mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
niri: refactor & cleanup (#347232)
This commit is contained in:
commit
aff7476997
@ -1,22 +1,26 @@
|
||||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, nix-update-script
|
||||
, pkg-config
|
||||
, libdisplay-info
|
||||
, libxkbcommon
|
||||
, pango
|
||||
, pipewire
|
||||
, seatd
|
||||
, stdenv
|
||||
, wayland
|
||||
, systemd
|
||||
, libinput
|
||||
, mesa
|
||||
, fontconfig
|
||||
, libglvnd
|
||||
, autoPatchelfHook
|
||||
, clang
|
||||
{
|
||||
lib,
|
||||
clang,
|
||||
dbus,
|
||||
eudev,
|
||||
fetchFromGitHub,
|
||||
libdisplay-info,
|
||||
libglvnd,
|
||||
libinput,
|
||||
libxkbcommon,
|
||||
mesa,
|
||||
nix-update-script,
|
||||
pango,
|
||||
pipewire,
|
||||
pkg-config,
|
||||
rustPlatform,
|
||||
seatd,
|
||||
systemd,
|
||||
wayland,
|
||||
withDbus ? true,
|
||||
withDinit ? false,
|
||||
withScreencastSupport ? true,
|
||||
withSystemd ? true,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
@ -26,10 +30,16 @@ rustPlatform.buildRustPackage rec {
|
||||
src = fetchFromGitHub {
|
||||
owner = "YaLTeR";
|
||||
repo = "niri";
|
||||
rev = "v${version}";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-4YDrKMwXGVOBkeaISbxqf24rLuHvO98TnqxWYfgiSeg=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs resources/niri-session
|
||||
substituteInPlace resources/niri.service \
|
||||
--replace-fail '/usr/bin' "$out/bin"
|
||||
'';
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
outputHashes = {
|
||||
@ -38,56 +48,79 @@ rustPlatform.buildRustPackage rec {
|
||||
};
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
clang
|
||||
pkg-config
|
||||
rustPlatform.bindgenHook
|
||||
autoPatchelfHook
|
||||
clang
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
wayland
|
||||
systemd # For libudev
|
||||
seatd # For libseat
|
||||
buildInputs =
|
||||
[
|
||||
libdisplay-info
|
||||
libxkbcommon
|
||||
libinput
|
||||
mesa # For libgbm
|
||||
fontconfig
|
||||
stdenv.cc.cc.lib
|
||||
pipewire
|
||||
pango
|
||||
];
|
||||
|
||||
runtimeDependencies = [
|
||||
wayland
|
||||
mesa
|
||||
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
|
||||
|
||||
passthru.providedSessions = [ "niri" ];
|
||||
buildFeatures =
|
||||
lib.optional withDbus "dbus"
|
||||
++ lib.optional withDinit "dinit"
|
||||
++ lib.optional withScreencastSupport "xdp-gnome-screencast"
|
||||
++ lib.optional withSystemd "systemd";
|
||||
buildNoDefaultFeatures = true;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs ./resources/niri-session
|
||||
substituteInPlace ./resources/niri.service \
|
||||
--replace-fail '/usr/bin' "$out/bin"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
install -Dm0755 ./resources/niri-session -t $out/bin
|
||||
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
|
||||
'';
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
env = {
|
||||
# Force linking with libEGL and libwayland-client
|
||||
# so they can be discovered by `dlopen()`
|
||||
RUSTFLAGS = toString (
|
||||
map (arg: "-C link-arg=" + arg) [
|
||||
"-Wl,--push-state,--no-as-needed"
|
||||
"-lEGL"
|
||||
"-lwayland-client"
|
||||
"-Wl,--pop-state"
|
||||
]
|
||||
);
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
passthru = {
|
||||
providedSessions = [ "niri" ];
|
||||
updateScript = nix-update-script { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Scrollable-tiling Wayland compositor";
|
||||
homepage = "https://github.com/YaLTeR/niri";
|
||||
license = licenses.gpl3Only;
|
||||
maintainers = with maintainers; [ iogamaster foo-dogsquared sodiboo ];
|
||||
changelog = "https://github.com/YaLTeR/niri/releases/tag/v${version}";
|
||||
license = lib.licenses.gpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
iogamaster
|
||||
foo-dogsquared
|
||||
sodiboo
|
||||
getchoo
|
||||
];
|
||||
mainProgram = "niri";
|
||||
platforms = platforms.linux;
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user