push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
{
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;
};
}

View File

@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4aee99fb..0bb28897 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@ ELSE ()
MESSAGE (FATAL_ERROR "Invalid PYTHON_DESIRED value: " ${PYTHON_DESIRED})
ENDIF()
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from sysconfig import get_path; stdout.write(get_path('purelib'))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+SET(PYTHON_INSTALL_DIR "@PYTHON_INSTALL_DIR@")
MESSAGE(STATUS "Python install dir is ${PYTHON_INSTALL_DIR}")
ADD_SUBDIRECTORY (dnf)

View File

@@ -0,0 +1,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;
};
}