How to boot without Initrd

Hey all,

I want to boot NixOS without an initrd, using systemd-boot. Since NixOS expects an initrd, I cannot configure this via configuration.nix.

I want to set this tor the kernel command line:

root=UUID=<root_uuid> resume=UUID=<swap_uuid> noinitrd

How can I boot NixOS without an initrd?

Setup:

  • Bootloader: systemd-boot
  • Root: BTRFS (no RAID, no encryption)
  • Swap: Dedicated partition (for hibernation)
  • Kernel: Self-compiled (includes BTRFS and needed drivers)

I don’t think NixOS is built with this in mind. There is a boot.initrd.enable option that you can set to false, but I suspect other things like the boot loader script will explode. You will probably need to make changes to nixpkgs and submit them in PRs (which, as the primary initrd maintainer, I think would be reasonable to accept).

I do have to wonder why you want this though?

1 Like

There’s an option to disable it, boot.initrd.enable. I’ve never tried it, though.

Yes, setting the option to false fails the rebuild.

I have been doing it like this on other distros. It is just personal preference.

I might look into a potential fix in March.

2 Likes