Add some more formatters to treefmt, reformat repo
This commit is contained in:
parent
34319c95fe
commit
cc57e16c87
|
@ -1,8 +1,8 @@
|
||||||
# Email
|
# Email
|
||||||
EMAIL="e.litherlandsmith@proton.me"
|
EMAIL="e.litherlandsmith@proton.me"
|
||||||
secret-tool lookup email "$EMAIL" >/dev/null || (
|
secret-tool lookup email "$EMAIL" >/dev/null || (
|
||||||
echo "Insert pass from protonmail-bridge"
|
echo "Insert pass from protonmail-bridge"
|
||||||
secret-tool store --label="Proton Mail mbsync" email "$EMAIL"
|
secret-tool store --label="Proton Mail mbsync" email "$EMAIL"
|
||||||
)
|
)
|
||||||
|
|
||||||
EMAIL="e.litherlandsmith@icloud.com"
|
EMAIL="e.litherlandsmith@icloud.com"
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
HOSTS=("$@")
|
HOSTS=("$@")
|
||||||
# Config files
|
# Config files
|
||||||
for TARGET in ".inputrc" ".config/starship.toml"; do
|
for TARGET in ".inputrc" ".config/starship.toml"; do
|
||||||
SOURCE="$HOME/$TARGET"
|
SOURCE="$HOME/$TARGET"
|
||||||
echo "--- $SOURCE ---"
|
echo "--- $SOURCE ---"
|
||||||
TMP_TARGET=/tmp/rsync-local-config
|
TMP_TARGET=/tmp/rsync-local-config
|
||||||
TMP_SOURCE=$TMP_TARGET
|
TMP_SOURCE=$TMP_TARGET
|
||||||
NIX_SED="sed -i 's|/nix/.*/bin/||g'"
|
NIX_SED="sed -i 's|/nix/.*/bin/||g'"
|
||||||
NIX_REPLACE="$NIX_SED $TMP_TARGET"
|
NIX_REPLACE="$NIX_SED $TMP_TARGET"
|
||||||
if [[ -e $SOURCE ]]; then
|
if [[ -e $SOURCE ]]; then
|
||||||
if [[ -d $SOURCE ]]; then
|
if [[ -d $SOURCE ]]; then
|
||||||
SOURCE=$SOURCE/
|
SOURCE=$SOURCE/
|
||||||
TMP_SOURCE=$TMP_SOURCE/
|
TMP_SOURCE=$TMP_SOURCE/
|
||||||
NIX_REPLACE="fd -g '**' $TMP_TARGET -tfile -x $NIX_SED {};"
|
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
|
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
|
done
|
||||||
|
|
|
@ -1,43 +1,43 @@
|
||||||
# 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/"
|
||||||
"$HOME/Documents/org/"
|
"$HOME/Documents/org/"
|
||||||
"$HOME/Documents/library/"
|
"$HOME/Documents/library/"
|
||||||
)
|
)
|
||||||
SYNC_URLS=(
|
SYNC_URLS=(
|
||||||
"https://git.xenia.me.uk/pixelifytica/pass.git"
|
"https://git.xenia.me.uk/pixelifytica/pass.git"
|
||||||
"https://git.xenia.me.uk/pixelifytica/org.git"
|
"https://git.xenia.me.uk/pixelifytica/org.git"
|
||||||
"https://git.xenia.me.uk/pixelifytica/library.git"
|
"https://git.xenia.me.uk/pixelifytica/library.git"
|
||||||
)
|
)
|
||||||
|
|
||||||
for i in "${!SYNC_DIRS[@]}"; do
|
for i in "${!SYNC_DIRS[@]}"; do
|
||||||
DIRECTORY="${SYNC_DIRS[$i]}"
|
DIRECTORY="${SYNC_DIRS[$i]}"
|
||||||
URL="${SYNC_URLS[$i]}"
|
URL="${SYNC_URLS[$i]}"
|
||||||
echo "--- sync: $DIRECTORY ---"
|
echo "--- sync: $DIRECTORY ---"
|
||||||
if [ ! -d "$DIRECTORY" ]; then
|
if [ ! -d "$DIRECTORY" ]; then
|
||||||
git clone "$URL" "$DIRECTORY"
|
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
|
fi
|
||||||
(
|
git pull --ff --ff-only
|
||||||
cd "$DIRECTORY" || exit
|
git submodule update --remote --recursive
|
||||||
git remote set-url origin "$URL"
|
git-sync -ns
|
||||||
if [ "$(git branch --show-current)" = "main" ]; then
|
git status --porcelain
|
||||||
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
|
|
||||||
)
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Clone ~/.config/emacs/ if it doesn't exist, pull otherwise
|
# Clone ~/.config/emacs/ if it doesn't exist, pull otherwise
|
||||||
EMACS_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/emacs"
|
EMACS_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/emacs"
|
||||||
EMACS_URL="https://git.xenia.me.uk/pixelifytica/emacs.git"
|
EMACS_URL="https://git.xenia.me.uk/pixelifytica/emacs.git"
|
||||||
if [ -d "$EMACS_DIR" ]; then
|
if [ -d "$EMACS_DIR" ]; then
|
||||||
git -C "$EMACS_DIR" remote set-url origin "$EMACS_URL"
|
git -C "$EMACS_DIR" remote set-url origin "$EMACS_URL"
|
||||||
git -C "$EMACS_DIR" pull --ff --ff-only
|
git -C "$EMACS_DIR" pull --ff --ff-only
|
||||||
else
|
else
|
||||||
git clone "$EMACS_URL" "$EMACS_DIR"
|
git clone "$EMACS_URL" "$EMACS_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Cleanup legacy Emacs config file/directory
|
# Cleanup legacy Emacs config file/directory
|
||||||
|
|
|
@ -7,18 +7,18 @@ let
|
||||||
dynamicWallpaper = pkgs.writeShellScriptBin "dynamic-wallpaper" ''
|
dynamicWallpaper = pkgs.writeShellScriptBin "dynamic-wallpaper" ''
|
||||||
swww query || exit 1 # Check SWWW daemon is actually running
|
swww query || exit 1 # Check SWWW daemon is actually running
|
||||||
case $(date +%H) in
|
case $(date +%H) in
|
||||||
06 | 07 | 08) # Morning
|
06 | 07 | 08) # Morning
|
||||||
${swwwMorning}
|
${swwwMorning}
|
||||||
;;
|
;;
|
||||||
09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17) # Day
|
09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17) # Day
|
||||||
${swwwDay}
|
${swwwDay}
|
||||||
;;
|
;;
|
||||||
18 | 19 | 20) # Evening
|
18 | 19 | 20) # Evening
|
||||||
${swwwEvening}
|
${swwwEvening}
|
||||||
;;
|
;;
|
||||||
21 | 22 | 23 | 00 | 01 | 02 | 03 | 04 | 05) # Night
|
21 | 22 | 23 | 00 | 01 | 02 | 03 | 04 | 05) # Night
|
||||||
${swwwNight}
|
${swwwNight}
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
'';
|
'';
|
||||||
|
|
20
treefmt.nix
20
treefmt.nix
|
@ -1,5 +1,23 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
projectRootFile = "flake.nix";
|
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/*"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue