Skip to content

Commit e533088

Browse files
ncfavierbobby285271
authored andcommitted
xfce.thunar: Expose unwrapped derivation
This exposes the unwrapped derivation as `xfce.thunar-unwrapped`, allowing it to be patched.
1 parent 9807714 commit e533088

File tree

3 files changed

+108
-119
lines changed

3 files changed

+108
-119
lines changed

pkgs/desktops/xfce/core/thunar/default.nix

Lines changed: 48 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -16,82 +16,63 @@
1616
pcre2,
1717
xfce4-panel,
1818
xfconf,
19-
makeWrapper,
20-
symlinkJoin,
21-
thunarPlugins ? [ ],
2219
withIntrospection ? false,
23-
buildPackages,
2420
gobject-introspection,
2521
}:
2622

27-
let
28-
unwrapped = mkXfceDerivation {
29-
category = "xfce";
30-
pname = "thunar";
31-
version = "4.20.3";
23+
mkXfceDerivation {
24+
category = "xfce";
25+
pname = "thunar";
26+
version = "4.20.3";
3227

33-
sha256 = "sha256-YOh7tuCja9F2VvzX+QqsKHJfebXWbhLqvcraq6PBOGo=";
28+
sha256 = "sha256-YOh7tuCja9F2VvzX+QqsKHJfebXWbhLqvcraq6PBOGo=";
3429

35-
nativeBuildInputs =
36-
[
37-
docbook_xsl
38-
libxslt
39-
]
40-
++ lib.optionals withIntrospection [
41-
gobject-introspection
42-
];
43-
44-
buildInputs = [
45-
exo
46-
gdk-pixbuf
47-
gtk3
48-
libX11
49-
libexif # image properties page
50-
libgudev
51-
libnotify
52-
libxfce4ui
53-
libxfce4util
54-
pcre2 # search & replace renamer
55-
xfce4-panel # trash panel applet plugin
56-
xfconf
30+
nativeBuildInputs =
31+
[
32+
docbook_xsl
33+
libxslt
34+
]
35+
++ lib.optionals withIntrospection [
36+
gobject-introspection
5737
];
5838

59-
configureFlags = [ "--with-custom-thunarx-dirs-enabled" ];
39+
buildInputs = [
40+
exo
41+
gdk-pixbuf
42+
gtk3
43+
libX11
44+
libexif # image properties page
45+
libgudev
46+
libnotify
47+
libxfce4ui
48+
libxfce4util
49+
pcre2 # search & replace renamer
50+
xfce4-panel # trash panel applet plugin
51+
xfconf
52+
];
6053

61-
# the desktop file … is in an insecure location»
62-
# which pops up when invoking desktop files that are
63-
# symlinks to the /nix/store
64-
#
65-
# this error was added by this commit:
66-
# https://github.com/xfce-mirror/thunar/commit/1ec8ff89ec5a3314fcd6a57f1475654ddecc9875
67-
postPatch = ''
68-
sed -i -e 's|thunar_dialogs_show_insecure_program (parent, _(".*"), file, exec)|1|' thunar/thunar-file.c
69-
'';
54+
configureFlags = [ "--with-custom-thunarx-dirs-enabled" ];
7055

71-
preFixup = ''
72-
gappsWrapperArgs+=(
73-
# https://github.com/NixOS/nixpkgs/issues/329688
74-
--prefix PATH : ${lib.makeBinPath [ exo ]}
75-
)
76-
'';
56+
# the desktop file … is in an insecure location»
57+
# which pops up when invoking desktop files that are
58+
# symlinks to the /nix/store
59+
#
60+
# this error was added by this commit:
61+
# https://github.com/xfce-mirror/thunar/commit/1ec8ff89ec5a3314fcd6a57f1475654ddecc9875
62+
postPatch = ''
63+
sed -i -e 's|thunar_dialogs_show_insecure_program (parent, _(".*"), file, exec)|1|' thunar/thunar-file.c
64+
'';
7765

78-
meta = with lib; {
79-
description = "Xfce file manager";
80-
mainProgram = "thunar";
81-
teams = [ teams.xfce ];
82-
};
83-
};
66+
preFixup = ''
67+
gappsWrapperArgs+=(
68+
# https://github.com/NixOS/nixpkgs/issues/329688
69+
--prefix PATH : ${lib.makeBinPath [ exo ]}
70+
)
71+
'';
8472

85-
in
86-
if thunarPlugins == [ ] then
87-
unwrapped
88-
else
89-
import ./wrapper.nix {
90-
inherit
91-
makeWrapper
92-
symlinkJoin
93-
thunarPlugins
94-
lib
95-
;
96-
thunar = unwrapped;
97-
}
73+
meta = with lib; {
74+
description = "Xfce file manager";
75+
mainProgram = "thunar";
76+
teams = [ teams.xfce ];
77+
};
78+
}

pkgs/desktops/xfce/core/thunar/wrapper.nix

Lines changed: 56 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,61 @@
22
lib,
33
makeWrapper,
44
symlinkJoin,
5-
thunar,
6-
thunarPlugins,
5+
thunar-unwrapped,
6+
thunarPlugins ? [ ],
77
}:
88

9-
symlinkJoin {
10-
name = "thunar-with-plugins-${thunar.version}";
11-
12-
paths = [ thunar ] ++ thunarPlugins;
13-
14-
nativeBuildInputs = [ makeWrapper ];
15-
16-
postBuild = ''
17-
wrapProgram "$out/bin/thunar" \
18-
--set "THUNARX_DIRS" "$out/lib/thunarx-3"
19-
20-
wrapProgram "$out/bin/thunar-settings" \
21-
--set "THUNARX_DIRS" "$out/lib/thunarx-3"
22-
23-
# NOTE: we need to remove the folder symlink itself and create
24-
# a new folder before trying to substitute any file below.
25-
rm -f "$out/lib/systemd/user"
26-
mkdir -p "$out/lib/systemd/user"
27-
28-
# point to wrapped binary in all service files
29-
for file in "lib/systemd/user/thunar.service" \
30-
"share/dbus-1/services/org.xfce.FileManager.service" \
31-
"share/dbus-1/services/org.xfce.Thunar.FileManager1.service" \
32-
"share/dbus-1/services/org.xfce.Thunar.service"
33-
do
34-
rm -f "$out/$file"
35-
substitute "${thunar}/$file" "$out/$file" \
36-
--replace "${thunar}" "$out"
37-
done
38-
'';
39-
40-
meta = with lib; {
41-
inherit (thunar.meta)
42-
homepage
43-
license
44-
platforms
45-
teams
46-
;
47-
48-
description =
49-
thunar.meta.description
50-
+
51-
optionalString (0 != length thunarPlugins)
52-
" (with plugins: ${concatStringsSep ", " (map (x: x.name) thunarPlugins)})";
53-
};
54-
}
9+
let
10+
thunar = thunar-unwrapped;
11+
in
12+
13+
if thunarPlugins == [ ] then
14+
thunar
15+
16+
else
17+
symlinkJoin {
18+
name = "thunar-with-plugins-${thunar.version}";
19+
20+
paths = [ thunar ] ++ thunarPlugins;
21+
22+
nativeBuildInputs = [ makeWrapper ];
23+
24+
postBuild = ''
25+
wrapProgram "$out/bin/thunar" \
26+
--set "THUNARX_DIRS" "$out/lib/thunarx-3"
27+
28+
wrapProgram "$out/bin/thunar-settings" \
29+
--set "THUNARX_DIRS" "$out/lib/thunarx-3"
30+
31+
# NOTE: we need to remove the folder symlink itself and create
32+
# a new folder before trying to substitute any file below.
33+
rm -f "$out/lib/systemd/user"
34+
mkdir -p "$out/lib/systemd/user"
35+
36+
# point to wrapped binary in all service files
37+
for file in "lib/systemd/user/thunar.service" \
38+
"share/dbus-1/services/org.xfce.FileManager.service" \
39+
"share/dbus-1/services/org.xfce.Thunar.FileManager1.service" \
40+
"share/dbus-1/services/org.xfce.Thunar.service"
41+
do
42+
rm -f "$out/$file"
43+
substitute "${thunar}/$file" "$out/$file" \
44+
--replace "${thunar}" "$out"
45+
done
46+
'';
47+
48+
meta = with lib; {
49+
inherit (thunar.meta)
50+
homepage
51+
license
52+
platforms
53+
teams
54+
;
55+
56+
description =
57+
thunar.meta.description
58+
+
59+
optionalString (0 != length thunarPlugins)
60+
" (with plugins: ${concatStringsSep ", " (map (x: x.name) thunarPlugins)})";
61+
};
62+
}

pkgs/desktops/xfce/default.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ makeScopeWithSplicing' {
3333

3434
libxfce4windowing = callPackage ./core/libxfce4windowing { };
3535

36-
thunar = callPackage ./core/thunar {
37-
thunarPlugins = [ ];
38-
};
36+
thunar-unwrapped = callPackage ./core/thunar { };
37+
38+
thunar = callPackage ./core/thunar/wrapper.nix { };
3939

4040
thunar-volman = callPackage ./core/thunar-volman { };
4141

@@ -169,7 +169,7 @@ makeScopeWithSplicing' {
169169

170170
xinitrc = self.xfce4-session.xinitrc; # added 2019-11-04
171171

172-
thunar-bare = self.thunar.override { thunarPlugins = [ ]; }; # added 2019-11-04
172+
thunar-bare = self.thunar-unwrapped; # added 2019-11-04
173173

174174
xfce4-datetime-plugin = throw ''
175175
xfce4-datetime-plugin has been removed: this plugin has been merged into the xfce4-panel's built-in clock

0 commit comments

Comments
 (0)