nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 influxdb-client,
7 kubernetes,
8 mock,
9 prometheus-client,
10 pymongo,
11 pytest-cov-stub,
12 pytest-timeout,
13 pytestCheckHook,
14 pyzmq,
15 setproctitle,
16 setuptools,
17}:
18
19buildPythonPackage rec {
20 pname = "powerapi";
21 version = "2.10.0";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "powerapi-ng";
26 repo = "powerapi";
27 tag = "v${version}";
28 hash = "sha256-rn1qe0RwYuUR23CgzOOeiwe1wuFihnhQ9a6ALgSP/cQ=";
29 };
30
31 __darwinAllowLocalNetworking = true;
32
33 build-system = [ setuptools ];
34
35 dependencies = [
36 pyzmq
37 setproctitle
38 ];
39
40 optional-dependencies = {
41 influxdb = [ influxdb-client ];
42 kubernetes = [ kubernetes ];
43 mongodb = [ pymongo ];
44 # opentsdb = [ opentsdb-py ];
45 prometheus = [ prometheus-client ];
46 };
47
48 nativeCheckInputs = [
49 mock
50 pytest-cov-stub
51 pytestCheckHook
52 pytest-timeout
53 ]
54 ++ lib.concatAttrValues optional-dependencies;
55
56 pythonImportsCheck = [ "powerapi" ];
57
58 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
59 "test_puller"
60 "TestDispatcher"
61 "TestK8sProcessor"
62 "TestPusher"
63 ];
64
65 meta = {
66 description = "Python framework for building software-defined power meters";
67 homepage = "https://github.com/powerapi-ng/powerapi";
68 changelog = "https://github.com/powerapi-ng/powerapi/releases/tag/${src.tag}";
69 license = lib.licenses.bsd3;
70 maintainers = with lib.maintainers; [ fab ];
71 };
72}