From 9e42d02047fe1153555f8c81039cb48135311e6d Mon Sep 17 00:00:00 2001 From: David Arnold Date: Tue, 3 Aug 2021 17:12:03 -0500 Subject: [PATCH] lib/modules: add mkImageMediaOverride so the underlaying use case of the preceding commit is so generic, that we gain a lot in reasoning to give it an appropriate name. As the comment states: image media needs to override host config short of mkForce --- lib/modules.nix | 1 + .../installer/cd-dvd/installation-cd-base.nix | 9 ++++----- nixos/modules/installer/cd-dvd/iso-image.nix | 19 ++++++++----------- nixos/modules/installer/netboot/netboot.nix | 12 ++++-------- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index ab2bc4f7f8e..b124ea000a2 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -710,6 +710,7 @@ rec { mkOptionDefault = mkOverride 1500; # priority of option defaults mkDefault = mkOverride 1000; # used in config sections of non-user modules to set a default + mkImageMediaOverride = mkOverride 60; # image media profiles can be derived by inclusion into host config, hence needing to override host config, but do allow user to mkForce mkForce = mkOverride 50; mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’ diff --git a/nixos/modules/installer/cd-dvd/installation-cd-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-base.nix index ec837b432ce..618057618d0 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-base.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-base.nix @@ -30,11 +30,10 @@ with lib; # Add Memtest86+ to the CD. boot.loader.grub.memtest86.enable = true; - # On a fresh machine, before formatting, an installation - # media cannot assume an existing file system layout such - # as might be defined by the encapsulated host config. - swapDevices = mkOverride 60 [ ]; - fileSystems = mkOverride 60 config.lib.isoFileSystems; + # An installation media cannot tolerate a host config defined file + # system layout on a fresh machine, before it has been formatted. + swapDevices = mkImageMediaOverride [ ]; + fileSystems = mkImageMediaOverride config.lib.isoFileSystems; boot.postBootCommands = '' for o in $(