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";
options = {
extra-config = mkOptions {
extra-config = mkOption {
description = "Any options from NixOS";
};
apply = mkOption {
@ -88,12 +88,12 @@ in
requests:
let
# 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
lib.optionalAttrs (validRequests != { }) {
${config.username} = {
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";
};
};
@ -133,10 +133,10 @@ in
inputs.nixops4-nixos.modules.nixops4Resource.nixos
];
nixos.module =
{ pkgs, ... }:
{ ... }:
{
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";
type = attrsOf (
submodule (
{ config, ... }:
{ ... }:
{
_class = "fediversity-resource";
options = {
@ -56,7 +56,7 @@ in
{
_class = "fediversity-resource-policy";
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";
type = optionType;
readOnly = true;
default = submodule (configuration: {
default = submodule {
options = {
enable = lib.mkEnableOption {
description = "your Fediversity configuration";
};
applications = lib.mapAttrs (
name: application:
_name: application:
mkOption {
description = application.description;
type = submodule application.module;
@ -175,7 +175,7 @@ in
}
) config.applications;
};
});
};
};
};
}