14 pyMajor = lib.versions.major python.version;
17 buildPythonPackage rec {
22 outputs = [ "out" "man" "py" ];
24 src = fetchFromGitHub {
25 owner = "rpm-software-management";
28 hash = "sha256-2voBauWXPoHWBt58vZfgpO1oWBDDZ+DvWN6jb5qOzFg=";
32 ./fix-python-install-dir.patch
36 substituteInPlace CMakeLists.txt \
37 --replace "@PYTHON_INSTALL_DIR@" "$out/${python.sitePackages}" \
38 --replace "SYSCONFDIR /etc" "SYSCONFDIR $out/etc" \
39 --replace "SYSTEMD_DIR /usr/lib/systemd/system" "SYSTEMD_DIR $out/lib/systemd/system"
40 substituteInPlace etc/tmpfiles.d/CMakeLists.txt \
41 --replace "DESTINATION /usr/lib/tmpfiles.d" "DESTINATION $out/usr/lib/tmpfiles.d"
42 substituteInPlace dnf/const.py.in \
43 --replace "/etc" "$out/etc" \
44 --replace "/var/tmp" "/tmp"
45 substituteInPlace doc/CMakeLists.txt \
46 --replace 'SPHINX_BUILD_NAME "sphinx-build-3"' 'SPHINX_BUILD_NAME "${sphinx}/bin/sphinx-build"'
55 propagatedBuildInputs = [
62 "-DPYTHON_DESIRED=${pyMajor}"
65 dontWrapPythonPrograms = true;
72 # See https://github.com/rpm-software-management/dnf/blob/41a287e2bd60b4d1100c329a274776ff32ba8740/dnf.spec#L218-L220
73 ln -s dnf-${pyMajor} $out/bin/dnf
74 ln -s dnf-${pyMajor} $out/bin/dnf4
75 mv $out/bin/dnf-automatic-${pyMajor} $out/bin/dnf-automatic
77 # See https://github.com/rpm-software-management/dnf/blob/41a287e2bd60b4d1100c329a274776ff32ba8740/dnf.spec#L231-L232
78 ln -s $out/etc/dnf/dnf.conf $out/etc/yum.conf
79 ln -s dnf-${pyMajor} $out/bin/yum
81 mkdir -p $out/share/bash-completion/completions
82 mv $out/etc/bash_completion.d/dnf-3 $out/share/bash-completion/completions/dnf4
83 ln -s $out/share/bash-completion/completions/dnf4 $out/share/bash-completion/completions/dnf
84 rm -r $out/etc/bash_completion.d
88 moveToOutput "lib/${python.libPrefix}" "$py"
92 description = "Package manager based on libdnf and libsolv. Replaces YUM";
93 homepage = "https://github.com/rpm-software-management/dnf";
94 changelog = "https://github.com/rpm-software-management/dnf/releases/tag/${version}";
95 license = licenses.gpl2Only;
96 maintainers = with maintainers; [ katexochen ];
98 platforms = platforms.unix;