feat(krz01): passthrough the nVidia Tesla K80 in ml01

This way, no need for reboot.

Signed-off-by: Ryan Lahfa <ryan@dgnum.eu>
This commit is contained in:
Ryan Lahfa 2024-10-08 17:36:31 +02:00
parent ebed6462f6
commit 8160b2762f
2 changed files with 45 additions and 17 deletions

View file

@ -15,7 +15,9 @@ lib.extra.mkConfig {
]; ];
extraConfig = { extraConfig = {
microvm.host.enable = true; microvm = {
host.enable = true;
};
dgn-hardware = { dgn-hardware = {
useZfs = true; useZfs = true;
zfsPools = [ zfsPools = [

View file

@ -1,7 +1,15 @@
_: { _: {
microvm.autostart = [ "ml01" ]; microvm.autostart = [ "ml01" ];
microvm.vms.ml01 = { microvm.vms.ml01 = {
config = { config =
{ config, ... }:
{
nixpkgs.config.cudaSupport = true;
nixpkgs.config.nvidia.acceptLicense = true;
# Tesla K80 is not supported by the latest driver.
hardware.nvidia.package = config.boot.kernelPackages.nvidia_x11_legacy470;
# Don't ask.
services.xserver.videoDrivers = [ "nvidia" ];
networking.hostName = "ml01"; networking.hostName = "ml01";
services.ollama = { services.ollama = {
enable = true; enable = true;
@ -9,7 +17,24 @@ _: {
sandbox = true; sandbox = true;
acceleration = "cuda"; acceleration = "cuda";
}; };
microvm.shares = [
microvm = {
hypervisor = "cloud-hypervisor";
vcpu = 4;
mem = 4096;
balloonMem = 2048;
devices = [
# The nVidia Tesla K80
{
bus = "pci";
path = "0000:44:00.0";
}
{
bus = "pci";
path = "0000:45:00.0";
}
];
shares = [
{ {
source = "/nix/store"; source = "/nix/store";
mountPoint = "/nix/.ro-store"; mountPoint = "/nix/.ro-store";
@ -19,4 +44,5 @@ _: {
]; ];
}; };
}; };
};
} }