This is my dotfiles repository for a standard NixOS system with Flakes enabled. NixOS can be downloaded here
Before using the dotfiles, you need to make some changes to the current running configuration.
- Add this into
configuration.nixand rebuild usingsudo nixos-rebuild switch
nix.settings.experimental-features = [ "nix-command" "flakes" ];- Install git temporarily using
nix-shell -p git - Clone the repo into
~/dotfiles
Continue the steps depending whether you are reinstalling an existing host or setting up a new one.
- Copy
/etc/nixos/hardware-configuration.nixto the appropriate hosts subdirectory - Edit
configuration.nixin same directory if needed (e.g. if you need to change boot options) - Rebuild with
sudo nixos-rebuild switch --flake $HOME/dotfiles/.#hostname --impurewherehostnameis the existing host's configuration name
- Make a new subdirectory in
hosts/and name it however you like - Create a new file inside called
default.nix.- Edit the file accordingly
- OR copy other hosts'
default.nixand change the configuration (recommended)
- Be sure to import
./hardware-configuartionindefault.nix
{ self, ... }:
{
imports =
[ ./hardware-configuration.nix ] ++
self.nixosModules.allImportsExcept [];
...
}- Copy
/etc/nixos/hardware-configuration.nixto the new host's subdirectory - Edit
flake.nixand find this part:
...
in
{
... = mkSystem ./hosts/...;
.... = mkSystem ./hosts/....;
};- Add the host there by adding the line
hostname = mkSystem ./hosts/hostname;wherehostnameis the new host's previously chosen name - Rebuild with
sudo nixos-rebuild switch --flake $HOME/dotfiles/.#hostname --impurewherehostnameis the new host's previously chosen name - Reboot the system
- Be sure to commit your changes
- After rebooting, log into your user. The initial password is the same as the username.
- After logging in,
passwdto change your user's password