about summary refs log tree commit diff
path: root/lib/types.nix
AgeCommit message (Collapse)AuthorFilesLines
2023-08-10lib.types.string: Use lib.warn instead of deprecationMessageSilvan Mosberger1-4/+6
This will cause a poorer error message without option location information, but it will catch all uses of its use.
2023-08-10Revert "lib.types.string: Deprecation error instead of warning"Silvan Mosberger1-1/+4
This reverts commit c59c6b1c57da542b6b4af5d2ac27d1b99e7f0c5e. 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 4b54aedee5e05aaf2838f6d951508b83e33d2baa, but had to be reverted in a36e6760e9be0ec260b637a06d751d39e2a78e4e because it caused infinite recursion for some users, and I couldn't remember that it was reverted.
2023-08-08lib.types.string: Deprecation error instead of warningSilvan Mosberger1-4/+1
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-06-27lib/types: add pathInStoreNaïm Favier1-0/+9
2023-06-23lib/types: remove unused recfigsoda1-1/+1
2023-05-17lib.types.submoduleWith: Interoperate with older version of submoduleWithRobert Hensing1-3/+5
2023-05-10lib.types.pkgs: initRobert Hensing1-0/+8
A nominal type.
2023-05-06lib/modules: Move class out of specialArgsRobert Hensing1-2/+8
2022-12-31lib.strings: isSimpleCoercibleString -> isStringLikeRobert Hensing1-3/+3
2022-12-31lib.types.path: Do not allow lists of stringsRobert Hensing1-2/+1
2022-12-31treewide: isCoercibleToString -> isMoreCoercibleToStringRobert Hensing1-2/+2
No change in behavior.
2022-12-31lib.types.anything: Use isSimpleCoercibleToStringRobert Hensing1-1/+2
Expecting no change in behavior.
2022-12-29lib.types.loaOf: Update comment to say deprecate instead of removeRobert Hensing1-1/+1
2022-12-29Revert "lib/types: remove loaOf"Robert Hensing1-0/+9
This reverts commit c8c538f2ab2432f2dd1eb637657c1bf5b54a147f. Reason: removal did not follow a deprecation process and it hurts nixops 1.7 users.
2022-12-19lib/types: remove loaOfSandro Jäckel1-9/+0
2022-11-08lib/types: add `descriptionClass` for `path`Naïm Favier1-0/+1
2022-10-18Merge pull request #194035 from Ma27/show-option-quotingRobert Hensing1-2/+2
lib/options/showOption: fix quoting of attr-names that are not identifiers
2022-10-13Merge pull request #192755 from hercules-ci/lib-types-unspecified-nameSilvan Mosberger1-1/+2
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-09-26lib/types.nix: remove unused bindingsfigsoda1-2/+0
2022-09-25lib/types.nix: Document that it should not be usedpiegames1-2/+16
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2022-09-24lib.types.unspecified: Make name match attribute name againRobert Hensing1-1/+2
@Infinisil: This isn't right, the name shouldn't be changed, but instead a description should be added https://github.com/NixOS/nixpkgs/pull/191353#discussion_r978983401
2022-09-17lib.types: Add parentheses where description is ambiguousRobert Hensing1-13/+69
2022-09-09Merge pull request #181834 from ncfavier/numbersSilvan Mosberger1-9/+33
lib/types: add `number`
2022-07-24lib/types: add `number`Naïm Favier1-9/+33
For numbers that can be ints or floats.
2022-06-25lib.types, nixos/users: Make passwdEntry availableKlemens Nanni1-0/+6
More nixpkgs code such as `boot.initrd.systemd.emergencyAccess` defines options that takes hashed passwords, so move the type definition from modules/ into lib/. The type definition itself stays unchanged.
2022-06-14lib.deferredModule: Make it properly singularRobert Hensing1-1/+3
2022-06-14lib.types: Add deferredModuleWithRobert Hensing1-2/+22
2022-06-14lib.types.deferredModule: Allow path-typed module referencesRobert Hensing1-1/+1
2022-06-14lib.types.deferredModule: Improve reported locationRobert Hensing1-1/+1
2022-06-14lib.types: Add deferredModuleRobert Hensing1-0/+8
2022-06-14lib/types, lib/modules: Remove unused extensionOffsetRobert Hensing1-6/+0
2022-06-14lib/types: Use map instead of imap1 in submoduleWithRobert Hensing1-1/+1
2022-06-14lib/types: Simplify submoduleWith shorthandOnlyDefinesConfig handlingSilvan Mosberger1-12/+3
The module system already uses the parent module's _file as a fallback, so we don't need to inject the file in a weird way
2022-06-10Merge pull request #173621 from ncfavier/submodule-descriptionRobert Hensing1-6/+17
lib/types: allow custom `submoduleWith` descriptions
2022-05-19lib/types: allow custom `submoduleWith` descriptionsNaïm Favier1-6/+17
Currently the only way to set the description for a submodule type is to use `freeformType`. This is not ideal as it requires setting a freeform type, and evaluates the submodule config unnecessarily. Instead, add a `description` argument to `submoduleWith`.
2022-05-17Merge pull request #172813 from hercules-ci/functionTo-properlyRobert Hensing1-1/+3
`lib.types.functionTo` type merging and docs
2022-05-13lib.types.functionTo: Add pseudo-attr to generated docsRobert Hensing1-1/+1
2022-05-13lib.types.functionTo: Support type mergingRobert Hensing1-0/+2
2022-04-27 lib/types: Drop misleading plural from type descriptions #170561Klemens Nanni1-3/+3
Probably being the most prominent document demonstrating the problem, configuration.nix(5) describes various types in plural, e.g. - ` Type: list of strings` - ` Type: list of systemd options` However, there are other cases where appending "s" to the inner type effectively changes the type, e.g. - ``` Type: list of string matching the pattern [a-zA-Z0-9@%:_.\-]+[.](service|socket|device|mount|automount|swap|target|path|timer|scope|slice)s ``` This should've read "list of string[s]..." but instead changes the regular expression. Simply drop the best-effort plural in favour of correctness and simplicity rather than adding more grammar related logic/trying to fix this.
2022-04-24lib.types.submoduleWith: Avoid _key collisions after extendModulesRobert Hensing1-2/+8
2022-03-18lib/modules: Finally remove deprecated types.optionSetSilvan Mosberger1-8/+0
types.optionSet has been deprecated for almost 10 years now (0e333688cea468a28516bf6935648c03ed62a7bb)! A removal was already attempted in 2019 (27982b408e465554b8831f492362bc87ed0ec02a), but it was promptly reinstantiated since some third-party uses were discovered (f531ce75e4178c6867cc1d0f7fec96b2d5c3f1cb). It's finally time to remove it for good :)
2022-03-16Merge pull request #156533 from ↵Silvan Mosberger1-7/+15
hercules-ci/issue-146882-transparent-submodule-options lib.modules: Let module declare options directly in bare submodule
2022-03-11Merge pull request #163443 from ncfavier/fix-types-packageRobert Hensing1-2/+10
lib.types.package: only call toDerivation when necessary
2022-03-11lib.types.package: only call toDerivation when necessaryNaïm Favier1-2/+10
The current logic assumes that everything that isn't a derivation is a store path, but it can also be something that's *coercible* to a store path, like a flake input. Unnecessary uses of `lib.toDerivation` result in errors in pure evaluation mode when `builtins.storePath` is disabled. Also document what a `package` is.
2022-03-10lib.types.optionType: Only merge when necessaryRobert Hensing1-1/+3
2022-03-03lib.modules: Inline a private functionRobert Hensing1-7/+7
This should save about four calls per module.
2022-03-03lib.modules: Default shorthandOnlyDefinesConfig to true when nullRobert Hensing1-1/+5
2022-03-03lib.modules: Make option injection work when shorthandOnlyDefinesConfigRobert Hensing1-1/+5
2022-03-03lib.types.submodule: Remove redundant isSubmodule attrRobert Hensing1-5/+0