nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ symlinkJoin, lib, rofi-unwrapped, makeWrapper, wrapGAppsHook, gdk-pixbuf, hicolor-icon-theme, theme ? null, plugins ? [], symlink-dmenu ? false }:
2
3symlinkJoin {
4 name = "rofi-${rofi-unwrapped.version}";
5
6 paths = [
7 rofi-unwrapped.out
8 ] ++ (lib.forEach plugins (p: p.out));
9
10 nativeBuildInputs = [ makeWrapper wrapGAppsHook ];
11 buildInputs = [ gdk-pixbuf ];
12
13 preferLocalBuild = true;
14 passthru.unwrapped = rofi-unwrapped;
15
16 dontWrapGApps = true;
17
18 postBuild = ''
19 rm -rf $out/bin
20 mkdir $out/bin
21 ln -s ${rofi-unwrapped}/bin/* $out/bin
22 rm $out/bin/rofi
23
24 gappsWrapperArgsHook
25 makeWrapper ${rofi-unwrapped}/bin/rofi $out/bin/rofi \
26 ''${gappsWrapperArgs[@]} \
27 --prefix XDG_DATA_DIRS : ${hicolor-icon-theme}/share \
28 ${lib.optionalString (plugins != []) ''--prefix XDG_DATA_DIRS : ${lib.concatStringsSep ":" (lib.forEach plugins (p: "${p.out}/share"))}''} \
29 ${lib.optionalString (theme != null) ''--add-flags "-theme ${theme}"''} \
30 ${lib.optionalString (plugins != []) ''--add-flags "-plugin-path $out/lib/rofi"''}
31
32 ${lib.optionalString symlink-dmenu "ln -s ${rofi-unwrapped}/bin/rofi $out/bin/dmenu"}
33
34 rm $out/bin/rofi-theme-selector
35 makeWrapper ${rofi-unwrapped}/bin/rofi-theme-selector $out/bin/rofi-theme-selector \
36 --prefix XDG_DATA_DIRS : $out/share
37 '';
38
39 meta = rofi-unwrapped.meta // {
40 priority = (rofi-unwrapped.meta.priority or 0) - 1;
41 };
42}