Customize configuration.nix created by installer

I recognize the standard process for installing NixOS is to do a manual custom install including partitioning or to use an installer iso then update the /etc/nixos/configuration.nix file manually.

I have spent a couple days searching for how to make a custom installer iso that provides a customized configuration on install that can simplify the process of setting up multiple device. My goal with this is to have the customizability of the partiotioning based on the device via the GUI then an automated way to install various dependencies and basically have my desired environment on first boot. This could include setting up SSH keys and cloning private repos. (Yes security is obviously a risk with this and this ISO should be destroyed to excessive levels when not in use :wink:)

All of that said, I do recognize it would be possible to customize the calamares installer to achieve this but I am crossing my fingers in the hopes that someone else has already done this and I can cheat off their work a bit :grin:. If not I will venture down this path and maybe make a extendable process.

this may help you.

however it may not!


Thanks for the suggestion and welcome! Sadly, as far as I can tell, nixos-generator builds installer based on a configuration.nix and is mostly the same as using nix-build.

That said, I think I found a decent middle ground step. Using environment.etcconfig in the installer configuration.nix; I should be able to setup scripts and configurations to be available on the installer. Once the install process is complete I should be able to mount the new installed partition and copy over the required files to setup the deployed environment. Might even be able to write a script that can be run in the installer to do all the post-install process :thinking: :grin:

1 Like