From 7946d711304e82baa1077687ead8b63cdb51320f Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Sun, 8 Dec 2024 11:16:25 +0800 Subject: [PATCH 1/2] galario: nixfmt --- pkgs/by-name/ga/galario/package.nix | 43 +++++++++++++++++++---------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/pkgs/by-name/ga/galario/package.nix b/pkgs/by-name/ga/galario/package.nix index add2445f4462..56476ed562ea 100644 --- a/pkgs/by-name/ga/galario/package.nix +++ b/pkgs/by-name/ga/galario/package.nix @@ -1,12 +1,14 @@ -{ lib, stdenv -, fetchzip -, fetchFromGitHub -, cmake -, fftw -, fftwFloat -, enablePython ? false -, pythonPackages ? null -, llvmPackages +{ + lib, + stdenv, + fetchzip, + fetchFromGitHub, + cmake, + fftw, + fftwFloat, + enablePython ? false, + pythonPackages ? null, + llvmPackages, }: let # CMake recipes are needed to build galario @@ -29,10 +31,13 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; - buildInputs = [ fftw fftwFloat ] - ++ lib.optional enablePython pythonPackages.python - ++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp - ; + buildInputs = + [ + fftw + fftwFloat + ] + ++ lib.optional enablePython pythonPackages.python + ++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp; propagatedBuildInputs = lib.optionals enablePython [ pythonPackages.numpy @@ -40,7 +45,10 @@ stdenv.mkDerivation rec { pythonPackages.pytest ]; - nativeCheckInputs = lib.optionals enablePython [ pythonPackages.scipy pythonPackages.pytest-cov ]; + nativeCheckInputs = lib.optionals enablePython [ + pythonPackages.scipy + pythonPackages.pytest-cov + ]; preConfigure = '' mkdir -p build/external/src @@ -49,7 +57,12 @@ stdenv.mkDerivation rec { ''; preCheck = '' - ${if stdenv.hostPlatform.isDarwin then "export DYLD_LIBRARY_PATH=$(pwd)/src/" else "export LD_LIBRARY_PATH=$(pwd)/src/"} + ${ + if stdenv.hostPlatform.isDarwin then + "export DYLD_LIBRARY_PATH=$(pwd)/src/" + else + "export LD_LIBRARY_PATH=$(pwd)/src/" + } ${lib.optionalString enablePython "sed -i -e 's|^#!.*|#!${stdenv.shell}|' python/py.test.sh"} ''; From 045655252364935ab1db76d177c46619c7016bb1 Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Sun, 8 Dec 2024 11:47:33 +0800 Subject: [PATCH 2/2] python312Packagesgalario: fix build --- pkgs/by-name/ga/galario/package.nix | 30 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/ga/galario/package.nix b/pkgs/by-name/ga/galario/package.nix index 56476ed562ea..d601722efab4 100644 --- a/pkgs/by-name/ga/galario/package.nix +++ b/pkgs/by-name/ga/galario/package.nix @@ -10,23 +10,24 @@ pythonPackages ? null, llvmPackages, }: + let # CMake recipes are needed to build galario # Build process would usually download them great-cmake-cookoff = fetchzip { url = "https://github.com/UCL/GreatCMakeCookOff/archive/v2.1.9.tar.gz"; - sha256 = "1yd53b5gx38g6f44jmjk4lc4igs3p25z6616hfb7aq79ly01q0w2"; + hash = "sha256-ggMcgKfpYHWWgyYY84u4Q79IGCVTVkmIMw+N/soapfk="; }; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs:{ pname = "galario"; version = "1.2.2"; src = fetchFromGitHub { owner = "mtazzari"; - repo = pname; - rev = "v${version}"; - sha256 = "0dw88ga50x3jwyfgcarn4azlhiarggvdg262hilm7rbrvlpyvha0"; + repo = "galario"; + tag = "v${finalAttrs.version}"; + hash = "sha256-QMHtL9155VNphMKI1/Z7WUVIvyI2K/ac53J0UNRDiDc="; }; nativeBuildInputs = [ cmake ]; @@ -41,10 +42,17 @@ stdenv.mkDerivation rec { propagatedBuildInputs = lib.optionals enablePython [ pythonPackages.numpy - pythonPackages.cython + pythonPackages.cython_0 + pythonPackages.distutils pythonPackages.pytest ]; + postPatch = '' + substituteInPlace python/utils.py \ + --replace-fail "trapz" "trapezoid" \ + --replace-fail "np.int" "int" + ''; + nativeCheckInputs = lib.optionals enablePython [ pythonPackages.scipy pythonPackages.pytest-cov @@ -78,7 +86,7 @@ stdenv.mkDerivation rec { install_name_tool -change libgalario_single.dylib $out/lib/libgalario_single.dylib $out/lib/python*/site-packages/galario/single/libcommon.so ''; - meta = with lib; { + meta = { description = "GPU Accelerated Library for Analysing Radio Interferometer Observations"; longDescription = '' Galario is a library that exploits the computing power of modern @@ -89,8 +97,8 @@ stdenv.mkDerivation rec { comparison to the observations. ''; homepage = "https://mtazzari.github.io/galario/"; - license = licenses.lgpl3; - maintainers = [ maintainers.smaret ]; - platforms = platforms.all; + license = lib.licenses.lgpl3; + maintainers = [ lib.maintainers.smaret ]; + platforms = lib.platforms.all; }; -} +})