4 boot.supportedFilesystems = [ "zfs" ];
5 boot.kernelPackages = pkgs.linuxPackages_latest;
6 myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; };
9 hostId = "8262ca33"; # generated with head -c4 /dev/urandom | od -A none -t x4
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; })
14 (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.hostEnv.ips);
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 []))
20 imports = builtins.attrValues (import ../..);
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;
26 myServices.buildbot.enable = true;
27 myServices.databases.enable = true;
28 myServices.gitolite.enable = true;
29 myServices.monitoring.enable = true;
30 myServices.irc.enable = true;
31 myServices.pub.enable = true;
32 myServices.tasks.enable = true;
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;
38 myServices.ejabberd.enable = true;
39 myServices.vpn.enable = true;
40 services.pure-ftpd.enable = true;
41 services.duplyBackup.enable = true;
42 services.duplyBackup.profiles.oldies.rootDir = "/var/lib/oldies";
46 dest = "rsync_backup/identity";
50 text = config.myEnv.rsync_backup.ssh_key.private;
53 programs.ssh.knownHosts.dilion = {
54 hostNames = ["dilion.immae.eu"];
56 profile = config.myEnv.rsync_backup.profiles.dilion;
58 "${profile.host_key_type} ${profile.host_key}";
62 targetEnv = "hetzner";
64 robotUser = config.myEnv.hetzner.user;
65 robotPass = config.myEnv.hetzner.pass;
66 mainIPv4 = config.hostEnv.ips.main.ip4;
68 clearpart --all --initlabel --drives=sda,sdb
70 part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda
71 part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb
73 part raid.1 --grow --ondisk=sda
74 part raid.2 --grow --ondisk=sdb
76 raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2
83 mailto = "cron@immae.eu";
86 # The star after /var/lib/* avoids deleting all folders in case of problem
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
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"
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.
100 # https://nixos.org/nixos/manual/release-notes.html
101 system.stateVersion = "20.03"; # Did you read the comment?