summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-01-14 15:05:32 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2025-01-14 15:05:40 +0100
commitc744867b5adc417748f6ed6fdb17cb6e4c6fc46b (patch)
treecc970543a9e601244f5fab956f52e999b686f4a1
parent21b52a31e1eff5c8142f26e091fde083c21db55f (diff)
downloadnixos-c744867b5adc417748f6ed6fdb17cb6e4c6fc46b.tar
nixos-c744867b5adc417748f6ed6fdb17cb6e4c6fc46b.tar.gz
nixos-c744867b5adc417748f6ed6fdb17cb6e4c6fc46b.tar.bz2
nixos-c744867b5adc417748f6ed6fdb17cb6e4c6fc46b.tar.xz
nixos-c744867b5adc417748f6ed6fdb17cb6e4c6fc46b.zip
...
-rw-r--r--accounts/gkleen@sif/niri/default.nix117
-rw-r--r--accounts/gkleen@sif/niri/waybar.nix16
-rw-r--r--accounts/gkleen@sif/systemd.nix14
-rw-r--r--flake.lock42
-rw-r--r--flake.nix7
-rw-r--r--hosts/sif/default.nix5
-rw-r--r--system-profiles/core/default.nix2
-rw-r--r--system-profiles/niri-unstable.nix11
8 files changed, 145 insertions, 69 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix
index 6a8d10a0..b6165487 100644
--- a/accounts/gkleen@sif/niri/default.nix
+++ b/accounts/gkleen@sif/niri/default.nix
@@ -1,10 +1,35 @@
1{ config, pkgs, lib, ... }: 1{ config, hostConfig, pkgs, lib, ... }:
2let 2let
3 niri = config.programs.niri.package; 3 niri = config.programs.niri.package;
4 terminal = lib.getExe config.programs.kitty.package; 4 terminal = lib.getExe config.programs.kitty.package;
5 lightctl = lib.getExe' config.services.avizo.package "lightctl"; 5 lightctl = lib.getExe' config.services.avizo.package "lightctl";
6 volumectl = lib.getExe' config.services.avizo.package "volumectl"; 6 volumectl = lib.getExe' config.services.avizo.package "volumectl";
7 dunstctl = lib.getExe' config.services.dunst.package "dunstctl"; 7 dunstctl = lib.getExe' config.services.dunst.package "dunstctl";
8 loginctl = lib.getExe' hostConfig.systemd.package "loginctl";
9 systemctl = lib.getExe' hostConfig.systemd.package "systemctl";
10
11 focus-or-spawn = pkgs.writeShellApplication {
12 name = "focus-or-spawn";
13 runtimeInputs = [ niri pkgs.gojq pkgs.gnugrep ];
14 text = ''
15 app_id="$1"
16 shift
17 workspace_name="$1"
18 shift
19
20 niri msg action move-workspace-to-monitor --output "$(niri msg -j workspaces | jq -r '.[] | select(.is_focused) | .output')" "$workspace_name"
21
22 while IFS=$'\n' read -r window_json; do
23 if jq -r '.app_id' <<<"$window_json" | grep -q "$app_id"; then
24 niri msg action focus-window --id "$(jq -r '.id' <<<"$window_json")"
25 exit 0
26 fi
27 done < <(niri msg -j windows | jq -c '.[]')
28
29 exec "$@"
30 '';
31 };
32 focus-or-spawn-action = app_id: workspace_name: config.lib.niri.actions.spawn (lib.getExe focus-or-spawn) (lib.escapeShellArg app_id) (lib.escapeShellArg workspace_name);
8in { 33in {
9 imports = [ 34 imports = [
10 ./waybar.nix 35 ./waybar.nix
@@ -21,7 +46,9 @@ in {
21 Service = { 46 Service = {
22 Type = "notify"; 47 Type = "notify";
23 NotifyAccess = "all"; 48 NotifyAccess = "all";
24 ExecStart = lib.getExe pkgs.xwayland-satellite-unstable; 49 Environment = [ "DISPLAY=:0" ];
50 ExecStart = ''${lib.getExe pkgs.xwayland-satellite-unstable} ''${DISPLAY}'';
51 ExecStartPre = "${systemctl} --user import-environment DISPLAY";
25 StandardOutput = "journal"; 52 StandardOutput = "journal";
26 }; 53 };
27 Install = { 54 Install = {
@@ -29,16 +56,44 @@ in {
29 }; 56 };
30 }; 57 };
31 58
59 services.swayidle = {
60 events = [
61 { event = "after-resume"; command = "${lib.getExe niri} msg action power-on-monitors"; }
62 ];
63 timeouts = [
64 { timeout = 300;
65 command = "${lib.getExe niri} msg action power-off-monitors";
66 }
67 ];
68 };
69
32 programs.niri.settings = { 70 programs.niri.settings = {
33 prefer-no-csd = true; 71 prefer-no-csd = true;
34 screenshot-path = "${config.home.homeDirectory}/screenshots"; 72 screenshot-path = "${config.home.homeDirectory}/screenshots";
35 73
74 hotkey-overlay.skip-at-startup = true;
75
36 input = { 76 input = {
37 keyboard.xkb = { 77 keyboard.xkb = {
38 layout = "us,"; 78 layout = "us,us";
39 variant = "dvp,"; 79 variant = "dvp,";
40 options = "compose:caps,grp:win_space_toggle"; 80 options = "compose:caps,grp:win_space_toggle";
41 }; 81 };
82
83 workspace-auto-back-and-forth = true;
84 # focus-follows-mouse.enable = true;
85 warp-mouse-to-focus = true;
86 };
87
88 outputs = {
89 "Samsung Display Corp. 0x4141 Unknown" = {
90 scale = 1.5;
91 position = { x = 0; y = 0; };
92 };
93 "Ancor Communications Inc ASUS PB287Q 0x0000DD9B" = {
94 scale = 1.5;
95 position = { x = 2560; y = 0; };
96 };
42 }; 97 };
43 98
44 environment = { 99 environment = {
@@ -48,9 +103,40 @@ in {
48 SDL_VIDEODRIVER = "wayland"; 103 SDL_VIDEODRIVER = "wayland";
49 }; 104 };
50 105
106 layout = {
107 gaps = 8;
108 struts = { left = 8; right = 8; top = 0; bottom = 0; };
109 focus-ring = {
110 width = 2;
111 };
112 empty-workspace-above-first = true;
113 };
114
51 cursor.hide-when-typing = true; 115 cursor.hide-when-typing = true;
52 116
117 workspaces = {
118 "01".name = "pwctl";
119 };
120
121 window-rules = [
122 {
123 geometry-corner-radius =
124 let
125 allCorners = r: { bottom-left = r; bottom-right = r; top-left = r; top-right = r; };
126 in allCorners 8.;
127 clip-to-geometry = true;
128 open-focused = false;
129 }
130 {
131 matches = [ { app-id = "^com\.saivert\.pwvucontrol$"; } ];
132 open-on-workspace = "pwctl";
133 open-focused = true;
134 }
135 ];
136
53 binds = with config.lib.niri.actions; { 137 binds = with config.lib.niri.actions; {
138 "Mod+Slash".action = show-hotkey-overlay;
139
54 "Mod+Return".action = spawn terminal; 140 "Mod+Return".action = spawn terminal;
55 "Mod+Q".action = close-window; 141 "Mod+Q".action = close-window;
56 "Mod+D".action = spawn (lib.getExe config.programs.fuzzel.package); 142 "Mod+D".action = spawn (lib.getExe config.programs.fuzzel.package);
@@ -79,17 +165,20 @@ in {
79 "Mod+G".action = focus-workspace-down; 165 "Mod+G".action = focus-workspace-down;
80 "Mod+C".action = focus-workspace-up; 166 "Mod+C".action = focus-workspace-up;
81 167
82 "Mod+Control+G".action = move-column-to-workspace-down; 168 "Mod+Shift+G".action = move-column-to-workspace-down;
83 "Mod+Control+C".action = move-column-to-workspace-up; 169 "Mod+Shift+C".action = move-column-to-workspace-up;
84 170
85 "Mod+Shift+G".action = move-workspace-down; 171 "Mod+Shift+Control+G".action = move-workspace-down;
86 "Mod+Shift+C".action = move-workspace-up; 172 "Mod+Shift+Control+C".action = move-workspace-up;
87 173
88 "Mod+M".action = consume-window-into-column; 174 "Mod+M".action = consume-or-expel-window-left;
89 "Mod+W".action = expel-window-from-column; 175 "Mod+W".action = consume-or-expel-window-right;
90 176
91 "Mod+F".action = maximize-column; 177 "Mod+R".action = switch-preset-column-width;
92 "Mod+Shift+F".action = fullscreen-window; 178 "Mod+Shift+R".action = switch-preset-window-height;
179 "Mod+F".action = center-column;
180 "Mod+Shift+F".action = maximize-column;
181 "Mod+Shift+Ctrl+F".action = fullscreen-window;
93 182
94 "Mod+Space".action = switch-focus-between-floating-and-tiling; 183 "Mod+Space".action = switch-focus-between-floating-and-tiling;
95 "Mod+Shift+Space".action = toggle-window-floating; 184 "Mod+Shift+Space".action = toggle-window-floating;
@@ -103,6 +192,10 @@ in {
103 action = spawn (lib.getExe niri) "msg" "action" "power-off-monitors"; 192 action = spawn (lib.getExe niri) "msg" "action" "power-off-monitors";
104 allow-when-locked = true; 193 allow-when-locked = true;
105 }; 194 };
195 "Mod+Shift+L" = {
196 action = spawn loginctl "lock-session";
197 };
198 "Mod+Shift+E".action = quit;
106 199
107 "XF86MonBrightnessUp" = { 200 "XF86MonBrightnessUp" = {
108 action = spawn lightctl "-d" "-e4" "-n1" "up"; 201 action = spawn lightctl "-d" "-e4" "-n1" "up";
@@ -133,6 +226,8 @@ in {
133 "Mod+Shift+Semicolon".action = spawn dunstctl "close-all"; 226 "Mod+Shift+Semicolon".action = spawn dunstctl "close-all";
134 "Mod+Period".action = spawn dunstctl "context"; 227 "Mod+Period".action = spawn dunstctl "context";
135 "Mod+Comma".action = spawn dunstctl "history-pop"; 228 "Mod+Comma".action = spawn dunstctl "history-pop";
229
230 "Mod+Alt+A".action = focus-or-spawn-action "^com\.saivert\.pwvucontrol$" "pwctl" "pwvucontrol";
136 }; 231 };
137 }; 232 };
138 }; 233 };
diff --git a/accounts/gkleen@sif/niri/waybar.nix b/accounts/gkleen@sif/niri/waybar.nix
index 1a25b581..2d00c6d8 100644
--- a/accounts/gkleen@sif/niri/waybar.nix
+++ b/accounts/gkleen@sif/niri/waybar.nix
@@ -80,9 +80,7 @@
80 exec = "${lib.getExe pkgs.worktime} today"; 80 exec = "${lib.getExe pkgs.worktime} today";
81 tooltip = false; 81 tooltip = false;
82 }; 82 };
83 "niri/workspaces" = { 83 "niri/workspaces" = {};
84 all-outputs = true;
85 };
86 "niri/window" = { 84 "niri/window" = {
87 separate-outputs = true; 85 separate-outputs = true;
88 icon = true; 86 icon = true;
@@ -166,9 +164,7 @@
166 modules-center = [ "niri/window" ]; 164 modules-center = [ "niri/window" ];
167 modules-right = [ "clock" ]; 165 modules-right = [ "clock" ];
168 166
169 "niri/workspaces" = { 167 "niri/workspaces" = {};
170 all-outputs = false;
171 };
172 "niri/window" = { 168 "niri/window" = {
173 separate-outputs = true; 169 separate-outputs = true;
174 icon = true; 170 icon = true;
@@ -215,13 +211,11 @@
215 } 211 }
216 212
217 #workspaces button { 213 #workspaces button {
218 color: @grey;
219 }
220 #workspaces button.hosting-monitor {
221 color: @white; 214 color: @white;
215 padding: 2px 5px;
222 } 216 }
223 #workspaces button.visible { 217 #workspaces button.empty {
224 color: @blue; 218 color: @grey;
225 } 219 }
226 #workspaces button.active { 220 #workspaces button.active {
227 color: @green; 221 color: @green;
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix
index c8400c28..119d8cc3 100644
--- a/accounts/gkleen@sif/systemd.nix
+++ b/accounts/gkleen@sif/systemd.nix
@@ -204,20 +204,6 @@ in {
204 WatchdogSec = "2s"; 204 WatchdogSec = "2s";
205 }; 205 };
206 }; 206 };
207 polkit-gnome-authentication-agent-1 = {
208 Install = {
209 WantedBy = ["graphical-session.target"];
210 };
211 Unit = {
212 PartOf = ["graphical-session.target"];
213 Requires = ["graphical-session-pre.target"];
214 After = ["graphical-session-pre.target"];
215 };
216 Service = {
217 ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
218 Restart = "on-failure";
219 };
220 };
221 gtklock = { 207 gtklock = {
222 Unit = { 208 Unit = {
223 Requisite = ["graphical-session.target"]; 209 Requisite = ["graphical-session.target"];
diff --git a/flake.lock b/flake.lock
index ac52bba4..27a157d5 100644
--- a/flake.lock
+++ b/flake.lock
@@ -389,17 +389,19 @@
389 "inputs": { 389 "inputs": {
390 "niri-stable": "niri-stable", 390 "niri-stable": "niri-stable",
391 "niri-unstable": "niri-unstable", 391 "niri-unstable": "niri-unstable",
392 "nixpkgs": "nixpkgs_2", 392 "nixpkgs": [
393 "nixpkgs"
394 ],
393 "nixpkgs-stable": "nixpkgs-stable_2", 395 "nixpkgs-stable": "nixpkgs-stable_2",
394 "xwayland-satellite-stable": "xwayland-satellite-stable", 396 "xwayland-satellite-stable": "xwayland-satellite-stable",
395 "xwayland-satellite-unstable": "xwayland-satellite-unstable" 397 "xwayland-satellite-unstable": "xwayland-satellite-unstable"
396 }, 398 },
397 "locked": { 399 "locked": {
398 "lastModified": 1736840959, 400 "lastModified": 1736855225,
399 "narHash": "sha256-po6B6ZkwtYI1BNIm5BR+JZ0HHKKNAnB+Dlr6BXCat3U=", 401 "narHash": "sha256-2+ayH/0B37BLPJy4thO1titHIrVCoDdCtdnl0CyV8kc=",
400 "owner": "sodiboo", 402 "owner": "sodiboo",
401 "repo": "niri-flake", 403 "repo": "niri-flake",
402 "rev": "d775188e23f94b2f73e939414b808fc2b9ebad73", 404 "rev": "b013bedcff63b5cdbb9cd9841ac339361fc5cfcc",
403 "type": "github" 405 "type": "github"
404 }, 406 },
405 "original": { 407 "original": {
@@ -429,15 +431,15 @@
429 "niri-unstable": { 431 "niri-unstable": {
430 "flake": false, 432 "flake": false,
431 "locked": { 433 "locked": {
432 "lastModified": 1736836910, 434 "lastModified": 1736861309,
433 "narHash": "sha256-jpyL3/lVeqbcXVOHoSPgXgIbJ9vZtiCDMSvZL0UyCgQ=", 435 "narHash": "sha256-RSCoXyngYF+7apD5pRq6lZfRbl8vHIUVI57bbihA5Ew=",
434 "owner": "YaLTeR", 436 "owner": "gkleen",
435 "repo": "niri", 437 "repo": "niri",
436 "rev": "36076d5279f349a32814dea91ca8f4dee61d5b08", 438 "rev": "80a7ee2971b2d43622f68dcdc3233ae8365338f6",
437 "type": "github" 439 "type": "github"
438 }, 440 },
439 "original": { 441 "original": {
440 "owner": "YaLTeR", 442 "owner": "gkleen",
441 "repo": "niri", 443 "repo": "niri",
442 "type": "github" 444 "type": "github"
443 } 445 }
@@ -676,22 +678,6 @@
676 }, 678 },
677 "nixpkgs_2": { 679 "nixpkgs_2": {
678 "locked": { 680 "locked": {
679 "lastModified": 1736701207,
680 "narHash": "sha256-jG/+MvjVY7SlTakzZ2fJ5dC3V1PrKKrUEOEE30jrOKA=",
681 "owner": "NixOS",
682 "repo": "nixpkgs",
683 "rev": "ed4a395ea001367c1f13d34b1e01aa10290f67d6",
684 "type": "github"
685 },
686 "original": {
687 "owner": "NixOS",
688 "ref": "nixos-unstable",
689 "repo": "nixpkgs",
690 "type": "github"
691 }
692 },
693 "nixpkgs_3": {
694 "locked": {
695 "lastModified": 1736798957, 681 "lastModified": 1736798957,
696 "narHash": "sha256-qwpCtZhSsSNQtK4xYGzMiyEDhkNzOCz/Vfu4oL2ETsQ=", 682 "narHash": "sha256-qwpCtZhSsSNQtK4xYGzMiyEDhkNzOCz/Vfu4oL2ETsQ=",
697 "owner": "NixOS", 683 "owner": "NixOS",
@@ -706,7 +692,7 @@
706 "type": "github" 692 "type": "github"
707 } 693 }
708 }, 694 },
709 "nixpkgs_4": { 695 "nixpkgs_3": {
710 "locked": { 696 "locked": {
711 "lastModified": 1681303793, 697 "lastModified": 1681303793,
712 "narHash": "sha256-JEdQHsYuCfRL2PICHlOiH/2ue3DwoxUX7DJ6zZxZXFk=", 698 "narHash": "sha256-JEdQHsYuCfRL2PICHlOiH/2ue3DwoxUX7DJ6zZxZXFk=",
@@ -829,7 +815,7 @@
829 "flake-compat": "flake-compat_4", 815 "flake-compat": "flake-compat_4",
830 "flake-utils": "flake-utils_2", 816 "flake-utils": "flake-utils_2",
831 "gitignore": "gitignore_3", 817 "gitignore": "gitignore_3",
832 "nixpkgs": "nixpkgs_4", 818 "nixpkgs": "nixpkgs_3",
833 "nixpkgs-stable": "nixpkgs-stable_4" 819 "nixpkgs-stable": "nixpkgs-stable_4"
834 }, 820 },
835 "locked": { 821 "locked": {
@@ -887,7 +873,7 @@
887 "nix-index-database": "nix-index-database", 873 "nix-index-database": "nix-index-database",
888 "nixVirt": "nixVirt", 874 "nixVirt": "nixVirt",
889 "nixos-hardware": "nixos-hardware", 875 "nixos-hardware": "nixos-hardware",
890 "nixpkgs": "nixpkgs_3", 876 "nixpkgs": "nixpkgs_2",
891 "nixpkgs-eostre": "nixpkgs-eostre", 877 "nixpkgs-eostre": "nixpkgs-eostre",
892 "nixpkgs-pgbackrest": "nixpkgs-pgbackrest", 878 "nixpkgs-pgbackrest": "nixpkgs-pgbackrest",
893 "nixpkgs-stable": "nixpkgs-stable_3", 879 "nixpkgs-stable": "nixpkgs-stable_3",
diff --git a/flake.nix b/flake.nix
index 816fd499..47c03f23 100644
--- a/flake.nix
+++ b/flake.nix
@@ -189,6 +189,10 @@
189 owner = "sodiboo"; 189 owner = "sodiboo";
190 repo = "niri-flake"; 190 repo = "niri-flake";
191 ref = "main"; 191 ref = "main";
192 inputs = {
193 nixpkgs.follows = "nixpkgs";
194 niri-unstable.url = "github:gkleen/niri";
195 };
192 }; 196 };
193 }; 197 };
194 198
@@ -275,9 +279,10 @@
275 mkAccountModule = dir: path: accountName: 279 mkAccountModule = dir: path: accountName:
276 let 280 let
277 userName = accountUserName accountName; 281 userName = accountUserName accountName;
282 hostName = accountHostName accountName;
278 in overrideModule 283 in overrideModule
279 (import (dir + "/${path}")) 284 (import (dir + "/${path}"))
280 (inputs: inputs // { inherit userName; }) 285 (inputs: inputs // { inherit userName hostName; })
281 (outputs: { _file = dir + "/${path}"; } 286 (outputs: { _file = dir + "/${path}"; }
282 // outputs 287 // outputs
283 // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); }); 288 // { imports = [self.nixosModules.users.${userName} or ({...}: { imports = defaultUserProfiles userName; })] ++ (outputs.imports or []); });
diff --git a/hosts/sif/default.nix b/hosts/sif/default.nix
index 09d43109..6dc6f3a9 100644
--- a/hosts/sif/default.nix
+++ b/hosts/sif/default.nix
@@ -13,8 +13,7 @@ in {
13 imports = with flake.nixosModules.systemProfiles; [ 13 imports = with flake.nixosModules.systemProfiles; [
14 ./hw.nix 14 ./hw.nix
15 ./mail ./libvirt 15 ./mail ./libvirt
16 tmpfs-root bcachefs initrd-all-crypto-modules default-locale openssh rebuild-machines 16 tmpfs-root bcachefs initrd-all-crypto-modules default-locale openssh rebuild-machines niri-unstable networkmanager
17 networkmanager
18 flakeInputs.nixos-hardware.nixosModules.lenovo-thinkpad-p1 17 flakeInputs.nixos-hardware.nixosModules.lenovo-thinkpad-p1
19 flakeInputs.impermanence.nixosModules.impermanence 18 flakeInputs.impermanence.nixosModules.impermanence
20 flakeInputs.nixVirt.nixosModules.default 19 flakeInputs.nixVirt.nixosModules.default
@@ -506,7 +505,7 @@ in {
506 505
507 "10-regreet"."/var/cache/regreet/cache.toml".C.argument = toString ((pkgs.formats.toml {}).generate "cache.toml" { 506 "10-regreet"."/var/cache/regreet/cache.toml".C.argument = toString ((pkgs.formats.toml {}).generate "cache.toml" {
508 last_user = "gkleen"; 507 last_user = "gkleen";
509 user_to_last_sess.gkleen = "niri"; 508 user_to_last_sess.gkleen = "Niri";
510 }); 509 });
511 }; 510 };
512 511
diff --git a/system-profiles/core/default.nix b/system-profiles/core/default.nix
index d60507b0..b85aea4e 100644
--- a/system-profiles/core/default.nix
+++ b/system-profiles/core/default.nix
@@ -181,7 +181,7 @@ in {
181 programs.ssh.internallyManaged = mkForce true; 181 programs.ssh.internallyManaged = mkForce true;
182 } 182 }
183 ]; 183 ];
184 extraSpecialArgs = { inherit flake flakeInputs path; }; 184 extraSpecialArgs = { inherit flake flakeInputs path; hostConfig = config; };
185 }; 185 };
186 186
187 sops = mkIf hasSops { 187 sops = mkIf hasSops {
diff --git a/system-profiles/niri-unstable.nix b/system-profiles/niri-unstable.nix
new file mode 100644
index 00000000..3a8b393d
--- /dev/null
+++ b/system-profiles/niri-unstable.nix
@@ -0,0 +1,11 @@
1{ config, pkgs, lib, ... }:
2{
3 config = {
4 programs.niri.package = lib.mkDefault pkgs.niri-unstable;
5 home-manager.sharedModules = [
6 {
7 programs.niri.package = lib.mkDefault config.programs.niri.package;
8 }
9 ];
10 };
11}