1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-23 07:26:54 +00:00
nixpkgs/pkgs/applications/graphics/gimp/wrapper.nix

30 lines
982 B
Nix
Raw Normal View History

2019-05-04 19:37:49 +01:00
{ stdenv, lib, symlinkJoin, gimp, makeWrapper, gimpPlugins, gnome3, plugins ? null}:
let
2019-08-31 05:50:22 +01:00
allPlugins = lib.filter (pkg: lib.isDerivation pkg && !pkg.meta.broken or false) (lib.attrValues gimpPlugins);
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;
in symlinkJoin {
name = "gimp-with-plugins-${gimp.version}";
paths = [ gimp ] ++ selectedPlugins;
buildInputs = [ makeWrapper ];
postBuild = ''
2017-12-22 07:59:08 +00:00
for each in gimp-${versionBranch} gimp-console-${versionBranch}; do
wrapProgram $out/bin/$each \
--set GIMP2_PLUGINDIR "$out/lib/gimp/2.0" \
--set GIMP2_DATADIR "$out/share/gimp/2.0" \
2019-05-04 19:37:49 +01:00
--prefix GTK_PATH : "${gnome3.gnome-themes-extra}/lib/gtk-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
done
'';
}