lol

go: convert seds to substitute patches

zowoq 4fd2bcb0 6285da30

+94 -20
+16 -10
pkgs/development/compilers/go/1.18.nix
··· 2 2 , stdenv 3 3 , fetchurl 4 4 , tzdata 5 + , substituteAll 5 6 , iana-etc 6 7 , which 7 8 , pkg-config ··· 68 69 hardeningDisable = [ "all" ]; 69 70 70 71 postPatch = '' 71 - patchShebangs ./ # replace /bin/bash 72 + patchShebangs . 73 + ''; 72 74 75 + patches = [ 76 + (substituteAll { 77 + src = ./iana-etc-1.17.patch; 78 + iana = iana-etc; 79 + }) 73 80 # Patch the mimetype database location which is missing on NixOS. 74 81 # but also allow static binaries built with NixOS to run outside nix 75 - sed -i 's,\"/etc/mime.types,"${mailcap}/etc/mime.types\"\,\n\t&,' src/mime/type_unix.go 76 - 77 - sed -i 's,/etc/protocols,${iana-etc}/etc/protocols,' src/net/lookup_unix.go 78 - sed -i 's,/etc/services,${iana-etc}/etc/services,' src/net/port_unix.go 79 - 82 + (substituteAll { 83 + src = ./mailcap-1.17.patch; 84 + inherit mailcap; 85 + }) 80 86 # prepend the nix path to the zoneinfo files but also leave the original value for static binaries 81 87 # that run outside a nix server 82 - sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go 83 - ''; 84 - 85 - patches = [ 88 + (substituteAll { 89 + src = ./tzdata-1.17.patch; 90 + inherit tzdata; 91 + }) 86 92 ./remove-tools-1.11.patch 87 93 ./ssl-cert-file-1.16.patch 88 94 ./go_no_vendor_checks-1.16.patch
+16 -10
pkgs/development/compilers/go/1.19.nix
··· 2 2 , stdenv 3 3 , fetchurl 4 4 , tzdata 5 + , substituteAll 5 6 , iana-etc 6 7 , which 7 8 , pkg-config ··· 68 69 hardeningDisable = [ "all" ]; 69 70 70 71 postPatch = '' 71 - patchShebangs ./ # replace /bin/bash 72 + patchShebangs . 73 + ''; 72 74 75 + patches = [ 76 + (substituteAll { 77 + src = ./iana-etc-1.17.patch; 78 + iana = iana-etc; 79 + }) 73 80 # Patch the mimetype database location which is missing on NixOS. 74 81 # but also allow static binaries built with NixOS to run outside nix 75 - sed -i 's,\"/etc/mime.types,"${mailcap}/etc/mime.types\"\,\n\t&,' src/mime/type_unix.go 76 - 77 - sed -i 's,/etc/protocols,${iana-etc}/etc/protocols,' src/net/lookup_unix.go 78 - sed -i 's,/etc/services,${iana-etc}/etc/services,' src/net/port_unix.go 79 - 82 + (substituteAll { 83 + src = ./mailcap-1.17.patch; 84 + inherit mailcap; 85 + }) 80 86 # prepend the nix path to the zoneinfo files but also leave the original value for static binaries 81 87 # that run outside a nix server 82 - sed -i 's,\"/usr/share/zoneinfo/,"${tzdata}/share/zoneinfo/\"\,\n\t&,' src/time/zoneinfo_unix.go 83 - ''; 84 - 85 - patches = [ 88 + (substituteAll { 89 + src = ./tzdata-1.19.patch; 90 + inherit tzdata; 91 + }) 86 92 ./remove-tools-1.11.patch 87 93 ./ssl-cert-file-1.16.patch 88 94 ./go_no_vendor_checks-1.16.patch
+26
pkgs/development/compilers/go/iana-etc-1.17.patch
··· 1 + diff --git a/src/net/lookup_unix.go b/src/net/lookup_unix.go 2 + index 8030e3d99e..5a7472d933 100644 3 + --- a/src/net/lookup_unix.go 4 + +++ b/src/net/lookup_unix.go 5 + @@ -21,7 +21,7 @@ var onceReadProtocols sync.Once 6 + // readProtocols loads contents of /etc/protocols into protocols map 7 + // for quick access. 8 + func readProtocols() { 9 + - file, err := open("/etc/protocols") 10 + + file, err := open("@iana@/etc/protocols") 11 + if err != nil { 12 + return 13 + } 14 + diff --git a/src/net/port_unix.go b/src/net/port_unix.go 15 + index a9a96a2323..0df6efe9e5 100644 16 + --- a/src/net/port_unix.go 17 + +++ b/src/net/port_unix.go 18 + @@ -17,7 +17,7 @@ import ( 19 + var onceReadServices sync.Once 20 + 21 + func readServices() { 22 + - file, err := open("/etc/services") 23 + + file, err := open("@iana@/etc/services") 24 + if err != nil { 25 + return 26 + }
+12
pkgs/development/compilers/go/mailcap-1.17.patch
··· 1 + diff --git a/src/mime/type_unix.go b/src/mime/type_unix.go 2 + index f954bc8a1f..06d897bfbf 100644 3 + --- a/src/mime/type_unix.go 4 + +++ b/src/mime/type_unix.go 5 + @@ -26,6 +26,7 @@ var mimeGlobs = []string{ 6 + 7 + // Common locations for mime.types files on unix. 8 + var typeFiles = []string{ 9 + + "@mailcap@/etc/mime.types", 10 + "/etc/mime.types", 11 + "/etc/apache2/mime.types", 12 + "/etc/apache/mime.types",
+12
pkgs/development/compilers/go/tzdata-1.17.patch
··· 1 + diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go 2 + index 4ea029dbde..af94a4d90b 100644 3 + --- a/src/time/zoneinfo_unix.go 4 + +++ b/src/time/zoneinfo_unix.go 5 + @@ -20,6 +20,7 @@ import ( 6 + // Many systems use /usr/share/zoneinfo, Solaris 2 has 7 + // /usr/share/lib/zoneinfo, IRIX 6 has /usr/lib/locale/TZ. 8 + var zoneSources = []string{ 9 + + "@tzdata@/share/zoneinfo/", 10 + "/usr/share/zoneinfo/", 11 + "/usr/share/lib/zoneinfo/", 12 + "/usr/lib/locale/TZ/",
+12
pkgs/development/compilers/go/tzdata-1.19.patch
··· 1 + diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go 2 + index 67b8beb47b..5cd1fb1759 100644 3 + --- a/src/time/zoneinfo_unix.go 4 + +++ b/src/time/zoneinfo_unix.go 5 + @@ -18,6 +18,7 @@ import ( 6 + // Many systems use /usr/share/zoneinfo, Solaris 2 has 7 + // /usr/share/lib/zoneinfo, IRIX 6 has /usr/lib/locale/TZ. 8 + var platformZoneSources = []string{ 9 + + "@tzdata@/share/zoneinfo/", 10 + "/usr/share/zoneinfo/", 11 + "/usr/share/lib/zoneinfo/", 12 + "/usr/lib/locale/TZ/",