Dotfiles : Enable auto-updates.
This commit is contained in:
parent
2bf9cf4dd5
commit
d550bb7363
0
.config/linux/system/module/common/AutoRebuild.nix
Normal file
0
.config/linux/system/module/common/AutoRebuild.nix
Normal file
|
@ -1,10 +1,13 @@
|
||||||
{ pkgs, inputs, lib, ... }: let
|
{ pkgs, inputs, lib, config, ... }: let
|
||||||
unit = {
|
unit = {
|
||||||
description = "Install/update dotfiles on startup.";
|
description = "Install/update dotfiles on startup.";
|
||||||
wantedBy = [ "multi-user.target" "default.target" ];
|
wantedBy = [ "multi-user.target" "default.target" ];
|
||||||
wants = [ "NetworkManager-wait-online.service" ];
|
wants = [ "NetworkManager-wait-online.service" ];
|
||||||
after = [ "NetworkManager-wait-online.service" ];
|
after = [ "NetworkManager-wait-online.service" ];
|
||||||
serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
|
path = with pkgs; [
|
||||||
|
git
|
||||||
|
];
|
||||||
script = ''
|
script = ''
|
||||||
cd ~
|
cd ~
|
||||||
test -d .git || {
|
test -d .git || {
|
||||||
|
@ -26,7 +29,7 @@
|
||||||
${lib.getExe pkgs.git} clean -f
|
${lib.getExe pkgs.git} clean -f
|
||||||
};
|
};
|
||||||
${lib.getExe pkgs.git} pull
|
${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 = {
|
timer = {
|
||||||
|
|
Reference in a new issue