From f184208c97f51fd3b3b613e2287535cee43d60a3 Mon Sep 17 00:00:00 2001 From: Sam Craig Date: Thu, 31 Dec 2020 12:24:55 -0500 Subject: [PATCH] feat: add go 1.14.13 --- packages.nix | 4 +- pkgs/go/default.nix | 43 ++++++++++++-------- pkgs/go/versions/{1.14.2.nix => 1.14.13.nix} | 4 +- pkgs/go/versions/1.14.4.nix | 14 ------- 4 files changed, 31 insertions(+), 34 deletions(-) rename pkgs/go/versions/{1.14.2.nix => 1.14.13.nix} (78%) delete mode 100644 pkgs/go/versions/1.14.4.nix diff --git a/packages.nix b/packages.nix index c0011ab..d087190 100644 --- a/packages.nix +++ b/packages.nix @@ -22,8 +22,8 @@ rec { # === go === - go = go_1_14_4; - go_1_14_4 = nixpkgs.pkgs.go_1_14; + go = go_1_14_13; + go_1_14_13 = package "go" "1.14.13" {}; # === golangci-lint === diff --git a/pkgs/go/default.nix b/pkgs/go/default.nix index 59f9198..0333d79 100644 --- a/pkgs/go/default.nix +++ b/pkgs/go/default.nix @@ -15,22 +15,24 @@ , mailcap , runtimeShell , buildPackages -, pkgsTargetTarget -, fetchpatch }: +, pkgsBuildTarget +, fetchpatch +}: { version , sha256 } @args: let + inherit (stdenv.lib) optionals optionalString; - # goBootstrap = runCommand "go-bootstrap" {} '' - # mkdir $out - # cp -rf ${buildPackages.go_bootstrap}/* $out/ - # chmod -R u+w $out - # find $out -name "*.c" -delete - # cp -rf $out/bin/* $out/share/go/bin/ - # ''; + goBootstrap = runCommand "go-bootstrap" {} '' + mkdir $out + cp -rf ${buildPackages.go_bootstrap}/* $out/ + chmod -R u+w $out + find $out -name "*.c" -delete + cp -rf $out/bin/* $out/share/go/bin/ + ''; goarch = platform: { "i686" = "386"; @@ -40,8 +42,12 @@ let "armv5tel" = "arm"; "armv6l" = "arm"; "armv7l" = "arm"; + "powerpc64le" = "ppc64le"; }.${platform.parsed.cpu.name} or (throw "Unsupported system"); + # We need a target compiler which is still runnable at build time, + # to handle the cross-building case where build != host == target + targetCC = pkgsBuildTarget.targetPackages.stdenv.cc; in stdenv.mkDerivation rec { @@ -49,9 +55,9 @@ stdenv.mkDerivation rec { pname = "go"; + src = fetchurl { inherit sha256; - url = "https://dl.google.com/go/go${version}.src.tar.gz"; }; @@ -183,11 +189,11 @@ 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 - "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}cc" + "${targetCC}/bin/${targetCC.targetPrefix}cc" else null; CXX_FOR_TARGET = if (stdenv.buildPlatform != stdenv.targetPlatform) then - "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}c++" + "${targetCC}/bin/${targetCC.targetPrefix}c++" else null; @@ -201,7 +207,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 @@ -210,8 +216,11 @@ stdenv.mkDerivation rec { export PATH=$(pwd)/bin:$PATH + ${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 + ''} ulimit -a ''; @@ -219,7 +228,7 @@ stdenv.mkDerivation rec { (cd src && ./make.bash) ''; - doCheck = stdenv.hostPlatform == stdenv.targetPlatform && !stdenv.isDarwin; + doCheck = false; checkPhase = '' runHook preCheck @@ -253,12 +262,14 @@ stdenv.mkDerivation rec { runHook postInstall ''; - # disallowedReferences = [ goBootstrap ]; + disallowedReferences = [ goBootstrap ]; meta = with stdenv.lib; { + branch = "1.14"; homepage = "http://golang.org/"; description = "The Go Programming language"; license = licenses.bsd3; + maintainers = teams.golang.members; platforms = platforms.linux ++ platforms.darwin; }; -} +} \ No newline at end of file diff --git a/pkgs/go/versions/1.14.2.nix b/pkgs/go/versions/1.14.13.nix similarity index 78% rename from pkgs/go/versions/1.14.2.nix rename to pkgs/go/versions/1.14.13.nix index 58e4d7b..ef4ab63 100644 --- a/pkgs/go/versions/1.14.2.nix +++ b/pkgs/go/versions/1.14.13.nix @@ -13,6 +13,6 @@ let }); in build { - version = "1.14.2"; - sha256 = "0z3zxsnhmsxplnwfw1l9gr6jgglwp50sr3p5njknv9i6jzk89plq"; + version = "1.14.13"; + sha256 = "0xxins5crcgghgvnzplmp0qyv2gbmh36v1fpl15d03jwdd6287ds"; } diff --git a/pkgs/go/versions/1.14.4.nix b/pkgs/go/versions/1.14.4.nix deleted file mode 100644 index 22a2db4..0000000 --- a/pkgs/go/versions/1.14.4.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ callPackage -, lib -, darwin -, gcc8Stdenv }: - -let - build = callPackage ../default.nix { - inherit (darwin.apple_sdk.frameworks) Security Foundation; - }; -in - build { - version = "1.14.4"; - sha256 = "1105qk2l4kfy1ki9n9gh8j4gfqrfgfwapa1fp38hih9aphxsy4bh"; - }