In the article “Linux Endgame - NixOS”, I outlined my rationale and initial impressions testing NixOS on my Framework Laptop 13 (AMD Ryzen).

As highlighted in the post, NixOS is a free and open-source, immutable Linux distribution based on the purely functional Nix package manager. NixOS is composed using modules and packages defined in the nixpkgs project.

As a long-time Fedora user, the switch to NixOS has been a little jarring. In many respects, I have had to “unlearn” many common Linux workflows, such as package management, upgrades, etc.

I would also argue that the documentation supporting NixOS is not yet equivalent to that offered by the Fedora and/or Arch communities. Therefore, overcoming inevitable challenges can require more effort and research.

In part, the lack of documentation is why I decided to write this article, which aims to outline my process of installing NixOS on a Framework Laptop 13, including my common software. At this time, I have not included more advance NixOS features such as Flakes and Home Manager. However, I do intent to write about these in the future.

Framework Laptop 13

The full specification of my Framework Laptop 13 can be found below. The steps outlined in this post should work for any AMD-based Framework Laptop (including the Framework Laptop 16).

  • Framework Laptop 13 DIY Edition
  • AMD Ryzen 7 7840U (8C/16T)
  • 64GB DDR5-5600 RAM
  • 4TB Western Digital Black SN850X NVMe (7.3GB/s Read)
  • 13.5-inch LCD Display (2256x1504 @ 60Hz)
  • 2x USB4 (USB-C), 1x USB 3.2 G2 (USB-A), 1x HDMI 2.0b

Before installation, it is important to disable Secure Boot from the Framework BIOS, otherwise the NixOS installation media will not be detected. This is achieved by tapping the “F2” key at boot (not the “F12” key), which will prompt the option “Administer Secure Boot”.

With Secure Boot disabled, the first step is to download and install NixOS. Thankfully, this task is very similar to other Linux distributions, facilitated by a “live CD”, which can be used to create a bootable USB drive.

The “live CD” runs the GNOME desktop environment and includes a full GUI installation wizard, whilst also allowing you to test NixOS before the actual installation (which can help identify any potential hardware conflicts, etc.) It should be noted, that any supported desktop environment (not just GNOME) can be selected during the installation process.

By default, I recommend full disk encryption on all modern systems. Unfortunately, unlike Fedora and Pop_OS!, the NixOS GUI installer does not include a “one-click” encryption option. As a result, full disk encryption must be configured manually.

I have outlined the nine-step process to enable full disk encryption in the article “NixOS Full Disk Encryption”.

With NixOS successfully installed and following a reboot, you will be greeted by a very clean/minimal operating system, with a limited number of packages (applications) installed. By default, you do not get common applications such as LibreOffice, etc.

The unique proposition offered by NixOS is that the entire operating system, including the kernel, applications, system packages, and configuration is declared in a configuration file, using the Nix language. The primary configuration file can be found at the following location and will be used to customise the setup per your requirements.

/etc/nixos/configuration.nix


At this stage, it is worth becoming familiar with the following terminal commands. Although fairly self-explanatory, I will describe the use of these commands throughout this post.

sudo nano /etc/nixos/configuration.nix

sudo nixos-rebuild switch

sudo nixos-rebuild boot --upgrade

sudo nixos-rebuild switch --rollback

sudo nix-collect-garbage -d

sudo nix-collect-garbage --delete-older-than 30d

flatpak update -y\


Edit the “configuration.nix” file using nano sudo nano /etc/nixos/configuration.nix and add the following configuration lines to install and enable key services, specifically Fingerprint Reader, Flatpak, Docker, virt-manager, and OneDrive.

As a reference, I have made my “configuration.nix” file available on GitHub.

services.fprintd.enable = true;  

services.flatpak.enable = true;  

virtualisation.docker.enable = true;  

virtualisation.libvirtd.enable = true;  
programs.virt-manager.enable = true;  

services.onedrive.enable = true;  


The following configuration installs and enables custom fonts, including the common Microsoft fonts (useful when viewing/editing Microsoft Office documents). Any new fonts can be added to this section.

fonts.packages = with pkgs; [  
  corefonts  
  vistafonts  
  noto-fonts  
  noto-fonts-cjk  
  noto-fonts-emoji  
  liberation_ttf  
  fira-code  
  fira-code-symbols  
  mplus-outline-fonts.githubRelease  
  dina-font  
  proggyfonts  
];

fonts.fontDir.enable = true;


The following configuration installs and enables packages from NixOS Packages. Where possible, I prioritise Flatpak applications, installed via Flathub. Therefore, I only use the Nix Package Manager when an application is not available and/or viable (e.g., feature-complete, reliable or performant) as a Flatpak.

environment.systemPackages = with pkgs; [  
  wget  
  git  
  google-chrome  
  vscode  
  ollama  
];


Flatpak applications do not need to be declared within the “configuration.nix” file, as they are not part of the base image.

As a result, Flatpak applications are installed and maintained from the command line and/or GNOME Software store, similar to other GNOME-based Linux distributions. Once installed, Flatpak application icons may not appear until after a reboot. They will also need to be manually updated using the ‘flatpak update -y' command.

A full list of the Flatpak applications I use can be found in the article “Flatpak Availability”. However, for reference, the commands to install my most common applications for NixOS can be found below.

flatpak install flathub org.libreoffice.LibreOffice  
flatpak install flathub com.github.IsmaelMartinez.teams_for_linux  
flatpak install flathub com.slack.Slack  
flatpak install flathub org.mozilla.firefox  
flatpak install flathub md.obsidian.Obsidian  
flatpak install flathub org.standardnotes.standardnotes   
flatpak install flathub org.gimp.GIMP  
flatpak install flathub org.kde.krita  
flatpak install flathub org.audacityteam.Audacity  
flatpak install flathub org.videolan.VLC  
flatpak install flathub fr.handbrake.ghb  
flatpak install flathub org.openshot.OpenShot  
flatpak install flathub fr.natron.Natron  
flatpak install flathub com.obsproject.Studio  
flatpak install flathub org.gnome.Boxes  
flatpak install flathub org.filezillaproject.Filezilla  
flatpak install flathub com.getpostman.Postman  
flatpak install flathub com.heroicgameslauncher.hgl  


With the “configuration.nix” file updated, exit and save the file by pressing ‘^ + X’ (if using Nano) and run the command sudo nixos-rebuild switch. This will verify the “configuration.nix” and build/switch to the new configuration. If an issue is identified within the “configuration.nix” file, an error message will be displayed.

Finally, with the newly defined configuration operational, run the following terminal commands to finish the setup of specific services/packages. Specifically, they enable the Flathub repository, allow the custom fonts to be accessed by Flatpak applications and set up OneDrive with your Personal or Business account.

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

ln -s /run/current-system/sw/share/X11/fonts ~/.local/share/fonts  
flatpak --user override --filesystem=$HOME/.local/share/fonts  
flatpak --user override --filesystem=$HOME/.icons

onedrive  
systemctl --user enable onedrive@onedrive.service  
systemctl --user start onedrive@onedrive.service  
systemctl --user status onedrive@onedrive.service


That’s it! As a final step, it is worth running the command ‘sudo nixos-rebuild boot –upgrade’, which will install any system updates and reboot. It should also “tidy” any loose ends as part of the step, specifically the enablement of Flatpak application icons, etc.

The final point for reference is the unique rollback option provided by NixOS. Thanks to the immutable nature of the operating system, every time a new configuration is switched to running (using the command ‘sudo nixos-rebuild switch’), the previous configuration is saved.

When rebooting, every previous configuration state is made available. Therefore, if you ever encounter an issue, the process to roll back is as simple as selecting a previous working configuration.

This is incredibly powerful, but can also lead to a lot of old configurations being stored. Therefore, the terminal command ‘sudo nix-collect-garbage -d’ will delete all unused configurations. You can also specify certain criteria, for example, ‘– delete-older-than 30d’, which will delete anything older than 30 days.

In theory, NixOS should be fully operational on the Framework Laptop 13, with all hardware (e.g., Fingerprint Reader, Webcam), services and applications enabled!