diff --git a/flake.lock b/flake.lock index 8b800a4..462eb03 100644 --- a/flake.lock +++ b/flake.lock @@ -1032,6 +1032,70 @@ "type": "github" } }, + "niri": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": [] + }, + "locked": { + "lastModified": 1760940149, + "narHash": "sha256-KbM47vD6E0cx+v4jYQZ8mD5N186AKm2CQlyh34TW58U=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "b3245b81a6ed8edfaf5388a74d2e0a23c24941e5", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, + "niri-flake": { + "inputs": { + "niri-stable": [ + "niri" + ], + "niri-unstable": "niri-unstable", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1761187190, + "narHash": "sha256-5ln16iOeWpEX5MO7M3jzFEBNFE42gpFsCvSvPjtF6tQ=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "77a07f5d3b775fba67550c38122ebb8d3ee3ba1c", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1760940149, + "narHash": "sha256-KbM47vD6E0cx+v4jYQZ8mD5N186AKm2CQlyh34TW58U=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "b3245b81a6ed8edfaf5388a74d2e0a23c24941e5", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nix": { "inputs": { "flake-compat": [ @@ -1192,6 +1256,22 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1761016216, + "narHash": "sha256-G/iC4t/9j/52i/nm+0/4ybBmAF4hzR8CNHC75qEhjHo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "481cf557888e05d3128a76f14c76397b7d7cc869", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-tuya-vacuum": { "locked": { "lastModified": 1743180016, @@ -1371,6 +1451,8 @@ "hyprland-plugins": "hyprland-plugins", "hyprlock": "hyprlock", "nh-flake": "nh-flake", + "niri": "niri", + "niri-flake": "niri-flake", "nix-ld": "nix-ld", "nixos-hardware": "nixos-hardware", "nixos-wsl": "nixos-wsl", @@ -1738,6 +1820,39 @@ "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": 1761173223, + "narHash": "sha256-FumZh+fPRaKXkl9Y1uTh5KV7Io/AyOZso+UkqLhLArs=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "bf745144acda1343934e9a094cf9458a54d57889", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } + }, "zen-browser": { "inputs": { "home-manager": "home-manager_2", diff --git a/flake.nix b/flake.nix index 3b86b98..d27906b 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,24 @@ inputs.hyprland.follows = "hyprland"; }; + ### + # Niri + niri = { + url = "github:YaLTeR/niri"; + inputs = { + nixpkgs.follows = "nixpkgs"; + rust-overlay.follows = ""; + }; + }; + + niri-flake = { + url = "github:sodiboo/niri-flake"; + inputs = { + niri-stable.follows = "niri"; + nixpkgs.follows = "nixpkgs"; + }; + }; + ### # Snowfall dependencies snowfall-lib = { @@ -144,6 +162,7 @@ overlays = with inputs; [ devenv.overlays.default + niri-flake.overlays.niri ]; homes.modules = with inputs; [ @@ -159,6 +178,14 @@ catppuccin.nixosModules.catppuccin ]; + systems.hosts.yggdrasil.modules = with inputs; [ + niri-flake.nixosModules.niri + ]; + + homes.hosts.yggdrasil.modules = with inputs; [ + niri-flake.homeModules.niri + ]; + systems.hosts.nixberry.modules = with inputs; [ raspberry-pi-nix.nixosModules.raspberry-pi raspberry-pi-nix.nixosModules.sd-image diff --git a/modules/nixos/desktop/addons/hyprlock/default.nix b/modules/nixos/desktop/addons/hyprlock/default.nix index 65f1273..f948d26 100644 --- a/modules/nixos/desktop/addons/hyprlock/default.nix +++ b/modules/nixos/desktop/addons/hyprlock/default.nix @@ -40,7 +40,7 @@ in environment.systemPackages = [ hyprlock-blur ]; - ${namespace}.desktop.hyprland.settings = { + ${namespace}.desktop.hyprland.settings = mkIf config.desktop.hyprland.enable { bind = [ "$mod CTRL, l, exec, hyprlock-blur" ]; diff --git a/modules/nixos/desktop/default.nix b/modules/nixos/desktop/default.nix index e87e97f..986a0d7 100644 --- a/modules/nixos/desktop/default.nix +++ b/modules/nixos/desktop/default.nix @@ -34,10 +34,10 @@ in systemd.user.sessionVariables = config.home-manager.users.${user}.home.sessionVariables; }; - qt = { - enable = true; - platformTheme = "gnome"; - style = "adwaita-dark"; - }; + # qt = { + # enable = true; + # platformTheme = "gnome"; + # style = "adwaita-dark"; + # }; }; } diff --git a/modules/nixos/desktop/hyprland/default.nix b/modules/nixos/desktop/hyprland/default.nix index 3bcf28a..82f7655 100644 --- a/modules/nixos/desktop/hyprland/default.nix +++ b/modules/nixos/desktop/hyprland/default.nix @@ -293,24 +293,24 @@ in "$mod CTRL, right, movecurrentworkspacetomonitor, r" # move focus - "$mod, h, hy3:movefocus, l" - "$mod, j, hy3:movefocus, d" - "$mod, k, hy3:movefocus, u" - "$mod, l, hy3:movefocus, r" - "$mod, left, hy3:movefocus, l" - "$mod, down, hy3:movefocus, d" - "$mod, up, hy3:movefocus, u" - "$mod, right, hy3:movefocus, r" + "$mod, h, movefocus, l" + "$mod, j, movefocus, d" + "$mod, k, movefocus, u" + "$mod, l, movefocus, r" + "$mod, left, movefocus, l" + "$mod, down, movefocus, d" + "$mod, up, movefocus, u" + "$mod, right, movefocus, r" # move focus - "$mod SHIFT, h, hy3:movewindow, l, once" - "$mod SHIFT, j, hy3:movewindow, d, once" - "$mod SHIFT, k, hy3:movewindow, u, once" - "$mod SHIFT, l, hy3:movewindow, r, once" - "$mod SHIFT, left, hy3:movewindow, l, once" - "$mod SHIFT, down, hy3:movewindow, d, once" - "$mod SHIFT, up, hy3:movewindow, u, once" - "$mod SHIFT, right, hy3:movewindow, r, once" + "$mod SHIFT, h, movewindow, l, once" + "$mod SHIFT, j, movewindow, d, once" + "$mod SHIFT, k, movewindow, u, once" + "$mod SHIFT, l, movewindow, r, once" + "$mod SHIFT, left, movewindow, l, once" + "$mod SHIFT, down, movewindow, d, once" + "$mod SHIFT, up, movewindow, u, once" + "$mod SHIFT, right, movewindow, r, once" #run important programs "$mod, Return, exec, kitty" @@ -332,7 +332,7 @@ in in [ "$mod, code:1${toString i}, workspace, ${toString ws}" - "$mod SHIFT, code:1${toString i}, hy3:movetoworkspace, ${toString ws}" + "$mod SHIFT, code:1${toString i}, movetoworkspace, ${toString ws}" ] ) 9 ) diff --git a/modules/nixos/desktop/niri/default.nix b/modules/nixos/desktop/niri/default.nix new file mode 100644 index 0000000..cf63dde --- /dev/null +++ b/modules/nixos/desktop/niri/default.nix @@ -0,0 +1,207 @@ +{ + config, + inputs, + lib, + pkgs, + system, + namespace, + ... +}: +with lib.${namespace}; +let + inherit (lib) + mkIf + mkEnableOption + mkOption + mkMerge + types + ; + + cfg = config.${namespace}.desktop.niri; + + apps-submodule = types.submodule { + options = { + terminal = mkOption { + type = types.package; + default = pkgs.kitty; + description = "The default Terminal to use"; + }; + runner = mkOption { + type = types.package; + default = pkgs.fuzzel; + description = "The app-runner to use"; + }; + }; + }; + +in +{ + options.${namespace}.desktop.niri = { + enable = mkEnableOption "Whether to enable niri"; + settings = mkOption { + type = types.attrs; + default = { }; + description = "Additional niri settings to apply."; + }; + apps = mkOption { + type = apps-submodule; + default = { }; + description = "Which apps to use"; + }; + }; + + config = mkIf cfg.enable { + programs.niri = { + enable = true; + package = inputs.niri-flake.packages.${system}.niri-unstable; + }; + + environment.systemPackages = [ + pkgs.alacritty + pkgs.fuzzel + ]; + + ${namespace} = { + desktop.addons = { + hyprlock = enabled; + hypridle = enabled; + }; + }; + + snowfallorg.users."cholli".home.config = { + programs.niri.settings = mkMerge [ + { + input = { + keyboard = { + numlock = true; + }; + }; + + outputs."DP-1" = { + mode = { + width = 3440; + height = 1440; + }; + }; + outputs."HDMI-A-1" = { + mode = { + width = 1920; + height = 1080; + }; + transform.rotation = 90; + }; + + layout = { + gaps = 5; + center-focused-column = "never"; + + default-column-width = { + proportion = 0.5; + }; + + preset-column-widths = [ + { proportion = 1. / 3.; } + { proportion = 1. / 2.; } + { proportion = 2. / 3.; } + + ]; + + focus-ring = { + width = 1; + active = { + color = "#7fc8ff"; + }; + inactive = { + color = "#505050"; + }; + }; + }; + + hotkey-overlay.skip-at-startup = true; + + screenshot-path = "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"; + + # block 1pass from screenshots and window capture + window-rules = [ + ]; + + binds = + with config.lib.niri; + let + workspaces = (builtins.genList (x: x + 1) 9); + + focus-workspaces = builtins.listToAttrs ( + map (num: { + name = "Mod=${toString num}"; + value = { + action.focus-workspace = num; + }; + }) workspaces + ); + in + + mkMerge [ + { + "Mod+Shift+Slash".action = show-hotkey-overlay; + + "Mod+Enter".action.spawn = "${lib.getExe cfg.apps.terminal}"; + "Mod+D".action.spwan = "${lib.getExe cfg.apps.runner}"; + "Mod+Alt+L".action.spawn = "hyprlock-blur"; + + "Mod+Shift+Q" = { + action = actions.close-window; + repeat = false; + }; + + "Mod+O" = { + action = actions.toggle-overview; + repeat = false; + }; + + inherit focus-workspaces; + + "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; + }; + } + ]; + + } + cfg.settings + ]; + }; + }; +} diff --git a/systems/x86_64-linux/yggdrasil/default.nix b/systems/x86_64-linux/yggdrasil/default.nix index 4f3c5fd..ffaa111 100644 --- a/systems/x86_64-linux/yggdrasil/default.nix +++ b/systems/x86_64-linux/yggdrasil/default.nix @@ -76,8 +76,9 @@ in starsector = enabled; }; - desktop.hyprland = { - enable = true; + desktop = { + hyprland = enabled; + niri = enabled; }; services = {