| Commit message (Expand) | Author | Age | Files | Lines |
| * | Merge pull request #152392 from polykernel/attrset-optimizations-patch-1•••lib/attrset: various function optimizations | pennae | 2022-01-11 | 1 | -17/+14 |
| |\ |
|
| | * | lib/attrset: miscellaneous optimizations•••- 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`.
| polykernel | 2021-12-27 | 1 | -10/+10 |
| | * | lib/attrset: optimize element access in recursiveUpdateUntil•••- 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.
| polykernel | 2021-12-27 | 1 | -7/+4 |
| * | | Merge pull request #152046 from pennae/optimize-modules-byName•••lib/modules: optimize byName | Robert Hensing | 2022-01-10 | 2 | -9/+9 |
| |\ \ |
|
| | * | | lib/modules: extract multiply-used value in byName•••module.${attr} is used at least twice, so it must be evaluated at least
twice (and since it's a function argument, be turned into a thunk
twice).
| pennae | 2021-12-28 | 1 | -4/+4 |
| | * | | lib/attrsets: use builtins.zipAttrsWith if available | pennae | 2021-12-25 | 1 | -1/+2 |
| | * | | lib/modules: optimize byName•••the foldl is equivalent to a zip with concat. list concatenation in nix
is an O(n) operation, which makes this operation extremely inefficient
when large numbers of modules are involved.
this change reduces the number of list elements by 7 million on the
system used to write this, total memory spent on lists by 58MB, and
total memory allocated on the GC heap by almost 100MB (with a similar
reduction in GC heap size). it's also slightly faster.
| pennae | 2021-12-25 | 1 | -6/+5 |
| | |/ |
|
| * | | lib.checkListOfEnum: init | José Romildo | 2022-01-09 | 2 | -1/+18 |
| * | | Merge pull request #151748 from hercules-ci/check-nixpkgs-overlays-type•••Check nixpkgs overlays argument types | Robert Hensing | 2022-01-05 | 2 | -1/+24 |
| |\ \ |
|
| | * | | lib.throwIfNot: init | Robert Hensing | 2021-12-22 | 2 | -1/+24 |
| | |/ |
|
| * / | nixos/documentation: split options doc build•••most modules can be evaluated for their documentation in a very
restricted environment that doesn't include all of nixpkgs. this
evaluation can then be cached and reused for subsequent builds, merging
only documentation that has changed into the cached set. since nixos
ships with a large number of modules of which only a few are used in any
given config this can save evaluation a huge percentage of nixos
options available in any given config.
in tests of this caching, despite having to copy most of nixos/, saves
about 80% of the time needed to build the system manual, or about two
second on the machine used for testing. build time for a full system
config shrank from 9.4s to 7.4s, while turning documentation off
entirely shortened the build to 7.1s.
| pennae | 2022-01-02 | 1 | -1/+1 |
| |/ |
|
| * | Merge pull request #148785 from pennae/more-option-doc-staticizing•••treewide: more defaultText for options | Graham Christensen | 2021-12-17 | 1 | -0/+2 |
| |\ |
|
| | * | nixos/modules: Allow options to be coerced to a string for convenience | Silvan Mosberger | 2021-12-08 | 1 | -0/+2 |
| * | | lib.systems.supported: remove aarch64-darwin from Tier 3 list•••While it is a fact of life that aarch64-darwin is built on Hydra, it has
never formally been elevated from the Tier 7 state it was originally
assigned in RFC 0046. Since platform Tier status is not only
descriptive, but also normative, a consensus to commit to supporting
aarch64-darwin would need to be reached.
| sternenseemann | 2021-12-16 | 1 | -2/+3 |
| * | | lib: fix flake check•••`builtins.currentSystem` is not available in pure eval. For this
particular test, we don't really care since it's all about generating
.drv files.
Fixes the following error:
$ nix flake check
warning: unknown flake output 'lib'
error: attribute 'currentSystem' missing
at /nix/store/8wvnlbjxlr90kq2qa6d9zjpj8rqkilr5-source/lib/tests/misc.nix:499:73:
498| let
499| deriv = derivation { name = "test"; builder = "/bin/sh"; system = builtins.currentSystem; };
| ^
500| in {
(use '--show-trace' to show detailed location informat
| zimbatm | 2021-12-13 | 1 | -1/+1 |
| * | | Merge pull request #149924 from Mic92/aarch64be-embedded•••pkgsCross.aarch64be-embedded: fix eval | Jörg Thalheim | 2021-12-09 | 1 | -2/+2 |
| |\ \ |
|
| | * | | pkgsCross.ppcle-embedded: fix eval | Jörg Thalheim | 2021-12-09 | 1 | -1/+1 |
| | * | | pkgsCross.aarch64be-embedded: fix eval | Jörg Thalheim | 2021-12-09 | 1 | -1/+1 |
| * | | | pkgsCross.x86_64-netbsd-llvm: mark as broken | Jörg Thalheim | 2021-12-09 | 1 | -0/+1 |
| |/ / |
|
| * | | Merge pull request #144022 from hercules-ci/lib-modules-optimize-unmatchedDefns•••lib/modules: Short-circuit unmatchedDefns when configs is empty | Silvan Mosberger | 2021-12-07 | 3 | -15/+34 |
| |\ \ |
|
| | * | | lib/modules: Use strict fold' as recursiveUpdate is also strict•••recursiveUpdate does not produce an attrset until it has evaluated
both its arguments to weak head normal form.
nix-repl> lib.recursiveUpdate (throw "a") (throw "b")
error: b
nix-repl> lib.recursiveUpdate (throw "a") {}
error: a
| Robert Hensing | 2021-11-03 | 1 | -2/+1 |
| | * | | lib/modules: Fix import* comments•••Very confusing otherwise.
| Robert Hensing | 2021-11-03 | 1 | -2/+2 |
| | * | | lib/modules: Remove a lib.flip•••In hot code, the overhead (envs, applies) can matter.
| Robert Hensing | 2021-11-03 | 1 | -3/+2 |
| | * | | lib/tests/modules: Test non-strictness some more•••Doesn't seem to have been a problem actually, but now it won't
regress.
| Robert Hensing | 2021-11-03 | 2 | -2/+16 |
| | * | | lib/modules: Short-circuit unmatchedDefns earlier | Robert Hensing | 2021-11-03 | 1 | -15/+16 |
| | * | | lib/modules: Short-circuit unmatchedDefns when configs is empty | Robert Hensing | 2021-10-31 | 1 | -4/+10 |
| * | | | Merge pull request #141856 from ShamrockLee/lib-spdx-license•••lib/meta: add getLicenseFromSpdxId function (resumed) | Silvan Mosberger | 2021-12-07 | 2 | -1/+28 |
| |\ \ \ |
|
| | * | | | lib/meta: add getLicenseFromSpdxId function•••Move function spdxLicense, internally used in yarn2nix
to lib/meta.nix, and
rename to getLicenseFromSpdxId
A similar function is implemented in poetry2nix,
but the one originally in yarn2nix seems beter.
since it falls back to an license-like attrset
for mismatched case
instead of a plain string
| Shamrock Lee | 2021-12-02 | 2 | -1/+28 |
| * | | | | lib/modules: Deprecate args and check | Robert Hensing | 2021-12-02 | 1 | -1/+6 |
| * | | | | lib/modules: Pass legacy args argument along through extendModules | Robert Hensing | 2021-12-02 | 1 | -4/+21 |
| | |_|/
|/| | |
|
| * | | | lib/tests: Use standard test syntax•••For consistency.
| Victor Engmark | 2021-11-26 | 1 | -1/+1 |
| * | | | lib/tests: Anchor config output regexes•••Strengthens the tests by making sure the whole line is matched.
| Victor Engmark | 2021-11-26 | 1 | -98/+98 |
| * | | | lib/tests: Set hardening pragmas•••Makes any programming errors more likely to show up early.
Non-obvious changes because of this:
- Ignore the `evalConfig` result in `reportFailure`; we're not checking
it at that point.
- Pre-increment `$fail` and `$pass` to make sure the arithmetic doesn't
result in a zero, which would result in a non-zero exit code for the
expression.
| Victor Engmark | 2021-11-26 | 2 | -4/+8 |
| * | | | lib/tests: Don't return non-zero values from checks•••The exit codes aren't used for anything.
| Victor Engmark | 2021-11-26 | 1 | -5/+0 |
| * | | | lib/tests: Avoid assigning an array to a string•••As per <https://github.com/koalaman/shellcheck/wiki/SC2124>.
| Victor Engmark | 2021-11-26 | 1 | -2/+2 |
| * | | | lib/tests: Remove redundant semicolons | Victor Engmark | 2021-11-26 | 1 | -6/+6 |
| * | | | lib/tests: Clarify assignment•••The extra equal sign was confusing, and doesn't seem to be relevant.
| Victor Engmark | 2021-11-26 | 1 | -1/+1 |
| * | | | lib/tests: Use correct shebang line•••The script uses plenty of non-POSIX features, such as referencing
`$BASH_SOURCE`.
| Victor Engmark | 2021-11-26 | 1 | -1/+1 |
| * | | | lib/tests: Quote variable references | Victor Engmark | 2021-11-26 | 1 | -5/+5 |
| * | | | lib/tests: `export` separately from assignment•••Avoids hiding the exit code from the assignment. See
<https://github.com/koalaman/shellcheck/wiki/SC2155>.
| Victor Engmark | 2021-11-26 | 1 | -2/+3 |
| * | | | add release notes for 22.05 and update codename | Timothy DeHerrera | 2021-11-22 | 1 | -1/+1 |
| * | | | modules: Add moduleType to module arguments | Robert Hensing | 2021-11-22 | 4 | -0/+39 |
| * | | | modules: Document that extendModules is also a module argument | Robert Hensing | 2021-11-22 | 1 | -0/+2 |
| |/ / |
|
| * | | lib.modules: add mkDerivedConfig•••mkDerivedConfig : Option a -> (a -> Definition b) -> Definition b
Create config definitions with the same priority as the definition of another option.
This should be used for option definitions where one option sets the value of another as a convenience.
For instance a config file could be set with a `text` or `source` option, where text translates to a `source`
value using `mkDerivedConfig options.text (pkgs.writeText "filename.conf")`.
It takes care of setting the right priority using `mkOverride`.
| Taeer Bar-Yam | 2021-11-15 | 2 | -1/+21 |
| * | | lib/systems: add x86_64-darwin hostPlatform | Jonathan Ringer | 2021-11-10 | 1 | -0/+6 |
| * | | lib/tests/sources: update to Nix 2.4 cli syntax | Bernardo Meurer | 2021-11-09 | 2 | -3/+7 |
| * | | lib/tests/modules.sh: update to Nix 2.4 syntax | Bernardo Meurer | 2021-11-09 | 1 | -12/+12 |
| * | | lib: fix escapeXML example in documentation•••The previous example output was forgotten copy-paste from some other
function.
| Robert Helgesson | 2021-11-02 | 1 | -1/+1 |
| * | | Merge pull request #144072 from polykernel/lib-lists-mutuallyexclusive-optimi... | Ben Siraphob | 2021-11-02 | 1 | -5/+2 |
| |\ \ |
|
| | * | | lib/lists: mutuallyExclusive function optimization•••The current implementation of `mutuallyExclusive` builds a new list with
length subtracted by one on every recursive call which is expensive. When
b is empty, the function still traverses a in its entirety before returning
a result.
The new implementation uses `any` to check if each element of list b is in
list a using `elem`. This maintains short circuiting when list a or b is empty
and has a worst case time complexity of O(nm).
| polykernel | 2021-11-01 | 1 | -5/+2 |
| | |/ |
|