]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/eldiron.nix
Add DNS resolver
[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 ./modules/dns
40 ];
41 services.myGitolite.enable = true;
42 services.myDatabases.enable = true;
43 services.myWebsites.production.enable = true;
44 services.myWebsites.integration.enable = true;
45 services.myWebsites.tools.enable = true;
46 services.pure-ftpd.enable = true;
47 services.irc.enable = true;
48 services.pub.enable = true;
49 services.myTasks.enable = true;
50 services.buildbot.enable = true;
51
52 services.journald.extraConfig = ''
53 MaxLevelStore="warning"
54 MaxRetentionSec="1year"
55 '';
56 networking.firewall.enable = true;
57
58 deployment = {
59 targetEnv = "hetzner";
60 hetzner = {
61 robotUser = myconfig.env.hetzner.user;
62 robotPass = myconfig.env.hetzner.pass;
63 mainIPv4 = myconfig.ips.main;
64 partitions = ''
65 clearpart --all --initlabel --drives=sda,sdb
66
67 part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda
68 part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb
69
70 part raid.1 --grow --ondisk=sda
71 part raid.2 --grow --ondisk=sdb
72
73 raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2
74 '';
75 };
76 };
77
78 environment.systemPackages = [
79 pkgs.telnet
80 pkgs.htop
81 pkgs.vim
82 ];
83
84 services.cron = {
85 enable = true;
86 systemCronJobs = [
87 ''
88 # The star after /var/lib/* avoids deleting all folders in case of problem
89 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
90 ''
91 ];
92 };
93
94 # This value determines the NixOS release with which your system is
95 # to be compatible, in order to avoid breaking some software such as
96 # database servers. You should change this only after NixOS release
97 # notes say you should.
98 system.stateVersion = "18.09"; # Did you read the comment?
99 };
100 }