-
-
Notifications
You must be signed in to change notification settings - Fork 102
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 Hyperv support #36
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I just have one comment, other than that it looks good to go.
scripts/install.sh
Outdated
@@ -25,6 +25,7 @@ nixos-generate-config --root /mnt | |||
curl -f "$packer_http/vagrant.nix" > /mnt/etc/nixos/vagrant.nix | |||
curl -f "$packer_http/vagrant-hostname.nix" > /mnt/etc/nixos/vagrant-hostname.nix | |||
curl -f "$packer_http/vagrant-network.nix" > /mnt/etc/nixos/vagrant-network.nix | |||
curl -f "$packer_http/custom-configuration.nix" > /mnt/etc/nixos/custom-configuration.nix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to only include the target guest config. I don't know how much hyperv support adds to the closure size?
Eg: curl -f "$packer_http/guest/$packet_target.nix" > /mnt/etc/nixos/guest.nix
($packet_target
is probably wrong but you get the idea)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am surprised. I would believe virtualisation.hypervGuest.enable = false;
would do nothing ? The idea was to remove this specific configuration out of configuration.nix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't look at the code close enough. Now I see the sed
commands.
I still think that it would be best to have one file per virtualization technology as the "sed" clauses will be quite fragile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I introduced the mechanism in #37 to make it easier for you
@PierreR mind rebasing on top of master? |
Yep I will do that asap. By the way I was also wondering how to keep in sync the iso_url value from https://github.com/nix-community/nixbox/blob/master/nixos-x86_64.json#L18 ? |
It looks like you really need to create an network adapter (here named "Devbox")
This is handy to configure locale, hypervisor or any other organisation specific configuration.
"echo http://{{.HTTPIP}}:{{.HTTPPort}} > .packer_http<enter>", | ||
"mkdir -m 0700 .ssh<enter>", | ||
"curl $(cat .packer_http)/install_rsa.pub > .ssh/authorized_keys<enter><wait>", | ||
"nixos-rebuild switch<enter><wait>", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this line necessary? It's not used for the other targets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remove that line and tested ... It is actually needed because nixos has to be rebuild with virtualisation.hypervGuest.enable = true;
otherwise windows never gets the IP back from the guest and the ssh callback will never fire. That means that I need the sed
call after all ...
In other words, I need to rebuild the nixos guest with hypervGuest enable to have a chance to get the provisioned install script to kick in. Can you think of another way to make this work ?
For your information, even when the hyperv packer images succeeded, I have never managed to get it work with vagrant. For some reason the X server will fail to start up ...
At the end, hyperv
has been a gigantic piece of wasted time on my side :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, sorry to hear that. I think the best way would be to change the generation of images to be Nix-driven instead of Packer-driven. But that will take some more work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The least effort would to cave in and install VirtualBox I'm afraid. I also think that Vagrant mainly works well with VirtualBox, all the other targets are less tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok no problem. I don't mind closing the PR and keeping the branch for documentation purpose.
As a note, what motivates me to investigate other hypervisors is the need for nested virtualization (not supported by Virtualbox on Intel).
"ram_size": 2048, | ||
"enable_mac_spoofing": true, | ||
"guest_additions_mode": "disable", | ||
"enable_virtualization_extensions": false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The json code is generated by the gen_template.rb script. The new target would be declared here:
Line 74 in dcff88c
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To re-generate the json run nix-shell --run "make update"
@PierreR sorry I didn't react quickly enough on my end to get this merged. Do you want to do yet another rebase or let it be? |
This is an attemps to fix #26.
It works on Windows 10 if you use a specific network external adapter.
Any comment, suggestion is welcomed.
I also took the liberty to add a hook so I can make heavier packer images. This need cames from the need to debug the vagrant box part of the generated hyperv box.