Johannes Kirschbauer
58c115499f
lib.types: improve performance on attrsWith
2024-12-03 10:03:19 +01:00
Silvan Mosberger
e60e2e6916
lib/types: standardise attrsOf functor.wrapped warning and add a test
2024-12-03 10:03:13 +01:00
Silvan Mosberger
e438d6b08d
lib/types: Add deprecation to attrsWith
...
Co-Authored-By: @infinisil
2024-12-03 10:02:55 +01:00
Silvan Mosberger
bd353d322c
lib/types: Test attrsWith type merging
...
Co-Authored-By: @hsjobeki
2024-12-03 10:02:47 +01:00
Johannes Kirschbauer
5b7a21358d
lib/types: init {types.attrsWith}
2024-12-03 10:02:40 +01:00
K900
907cb3d253
Revert "lib/types: init {types.attrsWith}"
2024-12-03 09:06:24 +03:00
Johannes Kirschbauer
399e582e18
lib.types: improve performance on attrsWith
2024-12-02 16:39:29 +01:00
Silvan Mosberger
d5eccbbbae
lib/types: standardise attrsOf functor.wrapped warning and add a test
2024-12-02 16:18:03 +01:00
Silvan Mosberger
45f0035a83
lib/types: Add deprecation to attrsWith
...
Co-Authored-By: @infinisil
2024-11-26 10:27:01 +01:00
Silvan Mosberger
415d1932ea
lib/types: Test attrsWith type merging
...
Co-Authored-By: @hsjobeki
2024-11-25 16:06:55 +01:00
Johannes Kirschbauer
c4a9529071
lib/types: init {types.attrsWith}
2024-11-25 15:11:45 +01:00
Johannes Kirschbauer
b978799f71
lib.types.defaultTypeMerge: refactor functor.{payload,wrapped} merging
2024-11-19 08:58:38 +01:00
Robert Hensing
d572d95502
lib.types.anything: remove custom logic for lists ( #340202 )
2024-09-18 17:08:15 +02:00
HexoKnight
cf5a46368b
lib/types: fix toCoerced's typeMerge
2024-09-10 22:45:27 +01:00
Alexis Destrez
e5e69b748f
lib.types.anything: remove custom logic for lists (default to 'mergeEqualOption')
...
Previously, for values of type list, the merge function would only retain the value
if the number of option definitions was less than or equal to 1, and would throw an
error for conflicting definitions to avoid potentially unwanted list merges.
This change removes that logic, defaulting to the 'mergeEqualOption' function for
values of type list. This approach maintains the same safeguard against merging
different lists while allowing lists with identical values to be merged.
2024-09-07 01:15:32 +02:00
Matt Sturgeon
f1cd097be2
lib/types: update reference to docs
...
The XML docs have been migrated to markdown since bfd21cd2c1
2024-08-16 16:09:15 +01:00
Philip Taron
6cf8ae9090
lib.types: remove __attrsFailEvaluation
...
The test (`nix-build pkgs/test/release/default.nix`) continues to pass without this preventative measure.
2024-07-01 10:37:58 -07:00
Silvan Mosberger
4f1d724b82
Merge pull request #284551 from hercules-ci/types-attrTag
...
Add `types.attrTag`
2024-04-09 20:48:44 +02: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
35fe538330
types.attrTag: Remove unnecessary definitions override
...
Committing because tests pass.
Co-authored-by: Silvan Mosberger <github@infinisil.com>
2024-04-04 13:00:19 +02:00
Robert Hensing
22d7f146a4
lib.types.attrTag: Fix declarationPositions after merge
2024-04-04 12:56:56 +02:00
Robert Hensing
2d791b5f7b
types.attrTag: Remove substSubmodules
...
I haven't managed to trigger the error, and it turns out that this
method is optional.
Specifically, getSubmodules is unimplemented (and unimplementable),
the tests pass, and we seem to have good location info.
2024-04-04 12:00:54 +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
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
e090bb55f0
lib/types.nix: Fix getSubOptions doc
...
This comment was added in 73f32d0375
, when it was already
supposed to be an attrset.
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
Robert Hensing
ca81a89839
lib.types.attrTag: init
2024-02-11 18:44:52 +01:00
Silvan Mosberger
f37ba19765
Merge pull request #284512 from hercules-ci/lib-types-unique-merge
...
lib.types.unique: Check inner type deeply
2024-02-10 02:52:45 +01:00
Robert Hensing
bd285d2c11
lib.types.uniq: Check inner type
...
We now reuse the `unique` type, which implements this.
Keeping the duplication around would be bad at this point.
2024-02-04 15:49:55 +01:00
Danila Danko
ad853c1368
types.nix: fix nonEmptyListOf
2024-01-29 22:29:44 +03:00
Robert Hensing
b78ba9bc68
lib.types.unique: Check inner type deeply
...
This doesn't change uniq. Why not?
- In NixOS it seems that uniq is only used with
simple types that are fully checked by t.check.
- It exists for much longer and is used more widely.
- I believe we should deprecate it, because unique was
already better.
- unique can be a proving ground.
2024-01-28 14:09:27 +01:00
Robert Hensing
6f4d0b5261
lib.types: Improve descriptions of composed types that have commas
...
Type: either ints.positive (enum ["auto"])
Before: positive integer, meaning >0 or value "auto" (singular enum)
After: positive integer, meaning >0, or value "auto" (singular enum)
2023-12-23 11:40:27 +01:00
Adam Joseph
80472e3754
treewide: add __attrsFailEvaluation and __recurseIntoDerivationForReleaseJobs
2023-12-15 05:13:46 -08:00
Silvan Mosberger
8d3978c149
lib.types.boolByOr: init
...
This type is necessary to have correct merging behavior for
`allowUnfreePredicate` and `allowInsecurePredicate`
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-12-08 21:50:29 +01:00
Silvan Mosberger
5075a51403
lib.types.string: Use lib.warn instead of deprecationMessage
...
This will cause a poorer error message without option location
information, but it will catch all uses of its use.
2023-08-10 06:31:36 +02:00
Silvan Mosberger
040b0ad3ed
Revert "lib.types.string: Deprecation error instead of warning"
...
This reverts commit c59c6b1c57
.
This was a bit too ambitious, because no warnings were previously
triggered when `string` was nested e.g. `attrsOf string`, `nullOr
string`, etc.
Support for nested type deprecation warnings was introduced in
4b54aedee5
, but had to be reverted in
a36e6760e9
because it caused infinite
recursion for some users, and I couldn't remember that it was reverted.
2023-08-10 06:25:29 +02:00
Silvan Mosberger
c59c6b1c57
lib.types.string: Deprecation error instead of warning
...
The type has given a warning on use since [4 years ago](03392cd336b128a1639c648baf0f6c1a1271e0d2), I think it's safe to move the deprecation to the next stage: An error instead of a warning.
2023-08-08 04:13:22 +02:00
Naïm Favier
14d3e5685a
lib/types: add pathInStore
2023-06-27 11:48:08 +02:00
figsoda
8283d3d8d1
lib/types: remove unused rec
2023-06-23 09:41:04 +00:00
Robert Hensing
2e485f2581
lib.types.submoduleWith: Interoperate with older version of submoduleWith
2023-05-17 12:51:09 +02:00
Robert Hensing
16d594a0e2
lib.types.pkgs: init
...
A nominal type.
2023-05-10 15:55:08 +02:00
Robert Hensing
8054785157
lib/modules: Move class out of specialArgs
2023-05-06 18:32:58 +02:00
Robert Hensing
872a24ebbc
lib.strings: isSimpleCoercibleString -> isStringLike
2022-12-31 01:33:46 +01:00
Robert Hensing
29efb2c438
lib.types.path: Do not allow lists of strings
2022-12-31 01:03:24 +01:00
Robert Hensing
fed5dc66f8
treewide: isCoercibleToString -> isMoreCoercibleToString
...
No change in behavior.
2022-12-31 01:03:24 +01:00
Robert Hensing
3a4c9bdbe6
lib.types.anything: Use isSimpleCoercibleToString
...
Expecting no change in behavior.
2022-12-31 01:03:24 +01:00