summaryrefslogtreecommitdiff
path: root/modules/hosts.nix
blob: 0c66c7080b5235dbec1197090f7ac555b89575e2 (plain)
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
{ lib, config, ... }:

let cfg = config.this.hosts;
in
{
  options = {
    this.hosts.lan.home = lib.mkEnableOption "Home LAN /etc/hosts";
    this.hosts.mine = lib.mkEnableOption "my /etc/hosts";
    this.hosts.alef.zoar.cx = lib.mkEnableOption "alef.zoar.cx /etc/hosts";
  };

  config = {
    networking.hosts =
      lib.optionalAttrs cfg.lan.home {
        "172.19.0.14" = ["sage.alef.zoar.cx" "sage"];
        "192.168.1.5" = ["rosemary.alef.zoar.cx" "rosemary"];
      } //
      lib.optionalAttrs cfg.mine {
        "45.61.184.234" = ["alfheim"];
      } //
      lib.optionalAttrs cfg.alef.zoar.cx {
        "173.16.167.196" = ["sage.alef.zoar.cx" "sage"];
      };
  };
}