NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.88k stars 13.95k forks source link

Provide pxe boot artifacts #191222

Open duhruh opened 2 years ago

duhruh commented 2 years ago

I'm attempting to install nixos via pxe boot along with other automation and though this is a great project I think it's missing 2 critical components to make this process easy.

  1. providing the bzImage/initrd/ipxe/etc artifacts
    • I found https://nixos.wiki/wiki/Netboot but having to manually maintain/build these every time I would want to update is a pain, providing them as build artifacts along side the ISO's you already provide would really alleviate this burden.
  2. Having some sort of cloud init boot hook
    • When attempting to automate the network booting and automate the install process, having to find a way to hook into the boot stages to partition and mount the drives is a hassle, cloud init solves this part pretty well but from what i can tell goes outside of the nix way of doing things.

Describe the solution you'd like Having some sort of boot command hook that points to a config file that could partition/mount/and install the os would be great, possibly in the nix configuration syntax.

also adding the ability to pass a device to nixos-install something like nixos-install -d /dev/sda1 and having that format, mount, run nixos-generate, and install would be nice to shorten the whole process.

Additional context I should emphasize that I am no expert here, and have no idea what i'm doing. So there are probably some boot options or workarounds I missed here. This is mainly me trying to interpret the nixos manual and get that working with https://matchbox.psdn.io/ on my own homelab (yes i'm one of those crazy people)

cole-h commented 2 years ago

Have you seen / looked at https://github.com/DeterminateSystems/nix-netboot-serve? I've used it in conjunction with Hydra to make multiple classes of machines bootable via netboot from that same Hydra instance.