nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 pkg-config,
6 clang,
7 libclang,
8 makeWrapper,
9 lua5_4,
10 dbus,
11 wayland,
12 wayland-protocols,
13 pipewire,
14 vulkan-loader,
15 libxkbcommon,
16 libGL,
17 sqlite,
18 fontconfig,
19 freetype,
20}:
21
22rustPlatform.buildRustPackage rec {
23 pname = "moxnotify";
24 version = "0.1.0";
25
26 src = fetchFromGitHub {
27 owner = "mox-desktop";
28 repo = "moxnotify";
29 rev = "6726af08621072e0c95a147cf4ae63ea66c7e857";
30 hash = "sha256-tTgY/813WaW3K8QKbj6qwCVKOAA8zMqy97Q7Z5qA0JM=";
31 };
32
33 cargoHash = "sha256-o2YyPa7bX9585lsicJjhj1xJ1jMdU5mlxbEn/6zSy8U=";
34
35 nativeBuildInputs = [
36 pkg-config
37 clang
38 makeWrapper
39 ];
40
41 buildInputs = [
42 lua5_4
43 dbus
44 wayland
45 wayland-protocols
46 pipewire
47 vulkan-loader
48 libxkbcommon
49 libGL
50 sqlite
51 fontconfig
52 freetype
53 libclang.lib
54 ];
55
56 # Set LIBCLANG_PATH for bindgen
57 env.LIBCLANG_PATH = "${libclang.lib}/lib";
58
59 # Workspace members - build both daemon and ctl
60 cargoBuildFlags = [ "--workspace" ];
61 cargoTestFlags = [ "--workspace" ];
62
63 # Skip tests for now as they may require display/audio systems
64 doCheck = false;
65
66 # Install both binaries with proper names
67 postInstall = ''
68 # Rename binaries to have more descriptive names
69 mv $out/bin/daemon $out/bin/moxnotify
70 mv $out/bin/ctl $out/bin/moxctl
71
72 # Install D-Bus service file
73 mkdir -p $out/share/dbus-1/services
74 substitute ${src}/pl.mox.notify.service.in $out/share/dbus-1/services/pl.mox.notify.service \
75 --replace-fail "@bindir@" "$out/bin"
76 '';
77
78 # Wrap binaries with runtime dependencies for graphics libraries
79 postFixup = ''
80 wrapProgram $out/bin/moxnotify \
81 --prefix LD_LIBRARY_PATH : ${
82 lib.makeLibraryPath [
83 vulkan-loader
84 libGL
85 ]
86 }
87 wrapProgram $out/bin/moxctl \
88 --prefix LD_LIBRARY_PATH : ${
89 lib.makeLibraryPath [
90 vulkan-loader
91 libGL
92 ]
93 }
94 '';
95
96 meta = {
97 description = "Feature-rich hardware-accelerated keyboard driven Wayland notification daemon";
98 homepage = "https://github.com/mox-desktop/moxnotify";
99 license = lib.licenses.mit;
100 maintainers = with lib.maintainers; [ logger ];
101 platforms = lib.platforms.linux; # Wayland-specific, Linux only
102 mainProgram = "moxnotify";
103 };
104}