summaryrefslogtreecommitdiff
path: root/host/automatix.nix
blob: 7c6edd0772a030ae346135e1f9f7430c33e7ad08 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{ pkgs, ... }:

{
  imports = [
    ./hardware/automatix.nix

    ./software/server/git.nix
    ./software/server/mail.nix
    ./software/server/website.nix
    ./software/server/wireguard.nix
  ];

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

  nix.settings.allowed-users = [ "public" ];

  networking = {
    hostName = "automatix";

    firewall = {
      enable = true;
    # open Nginx ports, other services open their own ports
      allowedTCPPorts = [ 80 443 ];
    };

  # setup IPv6
    interfaces.ens3.ipv6.addresses = [ {
      address = "2a01:4f8:c010:f56::1";
      prefixLength = 64;
    } ];

    defaultGateway6 = {
      address   = "fe80::1";
      interface = "ens3";
    };
  };

  services = {
    nginx = {
      enable = true;

      recommendedGzipSettings  = true;
      recommendedOptimisation  = true;
      recommendedProxySettings = true;
      recommendedTlsSettings   = true;
    };

    syncthing = {
      enable = true;
      group  = "users";
      openDefaultPorts = true;
    };
  };

  systemd.timers."generate-ical-of-org-agenda" = {
    enable = true;
    wantedBy = [ "timers.target" ];
    timerConfig = {
      OnCalendar = "daily";
      Persistent = true;
      Unit = "generate-ical-of-org-agenda.service";
    };
  };

  systemd.services."generate-ical-of-org-agenda" = {
    enable = true;
    script = "${pkgs.emacs-nox}/bin/emacs -batch -l /var/lib/syncthing/org-cal-export.el";
    serviceConfig = {
      Type = "oneshot";
      User = "syncthing";
    };
  };

  users.users.syncthing.shell = pkgs.bash;

  security.acme = {
    acceptTerms = true;
    defaults.email = "key@kummerlaender.eu";
  };

  system.stateVersion = "18.09";
}