2022-12-08 22:26:13 +00:00
|
|
|
{ pkgs, lib, stdenv, fetchFromGitHub, fetchzip, nixosTests, iputils, nodejs, makeWrapper }:
|
2022-09-23 04:30:54 +00:00
|
|
|
let
|
|
|
|
deps = import ./composition.nix { inherit pkgs; };
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "uptime-kuma";
|
2022-12-27 04:20:21 +00:00
|
|
|
version = "1.19.2";
|
2022-09-23 04:30:54 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "louislam";
|
|
|
|
repo = "uptime-kuma";
|
|
|
|
rev = finalAttrs.version;
|
2022-12-27 04:20:21 +00:00
|
|
|
sha256 = "yWQ3O3sCW6YKpE8BKgJjrKmLD9NyccaqyzQOXlSCC8I=";
|
2022-09-23 04:30:54 +00:00
|
|
|
};
|
|
|
|
|
2022-12-27 04:20:21 +00:00
|
|
|
uiSha256 = "sha256-aaQB1S8PmWU7brncRwEHG5bWEcyxD3amaq7Z6vpP92o=";
|
2022-09-23 04:30:54 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Fixes the permissions of the database being not set correctly
|
|
|
|
# See https://github.com/louislam/uptime-kuma/pull/2119
|
|
|
|
./fix-database-permissions.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace server/ping-lite.js \
|
|
|
|
--replace "/bin/ping" "${iputils}/bin/ping" \
|
|
|
|
--replace "/sbin/ping6" "${iputils}/bin/ping" \
|
|
|
|
--replace "/sbin/ping" "${iputils}/bin/ping"
|
|
|
|
'';
|
|
|
|
|
2022-12-08 22:26:13 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2022-09-23 04:30:54 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/share/
|
|
|
|
cp -r server $out/share/
|
|
|
|
cp -r db $out/share/
|
|
|
|
cp -r src $out/share/
|
|
|
|
cp package.json $out/share/
|
|
|
|
ln -s ${deps.package}/lib/node_modules/uptime-kuma/node_modules/ $out/share/
|
|
|
|
ln -s ${finalAttrs.passthru.ui} $out/share/dist
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
2022-12-08 22:26:13 +00:00
|
|
|
makeWrapper ${nodejs}/bin/node $out/bin/uptime-kuma-server \
|
2022-09-23 04:30:54 +00:00
|
|
|
--add-flags $out/share/server/server.js \
|
|
|
|
--chdir $out/share/
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
tests.uptime-kuma = nixosTests.uptime-kuma;
|
|
|
|
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
|
|
|
|
ui = fetchzip {
|
|
|
|
name = "uptime-kuma-dist-${finalAttrs.version}";
|
|
|
|
url = "https://github.com/louislam/uptime-kuma/releases/download/${finalAttrs.version}/dist.tar.gz";
|
|
|
|
sha256 = finalAttrs.uiSha256;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A fancy self-hosted monitoring tool";
|
|
|
|
homepage = "https://github.com/louislam/uptime-kuma";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ julienmalka ];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
|