diff --git a/home/default.nix b/home/default.nix index f9ea6b31..10dd5a38 100644 --- a/home/default.nix +++ b/home/default.nix @@ -210,11 +210,22 @@ } rsync-local-config () { HOST=$1 - for TARGET in starship.toml; do + for TARGET in bat git starship.toml; do SOURCE="${config.xdg.configHome}/$TARGET" + TMP_TARGET=/tmp/config-$TARGET + TMP_SOURCE=$TMP_TARGET + NIX_SED="${pkgs.gnused}/bin/sed -i 's|/nix/.*/bin/||g'" + NIX_REPLACE="$NIX_SED $TMP_TARGET" if [[ -e ${config.xdg.configHome}/$TARGET ]]; then - [[ -d $SOURCE ]] && SOURCE="$SOURCE/" - ${pkgs.rsync}/bin/rsync -avzL $SOURCE $HOST:.config/$TARGET + if [[ -d $SOURCE ]]; then + SOURCE=$SOURCE/ + TMP_SOURCE=$TMP_SOURCE/ + NIX_REPLACE="${pkgs.fd}/bin/fd -g '**' $TMP_TARGET -tfile -x $NIX_SED {};" + fi + ${pkgs.rsync}/bin/rsync -avzL $SOURCE /tmp/config-$TARGET + ${pkgs.bash}/bin/sh -c "$NIX_REPLACE" + ${pkgs.rsync}/bin/rsync -avzL $TMP_SOURCE $HOST:.config/$TARGET + ${pkgs.coreutils}/bin/rm -rf $TMP_SOURCE fi done }