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 on hyperv: load proper modules and make installer use the module #47482

Merged
merged 3 commits into from Oct 3, 2018

Conversation

peterhoeg
Copy link
Member

Motivation for this change
  • properly load the required kernel modules on hyperv
  • installer now uses the nixos module when it detects hyperv
  • support hot-adding CPUs

We run quite a bit of NixOS on HyperV and have had a number of changes in use that were never upstreamed. I'm trying to rectify that.

Would love for some people who run on HyperV to test this out.

Cc: @akavel

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@akavel
Copy link
Contributor

akavel commented Sep 28, 2018

What would you think about also adding an option in the hypervGuest section which would trigger boot.kernel.sysctl."vm.overcommit_memory" = "1";? Per my notes on nixos-hardware, I had to do this to avoid a problem with nix-env -i running out of memory (see also NixOS/nix#421). I imagine it could be disabled by default, but adding it there might make it easier for people to make their own decision.

Sorry I'll not be able to test this, but I uninstalled HyperV from my Windows notebook in the end, as I grew tired of trying to use NixOS that way (the machine had too little memory to do this comfortably while also "living normally" with a memory-hungry web browser on Windows).

Would you mind also editing the relevant nixos-hardware "guide" to take into account your simplifications after this PR hopefully gets merged?

As to your comment about BIOS vs. UEFI, I'm not even sure if my machine is BIOS- or UEFI-based... so won't be able to discuss this more too, I'm afraid... I just dumped into nixos-hardware whatever I found helped me, in hope that other people might find it useful too...

@peterhoeg
Copy link
Member Author

The memory issue was addressed in NixOS/nix@2825e05 so the overcommit workaround should no longer be needed - this isn't specific to hyperv.

I'm not even sure if my machine is BIOS- or UEFI-based

It's not about the host machine - the VM can be created as gen1 (BIOS) or gen2 (UEFI).

With the mentioned PR, there really shouldn't be anything needed to boot on HyperV - it should just work. Then you guide could cover file sharing as well as the gen1/gen2 distinction for the boot loader.

@peterhoeg
Copy link
Member Author

Are installer changes too late for 18.09 @vcunat and @samueldr ?

@peterhoeg peterhoeg changed the title nixos on hyperv: load proper modules and make installer use the module [WIP] nixos on hyperv: load proper modules and make installer use the module Oct 2, 2018
@vcunat
Copy link
Member

vcunat commented Oct 2, 2018

This seems safe to affect hyper-v only, so I'd not block that, if it gets some confidence through review, testing, etc. (Even if to be merged after official release.)

@peterhoeg
Copy link
Member Author

This PR is a cleanup of the configuration we have had running for customers in production for months so it should be safe. I'll deploy this exact configuration and merge if all OK.

@peterhoeg peterhoeg merged commit 7af39cb into NixOS:master Oct 3, 2018
@peterhoeg peterhoeg deleted the f/hyperv branch October 3, 2018 03:45
@peterhoeg peterhoeg restored the f/hyperv branch October 3, 2018 04:14
@peterhoeg peterhoeg deleted the f/hyperv branch October 3, 2018 12:21
@peterhoeg peterhoeg restored the f/hyperv branch October 3, 2018 12:48
@peterhoeg peterhoeg deleted the f/hyperv branch October 8, 2018 01:24
@peterhoeg peterhoeg restored the f/hyperv branch October 8, 2018 11:45
@peterhoeg peterhoeg deleted the f/hyperv branch March 18, 2019 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants