2021-05-30 19:33:09 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
psCfg = config.pub-solar;
|
|
|
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
|
|
|
createService = import ./create-service.nix;
|
2021-12-11 20:09:22 +00:00
|
|
|
|
|
|
|
isolateGPU = "rx550x";
|
2022-02-14 09:50:26 +00:00
|
|
|
handOverUSBDevices = true;
|
2021-12-11 20:09:22 +00:00
|
|
|
|
|
|
|
isolateAnyGPU = isolateGPU != null;
|
2021-05-30 19:33:09 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
config = mkIf psCfg.virtualisation.enable {
|
|
|
|
boot.extraModprobeConfig = mkIf isolateAnyGPU (concatStringsSep "\n" [
|
|
|
|
"softdep amdgpu pre: vfio vfio_pci"
|
2021-12-11 20:09:22 +00:00
|
|
|
(if isolateGPU == "rx5700xt"
|
2021-05-30 19:33:09 +00:00
|
|
|
then "options vfio-pci ids=1002:731f,1002:ab38"
|
|
|
|
else "options vfio-pci ids=1002:699f,1002:aae0"
|
|
|
|
)
|
|
|
|
]);
|
|
|
|
|
|
|
|
systemd.user.services = {
|
|
|
|
vm-windows = createService {
|
|
|
|
inherit config;
|
|
|
|
inherit pkgs;
|
|
|
|
inherit lib;
|
|
|
|
vm = {
|
|
|
|
name = "windows";
|
|
|
|
disk = "/dev/disk/by-id/ata-SanDisk_SDSSDA240G_162402455603";
|
|
|
|
id = "http://microsoft.com/win/10";
|
|
|
|
gpu = true;
|
|
|
|
mountHome = false;
|
2021-12-11 20:09:22 +00:00
|
|
|
isolateGPU = isolateGPU;
|
|
|
|
handOverUSBDevices = handOverUSBDevices;
|
2021-05-30 19:33:09 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
vm-manjaro = createService {
|
|
|
|
inherit config;
|
|
|
|
inherit pkgs;
|
|
|
|
inherit lib;
|
|
|
|
vm = {
|
|
|
|
name = "manjaro";
|
|
|
|
disk = "/dev/disk/by-id/ata-KINGSTON_SM2280S3G2240G_50026B726B0265CE";
|
|
|
|
id = "https://manjaro.org/download/#i3";
|
|
|
|
gpu = true;
|
|
|
|
mountHome = true;
|
2021-12-11 20:09:22 +00:00
|
|
|
isolateGPU = isolateGPU;
|
|
|
|
handOverUSBDevices = handOverUSBDevices;
|
2021-05-30 19:33:09 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|