summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/mk/mktxp/package.nix
blob: f6d65a295b6eeb28ee02f4c031c07597e4081ee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
  lib,
  python3Packages,
  fetchFromGitHub,
}:
let
  version = "2.0.3";
in
python3Packages.buildPythonApplication {
  pname = "mktxp";
  inherit version;
  pyproject = true;

  src = fetchFromGitHub {
    owner = "akpw";
    repo = "mktxp";
    tag = "v${version}";
    hash = "sha256-6CVVYBQWsEiFuJSeEiXAtsWuAKWBGrSFCT8xzCW5QrQ=";
  };

  build-system = with python3Packages; [ setuptools ];

  dependencies = with python3Packages; [
    prometheus-client
    routeros-api
    configobj
    humanize
    texttable
    speedtest-cli
    waitress
    packaging
    pyyaml
  ];

  nativeCheckInputs = with python3Packages; [
    pytestCheckHook
    pytest-mock
  ];

  # tests create the mktxp config under $HOME
  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  pythonImportsCheck = [ "mktxp" ];

  meta = {
    homepage = "https://github.com/akpw/mktxp";
    changelog = "https://github.com/akpw/mktxp/releases/tag/v${version}";
    description = "Prometheus Exporter for Mikrotik RouterOS devices";
    license = lib.licenses.gpl2;
    platforms = lib.platforms.linux;
    maintainers = [ lib.maintainers.BonusPlay ];
    mainProgram = "mktxp";
  };
}