fix: use nixos-25.11 with apple-sdk_15 for darwin support (fixes #1)

- Switch to nixos-25.11 for modern apple-sdk packages
- Use apple-sdk_15 which includes SecTrustCopyCertificateChain (macOS 12+)
- Required for Go 1.25 crypto/x509 compatibility on darwin
This commit is contained in:
Karol Broda
2025-12-23 11:09:44 +01:00
parent c95a5ebd23
commit dc7e5d435f
2 changed files with 8 additions and 9 deletions

8
flake.lock generated
View File

@@ -2,16 +2,16 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1765687488, "lastModified": 1766201043,
"narHash": "sha256-7YAJ6xgBAQ/Nr+7MI13Tui1ULflgAdKh63m1tfYV7+M=", "narHash": "sha256-eplAP+rorKKd0gNjV3rA6+0WMzb1X1i16F5m5pASnjA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d02bcc33948ca19b0aaa0213fe987ceec1f4ebe1", "rev": "b3aad468604d3e488d627c0b43984eb60e75e782",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-25.05", "ref": "nixos-25.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View File

@@ -1,7 +1,7 @@
{ {
description = "snitch - a friendlier ss/netstat for humans"; description = "snitch - a friendlier ss/netstat for humans";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
outputs = { self, nixpkgs }: outputs = { self, nixpkgs }:
let let
@@ -48,9 +48,9 @@
let let
rev = self.shortRev or self.dirtyShortRev or "unknown"; rev = self.shortRev or self.dirtyShortRev or "unknown";
version = "nix-${rev}"; version = "nix-${rev}";
isDarwin = pkgs.stdenv.isDarwin;
go = mkGo125 pkgs; go = mkGo125 pkgs;
buildGoModule = pkgs.buildGoModule.override { inherit go; }; buildGoModule = pkgs.buildGoModule.override { inherit go; };
isDarwin = pkgs.stdenv.isDarwin;
in in
buildGoModule { buildGoModule {
pname = "snitch"; pname = "snitch";
@@ -60,9 +60,8 @@
# darwin requires cgo for libproc, linux uses pure go with /proc # darwin requires cgo for libproc, linux uses pure go with /proc
env.CGO_ENABLED = if isDarwin then "1" else "0"; env.CGO_ENABLED = if isDarwin then "1" else "0";
env.GOTOOLCHAIN = "local"; env.GOTOOLCHAIN = "local";
# go 1.25 crypto/x509 uses SecTrustCopyCertificateChain (macOS 12+) # darwin: use macOS 15 SDK for SecTrustCopyCertificateChain (Go 1.25 crypto/x509)
env.MACOSX_DEPLOYMENT_TARGET = pkgs.lib.optionalString isDarwin "12.0"; buildInputs = pkgs.lib.optionals isDarwin [ pkgs.apple-sdk_15 ];
# nixpkgs 25.05+ uses system SDK directly, no explicit framework buildInputs needed
ldflags = [ ldflags = [
"-s" "-s"
"-w" "-w"