NixOS and Home Manager configuration for my machines.
From the root of this repository, apply both the NixOS configuration and the Home Manager configuration:
sudo nixos-rebuild switch --flake ./#x220-nixos --show-trace --verbose
From the root of this repository, apply only the Home Manager configuration:
home-manager switch \
--extra-experimental-features nix-command \
--extra-experimental-features flakes \
--flake .#jack@x220-nixos
ℹ️ As long as the configuration of a host (e.g.
nixos/hosts/x220/configuration.nix
) includesnix.settings.experimental-features = [ "nix-command" "flakes" ];
the--extra-experimental-features
flags can be omitted.
home-manager switch --flake .#jack@x220-nixos
- Create a bootable USB stick
- Setup a new NixOS machine
- Setup a new generic Linux machine
- Useful commands
I owe a lot to Vimjoyer and his excellent videos on NixOS and Home Manager.
I also learned a lot by looking at other people's NixOS and Home Manager configurations. Here is a non exhaustive list of repositories I often look at for inspiration, and why I think they are worth mentioning.
- it configures many hosts and many users.
- it's well organized and well documented.
- it configures 20 hosts, from laptops, to a NAS, to a Pinephone.
- it defines many profiles.
- it configures many hosts.
- it manages several versions of nixpkgs.
- it documents how to deploy the configuration to a new machine.
- it cites other Nix configurations to learn from.
- it's well organized and well documented.
- it contains a few notes that explain how to manage this configuration.
- it configures Neovim using an external Nix flake.
- it includes a build script to deploy the configuration to a new NixOS machine.
- it configures many hosts.
- it uses a nice way of organizing age-encrypted secrets.
- it's well documented.
- it has a modular Home Manager configuration.
- it has an extensive hyprland configuration.
- it includes a cachix configuration.
- it's a great starter configuration for Nix beginners.
- it clearly separates the NixOS (system-wide) configuration from the Home Manager (user) configuration. As far as I know, this pattern is followed by most of the Nix community.
- it's well documented. There is a short README in almost any directory. This keeps the documentation focused on a small subset of the entire configuration. I really like this approach.
- the author wrote this NixOS & Flakes Book.
- it uses impermanence (as a Home Manager module) to remove files/directories that are not specified in the nix config.
- it uses Disko for declarative disk management: luks + lvm + btrfs.
- it uses Stylix to customize the theme for the entire system and the software you use.
- it's well documented.
- it defines a few GitHub workflows to update Nix flakes.
- it has a modular Home Manager configuration.
- it cites other Nix configurations to learn from.