Compare commits

..

No commits in common. "141c841c29ce144be2c8842f18b30480ae516e37" and "284861635969ef795c15b701c481b2d909ad3355" have entirely different histories.

3 changed files with 5 additions and 25 deletions

View file

@ -10,10 +10,7 @@
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
kropcloud = {
admin = {

View file

@ -5,7 +5,6 @@
ipv4 = {
address = "192.168.1.160";
prefixLength = 24;
defaultGateway = "192.168.1.1";
};
};
};

View file

@ -18,12 +18,6 @@ let
default = null;
example = if version == 4 then 24 else 64;
};
defaultGateway = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "The defautl gateway IPv${version}";
default = null;
example = if version == 4 then "192.168.1.1" else null;
};
};
in
{
@ -40,10 +34,9 @@ in
assertions = [
{
assertion =
!(cfg.ipv4.address == null || cfg.ipv4.prefixLength == null || cfg.ipv4.defaultGateway == null);
assertion = !(cfg.ipv4.address == null || cfg.ipv4.prefixLength == null);
message = ''
You need to provide valid values for `address`, `prefixLength` and `defaultGateway` in `kropcloud.networking.ipv4`
You need to provide valid values for both `address` and `prefixLength` in `kropcloud.networking.ipv4`
when either is set.
'';
}
@ -64,17 +57,8 @@ in
];
};
};
useDHCP = (
cfg.ipv4.address == null || cfg.ipv4.prefixLength == null || cfg.ipv4.defaultGateway == null
);
defaultGateway = lib.mkIf (cfg.ipv4.defaultGateway != null) { address = cfg.ipv4.defaultGateway; };
nameservers =
lib.mkIf
(cfg.ipv4.address != null || cfg.ipv4.prefixLength != null || cfg.ipv4.defaultGateway != null)
[
"8.8.8.8"
"1.1.1.1"
];
useDHCP = (cfg.ipv4.address == null || cfg.ipv4.prefixLength == null);
nameservers = [ "8.8.8.8" "1.1.1.1" ];
};
};
}