Files
lux/modules/capabilities/niri/default.nix
T
2026-04-29 15:49:32 +02:00

173 lines
4.1 KiB
Nix

{
inputs,
config,
...
}:
let
repo = config.repo;
in
{
flake.modules.nixos.niri =
{ pkgs, ... }:
{
imports = [ inputs.niri.nixosModules.niri ];
nixpkgs.overlays = [ inputs.niri.overlays.niri ];
programs = {
dconf.enable = true;
niri = {
enable = true;
package = pkgs.niri-unstable;
};
};
services = {
gvfs.enable = true;
udisks2.enable = true;
};
xdg.portal.enable = true;
};
flake.modules.homeManager.niri =
{
config,
lib,
osConfig,
pkgs,
...
}:
let
borderPalette = repo.theme.kanagawa.palette.niri.border;
shortcuts = import ./_shortcuts.nix {
inherit
config
lib
pkgs
repo
;
};
in
{
home = {
sessionVariables.NIXOS_OZONE_WL = "1";
packages =
with pkgs;
[
playerctl
brightnessctl
xwayland-satellite
]
++ [
config.meta.desktop.fileManager.package
]
++ lib.attrValues shortcuts.scripts;
};
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
programs.niri.settings = {
outputs = lib.mapAttrs (
_: display:
{
position = {
inherit (display) x y;
};
}
// lib.optionalAttrs (display.primary or false) {
"focus-at-startup" = true;
}
// lib.optionalAttrs (display.scale != null) {
inherit (display) scale;
}
// lib.optionalAttrs (display.width != null && display.height != null && display.refresh != null) {
mode = {
inherit (display)
width
height
refresh
;
};
}
) osConfig.meta.machine.displays;
environment.DISPLAY = ":0";
spawn-at-startup = [
{ command = [ "xwayland-satellite" ]; }
{ command = [ "noctalia-shell" ]; }
];
prefer-no-csd = true;
hotkey-overlay.skip-at-startup = true;
screenshot-path = "${config.xdg.userDirs.pictures}/screenshots/%Y-%m-%dT%H:%M:%S.png";
animations.slowdown = 0.6;
cursor = {
inherit (config.home.pointerCursor) size;
theme = config.home.pointerCursor.name;
hide-after-inactive-ms = 3000;
hide-when-typing = true;
};
layout = {
always-center-single-column = true;
gaps = 14;
focus-ring.enable = false;
default-column-width.proportion = 1. / 2.;
border = {
enable = true;
width = 3;
active.color = borderPalette.active;
inactive.color = borderPalette.inactive;
urgent.color = borderPalette.urgent;
};
};
window-rules = [
{
geometry-corner-radius =
let
radius = 10.0;
in
{
bottom-left = radius;
bottom-right = radius;
top-left = radius;
top-right = radius;
};
clip-to-geometry = true;
}
{
matches = [
{ app-id = "^niri-shortcut-float$"; }
];
open-floating = true;
open-focused = true;
}
];
debug.honor-xdg-activation-with-invalid-serial = true;
gestures.hot-corners.enable = false;
input = {
focus-follows-mouse.enable = true;
mouse."accel-speed" = 0.4;
keyboard = {
repeat-delay = 300;
repeat-rate = 50;
xkb.options = "caps:escape";
};
touchpad.dwt = true;
};
binds = import ./_bindings.nix {
browserCommand = config.meta.desktop.browser.command;
terminalCommand = config.meta.desktop.terminal.command;
shortcutCommands = shortcuts.commands;
};
};
};
}