2024-08-05 09:06:58 +00:00
|
|
|
{ stdenv, fetchFromGitLab, pkgs, lib, node-pre-gyp, nodejs_18, pkg-config
|
2022-09-26 22:01:27 +00:00
|
|
|
, libjpeg, pixman, cairo, pango, which, postgresql }:
|
2021-04-15 04:04:24 +00:00
|
|
|
|
|
|
|
let
|
2023-09-24 12:51:56 +00:00
|
|
|
nodejs = nodejs_18;
|
2022-09-26 22:01:27 +00:00
|
|
|
|
|
|
|
version = "0.1.1";
|
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
group = "mx-puppet";
|
|
|
|
owner = "discord";
|
2021-04-15 04:04:24 +00:00
|
|
|
repo = "mx-puppet-discord";
|
2022-09-26 22:01:27 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-ZhyjUt6Bz/0R4+Lq/IoY9rNjdwVE2qp4ZQLc684+T/0=";
|
2021-04-15 04:04:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
myNodePackages = import ./node-composition.nix {
|
|
|
|
inherit pkgs nodejs;
|
|
|
|
inherit (stdenv.hostPlatform) system;
|
|
|
|
};
|
|
|
|
|
|
|
|
in myNodePackages.package.override {
|
2022-09-26 22:01:27 +00:00
|
|
|
inherit version src;
|
2021-05-23 21:46:18 +00:00
|
|
|
|
2024-08-05 09:06:58 +00:00
|
|
|
nativeBuildInputs = [ node-pre-gyp nodejs.pkgs.node-gyp-build pkg-config which ];
|
2022-09-26 22:01:27 +00:00
|
|
|
buildInputs = [ libjpeg pixman cairo pango postgresql ];
|
2021-04-15 04:04:24 +00:00
|
|
|
|
2022-09-26 22:01:27 +00:00
|
|
|
postRebuild = ''
|
|
|
|
# Build typescript stuff
|
2021-04-15 04:04:24 +00:00
|
|
|
npm run build
|
2022-09-26 22:01:27 +00:00
|
|
|
'';
|
2021-04-15 04:04:24 +00:00
|
|
|
|
2022-09-26 22:01:27 +00:00
|
|
|
postInstall = ''
|
2021-04-15 04:04:24 +00:00
|
|
|
# Make an executable to run the server
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cat <<EOF > $out/bin/mx-puppet-discord
|
|
|
|
#!/bin/sh
|
2022-09-26 22:01:27 +00:00
|
|
|
exec ${nodejs}/bin/node $out/lib/node_modules/@mx-puppet/discord/build/index.js "\$@"
|
2021-04-15 04:04:24 +00:00
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/mx-puppet-discord
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Discord puppeting bridge for matrix";
|
|
|
|
license = licenses.asl20;
|
2022-09-26 22:01:27 +00:00
|
|
|
homepage = "https://gitlab.com/mx-puppet/discord/mx-puppet-discord";
|
2021-04-15 04:04:24 +00:00
|
|
|
maintainers = with maintainers; [ expipiplus1 ];
|
|
|
|
platforms = platforms.unix;
|
2022-12-06 20:47:40 +00:00
|
|
|
# never built on aarch64-darwin since first introduction in nixpkgs
|
|
|
|
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
|
2023-11-23 21:09:35 +00:00
|
|
|
mainProgram = "mx-puppet-discord";
|
2021-04-15 04:04:24 +00:00
|
|
|
};
|
|
|
|
}
|