]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/eldiron.nix
Move rest of the modules outside of nixops
[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
a1a8649a 8 eldiron = { config, pkgs, myconfig, ... }:
ab5d04b8 9 {
50100321 10 boot.kernelPackages = pkgs.linuxPackages_latest;
8d213e2b 11 _module.args.privateFiles = privateFiles;
50100321 12
d68bb46b
IB
13 networking = {
14 firewall.enable = true;
15 # 176.9.151.89 declared in nixops -> infra / tools
16 interfaces."eth0".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList
17 (n: ips: { address = ips.ip4; prefixLength = 32; })
18 (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") myconfig.env.servers.eldiron.ips);
19 interfaces."eth0".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList
20 (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or []))
21 myconfig.env.servers.eldiron.ips);
22 };
23
8d213e2b
IB
24 imports = builtins.attrValues (import ../modules);
25
26 myServices.buildbot.enable = true;
182ae57f 27 myServices.databases.enable = true;
8d213e2b 28 myServices.gitolite.enable = true;
ffb14c1c 29 myServices.irc.enable = true;
8d213e2b
IB
30 myServices.pub.enable = true;
31 myServices.tasks.enable = true;
439049e5 32 services.pure-ftpd.enable = true;
a1bb33c4
IB
33
34 deployment = {
35 targetEnv = "hetzner";
36 hetzner = {
9d90e7e2
IB
37 robotUser = myconfig.env.hetzner.user;
38 robotPass = myconfig.env.hetzner.pass;
d68bb46b 39 mainIPv4 = myconfig.env.servers.eldiron.ips.main.ip4;
a1bb33c4
IB
40 partitions = ''
41 clearpart --all --initlabel --drives=sda,sdb
42
43 part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda
44 part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb
45
46 part raid.1 --grow --ondisk=sda
47 part raid.2 --grow --ondisk=sdb
48
49 raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2
50 '';
51 };
52 };
53
6533428a
IB
54 services.cron = {
55 enable = true;
56 systemCronJobs = [
57 ''
58 # The star after /var/lib/* avoids deleting all folders in case of problem
9d8d1425 59 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
60 ''
61 ];
62 };
3de01f9b
IB
63
64 # This value determines the NixOS release with which your system is
65 # to be compatible, in order to avoid breaking some software such as
66 # database servers. You should change this only after NixOS release
67 # notes say you should.
68 system.stateVersion = "18.09"; # Did you read the comment?
a1bb33c4
IB
69 };
70}