My multi-host NixOS flake!
Important
If you want to adapt these dot files for yourself be sure to configure your own hosts.
- Add a new entry to
nixosConfigurations
inflake.nix
:
# ...
nixosConfigurations = lib.genHosts = {
new-host = {
username = "new-host-user";
userDescription = "probably your name (for display-manager)";
# Other options you may want to change:
# arch (default: "x86_64-linux")
# hostname (default: config name)
};
# ...
};
# ...
- Create
default.nix
inhosts/new-host/
. Import modules likehardware-configuration.nix
orconfig.nix
from there. - Have a look at
options.md
for my custom configuration options.
Important
flakes
and nix-command
have to be enabled to rebuild the system using flakes.
nix.settings.experimental-features = ["nix-command" "flakes"];
- After setting up your hosts run
copy_config.sh
:
./copy_config.sh
- For the first rebuild with this config rebuild like this:
sudo nixos-rebuild boot --install-bootloader --flake /etc/nixos#<config-you-want-to-build>
Afterwards, you can run sudo nixos-rebuild switch|boot|etc.
like normal.
Tip
NixOS channels can be removed, because flakes don't rely on them. (nix-channel
)
In the nix-shells
directory, there are also a couple of nix shells for different usecases