about summary refs log tree commit diff
path: root/lib/tests
AgeCommit message (Collapse)AuthorFilesLines
2023-01-03Merge pull request #205190 from NixOS/lib.path.relativeNormaliseRobert Hensing1-0/+3
lib.path.subpath.{isValid,normalise}: init
2023-01-03lib.path.subpath.isValid: initSilvan Mosberger1-0/+3
The first path library function
2022-12-21lib/versions: add `pad`Naïm Favier1-0/+15
Pad a version string with zeros to match a given number of components.
2022-12-17lib: fix typosfigsoda1-1/+1
2022-12-11Merge pull request #205457 from ↵Robert Hensing1-0/+4
h7x4/lib-strings-toInt-broken-for-negative-numbers lib.strings: fix negative number handling for `toInt` and `toIntBase10`
2022-12-10lib.strings: fix negative number handling for `toInt` and `toIntBase10`h7x41-0/+4
The previous version would be unstable due to an input validation regex not expecting a '-' in front of the number.
2022-12-08nixos/doc: render option values using `lib.generators.toPretty`Naïm Favier1-1/+1
Render un`_type`d defaults and examples as `literalExpression`s using `lib.generators.toPretty` so that consumers don't have to reinvent Nix pretty-printing. `renderOptionValue` is kept internal for now intentionally. Make `toPretty` print floats as valid Nix values (without a tilde). Get rid of the now-obsolete `substSpecial` function. Move towards disallowing evaluation of packages in the manual by raising a warning on `pkgs.foo.{outPath,drvPath}`; later, this should throw an error. Instead, module authors should use `literalExpression` and `mkPackageOption`.
2022-12-08lib/generators.toPretty: escape strings properlyNaïm Favier1-8/+8
2022-12-08lib/generators.toPretty: don't evaluate derivationsNaïm Favier1-1/+1
With the goal of making `toPretty` suitable for rendering option values, render derivations as `<derivation foo-1.0>` instead of `<derivation /nix/store/…-foo-1.0.drv>`. This is to avoid causing sudden evaluation errors for out-of-tree projects that have options with `default = pkgs.someUnfreePackage;` and no `defaultText`.
2022-12-02lib/modules: Add context to the "option does not exist" errorRobert Hensing3-0/+9
Add trace items that provide context for a failed definition that can not be caught within the Nix language. This also adds a test for the `tryEval` behavior of `showDefs`.
2022-11-17lib/attrsets: add concatMapAttrsfigsoda1-0/+17
2022-11-04lib/systems: Support FreeBSDJohn Ericson1-3/+3
A tricky thing about FreeBSD is that there is no stable ABI across versions. That means that putting in the version as part of the config string is paramount. We have a parsed represenation that separates name versus version to accomplish this. We include FreeBSD versions 12 and 13 to demonstrate how it works.
2022-11-03lib/tests/modules: Test doRenameRobert Hensing3-0/+32
2022-10-23lib/strings: Update docs and restructured code to improve readability of ↵Jacob Abel2-1/+5
toInt and toIntBase10.
2022-10-23lib/strings: Refactor toInt into toInt and toIntBase10Jacob Abel2-17/+45
2022-10-23lib/strings: Update toInt to handle intermixed ws and zeros. Added testsJacob Abel2-1/+12
2022-10-23lib/strings: allow toInt to parse zero-padded stringsJacob Abel1-0/+28
2022-10-20lib/tests/misc: Add tests for charToInt, escapeC, and normalizePathDaniel Olsen1-0/+15
2022-10-07lib/types: always use `<function body>` instead of `[function body]` to ↵Maximilian Bosch1-2/+2
indicate a function inside an option structure The motivation is to have a single identifier for that. Useful for the next commit where I'll try to escape option-parts correctly (options can be any kind of strings, but unless these are Nix identifiers, they must be quoted). Since `<function body>` (or `<name>`/`*`) are special identifiers in error messages and the manual, we need a unique way to mark an option part as function call because these are not to be quoted.
2022-10-01Merge pull request #193132 from figsoda/clean-upfigsoda1-1/+0
treewide: clean up
2022-09-26lib/tests/maintainers.nix: remove unused bindingfigsoda1-1/+0
2022-09-21lib/modules: Fix meta duplication in shorthand syntaxRobert Hensing2-0/+22
2022-09-21lib: Add lazyDerivationRobert Hensing1-0/+53
2022-09-17lib.types: Add parentheses where description is ambiguousRobert Hensing1-0/+53
2022-08-31Merge pull request #188289 from erikarvstedt/fix-disabled-modules-abs-pathsRobert Hensing2-0/+6
lib.modules: support strings with absolute paths in `disabledModules`
2022-08-31lib.modules: support strings with absolute paths in `disabledModules`Erik Arvstedt2-0/+6
This is particularly useful for disabling modules defined in a flake. Example: disabledModules = [ "${flake}/modules/mymodule.nix" ]; Previously, absolute string paths were internally prepended with `modulesPath`, which caused the module filtering to fail.
2022-08-25lib/systems: add MicroBlaze architecturesMinijackson1-1/+1
2022-06-20teams/maintainers list: show instructions for validating the contentsGraham Christensen1-2/+2
2022-06-20maintainer teams: check them in lib testsGraham Christensen2-0/+54
2022-06-20maintainer lib test: extract maintainer moduleGraham Christensen2-31/+32
2022-06-20maintainers: remove longkeyidGraham Christensen1-1/+0
see https://dkg.fifthhorseman.net/blog/openpgp-key-ids-are-not-useful.html
2022-06-14lib/modules: Throw earlier when module function does not return attrsRobert Hensing2-0/+21
`m` must always be an attrset at this point. It is basically always evaluated. This will make it throw when any of the attrs is accessed, rather than just `config`. We assume that this will improve the error message in more scenarios.
2022-06-14lib.deferredModule: Make it properly singularRobert Hensing1-1/+1
2022-06-14lib.types.deferredModule: Allow path-typed module referencesRobert Hensing2-3/+4
2022-06-14lib.types.deferredModule: Improve reported locationRobert Hensing1-1/+1
2022-06-14lib/test/modules.sh: Test deferredModule error location fileRobert Hensing2-2/+11
2022-06-14lib.types: Add deferredModuleRobert Hensing2-0/+57
2022-06-14lib/tests: Add submodule file propagation testSilvan Mosberger2-0/+25
2022-05-23Merge pull request #168374 from Ma27/special-attrs-in-with-recursionSilvan Mosberger1-0/+15
lib/generators: withRecursion: don't break attr-sets with special attrs
2022-05-17Merge pull request #172813 from hercules-ci/functionTo-properlyRobert Hensing2-0/+63
`lib.types.functionTo` type merging and docs
2022-05-16Merge pull request #170561 from klemensn/types-descriptionSilvan Mosberger1-1/+1
lib/types: Drop misleading plural from type descriptions
2022-05-15Revert "lib: init flakes.nix"adisbladis3-23/+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-13lib/tests/modules: Test functionTo submodule merging tooRobert Hensing2-8/+11
2022-05-13lib.types.functionTo: Support type mergingRobert Hensing2-0/+60
2022-05-07lib/strings/toShellVars: handle derivations as stringsNaïm Favier1-0/+12
2022-05-02lib/tests/modules.sh: Fix for singular type descriptionsRobert Hensing1-1/+1
2022-05-02Merge pull request #170090 from danth/has-infix-toStringRobert Hensing1-0/+30
lib/strings: call toString within hasInfix
2022-05-02lib/tests: add tests for hasInfixDaniel Thwaites1-0/+30
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2022-05-01Merge pull request #167947 from MatthewCroughan/mc/callLocklessFlakeArtturi3-0/+22
lib: add callLocklessFlake
2022-04-28lib.systems: add riscv{32,64} sets and filtersAlyssa Ross1-0/+2
For other platforms like Intel and ARM, we can do e.g. lib.platforms.aarch64 to get only the 64-bit ARM platorms, but until now there were no equivalents for RISC-V.