1 { lib, stdenv, fetchurl, version, hashes, autoPatchelfHook }:
4 if platform.isDarwin then "darwin"
5 else platform.parsed.kernel.name;
13 "powerpc64le" = "ppc64le";
14 "riscv64" = "riscv64";
15 }.${platform.parsed.cpu.name} or (throw "Unsupported CPU ${platform.parsed.cpu.name}");
17 toGoPlatform = platform: "${toGoKernel platform}-${toGoCPU platform}";
19 platform = toGoPlatform stdenv.hostPlatform;
21 stdenv.mkDerivation rec {
22 name = "go-${version}-${platform}-bootstrap";
25 url = "https://go.dev/dl/go${version}.${platform}.tar.gz";
26 sha256 = hashes.${platform} or (throw "Missing Go bootstrap hash for platform ${platform}");
29 nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
31 # We must preserve the signature on Darwin
32 dontStrip = stdenv.hostPlatform.isDarwin;
36 mkdir -p $out/share/go $out/bin
38 ln -s $out/share/go/bin/go $out/bin/go