With the following two files vm.nix and vm-config.nix I am getting the error
#vm.nix
{ config, lib, pkgs, ... }:
with lib;
{
imports =
[ <nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
<nixpkgs/nixos/modules/profiles/clone-config.nix>
./vm-config.nix
];
system.build.qemuvmImage = import <nixpkgs/nixos/lib/make-disk-image.nix> {
inherit lib config;
pkgs = import <nixpkgs/nixos> { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package
diskSize = 8192;
format = "qcow2";
configFile = pkgs.writeText "configuration.nix"
''
{
imports = [ <./machine-config.nix> ];
}
'';
};
}
#vm-config.nix
{ pkgs, lib, ... }:
with lib;
{
imports = [
<nixpkgs/nixos/modules/profiles/qemu-guest.nix>
# (import "${builtins.fetchTarball https://github.com/zimbatm/nixpkgs/archive/foldingathome.tar.gz}")
];
config = {
installer.cloneConfig = true;
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
autoResize = true;
};
# Set VM disk size (in MB)
virtualisation.diskSize = 1024 * 2048;
boot.growPartition = true;
boot.kernelParams = [ "console=ttyS0 boot.shell_on_fail" ];
boot.loader.grub.device = "/dev/vda";
boot.loader.timeout = 0;
i18n.defaultLocale = "de_DE.UTF-8";
time.timeZone = "Europe/Paris";
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnsupportedSystem = true;
nixpkgs.config.system-features = [ "kvm" "nixos-test" ];
services = {
timesyncd.enable = lib.mkDefault true;
openssh = {
enable = true;
permitRootLogin = "yes";
};
# see https://github.com/NixOS/nixpkgs/pull/82192,
#foldingAtHome = {
# enable = true;
# nickname = "Daniel";
#};
};
environment.systemPackages = with pkgs; [
#fahviewer fahcontrol
];
users.extraUsers.root.password = "";
users.mutableUsers = false;
users.users.root = {
extraGroups = [ "wheel" ];
};
};
}
qemu-system-x86_64: CPU model ‘host’ requires KVM
when using nix-build '<nixpkgs/nixos>' -A vm -I nixos-config=./vm.nix -I nixpkgs=channel:nixos-20.03-small
instead of nix-build '<nixpkgs/nixos>' -A vm -I nixos-config=./vm.nix -I nixpkgs=channel:nixos-19.09-small
and then ./result/bin/run-nixos-vm
.
Is there a way to analyse this further ?