From e871fcf859651a54d83e87d554aadf578a889503 Mon Sep 17 00:00:00 2001 From: Connor Baker Date: Wed, 17 Jan 2024 18:03:33 +0000 Subject: [PATCH] stdenvAdapters.useLibsFrom: use targetStdenv.cc.override As @SomeoneSerge pointed out in https://github.com/NixOS/nixpkgs/pull/281371#discussion_r1531174155, by avoiding `wrapCCWith` and using `targetStdenv.cc.override`, we avoid roundtrip wrapping and are able to use `coreutils` from `targetStdenv`. --- pkgs/stdenv/adapters.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index 10ed96acc2097..32bcabee6d797 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -237,14 +237,18 @@ rec { }); }); + /* Copy the libstdc++ from the model stdenv to the target stdenv. + * + * TODO(@connorbaker): + * This interface provides behavior which should be revisited prior to the + * release of 24.05. For a more detailed explanation and discussion, see + * https://github.com/NixOS/nixpkgs/issues/283517. */ useLibsFrom = modelStdenv: targetStdenv: let ccForLibs = modelStdenv.cc.cc; - cc = pkgs.wrapCCWith { - /* NOTE: cc.cc is the unwrapped compiler. Should we respect the old - * wrapper instead? */ - cc = targetStdenv.cc.cc; - + /* NOTE(@connorbaker): + * This assumes targetStdenv.cc is a cc-wrapper. */ + cc = targetStdenv.cc.override { /* NOTE(originally by rrbutani): * Normally the `useCcForLibs`/`gccForLibs` mechanism is used to get a * clang based `cc` to use `libstdc++` (from gcc).