From c2d4e8f4cb3e2394cc31a949426ccd38f0056339 Mon Sep 17 00:00:00 2001 From: Kevin Boulain Date: Sun, 9 Mar 2025 10:41:42 +0100 Subject: [PATCH] nixos/nixos-containers: user options take precedence over module ones I think this is the norm in NixOS modules. This allows to start a container with '--volatile=overlay --link-journal=host' in order to persist logs across runs of a container running with a temporary root. While '--ephemeral' omits '--link-journal=try-guest', it's not possible to run an ephemeral container when linking the journal: https://github.com/systemd/systemd/issues/1666 --- nixos/modules/virtualisation/nixos-containers.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index 9e999e479638..acb5d1ce8384 100644 --- a/nixos/modules/virtualisation/nixos-containers.nix +++ b/nixos/modules/virtualisation/nixos-containers.nix @@ -178,7 +178,6 @@ let exec ${config.systemd.package}/bin/systemd-nspawn \ --keep-unit \ -M "$INSTANCE" -D "$root" "''${extraFlags[@]}" \ - $EXTRA_NSPAWN_FLAGS \ --notify-ready=yes \ --kill-signal=SIGRTMIN+3 \ --bind-ro=/nix/store:/nix/store$NIX_BIND_OPT \ @@ -203,6 +202,7 @@ let ${optionalString (cfg.tmpfs != null && cfg.tmpfs != []) ''--tmpfs=${concatStringsSep " --tmpfs=" cfg.tmpfs}'' } \ + $EXTRA_NSPAWN_FLAGS \ ${containerInit cfg} "''${SYSTEM_PATH:-/nix/var/nix/profiles/system}/init" '';