From 43a526d41dbd29810f5e16ca38f2ff540f8e6454 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Fri, 4 Jun 2021 14:33:26 +1000 Subject: [PATCH 1/5] go: add runHooks to bootstrap binary (cherry picked from commit 99697d891de658a5b6ea4bd4ea5ef9acfb62ea13) --- pkgs/development/compilers/go/binary.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/go/binary.nix b/pkgs/development/compilers/go/binary.nix index 7eb8f8f7b98..a2fff4f6d07 100644 --- a/pkgs/development/compilers/go/binary.nix +++ b/pkgs/development/compilers/go/binary.nix @@ -29,6 +29,7 @@ stdenv.mkDerivation rec { dontStrip = stdenv.hostPlatform.isDarwin; installPhase = '' + runHook preInstall mkdir -p $out/share/go $out/bin mv bin/* $out/bin cp -r . $out/share/go @@ -37,5 +38,6 @@ stdenv.mkDerivation rec { --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ $out/bin/go '')} - '' ; + runHook postInstall + ''; } From 46fc5b82ea36b8560b2cf8b7992fa28e50d0d1b9 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Fri, 4 Jun 2021 13:18:06 +1000 Subject: [PATCH 2/5] go: format with nixpkgs-fmt (cherry picked from commit 3a365e0e506068ff30a261b486942a199312dc76) --- pkgs/development/compilers/go/1.14.nix | 32 +++++++++++++++++------ pkgs/development/compilers/go/1.15.nix | 32 +++++++++++++++++------ pkgs/development/compilers/go/1.16.nix | 33 ++++++++++++++++++------ pkgs/development/compilers/go/2-dev.nix | 34 +++++++++++++++++++------ 4 files changed, 99 insertions(+), 32 deletions(-) diff --git a/pkgs/development/compilers/go/1.14.nix b/pkgs/development/compilers/go/1.14.nix index 92c1cbdfc18..f1b52ff1e59 100644 --- a/pkgs/development/compilers/go/1.14.nix +++ b/pkgs/development/compilers/go/1.14.nix @@ -1,6 +1,20 @@ -{ lib, stdenv, fetchurl, tzdata, iana-etc, runCommand -, perl, which, pkg-config, patch, procps, pcre, cacert, Security, Foundation -, mailcap, runtimeShell +{ lib +, stdenv +, fetchurl +, tzdata +, iana-etc +, runCommand +, perl +, which +, pkg-config +, patch +, procps +, pcre +, cacert +, Security +, Foundation +, mailcap +, runtimeShell , buildPackages , pkgsBuildTarget , fetchpatch @@ -15,7 +29,7 @@ let go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; - goBootstrap = runCommand "go-bootstrap" {} '' + goBootstrap = runCommand "go-bootstrap" { } '' mkdir $out cp -rf ${go_bootstrap}/* $out/ chmod -R u+w $out @@ -183,16 +197,18 @@ stdenv.mkDerivation rec { # {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those # to be different from CC/CXX - CC_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then + CC_FOR_TARGET = + if (stdenv.buildPlatform != stdenv.targetPlatform) then "${targetCC}/bin/${targetCC.targetPrefix}cc" else null; - CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then + CXX_FOR_TARGET = + if (stdenv.buildPlatform != stdenv.targetPlatform) then "${targetCC}/bin/${targetCC.targetPrefix}c++" else null; - GOARM = toString (lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]); + GOARM = toString (lib.intersectLists [ (stdenv.hostPlatform.parsed.cpu.version or "") ] [ "5" "6" "7" ]); GO386 = 387; # from Arch: don't assume sse2 on i686 CGO_ENABLED = 1; # Hopefully avoids test timeouts on Hydra @@ -202,7 +218,7 @@ stdenv.mkDerivation rec { # Some tests assume things like home directories and users exists GO_BUILDER_NAME = "nix"; - GOROOT_BOOTSTRAP="${goBootstrap}/share/go"; + GOROOT_BOOTSTRAP = "${goBootstrap}/share/go"; postConfigure = '' export GOCACHE=$TMPDIR/go-cache diff --git a/pkgs/development/compilers/go/1.15.nix b/pkgs/development/compilers/go/1.15.nix index 61285cd1b4e..34aea01192e 100644 --- a/pkgs/development/compilers/go/1.15.nix +++ b/pkgs/development/compilers/go/1.15.nix @@ -1,6 +1,20 @@ -{ lib, stdenv, fetchurl, tzdata, iana-etc, runCommand -, perl, which, pkg-config, patch, procps, pcre, cacert, Security, Foundation -, mailcap, runtimeShell +{ lib +, stdenv +, fetchurl +, tzdata +, iana-etc +, runCommand +, perl +, which +, pkg-config +, patch +, procps +, pcre +, cacert +, Security +, Foundation +, mailcap +, runtimeShell , buildPackages , pkgsBuildTarget , fetchpatch @@ -15,7 +29,7 @@ let go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; - goBootstrap = runCommand "go-bootstrap" {} '' + goBootstrap = runCommand "go-bootstrap" { } '' mkdir $out cp -rf ${go_bootstrap}/* $out/ chmod -R u+w $out @@ -186,16 +200,18 @@ stdenv.mkDerivation rec { # {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those # to be different from CC/CXX - CC_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then + CC_FOR_TARGET = + if (stdenv.buildPlatform != stdenv.targetPlatform) then "${targetCC}/bin/${targetCC.targetPrefix}cc" else null; - CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then + CXX_FOR_TARGET = + if (stdenv.buildPlatform != stdenv.targetPlatform) then "${targetCC}/bin/${targetCC.targetPrefix}c++" else null; - GOARM = toString (lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]); + GOARM = toString (lib.intersectLists [ (stdenv.hostPlatform.parsed.cpu.version or "") ] [ "5" "6" "7" ]); GO386 = 387; # from Arch: don't assume sse2 on i686 CGO_ENABLED = 1; # Hopefully avoids test timeouts on Hydra @@ -205,7 +221,7 @@ stdenv.mkDerivation rec { # Some tests assume things like home directories and users exists GO_BUILDER_NAME = "nix"; - GOROOT_BOOTSTRAP="${goBootstrap}/share/go"; + GOROOT_BOOTSTRAP = "${goBootstrap}/share/go"; postConfigure = '' export GOCACHE=$TMPDIR/go-cache diff --git a/pkgs/development/compilers/go/1.16.nix b/pkgs/development/compilers/go/1.16.nix index 93c9fa5c778..0b8341d816b 100644 --- a/pkgs/development/compilers/go/1.16.nix +++ b/pkgs/development/compilers/go/1.16.nix @@ -1,6 +1,21 @@ -{ lib, stdenv, fetchurl, tzdata, iana-etc, runCommand -, perl, which, pkg-config, patch, procps, pcre, cacert, Security, Foundation, xcbuild -, mailcap, runtimeShell +{ lib +, stdenv +, fetchurl +, tzdata +, iana-etc +, runCommand +, perl +, which +, pkg-config +, patch +, procps +, pcre +, cacert +, Security +, Foundation +, xcbuild +, mailcap +, runtimeShell , buildPackages , pkgsBuildTarget , fetchpatch @@ -15,7 +30,7 @@ let go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; - goBootstrap = runCommand "go-bootstrap" {} '' + goBootstrap = runCommand "go-bootstrap" { } '' mkdir $out cp -rf ${go_bootstrap}/* $out/ chmod -R u+w $out @@ -181,16 +196,18 @@ stdenv.mkDerivation rec { # {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those # to be different from CC/CXX - CC_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then + CC_FOR_TARGET = + if (stdenv.buildPlatform != stdenv.targetPlatform) then "${targetCC}/bin/${targetCC.targetPrefix}cc" else null; - CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then + CXX_FOR_TARGET = + if (stdenv.buildPlatform != stdenv.targetPlatform) then "${targetCC}/bin/${targetCC.targetPrefix}c++" else null; - GOARM = toString (lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]); + GOARM = toString (lib.intersectLists [ (stdenv.hostPlatform.parsed.cpu.version or "") ] [ "5" "6" "7" ]); GO386 = "softfloat"; # from Arch: don't assume sse2 on i686 CGO_ENABLED = 1; # Hopefully avoids test timeouts on Hydra @@ -200,7 +217,7 @@ stdenv.mkDerivation rec { # Some tests assume things like home directories and users exists GO_BUILDER_NAME = "nix"; - GOROOT_BOOTSTRAP="${goBootstrap}/share/go"; + GOROOT_BOOTSTRAP = "${goBootstrap}/share/go"; postConfigure = '' export GOCACHE=$TMPDIR/go-cache diff --git a/pkgs/development/compilers/go/2-dev.nix b/pkgs/development/compilers/go/2-dev.nix index 4b541e8990e..ec4ac103749 100644 --- a/pkgs/development/compilers/go/2-dev.nix +++ b/pkgs/development/compilers/go/2-dev.nix @@ -1,6 +1,22 @@ -{ pkgs, lib, stdenv, fetchurl, fetchgit, tzdata, iana-etc, runCommand -, perl, which, pkg-config, patch, procps, pcre, cacert, Security, Foundation -, mailcap, runtimeShell +{ pkgs +, lib +, stdenv +, fetchurl +, fetchgit +, tzdata +, iana-etc +, runCommand +, perl +, which +, pkg-config +, patch +, procps +, pcre +, cacert +, Security +, Foundation +, mailcap +, runtimeShell , buildPackages , pkgsBuildTarget , fetchpatch @@ -13,7 +29,7 @@ let go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; - goBootstrap = runCommand "go-bootstrap" {} '' + goBootstrap = runCommand "go-bootstrap" { } '' mkdir $out cp -rf ${go_bootstrap}/* $out/ chmod -R u+w $out @@ -178,16 +194,18 @@ stdenv.mkDerivation rec { # {CC,CXX}_FOR_TARGET must be only set for cross compilation case as go expect those # to be different from CC/CXX - CC_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then + CC_FOR_TARGET = + if (stdenv.buildPlatform != stdenv.targetPlatform) then "${targetCC}/bin/${targetCC.targetPrefix}cc" else null; - CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then + CXX_FOR_TARGET = + if (stdenv.buildPlatform != stdenv.targetPlatform) then "${targetCC}/bin/${targetCC.targetPrefix}c++" else null; - GOARM = toString (lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]); + GOARM = toString (lib.intersectLists [ (stdenv.hostPlatform.parsed.cpu.version or "") ] [ "5" "6" "7" ]); GO386 = "softfloat"; # from Arch: don't assume sse2 on i686 CGO_ENABLED = 1; # Hopefully avoids test timeouts on Hydra @@ -197,7 +215,7 @@ stdenv.mkDerivation rec { # Some tests assume things like home directories and users exists GO_BUILDER_NAME = "nix"; - GOROOT_BOOTSTRAP="${goBootstrap}/share/go"; + GOROOT_BOOTSTRAP = "${goBootstrap}/share/go"; postConfigure = '' export GOCACHE=$TMPDIR/go-cache From 8f3ec9ee43e8b53c314a27f70f766bd29fddd211 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Fri, 4 Jun 2021 13:52:04 +1000 Subject: [PATCH 3/5] go: cleanup (cherry picked from commit 88f1ca731cd772843c05a3395ae4eb283b1ef98d) --- pkgs/development/compilers/go/1.14.nix | 25 +++++++++------------- pkgs/development/compilers/go/1.15.nix | 25 +++++++++------------- pkgs/development/compilers/go/1.16.nix | 28 ++++++++++--------------- pkgs/development/compilers/go/2-dev.nix | 28 ++++++++++--------------- 4 files changed, 42 insertions(+), 64 deletions(-) diff --git a/pkgs/development/compilers/go/1.14.nix b/pkgs/development/compilers/go/1.14.nix index f1b52ff1e59..e8a90ac0b8d 100644 --- a/pkgs/development/compilers/go/1.14.nix +++ b/pkgs/development/compilers/go/1.14.nix @@ -22,11 +22,6 @@ }: let - - inherit (lib) optionals optionalString; - - version = "1.14.15"; - go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; goBootstrap = runCommand "go-bootstrap" { } '' @@ -55,7 +50,7 @@ in stdenv.mkDerivation rec { pname = "go"; - inherit version; + version = "1.14.15"; src = fetchurl { url = "https://dl.google.com/go/go${version}.src.tar.gz"; @@ -65,10 +60,10 @@ stdenv.mkDerivation rec { # perl is used for testing go vet nativeBuildInputs = [ perl which pkg-config patch procps ]; buildInputs = [ cacert pcre ] - ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ] - ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; + ++ lib.optionals stdenv.isLinux [ stdenv.cc.libc.out ] + ++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; - depsTargetTargetPropagated = optionals stdenv.isDarwin [ Security Foundation ]; + depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ]; hardeningDisable = [ "all" ]; @@ -120,14 +115,14 @@ stdenv.mkDerivation rec { # Disable cgo lookup tests not works, they depend on resolver rm src/net/cgo_unix_test.go - '' + optionalString stdenv.isLinux '' + '' + lib.optionalString stdenv.isLinux '' # prepend the nix path to the zoneinfo files but also leave the original value for static binaries # that run outside a nix server sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go - '' + optionalString stdenv.isAarch32 '' + '' + lib.optionalString stdenv.isAarch32 '' echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash - '' + optionalString stdenv.isDarwin '' + '' + lib.optionalString stdenv.isDarwin '' substituteInPlace src/race.bash --replace \ "sysctl machdep.cpu.extfeatures | grep -qv EM64T" true sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go @@ -227,7 +222,7 @@ stdenv.mkDerivation rec { export PATH=$(pwd)/bin:$PATH - ${optionalString (stdenv.buildPlatform != stdenv.targetPlatform) '' + ${lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) '' # Independent from host/target, CC should produce code for the building system. # We only set it when cross-compiling. export CC=${buildPackages.stdenv.cc}/bin/cc @@ -255,12 +250,12 @@ stdenv.mkDerivation rec { '' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then '' mv bin/*_*/* bin rmdir bin/*_* - ${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' + ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} ''} '' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' rm -rf bin/*_* - ${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' + ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} ''} '' else ""); diff --git a/pkgs/development/compilers/go/1.15.nix b/pkgs/development/compilers/go/1.15.nix index 34aea01192e..4d63f7b971d 100644 --- a/pkgs/development/compilers/go/1.15.nix +++ b/pkgs/development/compilers/go/1.15.nix @@ -22,11 +22,6 @@ }: let - - inherit (lib) optionals optionalString; - - version = "1.15.13"; - go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; goBootstrap = runCommand "go-bootstrap" { } '' @@ -55,7 +50,7 @@ in stdenv.mkDerivation rec { pname = "go"; - inherit version; + version = "1.15.13"; src = fetchurl { url = "https://dl.google.com/go/go${version}.src.tar.gz"; @@ -65,10 +60,10 @@ stdenv.mkDerivation rec { # perl is used for testing go vet nativeBuildInputs = [ perl which pkg-config patch procps ]; buildInputs = [ cacert pcre ] - ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ] - ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; + ++ lib.optionals stdenv.isLinux [ stdenv.cc.libc.out ] + ++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; - depsTargetTargetPropagated = optionals stdenv.isDarwin [ Security Foundation ]; + depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ]; hardeningDisable = [ "all" ]; @@ -128,14 +123,14 @@ stdenv.mkDerivation rec { # Disable cgo lookup tests not works, they depend on resolver rm src/net/cgo_unix_test.go - '' + optionalString stdenv.isLinux '' + '' + lib.optionalString stdenv.isLinux '' # prepend the nix path to the zoneinfo files but also leave the original value for static binaries # that run outside a nix server sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go - '' + optionalString stdenv.isAarch32 '' + '' + lib.optionalString stdenv.isAarch32 '' echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash - '' + optionalString stdenv.isDarwin '' + '' + lib.optionalString stdenv.isDarwin '' substituteInPlace src/race.bash --replace \ "sysctl machdep.cpu.extfeatures | grep -qv EM64T" true sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go @@ -230,7 +225,7 @@ stdenv.mkDerivation rec { export PATH=$(pwd)/bin:$PATH - ${optionalString (stdenv.buildPlatform != stdenv.targetPlatform) '' + ${lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) '' # Independent from host/target, CC should produce code for the building system. # We only set it when cross-compiling. export CC=${buildPackages.stdenv.cc}/bin/cc @@ -258,12 +253,12 @@ stdenv.mkDerivation rec { '' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then '' mv bin/*_*/* bin rmdir bin/*_* - ${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' + ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} ''} '' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' rm -rf bin/*_* - ${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' + ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} ''} '' else ""); diff --git a/pkgs/development/compilers/go/1.16.nix b/pkgs/development/compilers/go/1.16.nix index 0b8341d816b..26cfb898ecf 100644 --- a/pkgs/development/compilers/go/1.16.nix +++ b/pkgs/development/compilers/go/1.16.nix @@ -18,16 +18,10 @@ , runtimeShell , buildPackages , pkgsBuildTarget -, fetchpatch , callPackage }: let - - inherit (lib) optionals optionalString; - - version = "1.16.5"; - go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; goBootstrap = runCommand "go-bootstrap" { } '' @@ -56,7 +50,7 @@ in stdenv.mkDerivation rec { pname = "go"; - inherit version; + version = "1.16.5"; src = fetchurl { url = "https://dl.google.com/go/go${version}.src.tar.gz"; @@ -66,12 +60,12 @@ stdenv.mkDerivation rec { # perl is used for testing go vet nativeBuildInputs = [ perl which pkg-config patch procps ]; buildInputs = [ cacert pcre ] - ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ] - ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; + ++ lib.optionals stdenv.isLinux [ stdenv.cc.libc.out ] + ++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; - propagatedBuildInputs = optionals stdenv.isDarwin [ xcbuild ]; + propagatedBuildInputs = lib.optionals stdenv.isDarwin [ xcbuild ]; - depsTargetTargetPropagated = optionals stdenv.isDarwin [ Security Foundation ]; + depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ]; hardeningDisable = [ "all" ]; @@ -131,14 +125,14 @@ stdenv.mkDerivation rec { # Disable cgo lookup tests not works, they depend on resolver rm src/net/cgo_unix_test.go - '' + optionalString stdenv.isLinux '' + '' + lib.optionalString stdenv.isLinux '' # prepend the nix path to the zoneinfo files but also leave the original value for static binaries # that run outside a nix server sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go - '' + optionalString stdenv.isAarch32 '' + '' + lib.optionalString stdenv.isAarch32 '' echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash - '' + optionalString stdenv.isDarwin '' + '' + lib.optionalString stdenv.isDarwin '' substituteInPlace src/race.bash --replace \ "sysctl machdep.cpu.extfeatures | grep -qv EM64T" true sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go @@ -226,7 +220,7 @@ stdenv.mkDerivation rec { export PATH=$(pwd)/bin:$PATH - ${optionalString (stdenv.buildPlatform != stdenv.targetPlatform) '' + ${lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) '' # Independent from host/target, CC should produce code for the building system. # We only set it when cross-compiling. export CC=${buildPackages.stdenv.cc}/bin/cc @@ -254,12 +248,12 @@ stdenv.mkDerivation rec { '' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then '' mv bin/*_*/* bin rmdir bin/*_* - ${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' + ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} ''} '' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' rm -rf bin/*_* - ${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' + ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} ''} '' else ""); diff --git a/pkgs/development/compilers/go/2-dev.nix b/pkgs/development/compilers/go/2-dev.nix index ec4ac103749..8fd0e2e6630 100644 --- a/pkgs/development/compilers/go/2-dev.nix +++ b/pkgs/development/compilers/go/2-dev.nix @@ -1,7 +1,5 @@ -{ pkgs -, lib +{ lib , stdenv -, fetchurl , fetchgit , tzdata , iana-etc @@ -19,14 +17,10 @@ , runtimeShell , buildPackages , pkgsBuildTarget -, fetchpatch , callPackage }: let - - inherit (lib) optionals optionalString; - go_bootstrap = buildPackages.callPackage ./bootstrap.nix { }; goBootstrap = runCommand "go-bootstrap" { } '' @@ -58,7 +52,7 @@ stdenv.mkDerivation rec { version = "2021-04-13"; src = fetchgit { - url = https://go.googlesource.com/go; + url = "https://go.googlesource.com/go"; rev = "9cd52cf2a93a958e8e001aea36886e7846c91f2f"; sha256 = "sha256:0hybm93y4i4j7bs86y7h73nc1wqnspkq75if7n1032zf9bs8sm96"; }; @@ -66,10 +60,10 @@ stdenv.mkDerivation rec { # perl is used for testing go vet nativeBuildInputs = [ perl which pkg-config patch procps ]; buildInputs = [ cacert pcre ] - ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ] - ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; + ++ lib.optionals stdenv.isLinux [ stdenv.cc.libc.out ] + ++ lib.optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; - depsTargetTargetPropagated = optionals stdenv.isDarwin [ Security Foundation ]; + depsTargetTargetPropagated = lib.optionals stdenv.isDarwin [ Security Foundation ]; hardeningDisable = [ "all" ]; @@ -130,14 +124,14 @@ stdenv.mkDerivation rec { # Disable cgo lookup tests not works, they depend on resolver rm src/net/cgo_unix_test.go - '' + optionalString stdenv.isLinux '' + '' + lib.optionalString stdenv.isLinux '' # prepend the nix path to the zoneinfo files but also leave the original value for static binaries # that run outside a nix server sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go - '' + optionalString stdenv.isAarch32 '' + '' + lib.optionalString stdenv.isAarch32 '' echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash - '' + optionalString stdenv.isDarwin '' + '' + lib.optionalString stdenv.isDarwin '' substituteInPlace src/race.bash --replace \ "sysctl machdep.cpu.extfeatures | grep -qv EM64T" true sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go @@ -224,7 +218,7 @@ stdenv.mkDerivation rec { export PATH=$(pwd)/bin:$PATH - ${optionalString (stdenv.buildPlatform != stdenv.targetPlatform) '' + ${lib.optionalString (stdenv.buildPlatform != stdenv.targetPlatform) '' # Independent from host/target, CC should produce code for the building system. # We only set it when cross-compiling. export CC=${buildPackages.stdenv.cc}/bin/cc @@ -252,12 +246,12 @@ stdenv.mkDerivation rec { '' + (if (stdenv.buildPlatform != stdenv.hostPlatform) then '' mv bin/*_*/* bin rmdir bin/*_* - ${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' + ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOHOSTOS}_${GOHOSTARCH} pkg/tool/${GOHOSTOS}_${GOHOSTARCH} ''} '' else if (stdenv.hostPlatform != stdenv.targetPlatform) then '' rm -rf bin/*_* - ${optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' + ${lib.optionalString (!(GOHOSTARCH == GOARCH && GOOS == GOHOSTOS)) '' rm -rf pkg/${GOOS}_${GOARCH} pkg/tool/${GOOS}_${GOARCH} ''} '' else ""); From 11beeade2d9832eaba6cfceefa3edab60375de69 Mon Sep 17 00:00:00 2001 From: Maxine Aubrey Date: Tue, 13 Jul 2021 17:55:25 +0200 Subject: [PATCH 4/5] go_1_15: 1.15.13 -> 1.15.14 (cherry picked from commit 25eb6344d03d644084d9d3cb3c571f5664accf93) --- pkgs/development/compilers/go/1.15.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/go/1.15.nix b/pkgs/development/compilers/go/1.15.nix index 4d63f7b971d..40ac312a86a 100644 --- a/pkgs/development/compilers/go/1.15.nix +++ b/pkgs/development/compilers/go/1.15.nix @@ -50,11 +50,11 @@ in stdenv.mkDerivation rec { pname = "go"; - version = "1.15.13"; + version = "1.15.14"; src = fetchurl { url = "https://dl.google.com/go/go${version}.src.tar.gz"; - sha256 = "sha256-mQaeciNHnM5FU/hPh0uTRfb0BF8nz1CJSJtUbaYZokQ="; + sha256 = "sha256-YKSlxI1j0KE+yohJAJtiRin/QpyLxdGmqMPE2p805wo="; }; # perl is used for testing go vet From 3034d322a922c92137ddc7373dd608c56a96f29e Mon Sep 17 00:00:00 2001 From: Maxine Aubrey Date: Tue, 13 Jul 2021 17:55:35 +0200 Subject: [PATCH 5/5] go_1_16: 1.16.5 -> 1.16.6 (cherry picked from commit 4695639fdef6095c3b4358d55f5947235159d7e8) --- pkgs/development/compilers/go/1.16.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/go/1.16.nix b/pkgs/development/compilers/go/1.16.nix index 26cfb898ecf..f85d2bba907 100644 --- a/pkgs/development/compilers/go/1.16.nix +++ b/pkgs/development/compilers/go/1.16.nix @@ -50,11 +50,11 @@ in stdenv.mkDerivation rec { pname = "go"; - version = "1.16.5"; + version = "1.16.6"; src = fetchurl { url = "https://dl.google.com/go/go${version}.src.tar.gz"; - sha256 = "sha256-e/p+WQjHzJ512l3fMGbXy88/2fpRlFhRMl7rwX9QuoA="; + sha256 = "sha256-o6XUvEAbUdsGXk+TtSM0ek00OuDAsIplw0I7BaE4A30="; }; # perl is used for testing go vet