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