go: convert seds to substitute patches
This commit is contained in:
parent
6285da30c0
commit
4fd2bcb0fe
|
@ -2,6 +2,7 @@
|
|||
, stdenv
|
||||
, fetchurl
|
||||
, tzdata
|
||||
, substituteAll
|
||||
, iana-etc
|
||||
, which
|
||||
, pkg-config
|
||||
|
@ -68,21 +69,26 @@ stdenv.mkDerivation rec {
|
|||
hardeningDisable = [ "all" ];
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs ./ # replace /bin/bash
|
||||
|
||||
# Patch the mimetype database location which is missing on NixOS.
|
||||
# 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
|
||||
|
||||
sed -i 's,/etc/protocols,${iana-etc}/etc/protocols,' src/net/lookup_unix.go
|
||||
sed -i 's,/etc/services,${iana-etc}/etc/services,' src/net/port_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
|
||||
patchShebangs .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./iana-etc-1.17.patch;
|
||||
iana = iana-etc;
|
||||
})
|
||||
# Patch the mimetype database location which is missing on NixOS.
|
||||
# but also allow static binaries built with NixOS to run outside nix
|
||||
(substituteAll {
|
||||
src = ./mailcap-1.17.patch;
|
||||
inherit mailcap;
|
||||
})
|
||||
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
||||
# that run outside a nix server
|
||||
(substituteAll {
|
||||
src = ./tzdata-1.17.patch;
|
||||
inherit tzdata;
|
||||
})
|
||||
./remove-tools-1.11.patch
|
||||
./ssl-cert-file-1.16.patch
|
||||
./go_no_vendor_checks-1.16.patch
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
, stdenv
|
||||
, fetchurl
|
||||
, tzdata
|
||||
, substituteAll
|
||||
, iana-etc
|
||||
, which
|
||||
, pkg-config
|
||||
|
@ -68,21 +69,26 @@ stdenv.mkDerivation rec {
|
|||
hardeningDisable = [ "all" ];
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs ./ # replace /bin/bash
|
||||
|
||||
# Patch the mimetype database location which is missing on NixOS.
|
||||
# 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
|
||||
|
||||
sed -i 's,/etc/protocols,${iana-etc}/etc/protocols,' src/net/lookup_unix.go
|
||||
sed -i 's,/etc/services,${iana-etc}/etc/services,' src/net/port_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
|
||||
patchShebangs .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./iana-etc-1.17.patch;
|
||||
iana = iana-etc;
|
||||
})
|
||||
# Patch the mimetype database location which is missing on NixOS.
|
||||
# but also allow static binaries built with NixOS to run outside nix
|
||||
(substituteAll {
|
||||
src = ./mailcap-1.17.patch;
|
||||
inherit mailcap;
|
||||
})
|
||||
# prepend the nix path to the zoneinfo files but also leave the original value for static binaries
|
||||
# that run outside a nix server
|
||||
(substituteAll {
|
||||
src = ./tzdata-1.19.patch;
|
||||
inherit tzdata;
|
||||
})
|
||||
./remove-tools-1.11.patch
|
||||
./ssl-cert-file-1.16.patch
|
||||
./go_no_vendor_checks-1.16.patch
|
||||
|
|
26
pkgs/development/compilers/go/iana-etc-1.17.patch
Normal file
26
pkgs/development/compilers/go/iana-etc-1.17.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
diff --git a/src/net/lookup_unix.go b/src/net/lookup_unix.go
|
||||
index 8030e3d99e..5a7472d933 100644
|
||||
--- a/src/net/lookup_unix.go
|
||||
+++ b/src/net/lookup_unix.go
|
||||
@@ -21,7 +21,7 @@ var onceReadProtocols sync.Once
|
||||
// readProtocols loads contents of /etc/protocols into protocols map
|
||||
// for quick access.
|
||||
func readProtocols() {
|
||||
- file, err := open("/etc/protocols")
|
||||
+ file, err := open("@iana@/etc/protocols")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
diff --git a/src/net/port_unix.go b/src/net/port_unix.go
|
||||
index a9a96a2323..0df6efe9e5 100644
|
||||
--- a/src/net/port_unix.go
|
||||
+++ b/src/net/port_unix.go
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
var onceReadServices sync.Once
|
||||
|
||||
func readServices() {
|
||||
- file, err := open("/etc/services")
|
||||
+ file, err := open("@iana@/etc/services")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
12
pkgs/development/compilers/go/mailcap-1.17.patch
Normal file
12
pkgs/development/compilers/go/mailcap-1.17.patch
Normal file
|
@ -0,0 +1,12 @@
|
|||
diff --git a/src/mime/type_unix.go b/src/mime/type_unix.go
|
||||
index f954bc8a1f..06d897bfbf 100644
|
||||
--- a/src/mime/type_unix.go
|
||||
+++ b/src/mime/type_unix.go
|
||||
@@ -26,6 +26,7 @@ var mimeGlobs = []string{
|
||||
|
||||
// Common locations for mime.types files on unix.
|
||||
var typeFiles = []string{
|
||||
+ "@mailcap@/etc/mime.types",
|
||||
"/etc/mime.types",
|
||||
"/etc/apache2/mime.types",
|
||||
"/etc/apache/mime.types",
|
12
pkgs/development/compilers/go/tzdata-1.17.patch
Normal file
12
pkgs/development/compilers/go/tzdata-1.17.patch
Normal file
|
@ -0,0 +1,12 @@
|
|||
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
|
||||
index 4ea029dbde..af94a4d90b 100644
|
||||
--- a/src/time/zoneinfo_unix.go
|
||||
+++ b/src/time/zoneinfo_unix.go
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
// Many systems use /usr/share/zoneinfo, Solaris 2 has
|
||||
// /usr/share/lib/zoneinfo, IRIX 6 has /usr/lib/locale/TZ.
|
||||
var zoneSources = []string{
|
||||
+ "@tzdata@/share/zoneinfo/",
|
||||
"/usr/share/zoneinfo/",
|
||||
"/usr/share/lib/zoneinfo/",
|
||||
"/usr/lib/locale/TZ/",
|
12
pkgs/development/compilers/go/tzdata-1.19.patch
Normal file
12
pkgs/development/compilers/go/tzdata-1.19.patch
Normal file
|
@ -0,0 +1,12 @@
|
|||
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
|
||||
index 67b8beb47b..5cd1fb1759 100644
|
||||
--- a/src/time/zoneinfo_unix.go
|
||||
+++ b/src/time/zoneinfo_unix.go
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
// Many systems use /usr/share/zoneinfo, Solaris 2 has
|
||||
// /usr/share/lib/zoneinfo, IRIX 6 has /usr/lib/locale/TZ.
|
||||
var platformZoneSources = []string{
|
||||
+ "@tzdata@/share/zoneinfo/",
|
||||
"/usr/share/zoneinfo/",
|
||||
"/usr/share/lib/zoneinfo/",
|
||||
"/usr/lib/locale/TZ/",
|
Loading…
Reference in a new issue