diff options
Diffstat (limited to 'virtual/modules/websites/tools/mastodon')
-rw-r--r-- | virtual/modules/websites/tools/mastodon/default.nix | 5 | ||||
-rw-r--r-- | virtual/modules/websites/tools/mastodon/mastodon.nix | 27 |
2 files changed, 12 insertions, 20 deletions
diff --git a/virtual/modules/websites/tools/mastodon/default.nix b/virtual/modules/websites/tools/mastodon/default.nix index 25a389b..98ab9be 100644 --- a/virtual/modules/websites/tools/mastodon/default.nix +++ b/virtual/modules/websites/tools/mastodon/default.nix | |||
@@ -1,7 +1,8 @@ | |||
1 | { lib, pkgs, config, mylibs, ... }: | 1 | { lib, pkgs, config, myconfig, mylibs, ... }: |
2 | let | 2 | let |
3 | mastodon = pkgs.callPackage ./mastodon.nix { | 3 | mastodon = pkgs.callPackage ./mastodon.nix { |
4 | inherit (mylibs) fetchedGithub checkEnv; | 4 | inherit (mylibs) fetchedGithub; |
5 | env = myconfig.env.tools.mastodon; | ||
5 | }; | 6 | }; |
6 | 7 | ||
7 | cfg = config.services.myWebsites.tools.mastodon; | 8 | cfg = config.services.myWebsites.tools.mastodon; |
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 }: |
2 | let | 2 | let |
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 | ''; |