summary refs log tree commit diff
path: root/lib/attrsets.nix
Commit message (Collapse)AuthorAge
* Merge pull request #254452 from flyingcircusio/lib-attrsToListSilvan Mosberger2023-10-10
|\ | | | | lib.attrsets.attrsToList: add function
| * lib.attrsets.attrsToList: add functionOliver Schmidt2023-10-10
| | | | | | | | | | | | | | | | | | For transforming back between lists and attrsets, it makes sense to have a quasi-inverse of `builtins.listToAttrs` available as a library function. Co-authored-by: Silvan Mosberger <github@infinisil.com> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
* | lib.attrsets.foldlAttrs: Make stricterSilvan Mosberger2023-09-27
| | | | | | | | See the parent commit for the same change to lib.lists.foldl'
* | lib.lists.foldl': Make strict in the initial accumulatorSilvan Mosberger2023-09-27
|/ | | | | To maintain backwards compatibility, this can't be changed in the Nix language. We can however ensure that the version Nixpkgs has the more intuitive behavior.
* lib.attrsets.mergeAttrsList: initSilvan Mosberger2023-07-18
| | | | Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
* lib/attrsets: remove unused let bindingsfigsoda2023-06-23
|
* lib.concatMapAttrs: Simplify stack traceRobert Hensing2023-05-31
|
* lib: add missing removeAttrs builtinzimbatm2023-04-19
| | | | I'm expecting all the builtins.* functions to be available in lib.*
* init: lib.foldlAttrshsjobeki2023-03-11
| | | | | - provide comprehensive example - add unit test
* lib: standardise attrset type syntaxColin Arnott2023-01-30
| | | | | | | | There are a number of different syntaxes used for attrset type signatures in our doc strings, this change standardises upon one that uses :: for specifying attribute type, and ; terminators to be consistent with nix syntax. There are no bugs in the functions themselves, just that different syntaxes may confuse new users.
* Update lib/attrsets.nixAdam Joseph2023-01-25
| | | Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
* attrsets: clarify that mapAttrs maps over *leaf* attrsAdam Joseph2023-01-22
|
* lib: Fix mismatched quotes in `lib.*` doc commentsYoshiRulz2023-01-02
| | | | | caused problems for automated rich text generation such as https://teu5us.github.io/nix-lib.html#customisation-functions
* attrsets: fix and add some doc typeshsjobeki2022-12-24
|
* lib: fix typosfigsoda2022-12-17
|
* doc: auto-generate asserts and attrset library docsRyan Mulligan2022-12-08
| | | | | | | | If all the docs are auto-generated, it should be easier to convert them to Commonmark. Co-Authored-By: Valentin Gagarin <valentin.gagarin@tweag.io> Co-Authored-By: Silvan Mosberger <contact@infinisil.com>
* lib/attrsets: add concatMapAttrsfigsoda2022-11-17
|
* lib/attrsets: simplify chooseDevOutputsfigsoda2022-11-17
|
* unionOfDisjoint: use builtins.intersectAttrsAdam Joseph2022-09-25
| | | | | | | | | | | | | This brings two benefits: 1. The complete list of collisions is printed in the whenever any colliding attribute is accessed. 2. The sets are intersected using a C++ primitive, which runs in O(n) time (intersecting pre-sorted lists) with small constants rather than interpreted Nix code. Thanks to @toonn for prompting this improvement.
* note that `unionOfDisjoint` is commutative, unlike //Adam Joseph2022-09-12
|
* lib/attrsets.nix: add unionOfDisjointAdam Joseph2022-09-12
|
* lib.foldAttrs: Clarify exampleRobert Hensing2022-05-10
|
* Merge pull request #147077 from Infinisil/updateAttrPathsRobert Hensing2022-03-19
|\ | | | | Introduce `lib.updateManyAttrsByPath`
| * lib.attrsets: Introduce updateManyAttrsByPathSilvan Mosberger2022-03-18
| |
| * lib.attrsets: Introduce showAttrPathSilvan Mosberger2022-03-18
| |
* | lib.isDerivation: SimplifyRobert Hensing2022-03-09
|/
* fix: typo in lib/attrsets.nixJohn Rinehart2022-02-10
|
* Merge pull request #152392 from polykernel/attrset-optimizations-patch-1pennae2022-01-11
|\ | | | | lib/attrset: various function optimizations
| * lib/attrset: miscellaneous optimizationspolykernel2021-12-27
| | | | | | | | | | | | | | - Eta reduce `mapAttrsRecursiveCond`, `foldAttrs`, `getAttrFromPath`. - Modify `matchAttrs` to use `elemAt` instead of `head (tail xs)` to access elements. - Modify `matchAttrs` to use `any id` instead of `foldr and true`.
| * lib/attrset: optimize element access in recursiveUpdateUntilpolykernel2021-12-27
| | | | | | | | | | | | | | | | | | - Eta reduce formal arguments of `recursiveUpdate'. - Access elements in `recursiveUpdateUntil` using `elemAt` and `head` directly instead of `head (tail xs)` which copies a singleton unnecessarily. (`elemAt` is used instead of `last` to save a primitive call to `length`, this is possible because the 2-tuple structure is guranteed) - Use `length` instead of comparison to empty list to save a copy.
* | lib/attrsets: use builtins.zipAttrsWith if availablepennae2021-12-25
|/
* lib: make extendDerivation lighter on evalpennae2021-10-15
| | | | | | | | | the fix to extendDerivation in #140051 unwittingly worsened eval performance by quite a bit. set elements alone needed over 1GB extra after the change, which seems disproportionate to how small it was. if we flip the logic used to determine which outputs to install around and keep a "this one exactly" flag in the specific outputs instead of a "all of them" in the root we can avoid most of that cost.
* lib: optimize setAttrByPath and cleaup importspolykernel2021-08-23
| | | | | | | - Remove inheritance of `lists.fold` as it isn't used anywhere. - Inherit `foldl'` for consistency as only `cartesianProductOfSets` explicitly reference lib. - Inline `foldr` to generate nested attrs instead of using `listToAttrs` and `tail`.
* Merge pull request #110742 from siraben/deprecate-foldBen Siraphob2021-07-27
|\
| * treewide: fold -> foldrBen Siraphob2021-01-26
| |
* | nixpkgs-manual: lib.attrsets.mapAttrsToList returns a list (#122179)Erlend Pedersen2021-05-08
| |
* | lib/attrsets: add cartesianProductOfSets functionJacek Galowicz2021-01-28
|/
* lib/attrsets: add getMan functionrnhmjoj2020-06-18
|
* lib/attrsets: fix typo in the comment of mapAttrsRecursiveCondPierre Allix2020-06-16
|
* Merge pull request #83241 from Infinisil/valid-drv-nameSilvan Mosberger2020-04-02
|\ | | | | lib/strings: Add `sanitizeDerivationName` function
| * lib/strings: Add sanitizeDerivationName functionSilvan Mosberger2020-03-30
| |
* | Merge pull request #68491 from roberth/fix-dontRecurseIntoAttrsRobert Hensing2020-03-01
|\ \ | |/ |/| Fix dontRecurseIntoAttrs + add to lib + doc
| * Document attrsets.recurseIntoAttrsRobert Hensing2019-09-11
| |
| * top-level: Fix dontRecurseIntoAttrs and include in libRobert Hensing2019-09-11
| | | | | | | | | | dontRecurseIntoAttrs was a noop (x: x), causing the expression dontRecurseIntoAttrs (recurseIntoAttrs a) to have the wrong effect.
| * lib: Add recurseIntoAttrsRobert Hensing2019-09-11
| | | | | | | | | | | | | | | | | | This makes the function available without having to evaluate the Nixpkgs fix-point, making it available in a more natural way for code that deals with multiple Nixpkgs invocations. Its definition is coupled to Nix rather than Nixpkgs, so it will feel right at home in lib.
* | lib/attrsets: Fix error in comment for getAttrFromPathSilvan Mosberger2020-01-20
| |
* | lib: fix typo in 'zipAttrsWith' documentationPeter Simons2019-09-11
|/
* bundlerEnv: ensure dependencies always includedAlyssa Ross2018-12-11
| | | | | | | | | | | | | | | | | | | | | | | | Suppose I have a Gemfile like this: source "https://rubygems.org" gem "actioncable" gem "websocket-driver", group: :test The gemset.nix generated by Bundix 2.4.1 will set ActionCable's groups to [ "default" ], and websocket-driver's to [ "test" ]. This means that the generated bundlerEnv wouldn't include websocket-driver unless the test group was included, even though it's required by the default group. This is arguably a bug in Bundix (websocket-driver's groups should probably be [ "default" "test" ] or just [ "default" ]), but there's no reason bundlerEnv should omit dependencies even given such an input -- it won't necessarily come from Bundix, and it would be good for bundlerEnv to do the right thing. To fix this, filterGemset is now a recursive function, that adds dependencies of gems in the group to the filtered gemset until it stabilises on the gems that match the required groups, and all of their recursive dependencies.
* lib.overrideExisting: Better exampleSilvan Mosberger2018-09-17
|
* lib: Improve overrideExisting implementationSilvan Mosberger2018-09-07
|