{ config, lib, pkgs, ... }: { systemd.user.services.stowinit = { enable = true; after = [ "network.target" ]; wantedBy = [ "default.target" ]; description = "apply stow configurations and pull dotfiles."; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; }; script = '' export installdir="$HOME/dots" export repo="https://codeberg.org/nico/dots" if [ ! -d "$installdir" ]; then echo "cloning repo" ${pkgs.git}/bin/git clone $repo $installdir else echo "pulling latest dotfiles" pushd $installdir ${pkgs.git}/bin/git pull $repo # works if repo is cloned using ssh popd fi ${pkgs.stow}/bin/stow --target=$HOME --dir=$installdir stow echo "stowed configuration!" ''; }; }