Skip to content
This repository has been archived by the owner on Aug 29, 2021. It is now read-only.

Commit

Permalink
feat: add go 1.14.13
Browse files Browse the repository at this point in the history
  • Loading branch information
samc committed Dec 31, 2020
1 parent d163200 commit f184208
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 34 deletions.
4 changes: 2 additions & 2 deletions packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ===

Expand Down
43 changes: 27 additions & 16 deletions pkgs/go/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -40,18 +42,22 @@ 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 {
inherit version;

pname = "go";


src = fetchurl {
inherit sha256;

url = "https://dl.google.com/go/go${version}.src.tar.gz";
};

Expand Down Expand Up @@ -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;

Expand All @@ -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
Expand All @@ -210,16 +216,19 @@ 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
'';

postBuild = ''
(cd src && ./make.bash)
'';

doCheck = stdenv.hostPlatform == stdenv.targetPlatform && !stdenv.isDarwin;
doCheck = false;

checkPhase = ''
runHook preCheck
Expand Down Expand Up @@ -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;
};
}
}
4 changes: 2 additions & 2 deletions pkgs/go/versions/1.14.2.nix → pkgs/go/versions/1.14.13.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ let
});
in
build {
version = "1.14.2";
sha256 = "0z3zxsnhmsxplnwfw1l9gr6jgglwp50sr3p5njknv9i6jzk89plq";
version = "1.14.13";
sha256 = "0xxins5crcgghgvnzplmp0qyv2gbmh36v1fpl15d03jwdd6287ds";
}
14 changes: 0 additions & 14 deletions pkgs/go/versions/1.14.4.nix

This file was deleted.

0 comments on commit f184208

Please sign in to comment.