nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 makeWrapper,
4 symlinkJoin,
5 thunar-unwrapped,
6 thunarPlugins ? [ ],
7}:
8
9let
10 thunar = thunar-unwrapped;
11in
12
13if thunarPlugins == [ ] then
14 thunar
15
16else
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 = {
49 inherit (thunar.meta)
50 homepage
51 license
52 platforms
53 teams
54 ;
55
56 description =
57 thunar.meta.description
58 +
59 lib.optionalString (0 != lib.length thunarPlugins)
60 " (with plugins: ${lib.concatStringsSep ", " (map (x: x.name) thunarPlugins)})";
61 };
62 }