diff --git a/projects/default.nix b/projects/default.nix index af49837e7..d88f47b6a 100644 --- a/projects/default.nix +++ b/projects/default.nix @@ -86,11 +86,11 @@ in with types; submodule { options = { - services = mkOption { + modules.services = mkOption { type = nullOr (attrsOf (nullOr types'.service)); default = null; }; - programs = mkOption { + modules.programs = mkOption { type = nullOr (attrsOf (nullOr types'.program)); default = null; }; diff --git a/projects/types.nix b/projects/types.nix index 4bd4375cc..dfb123807 100644 --- a/projects/types.nix +++ b/projects/types.nix @@ -8,7 +8,7 @@ let mkOption ; in -{ +rec { subgrant = with types; submodule { @@ -97,7 +97,7 @@ in options = { module = mkOption { description = "the example must be a NixOS module in a file"; - type = pathInStore; + type = deferredModule; }; description = mkOption { description = "description of the example, ideally with further instructions on how to use it"; @@ -119,25 +119,32 @@ in # TODO: port modular services to programs program = with types; - submodule { - options = { - module = mkOption { - type = deferredModule; - }; - examples = mkOption { - type = attrsOf (nullOr example); - default = { }; - }; - extensions = mkOption { - type = attrsOf (nullOr plugin); - default = { }; - }; - links = mkOption { - type = attrsOf link; - default = { }; + submodule ( + { name, ... }: + { + options = { + name = mkOption { + type = with types; nullOr str; + default = name; + }; + module = mkOption { + type = deferredModule; + }; + examples = mkOption { + type = attrsOf (nullOr example); + default = { }; + }; + extensions = mkOption { + type = attrsOf (nullOr plugin); + default = { }; + }; + links = mkOption { + type = attrsOf link; + default = { }; + }; }; - }; - }; + } + ); # TODO: make use of modular services https://github.com/NixOS/nixpkgs/pull/372170 service = @@ -151,7 +158,7 @@ in default = name; }; module = mkOption { - type = moduleType; + type = deferredModule; }; examples = mkOption { type = nullOr (attrsOf (nullOr example));