2016-04-26 12:26:45 +00:00
|
|
|
{ stdenv, lib, symlinkJoin, gimp, makeWrapper, gimpPlugins, plugins ? null}:
|
2016-02-25 21:24:45 +00:00
|
|
|
|
|
|
|
let
|
2018-04-29 12:29:36 +00:00
|
|
|
allPlugins = lib.filter (pkg: builtins.isAttrs pkg && pkg.type == "derivation" && !pkg.meta.broken or false) (lib.attrValues gimpPlugins);
|
2016-02-25 21:24:45 +00:00
|
|
|
selectedPlugins = if plugins == null then allPlugins else plugins;
|
|
|
|
extraArgs = map (x: x.wrapArgs or "") selectedPlugins;
|
2017-12-22 07:59:08 +00:00
|
|
|
versionBranch = stdenv.lib.versions.majorMinor gimp.version;
|
2016-02-25 21:24:45 +00:00
|
|
|
|
2016-04-26 12:26:45 +00:00
|
|
|
in symlinkJoin {
|
|
|
|
name = "gimp-with-plugins-${gimp.version}";
|
2016-02-25 21:24:45 +00:00
|
|
|
|
|
|
|
paths = [ gimp ] ++ selectedPlugins;
|
|
|
|
|
2016-04-26 12:26:45 +00:00
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
2016-02-25 21:24:45 +00:00
|
|
|
postBuild = ''
|
2017-12-22 07:59:08 +00:00
|
|
|
for each in gimp-${versionBranch} gimp-console-${versionBranch}; do
|
2016-02-25 21:24:45 +00:00
|
|
|
wrapProgram $out/bin/$each \
|
|
|
|
--set GIMP2_PLUGINDIR "$out/lib/gimp/2.0" \
|
|
|
|
${toString extraArgs}
|
|
|
|
done
|
|
|
|
set +x
|
|
|
|
for each in gimp gimp-console; do
|
2017-12-22 07:59:08 +00:00
|
|
|
ln -sf "$each-${versionBranch}" $out/bin/$each
|
2016-02-25 21:24:45 +00:00
|
|
|
done
|
|
|
|
'';
|
2016-04-26 12:26:45 +00:00
|
|
|
}
|