1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00
Commit graph

449 commits

Author SHA1 Message Date
nicoo 0aa5242829 lib.fetchers: add tests 2024-09-17 10:51:48 +00:00
HexoKnight cf5a46368b
lib/types: fix toCoerced's typeMerge 2024-09-10 22:45:27 +01:00
Robert Hensing 92f4ef78de
lib/modules: improve error message when option is being accessed that isn't defined (#338362) 2024-09-02 10:08:49 +02:00
Sandro Jäckel ab8bf8c35b
lib/modules: improve error message when option is being accessed that isn't defined 2024-09-01 23:29:21 +02:00
github-actions[bot] dcad9b571a
Merge master into staging-next 2024-08-31 00:13:18 +00:00
Robert Hensing 0abfc619bc
lib.importApply: init (#230588)
* lib.modules.importApply: init

Brings variables from rich scopes to modules defined in separate files.

A helper for functions in files that return a module.

* lib.modules.importApply: Edit doc

Generally improve the quality. Notes:

- Not rendered to the manual yet, so probably the syntax could be
  improved, but I have no way to test this now.

- The docs use `arg` vs `staticArg` in the code. This is intentional,
  because the doc is pretty clear about the role of `arg` whereas
  the code exists in a context where ambiguities are more harmful.

* Format
2024-08-31 01:12:43 +02:00
github-actions[bot] 132f2322d0
Merge master into staging-next 2024-08-26 12:05:25 +00:00
Silvan Mosberger 8f425c25ad lib/tests: Format a file with nixfmt
And fix locations to not break the test.
This is a rare case where another change is required after formatting.
We do this in a separate commit so that we don't need to do it in the
treewide reformatting PR.
2024-08-25 05:07:51 +02:00
Gabriella Gonzalez 75c122699a
lib.cli.escapeShellArg{,s}: Only escape when necessary (#333744)
These utilities will now leave the string undisturbed if it doesn't need to be quoted (because it doesn't have any special characters). This can help generate nicer-looking command lines.

This also transitively improves the output of `lib.toGNUCommandLine` which uses `escapeShellArg` internally
2024-08-16 16:26:08 +02:00
Robert Hensing 7f838d4c54 lib/tests/modules.sh: Improve failure log format
- Clear separation between failures
- Move error regex close to error message, which is at the bottom
  of a fairly long trace
- Move most relevant and consistent info to bottom of terminal:
  the location of the failure.
  Some editors including vscode heuristically resolve file paths
  on Ctrl+click.
- Less wordy - easy to glance
- Capitalized prefixes to distinguish from Nix's own logging
2024-08-12 13:48:25 +02:00
Robert Hensing 6fa24da815 lib/tests/modules.sh: Add loc <depth> optional parameter 2024-08-12 13:47:41 +02:00
Robert Hensing c516c03bf4 lib/tests/modules.sh: Do not redirect diagnostics to stdout
It still prints its own diagnostics to stdout, but it's always done that.
2024-08-12 13:47:36 +02:00
Robert Hensing 8a6c85d886 lib/tests/modules.sh: Report failure source location 2024-08-12 13:46:38 +02:00
Sigmanificient 6dd44107ac treewide: remove unused lib (and other) arguments 2024-07-26 11:18:09 +02:00
Matt Sturgeon aad87c2aa8
lib.strings: add trim and trimWith
`strings.trim` returns a copy of the string with all leading and trailing
whitespace removed.

`strings.trimWith` does the same thing, but calling code can decide
whether to trim the start and/or end of the string.
2024-07-25 23:43:33 +01:00
Silvan Mosberger 7c6692836e
Merge pull request #149990 from ShamrockLee/lib-spdx-license 2024-07-25 22:27:10 +02:00
Janik c20399ea2e
Merge pull request #318712 from woojiq/lib-network-ipv6-parser
lib.network: add ipv6 parser
2024-07-11 20:57:53 +02:00
Robert Hensing 4a014ed92e lib/modules: Use fixed lib instead of args.lib
The practical use for this should be very limited because I don't
think anyone should change `lib`, let alone change `lib.functionArgs`,
but, but it would be even stranger to rely on `args.lib` (or really
`specialArgs.lib` for what's clearly a behavior of the current
`evalModules`, which uses its own ambient lib for basically everything.

The shadowing of `lib` by `args.lib` here seems to be a small mistake,
which is easy to make.
2024-07-03 11:16:31 +02:00
Yueh-Shun Li 10d2e6c906 lib.getLicenseFromSpdxIdOr: init
Add lib.meta.getLicenseFromSpdxIdOr as a variant of
lib.meta.getLicenseFromSpdxId that explicitly state the default
(fallback) value if there's no license matching the given SPDX ID.
2024-06-30 02:59:58 +08:00
woojiq d559eed93a lib.network: ipv6 parser from string
Add a library function to parse and validate an IPv6 address from a
string. It can parse the first two versions of an IPv6 address according
to https://datatracker.ietf.org/doc/html/rfc4291#section-2.2. The third
form "xxx:x.d.d.d.d" is not yet implemented. Optionally parser can accept prefix length (128 is default).

Add shell script network.sh to test IPv6 parser functionality.
2024-06-29 10:02:00 +03:00
lucasew 52cc703bba lib: add fromHexString
Co-authored-by: lucasew <lucas59356@gmail.com>
2024-06-28 20:53:53 +03:00
Tristan Ross 8bb66a4929
lib/tests/release.nix: fix pkgs.lib error by passing lib 2024-06-09 18:12:39 -07:00
Tristan Ross 013e398b0f
lib/tests/release.nix: make pure 2024-06-06 21:17:05 -07:00
Rob Pilling 9c9c3848d4 cli.nix: permit separators between args -> -a=b, --xyz=abc, etc 2024-05-22 07:58:26 +01:00
John Ericson c38dd73dec
Merge pull request #308032 from obsidiansystems/freebsd-no-suffix-version
treewide: freebsd13 -> freebsd
2024-05-01 10:03:12 -04:00
John Ericson 266cdd7d37 treewide: freebsd13 -> freebsd
Co-authored-by: Alyssa Ross <hi@alyssa.is>
2024-04-30 18:20:23 -04:00
Maximilian Bosch 2b4e18f3d4
nixVersions.unstable: build from master, re-init at 2.22.0.pre20240321_6fd2f42c
The idea behind that is to enable users and developers of
downstream tools such as home-manager to test Nix master for several
reasons:

* Nix is currently trying to have a `master` branch that's always
  releasable[1]. We're still on Nix 2.18 in nixpkgs due to too many
  notable regressions. Enabling people to test latest master may help on
  that end.

* This uses the most bleeding-edge Nix, but our packaging, so we can
  identify issues with our packaging early.

* From what I've seen, most people are using the packages from nixpkgs
  anyways instead of the upstream flake, this is far more convenient
  anyways.

My plan is to update this once a week. Right now we rely on the
`installCheckPhase` here, but as soon as we have proper regression
testing[2], we may want to add `nixUnstable` there as well (however with
failures being allowed probably).

[1] https://discourse.nixos.org/t/nix-release-schedule-and-roadmap/14204
[2] https://github.com/NixOS/nixpkgs/pull/304332
2024-04-28 21:59:04 +02:00
Silvan Mosberger 6861ef7707 lib.lists.ifilter0: init 2024-04-22 18:33:14 +02:00
Gabriel Volpe 7b687a59cd
lib/tests: apply lints 2024-04-15 19:18:41 +02:00
Gabriel Volpe fe2bead78b
lib/attrsets: introduce mapCartesianProduct 2024-04-15 19:16:15 +02:00
Gabriel Volpe 10517cf9ab
tree-wide: use cartesianProduct 2024-04-15 19:13:22 +02:00
Silvan Mosberger 4f1d724b82
Merge pull request #284551 from hercules-ci/types-attrTag
Add `types.attrTag`
2024-04-09 20:48:44 +02:00
Silvan Mosberger a448a21521
Merge pull request #301556 from edef1c/lib-xor
lib: add xor
2024-04-04 22:03:53 +02:00
edef 725bb4e48c lib: add xor
This gets clumsily reimplemented in various places, to no useful end.
2024-04-04 19:46:58 +00:00
Johannes Kirschbauer c0f5f271d1
doc: migrate trivial files to doc-comment format (#299986)
* doc: migrate trivial files to doc-comment format

* fix: revert some comments

* Apply suggestions from code review

Thanks @danielSidhion

Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com>

* Update lib/types.nix

---------

Co-authored-by: Daniel Sidhion <DanielSidhion@users.noreply.github.com>
Co-authored-by: Silvan Mosberger <github@infinisil.com>
2024-04-04 16:36:07 +02:00
Robert Hensing 22d7f146a4 lib.types.attrTag: Fix declarationPositions after merge 2024-04-04 12:56:56 +02:00
Robert Hensing cf4968a904 lib/tests/modules/types-attrTag.nix: Test other option doc attrs 2024-04-04 12:22:08 +02:00
Robert Hensing 74831d8b38 lib/tests/modules/types-attrTag.nix: Clean up unneeded comment 2024-04-04 12:00:55 +02:00
Robert Hensing 47e4a18d01 types.attrTagWith: remove
Keep it simple for now.
2024-04-04 12:00:54 +02:00
Robert Hensing 1465777b63 lib.types.attrTag: Custom error when passing bare type 2024-04-04 11:54:46 +02:00
Robert Hensing bcd774606a lib/tests/modules/types-attrTag: Test against unexpected attrs
Thank you lheckemann for pointing this out!
2024-04-04 11:54:46 +02:00
Robert Hensing 475a55b2f0 lib.types.attrTag: Remove tags from description
You can find them in the sub-options now.
2024-04-04 11:54:46 +02:00
Robert Hensing 4c7d990bad lib.types.attrTag: Provide declarations, definitions 2024-04-04 11:54:45 +02:00
Robert Hensing 0bc9783221 lib.types.attrTag: Support type merging 2024-04-04 11:54:45 +02:00
Robert Hensing 42d3b54f0d lib.types.attrTag: Take options instead of types 2024-04-04 11:54:45 +02:00
Robert Hensing 5b49672af4 lib.types.attrTag: Support module docs 2024-04-04 11:54:41 +02:00
Florian Richer 3b883d3cdf
lib/strings: Add makeIncludePath (#296237)
* Update strings.nix

* Fix typo in docs

* Update lib/strings.nix

Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>

* Update lib/strings.nix

Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>

* Add unit test with strings

* Move test to strings

* Add unit test with package structure

* testMakeIncludePathWithPkgs: use real pkgs

* Revert "testMakeIncludePathWithPkgs: use real pkgs"

This reverts commit fb1850c069.

* Update lib/tests/misc.nix

Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>

* Update lib/tests/misc.nix

Co-authored-by: Silvan Mosberger <github@infinisil.com>

---------

Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com>
Co-authored-by: Silvan Mosberger <github@infinisil.com>
2024-04-02 19:01:05 +02:00
Philip Taron c8a8550c28
Avoid top-level with in lib/tests/misc.nix 2024-03-11 16:30:31 -07:00
Philip Taron 20abffc0dd
Avoid top-level with ...; in lib/tests/modules/extendModules-168767-imports.nix 2024-03-11 08:38:37 -07:00
Philip Taron 0426125c53
Avoid top-level with ...; in lib/tests/modules/alias-with-priority.nix 2024-03-11 08:38:14 -07:00