|
2 | 2 | lib, |
3 | 3 | clang, |
4 | 4 | dbus, |
| 5 | + eudev, |
5 | 6 | fetchFromGitHub, |
6 | 7 | libdisplay-info, |
7 | 8 | libglvnd, |
|
16 | 17 | seatd, |
17 | 18 | systemd, |
18 | 19 | wayland, |
| 20 | + withDbus ? true, |
| 21 | + withDinit ? false, |
| 22 | + withScreencastSupport ? true, |
| 23 | + withSystemd ? true, |
19 | 24 | }: |
20 | 25 |
|
21 | 26 | rustPlatform.buildRustPackage rec { |
@@ -51,26 +56,40 @@ rustPlatform.buildRustPackage rec { |
51 | 56 | rustPlatform.bindgenHook |
52 | 57 | ]; |
53 | 58 |
|
54 | | - buildInputs = [ |
55 | | - dbus |
56 | | - libdisplay-info |
57 | | - libglvnd # For libEGL |
58 | | - libinput |
59 | | - libxkbcommon |
60 | | - mesa # For libgbm |
61 | | - pango |
62 | | - pipewire |
63 | | - seatd |
64 | | - systemd # Also includes libudev |
65 | | - wayland # For libwayland-client |
66 | | - ]; |
| 59 | + buildInputs = |
| 60 | + [ |
| 61 | + libdisplay-info |
| 62 | + libglvnd # For libEGL |
| 63 | + libinput |
| 64 | + libxkbcommon |
| 65 | + mesa # For libgbm |
| 66 | + pango |
| 67 | + seatd |
| 68 | + wayland # For libwayland-client |
| 69 | + ] |
| 70 | + ++ lib.optional (withDbus || withScreencastSupport || withSystemd) dbus |
| 71 | + ++ lib.optional withScreencastSupport pipewire |
| 72 | + ++ lib.optional withSystemd systemd # Includes libudev |
| 73 | + ++ lib.optional (!withSystemd) eudev; # Use an alternative libudev implementation when building w/o systemd |
67 | 74 |
|
68 | | - postInstall = '' |
69 | | - install -Dm0755 ./resources/niri-session -t $out/bin |
70 | | - install -Dm0644 resources/niri.desktop -t $out/share/wayland-sessions |
71 | | - install -Dm0644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal |
72 | | - install -Dm0644 resources/niri{-shutdown.target,.service} -t $out/share/systemd/user |
73 | | - ''; |
| 75 | + buildFeatures = |
| 76 | + lib.optional withDbus "dbus" |
| 77 | + ++ lib.optional withDinit "dinit" |
| 78 | + ++ lib.optional withScreencastSupport "xdp-gnome-screencast" |
| 79 | + ++ lib.optional withSystemd "systemd"; |
| 80 | + buildNoDefaultFeatures = true; |
| 81 | + |
| 82 | + postInstall = |
| 83 | + '' |
| 84 | + install -Dm0644 resources/niri.desktop -t $out/share/wayland-sessions |
| 85 | + '' |
| 86 | + + lib.optionalString withDbus '' |
| 87 | + install -Dm0644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal |
| 88 | + '' |
| 89 | + + lib.optionalString withSystemd '' |
| 90 | + install -Dm0755 resources/niri-session -t $out/bin |
| 91 | + install -Dm0644 resources/niri{-shutdown.target,.service} -t $out/share/systemd/user |
| 92 | + ''; |
74 | 93 |
|
75 | 94 | env = { |
76 | 95 | # Force linking with libEGL and libwayland-client |
|
0 commit comments