CCE

NixOS on Framework laptop

Contents

Archive

My NixOS configuration specific to the Framework Laptop Virtuous Cassette comes from a Blog Post. It's pretty straightforward, of course, and only a few changes are necessary or nice.

A lot of the complaints about this machine are that you have to choose between significant power drain while in "suspend to ram" state, or you have to wait 3-5 seconds for the laptop to come out of deep sleep. I choose the latter with =mem_sleep_default=deep=.

I also enable LVFS's testing repository so that i can have LVFS support for Framework hardware according to their knowledge base.

The only other thing to consider is to make sure the kernel is new enough to support the WiFi 6 chipsets.

The nixos-hardware repository is pulled in as a flake input pinned by flake.lock:

nix:tangle ~/nix/snippets/nixos-hardware-input.nix:mkdirp yes
nixos-hardware = {
  url = "github:NixOS/nixos-hardware";
  inputs.nixpkgs.follows = "nixpkgs";
};

This can't just be blindly included in all my endpoints since it defines kernel params, but here's how it could be:

AMD Ryzen 5

Don't have to fiddle with powermanagement like I did on the Intel 11th gen below. Upgraded the internals in a 30 minute swap on . Had to run =NIXOS_INSTALL_BOOTLOADER=1 /run/current-system/bin/switch-to-configuration boot= to get grub reinstalled. In theory I could have moved back to systemd-boot with bootctl install and some configuration changes in Virtuous Cassette manifest but decided not to.

nix:tangle ~/nix/nixos/framework-laptop-ryzen.nix
{ pkgs, ... }:

{
  powerManagement.powertop.enable = true;

  services.fwupd = {
    enable = true;
    extraRemotes = ["lvfs-testing"];
    # per Frame.work LVFS docs
    uefiCapsuleSettings = {
      DisableCapsuleUpdateOnDisk = true;
    };
  };
  hardware.rasdaemon.enable = true;
  # services.fprintd.enable = true;

  services.xserver.dpi = 204;
}

Intel 11th gen

Okay this is the first incarnation of the Framework, I think I had a batch 4 build, and it was basically fine but also really frustrating since it kept cooking DDR4 and I could never get low power suspend working right. Don't trust these kernel params.

nix:tangle ~/nix/nixos/framework-laptop-intel11.nix
{ inputs, pkgs, ... }:

{
  imports = [
    "${inputs.nixos-hardware}/framework/13-inch/11th-gen-intel"
  ];

  boot.kernelParams = [
    # if si0x below doesn't work
    # "mem_sleep_default=deep"
    # Fixes a regression in s2idle, making it more power efficient than deep sleep
    "acpi_osi=\"!Windows 2020\""
    # For Power consumption
    # https://community.frame.work/t/linux-battery-life-tuning/6665/156
    "nvme.noacpi=1"
  ];
  powerManagement.powertop.enable = true;

  services.fwupd = {
    enable = true;
    extraRemotes = ["lvfs-testing"];
    # per Frame.work LVFS docs
    uefiCapsuleSettings = {
      DisableCapsuleUpdateOnDisk = true;
    };
  };
  hardware.rasdaemon.enable = true;
  # services.fprintd.enable = true;

  services.xserver.dpi = 204;
}

I don't use fprintd since i hate configuring PAM and don't feel like figuring out how to configure it in the way i actually want to use a fingerprint reader... Consider instead how easy it was to get this laptop working, it doesn't really need special configuration.

(This page will not be included in tables of content or anything that relies on the Arroyo keywords because it's imported directly in the Virtuous Cassette morph derivation)

Resources for S0ix/Modern Standby

I really would like good low-power suspend... =mem_sleep_default=deep= means it takes like 7 seconds for my laptop to wake up.

Power management/Suspend and hibernate - ArchWiki

Linux* S0ix Troubleshooting | 01.org

How to achieve S0ix states in Linux* | 01.org

Framework 12 w/ Intel 13th gen intel

nix:tangle ~/nix/nixos/framework-laptop-12.nix
{ inputs, pkgs, ... }:

{
  imports = [
    "${inputs.nixos-hardware}/framework/12-inch/13th-gen-intel"
  ];

  powerManagement.powertop.enable = true;

  services.fwupd = {
    enable = true;
    extraRemotes = ["lvfs-testing"];
    # per Frame.work LVFS docs
    uefiCapsuleSettings = {
      DisableCapsuleUpdateOnDisk = true;
    };
  };
  hardware.rasdaemon.enable = true;
  services.xserver.dpi = 190;
}