NixOS on the Framework Laptop 16

The simplest way to check it is to call powerprofilesctl, which will show the available profiles and the current one:

❯ powerprofilesctl
  performance:
    CpuDriver:	amd_pstate
    PlatformDriver:	platform_profile
    Degraded:   no

  balanced:
    CpuDriver:	amd_pstate
    PlatformDriver:	platform_profile

* power-saver:
    CpuDriver:	amd_pstate
    PlatformDriver:	platform_profile

Oh, nice. thanks. I found the Nix/NixOS channel but I didn’t realize there is a whole space. I’ll check it out.

Is anyone else experiencing issues with their laptop not turning off? Systemd shutdown finishes execution and then I am greeted by a perpetual black screen. I have to hold down the power button to turn it off this happens on unstable and 24-05.

I also have this issue. I tried updating the firmware with fwupd, but that didn’t fix it. It occurs on both my NixOS install and on the NixOS live ISO (I’ve only tried the minimal installer), but not on the live ISO for any other Linux distro I’ve tried.

What kernel are you on? A lot of people in the Discord have been having power issues with shutdown that were resolved by updating the kernel to the latest 6.9 release.

For some reason, the default kernel included with NixOS is fairly old.

2 Likes

I’m on the default 6.6.32 for the new 25.04 release. Will try upgrading to a 6.9.x release.

Update: switched to boot.kernelPackages = pkgs.linuxPackages_latest; and now shutting down works properly. Thanks, @shaffle, for the tip!

1 Like

Is it possible, and how would I, disable the fingerprint reader in favor of password IF the screen is closed AND I’m on A/C power or, more specifically, plugged into a dock?

And while we’re at it, how might I convince my laptop to use iGPU instead dGPU when not in a game?

Just received my FW16 and installed NixOS on it!
My config is based on FrostPhoenix one’s. I tweaked it to fit my needs and to make the laptop profile suited for our own :smiley:

dotfiles: GitHub - clementpoiret/nixos-config: ❄️ NixOs / Hyprland rice with Home-Manager ❄️

4 Likes

I don’t know if this is the best way to do it, but I wrote an acpid script to take care of it

{ ... }:
{
  services.acpid = {
    enable = true;
    handlers.lidClosed = {
      event = "button/lid \\w+ close";
      action = ''
        cat /sys/class/backlight/amdgpu_bl1/device/enabled
        if grep -Fxq disabled /sys/class/backlight/amdgpu_bl1/device/enabled
        then
          echo "Lid closed. Disabling fprintd."
          systemctl stop fprintd
          ln -s /dev/null /run/systemd/transient/fprintd.service
          systemctl daemon-reload
        fi
      '';
    };
    handlers.lidOpen = {
      event = "button/lid \\w+ open";
      action = ''
        if ! $(systemctl is-active --quiet fprintd); then
          echo "Lid open. Enabling fprintd."
          rm -f /run/systemd/transient/fprintd.service
          systemctl daemon-reload
          systemctl start fprintd
        fi
      '';
    };
  };
}

This script is tailored to how I have my laptop set up to dock at work, I disable the builtin monitor, which means that reading from `/sys/class/backlight/amdgpu_blX/device/enabled will report as “disabled” when I’m docked. Based on that I use /run/transient to mask fprintd and reload systemd. The opposite handler is a more permissive inverse, unmasking fprintd if it’s been masked out every time I open the lid

1 Like

think I’m gonna snatch these and rebuild my system – have another go at trying Nix again.
But how’s battery life? surely there’s gotta be a way to get it to 10w or less

Actually the battery life with the dGPU module is okay but bot incredible. I believe I need to tweak things to optimize for battery consumption, such as running Hyprland on the iGPU rather than dGPU. I did not spent time optimizing that as I needed to be be ready for work first.

If you have tips going further than simply power-profiles-daemon, I’d be happy to try :smiley:

Depending on your kernel version, it maybe worth checking if VRR (Variable Refresh Rate) is working or not.
If it’s not, forcing the refresh rate to 60Hz can give you some extra battery life.

2 Likes

Ohh thanks for the tip, I’ll check that! I’m on the latest Zen Kernel.

Also just tried the following to use the iGPU first:

  home.file = lib.mkIf (host == "laptop") {
    # iGPU
    ".config/hypr/card" = {
      source = config.lib.file.mkOutOfStoreSymlink "/dev/dri/by-path/pci-0000:c5:00.0-card";
    };

    # dGPU
    ".config/hypr/fallbackCard" = {
      source = config.lib.file.mkOutOfStoreSymlink "/dev/dri/by-path/pci-0000:03:00.0-card";
    };
  };

  home.sessionVariables = lib.mkIf (host == "laptop") {
    WLR_DRM_DEVICES = "$HOME/.config/hypr/card:$HOME/.config/hypr/fallbackCard";
  };

Not sure how to really test if it works as expected.

Otherwise, quick question: do you guys managed to setup hidpi for qutebrowser? I tried to set qt auto scale factor on, and set qt.highdpi = true; for qutebrowser, but the graphics are still ugly on it…

By default, Hyprland should always favor the iGPU for rendering Hyprland itself.
This is also mentioned in Multi-GPU – Hyprland Wiki

If you wish to use the integrated GPU to run Hyprland, no further action is required. wlroots will set WLR_DRM_DEVICES to the integrated GPU by default.

While most processes are effectively handled by the iGPU, I still have processes handled by the dGPU which makes me wonder if the dGPU can really go into sleep:

I also have Hyprland-wrapp and Xwayland processes on the iGPU.

I think I need to try that zen kernel and other optimizations firstly so I can get it to a place where I’m not setting my thighs on fire just by having it on first. LOL

This beast is beautiful, I just want her to sip battery until I need to compile, render or frag, that’s all

1 Like

Have others been successful getting the touchpad to disable while typing?
Perhaps I’m doing something wrong and I’ve tried a few different things, but without any luck so far. I do have nixos-hardware imported as well and everything else is working well. I’m using Gnome still on X11 since I remember Wayland having a couple issues for me but maybe should I try it again. Thanks!

Edit: Nevermind I got it working with the below and then a re-login.

    environment.etc = {
      "libinput/local-overrides.quirks".text = ''
        [Keyboard]
        MatchUdevType=keyboard
        MatchName=Framework Laptop 16 Keyboard Module - ANSI Keyboard
        AttrKeyboardIntegration=internal
      '';
    };
1 Like

What does gnome prefer? I’m worried my dGPU is running it but I don’t even know how to check.