nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 fetchFromGitHub,
3 lib,
4 python3,
5 stdenv,
6 sudo,
7 zfs,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "check-zfs";
12 version = "2.0";
13
14 src = fetchFromGitHub {
15 owner = "zlacelle";
16 repo = "nagios_check_zfs_linux";
17 tag = version;
18 sha256 = "gPLCNt6hp4E94s9/PRgsnBN5XXQQ+s2MGcgRFeknXg4=";
19 };
20
21 buildInputs = [
22 python3
23 zfs
24 ];
25
26 postPatch = ''
27 patchShebangs check_zfs.py
28 substituteInPlace check_zfs.py \
29 --replace-fail "'/usr/bin/sudo'" "'${sudo}/bin/sudo'" \
30 --replace-fail "'/sbin/zpool'" "'${zfs}/bin/zpool'" \
31 --replace-fail "'/sbin/zfs'" "'${zfs}/bin/zfs'"
32 '';
33
34 installPhase = ''
35 runHook preInstall
36
37 install -Dm 755 check_zfs.py $out/bin/check_zfs
38
39 runHook postInstall
40 '';
41
42 meta = {
43 description = "Check the health, capacity, fragmentation, and other things for use with Nagios monitoring";
44 homepage = "https://github.com/zlacelle/nagios_check_zfs_linux";
45 license = lib.licenses.gpl3Only;
46 mainProgram = "check_zfs";
47 maintainers = with lib.maintainers; [ mariaa144 ];
48 };
49}