]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/system/eldiron.nix
Add dilion server
[perso/Immae/Config/Nix.git] / modules / private / system / eldiron.nix
CommitLineData
f807d917 1{ privateFiles }:
ab8f306d 2{ config, pkgs, ... }:
f807d917
IB
3{
4 boot.kernelPackages = pkgs.linuxPackages_latest;
ab8f306d 5 myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; };
f807d917
IB
6
7 networking = {
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; })
619e4f46 12 (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.hostEnv.ips);
f807d917
IB
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 []))
619e4f46 15 config.hostEnv.ips);
f807d917
IB
16 };
17
18 imports = builtins.attrValues (import ../..);
19
63cd475c
IB
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;
23 };
f807d917
IB
24 myServices.buildbot.enable = true;
25 myServices.databases.enable = true;
26 myServices.gitolite.enable = true;
3bc32d9e 27 myServices.monitoring.enable = true;
f807d917
IB
28 myServices.irc.enable = true;
29 myServices.pub.enable = true;
30 myServices.tasks.enable = true;
8415083e
IB
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;
3f453c7d 36 myServices.ejabberd.enable = true;
f807d917 37 services.pure-ftpd.enable = true;
d2e703c5 38 services.duplyBackup.enable = true;
213c323a 39 services.duplyBackup.profiles.oldies.rootDir = "/var/lib/oldies";
f807d917
IB
40
41 deployment = {
42 targetEnv = "hetzner";
43 hetzner = {
ab8f306d
IB
44 robotUser = config.myEnv.hetzner.user;
45 robotPass = config.myEnv.hetzner.pass;
619e4f46 46 mainIPv4 = config.hostEnv.ips.main.ip4;
f807d917
IB
47 partitions = ''
48 clearpart --all --initlabel --drives=sda,sdb
49
50 part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda
51 part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb
52
53 part raid.1 --grow --ondisk=sda
54 part raid.2 --grow --ondisk=sdb
55
56 raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2
57 '';
58 };
59 };
60
61 services.cron = {
62 enable = true;
4227853a 63 mailto = "cron@immae.eu";
f807d917
IB
64 systemCronJobs = [
65 ''
66 # The star after /var/lib/* avoids deleting all folders in case of problem
e920f02d 67 0 3,9,15,21 * * * root rsync -e "ssh -i /root/.ssh/id_charon_vpn" --new-compress -aAXv --delete --numeric-ids --super --rsync-path="sudo rsync" /var/lib/* immae@immae.eu: > /dev/null
7476e409 68 0 0 * * * root journalctl -q --since="25 hours ago" -u postfix -g "immae.eu.*Recipient address rejected"
f807d917
IB
69 ''
70 ];
71 };
72
73 # This value determines the NixOS release with which your system is
74 # to be compatible, in order to avoid breaking some software such as
75 # database servers. You should change this only after NixOS release
76 # notes say you should.
61ebe69b
IB
77 # https://nixos.org/nixos/manual/release-notes.html
78 system.stateVersion = "19.03"; # Did you read the comment?
f807d917 79}