fix typos, lint, format

This commit is contained in:
Kiara Grouwstra 2025-07-03 20:23:04 +02:00
parent ba047997f2
commit d185d5f94f
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
2 changed files with 12 additions and 14 deletions

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
); );
}; };
}; };
@ -164,8 +164,7 @@ in
{ {
inherit (fediversity) example-deployment; inherit (fediversity) example-deployment;
}; };
expected = expected = {
{ };
};
}; };
} }

View file

@ -10,7 +10,6 @@ let
attrsOf attrsOf
attrTag attrTag
deferredModuleWith deferredModuleWith
submoduleWith
submodule submodule
optionType optionType
functionTo functionTo
@ -37,7 +36,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 +55,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 +160,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 +174,7 @@ in
} }
) config.applications; ) config.applications;
}; };
}); };
}; };
}; };
} }