niri: formatting

This commit is contained in:
Bloxx12 2025-07-25 16:59:12 +02:00
commit 000f4aa56b

View file

@ -11,91 +11,100 @@ let
inherit (config.modules.system) isGraphical; inherit (config.modules.system) isGraphical;
inherit (config.meta.mainUser) username; inherit (config.meta.mainUser) username;
cfg = config.modules.desktops.niri; cfg = config.modules.desktops.niri;
niri = pkgs.callPackage (_: pkgs.rustPlatform.buildRustPackage { niri = pkgs.callPackage (
pname = "niri"; _:
version = "unstable"; pkgs.rustPlatform.buildRustPackage {
pname = "niri";
version = "unstable";
src = sources.niri; src = sources.niri;
postPatch = '' postPatch = ''
patchShebangs resources/niri-session patchShebangs resources/niri-session
substituteInPlace resources/niri.service \ substituteInPlace resources/niri.service \
--replace-fail '/usr/bin' "$out/bin" --replace-fail '/usr/bin' "$out/bin"
''; '';
cargoLock = { cargoLock = {
allowBuiltinFetchGit = true; allowBuiltinFetchGit = true;
lockFile = "${sources.niri}/Cargo.lock"; lockFile = "${sources.niri}/Cargo.lock";
}; };
strictDeps = true; strictDeps = true;
doInstallCheck = false; doInstallCheck = false;
doCheck = false;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
rustPlatform.bindgenHook rustPlatform.bindgenHook
pkg-config pkg-config
installShellFiles installShellFiles
]; ];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
cairo cairo
dbus dbus
libGL libGL
libdisplay-info libdisplay-info
libinput libinput
seatd seatd
libxkbcommon libxkbcommon
libgbm libgbm
pango pango
wayland wayland
dbus dbus
pipewire pipewire
# Also includes libudev # Also includes libudev
systemd systemd
]; ];
buildFeatures = [ buildFeatures = [
"dbus" "dbus"
"dinit" "dinit"
"xdp-gnome-screencast" "xdp-gnome-screencast"
"systemd" "systemd"
]; ];
buildNoDefaultFeatures = true; buildNoDefaultFeatures = true;
postInstall = '' postInstall = ''
installShellCompletion --cmd niri \ installShellCompletion --cmd niri \
--bash <($out/bin/niri completions bash) \ --bash <($out/bin/niri completions bash) \
--fish <($out/bin/niri completions fish) \ --fish <($out/bin/niri completions fish) \
--zsh <($out/bin/niri completions zsh) --zsh <($out/bin/niri completions zsh)
install -Dm644 resources/niri.desktop -t $out/share/wayland-sessions install -Dm644 resources/niri.desktop -t $out/share/wayland-sessions
install -Dm644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal install -Dm644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal
install -Dm755 resources/niri-session $out/bin/niri-session install -Dm755 resources/niri-session $out/bin/niri-session
install -Dm644 resources/niri{.service,-shutdown.target} -t $out/share/systemd/user install -Dm644 resources/niri{.service,-shutdown.target} -t $out/share/systemd/user
''; '';
env = { env = {
# Force linking with libEGL and libwayland-client # Force linking with libEGL and libwayland-client
# so they can be discovered by `dlopen()` # so they can be discovered by `dlopen()`
RUSTFLAGS = toString ( RUSTFLAGS = toString (
map (arg: "-C link-arg=" + arg) [ map (arg: "-C link-arg=" + arg) [
"-Wl,--push-state,--no-as-needed" "-Wl,--push-state,--no-as-needed"
"-lEGL" "-lEGL"
"-lwayland-client" "-lwayland-client"
"-Wl,--pop-state" "-Wl,--pop-state"
] ]
); ++ [
}; "-Ctarget-cpu=native"
"-Cpanic=abort"
"-Clto=thin"
"-Cembed-bitcode=yes"
]
);
};
passthru = { passthru = {
providedSessions = [ "niri" ]; providedSessions = [ "niri" ];
}; };
meta.mainProgram = "niri"; meta.mainProgram = "niri";
}) { }; }
) { };
in in
{ {
options.modules.desktops.niri.enable = mkEnableOption "Niri, a scolling tiling wayland compositor"; options.modules.desktops.niri.enable = mkEnableOption "Niri, a scolling tiling wayland compositor";
@ -117,6 +126,7 @@ in
avizo avizo
playerctl playerctl
wl-clipboard wl-clipboard
fuzzel
; ;
}; };
}; };