about summary refs log tree commit diff
path: root/pkgs/development/python-modules/dnf4/wrapper.nix
blob: c8cd1c1c261dd13f6f34e5d4a1e12739503dbca3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
  lib,
  wrapPython,
  python,
  stdenv,
  dnf4,
  dnf-plugins-core,
  plugins ? [ dnf-plugins-core ],
}:
let
  pluginPaths = map (p: "${p}/${python.sitePackages}/dnf-plugins") plugins;

  dnf4-unwrapped = 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 lib.meta.defaultPriority) - 1;
  };
}