]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - virtual/modules/websites/tools/mastodon/default.nix
Start purifying mastodon: bundler
[perso/Immae/Config/Nix.git] / virtual / modules / websites / tools / mastodon / default.nix
index 98ab9be39f51d55361aeccc7dc1f4c079a3172cd..f1a207feb97554d305ca2d8e7fc2871705a3955d 100644 (file)
@@ -70,16 +70,18 @@ in {
       after = [ "network.target" ];
 
       environment.RAILS_ENV = "production";
+      environment.BUNDLE_PATH = "${mastodon.gems}/lib/ruby/gems/2.5.0";
+      environment.BUNDLE_GEMFILE = "${mastodon.gems.confFiles}/Gemfile";
       environment.SOCKET = mastodon.railsSocket;
 
-      path = [ pkgs.bundler pkgs.file ];
+      path = [ mastodon.gems mastodon.gems.ruby pkgs.file ];
 
       preStart = ''
-        bundle exec rails db:migrate
+        ./bin/bundle exec rails db:migrate
       '';
 
       script = ''
-        exec bundle exec puma -C config/puma.rb
+        exec ./bin/bundle exec puma -C config/puma.rb
       '';
 
       serviceConfig = {
@@ -101,12 +103,14 @@ in {
       after = [ "network.target" "mastodon-web.service" ];
 
       environment.RAILS_ENV="production";
+      environment.BUNDLE_PATH = "${mastodon.gems}/${mastodon.gems.ruby.gemPath}";
+      environment.BUNDLE_GEMFILE = "${mastodon.gems.confFiles}/Gemfile";
       environment.DB_POOL="5";
 
-      path = [ pkgs.imagemagick pkgs.ffmpeg pkgs.bundler pkgs.file ];
+      path = [ mastodon.gems mastodon.gems.ruby pkgs.imagemagick pkgs.ffmpeg pkgs.file ];
 
       script = ''
-        exec bundle exec sidekiq -c 5 -q default -q mailers -q pull -q push
+        exec ./bin/bundle exec sidekiq -c 5 -q default -q mailers -q pull -q push
       '';
 
       serviceConfig = {
@@ -126,7 +130,7 @@ in {
       deps = [ "users" ];
       text = ''
       install -m 0755 -o mastodon -g mastodon -d ${mastodon.socketsDir}
-      install -m 0755 -o mastodon -g mastodon -d ${mastodon.varDir}
+      install -m 0755 -o mastodon -g mastodon -d ${mastodon.varDir} ${mastodon.varDir}/tmp/cache
       '';
     };