-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add netboot files #21
Conversation
Update: I don't think this will work correctly either, since the component derivations' outputs are also directories rather than individual files 🤦♂️ |
That's not a problem as long as the derivation emits a |
Yes, I realised this earlier. However, since A) these derivations aren't actually hydra jobs and B) the netboot files are symlinks (NixOS/hydra#580), this doesn't work yet. |
This allows testing channel mirroring locally without access to S3
Fixed! Things to note:
|
Some questions:
Aside: the ideal netboot would be to have a minimal initrd that mounts cache.nixos.org on /nix/store (via NixOS/nix@a9cbd67) and boots the system closure from there. |
After this, they should be available at https://nixos.org/channels/nixos-{18.03,unstable}/netboot.ipxe.
That makes sense, I can try doing that.
It's unable to find the root filesystem, for reasons similar to boot failures caused by incorrect USB stick creation.
These files are already built by hydra, does including them on the channel page make a big difference?
Yes and no respectively. It contains the entire nix store as a squashfs (much like the CD image), which is mounted and decompressed on the fly.
That is awesome! Orthogonal to this change, but it should allow making the initrd a bit smaller in future versions. |
ping @lheckemann |
zram and zstd might help with the size: NixOS/nixpkgs#52991 |
@Mic92 current zramSwap module isn't designed to be started in stage1. Also, if that squashfs @lheckemann mentions is already compressed, then it can't be compressed more, and thus no extra memory gain. |
This snippet by @Lassulus would download the iso in the initrd: { pkgs, lib }: let
system = import <nixpkgs/nixos/lib/eval-config.nix> {
modules = [{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-base.nix>
];
boot.initrd.network.enable = true;
boot.devSize = "500m";
boot.initrd.kernelModules = [ "e1000" ];
boot.initrd.extraUtilsCommands =''
cp ${pkgs.stdenv.cc.libc}/lib/libnss_dns.so.* $out/lib/
'';
boot.initrd.network.postCommands = ''
wget 'https://d3g5gsiof5omrk.cloudfront.net/nixos/18.09/nixos-18.09.1922.97e0d53d669/nixos-minimal-18.09.1922.97e0d53d669-x86_64-linux.iso' -O /dev/root
'';
boot.initrd.postMountCommands = ''
export stage2Init=$(awk '/APPEND/ {for(i=1;i<=NF;i++){ if($i ~ /init/){split($2,a,"="); print a[2]; exit} } }' /mnt-root/iso/isolinux/isolinux.cfg)
'';
}];
};
in pkgs.writeScript "run" ''
#!/bin/sh
${pkgs.kvm}/bin/qemu-kvm -m 2G \
-kernel ${system.config.system.build.kernel}/bzImage \
-initrd ${system.config.system.build.initialRamdisk}/initrd \
-net nic,netdev=user.0,model=e1000 -netdev user,id=user.0,hostfwd=tcp::8022-:22 \
-append "console=ttyS0 copytoram" -nographic
'' |
This pull request has been mentioned on Nix community. There might be relevant details there: https://discourse.nixos.org/t/easy-to-use-nixos-image-generators/1887/4 |
Do the images that That doesn't finish for me, even after a few minutes:
|
I just tested it inside a qemu VM, the unstable channel image works, even though the wget also does nothing for me. |
Allows adding nixos support to netboot.xyz (netbootxyz/netboot.xyz#37). NOT TESTED. Depends on NixOS/nixpkgs#43805. Fixes #6
Also fixes building the scripts on the side.
cc @fpletz @domenkozar @nshalman @matthewbauer who have expressed interest in netboot.xyz support