From 22168ff57d466cf6754613306f62a05e8d06ce23 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 3 Apr 2025 23:15:24 +0200 Subject: [PATCH 1/2] Revert "remove obsolete stdenv darwinMinVersion override" This reverts commit d91310bb32b9efca2f1e1a6a767cbe5b0a7f072c. > Some packages require setting a non-default deployment target > (or minimum version) to gain access to certain APIs. You do > that using the darwinMinVersionHook, which takes the deployment > target version as a parameter. -- https://github.com/NixOS/nixpkgs/blob/60b54c7aee3c0cefde72d1a151bb7d3a46361ca2/doc/stdenv/platform-notes.chapter.md#what-is-a-deployment-target-or-minimum-version-sec-darwin-troubleshooting-using-deployment-targets This will again solve error: ../nix_api_expr.cc:38:18: error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer -- https://hydra.nixos.org/build/294088946 (cherry picked from commit 5c4a4aeed7aeb808b5c3c6edc89b8f35d640f40b) --- flake.nix | 2 +- packaging/dependencies.nix | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index d1f49c290..d0fb521dd 100644 --- a/flake.nix +++ b/flake.nix @@ -177,7 +177,7 @@ { otherSplices = final.generateSplicesForMkScope "nixDependencies"; f = import ./packaging/dependencies.nix { - inherit stdenv; + inherit inputs stdenv; pkgs = final; }; }; diff --git a/packaging/dependencies.nix b/packaging/dependencies.nix index f06b65dee..0af670bfb 100644 --- a/packaging/dependencies.nix +++ b/packaging/dependencies.nix @@ -1,14 +1,33 @@ # These overrides are applied to the dependencies of the Nix components. { + # Flake inputs; used for sources + inputs, + # The raw Nixpkgs, not affected by this scope pkgs, stdenv, }: +let + prevStdenv = stdenv; +in + let inherit (pkgs) lib; + + stdenv = if prevStdenv.isDarwin && prevStdenv.isx86_64 then darwinStdenv else prevStdenv; + + # Fix the following error with the default x86_64-darwin SDK: + # + # error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer + # + # Despite the use of the 10.13 deployment target here, the aligned + # allocation function Clang uses with this setting actually works + # all the way back to 10.6. + darwinStdenv = pkgs.overrideSDK prevStdenv { darwinMinVersion = "10.13"; }; + in scope: { inherit stdenv; From f0bf94fe29e2021452aab9429024d100d74614b6 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 3 Apr 2025 23:21:11 +0200 Subject: [PATCH 2/2] packaging/dependency: Clarify darwinMinVersion (cherry picked from commit 4be92e7b82376a76e78622d61c7db047f6bbf402) --- packaging/dependencies.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packaging/dependencies.nix b/packaging/dependencies.nix index 0af670bfb..ed05843c7 100644 --- a/packaging/dependencies.nix +++ b/packaging/dependencies.nix @@ -26,6 +26,9 @@ let # Despite the use of the 10.13 deployment target here, the aligned # allocation function Clang uses with this setting actually works # all the way back to 10.6. + # NOTE: this is not just a version constraint, but a request to make Darwin + # provide this version level of support. Removing this minimum version + # request will regress the above error. darwinStdenv = pkgs.overrideSDK prevStdenv { darwinMinVersion = "10.13"; }; in