about summary refs log tree commit diff
path: root/lib/default.nix
AgeCommit message (Collapse)AuthorFilesLines
2024-02-02lib: Add optionalDrvAttr to conditionally set drv attributes.Shea Levy1-1/+1
This allows for adding new, conditionally set, derivation attributes to an existing derivation without changing any output paths in the case where the condition is not met.
2023-12-19Merge pull request #270537 from 9999years/packagesFromDirectorySilvan Mosberger1-1/+2
lib.packagesFromDirectoryRecursive: init
2023-12-19lib.packagesFromDirectoryRecursive: initRebecca Turner1-1/+2
Co-authored-by: Gabriella Gonzalez <GenuineGabriella@gmail.com>
2023-12-08lib.sortOn: initRobert Hensing1-1/+1
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`.
2023-11-15Merge pull request #239722 from Stunkymonkey/lib-allUniqueSilvan Mosberger1-1/+1
lib.lists.allUnique: init
2023-11-14lib.lists.allUnique: initFelix Buehler1-1/+1
2023-11-07lib.mirrorFunctionArgs: initYueh-Shun Li1-1/+1
Co-authored-by: Silvan Mosberger <github@infinisil.com>
2023-10-10Merge pull request #254452 from flyingcircusio/lib-attrsToListSilvan Mosberger1-2/+2
lib.attrsets.attrsToList: add function
2023-10-10lib.attrsets.attrsToList: add functionOliver Schmidt1-2/+2
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>
2023-09-27lib: add cmakeOptionType, cmakeBool and cmakeFeatureAnderson Torres1-0/+1
2023-09-02Merge pull request #245623 from tweag/fileset.toSourceSilvan Mosberger1-0/+1
File set combinators base: `lib.fileset.toSource`
2023-09-01lib.fileset.toSource: initSilvan Mosberger1-0/+1
2023-08-28Merge pull request #234615 from linsui/dconfJan Tojnar1-0/+1
nixos/dconf: support generating from attrs
2023-08-20Merge pull request #245957 from ↵Artturi1-1/+1
amjoseph-nixpkgs/pr/lib/customization/makeScopeWithSplicing2
2023-08-15lib/gvariant: initlinsui1-0/+1
2023-08-14lib.customisation: add uncurried form of makeScopeWithSplicingAdam Joseph1-1/+1
Deeply-curried functions are pretty error-prone in untyped languages like Nix. This is a particularly bad case because `top-level/splice.nix` *also* declares a makeScopeWithSplicing, but it takes *two fewer arguments*. Let's add a version that uses attrset-passing form, to provide some minimal level of sanity-checking. This also provides defaults for keep and extra (these are often unneeded by the user).
2023-08-13lib/meta.nix: introduce getExe'Sefa Eyeoglu1-1/+1
getExe' can be used to get a binary other than the mainProgram from a derivation. Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2023-06-13lib/options: remove literalDocBookpennae1-1/+1
no longer supported. warning when used would not be appropriate, and docbook has been on the way out for long enough that throwing an error should not be necessary either.
2023-04-05lib.sources.pathType and co.: Move to lib.filesystemSilvan Mosberger1-2/+3
These functions only work with the filesystem, they don't import anything as sources
2023-03-11init: lib.foldlAttrshsjobeki1-1/+1
- provide comprehensive example - add unit test
2023-03-08lib: remove deprecated functionspennae1-5/+4
all of these have been deprecated and raising warnings since 18.09. it's about time we actually made good on "will be removed in the next release".
2023-03-03strings: add escapeQuery for url encodingPatrick Widmer1-1/+1
2023-02-07Merge pull request #206611 from h7x4/lib-lists-add-repeatSilvan Mosberger1-1/+1
lib.lists: add `replicate`
2023-02-06lib.lists: add `replicate`h7x41-1/+1
`replicate` returns n copies of an element as a list. Co-Authored-By: Silvan Mosberger <contact@infinisil.com>
2023-01-31Merge pull request #205557 from ncfavier/concatLinesSilvan Mosberger1-1/+1
lib/strings: add `concatLines`
2023-01-05Merge pull request #208674 from YoshiRulz/yoshi-lib-docsSilvan Mosberger1-1/+1
lib: Fix mismatched quotes in `lib.*` doc comments
2023-01-05modules: add mkPackageOptionMDpennae1-1/+1
another transitional option factory, like mkAliasOptionModuleMD.
2023-01-05modules: add mkAliasOptionModuleMDpennae1-1/+2
mkAliasOptionModule should not default to mdDoc descriptions because that can break out-of-tree users of documentation infrastructure. add an explicitly-MD variant for now, to be removed some time after the MD transition is complete.
2023-01-03Merge pull request #205190 from NixOS/lib.path.relativeNormaliseRobert Hensing1-1/+2
lib.path.subpath.{isValid,normalise}: init
2023-01-03lib.path.subpath.isValid: initSilvan Mosberger1-1/+2
The first path library function
2023-01-02lib: Fix mismatched quotes in `lib.*` doc commentsYoshiRulz1-1/+1
caused problems for automated rich text generation such as https://teu5us.github.io/nix-lib.html#customisation-functions
2022-12-31lib: Add isStringLikeRobert Hensing1-2/+4
2022-12-31lib: Add isPathRobert Hensing1-1/+1
Available since Nix 2.3, which is the Nixpkgs minimum version. Thanks zimbatm!
2022-12-10lib/strings: add `concatLines`Naïm Favier1-1/+1
Like `unlines` from Haskell. The aim is to replace the `concatStringsSep "\n"` pattern for generated files, which doesn't add a final newline.
2022-12-06lib/default.nix: include mesonOption-related functionsAndersonTorres1-0/+1
To bring them to the scope when calling `lib`.
2022-11-17lib/attrsets: add concatMapAttrsfigsoda1-1/+1
2022-10-23lib/strings: Refactor toInt into toInt and toIntBase10Jacob Abel1-1/+1
2022-09-21lib: Add lazyDerivationRobert Hensing1-0/+2
2022-06-21lib/options: Add showOptionWithDefLocsRobert Hensing1-1/+2
2022-06-12treewide: attempt at markdown option docspennae1-1/+2
2022-06-10Merge pull request #157480 from MatthewCroughan/in-pure-eval-modeRobert Hensing1-1/+1
lib: add inPureEvalMode
2022-05-30add mechanism for handling meta.sourceProvenance attributesRobert Scott1-0/+1
heavily based on patterns used by licenses infrastructure, so may appear overengineered for its initial level of use
2022-05-15Revert "lib: init flakes.nix"adisbladis1-4/+0
This reverts commit PR #167947. Flakes aren't standardised and the `lib` namespace shouldn't be polluted with utilities that serve only experimental uses.
2022-05-06lib: add inPureEvalModematthewcroughan1-1/+1
This makes a value that is true if builtins does not contain the currentSystem function, but false if it does.
2022-05-01Merge pull request #167947 from MatthewCroughan/mc/callLocklessFlakeArtturi1-0/+4
lib: add callLocklessFlake
2022-04-27Merge pull request #170583 from ncfavier/mkShellVarsRobert Hensing1-1/+2
lib/strings: add toShellVars
2022-04-27lib/strings: add toShellVarsNaïm Favier1-1/+2
A straightforward piece of plumbing to safely inject Nix variables into shell scripts: '' ${lib.toShellVars { inherit foo bar; }} cmd "$foo" --bar "$bar" ''
2022-04-24lib/meta: add getExe to get the main program of a drvArtturin1-1/+1
2022-04-12lib: init flakes.nixmatthewcroughan1-1/+5
This commit creates flakes.nix, which is a library containing functions which relate to interacting with flakes. It also moves related functions from trivial.nix into it.
2022-04-12lib: add callLocklessFlakematthewcroughan1-1/+1
This is essentially a copy of the function of the same name, from flake-compat. callLocklessFlake is useful when trying to utilise a flake.nix without a lock file, often for when you want to create a subflake from within a parent flake. Co-authored-by: Tom Bereknyei <tomberek@gmail.com> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>