From 228a7b173e659a10c0f288f44e18e7ae050c78cb Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Wed, 8 Jan 2020 23:52:42 +0100 Subject: nixos/certmgr: Flip either submodule path type For upcoming allowance of paths as submodules --- nixos/modules/services/security/certmgr.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/security/certmgr.nix b/nixos/modules/services/security/certmgr.nix index e89078883ebe..94c0ba141179 100644 --- a/nixos/modules/services/security/certmgr.nix +++ b/nixos/modules/services/security/certmgr.nix @@ -113,7 +113,7 @@ in otherCert = "/var/certmgr/specs/other-cert.json"; } ''; - type = with types; attrsOf (either (submodule { + type = with types; attrsOf (either path (submodule { options = { service = mkOption { type = nullOr str; @@ -148,7 +148,7 @@ in description = "certmgr spec request object."; }; }; - }) path); + })); description = '' Certificate specs as described by: -- cgit v1.2.3 From 6525da6321a7272faa0c2b1c15ffd3501888e9b9 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Fri, 3 Jan 2020 05:22:11 +0100 Subject: lib/types: Allow paths as submodule values --- lib/tests/modules.sh | 3 +-- lib/types.nix | 8 +++++--- nixos/doc/manual/development/option-types.xml | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index f69befd15c64..65b482ec194d 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -174,8 +174,7 @@ checkConfigOutput "true" config.submodule.inner ./declare-submoduleWith-modules. checkConfigOutput "true" config.submodule.outer ./declare-submoduleWith-modules.nix ## Paths should be allowed as values and work as expected -# Temporarily disabled until https://github.com/NixOS/nixpkgs/pull/76861 -#checkConfigOutput "true" config.submodule.enable ./declare-submoduleWith-path.nix +checkConfigOutput "true" config.submodule.enable ./declare-submoduleWith-path.nix cat < A set of sub options o. - o can be an attribute set or a function - returning an attribute set. Submodules are used in composed types to - create modular options. This is equivalent to + o can be an attribute set, a function + returning an attribute set, or a path to a file containing such a value. Submodules are used in + composed types to create modular options. This is equivalent to types.submoduleWith { modules = toList o; shorthandOnlyDefinesConfig = true; }. Submodules are detailed in Date: Wed, 8 Jan 2020 23:59:37 +0100 Subject: nixos/doc: Add incompatibility note for `either submodule path` Co-Authored-By: Robert Hensing --- nixos/doc/manual/release-notes/rl-2003.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-2003.xml b/nixos/doc/manual/release-notes/rl-2003.xml index ca319dfea411..51f91268eff0 100644 --- a/nixos/doc/manual/release-notes/rl-2003.xml +++ b/nixos/doc/manual/release-notes/rl-2003.xml @@ -391,6 +391,16 @@ users.users.me = PR #63103. + + + For NixOS modules, the types types.submodule and types.submoduleWith now support + paths as allowed values, similar to how imports supports paths. + Because of this, if you have a module that defines an option of type + either (submodule ...) path, it will break since a path + is now treated as the first type instead of the second. To fix this, change + the type to either path (submodule ...). + + -- cgit v1.2.3