restinio: fix build (#375955)
[NixPkgs.git] / pkgs / desktops / xfce / core / thunar / wrapper.nix
blob925f8487ee0b3ba2e7ed8efe8b67afe69088730a
2   lib,
3   makeWrapper,
4   symlinkJoin,
5   thunar,
6   thunarPlugins,
7 }:
9 symlinkJoin {
10   name = "thunar-with-plugins-${thunar.version}";
12   paths = [ thunar ] ++ thunarPlugins;
14   nativeBuildInputs = [ makeWrapper ];
16   postBuild = ''
17     wrapProgram "$out/bin/thunar" \
18       --set "THUNARX_DIRS" "$out/lib/thunarx-3"
20     wrapProgram "$out/bin/thunar-settings" \
21       --set "THUNARX_DIRS" "$out/lib/thunarx-3"
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"
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   '';
40   meta = with lib; {
41     inherit (thunar.meta)
42       homepage
43       license
44       platforms
45       maintainers
46       ;
48     description =
49       thunar.meta.description
50       +
51         optionalString (0 != length thunarPlugins)
52           " (with plugins: ${concatStringsSep ", " (map (x: x.name) thunarPlugins)})";
53   };