diff --git a/pkgs/tools/graphics/gmic/default.nix b/pkgs/tools/graphics/gmic/default.nix index d077f13fef8f..b1df7fbcc063 100644 --- a/pkgs/tools/graphics/gmic/default.nix +++ b/pkgs/tools/graphics/gmic/default.nix @@ -1,30 +1,30 @@ -{ stdenv -, lib +{ lib +, stdenv , fetchFromGitHub , fetchurl -, cmake -, ninja -, pkg-config -, opencv -, openexr -, graphicsmagick , cimg -, fftw -, zlib -, libjpeg -, libtiff -, libpng -, writeShellScript +, cmake , common-updater-scripts +, coreutils , curl +, fftw +, gmic-qt , gnugrep , gnused -, coreutils +, graphicsmagick , jq -, gmic-qt +, libjpeg +, libpng +, libtiff +, ninja +, opencv +, openexr +, pkg-config +, writeShellScript +, zlib }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "gmic"; version = "3.2.4"; @@ -33,15 +33,15 @@ stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "GreycLab"; repo = "gmic"; - rev = "v.${version}"; + rev = "v.${finalAttrs.version}"; hash = "sha256-ITKsPhfDfkHmE7a04cxrpIKsSVlrPN944ySu2DCnyEU="; }; # TODO: build this from source - # https://github.com/dtschump/gmic/blob/b36b2428db5926af5eea5454f822f369c2d9907e/src/Makefile#L675-L729 + # Reference: src/Makefile, directive gmic_stdlib.h gmic_stdlib = fetchurl { name = "gmic_stdlib.h"; - url = "http://gmic.eu/gmic_stdlib${lib.replaceStrings ["."] [""] version}.h"; + url = "http://gmic.eu/gmic_stdlib${lib.replaceStrings ["."] [""] finalAttrs.version}.h"; hash = "sha256-ExMCxFkkctqrdSy5M/TXD5GBRmRA9YEdsYW8nWiTEYY="; }; @@ -54,13 +54,13 @@ stdenv.mkDerivation rec { buildInputs = [ cimg fftw - zlib + graphicsmagick libjpeg - libtiff libpng + libtiff opencv openexr - graphicsmagick + zlib ]; cmakeFlags = [ @@ -71,47 +71,51 @@ stdenv.mkDerivation rec { ]; postPatch = '' - # TODO: build from source - cp -r ${gmic_stdlib} src/gmic_stdlib.h + cp -r ${finalAttrs.gmic_stdlib} src/gmic_stdlib.h # CMake build files were moved to subdirectory. mv resources/CMakeLists.txt resources/cmake . - '' + lib.optionalString stdenv.isDarwin '' + '' + + lib.optionalString stdenv.isDarwin '' substituteInPlace CMakeLists.txt \ --replace "LD_LIBRARY_PATH" "DYLD_LIBRARY_PATH" ''; passthru = { tests = { - # Needs to update in lockstep. - inherit gmic-qt; + # Needs to update them all in lockstep. + inherit cimg gmic-qt; }; - updateScript = writeShellScript "${pname}-update-script" '' + updateScript = writeShellScript "gmic-update-script" '' set -o errexit - PATH=${lib.makeBinPath [ common-updater-scripts curl gnugrep gnused coreutils jq ]} + PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep gnused jq ]} - latestVersion=$(curl 'https://gmic.eu/files/source/' | grep -E 'gmic_[^"]+\.tar\.gz' | sed -E 's/.+