{ description = "C++ RmlUi-Shell dev shell (SDL3 + OpenGL, Wayland target)"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; rmlui = pkgs.stdenv.mkDerivation rec { pname = "rmlui"; version = "master"; src = pkgs.fetchFromGitHub { owner = "mikke89"; repo = "RmlUi"; rev = "master"; hash = "sha256-6SACAMsn3jrVlEs1ty08MywsXW8UlzDb+JrFnC8wA0M="; }; nativeBuildInputs = [ pkgs.cmake pkgs.pkg-config ]; buildInputs = [ pkgs.freetype pkgs.lunasvg pkgs.lua ]; cmakeFlags = [ "-DRMLUI_LUA_BINDINGS=ON" "-DRMLUI_LUA_BINDINGS_LIBRARY=lua" "-DRMLUI_SVG_PLUGIN=ON" "-DBUILD_SHARED_LIBS=ON" "-DBUILD_SAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DNO_FONT_INTERFACE_DEFAULT=OFF" ]; }; # Build tools required to actually compile the project buildTools = with pkgs; [ cmake pkg-config gcc ]; # Editor/LSP conveniences, devShell only; not part of any package build devTools = with pkgs; [ clang-tools lua-language-server superhtml vscode-css-languageserver ]; # Libraries linked into the final binary runtimeDeps = with pkgs; [ sdl3 sdl3-image libGL wayland wayland-protocols libxkbcommon rmlui freetype lunasvg lua ]; in { devShells.default = pkgs.mkShell { nativeBuildInputs = buildTools ++ devTools; buildInputs = runtimeDeps; shellHook = '' export CP_PATH="${rmlui}/include" export LIBRARY_PATH="${pkgs.libGL}/lib:${rmlui}/lib" export LD_LIBRARY_PATH="$LIBRARY_PATH:$LD_LIBRARY_PATH" echo "rmlshell dev environment ready (SDL3 / GL3 / Wayland)" ''; }; packages.default = pkgs.stdenv.mkDerivation { pname = "rmlshell"; version = "0.1.0"; src = ./.; nativeBuildInputs = buildTools ++ [ pkgs.makeWrapper ]; buildInputs = runtimeDeps; cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ]; postInstall = '' wrapProgram $out/bin/rmlshell \ --prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath runtimeDeps}" ''; }; } ); }