4 boot.kernelPackages = pkgs.linuxPackages_latest;
5 myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; };
8 firewall.enable = true;
9 # 176.9.151.89 declared in nixops -> infra / tools
10 interfaces."eth0".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList
11 (n: ips: { address = ips.ip4; prefixLength = 32; })
12 (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.hostEnv.ips);
13 interfaces."eth0".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList
14 (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or []))
18 imports = builtins.attrValues (import ../..);
20 boot.kernel.sysctl = {
21 # https://github.com/Netflix/security-bulletins/blob/master/advisories/third-party/2019-001.md
22 "net.ipv4.tcp_sack" = 0;
24 myServices.buildbot.enable = true;
25 myServices.databases.enable = true;
26 myServices.gitolite.enable = true;
27 myServices.monitoring.enable = true;
28 myServices.irc.enable = true;
29 myServices.pub.enable = true;
30 myServices.tasks.enable = true;
31 myServices.mpd.enable = true;
32 myServices.dns.enable = true;
33 myServices.certificates.enable = true;
34 myServices.websites.enable = true;
35 myServices.mail.enable = true;
36 myServices.ejabberd.enable = true;
37 myServices.vpn.enable = true;
38 services.pure-ftpd.enable = true;
39 services.duplyBackup.enable = true;
40 services.duplyBackup.profiles.oldies.rootDir = "/var/lib/oldies";
44 dest = "rsync_backup/identity";
48 text = config.myEnv.rsync_backup.ssh_key.private;
51 programs.ssh.knownHosts.dilion = {
52 hostNames = ["dilion.immae.eu"];
54 profile = config.myEnv.rsync_backup.profiles.dilion;
56 "${profile.host_key_type} ${profile.host_key}";
60 targetEnv = "hetzner";
62 robotUser = config.myEnv.hetzner.user;
63 robotPass = config.myEnv.hetzner.pass;
64 mainIPv4 = config.hostEnv.ips.main.ip4;
66 clearpart --all --initlabel --drives=sda,sdb
68 part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda
69 part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb
71 part raid.1 --grow --ondisk=sda
72 part raid.2 --grow --ondisk=sdb
74 raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2
81 mailto = "cron@immae.eu";
84 # The star after /var/lib/* avoids deleting all folders in case of problem
85 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
86 0 0 * * * root journalctl -q --since="25 hours ago" -u postfix -g "immae.eu.*Recipient address rejected"
91 # This value determines the NixOS release with which your system is
92 # to be compatible, in order to avoid breaking some software such as
93 # database servers. You should change this only after NixOS release
94 # notes say you should.
95 # https://nixos.org/nixos/manual/release-notes.html
96 system.stateVersion = "20.03"; # Did you read the comment?