From d1dc7fcc415f1105a55eba7db2dbeae46bd7781c Mon Sep 17 00:00:00 2001 From: The Hive Date: Wed, 29 Mar 2023 17:16:49 +0000 Subject: [PATCH] added qemu host and set it as default in the config template --- hosts/qemu/default.nix | 6 +++++ hosts/qemu/hardware-configuration.nix | 39 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 hosts/qemu/default.nix create mode 100644 hosts/qemu/hardware-configuration.nix diff --git a/hosts/qemu/default.nix b/hosts/qemu/default.nix new file mode 100644 index 0000000..ea30ecb --- /dev/null +++ b/hosts/qemu/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./hardware-configuration.nix + ]; +} diff --git a/hosts/qemu/hardware-configuration.nix b/hosts/qemu/hardware-configuration.nix new file mode 100644 index 0000000..a65c50d --- /dev/null +++ b/hosts/qemu/hardware-configuration.nix @@ -0,0 +1,39 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/vda2"; + fsType = "ext4"; + }; + + fileSystems."/boot/efi" = + { device = "/dev/vda1"; + fsType = "vfat"; + }; + services.spice-vdagentd.enable = true; + services.spice-webdavd.enable = true; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}