]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - pkgs/webapps/mastodon/default.nix
Upgrade mastodon
[perso/Immae/Config/Nix.git] / pkgs / webapps / mastodon / default.nix
index 0f936b5cb05f3e812e1387987625e20dd72c3a22..3769b67fd899891110910acfa87190413b659dd0 100644 (file)
@@ -3,11 +3,20 @@
   ruby_2_6, bundlerEnv, defaultGemConfig,
   jq, protobuf, protobufc, pkgconfig, libidn, pam, nodejs, yarn }:
 let
+  info = mylibs.fetchedGithub ./mastodon.json // {
+    src= runCommand "mastodon-patched" {
+      source = (mylibs.fetchedGithub ./mastodon.json).src;
+    } ''
+    cp -a $source $out
+    chmod -R u+w $out
+    sed -i -e "/fuubar/s/2.4.0/2.4.1/" $out/Gemfile.lock
+    '';
+  };
   gems = bundlerEnv {
     name = "mastodon-env";
     ruby = ruby_2_6;
     gemset = ./gemset.nix;
-    gemdir = (mylibs.fetchedGithub ./mastodon.json).src;
+    gemdir = info.src;
     groups = [ "default" "production" "test" "development" ];
     gemConfig = defaultGemConfig // {
       redis-rack = attrs: {
@@ -32,7 +41,6 @@ let
     };
   };
   yarnModules = let
-    info = mylibs.fetchedGithub ./mastodon.json;
     packagejson = runCommand "package.json" { buildInputs = [ jq ]; } ''
       cat ${info.src}/package.json | jq -r '.version = "${info.version}"' > $out
       '';
@@ -55,13 +63,13 @@ let
         };
       };
     };
-    mastodon_with_yarn = stdenv.mkDerivation (mylibs.fetchedGithub ./mastodon.json // rec {
-      installPhase = ''
-        cp -a . $out
-        cp -a ${yarnModules}/node_modules $out
-      '';
-      buildInputs = [ yarnModules ];
-    });
+  mastodon_with_yarn = stdenv.mkDerivation (info // rec {
+    installPhase = ''
+      cp -a . $out
+      cp -a ${yarnModules}/node_modules $out
+    '';
+    buildInputs = [ yarnModules ];
+  });
 in
 stdenv.mkDerivation {
   name = "mastodon";
@@ -75,7 +83,7 @@ stdenv.mkDerivation {
       cp -a $mastodon_with_yarn $out
       cd $out
       chmod u+rwX . public
-      chmod -R u+rwX config/
+      chmod -R u+rwX config/ node_modules/
       sed -i -e 's@^end$@  config.action_mailer.sendmail_settings = { location: ENV.fetch("SENDMAIL_LOCATION", "/usr/sbin/sendmail") }\nend@' config/environments/production.rb
       RAILS_ENV=production ${gems}/bin/rails assets:precompile
       rm -rf tmp/cache