NixOS: Enabling LXD virtual machines using Flakes

Nixpkgs is an ever-increasing collection of software packages for Nix and NixOS. Even with more than 80,000 packages, you easily run in a situation where there is a functionality that is not yet implemented.

Earlier this year, we wrote a tutorial on how to implement your own package in NixOS. The implementation of the package in the system was tedious and required keeping track of the package you wanted to implement.

Let’s dive into a practical example: LXD is a container and virtual machine manager. It endorses virtual machines natively since LXD 4.0. However, running on NixOS breaks the feature, and we have to find workarounds to use it. To allow LXD to start virtual machines on NixOS, we need a fix, and we want it to be both reproducible and portable.

To do so, we are using the lxd-agent feature which effectively fix the aforementionned issue. It was released by astridyu, a contributor to nixpkgs. It has not yet been implemented in the Master branch of nixpkgs and is, as of 19/04/2022, a pull request.

Our goal is to integrate the pull request to our nixpkgs to be able to start virtual machines. For this, we will use Flakes. It is an experimental feature of the Nix package manager that allows reproducibility in the deployment of dependencies. We use it to assemble different nixpkgs together. It is a trait known as composability.

If the pull request has been merged, this tutorial becomes

Read more
Framework laptop with NixOS, a user feedback

A new job comes with a new laptop. As such, I was given a Framework Laptop DIY Edition with the objective to install and configure it entirely with NixOS. I will share my first impressions after receiving and opening the box, sharing my personal feedback on the hardware. Then, I will go through the various pitfalls I encountered with the installation of NixOS on a Framework Laptop DIY Edition so that you can be up and running in no time.

If you are not familiar with Framework computers, that’s OK. The Framework laptop is relatively new to the market as it was introduced in 2019. What makes the Framework laptops unique is the fact that its parts are easily upgradable, repairable and customizable by the end-user. On order, the DIY edition provide various options to configure your machine, choosing between the operating system, the processor, the memory and the disk types. The configuration can further be extended with pluggable expansion cards providing a large choice of connectivity as well as extra storage. This flexibility is not just about customization, it also extends the lifespan of your machine as it can be upgraded with with needs, requirements and expectations over time.

Assembling the hardware

Once your order arrives, it is hard not to notice how light the box is. When you open it, you can appreciate the laptop, parts, manual, a very compact charger, 4 independently packaged expansion cards and a handy screwdriver that makes the assembly a breeze.

Read more