]>
Commit | Line | Data |
---|---|---|
5f5efa6f | 1 | { environment ? ./environment.nix }: |
a1bb33c4 IB |
2 | { |
3 | network = { | |
4 | description = "Immae's network"; | |
5 | enableRollback = true; | |
6 | }; | |
7 | ||
f8bde3d6 | 8 | eldiron = { config, pkgs, mylibs, myconfig, ... }: |
4d4f13f4 | 9 | with mylibs; |
ab5d04b8 | 10 | { |
4d4f13f4 IB |
11 | _module.args = { |
12 | mylibs = import ../libs.nix; | |
7636abc6 | 13 | mypkgs = import ../default.nix; |
f8bde3d6 | 14 | myconfig = { |
5f5efa6f | 15 | env = import environment; |
f8bde3d6 IB |
16 | ips = { |
17 | main = "176.9.151.89"; | |
18 | production = "176.9.151.154"; | |
19 | integration = "176.9.151.155"; | |
20 | }; | |
21 | }; | |
4d4f13f4 IB |
22 | }; |
23 | ||
24 | imports = [ | |
3013caf1 | 25 | ./modules/certificates.nix |
10889174 IB |
26 | ./modules/gitolite |
27 | ./modules/databases | |
e229e6f2 | 28 | ./modules/mpd |
54307da4 | 29 | ./modules/websites |
af421a8f | 30 | ./modules/mail |
439049e5 | 31 | ./modules/ftp |
4d4f13f4 IB |
32 | ]; |
33 | services.myGitolite.enable = true; | |
4d4f13f4 | 34 | services.myDatabases.enable = true; |
42429ef0 IB |
35 | services.myWebsites.production.enable = true; |
36 | services.myWebsites.integration.enable = true; | |
10889174 | 37 | services.myWebsites.tools.enable = true; |
439049e5 | 38 | services.pure-ftpd.enable = true; |
4d4f13f4 | 39 | |
46228a29 IB |
40 | services.journald.extraConfig = '' |
41 | MaxLevelStore="warning" | |
42 | MaxRetentionSec="1year" | |
43 | ''; | |
a1bb33c4 IB |
44 | networking = { |
45 | firewall = { | |
46 | enable = true; | |
10889174 | 47 | allowedTCPPorts = [ 22 ]; |
a1bb33c4 IB |
48 | }; |
49 | }; | |
50 | ||
51 | deployment = { | |
52 | targetEnv = "hetzner"; | |
53 | hetzner = { | |
9d90e7e2 IB |
54 | robotUser = myconfig.env.hetzner.user; |
55 | robotPass = myconfig.env.hetzner.pass; | |
f8bde3d6 | 56 | mainIPv4 = myconfig.ips.main; |
a1bb33c4 IB |
57 | partitions = '' |
58 | clearpart --all --initlabel --drives=sda,sdb | |
59 | ||
60 | part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda | |
61 | part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb | |
62 | ||
63 | part raid.1 --grow --ondisk=sda | |
64 | part raid.2 --grow --ondisk=sdb | |
65 | ||
66 | raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2 | |
67 | ''; | |
68 | }; | |
69 | }; | |
70 | ||
10889174 | 71 | environment.systemPackages = [ |
ce6ee3b8 | 72 | pkgs.telnet |
beeed847 | 73 | pkgs.htop |
ce6ee3b8 IB |
74 | pkgs.vim |
75 | ]; | |
76 | ||
5566d26d IB |
77 | services.openssh.extraConfig = '' |
78 | AuthorizedKeysCommand /etc/ssh/ldap_authorized_keys | |
79 | AuthorizedKeysCommandUser nobody | |
80 | ''; | |
81 | ||
5566d26d IB |
82 | environment.etc."ssh/ldap_authorized_keys" = let |
83 | ldap_authorized_keys = | |
5c101474 | 84 | wrap { |
5566d26d IB |
85 | name = "ldap_authorized_keys"; |
86 | file = ./ldap_authorized_keys.sh; | |
87 | vars = { | |
9d90e7e2 | 88 | LDAP_PASS = myconfig.env.sshd.ldap.password; |
5566d26d IB |
89 | GITOLITE_SHELL = "${pkgs.gitolite}/bin/gitolite-shell"; |
90 | ECHO = "${pkgs.coreutils}/bin/echo"; | |
91 | }; | |
92 | paths = [ pkgs.openldap pkgs.stdenv.shellPackage pkgs.gnugrep pkgs.gnused pkgs.coreutils ]; | |
93 | }; | |
94 | in { | |
95 | enable = true; | |
96 | mode = "0755"; | |
97 | user = "root"; | |
98 | source = ldap_authorized_keys; | |
65fe7543 IB |
99 | }; |
100 | ||
6533428a IB |
101 | services.cron = { |
102 | enable = true; | |
103 | systemCronJobs = [ | |
104 | '' | |
105 | # The star after /var/lib/* avoids deleting all folders in case of problem | |
9d8d1425 | 106 | 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 |
6533428a IB |
107 | '' |
108 | ]; | |
109 | }; | |
3de01f9b IB |
110 | |
111 | # This value determines the NixOS release with which your system is | |
112 | # to be compatible, in order to avoid breaking some software such as | |
113 | # database servers. You should change this only after NixOS release | |
114 | # notes say you should. | |
115 | system.stateVersion = "18.09"; # Did you read the comment? | |
a1bb33c4 IB |
116 | }; |
117 | } |