2020-08-03 12:51:28 +02:00
|
|
|
{ lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
inherit (lib)
|
|
|
|
lowerChars
|
|
|
|
replaceStrings
|
|
|
|
upperChars
|
|
|
|
;
|
|
|
|
|
|
|
|
caseFold = replaceStrings upperChars (map (c: "!" + c) lowerChars);
|
|
|
|
|
|
|
|
in
|
2020-08-03 04:06:11 +02:00
|
|
|
|
|
|
|
{ path, version, sha256 }:
|
|
|
|
|
2020-08-04 17:06:54 +02:00
|
|
|
pkgs.fetchurl {
|
2020-08-03 04:06:11 +02:00
|
|
|
name = "source";
|
2020-08-03 12:51:28 +02:00
|
|
|
url = "https://proxy.golang.org/${caseFold path}/@v/v${version}.zip";
|
2020-08-03 04:06:11 +02:00
|
|
|
inherit sha256;
|
|
|
|
|
|
|
|
recursiveHash = true;
|
|
|
|
downloadToTemp = true;
|
|
|
|
|
|
|
|
postFetch = ''
|
|
|
|
unpackDir="$TMPDIR/unpack"
|
|
|
|
mkdir "$unpackDir"
|
|
|
|
cd "$unpackDir"
|
|
|
|
|
|
|
|
mv "$downloadedFile" "$TMPDIR/src.zip"
|
2020-08-04 17:06:54 +02:00
|
|
|
${pkgs.unzip}/bin/unzip "$TMPDIR/src.zip" -d "$unpackDir"
|
2020-08-03 04:06:11 +02:00
|
|
|
mv "$unpackDir/${path}@v${version}" "$out"
|
|
|
|
'';
|
2020-08-04 17:06:54 +02:00
|
|
|
}
|