about summary refs log tree commit diff
path: root/lib/default.nix
AgeCommit message (Collapse)AuthorFilesLines
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>
2022-03-27lib/trivial: actually expose warnIfNot and throwIfNaïm Favier1-1/+1
2022-03-21Merge remote-tracking branch 'upstream/master' into tests-restrict-argumentsRobert Hensing1-4/+6
2022-03-21lib: Add toFunctionRobert Hensing1-1/+2
2022-03-21lib: applyIfFunction -> applyModuleArgsIfFunctionRobert Hensing1-1/+1
2022-03-21Merge pull request #163451 from hercules-ci/stop-premature-warningsKevin Cox1-2/+3
Stop premature warnings, including `nix.settings` migration
2022-03-18lib.attrsets: Introduce updateManyAttrsByPathSilvan Mosberger1-1/+2
2022-03-18lib.attrsets: Introduce showAttrPathSilvan Mosberger1-1/+1
2022-03-09lib: Add mkRenamedOptionModuleWithRobert Hensing1-2/+3
Adds support for sinceRelease
2022-02-28Merge pull request #157301 from pennae/lib-add-mkPackageOption0x4A6F1-1/+1
lib: add mkPackageOption to default.nix
2022-01-29lib: add mkPackageOption to default.nixpennae1-1/+1
this was forgotten in #155669
2022-01-27lib/modules: introduce setDefaultModuleLocationNaïm Favier1-2/+2
Wraps a module with a default location for reporting errors.
2022-01-24lib.types: Add unique like uniq, but custom errorsRobert Hensing1-2/+3
Couldn't extend types.uniq and it had a silly name anyway. Now we can have better error messages.
2022-01-09lib.checkListOfEnum: initJosé Romildo1-1/+1
2021-12-22lib.throwIfNot: initRobert Hensing1-1/+2
2021-12-02lib/meta: add getLicenseFromSpdxId functionShamrock Lee1-1/+1
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
2021-11-15lib.modules: add mkDerivedConfigTaeer Bar-Yam1-1/+1
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`.
2021-10-04Merge pull request #136909 from ncfavier/cleanup-defaults-examplesRobert Hensing1-2/+2
nixos/doc: clean up defaults and examples