]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/eldiron.nix
Add eldiron MX info
[perso/Immae/Config/Nix.git] / nixops / eldiron.nix
CommitLineData
30a78336 1{ privateFiles ? ./. }:
a1bb33c4
IB
2{
3 network = {
4 description = "Immae's network";
5 enableRollback = true;
6 };
7
f8bde3d6 8 eldiron = { config, pkgs, mylibs, myconfig, ... }:
ab5d04b8 9 {
4d4f13f4 10 _module.args = {
30a78336 11 pkgsNext = import <nixpkgsNext> {};
587b9e34 12 pkgsPrevious = import <nixpkgsPrevious> {};
596e62a6 13 mylibs = import ../libs.nix { nixpkgs = pkgs; };
7636abc6 14 mypkgs = import ../default.nix;
f8bde3d6 15 myconfig = {
9690acd9
IB
16 inherit privateFiles;
17 env = import "${privateFiles}/environment.nix";
f8bde3d6 18 };
4d4f13f4
IB
19 };
20
d68bb46b
IB
21 networking = {
22 firewall.enable = true;
23 # 176.9.151.89 declared in nixops -> infra / tools
24 interfaces."eth0".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList
25 (n: ips: { address = ips.ip4; prefixLength = 32; })
26 (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") myconfig.env.servers.eldiron.ips);
27 interfaces."eth0".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList
28 (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or []))
29 myconfig.env.servers.eldiron.ips);
30 };
31
4d4f13f4 32 imports = [
7e6f1fb4 33 ./modules/ssh
3013caf1 34 ./modules/certificates.nix
10889174
IB
35 ./modules/gitolite
36 ./modules/databases
e229e6f2 37 ./modules/mpd
54307da4 38 ./modules/websites
af421a8f 39 ./modules/mail
439049e5 40 ./modules/ftp
5ccc61bb 41 ./modules/pub
22149d17 42 ./modules/task
31a38b9f 43 ./modules/irc
9fb4205e 44 ./modules/buildbot
bb5e0900 45 ./modules/dns
4d4f13f4
IB
46 ];
47 services.myGitolite.enable = true;
4d4f13f4 48 services.myDatabases.enable = true;
42429ef0
IB
49 services.myWebsites.production.enable = true;
50 services.myWebsites.integration.enable = true;
10889174 51 services.myWebsites.tools.enable = true;
439049e5 52 services.pure-ftpd.enable = true;
31a38b9f 53 services.irc.enable = true;
5ccc61bb 54 services.pub.enable = true;
22149d17 55 services.myTasks.enable = true;
9fb4205e 56 services.buildbot.enable = true;
4d4f13f4 57
46228a29
IB
58 services.journald.extraConfig = ''
59 MaxLevelStore="warning"
60 MaxRetentionSec="1year"
61 '';
a1bb33c4
IB
62
63 deployment = {
64 targetEnv = "hetzner";
65 hetzner = {
9d90e7e2
IB
66 robotUser = myconfig.env.hetzner.user;
67 robotPass = myconfig.env.hetzner.pass;
d68bb46b 68 mainIPv4 = myconfig.env.servers.eldiron.ips.main.ip4;
a1bb33c4
IB
69 partitions = ''
70 clearpart --all --initlabel --drives=sda,sdb
71
72 part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda
73 part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb
74
75 part raid.1 --grow --ondisk=sda
76 part raid.2 --grow --ondisk=sdb
77
78 raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2
79 '';
80 };
81 };
82
10889174 83 environment.systemPackages = [
ce6ee3b8 84 pkgs.telnet
beeed847 85 pkgs.htop
ce6ee3b8
IB
86 pkgs.vim
87 ];
88
6533428a
IB
89 services.cron = {
90 enable = true;
91 systemCronJobs = [
92 ''
93 # The star after /var/lib/* avoids deleting all folders in case of problem
9d8d1425 94 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
95 ''
96 ];
97 };
3de01f9b
IB
98
99 # This value determines the NixOS release with which your system is
100 # to be compatible, in order to avoid breaking some software such as
101 # database servers. You should change this only after NixOS release
102 # notes say you should.
103 system.stateVersion = "18.09"; # Did you read the comment?
a1bb33c4
IB
104 };
105}