diff options
author | Donovan Glover <donovan@dglover.co> | 2023-08-03 12:27:59 -0400 |
---|---|---|
committer | Donovan Glover <donovan@dglover.co> | 2023-10-11 21:53:42 -0400 |
commit | fd7daf9fc47e21bc5eaa7793fb23e0b647558e45 (patch) | |
tree | e41dd648014c364bbbd982bc934c67c656ad67ea /nixos/modules/virtualisation | |
parent | 97ec5b4c089d3d6636e2292c3ecf3e24913bb0af (diff) | |
download | nixlib-fd7daf9fc47e21bc5eaa7793fb23e0b647558e45.tar nixlib-fd7daf9fc47e21bc5eaa7793fb23e0b647558e45.tar.gz nixlib-fd7daf9fc47e21bc5eaa7793fb23e0b647558e45.tar.bz2 nixlib-fd7daf9fc47e21bc5eaa7793fb23e0b647558e45.tar.lz nixlib-fd7daf9fc47e21bc5eaa7793fb23e0b647558e45.tar.xz nixlib-fd7daf9fc47e21bc5eaa7793fb23e0b647558e45.tar.zst nixlib-fd7daf9fc47e21bc5eaa7793fb23e0b647558e45.zip |
nixos/nixos-containers: add restartIfChanged option
This commit makes auto-restarting declarative containers optional. This is useful when you don't want changes to your config to automatically restart the container and thus stop any applications running inside it.
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r-- | nixos/modules/virtualisation/nixos-containers.nix | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index 5df9942dbc04..aa85665af695 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) |