all repos — nixfiles @ 1c43d96277b72be0f23359ccf0a7b3c0f03bd8e8

System and user configuration, managed by nix and home-manager

linde: auto-update nixfiles & inputs before upgrade

Alan Pearce
commit

1c43d96277b72be0f23359ccf0a7b3c0f03bd8e8

parent

a9c1d37223504736d947388120427f7f70b935b1

1 file changed, 22 insertions(+), 3 deletions(-)

changed files
M system/hosts/linde.nix → system/hosts/linde.nix
@@ -129,11 +129,30 @@ dates = [ "02:30" ];
}; }; + systemd.services.update-nixfiles = { + startAt = config.system.autoUpgrade.dates; + wantedBy = [ "nixos-upgrade.service" ]; + path = with pkgs; [ + openssh + nix + gitMinimal + ]; + serviceConfig = { + Type = "oneshot"; + User = "alan"; + WorkingDirectory = "${config.users.users.alan.home}/projects/alin.ovh/nixfiles"; + }; + script = '' + git reset --hard flake.lock + git pull + nix flake update + ''; + }; system.autoUpgrade = { dates = "02:10"; randomizedDelaySec = "59 min"; allowReboot = true; - flake = "git+file://${config.services.gitolite.dataDir}/repositories/nixfiles.git?submodules=1"; + flake = "${config.systemd.services.update-nixfiles.serviceConfig.WorkingDirectory}?submodules=1"; }; services.nix-serve = {
@@ -364,10 +383,10 @@ openssh
nix git ]; - serviceConfig = rec { + serviceConfig = { Type = "oneshot"; User = "alan"; - ExecStart = "${lib.getExe pkgs.home-manager} switch --flake git://localhost/nixfiles?submodules=1#${User}@%H"; + ExecStart = "${lib.getExe pkgs.home-manager} switch --flake %h/projects/nixfiles?submodules=1#%u@%H"; }; };