revert submodule wrapper to align with module functions already doing types #2

Closed
kiara wants to merge 37 commits from kiara/Fediversity:fix-submodule-type into main
2 changed files with 10 additions and 10 deletions
Showing only changes of commit b25ddac298 - Show all commits

View file

@ -40,7 +40,7 @@ in
_class = "fediversity-resource-policy"; _class = "fediversity-resource-policy";
options = { options = {
extra-config = mkOptions { extra-config = mkOption {
description = "Any options from NixOS"; description = "Any options from NixOS";
}; };
apply = mkOption { apply = mkOption {
@ -88,12 +88,12 @@ in
requests: requests:
let let
# Filter out requests that need wheel if policy doesn't allow it # Filter out requests that need wheel if policy doesn't allow it
validRequests = lib.filterAttrs (name: req: !req.wheel || config.wheel) requests; validRequests = lib.filterAttrs (_name: req: !req.wheel || config.wheel) requests;
in in
lib.optionalAttrs (validRequests != { }) { lib.optionalAttrs (validRequests != { }) {
${config.username} = { ${config.username} = {
isNormalUser = true; isNormalUser = true;
packages = with lib; concatMapAttrs (name: request: attrValues request.packages) validRequests; packages = with lib; concatMapAttrs (_name: request: attrValues request.packages) validRequests;
extraGroups = lib.optional config.wheel "wheel"; extraGroups = lib.optional config.wheel "wheel";
}; };
}; };
@ -133,10 +133,10 @@ in
inputs.nixops4-nixos.modules.nixops4Resource.nixos inputs.nixops4-nixos.modules.nixops4Resource.nixos
]; ];
nixos.module = nixos.module =
{ pkgs, ... }: { ... }:
{ {
users.users = config.resources.shell.login-shell.apply ( users.users = config.resources.shell.login-shell.apply (
lib.filterAttrs (name: value: value ? login-shell) requests lib.filterAttrs (_name: value: value ? login-shell) requests
); );
}; };
}; };

View file

@ -37,7 +37,7 @@ in
description = "Collection of deployment resources that can be required by applications and policed by hosting providers"; description = "Collection of deployment resources that can be required by applications and policed by hosting providers";
type = attrsOf ( type = attrsOf (
submodule ( submodule (
{ config, ... }: { ... }:
{ {
_class = "fediversity-resource"; _class = "fediversity-resource";
options = { options = {
@ -56,7 +56,7 @@ in
{ {
_class = "fediversity-resource-policy"; _class = "fediversity-resource-policy";
options.apply = mkOption { options.apply = mkOption {
desciption = "Apply the policy to a request"; description = "Apply the policy to a request";
}; };
} }
]; ];
@ -161,13 +161,13 @@ in
description = "Configuration type declaring options to be set by operators"; description = "Configuration type declaring options to be set by operators";
type = optionType; type = optionType;
readOnly = true; readOnly = true;
default = submodule (configuration: { default = submodule {
options = { options = {
enable = lib.mkEnableOption { enable = lib.mkEnableOption {
description = "your Fediversity configuration"; description = "your Fediversity configuration";
}; };
applications = lib.mapAttrs ( applications = lib.mapAttrs (
name: application: _name: application:
mkOption { mkOption {
description = application.description; description = application.description;
type = submodule application.module; type = submodule application.module;
@ -175,7 +175,7 @@ in
} }
) config.applications; ) config.applications;
}; };
}); };
}; };
}; };
} }