about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/dnf4/wrapper.nix
blob: 254bd7f27d2aeb5d18662ee348f31d593d68f362 (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
{ 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;
  };
}