]>
Commit | Line | Data |
---|---|---|
1 | { | |
2 | network = { | |
3 | description = "Immae's network"; | |
4 | enableRollback = true; | |
5 | }; | |
6 | ||
7 | eldiron = { config, pkgs, mylibs, myconfig, ... }: | |
8 | with mylibs; | |
9 | { | |
10 | _module.args = { | |
11 | mylibs = import ../libs.nix; | |
12 | myconfig = { | |
13 | env = import ./environment.nix; | |
14 | ips = { | |
15 | main = "176.9.151.89"; | |
16 | production = "176.9.151.154"; | |
17 | integration = "176.9.151.155"; | |
18 | }; | |
19 | }; | |
20 | }; | |
21 | ||
22 | imports = [ | |
23 | ./modules/certificates.nix | |
24 | ./modules/gitolite | |
25 | ./modules/databases | |
26 | ./modules/websites | |
27 | ./modules/mail | |
28 | ./modules/ftp | |
29 | ]; | |
30 | services.myGitolite.enable = true; | |
31 | services.myDatabases.enable = true; | |
32 | services.myWebsites.production.enable = true; | |
33 | services.myWebsites.integration.enable = true; | |
34 | services.myWebsites.tools.enable = true; | |
35 | services.pure-ftpd.enable = true; | |
36 | ||
37 | networking = { | |
38 | firewall = { | |
39 | enable = true; | |
40 | allowedTCPPorts = [ 22 ]; | |
41 | }; | |
42 | }; | |
43 | ||
44 | deployment = { | |
45 | targetEnv = "hetzner"; | |
46 | hetzner = { | |
47 | robotUser = myconfig.env.hetzner.user; | |
48 | robotPass = myconfig.env.hetzner.pass; | |
49 | mainIPv4 = myconfig.ips.main; | |
50 | partitions = '' | |
51 | clearpart --all --initlabel --drives=sda,sdb | |
52 | ||
53 | part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda | |
54 | part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb | |
55 | ||
56 | part raid.1 --grow --ondisk=sda | |
57 | part raid.2 --grow --ondisk=sdb | |
58 | ||
59 | raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2 | |
60 | ''; | |
61 | }; | |
62 | }; | |
63 | ||
64 | environment.systemPackages = [ | |
65 | pkgs.telnet | |
66 | pkgs.htop | |
67 | pkgs.vim | |
68 | ]; | |
69 | ||
70 | services.openssh.extraConfig = '' | |
71 | AuthorizedKeysCommand /etc/ssh/ldap_authorized_keys | |
72 | AuthorizedKeysCommandUser nobody | |
73 | ''; | |
74 | ||
75 | environment.etc."ssh/ldap_authorized_keys" = let | |
76 | ldap_authorized_keys = | |
77 | wrap { | |
78 | name = "ldap_authorized_keys"; | |
79 | file = ./ldap_authorized_keys.sh; | |
80 | vars = { | |
81 | LDAP_PASS = myconfig.env.sshd.ldap.password; | |
82 | GITOLITE_SHELL = "${pkgs.gitolite}/bin/gitolite-shell"; | |
83 | ECHO = "${pkgs.coreutils}/bin/echo"; | |
84 | }; | |
85 | paths = [ pkgs.openldap pkgs.stdenv.shellPackage pkgs.gnugrep pkgs.gnused pkgs.coreutils ]; | |
86 | }; | |
87 | in { | |
88 | enable = true; | |
89 | mode = "0755"; | |
90 | user = "root"; | |
91 | source = ldap_authorized_keys; | |
92 | }; | |
93 | ||
94 | services.cron = { | |
95 | enable = true; | |
96 | systemCronJobs = [ | |
97 | '' | |
98 | # The star after /var/lib/* avoids deleting all folders in case of problem | |
99 | 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: | |
100 | '' | |
101 | ]; | |
102 | }; | |
103 | }; | |
104 | } |