From 49e1508df2a73c06c37e89797c00d86dd076136d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 4 Jul 2025 10:00:33 +0200 Subject: [PATCH 1/2] pkgsStatic.toybox: fix macOS build --static is not a thing, we will still depend on libSystem but nothing else. --- pkgs/by-name/to/toybox/package.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/to/toybox/package.nix b/pkgs/by-name/to/toybox/package.nix index 4301f58926c1..f7ba1ff78cb2 100644 --- a/pkgs/by-name/to/toybox/package.nix +++ b/pkgs/by-name/to/toybox/package.nix @@ -64,7 +64,11 @@ stdenv.mkDerivation rec { make oldconfig ''; - makeFlags = [ "PREFIX=$(out)/bin" ] ++ optionals enableStatic [ "LDFLAGS=--static" ]; + makeFlags = + [ "PREFIX=$(out)/bin" ] + ++ optionals (enableStatic && !stdenv.hostPlatform.isDarwin) [ + "LDFLAGS=--static" + ]; installTargets = [ "install_flat" ]; From bd5c4ca1c0b3a57599534cbf27b65ca1e0309259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 4 Jul 2025 10:23:43 +0200 Subject: [PATCH 2/2] pkgsStatic.toybox: fix linux build --- pkgs/by-name/to/toybox/package.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/to/toybox/package.nix b/pkgs/by-name/to/toybox/package.nix index f7ba1ff78cb2..158f2baebceb 100644 --- a/pkgs/by-name/to/toybox/package.nix +++ b/pkgs/by-name/to/toybox/package.nix @@ -64,8 +64,16 @@ stdenv.mkDerivation rec { make oldconfig ''; + hardeningDisable = lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isStatic) [ + # breaks string.h header in musl + "fortify" + ]; + makeFlags = - [ "PREFIX=$(out)/bin" ] + [ + "PREFIX=$(out)/bin" + "CC=${stdenv.cc.targetPrefix}cc" + ] ++ optionals (enableStatic && !stdenv.hostPlatform.isDarwin) [ "LDFLAGS=--static" ];