about summary refs log tree commit diff
path: root/redmoon-static.nix
blob: 225af8f1956109b867f23e6221bfa92a500db846 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
}