https://sr.ht/~asya/nixstrap/
nixstrap is a declarative OS/distro bootstrapper that makes use of the Nix ecosystem. It's built similarly to NixOS, home-manager and other nix-based systems, except its output is not a full system or a home directory but instead bootable disk images. It is modular, and several modules are provided by nixstrap itself, such as support for bootloaders including limine. It replaces Makefiles and other build systems for OS/distros. It is bootloader- and kernel-agnostic.
nixstrap builds everything as nix derivations, in the nix sandbox. It does not need root access for building. It can (and should) be used with nix flakes, with pinned dependencies, therefore providing a lockfile for the OS and ensuring reproducibility. nixstrap allows you to have multiple configurations for your OS, so you can have any amount of pre-customized images (e.g. a linux distro could have the following configurations: aarch64-plasma riscv64-xfce x86_64-minimal...). For huge OSes with many packages and a long build time, you can spin up a nix cache server and spare your contributors hours, thanks to the reproducibility guarantee.
Here's a basic guide to how to use nixstrap for an OS with a homebrew kernel and environment:
- write nix packages for user software and the kernel. (not as complex as that sounds)
- enable and configure modules (such as bootloaders) that your 🫵 OS needs and nixstrap already supports. yes you heard it right 🫵 nixstrap saves you from sketchy makefiles downloading dependencies with unpinned versions suddenly breaking everything when your dependencies update.
nix build .#nixstrapConfigurations.<configuration name>.config.build.artifactsTODO: CLI tool to not have this long command- your bootable images are now ready, with your 🫵 favourite bootloader installed, your 🫵 kernel & initramfs placed in the boot partition and every other file that your 🫵 VM images and installer ISOs need placed exactly where they need to be.
module