nixos-config/pkgs/niri/default.nix

94 lines
2.0 KiB
Nix
Raw Normal View History

2023-12-27 11:15:25 +00:00
{ lib
, fetchFromGitHub
, rustPlatform
, pkg-config
, pipewire
, udev
, libxkbcommon
, libinput
2024-01-10 14:24:34 +00:00
, libglvnd
2023-12-27 11:15:25 +00:00
, systemd
, wayland
, mesa
, seatd
2024-01-01 05:56:10 +00:00
# Session script dependencies.
, makeBinaryWrapper
, coreutils
, dbus
2023-12-27 11:15:25 +00:00
}:
rustPlatform.buildRustPackage rec {
pname = "niri";
2024-01-09 02:52:10 +00:00
version = "0.1.0-alpha.3";
2023-12-27 11:15:25 +00:00
src = fetchFromGitHub {
owner = "YaLTeR";
repo = pname;
rev = "v${version}";
2024-01-09 02:52:10 +00:00
hash = "sha256-X3n8Mt3M5+Z8YDvYZOVCgKSHLTQJtBdbMBl0c5O/tt0=";
2023-12-27 11:15:25 +00:00
};
nativeBuildInputs = [
makeBinaryWrapper
2023-12-27 11:15:25 +00:00
pkg-config
rustPlatform.bindgenHook
2023-12-27 11:15:25 +00:00
];
buildInputs = [
libinput
libxkbcommon
2024-01-10 14:24:34 +00:00
libglvnd
2023-12-27 11:15:25 +00:00
mesa
pipewire
seatd
systemd
udev
wayland
];
cargoLock = {
lockFile = "${src}/Cargo.lock";
2023-12-27 11:15:25 +00:00
outputHashes = {
2024-01-09 02:52:10 +00:00
"smithay-0.3.0" = "sha256-+VIKgdonZScAb38QcSatyoYGPSV3Q7lscd3U5jajdbM=";
2023-12-27 11:15:25 +00:00
};
};
2024-01-10 14:24:34 +00:00
RUSTFLAGS = builtins.map (arg: "-C link-arg=${arg}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lwayland-client"
"-Wl,--pop-state"
];
postPatch = ''
patchShebangs ./resources/niri-session
substituteInPlace ./resources/niri.service \
--replace '/usr/bin' "$out/bin"
'';
postInstall = ''
install -Dm0755 resources/niri-session -t $out/bin
# This session script is used as a system component so we may as well fully
# wrap this with nixpkgs' dependencies.
wrapProgram $out/bin/niri-session \
--prefix PATH ':' '${lib.makeBinPath [ coreutils systemd dbus ]}'
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/lib/systemd/user
'';
passthru.providedSessions = [ "niri" ];
2023-12-27 11:15:25 +00:00
meta = with lib; {
homepage = "https://github.com/YaLTeR/niri";
description = "Scrollable tiling window manager";
license = licenses.gpl3Plus;
mainProgram = "niri";
2023-12-27 11:15:25 +00:00
maintainers = with maintainers; [ foo-dogsquared ];
platforms = platforms.linux;
};
}