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
launchpad/nixpkgs/master
David Arnold 3 years ago
parent 2af2d3146d
commit 9e42d02047
No known key found for this signature in database
GPG Key ID: AB15A6AF1101390D
  1. 1
      lib/modules.nix
  2. 9
      nixos/modules/installer/cd-dvd/installation-cd-base.nix
  3. 19
      nixos/modules/installer/cd-dvd/iso-image.nix
  4. 12
      nixos/modules/installer/netboot/netboot.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’

@ -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 $(</proc/cmdline); do

@ -614,14 +614,11 @@ in
};
};
# store them in lib so we can set the same fileSystems with a
# higher prio on installation media
# This module is often over-layed onto an existing host config
# that defines `fileSystems`. We use mkOverride 60 to override
# standard values, but at the same time leave room for mkForce
# values targeted at the image build.
# store them in lib so we can mkImageMediaOverride the
# entire file system layout in installation media (only)
config.lib.isoFileSystems = {
"/" = mkOverride 60
"/" = mkImageMediaOverride
{
fsType = "tmpfs";
options = [ "mode=0755" ];
@ -630,7 +627,7 @@ in
# Note that /dev/root is a symlink to the actual root device
# specified on the kernel command line, created in the stage 1
# init script.
"/iso" = mkOverride 60
"/iso" = mkImageMediaOverride
{ device = "/dev/root";
neededForBoot = true;
noCheck = true;
@ -638,20 +635,20 @@ in
# In stage 1, mount a tmpfs on top of /nix/store (the squashfs
# image) to make this a live CD.
"/nix/.ro-store" = mkOverride 60
"/nix/.ro-store" = mkImageMediaOverride
{ fsType = "squashfs";
device = "/iso/nix-store.squashfs";
options = [ "loop" ];
neededForBoot = true;
};
"/nix/.rw-store" = mkOverride 60
"/nix/.rw-store" = mkImageMediaOverride
{ fsType = "tmpfs";
options = [ "mode=0755" ];
neededForBoot = true;
};
"/nix/store" = mkOverride 60
"/nix/store" = mkImageMediaOverride
{ fsType = "overlay";
device = "overlay";
options = [

@ -29,31 +29,27 @@ with lib;
then []
else [ pkgs.grub2 pkgs.syslinux ]);
# This module is often over-layed onto an existing host config
# that defines `fileSystems`. We use mkOverride 60 to override
# standard values, but at the same time leave room for mkForce
# values targeted at the image build.
fileSystems."/" = mkOverride 60
fileSystems."/" = mkImageMediaOverride
{ fsType = "tmpfs";
options = [ "mode=0755" ];
};
# In stage 1, mount a tmpfs on top of /nix/store (the squashfs
# image) to make this a live CD.
fileSystems."/nix/.ro-store" = mkOverride 60
fileSystems."/nix/.ro-store" = mkImageMediaOverride
{ fsType = "squashfs";
device = "../nix-store.squashfs";
options = [ "loop" ];
neededForBoot = true;
};
fileSystems."/nix/.rw-store" = mkOverride 60
fileSystems."/nix/.rw-store" = mkImageMediaOverride
{ fsType = "tmpfs";
options = [ "mode=0755" ];
neededForBoot = true;
};
fileSystems."/nix/store" = mkOverride 60
fileSystems."/nix/store" = mkImageMediaOverride
{ fsType = "overlay";
device = "overlay";
options = [

Loading…
Cancel
Save