From ddfbd3b8d26d051430730ea833746b4115aa9e71 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 1 Dec 2023 15:15:40 +0100 Subject: [PATCH] Add settings for QEMU vm --- flake.nix | 2 +- lib/hardware/qemu.nix | 26 ++++++++++++++++++++++++++ lib/machines/nixos.nix | 5 +++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 lib/hardware/qemu.nix create mode 100644 lib/machines/nixos.nix diff --git a/flake.nix b/flake.nix index 8108a0d..9ff633f 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,6 @@ inherit nixpkgs; }; in { - nixosConfigurations.manu-surface = system "manu-surface" {}; + nixosConfigurations.nixos = system "nixos" {}; }; } diff --git a/lib/hardware/qemu.nix b/lib/hardware/qemu.nix new file mode 100644 index 0000000..89d4847 --- /dev/null +++ b/lib/hardware/qemu.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, modulesPath, ... }: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot = { + initrd = { + availableKernelModules = [ + "ahci" + "xhci_pci" + "virtio_pci" + "virtio_scsi" + "sd_mod" + "sr_mod" + ]; + + kernelModules = []; + }; + + kernelModules = [ + "kvm-intel" + ]; + + extraModulePackages = []; + }; +} diff --git a/lib/machines/nixos.nix b/lib/machines/nixos.nix new file mode 100644 index 0000000..f3b047d --- /dev/null +++ b/lib/machines/nixos.nix @@ -0,0 +1,5 @@ +{ nixpkgs, ... }: { + imports = [ + ../hardware/qemu.nix + ]; +}