about summary refs log tree commit diff
path: root/lib
Commit message (Collapse)AuthorAge
* Merge pull request #269551 from tejing1/nixos-stub-ldRobert Hensing2023-12-13
|\ | | | | nixos/stub-ld: init module
| * lib.systems.elaborate: add libDir attributeJeff Huffman2023-12-03
| |
* | Merge pull request #273704 from adisbladis/lib-getexe-efficiencySilvan Mosberger2023-12-13
|\ \ | | | | | | lib.getExe: Make more efficient
| * | lib.getExe: Make more efficientadisbladis2023-12-12
| | |
* | | Merge pull request #274022 from hercules-ci/doc-attrsets-operatorsSilvan Mosberger2023-12-13
|\ \ \ | | | | | | | | lib/attrsets: Document and link Nix language operators
| * | | lib/attrsets: Document and link Nix language operatorsRobert Hensing2023-12-13
| | | |
* | | | lib.path.hasStorePathPrefix: initSilvan Mosberger2023-12-13
| | | | | | | | | | | | | | | | Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
* | | | Merge pull request #273664 from tweag/fileset.gitTracked-improvementsSilvan Mosberger2023-12-13
|\ \ \ \ | |_|/ / |/| | | `lib.fileset.gitTracked,gitTrackedWith`: Minor improvements
| * | | lib.fileset.gitTracked: Improve error when passing filesSilvan Mosberger2023-12-11
| | | |
| * | | lib.fileset: Refactor gitTracked and gitTrackedWithSilvan Mosberger2023-12-11
| | |/ | |/| | | | | | | | | | Introduce an internal function for them to share more behavior. This makes future changes easier.
* | | Merge pull request #273473 from adisbladis/lib-isConvertibleToString-static-listSilvan Mosberger2023-12-11
|\ \ \ | | | | | | | | lib.isConvertibleToString: Statically compute types list
| * | | lib.isConvertibleToString: Statically compute types listadisbladis2023-12-11
| | | |
* | | | Merge pull request #273470 from adisbladis/lib-tohexstring-static-valuesSilvan Mosberger2023-12-11
|\ \ \ \ | | | | | | | | | | lib.toHexString: Statically compute hexDigits attrset
| * | | | lib.toHexString: Statically compute hexDigits attrsetadisbladis2023-12-11
| |/ / /
* | | | Merge pull request #273474 from adisbladis/lib-cmakeOptionType-static-listSilvan Mosberger2023-12-11
|\ \ \ \ | | | | | | | | | | lib.cmakeOptionType: Statically compute types list
| * | | | lib.cmakeOptionType: Statically compute types listadisbladis2023-12-11
| |/ / /
* | | | Merge pull request #273467 from adisbladis/lib-pipe-no-letSilvan Mosberger2023-12-11
|\ \ \ \ | | | | | | | | | | lib.pipe: Avoid creating a scope
| * | | | lib.pipe: Avoid creating scopesadisbladis2023-12-11
| |/ / /
* | | | Merge pull request #273004 from hercules-ci/attrset-path-longest-prefixRobert Hensing2023-12-11
|\ \ \ \ | | |_|/ | |/| | lib.attrsets.longestValidPathPrefix: init
| * | | lib.attrsets.hasAttrByPath: Document law and laziness, and test itRobert Hensing2023-12-08
| | | |
| * | | lib.attrsets.longestValidPathPrefix: initRobert Hensing2023-12-08
| | | | | | | | | | | | | | | | | | | | Allows finding the most specific path that exists. This is useful for error messages relating to attribute paths.
* | | | Merge pull request #257100 from Ma27/version-info-libRobert Hensing2023-12-11
|\ \ \ \ | |_|/ / |/| | | flake: fix `lib.trivial.version` when used from a flake
| * | | flake/version overlay: review fixesMaximilian Bosch2023-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Improves the comments of `lib/flake-version-info.nix` and drops the `__`-prefix from the filename. * `lib'` -> `lib0` in `nixpkgs/lib`. * Drop the declaration of `trivial.version` in the overlay because this declaration already uses the final expressions of `versionSuffix` and `release` now. * No need to fall back to `self.lastModified` anymore, this was a workaround for pre2.4 Nix. Co-authored-by: Robert Hensing <robert@roberthensing.nl> Co-authored-by: Silvan Mosberger <contact@infinisil.com>
| * | | lib/trivial: drop `rec` in favor of `lib` fixpointMaximilian Bosch2023-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That way each expression uses the final version of other lib.trivial declarations. For instance, when replacing `versionSuffix` with the string `"fnord"` in a lib overlay, `trivial.version` uses `"fnord"` as suffix now rather than `pre-git`.
| * | | flake: also provide proper version info for lib's flakeMaximilian Bosch2023-12-09
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This effectively means that nixpkgs$ nix eval ./lib#lib.trivial.version "23.11.20231020.ee0d6b5" now gives meaningful results as well. See https://github.com/NixOS/nixpkgs/pull/257100#discussion_r1352075369 for the discussion around this.
* | | lib.strings: Dont create scopes for getName/getVersionadisbladis2023-12-11
| | | | | | | | | | | | We can create the `parse` function in a scope one level up to avoid recomputing it every time.
* | | Merge pull request #272709 from hercules-ci/module-system-test-pr-131205Maximilian Bosch2023-12-10
|\ \ \ | | | | | | | | lib/modules: Test optionless module errors from #131205
| * | | lib/modules: Clarify test assertionsRobert Hensing2023-12-09
| | | |
| * | | lib/modules: Test optionless module errors from #131205Robert Hensing2023-12-09
| | |/ | |/|
* | | Merge pull request #272183 from infinisil/nixpkgs-referenceRobert Hensing2023-12-10
|\ \ \ | | | | | | | | doc: Rename to Nixpkgs reference manual and restate purpose
| * | | doc: Rename to Nixpkgs reference manual and state purposeSilvan Mosberger2023-12-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the time being, we're moving towards https://nix.dev/ containing all tutorials and guides. The Nixpkgs manual is reinforced to be a _reference_ manual. While it's not just reference for now, that's what the docs team is working towards. This commits rewrites the Nixpkgs manual introduction to reflect that and point to some more useful links. The contribution docs are updated similarly so it's not missed. Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
* | | | Merge pull request #272764 from tweag/anyBoolRobert Hensing2023-12-10
|\ \ \ \ | |_|_|/ |/| | | lib.types.anyBool: init
| * | | lib.types.boolByOr: initSilvan Mosberger2023-12-08
| | |/ | |/| | | | | | | | | | | | | | | | This type is necessary to have correct merging behavior for `allowUnfreePredicate` and `allowInsecurePredicate` Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
* | | lib.sort: Make doc consistent with sortOnRobert Hensing2023-12-08
| | |
* | | lib.callPackageWith: Optimize levenshtein sortRobert Hensing2023-12-08
| | | | | | | | | | | | | | | Probably not significant because of the limits already applied. This is mostly cleanup.
* | | lib.sortOn: initRobert Hensing2023-12-08
|/ / | | | | | | | | | | | | | | | | | | | | A more efficient sort in some cases, and often convenient. This exposes `lib.lists.sortOn` immediately on `lib`, because it is a sibling of `sort`, which is already present there. Omitting it would lead to more confusion, and worse outcomes. There's no confusion about the types `sort` or `sortOn` operate on. Haskell agrees about the type for `sortOn`, and it is in its `base`.
* | lib/customisation: fix eval error (attribute "levenshtein" missing)Someone Serge2023-12-03
| |
* | lib.systems.elaborate: fix passing `rust` (more) (#271707)Alyssa Ross2023-12-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An important idea around the rust stuff in lib.systems is that it's elaborated — this means that it should idempotently add to the values passed in, if any. But we missed that the names used for the parameter and the elaborated value for "rustcTarget"/"config" didn't line up. The intention was to use "rustcTarget" everywhere in the new interface, as a more descriptive name than "config". This fixes setting the system in NixOS configuration, which results in an already elaborated system being elaborated again. Before, this wouldn't produce the correct result: % nix-instantiate --eval -A stdenv.hostPlatform.rust.rustcTarget --system armv7l-linux "armv7-unknown-linux-gnueabihf" % NIX_PATH= nix-instantiate --eval -E '(import nixos/lib/eval-config.nix { system = "armv7l-linux"; modules = []; }).pkgs.stdenv.hostPlatform.rust.rustcTarget' "arm-unknown-linux-gnueabihf" Fixes: e3e57b8f1885 ("lib.systems: elaborate Rust metadata") Fixes: https://github.com/NixOS/nixpkgs/issues/271000
* | lib/customisation: fix callPackage error messagesK9002023-12-03
|/
* sudo: fix meta license information (#269788)Pierre Bourdon2023-12-02
|
* lib.customisation.callPackageWith: use throw, not abortAdam Joseph2023-11-30
|
* Merge pull request #270299 from adisbladis/lib-customisation-allocsSilvan Mosberger2023-11-27
|\ | | | | lib.customisation: Refactor nested set access & avoid some allocations
| * lib.customisation: Don't allocate intermediate list for missing argsadisbladis2023-11-27
| |
| * lib.customisation: Inherit lib/builtins into scopeadisbladis2023-11-27
| | | | | | | | It makes the code more readable if we have less nested attrsets being accessed.
* | Merge pull request #269552 from adisbladis/lib-matchattrs-list-allocsRobert Hensing2023-11-27
|\ \ | | | | | | lib.attrsets.matchAttrs: Avoid some list allocations when walking structure
| * | lib.attrsets.matchAttrs: Avoid some list allocations when walking structureadisbladis2023-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 } } ```
* | | lib.attrsets.attrByPath: Don't allocate one extra list per lookup recursionadisbladis2023-11-27
| | | | | | | | | | | | | | | Using `tail` in a recursive loop like this needlessly allocates. This changes the loop to look up by list index instead.
* | | lib.attrsets.hasAttrByPath: Don't allocate one extra list per lookup recursionadisbladis2023-11-27
| |/ |/| | | | | | | Using `tail` in a recursive loop like this needlessly allocates. This changes the loop to look up by list index instead.
* | Merge pull request #269637 from adisbladis/lib-meta-avoid-alloc-platformmatchSilvan Mosberger2023-11-26
|\ \ | |/ |/| lib.meta: Avoid attrset allocation in platformMatch
| * lib.meta: Avoid attrset allocation in platformMatchadisbladis2023-11-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 } } ```