Taken from: github.com/Misterio77/nix-starter-configs
export NIX_CONFIG="experimental-features = nix-command flakes"
Be sure that <hostname>
is set to use right configuration.nix
and hardware-configuration.nix
This should be done through nixos-generate-config
, it generate only hardware-configuration
if configuration.nix
exists.
But, if configuration.nix
is initially generated it won't do any harm, as you can only copy hardware-configuration.nix
,
put it to ./nixos/
folder and make sure to change include directive for it in the original ./nixos/kotur-pc.configuration.nix
To install from the installer run:
# On live CD
nixos-install --flake .#kotur-pc
# On distro
sudo nixos-rebuild switch --flake .#kotur-pc
To avoid using .#kotur-pc
, you can create a symlink
(this is possible because the current hostname is default output inspected by nixos-rebuild)
kotur-pc -> (nixos)
cd /etc/
sudo ln -s /home/kotur/.nixos-dotfiles nixos
sudo nixos-rebuild switch
Home manager goes similar
home-manager switch --flake .#kotur
If home-manager is not installed on the system, use:
nix shell nixpkgs#home-manager
# and then run the previous command
home-manager switch --flake .#kotur
Similarly, to avoid using .#kotur
, you can create a symlink
(username is default output inspected by home manager) username -> home-manager
cd /home/kotur/.config
ln -s /home/kotur/.nixos-dotfiles home-manager
home-manager switch
If you think about symlinks for nixos and home-manager, it should be the first thing you create, even before running the installer/home manager for the first time ;)
The only downside is that system and home-manager installers need to be ran separately
Enjoy!!
- Make symbolic links configuration.nix -> /etc/nixos/configuration.nix
- home-manager is ~/.config/home-manager
- Install basic nixos
- Ex. GUI install, but chose minimal
- You can add encryption as well
- After installing copy configuration.nix to the /mnt
- Boot the system
- Symlink configuration.nix to /etc/nixos/configuration.nix
- run nixos-rebuild switch
- Follow the standalone install tutorial
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
nix-channel --update
- Be sure to logout/login to continue
nix-shell '<home-manager>' -A install
- Make symbolic links home-manager -> /.config/home-manager
- Run home-manager switch
- if color scheme is not dark, run: configure-gtk
Removing old generations
sudo nixos-collect-gabage [-d]
nixos-collect-gabage [-d] # clean home-manager generations
- Use flakes for building configuration.nix and home-manager
- Consider adding home-manager as a nixos module
- Move sway to home-manager
- Fix lock screen and sleep