Compare commits

..

1 commit

Author SHA1 Message Date
37fd4d6642 fix resource mapping for the shell application 2025-07-25 14:18:02 +02:00
2 changed files with 16 additions and 30 deletions

View file

@ -14,7 +14,6 @@ let
];
}).config;
nixops4Deployment = inputs.nixops4.modules.nixops4Deployment.default;
inherit (inputs.nixops4.lib) mkDeployment;
in
{
test-eval = {
@ -164,37 +163,28 @@ in
};
}
);
resources = fediversity.applications.hello.resources fediversity.example-configuration.applications.hello;
hello-shell = (resources).resources.hello.login-shell;
environment = fediversity.environments.single-nixos-vm.resources.operator-environment.login-shell;
result = mkDeployment {
modules = [
(fediversity.environments.single-nixos-vm.deployment fediversity.example-configuration)
];
};
in
rec {
number-of-resources = with lib; length (attrNames fediversity.resources);
inherit (fediversity) example-configuration;
hello-package-exists = hello-shell.packages ? hello;
wheel-required = hello-shell.wheel;
wheel-allowed = environment.wheel;
hello-package-exists =
(fediversity.applications.hello.resources example-configuration.applications.hello)
.resources.hello.login-shell.packages ? hello;
wheel-required =
(fediversity.applications.hello.resources example-configuration.applications.hello)
.resources.hello.login-shell.wheel;
wheel-allowed =
fediversity.environments.single-nixos-vm.resources.operator-environment.login-shell.wheel;
operator-shell =
let
operator = (environment.apply resources).operator;
resources = fediversity.applications.hello.resources example-configuration.applications.hello;
users = fediversity.environments.single-nixos-vm.resources.operator-environment.login-shell.apply resources;
in
{
inherit (operator) isNormalUser;
packages = with lib; map (p: "${p.pname}") operator.packages;
extraGroups = operator.extraGroups;
inherit (users.operator) isNormalUser;
packages = with lib; map (p: "${p.pname}") users.operator.packages;
extraGroups = users.operator.extraGroups;
};
deployment = {
inherit (result) _type;
deploymentFunction = lib.isFunction result.deploymentFunction;
# XXX(@fricklerhandwerk): evaluating the derivation takes a bit, we may want to stop at `isFunction` here
getProviders = lib.isDerivation (result.getProviders { system = builtins.currentSystem; });
};
};
expected = {
number-of-resources = 2;
@ -210,11 +200,6 @@ in
packages = [ "hello" ];
extraGroups = [ ];
};
deployment = {
_type = "nixops4Deployment";
deploymentFunction = true;
getProviders = true;
};
};
};
}

View file

@ -10,6 +10,7 @@ let
attrsOf
attrTag
deferredModuleWith
submoduleWith
submodule
optionType
functionTo
@ -153,12 +154,12 @@ in
readOnly = true;
default = {
input-type = application-resources;
output-type = nixops4Deployment;
output-type = types.raw;
};
};
deployment = mkOption {
description = "Generate a deployment from a configuration";
type = functionTo (environment.config.resource-mapping.output-type);
type = functionTo (submodule environment.config.resource-mapping.output-type);
readOnly = true;
default =
cfg: