aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-12-30 00:40:08 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-12-30 00:40:08 +0100
commit6cd8d6ce21e3efeda631037851653c04ad64e41c (patch)
tree43fb8054ed293ce5d643d71f11def5e9c8e9a5d9
parent02bf0d911c2f7b100e22f9d9fd0b1b6b39274293 (diff)
downloadNix-6cd8d6ce21e3efeda631037851653c04ad64e41c.tar.gz
Nix-6cd8d6ce21e3efeda631037851653c04ad64e41c.tar.zst
Nix-6cd8d6ce21e3efeda631037851653c04ad64e41c.zip
Check environment variables at build time
-rw-r--r--libs.nix2
-rw-r--r--virtual/eldiron.nix6
2 files changed, 6 insertions, 2 deletions
diff --git a/libs.nix b/libs.nix
index da13a03..cef8586 100644
--- a/libs.nix
+++ b/libs.nix
@@ -26,4 +26,6 @@ in
26 name = "${json.meta.name}-${version}"; 26 name = "${json.meta.name}-${version}";
27 src = fetchgit json.git; 27 src = fetchgit json.git;
28 }; 28 };
29
30 checkEnv = var: builtins.stringLength (builtins.getEnv var) > 0;
29} 31}
diff --git a/virtual/eldiron.nix b/virtual/eldiron.nix
index ed41429..fb366b7 100644
--- a/virtual/eldiron.nix
+++ b/virtual/eldiron.nix
@@ -6,6 +6,7 @@
6 6
7 eldiron = { config, pkgs, ... }: 7 eldiron = { config, pkgs, ... }:
8 let mypkgs = import ./packages.nix; 8 let mypkgs = import ./packages.nix;
9 mylibs = import ../libs.nix;
9 in 10 in
10 { 11 {
11 networking = { 12 networking = {
@@ -96,7 +97,7 @@
96 "ldap" 97 "ldap"
97 "authnz_ldap" 98 "authnz_ldap"
98 ]); 99 ]);
99 extraConfig = '' 100 extraConfig = assert mylibs.checkEnv "NIXOPS_HTTP_LDAP_PASSWORD"; ''
100 <IfModule ldap_module> 101 <IfModule ldap_module>
101 LDAPSharedCacheSize 500000 102 LDAPSharedCacheSize 500000
102 LDAPCacheEntries 1024 103 LDAPCacheEntries 1024
@@ -162,7 +163,8 @@
162 # FIXME: environment variables ? 163 # FIXME: environment variables ?
163 security.pam.services = let 164 security.pam.services = let
164 pam_ldap = pkgs.pam_ldap; 165 pam_ldap = pkgs.pam_ldap;
165 pam_ldap_mysql = pkgs.writeText "mysql.conf" '' 166 pam_ldap_mysql = assert mylibs.checkEnv "NIXOPS_MYSQL_PAM_PASSWORD";
167 pkgs.writeText "mysql.conf" ''
166 host ldap.immae.eu 168 host ldap.immae.eu
167 base dc=immae,dc=eu 169 base dc=immae,dc=eu
168 binddn cn=mysql,cn=pam,ou=services,dc=immae,dc=eu 170 binddn cn=mysql,cn=pam,ou=services,dc=immae,dc=eu