summaryrefslogtreecommitdiff
path: root/config/networking/default.nix
diff options
context:
space:
mode:
authorquentin@aristote.fr <quentin@aristote.fr>2023-05-07 16:59:36 +0200
committerquentin@aristote.fr <quentin@aristote.fr>2023-05-07 19:04:44 +0200
commit0f12281f274f781c9b3041c5f4e5bc32d38a316d (patch)
tree0b8d5c31d866b91f47d30e3978ec50aca591afb9 /config/networking/default.nix
parent722d71b81cc05b76c5b84b47cb50c97da3501930 (diff)
config: networking: fix module
Diffstat (limited to 'config/networking/default.nix')
-rw-r--r--config/networking/default.nix52
1 files changed, 28 insertions, 24 deletions
diff --git a/config/networking/default.nix b/config/networking/default.nix
index 0692e6b..ea7e17e 100644
--- a/config/networking/default.nix
+++ b/config/networking/default.nix
@@ -7,29 +7,33 @@ in {
imports = [ ./services ];
options.personal.networking = {
- interfaces = lib.mkOption {
+ networks = lib.mkOption {
type = with lib.types;
attrsOf (submodule {
- interface = lib.mkOption {
- type = lib.types.str;
- description = "Name of the network interface.";
- example = "enp4s0";
- };
- subnet = lib.mkOption {
- type = lib.types.str;
- description = "IPv4 subnet of the network.";
- example = "192.168.1";
- };
- machines = lib.mkOption {
- type = with lib.types;
- attrsOf (submodule {
- address = lib.mkOption {
- type = lib.types.str;
- description = "IP address of this machine.";
- example = "192.168.1.1";
- };
- });
- description = "Some machines connected to this network.";
+ options = {
+ interface = lib.mkOption {
+ type = lib.types.str;
+ description = "Name of the network interface.";
+ example = "enp4s0";
+ };
+ subnet = lib.mkOption {
+ type = lib.types.str;
+ description = "IPv4 subnet of the network.";
+ example = "192.168.1";
+ };
+ machines = lib.mkOption {
+ type = with lib.types;
+ attrsOf (submodule {
+ options = {
+ address = lib.mkOption {
+ type = lib.types.str;
+ description = "IP address of this machine.";
+ example = "192.168.1.1";
+ };
+ };
+ });
+ description = "Some machines connected to this network.";
+ };
};
});
description = "Networks this device belongs to.";
@@ -65,7 +69,7 @@ in {
networking = {
hostName = "kerberos";
domain = "local";
- nameserver = [ cfg.networks.lan.machines.livebox.address ];
+ nameservers = [ cfg.networks.lan.machines.livebox.address ];
defaultGateway = with cfg.networks.lan; {
inherit interface;
@@ -76,8 +80,8 @@ in {
interfaces = lib.concatMapAttrs (name: value: {
"${value.interface}" = {
useDHCP = false;
- ipv4.address = lib.optional (value.machines ? self) {
- inherit (value.machines) address;
+ ipv4.addresses = lib.optional (value.machines ? self) {
+ inherit (value.machines.self) address;
prefixLength = 24;
};
};