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