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.
This commit is contained in:
Moritz Sanft
2025-01-07 11:47:04 +01:00
parent 9bb668a703
commit ec405dc474
@@ -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