-
-
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?
Changes from all commits
3df8bc3
600d660
4f7649d
e0b129a
45b3051
af460d4
8e94157
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -52,6 +52,36 @@ | |||
"1024" | ||||
] | ||||
] | ||||
}, | ||||
{ | ||||
"boot_wait": "40s", | ||||
"boot_command": [ | ||||
"echo http://{{.HTTPIP}}:{{.HTTPPort}} > .packer_http<enter>", | ||||
"mkdir -m 0700 .ssh<enter>", | ||||
"curl $(cat .packer_http)/install_rsa.pub > .ssh/authorized_keys<enter><wait>", | ||||
"sed -i '5ivirtualisation.hypervGuest.enable = true;' /etc/nixos/configuration.nix<enter><wait>", | ||||
"sed -i '6idocumentation.man.enable = false; documentation.enable = false;' /etc/nixos/configuration.nix<enter><wait>", | ||||
"sed -i '7iservices.nixosManual.enable = false;' /etc/nixos/configuration.nix<enter><wait>", | ||||
"nixos-rebuild switch<enter><wait>", | ||||
"systemctl start sshd<enter>" | ||||
], | ||||
"http_directory": "scripts", | ||||
"switch_name": "Devbox", | ||||
"iso_checksum_type": "sha256", | ||||
"shutdown_command": "shutdown -h now", | ||||
"ssh_private_key_file": "./scripts/install_rsa", | ||||
"ssh_port": 22, | ||||
"ssh_timeout": "600s", | ||||
"ssh_username": "root", | ||||
"type": "hyperv-iso", | ||||
"iso_url": "https://d3g5gsiof5omrk.cloudfront.net/nixos/18.09/nixos-18.09.1799.b9fa31cea0e/nixos-minimal-18.09.1799.b9fa31cea0e-x86_64-linux.iso", | ||||
"iso_checksum": "cc7c399c5fe4672383fe54cb1d648854a0d6732765fe1a61bb38b3fe3b7c6d2f", | ||||
"disk_size": 62000, | ||||
"cpu": 3, | ||||
"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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. To re-generate the json run |
||||
} | ||||
], | ||||
"provisioners": [ | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ config, pkgs, ... }: | ||
|
||
{ | ||
# Place here any custom configuration specific to your organisation (locale, ...) | ||
# if you want it to be part of the packer base image to be used with vagrant. | ||
} |
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 thesed
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).