Robert Hensing
0665253b86
Merge pull request #244044 from tweag/lib-readme
...
Create a Readme in `lib`
2023-07-19 16:34:36 +02:00
Silvan Mosberger
fa503f4b92
lib.attrsets.mergeAttrsList: init
...
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-18 20:27:15 +02:00
Silvan Mosberger
581d7c88be
lib/tests: Unify documentation of individual testable files
2023-07-18 17:22:45 +02:00
Robert Hensing
8014460c4d
lib.mergeModules: Add context to error message
2023-07-11 13:03:52 +02:00
Ryan Burns
2964b720de
Merge pull request #240825 from r-burns/mips-embedded
...
lib.platforms.mips{,64}-embedded: init
2023-07-05 21:26:47 -07:00
Naïm Favier
f66b401fa3
lib/tests: invalidate hashes
...
Having the current bash hash present in the nixpkgs tree makes Nix
detect bash as a runtime dependency of nixpkgs, which in turns messes up
`fetchFromGitHub` due to https://github.com/NixOS/nix/issues/6660
2023-07-05 11:31:58 +02:00
Ryan Burns
c8ae88d97b
lib.platforms.mips{,64}-embedded: init
2023-06-30 18:19:00 -07:00
Naïm Favier
4bdff8cbbb
lib/tests: remove experimental-features
...
Now that the lib is tested with Nix 2.3, this isn't needed any more and
causes warnings.
2023-06-27 11:48:53 +02:00
Robert Hensing
18111335ed
lib/tests/modules.sh: Test types.pathInStore
...
Add missing test cases. I think the .links case should be rejected
even though it's technically a path in the store.
2023-06-27 11:48:53 +02:00
Robert Hensing
b1ad9cd27d
Merge pull request #238136 from hercules-ci/nixos-nixpkgs-dont-check-when-_module.args.pkgs-is-set
...
`nixos/nixpkgs`: Don't check when `_module.args.pkgs` is set
2023-06-23 19:17:36 +02:00
Adam Joseph
00a749a3a6
lib/system: move toLosslessStringMaybe into lib/tests
...
toLosslessStringMaybe is not used by anything other than lib/tests,
so it can be private to that file.
I don't think this function was terribly well thought-through. If
people start using it, we will become permanently dependent on the
ability to test platforms for equality. It also makes the
elaboration process more fragile, because it encourages code outside
of nixpkgs to become sensitive to the minute details of how
elaboration happens.
2023-06-22 00:18:33 -07:00
Robert Hensing
36ea2bbfe8
lib.modules: Add mergeAttrDefinitionsWithPrio
...
This will let us make assertions involving _module.args.pkgs, which
is not an option but a value attribute, and therefore doesn't have
its own highestPrio to inspect. The new function gives us that info.
2023-06-16 22:08:16 +02:00
Robert Hensing
3150f25faa
lib/tests/release.nix: Run systems tests on OfBorg
2023-06-13 10:43:12 +02:00
Robert Hensing
144018541b
lib.systems.equals: Ignore all function attributes reflectively
...
Co-authored-by: Artturi <Artturin@artturin.com>
2023-06-13 10:22:06 +02:00
Robert Hensing
18c7f6237f
lib.systems.{equals,toLosslessStringMaybe}: init
2023-06-13 10:17:02 +02:00
Robert Hensing
6b078d2f5a
Merge pull request #235267 from tweag/lazier-findFirst
...
`lib.findFirst`: Add tests and make lazier
2023-06-06 19:09:56 +02:00
Silvan Mosberger
9790e70150
lib.list.findFirst: Make lazier
...
There's no need to evaluate list elements after a matching element
2023-06-06 17:17:32 +02:00
Silvan Mosberger
6996f76885
lib/tests: Add findFirst tests
2023-06-06 17:06:18 +02:00
Robert Hensing
fb21e6d7dd
Merge pull request #234070 from tweag/pathType-tests
...
Init `nixVersions.minimum` and fix `lib` tests for all Nix versions
2023-06-01 20:00:36 +02:00
Silvan Mosberger
013acf2396
lib/tests: Also run with nixVersions.minimum and nixVersions.unstable
...
The previous commits ensure that the tests also succeed with those
versions
2023-06-01 18:07:33 +02:00
Silvan Mosberger
0b6021ee53
lib/tests: Fix when run with Nix 2.3
2023-06-01 18:07:33 +02:00
Silvan Mosberger
de0c11241f
lib/tests/filesystem.sh: Check success and failure separately
2023-06-01 18:07:33 +02:00
Alyssa Ross
4e80f80864
lib.systems.doubles: add big-endian MIPS linux doubles
...
We already have examples for these, but since we didn't actually
recognise the doubles, it wasn't possible to build any packages for
them without setting allowUnsupportedSystem.
2023-06-01 10:42:27 +00:00
Silvan Mosberger
04db3589a8
lib.filesystem.pathType: Fix tests for Nix >= 2.14
2023-05-25 22:39:28 +02:00
Robert Hensing
a344acdc7f
Merge pull request #224834 from tweag/pathType-and-co
...
Improvements to pathType, pathIsDirectory and pathIsRegularFile
2023-05-23 09:32:01 +02:00
Silvan Mosberger
d064d972f0
lib.filesystem.pathType: Improve error for non-existent paths
...
Previously it would fail with
error: attribute 'nonexistent' missing
at nixpkgs/lib/filesystem.nix:29:10:
28| if dirOf path == path then "directory"
29| else (readDir (dirOf path)).${baseNameOf path};
| ^
30|
2023-05-22 14:13:57 +02:00
Silvan Mosberger
bb6eab0bdb
lib.filesystem.pathType: Fix for filesystem root argument
...
Previously this function couldn't handle / being passed, it would throw
an error:
error: attribute '' missing
at nixpkgs/lib/filesystem.nix:24:20:
23| */
24| pathType = path: (readDir (dirOf path)).${baseNameOf path};
| ^
25|
Consequently this also fixes the
lib.filesystem.{pathIsDirectory,pathIsRegularFile} functions.
2023-05-22 14:13:57 +02:00
Silvan Mosberger
a1dedc908d
lib.filesystem.pathType and co.: Add tests
...
Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2023-05-22 14:13:45 +02:00
Naïm Favier
ac9915b1ea
lib/tests: add mkPackageOption tests
2023-05-20 18:23:41 +02:00
Robert Hensing
eab660d91e
lib.modules: configurationClass -> class
...
This simplifies the documentation. `configuration` is implied by `_type`.
2023-05-06 18:32:59 +02:00
Robert Hensing
89491bef8d
lib.modules: in evalModules return move _module.class -> configurationClass
2023-05-06 18:32:59 +02:00
Robert Hensing
fd88c79418
lib.modules: Change class declaration in module to _class
2023-05-06 18:32:59 +02:00
Robert Hensing
7459c02495
lib/tests/modules.sh: Add submodule + class tests
2023-05-06 18:32:59 +02:00
Robert Hensing
8054785157
lib/modules: Move class out of specialArgs
2023-05-06 18:32:58 +02:00
Robert Hensing
84b1b01702
lib/modules: Only interpret class declaration in non-shorthand mode
...
This is to avoid stealing keys from submodules. `class` might be
common enough that reinterpreting existing `class` attributes in
configurations as a declaration leads to fairly widespread problems.
2023-05-06 18:29:04 +02:00
Robert Hensing
9714487f74
lib/modules: Explain that a configuration can't be loaded as a module
2023-05-06 18:29:04 +02:00
Robert Hensing
2e689d58cb
lib/modules: Improve error when a configuration is imported
...
This is appears to be a fairly common mistake for beginners who want
to build larger things from the system configurations, such as NixOps
networks, etc. Further explanation seems appropriate.
2023-05-06 18:29:03 +02:00
Robert Hensing
58f385f680
lib/modules: Check against importing things with a _type
2023-05-06 18:29:03 +02:00
Robert Hensing
b8ff2807a2
lib/modules: Add class concept to check imports
...
This improves the error message when an incompatible module is
imported.
2023-05-06 18:29:03 +02:00
Robert Hensing
e7e64233c9
lib/tests/modules.sh: Unload implicit modules
...
I had some trouble understanding this. Let's try to keep new tests
a bit more stateless and explicit.
2023-05-06 18:22:50 +02:00
toonn
e31c8b22dd
Merge pull request #223407 from AngryAnt/toplist-path
...
lib.toPlist: Add support for path values
2023-05-05 21:15:23 +02:00
Matthieu Coudron
8670e496ff
Merge pull request #227714 from ony/feature/generateLuarocksConfig-toLua
...
lua.lib: use toLua in generateLuarocksConfig
2023-05-01 18:53:22 +02:00
Mykola Orliuk
7287c0e076
lib.generators.toLua: asBindings option
...
Allows to generate code block for setting of global variables
2023-04-29 19:26:35 +02:00
Weijia Wang
b2ef7956b6
Merge pull request #227560 from jackyliu16/loongnix-commit
...
lib.platforms.loongarch64: init
2023-04-28 13:21:42 +03:00
jackyliu16
edcad332d9
lib.platforms.loongarch64: init
2023-04-27 20:04:30 +03:00
Mykola Orliuk
e9b416168a
lib.generators.toLua: allow disabling multiline
2023-04-23 19:46:14 +02:00
Mykola Orliuk
4ec4c6fda9
lib/generators: add toLua/mkLuaInline
...
Suitable to simplify Lua-based configurations like neovim-lspconfig that
might need to interpolate Nix package paths.
2023-04-23 01:07:58 +02:00
Emil "AngryAnt" Johansen
e932e98437
lib.toPlist: keep test output in external files for their tab indents
2023-03-27 19:25:52 +02:00
Emil "AngryAnt" Johansen
63a8c43d09
lib.toPlist: basic test coverage
2023-03-27 19:25:38 +02:00
Naïm Favier
8751764236
lib/modules: better error for invalid option declarations
...
Make `byName` aware of whether it's processing options or config to give
slightly more accurate error messages.
2023-03-22 12:37:28 +01:00