sync config
This commit is contained in:
@@ -10,10 +10,35 @@
|
||||
|
||||
imports = [ ./remote.nix ];
|
||||
|
||||
# TODO:
|
||||
#.config/zed/keymap.json
|
||||
#.config/zed/settings.json
|
||||
#.config/zed/themes
|
||||
#.config/zed/snippets
|
||||
systemd.user.services."update-zed-config" = {
|
||||
Unit.Description = "Autoupdate zed config";
|
||||
Service.Type = "oneshot";
|
||||
Service.ExecStart = toString (
|
||||
# TODO: do I want to clone it if missing? Requires git keys, I should clone on OnActiveSec
|
||||
pkgs.writers.writeBash "update-zed-config" { } ''
|
||||
PATH="${lib.makeBinPath [ pkgs.git ]}''${PATH:-":$PATH"}"
|
||||
if [[ -e "$HOME".config/zed/.git ]]; then
|
||||
cd "$HOME".config/zed/
|
||||
git add .
|
||||
if ! git diff --staged --exit-code --quiet; then
|
||||
git commit -m "Daily auto-commit $(date -u +%Y-%m-%dT%H:%M:%S%Z) @ $(hostname)"
|
||||
fi
|
||||
git pull --rebase --autostash
|
||||
git push
|
||||
fi
|
||||
''
|
||||
);
|
||||
};
|
||||
systemd.user.timers."update-zed-config" = {
|
||||
Unit.Description = "Autoupdate zed config";
|
||||
Install.WantedBy = [ "timers.target" ];
|
||||
# https://www.man7.org/linux/man-pages/man5/systemd.timer.5.html
|
||||
# Timer.OnBootSec = "10m";
|
||||
# Timer.OnUnitActiveSec = "24h";
|
||||
# Timer.Persistent = true; # will remember to do a thing on boot if timer was missed while off
|
||||
Timer.OnCalendar = "06:00";
|
||||
Timer.RandomizedDelaySec = "45min";
|
||||
Timer.Unit = "update-zed-config.service";
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user