NixOS on the Framework (blog review)

https://grahamc.com/blog/nixos-on-framework

8 Likes

Receiving my laptop this weekend. Will use this to install NixOS in it. Thank you!

I plan on doing the same, if you haven’t installed nixos before I highly recommend setting up a virtual machine with it that way you have some what of a configuration ready for it. Typically that’s what I do even when I have the machine I will test out my configurations from time to time to make sure the procedure hasn’t changed much.

If you do have a configuration prepared then YAY :tada: and congrats on your new laptop :smiley:

Just learned a little about what NixOS is. I’m intrigued now. I’m probably going to try this out even though on the outside it looks daunting, however the concept of it is extremely appealing considering that if you screw something up, its so easy to revert back to older versions. And OMG…that config file…refreshing to see this. While I wait for my Framework, I’m gonna edumacate myself on the Wiki.

1 Like

I recommend you check out this series of videos on youtube and use something like virtualbox to get yourself somewhere to learn about it.

1 Like

Thank you. I did a fair amount of reading last night and watched someone else’s YouTube videos on it but I’ll definitely watch these as well. And VirtualBox is my friend, especially with distros I’m not familiar with.

Here’s another review of NixOS on the Framework, from a Mozilla developer: NixOS on Framework laptop

3 Likes

NixOS is quite fascinating. Wonder if one can game on it. Will look at those reviews as well.

Yes you can game on it, it’s linux so pretty much anything you can do on linux you can do with NixOS :smiley: .

I have gone ahead and created an easy configuration file that could be imported into the main configuration after the initial creation of the configurations.

save this as framework.nix in /etc/nixos/

add ./framework.nix to the import block at the top of the configuration.nix file.

This was tested with the unstable iso of plasma5, it’s just what I had on hand after testing all weekend and on Monday.

Quick over of what the configuration has:
Linux Kernel 5.15.1
default sleep is set to deep via kernel parameters
Enable Bluetooth, Fingerprint, Networking, Thermal data, TouchPad
Pipewire for audio
Additional OpenGL packages
PowerManager with PowerTop and setting it to ondemand.

If there is a need or interest I could provide an installer ISO that would have the kernel already built in and the configs above.

3 Likes

I’m interested in the installer ISO with an updated kernel and the configs. Can’t wait to give NixOS a try when the laptop finally gets here.

I’ll get an ISO created and uploaded sometime this weekend. Currently working on the sleep problems with all the kernels.

5.15.2 was released today and it works great as well but just as most of the 5.14 kernels (and 5.15.1) it has waking up from sleep. Just some really weird quirks with the DE.

My batch 5 is shipping any second now, I’m looking forward to rolling nixos! Thanks for your gist-- looks like you saved me some troubleshooting.

Congrats! :slight_smile:

I might be changing up the gist to update it for the new kernel after I have done some testing and adjust some of the setting since sleep with linux is really wonky with the Framework in general, something that won’t be solved for now.

Is anyone using ZFS with Nixos?

I installed using the ISO linked from Grahamc’s blog post, setup my hard disk with ZFS, and build a system successfully with an extremely minimal configuration.nix file.

Then when I copied over my actual configuration.nix file and tried to build it, I got an error stating that zfs-kernel-2.0.6-5.15.2 is marked broken.

Is there any workarounds for ZFS and kernel 5.15.2? Or is there another kernel version with ZFS support that is known to work on the framework?

EDIT: Looks like kernel 5.14 is good. I’m installing now and will report back if I have any issues.

I’m following Graham Christensen’s tutorial at the top of this thread, and I can’t replicate a critical step

[nix-shell:~/Downloads/temp]$ nixos-generate -I nixpkgs=channel:nixos-unstable --format iso --configuration ./custom-media.nix 
error: Package ‘zfs-kernel-2.1.1-5.15.2’ in /nix/store/adz4qwqgl44zbvbm53vw4lf3hqyxa65f-nixexprs.tar.xz/pkgs/os-specific/linux/zfs/default.nix:195 is marked as broken, refusing to evaluate.

a) To temporarily allow broken packages, you can use an environment variable
   for a single invocation of the nix tools.

     $ export NIXPKGS_ALLOW_BROKEN=1

b) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

(use '--show-trace' to show detailed location information)

Anyone run into this?

Not sure I’ll be able to build without NIXPKGS_ALLOW_BROKEN=1 nixos-generate -I nixpkgs=channel:nixos-unstable --format iso --configuration ./custom-media.nix re the broken zfs situation. I’ve tried to grok nixos-generate -I more, it hasn’t helped. Is it a bad idea to install an OS with a broken version of zfs?

I’m reading instructions here, should Framework users follow UEFI (GPT) instructions or Legacy Boot (MBR) instructions?

Are you saying if I build an .iso with kernel 5.14 rather than 5.15 it won’t have the broken zfs? How do I enforce that? I’m assuming you used nixos-generate

Oh so many questions :stuck_out_tongue_winking_eye:

I do not use ZFS on the framework or with NixOS currently. I am sure it is possible but I personally feel more comfortable using something that is better supported (EXT4, BTRFS, or in my case XFS). Personal preference though.

@Quinn_Dougherty you are getting that error because the kernel (package) has been marked as broken. Yes it is a bad idea to install with broken packages.

Any modern system should be using the UEFI method for installing.

The best thing to do is grab the latest stable or unstable iso, there should be no need to generate a custom iso. A lot has changed in the last week with the packages in stable/unstable. Over the weekend I used the latest stable ISO to build my system and it worked just fine, was my test before I went and created another ISO.

In your configuration.nix file add these lines

boot.kernelPackages = pkgs.linuxPackages_5_14;

environment.systemPackages = with pkgs; [
    zfs
  ];

When you run nix-install that should grab the latest 5.14 kernel and the required zfs kernel modules. Let Nix figure out what you need instead of hunting for kernels that have zfs burned into the kernel.

Let me know if you have any more questions, more than happy to help out.

1 Like

Interesting, thanks @digitalknk. I’ll take a look at that if I need to.

Instead, I built my own .iso following Graham Christensen’s instructions modulo one small detail a friend provided me with: a custom-media.nix file that looks like this

quinn:temp$ cat custom-media-gnome.nix 
{ pkgs, modulesPath, ... }: {
    imports = [
        "${modulesPath}/installer/cd-dvd/installation-cd-graphical-gnome.nix"
    ];

    # boot.kernelPackages = pkgs.linuxPackages_latest;
    boot.kernelPackages = pkgs.zfs.latestCompatibleLinuxPackages;
}

Optimistic this will work.