From 1d205d39c3b7a1b941a5a643c758318657d219c2 Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Fri, 26 Dec 2025 23:09:37 +0000 Subject: [PATCH] users/jordan: add niri config --- flake.lock | 108 ++++++++ flake.nix | 5 + hosts/common.nix | 1 + .../jordan/common/optional/graphical/niri.nix | 261 ++++++++++++++++++ users/jordan/helios.nix | 2 +- 5 files changed, 376 insertions(+), 1 deletion(-) create mode 100644 users/jordan/common/optional/graphical/niri.nix diff --git a/flake.lock b/flake.lock index 2ab3919..26535f7 100644 --- a/flake.lock +++ b/flake.lock @@ -939,6 +939,64 @@ "type": "github" } }, + "niri": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1766765523, + "narHash": "sha256-DCk3GKdKZNjpvNuDy9ZVfVwCy3tlm96/UZnYkJO7N44=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "a3e638c75d07de759421e6f34bd69c3f9a0a3567", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1756556321, + "narHash": "sha256-RLD89dfjN0RVO86C/Mot0T7aduCygPGaYbog566F0Qo=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "01be0e65f4eb91a9cd624ac0b76aaeab765c7294", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v25.08", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1766751930, + "narHash": "sha256-83/YSW6c58i/iwGzAFApuMy6MCgoIaROeCcoIGh+ViU=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "b5640d5293ad8dca06cb447692ea7cbb21680eb1", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nix-topology": { "inputs": { "devshell": "devshell_3", @@ -1034,6 +1092,22 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1766736597, + "narHash": "sha256-BASnpCLodmgiVn0M1MU2Pqyoz0aHwar/0qLkp7CjvSQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f560ccec6b1116b22e6ed15f4c510997d99d5852", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1766651565, @@ -1171,6 +1245,7 @@ "hyprland-plugins": "hyprland-plugins", "impermanence": "impermanence", "kvlibadwaita": "kvlibadwaita", + "niri": "niri", "nix-topology": "nix-topology", "nixos-hardware": "nixos-hardware", "nixos-mailserver": "nixos-mailserver", @@ -1404,6 +1479,39 @@ "repo": "xdg-desktop-portal-hyprland", "type": "github" } + }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1755491097, + "narHash": "sha256-m+9tUfsmBeF2Gn4HWa6vSITZ4Gz1eA1F5Kh62B0N4oE=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "388d291e82ffbc73be18169d39470f340707edaa", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.7", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1766429945, + "narHash": "sha256-9Kv4gWagx/u4RfZJzBMAoagW9ava5waxd+XoTkzqF7E=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "0dde7ca1d3a8e8c5082533d76084e2aa02bef70e", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 116e3a3..c1b1e81 100644 --- a/flake.nix +++ b/flake.nix @@ -62,6 +62,11 @@ nixos-hardware.url = "github:NixOS/nixos-hardware"; + niri = { + url = "github:sodiboo/niri-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixos-mailserver = { url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-25.11"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/common.nix b/hosts/common.nix index 318047d..2cb9f26 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -24,6 +24,7 @@ config.allowUnfree = true; overlays = [ inputs.agenix.overlays.default + inputs.niri.overlays.niri (final: prev: { unstable = import inputs.nixpkgs-unstable { config = { diff --git a/users/jordan/common/optional/graphical/niri.nix b/users/jordan/common/optional/graphical/niri.nix new file mode 100644 index 0000000..0ce2341 --- /dev/null +++ b/users/jordan/common/optional/graphical/niri.nix @@ -0,0 +1,261 @@ +{ + config, + lib, + inputs, + pkgs, + ... +}: +let + inherit (lib) + getExe + ; +in +{ + imports = [ + inputs.niri.homeModules.niri + ]; + + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + config.niri = { + default = [ + "gnome" + "gtk" + ]; + "org.freedesktop.impl.portal.Access" = "gtk"; + "org.freedesktop.impl.portal.Notification" = "gtk"; + "org.freedesktop.impl.portal.Secret" = "gnome-keyring"; + "org.freedesktop.impl.portal.FileChooser" = "gtk"; + "org.freedesktop.impl.portal.ScreenCast" = [ "gnome" ]; + "org.freedesktop.impl.portal.Screenshot" = [ "gnome" ]; + }; + extraPortals = with pkgs; [ + xdg-desktop-portal-gtk + xdg-desktop-portal-gnome + ]; + }; + + programs.niri = { + enable = true; + package = pkgs.niri-unstable; + + settings = { + xwayland-satellite.path = getExe pkgs.xwayland-satellite-stable; + input = { + keyboard = { + xkb = { + layout = "us"; + variant = "intl"; + }; + + repeat-delay = 235; + repeat-rate = 60; + }; + + touchpad = { + tap = true; + dwt = true; + dwtp = true; + natural-scroll = true; + accel-profile = "flat"; + }; + + mouse = { + accel-speed = 0.2; + accel-profile = "flat"; + }; + + power-key-handling.enable = false; + workspace-auto-back-and-forth = true; + }; + + gestures.hot-corners.enable = false; + debug.honor-xdg-activation-with-invalid-serial = true; + binds = with config.lib.niri.actions; { + "Mod+T".action = spawn "kitty"; + "Mod+b".action = spawn "firefox"; + "Super+Alt+L".action = spawn "systemctl suspend"; + XF86AudioRaiseVolume = { + action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; + allow-when-locked = true; + }; + XF86AudioLowerVolume = { + action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; + allow-when-locked = true; + }; + XF86AudioMute = { + action = spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; + allow-when-locked = true; + }; + XF86AudioMicMute = { + action = spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; + allow-when-locked = true; + }; + "Mod+Q".action = close-window; + + "Mod+n".action = focus-column-left; + "Mod+left".action = focus-column-left; + "Mod+Shift+n".action = move-column-left; + "Mod+Shift+left".action = move-column-left; + + "Mod+r".action = focus-window-or-workspace-down; + "Mod+down".action = focus-window-or-workspace-down; + "Mod+Shift+r".action = move-window-down; + "Mod+Shift+down".action = move-window-down; + + "Mod+l".action = focus-window-or-workspace-up; + "Mod+up".action = focus-window-or-workspace-up; + "Mod+Shift+l".action = move-window-up; + "Mod+Shift+up".action = move-window-up; + + "Mod+s".action = focus-column-right; + "Mod+right".action = focus-column-right; + "Mod+Shift+s".action = move-column-right; + "Mod+Shift+right".action = move-column-right; + + "Mod+h".action = focus-column-first; + "Mod+Shift+h".action = consume-or-expel-window-left; + "Mod+m".action = focus-column-last; + "Mod+Shift+m".action = consume-or-expel-window-right; + + "Mod+Ctrl+n".action = focus-monitor-left; + "Mod+Shift+Ctrl+n".action = move-column-to-monitor-left; + "Mod+Ctrl+r".action = focus-monitor-down; + "Mod+Shift+Ctrl+r".action = move-column-to-monitor-down; + "Mod+Ctrl+l".action = focus-monitor-up; + "Mod+Shift+Ctrl+l".action = move-column-to-monitor-up; + "Mod+Ctrl+s".action = focus-monitor-right; + "Mod+Shift+Ctrl+s".action = move-column-to-monitor-right; + + "Mod+Period".action = focus-workspace-down; + "Mod+Shift+Period".action = move-column-to-workspace-down; + "Mod+Ctrl+Period".action = move-workspace-down; + "Mod+comma".action = focus-workspace-up; + "Mod+Shift+comma".action = move-column-to-workspace-up; + "Mod+Ctrl+comma".action = move-workspace-up; + + "Mod+WheelScrollDown" = { + action = focus-workspace-down; + cooldown-ms = 150; + }; + "Mod+WheelScrollUp" = { + action = focus-workspace-up; + cooldown-ms = 150; + }; + "Mod+Ctrl+WheelScrollDown" = { + action = move-column-to-workspace-down; + cooldown-ms = 150; + }; + "Mod+Ctrl+WheelScrollUp" = { + action = move-column-to-workspace-up; + cooldown-ms = 150; + }; + "Mod+WheelScrollRight".action = focus-column-right; + "Mod+WheelScrollLeft".action = focus-column-left; + "Mod+Ctrl+WheelScrollRight".action = move-column-right; + "Mod+Ctrl+WheelScrollLeft".action = move-column-left; + "Mod+Shift+WheelScrollDown".action = focus-column-right; + "Mod+Shift+WheelScrollUp".action = focus-column-left; + "Mod+Ctrl+Shift+WheelScrollDown".action = move-column-right; + "Mod+Ctrl+Shift+WheelScrollUp".action = move-column-left; + + "Mod+V".action = maximize-column; + "Mod+Ctrl+V".action = expand-column-to-available-width; + "Mod+return".action = fullscreen-window; + "Mod+Minus".action = set-column-width "-10%"; + "Mod+Shift+0".action = set-column-width "+10%"; + + "Mod+F".action = toggle-window-floating; + "Mod+Ctrl+F".action = switch-focus-between-floating-and-tiling; + + "Mod+y".action = toggle-column-tabbed-display; + + #"Print".action = screenshot; + #"Ctrl+Print".action = screenshot-screen {}; + #"Alt+Print".action = screenshot-window; + + "Mod+Escape" = { + action = toggle-keyboard-shortcuts-inhibit; + allow-inhibiting = false; + }; + + # The quit action will show a confirmation dialog to avoid accidental exits. + "Mod+Ctrl+Escape".action = quit; + # Powers off the monitors. To turn them back on, do any input like + # moving the mouse or pressing any other key. + "Mod+Shift+P".action = power-off-monitors; + }; + + spawn-at-startup = [ + { command = [ "firefox" ]; } + ]; + + prefer-no-csd = true; + hotkey-overlay = { + skip-at-startup = true; + }; + layout = { + gaps = 1; + center-focused-column = "never"; + empty-workspace-above-first = true; + preset-column-widths = [ + { proportion = 0.33333; } + { proportion = 0.5; } + { proportion = 0.66667; } + ]; + default-column-width = { + proportion = 0.5; + }; + preset-window-heights = [ + { proportion = 0.33333; } + { proportion = 0.5; } + { proportion = 0.66667; } + ]; + focus-ring = { + enable = true; + width = 2; + active.color = "#7fc8ff"; + inactive.color = "#505050"; + }; + border = { + enable = false; + width = 2; + active.color = "#ffc87f"; + inactive.color = "#505050"; + }; + shadow = { + # on + softness = 30; + spread = 5; + offset = { + x = 0; + y = 5; + }; + draw-behind-window = true; + color = "#00000070"; + # inactive-color "#00000054" + }; + tab-indicator = { + # off + hide-when-single-tab = true; + place-within-column = true; + gap = 5; + width = 4; + length = { + total-proportion = 1.0; + }; + position = "right"; + gaps-between-tabs = 2; + corner-radius = 8; + active.color = "red"; + inactive.color = "gray"; + }; + insert-hint = { + # off + display.color = "#ffc87f80"; + }; + }; + }; + }; +} diff --git a/users/jordan/helios.nix b/users/jordan/helios.nix index 402666e..8f54c37 100644 --- a/users/jordan/helios.nix +++ b/users/jordan/helios.nix @@ -7,7 +7,7 @@ imports = [ ./common/optional/graphical/firefox.nix ./common/optional/graphical/fonts.nix - ./common/optional/graphical/hyprland + ./common/optional/graphical/niri.nix ./common/optional/graphical/mimeapps.nix ];