[GH-ISSUE #37] NixOS support #19

Closed
opened 2026-02-27 14:49:59 +03:00 by kerem · 37 comments
Owner

Originally created by @globin on GitHub (Jan 17, 2016).
Original GitHub issue: https://github.com/netbootxyz/netboot.xyz/issues/37

Originally assigned to: @antonym on GitHub.

Quoting https://nixos.org/

NixOS is a Linux distribution with a unique approach to package and configuration management. Built on top of the Nix package manager, it is completely declarative, makes upgrading systems reliable, and has many other advantages.

See nixos/nixpkgs#2100 for more information and feel free to join the #nixos channel on freenode for more information and answers.

Originally created by @globin on GitHub (Jan 17, 2016). Original GitHub issue: https://github.com/netbootxyz/netboot.xyz/issues/37 Originally assigned to: @antonym on GitHub. Quoting https://nixos.org/ > NixOS is a Linux distribution with a unique approach to package and configuration management. Built on top of the Nix package manager, it is completely declarative, makes upgrading systems reliable, and has many other advantages. See nixos/nixpkgs#2100 for more information and feel free to join the #nixos channel on freenode for more information and answers.
kerem 2026-02-27 14:49:59 +03:00
Author
Owner

@domenkozar commented on GitHub (Jan 17, 2016):

ISO: https://nixos.org/releases/nixos/latest-iso-minimal-x86_64-linux

<!-- gh-comment-id:172367177 --> @domenkozar commented on GitHub (Jan 17, 2016): ISO: https://nixos.org/releases/nixos/latest-iso-minimal-x86_64-linux
Author
Owner

@antonym commented on GitHub (Jan 17, 2016):

Thanks for the request, I gave this a quick try with memdisk and ran into: http://i.imgur.com/dNV2Xru.png

You can replicate this by going into the iPXE command line and doing:

kernel http://boot.netboot.xyz/memdisk iso raw
initrd http://releases.nixos.org/nixos/15.09/nixos-15.09.919.b3bba00/nixos-minimal-15.09.919.b3bba00-x86_64-linux.iso
boot

I believe this might be a way to get it work from the syslinux pages. Ultimately the most ideal way is not to use ISOs but to pull the kernel, initramfs, and the rootfs from a official mirror.

<!-- gh-comment-id:172368384 --> @antonym commented on GitHub (Jan 17, 2016): Thanks for the request, I gave this a quick try with memdisk and ran into: http://i.imgur.com/dNV2Xru.png You can replicate this by going into the iPXE command line and doing: kernel http://boot.netboot.xyz/memdisk iso raw initrd http://releases.nixos.org/nixos/15.09/nixos-15.09.919.b3bba00/nixos-minimal-15.09.919.b3bba00-x86_64-linux.iso boot I believe [this](https://www.reversengineered.com/2016/01/07/booting-linux-isos-with-memdisk-and-ipxe/) might be a way to get it work from the syslinux pages. Ultimately the most ideal way is not to use ISOs but to pull the kernel, initramfs, and the rootfs from a official mirror.
Author
Owner

@domenkozar commented on GitHub (Jan 17, 2016):

Hmm, it's worth to also try the unstable http://nixos.org/releases/nixos/unstable/nixos-16.03pre75174.d0e3cca/nixos-minimal-16.03pre75174.d0e3cca-x86_64-linux.iso

<!-- gh-comment-id:172368547 --> @domenkozar commented on GitHub (Jan 17, 2016): Hmm, it's worth to also try the unstable http://nixos.org/releases/nixos/unstable/nixos-16.03pre75174.d0e3cca/nixos-minimal-16.03pre75174.d0e3cca-x86_64-linux.iso
Author
Owner

@domenkozar commented on GitHub (Jan 17, 2016):

Otherwise we'll have to use https://github.com/sleinen/nixos-pxe-installer

<!-- gh-comment-id:172368567 --> @domenkozar commented on GitHub (Jan 17, 2016): Otherwise we'll have to use https://github.com/sleinen/nixos-pxe-installer
Author
Owner

@antonym commented on GitHub (Jan 17, 2016):

Yeah, no luck with the unstable either.

<!-- gh-comment-id:172368812 --> @antonym commented on GitHub (Jan 17, 2016): Yeah, no luck with the unstable either.
Author
Owner

@domenkozar commented on GitHub (Jan 17, 2016):

Thanks @antonym

<!-- gh-comment-id:172368892 --> @domenkozar commented on GitHub (Jan 17, 2016): Thanks @antonym
Author
Owner

@davidak commented on GitHub (Jan 23, 2016):

That is the same error i have when booting on machines with a BIOS (unlike EFI).
https://github.com/NixOS/nixpkgs/issues/6265#issuecomment-171042344

<!-- gh-comment-id:174216503 --> @davidak commented on GitHub (Jan 23, 2016): That is the same error i have when booting on machines with a BIOS (unlike EFI). https://github.com/NixOS/nixpkgs/issues/6265#issuecomment-171042344
Author
Owner

@nshalman commented on GitHub (Apr 14, 2016):

https://github.com/NixOS/nixpkgs/issues/14538 may help.

<!-- gh-comment-id:210078482 --> @nshalman commented on GitHub (Apr 14, 2016): https://github.com/NixOS/nixpkgs/issues/14538 may help.
Author
Owner

@antonym commented on GitHub (Apr 14, 2016):

For installing from netboot.xyz, the installer ISO needs to be able to leverage memdiskfind to identify where the ISO has been loaded into RAM when it fails to load it from CD. Then we can leverage memdisk to load the ISO image and run through an install from iPXE.

https://www.reversengineered.com/2016/01/07/booting-linux-isos-with-memdisk-and-ipxe/

We don't want to worry about cracking open the image ourselves, but rather want to utilize the release ISO provided by the distribution.

<!-- gh-comment-id:210200211 --> @antonym commented on GitHub (Apr 14, 2016): For installing from netboot.xyz, the installer ISO needs to be able to leverage memdiskfind to identify where the ISO has been loaded into RAM when it fails to load it from CD. Then we can leverage memdisk to load the ISO image and run through an install from iPXE. https://www.reversengineered.com/2016/01/07/booting-linux-isos-with-memdisk-and-ipxe/ We don't want to worry about cracking open the image ourselves, but rather want to utilize the release ISO provided by the distribution.
Author
Owner

@nshalman commented on GitHub (Apr 15, 2016):

Sure, but an ISO generated that doesn't depend on being able to further find a squashfs might work better than the current ISO that does. In short, an ISO generated using the kernel and ramdisk built the way that I'm developing might have a better shot at working.

I'm glad you clarified for me that you always use an ISO. It will be up to others to decide what to do with the work that I'm doing.

<!-- gh-comment-id:210451540 --> @nshalman commented on GitHub (Apr 15, 2016): Sure, but an ISO generated that doesn't depend on being able to further find a squashfs might work better than the current ISO that does. In short, an ISO generated using the kernel and ramdisk built the way that I'm developing might have a better shot at working. I'm glad you clarified for me that you always use an ISO. It will be up to others to decide what to do with the work that I'm doing.
Author
Owner

@antonym commented on GitHub (Apr 15, 2016):

Ah, I see what you are saying, yeah, if it doesn't need to look for a squashfs and has everything it needs in the initrd, then that works as well.

<!-- gh-comment-id:210492093 --> @antonym commented on GitHub (Apr 15, 2016): Ah, I see what you are saying, yeah, if it doesn't need to look for a squashfs and has everything it needs in the initrd, then that works as well.
Author
Owner

@domenkozar commented on GitHub (Apr 29, 2016):

We've added (i)PXE support now in https://github.com/NixOS/nixpkgs/pull/14740, this should be possible.

<!-- gh-comment-id:215672299 --> @domenkozar commented on GitHub (Apr 29, 2016): We've added (i)PXE support now in https://github.com/NixOS/nixpkgs/pull/14740, this should be possible.
Author
Owner

@antonym commented on GitHub (Apr 29, 2016):

So can I expect to be able to point directly to the release ISO during the next release after the merge (https://nixos.org/releases/nixos/latest-iso-minimal-x86_64-linux) to boot via memdisk?

Or would I still be required to self host the files?

<!-- gh-comment-id:215733080 --> @antonym commented on GitHub (Apr 29, 2016): So can I expect to be able to point directly to the release ISO during the next release after the merge (https://nixos.org/releases/nixos/latest-iso-minimal-x86_64-linux) to boot via memdisk? Or would I still be required to self host the files?
Author
Owner

@antonym commented on GitHub (Apr 29, 2016):

Even better would be if I could just point to the vmlinuz and initrd of the installer kernels like I can do with Fedora today. If during the release cycle, NixOS could make those available as part of the release, it makes things a lot simpler and faster since then I can skip using memdisk to load the build.

I'm trying to avoid hosting or manipulating the release files of the distributions myself and instead relying on the projects to host the files to maintain as much trust as possible.

<!-- gh-comment-id:215744572 --> @antonym commented on GitHub (Apr 29, 2016): Even better would be if I could just point to the vmlinuz and initrd of the installer kernels like I can do with Fedora today. If during the release cycle, NixOS could make those available as part of the release, it makes things a lot simpler and faster since then I can skip using memdisk to load the build. I'm trying to avoid hosting or manipulating the release files of the distributions myself and instead relying on the projects to host the files to maintain as much trust as possible.
Author
Owner

@domenkozar commented on GitHub (Apr 29, 2016):

That would indeed be most simple and it should be completed once https://github.com/NixOS/nixos-channel-scripts/issues/6 is closed

<!-- gh-comment-id:215745568 --> @domenkozar commented on GitHub (Apr 29, 2016): That would indeed be most simple and it should be completed once https://github.com/NixOS/nixos-channel-scripts/issues/6 is closed
Author
Owner

@antonym commented on GitHub (Jun 30, 2016):

Any progress on this?

<!-- gh-comment-id:229813201 --> @antonym commented on GitHub (Jun 30, 2016): Any progress on this?
Author
Owner

@domenkozar commented on GitHub (Aug 16, 2016):

I've pushed a commit that gets us closer, see https://github.com/NixOS/nixos-channel-scripts/issues/6#issuecomment-240138999

Now we just need to modify mirroring script for channels and this should be ready.

<!-- gh-comment-id:240139766 --> @domenkozar commented on GitHub (Aug 16, 2016): I've pushed a commit that gets us closer, see https://github.com/NixOS/nixos-channel-scripts/issues/6#issuecomment-240138999 Now we just need to modify mirroring script for channels and this should be ready.
Author
Owner

@antonym commented on GitHub (Aug 16, 2016):

Nice, was able to get NixOS to boot via netboot.xyz using that latest build. Here's my initial testing branch:

github.com/antonym/netboot.xyz@9d8cca27c9

Is there a way to simplify the name of the init path? It's easier to update versions over time if the path is predictable. I wasn't sure if that was just a build server artifact or not.

<!-- gh-comment-id:240199782 --> @antonym commented on GitHub (Aug 16, 2016): Nice, was able to get NixOS to boot via netboot.xyz using that latest build. Here's my initial testing branch: https://github.com/antonym/netboot.xyz/commit/9d8cca27c9dd1e7a42d594d37658b7cd6623caac Is there a way to simplify the name of the init path? It's easier to update versions over time if the path is predictable. I wasn't sure if that was just a build server artifact or not.
Author
Owner

@domenkozar commented on GitHub (Aug 16, 2016):

@antonym use init=/nix/var/nix/profiles/system/init

<!-- gh-comment-id:240200357 --> @domenkozar commented on GitHub (Aug 16, 2016): @antonym use `init=/nix/var/nix/profiles/system/init`
Author
Owner

@antonym commented on GitHub (Aug 16, 2016):

Perfect, thanks!

<!-- gh-comment-id:240202105 --> @antonym commented on GitHub (Aug 16, 2016): Perfect, thanks!
Author
Owner

@antonym commented on GitHub (Aug 16, 2016):

@domenkozar looks like there's only a /nix/var/nix/profiles/per-user and not a system/init

<!-- gh-comment-id:240210125 --> @antonym commented on GitHub (Aug 16, 2016): @domenkozar looks like there's only a /nix/var/nix/profiles/per-user and not a system/init
Author
Owner

@domenkozar commented on GitHub (Aug 16, 2016):

Huh, that's strange, system profile should exist. Can you scan initrd of init file (mind it can be a symlink)

<!-- gh-comment-id:240210968 --> @domenkozar commented on GitHub (Aug 16, 2016): Huh, that's strange, `system` profile should exist. Can you scan initrd of `init` file (mind it can be a symlink)
Author
Owner

@bobvanderlinden commented on GitHub (Aug 16, 2016):

From what I've gathered, there isn't a clear symlink to init at the moment. At boot time (stage2) /run/current-system is linked, which will contain init, but at that time it's already too late.

/nix as a whole isn't included because squashfs only contains /nix/store/* and that is mounted at stage1. I've tried to get around this problem by creating /nix/var/nix/profiles/system in stage1, but using ln -s "${config.system.build.toplevel}" /nix/var/nix/profiles/system in there will cause a recursive loop (config.system.build.toplevel cannot be created without stage1).

Still need to investigate what the best solution for this is.

<!-- gh-comment-id:240244167 --> @bobvanderlinden commented on GitHub (Aug 16, 2016): From what I've gathered, there isn't a clear symlink to init at the moment. At boot time (stage2) `/run/current-system` is linked, which will contain `init`, but at that time it's already too late. `/nix` as a whole isn't included because squashfs only contains `/nix/store/*` and that is mounted at stage1. I've tried to get around this problem by creating `/nix/var/nix/profiles/system` in stage1, but using `ln -s "${config.system.build.toplevel}" /nix/var/nix/profiles/system` in there will cause a recursive loop (`config.system.build.toplevel` cannot be created without stage1). Still need to investigate what the best solution for this is.
Author
Owner

@domenkozar commented on GitHub (Aug 17, 2016):

We could just generate nixos.ipxe and then updating would mean copying that file. That seems the easiest here.

<!-- gh-comment-id:240377412 --> @domenkozar commented on GitHub (Aug 17, 2016): We could just generate `nixos.ipxe` and then updating would mean copying that file. That seems the easiest here.
Author
Owner

@antonym commented on GitHub (Aug 17, 2016):

What I usually do for netboot.xyz is create a menu with the options to load multiple versions if available. If there's a unique init path on each version, it complicates the menu process as I'd have to store that init path for each version. If it's more uniform, then I can make minimal changes for ongoing support as then I only have to change the location of the bzImage and initrd.

I can hardcode the unique init locations for now to get rolling but it would be nice to have a generic symlink to use in the future.

Thanks for everyones work on this so far too, appreciate it!

<!-- gh-comment-id:240492797 --> @antonym commented on GitHub (Aug 17, 2016): What I usually do for netboot.xyz is create a menu with the options to load multiple versions if available. If there's a unique init path on each version, it complicates the menu process as I'd have to store that init path for each version. If it's more uniform, then I can make minimal changes for ongoing support as then I only have to change the location of the bzImage and initrd. I can hardcode the unique init locations for now to get rolling but it would be nice to have a generic symlink to use in the future. Thanks for everyones work on this so far too, appreciate it!
Author
Owner

@bobvanderlinden commented on GitHub (Aug 17, 2016):

I'm not entirely sure what the limitations are, but a possible quickfix would be using chain http://hydra.nixos.org/something/netboot.ipxe. Each version should have its own netboot.ipxe file already. bzImage and initrd should be in the same directory as netboot.ipxe.

@domenkozar At the moment they aren't in the same 'directory'. Is there an url where they actually are? (http://hydra.nixos.org/build/38615837/download/3/netboot.ipxe and http://hydra.nixos.org/build/38603078/download/2/initrd)

<!-- gh-comment-id:240548384 --> @bobvanderlinden commented on GitHub (Aug 17, 2016): I'm not entirely sure what the limitations are, but a possible quickfix would be using `chain http://hydra.nixos.org/something/netboot.ipxe`. Each version should have its own `netboot.ipxe` file already. `bzImage` and `initrd` should be in the same directory as `netboot.ipxe`. @domenkozar At the moment they aren't in the same 'directory'. Is there an url where they actually are? (http://hydra.nixos.org/build/38615837/download/3/netboot.ipxe and http://hydra.nixos.org/build/38603078/download/2/initrd)
Author
Owner

@antonym commented on GitHub (Sep 21, 2016):

Are the network builds queued up for the next NixOS release? If not, would there be a good place to point for release candidate images? I'd like to get an initial NixOS support pushed, but I also want to make sure they are useful and not just coming off random build server releases directly.

<!-- gh-comment-id:248612107 --> @antonym commented on GitHub (Sep 21, 2016): Are the network builds queued up for the next NixOS release? If not, would there be a good place to point for release candidate images? I'd like to get an initial NixOS support pushed, but I also want to make sure they are useful and not just coming off random build server releases directly.
Author
Owner

@domenkozar commented on GitHub (Sep 21, 2016):

@bobvanderlinden init is really ${config.system.build.bootStage2}, so we need stage2 built at that time.

@antonym we need to implement https://github.com/NixOS/nixos-channel-scripts/issues/6 to copy the files into a directory. As @bobvanderlinden mentioned, best way to avoid specifying init would be for us to publish ipxe that would be chain-loaded. Does that sound good?

<!-- gh-comment-id:248615365 --> @domenkozar commented on GitHub (Sep 21, 2016): @bobvanderlinden `init` is really `${config.system.build.bootStage2}`, so we need stage2 built at that time. @antonym we need to implement https://github.com/NixOS/nixos-channel-scripts/issues/6 to copy the files into a directory. As @bobvanderlinden mentioned, best way to avoid specifying init would be for us to publish ipxe that would be chain-loaded. Does that sound good?
Author
Owner

@antonym commented on GitHub (Sep 21, 2016):

@domenkozar I guess in my use case I would need to add additional logic like urls directly to the kernels, signature checking and etc, so I probably would not be chaining the ipxe file directly.

What's typically useful for this sort of thing is having the url to the images and kernel command line consistent with the only change being usually being the version or architecture. That makes it a lot easier to maintain over time and then I just need to bump the versions in the ipxe code for that distro.

<!-- gh-comment-id:248623455 --> @antonym commented on GitHub (Sep 21, 2016): @domenkozar I guess in my use case I would need to add additional logic like urls directly to the kernels, signature checking and etc, so I probably would not be chaining the ipxe file directly. What's typically useful for this sort of thing is having the url to the images and kernel command line consistent with the only change being usually being the version or architecture. That makes it a lot easier to maintain over time and then I just need to bump the versions in the ipxe code for that distro.
Author
Owner

@antonym commented on GitHub (Jan 28, 2017):

Just curious how things are going on this end. Are we getting any closer to a release of the network builds?

<!-- gh-comment-id:275864506 --> @antonym commented on GitHub (Jan 28, 2017): Just curious how things are going on this end. Are we getting any closer to a release of the network builds?
Author
Owner

@domenkozar commented on GitHub (Jan 28, 2017):

Not much has happened since. This is mostly done, sadly I don't use this work atm and have no time to take it forward.

<!-- gh-comment-id:275864591 --> @domenkozar commented on GitHub (Jan 28, 2017): Not much has happened since. This is mostly done, sadly I don't use this work atm and have no time to take it forward.
Author
Owner

@nshalman commented on GitHub (Mar 28, 2018):

I haven't had a chance to work on NixOS related code in a while. Perhaps @grahamc has enough spare cycles to take a quick look. My sense is that if the netboot kernel and initrd were marked for hydra to publish, then URLs could be provided to netboot.xyz to use.

I think this https://github.com/NixOS/nixpkgs/pull/14740#issuecomment-215049974 from @domenkozar is the hint as to what remains to be done on the NixOS side.

I think would provide some nice visibility to NixOS when people see it in the boot menu and ask themselves "Huh, what's that?"

<!-- gh-comment-id:376885763 --> @nshalman commented on GitHub (Mar 28, 2018): I haven't had a chance to work on NixOS related code in a while. Perhaps @grahamc has enough spare cycles to take a quick look. My sense is that if the netboot kernel and initrd were marked for hydra to publish, then URLs could be provided to netboot.xyz to use. I think this https://github.com/NixOS/nixpkgs/pull/14740#issuecomment-215049974 from @domenkozar is the hint as to what remains to be done on the NixOS side. I think would provide some nice visibility to NixOS when people see it in the boot menu and ask themselves "Huh, what's that?"
Author
Owner

@grahamc commented on GitHub (Mar 28, 2018):

I can see about getting them pushed through the channel scripts, it shouldn't take too much work there.

<!-- gh-comment-id:376888411 --> @grahamc commented on GitHub (Mar 28, 2018): I can see about getting them pushed through the channel scripts, it shouldn't take too much work there.
Author
Owner

@Mic92 commented on GitHub (Jul 30, 2018):

https://github.com/NixOS/nixpkgs/pull/44089 is related to this.

<!-- gh-comment-id:408853872 --> @Mic92 commented on GitHub (Jul 30, 2018): https://github.com/NixOS/nixpkgs/pull/44089 is related to this.
Author
Owner

@Mic92 commented on GitHub (Feb 5, 2019):

@lassulus got something working! https://nixos.wiki/index.php?oldid=2984&rcid=3040
https://github.com/Lassulus/netboot.xyz/tree/nixos

<!-- gh-comment-id:460604855 --> @Mic92 commented on GitHub (Feb 5, 2019): @lassulus got something working! https://nixos.wiki/index.php?oldid=2984&rcid=3040 https://github.com/Lassulus/netboot.xyz/tree/nixos
Author
Owner

@nshalman commented on GitHub (Feb 5, 2019):

Based on my testing, the following appears to work:
chain https://hydra.nixos.org/job/nixos/release-18.09/nixos.netboot.x86_64-linux/latest/download/netboot.ipxe

Thought we might want to prefer to use
chain https://hydra.nixos.org/job/nixos/release-18.09/nixos.netboot.x86_64-linux/latest-finished/download/netboot.ipxe

<!-- gh-comment-id:460680680 --> @nshalman commented on GitHub (Feb 5, 2019): Based on my testing, the following appears to work: `chain https://hydra.nixos.org/job/nixos/release-18.09/nixos.netboot.x86_64-linux/latest/download/netboot.ipxe` Thought we might want to prefer to use `chain https://hydra.nixos.org/job/nixos/release-18.09/nixos.netboot.x86_64-linux/latest-finished/download/netboot.ipxe`
Author
Owner

@antonym commented on GitHub (Feb 6, 2019):

Merged support for NixOS so we can finally close this out!

yes

<!-- gh-comment-id:461190034 --> @antonym commented on GitHub (Feb 6, 2019): Merged support for NixOS so we can finally close this out! ![yes](https://media.giphy.com/media/pu6PQqp3OA1xu/giphy.gif)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/netboot.xyz#19
No description provided.