From ec405dc47448ce6f723433f785382129afe64ca2 Mon Sep 17 00:00:00 2001 From: Moritz Sanft <58110325+msanft@users.noreply.github.com> Date: Mon, 6 Jan 2025 11:52:09 +0100 Subject: [PATCH] rpm: add a disableUnshare option Add an option to disable the unshare RPM plugin. Enabling it hinders execution within the Nix sandbox. While plain RPM invocations can use `--noplugins` and friends, many consumers like `tdnf` do not expose such a knob for enabling / disabling RPM options. Thus, add an easy interface to disable the plugin via Nix. --- pkgs/tools/package-management/rpm/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/tools/package-management/rpm/default.nix b/pkgs/tools/package-management/rpm/default.nix index 3f266c11bdfb..ff427b7e4fc9 100644 --- a/pkgs/tools/package-management/rpm/default.nix +++ b/pkgs/tools/package-management/rpm/default.nix @@ -29,6 +29,10 @@ bubblewrap, autoconf, gnupg, + + # Disable the unshare RPM plugin, which can be useful if + # RPM is ran within the Nix sandbox. + disableUnshare ? true, }: stdenv.mkDerivation rec { @@ -112,6 +116,9 @@ stdenv.mkDerivation rec { ++ lib.optionals stdenv.hostPlatform.isDarwin [ "-DWITH_LIBELF=OFF" "-DWITH_LIBDW=OFF" + ] + ++ lib.optionals disableUnshare [ + "-DHAVE_UNSHARE=OFF" ]; # rpm/rpmlib.h includes popt.h, and then the pkg-config file mentions these as linkage requirements