Photo - Kobi Li
Photo

Hoverbear

Nix

Declarative GNOME configuration with NixOS

Using Home Manager to declaratively set key desktop environment knobs.

I adore tinkering with my machine, trying new tools, extensions, themes, and ideas. When I was younger, it was simply a way to learn. Now, it's a way for me to refine my workspace and bring myself small joys.

While tinkering can be fun, it can be a chore to set up a new machine, keep configurations up to date between machines, or even just remember to keep up to date backups. We've previously explored how to create Configurable Nix packages, which solves the problem for things like neovim, but what about when a package isn't practically configurable?

What about when we want to configure a whole desktop environment? While NixOS offers configuration settings like services.gnome.gnome-keyring.enable for systemwide features, there's a void of knobs when you want to set things like user-specific GNOME 'Favorite Apps' or extensions.

Let's explore a useful addition to your NixOS configuration: Home Manager and its dconf module.

Continue reading...

Configurable Nix packages

Let your users bring their settings with them.

The vim and neovim packages in Nixpkgs allow users to set custom configuration, including their customRC and any plugins they might want.

How do they accomplish it?

In this article, we'll explore how to create packages with similar behavior. We'll create a simple Rust app that consumes a configuration file, then create a Nix flake containing both an unwrapped binary package as well as a configurable package.

Continue reading...

A Flake for your Crate

Creating a Nix Flake for your Rust crate.

Nix (PDF) provides users a way to access the massive Nixpkgs library of packages, create reproducable builds of software, roll slim containers, create declarative VMs, or run their whole machines. A new feature of Nix, Flakes, is bringing a convention to how projects like Rust crates can be accessed, integrated, and used within Nix (or NixOS.)

Let's explore how we can make our Rust crate usable as a Nix flake. At the end of this, any nix user with Flakes enabled should be able to run your project with something like nix run github:user/project. They'll be able to add your repository as a Nix overlay, install the package, do interactive builds, or create a portable bundle of it.

Continue reading...

Using rust-bindgen in Nix

Getting things linking.

While building the Nix packages for pl/Rust I bumped into a curious issue: I couldn't link to stdio.h, or stdbool.h! They were clearly on my path, too.

It flummoxed me for quite some time, but exploring the firefox package led to a way forward. It was rust-bindgen not finding libraries!

Continue reading...

Custom live media with Nix flakes

How to make live media with Nix flakes.

I've always been quite fond of booting live media. To test or install a new operating system, to recover an old one, find some privacy, or to do a myriad of other specialized tasks. LiveUSBs and liveCDs introduced to me a new way of thinking about my computer.

It improved my mental model of the separation of between the machine, the UEFI (or BIOS), any bootloaders, and the operating system itself.

As I learnt about them over 15 years ago I spent months exploring ways to use them. I used them to rescue systems for myself and others, diagnose hardware, recovery files, and quickly set up machines.

With Nix flakes, we can define a custom live system and build it with minimal steps. This NixOS live system which could be a composition of existing NixOS modules, or an entirely new configuration.

Continue reading...
5ada95b33393c3fbd6d7705652aa535f2a01e152