aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiran Bastaja <mbastaja@sorre.xyz>2025-06-30 15:04:46 +0200
committerMiran Bastaja <mbastaja@sorre.xyz>2025-06-30 15:05:03 +0200
commit11b9d5239bbce7e1ea5ef2cd4bb3073d6abbc0dc (patch)
tree2321b0f117de161248c50749db8eec8671bcf728
parentb31427ed0732608af7b03caec65c5622fbcba932 (diff)
init: niri config
-rw-r--r--flake.lock138
-rw-r--r--flake.nix3
-rw-r--r--hosts/underworld/default.nix5
-rw-r--r--share/home/dev-stuff.nix1
-rw-r--r--share/home/niri.nix233
-rw-r--r--share/system/client-common.nix1
6 files changed, 370 insertions, 11 deletions
diff --git a/flake.lock b/flake.lock
index f483163..e2b42a2 100644
--- a/flake.lock
+++ b/flake.lock
@@ -67,7 +67,7 @@
"sorrepkgs",
"nixpkgs"
],
- "nixpkgs-stable": "nixpkgs-stable_2"
+ "nixpkgs-stable": "nixpkgs-stable_3"
},
"locked": {
"lastModified": 1739610734,
@@ -216,6 +216,62 @@
"type": "github"
}
},
+ "niri-flake": {
+ "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": 1751275819,
+ "narHash": "sha256-013hN0hBpLAPS9PQhkQKb2KOUB3Y1Ef7poANHpsxbck=",
+ "owner": "sodiboo",
+ "repo": "niri-flake",
+ "rev": "91b2083cad55e4607ebc1cf920c08daf209ad7a0",
+ "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": 1750791124,
+ "narHash": "sha256-F5iVU/hjoSHSSe0gllxm0PcAaseEtGNanYK5Ha3k2Tg=",
+ "owner": "YaLTeR",
+ "repo": "niri",
+ "rev": "37458d94b288945f6cfbd3c5c233f634d59f246c",
+ "type": "github"
+ },
+ "original": {
+ "owner": "YaLTeR",
+ "repo": "niri",
+ "type": "github"
+ }
+ },
"nix-formatter-pack": {
"inputs": {
"nixpkgs": [
@@ -269,15 +325,15 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1748929857,
- "narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=",
- "owner": "nixos",
+ "lastModified": 1751011381,
+ "narHash": "sha256-krGXKxvkBhnrSC/kGBmg5MyupUUT5R6IBCLEzx9jhMM=",
+ "owner": "NixOS",
"repo": "nixpkgs",
- "rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4",
+ "rev": "30e2e2857ba47844aa71991daa6ed1fc678bcbb7",
"type": "github"
},
"original": {
- "owner": "nixos",
+ "owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
@@ -345,6 +401,22 @@
},
"nixpkgs-stable_2": {
"locked": {
+ "lastModified": 1751211869,
+ "narHash": "sha256-1Cu92i1KSPbhPCKxoiVG5qnoRiKTgR5CcGSRyLpOd7Y=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "b43c397f6c213918d6cfe6e3550abfe79b5d1c51",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-25.05",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-stable_3": {
+ "locked": {
"lastModified": 1739357830,
"narHash": "sha256-9xim3nJJUFbVbJCz48UP4fGRStVW5nv4VdbimbKxJ3I=",
"owner": "NixOS",
@@ -375,6 +447,22 @@
"type": "github"
}
},
+ "nixpkgs_3": {
+ "locked": {
+ "lastModified": 1748929857,
+ "narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
"nmd": {
"flake": false,
"locked": {
@@ -448,7 +536,7 @@
"nur": {
"inputs": {
"flake-parts": "flake-parts",
- "nixpkgs": "nixpkgs_2",
+ "nixpkgs": "nixpkgs_3",
"treefmt-nix": "treefmt-nix"
},
"locked": {
@@ -495,8 +583,9 @@
"emacs-overlay": "emacs-overlay",
"futils": "futils",
"home-manager": "home-manager",
+ "niri-flake": "niri-flake",
"nix-on-droid": "nix-on-droid",
- "nixpkgs": "nixpkgs",
+ "nixpkgs": "nixpkgs_2",
"nur": "nur",
"rust-overlay": "rust-overlay",
"snippets-ls": "snippets-ls",
@@ -719,6 +808,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": 1751228685,
+ "narHash": "sha256-MENtauGBhJ+kDeFaawvWGXaFG3Il6qQzjaP0RmtfM0k=",
+ "owner": "Supreeeme",
+ "repo": "xwayland-satellite",
+ "rev": "557ebeb616e03d5e4a8049862bbbd1f02c6f020b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "Supreeeme",
+ "repo": "xwayland-satellite",
+ "type": "github"
+ }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index 15d9162..4f3394f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -47,6 +47,9 @@
inputs.nixpkgs.follows = "nixpkgs";
};
+ # no overrides because I the binary cache to work
+ niri-flake.url = "github:sodiboo/niri-flake";
+
# development stuff
treefmt-nix = {
url = "github:numtide/treefmt-nix";
diff --git a/hosts/underworld/default.nix b/hosts/underworld/default.nix
index 1bbc0d1..4efc252 100644
--- a/hosts/underworld/default.nix
+++ b/hosts/underworld/default.nix
@@ -54,7 +54,10 @@
services.desktopManager.plasma6.enable = true;
# Niri, scrollable-tiling window manager
- programs.niri.enable = true;
+ programs.niri = {
+ enable = true;
+ package = pkgs.niri-stable;
+ };
# Configure keymap in X11
services.xserver.xkb = {
diff --git a/share/home/dev-stuff.nix b/share/home/dev-stuff.nix
index 259dfdd..f8a90fd 100644
--- a/share/home/dev-stuff.nix
+++ b/share/home/dev-stuff.nix
@@ -66,6 +66,7 @@ in
gleam
erlang
sqlx-cli
+ cachix
# TUI/GUI
zed-editor
diff --git a/share/home/niri.nix b/share/home/niri.nix
index 52d2ed4..eb6cce9 100644
--- a/share/home/niri.nix
+++ b/share/home/niri.nix
@@ -1,6 +1,235 @@
-{ pkgs, ... }:
{
- home.packages = with pkgs; [ xwayland-satellite ];
+ pkgs,
+ config,
+ inputs,
+ ...
+}:
+{
+ imports = [
+ inputs.niri-flake.homeModules.niri
+ ];
programs.waybar.enable = true;
programs.tofi.enable = true;
+ programs.kitty.enable = true;
+
+ programs.niri.settings = {
+ input = {
+ keyboard.xkb = {
+ layout = "us,hr";
+ options = "grp:win_space_toggle";
+ };
+ touchpad = {
+ enable = true;
+ tap = true;
+ natural-scroll = true;
+ };
+ mouse = {
+ enable = true;
+ accel-profile = "flat";
+ };
+ };
+
+ outputs."eDP-1" = {
+ enable = true;
+ mode = {
+ width = 1920;
+ height = 1080;
+ };
+ scale = 2;
+ # transform = "normal";
+ # position = {
+ # # From the default config, no idea why
+ # x = 1280;
+ # y = 0;
+ # };
+ };
+
+ layout = {
+ gaps = 16;
+ center-focused-column = "never";
+ # You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between.
+ preset-column-widths = [
+ { proportion = 1. / 3.; }
+ { proportion = 1. / 2.; }
+ { proportion = 2. / 3.; }
+ ];
+ default-column-width.proportion = 1. / 2.;
+ focus-ring = {
+ width = 4;
+ active.color = "#7fc8ff";
+ inactive.color = "#505050";
+ };
+ };
+
+ spawn-at-startup = [
+ { command = [ "${pkgs.xwayland-satellite}/bin/xwayland-satellite" ]; }
+ ];
+
+ environment = {
+ QT_QPA_PLATFORM = "wayland";
+ DISPLAY = ":0"; # for X11 to recognize xwayland-satellite correctly
+ };
+
+ screenshot-path = null; # clipboard only
+
+ window-rules = [
+ # Open the Firefox picture-in-picture player as floating by default.
+ {
+ matches = [ { title = "^Picture-in-Picture$"; } ];
+ open-floating = true;
+ }
+
+ # Work around WezTerm's initial configure bug by setting an empty default-column-width.
+ {
+ matches = [ { app-id = ''^org\.wezfurlong\.wezterm$''; } ];
+ default-column-width = null;
+ }
+
+ {
+ matches = [
+ { app-id = ''^org\.keepassxc\.KeePassXC$''; }
+ { app-id = ''^org\.gnome\.World\.Secrets$''; }
+ { app-id = ''^Bitwarden$''; }
+ ];
+ block-out-from = "screen-capture";
+ }
+ ];
+
+ binds = with config.lib.niri.actions; {
+ # Shows a list of important hotkeys
+ "Mod+Shift+Slash".action = show-hotkey-overlay;
+
+ "Mod+Shift+Return".action = spawn "kitty";
+ "Mod+P".action = spawn "tofi-drun";
+ "Mod+Shift+P".action = spawn "tofi-run";
+
+ # Audio stuff
+ "XF86AudioRaiseVolume" = {
+ allow-when-locked = true;
+ action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1+";
+ };
+ "XF86AudioLowerVolume" = {
+ allow-when-locked = true;
+ action = spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.1-";
+ };
+ "XF86AudioMute" = {
+ allow-when-locked = true;
+ action = spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle";
+ };
+ "XF86AudioMicMute" = {
+ allow-when-locked = true;
+ action = spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle";
+ };
+
+ # general window management
+ "Mod+Shift+C".action = close-window;
+ "Mod+Left".action = focus-column-left;
+ "Mod+Down".action = focus-window-down;
+ "Mod+Up".action = focus-window-up;
+ "Mod+Right".action = focus-column-right;
+ "Mod+H".action = focus-column-left;
+ "Mod+J".action = focus-window-down;
+ "Mod+K".action = focus-window-up;
+ "Mod+L".action = focus-column-right;
+
+ "Mod+Shift+Left".action = move-column-left;
+ "Mod+Shift+Down".action = move-window-down;
+ "Mod+Shift+Up".action = move-window-up;
+ "Mod+Shift+Right".action = move-column-right;
+ "Mod+Shift+H".action = move-column-left;
+ "Mod+Shift+J".action = move-window-down;
+ "Mod+Shift+K".action = move-window-up;
+ "Mod+Shift+L".action = move-column-right;
+
+ "Mod+Home".action = focus-column-first;
+ "Mod+End".action = focus-column-last;
+ "Mod+Shift+Home".action = move-column-to-first;
+ "Mod+Shift+End".action = move-column-to-last;
+
+ "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;
+ "Mod+Shift+U".action = move-column-to-workspace-down;
+ "Mod+Shift+I".action = move-column-to-workspace-up;
+
+ "Mod+Shift+Page_Down".action = move-workspace-down;
+ "Mod+Shift+Page_Up".action = move-workspace-up;
+
+ "Mod+WheelScrollDown".action = focus-workspace-down;
+ "Mod+WheelScrollUp".action = focus-workspace-up;
+ "Mod+Ctrl+WheelScrollDown".action = move-column-to-workspace-down;
+ "Mod+Ctrl+WheelScrollUp".action = move-column-to-workspace-up;
+
+ "Mod+WheelScrollRight".action = focus-column-right;
+ "Mod+WheelScrollLeft".action = focus-column-left;
+ "Mod+Ctrl+WheelScrollRight".action = move-column-right;
+ "Mod+Ctrl+WheelScrollLeft".action = move-column-left;
+
+ "Mod+Shift+WheelScrollDown".action = focus-column-right;
+ "Mod+Shift+WheelScrollUp".action = focus-column-left;
+ "Mod+Ctrl+Shift+WheelScrollDown".action = move-column-right;
+ "Mod+Ctrl+Shift+WheelScrollUp".action = move-column-left;
+
+ "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+BracketLeft".action = consume-or-expel-window-left;
+ "Mod+BracketRight".action = consume-or-expel-window-right;
+
+ # Consume one window from the right to the bottom of the focused column.
+ "Mod+Comma".action = consume-window-into-column;
+ # Expel the bottom window from the focused column to the right.
+ "Mod+Period".action = expel-window-from-column;
+
+ "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 = maximize-column;
+ "Mod+Shift+F".action = fullscreen-window;
+
+ # Expand the focused column to space not taken up by other fully visible columns.
+ # Makes the column "fill the rest of the space".
+ "Mod+Ctrl+F".action = expand-column-to-available-width;
+
+ "Mod+C".action = center-column;
+
+ "Mod+Minus".action = set-column-width "-10%";
+ "Mod+Equal".action = set-column-width "+10%";
+ "Mod+Shift+Minus".action = set-window-height "-10%";
+ "Mod+Shift+Equal".action = set-window-height "+10%";
+
+ "Mod+V".action = toggle-window-floating;
+ "Mod+Shift+V".action = switch-focus-between-floating-and-tiling;
+
+ "Mod+W".action = toggle-column-tabbed-display;
+
+ "Print".action = screenshot;
+ "Alt+Print".action = screenshot-window;
+
+ "Mod+Escape" = {
+ allow-inhibiting = false;
+ action = toggle-keyboard-shortcuts-inhibit;
+ };
+
+ "Mod+Shift+E".action = quit;
+ "Ctrl+Alt+Delete".action = quit;
+ };
+ };
}
diff --git a/share/system/client-common.nix b/share/system/client-common.nix
index 20f61ae..41885ff 100644
--- a/share/system/client-common.nix
+++ b/share/system/client-common.nix
@@ -13,6 +13,7 @@
overlays = [
inputs.rust-overlay.overlays.default
inputs.emacs-overlay.overlays.default
+ inputs.niri-flake.overlays.niri
(final: prev: {
nur = import inputs.nur {
nurpkgs = prev;