diff --git a/home/scripts/default.nix b/home/scripts/default.nix index aa8df729..71fd17f3 100644 --- a/home/scripts/default.nix +++ b/home/scripts/default.nix @@ -2,18 +2,14 @@ { home = { packages = [ + (pkgs.writeShellScriptBin "esync" (builtins.readFile ./shell/esync.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 "xdg-query-program" (builtins.readFile ./shell/xdg-query-program.sh)) ]; - shellAliases = - let - sync = "sudo systemctl start nixos-upgrade.service && git-sync-all"; - in - { - gsa = "git-sync-all"; - sync-and-shutdown = sync + " && shutdown now"; - sync-and-reboot = sync + " && reboot"; - }; + shellAliases = { + gsa = "git-sync-all"; + sync-and-shutdown = "sudo systemctl start nixos-upgrade.service && git-sync-all && shutdown now"; + }; }; } diff --git a/home/scripts/shell/esync.sh b/home/scripts/shell/esync.sh new file mode 100755 index 00000000..fe42cb3f --- /dev/null +++ b/home/scripts/shell/esync.sh @@ -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 +) diff --git a/home/scripts/shell/git-sync-all.sh b/home/scripts/shell/git-sync-all.sh index 3c59884f..17474583 100755 --- a/home/scripts/shell/git-sync-all.sh +++ b/home/scripts/shell/git-sync-all.sh @@ -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_DIRS=( "$HOME/.password-store/"