init
This commit is contained in:
commit
50cc79e001
171
flake.nix
Normal file
171
flake.nix
Normal file
@ -0,0 +1,171 @@
|
||||
{
|
||||
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/gimp-3.0";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, gimp-source }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
# Fonction pour construire GIMP 3 à partir du code source
|
||||
buildGimp3 = {
|
||||
version ? "3.0.0",
|
||||
enabledFeatures ? [],
|
||||
disabledFeatures ? []
|
||||
}: pkgs.stdenv.mkDerivation {
|
||||
pname = "gimp";
|
||||
inherit version;
|
||||
|
||||
src = gimp-source;
|
||||
|
||||
# Dépendances de construction
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
meson
|
||||
ninja
|
||||
python3
|
||||
gettext
|
||||
perl
|
||||
intltool
|
||||
appstream-glib
|
||||
desktop-file-utils
|
||||
gobject-introspection
|
||||
wrapGAppsHook
|
||||
];
|
||||
|
||||
# Dépendances d'exécution
|
||||
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
|
||||
aalib
|
||||
openexr
|
||||
dbus-glib
|
||||
xorg.libXmu
|
||||
xorg.libXpm
|
||||
zlib
|
||||
bzip2
|
||||
] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) [
|
||||
libunwind
|
||||
];
|
||||
|
||||
# Configuration meson
|
||||
mesonFlags = [
|
||||
"-Dbuild-id=Nix"
|
||||
"-Dgtk-doc=false"
|
||||
]
|
||||
++ pkgs.lib.optionals (enabledFeatures != [])
|
||||
(map (feature: "-D${feature}=enabled") enabledFeatures)
|
||||
++ pkgs.lib.optionals (disabledFeatures != [])
|
||||
(map (feature: "-D${feature}=disabled") disabledFeatures);
|
||||
|
||||
# Post-installation : configuration des plugins
|
||||
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
|
||||
'';
|
||||
|
||||
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 = [ maintainers.your-github-username ];
|
||||
};
|
||||
};
|
||||
|
||||
# Construction de base de GIMP 3
|
||||
gimp3-base = buildGimp3 {};
|
||||
|
||||
# Fonction pour créer un GIMP 3 avec des plugins personnalisés
|
||||
mkGimp3WithPlugins = {
|
||||
plugins ? [],
|
||||
enabledFeatures ? [],
|
||||
disabledFeatures ? []
|
||||
}: pkgs.symlinkJoin {
|
||||
name = "gimp3-with-plugins";
|
||||
paths = [ (buildGimp3 { inherit enabledFeatures disabledFeatures; }) ] ++ plugins;
|
||||
|
||||
# Script pour ajouter les plugins au chemin de recherche de GIMP
|
||||
postBuild = ''
|
||||
# Création d'un wrapper qui configure les chemins des plugins
|
||||
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 {
|
||||
# Le package GIMP 3 de base
|
||||
gimp3 = gimp3-base;
|
||||
|
||||
# Une version avec des fonctionnalités activées/désactivées
|
||||
gimp3-full = buildGimp3 {
|
||||
enabledFeatures = [
|
||||
"python"
|
||||
"javascript"
|
||||
"lua"
|
||||
"webp"
|
||||
"openexr"
|
||||
];
|
||||
};
|
||||
|
||||
default = gimp3;
|
||||
};
|
||||
|
||||
# Fonction que d'autres flakes peuvent utiliser
|
||||
lib = {
|
||||
inherit buildGimp3 mkGimp3WithPlugins;
|
||||
};
|
||||
|
||||
# Applications exécutables
|
||||
apps = rec {
|
||||
gimp3 = flake-utils.lib.mkApp { drv = self.packages.${system}.gimp3; exePath = "/bin/gimp"; };
|
||||
default = gimp3;
|
||||
};
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user