at master 1.6 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 = "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.freebsd ++ lib.platforms.linux; 38 badPlatforms = [ 39 # Support for big-endian POWER < 8 was dropped in 1.9, but POWER8 users have less of a reason to run in big-endian mode than pre-POWER8 ones 40 # So non-LE ppc64 is effectively unsupported, and Go SIGILLs on affordable ppc64 hardware 41 # https://github.com/golang/go/issues/19074 - Dropped support for big-endian POWER < 8, with community pushback 42 # https://github.com/golang/go/issues/73349 - upstream will not accept submissions to fix this 43 "powerpc64-linux" 44 ]; 45 }; 46}