ctucx.git: nixfiles

ctucx' nixfiles

commit 463c11da2e6ed3f413110d7725d82feb8aeb7217
parent f1b3977641d157b47cf843e2de6a9fe4d0ea48ae
Author: Leah (ctucx) <leah@ctu.cx>
Date: Wed, 13 Oct 2021 18:17:28 +0200

programs/gimp: add (and use dev build because it uses gtk3 which means wayland support)
3 files changed, 123 insertions(+), 0 deletions(-)
M
configurations/desktop-sway.nix
|
2
++
A
configurations/programs/gimp/default.nix
|
109
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
configurations/programs/gimp/remove-cc-reference.patch
|
12
++++++++++++
diff --git a/configurations/desktop-sway.nix b/configurations/desktop-sway.nix
@@ -59,6 +59,8 @@
     ./programs/mpv.nix
     ./programs/imv.nix
 
+    ./programs/gimp
+
 	./programs/thunar.nix
 	./programs/utilities.nix
 
diff --git a/configurations/programs/gimp/default.nix b/configurations/programs/gimp/default.nix
@@ -0,0 +1,109 @@
+{ lib, pkgs, ... }:
+
+let
+  gimp = pkgs.stdenv.mkDerivation rec {
+    pname = "gimp";
+    version = "2.99.6";
+
+    src = pkgs.fetchurl {
+      url    = "http://download.gimp.org/pub/gimp/v${lib.versions.majorMinor version}/${pname}-${version}.tar.bz2";
+      sha256 = "1836izsv4zymky43nmp8fplmb4j6kfwf03pk82wz4gas8hl4n9ld";
+    };
+
+    patches = [
+      # to remove compiler from the runtime closure, reference was retained via
+      # gimp --version --verbose output
+      (pkgs.substituteAll {
+        src        = ./remove-cc-reference.patch;
+        cc_version = pkgs.stdenv.cc.cc.name;
+      })
+    ];
+
+    nativeBuildInputs = with pkgs; [
+      autoreconfHook
+      pkg-config
+      intltool
+      gettext
+      makeWrapper
+      gtk-doc
+    ];
+
+    buildInputs = with pkgs; [
+      babl
+      gegl
+      gtk3
+      glib
+      gdk-pixbuf
+      pango
+      cairo
+      gexiv2
+      harfbuzz
+      isocodes
+      freetype
+      fontconfig
+      lcms
+      libpng
+      libjpeg
+      poppler
+      poppler_data
+      libtiff
+      openexr
+      libmng
+      librsvg
+      libwmf
+      zlib
+      libzip
+      ghostscript
+      aalib
+      shared-mime-info
+      libwebp
+      libheif
+      libexif
+      xorg.libXpm
+      glib-networking
+      libmypaint
+      mypaint-brushes1
+      libgudev
+      gobject-introspection
+      vala
+      appstream-glib
+      libarchive
+    ];
+
+    # needed by gimp-2.0.pc
+    propagatedBuildInputs = with pkgs; [
+      gegl_0_4
+    ];
+
+    configureFlags = [
+      "--without-webkit" # old version is required
+      "--disable-check-update"
+      "--with-bug-report-url=https://github.com/NixOS/nixpkgs/issues/new"
+      "--with-icc-directory=/run/current-system/sw/share/color/icc"
+      # fix libdir in pc files (${exec_prefix} needs to be passed verbatim)
+      "--libdir=\${exec_prefix}/lib"
+      # because otherwise it would try to download stuff in build
+      "--without-appdata-test"
+    ];
+
+    enableParallelBuilding = true;
+
+    # Check if librsvg was built with --disable-pixbuf-loader.
+    PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${pkgs.librsvg}/${pkgs.gdk-pixbuf.moduleDir}";
+
+    preConfigure = ''
+      # The check runs before glib-networking is registered
+      export GIO_EXTRA_MODULES="${pkgs.glib-networking}/lib/gio/modules:$GIO_EXTRA_MODULES"
+    '';
+
+    postFixup = ''
+      wrapProgram $out/bin/gimp-${lib.versions.majorMinor version} \
+        --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
+    '';
+  };
+
+in {
+
+  home-manager.users.leah.home.packages = [ gimp ];
+
+}
diff --git a/configurations/programs/gimp/remove-cc-reference.patch b/configurations/programs/gimp/remove-cc-reference.patch
@@ -0,0 +1,12 @@
+diff --git a/app/gimp-version.c b/app/gimp-version.c
+index 3d1894a036..48bb670b64 100644
+--- a/app/gimp-version.c
++++ b/app/gimp-version.c
+@@ -230,7 +230,7 @@ gimp_version (gboolean be_verbose,
+                                       GIMP_BUILD_ID,
+                                       gimp_version_get_revision (),
+                                       GIMP_BUILD_PLATFORM_FAMILY,
+-                                      CC_VERSION,
++                                      "@cc_version@",
+                                       lib_versions);
+       g_free (lib_versions);