Ephemeral NixOS with ZFS and flakes, dual-booting with Windows

I had a need to get a NixOS install working on a machine which already had Windows, without removing Windows. Since it’s not fun if there’s no difficulty, I decided to also have tmpfs as /, tmpfs as /home, ZFS for persistent storage, and do it all with a Flake.

This repository has the example, configuration. I’ve written up the instructions in the README and as a number of comments in the various Nix files, those requiring action are marked with TODO:.

Portions of this guide are from Byron Gibson’s gist for a similar setup, with the flake-based organization following Gabriel Fontes’ “Nix Starter Configs” standard template, portions from Elis Hirwing’s tmpfs as root and tmpfs as home articles, and of course Graham Christensen’s “Erase your Darlings”.

A common problem with articles and documentation about Nix is that they don’t tend to be complete and self-contained (or link to required information). I’ve tried to avoid that here; if something is imported I include the full inputs & imports lines needed (it’s not really possible not to, in a flake).

If there’s something I’ve missed, or a better way to do something, please tell me so I can correct it!

5 Likes