forked from Fediversity/Fediversity
data model: add TF test #4
2 changed files with 28 additions and 16 deletions
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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};
|
||||
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;
|
||||
environment.systemPackages = with pkgs; [
|
||||
hello
|
||||
];
|
||||
}
|
||||
}";
|
||||
};
|
||||
in
|
||||
import ${pathToRoot}/deployment/nixos.nix { inherit configuration; }
|
||||
}
|
||||
')
|
||||
# DEPLOY
|
||||
host="root@${nodeName}"
|
||||
|
|
Loading…
Add table
Reference in a new issue