trying fixes

This commit is contained in:
Arthur Wambst 2025-05-30 17:02:15 +02:00
parent 8538673cb8
commit eca9ff8954

View File

@ -5,7 +5,7 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
# Source du code GIMP # Source du code GIMP
gimp-source = { gimp-source = {
url = "github:GNOME/gimp/master"; url = "git+https://gitlab.gnome.org/GNOME/gimp.git";
flake = false; flake = false;
}; };
}; };
@ -21,7 +21,14 @@
}: pkgs.stdenv.mkDerivation rec { }: pkgs.stdenv.mkDerivation rec {
pname = "gimp"; pname = "gimp";
inherit version; inherit version;
src = gimp-source;
# FIXED: Use fetchgit to properly fetch submodules
src = pkgs.fetchgit {
url = "https://gitlab.gnome.org/GNOME/gimp.git";
rev = "master";
fetchSubmodules = true;
sha256 = pkgs.lib.fakeSha256;
};
# FIXED: Added missing critical dependencies # FIXED: Added missing critical dependencies
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
@ -45,6 +52,7 @@
buildInputs = with pkgs; [ buildInputs = with pkgs; [
glib glib
glib-networking # FIXED: Moved to more prominent position
gtk3 gtk3
gdk-pixbuf gdk-pixbuf
pango pango
@ -73,7 +81,6 @@
libxml2 libxml2
json-glib json-glib
libgudev libgudev
glib-networking
# iso-codes # Not available in nixpkgs under this name # iso-codes # Not available in nixpkgs under this name
aalib aalib
openexr openexr
@ -86,33 +93,48 @@
freetype freetype
fontconfig fontconfig
pixman pixman
at-spi2-atk at-spi2-atk
at-spi2-core at-spi2-core
atk atk
# FIXED: Additional dependencies that might be needed
libsoup_3 # Required for glib-networking functionality
gsettings-desktop-schemas # For GSettings schemas
hicolor-icon-theme # For proper icon handling
# FIXED: Python dependencies for PyGObject
python3Packages.pygobject3
python3Packages.pycairo
] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) [ ] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) [
libunwind libunwind
]; ];
# More conservative meson configuration # FIXED: Better meson configuration with explicit glib-networking support
mesonFlags = [ mesonFlags = [
"-Dbuild-id=Nix" "-Dbuild-id=Nix"
# "-Dgtk-doc=false"
# "-Dg-ir-doc=false" # Disable introspection docs
"-Dcheck-update=no" # Disable update checks "-Dcheck-update=no" # Disable update checks
# FIXED: Ensure glib-networking is properly detected
"-Dglib-networking=enabled"
# Explicitly disable problematic features that might cause build issues # Explicitly disable problematic features that might cause build issues
"-Dalsa=disabled" "-Dalsa=disabled"
"-Dgudev=disabled" "-Dgudev=disabled"
# "-Dwebkitgtk=disabled"
] ++ pkgs.lib.optionals (enabledFeatures != []) ] ++ pkgs.lib.optionals (enabledFeatures != [])
(map (feature: "-D${feature}=enabled") enabledFeatures) (map (feature: "-D${feature}=enabled") enabledFeatures)
++ pkgs.lib.optionals (disabledFeatures != []) ++ pkgs.lib.optionals (disabledFeatures != [])
(map (feature: "-D${feature}=disabled") disabledFeatures); (map (feature: "-D${feature}=disabled") disabledFeatures);
# Better build configuration # FIXED: Better build configuration with proper environment setup
configurePhase = '' configurePhase = ''
runHook preConfigure runHook preConfigure
# FIXED: Set up environment for glib-networking detection
export PKG_CONFIG_PATH="${pkgs.glib-networking}/lib/pkgconfig:${pkgs.glib}/lib/pkgconfig:$PKG_CONFIG_PATH"
export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules"
# FIXED: Set up Python environment for PyGObject
export PYTHONPATH="${pkgs.python3Packages.pygobject3}/${pkgs.python3.sitePackages}:${pkgs.python3Packages.pycairo}/${pkgs.python3.sitePackages}:$PYTHONPATH"
# Ensure pkg-config can find all dependencies
export PKG_CONFIG_PATH="${pkgs.lib.concatStringsSep ":" (map (p: "${p}/lib/pkgconfig") buildInputs)}:$PKG_CONFIG_PATH"
# Ensure we have a clean build directory # Ensure we have a clean build directory
meson setup build . $mesonFlags meson setup build . $mesonFlags
@ -122,6 +144,10 @@
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
# FIXED: Set environment variables for build
export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules"
export GSETTINGS_SCHEMA_DIR="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas"
# Build with limited parallelism to avoid memory issues # Build with limited parallelism to avoid memory issues
ninja -C build -j$NIX_BUILD_CORES ninja -C build -j$NIX_BUILD_CORES
@ -146,14 +172,35 @@
if [ -f build/desktop/org.gimp.GIMP.desktop ]; then if [ -f build/desktop/org.gimp.GIMP.desktop ]; then
cp build/desktop/org.gimp.GIMP.desktop $out/share/applications/ cp build/desktop/org.gimp.GIMP.desktop $out/share/applications/
fi fi
# FIXED: Set up GIO modules path for runtime
mkdir -p $out/lib/gio/modules
if [ -d "${pkgs.glib-networking}/lib/gio/modules" ]; then
ln -sf "${pkgs.glib-networking}/lib/gio/modules"/* $out/lib/gio/modules/
fi
''; '';
# Add environment variables that might be needed # FIXED: Add environment variables that might be needed
preBuild = '' preBuild = ''
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
export XDG_CACHE_HOME=$HOME/.cache export XDG_CACHE_HOME=$HOME/.cache
export XDG_CONFIG_HOME=$HOME/.config export XDG_CONFIG_HOME=$HOME/.config
export XDG_DATA_HOME=$HOME/.local/share export XDG_DATA_HOME=$HOME/.local/share
# FIXED: Ensure glib-networking is available
export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules"
export GSETTINGS_SCHEMA_DIR="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas"
# FIXED: Python environment for PyGObject
export PYTHONPATH="${pkgs.python3Packages.pygobject3}/${pkgs.python3.sitePackages}:${pkgs.python3Packages.pycairo}/${pkgs.python3.sitePackages}:$PYTHONPATH"
'';
# FIXED: Add preFixup to handle GSettings and GIO modules
preFixup = ''
gappsWrapperArgs+=(
--prefix GIO_MODULE_DIR : "${pkgs.glib-networking}/lib/gio/modules"
--prefix GSETTINGS_SCHEMA_DIR : "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas"
)
''; '';
meta = with pkgs.lib; { meta = with pkgs.lib; {
@ -161,8 +208,8 @@
homepage = "https://www.gimp.org/"; homepage = "https://www.gimp.org/";
license = licenses.gpl3Plus; license = licenses.gpl3Plus;
platforms = platforms.unix; platforms = platforms.unix;
maintainers = [ ]; # Removed invalid maintainer reference maintainers = [ ];
broken = false; # Mark as not broken broken = false;
}; };
}; };
@ -183,6 +230,7 @@
#!/bin/sh #!/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_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)} export GIMP3_SCRIPTDIR=\$HOME/.config/GIMP/3.0/scripts:${pkgs.lib.concatStringsSep ":" (map (p: "${p}/lib/gimp/3.0/scripts") plugins)}
export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules"
exec ${gimp3-base}/bin/gimp "\$@" exec ${gimp3-base}/bin/gimp "\$@"
EOF EOF
chmod +x $out/bin/gimp chmod +x $out/bin/gimp
@ -194,15 +242,9 @@
# Ultra-minimal version for testing # Ultra-minimal version for testing
gimp3-test = buildGimp3 { gimp3-test = buildGimp3 {
disabledFeatures = [ disabledFeatures = [
#"python"
"javascript" "javascript"
#"lua"
#"webkitgtk"
"alsa" "alsa"
"gudev" "gudev"
#"check-update"
#"gtk-doc"
#"g-ir-doc"
]; ];
}; };
@ -225,10 +267,9 @@
"webp" "webp"
"openexr" "openexr"
]; ];
# Don't enable scripting languages by default as they can cause build issues
}; };
default = gimp3-test; # Start with the most minimal version default = gimp3-test;
}; };
lib = { lib = {