I prepared a boot partition and a root partition on a new drive, and installed NixOS from another running NixOS using nixos-install --root /mnt
. It boots fine but running e.g. nixos-rebuild
results in errors about missing boot partition
➜ ~ sudo nixos-rebuild switch
building Nix...
building the system configuration...
this derivation will be built:
/nix/store/fi0z5rs7njgrx1l6hzmji6jdsryf1ng0-nixos-system-leon-nixos-24.05.4169.797f7dc49e0b.drv
building '/nix/store/fi0z5rs7njgrx1l6hzmji6jdsryf1ng0-nixos-system-leon-nixos-24.05.4169.797f7dc49e0b.drv'...
efiSysMountPoint = '/boot' is not a mounted partition. Is the path configured correctly?
Traceback (most recent call last):
File "/nix/store/lpr9a49mfalfir0za242x57377n2yfzq-17nyliyy0k59a6ky037y6fj902f1s2w5-systemd-boot", line 397, in <module>
main()
File "/nix/store/lpr9a49mfalfir0za242x57377n2yfzq-17nyliyy0k59a6ky037y6fj902f1s2w5-systemd-boot", line 377, in main
subprocess.check_call(CHECK_MOUNTPOINTS)
File "/nix/store/3wb0055984n2whn449hywsl4ag9gcjir-python3-3.11.9/lib/python3.11/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/nix/store/za0y24r2l67222kyz8hi2nzi9qpavmav-check-mountpoints' returned non-zero exit status 1.
warning: error(s) occurred while switching to the new configuration
Indeed the partition is not mounted. When I run sudo mount /dev/disk/by/uuid/<uuid> /boot
, above command succeeds. Why does this happen? This is my hardware-configuration:
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "uas" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/38e72c62-f8b8-40ac-8586-d16d172b1854";
fsType = "ext4";
};
swapDevices = [];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}