Files
nixos-configs/modules/system/git-auto-rebuild.nix
2025-12-07 19:51:25 -08:00

16 lines
499 B
Nix

{ config, pkgs, ... }:
{
systemd.services.git-auto-rebuild = {
# enable = true;
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
description = "Rebuilds the git repo at /etc/nixos if there are changes in the currently checked out branch";
# startAt = "*:0/1";
serviceConfig = {
Type = "simple";
ExecStart = "/run/current-system/sw/bin/bash -c 'cd /etc/nixos && git pull && sudo nixos-rebuild switch --flake #$(hostname)'";
};
};
}