246 lines
7.1 KiB
Nix
246 lines
7.1 KiB
Nix
{
|
|
description = "Nix Flake for GIMP 3 built from source";
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
# Source du code GIMP
|
|
gimp-source = {
|
|
url = "github:GNOME/gimp/master";
|
|
flake = false;
|
|
};
|
|
};
|
|
outputs = { self, nixpkgs, flake-utils, gimp-source }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
buildGimp3 = {
|
|
version ? "3.0.0",
|
|
enabledFeatures ? [],
|
|
disabledFeatures ? []
|
|
}: pkgs.stdenv.mkDerivation rec {
|
|
pname = "gimp";
|
|
inherit version;
|
|
src = gimp-source;
|
|
|
|
# FIXED: Added missing critical dependencies
|
|
nativeBuildInputs = with pkgs; [
|
|
pkg-config
|
|
meson
|
|
ninja
|
|
python3
|
|
gettext
|
|
perl
|
|
intltool
|
|
appstream-glib
|
|
desktop-file-utils
|
|
gobject-introspection
|
|
wrapGAppsHook
|
|
cmake # Often needed for some dependencies
|
|
autoconf
|
|
automake
|
|
libtool
|
|
git # Sometimes needed during build
|
|
];
|
|
|
|
buildInputs = with pkgs; [
|
|
glib
|
|
gtk3
|
|
gdk-pixbuf
|
|
pango
|
|
cairo
|
|
harfbuzz
|
|
babl
|
|
gegl
|
|
libmypaint
|
|
mypaint-brushes1
|
|
gexiv2
|
|
libwebp
|
|
libpng
|
|
libjpeg
|
|
libtiff
|
|
libheif
|
|
libexif
|
|
lcms2
|
|
poppler
|
|
poppler_data
|
|
ghostscript
|
|
librsvg
|
|
libmng
|
|
libjxl
|
|
libwmf
|
|
libxslt
|
|
libxml2
|
|
json-glib
|
|
libgudev
|
|
# iso-codes # Not available in nixpkgs under this name
|
|
aalib
|
|
openexr
|
|
dbus-glib
|
|
xorg.libXmu
|
|
xorg.libXpm
|
|
zlib
|
|
bzip2
|
|
# FIXED: Added missing dependencies
|
|
freetype
|
|
fontconfig
|
|
pixman
|
|
|
|
at-spi2-atk
|
|
at-spi2-core
|
|
atk
|
|
] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) [
|
|
libunwind
|
|
];
|
|
|
|
# More conservative meson configuration
|
|
mesonFlags = [
|
|
"-Dbuild-id=Nix"
|
|
"-Dgtk-doc=false"
|
|
"-Dg-ir-doc=false" # Disable introspection docs
|
|
"-Dcheck-update=no" # Disable update checks
|
|
# Explicitly disable problematic features that might cause build issues
|
|
"-Dalsa=disabled"
|
|
"-Dgudev=disabled"
|
|
"-Dwebkitgtk=disabled"
|
|
] ++ pkgs.lib.optionals (enabledFeatures != [])
|
|
(map (feature: "-D${feature}=enabled") enabledFeatures)
|
|
++ pkgs.lib.optionals (disabledFeatures != [])
|
|
(map (feature: "-D${feature}=disabled") disabledFeatures);
|
|
|
|
# Better build configuration
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
|
|
# Ensure we have a clean build directory
|
|
meson setup build . $mesonFlags
|
|
|
|
runHook postConfigure
|
|
'';
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
# Build with limited parallelism to avoid memory issues
|
|
ninja -C build -j$NIX_BUILD_CORES
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
ninja -C build install
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
postInstall = ''
|
|
# Création des répertoires pour les plugins
|
|
mkdir -p $out/lib/gimp/3.0/plug-ins
|
|
mkdir -p $out/lib/gimp/3.0/scripts
|
|
|
|
# FIXED: Ensure desktop file is properly installed
|
|
mkdir -p $out/share/applications
|
|
if [ -f build/desktop/org.gimp.GIMP.desktop ]; then
|
|
cp build/desktop/org.gimp.GIMP.desktop $out/share/applications/
|
|
fi
|
|
'';
|
|
|
|
# Add environment variables that might be needed
|
|
preBuild = ''
|
|
export HOME=$(mktemp -d)
|
|
export XDG_CACHE_HOME=$HOME/.cache
|
|
export XDG_CONFIG_HOME=$HOME/.config
|
|
export XDG_DATA_HOME=$HOME/.local/share
|
|
'';
|
|
|
|
meta = with pkgs.lib; {
|
|
description = "GNU Image Manipulation Program (GIMP) version 3.0";
|
|
homepage = "https://www.gimp.org/";
|
|
license = licenses.gpl3Plus;
|
|
platforms = platforms.unix;
|
|
maintainers = [ ]; # Removed invalid maintainer reference
|
|
broken = false; # Mark as not broken
|
|
};
|
|
};
|
|
|
|
# Construction de base de GIMP 3
|
|
gimp3-base = buildGimp3 {};
|
|
|
|
mkGimp3WithPlugins = {
|
|
plugins ? [],
|
|
enabledFeatures ? [],
|
|
disabledFeatures ? []
|
|
}: pkgs.symlinkJoin {
|
|
name = "gimp3-with-plugins";
|
|
paths = [ (buildGimp3 { inherit enabledFeatures disabledFeatures; }) ] ++ plugins;
|
|
|
|
postBuild = ''
|
|
mkdir -p $out/bin
|
|
cat > $out/bin/gimp << EOF
|
|
#!/bin/sh
|
|
export GIMP3_PLUGINDIR=\$HOME/.config/GIMP/3.0/plug-ins:${pkgs.lib.concatStringsSep ":" (map (p: "${p}/lib/gimp/3.0/plug-ins") plugins)}
|
|
export GIMP3_SCRIPTDIR=\$HOME/.config/GIMP/3.0/scripts:${pkgs.lib.concatStringsSep ":" (map (p: "${p}/lib/gimp/3.0/scripts") plugins)}
|
|
exec ${gimp3-base}/bin/gimp "\$@"
|
|
EOF
|
|
chmod +x $out/bin/gimp
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
packages = rec {
|
|
# Ultra-minimal version for testing
|
|
gimp3-test = buildGimp3 {
|
|
disabledFeatures = [
|
|
"python"
|
|
"javascript"
|
|
"lua"
|
|
"webkitgtk"
|
|
"alsa"
|
|
"gudev"
|
|
"check-update"
|
|
"gtk-doc"
|
|
"g-ir-doc"
|
|
];
|
|
};
|
|
|
|
gimp3 = gimp3-base;
|
|
|
|
# Simplified version with fewer potential build issues
|
|
gimp3-minimal = buildGimp3 {
|
|
disabledFeatures = [
|
|
"python"
|
|
"javascript"
|
|
"lua"
|
|
"webkitgtk"
|
|
"alsa"
|
|
"gudev"
|
|
];
|
|
};
|
|
|
|
gimp3-full = buildGimp3 {
|
|
enabledFeatures = [
|
|
"webp"
|
|
"openexr"
|
|
];
|
|
# Don't enable scripting languages by default as they can cause build issues
|
|
};
|
|
|
|
default = gimp3-test; # Start with the most minimal version
|
|
};
|
|
|
|
lib = {
|
|
inherit buildGimp3 mkGimp3WithPlugins;
|
|
};
|
|
|
|
apps = rec {
|
|
gimp3 = flake-utils.lib.mkApp {
|
|
drv = self.packages.${system}.gimp3;
|
|
exePath = "/bin/gimp";
|
|
};
|
|
default = gimp3;
|
|
};
|
|
});
|
|
}
|