From f4c841ae5ea4b08546489a4d93b3ea583f3049d6 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 30 May 2025 14:57:33 +0200 Subject: [PATCH 1/2] lib.systems: don't throw if go unsupported Better to have a value that can actually be checked for, rather than throwing, so optional Go support can be disabled when unsupported. --- lib/systems/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 6b9da270bf5f..6f5be39d29ac 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -556,7 +556,7 @@ let "x86_64" = "amd64"; "wasm32" = "wasm"; } - .${final.parsed.cpu.name} or (throw "Unknown CPU variant ${final.parsed.cpu.name} by Go"); + .${final.parsed.cpu.name} or null; GOOS = if final.isWasi then "wasip1" else final.parsed.kernel.name; # See https://go.dev/wiki/GoArm From 1fb006101d53fbde475347df9bca845813bc6484 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 30 May 2025 14:58:39 +0200 Subject: [PATCH 2/2] libcap: disable go for unsupported host platforms Example: s390-linux. I've also changed meta.available to lib.meta.availableOn, as meta.available has very confusing behaviour when cross compiling. --- pkgs/by-name/li/libcap/package.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/li/libcap/package.nix b/pkgs/by-name/li/libcap/package.nix index 353e12cdb455..c15cb447278a 100644 --- a/pkgs/by-name/li/libcap/package.nix +++ b/pkgs/by-name/li/libcap/package.nix @@ -8,7 +8,8 @@ usePam ? !isStatic, pam ? null, isStatic ? stdenv.hostPlatform.isStatic, - withGo ? pkgsBuildHost.go.meta.available, + go, + withGo ? lib.meta.availableOn stdenv.buildPlatform go && stdenv.hostPlatform.go.GOARCH != null, # passthru.tests bind, @@ -47,7 +48,7 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = lib.optionals withGo [ - pkgsBuildHost.go + go ]; buildInputs = lib.optional usePam pam;