zig: add fetcher

This commit is contained in:
Tristan Ross 2025-06-06 11:26:38 -07:00
parent bac3beb820
commit 9a060b90c1
No known key found for this signature in database
GPG Key ID: B09C422035669AF8
2 changed files with 34 additions and 0 deletions

View File

@ -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
''

View File

@ -30,4 +30,6 @@
};
stdenv = overrideCC stdenv zig.cc;
fetchDeps = callPackage ./fetcher.nix { inherit zig; };
}