diff --git a/system/home/scripts/default.nix b/system/home/scripts/default.nix index 16239ee7..46cfbf5f 100644 --- a/system/home/scripts/default.nix +++ b/system/home/scripts/default.nix @@ -2,7 +2,6 @@ { home.packages = [ (pkgs.writeShellScriptBin "sync-git" (builtins.readFile ./shell/sync-git.sh)) - (pkgs.writeShellScriptBin "sync-emacs" (builtins.readFile ./shell/sync-emacs.sh)) (pkgs.writeShellScriptBin "ensure-pass" (builtins.readFile ./shell/ensure-pass.sh)) (pkgs.writeShellScriptBin "clean-config" (builtins.readFile ./shell/clean-config.sh)) (pkgs.writeShellScriptBin "rsync-local-config" (builtins.readFile ./shell/rsync-local-config.sh)) diff --git a/system/home/scripts/shell/sync-emacs.sh b/system/home/scripts/shell/sync-emacs.sh deleted file mode 100644 index 056fdf0d..00000000 --- a/system/home/scripts/shell/sync-emacs.sh +++ /dev/null @@ -1,10 +0,0 @@ -# Clone ~/.config/emacs/ if it doesn't exist -EMACS_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/emacs" -if [ -d "$EMACS_DIR" ]; then - git -C "$EMACS_DIR" pull --ff --ff-only -else - git clone "https://git.xenia.me.uk/pixelifytica/emacs.git" "$EMACS_DIR" -fi -# Cleanup legacy Emacs config file/directory -[ -f "$HOME/.emacs" ] && rm "$HOME/.emacs" -[ -d "$HOME/.emacs.d" ] && rm -r "$HOME/.emacs.d" diff --git a/system/home/scripts/shell/sync-git.sh b/system/home/scripts/shell/sync-git.sh index 17474583..e5916876 100644 --- a/system/home/scripts/shell/sync-git.sh +++ b/system/home/scripts/shell/sync-git.sh @@ -29,3 +29,17 @@ for i in "${!SYNC_DIRS[@]}"; do git status --porcelain ) done + +# Clone ~/.config/emacs/ if it doesn't exist, pull otherwise +EMACS_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/emacs" +EMACS_URL="https://git.xenia.me.uk/pixelifytica/emacs.git" +if [ -d "$EMACS_DIR" ]; then + git -C "$EMACS_DIR" remote set-url origin "$EMACS_URL" + git -C "$EMACS_DIR" pull --ff --ff-only +else + git clone "$EMACS_URL" "$EMACS_DIR" +fi + +# Cleanup legacy Emacs config file/directory +[ -f "$HOME/.emacs" ] && rm "$HOME/.emacs" +[ -d "$HOME/.emacs.d" ] && rm -r "$HOME/.emacs.d" diff --git a/system/home/shell/default.nix b/system/home/shell/default.nix index d4807093..7b3ba28a 100644 --- a/system/home/shell/default.nix +++ b/system/home/shell/default.nix @@ -11,7 +11,7 @@ ./starship.nix ]; home.shellAliases = { - sync-all = "sync-emacs; sync-git; vdirsyncer sync; mbsync -a"; + sync-all = "sync-git; vdirsyncer sync; mbsync -a"; sync-and-shutdown = "sync-all && shutdown now"; protonup = "sudo wg-quick up protonvpn && sudo wg"; protondown = "sudo wg-quick down protonvpn";