diff --git a/flake.lock b/flake.lock index 129d29b..147b8ed 100644 --- a/flake.lock +++ b/flake.lock @@ -279,6 +279,62 @@ "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": 1750316774, + "narHash": "sha256-JfksinMaAqBvx2kR9TV4/qHzK+RagIYZrizExMDLvmk=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "a67455b8e84e6bff6bc381bed25fc83a1bbf0b5f", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1748151941, + "narHash": "sha256-z4viQZLgC2bIJ3VrzQnR+q2F3gAOEQpU1H5xHtX/2fs=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "8ba57fcf25d2fc9565131684a839d58703f1dae7", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v25.05.1", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1750225787, + "narHash": "sha256-7O/8CChaOhSBSu94McHE0vyH0o+J5R4exq2DDq4zHAg=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "ed14e8da8476d5fde27b14d1dde03256a2f6e11b", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nix-colors": { "inputs": { "base16-schemes": "base16-schemes", @@ -316,17 +372,18 @@ }, "nixpkgs": { "locked": { - "lastModified": 1749494155, - "narHash": "sha256-FG4DEYBpROupu758beabUk9lhrblSf5hnv84v1TLqMc=", + "lastModified": 1750134718, + "narHash": "sha256-v263g4GbxXv87hMXMCpjkIxd/viIF7p3JpJrwgKdNiI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "88331c17ba434359491e8d5889cce872464052c2", + "rev": "9e83b64f727c88a7711a2c463a7b16eedb69a84c", "type": "github" }, "original": { - "id": "nixpkgs", - "ref": "nixos-25.05", - "type": "indirect" + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs-lib": { @@ -344,6 +401,22 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1750133334, + "narHash": "sha256-urV51uWH7fVnhIvsZIELIYalMYsyr2FCalvlRTzqWRw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "36ab78dab7da2e4e27911007033713bab534187b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1749285348, @@ -360,6 +433,21 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1749494155, + "narHash": "sha256-FG4DEYBpROupu758beabUk9lhrblSf5hnv84v1TLqMc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "88331c17ba434359491e8d5889cce872464052c2", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-25.05", + "type": "indirect" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1744868846, "narHash": "sha256-5RJTdUHDmj12Qsv7XOhuospjAjATNiTMElplWnJE9Hs=", @@ -375,7 +463,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1747610100, "narHash": "sha256-rpR5ZPMkWzcnCcYYo3lScqfuzEw5Uyfh+R0EKZfroAc=", @@ -421,9 +509,10 @@ "inputs": { "disko": "disko", "home-manager": "home-manager", + "niri": "niri", "nix-colors": "nix-colors", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", "sops-nix": "sops-nix", "stylix": "stylix" @@ -431,7 +520,7 @@ }, "sops-nix": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1749592509, @@ -459,7 +548,7 @@ "git-hooks": "git-hooks", "gnome-shell": "gnome-shell", "home-manager": "home-manager_2", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "nur": "nur", "systems": "systems", "tinted-foot": "tinted-foot", @@ -600,6 +689,39 @@ "repo": "treefmt-nix", "type": "github" } + }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1748488455, + "narHash": "sha256-IiLr1alzKFIy5tGGpDlabQbe6LV1c9ABvkH6T5WmyRI=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "3ba30b149f9eb2bbf42cf4758d2158ca8cceef73", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.6", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1749315541, + "narHash": "sha256-bEik1BfVOFnWvtOrcOHluos/edJ8f+G2y1QySbt/0Ak=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "da2ecb5be816de35e2efe23a408a1c49fe8b11ba", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 3c56e0b..23e4935 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,7 @@ stylix.url = "github:danth/stylix/release-25.05"; sops-nix.url = "github:Mic92/sops-nix"; + niri.url = "github:sodiboo/niri-flake"; disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; @@ -30,6 +31,7 @@ nix-colors, stylix, sops-nix, + niri, disko, ... } @ inputs: let diff --git a/hosts/ti-clt-dsk01/configuration.nix b/hosts/ti-clt-dsk01/configuration.nix index b1dd3ed..85199b1 100644 --- a/hosts/ti-clt-dsk01/configuration.nix +++ b/hosts/ti-clt-dsk01/configuration.nix @@ -14,6 +14,7 @@ cosmic.enable = true; hyprland.enable = false; gnome.enable = false; + niri.enable = true; }; applications = { common.enable = true; diff --git a/hosts/ti-clt-dsk01/home.nix b/hosts/ti-clt-dsk01/home.nix index 1a8c30c..02e544d 100644 --- a/hosts/ti-clt-dsk01/home.nix +++ b/hosts/ti-clt-dsk01/home.nix @@ -44,6 +44,7 @@ theming.stylix.theme = "da-one-ocean"; desktop-environments.hyprland.enable = false; + desktop-environments.niri.enable = true; }; home.packages = with pkgs; [ diff --git a/modules/home/default.nix b/modules/home/default.nix index b2e9eea..e91e52b 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -26,6 +26,7 @@ ./theming/stylix.nix ./desktop-environments/hyprland/default.nix + ./desktop-environments/niri/default.nix ./containers/network.nix diff --git a/modules/home/desktop-environments/niri/default.nix b/modules/home/desktop-environments/niri/default.nix new file mode 100644 index 0000000..7190dcf --- /dev/null +++ b/modules/home/desktop-environments/niri/default.nix @@ -0,0 +1,144 @@ +{ config, pkgs, lib, inputs, ... }: + +with lib; + +let + cfg = config.settings.desktop-environments.niri; +in { + options = { + settings.desktop-environments.niri.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable niri window manager configuration + ''; + default = false; + }; + }; + + imports = [ + inputs.niri.homeModules.niri + ]; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + alacritty + fuzzel + ]; + + programs.niri.enable = true; + programs.niri.package = pkgs.unstable.niri; + + programs.niri.settings.outputs = { + "HDMI-A-1".position = { + x = 1920; + y = 0; + }; + "DP-1".position = { + x = 0; + y = 0; + }; + }; + + programs.niri.settings.layout = { + preset-column-widths = [ + { proportion = 1. / 3.; } + { proportion = 1. / 2.; } + { proportion = 2. / 3.; } + ]; + }; + + programs.niri.settings.binds = with config.lib.niri.actions; { + "Mod+Shift+Slash".action = show-hotkey-overlay; + + # Spawn applications + "Mod+Space".action = spawn "fuzzel"; + "Mod+T".action = spawn "alacritty"; + + # Volume controls + "XF86AudioRaiseVolume".action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+"; + "XF86AudioLowerVolume".action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-"; + "XF86AudioMute".action = spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK" "toggle"; + + # Medila controls + "XF86AudioPlay".action = spawn "playerctl" "play-pause"; + "XF86AudioNext".action = spawn "playerctl" "next"; + "XF86AudioPrev".action = spawn "playerctl" "previous"; + + "Mod+O".action = toggle-overview; + "Mod+Q".action = close-window; + "Mod+C".action = center-column; + "Mod+R".action = switch-preset-column-width; + + # Sizing + "Mod+Minus".action = set-column-width "-10%"; + "Mod+Equal".action = set-column-width "+10%"; + + # Full screein + "Mod+F".action = maximize-column; + "Mod+Shift+F".action = fullscreen-window; + "Mod+Ctrl+F".action = expand-column-to-available-width; + + # Toggle floating + "Mod+V".action = toggle-window-floating; + "Mod+Shift+V".action = switch-focus-between-floating-and-tiling; + + # Print screen + "Print".action = screenshot { show-pointer=false; }; + + # Window focus + "Mod+H".action = focus-column-left; + "Mod+J".action = focus-window-down; + "Mod+K".action = focus-window-up; + "Mod+L".action = focus-column-right; + + # Window moving + "Mod+Ctrl+H".action = move-column-left; + "Mod+Ctrl+J".action = move-window-down; + "Mod+Ctrl+K".action = move-window-up; + "Mod+Ctrl+L".action = move-column-right; + + # Focus to different monitor + "Mod+Shift+H".action = focus-monitor-left; + "Mod+Shift+J".action = focus-monitor-down; + "Mod+Shift+K".action = focus-monitor-up; + "Mod+Shift+L".action = focus-monitor-right; + + # Move to different monitor + "Mod+Ctrl+Shift+H".action = move-column-to-monitor-left; + "Mod+Ctrl+Shift+J".action = move-column-to-monitor-down; + "Mod+Ctrl+Shift+K".action = move-column-to-monitor-up; + "Mod+Ctrl+Shift+L".action = move-column-to-monitor-right; + + # Switch workspaces + "Mod+Page_Down".action = focus-workspace-down; + "Mod+Page_Up".action = focus-workspace-up; + "Mod+U".action = focus-workspace-down; + "Mod+I".action = focus-workspace-up; + + # Move workspaces + "Mod+Ctrl+Page_Down".action = move-column-to-workspace-down; + "Mod+Ctrl+Page_Up".action = move-column-to-workspace-up; + "Mod+Ctrl+U".action = move-column-to-workspace-down; + "Mod+Ctrl+I".action = move-column-to-workspace-up; + + # Workspace scrolling + "Mod+WheelScrollDown" = { + action = focus-workspace-down; + cooldown-ms = 150; + }; + "Mod+WheelScrollUp" = { + action = focus-workspace-up; + cooldown-ms = 150; + }; + "Mod+Shift+WheelScrollDown" = { + action = focus-column-left; + cooldown-ms = 150; + }; + "Mod+Shift+WheelScrollUp" = { + action = focus-column-right; + cooldown-ms = 150; + }; + }; + }; +} + diff --git a/modules/system/default.nix b/modules/system/default.nix index e859e67..48dd0fc 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -24,6 +24,7 @@ ./desktop-environments/cosmic.nix ./desktop-environments/hyprland.nix ./desktop-environments/gnome.nix + ./desktop-environments/niri.nix ./display-managers/default.nix ]; diff --git a/modules/system/desktop-environments/niri.nix b/modules/system/desktop-environments/niri.nix new file mode 100644 index 0000000..2f342b4 --- /dev/null +++ b/modules/system/desktop-environments/niri.nix @@ -0,0 +1,49 @@ +{ lib, config, inputs, pkgs, ... }: + +with lib; + +let + cfg = config.settings.desktop-environments.niri; +in { + options = { + settings.desktop-environments.niri.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable niri desktop environment + ''; + default = false; + }; + }; + + imports = [ + inputs.niri.nixosModules.niri + ]; + + config = mkIf cfg.enable { + nix = { + settings = { + substituters = [ + "https://niri.cachix.org" + ]; + trusted-public-keys = [ + "niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964=" + ]; + }; + }; + + programs.niri.enable = true; + programs.niri.package = pkgs.unstable.niri; + nixpkgs.overlays = [ inputs.niri.overlays.niri ]; + environment.variables.NIXOS_OZONE_WL = "1"; + + environment.systemPackages = with pkgs; [ + wl-clipboard + wayland-utils + libsecret + cage + gamescope + xwayland-satellite-unstable + swaybg + ]; + }; +}