about summary refs log tree commit diff
path: root/nixos/modules/virtualisation
diff options
context:
space:
mode:
authorLin Jian <me@linj.tech>2023-10-16 20:41:32 +0800
committerGitHub <noreply@github.com>2023-10-16 20:41:32 +0800
commitfbc62319f1dc3c16ed421273e29c2d1b49726700 (patch)
tree135f82786e58963713ab16243ef75d8de90e559e /nixos/modules/virtualisation
parent921c95e05dfa6c07e348ccd8e56336d1fff75394 (diff)
parentfd7daf9fc47e21bc5eaa7793fb23e0b647558e45 (diff)
Merge pull request #260291 from donovanglover/nixos-containers/optional-restart
nixos/nixos-containers: add restartIfChanged option
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r--nixos/modules/virtualisation/nixos-containers.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix
index 5df9942dbc049..aa85665af6952 100644
--- a/nixos/modules/virtualisation/nixos-containers.nix
+++ b/nixos/modules/virtualisation/nixos-containers.nix
@@ -649,6 +649,15 @@ in
               '';
             };
 
+            restartIfChanged = mkOption {
+              type = types.bool;
+              default = true;
+              description = lib.mdDoc ''
+                Whether the container should be restarted during a NixOS
+                configuration switch if its definition has changed.
+              '';
+            };
+
             timeoutStartSec = mkOption {
               type = types.str;
               default = "1min";
@@ -826,7 +835,7 @@ in
                 containerConfig.path
                 config.environment.etc."${configurationDirectoryName}/${name}.conf".source
               ];
-              restartIfChanged = true;
+              restartIfChanged = containerConfig.restartIfChanged;
             }
           )
       )) config.containers)