mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 07:04:47 +00:00
symlink karabiner and add git auth
This commit is contained in:
parent
ec59278478
commit
64fa2acc76
3 changed files with 24 additions and 7 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -2,3 +2,5 @@ result
|
||||||
.direnv
|
.direnv
|
||||||
.cache-home
|
.cache-home
|
||||||
.bw-session
|
.bw-session
|
||||||
|
config/karabiner/assets/
|
||||||
|
config/karabiner/automatic_backups/
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,22 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
# Karabiner-Elements destroys symlinks (unlink + rewrite), so we cannot use
|
# Karabiner-Elements destroys file-level symlinks (unlink + rewrite), but
|
||||||
# xdg.configFile. Instead, copy the file on every activation so Karabiner
|
# directory-level symlinks survive. Point ~/.config/karabiner at the repo
|
||||||
# sees a real mutable file whose contents match our nix-managed source.
|
# directory so changes are tracked in git and Karabiner can write freely.
|
||||||
home.activation.karabinerConfig = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
home.activation.karabinerConfig = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||||
karabiner_dir="${config.home.homeDirectory}/.config/karabiner"
|
karabiner_link="${config.home.homeDirectory}/.config/karabiner"
|
||||||
mkdir -p "$karabiner_dir"
|
karabiner_src="/Users/rathi/Documents/GitHub/nix/config/karabiner"
|
||||||
cp -f "${../config/karabiner/karabiner.json}" "$karabiner_dir/karabiner.json"
|
|
||||||
chmod 600 "$karabiner_dir/karabiner.json"
|
if [ -L "$karabiner_link" ]; then
|
||||||
|
# Already a symlink - nothing to do
|
||||||
|
:
|
||||||
|
elif [ -d "$karabiner_link" ]; then
|
||||||
|
# Real directory exists - remove it, replace with symlink
|
||||||
|
rm -rf "$karabiner_link"
|
||||||
|
ln -s "$karabiner_src" "$karabiner_link"
|
||||||
|
else
|
||||||
|
ln -s "$karabiner_src" "$karabiner_link"
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,3 +160,9 @@ restore_aws_credentials
|
||||||
restore_gcloud_adc
|
restore_gcloud_adc
|
||||||
restore_plain_note 'Machine: Codex Auth' "${HOME}/.codex/auth.json" 600
|
restore_plain_note 'Machine: Codex Auth' "${HOME}/.codex/auth.json" 600
|
||||||
restore_plain_note 'Machine: Vercel Auth' "${HOME}/Library/Application Support/com.vercel.cli/auth.json" 600
|
restore_plain_note 'Machine: Vercel Auth' "${HOME}/Library/Application Support/com.vercel.cli/auth.json" 600
|
||||||
|
|
||||||
|
# GitHub CLI auth
|
||||||
|
if command -v gh >/dev/null 2>&1; then
|
||||||
|
read_note 'Machine: GitHub Token' | gh auth login --with-token
|
||||||
|
printf 'restored gh auth\n'
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue