diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix index b237c5f1bcf1..20d57d50941a 100644 --- a/pkgs/applications/graphics/gimp/plugins/default.nix +++ b/pkgs/applications/graphics/gimp/plugins/default.nix @@ -2,7 +2,11 @@ # If you just want a subset of plug-ins, you can specify them explicitly: # `gimp-with-plugins.override { plugins = with gimpPlugins; [ gap ]; }`. -{ lib, pkgs }: +{ + lib, + pkgs, + gimp, +}: let inherit (pkgs) @@ -16,6 +20,10 @@ let fetchFromGitHub fetchFromGitLab ; + + # We cannot use gimp from the arguments directly, or it would be shadowed by the one + # from scope when initializing the scope with it, leading to infinite recursion. + gimpArg = gimp; in lib.makeScope pkgs.newScope ( @@ -29,6 +37,7 @@ lib.makeScope pkgs.newScope ( attrs: let name = attrs.name or "${attrs.pname}-${attrs.version}"; + pkgConfigMajorVersion = if gimp.majorVersion == "2.0" then "2" else "3"; in stdenv.mkDerivation ( { @@ -63,8 +72,10 @@ lib.makeScope pkgs.newScope ( # Override installation paths. env = { - PKG_CONFIG_GIMP_2_0_GIMPLIBDIR = "${placeholder "out"}/${gimp.targetLibDir}"; - PKG_CONFIG_GIMP_2_0_GIMPDATADIR = "${placeholder "out"}/${gimp.targetDataDir}"; + "PKG_CONFIG_GIMP_${pkgConfigMajorVersion}_0_GIMPLIBDIR" = + "${placeholder "out"}/${gimp.targetLibDir}"; + "PKG_CONFIG_GIMP_${pkgConfigMajorVersion}_0_GIMPDATADIR" = + "${placeholder "out"}/${gimp.targetDataDir}"; } // attrs.env or { }; } ); @@ -86,7 +97,7 @@ lib.makeScope pkgs.newScope ( in { # Allow overriding GIMP package in the scope. - inherit (pkgs) gimp; + gimp = gimpArg; bimp = pluginDerivation rec { /* @@ -130,6 +141,7 @@ lib.makeScope pkgs.newScope ( installTargets = [ "install-admin" ]; meta = with lib; { + broken = gimp.majorVersion != "2.0"; description = "Batch Image Manipulation Plugin for GIMP"; homepage = "https://github.com/alessandrofrancesconi/gimp-plugin-bimp"; license = licenses.gpl2Plus; @@ -153,6 +165,7 @@ lib.makeScope pkgs.newScope ( ''; meta = { + broken = gimp.majorVersion != "2.0"; description = "Gimp plug-in for the farbfeld image format"; homepage = "https://github.com/ids1024/gimp-farbfeld"; license = lib.licenses.mit; @@ -192,6 +205,7 @@ lib.makeScope pkgs.newScope ( ''; meta = with lib; { + broken = gimp.majorVersion != "2.0"; description = "GIMP plug-in to do the fourier transform"; homepage = "https://people.via.ecp.fr/~remi/soft/gimp/gimp_plugin_en.php3#fourier"; license = with licenses; [ gpl3Plus ]; @@ -222,7 +236,7 @@ lib.makeScope pkgs.newScope ( }; meta = { - broken = !gimp.python2Support; + broken = gimp.majorVersion != "2.0"; }; }; @@ -240,6 +254,10 @@ lib.makeScope pkgs.newScope ( ninja gettext ]; + + meta = { + broken = gimp.majorVersion != "2.0"; + }; }; waveletSharpen = pluginDerivation { @@ -264,6 +282,10 @@ lib.makeScope pkgs.newScope ( }; installPhase = "installPlugin src/wavelet-sharpen"; # TODO translations are not copied .. How to do this on nix? + + meta = { + broken = gimp.majorVersion != "2.0"; + }; }; lqrPlugin = pluginDerivation rec { @@ -289,10 +311,15 @@ lib.makeScope pkgs.newScope ( sha256 = "EdjZWM6U1bhUmsOnLA8iJ4SFKuAXHIfNPzxZqel+JrY="; }) ]; + + meta = { + broken = gimp.majorVersion != "2.0"; + }; }; gmic = pkgs.gmic-qt.override { variant = "gimp"; + inherit (self) gimp; }; gimplensfun = pluginDerivation { @@ -320,6 +347,7 @@ lib.makeScope pkgs.newScope ( "; meta = { + broken = gimp.majorVersion != "2.0"; description = "GIMP plugin to correct lens distortion using the lensfun library and database"; homepage = "http://lensfun.sebastiankraft.net/"; diff --git a/pkgs/applications/graphics/gimp/wrapper.nix b/pkgs/applications/graphics/gimp/wrapper.nix index 82ff058ba7dc..2a4e2c3a844b 100644 --- a/pkgs/applications/graphics/gimp/wrapper.nix +++ b/pkgs/applications/graphics/gimp/wrapper.nix @@ -13,8 +13,14 @@ let lib.attrValues gimpPlugins ); selectedPlugins = lib.filter (pkg: pkg != gimp) (if plugins == null then allPlugins else plugins); - extraArgs = map (x: x.wrapArgs or "") selectedPlugins; - versionBranch = lib.versions.majorMinor gimp.version; + extraArgs = + map (x: x.wrapArgs or "") selectedPlugins + ++ lib.optionals (gimp.majorVersion == "2.0") [ + ''--prefix GTK_PATH : "${gnome-themes-extra}/lib/gtk-2.0"'' + ]; + exeVersion = + if gimp.majorVersion == "2.0" then lib.versions.majorMinor gimp.version else gimp.majorVersion; + majorVersion = if gimp.majorVersion == "2.0" then "2" else "3"; in symlinkJoin { @@ -25,16 +31,15 @@ symlinkJoin { nativeBuildInputs = [ makeWrapper ]; postBuild = '' - for each in gimp-${versionBranch} gimp-console-${versionBranch}; do + for each in gimp-${exeVersion} gimp-console-${exeVersion}; 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-themes-extra}/lib/gtk-2.0" \ + --set GIMP${majorVersion}_PLUGINDIR "$out/${gimp.targetLibDir}" \ + --set GIMP${majorVersion}_DATADIR "$out/${gimp.targetDataDir}" \ ${toString extraArgs} done set +x for each in gimp gimp-console; do - ln -sf "$each-${versionBranch}" $out/bin/$each + ln -sf "$each-${exeVersion}" $out/bin/$each done ''; diff --git a/pkgs/by-name/gm/gmic-qt/package.nix b/pkgs/by-name/gm/gmic-qt/package.nix index 4a07ba02bcef..8e93a53a11e0 100644 --- a/pkgs/by-name/gm/gmic-qt/package.nix +++ b/pkgs/by-name/gm/gmic-qt/package.nix @@ -100,7 +100,14 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ (lib.cmakeBool "ENABLE_DYNAMIC_LINKING" true) (lib.cmakeBool "ENABLE_SYSTEM_GMIC" true) - (lib.cmakeFeature "GMIC_QT_HOST" (if variant == "standalone" then "none" else variant)) + (lib.cmakeFeature "GMIC_QT_HOST" ( + if variant == "standalone" then + "none" + else if variant == "gimp" && gimp.majorVersion == "2.99" then + "gimp3" + else + variant + )) ]; postFixup = lib.optionalString (variant == "gimp") ''