Framework NixOS (Linux) users self-help

My PR for nixos-hardware to add a config for the FW13 7040 AMD was merged, so the framework-13-7040-amd profile can be used as a target now.

I submitted another PR (#776) to rearrange the folder structure for better consistency and shared configuration. It adds a framework-11th-gen-intel profile as well to replace the framework base profile that was used for the 11th gen.

9 Likes

I’m new to NixOS-- is it possible to experiment with the FW13 7040 AMD config in a VM? Or does it not work because the virutalized hardware is not the same as the host hardware?

The root question is how can I experiment with this config without fully committing to running NixOS directly on hardware? Ideally I’d like to play with a config in the VM environment, and be able to just use that same config on the FW13 7040 AMD hardware.

I mean in general, NixOS allows you to do exactly that very easily, except for the part where this specific configuration module is dealing exclusively with the hardware compatibility, so… it kinda doesn’t really make sense to “test” it on a VM rather than on the actual device. How exactly were you planning to play with it?

If you just want to play with NixOS, you can just play with vanilla NixOS in a VM / container, and then, once you decide that you like it, switch to real hardware keeping you configuration + adding that module, which will (ideally) do nothing else but guarantee that everything is smooth.

If, however, you want to experiment specifically with those hardware-related settings, I guess, you real options are installing onto a separate partition or, like, onto a USB drive / microSD / external drive and booting from there.

@gaben I’ve been running NixOS in VMware on an M1 Macbook Air for the last year or so following https://github.com/mitchellh/nixos-config’s configs. I wanted to exit from the Apple ecosystem, so I got a Framework 13 AMD. Knowing the hardware was super new, I decided to once again run NixOS via virtualization on a Framework Ubuntu Host for stability. Here’s some notes to hopefully get you started - Let me know if you have any questions, I’m happy to help – I feel I’m always going to be a nix newbie lol. I’m close to finally ironing out all the issues I’ve experienced in this setup. (Though now with the above PR merged, I’m likely to go full bare metal install with NixOS…)

VMware - I tried this initially as I was using this on MacOS; however, I hit too many performance and odd issues, so decided to try VirtualBox out.

Wayland is just kinda a no-go it seems on any virtualization program, so I switched from sway wm back to i3wm.

VirtualBox - After setting the below configs in the host and inside the VM… it’s ‘mostly’ stable and relatively performant, though I’m still trying to debug, what I expect, is a video acceleration issue (dmesg shows [drm:vmw_msg_ioctl [vmwgfx]] ERROR Failed to open channel) and performance isn’t as good as on Ubuntu when compiling or transcribing via local whisper.cpp projects I’m working on.

VirtualBox Host:

  • Setup as described in my README.md below. (You’ll need to portforward on VB 2222 host to 22 guest, if you want to install like I’m doing in my nixos-config)
  • Increase video ram (VB has a max of 128MB in the GUI and 256MB in a cli config): VBoxManage modifyvm “Name of VM” --vram 256
  • 8 core // 10GB ram
  • set display scaling to 133% (when using my resolution set, see GitHub link below)

NixOS Guest:
You can follow some of my latest commits here: GitHub - nodu/nixos-config: My NixOS configurations. Specifically looking at the machine/vm-shared.nix config:
https://github.com/nodu/nixos-config/blob/main/machines/vm-shared.nix#L72 for display resolution in xserver.

Good luck!

1 Like

fwiw, I made a video of installing NixOS on a Framework. It’s too long, badly edited, contains mistakes which I fix, and doesn’t have the fingerprint reader working yet. But it does show setting up the system with a Flake and adding the hardware quirks and SSD optimisation.

I dunno, might be useful for anyone who likes to see it to believe it.

The (very simple) config is here if you want to “skip to the end”, as it were:

6 Likes

Not sure who else this will help, but I was having wifi issues and not getting the expected performance from my hardware.

$ lspci | rg -i wireless
01:00.0 Network controller: MEDIATEK Corp. MT7922 802.11ax PCI Express Wireless Network Adapter

I perused the Arch Linux wiki and found this note:

For the MediaTek chip, you will be limited to 802.11n (WiFi 4) and 2.4GHz bands if you do not configure the regulatory domain

Which led me to this nixpkgs issue with the solution:

So I added this to my nixos config:

hardware.wirelessRegulatoryDatabase = true;
boot.extraModprobeConfig = ''
  options cfg80211 ieee80211_regdom="US"
'';

Naturally, you will want to use whatever regdomain code is relevant for your regulatory domain. After this, I’m getting much faster speeds according to fast.com and dropping no packets while doing so.

3 Likes

Since the regulatory domain would require an argument based on the user’s domain, I’m not sure exactly how we would add it there. Maybe I’ll poke around and see if there are other modules that take arguments and submit a similar PR.

1 Like

Any KDE people? I’m finding plasma5 with default KWin is chopping up my firefox window, at both default compositor settings and `switching compositor off. I want to try KDE, it’s the only time I’ve seen screentearing outside of gaming though. Is there anything we know about intel? the framework is a 13 from batch 5 (2 years old), but mainboard updated to 13th gen a couple months ago.

┬─[qd@grindenstern:~/o/p/arct]─[10:21:57 AM]─[G:main>]
╰─>$ nix-shell -p neofetch --run neofetch
          ▗▄▄▄       ▗▄▄▄▄    ▄▄▄▖            qd@grindenstern 
          ▜███▙       ▜███▙  ▟███▛            --------------- 
           ▜███▙       ▜███▙▟███▛             OS: NixOS 23.11.20231116.7414e9e (Tapir) x86_64 
            ▜███▙       ▜██████▛              Host: Framework FRANMCCP07 
     ▟█████████████████▙ ▜████▛     ▟▙        Kernel: 6.1.62 
    ▟███████████████████▙ ▜███▙    ▟██▙       Uptime: 49 mins 
           ▄▄▄▄▖           ▜███▙  ▟███▛       Packages: 2247 (nix-system), 6708 (nix-user) 
          ▟███▛             ▜██▛ ▟███▛        Shell: bash 5.2.15 
         ▟███▛               ▜▛ ▟███▛         Resolution: 2256x1504, 1920x1080 
▟███████████▛                  ▟██████████▙   DE: Plasma 5.27.9 
▜██████████▛                  ▟███████████▛   WM: KWin 
      ▟███▛ ▟▙               ▟███▛            Theme: Adwaita-dark [GTK2/3] 
     ▟███▛ ▟██▙             ▟███▛             Icons: breeze-dark [GTK2/3] 
    ▟███▛  ▜███▙           ▝▀▀▀▀              Terminal: emacs 
    ▜██▛    ▜███▙ ▜██████████████████▛        CPU: 13th Gen Intel i7-1370P (20) @ 5.000GHz 
     ▜▛     ▟████▙ ▜████████████████▛         GPU: Intel Raptor Lake-P [Iris Xe Graphics] 
           ▟██████▙       ▜███▙               Memory: 4868MiB / 64027MiB 
          ▟███▛▜███▙       ▜███▙
         ▟███▛  ▜███▙       ▜███▙                                     
         ▝▀▀▀    ▀▀▀▀▘       ▀▀▀▘                                     

The basic on-rails plasma5

{
  # imports = [ ./../greeter.nix ];
  services.xserver = {
    enable = true;

    desktopManager.plasma5.enable = true;
    displayManager.sddm.enable = true;
  };
  qt.platformTheme = "kde";
}

note: for World of Warcraft (through lutris) in particular, KDE is the least finicky desktop with respect to screentear in my experiments. I tried services.picom.enable = true; and it may haev made the WoW usecase slightly worse, but I didn’t check choppiness/tear in firefox (it could be a different question). I’m also uncertain how often I should be relogging / rebooting to test stuff like turning the compositor off and on.

The other thing about KDE is that my fan has literally not stopped running once, even when I’m on a light computational load.

also its odd that I run fwupdmgr update about once a month, it always tells me there’s nothing. Then today I do it and it offers a jump from 33 to 371 on UEFI dbx.

╔══════════════════════════════════════════════════════════════════════════════╗
║ Upgrade UEFI dbx from 33 to 371?                                             ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ Insecure versions of the Microsoft Windows boot manager affected by Black    ║
║ Lotus were added to the list of forbidden signatures due to a discovered     ║
║ security problem.This updates the dbx to the latest release from Microsoft.  ║
║                                                                              ║
║ Before installing the update, fwupd will check for any affected executables  ║
║ in the ESP and will refuse to update if it finds any boot binaries signed    ║
║ with any of the forbidden signatures.Applying this update may also cause     ║
║ some Windows install media to not start correctly.                           ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

Any downside to letting this run (it asked me yes or no)? I’ve never had fwupdmgr return any possible updates before.

Update: I ran it, rebooted, everything seems fine no noticeable difference. Still odd that it jumped from 33 to 371 so quickly, maybe the local index was wrong before.

Oh wow, what a small world. Have you tried it with wayland?

About fan — services.thermald.enable = true

I’m searching nixos options for a way to activate wayland under plasma, closest I found is programs.xwayland.enable = true;. It seems to have worked quite well, though!

EDIT: Found this on nixos wiki services.xserver.displayManager.defaultSession = "plasmawayland";

Thanks for thermald! Hadn’t seen that around.

1 Like

I made my own notes on nix, after a few months in, because the documentation is chaotic.

Hope it’d be useful here :slight_smile:

1 Like

Has anyone managed to get NixOS to work on the AMD 7040 series? I created a bootable USB for NixOS using BalenaEtcher and the KDE ISO from the downloads page. For whatever reason it shows up as

EFI USB Device (SMI USB DISK) boot failed.

When I use the same bootable USB on my 13th gen Intel it works fine (I get to the NixOS live USB menu), and also a Fedora bootable USB works fine on the 7840U (get to grub menu).

Any ideas? Perhaps there’s some BIOS thing I have to do that I may have already done on the 13th gen?

1 Like

You need to disable Secure Boot in UEFI settings.

3 Likes

That was it. I missed that setting since it’s in a different place than the rest of the BIOS Security setup (TPM etc). Thanks!

1 Like

Hi,

I received my FW13 a few weeks ago, installed the latest BIOS (3.03 as of today) and NixOS on the machine. For the most part, it works without problem apart from issues with 3D graphics on Wayland (and X, actually, but I didn’t test it thoroughly yet) - but they might be the topic of another post.

From time to time, when I’m actively using it, the program I’m using crashes, and I can’t do anything on the machine: if I go to an already open shell (because sometimes I can’t open a new one), whatever I do triggers either an “I/O error” or a “read-only filesystem” error. I can’t find anything clearly related to these failures in last boot’s journald logs - if something would have been written, it couldn’t have because of the I/O failures.

So far, I ran SMART tests on my SSD (nothing remarkable), memtest86+ (a few complete cycles) didn’t show anything either. It might come from another piece of hardware failing, but I wouldn’t know how to test it. It looks like this issue.

I have no specific problem with suspend (it can happen either anytime before or after having suspended). The only thing I’m sure about is that this failure doesn’t trigger when I’m not actively using the computer. Sometimes it runs for hours (spread over days, using it actively), sometimes it fails 5 minutes after a reboot.

I use:

  • NixOS (nixos-unstable, nixpkgs-unstable)
  • Kernel 6.1.62, by means of nixos-hardware)
  • sway (Wayland)

Is it an already known issue? What can I do to troubleshoot further? I can provide more information if needed.

6.1 is old and has known issues with the newish hardware in the fw13 - I don’t know how nixos handles kernels but if you can ideally get onto a 6.7 branch or 6.5 distro kernel (the one in fc39 is mostly ok) you’ll be in a better place.

1 Like

Based on you saying that you installed bios 3.03, I assume you have the AMD one, but that topic is from Intel, so probably not something AMD-specific.

Also, I have SN770 1Tb and I’m not experiencing anything like this. I also highly doubt that it is related to NixOS in anyway, so I would probably ask in some other thread, where others, not only NixOS users, will see it. Given your symptoms, though, it does sound like hardware, so, like, I don’t know, have you tried removing the SSD and plugging it again? If you can, borrow another SSD from a different laptop or a friend and try with it. After this, probably, the only thing left is contacting the support.

1 Like

Thanks for the answers. I have the AMD board indeed - it was stated in the title of the post I created but disappeared on merging :smiley:

I used kernel 6.6 for a while, but it didn’t make the problem disappear (though it seems that it happened less frequently). I installed 6.5 as mentioned, we’ll see if it helps the problem go away - 6.7 is not easily available on NixOS yet. I also found some information mentioning bootargs for randomly disconnecting NVMe drives, like in this issue. That might be my problem though I can’t troubleshoot it as no logs are written anywhere (neither dmesg not journald work at this point, and after rebooting, journald -b -1 doesn’t have anything incriminating written in it). I’d like to try these bootargs out, do you have any more information about them and how they could be relevant?

If ever this is useful, my drive is a WD Blue SN550 1 TB. I just updated it to the last firmware, maybe the older firmware was part of the general problem.

FWIW, while 6.7 doesn’t even technically exist yet, on NixOS unstable you get 6.7-rc2 in linuxPackages_testing. Of course, then you’re running an RC kernel, which is most of the time okay, but can cause a lot of damage in the unlikely case something goes wrong.

2 Likes