From 9c1b7551e61a397f5b9066061e5dae248b9583e1 Mon Sep 17 00:00:00 2001 From: qbisi Date: Sun, 20 Apr 2025 01:33:32 +0800 Subject: [PATCH] kahip: init at 3.18 --- pkgs/by-name/ka/kahip/package.nix | 66 ++++++++++++++++++++++++++++++ pkgs/top-level/python-packages.nix | 7 ++++ 2 files changed, 73 insertions(+) create mode 100644 pkgs/by-name/ka/kahip/package.nix diff --git a/pkgs/by-name/ka/kahip/package.nix b/pkgs/by-name/ka/kahip/package.nix new file mode 100644 index 000000000000..19b79ba4ac33 --- /dev/null +++ b/pkgs/by-name/ka/kahip/package.nix @@ -0,0 +1,66 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch2, + cmake, + mpi, + metis, + python3Packages, + pythonSupport ? false, + isILP64 ? false, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "kahip"; + version = "3.18"; + + src = fetchFromGitHub { + owner = "KaHIP"; + repo = "KaHIP"; + tag = "v${finalAttrs.version}"; + hash = "sha256-l8DhVb2G6pQQcH3Wq4NsKw30cSK3sG+gCYRdpibw4ZI="; + }; + + patches = [ + (fetchpatch2 { + url = "https://github.com/KaHIP/KaHIP/commit/9d4978c7540a1ccbc9807367d6e3852114e86567.patch?full_index=1"; + hash = "sha256-nIJL0YmVp9+JUhzEXjoabD1qNEnhtrBnjMWnitYt0eU="; + }) + ]; + + nativeBuildInputs = + [ cmake ] + ++ lib.optionals pythonSupport [ + python3Packages.python + python3Packages.pybind11 + ]; + + buildInputs = [ + mpi + metis + ]; + + cmakeFlags = [ + (lib.cmakeBool "64BITMODE" isILP64) + (lib.cmakeBool "BUILDPYTHONMODULE" pythonSupport) + (lib.cmakeFeature "CMAKE_INSTALL_PYTHONDIR" python3Packages.python.sitePackages) + ]; + + doInstallCheck = pythonSupport; + + nativeInstallCheckInputs = lib.optionals pythonSupport [ + python3Packages.pythonImportsCheckHook + ]; + + pythonImportsCheck = [ "kahip" ]; + + meta = { + homepage = "https://kahip.github.io/"; + downloadPage = "https://github.com/KaHIP/KaHIP/"; + changelog = "https://github.com/KaHIP/KaHIP/releases/tag/v${finalAttrs.version}"; + description = "Karlsruhe HIGH Quality Partitioning"; + license = lib.licenses.mit; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ qbisi ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6a6a77d1ea23..09101e8f6d0b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7282,6 +7282,13 @@ self: super: with self; { kaggle = callPackage ../development/python-modules/kaggle { }; + kahip = toPythonModule ( + pkgs.kahip.override { + pythonSupport = true; + python3Packages = self; + } + ); + kaitaistruct = callPackage ../development/python-modules/kaitaistruct { }; kajiki = callPackage ../development/python-modules/kajiki { };