niri: switch to master package, move config file location

Signed-off-by: Bloxx12 <charlie@charlieroot.dev>
Change-Id: I6a6a696441d048ff2328d08338293b4a1be005e7
This commit is contained in:
Bloxx12 2025-07-21 00:07:28 +02:00
commit 5765bbc868
Signed by: faukah
SSH key fingerprint: SHA256:jpYIt4Vkz1NBTQcks/N9OPTfTFxE6KF2W/rV7hrfrIw
2 changed files with 101 additions and 17 deletions

View file

@ -2,32 +2,100 @@
config, config,
lib, lib,
pkgs, pkgs,
sources,
... ...
}: }:
let let
inherit (lib.modules) mkForce mkIf; inherit (lib.modules) mkForce mkIf;
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption;
inherit (config.modules.system) isGraphical; inherit (config.modules.system) isGraphical;
inherit (config.meta.mainUser) username;
cfg = config.modules.desktops.niri; cfg = config.modules.desktops.niri;
patched-niri = pkgs.niri.overrideAttrs (prev: { niri = pkgs.callPackage (_: pkgs.rustPlatform.buildRustPackage {
src = pkgs.fetchFromGitHub { pname = "niri";
inherit (prev.src) owner repo; version = "unstable";
rev = "37458d94b288945f6cfbd3c5c233f634d59f246c";
hash = "sha256-F5iVU/hjoSHSSe0gllxm0PcAaseEtGNanYK5Ha3k2Tg="; src = sources.niri;
postPatch = ''
patchShebangs resources/niri-session
substituteInPlace resources/niri.service \
--replace-fail '/usr/bin' "$out/bin"
'';
cargoLock = {
allowBuiltinFetchGit = true;
lockFile = "${sources.niri}/Cargo.lock";
}; };
cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
inherit (patched-niri) src; strictDeps = true;
hash = "sha256-fT0L/OTlQ9BnKHnckKsLi+tN+oevEU+eJWrh1INqQhA="; doInstallCheck = false;
};
patches = [ nativeBuildInputs = with pkgs; [
(pkgs.fetchpatch { rustPlatform.bindgenHook
url = "https://github.com/YaLTeR/niri/commit/ab71a6c553f9c53ea484ec6dedc5dcede708929f.diff"; pkg-config
hash = "sha256-C3TJIK5/YTAcmdSP6NyOwX+1oA36u6nrMuJuVYIvAHQ="; installShellFiles
})
]; ];
});
buildInputs = with pkgs; [
cairo
dbus
libGL
libdisplay-info
libinput
seatd
libxkbcommon
libgbm
pango
wayland
dbus
pipewire
# Also includes libudev
systemd
];
buildFeatures = [
"dbus"
"dinit"
"xdp-gnome-screencast"
"systemd"
];
buildNoDefaultFeatures = true;
postInstall = ''
installShellCompletion --cmd niri \
--bash <($out/bin/niri completions bash) \
--fish <($out/bin/niri completions fish) \
--zsh <($out/bin/niri completions zsh)
install -Dm644 resources/niri.desktop -t $out/share/wayland-sessions
install -Dm644 resources/niri-portals.conf -t $out/share/xdg-desktop-portal
install -Dm755 resources/niri-session $out/bin/niri-session
install -Dm644 resources/niri{.service,-shutdown.target} -t $out/share/systemd/user
'';
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"
]
);
};
passthru = {
providedSessions = [ "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";
@ -35,13 +103,13 @@ in
config = mkIf (cfg.enable || isGraphical) { config = mkIf (cfg.enable || isGraphical) {
programs.niri = { programs.niri = {
enable = true; enable = true;
package = patched-niri; package = niri;
}; };
# The niri module auto enables the gnome keyring, # The niri module auto enables the gnome keyring,
# which is something I direly want to avoid. # which is something I direly want to avoid.
services.gnome.gnome-keyring.enable = mkForce false; services.gnome.gnome-keyring.enable = mkForce false;
environment.etc."niri/config.kdl".source = ./config.kdl; hjem.users.${username}.files.".config/niri/config.kdl".source = ./config.kdl;
environment.systemPackages = builtins.attrValues { environment.systemPackages = builtins.attrValues {
inherit (pkgs) inherit (pkgs)

View file

@ -107,6 +107,22 @@
"url": "https://github.com/oxalica/nil/archive/524ae2d67dd84d99a10f409ed6cd8e4e7b3cae3f.tar.gz", "url": "https://github.com/oxalica/nil/archive/524ae2d67dd84d99a10f409ed6cd8e4e7b3cae3f.tar.gz",
"hash": "sha256-Uy2qzd+fMoBcp4NPSO7DavEC1pGMegmAqoEMvmXbIQU=" "hash": "sha256-Uy2qzd+fMoBcp4NPSO7DavEC1pGMegmAqoEMvmXbIQU="
}, },
"niri": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "yalter",
"repo": "niri"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "v25.05.1",
"revision": "61e306c1c6b13ae99bf7f51532a6aa86cd50d690",
"url": "https://api.github.com/repos/yalter/niri/tarball/refs/tags/v25.05.1",
"hash": "sha256-z4viQZLgC2bIJ3VrzQnR+q2F3gAOEQpU1H5xHtX/2fs="
},
"nixfmt": { "nixfmt": {
"type": "GitRelease", "type": "GitRelease",
"repository": { "repository": {