diff --git a/flake.lock b/flake.lock index ef778bd..3528cfd 100644 --- a/flake.lock +++ b/flake.lock @@ -667,6 +667,62 @@ "type": "github" } }, + "niri": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": "nixpkgs_11", + "nixpkgs-stable": "nixpkgs-stable", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1755424351, + "narHash": "sha256-xcorYLNdtLpb0wH5CPlUcpmYQUxeK95j1X855xQw+DY=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "9aa137af01f05386e5bb5050e983750017007a66", + "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": 1755419373, + "narHash": "sha256-EFH3zbpyLYjEboNV2Lmkxf9joEuFCmeYX+MMLRPStpg=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "a6febb86aa5af0df7bf2792ca027ef95a503d599", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nix-gaming": { "inputs": { "flake-parts": "flake-parts_2", @@ -787,6 +843,22 @@ "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1755274400, + "narHash": "sha256-rTInmnp/xYrfcMZyFMH3kc8oko5zYfxsowaLv1LVobY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ad7196ae55c295f53a7d1ec39e4a06d922f3b899", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_10": { "locked": { "lastModified": 1682600000, @@ -804,6 +876,22 @@ } }, "nixpkgs_11": { + "locked": { + "lastModified": 1755186698, + "narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_12": { "locked": { "lastModified": 1753429684, "narHash": "sha256-9h7+4/53cSfQ/uA3pSvCaBepmZaz/dLlLVJnbQ+SJjk=", @@ -819,7 +907,7 @@ "type": "github" } }, - "nixpkgs_12": { + "nixpkgs_13": { "locked": { "lastModified": 1706487304, "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", @@ -835,7 +923,7 @@ "type": "github" } }, - "nixpkgs_13": { + "nixpkgs_14": { "locked": { "lastModified": 1681358109, "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", @@ -851,7 +939,7 @@ "type": "github" } }, - "nixpkgs_14": { + "nixpkgs_15": { "locked": { "lastModified": 1747958103, "narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=", @@ -1121,10 +1209,11 @@ "meson-syntax": "meson-syntax", "mujmap": "mujmap", "naersk": "naersk_4", + "niri": "niri", "nix-gaming": "nix-gaming", "nix-index-database": "nix-index-database", "nix-ld": "nix-ld", - "nixpkgs": "nixpkgs_11", + "nixpkgs": "nixpkgs_12", "nixvim": "nixvim", "nur": "nur", "raclette": "raclette", @@ -1239,7 +1328,7 @@ "rust-overlay_5": { "inputs": { "flake-utils": "flake-utils_10", - "nixpkgs": "nixpkgs_12" + "nixpkgs": "nixpkgs_13" }, "locked": { "lastModified": 1710123130, @@ -1258,7 +1347,7 @@ "rust-overlay_6": { "inputs": { "flake-utils": "flake-utils_12", - "nixpkgs": "nixpkgs_13" + "nixpkgs": "nixpkgs_14" }, "locked": { "lastModified": 1699150490, @@ -1522,7 +1611,7 @@ }, "treefmt-nix": { "inputs": { - "nixpkgs": "nixpkgs_14" + "nixpkgs": "nixpkgs_15" }, "locked": { "lastModified": 1753439394, @@ -1615,6 +1704,39 @@ "repo": "wayland-pipewire-idle-inhibit", "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": 1755219541, + "narHash": "sha256-yKV6xHaPbEbh5RPxAJnb9yTs1wypr7do86hFFGQm1w8=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "5a184d435927c3423f0ad189ea2b490578450fb7", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index bab1a89..899d2e0 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; gsm.url = "github:traxys/git-series-manager"; + niri.url = "github:sodiboo/niri-flake"; flake-parts.url = "github:hercules-ci/flake-parts"; treefmt-nix.url = "github:numtide/treefmt-nix"; @@ -158,7 +159,9 @@ gui = import ./gui/hm.nix { wayland-pipewire-idle-inhibit = inputs.wayland-pipewire-idle-inhibit.homeModules.default; }; - wm = import ./wm/hm.nix; + wm = import ./wm/hm.nix { + inherit (inputs) niri; + }; de = import ./de/hm.nix; personal-gui = import ./personal-gui/hm.nix; gaming = import ./gaming/hm.nix; @@ -169,7 +172,7 @@ minimal = import ./minimal/nixos.nix { inherit extraInfo; }; personal-cli = import ./personal-cli/nixos.nix; gui = import ./gui/nixos.nix; - wm = import ./wm/nixos.nix; + wm = import ./wm/nixos.nix { inherit (inputs) niri; }; de = import ./de/nixos.nix; personal-gui = import ./personal-gui/nixos.nix; roaming = import ./roaming/nixos.nix; diff --git a/wm/hm.nix b/wm/hm.nix index b740158..c185cba 100644 --- a/wm/hm.nix +++ b/wm/hm.nix @@ -1,3 +1,4 @@ +{ niri }: { config, lib, @@ -8,11 +9,24 @@ imports = [ ./sway.nix ./waybar/hm.nix + niri.homeModules.niri + ./niri.nix ]; options = { traxys.wm = lib.mkOption { - type = lib.types.enum [ "sway" ]; + type = lib.types.enum [ + "sway" + "niri" + ]; + }; + traxys.pkgs.niri-unstable = lib.mkOption { + type = lib.types.package; + default = niri.packages.${pkgs.system}.niri-unstable; + }; + traxys.pkgs.xwayland-satellite-unstable = lib.mkOption { + type = lib.types.package; + default = niri.packages.${pkgs.system}.xwayland-satellite-unstable; }; }; diff --git a/wm/niri.nix b/wm/niri.nix new file mode 100644 index 0000000..8309988 --- /dev/null +++ b/wm/niri.nix @@ -0,0 +1,217 @@ +{ + config, + pkgs, + lib, + ... +}: +lib.mkIf (config.traxys.wm == "niri") { + home.packages = with pkgs; [ + swaybg + config.traxys.pkgs.xwayland-satellite-unstable + ]; + + services.gnome-keyring.enable = true; + xdg.portal = { + enable = true; + extraPortals = [pkgs.xdg-desktop-portal-gnome]; + configPackages = [ config.programs.niri.package ]; + }; + + traxys.waybar.enable = true; + traxys.waybar.modules."niri/window".enable = true; + traxys.waybar.modules."niri/workspaces".enable = true; + + programs.niri = { + enable = true; + package = config.traxys.pkgs.niri-unstable; + + settings = + let + wallpaper = "${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/ba +ckgrounds/nixos/nix-wallpaper-simple-dark-gray.png"; + in + { + xwayland-satellite.path = lib.getExe config.traxys.pkgs.xwayland-satellite-unstable; + + input = { + keyboard = { + xkb.layout = "fr(ergol),us"; + xkb.options = "compose:102"; + numlock = true; + }; + touchpad = { + natural-scroll = false; + }; + }; + + spawn-at-startup = [ + { command = [ "waybar" ]; } + { command = [ "${pkgs.mako}/bin/mako" ]; } + { command = [ "signal-desktop" ]; } + { command = [ "discord" ]; } + { command = [ "firefox" ]; } + { command = [ "element-desktop" ]; } + { command = [ "thunderbird" ]; } + { command = [ "${pkgs.plasma5Packages.kdeconnect-kde}/libexec/kdeconnectd" ]; } + { + command = [ + "swaybg" + "--image" + wallpaper + ]; + } + ]; + + layer-rules = [ + { + matches = [ { namespace = "^notifications$"; } ]; + block-out-from = "screencast"; + } + ]; + + binds = + let + inherit (config.lib.niri.actions) + spawn + close-window + show-hotkey-overlay + toggle-overview + focus-column-left + focus-column-right + focus-window-up + focus-window-down + move-column-left + move-column-right + move-window-up + move-window-down + move-column-to-monitor-left + move-column-to-monitor-right + move-column-to-monitor-up + move-column-to-monitor-down + focus-workspace-down + focus-workspace-up + move-workspace-down + move-workspace-up + consume-or-expel-window-left + consume-or-expel-window-right + consume-window-into-column + expel-window-from-column + switch-preset-column-width + switch-preset-window-height + maximize-column + fullscreen-window + center-column + center-visible-columns + set-column-width + set-window-height + screenshot + ; + in + { + # "Print".action = spawn "sh" "-c" '' + # ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png + # ''; + "Print".action = screenshot; + "Mod+Shift+l" = { + action = spawn "${pkgs.swaylock-fancy}/bin/swaylock-fancy"; + hotkey-overlay.title = "Lock the screen"; + }; + "Mod+e" = { + action = spawn "${config.programs.rofi.package}/bin/rofi" "-show" "drun" "-show-icons"; + hotkey-overlay.title = "Run a program"; + }; + "Mod+Return" = { + action = spawn config.terminal.command; + hotkey-overlay.title = "Create a terminal"; + }; + + "Mod+space" = { + action = spawn "foot" "nvim" "+WikiIndex"; + hotkey-overlay.title = "Open the wiki index"; + }; + "Mod+Shift+space" = { + action = spawn "foot" "nvim" "+WikiPages"; + hotkey-overlay.title = "Open the wiki search"; + }; + "Mod+Shift+Slash".action = show-hotkey-overlay; + + "Mod+Shift+Q" = { + action = close-window; + hotkey-overlay.title = "Close the current window"; + }; + + "Mod+O" = { + action = toggle-overview; + repeat = false; + }; + + "Mod+Left".action = focus-column-left; + "Mod+Right".action = focus-column-right; + "Mod+Up".action = focus-window-up; + "Mod+Down".action = focus-window-down; + "Mod+Shift+Left".action = move-column-left; + "Mod+Shift+Right".action = move-column-right; + "Mod+Shift+Up".action = move-window-up; + "Mod+Shift+Down".action = move-window-down; + + "Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left; + "Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right; + "Mod+Shift+Ctrl+Up".action = move-column-to-monitor-up; + "Mod+Shift+Ctrl+Down".action = move-column-to-monitor-down; + + "Mod+Page_Down".action = focus-workspace-down; + "Mod+Page_Up".action = focus-workspace-up; + "Mod+Shift+Page_Down".action = move-workspace-down; + "Mod+Shift+Page_Up".action = move-workspace-up; + + "Mod+BracketLeft".action = consume-or-expel-window-left; + "Mod+BracketRight".action = consume-or-expel-window-right; + + "Mod+H".action = consume-window-into-column; + "Mod+G".action = expel-window-from-column; + "Mod+R".action = switch-preset-column-width; + "Mod+Shift+R".action = switch-preset-window-height; + "Mod+F".action = maximize-column; + "Mod+Shift+F".action = fullscreen-window; + "Mod+C".action = center-column; + "Mod+Shift+C".action = center-visible-columns; + + "Mod+Minus".action = set-column-width "-10%"; + "Mod+Plus".action = set-column-width "+10%"; + "Mod+Shift+Minus".action = set-window-height "-10%"; + "Mod+Shift+Plus".action = set-window-height "+10%"; + + # Media Keys + "XF86AudioRaiseVolume" = { + action = spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "'+10%'"; + allow-when-locked = true; + }; + "XF86AudioLowerVolume" = { + action = spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "'-10%'"; + allow-when-locked = true; + }; + "XF86AudioMute" = { + action = spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-mute" "@DEFAULT_SINK@" "toggle"; + allow-when-locked = true; + }; + "XF86AudioPlay" = { + action = spawn "${pkgs.playerctl}/bin/playerctl" "-p" "spotify" "play-pause"; + allow-when-locked = true; + }; + "XF86AudioNext".action = spawn "${pkgs.playerctl}/bin/playerctl" "-p" "spotify" "next"; + "XF86AudioPrev".action = spawn "${pkgs.playerctl}/bin/playerctl" "-p" "spotify" "previous"; + + "XF86MonBrightnessDown" = { + action = spawn (lib.getExe pkgs.brightnessctl) "set" "10%-"; + allow-when-locked = true; + }; + "XF86MonBrightnessUp" = { + action = spawn (lib.getExe pkgs.brightnessctl) "set" "10%+"; + allow-when-locked = true; + }; + + "XF86Display".action = spawn (lib.getExe' pkgs.wl-mirror "wl-present") "mirror"; + }; + }; + }; +} diff --git a/wm/nixos.nix b/wm/nixos.nix index f04635e..e120c84 100644 --- a/wm/nixos.nix +++ b/wm/nixos.nix @@ -1,3 +1,4 @@ +{ niri }: { pkgs, lib, @@ -7,7 +8,10 @@ { options = { traxys.wm = lib.mkOption { - type = lib.types.enum [ "sway" ]; + type = lib.types.enum [ + "sway" + "niri" + ]; }; }; @@ -22,16 +26,22 @@ }; }; - extraPortals = lib.mkIf (config.traxys.wm == "sway") ( - with pkgs; - [ - xdg-desktop-portal-wlr - xdg-desktop-portal-gtk - ] - ); + extraPortals = lib.mkMerge [ + (lib.mkIf (config.traxys.wm == "sway") ( + with pkgs; + [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ] + )) + (lib.mkIf (config.traxys.wm == "niri") (with pkgs; [ xdg-desktop-portal-gnome ])) + ]; + + configPackages = lib.mkIf (config.traxys.wm == "niri") [ pkgs.niri-unstable ]; }; nixpkgs.overlays = [ + niri.overlays.niri (self: super: { cage = pkgs.writeShellScriptBin "cage" '' export XKB_DEFAULT_LAYOUT=fr @@ -41,7 +51,25 @@ }) ]; - services.displayManager.sessionPackages = lib.optional (config.traxys.wm == "sway") pkgs.sway; + security.polkit.enable = true; + services.gnome.gnome-keyring.enable = true; + systemd.user.services.niri-flake-polkit = lib.mkIf (config.traxys.wm == "niri") { + description = "PolicyKit Authentication Agent provided by niri-flake"; + wantedBy = [ "niri.service" ]; + after = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + + services.displayManager.sessionPackages = + (lib.optional (config.traxys.wm == "sway") pkgs.sway) + ++ (lib.optional (config.traxys.wm == "niri") pkgs.niri-unstable); programs.regreet = { enable = true; diff --git a/wm/waybar/hm.nix b/wm/waybar/hm.nix index f07b9b6..808c9c1 100644 --- a/wm/waybar/hm.nix +++ b/wm/waybar/hm.nix @@ -123,6 +123,13 @@ }; }; + "niri/workspaces" = moduleOpt { + enable = false; + side = "left"; + priority = 20; + settings = { }; + }; + "sway/mode" = moduleOpt { enable = false; side = "left"; @@ -143,6 +150,13 @@ }; }; + "niri/window" = moduleOpt { + enable = false; + side = "center"; + priority = 10; + settings = { }; + }; + # # Right #