mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
flake: add overlay output
This commit is contained in:
@@ -81,132 +81,10 @@
|
|||||||
packages = forAllSystems (
|
packages = forAllSystems (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
inherit (self.packages.${system}) niri;
|
inherit (self.overlays.default nixpkgsFor.${system} null) niri;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
niri = nixpkgsFor.${system}.callPackage (
|
inherit niri;
|
||||||
{
|
|
||||||
cairo,
|
|
||||||
clang,
|
|
||||||
dbus,
|
|
||||||
libGL,
|
|
||||||
libclang,
|
|
||||||
libdisplay-info,
|
|
||||||
libinput,
|
|
||||||
libseat,
|
|
||||||
libxkbcommon,
|
|
||||||
mesa,
|
|
||||||
pango,
|
|
||||||
pipewire,
|
|
||||||
pkg-config,
|
|
||||||
rustPlatform,
|
|
||||||
systemd,
|
|
||||||
wayland,
|
|
||||||
withDbus ? true,
|
|
||||||
withSystemd ? true,
|
|
||||||
withScreencastSupport ? true,
|
|
||||||
withDinit ? false,
|
|
||||||
}:
|
|
||||||
|
|
||||||
rustPlatform.buildRustPackage {
|
|
||||||
pname = "niri";
|
|
||||||
version = self.shortRev or self.dirtyShortRev or "unknown";
|
|
||||||
|
|
||||||
src = nix-filter.lib.filter {
|
|
||||||
root = self;
|
|
||||||
include = [
|
|
||||||
"niri-config"
|
|
||||||
"niri-ipc"
|
|
||||||
"niri-visual-tests"
|
|
||||||
"resources"
|
|
||||||
"src"
|
|
||||||
./Cargo.lock
|
|
||||||
./Cargo.toml
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
postPatch = ''
|
|
||||||
patchShebangs resources/niri-session
|
|
||||||
substituteInPlace resources/niri.service \
|
|
||||||
--replace-fail '/usr/bin' "$out/bin"
|
|
||||||
'';
|
|
||||||
|
|
||||||
cargoLock = {
|
|
||||||
# NOTE: This is only used for Git dependencies
|
|
||||||
allowBuiltinFetchGit = true;
|
|
||||||
lockFile = ./Cargo.lock;
|
|
||||||
};
|
|
||||||
|
|
||||||
strictDeps = true;
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
clang
|
|
||||||
pkg-config
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs =
|
|
||||||
[
|
|
||||||
cairo
|
|
||||||
dbus
|
|
||||||
libGL
|
|
||||||
libdisplay-info
|
|
||||||
libinput
|
|
||||||
libseat
|
|
||||||
libxkbcommon
|
|
||||||
mesa # libgbm
|
|
||||||
pango
|
|
||||||
wayland
|
|
||||||
]
|
|
||||||
++ lib.optional (withDbus || withScreencastSupport || withSystemd) dbus
|
|
||||||
++ lib.optional withScreencastSupport pipewire
|
|
||||||
# Also includes libudev
|
|
||||||
++ lib.optional withSystemd systemd;
|
|
||||||
|
|
||||||
buildFeatures =
|
|
||||||
lib.optional withDbus "dbus"
|
|
||||||
++ lib.optional withDinit "dinit"
|
|
||||||
++ lib.optional withScreencastSupport "xdp-gnome-screencast"
|
|
||||||
++ lib.optional withSystemd "systemd";
|
|
||||||
buildNoDefaultFeatures = true;
|
|
||||||
|
|
||||||
postInstall =
|
|
||||||
''
|
|
||||||
install -Dm644 resources/niri.desktop -t $out/share/wayland-sessions
|
|
||||||
install -Dm644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal
|
|
||||||
''
|
|
||||||
+ lib.optionalString withSystemd ''
|
|
||||||
install -Dm755 resources/niri-session $out/bin/niri-session
|
|
||||||
install -Dm644 resources/niri{.service,-shutdown.target} -t $out/share/systemd/user
|
|
||||||
'';
|
|
||||||
|
|
||||||
env = {
|
|
||||||
LIBCLANG_PATH = lib.getLib libclang + "/lib";
|
|
||||||
|
|
||||||
# Force linking with libEGL and libwayland-client
|
|
||||||
# so they can be discovered by `dlopen()`
|
|
||||||
CARGO_BUILD_RUSTFLAGS = toString (
|
|
||||||
map (arg: "-C link-arg=" + arg) [
|
|
||||||
"-Wl,--push-state,--no-as-needed"
|
|
||||||
"-lEGL"
|
|
||||||
"-lwayland-client"
|
|
||||||
"-Wl,--pop-state"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
passthru = {
|
|
||||||
providedSessions = [ "niri" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "Scrollable-tiling Wayland compositor";
|
|
||||||
homepage = "https://github.com/YaLTeR/niri";
|
|
||||||
license = lib.licenses.gpl3Only;
|
|
||||||
mainProgram = "niri";
|
|
||||||
platforms = lib.platforms.linux;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
) { };
|
|
||||||
|
|
||||||
# NOTE: This is for development purposes only
|
# NOTE: This is for development purposes only
|
||||||
#
|
#
|
||||||
@@ -227,5 +105,131 @@
|
|||||||
default = niri;
|
default = niri;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
overlays.default = final: _: {
|
||||||
|
niri = final.callPackage (
|
||||||
|
{
|
||||||
|
cairo,
|
||||||
|
clang,
|
||||||
|
dbus,
|
||||||
|
libGL,
|
||||||
|
libclang,
|
||||||
|
libdisplay-info,
|
||||||
|
libinput,
|
||||||
|
libseat,
|
||||||
|
libxkbcommon,
|
||||||
|
mesa,
|
||||||
|
pango,
|
||||||
|
pipewire,
|
||||||
|
pkg-config,
|
||||||
|
rustPlatform,
|
||||||
|
systemd,
|
||||||
|
wayland,
|
||||||
|
withDbus ? true,
|
||||||
|
withSystemd ? true,
|
||||||
|
withScreencastSupport ? true,
|
||||||
|
withDinit ? false,
|
||||||
|
}:
|
||||||
|
|
||||||
|
rustPlatform.buildRustPackage {
|
||||||
|
pname = "niri";
|
||||||
|
version = self.shortRev or self.dirtyShortRev or "unknown";
|
||||||
|
|
||||||
|
src = nix-filter.lib.filter {
|
||||||
|
root = self;
|
||||||
|
include = [
|
||||||
|
"niri-config"
|
||||||
|
"niri-ipc"
|
||||||
|
"niri-visual-tests"
|
||||||
|
"resources"
|
||||||
|
"src"
|
||||||
|
./Cargo.lock
|
||||||
|
./Cargo.toml
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
patchShebangs resources/niri-session
|
||||||
|
substituteInPlace resources/niri.service \
|
||||||
|
--replace-fail '/usr/bin' "$out/bin"
|
||||||
|
'';
|
||||||
|
|
||||||
|
cargoLock = {
|
||||||
|
# NOTE: This is only used for Git dependencies
|
||||||
|
allowBuiltinFetchGit = true;
|
||||||
|
lockFile = ./Cargo.lock;
|
||||||
|
};
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
clang
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs =
|
||||||
|
[
|
||||||
|
cairo
|
||||||
|
dbus
|
||||||
|
libGL
|
||||||
|
libdisplay-info
|
||||||
|
libinput
|
||||||
|
libseat
|
||||||
|
libxkbcommon
|
||||||
|
mesa # libgbm
|
||||||
|
pango
|
||||||
|
wayland
|
||||||
|
]
|
||||||
|
++ lib.optional (withDbus || withScreencastSupport || withSystemd) dbus
|
||||||
|
++ lib.optional withScreencastSupport pipewire
|
||||||
|
# Also includes libudev
|
||||||
|
++ lib.optional withSystemd systemd;
|
||||||
|
|
||||||
|
buildFeatures =
|
||||||
|
lib.optional withDbus "dbus"
|
||||||
|
++ lib.optional withDinit "dinit"
|
||||||
|
++ lib.optional withScreencastSupport "xdp-gnome-screencast"
|
||||||
|
++ lib.optional withSystemd "systemd";
|
||||||
|
buildNoDefaultFeatures = true;
|
||||||
|
|
||||||
|
postInstall =
|
||||||
|
''
|
||||||
|
install -Dm644 resources/niri.desktop -t $out/share/wayland-sessions
|
||||||
|
install -Dm644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal
|
||||||
|
''
|
||||||
|
+ lib.optionalString withSystemd ''
|
||||||
|
install -Dm755 resources/niri-session $out/bin/niri-session
|
||||||
|
install -Dm644 resources/niri{.service,-shutdown.target} -t $out/share/systemd/user
|
||||||
|
'';
|
||||||
|
|
||||||
|
env = {
|
||||||
|
LIBCLANG_PATH = lib.getLib libclang + "/lib";
|
||||||
|
|
||||||
|
# Force linking with libEGL and libwayland-client
|
||||||
|
# so they can be discovered by `dlopen()`
|
||||||
|
CARGO_BUILD_RUSTFLAGS = toString (
|
||||||
|
map (arg: "-C link-arg=" + arg) [
|
||||||
|
"-Wl,--push-state,--no-as-needed"
|
||||||
|
"-lEGL"
|
||||||
|
"-lwayland-client"
|
||||||
|
"-Wl,--pop-state"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
providedSessions = [ "niri" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Scrollable-tiling Wayland compositor";
|
||||||
|
homepage = "https://github.com/YaLTeR/niri";
|
||||||
|
license = lib.licenses.gpl3Only;
|
||||||
|
mainProgram = "niri";
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
) { };
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user