{ pkgs, user-pkgs, ... }: { systemd.services.char-dotfiles = { description = "Clone and stow charlotte's dotfiles"; wantedBy = [ "multi-user.target" ]; after = [ "network-online.target" ]; wants = [ "network-online.target" ]; serviceConfig = { Type = "oneshot"; User = "charlotte"; RemainAfterExit = true; }; path = with pkgs; [ git stow ]; script = '' set -eu cd ~ mkdir -p .config .local/libexec ln -sf ${user-pkgs.abbr-dir}/bin/abbr-dir ~/.local/libexec/abbr-dir if [ -d .dotfiles/.git ]; then git -C .dotfiles pull --ff-only --recurse-submodules else git clone --recursive https://github.com/char/dotfiles.git .dotfiles fi for pkg in zsh jj git; do [ -d ".dotfiles/$pkg" ] && stow -R -d .dotfiles -t ~ "$pkg" done ''; }; }