]>
Commit | Line | Data |
---|---|---|
1 | { privateFiles ? ./. }: | |
2 | { | |
3 | network = { | |
4 | description = "Immae's network"; | |
5 | enableRollback = true; | |
6 | }; | |
7 | ||
8 | eldiron = { config, pkgs, mylibs, myconfig, ... }: | |
9 | { | |
10 | _module.args = { | |
11 | pkgsNext = import <nixpkgsNext> {}; | |
12 | pkgsPrevious = import <nixpkgsPrevious> {}; | |
13 | mylibs = import ../libs.nix { nixpkgs = pkgs; }; | |
14 | mypkgs = import ../default.nix; | |
15 | myconfig = { | |
16 | inherit privateFiles; | |
17 | env = import "${privateFiles}/environment.nix"; | |
18 | }; | |
19 | }; | |
20 | ||
21 | networking = { | |
22 | firewall.enable = true; | |
23 | # 176.9.151.89 declared in nixops -> infra / tools | |
24 | interfaces."eth0".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList | |
25 | (n: ips: { address = ips.ip4; prefixLength = 32; }) | |
26 | (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") myconfig.env.servers.eldiron.ips); | |
27 | interfaces."eth0".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList | |
28 | (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or [])) | |
29 | myconfig.env.servers.eldiron.ips); | |
30 | }; | |
31 | ||
32 | imports = [ | |
33 | ./modules/ssh | |
34 | ./modules/certificates.nix | |
35 | ./modules/gitolite | |
36 | ./modules/databases | |
37 | ./modules/mpd | |
38 | ./modules/websites | |
39 | ./modules/mail | |
40 | ./modules/ftp | |
41 | ./modules/pub | |
42 | ./modules/task | |
43 | ./modules/irc | |
44 | ./modules/buildbot | |
45 | ./modules/dns | |
46 | ]; | |
47 | services.myGitolite.enable = true; | |
48 | services.myDatabases.enable = true; | |
49 | services.myWebsites.production.enable = true; | |
50 | services.myWebsites.integration.enable = true; | |
51 | services.myWebsites.tools.enable = true; | |
52 | services.pure-ftpd.enable = true; | |
53 | services.irc.enable = true; | |
54 | services.pub.enable = true; | |
55 | services.myTasks.enable = true; | |
56 | services.buildbot.enable = true; | |
57 | ||
58 | services.journald.extraConfig = '' | |
59 | MaxLevelStore="warning" | |
60 | MaxRetentionSec="1year" | |
61 | ''; | |
62 | ||
63 | deployment = { | |
64 | targetEnv = "hetzner"; | |
65 | hetzner = { | |
66 | robotUser = myconfig.env.hetzner.user; | |
67 | robotPass = myconfig.env.hetzner.pass; | |
68 | mainIPv4 = myconfig.env.servers.eldiron.ips.main.ip4; | |
69 | partitions = '' | |
70 | clearpart --all --initlabel --drives=sda,sdb | |
71 | ||
72 | part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda | |
73 | part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb | |
74 | ||
75 | part raid.1 --grow --ondisk=sda | |
76 | part raid.2 --grow --ondisk=sdb | |
77 | ||
78 | raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2 | |
79 | ''; | |
80 | }; | |
81 | }; | |
82 | ||
83 | environment.systemPackages = [ | |
84 | pkgs.telnet | |
85 | pkgs.htop | |
86 | pkgs.vim | |
87 | pkgs.iftop | |
88 | ]; | |
89 | ||
90 | services.cron = { | |
91 | enable = true; | |
92 | systemCronJobs = [ | |
93 | '' | |
94 | # The star after /var/lib/* avoids deleting all folders in case of problem | |
95 | 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 | |
96 | '' | |
97 | ]; | |
98 | }; | |
99 | ||
100 | # This value determines the NixOS release with which your system is | |
101 | # to be compatible, in order to avoid breaking some software such as | |
102 | # database servers. You should change this only after NixOS release | |
103 | # notes say you should. | |
104 | system.stateVersion = "18.09"; # Did you read the comment? | |
105 | }; | |
106 | } |