summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-05-14 10:50:27 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2025-05-14 10:50:27 +0200
commit43c9825e49d25fbd2c19abcdeb8f73aee8be2a4c (patch)
treec1cc8a034395c9bb8188651f6835922b38887f32 /accounts/gkleen@sif
parent03d49aa8ec6f51c8f51bfb628e614ac537cca8e0 (diff)
downloadnixos-43c9825e49d25fbd2c19abcdeb8f73aee8be2a4c.tar
nixos-43c9825e49d25fbd2c19abcdeb8f73aee8be2a4c.tar.gz
nixos-43c9825e49d25fbd2c19abcdeb8f73aee8be2a4c.tar.bz2
nixos-43c9825e49d25fbd2c19abcdeb8f73aee8be2a4c.tar.xz
nixos-43c9825e49d25fbd2c19abcdeb8f73aee8be2a4c.zip
...
Diffstat (limited to 'accounts/gkleen@sif')
-rw-r--r--accounts/gkleen@sif/default.nix31
-rw-r--r--accounts/gkleen@sif/niri/default.nix14
-rw-r--r--accounts/gkleen@sif/niri/mako.nix54
-rw-r--r--accounts/gkleen@sif/systemd.nix32
-rw-r--r--accounts/gkleen@sif/zshrc80
5 files changed, 104 insertions, 107 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix
index b46d021e..80f03e49 100644
--- a/accounts/gkleen@sif/default.nix
+++ b/accounts/gkleen@sif/default.nix
@@ -63,7 +63,7 @@ let
63 }; 63 };
64in { 64in {
65 imports = with flake.nixosModules.userProfiles.${userName}; [ 65 imports = with flake.nixosModules.userProfiles.${userName}; [
66 mpv yt-dlp (args: import ./xcompose.nix (inputs // args)) 66 zsh tmux mpv yt-dlp (args: import ./xcompose.nix (inputs // args))
67 ]; 67 ];
68 68
69 config = { 69 config = {
@@ -77,10 +77,10 @@ in {
77 77
78 home.stateVersion = "20.09"; 78 home.stateVersion = "20.09";
79 79
80 nixpkgs.config = { 80 # nixpkgs.config = {
81 allowUnfree = true; 81 # allowUnfree = true;
82 zathura.useMupdf = false; 82 # zathura.useMupdf = false;
83 }; 83 # };
84 84
85 nix.registry = { 85 nix.registry = {
86 "flk" = { 86 "flk" = {
@@ -186,7 +186,7 @@ in {
186 gpu-api = "vulkan"; 186 gpu-api = "vulkan";
187 }; 187 };
188 188
189 zsh.initExtra = let 189 zsh.initContent = let
190 zshrc = pkgs.resholve.mkDerivation { 190 zshrc = pkgs.resholve.mkDerivation {
191 pname = "zshrc"; 191 pname = "zshrc";
192 version = "0.0.0"; 192 version = "0.0.0";
@@ -219,7 +219,6 @@ in {
219 gnutar 219 gnutar
220 cpio 220 cpio
221 magic-wormhole 221 magic-wormhole
222 quickserve
223 cfg.programs.zsh.package 222 cfg.programs.zsh.package
224 fuse 223 fuse
225 util-linux 224 util-linux
@@ -232,6 +231,7 @@ in {
232 config.systemd.package 231 config.systemd.package
233 config.programs.ssh.package 232 config.programs.ssh.package
234 gnused 233 gnused
234 miniserve
235 ]; 235 ];
236 execer = with pkgs; [ 236 execer = with pkgs; [
237 "cannot:${lib.getExe' rpm "rpm2cpio"}" 237 "cannot:${lib.getExe' rpm "rpm2cpio"}"
@@ -240,7 +240,6 @@ in {
240 "cannot:${lib.getExe cfg.programs.git.package}" 240 "cannot:${lib.getExe cfg.programs.git.package}"
241 "cannot:${lib.getExe cpio}" 241 "cannot:${lib.getExe cpio}"
242 "cannot:${lib.getExe' magic-wormhole "wormhole"}" 242 "cannot:${lib.getExe' magic-wormhole "wormhole"}"
243 "cannot:${lib.getExe quickserve}"
244 "cannot:${lib.getExe' fuse "fusermount"}" 243 "cannot:${lib.getExe' fuse "fusermount"}"
245 "cannot:${lib.getExe less}" 244 "cannot:${lib.getExe less}"
246 "cannot:${lib.getExe' config.systemd.package "systemctl"}" 245 "cannot:${lib.getExe' config.systemd.package "systemctl"}"
@@ -322,14 +321,6 @@ in {
322 "kitty_mod+m" = "detach_window ask"; 321 "kitty_mod+m" = "detach_window ask";
323 }; 322 };
324 }; 323 };
325 wpaperd = {
326 enable = true;
327 settings.default = {
328 path = "~/.wallpapers";
329 duration = "15m";
330 mode = "center";
331 };
332 };
333 fuzzel = { 324 fuzzel = {
334 enable = true; 325 enable = true;
335 settings = { 326 settings = {
@@ -360,6 +351,14 @@ in {
360 }; 351 };
361 352
362 services = { 353 services = {
354 wpaperd = {
355 enable = true;
356 settings.default = {
357 path = "~/.wallpapers";
358 duration = "15m";
359 mode = "center";
360 };
361 };
363 emacs = { 362 emacs = {
364 enable = true; 363 enable = true;
365 socketActivation.enable = true; 364 socketActivation.enable = true;
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix
index 732e3c7a..a9b4b0f8 100644
--- a/accounts/gkleen@sif/niri/default.nix
+++ b/accounts/gkleen@sif/niri/default.nix
@@ -249,7 +249,7 @@ in {
249 import os 249 import os
250 import socket 250 import socket
251 import json 251 import json
252 import sys 252 # import sys
253 from collections import defaultdict 253 from collections import defaultdict
254 from threading import Thread, Lock 254 from threading import Thread, Lock
255 from socketserver import StreamRequestHandler, ThreadingTCPServer 255 from socketserver import StreamRequestHandler, ThreadingTCPServer
@@ -275,7 +275,7 @@ in {
275 def focus_workspace(output, workspace): 275 def focus_workspace(output, workspace):
276 with history_lock: 276 with history_lock:
277 workspace_history[output] = [workspace] + [ws for ws in workspace_history[output] if ws != workspace] # noqa: E501 277 workspace_history[output] = [workspace] + [ws for ws in workspace_history[output] if ws != workspace] # noqa: E501
278 print(json.dumps(workspace_history), file=sys.stderr) 278 # print(json.dumps(workspace_history), file=sys.stderr)
279 279
280 sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) 280 sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
281 sock.connect(os.environ["NIRI_SOCKET"]) 281 sock.connect(os.environ["NIRI_SOCKET"])
@@ -743,19 +743,19 @@ in {
743 "Mod+Shift+Control+C".action = move-workspace-up; 743 "Mod+Shift+Control+C".action = move-workspace-up;
744 744
745 "Mod+ParenLeft".action = focus-workspace "comm"; 745 "Mod+ParenLeft".action = focus-workspace "comm";
746 "Mod+Shift+ParenLeft".action = move-column-to-workspace "comm"; 746 "Mod+Shift+ParenLeft".action = kdl.magic-leaf "move-column-to-workspace" "comm";
747 747
748 "Mod+ParenRight".action = focus-workspace "web"; 748 "Mod+ParenRight".action = focus-workspace "web";
749 "Mod+Shift+ParenRight".action = move-column-to-workspace "web"; 749 "Mod+Shift+ParenRight".action = kdl.magic-leaf "move-column-to-workspace" "web";
750 750
751 "Mod+BraceRight".action = focus-workspace "read"; 751 "Mod+BraceRight".action = focus-workspace "read";
752 "Mod+Shift+BraceRight".action = move-column-to-workspace "read"; 752 "Mod+Shift+BraceRight".action = kdl.magic-leaf "move-column-to-workspace" "read";
753 753
754 "Mod+BraceLeft".action = focus-workspace "mon"; 754 "Mod+BraceLeft".action = focus-workspace "mon";
755 "Mod+Shift+BraceLeft".action = move-column-to-workspace "mon"; 755 "Mod+Shift+BraceLeft".action = kdl.magic-leaf "move-column-to-workspace" "mon";
756 756
757 "Mod+Asterisk".action = focus-workspace "vid"; 757 "Mod+Asterisk".action = focus-workspace "vid";
758 "Mod+Shift+Asterisk".action = move-column-to-workspace "vid"; 758 "Mod+Shift+Asterisk".action = kdl.magic-leaf "move-column-to-workspace" "vid";
759 759
760 "Mod+Plus".action = with-unnamed-workspace-action ''{"Action":{"FocusWorkspace":{"reference":{"Id": .id}}}}''; 760 "Mod+Plus".action = with-unnamed-workspace-action ''{"Action":{"FocusWorkspace":{"reference":{"Id": .id}}}}'';
761 "Mod+Shift+Plus".action = with-unnamed-workspace-action ''{"Action":{"MoveColumnToWorkspace":{"reference":{"Id": .id}}}}''; 761 "Mod+Shift+Plus".action = with-unnamed-workspace-action ''{"Action":{"MoveColumnToWorkspace":{"reference":{"Id": .id}}}}'';
diff --git a/accounts/gkleen@sif/niri/mako.nix b/accounts/gkleen@sif/niri/mako.nix
index 2788fb82..9373dc21 100644
--- a/accounts/gkleen@sif/niri/mako.nix
+++ b/accounts/gkleen@sif/niri/mako.nix
@@ -3,37 +3,29 @@
3 config = { 3 config = {
4 services.mako = { 4 services.mako = {
5 enable = true; 5 enable = true;
6 font = "Fira Sans 10"; 6 settings = {
7 format = "<i>%s</i>\\n%b"; 7 font = "Fira Sans 10";
8 margin = "2"; 8 format = "<i>%s</i>\\n%b";
9 maxVisible = -1; 9 margin = "2";
10 backgroundColor = "#000000dd"; 10 max-visible = -1;
11 progressColor = "source #223544ff"; 11 background-color = "#000000dd";
12 width = 384; 12 progress-color = "source #223544ff";
13 extraConfig = '' 13 width = 384;
14 outer-margin=1 14 outer-margin = 1;
15 max-history=100 15 max-history = 100;
16 max-icon-size=48 16 max-icon-size = 48;
17 17 };
18 [grouped] 18 criteria = {
19 format=<b>(%g)</b> <i>%s</i>\n%b 19 grouped.format = "<b>(%g)</b> <i>%s</i>\n%b";
20 20 "urgency=low".text-color = "#999999ff";
21 [urgency=low] 21 "urgency=critical".background-color = "#900000dd";
22 text-color=#999999ff 22 "app-name=Element".group-by = "summary";
23 23 "app-name=poweralertd" = {
24 [urgency=critical] 24 ignore-timeout = true;
25 background-color=#900000dd 25 default-timeout = 2000;
26 26 };
27 [app-name=Element] 27 "mode=silent".invisible = true;
28 group-by=summary 28 };
29
30 [app-name=poweralertd]
31 ignore-timeout=1
32 default-timeout=2000
33
34 [mode=silent]
35 invisible=1
36 '';
37 package = pkgs.symlinkJoin { 29 package = pkgs.symlinkJoin {
38 name = "${pkgs.mako.name}-wrapped"; 30 name = "${pkgs.mako.name}-wrapped";
39 paths = with pkgs; [ mako ]; 31 paths = with pkgs; [ mako ];
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix
index 2237b708..90cccc58 100644
--- a/accounts/gkleen@sif/systemd.nix
+++ b/accounts/gkleen@sif/systemd.nix
@@ -242,7 +242,7 @@ in {
242 "-${lib.getExe pkgs.playerctl} -a pause" 242 "-${lib.getExe pkgs.playerctl} -a pause"
243 "-${lib.getExe (pkgs.writeShellApplication { 243 "-${lib.getExe (pkgs.writeShellApplication {
244 name = "generate-css"; 244 name = "generate-css";
245 runtimeInputs = with pkgs; [cfg.programs.wpaperd.package jq coreutils imagemagick findutils]; 245 runtimeInputs = with pkgs; [cfg.services.wpaperd.package jq coreutils imagemagick findutils];
246 text = '' 246 text = ''
247 declare -A monitors 247 declare -A monitors
248 monitors=() 248 monitors=()
@@ -333,21 +333,21 @@ in {
333 ExecStopPost = "${pkgs.coreutils}/bin/rm -rfv \"$CACHE_DIRECTORY\""; 333 ExecStopPost = "${pkgs.coreutils}/bin/rm -rfv \"$CACHE_DIRECTORY\"";
334 }; 334 };
335 }; 335 };
336 wpaperd = { 336 # wpaperd = {
337 Install = { 337 # Install = {
338 WantedBy = ["graphical-session.target"]; 338 # WantedBy = ["graphical-session.target"];
339 }; 339 # };
340 Unit = { 340 # Unit = {
341 After = [ "graphical-session.target" ]; 341 # After = [ "graphical-session.target" ];
342 PartOf = [ "graphical-session.target" ]; 342 # PartOf = [ "graphical-session.target" ];
343 }; 343 # };
344 Service = { 344 # Service = {
345 ExecStart = lib.getExe cfg.programs.wpaperd.package; 345 # ExecStart = lib.getExe cfg.services.wpaperd.package;
346 Type = "simple"; 346 # Type = "simple";
347 Restart = "always"; 347 # Restart = "always";
348 RestartSec = "2s"; 348 # RestartSec = "2s";
349 }; 349 # };
350 }; 350 # };
351 xembed-sni-proxy = { 351 xembed-sni-proxy = {
352 Unit = { 352 Unit = {
353 PartOf = lib.mkForce ["tray.target"]; 353 PartOf = lib.mkForce ["tray.target"];
diff --git a/accounts/gkleen@sif/zshrc b/accounts/gkleen@sif/zshrc
index 06f6f6f2..7645e0fc 100644
--- a/accounts/gkleen@sif/zshrc
+++ b/accounts/gkleen@sif/zshrc
@@ -6,11 +6,10 @@ dir() {
6 forceShell=false 6 forceShell=false
7 wormhole=false 7 wormhole=false
8 gitWorktree="" 8 gitWorktree=""
9 # notmuchMsg=""
10 quickserve=false
11 modifyPDF="" 9 modifyPDF=""
10 miniserve=false
12 11
13 while getopts ':t:a:d:ir:wqg:p:' arg; do 12 while getopts ':t:a:d:ir:wg:p:m' arg; do
14 case $arg in 13 case $arg in
15 "t") ;; 14 "t") ;;
16 "a") 15 "a")
@@ -26,9 +25,8 @@ dir() {
26 "r") repoUrl=${OPTARG} ;; 25 "r") repoUrl=${OPTARG} ;;
27 "w") wormhole=true ;; 26 "w") wormhole=true ;;
28 "g") gitWorktree=${OPTARG} ;; 27 "g") gitWorktree=${OPTARG} ;;
29 # "n") notmuchMsg=${OPTARG} ;;
30 "q") quickserve=true ;;
31 "p") modifyPDF=${OPTARG:a} ;; 28 "p") modifyPDF=${OPTARG:a} ;;
29 "m") miniserve=true ;;
32 *) printf "Invalid option: %s\n" $arg >&2; exit 2 ;; 30 *) printf "Invalid option: %s\n" $arg >&2; exit 2 ;;
33 esac 31 esac
34 done 32 done
@@ -52,17 +50,29 @@ dir() {
52 gitWorktree="" 50 gitWorktree=""
53 fi 51 fi
54 52
53 miniservePIDFile=""
54 if [[ ${miniserve} = "true" ]]; then
55 miniservePIDFile=$(mktemp --tmpdir --suffix=.pid)
56 fi
57
55 cleanup() 58 cleanup()
56 { 59 {
57 cd ${modifyPDF:h}
58 if [[ -n ${modifyPDF} ]]; then 60 if [[ -n ${modifyPDF} ]]; then
61 cd ${modifyPDF:h}
59 typeset -a pages 62 typeset -a pages
60 eval 'pages=(${dir}/${modifyPDF:t:r}_*.png(on))' 63 eval 'pages=(${dir}/${modifyPDF:t:r}_*.png(on))'
61 magick -verbose "$pages" ${modifyPDF} 64 magick -verbose "$pages" ${modifyPDF}
65 modifyPDF=""
66 fi
67 if [[ -n ${miniservePIDFile} ]]; then
68 kill --verbose $(cat ${miniservePIDFile}) && wait $(cat ${miniservePIDFile})
69 miniservePIDFile=""
62 fi 70 fi
63 } 71 }
64 72
65 ( 73 (
74 set -o localtraps
75 trap 'return 1' INT TERM
66 trap cleanup EXIT 76 trap cleanup EXIT
67 77
68 cd ${dir} 78 cd ${dir}
@@ -135,18 +145,18 @@ dir() {
135 [[ $wormhole = "true" ]] && wormhole receive --accept-file 145 [[ $wormhole = "true" ]] && wormhole receive --accept-file
136 146
137 147
138 if [[ $quickserve = "true" ]]; then 148 if [[ ${#@} -gt 0 ]]; then
139 quickserve --root . --upload . --show-hidden --tar gz 149 ${@}
140 fi 150 fi
141 151
152 cd $(pwd) # Needed for mounting to work
142 153
143 if [[ ${#@} -eq 0 ]] || [[ $forceShell = "true" ]]; then 154 if [[ ${miniserve} = "true" ]]; then
144 if [[ ${#@} -gt 0 ]]; then 155 miniserve --random-route --hidden --enable-tar-gz --enable-zip . &
145 ${@} 156 echo $! > "${miniservePIDFile}"
146 fi 157 fi
147
148 cd $(pwd) # Needed for mounting to work
149 158
159 if [[ ${#@} -eq 0 ]] && [[ ${miniserve} != "true" ]] || [[ $forceShell = "true" ]]; then
150 isSingleDir() { 160 isSingleDir() {
151 typeset -a contents 161 typeset -a contents
152 contents=(*(N) .*(N)) 162 contents=(*(N) .*(N))
@@ -160,10 +170,9 @@ dir() {
160 } 170 }
161 while d=$(isSingleDir); do cd ${d}; done 171 while d=$(isSingleDir); do cd ${d}; done
162 172
163
164 zsh 173 zsh
165 else 174 elif [[ ${miniserve} == "true" ]]; then
166 ${@} 175 wait $(cat "${miniservePIDFile}")
167 fi 176 fi
168 ) 177 )
169} 178}
@@ -171,27 +180,30 @@ dir() {
171tmpdir() { 180tmpdir() {
172 cleanup() 181 cleanup()
173 { 182 {
174 cd / 183 cd /
175 unmount() { 184 unmount() {
176 printf "Unmounting %s\n" ${1} >&2 185 printf "Unmounting %s\n" ${1} >&2
177 fusermount -u ${1} || umount ${1} || sudo umount ${1} 186 fusermount -u ${1} || umount ${1} || sudo umount ${1}
178 } 187 }
179 188
180 if mountpoint -q -- ${dir}; then 189 if [[ -n ${dir} ]]; then
181 unmount ${dir} || return $? 190 if mountpoint -q -- ${dir}; then
182 else 191 unmount ${dir} || return $?
183 while read -d $'\0' subDir; do 192 else
184 mountpoint -q -- ${subDir} || continue 193 while read -d $'\0' subDir; do
185 unmount ${subDir} || return $? 194 mountpoint -q -- ${subDir} || continue
186 done <<<$(find ${dir} -xdev -type d -print0 | sort -zr) 195 unmount ${subDir} || return $?
187 fi 196 done <<<$(find ${dir} -xdev -type d -print0 | sort -zr)
188 197 fi
189 rm -rfv --one-file-system -- ${dir} 198
199 rm -rfv --one-file-system -- ${dir}
200 dir=""
201 fi
190 } 202 }
191 203
192 local tmpdir="" 204 local tmpdir=""
193 205
194 while getopts ':t:a:s:Sd:ir:wqg:p:' arg; do 206 while getopts ':t:a:d:ir:wg:p:m' arg; do
195 case $arg in 207 case $arg in
196 "t") tmpdir="=${OPTARG}" ;; 208 "t") tmpdir="=${OPTARG}" ;;
197 "?"|":") printf "Invalid option: %s\n" $arg >&2; exit 2 ;; 209 "?"|":") printf "Invalid option: %s\n" $arg >&2; exit 2 ;;
@@ -199,6 +211,8 @@ tmpdir() {
199 done 211 done
200 212
201 ( 213 (
214 set -o localtraps
215 trap 'return 1' INT TERM
202 trap cleanup EXIT 216 trap cleanup EXIT
203 217
204 218
@@ -247,14 +261,6 @@ l() {
247 ls --long --binary --git --time-style=iso --header $@ 261 ls --long --binary --git --time-style=iso --header $@
248} 262}
249 263
250re() {
251 systemctl restart $@
252}
253
254ure() {
255 systemctl --user restart $@
256}
257
258ssh-installer() { 264ssh-installer() {
259 ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentityFile=~/.ssh/gkleen@sif.midgard.yggdrasil $@ 265 ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentityFile=~/.ssh/gkleen@sif.midgard.yggdrasil $@
260} 266}