436145a41c
Change-Id: I5a93462a23bf3c9f22fc3de0b173763a9bc8d526 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1591 Tested-by: BuildkiteCI Reviewed-by: edef <edef@edef.eu>
36 lines
712 B
Nix
36 lines
712 B
Nix
{ lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
inherit (lib)
|
|
lowerChars
|
|
replaceStrings
|
|
upperChars
|
|
;
|
|
|
|
caseFold = replaceStrings upperChars (map (c: "!" + c) lowerChars);
|
|
|
|
in
|
|
|
|
{ path, version, sha256 }:
|
|
|
|
(pkgs.fetchurl {
|
|
name = "source";
|
|
url = "https://proxy.golang.org/${caseFold 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 ];
|
|
})
|