xfce.thunar: Expose unwrapped derivation (#425075)

This commit is contained in:
Bobby Rong 2025-07-15 23:37:04 +08:00 committed by GitHub
commit 8fe37315e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 102 additions and 111 deletions

View File

@ -19,6 +19,8 @@
services.xserver.desktopManager.xfce.enable = true;
environment.systemPackages = [ pkgs.xfce.xfce4-whiskermenu-plugin ];
programs.thunar.plugins = [ pkgs.xfce.thunar-archive-plugin ];
};
enableOCR = true;

View File

@ -16,82 +16,63 @@
pcre2,
xfce4-panel,
xfconf,
makeWrapper,
symlinkJoin,
thunarPlugins ? [ ],
withIntrospection ? false,
buildPackages,
gobject-introspection,
}:
let
unwrapped = mkXfceDerivation {
category = "xfce";
pname = "thunar";
version = "4.20.3";
mkXfceDerivation {
category = "xfce";
pname = "thunar";
version = "4.20.3";
sha256 = "sha256-YOh7tuCja9F2VvzX+QqsKHJfebXWbhLqvcraq6PBOGo=";
sha256 = "sha256-YOh7tuCja9F2VvzX+QqsKHJfebXWbhLqvcraq6PBOGo=";
nativeBuildInputs =
[
docbook_xsl
libxslt
]
++ lib.optionals withIntrospection [
gobject-introspection
];
buildInputs = [
exo
gdk-pixbuf
gtk3
libX11
libexif # image properties page
libgudev
libnotify
libxfce4ui
libxfce4util
pcre2 # search & replace renamer
xfce4-panel # trash panel applet plugin
xfconf
nativeBuildInputs =
[
docbook_xsl
libxslt
]
++ lib.optionals withIntrospection [
gobject-introspection
];
configureFlags = [ "--with-custom-thunarx-dirs-enabled" ];
buildInputs = [
exo
gdk-pixbuf
gtk3
libX11
libexif # image properties page
libgudev
libnotify
libxfce4ui
libxfce4util
pcre2 # search & replace renamer
xfce4-panel # trash panel applet plugin
xfconf
];
# 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
'';
configureFlags = [ "--with-custom-thunarx-dirs-enabled" ];
preFixup = ''
gappsWrapperArgs+=(
# https://github.com/NixOS/nixpkgs/issues/329688
--prefix PATH : ${lib.makeBinPath [ exo ]}
)
'';
# 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 = with lib; {
description = "Xfce file manager";
mainProgram = "thunar";
teams = [ teams.xfce ];
};
preFixup = ''
gappsWrapperArgs+=(
# https://github.com/NixOS/nixpkgs/issues/329688
--prefix PATH : ${lib.makeBinPath [ exo ]}
)
'';
meta = with lib; {
description = "Xfce file manager";
mainProgram = "thunar";
teams = [ teams.xfce ];
};
in
if thunarPlugins == [ ] then
unwrapped
else
import ./wrapper.nix {
inherit
makeWrapper
symlinkJoin
thunarPlugins
lib
;
thunar = unwrapped;
}
}

View File

@ -2,53 +2,61 @@
lib,
makeWrapper,
symlinkJoin,
thunar,
thunarPlugins,
thunar-unwrapped,
thunarPlugins ? [ ],
}:
symlinkJoin {
name = "thunar-with-plugins-${thunar.version}";
let
thunar = thunar-unwrapped;
in
paths = [ thunar ] ++ thunarPlugins;
if thunarPlugins == [ ] then
thunar
nativeBuildInputs = [ makeWrapper ];
else
symlinkJoin {
name = "thunar-with-plugins-${thunar.version}";
postBuild = ''
wrapProgram "$out/bin/thunar" \
--set "THUNARX_DIRS" "$out/lib/thunarx-3"
paths = [ thunar ] ++ thunarPlugins;
wrapProgram "$out/bin/thunar-settings" \
--set "THUNARX_DIRS" "$out/lib/thunarx-3"
nativeBuildInputs = [ makeWrapper ];
# NOTE: we need to remove the folder symlink itself and create
# a new folder before trying to substitute any file below.
rm -f "$out/lib/systemd/user"
mkdir -p "$out/lib/systemd/user"
postBuild = ''
wrapProgram "$out/bin/thunar" \
--set "THUNARX_DIRS" "$out/lib/thunarx-3"
# point to wrapped binary in all service files
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
'';
wrapProgram "$out/bin/thunar-settings" \
--set "THUNARX_DIRS" "$out/lib/thunarx-3"
meta = with lib; {
inherit (thunar.meta)
homepage
license
platforms
teams
;
# NOTE: we need to remove the folder symlink itself and create
# a new folder before trying to substitute any file below.
rm -f "$out/lib/systemd/user"
mkdir -p "$out/lib/systemd/user"
description =
thunar.meta.description
+
optionalString (0 != length thunarPlugins)
" (with plugins: ${concatStringsSep ", " (map (x: x.name) thunarPlugins)})";
};
}
# point to wrapped binary in all service files
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
teams
;
description =
thunar.meta.description
+
optionalString (0 != length thunarPlugins)
" (with plugins: ${concatStringsSep ", " (map (x: x.name) thunarPlugins)})";
};
}

View File

@ -33,9 +33,9 @@ makeScopeWithSplicing' {
libxfce4windowing = callPackage ./core/libxfce4windowing { };
thunar = callPackage ./core/thunar {
thunarPlugins = [ ];
};
thunar-unwrapped = callPackage ./core/thunar { };
thunar = callPackage ./core/thunar/wrapper.nix { };
thunar-volman = callPackage ./core/thunar-volman { };
@ -169,7 +169,7 @@ makeScopeWithSplicing' {
xinitrc = self.xfce4-session.xinitrc; # added 2019-11-04
thunar-bare = self.thunar.override { thunarPlugins = [ ]; }; # added 2019-11-04
thunar-bare = self.thunar-unwrapped; # added 2019-11-04
xfce4-datetime-plugin = throw ''
xfce4-datetime-plugin has been removed: this plugin has been merged into the xfce4-panel's built-in clock