From d3ecf9002efc5bc2a2bd85edcce18107a3c5d1f2 Mon Sep 17 00:00:00 2001 From: Paul Meyer <49727155+katexochen@users.noreply.github.com> Date: Sat, 16 Dec 2023 19:33:47 +0100 Subject: [PATCH] dnf4: wrap with plugins --- .../python-modules/dnf4/wrapper.nix | 53 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/dnf4/wrapper.nix diff --git a/pkgs/development/python-modules/dnf4/wrapper.nix b/pkgs/development/python-modules/dnf4/wrapper.nix new file mode 100644 index 000000000000..254bd7f27d2a --- /dev/null +++ b/pkgs/development/python-modules/dnf4/wrapper.nix @@ -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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 84f8fcc4d6b3..ca404948b2a9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };