1
0
Fork 0

Introduce matrix-commander notifications

This commit is contained in:
Malte Brandy 2021-01-09 01:27:18 +01:00
parent 039b3ae2d8
commit e1edb61809
3 changed files with 43 additions and 16 deletions

View file

@ -37,22 +37,15 @@ in {
lib.makeBinPath [ pkgs.laminar pkgs.nix ]
}:$PATH nix-jobs realise-here "$DERIVATION"
'';
"after" = pkgs.writeShellScript "after-all-jobs-script" ''
TO_EMAIL="ci-jobs-channel@email2matrix.maralorn.de"
FROM_EMAIL="laminar@hera.m-0.eu"
LAMINAR_URL="ci.maralorn.de"
sendmail -t <<EOF
From: $FROM_EMAIL
To: $TO_EMAIL
Subject: $JOB #$RUN: $RESULT
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
$(curl -s $LAMINAR_URL/log/$JOB/$RUN)
EOF
'';
};
after = pkgs.writeShellScript "after-all-jobs-script" ''
LAMINAR_URL="https://ci.maralorn.de"
${pkgs.matrix-commander}/bin/matrix-commander -c ${stateDir}/matrix-credentials.json -s ${stateDir}/matrix-secrets-store <<EOF
$JOB #$RUN: $RESULT
$(if [[ $RESULT == "failed" ]]; then echo -e 'maralorn'; ${pkgs.curl}/bin/curl -m1 -s $LAMINAR_URL/log/$JOB/$RUN | tail; fi)
EOF
true
'';
contexts = {
"default.conf" = builtins.toFile "default.conf" "EXECUTORS=16";
};

View file

@ -0,0 +1,34 @@
self: super:
let
package = { python3Packages, fetchFromGitHub }:
let
pname = "matrix-commander";
version = "67a6a89";
in python3Packages.buildPythonApplication {
name = "${pname}-${version}";
inherit pname version;
src = fetchFromGitHub {
owner = "8go";
repo = "matrix-commander";
rev = version;
sha256 = "0k387a0i9jh6034f8yy3b8wxsjr8abb896rfmmbmh5gx1a6f5cz4";
};
format = "other";
installPhase = ''
mkdir -p $out/bin
install matrix-commander.py $out/bin/matrix-commander
'';
propagatedBuildInputs = with python3Packages; [
aiohttp
aiofiles
markdown
matrix-nio
notify2
pillow
python_magic
];
checkPhase = ''
$out/bin/matrix-commander --help > /dev/null
'';
};
in { matrix-commander = self.callPackage package { }; }

View file

@ -44,7 +44,7 @@ self: super: {
inherit (self.pythonPackages) yapf jsbeautifier;
inherit (self)
go gdb mpc_cli ncmpcpp shfmt htmlTidy astyle nodejs tasksh magic-wormhole
nixfmt nixpkgs-fmt rnix-lsp tmate rustup kitty nix-top ghcWithPackages ghcid;
nixfmt nixpkgs-fmt rnix-lsp tmate rustup kitty nix-top ghcWithPackages ghcid matrix-commander;
obelisk = (import self.sources.obelisk { }).command;
};
accounting-pkgs = {