Compare commits
2 commits
2848616359
...
141c841c29
Author | SHA1 | Date | |
---|---|---|---|
141c841c29 | |||
b93cf25dea |
3 changed files with 25 additions and 5 deletions
|
@ -10,7 +10,10 @@
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
nix.settings.experimental-features = [
|
||||||
|
"nix-command"
|
||||||
|
"flakes"
|
||||||
|
];
|
||||||
|
|
||||||
kropcloud = {
|
kropcloud = {
|
||||||
admin = {
|
admin = {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
ipv4 = {
|
ipv4 = {
|
||||||
address = "192.168.1.160";
|
address = "192.168.1.160";
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
|
defaultGateway = "192.168.1.1";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,12 @@ let
|
||||||
default = null;
|
default = null;
|
||||||
example = if version == 4 then 24 else 64;
|
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
|
in
|
||||||
{
|
{
|
||||||
|
@ -34,9 +40,10 @@ in
|
||||||
|
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = !(cfg.ipv4.address == null || cfg.ipv4.prefixLength == null);
|
assertion =
|
||||||
|
!(cfg.ipv4.address == null || cfg.ipv4.prefixLength == null || cfg.ipv4.defaultGateway == null);
|
||||||
message = ''
|
message = ''
|
||||||
You need to provide valid values for both `address` and `prefixLength` in `kropcloud.networking.ipv4`
|
You need to provide valid values for `address`, `prefixLength` and `defaultGateway` in `kropcloud.networking.ipv4`
|
||||||
when either is set.
|
when either is set.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
@ -57,8 +64,17 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
useDHCP = (cfg.ipv4.address == null || cfg.ipv4.prefixLength == null);
|
useDHCP = (
|
||||||
nameservers = [ "8.8.8.8" "1.1.1.1" ];
|
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"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue