2022-12-17 10:02:37 +00:00
|
|
|
{ lib
|
2023-08-04 22:07:22 +00:00
|
|
|
, stdenv
|
2022-12-17 10:02:37 +00:00
|
|
|
, fetchFromGitHub
|
2023-08-04 22:07:22 +00:00
|
|
|
, fetchYarnDeps
|
2024-04-21 15:54:59 +00:00
|
|
|
, fixup-yarn-lock
|
2023-08-04 22:07:22 +00:00
|
|
|
, nodejs
|
|
|
|
, nodejs-slim
|
2022-12-17 10:02:37 +00:00
|
|
|
, matrix-sdk-crypto-nodejs
|
|
|
|
, nixosTests
|
|
|
|
, nix-update-script
|
|
|
|
}:
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
let
|
2021-05-29 03:34:57 +00:00
|
|
|
pname = "matrix-appservice-irc";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "2.0.0";
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "matrix-org";
|
2023-08-04 22:07:22 +00:00
|
|
|
repo = pname;
|
2022-12-17 10:02:37 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-voZJVBggsuwmGw/imt2HYmqiYBkRYMpppt/Nemh6fsM=";
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
2021-05-29 03:34:57 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
yarnOfflineCache = fetchYarnDeps {
|
|
|
|
name = "${pname}-${version}-offline-cache";
|
|
|
|
yarnLock = "${src}/yarn.lock";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-hapEbdjvvzeZHfrpYRW9W3vXkQVNyGZ0qydO34+mQqQ=";
|
2023-08-04 22:07:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
inherit pname version src yarnOfflineCache;
|
|
|
|
|
|
|
|
strictDeps = true;
|
2022-09-14 18:05:37 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
nativeBuildInputs = [
|
2024-04-21 15:54:59 +00:00
|
|
|
fixup-yarn-lock
|
2023-08-04 22:07:22 +00:00
|
|
|
nodejs-slim
|
|
|
|
nodejs.pkgs.yarn
|
|
|
|
nodejs.pkgs.node-gyp-build
|
2022-12-17 10:02:37 +00:00
|
|
|
];
|
2022-10-30 15:09:59 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
|
|
|
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
yarn config --offline set yarn-offline-mirror "$yarnOfflineCache"
|
|
|
|
fixup-yarn-lock yarn.lock
|
|
|
|
yarn install --frozen-lockfile --offline --no-progress --non-interactive --ignore-scripts
|
|
|
|
patchShebangs node_modules/ bin/
|
|
|
|
|
|
|
|
runHook postConfigure
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
yarn --offline build
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir $out
|
|
|
|
cp package.json $out
|
|
|
|
cp app.js config.schema.yml $out
|
|
|
|
cp -r bin lib public $out
|
|
|
|
|
|
|
|
# prune dependencies to production only
|
|
|
|
yarn install --frozen-lockfile --offline --no-progress --non-interactive --ignore-scripts --production
|
|
|
|
cp -r node_modules $out
|
|
|
|
|
|
|
|
# replace matrix-sdk-crypto-nodejs with nixos package
|
|
|
|
rm -rv $out/node_modules/@matrix-org/matrix-sdk-crypto-nodejs
|
|
|
|
ln -sv ${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/matrix-sdk-crypto-nodejs $out/node_modules/@matrix-org/
|
|
|
|
|
|
|
|
runHook postInstall
|
2021-04-05 15:23:46 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests.matrix-appservice-irc = nixosTests.matrix-appservice-irc;
|
2022-12-28 21:21:41 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
2021-04-05 15:23:46 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2024-04-21 15:54:59 +00:00
|
|
|
changelog = "https://github.com/matrix-org/matrix-appservice-irc/releases/tag/${version}";
|
2021-04-05 15:23:46 +00:00
|
|
|
description = "Node.js IRC bridge for Matrix";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "matrix-appservice-irc";
|
2022-11-04 12:27:35 +00:00
|
|
|
maintainers = with maintainers; [ rhysmdnz ];
|
2021-04-05 15:23:46 +00:00
|
|
|
homepage = "https://github.com/matrix-org/matrix-appservice-irc";
|
|
|
|
license = licenses.asl20;
|
2022-09-14 18:05:37 +00:00
|
|
|
platforms = platforms.linux;
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
|
|
|
}
|