about summary refs log tree commit diff
path: root/pkgs/stdenv/adapters.nix
AgeCommit message (Collapse)AuthorFilesLines
2024-03-29overrideSDK: support all deps attributesRandy Eckenrode1-119/+11
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.
2024-03-21Merge pull request #297711 from hercules-ci/rename-adapters-finalAttrsRobert Hensing1-3/+3
pkgs/stdenv/adapters.nix: Rename internal name
2024-03-21pkgs/stdenv/adapters.nix: Rename internal nameRobert Hensing1-3/+3
`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.
2024-03-20Merge master into staging-nextgithub-actions[bot]1-5/+9
2024-03-20stdenvAdapters.useLibsFrom: use targetStdenv.cc.overrideConnor Baker1-5/+9
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`.
2024-03-14Merge master into staging-nextgithub-actions[bot]1-1/+1
2024-03-11make-derivation.nix: Return mkDerivation as an attributeRobert Hensing1-1/+1
2024-03-11llvmPackages_{12,13,14,15,16,17,git}.{libcxx,libcxxabi}: merge libcxxabi ↵a-n-n-a-l-e-e1-16/+4
into libcxx (#292043) - 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/292043
2024-01-12stdenvAdapters.useLibsFrom: initSomeone Serge1-0/+24
2024-01-10Merge branch 'master' into staging-nextWeijia Wang1-1/+4
2024-01-07stdenv.adapters: fixx `overrideLibcxx` to refer to existing `compiler-rt`Sergei Trofimovich1-1/+4
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 '...'`.
2023-12-09stdenvAdapters: add withDefaultHardeningFlagsRobert Scott1-0/+14
2023-11-04Merge pull request #265307 from reckenrode/clang16-fixes-batch2Weijia Wang1-0/+44
rubyPackages.iconv, v8: fix build with clang 16
2023-11-04stdenvAdapters.overrideSDK: special case the 10.12 LibsystemRandy Eckenrode1-2/+5
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.
2023-11-03stdenvAdapters: add overrideLibcxxRandy Eckenrode1-0/+44
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.
2023-11-01stdenvAdapters.overrideSDK: handle non-drv nativeBuildInputsRandy Eckenrode1-1/+1
2023-11-01stdenvAdapters.overrideSDK: also remap propagatedBuildInputsRandy Eckenrode1-0/+1
2023-11-01stdenvAdapters.overrideSDK: update the SDK version recursivelyRandy Eckenrode1-12/+15
Update all propagated build inputs recursively, so that propagated inputs with propagated inputs use the correct SDK.
2023-10-31stdenvAdapters.overrideSDK: override xcodebuild to use the requested SDKRandy Eckenrode1-1/+22
2023-10-26stdenvAdapters: add overrideSDKRandy Eckenrode1-0/+99
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.
2023-10-20Merge staging-next into staginggithub-actions[bot]1-10/+4
2023-10-19stdenvAdapters.useMoldLinker: set `allowedRequisites` to `null`Pavel Sobolev1-10/+4
2023-10-13Merge staging-next into staginggithub-actions[bot]1-1/+4
2023-10-13stdenvAdapters.useMoldLinker: automatically add `allowedRequisites`Artturin1-1/+4
Co-Authored-By: Pavel Sobolev <paveloom@riseup.net>
2023-10-13Merge staging-next into staginggithub-actions[bot]1-2/+2
2023-10-13mold: add tests for `mold-wrapped` and `useMoldLinker` adapterArtturin1-2/+2
Make both ready for cross with prefixes Currently `pkgsCross.aarch64-multiplatform.mold.passthru.tests.{wrapped,adapter}` fail with ``` Testing running the 'hello' binary which should be linked with 'mold' Hello, world! Checking for mold in the '.comment' section No mention of 'mold' detected in the '.comment' section The command was: aarch64-unknown-linux-gnu-readelf -p .comment ...bin/hello The output was: String dump of section '.comment': [ 0] GCC: (GNU) 12.3.0 ```
2023-09-03makeStaticBinaries: Set -DCMAKE_SKIP_INSTALL_RPATHPeter Waller1-6/+7
Without this, you get error messages during the install phase along the lines of: "file RPATH_CHANGE could not write new RPATH:". This is unsurprising because the static binaries do not have any dynamic linker and thus, no runpath to rewrite either. Tell cmake it doesn't need to do RPATH manipulation by passing cmakeFlags. While we're here, I also renamed `finalAttrs` to `args` and fixed the indentation; this improves consistency with the surrounding code and eliminates a point of confusion: because it was named `finalAttrs` I presumed I should be able to influence it with an overrideAttrs setting dontAddStaticConfigureFlags, but this turns out not to be possible; adding prevAttrs as well doesn't work because of a limitation of overrideAttrs whereby it gives an infinite recursion if the set of attribute keys being returned depends on finalAttrs. Signed-off-by: Peter Waller <p@pwaller.net>
2023-07-21stdenvAdapters: Remove 6 year old commentArtturin1-3/+0
Comment was added in 3c36dcc and hasn't been needed because makeStaticBinaries already adds glibc.static
2023-07-21stdenvAdapters: Fix conditionArtturin1-1/+1
Fixes issue 244232
2023-07-08darwin.stdenv: fix portable libsystem hook with sandboxingRandy Eckenrode1-0/+1
When sandboxing is enabled, the hook tries to run `install_name_tool` and fails because the system one is inaccessible. Having it use `targetPrefix` allows it to find and use the cross-install_name_tool.
2023-07-03stdenvAdapters: don't use lib.optional with a listfigsoda1-1/+1
2023-06-22stdenv: fix makeStaticDarwin not composing with stdenvNoCCUri Baghin1-11/+13
2023-04-12stdenvAdapters: fix preservation of env.NIX_CFLAGS_COMPILEArtturin1-3/+3
we have managed to migrate to NIX_CFLAGS_COMPILE to the env attrset well enough that we don't need to support having it toplevel. mkDerivation will throw if there's a attr in both env and toplevel so no need to worry about that
2023-04-11stdenvAdapters: fix preservation of envArtturin1-3/+4
2023-02-23Merge staging-next into staginggithub-actions[bot]1-4/+4
2023-02-22treewide: move NIX_CFLAGS_COMPILE to the env attrsetArtturin1-4/+4
with structuredAttrs lists will be bash arrays which cannot be exported which will be a issue with some patches and some wrappers like cc-wrapper this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists in env cause a eval failure
2023-02-17stdenvAdapters: add useMoldLinkerArtturin1-0/+22
2023-01-19treewide: add names to all setup hooksAlyssa Ross1-0/+1
2022-08-26stdenv: remove deprecated adapterspennae1-44/+0
2022-06-05stdenv/adapters.nix: Fix for overlay style argumentsRobert Hensing1-5/+5
2022-05-25treewide: stdenv.glibc -> glibcArtturin1-2/+2
2022-05-07stdenv: deprecate unused adaptersArtturin1-29/+6
stdenv: deprecate addCoverageInstrumentation adapter this used to be used in nixos/tests but it hasn't been used in nixpkgs for years stdenv: deprecate replaceMaintainersField adapter it was added in 2009 in 01e98e49b155d989d8c80066db6de910396cdcaa by nbp there are no uses of it in nixpkgs now stdenv: deprecate validateLicenses adapter it was added in 2009 in b29073af25cb0ff2d8d9a0aa1f958316904d3dc9 unfreePredicate is now handled in ./pkgs/stdenv/generic/check-meta.nix so this is unnecessary
2022-01-29stdenv: introduce withCFlagsmatthewcroughan1-0/+21
Adds an easy method of appending compiler flags to your stdenv via a list. Co-authored-by: tomberek <tomberek@users.noreply.github.com> Co-authored-by: Gytis Ivaskevicius <gytis02.21@gmail.com> Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2021-08-20pkgsStatic: Finally obviate overlay!John Ericson1-0/+14
2021-08-19pkgsStatic: Inline more of static overlayJohn Ericson1-0/+18
2021-08-18stdenv: Fix overriding + `overrideAttrs`John Ericson1-49/+76
The old stdenv adapters were subtly wrong in two ways: - `overrideAttrs` leaked the original, unoverridden `mkDerivation`. - `stdenv.override` would throw away any manually-set `mkDerivation` from a stdenv reverting to the original. Now, `mkDerivation` is controlled (nearly directly) via an argument, and always correctly closes over the final ("self") stdenv. This means the adapters can work entirely via `.override` without any manual `stdenv // ...`, and both those issues are fixed. Note hashes are changed, because stdenvs no previously overridden like `stdenvNoCC` and `crossLibcStdenv` now are. I had to add some `dontDisableStatic = true` accordingly. The flip side however is that since the overrides compose, we no longer need to override anything but the default `stdenv` from which all the others are created.
2021-06-11stdenv: introduce dontAddStaticConfigureFlagsAlyssa Ross1-0/+2
With removeUnknownConfigureFlags, it's impossible to express a package that needs --enable-static, but will not accept --disable-shared, without overriding the result of removeUnknownConfigureFlags _again_ in pkgs/top-level/static.nix. It would be much better (and more in line with the rest of Nixpkgs) if we encoded changes needed for static builds in package definitions themselves, rather than in an ever-expanding list in static.nix. This is especially true when doing it in static.nix is going to require multiple overrides to express what could be expressed with stdenv options. So as a step in that direction, and to fix the problem described above, here I replace removeUnknownConfigureFlags with a new stdenv option, dontAddStaticConfigureFlags. With this mechanism, a package that needs one but not both of the flags just needs to set dontAddStaticConfigureFlags and then set up configureFlags manually based on stdenv.hostPlatform.isStatic.
2021-01-27treewide: stdenv.lib -> libBen Siraphob1-1/+1
2020-04-28pkgsStatic: fix eval on DarwinJude Taylor1-2/+2
2020-01-03pkgsStatic: set BUILD_SHARED_LIBS=OFF for cmakeDmitry Kalinkin1-0/+1