Compare commits

..

72 commits

Author SHA1 Message Date
95313c0031
fix nixops4 for adjusted arguments 2025-09-01 20:48:50 +02:00
ec28601a41
restore path-based behavior for non-data-model tests 2025-09-01 15:19:52 +02:00
e24171f1d5
switch reusable script to package, facilitating inspection and reuse 2025-09-01 15:19:52 +02:00
6b9a57bd43
factor out ssh deployment to make for reusable invocation 2025-09-01 15:19:52 +02:00
ca62278582
stablize pathToRoot by builtins.path 2025-09-01 15:19:52 +02:00
57b6a590c0
simplify deployment/nixos.nix 2025-09-01 15:19:52 +02:00
b09e72e592
split tests to allow running the faster ssh test separately 2025-09-01 15:19:52 +02:00
b9e058369c
factor out data model 2025-09-01 15:19:52 +02:00
5f2accc987
add nixops4 data model test 2025-09-01 15:19:52 +02:00
93f17b6a42
adjust deployment type
this is a cop-out possible until
fricklerhandwerk/Fediversity#15.
after that, this will require actually figuring out how to get `options`
for `deployment.nix` - which may need `evalModules` with
`data-model.nix`.
2025-09-01 15:19:52 +02:00
78eb747256
restore data model with { resources } wrappers, this time working 2025-09-01 15:19:52 +02:00
17f6d3269b
simpler data model, not sure it's desirable but at least it's consistent 2025-09-01 15:19:52 +02:00
ee045f98a1
actually rely on user package from data model 2025-09-01 15:19:52 +02:00
a8bba3e2f7
pass system 2025-09-01 15:19:52 +02:00
c7e1e0fefa
update test 2025-09-01 15:19:52 +02:00
2759757cc4
update deployment 2025-09-01 15:19:52 +02:00
db827dcfab
simplify auth to not accept password 2025-09-01 15:19:52 +02:00
3c7ed1b662
rename deployment to deployment-type, disambiguating from environments' deployment 2025-09-01 15:19:52 +02:00
de1fbd25fc
fix attrTag by adding mkOption 2025-09-01 15:19:52 +02:00
8679fdf833
wrap application resources to match the input of apply 2025-09-01 15:19:52 +02:00
9a2f6a6173
stylize user-specified names by quotes to clarify their status 2025-09-01 15:19:52 +02:00
48d5b06c16
fix a bug of mismatching names in data model test
matches the name of `shell` to `operator-environment`.
2025-09-01 15:19:52 +02:00
9871d4d674
try and use deployment 2025-09-01 15:19:52 +02:00
77cd156236
spacing 2025-09-01 15:19:52 +02:00
0174c583ca
simplify imputDerivations 2025-09-01 15:19:52 +02:00
4240d974fa
unimport qemu-guest 2025-09-01 15:19:52 +02:00
22ad5fac8d
simplify inputDerivations 2025-09-01 15:19:52 +02:00
be09ee868a
simplify deployment 2025-09-01 15:19:52 +02:00
983c557d74
skip is-active sshd 2025-09-01 15:19:52 +02:00
fe568085a5
- auto 2025-09-01 15:19:52 +02:00
ebb5f6962c
move fail in 2025-09-01 15:19:52 +02:00
32d02a7d76
- BatchMode 2025-09-01 15:19:52 +02:00
d20c2ddfc6
rm unused ssh settings 2025-09-01 15:19:52 +02:00
e57ef09300
dedupe inputDerivations 2025-09-01 15:19:52 +02:00
4403e3ff9f
rm cowsay 2025-09-01 15:19:52 +02:00
5555e14779
remove unused JSON-serialized args (sources) 2025-09-01 15:19:52 +02:00
9783a461a9
factor out to nixos.nix 2025-09-01 15:19:52 +02:00
6e01c454a4
rm users 2025-09-01 15:19:52 +02:00
a87fee4055
simplify grub 2025-09-01 15:19:52 +02:00
1b5ac64568
rm users 2025-09-01 15:19:52 +02:00
3d64683df3
reenable ipv6 2025-09-01 15:19:52 +02:00
5e1cee9ab3
reenable firewall 2025-09-01 15:19:52 +02:00
0a3ac78758
rm comments 2025-09-01 15:19:52 +02:00
a6fa7838b3
rm getty 2025-09-01 15:19:52 +02:00
d872f202fd
mv attempts 2025-09-01 15:19:52 +02:00
5a3bbb3f58
download-attempts: settle for just targetNode 2025-09-01 15:19:52 +02:00
7b2fb9fe2a
rm comment 2025-09-01 15:19:52 +02:00
a60bc4f6db
restore imports 2025-09-01 15:19:52 +02:00
94a4318f43
dedupe nixosTest.nix 2025-09-01 15:19:52 +02:00
6e0627f983
qemu guest 2025-09-01 15:19:52 +02:00
325c228b84
grub 2025-09-01 15:19:52 +02:00
3b514b9960
auto login 2025-09-01 15:19:52 +02:00
71ef264ff8
networking 2025-09-01 15:19:52 +02:00
bf7aebd852
users 2025-09-01 15:19:52 +02:00
5bb939d68e
handle test outcome 2025-09-01 15:19:52 +02:00
81467ba3e5
specialArgs: sources 2025-09-01 15:19:52 +02:00
130ccf78c0
nix in tests: download-attempts = 1 2025-09-01 15:19:52 +02:00
a9c6b667fb
ensure inputs 2025-09-01 15:19:52 +02:00
cba3311289
rm paste 2025-09-01 15:19:52 +02:00
248ba40771
move stuff not needed in test out 2025-09-01 15:19:52 +02:00
e2fc829c66
ensure availability of needed inputs 2025-09-01 15:19:52 +02:00
d6e30517ec
reduce download attempts in test 2025-09-01 15:19:52 +02:00
24d4a7aea7
settle for hello, ditching cowsay 2025-09-01 15:19:52 +02:00
dc0b4caf3b
move imports from paste to targetNode to increase parity between paste and nixosTest 2025-09-01 15:19:52 +02:00
7011b4ff40
ditch superfluous substituters 2025-09-01 15:19:52 +02:00
329b5b7a22
pasteable command for trying without rebuilding vm 2025-09-01 15:19:52 +02:00
1d0a696c31
add keys 2025-09-01 15:19:52 +02:00
8540773207
wip: use ssh in test 2025-09-01 15:19:52 +02:00
f71487469b
add deployment method: ssh 2025-09-01 15:19:52 +02:00
5a23f63939
un-nixops 2025-09-01 15:19:52 +02:00
424b27be3f
scaffold deployment/check/data-model from ./basic
modelify
2025-09-01 15:19:52 +02:00
806f561153
allow different deployment types 2025-09-01 15:19:52 +02:00
5 changed files with 32 additions and 72 deletions

View file

@ -1,5 +1,4 @@
on:
workflow_dispatch: # allows manual triggering
pull_request:
types:
- opened

View file

@ -105,7 +105,8 @@ let
options.enable = lib.mkEnableOption "Hello in the shell";
};
implementation = cfg: {
resources = lib.optionalAttrs cfg.enable {
input = cfg;
output.resources = lib.optionalAttrs cfg.enable {
hello.login-shell.packages.hello = pkgs.hello;
};
};
@ -141,7 +142,8 @@ let
deployment-name,
}:
{
ssh-host = {
input = required-resources;
output.ssh-host = {
nixos-configuration = mkNixosConfiguration environment required-resources;
system = targetSystem;
ssh = {
@ -164,7 +166,8 @@ let
...
}:
{
nixops4 =
input = required-resources;
output.nixops4 =
{ providers, ... }:
{
providers = {

View file

@ -98,9 +98,9 @@ in
{
options.enable = lib.mkEnableOption "Hello in the shell";
};
implementation =
cfg: {
resources = lib.optionalAttrs cfg.enable {
implementation = cfg: {
input = cfg;
output.resources = lib.optionalAttrs cfg.enable {
hello.login-shell.packages.hello = pkgs.hello;
};
};
@ -110,7 +110,8 @@ in
{
resources."operator-environment".login-shell.username = "operator";
implementation = requests: {
nixops4 = (
input = requests;
output.nixops4 =
{ providers, ... }:
{
providers = {
@ -133,8 +134,7 @@ in
};
};
};
}
);
};
};
};
};

View file

@ -29,7 +29,7 @@ let
lib.strings.toJSON v
);
functionType = submodule ./function.nix;
functionType = import ./function.nix;
application-resources = submodule {
options.resources = mkOption {
# TODO: maybe transpose, and group the resources by type instead
@ -223,19 +223,18 @@ in
};
resources = mkOption {
description = "Compute resources required by an application";
type = application.config.config-mapping.function-type;
type = functionTo application.config.config-mapping.output-type;
readOnly = true;
default = application.config.config-mapping.apply;
default = input: (application.config.implementation input).output;
};
# TODO(@fricklerhandwerk): this needs a better name
# TODO(@fricklerhandwerk): this needs a better name, it's just the type
config-mapping = mkOption {
description = "Function type for the mapping from application configuration to required resources";
type = functionType;
type = submodule functionType;
readOnly = true;
default = {
input-type = submodule application.config.module;
output-type = application-resources;
implementation = application.config.implementation;
};
};
};
@ -267,7 +266,7 @@ in
};
resource-mapping = mkOption {
description = "Function type for the mapping from resources to a deployment";
type = functionType;
type = submodule functionType;
readOnly = true;
default = {
input-type = submodule {
@ -281,37 +280,6 @@ in
};
};
output-type = deployment-type;
implementation = environment.config.implementation;
};
};
config-mapping = mkOption {
description = "Mapping from a configuration to a deployment";
type = functionType;
readOnly = true;
default = {
input-type = submodule {
options = {
deployment-name = mkOption {
type = types.str;
};
configuration = mkOption {
type = config.configuration;
};
};
};
output-type = deployment-type;
implementation =
{
deployment-name,
configuration,
}:
# TODO: check cfg.enable.true
let
required-resources = lib.mapAttrs (
name: application-settings: config.applications.${name}.resources application-settings
) configuration.applications;
in
environment.config.resource-mapping.apply { inherit required-resources deployment-name; };
};
};
# TODO(@fricklerhandwerk): maybe this should be a separate thing such as `fediversity-setup`,
@ -319,9 +287,21 @@ in
# then the deployments can simply be the result of the function application baked into this module.
deployment = mkOption {
description = "Generate a deployment from a configuration, by applying an environment's resource policies to the applications' resource mappings";
type = environment.config.config-mapping.function-type;
type = functionTo (environment.config.resource-mapping.output-type);
readOnly = true;
default = environment.config.config-mapping.apply;
default =
{
deployment-name,
configuration,
}:
# TODO: check cfg.enable.true
let
required-resources = lib.mapAttrs (
name: application-settings: config.applications.${name}.resources application-settings
) configuration.applications;
in
(environment.config.implementation { inherit required-resources deployment-name; }).output;
};
};
})

View file

@ -19,11 +19,6 @@ in
type = optionType;
};
function-type = mkOption {
type = optionType;
readOnly = true;
default = functionTo config.output-type;
};
wrapper-type = mkOption {
type = optionType;
readOnly = true;
default = functionTo (submodule {
@ -37,22 +32,5 @@ in
};
});
};
implementation = mkOption {
type = config.function-type;
default = _: { };
};
wrapper = mkOption {
type = config.wrapper-type;
readOnly = true;
default = input: fn: {
inherit input;
output = config.implementation fn.config.input;
};
};
apply = mkOption {
type = config.function-type;
readOnly = true;
default = input: (config.wrapper input).output;
};
};
}