feat(edef/fetchGoModule): init
Change-Id: I160a4264b9ade35d7cfcc1609ab395eab164d4d8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1586 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi>
This commit is contained in:
parent
4a7b7e35b2
commit
2ab7561ac9
1 changed files with 24 additions and 0 deletions
24
users/edef/fetchGoModule.nix
Normal file
24
users/edef/fetchGoModule.nix
Normal file
|
@ -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 ];
|
||||
})
|
Loading…
Reference in a new issue