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, config,
inputs ? (import ../../../default.nix { }).inputs,
sources ? import ../../../npins,
... ...
}: }:
let let
inherit (sources) nixpkgs;
lib = import "${nixpkgs}/lib";
eval = eval =
module: module:
(lib.evalModules { (lib.evalModules {
@ -33,8 +35,21 @@ let
authentication.password = "password"; authentication.password = "password";
}; };
nixos-configuration = 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 ( users.users = config.resources.shell.login-shell.apply (
lib.filterAttrs (_name: value: value ? login-shell) requests lib.filterAttrs (_name: value: value ? login-shell) requests
); );

View file

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