3 description = "Immae's network";
7 eldiron = { config, pkgs, ... }: {
11 allowedTCPPorts = [ 22 80 443 3306 5432 ];
16 targetEnv = "hetzner";
18 #robotUser = "defined in HETZNER_ROBOT_USER";
19 #robotPass = "defined in HETZNER_ROBOT_PASS";
20 mainIPv4 = "176.9.151.89";
22 clearpart --all --initlabel --drives=sda,sdb
24 part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda
25 part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb
27 part raid.1 --grow --ondisk=sda
28 part raid.2 --grow --ondisk=sdb
30 raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2
35 # FIXME: how to run it? currently set as timer
36 security.acme.certs = {
38 webroot = "/var/lib/acme/acme-challenge";
39 email = "ismael@bouya.org";
40 domain = "eldiron.immae.eu";
42 "db-1.immae.eu" = null;
47 services.nginx = rec {
52 useACMEHost = "eldiron";
54 "eldiron.immae.eu" = {
56 useACMEHost = "eldiron";
58 # FIXME: directory needs to exist
65 # FIXME: environment variables ?
66 security.pam.services = let
67 pam_ldap = pkgs.pam_ldap;
68 pam_ldap_mysql = pkgs.writeText "mysql.conf" ''
71 binddn cn=mysql,cn=pam,ou=services,dc=immae,dc=eu
72 bindpw ${builtins.getEnv "NIXOPS_MYSQL_PAM_PASSWORD"}
73 pam_filter memberOf=cn=users,cn=mysql,cn=pam,ou=services,dc=immae,dc=eu
79 # https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/
80 auth required ${pam_ldap}/lib/security/pam_ldap.so config=${pam_ldap_mysql}
81 account required ${pam_ldap}/lib/security/pam_ldap.so config=${pam_ldap_mysql}
88 # FIXME: restart after pam
89 # FIXME: pam access doesn’t work (because of php module)
90 services.mysql = rec {
92 package = pkgs.mariadb.overrideAttrs(old: rec {
93 cmakeFlags = old.cmakeFlags ++ [ "-DWITH_AUTHENTICATION_PAM=ON" ];
94 buildInputs = old.buildInputs ++ [ pkgs.pam ];
100 services.postgresql = rec {
102 package = pkgs.postgresql100.overrideAttrs(old: rec {
103 passthru = old.passthru // { psqlSchema = "11.0"; };
104 name = "postgresql-11.1";
105 src = pkgs.fetchurl {
106 url = "mirror://postgresql/source/v11.1/${name}.tar.bz2";
107 sha256 = "026v0sicsh7avzi45waf8shcbhivyxmi7qgn9fd1x0vl520mx0ch";
112 max_connections = 100
114 shared_buffers = 128MB
117 log_timezone = 'Europe/Paris'
118 datestyle = 'iso, mdy'
119 timezone = 'Europe/Paris'
120 lc_messages = 'en_US.UTF-8'
121 lc_monetary = 'en_US.UTF-8'
122 lc_numeric = 'en_US.UTF-8'
123 lc_time = 'en_US.UTF-8'
124 default_text_search_config = 'pg_catalog.english'
126 # ssl_cert_file = '/var/lib/acme/eldiron/fullchain.pem'
127 # ssl_key_file = '/var/lib/acme/eldiron/key.pem'
130 local all postgres ident
132 host all all 178.33.252.96/32 md5
133 host all all 188.165.209.148/32 md5
134 #host all all all pam