forked from mirrors/nixpkgs
mx-puppet-discord: update to 0.1.1 and fix for node2nix npmv7 update
This commit is contained in:
parent
e70290e57d
commit
1f067ee3fb
|
@ -1,14 +1,17 @@
|
|||
{ stdenv, fetchFromGitHub, pkgs, lib, nodejs-14_x, nodePackages, pkg-config, libjpeg
|
||||
, pixman, cairo, pango }:
|
||||
{ stdenv, fetchFromGitLab, pkgs, lib, nodejs-14_x, pkg-config
|
||||
, libjpeg, pixman, cairo, pango, which, postgresql }:
|
||||
|
||||
let
|
||||
nodejs = nodejs-14_x;
|
||||
# No official version ever released
|
||||
src = fetchFromGitHub {
|
||||
owner = "matrix-discord";
|
||||
|
||||
version = "0.1.1";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
group = "mx-puppet";
|
||||
owner = "discord";
|
||||
repo = "mx-puppet-discord";
|
||||
rev = "bb6438a504182a7a64048b992179427587ccfded";
|
||||
sha256 = "0g2p5xwxxgvlnq0fg0x4q9x4asqyppdv6b5z6bvncm62kc70z6xk";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-ZhyjUt6Bz/0R4+Lq/IoY9rNjdwVE2qp4ZQLc684+T/0=";
|
||||
};
|
||||
|
||||
myNodePackages = import ./node-composition.nix {
|
||||
|
@ -17,25 +20,22 @@ let
|
|||
};
|
||||
|
||||
in myNodePackages.package.override {
|
||||
pname = "mx-puppet-discord";
|
||||
version = "2021-08-01";
|
||||
inherit version src;
|
||||
|
||||
inherit src;
|
||||
nativeBuildInputs = [ nodejs.pkgs.node-pre-gyp nodejs.pkgs.node-gyp-build pkg-config which ];
|
||||
buildInputs = [ libjpeg pixman cairo pango postgresql ];
|
||||
|
||||
nativeBuildInputs = [ nodePackages.node-pre-gyp pkg-config ];
|
||||
buildInputs = [ libjpeg pixman cairo pango ];
|
||||
postRebuild = ''
|
||||
# Build typescript stuff
|
||||
npm run build
|
||||
'';
|
||||
|
||||
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 "\$@"
|
||||
exec ${nodejs}/bin/node $out/lib/node_modules/@mx-puppet/discord/build/index.js "\$@"
|
||||
EOF
|
||||
chmod +x $out/bin/mx-puppet-discord
|
||||
'';
|
||||
|
@ -43,7 +43,7 @@ in myNodePackages.package.override {
|
|||
meta = with lib; {
|
||||
description = "A discord puppeting bridge for matrix";
|
||||
license = licenses.asl20;
|
||||
homepage = "https://github.com/matrix-discord/mx-puppet-discord";
|
||||
homepage = "https://gitlab.com/mx-puppet/discord/mx-puppet-discord";
|
||||
maintainers = with maintainers; [ expipiplus1 ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p nodePackages.node2nix
|
||||
|
||||
# No official release
|
||||
rev=bb6438a504182a7a64048b992179427587ccfded
|
||||
u=https://raw.githubusercontent.com/matrix-discord/mx-puppet-discord/$rev
|
||||
# Download package.json and package-lock.json
|
||||
curl -O $u/package.json
|
||||
curl $u/package-lock.json |
|
||||
sed -e 's|git+ssh://git@|git+https://|g' > package-lock.json
|
||||
tag="v0.1.1"
|
||||
u="https://gitlab.com/mx-puppet/discord/mx-puppet-discord/-/raw/$tag"
|
||||
# Download package.json and patch in @discordjs/opus optional dependency
|
||||
curl $u/package.json |
|
||||
sed 's|"typescript": *"\^\?3\.[^"]*"|"typescript": "^4.8.3"|' | # TODO: remove when newer typescript version pinned
|
||||
sed 's|\("dependencies": *{\)|\1\n"@discordjs/opus": "^0.8.0",|' >package.json
|
||||
|
||||
node2nix \
|
||||
--nodejs-14 \
|
||||
--node-env ../../development/node-packages/node-env.nix \
|
||||
--input package.json \
|
||||
--lock package-lock.json \
|
||||
--strip-optional-dependencies \
|
||||
--output node-packages.nix \
|
||||
--composition node-composition.nix
|
||||
--composition node-composition.nix \
|
||||
--registry https://registry.npmjs.org \
|
||||
--registry https://gitlab.com/api/v4/packages/npm \
|
||||
--registry-scope '@mx-puppet'
|
||||
|
||||
sed -i 's|<nixpkgs>|../../..|' node-composition.nix
|
||||
|
||||
rm -f package.json package-lock.json
|
||||
rm -f package.json
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# This file has been generated by node2nix 1.9.0. Do not edit!
|
||||
# This file has been generated by node2nix 1.11.1. Do not edit!
|
||||
|
||||
{pkgs ? import ../../.. {
|
||||
inherit system;
|
||||
|
|
2232
pkgs/servers/mx-puppet-discord/node-packages.nix
generated
2232
pkgs/servers/mx-puppet-discord/node-packages.nix
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue