depot/pkgs/development/python-modules/dnf4/wrapper.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

57 lines
1,002 B
Nix

{
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;
};
}