tvl-depot/nix/fetchGoModule/default.nix
edef 8d6fcbe1a5 chore(nix/fetchGoModule): Move //users/edef/fetchGoModule to //nix
Change-Id: Ie7f52367ef91c0c8017a36c2a6c7edb06f10e57d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1589
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-08-03 10:29:18 +00:00

24 lines
548 B
Nix

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