]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/eldiron.nix
Move ssh to its own module
[perso/Immae/Config/Nix.git] / nixops / eldiron.nix
1 { privateFiles ? ./. }:
2 {
3 network = {
4 description = "Immae's network";
5 enableRollback = true;
6 };
7
8 eldiron = { config, pkgs, mylibs, myconfig, ... }:
9 {
10 _module.args = {
11 pkgsNext = import <nixpkgsNext> {};
12 pkgsPrevious = import <nixpkgsPrevious> {};
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/ssh
28 ./modules/certificates.nix
29 ./modules/gitolite
30 ./modules/databases
31 ./modules/mpd
32 ./modules/websites
33 ./modules/mail
34 ./modules/ftp
35 ./modules/pub
36 ./modules/task
37 ./modules/irc
38 ./modules/buildbot
39 ];
40 services.myGitolite.enable = true;
41 services.myDatabases.enable = true;
42 services.myWebsites.production.enable = true;
43 services.myWebsites.integration.enable = true;
44 services.myWebsites.tools.enable = true;
45 services.pure-ftpd.enable = true;
46 services.irc.enable = true;
47 services.pub.enable = true;
48 services.myTasks.enable = true;
49 services.buildbot.enable = true;
50
51 services.journald.extraConfig = ''
52 MaxLevelStore="warning"
53 MaxRetentionSec="1year"
54 '';
55 networking.firewall.enable = true;
56
57 deployment = {
58 targetEnv = "hetzner";
59 hetzner = {
60 robotUser = myconfig.env.hetzner.user;
61 robotPass = myconfig.env.hetzner.pass;
62 mainIPv4 = myconfig.ips.main;
63 partitions = ''
64 clearpart --all --initlabel --drives=sda,sdb
65
66 part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda
67 part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb
68
69 part raid.1 --grow --ondisk=sda
70 part raid.2 --grow --ondisk=sdb
71
72 raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2
73 '';
74 };
75 };
76
77 environment.systemPackages = [
78 pkgs.telnet
79 pkgs.htop
80 pkgs.vim
81 ];
82
83 services.cron = {
84 enable = true;
85 systemCronJobs = [
86 ''
87 # The star after /var/lib/* avoids deleting all folders in case of problem
88 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
89 ''
90 ];
91 };
92
93 # This value determines the NixOS release with which your system is
94 # to be compatible, in order to avoid breaking some software such as
95 # database servers. You should change this only after NixOS release
96 # notes say you should.
97 system.stateVersion = "18.09"; # Did you read the comment?
98 };
99 }