From 2af2d3146d79866ae65ca1883527daa010669b07 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Tue, 3 Aug 2021 14:36:07 -0500 Subject: [PATCH] nixos/boot-media: soft-force entire fs layout https://github.com/NixOS/nixpkgs/pull/131760 was made to avo a speicific configuration conflict that errored out for multiple definitions of "/" when the installer where overlayed on any existing host configuration. --- Problem 1: It turns out that in also other mountpoints can coflict. Solution 1: use `mkOverride 60` for all mountpoints (even for the ones unlikely causing confilct for consistency sake) --- Problem 2: It turns out that on an installation media for a fresh machine (before formatting), we usually don't have any devices yet formatted. However defining for example `fileSystems..device = "/dev/disk/by-label/...", in newer versions of nixos, seems to make the system startup fail. Similarily waiting for a non-existent swap device does not make the startup fail, but has a 1:30 min timeout. Solution 2: For an installation medium, soft-override ("unless users know what they are doing") the entire `fileSystems` and `swapDevices` definitions. --- .../installer/cd-dvd/installation-cd-base.nix | 6 ++ nixos/modules/installer/cd-dvd/iso-image.nix | 101 +++++++++--------- nixos/modules/installer/netboot/netboot.nix | 18 ++-- 3 files changed, 68 insertions(+), 57 deletions(-) diff --git a/nixos/modules/installer/cd-dvd/installation-cd-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-base.nix index aecb65b8c576..ec837b432ce4 100644 --- a/nixos/modules/installer/cd-dvd/installation-cd-base.nix +++ b/nixos/modules/installer/cd-dvd/installation-cd-base.nix @@ -30,6 +30,12 @@ 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; + boot.postBootCommands = '' for o in $(