forked from Fediversity/Fediversity
simpler data model, not sure it's desirable but at least it's consistent
This commit is contained in:
parent
cce6dc9a75
commit
ca51b2377a
3 changed files with 10 additions and 11 deletions
|
@ -66,9 +66,7 @@ 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.resources;
|
||||
validRequests = lib.filterAttrs (_name: req: !req.login-shell.wheel || config.wheel) requests;
|
||||
in
|
||||
lib.optionalAttrs (validRequests != { }) {
|
||||
${config.username} = {
|
||||
|
@ -94,7 +92,7 @@ let
|
|||
implementation = cfg: {
|
||||
input = cfg;
|
||||
output = lib.optionalAttrs cfg.enable {
|
||||
resources.hello.login-shell.packages.hello = pkgs.hello;
|
||||
"my".login-shell.packages.hello = pkgs.hello;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -125,9 +123,11 @@ let
|
|||
else
|
||||
null;
|
||||
|
||||
users.users = environment.config.resources."operator-environment".login-shell.apply {
|
||||
resources = lib.filterAttrs (_name: value: value ? login-shell) requests;
|
||||
};
|
||||
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
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -73,9 +73,7 @@ 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.resources;
|
||||
validRequests = lib.filterAttrs (_name: req: !req.login-shell.wheel || config.wheel) requests;
|
||||
in
|
||||
lib.optionalAttrs (validRequests != { }) {
|
||||
${config.username} = {
|
||||
|
@ -158,7 +156,7 @@ in
|
|||
resources =
|
||||
fediversity.applications.hello.resources
|
||||
fediversity."example-configuration".applications.hello;
|
||||
hello-shell = resources.resources.hello.login-shell;
|
||||
hello-shell = resources."my".login-shell;
|
||||
environment = fediversity.environments.single-nixos-vm.resources."operator-environment".login-shell;
|
||||
result = mkDeployment {
|
||||
modules = [
|
||||
|
|
|
@ -190,6 +190,7 @@ in
|
|||
type = types.optionType;
|
||||
};
|
||||
# TODO(@fricklerhandwerk): we may want to make the function type explicit here: `application-resources -> resource-type`
|
||||
# and then also rename this to be consistent with the application's resource mapping
|
||||
options.apply = mkOption {
|
||||
description = "Apply the policy to a request";
|
||||
type = functionTo policy.config.resource-type;
|
||||
|
|
Loading…
Add table
Reference in a new issue