ssh-keygen -t ed25519 -C "[email protected]"
cat ~/.ssh/id_ed25519.pub
Add the key to git repo.
nix shell --extra-experimental-features nix-command --extra-experimental-features flakes nixpkgs#git
git clone [email protected]:nazmir/nix-config.git
Use the existing confifuration files or create new ones as needed.
The script will backup the files in source directory (arg1) and link to target directory.
Don't rename hardware config to specific machine as configuration.nix
sudo ~/nix-config/bin/rename-and-link.sh /etc/nixos/configuration.nix ~/nix-config/nixos/hosts/pc/configuration-pc.nix
sudo ~/nix-config/bin/rename-and-link.sh /etc/nixos/hardware-configuration.nix ~/nix-config/nixos/hosts/pc/hardware-configuration.nix
sudo nixos-rebuild switch --flake /home/mir/nix-config/.#mir-nixos-pc
Before installing home manager run nix flake update and then link the config file to git repo
cd ~/nix-config
nix flake update
#this will initialize home manager and place config file in ~/.config/home-manager/home.nix
nix run home-manager/master -- init
~/nix-config/bin/rename-and-link.sh ~/.config/home-manager/home.nix ~/nix-config/home-manager/hosts/home-nixos.nix
#initial evaluation with flakes
home-manager switch --flake /home/mir/nix-config/.#mir@mir-nixos-pc
nix flake update
nh os switch --ask #Ask for confirmation before applying configuration
nh home switch --ask
#home-manager switch --flake '.#mir@mir-nixos-pc'
nh home switch -c mir@mir-nixos-pc ./
#To specify flakes explicitly use:
nh os switch --ask ~/nix-config/.#mir-nixos-thinkpad
#To use the current hostname and specify flake path reference use:
nh os switch --ask ~/nix-config/
nh clean all #Clean OS and Home profiles
nh clean user #clean user profiles
nix profile list
nh clean profile -a nixGL #nixGL is profile name and -a asks for confirmation
sudo nixos-rebuild switch --flake /home/mir/nix-config/.#mir-nixos-thinkpad
home-manager switch --flake /home/mir/nix-config/.#mir@mir-nixos-thinkpad
sudo tailscale up -authkey tskey-auth-KEY #Get key from tailscale console
Build the result before switching
sudo nixos-rebuild build --flake /home/mir/nix-config/.#mir-nixos-thinkpad
To compare current system with build result run
nvd diff /run/current-system/ ./result/
nvd diff $(ls -d1v /nix/var/nix/profiles/system-*-link|tail -n 2) #To compare result after switch
nvd uses nix store diff-closure, but with improved reporting. Syntax for nix store diff-closure is:
nix store diff-closures $(ls -d1v /nix/var/nix/profiles/system-*-link|tail -n 2)
Install Doom Emacs and make sure to run
doom doctor
#To check for any issues
Backup ~/.emacs.d if it exists
mv ~/.emacs.d ~/.emacs.d.orig
Copy doom configuration files to ~/.nix-config/.config/doom
~/nix-config/bin/rename-and-link.sh ~/.config/doom/ ~/nix-config/.config/doom
~/nix-config/bin/rename-and-link ~/.config/sway/config ~/.config/sway/config
~/nix-config/bin/rename-and-link ~/.config/kitty/ ~/nix-config/.config/kitty
#The result will be in current folder