about summary refs log tree commit diff
path: root/pkgs/development/python-modules/dnf4/wrapper.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/dnf4/wrapper.nix')
-rw-r--r--pkgs/development/python-modules/dnf4/wrapper.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/dnf4/wrapper.nix b/pkgs/development/python-modules/dnf4/wrapper.nix
new file mode 100644
index 0000000000000..254bd7f27d2ae
--- /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;
+  };
+}