diff --git a/system/home/scripts/shell/ensure-pass.sh b/system/home/scripts/shell/ensure-pass.sh index 8129c07c..8b5e0aa6 100644 --- a/system/home/scripts/shell/ensure-pass.sh +++ b/system/home/scripts/shell/ensure-pass.sh @@ -1,8 +1,8 @@ # Email EMAIL="e.litherlandsmith@proton.me" secret-tool lookup email "$EMAIL" >/dev/null || ( - echo "Insert pass from protonmail-bridge" - secret-tool store --label="Proton Mail mbsync" email "$EMAIL" + echo "Insert pass from protonmail-bridge" + secret-tool store --label="Proton Mail mbsync" email "$EMAIL" ) EMAIL="e.litherlandsmith@icloud.com" diff --git a/system/home/scripts/shell/rsync-local-config.sh b/system/home/scripts/shell/rsync-local-config.sh index b00bef8d..57b5ca2a 100644 --- a/system/home/scripts/shell/rsync-local-config.sh +++ b/system/home/scripts/shell/rsync-local-config.sh @@ -1,23 +1,23 @@ HOSTS=("$@") # Config files for TARGET in ".inputrc" ".config/starship.toml"; do - SOURCE="$HOME/$TARGET" - echo "--- $SOURCE ---" - TMP_TARGET=/tmp/rsync-local-config - TMP_SOURCE=$TMP_TARGET - NIX_SED="sed -i 's|/nix/.*/bin/||g'" - NIX_REPLACE="$NIX_SED $TMP_TARGET" - if [[ -e $SOURCE ]]; then - if [[ -d $SOURCE ]]; then - SOURCE=$SOURCE/ - TMP_SOURCE=$TMP_SOURCE/ - NIX_REPLACE="fd -g '**' $TMP_TARGET -tfile -x $NIX_SED {};" - fi - rsync -avzL --exclude=".git*" --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r "$SOURCE" $TMP_TARGET - sh -c "$NIX_REPLACE" - for HOST in "${HOSTS[@]}"; do - rsync -avzL --delete --exclude=".git*" $TMP_SOURCE "$HOST:$TARGET" - done - rm -rf $TMP_SOURCE + SOURCE="$HOME/$TARGET" + echo "--- $SOURCE ---" + TMP_TARGET=/tmp/rsync-local-config + TMP_SOURCE=$TMP_TARGET + NIX_SED="sed -i 's|/nix/.*/bin/||g'" + NIX_REPLACE="$NIX_SED $TMP_TARGET" + if [[ -e $SOURCE ]]; then + if [[ -d $SOURCE ]]; then + SOURCE=$SOURCE/ + TMP_SOURCE=$TMP_SOURCE/ + NIX_REPLACE="fd -g '**' $TMP_TARGET -tfile -x $NIX_SED {};" fi + rsync -avzL --exclude=".git*" --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r "$SOURCE" $TMP_TARGET + sh -c "$NIX_REPLACE" + for HOST in "${HOSTS[@]}"; do + rsync -avzL --delete --exclude=".git*" $TMP_SOURCE "$HOST:$TARGET" + done + rm -rf $TMP_SOURCE + fi done diff --git a/system/home/scripts/shell/sync-git.sh b/system/home/scripts/shell/sync-git.sh index e5916876..ee94e966 100644 --- a/system/home/scripts/shell/sync-git.sh +++ b/system/home/scripts/shell/sync-git.sh @@ -1,43 +1,43 @@ # Sync common directories, setting url to ensure it's up-to-date first SYNC_DIRS=( - "$HOME/.password-store/" - "$HOME/Documents/org/" - "$HOME/Documents/library/" + "$HOME/.password-store/" + "$HOME/Documents/org/" + "$HOME/Documents/library/" ) SYNC_URLS=( - "https://git.xenia.me.uk/pixelifytica/pass.git" - "https://git.xenia.me.uk/pixelifytica/org.git" - "https://git.xenia.me.uk/pixelifytica/library.git" + "https://git.xenia.me.uk/pixelifytica/pass.git" + "https://git.xenia.me.uk/pixelifytica/org.git" + "https://git.xenia.me.uk/pixelifytica/library.git" ) for i in "${!SYNC_DIRS[@]}"; do - DIRECTORY="${SYNC_DIRS[$i]}" - URL="${SYNC_URLS[$i]}" - echo "--- sync: $DIRECTORY ---" - if [ ! -d "$DIRECTORY" ]; then - git clone "$URL" "$DIRECTORY" + DIRECTORY="${SYNC_DIRS[$i]}" + URL="${SYNC_URLS[$i]}" + echo "--- sync: $DIRECTORY ---" + if [ ! -d "$DIRECTORY" ]; then + git clone "$URL" "$DIRECTORY" + fi + ( + cd "$DIRECTORY" || exit + git remote set-url origin "$URL" + if [ "$(git branch --show-current)" = "main" ]; then + git branch --set-upstream-to=origin/main main fi - ( - cd "$DIRECTORY" || exit - git remote set-url origin "$URL" - if [ "$(git branch --show-current)" = "main" ]; then - git branch --set-upstream-to=origin/main main - fi - git pull --ff --ff-only - git submodule update --remote --recursive - git-sync -ns - git status --porcelain - ) + git pull --ff --ff-only + git submodule update --remote --recursive + git-sync -ns + 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 + 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" + git clone "$EMACS_URL" "$EMACS_DIR" fi # Cleanup legacy Emacs config file/directory diff --git a/system/home/swww.nix b/system/home/swww.nix index b3081696..d92ed217 100644 --- a/system/home/swww.nix +++ b/system/home/swww.nix @@ -7,18 +7,18 @@ let dynamicWallpaper = pkgs.writeShellScriptBin "dynamic-wallpaper" '' swww query || exit 1 # Check SWWW daemon is actually running case $(date +%H) in - 06 | 07 | 08) # Morning - ${swwwMorning} - ;; - 09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17) # Day - ${swwwDay} - ;; - 18 | 19 | 20) # Evening - ${swwwEvening} - ;; - 21 | 22 | 23 | 00 | 01 | 02 | 03 | 04 | 05) # Night - ${swwwNight} - ;; + 06 | 07 | 08) # Morning + ${swwwMorning} + ;; + 09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17) # Day + ${swwwDay} + ;; + 18 | 19 | 20) # Evening + ${swwwEvening} + ;; + 21 | 22 | 23 | 00 | 01 | 02 | 03 | 04 | 05) # Night + ${swwwNight} + ;; esac ''; diff --git a/treefmt.nix b/treefmt.nix index 970592a6..90ba1c54 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -1,5 +1,23 @@ { ... }: { projectRootFile = "flake.nix"; - programs.nixfmt.enable = true; + programs = { + nixfmt.enable = true; + prettier.enable = true; + shfmt.enable = true; + }; + settings.global.excludes = [ + "*.png" + "*.jpg" + "*.gif" + "*.conf" + "*.toml" + "*.org" + "*.lisp" + "*.sty" + "Makefile" + "system/kanata.kbd" + "system/home/email/davmail.properties" + "system/home/email/signatures/*" + ]; }