diff options
author | Izorkin <izorkin@elven.pw> | 2021-02-16 10:09:14 +0300 |
---|---|---|
committer | erictapen <justin.humm@posteo.de> | 2021-02-16 17:57:31 +0100 |
commit | 96f0c2c191c50aae55715c0e7cbc93510354fcf4 (patch) | |
tree | d2b67b182906f31859b77513661fe1b950c23690 | |
parent | ee688534bda0652522f36dedd071886bb87ddf06 (diff) |
mastodon, nixos/mastodon: use the same nodejs package in package and module
-rw-r--r-- | nixos/modules/services/web-apps/mastodon.nix | 2 | ||||
-rw-r--r-- | pkgs/servers/mastodon/default.nix | 12 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 6 |
3 files changed, 16 insertions, 4 deletions
diff --git a/nixos/modules/services/web-apps/mastodon.nix b/nixos/modules/services/web-apps/mastodon.nix index 37e5f7719b7b5..24aea356de4e8 100644 --- a/nixos/modules/services/web-apps/mastodon.nix +++ b/nixos/modules/services/web-apps/mastodon.nix @@ -450,7 +450,7 @@ in { else { PORT = toString(cfg.streamingPort); } ); serviceConfig = { - ExecStart = "${pkgs.nodejs-slim}/bin/node streaming"; + ExecStart = "${cfg.package}/run-streaming.sh"; Restart = "always"; RestartSec = 20; EnvironmentFile = "/var/lib/mastodon/.secrets_env"; diff --git a/pkgs/servers/mastodon/default.nix b/pkgs/servers/mastodon/default.nix index 8508fbe8f78be..b8582f68ebc57 100644 --- a/pkgs/servers/mastodon/default.nix +++ b/pkgs/servers/mastodon/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, nodejs-slim, mkYarnPackage, fetchFromGitHub, bundlerEnv -, yarn, callPackage, imagemagick, ffmpeg, file, ruby_2_7 +, yarn, callPackage, imagemagick, ffmpeg, file, ruby_2_7, writeShellScript # Allow building a fork or custom version of Mastodon: , pname ? "mastodon" @@ -96,10 +96,18 @@ stdenv.mkDerivation rec { ln -s /var/log/mastodon log ln -s /tmp tmp ''; + propagatedBuildInputs = [ imagemagick ffmpeg file mastodon-gems.wrappedRuby ]; - installPhase = '' + + installPhase = let + run-streaming = writeShellScript "run-streaming.sh" '' + # NixOS helper script to consistently use the same NodeJS version the package was built with. + ${nodejs-slim}/bin/node ./streaming + ''; + in '' mkdir -p $out cp -r * $out/ + ln -s ${run-streaming} $out/run-streaming.sh ''; meta = with lib; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d70c6f9bda073..85d4ff856394d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17921,7 +17921,11 @@ in mailman-web = with python3.pkgs; toPythonApplication mailman-web; - mastodon = callPackage ../servers/mastodon { }; + mastodon = callPackage ../servers/mastodon { + # With nodejs v14 the streaming endpoint breaks. Need migrate to uWebSockets.js or similar. + # https://github.com/tootsuite/mastodon/issues/15184 + nodejs-slim = nodejs-slim-12_x; + }; mattermost = callPackage ../servers/mattermost { }; matterircd = callPackage ../servers/mattermost/matterircd.nix { }; |