diff --git a/build.zig.zon.nix b/build.zig.zon.nix index bfc6dd1..07bf9d7 100644 --- a/build.zig.zon.nix +++ b/build.zig.zon.nix @@ -101,9 +101,11 @@ runCommandLocal name export -f unpack # Several at a time: `zig fetch` spends most of a package on one core. + # `-r` because otherwise xargs runs `unpack` once, with no arguments, when + # there are no packages at all, and the build fails. cores="''${NIX_BUILD_CORES:-0}" if [ "$cores" -le 0 ]; then cores="$(nproc)"; fi - xargs -P "$cores" -n 2 bash -c 'unpack "$@"' unpack <<'EOF' + xargs -r -P "$cores" -n 2 bash -c 'unpack "$@"' unpack <<'EOF' ${lib.concatStrings (lib.mapAttrsToList (hash: src: "${hash} ${src}\n") packages)} EOF '' diff --git a/flake.lock b/flake.lock index 24047b0..8d43c04 100644 --- a/flake.lock +++ b/flake.lock @@ -49,11 +49,11 @@ "zig": "zig" }, "locked": { - "lastModified": 1790983378, - "narHash": "sha256-RB1SiCcumk7Y9NkBKJDq/Hg0NLyCmX/TX02EXp7QRco=", + "lastModified": 1791143591, + "narHash": "sha256-Z0jYkEqGgWoovZWSvQqwUDXzUn79QcG1ybpJG8fMQk0=", "owner": "jcollie", "repo": "zon2nix", - "rev": "d1c869946e98c380ff474c6bd30e2fe2f5110473", + "rev": "d5a6545496dfb17878fe23d026e0a880ee9e12c9", "type": "github" }, "original": { diff --git a/package.nix b/package.nix index bc5cc6f..7453adf 100644 --- a/package.nix +++ b/package.nix @@ -5,25 +5,12 @@ lib, stdenv, callPackage, - runCommandLocal, zig_0_17, }: let # Generated by zon2nix from build.zig.zon; regenerate with: # nix develop -c zon2nix --17 --nix=build.zig.zon.nix build.zig.zon - # - # The expression zon2nix writes for Zig 0.17 feeds the package list to - # `xargs` without `--no-run-if-empty`, and GNU xargs runs its command - # once even when given nothing -- so with no dependencies at all, which - # is this project, it runs `zig fetch ""` and fails. Rather than edit a - # generated file, hand it a runCommandLocal that adds the flag. Once - # zon2nix emits `xargs -r` itself the substitution matches nothing and - # this can go. - zigDeps = callPackage ./build.zig.zon.nix { - runCommandLocal = - name: env: script: - runCommandLocal name env (builtins.replaceStrings [ "xargs -P" ] [ "xargs -r -P" ] script); - }; + zigDeps = callPackage ./build.zig.zon.nix { }; in stdenv.mkDerivation (finalAttrs: { pname = "zig-dmarc";