diff --git a/pkgs/by-name/me/megapixels/package.nix b/pkgs/by-name/me/megapixels/package.nix index 91bd2b302b94..34eefdcbf139 100644 --- a/pkgs/by-name/me/megapixels/package.nix +++ b/pkgs/by-name/me/megapixels/package.nix @@ -54,6 +54,12 @@ stdenv.mkDerivation (finalAttrs: { zbar ]; + patches = [ + # In the settings menu of Megapixels the user can select a different postprocessing script. The path to the script is then stored in a dconf setting. If the path changes, for example because it is in the Nix store and a dependency of the postprocessor changes, Megapixels will try to use this now non-existing old path. This will cause Megapixels to not save any images that were taken until the user opens the settings again and selects a postprocessor again. Using a global path allows the setting to keep working. + # Note that this patch only fixes the issue for external postprocessors like postprocessd but the postprocessor script that comes with Megapixels is still refered to by the Nix store path. + ./search-for-postprocessors-in-NixOS-specific-global-location.patch + ]; + postInstall = '' glib-compile-schemas $out/share/glib-2.0/schemas ''; diff --git a/pkgs/by-name/me/megapixels/search-for-postprocessors-in-NixOS-specific-global-location.patch b/pkgs/by-name/me/megapixels/search-for-postprocessors-in-NixOS-specific-global-location.patch new file mode 100644 index 000000000000..85320316de02 --- /dev/null +++ b/pkgs/by-name/me/megapixels/search-for-postprocessors-in-NixOS-specific-global-location.patch @@ -0,0 +1,27 @@ +--- a/src/process_pipeline.c ++++ b/src/process_pipeline.c +@@ -179,10 +179,10 @@ mp_process_find_all_processors(GtkListStore *store) + store, &iter, 0, buffer, 1, "(built-in) postprocess.sh", -1); + } + +- // Find extra packaged postprocessor scripts +- // These should be packaged in +- // /usr/share/megapixels/postprocessor.d/executable +- sprintf(buffer, "%s/megapixels/postprocessor.d", DATADIR); ++ // Find extra system postprocessor scripts ++ // These should be accessible in ++ // /run/current-system/sw/share/megapixels/postprocessor.d/executable ++ sprintf(buffer, "/run/current-system/sw/share/megapixels/postprocessor.d"); + DIR *d; + struct dirent *dir; + d = opendir(buffer); +@@ -192,8 +192,7 @@ mp_process_find_all_processors(GtkListStore *store) + continue; + } + sprintf(buffer, +- "%s/megapixels/postprocessor.d/%s", +- DATADIR, ++ "/run/current-system/sw/share/megapixels/postprocessor.d/%s", + dir->d_name); + gtk_list_store_insert(store, &iter, -1); + gtk_list_store_set( diff --git a/pkgs/by-name/po/postprocessd/package.nix b/pkgs/by-name/po/postprocessd/package.nix new file mode 100644 index 000000000000..ef74fd7ad53b --- /dev/null +++ b/pkgs/by-name/po/postprocessd/package.nix @@ -0,0 +1,53 @@ +{ + lib, + fetchFromSourcehut, + libexif, + libraw, + meson, + ninja, + opencv4, + pkg-config, + scdoc, + stdenv, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "postprocessd"; + version = "0.3.0"; + + src = fetchFromSourcehut { + owner = "~martijnbraam"; + repo = "postprocessd"; + rev = finalAttrs.version; + hash = "sha256-xqEjjAv27TUrEU/5j8Um7fTFjmIYZovyJCccbtHPuGo="; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + scdoc + ]; + + depsBuildBuild = [ + pkg-config + ]; + + buildInputs = [ + libexif + libraw + opencv4 + ]; + + strictDeps = true; + + meta = { + description = "Queueing megapixels post-processor"; + homepage = "https://git.sr.ht/~martijnbraam/postprocessd"; + changelog = "https://git.sr.ht/~martijnbraam/postprocessd/refs/${finalAttrs.version}"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ Luflosi ]; + platforms = lib.platforms.linux; + mainProgram = "postprocess-single"; + }; +})