]>
Commit | Line | Data |
---|---|---|
f807d917 | 1 | { privateFiles }: |
ab8f306d | 2 | { config, pkgs, ... }: |
f807d917 | 3 | { |
31e11cdf | 4 | boot.supportedFilesystems = [ "zfs" ]; |
f807d917 | 5 | boot.kernelPackages = pkgs.linuxPackages_latest; |
ab8f306d | 6 | myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; }; |
f807d917 IB |
7 | |
8 | networking = { | |
31e11cdf | 9 | hostId = "8262ca33"; # generated with head -c4 /dev/urandom | od -A none -t x4 |
f807d917 IB |
10 | firewall.enable = true; |
11 | # 176.9.151.89 declared in nixops -> infra / tools | |
12 | interfaces."eth0".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList | |
13 | (n: ips: { address = ips.ip4; prefixLength = 32; }) | |
619e4f46 | 14 | (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.hostEnv.ips); |
f807d917 IB |
15 | interfaces."eth0".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList |
16 | (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or [])) | |
619e4f46 | 17 | config.hostEnv.ips); |
f807d917 IB |
18 | }; |
19 | ||
20 | imports = builtins.attrValues (import ../..); | |
21 | ||
63cd475c IB |
22 | boot.kernel.sysctl = { |
23 | # https://github.com/Netflix/security-bulletins/blob/master/advisories/third-party/2019-001.md | |
24 | "net.ipv4.tcp_sack" = 0; | |
25 | }; | |
f807d917 IB |
26 | myServices.buildbot.enable = true; |
27 | myServices.databases.enable = true; | |
28 | myServices.gitolite.enable = true; | |
3bc32d9e | 29 | myServices.monitoring.enable = true; |
f807d917 IB |
30 | myServices.irc.enable = true; |
31 | myServices.pub.enable = true; | |
32 | myServices.tasks.enable = true; | |
8415083e IB |
33 | myServices.mpd.enable = true; |
34 | myServices.dns.enable = true; | |
35 | myServices.certificates.enable = true; | |
36 | myServices.websites.enable = true; | |
37 | myServices.mail.enable = true; | |
3f453c7d | 38 | myServices.ejabberd.enable = true; |
ea9c6fe8 | 39 | myServices.vpn.enable = true; |
f807d917 | 40 | services.pure-ftpd.enable = true; |
d2e703c5 | 41 | services.duplyBackup.enable = true; |
213c323a | 42 | services.duplyBackup.profiles.oldies.rootDir = "/var/lib/oldies"; |
f807d917 | 43 | |
8bf83d7a IB |
44 | secrets.keys = [ |
45 | { | |
46 | dest = "rsync_backup/identity"; | |
47 | user = "root"; | |
48 | group = "root"; | |
49 | permissions = "0400"; | |
50 | text = config.myEnv.rsync_backup.ssh_key.private; | |
51 | } | |
52 | ]; | |
53 | programs.ssh.knownHosts.dilion = { | |
54 | hostNames = ["dilion.immae.eu"]; | |
55 | publicKey = let | |
56 | profile = config.myEnv.rsync_backup.profiles.dilion; | |
57 | in | |
58 | "${profile.host_key_type} ${profile.host_key}"; | |
59 | }; | |
60 | ||
f807d917 IB |
61 | deployment = { |
62 | targetEnv = "hetzner"; | |
63 | hetzner = { | |
ab8f306d IB |
64 | robotUser = config.myEnv.hetzner.user; |
65 | robotPass = config.myEnv.hetzner.pass; | |
619e4f46 | 66 | mainIPv4 = config.hostEnv.ips.main.ip4; |
f807d917 IB |
67 | partitions = '' |
68 | clearpart --all --initlabel --drives=sda,sdb | |
69 | ||
70 | part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda | |
71 | part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb | |
72 | ||
73 | part raid.1 --grow --ondisk=sda | |
74 | part raid.2 --grow --ondisk=sdb | |
75 | ||
76 | raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2 | |
77 | ''; | |
78 | }; | |
79 | }; | |
80 | ||
81 | services.cron = { | |
82 | enable = true; | |
4227853a | 83 | mailto = "cron@immae.eu"; |
f807d917 IB |
84 | systemCronJobs = [ |
85 | '' | |
86 | # The star after /var/lib/* avoids deleting all folders in case of problem | |
8bf83d7a | 87 | 0 3,9,15,21 * * * root rsync -e "ssh -i /var/secrets/rsync_backup/identity" --new-compress -aAXv --delete --numeric-ids --super --rsync-path="sudo rsync" /var/lib/* backup@dilion.immae.eu: > /dev/null |
fb7611c1 IB |
88 | 0 0 * * * root journalctl -q --since="25 hours ago" -u postfix -t postfix/smtpd -g "immae.eu.*Recipient address rejected" |
89 | # Need a way to blacklist properly | |
90 | # 0 0 * * * root journalctl -q --since="25 hours ago" -u postfix -t postfix/smtpd -g "NOQUEUE:" | |
91 | 0 0 * * * root journalctl -q --since="25 hours ago" -u postfix -t postfix/smtp -g "status=bounced" | |
f807d917 IB |
92 | '' |
93 | ]; | |
94 | }; | |
95 | ||
96 | # This value determines the NixOS release with which your system is | |
97 | # to be compatible, in order to avoid breaking some software such as | |
98 | # database servers. You should change this only after NixOS release | |
99 | # notes say you should. | |
61ebe69b | 100 | # https://nixos.org/nixos/manual/release-notes.html |
d43e0c61 | 101 | system.stateVersion = "20.03"; # Did you read the comment? |
f807d917 | 102 | } |