add test for port uniqueness
This commit is contained in:
parent
2aa78bfc48
commit
80b66beb54
21
flake.nix
21
flake.nix
@ -62,7 +62,6 @@
|
||||
music_dir = "/${zpool_ssds}/music";
|
||||
torrent_group = "media";
|
||||
|
||||
# TODO: add checks to make sure none of these collide
|
||||
ports = {
|
||||
https = 443;
|
||||
jellyfin = 8096; # no services.jellyfin option for this
|
||||
@ -170,6 +169,26 @@
|
||||
};
|
||||
modules =
|
||||
[
|
||||
# SAFETY! make sure no ports collide
|
||||
(
|
||||
{ lib, ... }:
|
||||
{
|
||||
config = {
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
let
|
||||
ports = lib.attrValues service_configs.ports;
|
||||
uniquePorts = lib.unique ports;
|
||||
in
|
||||
(lib.length ports) == (lib.length uniquePorts);
|
||||
message = "Duplicate ports detected in 'ports' configuration";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
)
|
||||
|
||||
./disk-config.nix
|
||||
disko.nixosModules.disko
|
||||
./configuration.nix
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user