dnf4: wrap with plugins

This commit is contained in:
Paul Meyer 2023-12-16 19:33:47 +01:00
parent 64365bbfce
commit d3ecf9002e
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,53 @@
{ lib
, wrapPython
, python3
, stdenv
, dnf-plugins-core
, plugins ? [ dnf-plugins-core ]
}:
let
pluginPaths = map (p: "${p}/${python3.sitePackages}/dnf-plugins") plugins;
dnf4-unwrapped = python3.pkgs.dnf4;
in
stdenv.mkDerivation {
pname = "dnf4";
inherit (dnf4-unwrapped) version;
outputs = [ "out" "man" "py" ];
dontUnpack = true;
nativeBuildInputs = [
wrapPython
];
propagatedBuildInputs = [
dnf4-unwrapped
] ++ plugins;
makeWrapperArgs = lib.optional (plugins != [ ]) ''--add-flags "--setopt=pluginpath=${lib.concatStringsSep "," pluginPaths}"'';
installPhase = ''
runHook preInstall
cp -R ${dnf4-unwrapped} $out
cp -R ${dnf4-unwrapped.py} $py
cp -R ${dnf4-unwrapped.man} $man
runHook postInstall
'';
postFixup = ''
wrapPythonPrograms
'';
passthru = {
unwrapped = dnf4-unwrapped;
};
meta = dnf4-unwrapped.meta // {
priority = (dnf4-unwrapped.meta.priority or 0) - 1;
};
}

View File

@ -619,7 +619,7 @@ with pkgs;
dnf-plugins-core = with python3Packages; toPythonApplication dnf-plugins-core;
dnf4 = with python3Packages; toPythonApplication dnf4;
dnf4 = python3Packages.callPackage ../development/python-modules/dnf4/wrapper.nix { };
dnf5 = callPackage ../tools/package-management/dnf5 { };