try and use deployment

This commit is contained in:
Kiara Grouwstra 2025-08-25 11:20:38 +02:00
parent 5ffd7f3940
commit b6e6f993ec
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
2 changed files with 28 additions and 16 deletions

View file

@ -1,11 +1,13 @@
{
inputs,
lib,
config,
inputs ? (import ../../../default.nix { }).inputs,
sources ? import ../../../npins,
...
}:
let
inherit (sources) nixpkgs;
lib = import "${nixpkgs}/lib";
eval =
module:
(lib.evalModules {
@ -33,8 +35,21 @@ let
authentication.password = "password";
};
nixos-configuration =
{ ... }:
{ pkgs, ... }:
{
imports = [
../common/sharedOptions.nix
../common/targetNode.nix
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
];
inherit (config) enableAcme;
acmeNodeIP = if config.enableAcme then config.nodes.acme.networking.primaryIPAddress else null;
environment.systemPackages = with pkgs; [
hello
];
users.users = config.resources.shell.login-shell.apply (
lib.filterAttrs (_name: value: value ? login-shell) requests
);

View file

@ -5,6 +5,7 @@
}:
let
inherit (import ./constants.nix) targetMachines pathToRoot;
escapedJson = v: lib.replaceStrings [ "\"" ] [ "\\\\\"" ] (lib.strings.toJSON v);
in
{
_class = "nixosTest";
@ -43,20 +44,16 @@ in
# INSTANTIATE
command=(nix-instantiate --expr '
let
configuration = { pkgs, config, ... }: {
imports = [
${pathToRoot}/deployment/check/common/sharedOptions.nix
${pathToRoot}/deployment/check/common/targetNode.nix
];
enableAcme = ${lib.strings.toJSON config.enableAcme};
acmeNodeIP = if config.enableAcme then config.nodes.acme.networking.primaryIPAddress else null;
environment.systemPackages = with pkgs; [
hello
];
import ${pathToRoot}/deployment/nixos.nix {
configuration = import ${pathToRoot}/deployment/check/data-model/deployment.nix {
config = builtins.fromJSON "${
escapedJson {
inherit (config) enableAcme;
acmeNodeIP = if config.enableAcme then config.nodes.acme.networking.primaryIPAddress else null;
}
}";
};
in
import ${pathToRoot}/deployment/nixos.nix { inherit configuration; }
}
')
# DEPLOY
host="root@${nodeName}"