2022-01-29 22:52:29 +00:00
|
|
|
{ stdenv, fetchFromGitHub, pkgs, lib, nodejs-14_x, nodePackages, pkg-config, libjpeg
|
2021-04-15 05:04:24 +01:00
|
|
|
, pixman, cairo, pango }:
|
|
|
|
|
|
|
|
let
|
2022-01-29 22:52:29 +00:00
|
|
|
nodejs = nodejs-14_x;
|
2021-04-15 05:04:24 +01:00
|
|
|
# No official version ever released
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "matrix-discord";
|
|
|
|
repo = "mx-puppet-discord";
|
2022-01-29 22:52:29 +00:00
|
|
|
rev = "bb6438a504182a7a64048b992179427587ccfded";
|
|
|
|
sha256 = "0g2p5xwxxgvlnq0fg0x4q9x4asqyppdv6b5z6bvncm62kc70z6xk";
|
2021-04-15 05:04:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
myNodePackages = import ./node-composition.nix {
|
|
|
|
inherit pkgs nodejs;
|
|
|
|
inherit (stdenv.hostPlatform) system;
|
|
|
|
};
|
|
|
|
|
|
|
|
in myNodePackages.package.override {
|
2021-05-23 22:46:18 +01:00
|
|
|
pname = "mx-puppet-discord";
|
2022-01-29 22:52:29 +00:00
|
|
|
version = "2021-08-01";
|
2021-05-23 22:46:18 +01:00
|
|
|
|
2021-04-15 05:04:24 +01:00
|
|
|
inherit src;
|
2021-05-23 22:46:18 +01:00
|
|
|
|
2021-04-15 05:04:24 +01:00
|
|
|
nativeBuildInputs = [ nodePackages.node-pre-gyp pkg-config ];
|
|
|
|
buildInputs = [ libjpeg pixman cairo pango ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# Patch shebangs in node_modules, otherwise the webpack build fails with interpreter problems
|
|
|
|
patchShebangs --build "$out/lib/node_modules/mx-puppet-discord/node_modules/"
|
|
|
|
# compile Typescript sources
|
|
|
|
npm run build
|
|
|
|
|
|
|
|
# Make an executable to run the server
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cat <<EOF > $out/bin/mx-puppet-discord
|
|
|
|
#!/bin/sh
|
|
|
|
exec ${nodejs}/bin/node $out/lib/node_modules/mx-puppet-discord/build/index.js "\$@"
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/mx-puppet-discord
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A discord puppeting bridge for matrix";
|
|
|
|
license = licenses.asl20;
|
|
|
|
homepage = "https://github.com/matrix-discord/mx-puppet-discord";
|
|
|
|
maintainers = with maintainers; [ expipiplus1 ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|