diff options
Diffstat (limited to 'nixpkgs/nixos/modules/hardware')
-rw-r--r-- | nixpkgs/nixos/modules/hardware/all-firmware.nix | 6 | ||||
-rw-r--r-- | nixpkgs/nixos/modules/hardware/cpu/intel-sgx.nix | 64 | ||||
-rw-r--r-- | nixpkgs/nixos/modules/hardware/hackrf.nix | 23 | ||||
-rw-r--r-- | nixpkgs/nixos/modules/hardware/network/b43.nix | 4 | ||||
-rw-r--r-- | nixpkgs/nixos/modules/hardware/onlykey/onlykey.udev | 4 | ||||
-rw-r--r-- | nixpkgs/nixos/modules/hardware/rtl-sdr.nix | 12 | ||||
-rw-r--r-- | nixpkgs/nixos/modules/hardware/video/amdgpu-pro.nix | 46 | ||||
-rw-r--r-- | nixpkgs/nixos/modules/hardware/video/capture/mwprocapture.nix | 5 | ||||
-rw-r--r-- | nixpkgs/nixos/modules/hardware/video/nvidia.nix | 5 |
9 files changed, 103 insertions, 66 deletions
diff --git a/nixpkgs/nixos/modules/hardware/all-firmware.nix b/nixpkgs/nixos/modules/hardware/all-firmware.nix index ce87f9e8be8a..99bdb11b0112 100644 --- a/nixpkgs/nixos/modules/hardware/all-firmware.nix +++ b/nixpkgs/nixos/modules/hardware/all-firmware.nix @@ -31,7 +31,6 @@ in { type = types.bool; description = '' Turn on this option if you want to enable all the firmware with a license allowing redistribution. - (i.e. free firmware and <literal>firmware-linux-nonfree</literal>) ''; }; @@ -51,14 +50,13 @@ in { config = mkMerge [ (mkIf (cfg.enableAllFirmware || cfg.enableRedistributableFirmware) { hardware.firmware = with pkgs; [ - firmwareLinuxNonfree + linux-firmware intel2200BGFirmware rtl8192su-firmware rt5677-firmware rtl8723bs-firmware rtl8761b-firmware rtw88-firmware - rtw89-firmware zd1211fw alsa-firmware sof-firmware @@ -66,6 +64,8 @@ in { ] ++ optional (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) raspberrypiWirelessFirmware ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [ rtl8723bs-firmware + ] ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "5.16") [ + rtw89-firmware ]; hardware.wirelessRegulatoryDatabase = true; }) diff --git a/nixpkgs/nixos/modules/hardware/cpu/intel-sgx.nix b/nixpkgs/nixos/modules/hardware/cpu/intel-sgx.nix index 046479400587..1355ee753f0d 100644 --- a/nixpkgs/nixos/modules/hardware/cpu/intel-sgx.nix +++ b/nixpkgs/nixos/modules/hardware/cpu/intel-sgx.nix @@ -1,10 +1,24 @@ { config, lib, ... }: with lib; let - cfg = config.hardware.cpu.intel.sgx.provision; - defaultGroup = "sgx_prv"; + cfg = config.hardware.cpu.intel.sgx; + defaultPrvGroup = "sgx_prv"; in { + options.hardware.cpu.intel.sgx.enableDcapCompat = mkOption { + description = '' + Whether to enable backward compatibility for SGX software build for the + out-of-tree Intel SGX DCAP driver. + + Creates symbolic links for the SGX devices <literal>/dev/sgx_enclave</literal> + and <literal>/dev/sgx_provision</literal> to make them available as + <literal>/dev/sgx/enclave</literal> and <literal>/dev/sgx/provision</literal>, + respectively. + ''; + type = types.bool; + default = true; + }; + options.hardware.cpu.intel.sgx.provision = { enable = mkEnableOption "access to the Intel SGX provisioning device"; user = mkOption { @@ -15,7 +29,7 @@ in group = mkOption { description = "Group to assign to the SGX provisioning device."; type = types.str; - default = defaultGroup; + default = defaultPrvGroup; }; mode = mkOption { description = "Mode to set for the SGX provisioning device."; @@ -24,24 +38,32 @@ in }; }; - config = mkIf cfg.enable { - assertions = [ - { - assertion = hasAttr cfg.user config.users.users; - message = "Given user does not exist"; - } - { - assertion = (cfg.group == defaultGroup) || (hasAttr cfg.group config.users.groups); - message = "Given group does not exist"; - } - ]; + config = mkMerge [ + (mkIf cfg.provision.enable { + assertions = [ + { + assertion = hasAttr cfg.provision.user config.users.users; + message = "Given user does not exist"; + } + { + assertion = (cfg.provision.group == defaultPrvGroup) || (hasAttr cfg.provision.group config.users.groups); + message = "Given group does not exist"; + } + ]; - users.groups = optionalAttrs (cfg.group == defaultGroup) { - "${cfg.group}" = { }; - }; + users.groups = optionalAttrs (cfg.provision.group == defaultPrvGroup) { + "${cfg.provision.group}" = { }; + }; - services.udev.extraRules = '' - SUBSYSTEM=="misc", KERNEL=="sgx_provision", OWNER="${cfg.user}", GROUP="${cfg.group}", MODE="${cfg.mode}" - ''; - }; + services.udev.extraRules = with cfg.provision; '' + SUBSYSTEM=="misc", KERNEL=="sgx_provision", OWNER="${user}", GROUP="${group}", MODE="${mode}" + ''; + }) + (mkIf cfg.enableDcapCompat { + services.udev.extraRules = '' + SUBSYSTEM=="misc", KERNEL=="sgx_enclave", SYMLINK+="sgx/enclave" + SUBSYSTEM=="misc", KERNEL=="sgx_provision", SYMLINK+="sgx/provision" + ''; + }) + ]; } diff --git a/nixpkgs/nixos/modules/hardware/hackrf.nix b/nixpkgs/nixos/modules/hardware/hackrf.nix new file mode 100644 index 000000000000..7f03b765bbda --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/hackrf.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.hardware.hackrf; + +in +{ + options.hardware.hackrf = { + enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enables hackrf udev rules and ensures 'plugdev' group exists. + This is a prerequisite to using HackRF devices without being root, since HackRF USB descriptors will be owned by plugdev through udev. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + services.udev.packages = [ pkgs.hackrf ]; + users.groups.plugdev = { }; + }; +} diff --git a/nixpkgs/nixos/modules/hardware/network/b43.nix b/nixpkgs/nixos/modules/hardware/network/b43.nix index e63f2d04d1a6..eb03bf223ccf 100644 --- a/nixpkgs/nixos/modules/hardware/network/b43.nix +++ b/nixpkgs/nixos/modules/hardware/network/b43.nix @@ -24,10 +24,6 @@ let kernelVersion = config.boot.kernelPackages.kernel.version; in ###### implementation config = mkIf config.networking.enableB43Firmware { - assertions = singleton - { assertion = lessThan 0 (builtins.compareVersions kernelVersion "3.2"); - message = "b43 firmware for kernels older than 3.2 not packaged yet!"; - }; hardware.firmware = [ pkgs.b43Firmware_5_1_138 ]; }; diff --git a/nixpkgs/nixos/modules/hardware/onlykey/onlykey.udev b/nixpkgs/nixos/modules/hardware/onlykey/onlykey.udev index 61e3ee4e8828..9c8873aafc9e 100644 --- a/nixpkgs/nixos/modules/hardware/onlykey/onlykey.udev +++ b/nixpkgs/nixos/modules/hardware/onlykey/onlykey.udev @@ -14,5 +14,5 @@ KERNEL=="ttyACM*", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="60fc", MODE:="066 # ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" -SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", GROUP+="plugdev" -KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", GROUP+="plugdev" +SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", GROUP="plugdev" +KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", GROUP="plugdev" diff --git a/nixpkgs/nixos/modules/hardware/rtl-sdr.nix b/nixpkgs/nixos/modules/hardware/rtl-sdr.nix index 9605c7967f61..e85fc04e29bb 100644 --- a/nixpkgs/nixos/modules/hardware/rtl-sdr.nix +++ b/nixpkgs/nixos/modules/hardware/rtl-sdr.nix @@ -5,10 +5,14 @@ let in { options.hardware.rtl-sdr = { - enable = lib.mkEnableOption '' - Enables rtl-sdr udev rules, ensures 'plugdev' group exists, and blacklists DVB kernel modules. - This is a prerequisite to using devices supported by rtl-sdr without being root, since rtl-sdr USB descriptors will be owned by plugdev through udev. - ''; + enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enables rtl-sdr udev rules, ensures 'plugdev' group exists, and blacklists DVB kernel modules. + This is a prerequisite to using devices supported by rtl-sdr without being root, since rtl-sdr USB descriptors will be owned by plugdev through udev. + ''; + }; }; config = lib.mkIf cfg.enable { diff --git a/nixpkgs/nixos/modules/hardware/video/amdgpu-pro.nix b/nixpkgs/nixos/modules/hardware/video/amdgpu-pro.nix index ec1c8c2d57a1..d784befc9b88 100644 --- a/nixpkgs/nixos/modules/hardware/video/amdgpu-pro.nix +++ b/nixpkgs/nixos/modules/hardware/video/amdgpu-pro.nix @@ -11,23 +11,17 @@ let enabled = elem "amdgpu-pro" drivers; package = config.boot.kernelPackages.amdgpu-pro; - package32 = pkgs.pkgsi686Linux.linuxPackages.amdgpu-pro.override { libsOnly = true; kernel = null; }; + package32 = pkgs.pkgsi686Linux.linuxPackages.amdgpu-pro.override { kernel = null; }; opengl = config.hardware.opengl; - kernel = pkgs.linux_4_9.override { - extraConfig = '' - KALLSYMS_ALL y - ''; - }; - in { config = mkIf enabled { - nixpkgs.config.xorg.abiCompat = "1.19"; + nixpkgs.config.xorg.abiCompat = "1.20"; services.xserver.drivers = singleton { name = "amdgpu"; modules = [ package ]; display = true; }; @@ -36,31 +30,39 @@ in hardware.opengl.package32 = package32; hardware.opengl.setLdLibraryPath = true; - boot.extraModulePackages = [ package ]; - - boot.kernelPackages = - pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor kernel); + boot.extraModulePackages = [ package.kmod ]; - boot.blacklistedKernelModules = [ "radeon" ]; + boot.kernelPackages = pkgs.linuxKernel.packagesFor + (pkgs.linuxKernel.kernels.linux_5_10.override { + structuredExtraConfig = { + DEVICE_PRIVATE = kernel.yes; + KALLSYMS_ALL = kernel.yes; + }; + }); - hardware.firmware = [ package ]; + hardware.firmware = [ package.fw ]; system.activationScripts.setup-amdgpu-pro = '' - mkdir -p /run/lib - ln -sfn ${package}/lib ${package.libCompatDir} - ln -sfn ${package} /run/amdgpu-pro - '' + optionalString opengl.driSupport32Bit '' - ln -sfn ${package32}/lib ${package32.libCompatDir} + ln -sfn ${package}/opt/amdgpu{,-pro} /run ''; system.requiredKernelConfig = with config.lib.kernelConfig; [ + (isYes "DEVICE_PRIVATE") (isYes "KALLSYMS_ALL") ]; + boot.initrd.extraUdevRulesCommands = '' + cp -v ${package}/etc/udev/rules.d/*.rules $out/ + ''; + + environment.systemPackages = + [ package.vulkan ] ++ + # this isn't really DRI, but we'll reuse this option for now + optional config.hardware.opengl.driSupport32Bit package32.vulkan; + environment.etc = { - "amd/amdrc".source = package + "/etc/amd/amdrc"; - "amd/amdapfxx.blb".source = package + "/etc/amd/amdapfxx.blb"; - "gbm/gbm.conf".source = package + "/etc/gbm/gbm.conf"; + "modprobe.d/blacklist-radeon.conf".source = package + "/etc/modprobe.d/blacklist-radeon.conf"; + amd.source = package + "/etc/amd"; }; }; diff --git a/nixpkgs/nixos/modules/hardware/video/capture/mwprocapture.nix b/nixpkgs/nixos/modules/hardware/video/capture/mwprocapture.nix index 61bab533edaf..76cb4c6ee9bf 100644 --- a/nixpkgs/nixos/modules/hardware/video/capture/mwprocapture.nix +++ b/nixpkgs/nixos/modules/hardware/video/capture/mwprocapture.nix @@ -16,11 +16,6 @@ in config = mkIf cfg.enable { - assertions = singleton { - assertion = versionAtLeast kernelPackages.kernel.version "3.2"; - message = "Magewell Pro Capture family module is not supported for kernels older than 3.2"; - }; - boot.kernelModules = [ "ProCapture" ]; environment.systemPackages = [ kernelPackages.mwprocapture ]; diff --git a/nixpkgs/nixos/modules/hardware/video/nvidia.nix b/nixpkgs/nixos/modules/hardware/video/nvidia.nix index ff4225dc29ad..c0ba60e49a73 100644 --- a/nixpkgs/nixos/modules/hardware/video/nvidia.nix +++ b/nixpkgs/nixos/modules/hardware/video/nvidia.nix @@ -179,11 +179,6 @@ in in mkIf enabled { assertions = [ { - assertion = with config.services.xserver.displayManager; (gdm.enable && gdm.nvidiaWayland) -> cfg.modesetting.enable; - message = "You cannot use wayland with GDM without modesetting enabled for NVIDIA drivers, set `hardware.nvidia.modesetting.enable = true`"; - } - - { assertion = primeEnabled -> pCfg.intelBusId == "" || pCfg.amdgpuBusId == ""; message = '' You cannot configure both an Intel iGPU and an AMD APU. Pick the one corresponding to your processor. |