Skip to content

Commit

Permalink
chore(infra): add devices assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgon committed Jan 15, 2025
1 parent 023d3f9 commit 0e3c5f8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions modules/infra/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, ... }:
{ config, lib, ... }:
{
imports = [
./config.nix
Expand Down Expand Up @@ -35,7 +35,7 @@
};
}
);
description = "List of IPs and MACs of client devices.";
description = "List of IPs and MACs of client devices. Used mostly for bluetooth or static IPs.";
default = { };
example = {
ps5 = {
Expand Down Expand Up @@ -75,4 +75,15 @@
internal = true;
};
};

config = {
assertions = [
{
assertion = lib.lists.all (device: device.ip != null || device.mac != null) (
builtins.attrValues config.myInfra.devices
);
message = "Each infra device must have either IP or MAC set.";
}
];
};
}

0 comments on commit 0e3c5f8

Please sign in to comment.