Something went wrong. Try again.
The agentic engineering control plane for the posthuman future
Something went wrong. Try again.
xenomorphic flake.nix
5.5 kB · 122 lines
Nix
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123{ description = "Xenomorphic Qt6 QtQuick + QWindowKit application";
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; };
outputs = { self, nixpkgs }: let systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs systems;
# The pinned dependency sources come from app/cmake-content.json (via # app/deps.nix), which is also what CMake reads. Nothing here repeats a # repository or a revision. qwindowkitPackage = { lib, stdenv, cmake, ninja, qt6, fetchgit, zig_0_16 }: let deps = import ./app/deps.nix { inherit lib stdenv fetchgit zig_0_16; }; in stdenv.mkDerivation { pname = "qwindowkit"; version = "1.5.0";
src = deps.sources.QWindowKit;
nativeBuildInputs = [ cmake ninja qt6.wrapQtAppsHook ]; buildInputs = [ qt6.qtbase qt6.qtdeclarative ]; cmakeFlags = [ # Nix sets CMAKE_INSTALL_LIBDIR to an absolute store path, which breaks # qwindowkit's in-place qmsetup submodule config (find_package(qmsetup)). "-DCMAKE_INSTALL_LIBDIR=lib" "-DQWINDOWKIT_BUILD_QUICK=ON" # Static, to match app/cmake/Dependencies.cmake: the app links # QWindowKit in, so nothing needs a shared QWindowKit at run time. "-DQWINDOWKIT_BUILD_STATIC=ON" "-DQWINDOWKIT_BUILD_WIDGETS=OFF" "-DQWINDOWKIT_BUILD_EXAMPLES=OFF" "-DQWINDOWKIT_BUILD_TESTS=OFF" "-DQWINDOWKIT_BUILD_DOCUMENTATIONS=OFF" ]; }; in { packages = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; # app.nix and check.nix import app/deps.nix with this same stdenv, so the # three agree on one fixed-output path for the zig cache. deps = import ./app/deps.nix { inherit (pkgs) lib fetchgit zig_0_16; stdenv = pkgs.llvmPackages_21.stdenv; }; in { # Exposed so `nix build .#ghosttyZigCache` reports the hash to record in # app/cmake-content.json after a ghostty rev bump. ghosttyZigCache = deps.ghosttyZigCache; qwindowkit = pkgs.callPackage qwindowkitPackage {}; default = pkgs.callPackage ./app.nix { qwindowkit = self.packages.${system}.qwindowkit; # Force Clang 21 as the C++ compiler for this project. stdenv = pkgs.llvmPackages_21.stdenv; }; });
checks = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; in { static-analysis = pkgs.callPackage ./check.nix { qwindowkit = self.packages.${system}.qwindowkit; stdenv = pkgs.llvmPackages_21.stdenv; llvmPackages = pkgs.llvmPackages_21; jq = pkgs.jq; }; });
devShells = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; # gdb is unsupported/broken on darwin; use the system lldb there. dbg = if pkgs.stdenv.isDarwin then [] else [ pkgs.gdb ]; # Pin mkShell's stdenv so the shell's default compiler (cc/clang) is # Clang 21, matching the project build and the check.nix static- # analysis gate. The stdenv also drives clangd's --query-driver # resolution, keeping the LSP on the build's exact toolchain. mkShell = pkgs.mkShell.override { stdenv = pkgs.llvmPackages_21.stdenv; }; in { default = mkShell { # Pulls in the project's own inputs, including zig (for ghostty) and, # on darwin, xcbuild/apple-sdk for the macOS SDK that zig probes for. inputsFrom = [ self.packages.${system}.default ]; # nativeBuildInputs (the `packages` slot) precede the stdenv's # compiler dirs on PATH. clang-tools must win PATH so its wrapped, # resource-header-bearing clangd/clang-tidy/clang-format are used # instead of the raw, header-less copies in the plain `clang` pkg. nativeBuildInputs = [ pkgs.llvmPackages_21.clang-tools # Qt language server (qmlls): QML diagnostics without a build. # qt6.qtdeclarative's default output already ships bin/qmlls. pkgs.qt6.qtdeclarative # ghostty's CMake wrapper shells out to `zig build -Demit-lib-vt`. pkgs.zig_0_16 ]; buildInputs = with pkgs; [ cmake ninja makeWrapper # The C++ compiler (cc/clang/clang++) comes from the pinned stdenv, # not the `clang` package; the `clang` pkg only re-exports raw, # toolchain-incomplete binaries and must not be on PATH. ] ++ dbg; # The first configure clones ghostty into build/_deps at the revision # in app/cmake-content.json, so the shell needs no ghostty environment. # # The dev-shell binary is unwrapped (no wrap-qt-apps-hook), so Qt # cannot find its QML modules or plugins from the build tree alone. # Export the same import/plugin paths the packaged-wrapper sets so # `./build/bin/xenomorphic` runs directly. These use the exact store # dirs of the qtbase/qtdeclarative inputs. shellHook = '' export QT_PLUGIN_PATH="${pkgs.qt6.qtbase}/lib/qt-6/plugins:${pkgs.qt6.qtdeclarative}/lib/qt-6/plugins" export NIXPKGS_QT6_QML_IMPORT_PATH="${pkgs.qt6.qtdeclarative}/lib/qt-6/qml" ''; }; }); };}