Start of GPU passthrough plan
This commit is contained in:
parent
bf3c4fca2d
commit
f76c3e17a7
|
@ -33,6 +33,9 @@
|
|||
sshKey = config.sops.secrets."borg-ssh-key".path;
|
||||
};
|
||||
};
|
||||
hardware = {
|
||||
amdPassthrough = true;
|
||||
};
|
||||
config = {
|
||||
isDesktop = true;
|
||||
setupGrub = true;
|
||||
|
|
|
@ -102,6 +102,8 @@ in
|
|||
# Logitech hardware support
|
||||
# On by default if the system is a desktop
|
||||
logitech = mkDefaultOption "logitech" config.nathan.config.isDesktop;
|
||||
# AMD Single gpu passthrough
|
||||
amdPassthrough = mkEnableOption "logitech";
|
||||
};
|
||||
# Linux specific configuration
|
||||
config = {
|
||||
|
|
|
@ -4,10 +4,34 @@ let
|
|||
in
|
||||
with lib;
|
||||
{
|
||||
config = {
|
||||
config = mkMerge [
|
||||
{
|
||||
hardware.logitech.wireless = mkIf nw.logitech {
|
||||
enable = true;
|
||||
enableGraphical = true;
|
||||
};
|
||||
}
|
||||
(mkIf nw.amdPassthrough {
|
||||
# Turn on IOMMU and the needed drivers
|
||||
boot = {
|
||||
kernelParams = [ "amd_iommu=on" ];
|
||||
kernelModules = [ "kvm-amd" "vifo-pci" ];
|
||||
};
|
||||
# Enable libvirtd
|
||||
virtualisation.libvirtd = {
|
||||
enable = true;
|
||||
onBoot = "ignore";
|
||||
onShutdown = "shutdown";
|
||||
qemu = {
|
||||
ovmf = {
|
||||
enable = true;
|
||||
package = pkgs.OVMFFull;
|
||||
runAsRoot = true;
|
||||
};
|
||||
swtpm.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@ let
|
|||
nc = config.nathan.config;
|
||||
in
|
||||
with lib; {
|
||||
config = {
|
||||
config = mkMerge [
|
||||
{
|
||||
users = {
|
||||
# If we install the user and the system is hardended, then disable mutable users
|
||||
mutableUsers = !(nc.installUser && nc.harden);
|
||||
|
@ -48,5 +49,9 @@ with lib; {
|
|||
] else [ ];
|
||||
# Configure the timezone
|
||||
time.timeZone = "America/New_York";
|
||||
};
|
||||
}
|
||||
(mkIf config.nathan.config.hardware.amdPassthrough {
|
||||
users.users."${nc.user}".extraGroups = [ "libvirtd" ];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue