Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NixOS support #37

Closed
globin opened this issue Jan 17, 2016 · 37 comments
Closed

NixOS support #37

globin opened this issue Jan 17, 2016 · 37 comments
Assignees

Comments

@globin
Copy link

globin commented Jan 17, 2016

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.

@domenkozar
Copy link

@antonym
Copy link
Member

antonym commented 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.

@domenkozar
Copy link

@domenkozar
Copy link

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

@antonym
Copy link
Member

antonym commented Jan 17, 2016

Yeah, no luck with the unstable either.

@domenkozar
Copy link

Thanks @antonym

@davidak
Copy link

davidak commented Jan 23, 2016

That is the same error i have when booting on machines with a BIOS (unlike EFI).
NixOS/nixpkgs#6265 (comment)

@nshalman
Copy link

NixOS/nixpkgs#14538 may help.

@antonym
Copy link
Member

antonym commented 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.

@nshalman
Copy link

nshalman commented 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.

@antonym
Copy link
Member

antonym commented 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.

@domenkozar
Copy link

We've added (i)PXE support now in NixOS/nixpkgs#14740, this should be possible.

@antonym
Copy link
Member

antonym commented 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?

@antonym
Copy link
Member

antonym commented 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.

@domenkozar
Copy link

That would indeed be most simple and it should be completed once NixOS/nixos-channel-scripts#6 is closed

@antonym
Copy link
Member

antonym commented Jun 30, 2016

Any progress on this?

@domenkozar
Copy link

I've pushed a commit that gets us closer, see NixOS/nixos-channel-scripts#6 (comment)

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

@antonym antonym self-assigned this Aug 16, 2016
@antonym
Copy link
Member

antonym commented Aug 16, 2016

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

9d8cca2

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.

@domenkozar
Copy link

domenkozar commented Aug 16, 2016

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

@antonym
Copy link
Member

antonym commented Aug 16, 2016

Perfect, thanks!

@antonym
Copy link
Member

antonym commented Aug 16, 2016

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

@domenkozar
Copy link

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

@bobvanderlinden
Copy link

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.

@domenkozar
Copy link

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

@antonym
Copy link
Member

antonym commented 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!

@bobvanderlinden
Copy link

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)

@antonym
Copy link
Member

antonym commented 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.

@domenkozar
Copy link

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

@antonym we need to implement NixOS/nixos-channel-scripts#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?

@antonym
Copy link
Member

antonym commented 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.

@antonym
Copy link
Member

antonym commented Jan 28, 2017

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

@domenkozar
Copy link

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.

@nshalman
Copy link

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 NixOS/nixpkgs#14740 (comment) 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?"

@grahamc
Copy link

grahamc commented Mar 28, 2018

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

@Mic92
Copy link

Mic92 commented Jul 30, 2018

NixOS/nixpkgs#44089 is related to this.

@Mic92
Copy link

Mic92 commented Feb 5, 2019

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

@nshalman
Copy link

nshalman commented 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

@Lassulus Lassulus mentioned this issue Feb 6, 2019
@antonym
Copy link
Member

antonym commented Feb 6, 2019

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

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants