Replies: 1 comment
-
I use git branches for non-Nix configuration. Nix configuration is kept the same across all branches because the module system is really good at handling differences between machines in a sane way. I keep configuration for all of my machines in a single branch too, but they're in a separate private repository.
When I have a situation like this, I tend to make a new module under the profiles directory and expose the differences as module options.
This isn't currently possible. However, since I've been considering introducing the modules system to flakes using flake-parts. This should make it possible to implement what you described, but I haven't decided on that yet. |
Beta Was this translation helpful? Give feedback.
-
The top-level documentation advises using a Git topic branch (kept presumably on a given machine) in order to adjust the common configuration for that machine. There's also mention there of editing the config.toml file.
While it's easy to understand that there could be these separate copies of the code on several machines, I'm wondering if you ever go back and commit more machines to the nix/home/machines/default.nix file. It may not be of any use to publish this machine-specific configuration to the common source code, as other machines shouldn't need to use it, but I can see some benefit of being able to get started with a new machine by cloning the repository and then saying, "This new machine B is just like this other machine A which is already defined here, except for a couple of details that need adjustment."
Also, say that I wanted to vary only a detail like the email address that I'll use, and maybe the GPG signing key ID, but the rest of the config.toml file should stay the same. Can I override the config.toml file's values elsewhere, such as in a flake.nix file? Could I assign to an attribute like
dotfiles.config.user.email
in a module passed tolib.mkDarwin
like you show in the template flake.nix file?Again, I understand how maintaining a fork of the config.toml would work, but I'm interested in other ways to override parts of that configuration for each machine that would all be committed together in the same source code repository (and not just on parallel branches in that repository).
Beta Was this translation helpful? Give feedback.
All reactions