summaryrefslogtreecommitdiff
path: root/pkgs/stdenv/adapters.nix (follow)
Commit message (Expand)AuthorAgeFilesLines
* mold: switch to wrapped by defaultDawid Ciężarkiewicz2025-12-081-3/+8
* wild: make wrapped default, add wild-unwrappedDawid Ciężarkiewicz2025-11-101-1/+1
* adapters: Add useWildLinkerRoss Smyth2025-11-051-0/+16
* Merge remote-tracking branch 'origin/master' into staging-nextK9002025-10-041-1/+1
|\
| * pkgs: remove optional builtins prefixes from prelude functions•••Remove optional builtins prefixes from prelude functions by running: builtins=( abort baseNameOf break derivation derivationStrict dirOf false fetchGit fetchMercurial fetchTarball fetchTree fromTOML import isNull map null placeholder removeAttrs scopedImport throw toString true ) fd \ --type file \ . \ pkgs \ --exec-batch sed --in-place --regexp-extended " s/\<builtins\.($( printf '%s\n' "${builtins[@]}" | paste --delimiter '|' --serial - ))\>/\1/g " nix fmt NAHO2025-10-041-1/+1
* | overrideLibcxx: drop•••We now use the latest SDK’s libc++ headers, and longer have Clang versions old enough for version compatibility to be a concern. Emily2025-09-151-44/+0
|/
* {darwin.*,overrideSDK}: convert compatibility stubs to throwsEmily2025-08-161-3/+0
* pkgsStatic: fix in combination with __structuredAttrs•••pkgsStatic injects { NIX_CFLAGS_COMPILE = " -static"; }. When __structuredAttrs is true, it must inject { env.NIX_CFLAGS_COMPILE = " -static"; } instead, as attributes outside env are ignored. Guillaume Girol2025-07-261-16/+18
* stdenvAdapters.keepDebugInfo: add Rust support•••These are the flags we use in the separateDebugInfo hook, plus disabling optimisations in line with what we do for C. This fixes e.g. enableDebugging amberol. Alyssa Ross2025-07-141-0/+1
* Fix useMoldLinker when cross compiling (#400749)Ben Siraphob2025-05-121-2/+3
|\
| * Fix useMoldLinker when cross compiling•••After #400734 we can make useMoldLinker work when cross compiling. We need the following: - Need to use pkgs.buildPackages.mold so that we use mold binaries for the build machine instead of the host. - Need to create unprefixed ld.mold wrapper because gcc will not look for a triple-prefixed ld.mold when passing -fuse-ld=mold. Tested on an aarch64 machine with this change + #400734: $ nix-build -K --expr 'with import "${./.}" { crossSystem = { config = "x86_64-unknown-linux-gnu"; }; }; hello.override { stdenv = useMoldLinker stdenv; }' && strings result/bin/hello | grep mold /nix/store/w1yg0am7iyqsgi253h84lsp92178sgfi-hello-x86_64-unknown-linux-gnu-2.12.1 mold 2.37.1 (compatible with GNU ld) Peter Collingbourne2025-04-211-2/+3
* | overrideSDK: add deprecation warningEmily2025-04-201-9/+1
* | pkgsStatic.stdenv: fix eval on darwinTristan Ross2025-04-091-1/+2
|/
* treewide: Format all Nix files•••Format all Nix files using the officially approved formatter, making the CI check introduced in the previous commit succeed: nix-build ci -A fmt.check This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153) of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166). This commit will lead to merge conflicts for a number of PRs, up to an estimated ~1100 (~33%) among the PRs with activity in the past 2 months, but that should be lower than what it would be without the previous [partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537). Merge conflicts caused by this commit can now automatically be resolved while rebasing using the [auto-rebase script](https://github.com/NixOS/nixpkgs/tree/8616af08d915377bd930395f3b700a0e93d08728/maintainers/scripts/auto-rebase). If you run into any problems regarding any of this, please reach out to the [formatting team](https://nixos.org/community/teams/formatting/) by pinging @NixOS/nix-formatting. Silvan Mosberger2025-04-011-201/+314
* stdenvAdapters: set default_both_libraries for meson in makeStaticLibrary•••The default value of `default_both_libraries` is 'shared'. This change supplements the existing `default_library` flag for static builds. Kiskae2024-11-021-1/+4
* overrideSDK: update for the new SDK•••Change the adapter to add the requested SDK to the target’s build inputs. Note that only the “11.0” (i.e., 11.3) and 12.3 SDKs are supported. This adapter is retained for compatibility. The preferred way to override the SDK is to add it to the appropriate inputs directly. Randy Eckenrode2024-10-101-11/+3
* makeStaticDarwin: handle when `env.NIX_CFLAGS_LINK` is setRandy Eckenrode2024-10-101-5/+10
* makeStaticDarwin: drop darwin-portable-libSystem-hook•••`${stdenv.cc.libc}/lib/libSystem.B.dylib` does not exist and not existed for as long as I have used nixpkgs. Since `/usr/lib/libSystem.B.dylib` is already linked via text-based stubs, continue relying on those. Randy Eckenrode2024-10-101-10/+1
* darwin.stdenv: provide an SDK when cross-compiling•••Static can rely on the standard cross-SDK because it will be a static SDK when building for static targets. Randy Eckenrode2024-10-101-2/+0
* stdenv: throw when using mold for targeting darwin•••Mold does not support linking Mach-O, but still can be used on MacOS to emit ELF. Fixes: #338970 Azat Bahawi2024-09-021-19/+21
* stdenv: Fix args.env.NIX_CFLAGS_LINK/args.NIX_CFLAGS_LINK typoadisbladis2024-08-071-1/+1
* stdenv: Take nested env.NIX_CFLAGS_LINK into account when making static binaries•••https://github.com/NixOS/nixpkgs/pull/315998/files#diff-2828f66a476875b1160e3c241960db085c2a3933211cc187bcd1fb456fb95e7fL213-R216 moved NIX_CFLAGS_LINK from a top-level `mkDerivation` argument to the nested `env` attribute. This doesn't play nicely with how `stdenv/adapters.nix` adds it's NIX_CFLAGS_LINK in the top-level. This changes the stdenv adapter to check for the presence of `env.NIX_CFLAGS_LINK`, and override that one if present, and only otherwise override on the top-level drv attrset. adisbladis2024-08-031-2/+6
* *bsdCross: Remove these package sets•••I realized what rhelmot did in 61202561d92cf1cd74532fcbd8b9d6662c5bc57b (specify what packages just need `stdenvNoLibc`) is definitely the right approach for this, and adjusted NetBSD and OpenBSD to likewise use it. With that change, we don't need these confusing and ugly `*bsdCross` package sets at all! We can get rid of a lot more libc-related `*Cross`, and I will do so soon, but this is the first step. (adapted from commit 51f1ecaa59a3b7c182b24e71a3176c83d6cd601e) John Ericson2024-06-211-1/+5
* Revert #320852: Clean up cross bootstrapping•••It rebuilt stdenv on *-darwin; we can't do that in nixpkgs master. This reverts commit 2f20501c5f188ab0c4c430519ce77bc6b988202b, reversing changes made to fd469c24af2e16aad2c2b4fc90fc8c74af36e773. Vladimír Čunát2024-06-211-5/+1
* Clean up cross bootstrapping•••For a long time, we've had `crossLibcStdenv`, `*Cross` libc attributes, and `*bsdCross` pre-libc package sets. This was always bad because having "cross" things is "not declarative": the naming doesn't reflect what packages *need* but rather how we *provide* something. This is ugly, and creates needless friction between cross and native building. Now, almost all of these `*Cross` attributes are gone: just these are kept: - Glibc's and Musl's are kept, because those packages are widely used and I didn't want to risk changing the native builds of those at this time. - generic `libcCross`, `theadsCross`, and friends, because these relate to the convolulted GCC bootstrap which still needs to be redone. The BSD and obscure Linux or freestnanding libcs have conversely all been made to use a new `stdenvNoLibc`, which is like the old `crossLibcStdenv` except: 1. It usable for native and cross alike 2. It named according to what it *is* ("a standard environment without libc but with a C compiler"), rather than some non-compositional jargon ("the stdenv used for building libc when cross compiling", yuck). I should have done this change long ago, but I was stymied because of "infinite recursions". The problem was that in too many cases we are overriding `stdenv` to *remove* things we don't need, and this risks cyles since those more minimal stdenvs are used to build things in the more maximal stdenvs. The solution is to pass `stage.nix` `stdenvNoCC`, so we can override to *build up* rather than *tear down*. For now, the full `stdenv` is also passed, so I don't need to change the native bootstraps, but I can see this changing as we make things more uniform and clean those up. Finally, the BSDs also had to be cleaned up, since they have a few pre-libc dependencies, demanding a systematic approach. I realized what rhelmot did in 61202561d92cf1cd74532fcbd8b9d6662c5bc57b (specify what packages just need `stdenvNoLibc`) is definitely the right approach for this, and adjusted NetBSD and OpenBSD to likewise use it. John Ericson2024-06-181-1/+5
* overrideSDK: support all deps attributes•••This is effectively a rewrite of `overrideSDK`. It was required because `wrapGAppsHook` propagates `depsTargetTarget` with the expectation that it will effectively be `buildInputs` when the hook is itself used as a `nativeBuildInput`. This propagates Gtk, which itself propagates the default Dariwn SDK, making it effectively impossible to override the SDK when a package depends on Gtk and uses `wrapGAppsHook`. This rewrite implements the following improvements: * Cross-compilation should be supported correctly (untested); * Supports public and private frameworks; * Supports SDK `libs`; * Remaps instead of replacing extra (native) build inputs in the stdenv; * Updates any Darwin framework references in `nix-support`; and * It updates `xcodebuild` regardless of which input its in. The implementation avoids recursion for performance reasons. Instead, it enumerates transitive dependencies and walks the list from the leaf packages backwards to the parent packages. Randy Eckenrode2024-03-291-119/+11
* Merge pull request #297711 from hercules-ci/rename-adapters-finalAttrs•••pkgs/stdenv/adapters.nix: Rename internal nameRobert Hensing2024-03-211-3/+3
|\
| * pkgs/stdenv/adapters.nix: Rename internal name•••`finalAttrs` is never the first argument. This should have been called `prevAttrs` all along. It confused me for a bit, because the callback _must not_ be strict in `finalAttrs` (the first of _two_ parameters), or it will recurse infinitely while trying to figure out what the attrNames are. Robert Hensing2024-03-211-3/+3
* | Merge master into staging-nextgithub-actions[bot]2024-03-201-5/+9
|\ \
| * | 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`. Connor Baker2024-03-201-5/+9
| |/
* | Merge master into staging-nextgithub-actions[bot]2024-03-141-1/+1
|\|
| * make-derivation.nix: Return mkDerivation as an attributeRobert Hensing2024-03-111-1/+1
* | llvmPackages_{12,13,14,15,16,17,git}.{libcxx,libcxxabi}: merge libcxxabi into...•••- merge libcxxabi into libcxx for LLVM 12, 13, 14, 15, 16, 17, and git. - remove the link time workaround `-lc++ -lc++abi` from 58 packages as it is no longer required. - fixes https://github.com/NixOS/nixpkgs/issues/166205 - provides alternative fixes for. https://github.com/NixOS/nixpkgs/issues/269548 https://github.com/NixOS/nix/issues/9640 - pkgsCross.x86_64-freebsd builds work again This change can be represented in 3 stages 1. merge libcxxabi into libcxx -- files: pkgs/development/compilers/llvm/[12, git]/{libcxx, libcxxabi} 2. update stdenv to account for merge -- files: stdenv.{adapters, cc.wrapper, darwin} 3. remove all references to libcxxabi outside of llvm (about 58 packages modified) ### merging libcxxabi into libcxx - take the union of the libcxxabi and libcxx cmake flags - eliminate the libcxx-headers-only package - it was only needed to break libcxx <-> libcxxabi circular dependency - libcxx.cxxabi is removed. external cxxabi (freebsd) will symlink headers / libs into libcxx. - darwin will re-export the libcxxabi symbols into libcxx so linking `-lc++` is sufficient. - linux/freebsd `libc++.so` is a linker script `LINK(libc++.so.1, -lc++abi)` making `-lc++` sufficient. - libcxx/default.nix [12, 17] are identical except for patches and `LIBCXX_ADDITIONAL_LIBRARIES` (only used in 16+) - git/libcxx/defaul.nix does not link with -nostdlib when useLLVM is true so flag is removed. this is not much different than before as libcxxabi used -nostdlib where libcxx did not, so libc was linked in anyway. ### stdenv changes - darwin bootstrap, remove references to libcxxabi and cxxabi - cc-wrapper: remove c++ link workaround when libcxx.cxxabi doesn't exist (still exists for LLVM pre 12) - adapter: update overrideLibcxx to account for a pkgs.stdenv that only has libcxx ### 58 package updates - remove `NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}` as no longer needed - swift, nodejs_v8 remove libcxxabi references in the clang override https://github.com/NixOS/nixpkgs/pull/292043a-n-n-a-l-e-e2024-03-111-16/+4
|/
* stdenvAdapters.useLibsFrom: initSomeone Serge2024-01-121-0/+24
* Merge branch 'master' into staging-nextWeijia Wang2024-01-101-1/+4
|\
| * stdenv.adapters: fixx `overrideLibcxx` to refer to existing `compiler-rt`•••Before the change `pkgsLLVM` attributes were failing to pull in `compiler-rt` on `x86_64-linux`: $ nix build --no-link -f. pkgsLLVM.asciidoc-full error: error: attribute 'llvmPackages_13' missing at pkgs/stdenv/adapters.nix:86:32: 85| inherit libcxx; 86| extraPackages = [ cxxabi pkgs.pkgsTargetTarget."llvmPackages_${lib.versions.major llvmLibcxxVersion}".compiler-rt ]; | ^ 87| }); It happens because `pkgs.pkgsTargetTarget` are always empty for cross-packages like `pkgsLLVM.`, `pkgsCross.*.` or `--arg crossSystem '...'`. Sergei Trofimovich2024-01-071-1/+4
* | stdenvAdapters: add withDefaultHardeningFlagsRobert Scott2023-12-091-0/+14
|/
* Merge pull request #265307 from reckenrode/clang16-fixes-batch2•••rubyPackages.iconv, v8: fix build with clang 16Weijia Wang2023-11-041-0/+44
|\
| * stdenvAdapters: add overrideLibcxx•••This was taken from #264091 to use in the interim before that PR lands (sometime after the release of 23.11). It allows different versions of clang to link the same libc++, allowing dependencies to be linked when they are built with a different version of clang than the stdenv. Randy Eckenrode2023-11-031-0/+44
* | stdenvAdapters.overrideSDK: special case the 10.12 Libsystem•••The 10.12 Libsystem is not located as a sub-attribute of `darwin.apple_sdk_10_12`. This will be fixed as part of the SDK changes planned for post-23.11. In the meantime, special case it so the adapter can be used to change the deployment target. Randy Eckenrode2023-11-041-2/+5
|/
* stdenvAdapters.overrideSDK: handle non-drv nativeBuildInputsRandy Eckenrode2023-11-011-1/+1
* stdenvAdapters.overrideSDK: also remap propagatedBuildInputsRandy Eckenrode2023-11-011-0/+1
* stdenvAdapters.overrideSDK: update the SDK version recursively•••Update all propagated build inputs recursively, so that propagated inputs with propagated inputs use the correct SDK. Randy Eckenrode2023-11-011-12/+15
* stdenvAdapters.overrideSDK: override xcodebuild to use the requested SDKRandy Eckenrode2023-10-311-1/+22
* stdenvAdapters: add overrideSDK•••This is a replacement for using `darwin.apple_sdk_<ver>.callPackage`. Instead of injecting the required packages, it provides a stdenv adapter that modifies the derivation’s build inputs to use the requested SDK versions. This modification extends to any build inputs propagated to it as well. The `callPackage` approach is not deprecated yet, but it is expected that it will be eventually. Note that this is an MVP. It should work with most packages, but it only handles build inputs and also only handles frameworks. Once more SDKs are added (after #229210 is merged) and the SDK structure is normalized, it can be extended to handle any package in the SDK namespace. Cross-compilation may or may not work. Any cross-related issues can be addressed after #256590 is merged. Randy Eckenrode2023-10-261-0/+99
* Merge staging-next into staginggithub-actions[bot]2023-10-201-10/+4
|\
| * stdenvAdapters.useMoldLinker: set `allowedRequisites` to `null`Pavel Sobolev2023-10-191-10/+4
* | Merge staging-next into staginggithub-actions[bot]2023-10-131-1/+4
|\|
| * stdenvAdapters.useMoldLinker: automatically add `allowedRequisites`•••Co-Authored-By: Pavel Sobolev <paveloom@riseup.net> Artturin2023-10-131-1/+4
* | Merge staging-next into staginggithub-actions[bot]2023-10-131-2/+2
|\|