summaryrefslogtreecommitdiff
path: root/modules/nixos/personal/nix.nix
diff options
context:
space:
mode:
authoraristote <quentin.aristote@irif.fr>2025-02-04 11:49:03 +0100
committeraristote <quentin.aristote@irif.fr>2025-02-04 11:49:03 +0100
commit63ec5ee74ccea235f6e89e882309b9e314f9cf8b (patch)
tree18b7ac203b9a625778f490d991979a7ff74e6517 /modules/nixos/personal/nix.nix
parent5a9a9661e9fb43a7ef4219a79c6f67e7fa9efd3f (diff)
nixos: upgrade: add checkHosts option
Diffstat (limited to 'modules/nixos/personal/nix.nix')
-rw-r--r--modules/nixos/personal/nix.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/nixos/personal/nix.nix b/modules/nixos/personal/nix.nix
index 6f68f60..0d17148 100644
--- a/modules/nixos/personal/nix.nix
+++ b/modules/nixos/personal/nix.nix
@@ -8,14 +8,16 @@
hasFlake = cfg.flake != null;
hasFlakeInputs = cfg.autoUpgrade.autoUpdateInputs != [];
checkNetwork = {
- preStart = "${pkgs.host}/bin/host 9.9.9.9 || kill -s SIGUSR1 $$"; # Check network connectivity
+ path = [pkgs.host];
+ # Check network connectivity
+ preStart = "(${lib.concatMapStringsSep " && " (host: "host ${host}") cfg.autoUpgrade.checkHosts}) || kill -s SIGUSR1 $$";
unitConfig = {
StartLimitIntervalSec = 300;
StartLimitBurst = 5;
};
serviceConfig = {
Restart = "on-abort";
- RestartSec = "30";
+ RestartSec = 30;
};
};
in {
@@ -27,6 +29,10 @@ in {
type = with lib.types; listOf str;
default = ["nixpkgs"];
};
+ checkHosts = lib.mkOption {
+ type = with lib.types; listOf str;
+ default = ["cache.nixos.org"];
+ };
};
flake = lib.mkOption {
type = with lib.types; nullOr str;