migrate predevicecommands to initrd systemd service

This commit is contained in:
2026-04-22 03:34:10 +02:00
parent 86d717fad1
commit 96045f57c4

View File

@@ -17,9 +17,23 @@
boot.extraModprobeConfig = '' boot.extraModprobeConfig = ''
options vfio-pci ids=10de:1b81,10de:10f0 options vfio-pci ids=10de:1b81,10de:10f0
''; '';
boot.initrd.preDeviceCommands = '' boot.initrd.systemd = {
enable = true;
services.initrd-vfio-pci-nvidia = {
description = "vfio-pci predevice init";
wantedBy = [ "initrd.target" ];
# Match 'preDeviceCommands' by running early
before = [ "sysroot.mount" ];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
# Place your original shell commands here
script = ''
modprobe vfio-pci modprobe vfio-pci
''; '';
}
# # EARLY and deterministic binding # # EARLY and deterministic binding
# boot.initrd.preDeviceCommands = '' # boot.initrd.preDeviceCommands = ''
# echo 0000:05:00.0 > /sys/bus/pci/drivers/vfio-pci/bind # echo 0000:05:00.0 > /sys/bus/pci/drivers/vfio-pci/bind