This repository accumulates my NixOS configurations.
Inputs are supplied in flake.nix
and include:
- nixpkgs
- home-manager (follows nixpkgs)
- kmonad (follows nixpkgs)
- nix-store-emacs-packages (follows nixpkgs)
- emacs-overlay
Inputs are mainly used in base-system.nix
, that provides basis for my configurations. Included:
- Nix is configured to use flakes.
- nixpkgs flake is pinned and added to
NIX_PATH
to support oldnix-shell
- cachix is added automatically, if
cachix.nix
exists in its standard location - kmonad modules
- nix-store-emacs-packages and emacs overlays
base-system.nix
is imported as a function that takes system type and a list of modules.
Also see this for a flake reference.
- Clone the repository (or maybe even fork it?).
- Write your configuration preferably in the
machines
directory.- Reuse provided modules or write your own.
- It is also preferable that configuration name matches your machine’s hostname.
- In the root of the repository run
nix run nixpkgs.nixFlakes -c sudo nix --experimental-features 'flakes nix-command' build .#nixosConfigurations.$(hostname).config.system.build.toplevel
- In the root of the repository run
sudo ./result/bin/switch-to-configuration switch
- Now you can remove
./result
- Rebuild your system using
sudo nixos-rebuild switch --flake <path>#<configuration name>
. You can only pass the path, if configuration name matches your hostname. - To update all inputs run
nix flake update
- To update single input run
nix flake lock --update-input <input name>
- Don’t forget to commit the lock file.