hardware/nvidia: stricter constraints on PCI bus-id.

The current type for the busId options are too relaxed, a stricter
constraint should be imposed to guard against typos which result
in Xorg unable to start.

This commit restricts the type to adhere to the B/D/F notation[1] for
addressing devices as expected by the module option.

[1] - https://wiki.osdev.org/PCI#Configuration_Space_Access_Mechanism_.231
This commit is contained in:
polykernel 2021-10-03 17:14:03 -04:00
parent 9c3048dfdb
commit 614b54d9b0

View file

@ -68,7 +68,7 @@ in
};
hardware.nvidia.prime.nvidiaBusId = mkOption {
type = types.str;
type = types.strMatching "[[:print:]]+\:[0-9]{1,3}\:[0-9]{1,2}\:[0-9]";
default = "";
example = "PCI:1:0:0";
description = ''
@ -78,7 +78,7 @@ in
};
hardware.nvidia.prime.intelBusId = mkOption {
type = types.str;
type = types.strMatching "[[:print:]]+\:[0-9]{1,3}\:[0-9]{1,2}\:[0-9]";
default = "";
example = "PCI:0:2:0";
description = ''
@ -88,7 +88,7 @@ in
};
hardware.nvidia.prime.amdgpuBusId = mkOption {
type = types.str;
type = types.strMatching "[[:print:]]+\:[0-9]{1,3}\:[0-9]{1,2}\:[0-9]";
default = "";
example = "PCI:4:0:0";
description = ''