From 3000a0f87e5574fdaed7e3209f6815bac08d8cd4 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 10 Nov 2020 23:57:44 +0100 Subject: [PATCH 1/4] gimp: expose gimpdatadir & gimplibdir --- pkgs/applications/graphics/gimp/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/graphics/gimp/default.nix b/pkgs/applications/graphics/gimp/default.nix index 025f97b54e6..4ba7cb8eb03 100644 --- a/pkgs/applications/graphics/gimp/default.nix +++ b/pkgs/applications/graphics/gimp/default.nix @@ -163,8 +163,10 @@ in stdenv.mkDerivation rec { # The declarations for `gimp-with-plugins` wrapper, # used for determining plug-in installation paths majorVersion = "${lib.versions.major version}.0"; - targetPluginDir = "lib/gimp/${majorVersion}/plug-ins"; - targetScriptDir = "share/gimp/${majorVersion}/scripts"; + targetLibDir = "lib/gimp/${majorVersion}"; + targetDataDir = "share/gimp/${majorVersion}"; + targetPluginDir = "${targetLibDir}/plug-ins"; + targetScriptDir = "${targetDataDir}/scripts"; # probably its a good idea to use the same gtk in plugins ? gtk = gtk2; From a84a2de0aece7e1a4ee6a95567100426745048dd Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 11 Nov 2020 00:14:16 +0100 Subject: [PATCH 2/4] gimpPlugins: clean up using gimp.targetLibDir --- .../graphics/gimp/plugins/default.nix | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix index b78350ae4d3..dae498d99a0 100644 --- a/pkgs/applications/graphics/gimp/plugins/default.nix +++ b/pkgs/applications/graphics/gimp/plugins/default.nix @@ -8,8 +8,8 @@ let inherit (pkgs) stdenv fetchurl pkgconfig intltool glib fetchFromGitHub; inherit (gimp) targetPluginDir targetScriptDir; - pluginDerivation = a: let - name = a.name or "${a.pname}-${a.version}"; + pluginDerivation = attrs: let + name = attrs.name or "${attrs.pname}-${attrs.version}"; in stdenv.mkDerivation ({ prePhases = "extraLib"; extraLib = '' @@ -22,12 +22,16 @@ let for p in "$@"; do cp "$p" -r $out/${targetPluginDir}/${name}; done } ''; + + # Override installation paths. + PKG_CONFIG_GIMP_2_0_GIMPLIBDIR = "${placeholder "out"}/${gimp.targetLibDir}"; + PKG_CONFIG_GIMP_2_0_GIMPDATADIR = "${placeholder "out"}/${gimp.targetDataDir}"; } - // a + // attrs // { name = "gimp-plugin-${name}"; - buildInputs = [ gimp gimp.gtk glib ] ++ (a.buildInputs or []); - nativeBuildInputs = [ pkgconfig intltool ] ++ (a.nativeBuildInputs or []); + buildInputs = [ gimp gimp.gtk glib ] ++ (attrs.buildInputs or []); + nativeBuildInputs = [ pkgconfig intltool ] ++ (attrs.nativeBuildInputs or []); } ); @@ -49,10 +53,6 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; { sha256 = "1jic7ixcmsn4kx2cn32nc5087rk6g8xsrz022xy11yfmgvhzb0ql"; }; NIX_LDFLAGS = "-lm"; - patchPhase = '' - sed -e 's,^\(GIMP_PLUGIN_DIR=\).*,\1'"$out/${gimp.name}-plugins", \ - -e 's,^\(GIMP_DATA_DIR=\).*,\1'"$out/share/${gimp.name}", -i configure - ''; hardeningDisable = [ "format" ]; meta = with stdenv.lib; { description = "The GIMP Animation Package"; @@ -99,7 +99,7 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; { version = "2.0.3"; buildInputs = with pkgs; [ fftw ]; nativeBuildInputs = with pkgs; [ autoreconfHook ]; - makeFlags = [ "GIMP_LIBDIR=${placeholder "out"}/lib/gimp/2.0" ]; + makeFlags = [ "GIMP_LIBDIR=${placeholder "out"}/${gimp.targetLibDir}" ]; src = fetchFromGitHub { owner = "bootchk"; repo = "resynthesizer"; From f4c513125dbd0c235697771621bc560f5e90bb64 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 11 Nov 2020 00:16:39 +0100 Subject: [PATCH 3/4] =?UTF-8?q?gimpPlugins.lqrPlugin:=200.7.1=20=E2=86=92?= =?UTF-8?q?=200.7.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/carlobaldassi/gimp-lqr-plugin/compare/v0.7.1...v0.7.2 Also switch to GitHub upstream and use installPhase from generic builder (thanks to the pkg-config variables). --- pkgs/applications/graphics/gimp/plugins/default.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix index dae498d99a0..6a492580f7d 100644 --- a/pkgs/applications/graphics/gimp/plugins/default.nix +++ b/pkgs/applications/graphics/gimp/plugins/default.nix @@ -138,14 +138,14 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; { Layer/Liquid Rescale */ pname = "lqr-plugin"; - version = "0.7.1"; + version = "0.7.2"; buildInputs = with pkgs; [ liblqr1 ]; - src = fetchurl { - url = "https://github.com/pixlsus/registry.gimp.org_static/raw/master/registry.gimp.org/files/gimp-lqr-plugin-${version}.tar.bz2"; - sha256 = "sha256-YpgYPjHZkueJWS51QGmugXavGS+1x4o20St31qoRng4="; + src = fetchFromGitHub { + owner = "carlobaldassi"; + repo = "gimp-lqr-plugin"; + rev = "v${version}"; + sha256 = "81ajdZ2zQi/THxnBlSeT36tVTEzrS1YqLGpHMhFTKAo="; }; - #postInstall = ''mkdir -p $out/nix-support; echo "${liblqr1}" > "$out/nix-support/propagated-user-env-packages"''; - installPhase = "installPlugins src/gimp-lqr-plugin"; }; gmic = pkgs.gmic-qt.override { From aa96bd294b2ce9852a524e1a88dad2bd50852a0f Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 11 Nov 2020 14:33:49 +0100 Subject: [PATCH 4/4] gimpPlugins: include GIMP into the scope So that it can be easily overridden. Also clean up, update usage comment for this century and remove alias. --- .../graphics/gimp/plugins/default.nix | 50 +++++++++++-------- pkgs/applications/graphics/gimp/wrapper.nix | 2 +- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix index 6a492580f7d..84f5abfce06 100644 --- a/pkgs/applications/graphics/gimp/plugins/default.nix +++ b/pkgs/applications/graphics/gimp/plugins/default.nix @@ -1,12 +1,18 @@ -# install these packages into your profile. Then add -# ~/.nix-profile/gimp-version-plugins to your plugin list you can find at -# preferences -> Folders -> Plug-ins -# same applies for the scripts +# Use `gimp-with-plugins` package for GIMP with all plug-ins. +# If you just want a subset of plug-ins, you can specify them explicitly: +# `gimp-with-plugins.override { plugins = with gimpPlugins; [ gap ]; }`. + +{ config, lib, pkgs }: -{ config, pkgs, gimp }: let - inherit (pkgs) stdenv fetchurl pkgconfig intltool glib fetchFromGitHub; - inherit (gimp) targetPluginDir targetScriptDir; + inherit (pkgs) stdenv fetchurl pkg-config intltool glib fetchFromGitHub; +in + +lib.makeScope pkgs.newScope (self: + +let + # Use GIMP from the scope. + inherit (self) gimp; pluginDerivation = attrs: let name = attrs.name or "${attrs.pname}-${attrs.version}"; @@ -14,12 +20,12 @@ let prePhases = "extraLib"; extraLib = '' installScripts(){ - mkdir -p $out/${targetScriptDir}/${name}; - for p in "$@"; do cp "$p" -r $out/${targetScriptDir}/${name}; done + mkdir -p $out/${gimp.targetScriptDir}/${name}; + for p in "$@"; do cp "$p" -r $out/${gimp.targetScriptDir}/${name}; done } installPlugins(){ - mkdir -p $out/${targetPluginDir}/${name}; - for p in "$@"; do cp "$p" -r $out/${targetPluginDir}/${name}; done + mkdir -p $out/${gimp.targetPluginDir}/${name}; + for p in "$@"; do cp "$p" -r $out/${gimp.targetPluginDir}/${name}; done } ''; @@ -30,8 +36,16 @@ let // attrs // { name = "gimp-plugin-${name}"; - buildInputs = [ gimp gimp.gtk glib ] ++ (attrs.buildInputs or []); - nativeBuildInputs = [ pkgconfig intltool ] ++ (attrs.nativeBuildInputs or []); + buildInputs = [ + gimp + gimp.gtk + glib + ] ++ (attrs.buildInputs or []); + + nativeBuildInputs = [ + pkg-config + intltool + ] ++ (attrs.nativeBuildInputs or []); } ); @@ -39,10 +53,11 @@ let phases = [ "extraLib" "installPhase" ]; installPhase = "installScripts ${src}"; } // attrs); - in +{ + # Allow overriding GIMP package in the scope. + inherit (pkgs) gimp; -stdenv.lib.makeScope pkgs.newScope (self: with self; { gap = pluginDerivation { /* menu: Video @@ -201,9 +216,4 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; { sha256 = "c14a8f4f709695ede3f77348728a25b3f3ded420da60f3f8de3944b7eae98a49"; }; }; - -} // stdenv.lib.optionalAttrs (config.allowAliases or true) { - - resynthesizer2 = resynthesizer; - }) diff --git a/pkgs/applications/graphics/gimp/wrapper.nix b/pkgs/applications/graphics/gimp/wrapper.nix index 841728d3a29..7e8ce913f02 100644 --- a/pkgs/applications/graphics/gimp/wrapper.nix +++ b/pkgs/applications/graphics/gimp/wrapper.nix @@ -2,7 +2,7 @@ let allPlugins = lib.filter (pkg: lib.isDerivation pkg && !pkg.meta.broken or false) (lib.attrValues gimpPlugins); -selectedPlugins = if plugins == null then allPlugins else plugins; +selectedPlugins = lib.filter (pkg: pkg != gimpPlugins.gimp) (if plugins == null then allPlugins else plugins); extraArgs = map (x: x.wrapArgs or "") selectedPlugins; versionBranch = stdenv.lib.versions.majorMinor gimp.version;