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.
This commit is contained in:
Donovan Glover 2023-08-03 12:27:59 -04:00
parent 97ec5b4c08
commit fd7daf9fc4
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -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)