2022-12-03 19:09:00 +00:00
|
|
|
{ lib
|
2023-07-30 03:26:44 +00:00
|
|
|
, stdenv
|
2022-12-03 19:09:00 +00:00
|
|
|
, fetchFromGitHub
|
2023-07-30 03:26:44 +00:00
|
|
|
, fetchYarnDeps
|
2024-04-17 17:34:05 +00:00
|
|
|
, fixup-yarn-lock
|
2023-07-30 03:26:44 +00:00
|
|
|
, nodejs
|
|
|
|
, nodejs-slim
|
2022-12-03 19:09:00 +00:00
|
|
|
, matrix-sdk-crypto-nodejs
|
|
|
|
, nixosTests
|
|
|
|
, nix-update-script
|
2024-08-13 13:55:04 +00:00
|
|
|
, yarn
|
2022-12-03 19:09:00 +00:00
|
|
|
}:
|
|
|
|
|
2023-07-30 03:26:44 +00:00
|
|
|
let
|
2021-05-23 21:45:47 +00:00
|
|
|
pname = "matrix-appservice-irc";
|
2024-09-04 17:37:34 +00:00
|
|
|
version = "3.0.0";
|
2021-09-07 21:47:32 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "matrix-org";
|
2023-07-30 03:26:44 +00:00
|
|
|
repo = pname;
|
2022-12-03 19:09:00 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2024-09-04 17:37:34 +00:00
|
|
|
hash = "sha256-ZT8ugev+Tgu47KLuVVo5sFfiGtWLDc6JW5NZvsQ1mA8=";
|
2021-09-07 21:47:32 +00:00
|
|
|
};
|
2021-05-23 21:45:47 +00:00
|
|
|
|
2023-07-30 03:26:44 +00:00
|
|
|
yarnOfflineCache = fetchYarnDeps {
|
|
|
|
name = "${pname}-${version}-offline-cache";
|
|
|
|
yarnLock = "${src}/yarn.lock";
|
2024-09-04 17:37:34 +00:00
|
|
|
hash = "sha256-13OUcxZOlW1pp4uB1aRmqlzKf6rTgyP/nMnLmksXV3w=";
|
2023-07-30 03:26:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
inherit pname version src yarnOfflineCache;
|
2022-09-13 12:50:39 +00:00
|
|
|
|
2023-08-01 11:53:02 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2022-12-03 19:09:00 +00:00
|
|
|
nativeBuildInputs = [
|
2024-04-17 17:34:05 +00:00
|
|
|
fixup-yarn-lock
|
2023-07-30 03:26:44 +00:00
|
|
|
nodejs-slim
|
2024-08-13 13:55:04 +00:00
|
|
|
yarn
|
2023-07-30 03:26:44 +00:00
|
|
|
nodejs.pkgs.node-gyp-build
|
2022-12-03 19:09:00 +00:00
|
|
|
];
|
2022-10-25 09:21:13 +00:00
|
|
|
|
2023-07-30 03:26:44 +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
|
2023-08-01 11:53:02 +00:00
|
|
|
cp package.json $out
|
2023-07-30 03:26:44 +00:00
|
|
|
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
|
2020-05-28 12:03:00 +00:00
|
|
|
'';
|
|
|
|
|
2020-08-30 07:42:21 +00:00
|
|
|
passthru.tests.matrix-appservice-irc = nixosTests.matrix-appservice-irc;
|
2022-12-25 22:11:14 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
2020-08-30 07:42:21 +00:00
|
|
|
|
2020-05-28 12:03:00 +00:00
|
|
|
meta = with lib; {
|
2024-04-16 10:25:11 +00:00
|
|
|
changelog = "https://github.com/matrix-org/matrix-appservice-irc/releases/tag/${version}";
|
2020-05-28 12:03:00 +00:00
|
|
|
description = "Node.js IRC bridge for Matrix";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "matrix-appservice-irc";
|
2022-10-16 07:52:54 +00:00
|
|
|
maintainers = with maintainers; [ rhysmdnz ];
|
2020-05-28 12:03:00 +00:00
|
|
|
homepage = "https://github.com/matrix-org/matrix-appservice-irc";
|
|
|
|
license = licenses.asl20;
|
2022-09-13 12:50:39 +00:00
|
|
|
platforms = platforms.linux;
|
2020-05-28 12:03:00 +00:00
|
|
|
};
|
|
|
|
}
|