Skip to content

Change virtualization-options for nixos-rebuild build-vm  #59219

@Enteee

Description

@Enteee

Issue description

I would like to build and run a qemu vm from my current nixos configuration using nixos-rebuild build-vm. The problem is that the generated run-script does not start the vm with a configuration which allows to run hardware demanding applications in it. For this reason I would like to tweak some options which are exposed by the qemu-vm module. But when I do this nixos-rebuild raises errors.

Steps to reproduce

Add:

virtualization.cores = 5;

to /etc/nixos/configuration.nix. And run

$ nixos-rebuild build-vm 
building Nix...
error: The option `virtualisation.cores' defined in `/etc/nixos/configuration.nix' does not exist.
(use '--show-trace' to show detailed location information)
building the system configuration...
these derivations will be built:

Interestingly the run script was built just fine.

Also when I run nixos-rebuild build-vm --fast the error disappears.

Is this a bug or how can I define virtualisation.cores without raising this error on nixos-rebuild ?

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.14.110, NixOS, 19.09pre174426.acbdaa569f4 (Loris)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.2
  • channels(root): "nixos-19.09pre174426.acbdaa569f4, nixos-hardware, nixpkgs-19.09pre174594.0c0954781e2"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: questionRequests for a specific question to be answered2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions