summary refs log tree commit diff
path: root/pkgs/applications/graphics/gimp/wrapper.nix
diff options
context:
space:
mode:
authorAlexander V. Nikolaev <avn@avnik.info>2016-02-25 23:24:45 +0200
committerAlexander V. Nikolaev <avn@avnik.info>2016-02-25 23:34:28 +0200
commit0649c8bde74d5e0e2036a66f0cab72b9de777617 (patch)
tree2778f2c8ce087e0a8b362a2fc164d2823ffad014 /pkgs/applications/graphics/gimp/wrapper.nix
parentfdd11c2c2b95e721c134c7cd5f6d2e92da62aff5 (diff)
downloadnixpkgs-0649c8bde74d5e0e2036a66f0cab72b9de777617.tar
nixpkgs-0649c8bde74d5e0e2036a66f0cab72b9de777617.tar.gz
nixpkgs-0649c8bde74d5e0e2036a66f0cab72b9de777617.tar.bz2
nixpkgs-0649c8bde74d5e0e2036a66f0cab72b9de777617.tar.lz
nixpkgs-0649c8bde74d5e0e2036a66f0cab72b9de777617.tar.xz
nixpkgs-0649c8bde74d5e0e2036a66f0cab72b9de777617.tar.zst
nixpkgs-0649c8bde74d5e0e2036a66f0cab72b9de777617.zip
gimp: add gimp-with-plugin derivation
By default all plugins from pkgs.gimpPlugins set are enabled.

Default location of plugins changed from $out/${gimp.name} to
$out/lib/gimp/${majorVersion}. Resulting derivation for gimp+plugins
is set as search path for plugins by default (additional tweaking in
gimprc done for old plugin scheme should be removed)
Diffstat (limited to 'pkgs/applications/graphics/gimp/wrapper.nix')
-rw-r--r--pkgs/applications/graphics/gimp/wrapper.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/pkgs/applications/graphics/gimp/wrapper.nix b/pkgs/applications/graphics/gimp/wrapper.nix
new file mode 100644
index 00000000000..53067dc39c9
--- /dev/null
+++ b/pkgs/applications/graphics/gimp/wrapper.nix
@@ -0,0 +1,33 @@
+{ stdenv, lib, buildEnv, gimp, makeWrapper, gimpPlugins, plugins ? null}:
+
+let
+allPlugins = lib.filter (pkg: builtins.isAttrs pkg && pkg.type == "derivation") (lib.attrValues gimpPlugins);
+selectedPlugins = if plugins == null then allPlugins else plugins;
+extraArgs = map (x: x.wrapArgs or "") selectedPlugins;
+
+drv = buildEnv {
+  name = "gimp-with-plugins-" + (builtins.parseDrvName gimp.name).version;
+
+  paths = [ gimp ] ++ selectedPlugins;
+
+  postBuild = ''
+    # TODO: This could be avoided if buildEnv could be forced to create all directories
+    if [ -L $out/bin ]; then
+      rm $out/bin
+      mkdir $out/bin
+      for i in ${gimp}/bin/*; do
+        ln -s $i $out/bin
+      done
+    fi
+    for each in gimp-2.8 gimp-console-2.8; do
+      wrapProgram $out/bin/$each \
+        --set GIMP2_PLUGINDIR "$out/lib/gimp/2.0" \
+        ${toString extraArgs}
+    done
+    set +x
+    for each in gimp gimp-console; do
+      ln -sf "$each-2.8" $out/bin/$each
+    done
+  '';
+  };
+in stdenv.lib.overrideDerivation drv (x : { buildInputs = x.buildInputs ++ [ makeWrapper ]; })