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;
|
sshKey = config.sops.secrets."borg-ssh-key".path;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
hardware = {
|
||||||
|
amdPassthrough = true;
|
||||||
|
};
|
||||||
config = {
|
config = {
|
||||||
isDesktop = true;
|
isDesktop = true;
|
||||||
setupGrub = true;
|
setupGrub = true;
|
||||||
|
|
|
@ -102,6 +102,8 @@ in
|
||||||
# Logitech hardware support
|
# Logitech hardware support
|
||||||
# On by default if the system is a desktop
|
# On by default if the system is a desktop
|
||||||
logitech = mkDefaultOption "logitech" config.nathan.config.isDesktop;
|
logitech = mkDefaultOption "logitech" config.nathan.config.isDesktop;
|
||||||
|
# AMD Single gpu passthrough
|
||||||
|
amdPassthrough = mkEnableOption "logitech";
|
||||||
};
|
};
|
||||||
# Linux specific configuration
|
# Linux specific configuration
|
||||||
config = {
|
config = {
|
||||||
|
|
|
@ -4,10 +4,34 @@ let
|
||||||
in
|
in
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
config = {
|
config = mkMerge [
|
||||||
|
{
|
||||||
hardware.logitech.wireless = mkIf nw.logitech {
|
hardware.logitech.wireless = mkIf nw.logitech {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableGraphical = 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;
|
nc = config.nathan.config;
|
||||||
in
|
in
|
||||||
with lib; {
|
with lib; {
|
||||||
config = {
|
config = mkMerge [
|
||||||
|
{
|
||||||
users = {
|
users = {
|
||||||
# If we install the user and the system is hardended, then disable mutable users
|
# If we install the user and the system is hardended, then disable mutable users
|
||||||
mutableUsers = !(nc.installUser && nc.harden);
|
mutableUsers = !(nc.installUser && nc.harden);
|
||||||
|
@ -48,5 +49,9 @@ with lib; {
|
||||||
] else [ ];
|
] else [ ];
|
||||||
# Configure the timezone
|
# Configure the timezone
|
||||||
time.timeZone = "America/New_York";
|
time.timeZone = "America/New_York";
|
||||||
};
|
}
|
||||||
|
(mkIf config.nathan.config.hardware.amdPassthrough {
|
||||||
|
users.users."${nc.user}".extraGroups = [ "libvirtd" ];
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue