about summary refs log tree commit diff
path: root/configurations/varda/default.nix
blob: b9d84f709975bb5a9e0e6310fbaa7421f7a92593 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
  config,
  inputs,
  lib,
  this,
  ...
}:
with lib; {
  secrets.wireguard-private-key-varda.file = "${inputs.self}/secrets/wireguard-private-key-varda";

  nixfiles.modules = {
    wireguard = {
      privateKeyFile = config.secrets.wireguard-private-key-varda.path;
      client.enable = true;
    };

    acme.enable = true;

    rss-bridge.enable = true;
    radicale.enable = true;
  };

  networking = let
    interface = "eth0";
  in {
    interfaces.${interface} = {
      ipv4.addresses = [
        {
          inherit (this.ipv4) address;
          prefixLength = 22;
        }
      ];

      ipv6.addresses = [
        {
          inherit (this.ipv6) address;
          prefixLength = 64;
        }
      ];
    };

    defaultGateway = {
      inherit interface;
      address = this.ipv4.gateway;
    };

    defaultGateway6 = {
      inherit interface;
      address = this.ipv6.gateway;
    };
  };

  boot = {
    loader.grub = {
      enable = true;
      device = "/dev/sda";
    };

    initrd = {
      luks.devices.nixos = {
        device = "/dev/sda2";
        allowDiscards = true;
        bypassWorkqueues = true;
      };

      network = {
        enable = true;
        ssh = {
          enable = true;
          port = head config.services.openssh.ports;
          hostKeys = map (k: k.path) config.services.openssh.hostKeys;
          authorizedKeys = config.my.openssh.authorizedKeys.keys;
        };
      };

      availableKernelModules = ["ata_piix" "sd_mod" "sr_mod" "uhci_hcd" "virtio_pci" "virtio_scsi"];
    };
  };

  fileSystems = {
    "/boot" = {
      device = "LABEL=boot";
      fsType = "xfs";
      options = ["noatime"];
    };

    "/" = {
      device = "LABEL=nixos";
      fsType = "xfs";
      options = ["noatime"];
    };
  };

  system.stateVersion = "22.05";
}

Consider giving Nix/NixOS a try! <3