Find a file
2022-04-24 10:14:49 -03:00
modules some more docs, and a minimal working system config 2021-12-17 11:32:24 -03:00
overlays some more docs, and a minimal working system config 2021-12-17 11:32:24 -03:00
pkgs some more comments 2021-12-16 18:41:05 -03:00
.gitignore some more docs, and a minimal working system config 2021-12-17 11:32:24 -03:00
configuration.nix simplify registry, add a few more opinionated defaults 2021-12-18 10:16:16 -03:00
flake.nix some more docs, and a minimal working system config 2021-12-17 11:32:24 -03:00
hardware-configuration.nix some more docs, and a minimal working system config 2021-12-17 11:32:24 -03:00
home.nix some more docs, and a minimal working system config 2021-12-17 11:32:24 -03:00
README.md Add multiple versions to readme 2022-04-24 10:14:49 -03:00

Nix Starter Config

This is a simple nix flake for getting started with NixOS + home-manager.

Available versions:

  • Minimal: Includes just a flake for referring to a configuration.nix and a home.nix.
  • Medium: Minimal + boilerplate for custom overlays, packages, and nixos/home-manager modules.
  • Complete: Medium + hosts and users are located in their own directories.

What this provides

  • NixOS configuration on configuration.nix, accessible via nixos-rebuild --flake
  • Home-manager configuration on home.nix, accessible via home-manager --flake
  • Basic boilerplate for adding custom packages (under pkgs) and overlays (under overlays). Acessible on your system, home config, as well as nix build .#package-name
  • Boilerplate for custom NixOS (modules/nixos) and home-manager (modules/home-manager) modules
  • Dev shell for bootstrapping, accessible via nix develop

Getting started

Assuming you have a basic NixOS installation up and running:

The repo

  • Install git
  • Clone this repo to somewhere acessible (i usually have a /dotfiles folder for this)
  • Add stuff you currently have on /etc/nixos/configuration.nix to configuration.nix, and /etc/nixos/hardware-configuration.nix to hardware-configuration.nix
  • If you're already using home-manager, add your stuff from ~/.config/nixpkgs/home.nix to home.nix
  • Take a look at flake.nix, filling out stuff marked by TODOs
  • Create a remote repo (github, gitlab, sr.ht, etc) and push your changes for safekeeping

Bootstrapping

  • Run nix develop --experimental-features "nix-command flakes" to bootstrap into flake-enabled nix and home-manager.
  • Run sudo nixos-rebuild switch --flake . to apply system configuration
  • Run home-manager switch --flake . to apply home configuration
  • Reboot!

How to's

Customize your NixOS configuration

Use the configuration.nix file.

For a list of options, see man configuration.nix. Also see the manual.

Customize your home-manager configuration

Use the home.nix file.

For a list of options, see man home-configuration.nix. Also see the manual.

Adding packages

Create a folder inside pkgs, and add a default.nix file containing a derivation. Be sure to also callPackage them on pkgs/default.nix.

See the manual.

Adding overlays

Use the overlays/default.nix file. If it gets too big, feel free to split it up.

If you're applying patches, i recommend you keep the patches on the overlays folder as well.

See the wiki article.

Adding your own modules

Create a file for them on either modules/nixos or modules/home-manager. Be sure to also add them to the listing at modules/nixos/default.nix or modules/home-manager/default.nix.

See the wiki article.

Adding more hosts or users, or multiple files

If you're starting to manage more than one host or user (or splitting up a big configuration in multiple files), you might want to create a hosts and/or users folder, and move your configs there. Be sure to change the path on flake.nix as well.