Desktop nvidia tty / console resolution

Hi there.

I have a new setup (pc amd cpu + nvidia gpu, hybrid disabled) and I’m new to NixOS.
My goal is to have a working configuration using Wayland + Hyprland and a greeter (probably greetd + gtkgreet, currently sddm). The system is connected to one screen with the resolution 3840x1600@144 using displayport.

My only issue I can’t solve is the tty / console resolution. It’s fixed to 1024x768 and I can’t figure out how to change it. The resolution is the same during the boot and within the tty(s) afterwards.

I don’t have any console / font setup yet, staying to the defaults.

I tried to enable the nvidia module during the boot, but this doesn’t change anything:

boot.initrd.kernelModules = [ "nvidia" ];   

I tried to set the resolution using

 boot.kernelParams = [ "video=3840x1600" ];

The boot starts with

 initrd=\EFI\nixos\3p5v5d67zvdfa8kydzzh9y3ycdasf1qx-initrd-linux-6.6.31-initrd.efi init=/nix/store/p2xi92b6s6hffi1psi0nnzkwzk9mc9vr-nixos-system-nix-24.11.20240524.bfb7a88/init video=3840x1600 loglevel=4 nvidia-drm.modeset=1

but the mode fails with

[    0.645872] simple-framebuffer simple-framebuffer.0: [drm] User-defined mode not supported: "3840x1600": 60 522915 3840 4128 4552 5264 1600 1601 1604 1656 0x20 0x6

(I also tried adding @144)

How could I set the correct resolution?

Also relevant might be:

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.timeout = 2;
  boot.loader.systemd-boot.consoleMode = "max";

...

  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
  };

  services.xserver = {
    videoDrivers = ["nvidia"];
  };

  hardware.nvidia = {
    modesetting.enable = true;
    open = false;
    powerManagement.enable = false;
    powerManagement.finegrained = false;
    nvidiaSettings = true;
    package = config.boot.kernelPackages.nvidiaPackages.stable;
  };

I tried different consoleModes without any effect.

console ={
  earlySetup = true;
};

Didn’t change anything either.

My hardware config:

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

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

  boot.initrd.availableKernelModules = [ "nvme" "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-label/NIXROOT";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-label/NIXBOOT";
      fsType = "vfat";
      options = [ "fmask=0022" "dmask=0022" ];
    };

  swapDevices = [ ];

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.enp12s0.useDHCP = lib.mkDefault true;
  # networking.interfaces.wlp13s0.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

I’m thankful for any suggestions as I’m out of ideas…
Thanks for your help :slight_smile:

Christian

1 Like