about summary refs log tree commit diff
path: root/pkgs/stdenv
AgeCommit message (Collapse)AuthorFilesLines
2024-01-02Merge pull request #273935 from adisbladis/lib-meta-typechecks-go-brrrRobert Hensing2-47/+114
stdenv/check-meta: Use bespoke type checking
2023-12-28stdenv: fix eval of pkgsMusl packages with platform constraintsSergei Trofimovich1-2/+2
Before the change `pkgsMusl.adobe-reader` was failing the interpreter: $ nix-instantiate --eval --strict --expr 'with import ./. {}; builtins.tryEval pkgsMusl.adobe-reader' error: error: evaluation aborted with the following error message: 'unsupported platform for the pure Linux stdenv' After the change `pkgsMusl.adobe-reader` returns catchable excation: $ nix-instantiate --eval --strict --expr 'with import ./. {}; builtins.tryEval pkgsMusl.adobe-reader' { success = false; value = false; } Noticed when was exploring `nixpkgs` for uncatchable evaluation errors. Ideally those should only happen when there is a code bug in the use site. In this case it's just a package with incompatible constraints for `musl`. Changed uncatchable `abort` to `throw`.
2023-12-26stdenv/check-meta: Use bespoke type checkingadisbladis2-47/+114
Aka `checkMeta` goes brrr. Using the module system type checking works OK & generates good error messages. The performance of using it however is terrible because of the value merging it does being very allocation heavy. By implementing a very minimal type checker we can drastically improve the performance when nixpkgs is evaluated with `checkMeta = true`.
2023-12-13darwin/make-bootstrap-tools.nix: set -headerpad_max_install_names for coreutilsSergei Trofimovich1-1/+6
Without the change bootstrapTools build fails as: https://cache.nixos.org/log/g5wyq9xqshan6m3kl21bjn1z88hx48rh-stdenv-bootstrap-tools.drv error: install_name_tool: changing install names or rpaths can't be redone for: /nix/store/0hxg356h7lnl2hck23wrdpbib3cckx41-stdenv-bootstrap-tools/bin/tac (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)
2023-12-12Merge pull request #269546 from adisbladis/stdenv-meta-no-intermediate-allocadisbladis1-7/+12
stdenv: Avoid allocating intermediate attrset when checking meta validity
2023-12-12Merge pull request #269782 from ↵adisbladis1-8/+21
adisbladis/stdenv-meta-tolist-license-allocations stdenv: Avoid some list allocations in check-meta when checking licenses
2023-12-12stdenv: Avoid allocating intermediate attrset when checking meta validityadisbladis1-7/+12
This is a small performance optimization. It should be impercetible to most. Benchmarks: - Before ``` json { "cpuTime": 0.2777960002422333, "envs": { "bytes": 3832648, "elements": 189513, "number": 144784 }, "gc": { "heapSize": 402915328, "totalBytes": 50229344 }, "list": { "bytes": 655304, "concats": 3249, "elements": 81913 }, "nrAvoided": 218962, "nrFunctionCalls": 127718, "nrLookups": 40946, "nrOpUpdateValuesCopied": 1563978, "nrOpUpdates": 8542, "nrPrimOpCalls": 113032, "nrThunks": 329605, "sets": { "bytes": 29774864, "elements": 1824537, "number": 36392 }, "sizes": { "Attr": 16, "Bindings": 16, "Env": 16, "Value": 24 }, "symbols": { "bytes": 235909, "number": 24432 }, "values": { "bytes": 9691392, "number": 403808 } } ``` - After ``` { "cpuTime": 0.2615779936313629, "envs": { "bytes": 3833832, "elements": 189661, "number": 144784 }, "gc": { "heapSize": 402915328, "totalBytes": 50212960 }, "list": { "bytes": 655304, "concats": 3249, "elements": 81913 }, "nrAvoided": 218814, "nrFunctionCalls": 127718, "nrLookups": 40798, "nrOpUpdateValuesCopied": 1563978, "nrOpUpdates": 8542, "nrPrimOpCalls": 113032, "nrThunks": 329457, "sets": { "bytes": 29765392, "elements": 1824093, "number": 36244 }, "sizes": { "Attr": 16, "Bindings": 16, "Env": 16, "Value": 24 }, "symbols": { "bytes": 235909, "number": 24432 }, "values": { "bytes": 9687840, "number": 403660 } } ```
2023-12-12stdenv: Avoid some list allocations in check-meta when checking licensesadisbladis1-8/+21
2023-12-06Merge master into staging-nextgithub-actions[bot]1-41/+0
2023-12-06Merge pull request #271362 from pbsds/rm-dead-patchesRick van Schijndel1-41/+0
treewide: remove unreferenced patch files
2023-12-01Merge branch 'staging' into staging-nextVladimír Čunát1-11/+5
2023-12-01treewide: remove unreferenced patch filesPeder Bergebakken Sundt1-41/+0
Found with `fd \\.patch$ pkgs/ -x bash -c 'rg -F "{/}" pkgs/ -q || echo {}'`
2023-11-30pkgsStatic.stdenv: fix custom CMake LINKER_LANGUAGEAlyssa Ross1-0/+2
If a CMake target has a non-default LINKER_LANGUAGE set, CMake will manually add the libraries it has detected that language's compiler as linking implicitly. When it does this, it'll pass -Bstatic and -Bdynamic options based on the vibes it gets from each such detected library. This in itself isn't a problem, because the compiler toolchain, or our wrapper, or something, seems to be smart enough to ignore -Bdynamic for those libraries. But it does create a problem if the compiler adds extra libraries to the linker command line after that final -Bdynamic, because those will be linked dynamically. Since our compiler is static by default, CMake should reset to -Bstatic after it's done manually specifying libraries, but CMake didn't actually know that our compiler is static by default. The fix for that is to tell it, like so. Until recently, this problem was difficult to notice, because it would result binaries that worked, but that were dynamically linked. Since e08ce498f03f ("cc-wrapper: Account for NIX_LDFLAGS and NIX_CFLAGS_LINK in linkType"), though, -Wl,-dynamic-linker is no longer mistakenly passed for executables that are supposed to be static, so they end up created with a /lib interpreter path, and so don't run at all on NixOS. This fixes pkgsStatic.graphite2.
2023-11-29Merge staging-next into staginggithub-actions[bot]1-24/+63
2023-11-29Merge pull request #267309: check-meta: Improve performancepiegames1-24/+63
2023-11-26Merge pull request #265738 from Artturin/patchshebangconArtturi1-0/+4
stdenv: run patchShebangs on the configure script when it's a file
2023-11-25stdenv: run patchShebangs on the configure script when it's a fileArtturin1-0/+4
if the configure script has a `/usr/bin/env` or some other shebang which is not in the sandbox then there will be errors such as `...-stdenv-linux/setup: line 1299: ./configure: cannot execute: required file not found` There are 250 files which `patchShebangs` `./configure` https://github.com/search?q=NOT+is%3Afork+lang%3Anix+%2FpatchShebangs+.%5C%2Fconfigure%2F&type=code
2023-11-17Merge staging-next into staginggithub-actions[bot]1-4/+18
2023-11-17Merge pull request #267058 from toonn/bootstrap-tools-specify-llvmK9001-4/+18
freshBootstrapTools: Overlay the package set with the desired LLVM
2023-11-17Update pkgs/stdenv/darwin/make-bootstrap-tools.nixAdam Joseph1-0/+13
2023-11-17stdenv: consistent phases headerIvan Mincik1-11/+1
Make phases header consistent for all phases. `Running phase:` is from an old nix ux doc from 2020 https://github.com/tweag/nix-ux/blob/master/first_steps_with_nix_v2.md Co-authored-by: Artturin <Artturin@artturin.com>
2023-11-14check-meta: don't use recArtturin1-2/+4
possible performance improvement
2023-11-13check-meta: don't use withArtturin1-1/+14
2023-11-13check-meta: Improve performanceArtturin1-22/+46
See c3c31aa798551a2808981d14537d04de8f51dff8
2023-11-12Merge branch 'master' into staging-nextWeijia Wang1-82/+119
2023-11-12freshBootstrapTools: Overlay the package set with the desired LLVMtoonn1-4/+5
As reported in #241692, since the `llvmPackages` bump the bootstrap-tools started failing to build due to a mismatch in LLVM versions used to build certain tools. By overlaying the imported package set to specify `llvmPackages`, we get everything built with the expected LLVM version.
2023-11-12stdenv: Improve performanceArtturin1-82/+119
| stat | before | after | Δ | Δ% | |------------------------|-----------------|-----------------|-----------------|---------| | cpuTime | 513.67 | 507.77 | ↘ 5.90 | -1.15% | | envs-bytes | 20,682,847,968 | 20,628,961,616 | ↘ 53,886,352 | -0.26% | | envs-elements | 1,054,735,104 | 1,051,395,620 | ↘ 3,339,484 | -0.32% | | envs-number | 765,310,446 | 763,612,291 | ↘ 1,698,155 | -0.22% | | gc-heapSize | 53,439,602,688 | 51,711,545,344 | ↘ 1,728,057,344 | -3.23% | | gc-totalBytes | 113,062,066,672 | 112,139,998,240 | ↘ 922,068,432 | -0.82% | | list-bytes | 3,118,249,784 | 3,118,249,784 | 0 | | | list-concats | 52,834,140 | 52,834,140 | 0 | | | list-elements | 389,781,223 | 389,781,223 | 0 | | | nrAvoided | 968,097,988 | 991,889,795 | ↗ 23,791,807 | 2.46% | | nrFunctionCalls | 697,259,792 | 697,259,792 | 0 | | | nrLookups | 510,257,062 | 338,275,331 | ↘ 171,981,731 | -33.70% | | nrOpUpdateValuesCopied | 1,446,690,216 | 1,446,690,216 | 0 | | | nrOpUpdates | 68,504,034 | 68,504,034 | 0 | | | nrPrimOpCalls | 429,464,805 | 429,464,805 | 0 | | | nrThunks | 1,009,240,391 | 982,109,100 | ↘ 27,131,291 | -2.69% | | sets-bytes | 33,524,722,928 | 33,524,722,928 | 0 | | | sets-elements | 1,938,309,212 | 1,938,309,212 | 0 | | | sets-number | 156,985,971 | 156,985,971 | 0 | | | sizes-Attr | 16 | 16 | 0 | | | sizes-Bindings | 16 | 16 | 0 | | | sizes-Env | 16 | 16 | 0 | | | sizes-Value | 24 | 24 | 0 | | | symbols-bytes | 2,151,298 | 2,151,298 | 0 | | | symbols-number | 159,707 | 159,707 | 0 | | | values-bytes | 30,218,194,248 | 29,567,043,264 | ↘ 651,150,984 | -2.15% | | values-number | 1,259,091,427 | 1,231,960,136 | ↘ 27,131,291 | -2.15% | > Accessing the lexical scope directly should be more efficient, yes, because it changes from a binary search (many lookups) to just two memory accesses > correction: one short linked list + one array access > oh and you had to do the lexical scope lookup anyway for lib itself > so it really does save a binary search at basically no extra cost - roberth after seeing the stats > Oooh nice. I did not consider that more of the maybeThunk optimization becomes effective (nrAvoided). Those lookups also caused allocations! - roberth Left `lib.generators` and `lib.strings` alone because they're only used once.
2023-11-11Merge pull request #265102 from reckenrode/darwin-corefoundationRandy Eckenrode1-23/+42
darwin.stdenv: use CoreFoundation instead of CF
2023-11-09stdenv: fix meson rust cross compilationAlyssa Ross1-0/+2
2023-11-09Merge staging-next into staginggithub-actions[bot]1-3/+2
2023-11-09Merge master into staging-nextgithub-actions[bot]1-3/+2
2023-11-07Merge pull request #230874 from Ninlives/runPhaseArtturi1-33/+39
2023-11-07Merge branch 'staging-next' into stagingWeijia Wang1-2/+49
2023-11-07Merge pull request #243161 from nh2/more-enableStaticArtturi1-1/+1
2023-11-07stdenv: wrap phase running actions of genericBuildmlatus1-33/+39
Provide a `runPhase` function which wraps the phase running action of genericBuild. The new function can be used as an interface by `nix develop`, i.e. `nix develop some#flake --build` may just call `runPhase build`, which makes its behavior more consistent with `nix build`. In preparation of fixing https://github.com/NixOS/nix/issues/6202
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-02darwin.stdenv: use CoreFoundation instead of CFRandy Eckenrode1-23/+42
This patch switches the CoreFoundation on x86_64-darwin from the open source swift-corelibs-foundation (CF) to the system CoreFoundation. This change was motivated by failures building packages for the current staging-next cycle #263535 due to an apparent incompatibility with the rpath-based approach to choosing CF or CoreFoundation and macOS 14. This error often manifests as a crash with an Illegal Instruction. For example, building aws-sdk-cpp for building Nix will fail this way. https://hydra.nixos.org/build/239459417/nixlog/1 Application Specific Information: CF objects must have a non-zero isa Error Formulating Crash Report: PC register does not match crashing frame (0x0 vs 0x7FF8094DD640) Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 CoreFoundation 0x7ff8094dd640 CF_IS_OBJC.cold.1 + 14 1 CoreFoundation 0x7ff8094501d0 CF_IS_OBJC + 60 2 CoreFoundation 0x7ff8093155e8 CFRelease + 40 3 ??? 0x10c7a2c61 s_aws_secure_transport_ctx_destroy + 65 4 ??? 0x10c87ba32 aws_ref_count_release + 34 5 ??? 0x10c7b7adb aws_tls_connection_options_clean_up + 27 6 ??? 0x10c596db4 Aws::Crt::Io::TlsConnectionOptions::~TlsConnectionOptions() + 20 7 ??? 0x10c2d249c Aws::CleanupCrt() + 92 8 ??? 0x10c2d1ff0 Aws::ShutdownAPI(Aws::SDKOptions const&) + 64 9 ??? 0x102d9bc6f main + 335 10 dyld 0x202f333a6 start + 1942 According to a [post][1] on the Apple developer forums, hardening was added to CoreFoundation, and this particular message occurs when you attempt to release an object it does not recognize as a valid CF object. (Thank you to @lilyinstarlight for finding this post). When I switched aws-sdk-cpp to link against CoreFoundation instead of CF, the error went away. Somehow both libraries were being used. To prevent dependent packages from linking the wrong CoreFoundation, it would need to be added as a propagated build input. Note that there are other issues related to mixing CF and CoreFoundation frameworks. #264503 fixes an issue with abseil-cpp where it propagates CF, causing issues when using a different SDK version. Mixing versions can also cause crashes with Python when a shared object is loaded that is linked to the “wrong” CoreFoundation. `NIX_COREFOUNDATION_RPATH` is supposed to make sure the right CoreFoundation is being used, but it does not appear to be enough on macOS 14 (presumably due to the hardening). While it is possible to propagate CoreFoundation manually, the cleaner solution is to make it the default. CF remains available as `darwin.swift-corelibs-foundation`. [1]: https://developer.apple.com/forums/thread/739355
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-31check-meta.nix: Fix flake noteRobert Hensing1-3/+2
- These new-cli commands can be used with `-f`, in which case they're evaluated with pure evaluation disabled. - Nix 2.4+ is not part of the condition; "flakes" is fully descriptive and more relatable. - Don't suggest that it only enables this variable. - Just don't say too much.
2023-10-31stdenvAdapters.overrideSDK: override xcodebuild to use the requested SDKRandy Eckenrode1-1/+22
2023-10-27Merge pull request #263598 from reckenrode/curl-propagation-fixtoonn1-0/+99
curl: fix build failures due to needing to propagate frameworks
2023-10-26Merge master into staging-nextgithub-actions[bot]1-0/+11
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-25stdenv.mkDerivation: Reject MD5 hashesnicoo1-0/+11
While there is no fetcher or builder (in nixpkgs) that takes an `md5` parameter, for some inscrutable reason the nix interpreter accepts the following: ```nix fetchurl { url = "https://www.perdu.com"; hash = "md5-rrdBU2a35b2PM2ZO+n/zGw=="; } ``` Note that neither MD5 nor SHA1 are allowed by the syntax of SRI hashes.
2023-10-21Merge pull request #260963 from reckenrode/curl-fixtoonn1-14/+44
curl: fix infinite recursion in staging-next
2023-10-21Merge staging-next into staginggithub-actions[bot]1-1/+1