diff options
Diffstat (limited to 'users/edef/fetchGoModule.nix')
-rw-r--r-- | users/edef/fetchGoModule.nix | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/users/edef/fetchGoModule.nix b/users/edef/fetchGoModule.nix new file mode 100644 index 000000000000..e49a5e3a1c5e --- /dev/null +++ b/users/edef/fetchGoModule.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: + +{ path, version, sha256 }: + +(pkgs.fetchurl { + name = "source"; + url = "https://proxy.golang.org/${path}/@v/v${version}.zip"; + inherit sha256; + + recursiveHash = true; + downloadToTemp = true; + + postFetch = '' + unpackDir="$TMPDIR/unpack" + mkdir "$unpackDir" + cd "$unpackDir" + + mv "$downloadedFile" "$TMPDIR/src.zip" + unpackFile "$TMPDIR/src.zip" + mv "$unpackDir/${path}@v${version}" "$out" + ''; +}).overrideAttrs ({ nativeBuildInputs ? [], ... }: { + nativeBuildInputs = nativeBuildInputs ++ [ pkgs.unzip ]; +}) |