restore data model with { resources } wrappers, this time working

This commit is contained in:
Kiara Grouwstra 2025-08-26 23:31:48 +02:00
parent ca51b2377a
commit 245a7d63d1
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
2 changed files with 16 additions and 10 deletions

View file

@ -66,7 +66,9 @@ let
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.login-shell.wheel || config.wheel) requests; validRequests = lib.filterAttrs (
_name: req: !req.login-shell.wheel || config.wheel
) requests.resources;
in in
lib.optionalAttrs (validRequests != { }) { lib.optionalAttrs (validRequests != { }) {
${config.username} = { ${config.username} = {
@ -91,8 +93,8 @@ let
}; };
implementation = cfg: { implementation = cfg: {
input = cfg; input = cfg;
output = lib.optionalAttrs cfg.enable { output.resources = lib.optionalAttrs cfg.enable {
"my".login-shell.packages.hello = pkgs.hello; hello.login-shell.packages.hello = pkgs.hello;
}; };
}; };
}; };
@ -123,11 +125,13 @@ let
else else
null; null;
users.users = environment.config.resources."operator-environment".login-shell.apply ( users.users = environment.config.resources."operator-environment".login-shell.apply {
lib.filterAttrs (_name: value: value ? login-shell) ( resources = lib.filterAttrs (_name: value: value ? login-shell) (
lib.concatMapAttrs (k': lib.mapAttrs' (k: v: lib.nameValuePair "${k'}.${k}" v)) requests lib.concatMapAttrs (
) k': req: lib.mapAttrs' (k: lib.nameValuePair "${k'}.${k}") req.resources
); ) requests
);
};
}; };
}; };
}; };

View file

@ -73,7 +73,9 @@ 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.login-shell.wheel || config.wheel) requests; validRequests = lib.filterAttrs (
_name: req: !req.login-shell.wheel || config.wheel
) requests.resources;
in in
lib.optionalAttrs (validRequests != { }) { lib.optionalAttrs (validRequests != { }) {
${config.username} = { ${config.username} = {
@ -156,7 +158,7 @@ in
resources = resources =
fediversity.applications.hello.resources fediversity.applications.hello.resources
fediversity."example-configuration".applications.hello; fediversity."example-configuration".applications.hello;
hello-shell = resources."my".login-shell; hello-shell = resources.resources.hello.login-shell;
environment = fediversity.environments.single-nixos-vm.resources."operator-environment".login-shell; environment = fediversity.environments.single-nixos-vm.resources."operator-environment".login-shell;
result = mkDeployment { result = mkDeployment {
modules = [ modules = [