Skip to content

Commit

Permalink
niri: allow configuration of build features
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed Oct 8, 2024
1 parent 6a2a508 commit 0c5d185
Showing 1 changed file with 38 additions and 19 deletions.
57 changes: 38 additions & 19 deletions pkgs/by-name/ni/niri/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
clang,
dbus,
eudev,
fetchFromGitHub,
libdisplay-info,
libglvnd,
Expand All @@ -16,6 +17,10 @@
seatd,
systemd,
wayland,
withDbus ? true,
withDinit ? false,
withScreencastSupport ? true,
withSystemd ? true,
}:

rustPlatform.buildRustPackage rec {
Expand Down Expand Up @@ -51,26 +56,40 @@ rustPlatform.buildRustPackage rec {
rustPlatform.bindgenHook
];

buildInputs = [
dbus
libdisplay-info
libglvnd # For libEGL
libinput
libxkbcommon
mesa # For libgbm
pango
pipewire
seatd
systemd # Also includes libudev
wayland # For libwayland-client
];
buildInputs =
[
libdisplay-info
libglvnd # For libEGL
libinput
libxkbcommon
mesa # For libgbm
pango
seatd
wayland # For libwayland-client
]
++ lib.optional (withDbus || withScreencastSupport || withSystemd) dbus
++ lib.optional withScreencastSupport pipewire
++ lib.optional withSystemd systemd # Includes libudev
++ lib.optional (!withSystemd) eudev; # Use an alternative libudev implementation when building w/o systemd

postInstall = ''
install -Dm0755 ./resources/niri-session -t $out/bin
install -Dm0644 resources/niri.desktop -t $out/share/wayland-sessions
install -Dm0644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal
install -Dm0644 resources/niri{-shutdown.target,.service} -t $out/share/systemd/user
'';
buildFeatures =
lib.optional withDbus "dbus"
++ lib.optional withDinit "dinit"
++ lib.optional withScreencastSupport "xdp-gnome-screencast"
++ lib.optional withSystemd "systemd";
buildNoDefaultFeatures = true;

postInstall =
''
install -Dm0644 resources/niri.desktop -t $out/share/wayland-sessions
''
+ lib.optionalString withDbus ''
install -Dm0644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal
''
+ lib.optionalString withSystemd ''
install -Dm0755 resources/niri-session -t $out/bin
install -Dm0644 resources/niri{-shutdown.target,.service} -t $out/share/systemd/user
'';

env = {
# Force linking with libEGL and libwayland-client
Expand Down

0 comments on commit 0c5d185

Please sign in to comment.