From b66c1ca1852ac68ca8bc5696e830765825bf6923 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Fri, 6 Oct 2023 16:29:13 -0400 Subject: [PATCH 1/2] simpleitk: package cleanup - added changelog - bump lua version - use finalAttrs pattern - improve formatting --- .../libraries/simpleitk/default.nix | 31 ++++++++++++++----- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/simpleitk/default.nix b/pkgs/development/libraries/simpleitk/default.nix index 411622c26a44..c2f75bdd6c26 100644 --- a/pkgs/development/libraries/simpleitk/default.nix +++ b/pkgs/development/libraries/simpleitk/default.nix @@ -1,27 +1,44 @@ -{ lib, stdenv, fetchFromGitHub, cmake, swig4, lua, itk }: +{ lib +, stdenv +, fetchFromGitHub +, cmake +, swig4 +, lua +, itk +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "simpleitk"; version = "2.3.0"; src = fetchFromGitHub { owner = "SimpleITK"; repo = "SimpleITK"; - rev = "refs/tags/v${version}"; + rev = "refs/tags/v${finalAttrs.version}"; hash = "sha256-SJSFJEFu1qKowX5/98MslN7GFDS8aF5+EKkQ2983Azg="; }; - nativeBuildInputs = [ cmake swig4 ]; - buildInputs = [ lua itk ]; + nativeBuildInputs = [ + cmake + swig4 + ]; + buildInputs = [ + lua + itk + ]; # 2.0.0: linker error building examples - cmakeFlags = [ "-DBUILD_EXAMPLES=OFF" "-DBUILD_SHARED_LIBS=ON" ]; + cmakeFlags = [ + "-DBUILD_EXAMPLES=OFF" + "-DBUILD_SHARED_LIBS=ON" + ]; meta = with lib; { homepage = "https://www.simpleitk.org"; description = "Simplified interface to ITK"; + changelog = "https://github.com/SimpleITK/SimpleITK/releases/tag/v${finalAttrs.version}"; maintainers = with maintainers; [ bcdarwin ]; platforms = platforms.linux; license = licenses.asl20; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3288e469ef36..8e3eeb7412e0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25142,7 +25142,7 @@ with pkgs; simp_le = callPackage ../tools/admin/simp_le { }; - simpleitk = callPackage ../development/libraries/simpleitk { lua = lua5_3; }; + simpleitk = callPackage ../development/libraries/simpleitk { lua = lua5_4; }; sioclient = callPackage ../development/libraries/sioclient { }; From 9c90eb4e3f660d298900169f8fe2da914075cf8d Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Sat, 7 Oct 2023 18:30:08 -0400 Subject: [PATCH 2/2] simpleitk: enable SimpleElastix module Note that building SimpleITK with shared libraries had to be disabled when building against Elastix (which doesn't support building with shared libraries for some reason) due to a linker error. However, the Python package correctly builds the needed shared objects. --- pkgs/development/libraries/simpleitk/default.nix | 5 ++++- .../python-modules/simpleitk/default.nix | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/simpleitk/default.nix b/pkgs/development/libraries/simpleitk/default.nix index c2f75bdd6c26..8ef0e5e39a55 100644 --- a/pkgs/development/libraries/simpleitk/default.nix +++ b/pkgs/development/libraries/simpleitk/default.nix @@ -4,6 +4,7 @@ , cmake , swig4 , lua +, elastix , itk }: @@ -23,6 +24,7 @@ stdenv.mkDerivation (finalAttrs: { swig4 ]; buildInputs = [ + elastix lua itk ]; @@ -30,7 +32,8 @@ stdenv.mkDerivation (finalAttrs: { # 2.0.0: linker error building examples cmakeFlags = [ "-DBUILD_EXAMPLES=OFF" - "-DBUILD_SHARED_LIBS=ON" + "-DBUILD_SHARED_LIBS=OFF" + "-DSimpleITK_USE_ELASTIX=ON" ]; meta = with lib; { diff --git a/pkgs/development/python-modules/simpleitk/default.nix b/pkgs/development/python-modules/simpleitk/default.nix index aa8a970364d8..e07e6e994d43 100644 --- a/pkgs/development/python-modules/simpleitk/default.nix +++ b/pkgs/development/python-modules/simpleitk/default.nix @@ -4,6 +4,7 @@ , fetchFromGitHub , cmake , swig4 +, elastix , itk , numpy , simpleitk @@ -20,8 +21,17 @@ buildPythonPackage rec { make ''; - nativeBuildInputs = [ cmake swig4 scikit-build ]; - propagatedBuildInputs = [ itk simpleitk numpy ]; + nativeBuildInputs = [ + cmake + swig4 + scikit-build + ]; + propagatedBuildInputs = [ + elastix + itk + simpleitk + numpy + ]; pythonImportsCheck = [ "SimpleITK" ]; }