From 5f3c43df70bf4b0eac72180a50529f7c1dfc8eb9 Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Mon, 20 Oct 2025 21:04:36 +0400 Subject: [PATCH] pmtiles: fix sandbox build on darwin --- .../pm/pmtiles/darwin-sandbox-fix.patch | 20 +++++++++++++++++++ pkgs/by-name/pm/pmtiles/package.nix | 9 ++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/pm/pmtiles/darwin-sandbox-fix.patch diff --git a/pkgs/by-name/pm/pmtiles/darwin-sandbox-fix.patch b/pkgs/by-name/pm/pmtiles/darwin-sandbox-fix.patch new file mode 100644 index 000000000000..b390d492467c --- /dev/null +++ b/pkgs/by-name/pm/pmtiles/darwin-sandbox-fix.patch @@ -0,0 +1,20 @@ +--- vendor/modernc.org/libc/honnef.co/go/netdb/netdb.go ++++ vendor/modernc.org/libc/honnef.co/go/netdb/netdb.go +@@ -696,7 +696,7 @@ func init() { + // Load protocols + data, err := ioutil.ReadFile("/etc/protocols") + if err != nil { +- if !os.IsNotExist(err) { ++ if !os.IsNotExist(err) && !os.IsPermission(err) { + panic(err) + } + +@@ -732,7 +732,7 @@ func init() { + // Load services + data, err = ioutil.ReadFile("/etc/services") + if err != nil { +- if !os.IsNotExist(err) { ++ if !os.IsNotExist(err) && !os.IsPermission(err) { + panic(err) + } + diff --git a/pkgs/by-name/pm/pmtiles/package.nix b/pkgs/by-name/pm/pmtiles/package.nix index d5c616ba726f..554fea30290e 100644 --- a/pkgs/by-name/pm/pmtiles/package.nix +++ b/pkgs/by-name/pm/pmtiles/package.nix @@ -14,7 +14,14 @@ buildGoModule rec { hash = "sha256-JGsbgBB2T+4SWKQmiSmuMqQ8gw0qhM5c5eFDF/+sndA="; }; - vendorHash = "sha256-XRx9Qe7tTQAPJJdj9yEU0YAFjvl+4jW/XQy2MYFApds="; + vendorHash = "sha256-6zsX7rU+D+RUHwXfFZzLQftQ6nSYJhvKIDdsO2vow4A="; + + overrideModAttrs = old: { + # https://gitlab.com/cznic/libc/-/merge_requests/10 + postBuild = '' + patch -p0 < ${./darwin-sandbox-fix.patch} + ''; + }; ldflags = [ "-s"