Move Emacs syncing from git-sync-all to separate script (esync.sh)

This commit is contained in:
Evie Litherland-Smith 2024-08-22 06:55:41 +01:00
parent 83d362bba2
commit 5192d3a07f
3 changed files with 17 additions and 16 deletions

View file

@ -2,18 +2,14 @@
{ {
home = { home = {
packages = [ packages = [
(pkgs.writeShellScriptBin "esync" (builtins.readFile ./shell/esync.sh))
(pkgs.writeShellScriptBin "git-sync-all" (builtins.readFile ./shell/git-sync-all.sh)) (pkgs.writeShellScriptBin "git-sync-all" (builtins.readFile ./shell/git-sync-all.sh))
(pkgs.writeShellScriptBin "rsync-local-config" (builtins.readFile ./shell/rsync-local-config.sh)) (pkgs.writeShellScriptBin "rsync-local-config" (builtins.readFile ./shell/rsync-local-config.sh))
(pkgs.writeShellScriptBin "xdg-query-program" (builtins.readFile ./shell/xdg-query-program.sh)) (pkgs.writeShellScriptBin "xdg-query-program" (builtins.readFile ./shell/xdg-query-program.sh))
]; ];
shellAliases = shellAliases = {
let
sync = "sudo systemctl start nixos-upgrade.service && git-sync-all";
in
{
gsa = "git-sync-all"; gsa = "git-sync-all";
sync-and-shutdown = sync + " && shutdown now"; sync-and-shutdown = "sudo systemctl start nixos-upgrade.service && git-sync-all && shutdown now";
sync-and-reboot = sync + " && reboot";
}; };
}; };
} }

12
home/scripts/shell/esync.sh Executable file
View file

@ -0,0 +1,12 @@
# Clone ~/.emacs.d/ if it doesn't exist
EMACS_DIR="$HOME/.emacs.d/"
if [ ! -d "$EMACS_DIR" ]; then
git clone "https://git.xenia.me.uk/pixelifytica/emacs.git" "$EMACS_DIR"
fi
(
cd "$EMACS_DIR" || exit 1
# Pull changes by fast-forwarding only
git pull --ff --ff-only
# Install and update extensions
make install
)

View file

@ -1,10 +1,3 @@
# Clone ~/.emacs.d/ if it doesn't exist, fast-forward pull
EMACS_DIR="$HOME/.emacs.d/"
if [ ! -d "$EMACS_DIR" ]; then
git clone "https://git.xenia.me.uk/pixelifytica/emacs.git" "$EMACS_DIR"
fi
git -C "$EMACS_DIR" pull --ff --ff-only
# Sync common directories, setting url to ensure it's up-to-date first # Sync common directories, setting url to ensure it's up-to-date first
SYNC_DIRS=( SYNC_DIRS=(
"$HOME/.password-store/" "$HOME/.password-store/"