summaryrefslogtreecommitdiff
path: root/machines/dragon.nix
blob: 8ff178543a2ee3bfdcda0ec2ccfce0a7b19c20f4 (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
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
{ config, lib, pkgs, ... }:
{
  imports = [
    ../config/common.nix
    ../config/users.nix
    ../config/weechat.nix
    ../config/dns.nix
    ../config/hydra.nix
    ../config/web-server.nix
    ../config/cgit.nix
    ../config/mail-server.nix
    ../config/munin-node.nix
    ../config/munin-master.nix
  ];

  virtualisation.lxd.enable = true;
  security.apparmor = {
    enable = true;
    profiles = [
      "${pkgs.lxc}/etc/apparmor.d/usr.bin.lxc-star" 
      "${pkgs.lxc}/etc/apparmor.d/lxc-containers"
    ];
    packages = [ pkgs.lxc ];
  };

  boot.kernelParams = [ "console=tty0" ''console="ttyS0,115200n8"'' ];
  boot.loader.grub.extraConfig = ''
    GRUB_TERMINAL="console serial"
    GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
  '';
  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  boot.loader.grub.devices = ["/dev/sda" "/dev/sdb"];
  
  networking = {
    hostName = lib.mkForce "dragon";

    bridges = {
      br0 = {
        interfaces = ["eno2"];
      };
    };

    # interfaces.br0.ip6 = [
    #   # { address = "2001:470:8e2e:20:eca0:41ff:feef:92"; prefixLength = 64; }
    #   { address = "2001:470:8e2e:20::d"; prefixLength = 64; }
    # ];

    localCommands = ''
      ip -6 addr add 2001:470:8e2e:20::d/64 dev br0 || true
      ip -6 route add default via fe80::822a:a8ff:fe4d:f5d6 dev br0 metric 512 src 2001:470:8e2e:20::d || true
    '';
  };

  services = {
    openssh = {
      enable = lib.mkDefault true;
      passwordAuthentication = false;
    };
  };

  fileSystems = {
    "/storage" = {
      device = "/dev/sda3";
      fsType = "btrfs";
      options = [ "subvol=storage" ];
    };
  };

  system.stateVersion = lib.mkForce "17.09";
}