For people who are confused, this file has a bunch of source blocks that are then put into individual files using emacs+org’s tangle mode. I use nix

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2025-01-11 01:30:04

For people who are confused, this file has a bunch of source blocks that are then put into individual files using emacs+org’s tangle mode.

I use nix flakes which means that the entry point for the nix evaluation is a file called flake.nix which has two parts (among other things)

Nix flakes is still behind an experimental flag, but it is considered the standard by most of the community. Flakes allow us to pin the input package versions using a flake.lock file. This prevents unwanted and surprise updates when rebuilding without changing the configuration.

I have a bunch of constant strings that I would rather put in a file. Thats what user.nix is. The values are imported at the beginning and are available to almost all the functions being called to configure the system.

Now that the inputs are ready, the outputs define what the system will actually look like. I also define the machines that this configuration specifies early on. Finally, I iterate over the machines list and pull files from /.machines/${name} subdirectory. This allows me to have configuration that has machine specific configuration limited to those files while also keeping a modular reusable base. We also add a devshell that makes editing this repository easier in emacs.

Leave a Comment