1{
2 lib,
3 wrapPython,
4 python3,
5 stdenv,
6 dnf-plugins-core,
7 plugins ? [ dnf-plugins-core ],
8}:
9let
10 pluginPaths = map (p: "${p}/${python3.sitePackages}/dnf-plugins") plugins;
11
12 dnf4-unwrapped = python3.pkgs.dnf4;
13in
14
15stdenv.mkDerivation {
16 pname = "dnf4";
17 inherit (dnf4-unwrapped) version;
18
19 outputs = [
20 "out"
21 "man"
22 "py"
23 ];
24
25 dontUnpack = true;
26
27 nativeBuildInputs = [ wrapPython ];
28
29 propagatedBuildInputs = [ dnf4-unwrapped ] ++ plugins;
30
31 makeWrapperArgs = lib.optional (
32 plugins != [ ]
33 ) ''--add-flags "--setopt=pluginpath=${lib.concatStringsSep "," pluginPaths}"'';
34
35 installPhase = ''
36 runHook preInstall
37
38 cp -R ${dnf4-unwrapped} $out
39 cp -R ${dnf4-unwrapped.py} $py
40 cp -R ${dnf4-unwrapped.man} $man
41
42 runHook postInstall
43 '';
44
45 postFixup = ''
46 wrapPythonPrograms
47 '';
48
49 passthru = {
50 unwrapped = dnf4-unwrapped;
51 };
52
53 meta = dnf4-unwrapped.meta // {
54 priority = (dnf4-unwrapped.meta.priority or 0) - 1;
55 };
56}