summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorWael Nasreddine <wael.nasreddine@gmail.com>2019-12-08 11:23:45 -0800
committerGitHub <noreply@github.com>2019-12-08 11:23:45 -0800
commitb0db7c4f7be1aeed3e707a6176f7ce2a895d2a3e (patch)
treeda506ec73745b6d8a90e2336ae0c1ab09e5f2699 /pkgs/development
parent69b393ace512f7d08e31ff2b02b015d39f49fcdf (diff)
parent051bc353d06c86602f9af078cae4d839b819ca23 (diff)
downloadnixpkgs-b0db7c4f7be1aeed3e707a6176f7ce2a895d2a3e.tar
nixpkgs-b0db7c4f7be1aeed3e707a6176f7ce2a895d2a3e.tar.gz
nixpkgs-b0db7c4f7be1aeed3e707a6176f7ce2a895d2a3e.tar.bz2
nixpkgs-b0db7c4f7be1aeed3e707a6176f7ce2a895d2a3e.tar.lz
nixpkgs-b0db7c4f7be1aeed3e707a6176f7ce2a895d2a3e.tar.xz
nixpkgs-b0db7c4f7be1aeed3e707a6176f7ce2a895d2a3e.tar.zst
nixpkgs-b0db7c4f7be1aeed3e707a6176f7ce2a895d2a3e.zip
Merge pull request #75013 from fmpwizard/issue_54603
go: do not replace path to zoneinfo.zip and mime.types
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/go/1.13.nix9
-rw-r--r--pkgs/development/compilers/go/1.4.nix4
2 files changed, 9 insertions, 4 deletions
diff --git a/pkgs/development/compilers/go/1.13.nix b/pkgs/development/compilers/go/1.13.nix
index 9e8a6601724..4354529a58c 100644
--- a/pkgs/development/compilers/go/1.13.nix
+++ b/pkgs/development/compilers/go/1.13.nix
@@ -57,8 +57,8 @@ stdenv.mkDerivation rec {
       --replace '#!/usr/bin/env bash' '#!${runtimeShell}'
 
     # Patch the mimetype database location which is missing on NixOS.
-    substituteInPlace src/mime/type_unix.go \
-      --replace '/etc/mime.types' '${mailcap}/etc/mime.types'
+    # but also allow static binaries built with NixOS to run outside nix
+    sed -i 's,\"/etc/mime.types,"${mailcap}/etc/mime.types\"\,\n\t&,' src/mime/type_unix.go
 
     # Disabling the 'os/http/net' tests (they want files not available in
     # chroot builds)
@@ -97,7 +97,10 @@ stdenv.mkDerivation rec {
     rm src/net/cgo_unix_test.go
 
   '' + optionalString stdenv.isLinux ''
-    sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go
+    # 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 ''
     echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
   '' + optionalString stdenv.isDarwin ''
diff --git a/pkgs/development/compilers/go/1.4.nix b/pkgs/development/compilers/go/1.4.nix
index 1052f1f1ae1..0dd852a1ef1 100644
--- a/pkgs/development/compilers/go/1.4.nix
+++ b/pkgs/development/compilers/go/1.4.nix
@@ -61,7 +61,9 @@ stdenv.mkDerivation rec {
 
     sed -i 's,/etc/protocols,${iana-etc}/etc/protocols,' src/net/lookup_unix.go
   '' + lib.optionalString stdenv.isLinux ''
-    sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go
+    # 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
 
     # Find the loader dynamically
     LOADER="$(find ${lib.getLib libc}/lib -name ld-linux\* | head -n 1)"