]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - virtual/eldiron.nix
Add eldiron machine handled by nixops
[perso/Immae/Config/Nix.git] / virtual / eldiron.nix
CommitLineData
a1bb33c4
IB
1{
2 network = {
3 description = "Immae's network";
4 enableRollback = true;
5 };
6
7 eldiron = { config, pkgs, ... }: {
8 networking = {
9 firewall = {
10 enable = true;
11 allowedTCPPorts = [ 22 80 443 5432 ];
12 };
13 };
14
15 deployment = {
16 targetEnv = "hetzner";
17 hetzner = {
18 #robotUser = "defined in HETZNER_ROBOT_USER";
19 #robotPass = "defined in HETZNER_ROBOT_PASS";
20 mainIPv4 = "176.9.151.89";
21 partitions = ''
22 clearpart --all --initlabel --drives=sda,sdb
23
24 part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda
25 part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb
26
27 part raid.1 --grow --ondisk=sda
28 part raid.2 --grow --ondisk=sdb
29
30 raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2
31 '';
32 };
33 };
34
35 # FIXME: how to run it? currently set as timer
36 security.acme.certs = {
37 "eldiron" = {
38 webroot = "/var/lib/acme/acme-challenge";
39 email = "ismael@bouya.org";
40 domain = "eldiron.immae.eu";
41 extraDomains = {
42 "db-1.immae.eu" = null;
43 };
44 };
45 };
46
47 services.nginx = rec {
48 enable = true;
49 virtualHosts = {
50 "_" = {
51 serverName = "_";
52 useACMEHost = "eldiron";
53 };
54 "eldiron.immae.eu" = {
55 forceSSL = true;
56 useACMEHost = "eldiron";
57 locations."/" = {
58 # FIXME: directory needs to exist
59 root = "/var/www";
60 };
61 };
62 };
63 };
64
65 # FIXME: initial sync
66 services.postgresql = rec {
67 enable = true;
68 package = pkgs.postgresql100.overrideAttrs(old: rec {
69 passthru = old.passthru // { psqlSchema = "11.0"; };
70 name = "postgresql-11.1";
71 src = pkgs.fetchurl {
72 url = "mirror://postgresql/source/v11.1/${name}.tar.bz2";
73 sha256 = "026v0sicsh7avzi45waf8shcbhivyxmi7qgn9fd1x0vl520mx0ch";
74 };
75 });
76 enableTCPIP = true;
77 extraConfig = ''
78 max_connections = 100
79 wal_level = logical
80 shared_buffers = 128MB
81 max_wal_size = 1GB
82 min_wal_size = 80MB
83 log_timezone = 'Europe/Paris'
84 datestyle = 'iso, mdy'
85 timezone = 'Europe/Paris'
86 lc_messages = 'en_US.UTF-8'
87 lc_monetary = 'en_US.UTF-8'
88 lc_numeric = 'en_US.UTF-8'
89 lc_time = 'en_US.UTF-8'
90 default_text_search_config = 'pg_catalog.english'
91 # ssl = on
92 # ssl_cert_file = '/var/lib/acme/eldiron/fullchain.pem'
93 # ssl_key_file = '/var/lib/acme/eldiron/key.pem'
94 '';
95 authentication = ''
96 local all postgres ident
97 local all all md5
98 host all all 178.33.252.96/32 md5
99 host all all 188.165.209.148/32 md5
100 #host all all all pam
101 '';
102 };
103 };
104}