2.6 KiB
Nix Starter Config (Minimal version)
This is a simple nix flake for getting started with NixOS + home-manager.
What this provides
- NixOS configuration on
nixos/configuration.nix
, accessible vianixos-rebuild --flake .
- Home-manager configuration on
home-manager/home.nix
, accessible viahome-manager --flake .
Getting started
Assuming you have a basic NixOS booted up (either live or installed, anything works). Here's a link to the latest NixOS downloads, just for you.
The repo
-
Hit "Use this template" on this repo (or clone this down and push to any another git remote)
-
Add stuff you currently have on
/etc/nixos/
tonixos
(usuallyconfiguration.nix
andhardware-configuration.nix
, when you're starting out).- The included file has some options you might want, specially if you don't
have a configuration ready. Make sure you have generated your own
hardware-configuration.nix
; if not, just mount your partitions to/mnt
and run:nixos-generate-config --root /mnt
.
- The included file has some options you might want, specially if you don't
have a configuration ready. Make sure you have generated your own
-
If you're already using home-manager, add your stuff from
~/.config/nixpkgs
tohome-manager
(probablyhome.nix
).- I also include one with some simple options if you need. Feel free to ignore this step if you don't want to use home-manager just yet.
-
Take a look at
flake.nix
, making sure to fill out anything marked with FIXME (required) or TODO (usually tips or optional stuff you might want) -
Push your changes! Or at least copy them somewhere if you're on a live medium.
Bootstrapping
To get everything up and running, you need flake-enabled nix and/or home-manager.
For simplicity, this minimal version does not include a bootstrap shell.
Check the NixOS wiki for information on how to enable flakes.
Usage
- Run
sudo nixos-rebuild switch --flake .#hostname
to apply your system configuration.- If you're still on a live installation medium, run
nixos-install --flake .#hostname
instead, and reboot.
- If you're still on a live installation medium, run
- Run
home-manager switch --flake .#username@hostname
to apply your home configuration.
What next?
Full version
Once you're confortable with this flake, take a look at the full version, it includes boilerplate for overlays, custom packages, and more.