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