matrix-alertmanager: init at 0.5.0

This commit is contained in:
Yureka 2021-09-04 16:18:09 +02:00 committed by Yuka
parent 0eb5088814
commit 38937b7a78
6 changed files with 2551 additions and 0 deletions

View File

@ -0,0 +1,39 @@
{ lib, callPackage, mkYarnPackage, fetchYarnDeps, fetchFromGitHub, nodejs }:
mkYarnPackage rec {
pname = "matrix-alertmanager";
version = "0.5.0";
src = fetchFromGitHub {
owner = "jaywink";
repo = pname;
rev = "v${version}";
sha256 = "M3/8viRCRiVJGJSHidP6nG8cr8wOl9hMFY/gzdSRN+4=";
};
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
offlineCache = fetchYarnDeps {
inherit yarnLock;
sha256 = lib.fileContents ./yarn-hash;
};
prePatch = ''
cp ${./package.json} ./package.json
'';
postInstall = ''
sed '1 s;^;#!${nodejs}/bin/node\n;' -i $out/libexec/matrix-alertmanager/node_modules/matrix-alertmanager/src/app.js
chmod +x $out/libexec/matrix-alertmanager/node_modules/matrix-alertmanager/src/app.js
'';
passthru.updateScript = callPackage ./update.nix {};
meta = with lib; {
description = "Bot to receive Alertmanager webhook events and forward them to chosen rooms";
homepage = "https://git.feneas.org/jaywink/matrix-alertmanager";
license = licenses.mit;
maintainers = with maintainers; [ yuka ];
platforms = platforms.all;
};
}

View File

@ -0,0 +1,40 @@
{
"name": "matrix-alertmanager",
"version": "0.4.0",
"description": "Prometheus Alertmanager bot for Matrix",
"main": "src/app.js",
"scripts": {
"dev": "node_modules/.bin/nodemon src/app.js localhost 3000",
"test": "node_modules/.bin/mocha tests/",
"start": "node src/app.js"
},
"repository": {
"type": "git",
"url": "https://git.feneas.org/jaywink/matrix-alertmanager"
},
"keywords": [
"matrix",
"alertmanager",
"prometheus",
"bot"
],
"engines": {
"node": ">= 14"
},
"author": "Jason Robinson",
"license": "MIT",
"devDependencies": {
"chai": "^4.2.0",
"eslint": "^7.14.0",
"mocha": "^8.2.1",
"nodemon": "^2.0.6",
"sinon": "^9.2.1"
},
"dependencies": {
"dotenv": "^8.2.0",
"express": "^4.17.1",
"matrix-js-sdk": "^9.2.0",
"striptags": "^3.1.1"
},
"bin": "src/app.js"
}

View File

@ -0,0 +1,29 @@
{ lib, writeShellScript
, coreutils, jq, common-updater-scripts
, curl, wget, gnugrep, yarn, prefetch-yarn-deps
}:
writeShellScript "update-matrix-alertmanager" ''
set -xe
export PATH="${lib.makeBinPath [ gnugrep coreutils curl wget jq common-updater-scripts yarn prefetch-yarn-deps ]}"
owner="jaywink"
repo="matrix-alertmanager"
version=`curl -s "https://api.github.com/repos/$owner/$repo/tags" | jq -r .[0].name | grep -oP "^v\K.*"`
url="https://raw.githubusercontent.com/$owner/$repo/v$version/"
(
update-source-version matrix-alertmanager "$version" --file=pkgs/servers/monitoring/matrix-alertmanager/default.nix
)
rm -f package.json package-lock.json yarn.lock
wget "$url/package.json" "$url/package-lock.json"
yarn import
echo $(prefetch-yarn-deps) > yarn-hash
jq '. + { bin: .main }' package.json > package.json.tmp
mv package.json{.tmp,}
rm -rf package-lock.json node_modules
''

View File

@ -0,0 +1 @@
1yvcm0prk8lxljlnww42pdgzdjdhljkih94hqb0x4cikd2cqgjmp

File diff suppressed because it is too large Load Diff

View File

@ -20942,6 +20942,8 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) DiskArbitration Foundation;
};
matrix-alertmanager = callPackage ../servers/monitoring/matrix-alertmanager { };
mattermost = callPackage ../servers/mattermost { };
matterircd = callPackage ../servers/mattermost/matterircd.nix { };
matterbridge = callPackage ../servers/matterbridge { };