Merge pull request #103361 from jtojnar/gimp-cleanup

This commit is contained in:
Jan Tojnar 2020-11-11 17:28:49 +01:00 committed by GitHub
commit dfa97742d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 37 deletions

View File

@ -163,8 +163,10 @@ in stdenv.mkDerivation rec {
# The declarations for `gimp-with-plugins` wrapper, # The declarations for `gimp-with-plugins` wrapper,
# used for determining plug-in installation paths # used for determining plug-in installation paths
majorVersion = "${lib.versions.major version}.0"; majorVersion = "${lib.versions.major version}.0";
targetPluginDir = "lib/gimp/${majorVersion}/plug-ins"; targetLibDir = "lib/gimp/${majorVersion}";
targetScriptDir = "share/gimp/${majorVersion}/scripts"; targetDataDir = "share/gimp/${majorVersion}";
targetPluginDir = "${targetLibDir}/plug-ins";
targetScriptDir = "${targetDataDir}/scripts";
# probably its a good idea to use the same gtk in plugins ? # probably its a good idea to use the same gtk in plugins ?
gtk = gtk2; gtk = gtk2;

View File

@ -1,33 +1,51 @@
# install these packages into your profile. Then add # Use `gimp-with-plugins` package for GIMP with all plug-ins.
# ~/.nix-profile/gimp-version-plugins to your plugin list you can find at # If you just want a subset of plug-ins, you can specify them explicitly:
# preferences -> Folders -> Plug-ins # `gimp-with-plugins.override { plugins = with gimpPlugins; [ gap ]; }`.
# same applies for the scripts
{ config, lib, pkgs }:
{ config, pkgs, gimp }:
let let
inherit (pkgs) stdenv fetchurl pkgconfig intltool glib fetchFromGitHub; inherit (pkgs) stdenv fetchurl pkg-config intltool glib fetchFromGitHub;
inherit (gimp) targetPluginDir targetScriptDir; in
pluginDerivation = a: let lib.makeScope pkgs.newScope (self:
name = a.name or "${a.pname}-${a.version}";
let
# Use GIMP from the scope.
inherit (self) gimp;
pluginDerivation = attrs: let
name = attrs.name or "${attrs.pname}-${attrs.version}";
in stdenv.mkDerivation ({ in stdenv.mkDerivation ({
prePhases = "extraLib"; prePhases = "extraLib";
extraLib = '' extraLib = ''
installScripts(){ installScripts(){
mkdir -p $out/${targetScriptDir}/${name}; mkdir -p $out/${gimp.targetScriptDir}/${name};
for p in "$@"; do cp "$p" -r $out/${targetScriptDir}/${name}; done for p in "$@"; do cp "$p" -r $out/${gimp.targetScriptDir}/${name}; done
} }
installPlugins(){ installPlugins(){
mkdir -p $out/${targetPluginDir}/${name}; mkdir -p $out/${gimp.targetPluginDir}/${name};
for p in "$@"; do cp "$p" -r $out/${targetPluginDir}/${name}; done for p in "$@"; do cp "$p" -r $out/${gimp.targetPluginDir}/${name}; done
} }
''; '';
# Override installation paths.
PKG_CONFIG_GIMP_2_0_GIMPLIBDIR = "${placeholder "out"}/${gimp.targetLibDir}";
PKG_CONFIG_GIMP_2_0_GIMPDATADIR = "${placeholder "out"}/${gimp.targetDataDir}";
} }
// a // attrs
// { // {
name = "gimp-plugin-${name}"; name = "gimp-plugin-${name}";
buildInputs = [ gimp gimp.gtk glib ] ++ (a.buildInputs or []); buildInputs = [
nativeBuildInputs = [ pkgconfig intltool ] ++ (a.nativeBuildInputs or []); gimp
gimp.gtk
glib
] ++ (attrs.buildInputs or []);
nativeBuildInputs = [
pkg-config
intltool
] ++ (attrs.nativeBuildInputs or []);
} }
); );
@ -35,10 +53,11 @@ let
phases = [ "extraLib" "installPhase" ]; phases = [ "extraLib" "installPhase" ];
installPhase = "installScripts ${src}"; installPhase = "installScripts ${src}";
} // attrs); } // attrs);
in in
{
# Allow overriding GIMP package in the scope.
inherit (pkgs) gimp;
stdenv.lib.makeScope pkgs.newScope (self: with self; {
gap = pluginDerivation { gap = pluginDerivation {
/* menu: /* menu:
Video Video
@ -49,10 +68,6 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; {
sha256 = "1jic7ixcmsn4kx2cn32nc5087rk6g8xsrz022xy11yfmgvhzb0ql"; sha256 = "1jic7ixcmsn4kx2cn32nc5087rk6g8xsrz022xy11yfmgvhzb0ql";
}; };
NIX_LDFLAGS = "-lm"; NIX_LDFLAGS = "-lm";
patchPhase = ''
sed -e 's,^\(GIMP_PLUGIN_DIR=\).*,\1'"$out/${gimp.name}-plugins", \
-e 's,^\(GIMP_DATA_DIR=\).*,\1'"$out/share/${gimp.name}", -i configure
'';
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "The GIMP Animation Package"; description = "The GIMP Animation Package";
@ -99,7 +114,7 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; {
version = "2.0.3"; version = "2.0.3";
buildInputs = with pkgs; [ fftw ]; buildInputs = with pkgs; [ fftw ];
nativeBuildInputs = with pkgs; [ autoreconfHook ]; nativeBuildInputs = with pkgs; [ autoreconfHook ];
makeFlags = [ "GIMP_LIBDIR=${placeholder "out"}/lib/gimp/2.0" ]; makeFlags = [ "GIMP_LIBDIR=${placeholder "out"}/${gimp.targetLibDir}" ];
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "bootchk"; owner = "bootchk";
repo = "resynthesizer"; repo = "resynthesizer";
@ -138,14 +153,14 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; {
Layer/Liquid Rescale Layer/Liquid Rescale
*/ */
pname = "lqr-plugin"; pname = "lqr-plugin";
version = "0.7.1"; version = "0.7.2";
buildInputs = with pkgs; [ liblqr1 ]; buildInputs = with pkgs; [ liblqr1 ];
src = fetchurl { src = fetchFromGitHub {
url = "https://github.com/pixlsus/registry.gimp.org_static/raw/master/registry.gimp.org/files/gimp-lqr-plugin-${version}.tar.bz2"; owner = "carlobaldassi";
sha256 = "sha256-YpgYPjHZkueJWS51QGmugXavGS+1x4o20St31qoRng4="; repo = "gimp-lqr-plugin";
rev = "v${version}";
sha256 = "81ajdZ2zQi/THxnBlSeT36tVTEzrS1YqLGpHMhFTKAo=";
}; };
#postInstall = ''mkdir -p $out/nix-support; echo "${liblqr1}" > "$out/nix-support/propagated-user-env-packages"'';
installPhase = "installPlugins src/gimp-lqr-plugin";
}; };
gmic = pkgs.gmic-qt.override { gmic = pkgs.gmic-qt.override {
@ -201,9 +216,4 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; {
sha256 = "c14a8f4f709695ede3f77348728a25b3f3ded420da60f3f8de3944b7eae98a49"; sha256 = "c14a8f4f709695ede3f77348728a25b3f3ded420da60f3f8de3944b7eae98a49";
}; };
}; };
} // stdenv.lib.optionalAttrs (config.allowAliases or true) {
resynthesizer2 = resynthesizer;
}) })

View File

@ -2,7 +2,7 @@
let let
allPlugins = lib.filter (pkg: lib.isDerivation pkg && !pkg.meta.broken or false) (lib.attrValues gimpPlugins); allPlugins = lib.filter (pkg: lib.isDerivation pkg && !pkg.meta.broken or false) (lib.attrValues gimpPlugins);
selectedPlugins = if plugins == null then allPlugins else plugins; selectedPlugins = lib.filter (pkg: pkg != gimpPlugins.gimp) (if plugins == null then allPlugins else plugins);
extraArgs = map (x: x.wrapArgs or "") selectedPlugins; extraArgs = map (x: x.wrapArgs or "") selectedPlugins;
versionBranch = stdenv.lib.versions.majorMinor gimp.version; versionBranch = stdenv.lib.versions.majorMinor gimp.version;