From f01ee2d84bd750b5fcb547d704b71a29e0abc0b4 Mon Sep 17 00:00:00 2001 From: Harivansh Rathi Date: Fri, 13 Mar 2026 12:49:57 -0400 Subject: [PATCH] applied --- .gitignore | 3 ++- config/karabiner/karabiner.json | 6 +++--- home/tmux.nix | 14 +++++++++++++- home/zsh.nix | 13 +++++++++++++ modules/macos.nix | 26 +++++++++++++++++++++++++- scripts/backup-machine.sh | 5 ++--- 6 files changed, 58 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 3f9940a..e472383 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ result .direnv - +.cache-home +private-backup/ diff --git a/config/karabiner/karabiner.json b/config/karabiner/karabiner.json index bf63001..6ac4acc 100644 --- a/config/karabiner/karabiner.json +++ b/config/karabiner/karabiner.json @@ -286,7 +286,7 @@ ] }, { - "description": "Right Command = Option+W (tmux prefix)", + "description": "Right Command = Ctrl+B (tmux prefix)", "manipulators": [ { "from": { @@ -299,9 +299,9 @@ }, "to": [ { - "key_code": "w", + "key_code": "b", "modifiers": [ - "left_option" + "left_control" ] } ], diff --git a/home/tmux.nix b/home/tmux.nix index 23de725..152845a 100644 --- a/home/tmux.nix +++ b/home/tmux.nix @@ -1,4 +1,16 @@ -{...}: { +{lib, ...}: { + home.activation.removeLegacyTmuxLink = lib.hm.dag.entryBefore ["checkLinkTargets"] '' + path="$HOME/.config/tmux/tmux.conf" + if [ -L "$path" ]; then + target="$(readlink "$path")" + case "$target" in + ../../dots/tmux/*|dots/tmux/*|"$HOME"/dots/tmux/*) + rm -f "$path" + ;; + esac + fi + ''; + programs.tmux = { enable = true; extraConfig = '' diff --git a/home/zsh.nix b/home/zsh.nix index deb9b40..98e2c4a 100644 --- a/home/zsh.nix +++ b/home/zsh.nix @@ -4,6 +4,19 @@ pkgs, ... }: { + home.activation.removeLegacyZshLinks = lib.hm.dag.entryBefore ["checkLinkTargets"] '' + for path in "$HOME/.zshenv" "$HOME/.zshrc"; do + if [ -L "$path" ]; then + target="$(readlink "$path")" + case "$target" in + dots/zsh/*|"$HOME"/dots/zsh/*) + rm -f "$path" + ;; + esac + fi + done + ''; + home.activation.ensureOhMyZshCache = lib.hm.dag.entryAfter ["writeBoundary"] '' mkdir -p "${config.xdg.cacheHome}/oh-my-zsh" ''; diff --git a/modules/macos.nix b/modules/macos.nix index 89921c8..ed6be39 100644 --- a/modules/macos.nix +++ b/modules/macos.nix @@ -1,8 +1,32 @@ -{...}: { +{ + lib, + pkgs, + ... +}: let + karabinerAgentsDir = + "${pkgs.karabiner-elements}/Library/Application Support/org.pqrs/Karabiner-Elements/" + + "Karabiner-Elements Non-Privileged Agents v2.app/Contents/Library/LaunchAgents"; +in { security.pam.services.sudo_local.touchIdAuth = true; services.karabiner-elements.enable = true; + # Karabiner-Elements 15.7.0 moved its user launch agents into the + # Non-Privileged Agents v2 bundle and renamed karabiner_grabber. + # nix-darwin's built-in module still points at the old top-level paths. + environment.userLaunchAgents."org.pqrs.karabiner.agent.karabiner_grabber.plist".enable = + lib.mkForce false; + environment.userLaunchAgents."org.pqrs.karabiner.agent.karabiner_observer.plist".enable = + lib.mkForce false; + environment.userLaunchAgents."org.pqrs.karabiner.karabiner_console_user_server.plist".enable = + lib.mkForce false; + + environment.userLaunchAgents."org.pqrs.service.agent.Karabiner-Core-Service.plist".source = "${karabinerAgentsDir}/org.pqrs.service.agent.Karabiner-Core-Service.plist"; + environment.userLaunchAgents."org.pqrs.service.agent.Karabiner-NotificationWindow.plist".source = "${karabinerAgentsDir}/org.pqrs.service.agent.Karabiner-NotificationWindow.plist"; + environment.userLaunchAgents."org.pqrs.service.agent.Karabiner-Menu.plist".source = "${karabinerAgentsDir}/org.pqrs.service.agent.Karabiner-Menu.plist"; + environment.userLaunchAgents."org.pqrs.service.agent.karabiner_console_user_server.plist".source = "${karabinerAgentsDir}/org.pqrs.service.agent.karabiner_console_user_server.plist"; + environment.userLaunchAgents."org.pqrs.service.agent.Karabiner-MultitouchExtension.plist".source = "${karabinerAgentsDir}/org.pqrs.service.agent.Karabiner-MultitouchExtension.plist"; + system.defaults = { dock.autohide = true; dock.show-recents = false; diff --git a/scripts/backup-machine.sh b/scripts/backup-machine.sh index c19b67f..2b9162e 100755 --- a/scripts/backup-machine.sh +++ b/scripts/backup-machine.sh @@ -3,7 +3,8 @@ set -euo pipefail umask 077 -backup_root="${HOME}/Backups/nix-migration" +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +backup_root="${repo_root}/private-backup" timestamp="$(date +%Y%m%d-%H%M%S)" backup_dir="${1:-${backup_root}/${timestamp}}" @@ -36,7 +37,6 @@ if command -v nix >/dev/null 2>&1; then nix --version > "${backup_dir}/manifests/nix-version.txt" 2>&1 || true fi -repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" git -C "${repo_root}" status --short > "${backup_dir}/manifests/nix-repo-status.txt" 2>&1 || true git -C "${repo_root}" rev-parse HEAD > "${backup_dir}/manifests/nix-repo-head.txt" 2>&1 || true @@ -71,7 +71,6 @@ home_paths=( ".claude.json" ".claude.json.backup" "dots" - "Documents/GitHub/nix" ) library_paths=(