From fdf3479b319733801d4ccc14717271fab1daab28 Mon Sep 17 00:00:00 2001 From: serenity-F Date: Tue, 22 Sep 2026 00:16:38 +1000 Subject: [PATCH] feat: configured niri --- modules/features/desktop/niri.nix | 147 +++++++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 1 deletion(-) diff --git a/modules/features/desktop/niri.nix b/modules/features/desktop/niri.nix index 04a2961..8aa49a4 100644 --- a/modules/features/desktop/niri.nix +++ b/modules/features/desktop/niri.nix @@ -7,12 +7,19 @@ { imports = [ + # for home manager functionality inputs.home-manager.nixosModules.home-manager + # for niri binary cache from epireyn # disable if untrusted # conflicts with unstable overlay #inputs.niri.nixosModules.niri + + # extra niri config files + ./binds.nix + ./window-rules.nix + ]; # for niri binary cache from epireyn @@ -24,6 +31,7 @@ # packages for desktop environment environment.systemPackages = with pkgs; [ + jq # unsure what this is for - research time? xwayland-satellite # niri xwayland support - disable if using unstable #xwayland-satellite-unstable # niri xwayland support - disable if using stable ]; @@ -74,8 +82,145 @@ #path = lib.getExe pkgs.xwayland-satellite-unstable; }; + # environment variables + environment = { + # display + DISPLAY = ":0"; + WLR_RENDERER = "vulkan"; + NIXOS_OZONE_WL = "1"; + SDL_VIDEODRIVER = "wayland"; + # xdg variables + XDG_SESSION_TYPE = "wayland"; + XDG_CURRENT_DESKTOP = "niri"; + # qt variables + QT_QPA_PLATFORM = "wayland;xcb"; + QT_QPA_PLATFORMTHEME = "qt5ct"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + # native wayland firefox + MOZ_ENABLE_WAYLAND = "1"; + }; + # display configuration - #foo.bar = { }; + outputs."DP-4" = { + # display scaling + scale = 1.2; + # window focus? + focus-at-startup = true; + # resolution config + variable-refresh-rate = true; + mode = { + width = 3440; + height = 1440; + refresh = 74.924; + }; + # grid position for this display + position = { + x = 0; + y = 0; + }; + }; + + # input settings - keybinds are elsewhere + hotkey-overlay = { + hide-not-bound = true; + skip-at-startup = true; + }; + input = { + # window focus + focus-follows-mouse = { + enable = true; + max-scroll-amount = "0%"; + }; + # keyboard and pointing devices + keyboard.numlock = true; + trackpoint = { + enable = true; + }; + touchpad = { + enable = true; + natural-scroll = true; + }; + mouse = { + enable = true; + natural-scroll = false; + accel-speed = 1.0; + accel-profile = "flat"; + }; + }; + + # workspaces + workspaces."01sys" = { + name = "System"; + open-on-output = "DP-4"; + }; + + # autostart + spawn-at-startup = [ + { + # necessary for xwayland functionality + argv = [ "xwayland-satellite" ]; + } + { + # spawns the desktop shell + argv = [ "noctalia" ]; + } + { + # spawns a terminal running btop + argv = [ + "kitty" + "btop" + ]; + } + ]; + + # visual settings + center-focused-column = "never"; + overview = { + workspace-shadow.enable = false; + }; + animations = { + enable = true; + slowdown = 1.25; + }; + prefer-no-csd = true; + border.enable = false; + layout = { + # window|window gaps + gaps = 8; + #window|screen edge gaps + struts = { + left = 2; + right = 2; + top = 2; + bottom = 4; + }; + }; + # highlights the focused window bounds + focus-ring = { + enable = true; + width = 2; + #focus ring colour + active.gradient = { + angle = 45; + from = "#00cdff"; + to = "#80c8ff"; + }; + }; + # used when increasing window size in steps + preset-column-widths = [ + { + proportion = 0.33; + } + { + proportion = 0.5; + } + { + proportion = 0.67; + } + { + proportion = 1.0; + } + ]; };