Skip to content

Commit 0c5d185

Browse files
committed
niri: allow configuration of build features
1 parent 6a2a508 commit 0c5d185

File tree

1 file changed

+38
-19
lines changed

1 file changed

+38
-19
lines changed

pkgs/by-name/ni/niri/package.nix

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
lib,
33
clang,
44
dbus,
5+
eudev,
56
fetchFromGitHub,
67
libdisplay-info,
78
libglvnd,
@@ -16,6 +17,10 @@
1617
seatd,
1718
systemd,
1819
wayland,
20+
withDbus ? true,
21+
withDinit ? false,
22+
withScreencastSupport ? true,
23+
withSystemd ? true,
1924
}:
2025

2126
rustPlatform.buildRustPackage rec {
@@ -51,26 +56,40 @@ rustPlatform.buildRustPackage rec {
5156
rustPlatform.bindgenHook
5257
];
5358

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
6774

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+
'';
7493

7594
env = {
7695
# Force linking with libEGL and libwayland-client

0 commit comments

Comments
 (0)