nixos/filesystems: fix special file-systems for systemd-nspawn (#345899)

This commit is contained in:
Maximilian Bosch
2025-10-03 19:33:31 +00:00
committed by GitHub
8 changed files with 107 additions and 35 deletions

View File

@@ -509,13 +509,25 @@ in
boot.isContainer = mkOption {
type = types.bool;
default = false;
default = config.boot.isNspawnContainer;
defaultText = "config.boot.isNspawnContainer";
description = ''
Whether this NixOS machine is a lightweight container running
in another NixOS system.
'';
};
boot.isNspawnContainer = mkOption {
type = types.bool;
default = false;
description = ''
Whether the machine is running in an nspawn container. This
option is added because [](#opt-boot.isContainer) is heavily used
for non-nspawn environments as well, hence nspawn-specific settings
are guarded by this option.
'';
};
boot.enableContainers = mkOption {
type = types.bool;
default = config.containers != { };
@@ -558,7 +570,7 @@ in
{ inherit (host.pkgs.stdenv) hostPlatform; }
else
{ localSystem = host.pkgs.stdenv.hostPlatform; };
boot.isContainer = true;
boot.isNspawnContainer = true;
networking.hostName = mkDefault name;
networking.useDHCP = false;
assertions = [