diff --git a/.github/workflows/build-and-cache.yml b/.github/workflows/build-and-cache.yml index 264d3ce..95cb54d 100644 --- a/.github/workflows/build-and-cache.yml +++ b/.github/workflows/build-and-cache.yml @@ -7,8 +7,8 @@ jobs: strategy: matrix: package: - - github:cything/nixpkgs/fd06e41125350bc3db5628df49d3b84e4652a59d#lact - - github:cything/nixpkgs/2269ae37e860190c38b17826d5ca274e6a901c46#alvr + - github:cything/nixpkgs/301762de4d6dab6d1a100b4c0dde7e0168d09489#lact + - github:nixos/nixpkgs/be139555bb144501ba96e93e4c44e8f074b5a5ff#ungoogled-chromium os: - ubuntu-latest - macos-latest diff --git a/flake.lock b/flake.lock index dd82f82..db6dff3 100644 --- a/flake.lock +++ b/flake.lock @@ -266,11 +266,11 @@ ] }, "locked": { - "lastModified": 1737120639, - "narHash": "sha256-p5e/45V41YD3tMELuiNIoVCa25/w4nhOTm0B9MtdHFI=", + "lastModified": 1737221749, + "narHash": "sha256-igllW0yG+UbetvhT11jnt9RppSHXYgMykYhZJeqfHs0=", "owner": "nix-community", "repo": "home-manager", - "rev": "a0046af169ce7b1da503974e1b22c48ef4d71887", + "rev": "97d7946b5e107dd03cc82f21165251d4e0159655", "type": "github" }, "original": { @@ -355,6 +355,64 @@ "type": "github" } }, + "niri": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_2", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1737231928, + "narHash": "sha256-eOvFTgpFGP8hy6r3O8Ae5jOGc483l4BszwQsPcccbbs=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "ca748d585a271a512807cd60e5353a9ddb4d1dee", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1736614405, + "narHash": "sha256-AJ1rlgNOPb3/+DbS5hkhm21t6Oz8IgqLllwmZt0lyzk=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "e05bc269e678ecf828b96ae79c991c13b00b38a5", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v25.01", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1737211438, + "narHash": "sha256-XPcV2rV7Vy7lLeZMhTOwd0t/sRwNquXI7CH7+3Aftt0=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "818248457210f5101459ea7d7066d12c456c8a97", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nix-darwin": { "inputs": { "nixpkgs": [ @@ -378,11 +436,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1737083351, - "narHash": "sha256-hCddtSuk6m6XROmdOC0te0j2sLeUr28QIzNRk0qF1as=", + "lastModified": 1737241062, + "narHash": "sha256-GM4ZnlsuJWjk+tbespU/DWQsZ2V0u0CS3Hqg0JGMt5M=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0993fc268872148cebcd1fac8660a8b8ced49542", + "rev": "b681ff2c9c9163f24ca705d948bb0cee1b3e09f9", "type": "github" }, "original": { @@ -436,6 +494,22 @@ "type": "github" } }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1737165118, + "narHash": "sha256-s40Kk/OulP3J/1JvC3VT16U4r/Xw6Qdi7SRw3LYkPWs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6a3ae7a5a12fb8cac2d59d7df7cbd95f9b2f0566", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, "nixvim": { "inputs": { "devshell": "devshell", @@ -451,11 +525,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1737143193, - "narHash": "sha256-+/BdPFrdJpgmzrMEUZMxsLeND8IvFtjyZbxHX2XrNv4=", + "lastModified": 1737200978, + "narHash": "sha256-QTUx/F8HVjrRIHQxHKrr72aPMj+cDk18WTbvBCCBBdI=", "owner": "nix-community", "repo": "nixvim", - "rev": "aa839cf994f6b9a6b38e755597452087beac0567", + "rev": "cbf960e5659054b2ccf27b67218782e69016bef5", "type": "github" }, "original": { @@ -520,6 +594,7 @@ "flake-parts": "flake-parts", "home-manager": "home-manager", "lanzaboote": "lanzaboote", + "niri": "niri", "nixpkgs": "nixpkgs", "nixpkgs-garage": "nixpkgs-garage", "nixvim": "nixvim", @@ -642,6 +717,39 @@ "repo": "treefmt-nix", "type": "github" } + }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1730166465, + "narHash": "sha256-nq7bouXQXaaPPo/E+Jbq+wNHnatD4dY8OxSrRqzvy6s=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "a713cf46cb7db84a0d1b57c3a397c610cad3cf98", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.5", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1736487362, + "narHash": "sha256-4kGoOA7FgK9N2mzS+TFEn41kUUNY6KwdiA/0rqlr868=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "8f55e27f63a749881c4bbfbb6b1da028342a91d1", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 15b79ed..ca9fcf6 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; flake-parts.url = "github:hercules-ci/flake-parts"; + niri.url = "github:sodiboo/niri-flake"; + niri.inputs.nixpkgs.follows = "nixpkgs"; nixpkgs-garage.url = "github:cything/nixpkgs/garage-module"; # unmerged PR }; @@ -35,9 +37,13 @@ nixConfig = { extra-substituters = [ "https://cache.cything.io/central" + "https://niri.cachix.org" + "https://nix-community.cachix.org" ]; extra-trusted-public-keys = [ "central:uWhjva6m6dhC2hqNisjn2hXGvdGBs19vPkA1dPEuwFg=" + "niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; builders-use-substitutes = true; }; @@ -92,88 +98,91 @@ pkgs = import nixpkgs { config.allowUnfree = true; system = "x86_64-linux"; - overlays = import ./overlay; + overlays = [ inputs.niri.overlays.niri ] ++ import ./overlay; }; in { - nixosConfigurations = - let - lib = nixpkgs.lib; - in - { - ytnix = lib.nixosSystem { - modules = [ - { - nixpkgs = { inherit pkgs; }; - } - ./hosts/ytnix - inputs.sops-nix.nixosModules.sops - ./modules - inputs.lanzaboote.nixosModules.lanzaboote - ]; - }; - chunk = lib.nixosSystem { - specialArgs = { inherit inputs; }; - modules = [ - { - nixpkgs = { inherit pkgs; }; - disabledModules = [ - "services/web-servers/garage.nix" - ]; - } - ./hosts/chunk - inputs.sops-nix.nixosModules.sops - ./modules - (inputs.nixpkgs-garage + "/nixos/modules/services/web-servers/garage.nix") - ]; - }; + nixosConfigurations = + let + lib = nixpkgs.lib; + in + { + ytnix = lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + { + nixpkgs = { inherit pkgs; }; + } + ./hosts/ytnix + inputs.sops-nix.nixosModules.sops + ./modules + inputs.lanzaboote.nixosModules.lanzaboote + inputs.niri.nixosModules.niri + ]; + }; + chunk = lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + { + nixpkgs = { inherit pkgs; }; + disabledModules = [ + "services/web-servers/garage.nix" + ]; + } + ./hosts/chunk + inputs.sops-nix.nixosModules.sops + ./modules + (inputs.nixpkgs-garage + "/nixos/modules/services/web-servers/garage.nix") + ]; + }; - titan = lib.nixosSystem { - specialArgs = { inherit inputs; }; - modules = [ - { - nixpkgs = { inherit pkgs; }; - } - ./hosts/titan - disko.nixosModules.disko - inputs.sops-nix.nixosModules.sops - ./modules - ]; - }; - }; - homeConfigurations = - let - lib = home-manager.lib; - in - { - "yt@ytnix" = lib.homeManagerConfiguration { - inherit pkgs; - extraSpecialArgs = { inherit inputs; }; - modules = [ - ./home/yt/ytnix.nix - inputs.nixvim.homeManagerModules.nixvim - ]; + titan = lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + { + nixpkgs = { inherit pkgs; }; + } + ./hosts/titan + disko.nixosModules.disko + inputs.sops-nix.nixosModules.sops + ./modules + ]; + }; }; + homeConfigurations = + let + lib = home-manager.lib; + in + { + "yt@ytnix" = lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { inherit inputs; }; + modules = [ + ./home/yt/ytnix.nix + inputs.nixvim.homeManagerModules.nixvim + inputs.niri.homeModules.config + ]; + }; - "yt@chunk" = lib.homeManagerConfiguration { - inherit pkgs; - extraSpecialArgs = { inherit inputs; }; - modules = [ - ./home/yt/chunk.nix - inputs.nixvim.homeManagerModules.nixvim - ]; - }; + "yt@chunk" = lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { inherit inputs; }; + modules = [ + ./home/yt/chunk.nix + inputs.nixvim.homeManagerModules.nixvim + ]; + }; - "codespace@codespace" = lib.homeManagerConfiguration { - inherit pkgs; - extraSpecialArgs = { inherit inputs; }; - modules = [ - ./home/yt/codespace.nix - inputs.nixvim.homeManagerModules.nixvim - ]; + "codespace@codespace" = lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { inherit inputs; }; + modules = [ + ./home/yt/codespace.nix + inputs.nixvim.homeManagerModules.nixvim + ]; + }; }; - }; - }; + }; } ); } diff --git a/home/niri/default.nix b/home/niri/default.nix new file mode 100644 index 0000000..5071256 --- /dev/null +++ b/home/niri/default.nix @@ -0,0 +1,157 @@ +{ config, pkgs, lib, ... }: +let + wallpaper = "${./nixos-c-book.png}"; + terminal = "foot"; + menu = [ "fuzzel" "-w" "100" ]; + browser = "librewolf"; + file-manager = "thunar"; + clipboard = "cliphist list | ${lib.concatStringsSep " " menu} --dmenu | cliphist decode | wl-copy"; +in +{ + programs.niri.settings = { + prefer-no-csd = true; + input.keyboard.xkb.options = "ctrl:nocaps"; + spawn-at-startup = [ + { command = [ "${lib.getExe pkgs.waybar}" ]; } + { command = [ "${lib.getExe pkgs.swaybg}" "-m" "fill" "-i" wallpaper ]; } + { command = [ "${lib.getExe pkgs.xwayland-satellite}" ]; } + ]; + hotkey-overlay.skip-at-startup = true; + + input = { + touchpad = { + tap = true; + dwt = true; + natural-scroll = true; + click-method = "clickfinger"; + }; + warp-mouse-to-focus = true; + focus-follows-mouse.enable = true; + }; + + environment = { + DISPLAY = ":0"; # for xwayland-satellite + }; + + layout = { + gaps = 4; + focus-ring = { + width = 4; + active.color = "#00000055"; + inactive.color = "#505050"; + }; + always-center-single-column = true; + border.enable = false; + }; + + window-rules = [ + { + matches = [ + { app-id = "anki"; title = "Add"; } + { app-id = "mpv"; } + { app-id = "Bitwarden"; } + ]; + open-floating = true; + } + { + matches = [{ app-id = "anki"; }]; + default-column-width.proportion = .25; + } + { + matches = [ + { app-id = "foot"; } + { app-id = "anki"; title = "^Browse"; } + ]; + default-column-width.proportion = .5; + } + { + matches = [{ app-id = "librewolf"; }]; + default-column-width.proportion = .75; + } + ]; + }; + + programs.niri.settings.binds = + with config.lib.niri.actions; + let + sh = spawn "sh" "-c"; + in + { + "Mod+Return".action = spawn terminal; + "Mod+D".action = spawn menu; + + "Mod+Shift+E".action = quit; + "Mod+Equal".action = set-column-width "+10%"; + "Mod+Minus".action = set-column-width "-10%"; + "Mod+Shift+Equal".action = set-window-height "+10%"; + "Mod+Shift+Minus".action = set-window-height "-10%"; + "Super+Alt+L".action = spawn "swaylock"; + "Mod+Ctrl+Q".action = close-window; + "Mod+H".action = focus-column-left; + "Mod+L".action = focus-column-right; + "Mod+K".action = focus-window-up; + "Mod+J".action = focus-window-down; + "Mod+Shift+H".action = move-column-left; + "Mod+Shift+L".action = move-column-right; + "Mod+Shift+K".action = move-window-up; + "Mod+Shift+J".action = move-window-down; + "Mod+U".action = focus-workspace-up; + "Mod+I".action = focus-workspace-down; + "Mod+Shift+U".action = move-window-to-workspace-up; + "Mod+Shift+I".action = move-window-to-workspace-down; + "Mod+W".action = maximize-column; + "Mod+C".action = center-column; + "Mod+Shift+Space".action = toggle-window-floating; + "Mod+Space".action = switch-focus-between-floating-and-tiling; + "Print".action = screenshot; + "Alt+Print".action = screenshot-window; + "Ctrl+Print".action = screenshot-screen; + "Mod+R".action = switch-preset-column-width; + "Mod+Shift+R".action = switch-preset-window-height; + "Mod+Ctrl+R".action = reset-window-height; + "Mod+F".action = fullscreen-window; + "Mod+WheelScrollDown" = { + cooldown-ms = 150; + action = focus-column-right; + }; + "Mod+WheelScrollUp" = { + cooldown-ms = 150; + action = focus-column-left; + }; + + "XF86AudioRaiseVolume".action = sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+"; + "XF86AudioLowerVolume".action = sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-"; + "XF86AudioMute".action = sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + "XF86MonBrightnessUp".action = sh "brightnessctl set 1%+"; + "XF86MonBrightnessDown".action = sh "brightnessctl set 1%-"; + + "Mod+1".action = focus-workspace 1; + "Mod+2".action = focus-workspace 2; + "Mod+3".action = focus-workspace 3; + "Mod+4".action = focus-workspace 4; + "Mod+5".action = focus-workspace 5; + "Mod+6".action = focus-workspace 6; + "Mod+7".action = focus-workspace 7; + "Mod+8".action = focus-workspace 8; + "Mod+9".action = focus-workspace 9; + "Mod+Shift+1".action = move-column-to-workspace 1; + "Mod+Shift+2".action = move-column-to-workspace 2; + "Mod+Shift+3".action = move-column-to-workspace 3; + "Mod+Shift+4".action = move-column-to-workspace 4; + "Mod+Shift+5".action = move-column-to-workspace 5; + "Mod+Shift+6".action = move-column-to-workspace 6; + "Mod+Shift+7".action = move-column-to-workspace 7; + "Mod+Shift+8".action = move-column-to-workspace 8; + "Mod+Shift+9".action = move-column-to-workspace 9; + + "Mod+Alt+B".action = spawn browser; + "Mod+Alt+A".action = spawn "anki"; + "Mod+Alt+F".action = spawn file-manager; + "Mod+Alt+E".action = spawn "evolution"; + "Mod+P".action = spawn "bitwarden"; + "Mod+Comma".action = sh clipboard; + + "MouseForward".action = spawn "sh" "${./scripts/remote.sh}" "btn1"; + "MouseBack".action = spawn "sh" "${./scripts/remote.sh}"; + }; +} diff --git a/home/niri/nixos-c-book.png b/home/niri/nixos-c-book.png new file mode 100644 index 0000000..96abf8f Binary files /dev/null and b/home/niri/nixos-c-book.png differ diff --git a/home/niri/scripts/remote.sh b/home/niri/scripts/remote.sh new file mode 100755 index 0000000..5065980 --- /dev/null +++ b/home/niri/scripts/remote.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +active_window=$(niri msg --json focused-window |jq -r .app_id) + +if [ "$1" = "btn1" ]; then + if [ "$active_window" = "anki" ]; then + wtype " " + elif [ "$active_window" = "foot" ]; then + wtype -M ctrl -M shift -k c -m ctrl -m shift + elif [ "$active_window" = "chromium-browser" ] || [ "$active_window" = "librewolf" ]; then + wtype -M alt -P right -p right -m alt + else + wtype -M ctrl -k c -m ctrl + fi +else + if [ "$active_window" = "anki" ]; then + wtype "1" + elif [ "$active_window" = "foot" ]; then + wtype -M ctrl -M shift -k v -m ctrl + elif [ "$active_window" = "chromium-browser" ] || [ "$active_window" = "librewolf" ]; then + wtype -M alt -P left -p left -m alt + else + wtype -M ctrl -k v -m ctrl + fi +fi diff --git a/home/nixvim/default.nix b/home/nixvim/default.nix index 675dbc0..98a97ee 100644 --- a/home/nixvim/default.nix +++ b/home/nixvim/default.nix @@ -150,7 +150,10 @@ nil_ls = { enable = true; settings = { - formatting.command = [ "nix" "fmt" ]; + formatting.command = [ + "nix" + "fmt" + ]; nix.flake.autoArchive = true; }; }; diff --git a/home/waybar/config b/home/waybar/config index 13b7819..6038a44 100644 --- a/home/waybar/config +++ b/home/waybar/config @@ -6,8 +6,8 @@ "margin-left": 0, "margin-right": 0, "margin-top": 0, - "modules-left": ["sway/workspaces", "clock#time", "clock#date", "battery"], // Sets modules for the left of the bar - "modules-center": ["sway/window"], // Set modules for the center of the bar + "modules-left": ["niri/workspaces", "clock#time", "clock#date", "battery"], // Sets modules for the left of the bar + "modules-center": ["niri/window"], // Set modules for the center of the bar "modules-right": ["tray", "temperature", "cpu", "memory", "wireplumber"], // Set modules for the right of the bar "clock#time": { "format": "{:%H:%M:%S}", @@ -71,7 +71,7 @@ "on-click": "pavucontrol", "interval": 4, }, - "sway/window": { + "niri/window": { "max-length": 64, }, "tray": { diff --git a/home/yt/ytnix.nix b/home/yt/ytnix.nix index 8a725fe..a64bc73 100644 --- a/home/yt/ytnix.nix +++ b/home/yt/ytnix.nix @@ -6,6 +6,7 @@ imports = [ ./common.nix ../foot.nix + ../niri ]; home = { username = "yt"; @@ -99,6 +100,7 @@ clang seahorse github-cli + fuzzel ]; programs.waybar.enable = true; @@ -121,7 +123,6 @@ }; xdg.configFile = { - sway.source = ../sway; rofi.source = ../rofi; waybar.source = ../waybar; mpv.source = ../mpv; diff --git a/hosts/ytnix/default.nix b/hosts/ytnix/default.nix index f6e5c55..8912c19 100644 --- a/hosts/ytnix/default.nix +++ b/hosts/ytnix/default.nix @@ -188,11 +188,6 @@ }; services.blueman.enable = true; - programs.sway = { - enable = true; - wrapperFeatures.gtk = true; - }; - my.backup = { enable = true; jobName = "ytnixRsync"; @@ -315,4 +310,9 @@ }; services.trezord.enable = true; + + my.niri = { + enable = true; + package = pkgs.niri-unstable; + }; } diff --git a/modules/default.nix b/modules/default.nix index 2155137..bde6e96 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -2,5 +2,6 @@ { imports = [ ./backup.nix + ./niri.nix ]; } diff --git a/modules/niri.nix b/modules/niri.nix new file mode 100644 index 0000000..b5a6ef4 --- /dev/null +++ b/modules/niri.nix @@ -0,0 +1,21 @@ +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.my.niri; +in +{ + options.my.niri = { + enable = lib.mkEnableOption "niri"; + package = lib.mkPackageOption pkgs "niri" { }; + }; + + config = lib.mkIf cfg.enable { + programs.niri.package = cfg.package; + programs.niri.enable = true; + programs.xwayland.enable = true; + }; +}