diff --git a/hosts/Haven/default.nix b/hosts/Haven/default.nix index e9864ac..7926ff3 100644 --- a/hosts/Haven/default.nix +++ b/hosts/Haven/default.nix @@ -120,7 +120,7 @@ in Type = "oneshot"; User = config.users.users.aires.name; }; - path = with pkgs; [ + path = with pkgs; [ # Courtesy of https://discourse.nixos.org/t/how-to-use-other-packages-binary-in-systemd-service-configuration/14363 coreutils gnutar xz.bin @@ -135,8 +135,7 @@ in git pull --recurse-submodules nix flake update git add flake.lock - git commit -m "Update flake.lock" - git push + git diff --quiet && git diff --staged --quiet || git commit -am "Update flake.lock" && git push # Courtesy of https://stackoverflow.com/a/40255467 ''; }; diff --git a/modules/base/system.nix b/modules/base/system.nix index 7ebc514..1cd21f0 100644 --- a/modules/base/system.nix +++ b/modules/base/system.nix @@ -43,10 +43,14 @@ openssh ]; script = '' - set -eu cd ${config.users.users.aires.home}/Development/nix-configuration - sudo -u aires git pull --recurse-submodules - nh os switch + # Check if there are changes from Git + sudo -u aires git fetch + sudo -u aires git diff --exit-code main origin/main + if [ $? -eq 1]; then + sudo -u aires git pull --recurse-submodules + nh os search + fi ''; }; systemd.timers."nixos-update-timer" = {