3 description = "Immae's network";
7 eldiron = { config, pkgs, ... }:
8 let mypkgs = import ./packages.nix;
14 allowedTCPPorts = [ 22 80 443 3306 5432 ];
19 targetEnv = "hetzner";
21 #robotUser = "defined in HETZNER_ROBOT_USER";
22 #robotPass = "defined in HETZNER_ROBOT_PASS";
23 mainIPv4 = "176.9.151.89";
25 clearpart --all --initlabel --drives=sda,sdb
27 part swap1 --recommended --label=swap1 --fstype=swap --ondisk=sda
28 part swap2 --recommended --label=swap2 --fstype=swap --ondisk=sdb
30 part raid.1 --grow --ondisk=sda
31 part raid.2 --grow --ondisk=sdb
33 raid / --level=1 --device=md0 --fstype=ext4 --label=root raid.1 raid.2
38 # FIXME: how to run it? currently set as timer
39 security.acme.certs = {
41 webroot = "/var/lib/acme/acme-challenge";
42 email = "ismael@bouya.org";
43 domain = "eldiron.immae.eu";
45 "db-1.immae.eu" = null;
50 services.nginx = rec {
55 useACMEHost = "eldiron";
57 "eldiron.immae.eu" = {
59 useACMEHost = "eldiron";
61 # FIXME: directory needs to exist
68 # FIXME: environment variables ?
69 security.pam.services = let
70 pam_ldap = pkgs.pam_ldap;
71 pam_ldap_mysql = pkgs.writeText "mysql.conf" ''
74 binddn cn=mysql,cn=pam,ou=services,dc=immae,dc=eu
75 bindpw ${builtins.getEnv "NIXOPS_MYSQL_PAM_PASSWORD"}
76 pam_filter memberOf=cn=users,cn=mysql,cn=pam,ou=services,dc=immae,dc=eu
82 # https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/
83 auth required ${pam_ldap}/lib/security/pam_ldap.so config=${pam_ldap_mysql}
84 account required ${pam_ldap}/lib/security/pam_ldap.so config=${pam_ldap_mysql}
91 # FIXME: restart after pam
92 # FIXME: pam access doesn’t work (because of php module)
93 services.mysql = rec {
95 package = pkgs.mariadb.overrideAttrs(old: rec {
96 cmakeFlags = old.cmakeFlags ++ [ "-DWITH_AUTHENTICATION_PAM=ON" ];
97 buildInputs = old.buildInputs ++ [ pkgs.pam ];
101 # FIXME: initial sync
103 services.postgresql = rec {
105 package = pkgs.postgresql100.overrideAttrs(old: rec {
106 passthru = old.passthru // { psqlSchema = "11.0"; };
107 name = "postgresql-11.1";
108 src = pkgs.fetchurl {
109 url = "mirror://postgresql/source/v11.1/${name}.tar.bz2";
110 sha256 = "026v0sicsh7avzi45waf8shcbhivyxmi7qgn9fd1x0vl520mx0ch";
115 max_connections = 100
117 shared_buffers = 128MB
120 log_timezone = 'Europe/Paris'
121 datestyle = 'iso, mdy'
122 timezone = 'Europe/Paris'
123 lc_messages = 'en_US.UTF-8'
124 lc_monetary = 'en_US.UTF-8'
125 lc_numeric = 'en_US.UTF-8'
126 lc_time = 'en_US.UTF-8'
127 default_text_search_config = 'pg_catalog.english'
129 # ssl_cert_file = '/var/lib/acme/eldiron/fullchain.pem'
130 # ssl_key_file = '/var/lib/acme/eldiron/key.pem'
133 local all postgres ident
135 host all all 178.33.252.96/32 md5
136 host all all 188.165.209.148/32 md5
137 #host all all all pam