1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
{ lib
, stdenv
, perlPackages
, fetchFromGitHub
, makeWrapper
, shortenPerlShebang
, coreutils
, dmidecode
, findutils
, inetutils
, ipmitool
, iproute2
, lvm2
, nmap
, pciutils
, usbutils
, util-linux
, testers
, ocsinventory-agent
, nix-update-script
}:
perlPackages.buildPerlPackage rec {
version = "2.10.1";
pname = "ocsinventory-agent";
src = fetchFromGitHub {
owner = "OCSInventory-NG";
repo = "UnixAgent";
rev = "refs/tags/v${version}-MAC";
hash = "sha256-aFzBrUsVttUhpYGEYd/yYuXmE90PGCiBmBsVjtHcHLg=";
};
nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.isDarwin shortenPerlShebang;
buildInputs = with perlPackages; [
perl
DataUUID
IOCompress
IOSocketSSL
LWP
LWPProtocolHttps
NetIP
NetNetmask
NetSNMP
ParseEDID
ProcDaemon
ProcPIDFile
XMLSimple
] ++ lib.optionals stdenv.isLinux (with perlPackages; [
NetCUPS # cups-filters is broken on darwin
]) ++ lib.optionals stdenv.isDarwin (with perlPackages; [
MacSysProfile
]);
postInstall = let
runtimeDependencies = [
coreutils # uname, cut, df, stat, uptime
findutils # find
inetutils # ifconfig
ipmitool # ipmitool
nmap # nmap
pciutils # lspci
] ++ lib.optionals stdenv.isLinux [
dmidecode # dmidecode
iproute2 # ip
lvm2 # pvs
usbutils # lsusb
util-linux # last, lsblk, mount
];
in lib.optionalString stdenv.isDarwin ''
shortenPerlShebang $out/bin/ocsinventory-agent
'' + ''
wrapProgram $out/bin/ocsinventory-agent --prefix PATH : ${lib.makeBinPath runtimeDependencies}
'';
passthru = {
tests.version = testers.testVersion {
package = ocsinventory-agent;
command = "ocsinventory-agent --version";
# upstream has not updated version in lib/Ocsinventory/Agent/Config.pm
version = "2.10.0";
};
updateScript = nix-update-script { };
};
meta = with lib; {
description = "OCS Inventory unified agent for Unix operating systems";
longDescription = ''
Open Computers and Software Inventory (OCS) is an application designed
to help a network or system administrator to keep track of the hardware and
software configurations of computers that are installed on the network.
'';
homepage = "https://ocsinventory-ng.org";
changelog = "https://github.com/OCSInventory-NG/UnixAgent/releases/tag/v${version}";
downloadPage = "https://github.com/OCSInventory-NG/UnixAgent/releases";
license = licenses.gpl2Only;
mainProgram = "ocsinventory-agent";
maintainers = with maintainers; [ totoroot anthonyroussel ];
platforms = platforms.unix;
};
}
|