forked from Fediversity/Fediversity
Compare commits
1 commit
42ee27f737
...
3fa1756feb
Author | SHA1 | Date | |
---|---|---|---|
3fa1756feb |
3 changed files with 16 additions and 9 deletions
|
@ -93,8 +93,8 @@ let
|
||||||
};
|
};
|
||||||
implementation = cfg: {
|
implementation = cfg: {
|
||||||
input = cfg;
|
input = cfg;
|
||||||
output = lib.optionalAttrs cfg.enable {
|
output.resources = lib.optionalAttrs cfg.enable {
|
||||||
resources.hello.login-shell.packages.hello = pkgs.hello;
|
hello.login-shell.packages.hello = pkgs.hello;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -126,7 +126,11 @@ let
|
||||||
null;
|
null;
|
||||||
|
|
||||||
users.users = environment.config.resources."operator-environment".login-shell.apply {
|
users.users = environment.config.resources."operator-environment".login-shell.apply {
|
||||||
resources = lib.filterAttrs (_name: value: value ? login-shell) requests;
|
resources = lib.filterAttrs (_name: value: value ? login-shell) (
|
||||||
|
lib.concatMapAttrs (
|
||||||
|
k': req: lib.mapAttrs' (k: lib.nameValuePair "${k'}.${k}") req.resources
|
||||||
|
) requests
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -100,8 +100,8 @@ in
|
||||||
};
|
};
|
||||||
implementation = cfg: {
|
implementation = cfg: {
|
||||||
input = cfg;
|
input = cfg;
|
||||||
output = lib.optionalAttrs cfg.enable {
|
output.resources = lib.optionalAttrs cfg.enable {
|
||||||
resources.hello.login-shell.packages.hello = pkgs.hello;
|
hello.login-shell.packages.hello = pkgs.hello;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -126,7 +126,11 @@ in
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
users.users = config.resources."operator-environment".login-shell.apply {
|
users.users = config.resources."operator-environment".login-shell.apply {
|
||||||
resources = lib.filterAttrs (_name: value: value ? login-shell) requests;
|
resources = lib.filterAttrs (_name: value: value ? login-shell) (
|
||||||
|
lib.concatMapAttrs (
|
||||||
|
k': req: lib.mapAttrs' (k: lib.nameValuePair "${k'}.${k}") req.resources
|
||||||
|
) requests
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -93,8 +93,7 @@ in
|
||||||
description = "The type of resource this policy configures";
|
description = "The type of resource this policy configures";
|
||||||
type = types.optionType;
|
type = types.optionType;
|
||||||
};
|
};
|
||||||
# TODO(@fricklerhandwerk): we may want to make the function type explict here: `request -> resource-type`
|
# 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 {
|
options.apply = mkOption {
|
||||||
description = "Apply the policy to a request";
|
description = "Apply the policy to a request";
|
||||||
type = functionTo policy.config.resource-type;
|
type = functionTo policy.config.resource-type;
|
||||||
|
@ -174,7 +173,7 @@ in
|
||||||
type = submodule functionType;
|
type = submodule functionType;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = {
|
default = {
|
||||||
input-type = application-resources;
|
input-type = attrsOf application-resources;
|
||||||
output-type = deployment-type;
|
output-type = deployment-type;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue