]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - virtual/modules/websites/tools/diaspora/diaspora.nix
Remove use of environment variables
[perso/Immae/Config/Nix.git] / virtual / modules / websites / tools / diaspora / diaspora.nix
index 7880ac536f4c408dc45707f634b362ac81670f53..39de20248d749849a0260d19c1e9e27fd1ec1f2e 100644 (file)
@@ -1,13 +1,9 @@
-{ checkEnv, fetchedGithub, stdenv, defaultGemConfig, writeText, bundlerEnv, ruby_2_4, pkgs, cacert }:
+{ env, fetchedGithub, stdenv, defaultGemConfig, writeText, bundlerEnv, ruby_2_4, pkgs, cacert }:
 let
   gems = bundlerEnv {
     name = "diaspora-env";
     ruby = ruby_2_4;
     gemdir = ./.;
-    # FIXME: it fails if I don’t include all groups
-    #groups = [ "default" "postgresql" "production" "development" "test" ];
-    # Had to remove them from gemset.nix, and remove mysql2
-    # Also had to "ungroup" pg in Gemfile
     gemConfig = defaultGemConfig // {
       kostya-sigar = attrs: {
         buildInputs = with pkgs; [ pkgs.perl ];
@@ -34,13 +30,10 @@ let
     '';
     propagatedBuildInputs = buildInputs;
   });
-  secret_token = assert checkEnv "NIXOPS_DIASPORA_SECRET_TOKEN";
-    writeText "secret_token.rb" ''
-    Diaspora::Application.config.secret_key_base = '${builtins.getEnv "NIXOPS_DIASPORA_SECRET_TOKEN"}'
+  secret_token = writeText "secret_token.rb" ''
+    Diaspora::Application.config.secret_key_base = '${env.secret_token}'
     '';
-  config =
-    assert checkEnv "NIXOPS_DIASPORA_LDAP_PASSWORD";
-    writeText "diaspora.yml" ''
+  config = writeText "diaspora.yml" ''
       configuration:
         environment:
           url: "https://diaspora.immae.eu/"
@@ -105,7 +98,7 @@ let
             skip_email_confirmation: true
             use_bind_dn: true
             bind_dn: "cn=diaspora,ou=services,dc=immae,dc=eu"
-            bind_pw: "${builtins.getEnv "NIXOPS_DIASPORA_LDAP_PASSWORD"}"
+            bind_pw: "${env.ldap.password}"
             search_base: "dc=immae,dc=eu"
             search_filter: "(&(memberOf=cn=users,cn=diaspora,ou=services,dc=immae,dc=eu)(uid=%{username}))"
       production:
@@ -113,15 +106,13 @@ let
       development:
         environment:
     '';
-  database_config =
-    assert checkEnv "NIXOPS_DIASPORA_SQL_PASSWORD";
-    writeText "database.yml" ''
+  database_config = writeText "database.yml" ''
       postgresql: &postgresql
         adapter: postgresql
         host: db-1.immae.eu
         port: 5432
         username: "diaspora"
-        password: "${builtins.getEnv "NIXOPS_DIASPORA_SQL_PASSWORD"}"
+        password: "${env.postgresql.password}"
         encoding: unicode
       common: &common
         <<: *postgresql