Dotfiles : Enable auto-updates.

This commit is contained in:
Dmitry Voronin 2024-03-03 19:29:54 +03:00
parent 2bf9cf4dd5
commit d550bb7363
2 changed files with 5 additions and 2 deletions

View file

@ -1,10 +1,13 @@
{ pkgs, inputs, lib, ... }: let
{ pkgs, inputs, lib, config, ... }: let
unit = {
description = "Install/update dotfiles on startup.";
wantedBy = [ "multi-user.target" "default.target" ];
wants = [ "NetworkManager-wait-online.service" ];
after = [ "NetworkManager-wait-online.service" ];
serviceConfig.Type = "oneshot";
path = with pkgs; [
git
];
script = ''
cd ~
test -d .git || {
@ -26,7 +29,7 @@
${lib.getExe pkgs.git} clean -f
};
${lib.getExe pkgs.git} pull
[[ "$UID" = "0" ]] && [[ "$HOSTNAME" != "live" ]] && nix rebuild
[[ "$UID" = "0" ]] && [[ "$HOSTNAME" != "live" ]] && ${config.system.build.nixos-rebuild}/bin/nixos-rebuild boot --flake "/root/.config/linux/system#$HOSTNAME"
'';
};
timer = {