From d43eae54d3e1b64e67dcd4806962cd4a7e6c33c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Tue, 13 Aug 2024 12:21:00 +0200 Subject: [PATCH 1/2] nut: 2.8.0 -> 2.8.2 * nut wants to build the new GPIO driver by default. Our libgpiod version isn't compatible and configure fails with checking for libgpiod version via pkg-config (1.0.0 minimum required)... 2.1.3 found checking for libgpiod cflags... -I/nix/store/igaf4d9zr8nmmk91icf7f2w0mw23238p-libgpiod-2.1.3/include checking for libgpiod ldflags... -L/nix/store/igaf4d9zr8nmmk91icf7f2w0mw23238p-libgpiod-2.1.3/lib -lgpiod checking for gpiod.h... yes checking for gpiod_chip_open_by_name... no checking for gpiod_chip_close... yes [...] configure: error: No supported GPIO library was found, required for GPIO driver So disable that for now. * Refresh our search path patch. * solaris-init doesn't exist in the output anymore, so we can remove the removal. --- pkgs/applications/misc/nut/default.nix | 8 +++----- pkgs/applications/misc/nut/hardcode-paths.patch | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/misc/nut/default.nix b/pkgs/applications/misc/nut/default.nix index a574520a5af6..b2ed55eb16ca 100644 --- a/pkgs/applications/misc/nut/default.nix +++ b/pkgs/applications/misc/nut/default.nix @@ -23,11 +23,11 @@ stdenv.mkDerivation rec { pname = "nut"; - version = "2.8.0"; + version = "2.8.2"; src = fetchurl { url = "https://networkupstools.org/source/${lib.versions.majorMinor version}/${pname}-${version}.tar.gz"; - sha256 = "sha256-w+WnCNp5e3xwtlPTexIGoAD8tQO4VRn+TN9jU/eSv+U="; + sha256 = "sha256-5LSwy+fdObqQl75/fXh7sv/74132Tf9Ttf45PWWcWX0="; }; patches = [ @@ -56,6 +56,7 @@ stdenv.mkDerivation rec { configureFlags = [ "--with-all" "--with-ssl" + "--without-gpio" "--without-powerman" # Until we have it ... "--with-systemdsystemunitdir=$(out)/lib/systemd/system" "--with-systemdshutdowndir=$(out)/lib/systemd/system-shutdown" @@ -83,9 +84,6 @@ stdenv.mkDerivation rec { substituteInPlace $out/lib/systemd/system/nut-driver-enumerator.path \ --replace "$out/etc/ups.conf" "/etc/nut/ups.conf" - # we don't need init.d scripts - rm -r $out/share/solaris-init - # Suspicious/overly broad rule, remove it until we know better rm $out/etc/udev/rules.d/52-nut-ipmipsu.rules ''; diff --git a/pkgs/applications/misc/nut/hardcode-paths.patch b/pkgs/applications/misc/nut/hardcode-paths.patch index a58d402a2058..b2d0a55fb56a 100644 --- a/pkgs/applications/misc/nut/hardcode-paths.patch +++ b/pkgs/applications/misc/nut/hardcode-paths.patch @@ -1,9 +1,9 @@ --- a/common/common.c +++ b/common/common.c -@@ -991,6 +991,12 @@ ssize_t select_write(const int fd, const void *buf, const size_t buflen, const t +@@ -1990,6 +1990,12 @@ ssize_t select_write(serial_handler_t *fd, const void *buf, const size_t buflen, * communications media and/or vendor protocol. */ - static const char * search_paths[] = { + static const char * search_paths_builtin[] = { + "@avahi@", + "@freeipmi@", + "@libusb@", @@ -12,4 +12,4 @@ + "@netsnmp@", /* Use the library path (and bitness) provided during ./configure first */ LIBDIR, - "/usr"LIBDIR, + "/usr"LIBDIR, /* Note: this can lead to bogus strings like */ From a2b8dba362810c9312b65fa2eeb351d66003fd01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Wed, 21 Aug 2024 23:06:23 +0200 Subject: [PATCH 2/2] nut: enable the GPIO driver NUT wants to build it by default, so allow it. It works with libgpiod_1, not libgpiod. The closure size increases from 365 MiB to 366 MiB. --- pkgs/applications/misc/nut/default.nix | 5 +++-- pkgs/applications/misc/nut/hardcode-paths.patch | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/misc/nut/default.nix b/pkgs/applications/misc/nut/default.nix index b2ed55eb16ca..cded819dbb5b 100644 --- a/pkgs/applications/misc/nut/default.nix +++ b/pkgs/applications/misc/nut/default.nix @@ -7,6 +7,7 @@ , freeipmi , gd , i2c-tools +, libgpiod_1 , libmodbus , libtool , libusb1 @@ -42,6 +43,7 @@ stdenv.mkDerivation rec { src = ./hardcode-paths.patch; avahi = "${avahi}/lib"; freeipmi = "${freeipmi}/lib"; + libgpiod = "${libgpiod_1}/lib"; libusb = "${libusb1}/lib"; neon = "${neon}/lib"; libmodbus = "${libmodbus}/lib"; @@ -49,14 +51,13 @@ stdenv.mkDerivation rec { }) ]; - buildInputs = [ neon libusb1 openssl udev avahi freeipmi libmodbus libtool i2c-tools net-snmp gd ]; + buildInputs = [ neon libusb1 openssl udev avahi freeipmi libgpiod_1 libmodbus libtool i2c-tools net-snmp gd ]; nativeBuildInputs = [ autoreconfHook pkg-config makeWrapper ]; configureFlags = [ "--with-all" "--with-ssl" - "--without-gpio" "--without-powerman" # Until we have it ... "--with-systemdsystemunitdir=$(out)/lib/systemd/system" "--with-systemdshutdowndir=$(out)/lib/systemd/system-shutdown" diff --git a/pkgs/applications/misc/nut/hardcode-paths.patch b/pkgs/applications/misc/nut/hardcode-paths.patch index b2d0a55fb56a..2a85644358c9 100644 --- a/pkgs/applications/misc/nut/hardcode-paths.patch +++ b/pkgs/applications/misc/nut/hardcode-paths.patch @@ -1,11 +1,12 @@ --- a/common/common.c +++ b/common/common.c -@@ -1990,6 +1990,12 @@ ssize_t select_write(serial_handler_t *fd, const void *buf, const size_t buflen, +@@ -1990,6 +1990,13 @@ ssize_t select_write(serial_handler_t *fd, const void *buf, const size_t buflen, * communications media and/or vendor protocol. */ static const char * search_paths_builtin[] = { + "@avahi@", + "@freeipmi@", ++ "@libgpiod@", + "@libusb@", + "@neon@", + "@libmodbus@",