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