Skip to content

Commit dfa9774

Browse files
authored
Merge pull request #103361 from jtojnar/gimp-cleanup
2 parents dd4ebbc + aa96bd2 commit dfa9774

File tree

3 files changed

+49
-37
lines changed

3 files changed

+49
-37
lines changed

pkgs/applications/graphics/gimp/default.nix

+4-2
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ in stdenv.mkDerivation rec {
163163
# The declarations for `gimp-with-plugins` wrapper,
164164
# used for determining plug-in installation paths
165165
majorVersion = "${lib.versions.major version}.0";
166-
targetPluginDir = "lib/gimp/${majorVersion}/plug-ins";
167-
targetScriptDir = "share/gimp/${majorVersion}/scripts";
166+
targetLibDir = "lib/gimp/${majorVersion}";
167+
targetDataDir = "share/gimp/${majorVersion}";
168+
targetPluginDir = "${targetLibDir}/plug-ins";
169+
targetScriptDir = "${targetDataDir}/scripts";
168170

169171
# probably its a good idea to use the same gtk in plugins ?
170172
gtk = gtk2;

pkgs/applications/graphics/gimp/plugins/default.nix

+44-34
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,63 @@
1-
# install these packages into your profile. Then add
2-
# ~/.nix-profile/gimp-version-plugins to your plugin list you can find at
3-
# preferences -> Folders -> Plug-ins
4-
# same applies for the scripts
1+
# Use `gimp-with-plugins` package for GIMP with all plug-ins.
2+
# If you just want a subset of plug-ins, you can specify them explicitly:
3+
# `gimp-with-plugins.override { plugins = with gimpPlugins; [ gap ]; }`.
4+
5+
{ config, lib, pkgs }:
56

6-
{ config, pkgs, gimp }:
77
let
8-
inherit (pkgs) stdenv fetchurl pkgconfig intltool glib fetchFromGitHub;
9-
inherit (gimp) targetPluginDir targetScriptDir;
8+
inherit (pkgs) stdenv fetchurl pkg-config intltool glib fetchFromGitHub;
9+
in
1010

11-
pluginDerivation = a: let
12-
name = a.name or "${a.pname}-${a.version}";
11+
lib.makeScope pkgs.newScope (self:
12+
13+
let
14+
# Use GIMP from the scope.
15+
inherit (self) gimp;
16+
17+
pluginDerivation = attrs: let
18+
name = attrs.name or "${attrs.pname}-${attrs.version}";
1319
in stdenv.mkDerivation ({
1420
prePhases = "extraLib";
1521
extraLib = ''
1622
installScripts(){
17-
mkdir -p $out/${targetScriptDir}/${name};
18-
for p in "$@"; do cp "$p" -r $out/${targetScriptDir}/${name}; done
23+
mkdir -p $out/${gimp.targetScriptDir}/${name};
24+
for p in "$@"; do cp "$p" -r $out/${gimp.targetScriptDir}/${name}; done
1925
}
2026
installPlugins(){
21-
mkdir -p $out/${targetPluginDir}/${name};
22-
for p in "$@"; do cp "$p" -r $out/${targetPluginDir}/${name}; done
27+
mkdir -p $out/${gimp.targetPluginDir}/${name};
28+
for p in "$@"; do cp "$p" -r $out/${gimp.targetPluginDir}/${name}; done
2329
}
2430
'';
31+
32+
# Override installation paths.
33+
PKG_CONFIG_GIMP_2_0_GIMPLIBDIR = "${placeholder "out"}/${gimp.targetLibDir}";
34+
PKG_CONFIG_GIMP_2_0_GIMPDATADIR = "${placeholder "out"}/${gimp.targetDataDir}";
2535
}
26-
// a
36+
// attrs
2737
// {
2838
name = "gimp-plugin-${name}";
29-
buildInputs = [ gimp gimp.gtk glib ] ++ (a.buildInputs or []);
30-
nativeBuildInputs = [ pkgconfig intltool ] ++ (a.nativeBuildInputs or []);
39+
buildInputs = [
40+
gimp
41+
gimp.gtk
42+
glib
43+
] ++ (attrs.buildInputs or []);
44+
45+
nativeBuildInputs = [
46+
pkg-config
47+
intltool
48+
] ++ (attrs.nativeBuildInputs or []);
3149
}
3250
);
3351

3452
scriptDerivation = {src, ...}@attrs : pluginDerivation ({
3553
phases = [ "extraLib" "installPhase" ];
3654
installPhase = "installScripts ${src}";
3755
} // attrs);
38-
3956
in
57+
{
58+
# Allow overriding GIMP package in the scope.
59+
inherit (pkgs) gimp;
4060

41-
stdenv.lib.makeScope pkgs.newScope (self: with self; {
4261
gap = pluginDerivation {
4362
/* menu:
4463
Video
@@ -49,10 +68,6 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; {
4968
sha256 = "1jic7ixcmsn4kx2cn32nc5087rk6g8xsrz022xy11yfmgvhzb0ql";
5069
};
5170
NIX_LDFLAGS = "-lm";
52-
patchPhase = ''
53-
sed -e 's,^\(GIMP_PLUGIN_DIR=\).*,\1'"$out/${gimp.name}-plugins", \
54-
-e 's,^\(GIMP_DATA_DIR=\).*,\1'"$out/share/${gimp.name}", -i configure
55-
'';
5671
hardeningDisable = [ "format" ];
5772
meta = with stdenv.lib; {
5873
description = "The GIMP Animation Package";
@@ -99,7 +114,7 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; {
99114
version = "2.0.3";
100115
buildInputs = with pkgs; [ fftw ];
101116
nativeBuildInputs = with pkgs; [ autoreconfHook ];
102-
makeFlags = [ "GIMP_LIBDIR=${placeholder "out"}/lib/gimp/2.0" ];
117+
makeFlags = [ "GIMP_LIBDIR=${placeholder "out"}/${gimp.targetLibDir}" ];
103118
src = fetchFromGitHub {
104119
owner = "bootchk";
105120
repo = "resynthesizer";
@@ -138,14 +153,14 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; {
138153
Layer/Liquid Rescale
139154
*/
140155
pname = "lqr-plugin";
141-
version = "0.7.1";
156+
version = "0.7.2";
142157
buildInputs = with pkgs; [ liblqr1 ];
143-
src = fetchurl {
144-
url = "https://github.com/pixlsus/registry.gimp.org_static/raw/master/registry.gimp.org/files/gimp-lqr-plugin-${version}.tar.bz2";
145-
sha256 = "sha256-YpgYPjHZkueJWS51QGmugXavGS+1x4o20St31qoRng4=";
158+
src = fetchFromGitHub {
159+
owner = "carlobaldassi";
160+
repo = "gimp-lqr-plugin";
161+
rev = "v${version}";
162+
sha256 = "81ajdZ2zQi/THxnBlSeT36tVTEzrS1YqLGpHMhFTKAo=";
146163
};
147-
#postInstall = ''mkdir -p $out/nix-support; echo "${liblqr1}" > "$out/nix-support/propagated-user-env-packages"'';
148-
installPhase = "installPlugins src/gimp-lqr-plugin";
149164
};
150165

151166
gmic = pkgs.gmic-qt.override {
@@ -201,9 +216,4 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; {
201216
sha256 = "c14a8f4f709695ede3f77348728a25b3f3ded420da60f3f8de3944b7eae98a49";
202217
};
203218
};
204-
205-
} // stdenv.lib.optionalAttrs (config.allowAliases or true) {
206-
207-
resynthesizer2 = resynthesizer;
208-
209219
})

pkgs/applications/graphics/gimp/wrapper.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
let
44
allPlugins = lib.filter (pkg: lib.isDerivation pkg && !pkg.meta.broken or false) (lib.attrValues gimpPlugins);
5-
selectedPlugins = if plugins == null then allPlugins else plugins;
5+
selectedPlugins = lib.filter (pkg: pkg != gimpPlugins.gimp) (if plugins == null then allPlugins else plugins);
66
extraArgs = map (x: x.wrapArgs or "") selectedPlugins;
77
versionBranch = stdenv.lib.versions.majorMinor gimp.version;
88

0 commit comments

Comments
 (0)