Jump to content

Nvidia: Difference between revisions

1,374 bytes added ,  27 August 2023
no edit summary
imported>Nadimkobeissi
No edit summary
imported>Nadimkobeissi
No edit summary
Line 202: Line 202:


== Useful Tips ==
== Useful Tips ==
=== Multiple Boot Configurations ===
Imagine you have a laptop that you mostly use in clamshell mode (docked, connected to an external display and plugged into a charger) but that you sometimes use on the go.
In clamshell mode, using PRIME Sync is likely to lead to better performance, external display support, etc., at the cost of potentially (but not always) lower battery life. However, when using the laptop on the go, you may prefer to use offload mode.
NixOS supports "specialisations", which allow you to automatically generate different boot profiles when rebuilding your system. We can, for example, enable PRIME sync by default, but also create a "on-the-go" specialization that disables PRIME sync and instead enables offload mode:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
specialisation = {
  on-the-go.configuration = {
    system.nixos.tags = [ "on-the-go" ];
    hardware.nvidia = {
      prime.offload.enable = lib.mkForce true;
      prime.offload.enableOffloadCmd = lib.mkForce true;
      prime.sync.enable = lib.mkForce false;
    };
  };
};
}
</nowiki>}}
(You can also add other settings here totally unrelated to Nvidia, such as power profiles, etc.)
After rebuilding and rebooting, you'll see in your boot menu under each Generation an "on-the-go" option, which will let you boot into the on-to-go specialisation for that generation.


=== Using GPUs on non-NixOS ===
=== Using GPUs on non-NixOS ===
Line 212: Line 240:


=== Using Steam in Offload Mode ===
=== Using Steam in Offload Mode ===
In order to automatically launch Steam in offload mode, you need to add the following to your <code>~/.bashrc</code>:
In order to automatically launch Steam in offload mode, you need to add the following to your <code>~/.bashrc</code>:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 262: Line 289:


=== Graphical Corruption and System Crashes on Suspend/Resume ===
=== Graphical Corruption and System Crashes on Suspend/Resume ===
First, ensure that <code>powerManagement.enable = true</code>, as initially suggested in the starting configuration above.
First, ensure that <code>powerManagement.enable = true</code>, as initially suggested in the starting configuration above.