blob: 84794bbc50c7e9466ec97b302fff4a2e37a7930c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
{ 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"
${pkgs.unzip}/bin/unzip "$downloadedFile" -d "$unpackDir"
mv "$unpackDir/${path}@v${version}" "$out"
'';
}
|