From 245a7d63d1ea0e260f5f128c37b9f647569ccdd3 Mon Sep 17 00:00:00 2001 From: Kiara Grouwstra Date: Tue, 26 Aug 2025 23:31:48 +0200 Subject: [PATCH] restore data model with { resources } wrappers, this time working --- deployment/check/data-model/deployment.nix | 20 ++++++++++++-------- deployment/data-model-test.nix | 6 ++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/deployment/check/data-model/deployment.nix b/deployment/check/data-model/deployment.nix index 76abe204..36f9013b 100644 --- a/deployment/check/data-model/deployment.nix +++ b/deployment/check/data-model/deployment.nix @@ -66,7 +66,9 @@ let requests: let # 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 lib.optionalAttrs (validRequests != { }) { ${config.username} = { @@ -91,8 +93,8 @@ let }; implementation = cfg: { input = cfg; - output = lib.optionalAttrs cfg.enable { - "my".login-shell.packages.hello = pkgs.hello; + output.resources = lib.optionalAttrs cfg.enable { + hello.login-shell.packages.hello = pkgs.hello; }; }; }; @@ -123,11 +125,13 @@ let else null; - users.users = environment.config.resources."operator-environment".login-shell.apply ( - lib.filterAttrs (_name: value: value ? login-shell) ( - lib.concatMapAttrs (k': lib.mapAttrs' (k: v: lib.nameValuePair "${k'}.${k}" v)) requests - ) - ); + users.users = environment.config.resources."operator-environment".login-shell.apply { + resources = lib.filterAttrs (_name: value: value ? login-shell) ( + lib.concatMapAttrs ( + k': req: lib.mapAttrs' (k: lib.nameValuePair "${k'}.${k}") req.resources + ) requests + ); + }; }; }; }; diff --git a/deployment/data-model-test.nix b/deployment/data-model-test.nix index 2cb38329..ff8058d3 100644 --- a/deployment/data-model-test.nix +++ b/deployment/data-model-test.nix @@ -73,7 +73,9 @@ in requests: let # 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 lib.optionalAttrs (validRequests != { }) { ${config.username} = { @@ -156,7 +158,7 @@ in resources = fediversity.applications.hello.resources 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; result = mkDeployment { modules = [