commit 342334bfe9f71d9fd382d35ea09acdf03dd12bac
parent 049caa61c6c679336b329a8628444993af608dab
Author: William Casarin <jb55@jb55.com>
Date: Fri, 2 Oct 2020 14:19:12 -0700
monad: add windows VM stuff
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
4 files changed, 79 insertions(+), 14 deletions(-)
diff --git a/nix-config/configuration.nix b/nix-config/configuration.nix
@@ -95,14 +95,4 @@ in {
programs.zsh.enable = true;
- # boot.kernelPatches = [{
- # name = "nintendo-hid";
- # patch = (pkgs.fetchurl {
- # url = "https://jb55.com/s/2020-03-24-HID-nintendo-add-nintendo-switch-controller-driver.patch";
- # sha256 = "660302c88b797df6a89e5e715388ab22144dedfc0174597221a03a987a496a2e";
- # });
- # extraConfig = ''
- # NINTENDO_FF y
- # '';
- # }];
}
diff --git a/nix-config/machines/monad/default.nix b/nix-config/machines/monad/default.nix
@@ -197,10 +197,69 @@ in
};
virtualisation.docker.enable = if extra.is-minimal then false else true;
+
+ boot.kernelPatches = [
+ {
+ name = "nintendo-hid";
+ patch = (pkgs.fetchurl {
+ url = "https://jb55.com/s/2020-03-24-HID-nintendo-add-nintendo-switch-controller-driver.patch";
+ sha256 = "660302c88b797df6a89e5e715388ab22144dedfc0174597221a03a987a496a2e";
+ });
+ extraConfig = ''
+ NINTENDO_FF y
+ '';
+ }
+ { # pci acs hack, not really safe or a good idea
+ name = "acs-overrides";
+ patch = pkgs.fetchurl {
+ url = "https://aur.archlinux.org/cgit/aur.git/plain/add-acs-overrides.patch?h=linux-vfio";
+ sha256 = "1b1qjlqkbwpv82aja48pj9vpi9p6jggc8g92p4rg7zjjjs2ldp24";
+ };
+ }
+ ];
+ boot.kernelParams = [ "pcie_acs_override=downstream" ];
+
+ virtualisation.libvirtd.enable = true;
+ virtualisation.libvirtd.qemuOvmf = true;
+ virtualisation.libvirtd.qemuVerbatimConfig = ''
+ user = "jb55"
+ group = "kvm"
+ cgroup_device_acl = [
+ "/dev/input/by-id/usb-Topre_Corporation_Realforce-event-kbd",
+ "/dev/input/by-id/usb-Razer_Razer_DeathAdder_2013-event-mouse",
+ "/dev/null", "/dev/full", "/dev/zero",
+ "/dev/random", "/dev/urandom",
+ "/dev/ptmx", "/dev/kvm", "/dev/kqemu",
+ "/dev/rtc","/dev/hpet", "/dev/sev"
+ ]
+ '';
+
+ services.samba = {
+ };
+
+ systemd.tmpfiles.rules = [
+ "f /dev/shm/looking-glass 0660 jb55 qemu-libvirtd -"
+ "f /dev/shm/scream 0660 jb55 qemu-libvirtd -"
+ ];
+
+ systemd.user.services.scream-ivshmem = {
+ enable = true;
+ description = "Scream IVSHMEM";
+ serviceConfig = {
+ ExecStart = "${pkgs.scream-receivers}/bin/scream-ivshmem-pulse /dev/shm/scream";
+ Restart = "always";
+ };
+ wantedBy = [ "multi-user.target" ];
+ requires = [ "pulseaudio.service" ];
+ };
+
+ environment.systemPackages = [ pkgs.virt-manager ];
+
virtualisation.virtualbox.host.enable = false;#if extra.is-minimal then false else true;
virtualisation.virtualbox.host.enableHardening = false;
#virtualization.virtualbox.host.enableExtensionPack = true;
- users.extraUsers.jb55.extraGroups = [ "vboxusers" "bitcoin" ];
+
+ users.extraUsers.jb55.extraGroups = [ "vboxusers" "bitcoin" "kvm" "input" ];
services.xserver.videoDrivers = [ ];
diff --git a/nix-config/machines/monad/hardware/default.nix b/nix-config/machines/monad/hardware/default.nix
@@ -10,9 +10,17 @@
# fsType = "zfs";
#nixos-generate-config --root /mnt };
- boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
- boot.kernelParams = [ "amdgpu.gpu_recovery=1" ];
- boot.kernelModules = [ "kvm-amd" ];
+ boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" "amdgpu" "vfio-pci" ];
+ boot.initrd.preDeviceCommands = ''
+ DEVS="0000:27:00.0 0000:27:00.1"
+ for DEV in $DEVS; do
+ echo "vfio-pci" > /sys/bus/pci/devices/$DEV/driver_override
+ done
+ modprobe -i vfio-pci
+ '';
+
+ boot.kernelParams = [ "amdgpu.gpu_recovery=1" "amd_iommu=on" "pcie_aspm=off" ];
+ boot.kernelModules = [ "kvm-amd" "kvm-intel" ];
boot.loader.grub.copyKernels = true;
boot.extraModulePackages = [ ];
diff --git a/nix-config/nixpkgs/config.nix b/nix-config/nixpkgs/config.nix
@@ -14,7 +14,15 @@ in {
allowBroken = false;
zathura.useMupdf = true;
+
packageOverrides = super: rec {
+ qemu = super.qemu.override {
+ smbdSupport = true;
+ };
+
+ scream-receivers = super.scream-receivers.override {
+ pulseSupport = true;
+ };
# /run/current-system/sw/bin/ls $HOME/.emacs.d/elpa | sed 's/-[[:digit:]].*//g;s/\+$/-plus/g' | sort -u
#emacs = super.emacsHead;