Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
2.8 kB · 104 lines
Nix
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105{ lib, buildPythonPackage, cmake, fetchFromGitHub, gettext, libcomps, libdnf, python, rpm, sphinx, nix-update-script,}:
let pyMajor = lib.versions.major python.version;in
buildPythonPackage rec { pname = "dnf4"; version = "4.23.0"; format = "other";
outputs = [ "out" "man" "py" ];
src = fetchFromGitHub { owner = "rpm-software-management"; repo = "dnf"; tag = version; hash = "sha256-qlOnFtEURhyxfsprhRaYUj141vZJp8qMjLpP1wGxikw="; };
patches = [ ./fix-python-install-dir.patch ];
postPatch = '' substituteInPlace CMakeLists.txt \ --replace "@PYTHON_INSTALL_DIR@" "$out/${python.sitePackages}" \ --replace "SYSCONFDIR /etc" "SYSCONFDIR $out/etc" \ --replace "SYSTEMD_DIR /usr/lib/systemd/system" "SYSTEMD_DIR $out/lib/systemd/system" substituteInPlace etc/tmpfiles.d/CMakeLists.txt \ --replace "DESTINATION /usr/lib/tmpfiles.d" "DESTINATION $out/usr/lib/tmpfiles.d" substituteInPlace dnf/const.py.in \ --replace "/etc" "$out/etc" \ --replace "/var/tmp" "/tmp" substituteInPlace doc/CMakeLists.txt \ --replace 'SPHINX_BUILD_NAME "sphinx-build-3"' 'SPHINX_BUILD_NAME "${sphinx}/bin/sphinx-build"' '';
nativeBuildInputs = [ cmake gettext sphinx ];
propagatedBuildInputs = [ libcomps libdnf rpm ];
cmakeFlags = [ "-DPYTHON_DESIRED=${pyMajor}" ];
dontWrapPythonPrograms = true;
postBuild = '' make doc-man '';
postInstall = '' # See https://github.com/rpm-software-management/dnf/blob/41a287e2bd60b4d1100c329a274776ff32ba8740/dnf.spec#L218-L220 ln -s dnf-${pyMajor} $out/bin/dnf ln -s dnf-${pyMajor} $out/bin/dnf4 mv $out/bin/dnf-automatic-${pyMajor} $out/bin/dnf-automatic
# See https://github.com/rpm-software-management/dnf/blob/41a287e2bd60b4d1100c329a274776ff32ba8740/dnf.spec#L231-L232 ln -s $out/etc/dnf/dnf.conf $out/etc/yum.conf ln -s dnf-${pyMajor} $out/bin/yum
mkdir -p $out/share/bash-completion/completions mv $out/etc/bash_completion.d/dnf-3 $out/share/bash-completion/completions/dnf4 ln -s $out/share/bash-completion/completions/dnf4 $out/share/bash-completion/completions/dnf rm -r $out/etc/bash_completion.d '';
postFixup = '' moveToOutput "lib/${python.libPrefix}" "$py" '';
passthru.updateScript = nix-update-script { };
meta = with lib; { description = "Package manager based on libdnf and libsolv. Replaces YUM"; homepage = "https://github.com/rpm-software-management/dnf"; changelog = "https://github.com/rpm-software-management/dnf/releases/tag/${version}"; license = licenses.gpl2Only; maintainers = with maintainers; [ katexochen ]; mainProgram = "dnf"; platforms = platforms.unix; };}