forked from fediversity/fediversity
Compare commits
2 commits
37fd4d6642
...
0599a33916
Author | SHA1 | Date | |
---|---|---|---|
0599a33916 | |||
312ca7a48b |
2 changed files with 30 additions and 16 deletions
|
@ -14,6 +14,7 @@ let
|
||||||
];
|
];
|
||||||
}).config;
|
}).config;
|
||||||
nixops4Deployment = inputs.nixops4.modules.nixops4Deployment.default;
|
nixops4Deployment = inputs.nixops4.modules.nixops4Deployment.default;
|
||||||
|
inherit (inputs.nixops4.lib) mkDeployment;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
test-eval = {
|
test-eval = {
|
||||||
|
@ -163,27 +164,36 @@ 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
|
in
|
||||||
rec {
|
rec {
|
||||||
number-of-resources = with lib; length (attrNames fediversity.resources);
|
number-of-resources = with lib; length (attrNames fediversity.resources);
|
||||||
inherit (fediversity) example-configuration;
|
inherit (fediversity) example-configuration;
|
||||||
hello-package-exists =
|
hello-package-exists = hello-shell.packages ? hello;
|
||||||
(fediversity.applications.hello.resources example-configuration.applications.hello)
|
wheel-required = hello-shell.wheel;
|
||||||
.resources.hello.login-shell.packages ? hello;
|
wheel-allowed = environment.wheel;
|
||||||
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 =
|
operator-shell =
|
||||||
let
|
let
|
||||||
resources = fediversity.applications.hello.resources example-configuration.applications.hello;
|
operator = (environment.apply resources).operator;
|
||||||
users = fediversity.environments.single-nixos-vm.resources.operator-environment.login-shell.apply resources;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit (users.operator) isNormalUser;
|
inherit (operator) isNormalUser;
|
||||||
packages = with lib; map (p: "${p.pname}") users.operator.packages;
|
packages = with lib; map (p: "${p.pname}") operator.packages;
|
||||||
extraGroups = users.operator.extraGroups;
|
extraGroups = 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 = {
|
expected = {
|
||||||
|
@ -200,6 +210,11 @@ in
|
||||||
packages = [ "hello" ];
|
packages = [ "hello" ];
|
||||||
extraGroups = [ ];
|
extraGroups = [ ];
|
||||||
};
|
};
|
||||||
|
deployment = {
|
||||||
|
_type = "nixops4Deployment";
|
||||||
|
deploymentFunction = true;
|
||||||
|
getProviders = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ let
|
||||||
attrsOf
|
attrsOf
|
||||||
attrTag
|
attrTag
|
||||||
deferredModuleWith
|
deferredModuleWith
|
||||||
submoduleWith
|
|
||||||
submodule
|
submodule
|
||||||
optionType
|
optionType
|
||||||
functionTo
|
functionTo
|
||||||
|
@ -154,12 +153,12 @@ in
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default = {
|
default = {
|
||||||
input-type = application-resources;
|
input-type = application-resources;
|
||||||
output-type = types.raw;
|
output-type = nixops4Deployment;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
deployment = mkOption {
|
deployment = mkOption {
|
||||||
description = "Generate a deployment from a configuration";
|
description = "Generate a deployment from a configuration";
|
||||||
type = functionTo (submodule environment.config.resource-mapping.output-type);
|
type = functionTo (environment.config.resource-mapping.output-type);
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
default =
|
default =
|
||||||
cfg:
|
cfg:
|
||||||
|
|
Loading…
Add table
Reference in a new issue