> ## Content Index
> Fetch the complete content index at: https://blog.matthewbrunelle.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Setting up my new Framework Laptop 13 DIY Edition with NixOS
- URL: https://blog.matthewbrunelle.com/setting-up-my-new-framework-laptop-13-diy-edition-with-nixos/
- Published: 2025-08-27T01:40:45.000Z
- Updated: 2025-09-02T21:39:56.000Z
- Description: Declarative partitioning with Disko, hibernate with LUKS, and Lanzeboote, oh my!
- Author: Matthew Brunelle
- Tags: Framework, Thoughts, NixOS

#### On this page

I've used NixOS for year, yet I've never written about the experience before. This month I sold my 2021 M1 Max Macbook Pro and bought a Framework 13 DIY Edition laptop. After I got everything setup I sat down to write about the experience. Some \~4500 words later I realized I needed to break my thoughts into multiple posts. This one covers my perspective on setting up the software side.

See also:

- [Framework 13 DIY Edition Hardware Thoughts](https://blog.matthewbrunelle.com/framework-13-diy-edition-hardware-thoughts/)
- [I'm a laptop weirdo and that's why I like my new Framework 13](https://blog.matthewbrunelle.com/im-a-laptop-weirdo-and-thats-why-i-like-my-new-framework-13/)

---

This post is not:

- a general NixOS install guide. Please use the [NixOS manual](https://nixos.org/manual/nixos/stable/?ref=blog.matthewbrunelle.com#sec-installation).
- a guide for installing NixOS on Framework laptops. NixOS is a [community supported](https://discourse.nixos.org/t/exciting-partnership-announcement-framework-community-nixos-communities-join-forces/44640?ref=blog.matthewbrunelle.com) distro for NixOS. So please use Framework's [NixOS on the Framework Laptop 13](https://guides.frame.work/Guide/NixOS+on+the+Framework+Laptop+13/400?ref=blog.matthewbrunelle.com) guide and the [NixOS wiki](https://wiki.nixos.org/wiki/Hardware/Framework/Laptop%5F13?ref=blog.matthewbrunelle.com).
- a Framework 13 DIY Edition setup guide. Please use the [Framework Laptop 13 (AMD Ryzen™ AI 300 Series) DIY Edition Quick Start Guide](https://guides.frame.work/Guide/Framework+Laptop+13+%28AMD+Ryzen%E2%84%A2+AI+300+Series%29+DIY+Edition+Quick+Start+Guide/404?ref=blog.matthewbrunelle.com).

What this post is:

- I haven't had a Linux laptop for a bit and wanted to share some laptop specific configuration changes I made to my setup.
- I tried out some new things and wanted to share the solutions to stumbling blocks I found.
- Talking a bit about having a single NixOS config for multiple machines.

---

### Prepping the live install usb and booting up

I usually use Balena Etcher to setup a live USB for installs. The stable version of the NixOS manual even [suggests](https://nixos.org/manual/nixos/stable/?ref=blog.matthewbrunelle.com#sec-booting-from-usb) using Etcher. However, based on this [issue](https://github.com/NixOS/nixpkgs/issues/153537?ref=blog.matthewbrunelle.com#issuecomment-2461136259), the program has not been included in nixpkgs for a while due to using an out of date Electron version. The issue suggests using Popsicle instead, but you could also just use dd and the manual suggests.

To boot from a live USB for install you need to [disable secure boot](https://github.com/FrameworkComputer/linux-docs/blob/main/misc/secure-boot.md?ref=blog.matthewbrunelle.com#how-to-disable-it-if-you-choose-to) first. Don't worry, you can re-enable secure boot later. I also had an issue with the laptop not detecting my USB. The Framework laptops use [expansion cards](https://knowledgebase.frame.work/what-is-an-expansion-card-SkdG4Hw%5Fu?ref=blog.matthewbrunelle.com) for the ports. I removed and reinserted my USB A card and suddenly my USB drive was detected. So perhaps the expansion card was not detected.

When I finally booted from live USB, I couldn't authenticate to my home wifi. I had a usb to ethernet adapter I used instead. Weirdly enough after installation I've had no issue with wifi.

I was tempted to try out [nixos-anywhere](https://github.com/nix-community/nixos-anywhere?ref=blog.matthewbrunelle.com) this time, but I was very excited and just dove in instead.

---

### Partitioning with Disko, finally quick BTRFS on LUKS

I usually am pretty boring when I partition my desktop. Just a simple EFI partition, a single ext4 partition, and a swap partition for hibernate. Simple is easy to setup and diagnose if something goes wrong.

However, I've wanted to try [Disko](https://github.com/nix-community/disko?ref=blog.matthewbrunelle.com) out for a while now. Not only is a declarative parition description appealing, but also I can be lazy and avoid typing all the commands to setup my disk. In fact I felt empowered to try a new partition scheme thanks to Disko.

The project has a whole folder of [example](https://github.com/nix-community/disko/tree/master/example?ref=blog.matthewbrunelle.com) configurations. I chose to start with the [luks-btrfs-subvolumes.nix](https://github.com/nix-community/disko/blob/master/example/luks-btrfs-subvolumes.nix?ref=blog.matthewbrunelle.com) example. The only changes I had to make where:

1. Updating `devices` to match my nvme drive
2. Changing the swapfile size to match my ram size. That way I can use hibernate.
3. Removing the `settings.keyFile` as noted by a comment in the file. I want to use an interactive password instead.

Thats everything! Basically in five minutes with no prior experience I was able to use the [quickstart guide](https://github.com/nix-community/disko/blob/master/docs/quickstart.md?ref=blog.matthewbrunelle.com) and have BTRSFS on LUKS setup. Also, don't forget to swapon the swap file before you run `nixos-generate-config` so your configuration includes the swap device.

---

### Installing NixOS and handling multiple machines in a single configuration

The install process was pretty standard. I did not use the GUI installer and instead used the [manual](https://nixos.org/manual/nixos/stable/?ref=blog.matthewbrunelle.com#sec-installation). Also, I think I just totally missed this addition, but the `nixos-install` command now has a `--flake` option! I've been installing without and then converting to flake based installs this whole time...

Once the install command finished I rebooted. Then I just needed a quick git pull to get my configuration, a rebuild and then everything felt like home. My current [current iteration](https://github.com/ciferkey/NixOS-Config?ref=blog.matthewbrunelle.com) configuration is based off [nix-starter-configs](https://github.com/Misterio77/nix-starter-configs?ref=blog.matthewbrunelle.com). The only host I had configured was my desktop. However if you add a new `nixosConfigurations.<hostname>` entry in your `flake.nix` you can have different configurations for each host.

I'm due for a revamp and cleanup to my current configuration. For now I extracted the couple of desktop specific configuration details into their own `desktop.nix` file that is only imported by my desktop configuration. I then duplicated all the general configuration under a directory for my laptop's hostname. Going forward I'll work on pulling common pieces out into their own modules. \[^ I don't want to go too crazy with that though. I did that in the past and ended up with too many modules which felt cumbersome.\] I also realized that there is now an [issue](https://github.com/Misterio77/nix-starter-configs/issues/86?ref=blog.matthewbrunelle.com) in the nix-starter-configs repo that the project needs a rework. So I may try to migrate off of to something simpler.

---

### Hibernation using a swapfile with BTRFS on LUKS

Remember when I mentioned I usually do the boring thing for disk partitions? Hibernate is a great reason why. OK, I'm being a little hyperbolic, but hibernation is something I'd really like on a laptop for powersavings and LUKS complicates the process.

If I had used a swap partition I would just need to point `swapDevices` to the partition. Instead we have a swapfile on BTRFS *inside LUKS*. The wiki page on [hibernation](https://nixos.wiki/wiki/Hibernation?ref=blog.matthewbrunelle.com) recommends the following:

```nix
boot.kernelParams = ["resume_offset=<offset>"];

boot.resumeDevice = "/dev/disk/by-uuid/<uuid-of-root-partition>";

powerManagement.enable = true;

swapDevices = [
  {
    device = "/var/lib/swapfile";
    size = 32 * 1024; # 32GB in MB
  }
];

```

Where you need to figure out the offset for your swap file using `filefrag`.

However based on a conversation in the [forums](https://discourse.nixos.org/t/is-it-possible-to-hibernate-with-swap-file/2852/7?ref=blog.matthewbrunelle.com), since release 24.05 you only need to enable initrd systemd and set the swap device:

```nix
boot.initrd.systemd.enable = true;
swapDevices = [{
  device = "/var/lib/swapfile";
  size = 32 * 1024;
}];

```

Systemd determines and handles the offset for you. What's more `powerManagement.enable` [defaults](https://search.nixos.org/options?channel=unstable&show=powerManagement.enable&query=powerManagement.enable&ref=blog.matthewbrunelle.com) to true and can be omitted.

---

### I was afraid of trying secure boot, but that was unfounded

I have never set up secure boot on Linux before, and I'm happy to report the process was painless!

I found this post [Framework and NixOS - Secure Boot (Day Three)](https://0xda.de/blog/2024/06/framework-and-nixos-secure-boot-day-three/?ref=blog.matthewbrunelle.com) which pointed me towards Lanzaboote. Then I found this FOSDOM 2023 presentation [Towards Secure Boot for NixOS](https://archive.fosdem.org/2023/schedule/event/nix%5Fand%5Fnixos%5Ftowards%5Fsecure%5Fboot/?ref=blog.matthewbrunelle.com) which explains how Lanzaboote works. Some notes from the talk:

- automatically handles signing everything when you when you do a nixos rebuild
- provides a stub to help prevent the EFI parition from running out of space when you have many generations
- you have to handle key generations and rerollment once

Also this lovely quote:

> I've heard that it works for other people... I have also heard it did not work for other people.

Thankfully in the time since then the project has improved. I simply followed the [quick start guide](https://github.com/nix-community/lanzaboote/blob/master/docs/QUICK%5FSTART.md?ref=blog.matthewbrunelle.com) as prescribed. The guide even includes specific details for Framework Laptop users.

Also note this warning:

> To be able to setup Secure Boot on your device, NixOS needs to be installed in UEFI mode and [systemd-boot](https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/?ref=blog.matthewbrunelle.com) must be used as a boot loader. This means if you wish to install lanzaboote on a new machine, you need to follow the install instruction for systemd-boot and then switch to lanzaboote after the first boot.

I used the flakes option when installing rather than the niv option. Also, make sure to [set your UEFI password](https://knowledgebase.frame.work/setting-a-bios-password-SkEuDB7Blxk?ref=blog.matthewbrunelle.com).

![image.png](https://blog.matthewbrunelle.com/content/images/2025/08/image.png)

---

### Linux on Laptops seems simpler now

In the past I feel like I had a whole laundry list of items to attend to when installing Linux on a Laptop. Now in 2025 there really isn't that much tweaking to do compared to a desktop. No mucking about with TLP or anything. The Framework knowledge base [recommends](https://knowledgebase.frame.work/en%5Fus/optimizing-ubuntu-battery-life-Sye%5F48Lg3?ref=blog.matthewbrunelle.com):

> For Framework Laptop 13/16 AMD Ryzen™ 7040 Series configurations, you will absolutely want to use power-profiles-daemon for the absolute best experience. **Do NOT use TLP**. Without getting too detailed, there are things happening behind the scenes that require PPD for the best experience for our Linux customers. \[^ They have not said if this applies for the AMD 300 Strix AI series, but in absence of clarification I'm avoiding TLP.\]

The whole experience is.... peaceful? I still get to tweak a lot of things. Just less of the fiddly bits. I dig it.

I've literally never done a ~~neofetch~~ fastfetch before, but I'd like to end on a cliche:

![fastfetch.png](https://blog.matthewbrunelle.com/content/images/2025/08/fastfetch.png)