1. Use netboot.xyz to boot Nixos 2. Copy over nix configurations. I use nix flakes, so I can pre-build all my packages on another machine and debug the config in a more comfortable environment. 3. Run nixos-install (and generate a hardware config if needed). 4. Reboot
- I have two M1 Macs, running MacOS
- I have a Ryzen desktop that dual-boots Windows 11 and NixOS 22.11
I would like to have one dotfiles repo with all my configs and home-manager setup, as well as the system / hardware config for the bare-metal NixOS installations.
I have gotten these working independently, but I still can't quite make the leap in a single repo to:
- Having some config be machine-specific
- Having other config be OS-specific
- On a particular machine (same OS - macOS), having some slightly different config, because it's a work machine vs personal (e.g. different .gitconfig setups).
Can all of the above be addressed with Nix?
There seems to be an assumption either you have gone all-in using NixOS (e.g. in a VM inside host OS, or bare-metal), or you are just using the package manager (+ a subset of home-manager), e.g. macOS or WSL inside Windows.
But on the whole, 80% of what I want to set up and configure is machine-agnostic (NeoVIM, fish shell, basic CLI utilities, etc), and I use direnv/shell.nix in individual project folders to load the tooling for that project.
Then you can have multiple system and home configs that import the common files and then add your own config.
You can also pass options in with suecialArgs / extraSpecialArgs to the nixos/hm modiles.
I don't bother with building a custom ISO.
The way I do it:
* Boot with the default ISO
* Format the disk
* Git clone my dotfiles repo with all the configs
* Generate the hardware config and extend my flake.nix with the new machine.
* Install with my dotfiles config
* Reboot (aka profit!)
I can complete the whole process in about 10 minutes (on a fast CPU and with a good network).
Customizing the config up front, building the custom ISO , and writing it to a USB stick takes up way more time than just doing the above.