nixpkgs/pkgs/applications/graphics/gimp/wrapper.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
1 KiB
Nix
Raw Normal View History

{ lib, symlinkJoin, makeWrapper, gimpPlugins, gnome, plugins ? null}:
let
inherit (gimpPlugins) gimp;
2019-08-31 06:50:22 +02:00
allPlugins = lib.filter (pkg: lib.isDerivation pkg && !pkg.meta.broken or false) (lib.attrValues gimpPlugins);
selectedPlugins = lib.filter (pkg: pkg != gimp) (if plugins == null then allPlugins else plugins);
extraArgs = map (x: x.wrapArgs or "") selectedPlugins;
2021-01-15 14:21:58 +01:00
versionBranch = lib.versions.majorMinor gimp.version;
in symlinkJoin {
name = "gimp-with-plugins-${gimp.version}";
paths = [ gimp ] ++ selectedPlugins;
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
2017-12-22 08:59:08 +01: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" \
--prefix GTK_PATH : "${gnome.gnome-themes-extra}/lib/gtk-2.0" \
${toString extraArgs}
done
set +x
for each in gimp gimp-console; do
2017-12-22 08:59:08 +01:00
ln -sf "$each-${versionBranch}" $out/bin/$each
done
'';
inherit (gimp) meta;
}