about summary refs log tree commit diff
path: root/pkgs/applications/graphics/gimp
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2020-11-11 14:33:49 +0100
committerJan Tojnar <jtojnar@gmail.com>2020-11-11 14:41:15 +0100
commitaa96bd294b2ce9852a524e1a88dad2bd50852a0f (patch)
tree84fcd2c6a75844cd70b9472e70c9330b1e760154 /pkgs/applications/graphics/gimp
parentf4c513125dbd0c235697771621bc560f5e90bb64 (diff)
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.
Diffstat (limited to 'pkgs/applications/graphics/gimp')
-rw-r--r--pkgs/applications/graphics/gimp/plugins/default.nix50
-rw-r--r--pkgs/applications/graphics/gimp/wrapper.nix2
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 6a492580f7d3f..84f5abfce0631 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 }:
+
+let
+  inherit (pkgs) stdenv fetchurl pkg-config intltool glib fetchFromGitHub;
+in
+
+lib.makeScope pkgs.newScope (self:
 
-{ config, pkgs, gimp }:
 let
-  inherit (pkgs) stdenv fetchurl pkgconfig intltool glib fetchFromGitHub;
-  inherit (gimp) targetPluginDir targetScriptDir;
+  # 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 841728d3a2946..7e8ce913f0220 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;