nixos/system/home/scripts/shell/rsync-local-config.sh
Evie Litherland-Smith 5ff572a9b7 Major rewrite/refactor to simplify things
Move home/ directory under system/ directory. Remove duplicated
machine-specific config files, now handled as one per host (excluding
hardware-configuration directory)

Move as much configuration as possible out of flake.nix and into more
appropriate files (e.g. system/default.nix)

Add a desktop.nix and laptop.nix for system, both will import
home/desktop.nix and home/laptop.nix respectively to reduce
duplication in machine-specific config files

Remove games and streaming directories, moved directly into Vanguard
config file

Remove home/personal.nix since it ended up being empty after changes

Remove old sway config since I haven't been maintaining it and this
refactor will definitely break it
2024-08-30 12:57:02 +01:00

34 lines
1.5 KiB
Bash
Executable file

HOSTS=("$@")
# Config files
for TARGET in ".inputrc" ".config/bat/" ".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
fi
done
# Fonts
IOSEVKA_FLAKE_URL="git+https://git.xenia.me.uk/pixelifytica/iosevka.git?ref=main"
IOSEVKA_CUSTOM_NERDFONT=$(nix path-info "$IOSEVKA_FLAKE_URL#packages.x86_64-linux.iosevka-custom-nerdfont")
IOSEVKA_CUSTOM_AILE=$(nix path-info "$IOSEVKA_FLAKE_URL#packages.x86_64-linux.iosevka-custom-aile")
echo "--- Fonts ---"
for HOST in "${HOSTS[@]}"; do
rsync -avzL --delete --exclude=".git*" --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r "$IOSEVKA_CUSTOM_NERDFONT/share/fonts/truetype/" "$HOST:.fonts/IosevkaCustomNerdFont"
rsync -avzL --delete --exclude=".git*" --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r "$IOSEVKA_CUSTOM_AILE/share/fonts/truetype/" "$HOST:.fonts/IosevkaCustomAile"
done