From fd7daf9fc47e21bc5eaa7793fb23e0b647558e45 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Thu, 3 Aug 2023 12:27:59 -0400 Subject: 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. --- nixos/modules/virtualisation/nixos-containers.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'nixos/modules/virtualisation/nixos-containers.nix') diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index 5df9942dbc0..aa85665af69 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) -- cgit 1.4.1 From 6f06066e948872527c2f17632a8ce255e5fea888 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 27 Oct 2023 11:31:23 +0300 Subject: nixos/containers: use latest stateVersion as example Hopefully this way we don't confuse people into thinking you have to set it to 21.05. --- nixos/modules/virtualisation/nixos-containers.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nixos/modules/virtualisation/nixos-containers.nix') diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index aa85665af69..6fdb177b968 100644 --- a/nixos/modules/virtualisation/nixos-containers.nix +++ b/nixos/modules/virtualisation/nixos-containers.nix @@ -754,7 +754,7 @@ in { services.postgresql.enable = true; services.postgresql.package = pkgs.postgresql_14; - system.stateVersion = "21.05"; + system.stateVersion = "${lib.trivial.release}"; }; }; } @@ -906,4 +906,6 @@ in "tun" ]; }); + + meta.buildDocsInSandbox = false; } -- cgit 1.4.1