RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process
nix: fetch Zig dependencies with nixpkgs' zig.fetchDeps
oxydizer53bf3ee23bcd
diff --git a/docs/nix.md b/docs/nix.mdindex 03c0a87..d28e60b 100644--- a/docs/nix.md+++ b/docs/nix.md@@ -74,8 +74,8 @@ of `scripts/make-release.sh`; Nix packages do not need a distro tarball.Real display-manager login, unlock, Xwayland and browser screen sharing stillneed a NixOS session acceptance check.-When changing `build.zig.zon` dependencies, set `outputHash` in-`nix/zig-deps.nix` to `lib.fakeHash` (and add `lib` to its arguments), build+When changing `build.zig.zon` dependencies, set the `zigDeps` hash in+`nix/package.nix` (nixpkgs' `zig.fetchDeps`) to `""`, build`nix build .#rediwm.zigDeps`, then replace it with the reported actual hash.Keep `nix/wlroots.nix` aligned with `scripts/build-wlroots.sh` and the patchesin `patches/wlroots/`. Update Nixpkgs deliberately withdiff --git a/nix/package.nix b/nix/package.nixindex 5209577..7a160c9 100644--- a/nix/package.nix+++ b/nix/package.nix@@ -53,9 +53,6 @@letwlroots = callPackage ./wlroots.nix { };- zigDeps = callPackage ./zig-deps.nix { };-in-stdenv.mkDerivation {pname = "rediwm";version = builtins.head (builtins.match ''.*\.version = "([^"]+)".*'' (builtins.readFile ../build.zig.zon)@@ -77,6 +74,16 @@ stdenv.mkDerivation {../LICENSE-APACHE];};+ # Only this fixed-output fetch may access the network; the build gets the+ # verified package cache and runs offline. Using nixpkgs' zig.fetchDeps+ # rather than our own derivation was suggested by SpaceboyRoss.+ zigDeps = zig_0_17.fetchDeps {+ inherit pname version src;+ hash = "sha256-R5Eg4CG+DW/pgg1zU+4Y2Ov1LCY3ReJordmBQGxkiyc=";+ };+in+stdenv.mkDerivation {+ inherit pname version src;strictDeps = true;nativeBuildInputs = [@@ -147,7 +154,7 @@ stdenv.mkDerivation {runHook preConfigureexport ZIG_GLOBAL_CACHE_DIR="$TMPDIR/zig-cache"mkdir -p "$ZIG_GLOBAL_CACHE_DIR"- cp -R ${zigDeps}/p "$ZIG_GLOBAL_CACHE_DIR/p"+ cp -R ${zigDeps} "$ZIG_GLOBAL_CACHE_DIR/p"chmod -R u+w "$ZIG_GLOBAL_CACHE_DIR"runHook postConfigure'';diff --git a/nix/zig-deps.nix b/nix/zig-deps.nixdeleted file mode 100644index fcbf03b..0000000--- a/nix/zig-deps.nix+++ /dev/null@@ -1,32 +0,0 @@-{- stdenvNoCC,- zig_0_17,- cacert,-}:--# Only this fixed-output fetch may access the network. The actual build-# receives the verified package cache and runs completely offline.-stdenvNoCC.mkDerivation {- pname = "rediwm-zig-deps";- version = "1";- src = ../build.zig.zon;- dontUnpack = true;- nativeBuildInputs = [- zig_0_17- cacert- ];- dontConfigure = true;- dontInstall = true;- dontFixup = true;- buildPhase = ''- export ZIG_GLOBAL_CACHE_DIR="$TMPDIR/zig-cache"- cp "$src" build.zig.zon- touch build.zig- zig build --fetch- mkdir -p "$out"- cp -R "$ZIG_GLOBAL_CACHE_DIR/p" "$out/p"- '';- outputHashMode = "recursive";- outputHashAlgo = "sha256";- outputHash = "sha256-Bm0/CoGiYtscJWFCDKVEiUmA59n9PATonIuEjOBr3GM=";-}