diff --git a/lib/mkmachine.nix b/lib/mkmachine.nix index 2adf497..5d55d29 100644 --- a/lib/mkmachine.nix +++ b/lib/mkmachine.nix @@ -59,6 +59,7 @@ import "${nixpkgs}/nixos/lib/eval-config.nix" { hydrasect = prev.pkgs.callPackage ../packages/hydrasect { }; codeberg-pages-custom = prev.pkgs.callPackage ../packages/codeberg-pages-custom { }; readeck = prev.pkgs.callPackage ../packages/readeck { }; + uptime-kuma-beta = prev.pkgs.callPackage ../packages/uptime-kuma-beta { }; }) ( diff --git a/lon.lock b/lon.lock index 30ac2fc..0b7e5be 100644 --- a/lon.lock +++ b/lon.lock @@ -174,9 +174,9 @@ "stateless-uptime-kuma": { "type": "Git", "fetchType": "git", - "branch": "master", + "branch": "truly-deterministic", "revision": "880f444ff7862d6127b051cf1a993ad1585b1652", - "url": "https://git.dgnum.eu/DGNum/stateless-uptime-kuma.git", + "url": "https://git.dgnum.eu/Luj/stateless-uptime-kuma.git", "hash": "sha256-l9fgwesnmFxasCaYUCD7L9bGGJXytLuwtx3CZMgpwJg=", "submodules": false }, diff --git a/machines/lambda/uptime-kuma.nix b/machines/lambda/uptime-kuma.nix index 595b62d..56dda23 100644 --- a/machines/lambda/uptime-kuma.nix +++ b/machines/lambda/uptime-kuma.nix @@ -1,9 +1,13 @@ -{ pkgs, config, ... }: +{ + pkgs, + config, + ... +}: { services.uptime-kuma = { enable = true; - package = pkgs.unstable.uptime-kuma; + package = pkgs.uptime-kuma-beta; settings = { NODE_EXTRA_CA_CERTS = "/etc/ssl/certs/ca-certificates.crt"; }; @@ -37,7 +41,10 @@ }; }; - extraFlags = [ "-s" ]; + extraFlags = [ + "-s" + "-v DEBUG" + ]; host = "http://localhost:${builtins.toString 3001}/"; username = "Julien"; diff --git a/packages/uptime-kuma-beta/default.nix b/packages/uptime-kuma-beta/default.nix new file mode 100644 index 0000000..6c41d30 --- /dev/null +++ b/packages/uptime-kuma-beta/default.nix @@ -0,0 +1,53 @@ +{ + lib, + stdenv, + fetchFromGitHub, + buildNpmPackage, + python3, + nodejs, + nixosTests, +}: + +buildNpmPackage rec { + pname = "uptime-kuma"; + version = "2.0.0-beta.0"; + + src = fetchFromGitHub { + owner = "louislam"; + repo = "uptime-kuma"; + rev = version; + hash = "sha256-QWGrwysPS5BxhtjluI30pKWCUo7O3kpL4K8uEb5J3Ik="; + }; + + npmDepsHash = "sha256-DuXBu536Ro6NA3pPnP1mL+hBdgKCSudV0rxD2vZwX3o="; + + nativeBuildInputs = [ python3 ]; + + CYPRESS_INSTALL_BINARY = 0; # Stops Cypress from trying to download binaries + + postInstall = '' + cp -r dist $out/lib/node_modules/uptime-kuma/ + + # remove references to nodejs source + rm -r $out/lib/node_modules/uptime-kuma/node_modules/@louislam/sqlite3/build-tmp-napi-v6 + ''; + + postFixup = '' + makeWrapper ${nodejs}/bin/node $out/bin/uptime-kuma-server \ + --add-flags $out/lib/node_modules/uptime-kuma/server/server.js \ + --chdir $out/lib/node_modules/uptime-kuma + ''; + + passthru.tests.uptime-kuma = nixosTests.uptime-kuma; + + meta = with lib; { + description = "Fancy self-hosted monitoring tool"; + mainProgram = "uptime-kuma-server"; + homepage = "https://github.com/louislam/uptime-kuma"; + changelog = "https://github.com/louislam/uptime-kuma/releases/tag/${version}"; + license = licenses.mit; + maintainers = with maintainers; [ julienmalka ]; + # FileNotFoundError: [Errno 2] No such file or directory: 'xcrun' + broken = stdenv.hostPlatform.isDarwin; + }; +}