From 9b4e87af6f48e9a2685e4459c7e8c5ca458e0b3f Mon Sep 17 00:00:00 2001 From: sinavir Date: Thu, 18 Apr 2024 19:00:20 +0200 Subject: [PATCH] feat: package python cli --- default.nix | 1 + overlay.nix | 1 + pyproject.toml | 8 +++++++- stateless-uptime-kuma.nix | 31 +++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 stateless-uptime-kuma.nix diff --git a/default.nix b/default.nix index 6425f5e..59f6341 100644 --- a/default.nix +++ b/default.nix @@ -4,6 +4,7 @@ pkgs ? import nixpkgs { overlays = [ (import ./overlay.nix) ]; }, }: rec { + inherit pkgs; shell = pkgs.mkShell { packages = [ python diff --git a/overlay.nix b/overlay.nix index b5ef023..c9148b2 100644 --- a/overlay.nix +++ b/overlay.nix @@ -4,4 +4,5 @@ final: prev: { uptime-kuma-api = python-self.callPackage ./uptime-kuma-api.nix { }; }; }; + statelessUptimeKuma = final.callPackage ./stateless-uptime-kuma.nix { }; } diff --git a/pyproject.toml b/pyproject.toml index ea9c327..efebd2c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,10 +17,16 @@ classifiers = [ ] dependencies = [ "uptime-kuma-api", + "requests", + "click", + "click-log", ] +[tool.hatch.build.targets.wheel] + packages = ["stateless_uptime_kuma"] + [project.urls] Homepage = "https://git.dgnum.eu/mdebray/stateless-uptime-kuma" [project.scripts] -stateless_uptime_kuma = "cli:main" +stateless-uptime-kuma = "stateless_uptime_kuma.cli:cli" diff --git a/stateless-uptime-kuma.nix b/stateless-uptime-kuma.nix new file mode 100644 index 0000000..78d9fa7 --- /dev/null +++ b/stateless-uptime-kuma.nix @@ -0,0 +1,31 @@ +{ lib, python3 }: + +python3.pkgs.buildPythonApplication rec { + pname = "stateless-uptime-kuma"; + version = "unstable"; + pyproject = true; + + src = + with lib.fileset; + toSource { + root = ./.; + fileset = difference (intersection (gitTracked ./.) ( + fileFilter (file: !file.hasExt "nix") ./. + )) ./tests; + }; + + nativeBuildInputs = with python3.pkgs; [ hatchling ]; + + propagatedBuildInputs = with python3.pkgs; [ + uptime-kuma-api + requests + click + click-log + ]; + + meta = with lib; { + description = "A python tool to create uptime-kuma probes"; + license = licenses.eupl12; + maintainers = with maintainers; [ ]; + }; +}