nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 django,
5 fetchFromGitHub,
6 netaddr,
7 netbox,
8 poetry-core,
9}:
10
11buildPythonPackage rec {
12 pname = "netbox-plugin-prometheus-sd";
13 version = "1.2.0";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "FlxPeters";
18 repo = "netbox-plugin-prometheus-sd";
19 tag = "v${version}";
20 hash = "sha256-L5kJnaY9gKpsWAgwkjVRQQauL2qViinqk7rHLXTVzT4=";
21 };
22
23 postPatch = ''
24 substituteInPlace pyproject.toml \
25 --replace-fail 'version = "0.0.0"' 'version = "${version}"'
26 substituteInPlace netbox_prometheus_sd/__init__.py \
27 --replace-fail "from extras.plugins import PluginConfig" "from netbox.plugins import PluginConfig"
28 '';
29
30 build-system = [ poetry-core ];
31
32 dependencies = [
33 django
34 netaddr
35 ];
36
37 nativeCheckInputs = [ netbox ];
38
39 preFixup = ''
40 export PYTHONPATH=${netbox}/opt/netbox/netbox:$PYTHONPATH
41 '';
42
43 pythonImportsCheck = [ "netbox_prometheus_sd" ];
44
45 meta = {
46 description = "Netbox plugin to provide Netbox entires to Prometheus HTTP service discovery";
47 homepage = "https://github.com/FlxPeters/netbox-plugin-prometheus-sd";
48 changelog = "https://github.com/FlxPeters/netbox-plugin-prometheus-sd/releases/tag/${src.tag}";
49 license = lib.licenses.mit;
50 maintainers = with lib.maintainers; [ xanderio ];
51 };
52}