1
0
Fork 0

home-manger: add service+timer to update the home-manager flake.lock

This commit is contained in:
Pratham Patel 2024-02-11 16:06:05 +05:30
parent a4bd8f4432
commit c5f9f40ba5
Signed by: thefossguy
SSH Key Fingerprint: SHA256:/B3wAg7jnMEBQ2JwkebbS/eXVZANDmqRfnd9QkIhxMI
1 changed files with 38 additions and 0 deletions

View File

@ -7,4 +7,42 @@ in
home.username = "${me}";
home.homeDirectory = "/home/${me}";
targets.genericLinux.enable = true;
systemd.user = {
timers = {
"update-flake-inputs" = {
Unit = {
Description = "Flake input update timer";
};
Timer = {
OnCalendar = "*** 23:30:00";
Persistent = "true";
Unit = "update-flake-inputs.service";
};
Install = {
WantedBy = [ "timers.target" ];
};
};
};
services = {
"update-flake-inputs" = {
Unit = {
Description = "Update flake inputs for Home Manager";
Before = [ "home-manager-auto-upgrade.service" ];
};
Service = {
ExecStart = toString
(pkgs.writeShellScript "" ''
echo 'Running `nix flake update` for the Home Manager flake'
pushd $HOME/.config/home-manager
${pkgs.nix}/bin/nix flake update
popd
'');
};
Install = {
RequiredBy = [ "home-manager-auto-upgrade.service" ];
};
};
};
};
}