3
0
Fork 0
forked from mirrors/nixpkgs

mastodon, nixos/mastodon: use the same nodejs package in package and module

This commit is contained in:
Izorkin 2021-02-16 10:09:14 +03:00 committed by erictapen
parent ee688534bd
commit 96f0c2c191
3 changed files with 16 additions and 4 deletions

View file

@ -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";

View file

@ -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; {

View file

@ -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 { };