NixOSでKDEディスプレイが機能しない場合 - Thinkpad P15 Gen 2、NVIDIA RTX A4000

NixOSでKDEディスプレイが機能しない場合 - Thinkpad P15 Gen 2、NVIDIA RTX A4000

新しいThinkpad P15 Gen 2にNixOSをインストールしようとしていますが、デスクトップ環境では画面に何も表示されません。開いたり再起動したりするたびに、ctrl + alt + F4を押してシェルに入るまで、画面は黒くなります。 KDE Plasma 5を使用しようとしていますが、他のDEがうまく機能している場合は、喜んで試してみましょう。 KDEでインストーラISOを使用しましたが、グラフィックディスプレイとすべてを表示できました。その後、パーティションにインストールした後にグラフィックを表示することはできません。

これは私の設定です。nix(現在のチャンネルはnixos / 21.11):

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  boot.kernelPackages = pkgs.linuxPackages_5_16;

  networking.hostName = "fins-thinkpad"; # Define your hostname.
  
  networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.

  # Nvidia drivers unfree
  nixpkgs.config.allowUnfree = true;

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable the Plasma 5 Desktop Environment.
  services.xserver.displayManager.sddm.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;
  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.opengl.enable = true;

  users.users.finley = {
    isNormalUser = true;
    extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
  };

  environment.systemPackages = with pkgs; [
    vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
    wget
    firefox
  ];

  system.stateVersion = "22.05"; # Did you read the comment?
}

そして私hardware-configuration.nix

{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/7e6bcba1-25e7-43f5-8dd2-1458d863c0c4";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/19A7-C717";
      fsType = "vfat";
    };

  swapDevices =
    [ { device = "/dev/disk/by-uuid/14412169-fb90-4e0c-ae3f-735c817b8cf3"; }
    ];

  # The global useDHCP flag is deprecated, therefore explicitly set to false here.
  # Per-interface useDHCP will be mandatory in the future, so this generated config
  # replicates the default behaviour.
  networking.useDHCP = lib.mkDefault false;
  networking.interfaces.enp11s0.useDHCP = lib.mkDefault true;
  networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true;

  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
  # high-resolution display
  hardware.video.hidpi.enable = lib.mkDefault true;
}

ディスプレイマネージャのログは、次のPastebinソースリンクにあります。https://pastebin.com/raw/YycVPVVd

出力は次のとおりですlspci -k | grep -A3 'VGA'

00:02.0 VGA compatible controller: Intel Corporation Device 9a70 (rev 01)
    Subsystem: Lenovo Device 22d8
    Kernel driver in use: i915
    Kernel modules: i915
--
01:00.0 VGA compatible controller: NVIDIA Corporation Device 24b7 (rev a1)
    Subsystem: Lenovo Device 22d8
    Kernel driver in use: nvidia
    Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia

必要に応じて、より多くのログやファイルを公開することができます。助けてくれてありがとう!

ベストアンサー1

これは実際に私のラップトップの統合IntelグラフィックがNvidiaカードとうまく機能しないために起こりました。統合グラフィックスはモード設定ドライバでのみ使用できるため、設定を次のように変更すると問題が解決します。

services.xserver.videoDrivers = [ "modesetting" ]

変える[ "nvidia" ]。さらに、NixOS の PRIME 構成では、統合グラフィックスと Nvidia グラフィックスのオフロード設定が非常に簡単になります。Wikipediaで説明されているように

おすすめ記事