diff --git a/pkgs/development/compilers/zig/fetcher.nix b/pkgs/development/compilers/zig/fetcher.nix new file mode 100644 index 000000000000..abb8acaa0838 --- /dev/null +++ b/pkgs/development/compilers/zig/fetcher.nix @@ -0,0 +1,32 @@ +{ + lib, + zig, + runCommand, +}: +{ + pname, + version, + name ? "${pname}-${version}", + src, + hash ? lib.fakeHash, +}@args: +runCommand "${name}-zig-deps" + { + inherit (args) src; + + nativeBuildInputs = [ zig ]; + + outputHashAlgo = null; + outputHashMode = "recursive"; + outputHash = hash; + } + '' + export ZIG_GLOBAL_CACHE_DIR=$(mktemp -d) + + runHook unpackPhase + + cd $sourceRoot + zig build --fetch + + mv $ZIG_GLOBAL_CACHE_DIR/p $out + '' diff --git a/pkgs/development/compilers/zig/passthru.nix b/pkgs/development/compilers/zig/passthru.nix index cdd4d574a763..094142fbc16e 100644 --- a/pkgs/development/compilers/zig/passthru.nix +++ b/pkgs/development/compilers/zig/passthru.nix @@ -30,4 +30,6 @@ }; stdenv = overrideCC stdenv zig.cc; + + fetchDeps = callPackage ./fetcher.nix { inherit zig; }; }