A small tool designed to replace nixos-generate-config
Go to file
2023-08-13 14:46:16 +02:00
README.md README driven development 2023-08-13 14:46:16 +02:00

nixos-generate-facts - a data-driven alternative to nixos-generate-config

nixos-generate-config has two problems:

  1. It only ships on machines that already have Nix available.
  2. It outputs Nix code instead of data.

The first point is mostly relevant to cases where you want to bootstrap a new server with a remote tool like nixos-anywhere. It should be possible to gather the machine facts without first installing Nix. Otherwise there is a bootstrap problem.

The second point is for everybody. If instead of generating Nix code we would be generating a JSON-like data structure of facts about the machine. This can be recorded and loaded by Nix. Or added to the nixos-hardware repo. It can be used for user diagnostics. It inverts the control where the NixOS module system can now make decisions on which kernel modules to load over time.

Status: vaporware

The project is currently just a README.

The next step is going to generate the minimal binary and adapter so that I can replace my machine's hardware-configuration.nix

Once proven, I'm hoping to integrate that project upstream.

How the project works

The project has two parts:

  1. The binary that scans the system and outputs JSON or TOML.
  2. A NixOS module that can load that data and make decisions.

That's it.