megapixels: search for postprocessing programs in NixOS specific global location

This commit is contained in:
Luflosi 2024-08-27 21:37:05 +02:00
parent d25ccf9c58
commit 5d9936f637
No known key found for this signature in database
GPG Key ID: 743C5DD6900A1FF0
2 changed files with 33 additions and 0 deletions

View File

@ -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
'';

View File

@ -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(