about summary refs log tree commit diff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2023-11-27lib.attrsets.matchAttrs: Avoid some list allocations when walking structureadisbladis2-9/+40
Benchmarks (`nix-instantiate ./. -A python3`): - Before: ``` json { "cpuTime": 0.29049500823020935, "envs": { "bytes": 4484216, "elements": 221443, "number": 169542 }, "gc": { "heapSize": 402915328, "totalBytes": 53086800 }, "list": { "bytes": 749424, "concats": 4242, "elements": 93678 }, "nrAvoided": 253991, "nrFunctionCalls": 149848, "nrLookups": 49612, "nrOpUpdateValuesCopied": 1587837, "nrOpUpdates": 10104, "nrPrimOpCalls": 130356, "nrThunks": 358981, "sets": { "bytes": 30423600, "elements": 1859999, "number": 41476 }, "sizes": { "Attr": 16, "Bindings": 16, "Env": 16, "Value": 24 }, "symbols": { "bytes": 236145, "number": 24453 }, "values": { "bytes": 10502520, "number": 437605 } } ``` - After: ``` json { "cpuTime": 0.2946169972419739, "envs": { "bytes": 3315224, "elements": 172735, "number": 120834 }, "gc": { "heapSize": 402915328, "totalBytes": 48718432 }, "list": { "bytes": 347568, "concats": 4242, "elements": 43446 }, "nrAvoided": 173252, "nrFunctionCalls": 101140, "nrLookups": 73595, "nrOpUpdateValuesCopied": 1587837, "nrOpUpdates": 10104, "nrPrimOpCalls": 83067, "nrThunks": 304216, "sets": { "bytes": 29704096, "elements": 1831673, "number": 24833 }, "sizes": { "Attr": 16, "Bindings": 16, "Env": 16, "Value": 24 }, "symbols": { "bytes": 236145, "number": 24453 }, "values": { "bytes": 8961552, "number": 373398 } } ``` (cherry picked from commit 013a0a1357c446d0a46b4bbd8f68512fd9223257)
2023-11-26lib.meta: Avoid attrset allocation in platformMatchadisbladis2-10/+42
Benchmarks (`nix-instantiate ./. -A python3`) - Before ``` json { "cpuTime": 0.30625399947166443, "envs": { "bytes": 4484216, "elements": 221443, "number": 169542 }, "gc": { "heapSize": 402915328, "totalBytes": 53091024 }, "list": { "bytes": 749424, "concats": 4242, "elements": 93678 }, "nrAvoided": 253991, "nrFunctionCalls": 149848, "nrLookups": 49614, "nrOpUpdateValuesCopied": 1588326, "nrOpUpdates": 10106, "nrPrimOpCalls": 130356, "nrThunks": 359013, "sets": { "bytes": 30432320, "elements": 1860540, "number": 41480 }, "sizes": { "Attr": 16, "Bindings": 16, "Env": 16, "Value": 24 }, "symbols": { "bytes": 236218, "number": 24459 }, "values": { "bytes": 10504632, "number": 437693 } } ``` - After ``` { "cpuTime": 0.29695799946784973, "envs": { "bytes": 3296712, "elements": 169055, "number": 121517 }, "gc": { "heapSize": 402915328, "totalBytes": 49044992 }, "list": { "bytes": 504928, "concats": 4242, "elements": 63116 }, "nrAvoided": 175403, "nrFunctionCalls": 110554, "nrLookups": 44907, "nrOpUpdateValuesCopied": 1588326, "nrOpUpdates": 10106, "nrPrimOpCalls": 82330, "nrThunks": 306625, "sets": { "bytes": 29943328, "elements": 1843076, "number": 28382 }, "sizes": { "Attr": 16, "Bindings": 16, "Env": 16, "Value": 24 }, "symbols": { "bytes": 236218, "number": 24459 }, "values": { "bytes": 9037752, "number": 376573 } } ``` (cherry picked from commit 4b4d4138177fd467cd8e726470824afac6ad3df5)
2023-11-24lib.systems.elaborate: fix passing `rust`Alyssa Ross1-92/+92
Usually, attributes passed explicitly to elaborate take precedence over the elaborated ones, but since we also elaborate the nested "rust" attrset, we need to push that one level down, so the rest of "rust" is still filled in if you just pass { rust = { config = ... } }. I've had to drop the assertion that checked that at most one of "rust" and "rustc" was part of the un-elaborated system, because doing this broke passing an elaborated system in, which should be idempotent. For the same reason, I've also had to make it possible for rust.rustcTargetSpec to be passed in. Otherwise, on the second call, since platform was filled in by the first, the custom target file would be constructed. The only other way to avoid this would be to compare the platform attrs to all built in Rust targets to check it wasn't one of those, and that isn't feasible. Fixes: e3e57b8f1885 ("lib.systems: elaborate Rust metadata") (cherry picked from commit 886c89287f6a35adb6eb9230a3a0cccf682d0f88)
2023-11-23lib.fileset.fileFilter: Predicate attribute for file extensionSilvan Mosberger3-3/+46
(cherry picked from commit 6816f28c960c523e6a30f2ad4a1cc812251f5ffb)
2023-11-22lib.fileset: Document decision for strict existence checksSilvan Mosberger1-0/+13
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> (cherry picked from commit 827232d6dd2b7787749afdfef614fbea8d88ebe9)
2023-11-22lib.fileset.maybeMissing: initSilvan Mosberger4-7/+69
(cherry picked from commit 1cc2c2f13d7a548759a55f710fd0222da14c5403)
2023-11-20Merge pull request #268619 from tweag/lib-descriptionsSilvan Mosberger7-17/+20
lib: Take advantage of section descriptions
2023-11-20lib: Take advantage of section descriptionsSilvan Mosberger7-17/+20
See https://github.com/nix-community/nixdoc/releases/tag/v2.6.0
2023-11-19lib.fileset: Re-order to match reference overviewSilvan Mosberger1-200/+200
2023-11-19lib.fileset: Add overview section to reference docsSilvan Mosberger1-2/+44
2023-11-19Merge pull request #268520 from tweag/fileset-minor-changesSilvan Mosberger3-6/+11
`lib.fileset`: Minor changes
2023-11-19lib.fileset: Minor changesSilvan Mosberger3-6/+11
- Make fromSource's missing file error message more consistent with others, and add a test for it - Indent some function arguments - Fix an internal type
2023-11-19lib.fileset: Move introduction section above the functionsSilvan Mosberger1-0/+49
Previously the introductory section and the function listings were in different places. But now nixdoc supports having them together with https://github.com/nix-community/nixdoc/pull/70!
2023-11-19Merge pull request #266443 from amjoseph-nixpkgs/pr/lib-tests-no-aws-sdkSilvan Mosberger3-5/+26
2023-11-18lib.tests: build nix without flaky aws-sdk-cppAdam Joseph3-5/+26
The aws-sdk-cpp tests are flaky. Since pull requests to staging cause nix to be rebuilt, this means that staging PRs end up getting false CI failures due to whatever is flaky in the AWS SDK tests. Since none of our CI needs to (or should be able to) contact AWS S3, let's just omit it all. Bonus: the tests build way faster.
2023-11-16Merge master into staging-nextgithub-actions[bot]4-16/+348
2023-11-16lib.fileset.gitTracked: Better error in pure evalSilvan Mosberger2-18/+49
2023-11-16Merge branch 'master' into staging-nextVladimír Čunát4-31/+52
2023-11-16lib.fileset.gitTrackedWith: Introduce recurseSubmodules parameterSilvan Mosberger3-6/+53
2023-11-16lib.fileset.gitTracked/gitTrackedWith: initSilvan Mosberger4-1/+255
A configuration parameter for gitTrackedWith will be introduced in the next commit
2023-11-16Merge pull request #267384 from tweag/fileset.fileFilter-path2Robert Hensing4-31/+52
`fileset.fileFilter`: Restrict second argument to paths
2023-11-15Merge branch 'master' into staging-nextVladimír Čunát6-17/+77
2023-11-15Merge pull request #239722 from Stunkymonkey/lib-allUniqueSilvan Mosberger3-1/+23
lib.lists.allUnique: init
2023-11-15lib.fileset.fileFilter: Restrict second argument to pathsSilvan Mosberger4-31/+52
While this change is backwards-incompatible, I think it's okay because: - The `fileFilter` function is not yet in a stable NixOS release, it was only merged about [a month ago](https://github.com/NixOS/nixpkgs/pull/257356). - All public uses of the function on GitHub only pass a path - Any `fileFilter pred fileset` can also be expressed as `intersection fileset (fileFilter pred path)` without loss of functionality. - This is furthermore pointed out in the new error message when a file set is passed
2023-11-15Merge pull request #267381 from tweag/fileset.fileFilter-pathSilvan Mosberger3-16/+54
`fileset.fileFilter`: Don't run predicate unnecessarily
2023-11-14lib.lists.allUnique: initFelix Buehler3-1/+23
2023-11-14Merge remote-tracking branch 'origin/master' into staging-nextMartin Weinelt1-0/+20
Conflicts: - pkgs/development/libraries/gdcm/default.nix
2023-11-14Merge pull request #263059 from DanielSidhion/add-doc-conventionSilvan Mosberger1-0/+20
doc: commit header convention for documentation changes
2023-11-14lib.fileset.fileFilter: Don't run predicate unnecessarilySilvan Mosberger2-16/+43
Before: nix-repl> fileset.trace (fileset.fileFilter (file: builtins.trace file.name false) ./default.nix) trace: README.md trace: benchmark.sh trace: default.nix trace: internal.nix trace: mock-splitRoot.nix trace: tests.sh After: nix-repl> fileset.trace (fileset.fileFilter (file: builtins.trace file.name false) ./default.nix) trace: default.nix
2023-11-14lib.fileset.fileFilter: Minor cleanups and more testsSilvan Mosberger3-2/+13
2023-11-14Merge master into staging-nextgithub-actions[bot]5-13/+46
2023-11-13doc: separate commit header conventions for each area, info on docs changes.DS1-0/+20
2023-11-14Merge pull request #265710 from ShamrockLee/lib-copy-function-argsSilvan Mosberger3-9/+45
lib.mirrorFunctionArgs: init
2023-11-13lib.fileset: Very minor changesSilvan Mosberger2-4/+1
2023-11-11Merge master into staging-nextgithub-actions[bot]1-5/+5
2023-11-11treewide: fix redirected and broken URLsAnthony Roussel1-5/+5
Using the script in maintainers/scripts/update-redirected-urls.sh
2023-11-11Merge staging-next into staginggithub-actions[bot]4-29/+398
2023-11-10Merge pull request #261732 from tweag/fileset.fromSourceRobert Hensing4-29/+398
`lib.fileset.fromSource`: init
2023-11-10Merge staging-next into staginggithub-actions[bot]4-57/+83
2023-11-09Merge pull request #266349 from tweag/fileset/cleanupsSilvan Mosberger3-57/+54
Minor `lib.fileset` cleanups
2023-11-09lib: add asserts.assertEachOneOfProfpatsch1-0/+29
Along the lines of `assertOneOf`, but expects a list of values to be compared. This gives a good error message and is useful for lists of values, like `supportedGhcVersions` in the arguments of `haskell-language-server`.
2023-11-09lib.systems: elaborate Rust metadataAlyssa Ross1-2/+98
We need this stuff to be available in lib so make-derivation.nix can access it to construct the Meson cross file. This has a couple of other advantages: - It makes Rust less special. Now figuring out what Rust calls a platform is the same as figuring out what Linux or QEMU call it. - We can unify the schema used to define Rust targets, and the schema used to access those values later. Just like you can set "config" or "system" in a platform definition, and then access those same keys on the elaborated platform, you can now set "rustcTarget" in your crossSystem, and then access "stdenv.hostPlatform.rustcTarget" in your code. "rustcTarget", "rustcTargetSpec", "cargoShortTarget", and "cargoEnvVarTarget" have the "rustc" and "cargo" prefixes because these are not exposed to code by the compiler, and are not standardized. The arch/os/etc. variables are all named to match the forms in the Rust target spec JSON. The new rust.target-family only takes a list, since we don't need to worry about backwards compatibility when that name is used. The old APIs are all still functional with no warning for now, so that it's possible for external code to use a single API on both 23.05 and 23.11. We can introduce the warnings once 23.05 is EOL, and make them hard errors when 23.11 is EOL.
2023-11-09lib.fileset: Remove unused bindingsSilvan Mosberger1-3/+0
Thanks nixd!
2023-11-08lib.fileset: Make error messages more uniformSilvan Mosberger3-45/+47
Just minor changes like: - Always using "X is a Y, but it should be Z" - "X is a path that does not exist" rather than "X does not exist" - Always using multi-line strings for errors - Always quoting string-like values and not quoting path-like values - But do quote filesystem roots. Even though they're paths, they might be very small, good to have quotes to know the start/end - Capitalise the first word - Distinguish root vs filesystem root more
2023-11-08lib.fileset: Remove nixdoc workaroundSilvan Mosberger1-9/+7
This problem was fixed in https://github.com/nix-community/nixdoc/pull/81 which is included in version 2.5.1, which is now used in Nixpkgs
2023-11-08lib.licenses: nvidia*: add shortName-sSomeone Serge1-0/+1
2023-11-08cudaPackages: redist components: per-package license urlSomeone Serge1-0/+8
2023-11-08lib.licenses: nvidia*: use same fullNames as conda doesSomeone Serge1-1/+1
2023-11-08cudnn_cudatoolkit: add NVIDIA licenseTyler Benster1-6/+0
2023-11-08lib.licenses: add NVIDIA licensesTyler Benster1-0/+12