]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - nixops/modules/websites/tools/mastodon/default.nix
Move mastodon to pkgs
[perso/Immae/Config/Nix.git] / nixops / modules / websites / tools / mastodon / default.nix
index 6e34280f30f6086951347ce6d5933db4b5abdc03..919bac2a148b5f078a8838048b564de9b259bb48 100644 (file)
@@ -1,7 +1,7 @@
 { lib, pkgs, config, myconfig, mylibs, ... }:
 let
   mastodon = pkgs.callPackage ./mastodon.nix {
-    inherit (mylibs) fetchedGithub;
+    inherit (pkgs.webapps) mastodon;
     env = myconfig.env.tools.mastodon;
   };
 
@@ -13,6 +13,7 @@ in {
   };
 
   config = lib.mkIf cfg.enable {
+    mySecrets.keys = mastodon.keys;
     ids.uids.mastodon = myconfig.env.tools.mastodon.user.uid;
     ids.gids.mastodon = myconfig.env.tools.mastodon.user.gid;
 
@@ -21,7 +22,7 @@ in {
       uid = config.ids.uids.mastodon;
       group = "mastodon";
       description = "Mastodon user";
-      home = mastodon.railsRoot;
+      home = mastodon.varDir;
       useDefaultShell = true;
     };
 
@@ -54,7 +55,7 @@ in {
 
       serviceConfig = {
         User = "mastodon";
-        EnvironmentFile = mastodon.config;
+        EnvironmentFile = "/var/secrets/webapps/tools-mastodon";
         PrivateTmp = true;
         Restart = "always";
         TimeoutSec = 15;
@@ -71,7 +72,7 @@ in {
       after = [ "network.target" ];
 
       environment.RAILS_ENV = "production";
-      environment.BUNDLE_PATH = "${mastodon.gems}/lib/ruby/gems/2.5.0";
+      environment.BUNDLE_PATH = "${mastodon.gems}/${mastodon.gems.ruby.gemPath}";
       environment.BUNDLE_GEMFILE = "${mastodon.gems.confFiles}/Gemfile";
       environment.SOCKET = mastodon.railsSocket;
 
@@ -87,7 +88,7 @@ in {
 
       serviceConfig = {
         User = "mastodon";
-        EnvironmentFile = mastodon.config;
+        EnvironmentFile = "/var/secrets/webapps/tools-mastodon";
         PrivateTmp = true;
         Restart = "always";
         TimeoutSec = 60;
@@ -116,7 +117,7 @@ in {
 
       serviceConfig = {
         User = "mastodon";
-        EnvironmentFile = mastodon.config;
+        EnvironmentFile = "/var/secrets/webapps/tools-mastodon";
         PrivateTmp = true;
         Restart = "always";
         TimeoutSec = 15;