Hardware/Framework/Laptop 16: Difference between revisions

DHCP (talk | contribs)
m style fixes
 
Line 55: Line 55:
Add this snippet to configuration.nix:
Add this snippet to configuration.nix:


<syntaxhighlight lang="nix">
{{file|configuration.nix|nix|3=
systemd.services.inhibit-sleep-after-resume = {
systemd.services.inhibit-sleep-after-resume = {
   description = "Temporary sleep inhibitor after resume (workaround for double-suspend)";
   description = "Temporary sleep inhibitor after resume (workaround for double-suspend)";
Line 69: Line 69:
   '';
   '';
};
};
</syntaxhighlight>
}}


==== Workaround 2: disable GNOME idle-suspend (low risk; lid-close suspend still works) ====
==== Workaround 2: disable GNOME idle-suspend (low risk; lid-close suspend still works) ====
Line 77: Line 77:
Disable idle suspend on AC power:
Disable idle suspend on AC power:


<syntaxhighlight lang="sh">
<syntaxhighlight lang=console>
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
</syntaxhighlight>
</syntaxhighlight>


Optionally also disable it on battery:
Optionally also disable it on battery:


<syntaxhighlight lang="sh">
<syntaxhighlight lang=console>
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'nothing'
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'nothing'
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
</syntaxhighlight>
</syntaxhighlight>


Line 154: Line 154:
Example override:
Example override:


<syntaxhighlight lang="nix">
{{file|configuration.nix|nix|3=
{
{
  # In your system configuration:
   hardware.nvidia.prime = {
   hardware.nvidia.prime = {
     # Replace these values with your own system's IDs:
     # Replace these values with your own system's IDs:
Line 163: Line 162:
   };
   };
}
}
</syntaxhighlight>
}}


Find PCI IDs:
Find PCI IDs:


<syntaxhighlight lang="sh">
<syntaxhighlight lang=console>
$ nix-shell -p pciutils --run 'lspci | grep -E "VGA|3D|Display"'
$ nix-shell -p pciutils --run 'lspci | grep -E "VGA|3D|Display"'
</syntaxhighlight>
</syntaxhighlight>
Line 186: Line 185:
Validation (hybrid/offload):
Validation (hybrid/offload):


<syntaxhighlight lang="sh">
<syntaxhighlight lang=console>
# Default: should show AMD iGPU
$ # Default: should show AMD iGPU
nix-shell -p mesa-demos --run 'glxinfo -B | grep -E "OpenGL vendor|OpenGL renderer"'
$ nix-shell -p mesa-demos --run 'glxinfo -B | grep -E "OpenGL vendor|OpenGL renderer"'


# Offload: should show NVIDIA dGPU
$ # Offload: should show NVIDIA dGPU
nix-shell -p mesa-demos --run 'nvidia-offload glxinfo -B | grep -E "OpenGL vendor|OpenGL renderer"'
$ nix-shell -p mesa-demos --run 'nvidia-offload glxinfo -B | grep -E "OpenGL vendor|OpenGL renderer"'


# Idle power check: should become "suspended" when idle
$ # Idle power check: should become "suspended" when idle
cat /sys/bus/pci/devices/0000:??:??.?/power/runtime_status
$ cat /sys/bus/pci/devices/0000:??:??.?/power/runtime_status
</syntaxhighlight>
</syntaxhighlight>


Line 263: Line 262:
Example (LED matrix clock):
Example (LED matrix clock):


<syntaxhighlight lang="sh"># Serial device is often /dev/ttyACM0 (or ttyACM1 if you have two modules)
<syntaxhighlight lang=console>
inputmodule-control --serial-dev /dev/ttyACM0 led-matrix --clock</syntaxhighlight>
$ # Serial device is often /dev/ttyACM0 (or ttyACM1 if you have two modules)
$ inputmodule-control --serial-dev /dev/ttyACM0 led-matrix --clock
</syntaxhighlight>


== External resources ==
== External resources ==


There is [https://community.frame.work/t/nixos-on-the-framework-laptop-16/46743 a NixOS thread on the Framework forum], where you can find additional help, guidance, and example configurations.
There is [https://community.frame.work/t/nixos-on-the-framework-laptop-16/46743 a NixOS thread on the Framework forum], where you can find additional help, guidance, and example configurations.