diff --git a/configuration.nix b/configuration.nix index 7a046cd..52be205 100644 --- a/configuration.nix +++ b/configuration.nix @@ -18,6 +18,12 @@ let ${pkgs.pciutils}/bin/lspci | ${pkgs.busybox}/bin/grep NVIDIA | ${pkgs.busybox}/bin/grep VGA > $out || true '' )) != ""; + isAdata = # ADATA is a famous cheap troubleful NVMe controllers + (builtins.readFile ( + pkgs.runCommandLocal "isAdata" { } '' + ${pkgs.pciutils}/bin/lspci | ${pkgs.busybox}/bin/grep ADATA | ${pkgs.busybox}/bin/grep -i NVMe > $out || true + '' + )) != ""; in { nixpkgs.overlays = [ @@ -702,7 +708,12 @@ in open = false; nvidiaSettings = false; }; - boot.kernelParams = if isNvidia then [ "nvidia-drm.modeset=1" ] else [ ]; + services.udev.extraRules = if isAdata then '' + ACTION=="add|change",KERNEL=="nvme[0-9]", ATTR{queue/scheduler}="none" + '' else ""; + boot.kernelParams = lib.optionals isNvidia [ "nvidia-drm.modeset=1" ] + ++ lib.optionals isAdata [ "nvme_core.default_ps_max_latency_us=0" "nvme_core.io_timeout=4294967295" ]; + boot.blacklistedKernelModules = if isNvidia then [ "nouveau" ] else [ ]; boot.blacklistedKernelModules = if isNvidia then [ "nouveau" ] else [ ]; boot.extraModprobeConfig = if isNvidia then