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:
edef 2020-08-03 02:06:11 +00:00
parent 4a7b7e35b2
commit 2ab7561ac9

View 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 ];
})