From 7ec9410c6a76d52dd841a4dfd4cf64ce16b1799e Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 11 Feb 2021 01:45:15 +0100 Subject: [PATCH 1/2] gimpPlugins.fourier: fix loading Turns out there was a pre-compiled binary in the tarball, which was installed instead of building our own binary. That means RPATH was not set properly, and the plug-in could not find libgimp. --- .../graphics/gimp/plugins/default.nix | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix index 555bfbe17e7..57ab023359b 100644 --- a/pkgs/applications/graphics/gimp/plugins/default.nix +++ b/pkgs/applications/graphics/gimp/plugins/default.nix @@ -83,15 +83,28 @@ in Filters/Generic/FFT Forward Filters/Generic/FFT Inverse */ - name = "fourier-0.4.3"; - buildInputs = with pkgs; [ fftw ]; + pname = "fourier"; + version = "0.4.3"; src = fetchurl { - url = "https://www.lprp.fr/files/old-web/soft/gimp/${name}.tar.gz"; + url = "https://www.lprp.fr/files/old-web/soft/gimp/${pname}-${version}.tar.gz"; sha256 = "0mf7f8vaqs2madx832x3kcxw3hv3w3wampvzvaps1mkf2kvrjbsn"; }; - installPhase = "installPlugins fourier"; + buildInputs = with pkgs; [ fftw ]; + + postPatch = '' + # The tarball contains a prebuilt binary. + make clean + ''; + + installPhase = '' + runHook preInstall + + installPlugins fourier + + runHook postInstall + ''; meta = with lib; { description = "GIMP plug-in to do the fourier transform"; From 32d3da48bc4a127f3b0e233a5e995a6b8656f258 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 11 Feb 2021 02:11:01 +0100 Subject: [PATCH 2/2] =?UTF-8?q?gimpPlugins:=20Fix=20pluginDerivation?= =?UTF-8?q?=E2=80=99s=20installPlugins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `installPlugins` command installed stuff into directories based on package name but GIMP actually requires the plug-in executable to match the directory, so the plug-ins could not be loaded. https://gitlab.gnome.org/GNOME/gimp/-/commit/efae55a73e98389e38fa0e59ebebcda0abe3ee96 Let’s update `installPlugins` and also rename since the old broken usage had different semantics. Scripts work the old way. --- .../graphics/gimp/plugins/default.nix | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix index 57ab023359b..db3bd494b6b 100644 --- a/pkgs/applications/graphics/gimp/plugins/default.nix +++ b/pkgs/applications/graphics/gimp/plugins/default.nix @@ -23,9 +23,12 @@ let mkdir -p $out/${gimp.targetScriptDir}/${name}; for p in "$@"; do cp "$p" -r $out/${gimp.targetScriptDir}/${name}; done } - installPlugins(){ - mkdir -p $out/${gimp.targetPluginDir}/${name}; - for p in "$@"; do cp "$p" -r $out/${gimp.targetPluginDir}/${name}; done + installPlugin() { + # The base name of the first argument is the plug-in name and the main executable. + # GIMP only allows a single plug-in per directory: + # https://gitlab.gnome.org/GNOME/gimp/-/commit/efae55a73e98389e38fa0e59ebebcda0abe3ee96 + pluginDir=$out/${gimp.targetPluginDir}/$(basename "$1") + install -Dt "$pluginDir" "$@" } ''; @@ -101,7 +104,7 @@ in installPhase = '' runHook preInstall - installPlugins fourier + installPlugin fourier runHook postInstall ''; @@ -144,7 +147,7 @@ in rev = "de4367f71e40fe6d82387eaee68611a80a87e0e1"; sha256 = "1zzvbczly7k456c0y6s92a1i8ph4ywmbvdl8i4rcc29l4qd2z8fw"; }; - installPhase = "installPlugins src/texturize"; + installPhase = "installPlugin src/texturize"; meta.broken = true; # https://github.com/lmanul/gimp-texturize/issues/1 }; @@ -158,7 +161,7 @@ in url = "https://github.com/pixlsus/registry.gimp.org_static/raw/master/registry.gimp.org/files/wavelet-sharpen-0.1.2.tar.gz"; sha256 = "0vql1k67i21g5ivaa1jh56rg427m0icrkpryrhg75nscpirfxxqw"; }; - installPhase = "installPlugins src/wavelet-sharpen"; # TODO translations are not copied .. How to do this on nix? + installPhase = "installPlugin src/wavelet-sharpen"; # TODO translations are not copied .. How to do this on nix? }; lqrPlugin = pluginDerivation rec { @@ -194,7 +197,7 @@ in buildInputs = with pkgs; [ lensfun gexiv2 ]; installPhase = " - installPlugins gimp-lensfun + installPlugin gimp-lensfun "; meta = {