]>
Commit | Line | Data |
---|---|---|
1 | { privateFiles }: | |
2 | { config, pkgs, ... }: | |
3 | { | |
4 | boot.kernelPackages = pkgs.linuxPackages_latest; | |
5 | myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; }; | |
6 | hostEnv.FQDN = "eldiron.immae.eu"; | |
7 | ||
8 | networking = { | |
9 | firewall.enable = true; | |
10 | # 176.9.151.89 declared in nixops -> infra / tools | |
11 | interfaces."eth0".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList | |
12 | (n: ips: { address = ips.ip4; prefixLength = 32; }) | |
13 | (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.myEnv.servers.eldiron.ips); | |
14 | interfaces."eth0".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList | |
15 | (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or [])) | |
16 | config.myEnv.servers.eldiron.ips); | |
17 | }; | |
18 | ||
19 | imports = builtins.attrValues (import ../..); | |
20 | ||
21 | boot.kernel.sysctl = { | |
22 | # https://github.com/Netflix/security-bulletins/blob/master/advisories/third-party/2019-001.md | |
23 | "net.ipv4.tcp_sack" = 0; | |
24 | }; | |
25 | myServices.buildbot.enable = true; | |
26 | myServices.databases.enable = true; | |
27 | myServices.gitolite.enable = true; | |
28 | myServices.monitoring.enable = true; | |
29 | myServices.irc.enable = true; | |
30 | myServices.pub.enable = true; | |
31 | myServices.tasks.enable = true; | |
32 | myServices.mpd.enable = true; | |
33 | myServices.dns.enable = true; | |
34 | myServices.certificates.enable = true; | |
35 | myServices.websites.enable = true; | |
36 | myServices.mail.enable = true; | |
37 | services.pure-ftpd.enable = true; | |
38 | services.duplyBackup.enable = true; | |
39 | ||
40 | deployment = { | |
41 | targetEnv = "hetzner"; | |
42 | hetzner = { | |
43 | robotUser = config.myEnv.hetzner.user; | |
44 | robotPass = config.myEnv.hetzner.pass; | |
45 | mainIPv4 = config.myEnv.servers.eldiron.ips.main.ip4; | |
46 | partitions = '' | |
47 | clearpart --all --initlabel --drives=sda,sdb | |
48 | ||
49 | part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda | |
50 | part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb | |
51 | ||
52 | part raid.1 --grow --ondisk=sda | |
53 | part raid.2 --grow --ondisk=sdb | |
54 | ||
55 | raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2 | |
56 | ''; | |
57 | }; | |
58 | }; | |
59 | ||
60 | services.cron = { | |
61 | enable = true; | |
62 | mailto = "cron@immae.eu"; | |
63 | systemCronJobs = [ | |
64 | '' | |
65 | # The star after /var/lib/* avoids deleting all folders in case of problem | |
66 | 0 3,9,15,21 * * * root rsync -e "ssh -i /root/.ssh/id_charon_vpn" -aAXvz --delete --numeric-ids --super --rsync-path="sudo rsync" /var/lib/* immae@immae.eu: > /dev/null | |
67 | '' | |
68 | ]; | |
69 | }; | |
70 | ||
71 | # This value determines the NixOS release with which your system is | |
72 | # to be compatible, in order to avoid breaking some software such as | |
73 | # database servers. You should change this only after NixOS release | |
74 | # notes say you should. | |
75 | # https://nixos.org/nixos/manual/release-notes.html | |
76 | system.stateVersion = "19.03"; # Did you read the comment? | |
77 | } |