nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 rustPlatform,
4 fetchFromGitHub,
5 lib,
6 libiconv,
7 nixosTests,
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "wireguard-exporter";
12 version = "3.6.6";
13
14 src = fetchFromGitHub {
15 owner = "MindFlavor";
16 repo = "prometheus_wireguard_exporter";
17 rev = version;
18 sha256 = "sha256-2e31ZuGJvpvu7L2Lb+n6bZWpC1JhETzEzSiNaxxsAtA=";
19 };
20
21 cargoHash = "sha256-PVjeCKGHiHo+OtjIxMZBBJ19Z3807R34Oyu/HYZO90U=";
22
23 postPatch = ''
24 # drop hardcoded linker names, fixing static build
25 rm .cargo/config.toml
26 '';
27
28 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
29 libiconv
30 ];
31
32 passthru.tests = { inherit (nixosTests.prometheus-exporters) wireguard; };
33
34 meta = {
35 description = "Prometheus exporter for WireGuard, written in Rust";
36 homepage = "https://github.com/MindFlavor/prometheus_wireguard_exporter";
37 license = lib.licenses.mit;
38 maintainers = with lib.maintainers; [
39 ma27
40 globin
41 ];
42 mainProgram = "prometheus_wireguard_exporter";
43 };
44}