~jb55/citadel

342334bfe9f71d9fd382d35ea09acdf03dd12bac — William Casarin 1 year, 24 days ago 049caa6
monad: add windows VM stuff

Signed-off-by: William Casarin <jb55@jb55.com>
M nix-config/configuration.nix => nix-config/configuration.nix +0 -10
@@ 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
  #   '';
  # }];
}

M nix-config/machines/monad/default.nix => nix-config/machines/monad/default.nix +60 -1
@@ 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 = [ ];


M nix-config/machines/monad/hardware/default.nix => nix-config/machines/monad/hardware/default.nix +11 -3
@@ 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 = [ ];


M nix-config/nixpkgs/config.nix => nix-config/nixpkgs/config.nix +8 -0
@@ 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;