at 25.11-pre 39 lines 1.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 version, 6 hashes, 7}: 8let 9 platform = with stdenv.hostPlatform.go; "${GOOS}-${if GOARCH == "arm" then "armv6l" else GOARCH}"; 10in 11stdenv.mkDerivation { 12 name = "go-${version}-${platform}-bootstrap"; 13 14 src = fetchurl { 15 url = "https://go.dev/dl/go${version}.${platform}.tar.gz"; 16 sha256 = hashes.${platform} or (throw "Missing Go bootstrap hash for platform ${platform}"); 17 }; 18 19 # We must preserve the signature on Darwin 20 dontStrip = stdenv.hostPlatform.isDarwin; 21 22 installPhase = '' 23 runHook preInstall 24 mkdir -p $out/share/go $out/bin 25 cp -r . $out/share/go 26 ln -s $out/share/go/bin/go $out/bin/go 27 runHook postInstall 28 ''; 29 30 meta = { 31 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 32 changelog = "https://go.dev/doc/devel/release#go${lib.versions.majorMinor version}"; 33 description = "The Go Programming language"; 34 homepage = "https://go.dev/"; 35 license = lib.licenses.bsd3; 36 teams = [ lib.teams.golang ]; 37 platforms = lib.platforms.darwin ++ lib.platforms.linux; 38 }; 39}