diff options
Diffstat (limited to 'nixpkgs/pkgs/desktops/xfce/core/thunar')
3 files changed, 152 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/desktops/xfce/core/thunar/default.nix b/nixpkgs/pkgs/desktops/xfce/core/thunar/default.nix new file mode 100644 index 000000000000..24df606e2466 --- /dev/null +++ b/nixpkgs/pkgs/desktops/xfce/core/thunar/default.nix @@ -0,0 +1,70 @@ +{ mkXfceDerivation +, lib +, docbook_xsl +, exo +, gdk-pixbuf +, gtk3 +, libgudev +, libnotify +, libX11 +, libxfce4ui +, libxfce4util +, libxslt +, xfconf +, gobject-introspection +, gvfs +, makeWrapper +, symlinkJoin +, thunarPlugins ? [] +}: + +let unwrapped = mkXfceDerivation { + category = "xfce"; + pname = "thunar"; + version = "1.8.14"; + + sha256 = "1ph9bcqfm2nccliagl8zdl1dizh62qnr8m5hacri3cs2jhc0jjpy"; + + nativeBuildInputs = [ + docbook_xsl + gobject-introspection + libxslt + ]; + + buildInputs = [ + exo + gdk-pixbuf + gtk3 + gvfs + libX11 + libgudev + libnotify + libxfce4ui + libxfce4util + xfconf + ]; + + patches = [ + ./thunarx_plugins_directory.patch + ]; + + # the desktop file … is in an insecure location» + # which pops up when invoking desktop files that are + # symlinks to the /nix/store + # + # this error was added by this commit: + # https://github.com/xfce-mirror/thunar/commit/1ec8ff89ec5a3314fcd6a57f1475654ddecc9875 + postPatch = '' + sed -i -e 's|thunar_dialogs_show_insecure_program (parent, _(".*"), file, exec)|1|' thunar/thunar-file.c + ''; + + meta = { + description = "Xfce file manager"; + }; +}; + +in if thunarPlugins == [] then unwrapped + else import ./wrapper.nix { + inherit makeWrapper symlinkJoin thunarPlugins lib; + thunar = unwrapped; + } diff --git a/nixpkgs/pkgs/desktops/xfce/core/thunar/thunarx_plugins_directory.patch b/nixpkgs/pkgs/desktops/xfce/core/thunar/thunarx_plugins_directory.patch new file mode 100644 index 000000000000..594a81c829ef --- /dev/null +++ b/nixpkgs/pkgs/desktops/xfce/core/thunar/thunarx_plugins_directory.patch @@ -0,0 +1,48 @@ +diff --git a/thunarx/thunarx-provider-factory.c b/thunarx/thunarx-provider-factory.c +index 94b11545..1f66c982 100644 +--- a/thunarx/thunarx-provider-factory.c ++++ b/thunarx/thunarx-provider-factory.c +@@ -150,12 +150,19 @@ static GList* + thunarx_provider_factory_load_modules (ThunarxProviderFactory *factory) + { + ThunarxProviderModule *module; ++ const gchar *thunar_dir; + const gchar *name; + GList *modules = NULL; + GList *lp; + GDir *dp; + +- dp = g_dir_open (THUNARX_DIRECTORY, 0, NULL); ++ thunar_dir = g_getenv("THUNARX_MODULE_DIR"); ++ if (NULL == thunar_dir) ++ { ++ thunar_dir = THUNARX_DIRECTORY; ++ } ++ ++ dp = g_dir_open (thunar_dir, 0, NULL); + if (G_LIKELY (dp != NULL)) + { + /* determine the types for all existing plugins */ +diff --git a/thunarx/thunarx-provider-module.c b/thunarx/thunarx-provider-module.c +index 023ad2ae..b1d1be8f 100644 +--- a/thunarx/thunarx-provider-module.c ++++ b/thunarx/thunarx-provider-module.c +@@ -174,10 +174,17 @@ static gboolean + thunarx_provider_module_load (GTypeModule *type_module) + { + ThunarxProviderModule *module = THUNARX_PROVIDER_MODULE (type_module); ++ const gchar *thunar_dir; + gchar *path; + ++ thunar_dir = g_getenv("THUNARX_MODULE_DIR"); ++ if (NULL == thunar_dir) ++ { ++ thunar_dir = THUNARX_DIRECTORY; ++ } ++ + /* load the module using the runtime link editor */ +- path = g_build_filename (THUNARX_DIRECTORY, type_module->name, NULL); ++ path = g_build_filename (thunar_dir, type_module->name, NULL); + module->library = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); + g_free (path); + diff --git a/nixpkgs/pkgs/desktops/xfce/core/thunar/wrapper.nix b/nixpkgs/pkgs/desktops/xfce/core/thunar/wrapper.nix new file mode 100644 index 000000000000..cc44e6624571 --- /dev/null +++ b/nixpkgs/pkgs/desktops/xfce/core/thunar/wrapper.nix @@ -0,0 +1,34 @@ +{ makeWrapper, symlinkJoin, thunar, thunarPlugins, lib }: + +symlinkJoin { + name = "thunar-with-plugins-${thunar.version}"; + + paths = [ thunar ] ++ thunarPlugins; + + buildInputs = [ makeWrapper ]; + + postBuild = '' + wrapProgram "$out/bin/thunar" \ + --set "THUNARX_MODULE_DIR" "$out/lib/thunarx-3" + + wrapProgram "$out/bin/thunar-settings" \ + --set "THUNARX_MODULE_DIR" "$out/lib/thunarx-3" + + for file in "lib/systemd/user/thunar.service" "share/dbus-1/services/org.xfce.FileManager.service" \ + "share/dbus-1/services/org.xfce.Thunar.FileManager1.service" \ + "share/dbus-1/services/org.xfce.Thunar.service" + do + rm -f "$out/$file" + substitute "${thunar}/$file" "$out/$file" \ + --replace "${thunar}" "$out" + done + ''; + + meta = with lib; { + inherit (thunar.meta) homepage license platforms maintainers; + + description = thunar.meta.description + optionalString + (0 != length thunarPlugins) + " (with plugins: ${concatStrings (intersperse ", " (map (x: x.name) thunarPlugins))})"; + }; +} |