1{
2 cmake,
3 fetchFromGitHub,
4 glib,
5 gtk3,
6 lib,
7 libsoup_3,
8 networkmanager,
9 pkg-config,
10 rustPlatform,
11 versionCheckHook,
12 webkitgtk_4_1,
13 wrapGAppsHook3,
14 xdotool,
15 nix-update-script,
16}:
17rustPlatform.buildRustPackage rec {
18 pname = "rmenu";
19 version = "1.3.0";
20
21 src = fetchFromGitHub {
22 tag = "v${version}";
23 owner = "imgurbot12";
24 repo = "rmenu";
25 hash = "sha256-cmuB7JfHQuDFo8YaenTDwpe+TxKFaoJM5YwrT7eAfPM=";
26 };
27
28 nativeBuildInputs = [
29 pkg-config
30 cmake
31 wrapGAppsHook3
32 ];
33
34 buildInputs = [
35 glib
36 gtk3
37 libsoup_3
38 networkmanager
39 webkitgtk_4_1
40 xdotool
41 ];
42
43 strictDeps = true;
44
45 cargoHash = "sha256-FIlFy3/Hih40My5fTykYjvaQEmnB3ZC5vX3lfKdW9Gk=";
46
47 postInstall = ''
48 # copy themes and plugins
49 mkdir -p $out/themes $out/plugins/css
50 cp -vfr $src/themes/* $out/themes
51 cp -vfr $src/plugins/misc/* $out/plugins
52 mv $out/bin/* $out/plugins # everything is a plugin by default
53
54 # rmenu and rmenu-build are actual binaries
55 mv $out/plugins/rmenu $out/bin/rmenu
56 mv $out/plugins/rmenu-build $out/bin/rmenu-build
57
58 # fix plugin names
59 # desktop network pactl-audio.sh powermenu.sh run window emoji search
60 for plugin in desktop emoji files network run search window ; do
61 mv $out/plugins/$plugin $out/plugins/rmenu-$plugin
62 done
63
64 # fix config and theme
65 mkdir -p $out/share/rmenu
66 cp -vf $src/rmenu/public/config.yaml $out/share/rmenu/config.yaml
67 cp -vf $src/plugins/emoji/css/* $out/plugins/css
68 substituteInPlace $out/share/rmenu/config.yaml --replace-fail "~/.config/rmenu" "$out"
69 ln -sf $out/themes/dark.css $out/share/rmenu/style.css
70 '';
71
72 preFixup = ''
73 # rmenu expects the config to be in XDG_CONFIG_DIRS
74 # shell script plugins called from rmenu binary expect the rmenu-build binary to be on the PATH,
75 # which needs wrapping in temporary environments like shells and flakes
76 gappsWrapperArgs+=(
77 --suffix XDG_CONFIG_DIRS : "$out/share"
78 --suffix PATH : "$out/bin"
79 )
80 '';
81
82 doInstallCheck = true;
83 nativeInstallCheckInputs = [ versionCheckHook ];
84
85 passthru.updateScript = nix-update-script { };
86
87 meta = {
88 changelog = "https://github.com/imgurbot12/rmenu/releases/tag/v${version}";
89 description = "Another customizable Application-Launcher written in Rust";
90 homepage = "https://github.com/imgurbot12/rmenu";
91 license = lib.licenses.mit;
92 mainProgram = "rmenu";
93 maintainers = with lib.maintainers; [ grimmauld ];
94 platforms = lib.platforms.linux;
95 };
96}