summary refs log tree commit diff
path: root/nixos/modules/virtualisation/lxd.nix
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2021-02-28 14:02:42 +0100
committerrnhmjoj <rnhmjoj@inventati.org>2021-02-28 14:02:56 +0100
commitb9dc818bd55ef4314da10d09297d7f51f0d3e6a9 (patch)
treed3324f1e5f2e3df3c6503f7ccdac8d4f925126bb /nixos/modules/virtualisation/lxd.nix
parent4adcb0064200facdee1109a0296905717d046b3e (diff)
downloadnixpkgs-b9dc818bd55ef4314da10d09297d7f51f0d3e6a9.tar
nixpkgs-b9dc818bd55ef4314da10d09297d7f51f0d3e6a9.tar.gz
nixpkgs-b9dc818bd55ef4314da10d09297d7f51f0d3e6a9.tar.bz2
nixpkgs-b9dc818bd55ef4314da10d09297d7f51f0d3e6a9.tar.lz
nixpkgs-b9dc818bd55ef4314da10d09297d7f51f0d3e6a9.tar.xz
nixpkgs-b9dc818bd55ef4314da10d09297d7f51f0d3e6a9.tar.zst
nixpkgs-b9dc818bd55ef4314da10d09297d7f51f0d3e6a9.zip
nixos/lxd: make start timeout configurable
Diffstat (limited to 'nixos/modules/virtualisation/lxd.nix')
-rw-r--r--nixos/modules/virtualisation/lxd.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/nixos/modules/virtualisation/lxd.nix b/nixos/modules/virtualisation/lxd.nix
index d7e94cc3b39..d686cb503d8 100644
--- a/nixos/modules/virtualisation/lxd.nix
+++ b/nixos/modules/virtualisation/lxd.nix
@@ -74,6 +74,17 @@ in {
           for details.
         '';
       };
+
+      startTimeout = mkOption {
+        type = types.int;
+        default = 600;
+        apply = toString;
+        description = ''
+          Time to wait (in seconds) for LXD to become ready to process requests.
+          If LXD does not reply within the configured time, lxd.service will be
+          considered failed and systemd will attempt to restart it.
+        '';
+      };
     };
   };
 
@@ -120,7 +131,7 @@ in {
 
       serviceConfig = {
         ExecStart = "@${cfg.package}/bin/lxd lxd --group lxd";
-        ExecStartPost = "${cfg.package}/bin/lxd waitready --timeout=600";
+        ExecStartPost = "${cfg.package}/bin/lxd waitready --timeout=${cfg.startTimeout}";
         ExecStop = "${cfg.package}/bin/lxd shutdown";
 
         KillMode = "process"; # when stopping, leave the containers alone
@@ -130,7 +141,7 @@ in {
         TasksMax = "infinity";
 
         Restart = "on-failure";
-        TimeoutStartSec = "600s";
+        TimeoutStartSec = "${cfg.startTimeout}s";
         TimeoutStopSec = "30s";
 
         # By default, `lxd` loads configuration files from hard-coded