nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 fetchFromGitHub,
3 lib,
4 makeWrapper,
5 nix-update-script,
6 perlPackages,
7 stdenv,
8 versionCheckHook,
9}:
10stdenv.mkDerivation rec {
11 pname = "manubulon-snmp-plugins";
12 version = "2.1.0-unstable-2024-03-13";
13
14 src = fetchFromGitHub {
15 owner = "SteScho";
16 repo = "manubulon-snmp";
17 rev = "1a5afb2486802034146277010d956eba9c2ad54b";
18 hash = "sha256-B5CCGMkNv1wGnLQIl0yiGTH2j5MOlj5+MrRqbLNIwhE=";
19 };
20
21 buildInputs = with perlPackages; [
22 CryptDES
23 CryptRijndael
24 DigestHMAC
25 DigestSHA1
26 GetoptLongDescriptive
27 NetSNMP
28 perl
29 ];
30
31 nativeBuildInputs = [
32 makeWrapper
33 ];
34
35 installPhase = ''
36 runHook preInstall
37 mkdir --parents $out/bin
38 install --mode=0755 plugins/*.pl $out/bin
39 runHook postInstall
40 '';
41
42 postFixup = ''
43 for f in $out/bin/* ; do
44 wrapProgram $f --set PERL5LIB $PERL5LIB --set LC_ALL C
45 done
46 '';
47
48 doInstallCheck = true;
49 nativeInstallCheckInputs = [ versionCheckHook ];
50 versionCheckProgram = "${placeholder "out"}/bin/check_snmp_int.pl";
51 preVersionCheck = ''
52 version=${builtins.head (lib.splitString "-" version)}
53 '';
54
55 passthru = {
56 updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
57 };
58
59 meta = {
60 changelog = "https://github.com/SteScho/manubulon-snmp/releases/tag/v${version}";
61 description = "Set of Icinga/Nagios plugins to check hosts and hardware with the SNMP protocol";
62 homepage = "https://github.com/SteScho/manubulon-snmp";
63 license = with lib.licenses; [ gpl2Only ];
64 platforms = lib.platforms.unix;
65 maintainers = with lib.maintainers; [ jwillikers ];
66 };
67}