summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorpolykernel <81340136+polykernel@users.noreply.github.com>2021-10-03 17:14:03 -0400
committerpolykernel <81340136+polykernel@users.noreply.github.com>2022-04-16 15:25:37 -0400
commit614b54d9b04092d6926afd49d64efe86272f7dd1 (patch)
tree2ec0a9d95459b143073721b9f8d9e05f6899cbfd /nixos
parent9c3048dfdbe157c0a96d603f98ce12b0b0b289ff (diff)
downloadnixpkgs-614b54d9b04092d6926afd49d64efe86272f7dd1.tar
nixpkgs-614b54d9b04092d6926afd49d64efe86272f7dd1.tar.gz
nixpkgs-614b54d9b04092d6926afd49d64efe86272f7dd1.tar.bz2
nixpkgs-614b54d9b04092d6926afd49d64efe86272f7dd1.tar.lz
nixpkgs-614b54d9b04092d6926afd49d64efe86272f7dd1.tar.xz
nixpkgs-614b54d9b04092d6926afd49d64efe86272f7dd1.tar.zst
nixpkgs-614b54d9b04092d6926afd49d64efe86272f7dd1.zip
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
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/hardware/video/nvidia.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix
index 6de5b99a1ee..c7c440bea19 100644
--- a/nixos/modules/hardware/video/nvidia.nix
+++ b/nixos/modules/hardware/video/nvidia.nix
@@ -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 = ''