2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, autoreconfHook
|
|
|
|
, avahi
|
|
|
|
, coreutils
|
|
|
|
, fetchurl
|
|
|
|
, freeipmi
|
|
|
|
, gd
|
|
|
|
, i2c-tools
|
|
|
|
, libmodbus
|
|
|
|
, libtool
|
|
|
|
, libusb1
|
|
|
|
, makeWrapper
|
|
|
|
, neon
|
|
|
|
, net-snmp
|
|
|
|
, openssl
|
|
|
|
, pkg-config
|
|
|
|
, substituteAll
|
|
|
|
, systemd
|
|
|
|
, udev
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "nut";
|
2023-03-24 00:07:29 +00:00
|
|
|
version = "2.8.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-03-24 00:07:29 +00:00
|
|
|
url = "https://networkupstools.org/source/${lib.versions.majorMinor version}/${pname}-${version}.tar.gz";
|
2023-07-15 17:15:38 +00:00
|
|
|
sha256 = "sha256-w+WnCNp5e3xwtlPTexIGoAD8tQO4VRn+TN9jU/eSv+U=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
2022-11-21 17:40:18 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./hardcode-paths.patch;
|
|
|
|
avahi = "${avahi}/lib";
|
|
|
|
freeipmi = "${freeipmi}/lib";
|
2023-07-15 17:15:38 +00:00
|
|
|
libusb = "${libusb1}/lib";
|
2022-11-21 17:40:18 +00:00
|
|
|
neon = "${neon}/lib";
|
2023-07-15 17:15:38 +00:00
|
|
|
libmodbus = "${libmodbus}/lib";
|
|
|
|
netsnmp = "${net-snmp.lib}/lib";
|
2022-11-21 17:40:18 +00:00
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
buildInputs = [ neon libusb1 openssl udev avahi freeipmi libmodbus i2c-tools net-snmp gd ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook libtool pkg-config makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags =
|
|
|
|
[ "--with-all"
|
|
|
|
"--with-ssl"
|
|
|
|
"--without-powerman" # Until we have it ...
|
2023-07-15 17:15:38 +00:00
|
|
|
"--with-systemdsystemunitdir=$(out)/lib/systemd/system"
|
|
|
|
"--with-systemdshutdowndir=$(out)/lib/systemd/system-shutdown"
|
|
|
|
"--with-systemdtmpfilesdir=$(out)/lib/tmpfiles.d"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-udev-dir=$(out)/etc/udev"
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
postInstall = ''
|
|
|
|
substituteInPlace $out/lib/systemd/system-shutdown/nutshutdown \
|
|
|
|
--replace /bin/sleep "${coreutils}/bin/sleep" \
|
|
|
|
--replace /bin/systemctl "${systemd}/bin/systemctl"
|
|
|
|
|
|
|
|
for file in system/{nut-monitor.service,nut-driver-enumerator.service,nut-server.service,nut-driver@.service} system-shutdown/nutshutdown; do
|
|
|
|
substituteInPlace $out/lib/systemd/$file \
|
|
|
|
--replace "$out/etc/nut.conf" "/etc/nut.conf"
|
|
|
|
done
|
|
|
|
|
|
|
|
# we don't need init.d scripts
|
|
|
|
rm -r $out/share/solaris-init
|
|
|
|
'';
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Network UPS Tools";
|
|
|
|
longDescription = ''
|
|
|
|
Network UPS Tools is a collection of programs which provide a common
|
|
|
|
interface for monitoring and administering UPS, PDU and SCD hardware.
|
|
|
|
It uses a layered approach to connect all of the parts.
|
|
|
|
'';
|
|
|
|
homepage = "https://networkupstools.org/";
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.pierron ];
|
|
|
|
license = with licenses; [ gpl1Plus gpl2Plus gpl3Plus ];
|
|
|
|
priority = 10;
|
|
|
|
};
|
|
|
|
}
|