2023-07-28 22:31:28 +02:00
|
|
|
{ lib
|
2022-10-06 11:53:42 +02:00
|
|
|
, stdenv
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
2023-07-28 22:31:28 +02:00
|
|
|
, fetchNpmDeps
|
2022-10-06 11:53:42 +02:00
|
|
|
, nixosTests
|
2023-07-28 22:31:28 +02:00
|
|
|
, nodejs
|
|
|
|
, npmHooks
|
2022-10-06 11:53:42 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "karma";
|
2023-07-28 22:37:13 +02:00
|
|
|
version = "0.115";
|
2022-10-06 11:53:42 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "prymitive";
|
|
|
|
repo = "karma";
|
|
|
|
rev = "v${version}";
|
2023-07-28 22:37:13 +02:00
|
|
|
hash = "sha256-SW/nmJcSk/LmoKLuD5stsSaRGaJctl6hVSODNCT9i64=";
|
2022-10-06 11:53:42 +02:00
|
|
|
};
|
|
|
|
|
2023-07-28 22:37:13 +02:00
|
|
|
vendorHash = "sha256-Y55AaB8KRV+Tq/Trg1BOOwziyt+yJ2b3iVYA6bDebQY=";
|
2022-10-06 11:53:42 +02:00
|
|
|
|
2023-07-28 22:31:28 +02:00
|
|
|
npmDeps = fetchNpmDeps {
|
|
|
|
src = "${src}/ui";
|
2023-07-28 22:37:13 +02:00
|
|
|
hash = "sha256-/L+eU0xwaopL2im9epiZiZ23dUqJ+3OwhWw/rIZC6hI=";
|
2023-07-28 22:31:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
npmRoot = "ui";
|
|
|
|
|
2022-10-06 11:53:42 +02:00
|
|
|
nativeBuildInputs = [
|
2023-07-28 22:31:28 +02:00
|
|
|
nodejs
|
|
|
|
npmHooks.npmConfigHook
|
2022-10-06 11:53:42 +02:00
|
|
|
];
|
|
|
|
|
2023-07-28 22:31:28 +02:00
|
|
|
overrideModAttrs = oldAttrs: {
|
|
|
|
nativeBuildInputs = lib.filter (drv: drv != npmHooks.npmConfigHook) oldAttrs.nativeBuildInputs;
|
|
|
|
};
|
|
|
|
|
2022-10-06 11:53:42 +02:00
|
|
|
postPatch = ''
|
|
|
|
# Since we're using node2nix packages, the NODE_INSTALL hook isn't needed in the makefile
|
|
|
|
sed -i \
|
|
|
|
-e 's/$(NODE_INSTALL)//g' ./ui/Makefile \
|
|
|
|
-e 's~NODE_PATH := $(shell npm bin)~NODE_PATH := ./node_modules~g' ./ui/Makefile \
|
|
|
|
-e 's~NODE_MODULES := $(shell dirname `npm bin`)~NODE_MODULES := ./~g' ./ui/Makefile
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
2023-07-28 22:31:28 +02:00
|
|
|
runHook preBuild
|
2022-10-06 11:53:42 +02:00
|
|
|
|
|
|
|
VERSION="v${version}" make -j$NIX_BUILD_CORES
|
|
|
|
|
2023-07-28 22:31:28 +02:00
|
|
|
runHook postBuild
|
2022-10-06 11:53:42 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -Dm 755 ./karma $out/bin/karma
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests.karma = nixosTests.karma;
|
|
|
|
|
|
|
|
meta = with lib; {
|
2023-07-28 22:37:13 +02:00
|
|
|
changelog = "https://github.com/prymitive/karma/blob/${src.rev}/CHANGELOG.md";
|
2022-10-06 11:53:42 +02:00
|
|
|
description = "Alert dashboard for Prometheus Alertmanager";
|
2024-03-19 03:14:51 +01:00
|
|
|
mainProgram = "karma";
|
2022-10-06 11:53:42 +02:00
|
|
|
homepage = "https://karma-dashboard.io/";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ nukaduka ];
|
|
|
|
};
|
|
|
|
}
|