test: added a test for physical servers.
They wont be built/deployed now without an ip assigned. See the "fun" over here https://discord.com/channels/689189992417067052/1118476661604765746/1125914392102445220
This commit is contained in:
parent
378973060a
commit
8b09e7962b
4 changed files with 20 additions and 1 deletions
|
@ -19,6 +19,7 @@ let
|
|||
|
||||
in {
|
||||
imports = [
|
||||
./hardware/_base.nix
|
||||
./hardware/RM001.nix
|
||||
];
|
||||
|
||||
|
|
17
machines/hardware/_base.nix
Normal file
17
machines/hardware/_base.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ config, options, lib, ... }: with lib;
|
||||
let
|
||||
# get a list of interfaces
|
||||
interfaces = attrNames config.networking.interfaces;
|
||||
# check if an IP has been assigned
|
||||
has_ip = interface: (length config.networking.interfaces."${interface}".ipv4.addresses) != 0;
|
||||
in {
|
||||
config = {
|
||||
assertions = [
|
||||
{
|
||||
assertion = lists.any has_ip interfaces;
|
||||
message = "Must have a ip address set";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
}
|
|
@ -20,6 +20,7 @@ let
|
|||
|
||||
in {
|
||||
imports = [
|
||||
./hardware/_base.nix
|
||||
./hardware/RM007.nix
|
||||
../applications/restic.nix
|
||||
];
|
||||
|
|
|
@ -22,7 +22,7 @@ let
|
|||
ns = "ns1";
|
||||
in {
|
||||
imports = [
|
||||
# the physical hardware for this
|
||||
./hardware/_base.nix
|
||||
./hardware/RM002.nix
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in a new issue