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.nix
and 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.nix
to the appropriate hosts subdirectory - Edit
configuration.nix
in same directory if needed (e.g. if you need to change boot options) - Rebuild with
sudo nixos-rebuild switch --flake $HOME/dotfiles/.#hostname --impure
wherehostname
is 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.nix
and change the configuration (recommended)
- Be sure to import
./hardware-configuartion
indefault.nix
{ self, ... }:
{
imports =
[ ./hardware-configuration.nix ] ++
self.nixosModules.allImportsExcept [];
...
}
- Copy
/etc/nixos/hardware-configuration.nix
to the new host's subdirectory - Edit
flake.nix
and find this part:
...
in
{
... = mkSystem ./hosts/...;
.... = mkSystem ./hosts/....;
};
- Add the host there by adding the line
hostname = mkSystem ./hosts/hostname;
wherehostname
is the new host's previously chosen name - Rebuild with
sudo nixos-rebuild switch --flake $HOME/dotfiles/.#hostname --impure
wherehostname
is 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,
passwd
to change your user's password