]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/system/eldiron.nix
Change cron e-mail
[perso/Immae/Config/Nix.git] / modules / private / system / eldiron.nix
CommitLineData
f807d917
IB
1{ privateFiles }:
2{ config, pkgs, myconfig, ... }:
3{
4 boot.kernelPackages = pkgs.linuxPackages_latest;
5 _module.args.privateFiles = privateFiles;
9f202523 6 _module.args.hostFQDN = "eldiron.immae.eu";
f807d917
IB
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") myconfig.env.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 myconfig.env.servers.eldiron.ips);
17 };
18
19 imports = builtins.attrValues (import ../..);
20
63cd475c
IB
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 };
f807d917
IB
25 myServices.buildbot.enable = true;
26 myServices.databases.enable = true;
27 myServices.gitolite.enable = true;
3bc32d9e 28 myServices.monitoring.enable = true;
f807d917
IB
29 myServices.irc.enable = true;
30 myServices.pub.enable = true;
31 myServices.tasks.enable = true;
8415083e
IB
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;
f807d917 37 services.pure-ftpd.enable = true;
d2e703c5 38 services.duplyBackup.enable = true;
f807d917
IB
39
40 deployment = {
41 targetEnv = "hetzner";
42 hetzner = {
43 robotUser = myconfig.env.hetzner.user;
44 robotPass = myconfig.env.hetzner.pass;
45 mainIPv4 = myconfig.env.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;
4227853a 62 mailto = "cron@immae.eu";
f807d917
IB
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.
61ebe69b
IB
75 # https://nixos.org/nixos/manual/release-notes.html
76 system.stateVersion = "19.03"; # Did you read the comment?
f807d917 77}