about summary refs log tree commit diff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2024-03-18Merge pull request #293901 from philiptaron/refactor-lib/generators.nixSilvan Mosberger1-76/+133
lib: use explicit name imports in `lib/generators.nix`
2024-03-18Merge pull request #295158 from philiptaron/remove-top-level-with-in-lib-part5Silvan Mosberger1-1/+88
Avoid top-level `with` in `lib/tests/misc.nix`
2024-03-16lib.foldl': document eta expansionJohannes Kirschbauer1-1/+9
2024-03-16lib: use names from `lib` in `lib/generators.nix`, rather than `builtins` or ↵Philip Taron1-36/+24
submodules of `lib` There's not a lot of rhyme to which names are exported from which module, as I see it, but everything is found somewhere.
2024-03-15lib.foldl': avoid unnecessary function callJohannes Kirschbauer1-3/+1
2024-03-14lib/generators: use the explicit public interface patternPhilip Taron1-19/+37
This enables further refactoring without accidentally changing the public interface.
2024-03-14lib/generators: explicitly import names from `lib.trivial`Philip Taron1-1/+5
Everything else was already imported.
2024-03-14lib/generators: explicitly import names from `lib.attrsets`Philip Taron1-7/+5
Everything used was already imported.
2024-03-14lib/generators: explicitly import names from `lib.string`Philip Taron1-15/+24
A couple of these were imports from `builtins`.
2024-03-14lib/generators: explicitly import names from `lib`Philip Taron1-18/+41
I followed the `inherit` chains in `lib/default.nix` to arrive at these imports.
2024-03-14lib/generators: builtins.isFloat is in Nix 2.3Philip Taron1-22/+39
There's a couple of aliases in play: 1. `lib.isList` is an alias for `builtins.isList`. 2. `lib.strings.concatStringsSep` is an alias for `builtins.concatStringsSep`
2024-03-14Merge pull request #294906 from philiptaron/remove-top-level-with-in-lib-part2Silvan Mosberger1-19/+85
lib: use explicit name imports in `lib/deprecated.nix`
2024-03-14Merge pull request #295007 from philiptaron/remove-top-level-with-in-lib-part3Silvan Mosberger1-1/+3
lib: avoid top-level `with ...;` in lib/kernel.nix
2024-03-13doc: lib.lists migrate to doc-comments (#294257)Johannes Kirschbauer1-370/+1322
* doc: lib.lists migrate to doc-comments * Fix extra indentation of docs lines, remove redundant comments, add inputs docs * fix: indentation & argument references --------- Co-authored-by: DS <commits@sidhion.com>
2024-03-11Avoid top-level `with` in lib/tests/misc.nixPhilip Taron1-1/+88
2024-03-11Avoid top-level `with ...;` in lib/kernel.nixPhilip Taron1-1/+3
2024-03-11Avoid top-level `with ...;` in ↵Philip Taron1-1/+8
lib/tests/modules/extendModules-168767-imports.nix
2024-03-11Avoid top-level `with ...;` in lib/tests/modules/alias-with-priority.nixPhilip Taron1-3/+10
2024-03-11Avoid top-level `with ...;` in ↵Philip Taron1-3/+10
lib/tests/modules/alias-with-priority-can-override.nix
2024-03-10lib: use explicit name imports in lib/deprecated.nixPhilip Taron1-19/+85
2024-03-09doc: actually document `lib.customisation.makeScope` (#294194)Valentin Gagarin1-11/+122
* doc: actually document `lib.customisation.makeScope`
2024-03-07doc: lib.asserts migrate to doc-comments (#292310)Johannes Kirschbauer1-44/+106
2024-03-06Merge branch 'master' into license-updatesJörg Thalheim32-333/+912
2024-03-06Merge pull request #292945 from adisbladis/lib-tointSilvan Mosberger1-10/+17
lib.toInt/toIntBase10: Make more efficient by hoisting up internal strings into higher scope
2024-03-06Merge pull request #292941 from adisbladis/lib-getattrfrompath-envSilvan Mosberger1-2/+1
lib.getAttrFromPath: Don't use errorMessage variable
2024-03-06Merge pull request #292938 from adisbladis/mapattrsrecursivecond-envSilvan Mosberger1-7/+6
lib.mapAttrsRecursiveCond: Eliminate intermediate one intermediate variable environment
2024-03-06Merge pull request #292937 from adisbladis/zipattrs-envSilvan Mosberger1-4/+1
lib.zipAttrs: Remove needless function wrapping
2024-03-06Merge pull request #292934 from adisbladis/lib-choosedevoutputSilvan Mosberger1-4/+1
lib.chooseDevOutputs: Remove needless function wrapping
2024-03-06Merge pull request #292209 from hercules-ci/lazyDerivation-multi-outputSilvan Mosberger2-7/+75
lib.lazyDerivation: Support multi-output derivations
2024-03-06doc: add details on `mapAttrsRecursive[Cond]` (#293509)Valentin Gagarin1-31/+46
* doc: add details on `mapAttrsRecursive[Cond]` from first reading it wasn't clear that `f` also takes the current attribute path. also the value f receives is tricky due to how the condition is evaluated. Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com>
2024-03-03Merge pull request #177977 from thefloweringash/call-packages-with-function-argsArtturi2-1/+20
lib/customization: propagate function arguments in callPackagesWith
2024-03-03Merge pull request #288812 from hercules-ci/lib-flake-versionRobert Hensing3-1/+8
`lib/` flake: fix `lib.version`
2024-03-03lib.toInt/toIntBase10: Make more efficient by hoisting up internal strings ↵adisbladis1-10/+17
into higher scope
2024-03-03lib.getAttrFromPath: Don't use errorMessage variableadisbladis1-2/+1
We can just pass the error message on without creating an environment.
2024-03-03lib.mapAttrsRecursiveCond: Eliminate intermediate one intermediate variable ↵adisbladis1-7/+6
environment
2024-03-03lib.zipAttrs: Remove needless function wrappingadisbladis1-4/+1
Returning the partially applied `zipAttrsWith fn` is the same as `sets: zipAttrsWith fn sets`.
2024-03-03lib.chooseDevOutputs: Remove needless function wrappingadisbladis1-4/+1
Returning the partially applied `map getDev` is the same as `drvs: map getDev drvs`.
2024-02-29Merge pull request #292340 from DanielSidhion/fix-fixed-points-docSilvan Mosberger1-7/+6
lib.fixedPoints: fix rendering of docs for `extends`
2024-02-29lib.fixedPoints: fix rendering of docs for `extends`DS1-7/+6
2024-02-29lib.lazyDerivation: Support multi-output derivationsRobert Hensing2-7/+75
2024-02-28Merge pull request #287369 from tweag/lib-remove-polyfillsSilvan Mosberger6-94/+15
`lib`: Remove unneeded polyfills
2024-02-28lib/customization: propagate function arguments in callPackagesWithAndrew Childs2-1/+20
makeOverridable is very careful to ensure the arguments to the overridden function are the same as the input function. As a result, the arguments of hello.override are exactly the same as the original arguments of the hello function that produced the derivation. However, callPackagesWith calls makeOverridable with a lambda that does not propagate the arguments. The override function for a package instantiated with callPackagesWith will not have the original arguments. For example: nix-repl> lib.functionArgs hello.override { callPackage = false; fetchurl = false; hello = false; lib = false; nixos = false; stdenv = false; testers = false; } nix-repl> lib.functionArgs openssl.override { } By copying the arguments onto the inner lambda before passing it to makeOverridable, we can make callPackage and callPackages behave the same. nix-repl> lib.functionArgs openssl.override { buildPackages = false; coreutils = false; cryptodev = false; enableSSL2 = true; enableSSL3 = true; fetchurl = false; lib = false; perl = false; removeReferencesTo = false; static = true; stdenv = false; withCryptodev = true; withPerl = true; }
2024-02-28Merge pull request #291933 from tweag/fileset-tests-posixRobert Hensing1-48/+52
lib.fileset: Fix tests on Darwin, more POSIX
2024-02-27lib.fileset: Fix tests on Darwin, more POSIXSilvan Mosberger1-48/+52
This was found when trying to run the fileset tests on Darwin (https://github.com/NixOS/nix/pull/9546#issuecomment-1967409445), which mysteriously fail on Darwin: test case at lib/fileset/tests.sh:342 failed: toSource { root = "/nix/store/foobar"; fileset = ./.; } should have errored with this regex pattern: lib.fileset.toSource: `root` \(/nix/store/foobar\) is a string-like value, but it should be a path instead. \s*Paths in strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead. but this was the actual error: error: lib.fileset.toSource: `root` (/nix/store/foobar) is a string-like value, but it should be a path instead. Paths in strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead. After dissecting this, I find out that apparently \s works on Linux, but not on Darwin for some reason! From the bash source code, it looks like <regex.h> with `REG_EXTENDED` is used for all platforms the same, so there's nothing odd there. It's almost impossible to know where <regex.h> comes from, but it looks to be a POSIX thing. So after digging through the almost impossible to find POSIX specifications (https://pubs.opengroup.org/onlinepubs/007908799/xbd/re.html#tag_007_003_005), I can indeed confirm that there's no mention of \s or the like! _However_, there is a mention of `[[:blank:]]`, so we'll use that instead.
2024-02-27Merge pull request #291909 from cdmistman/lib-meta-available-on-doc-exampleRyan Mulligan1-0/+4
lib.meta.availableOn: add example in documentation
2024-02-27lib.meta.platformMatch: expand documentationColton Donnelly1-0/+4
2024-02-27lib.meta.availableOn: add example in documentationColton Donnelly1-0/+4
2024-02-26lib/tests/release: Test lib.version in isolationRobert Hensing1-0/+6
2024-02-26.version: Make lib/.version source of truthRobert Hensing1-9/+0
This way we don't have to make sure they're in sync, and we remove a small step from the release process.
2024-02-26lib flake: Fix versionRobert Hensing3-1/+11
Manually tested with nix-repl> :lf path:lib nix-repl> lib.version