diff options
-rw-r--r-- | machines/dnyarri.nix | 2 | ||||
-rw-r--r-- | machines/mmrnmhrm.nix | 2 | ||||
-rw-r--r-- | redmoon-static.nix | 30 |
3 files changed, 32 insertions, 2 deletions
diff --git a/machines/dnyarri.nix b/machines/dnyarri.nix index aca4d383..cb1ef594 100644 --- a/machines/dnyarri.nix +++ b/machines/dnyarri.nix @@ -4,7 +4,7 @@ with pkgs.lib; with import ../lib; { - imports = singleton ../common-workstation.nix; + imports = [ ../common-workstation.nix ../redmoon-static.nix ]; nix.maxJobs = 8; diff --git a/machines/mmrnmhrm.nix b/machines/mmrnmhrm.nix index 7f966c02..9e7ca041 100644 --- a/machines/mmrnmhrm.nix +++ b/machines/mmrnmhrm.nix @@ -4,7 +4,7 @@ with pkgs.lib; with import ../lib; { - imports = singleton ../common-workstation.nix; + imports = [ ../common-workstation.nix ../redmoon-static.nix ]; nix.maxJobs = 2; diff --git a/redmoon-static.nix b/redmoon-static.nix new file mode 100644 index 00000000..225af8f1 --- /dev/null +++ b/redmoon-static.nix @@ -0,0 +1,30 @@ +{ config, lib, ... }: + +let + hostMap = { + spaghetti.ipv4 = "192.168.1.1"; + mmrnmhrm.ipv4 = "192.168.1.20"; + dnyarri.ipv4 = "192.168.1.32"; + + mmrnmhrm.device = "enp4s0"; + dnyarri.device = "enp0s25"; + }; + + hostcfg = hostMap.${config.networking.hostName}; + +in { + # Workaround for my temporary stupid fscking non-IPv6 NAT gateway... + networking.domain = "redmoon"; + networking.nameservers = [ "212.18.0.5" "212.18.3.5" ]; + networking.defaultGateway = "192.168.1.1"; + networking.interfaces.${hostcfg.device} = { + ipAddress = hostcfg.ipv4; + prefixLength = 24; + }; + + networking.extraHosts = let + hostList = lib.mapAttrsToList (name: { ipv4, ... }: '' + ${ipv4} ${name} ${name}.redmoon + '') hostMap; + in lib.concatStrings hostList; +} |