trying fixes

This commit is contained in:
Arthur Wambst 2025-05-30 16:25:47 +02:00
parent 6981831cc7
commit edaf6a2b78

155
flake.nix
View File

@ -1,6 +1,5 @@
{ {
description = "Nix Flake for GIMP 3 built from source"; description = "Nix Flake for GIMP 3 built from source";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
@ -10,24 +9,21 @@
flake = false; flake = false;
}; };
}; };
outputs = { self, nixpkgs, flake-utils, gimp-source }: outputs = { self, nixpkgs, flake-utils, gimp-source }:
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let let
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
# Fonction pour construire GIMP 3 à partir du code source buildGimp3 = {
buildGimp3 = { version ? "3.0.0",
version ? "3.0.0",
enabledFeatures ? [], enabledFeatures ? [],
disabledFeatures ? [] disabledFeatures ? []
}: pkgs.stdenv.mkDerivation { }: pkgs.stdenv.mkDerivation rec {
pname = "gimp"; pname = "gimp";
inherit version; inherit version;
src = gimp-source; src = gimp-source;
# Dépendances de construction # FIXED: Added missing critical dependencies
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
meson meson
@ -40,9 +36,13 @@
desktop-file-utils desktop-file-utils
gobject-introspection gobject-introspection
wrapGAppsHook wrapGAppsHook
cmake # Often needed for some dependencies
autoconf
automake
libtool
git # Sometimes needed during build
]; ];
# Dépendances d'exécution
buildInputs = with pkgs; [ buildInputs = with pkgs; [
glib glib
gtk3 gtk3
@ -73,7 +73,7 @@
libxml2 libxml2
json-glib json-glib
libgudev libgudev
#iso-codes # iso-codes # Not available in nixpkgs under this name
aalib aalib
openexr openexr
dbus-glib dbus-glib
@ -81,25 +81,87 @@
xorg.libXpm xorg.libXpm
zlib zlib
bzip2 bzip2
# FIXED: Added missing dependencies
freetype
fontconfig
pixman
libX11
libXext
libXrender
libXrandr
libXfixes
libXdamage
libXcomposite
libXcursor
libXi
libXinerama
at-spi2-atk
at-spi2-core
atk
] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) [ ] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) [
libunwind libunwind
]; ];
# Configuration meson # More conservative meson configuration
mesonFlags = [ mesonFlags = [
"-Dbuild-id=Nix" "-Dbuild-id=Nix"
"-Dgtk-doc=false" "-Dgtk-doc=false"
] "-Dg-ir-doc=false" # Disable introspection docs
++ pkgs.lib.optionals (enabledFeatures != []) "-Dcheck-update=false" # 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) (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);
# Post-installation : configuration des plugins # 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 = '' postInstall = ''
# Création des répertoires pour les plugins # Création des répertoires pour les plugins
mkdir -p $out/lib/gimp/3.0/plug-ins mkdir -p $out/lib/gimp/3.0/plug-ins
mkdir -p $out/lib/gimp/3.0/scripts 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; { meta = with pkgs.lib; {
@ -107,25 +169,23 @@
homepage = "https://www.gimp.org/"; homepage = "https://www.gimp.org/";
license = licenses.gpl3Plus; license = licenses.gpl3Plus;
platforms = platforms.unix; platforms = platforms.unix;
maintainers = [ maintainers.your-github-username ]; maintainers = [ ]; # Removed invalid maintainer reference
broken = false; # Mark as not broken
}; };
}; };
# Construction de base de GIMP 3 # Construction de base de GIMP 3
gimp3-base = buildGimp3 {}; gimp3-base = buildGimp3 {};
# Fonction pour créer un GIMP 3 avec des plugins personnalisés mkGimp3WithPlugins = {
mkGimp3WithPlugins = { plugins ? [],
plugins ? [],
enabledFeatures ? [], enabledFeatures ? [],
disabledFeatures ? [] disabledFeatures ? []
}: pkgs.symlinkJoin { }: pkgs.symlinkJoin {
name = "gimp3-with-plugins"; name = "gimp3-with-plugins";
paths = [ (buildGimp3 { inherit enabledFeatures disabledFeatures; }) ] ++ plugins; paths = [ (buildGimp3 { inherit enabledFeatures disabledFeatures; }) ] ++ plugins;
# Script pour ajouter les plugins au chemin de recherche de GIMP
postBuild = '' postBuild = ''
# Création d'un wrapper qui configure les chemins des plugins
mkdir -p $out/bin mkdir -p $out/bin
cat > $out/bin/gimp << EOF cat > $out/bin/gimp << EOF
#!/bin/sh #!/bin/sh
@ -136,35 +196,58 @@
chmod +x $out/bin/gimp chmod +x $out/bin/gimp
''; '';
}; };
in in
{ {
packages = rec { packages = rec {
# Le package GIMP 3 de base # Ultra-minimal version for testing
gimp3 = gimp3-base; gimp3-test = buildGimp3 {
disabledFeatures = [
# Une version avec des fonctionnalités activées/désactivées "python"
gimp3-full = buildGimp3 { "javascript"
enabledFeatures = [
"python"
"javascript"
"lua" "lua"
"webp" "webkitgtk"
"openexr" "alsa"
"gudev"
"check-update"
"gtk-doc"
"g-ir-doc"
]; ];
}; };
default = gimp3; 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
}; };
# Fonction que d'autres flakes peuvent utiliser
lib = { lib = {
inherit buildGimp3 mkGimp3WithPlugins; inherit buildGimp3 mkGimp3WithPlugins;
}; };
# Applications exécutables
apps = rec { apps = rec {
gimp3 = flake-utils.lib.mkApp { drv = self.packages.${system}.gimp3; exePath = "/bin/gimp"; }; gimp3 = flake-utils.lib.mkApp {
drv = self.packages.${system}.gimp3;
exePath = "/bin/gimp";
};
default = gimp3; default = gimp3;
}; };
}); });