matrix-alertmanager: init at 0.5.0
This commit is contained in:
parent
0eb5088814
commit
38937b7a78
39
pkgs/servers/monitoring/matrix-alertmanager/default.nix
Normal file
39
pkgs/servers/monitoring/matrix-alertmanager/default.nix
Normal 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;
|
||||
};
|
||||
}
|
40
pkgs/servers/monitoring/matrix-alertmanager/package.json
Normal file
40
pkgs/servers/monitoring/matrix-alertmanager/package.json
Normal 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"
|
||||
}
|
29
pkgs/servers/monitoring/matrix-alertmanager/update.nix
Executable file
29
pkgs/servers/monitoring/matrix-alertmanager/update.nix
Executable 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
|
||||
''
|
1
pkgs/servers/monitoring/matrix-alertmanager/yarn-hash
Normal file
1
pkgs/servers/monitoring/matrix-alertmanager/yarn-hash
Normal file
|
@ -0,0 +1 @@
|
|||
1yvcm0prk8lxljlnww42pdgzdjdhljkih94hqb0x4cikd2cqgjmp
|
2440
pkgs/servers/monitoring/matrix-alertmanager/yarn.lock
Normal file
2440
pkgs/servers/monitoring/matrix-alertmanager/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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 { };
|
||||
|
|
Loading…
Reference in a new issue