From e653e35fb410d0c95bc4056e8eb8ac6604ba3667 Mon Sep 17 00:00:00 2001 From: Tom Hunze Date: Thu, 24 Jul 2025 18:04:11 +0200 Subject: [PATCH 1/2] maintainers: add thunze --- maintainers/maintainer-list.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index f72df1c17bcf..d8ec6e7f5e09 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -25973,6 +25973,11 @@ name = "Chinmay D. Pai"; keys = [ { fingerprint = "7F3E EEAA EE66 93CC 8782 042A 7550 7BE2 56F4 0CED"; } ]; }; + thunze = { + name = "Tom Hunze"; + github = "thunze"; + githubId = 22795263; + }; tiagolobocastro = { email = "tiagolobocastro@gmail.com"; github = "tiagolobocastro"; From b3ad4503a867c92c28728dc099106c8f2325486d Mon Sep 17 00:00:00 2001 From: Tom Hunze Date: Thu, 24 Jul 2025 18:08:29 +0200 Subject: [PATCH 2/2] xapp-thumbnailers: init at 1.2.8 --- pkgs/by-name/xa/xapp-thumbnailers/meson.patch | 14 ++ pkgs/by-name/xa/xapp-thumbnailers/package.nix | 122 ++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 pkgs/by-name/xa/xapp-thumbnailers/meson.patch create mode 100644 pkgs/by-name/xa/xapp-thumbnailers/package.nix diff --git a/pkgs/by-name/xa/xapp-thumbnailers/meson.patch b/pkgs/by-name/xa/xapp-thumbnailers/meson.patch new file mode 100644 index 000000000000..d052e500328b --- /dev/null +++ b/pkgs/by-name/xa/xapp-thumbnailers/meson.patch @@ -0,0 +1,14 @@ +diff --git a/meson.build b/meson.build +index d0887d1..277cfb7 100644 +--- a/meson.build ++++ b/meson.build +@@ -4,8 +4,8 @@ project_url = 'https://github.com/linuxmint/xapp-thumbnailers' + version = meson.project_version() + + install_subdir( +- 'files', +- install_dir: '/', ++ 'files/usr', ++ install_dir: '', + strip_directory: true, + ) diff --git a/pkgs/by-name/xa/xapp-thumbnailers/package.nix b/pkgs/by-name/xa/xapp-thumbnailers/package.nix new file mode 100644 index 000000000000..7b31fd51d2ac --- /dev/null +++ b/pkgs/by-name/xa/xapp-thumbnailers/package.nix @@ -0,0 +1,122 @@ +{ + lib, + python3Packages, + fetchFromGitHub, + wrapGAppsNoGuiHook, + gobject-introspection, + meson, + ninja, + gdk-pixbuf, + xapp, + + dcraw, + gimp, + libjxl, + squashfsTools, + + # Exclude "raw" for now because dcraw is vulnerable. + enabledThumbnailers ? [ + "aiff" + "appimage" + "epub" + "gimp" + "jxl" + "mp3" + "ora" + "vorbiscomment" + ], + + # passthru.updateScript + nix-update-script, +}: + +python3Packages.buildPythonApplication rec { + pname = "xapp-thumbnailers"; + version = "1.2.8"; + pyproject = false; + + src = fetchFromGitHub { + owner = "linuxmint"; + repo = "xapp-thumbnailers"; + tag = version; + hash = "sha256-MX2TvtuOmqi8cpA/K8pSEPScUOXEmz++t7Xb/eDdb9c="; + }; + + patches = [ ./meson.patch ]; + + postPatch = + let + enabledThumbnailerFilenames = map (format: "xapp-${format}-thumbnailer") enabledThumbnailers; + in + '' + for path in files/usr/bin/xapp-*-thumbnailer; do + filename=$(basename "$path"); + if [[ ! " ${lib.concatStringsSep " " enabledThumbnailerFilenames} " =~ " $filename " ]]; then + rm "files/usr/bin/$filename" + rm "files/usr/share/thumbnailers/$filename.thumbnailer" + fi + done + + # Make thumbnailer binaries executable (because not all of them are), use absolute paths in thumbnailer files + for format in ${lib.concatStringsSep " " enabledThumbnailers}; do + chmod +x files/usr/bin/xapp-$format-thumbnailer + substituteInPlace files/usr/share/thumbnailers/xapp-$format-thumbnailer.thumbnailer \ + --replace-fail "TryExec=xapp-$format-thumbnailer" "TryExec=${placeholder "out"}/bin/xapp-$format-thumbnailer" \ + --replace-fail "Exec=xapp-$format-thumbnailer" "Exec=${placeholder "out"}/bin/xapp-$format-thumbnailer" + done + ''; + + nativeBuildInputs = [ + wrapGAppsNoGuiHook + gobject-introspection + meson + ninja + ]; + + buildInputs = [ + gdk-pixbuf + xapp + ]; + + dependencies = + with python3Packages; + [ + pillow + pygobject3 + ] + ++ lib.optional (builtins.elem "aiff" enabledThumbnailers) mutagen + ++ lib.optional (builtins.elem "appimage" enabledThumbnailers) pyelftools + ++ lib.optional (builtins.elem "mp3" enabledThumbnailers) eyed3 + ++ lib.optional (builtins.elem "vorbiscomment" enabledThumbnailers) mutagen; + + # Let the Python wrapper add `gappsWrapperArgs` to avoid two layers of wrapping. + dontWrapGApps = true; + + preFixup = + let + runtimeBinPackages = + lib.optional (builtins.elem "appimage" enabledThumbnailers) squashfsTools + ++ lib.optional (builtins.elem "gimp" enabledThumbnailers) gimp + ++ lib.optional (builtins.elem "jxl" enabledThumbnailers) libjxl + ++ lib.optional (builtins.elem "raw" enabledThumbnailers) dcraw; + in + '' + makeWrapperArgs+=( + "''${gappsWrapperArgs[@]}" \ + --prefix PATH : '${lib.makeBinPath runtimeBinPackages}' + ) + ''; + + pythonImportsCheck = [ "XappThumbnailers" ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Thumbnailers for GTK desktop environments"; + homepage = "https://github.com/linuxmint/xapp-thumbnailers"; + changelog = "https://github.com/linuxmint/xapp-thumbnailers/blob/${src.tag}/debian/changelog"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ thunze ]; + inherit (xapp.meta) platforms; + }; +}