aboutsummaryrefslogtreecommitdiff
path: root/virtual/modules/websites/tools/mastodon/mastodon.nix
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-22 12:49:20 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-01-22 12:49:20 +0100
commit9d90e7e281e8f4cf9371c17c812a1ac9c08aa66d (patch)
tree0b011ca0aeeef02dce03a3c825d9a037c5cfc01a /virtual/modules/websites/tools/mastodon/mastodon.nix
parent0f3047a77ee1e0b3d943e39d50301ba85821c572 (diff)
downloadNix-9d90e7e281e8f4cf9371c17c812a1ac9c08aa66d.tar.gz
Nix-9d90e7e281e8f4cf9371c17c812a1ac9c08aa66d.tar.zst
Nix-9d90e7e281e8f4cf9371c17c812a1ac9c08aa66d.zip
Remove use of environment variables
Fixes https://git.immae.eu/mantisbt/view.php?id=113
Diffstat (limited to 'virtual/modules/websites/tools/mastodon/mastodon.nix')
-rw-r--r--virtual/modules/websites/tools/mastodon/mastodon.nix27
1 files changed, 9 insertions, 18 deletions
diff --git a/virtual/modules/websites/tools/mastodon/mastodon.nix b/virtual/modules/websites/tools/mastodon/mastodon.nix
index e948852..463de1c 100644
--- a/virtual/modules/websites/tools/mastodon/mastodon.nix
+++ b/virtual/modules/websites/tools/mastodon/mastodon.nix
@@ -1,4 +1,4 @@
1{ checkEnv, fetchedGithub, stdenv, writeText, pkgs, cacert }: 1{ env, fetchedGithub, stdenv, writeText, pkgs, cacert }:
2let 2let
3 varDir = "/var/lib/mastodon_immae"; 3 varDir = "/var/lib/mastodon_immae";
4 socketsDir = "/run/mastodon"; 4 socketsDir = "/run/mastodon";
@@ -21,35 +21,26 @@ let
21 jemalloc which postgresql python3 cacert 21 jemalloc which postgresql python3 cacert
22 ]; 22 ];
23 }); 23 });
24 config = 24 config = writeText "mastodon_environment" ''
25 assert checkEnv "NIXOPS_MASTODON_DB_PASS";
26 assert checkEnv "NIXOPS_MASTODON_PAPERCLIP_SECRET";
27 assert checkEnv "NIXOPS_MASTODON_SECRET_KEY_BASE";
28 assert checkEnv "NIXOPS_MASTODON_OTP_SECRET";
29 assert checkEnv "NIXOPS_MASTODON_VAPID_PRIVATE_KEY";
30 assert checkEnv "NIXOPS_MASTODON_VAPID_PUBLIC_KEY";
31 assert checkEnv "NIXOPS_MASTODON_OTP_SECRET";
32 assert checkEnv "NIXOPS_MASTODON_LDAP_PASSWORD";
33 writeText "mastodon_environment" ''
34 REDIS_HOST=localhost 25 REDIS_HOST=localhost
35 REDIS_PORT=6379 26 REDIS_PORT=6379
36 REDIS_DB=13 27 REDIS_DB=13
37 DB_HOST=/run/postgresql 28 DB_HOST=/run/postgresql
38 DB_USER=mastodon 29 DB_USER=mastodon
39 DB_NAME=mastodon 30 DB_NAME=mastodon
40 DB_PASS=${builtins.getEnv "NIXOPS_MASTODON_DB_PASS"} 31 DB_PASS=${env.postgresql.password}
41 DB_PORT=5432 32 DB_PORT=5432
42 33
43 LOCAL_DOMAIN=mastodon.immae.eu 34 LOCAL_DOMAIN=mastodon.immae.eu
44 LOCAL_HTTPS=true 35 LOCAL_HTTPS=true
45 ALTERNATE_DOMAINS=immae.eu 36 ALTERNATE_DOMAINS=immae.eu
46 37
47 PAPERCLIP_SECRET=${builtins.getEnv "NIXOPS_MASTODON_PAPERCLIP_SECRET"} 38 PAPERCLIP_SECRET=${env.paperclip_secret}
48 SECRET_KEY_BASE=${builtins.getEnv "NIXOPS_MASTODON_SECRET_KEY_BASE"} 39 SECRET_KEY_BASE=${env.secret_key_base}
49 OTP_SECRET=${builtins.getEnv "NIXOPS_MASTODON_OTP_SECRET"} 40 OTP_SECRET=${env.otp_secret}
50 41
51 VAPID_PRIVATE_KEY=${builtins.getEnv "NIXOPS_MASTODON_VAPID_PRIVATE_KEY"} 42 VAPID_PRIVATE_KEY=${env.vapid.private}
52 VAPID_PUBLIC_KEY=${builtins.getEnv "NIXOPS_MASTODON_VAPID_PUBLIC_KEY"} 43 VAPID_PUBLIC_KEY=${env.vapid.public}
53 44
54 SMTP_SERVER=mail.immae.eu 45 SMTP_SERVER=mail.immae.eu
55 SMTP_PORT=587 46 SMTP_PORT=587
@@ -66,7 +57,7 @@ let
66 LDAP_METHOD=simple_tls 57 LDAP_METHOD=simple_tls
67 LDAP_BASE="dc=immae,dc=eu" 58 LDAP_BASE="dc=immae,dc=eu"
68 LDAP_BIND_DN="cn=mastodon,ou=services,dc=immae,dc=eu" 59 LDAP_BIND_DN="cn=mastodon,ou=services,dc=immae,dc=eu"
69 LDAP_PASSWORD="${builtins.getEnv "NIXOPS_MASTODON_LDAP_PASSWORD"}" 60 LDAP_PASSWORD="${env.ldap.password}"
70 LDAP_UID="uid" 61 LDAP_UID="uid"
71 LDAP_SEARCH_FILTER="(&(%{uid}=%{email})(memberOf=cn=users,cn=mastodon,ou=services,dc=immae,dc=eu))" 62 LDAP_SEARCH_FILTER="(&(%{uid}=%{email})(memberOf=cn=users,cn=mastodon,ou=services,dc=immae,dc=eu))"
72 ''; 63 '';