Framework NixOS (Linux) users self-help

Hi everyone! Feel free to read my daily driver https://github.com/quinn-dougherty/configuration.nix/tree/main/framework

Ping me if you need any help it seems like I might have experience.

2 Likes

A few of the most complete nix documentation I rely on:

I donā€™t know if this is correct place but since this looks like an open discussion of nix over framework laptop, Iā€™m asking for inputs on a new RFC I recently made:

Any public opinion matters!

Thank you :smiley:

1 Like

I could probably use some help if anyone is willing. I installed NixOS on my 13" and didnā€™t even think to check the forums here. But I basically have the single config file. Havenā€™t delved into flakes yet. Was thinking that may just complicate things more before I got a grasp of how everything works.

But Iā€™ve been having a bunch of issues.

The system wont auto-boot. It shows the generations but doesnā€™t select one automatically even though those settings werenā€™t modified in configuration.nix.

I cannot get my egpu working with my 3090 no matter what I try. System always gets all jerky and low frame rates even when setting it up as prime. And offload doesnā€™t work.

I am thinking about doing a new install to see if that fixes any issues. Which is what made me come and and search to see if anyone else has been using NixOS.

So if anyone has some time I could probably use some help doing it a better way this time around. :smiley:

Fingerprint wonā€™t work in NixOS even with hardware config file in NixOS-hardware

Someone please make a script for NixOS that clears the fingerprints I beg lol

@Matt_Hartley had linked this post above where you can use a flake:


I think it worked? The storage being cleared part of it.

Below are the additional lines I set this morning into /etc/nixos/configuration.nix (and rebooted) when I was at 95% battery. After logging back in, loading up all my usual apps in gnome40, I shut the lid and when opening again 7+ hours later was at 88%. This is a huge improvement for me as before Iā€™d have found it at 20% if lucky.

  # Ensures lid-close leads to a sleep I actually expect, that doesn't drain my battery.
  # "S3" here refers to Suspend-to-Ram of Intel's si0x documentation:
  # https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/reference/energy-analysis-metrics-reference/s0ix-states.html
  # Lines below taken from https://github.com/NixOS/nixos-hardware/blob/488931efb69a50307fa0d71e23e78c8706909416/dell/xps/13-9370/default.nix
  #
  # Force S3 sleep mode. See README.wiki for details.
  boot.kernelParams = [ "mem_sleep_default=deep" ];

Hope this helps someone else!

10 Likes

Nice tip!

1 Like

Thank you!

1 Like

@jon

do you happen to use systemds hybrid-sleep feature? I keep seeing the large energy consumption during hybrid-sleep even with your fix (running nixos 23.05).

I do use hybrid-sleep my because framework keeps consuming that much power during sleep and hybrid-sleep ensures my RAM content isnt lost when the battery is drained.

This would be helpful for other NixOS users, rolling this into the existing thread to maintain visibility for those who may not know about this thread.

Do you have a command I could run in order to determine what my mode is? Happy to run it and get back to you.

my original PSA here about `mem_sleep_default` is wrong~ish

tl;dr anyone who comes across this big, unified nixos+framework thread that Mattā€™s kindly maintaining is a prime candidate to at least read the configs nixos-hardware/framework at master Ā· NixOS/nixos-hardware Ā· GitHub (and consider using them per the README, if not also contributing).

new PSA for nixos users (particularly new-to-nixos like I am)

I donā€™t have edit access to that^ post anymore, so Iā€™m starting a new PSA for nixos users: donā€™t use^ this tip. Or rather, you probably donā€™t want that tip, and instead use the more robust route maintained by other folks for you: the nixos-hardware project :tada: ā€¦ by doing this:

  1. figure out your framework laptopā€™s ā€œgenerationā€; for me itā€™s ā€œ11thā€ genā€¦
    there must be a faster way to look up your generation? eg: via order page? but whatever, hereā€™s steps I usedā€¦
      1. Framework | Sign in ā†’ find your laptop
      1. under ā€œorder summaryā€ the ā€œconfigurationā€ field shows your chipā€™s identifier (for me itā€™s i7-1165G7)
      1. load Framework | Framework Laptop Comparison
      1. ctrl+f for your chip from step 2
      1. scroll down to ā€œprocessor optionsā€ table (this will force a header-row to float down with generation indicators)
      1. for me i7-1165G7 shows ā€œ13 (11th Gen Intel Core)ā€
  1. lookup your framework generation in the table here GitHub - NixOS/nixos-hardware: A collection of NixOS modules covering hardware quirks. (stable link) (ctrl+f for framework)

  2. follow GitHub - NixOS/nixos-hardware: A collection of NixOS modules covering hardware quirks. (stable link) which Iā€™ll summarize here for convenience:

    1. add and update the nixos-hardware nixos ā€œchannelā€ by running:
    sudo nix-channel --add \
        https://github.com/NixOS/nixos-hardware/archive/master.tar.gz \
        nixos-hardware
    sudo nix-channel --update
    
    1. copy the string on the right side (for me it was <nixos-hardware/framework>; for you it might be <nixos-hardware/framework/13th-gen-intel>); letā€™s call it $YOUR_FRAMEWORK_STRING

    2. pull up your configuration.nix and add string from step 3:

      1. find the spot in your configuration.nix that looks like:
      imports = [
        ./hardware-configuration.nix
      ];
      
      1. add $YOUR_FRAMEWORK_STRING in that list
      imports = [
       $YOUR_FRAMEWORK_STRING # for me this line is: <nixos-hardware/framework>
       ./hardware-configuration.nix
      ];
      
  3. see if this is workingā€¦

    1. unset previous hand-made changes for framework (eg: comment out my PSA about mem_leep_default=deep)
    2. force set the new changes: sudo nixos-rebuild switch --upgrade
    3. reboot to be sure allā€™s well

I think itā€™s self-explanatory why a collective of configurations is better than hand-maintaining duplicate versions on your own (and likely not as complete). If you want to see what your generationā€™s nixos-hardware configuration is in this repo, click into your subfolder here: nixos-hardware/framework at master Ā· NixOS/nixos-hardware Ā· GitHub (stable link)

If youā€™re curious why the 11th gen does not have mem_sleep_default=deep line any longer, see this PR: framework laptop 11th gen: Improve sleep power efficiency by obj-obj Ā· Pull Request #717 Ā· NixOS/nixos-hardware Ā· GitHub.

(I really wanted to make this a separate post for higher visibility, but as itā€™s been merged into this thread, Iā€™ll leave it be)

but why did you post the tip above then? doesn't it work?

Yes the original tip works, but I just didnā€™t look closely at the larger repo when I copied that xps13 config (until now). If youā€™re reading this and youā€™re a nixos expert, please comment with more guidance (and/or confirmation even). I certainly didnā€™t figure this out via any official nixos docs/wiki (wouldā€™ve been nice), so I feel like I should document how I stumbled upon thisā€¦

  • I recently loaded this old mem_sleep_default=deep post and looked at the original github link in my inline-comment, to jog my memoryā€¦
  • I commented out my own PSAā€™s fix, and following this nixos-hardware repoā€™s instructions (summary above)
  • I rebooted my machine and tested
    • :white_check_mark: sleep works as intended (shut lid mid-workstream, had 98% battery; 3 hours later had 97% battery)
    • :white_check_mark: improvement: to take advantage of this fprintd default already set (stable link), I tested fingerprint unlock (after running fprintd-enroll), and confirmed gdm3 and sudo both behave as expected. This hadnā€™t actually worked for me for a long time.

Edit: lol nixos-hardware called out in the third post on this uber thread :slight_smile: Well, I guess Matt merging everyone in here will decrease likelihood folks like me will miss it :+1: (Iā€™m clearly not the only one, since folks appreciated my one-off tweak). Edit2: typo in bulletsā€™ nestings

3 Likes

Yeah I was pondering the same the other day, given the various success and failure stories with different Linux distros around here.

Maybe a small script that checks the relevant settings from /sys to report what has been configured correctly or not.

EDIT

While I generally agree a central collection being helpful, itā€™s also highly specific to NixOS at a current point in time, because modules like nixos-hardware are merged with the ā€œbuiltinā€ modules that a NixOS release ships with. And due to how merging works the magic happens because of the sum of all the modules.
A form of magic where the outcomes is really hard to translate into the non-NixOS world.
I guess this is kinda a rant-like argument for my idea above - the checkscript.

Dang, thanks for all the digging @jon. I was already using nixos-hardware but didnā€™t realize PR #717 was created.

Hey friends ---- a situation emerged approaching the 2-year mark of daily driving my batch 5 with my power button.

I donā€™t know if itā€™s battery or button press, but basically it has no way of turning on without being plugged in. Also, it will interpret the moment of plugging in as ā€œpower onā€, so the button is effectively doing nothing.

I can unplug it after boot sequence starts and things are basically fine. (battery life is of course not super great, but I havenā€™t invested a lot of time into optimizing my OS for that).

Anyone have ideas or advice?

Is there some reason you suspect this behaviour is related to NixOS?

Always test against a live USB of Fedora or Ubuntu LTS. If the power behavior is not present there, itā€™s your config. If it is present in the live environments, then Iā€™d open a ticket and link to your thread here pointing out clearly you did indeed, test the Live USB approach to triage.

Hey, all! Let me know if a separate thread would be preferable and Iā€™ll post elsewhere.

Iā€™m trying to install NixOS on my Framework 13 with a Ryzen 7640U mainboard, but cannot get the ISO to boot from my USB drive. Fedora Workstation 39 Beta booted just fine from the same flash drive and I ddā€™d the ISO to the flash drive the same way:

dd if=$ISO of=/dev/sda status=progress bs=1M

Iā€™m guessing the issue has something to do with the way the ISO boots. NixOS, to my knowledge, boots in a different way than other distros, but I have another system that can boot off this drive, so I would consider this a bug in the BIOS. Correct me if Iā€™m wrong!

The BIOS of the 7640U mainboard as of today is on 3.02, which I understand has issues with certain Linux kernels, but I tried building my own NixOS ISO using Linux 6.5.7 (the Fedora install currently on it is 6.5.6) and that didnā€™t seem to resolve the issue in any way. The USB drive still does not boot on the Framework but does boot on my current laptop, a Lenovo T480.

For anybody interested, the flake for this is here (you can build it with nix build git+ssh://gitea@git.lyte.dev/lytedev/foxtrot-nix#nixosConfigurations.live.config.system.build.isoImage) and its worth noting that I stripped all the NixOS kernel patches since they were incompatible with 6.5.7.

Iā€™m guessing my next step is to go ahead and try GitHub - nix-community/nixos-anywhere: install nixos everywhere via ssh [maintainer=@numtide] to convert the Fedora installation into a NixOS one?

Either way, Iā€™d love to know that my shiny, powerful new laptop will boot my bootable media, even if it is kind of wacky. Ultimately, Iā€™m very much wanting to run NixOS on this thing since I run it everywhere else. I know itā€™s not officially supported, but I also know that there are other people out there that will want this like me and Iā€™m willing to put in effort on my end to make it happen, but I suspect weā€™re stuck waiting on the 3.03 BIOS upgrade to hopefully fix this bug (even though the official reason for the BIOS upgrade seems mostly related to amdgpu graphics driver issues). That thread is here for posterity: Laptop 13 AMD Ryzen 7040 BIOS 3.03 and driver Release

3 Likes