YOUR JOURNEY
11 / 18
02THE NIXOS SYSTEM 5 MIN READ
LESSON 11 / PACKAGES, USERS & SERVICES

Tools installed.
Services configured.

Having a binary and running a service are two different requests.

NixOS options connect package selection with service configuration, users, and generated systemd units.

Explore the lesson
~$ NixOS examples · try them in a VM.
THE NIX MODEL01 / 03
Drag to rotate

A package provides executable files.

Executable installed
11.1USE THE SERVICE MODULE

Express the behavior you want.

Adding a package to environment.systemPackages makes its programs available system-wide. It does not necessarily start or configure a daemon. For a system service, look for its NixOS module.

This example requests Git as a tool and enables the local printing service. Add these options to your existing configuration, then build and review the change before switching.

configuration.nix · excerpt
{ pkgs, ... }: {
  environment.systemPackages = [ pkgs.git ];
 
  services.printing.enable = true;
 
  # This option contributes CUPS configuration
  # and a systemd service, not just a binary.
}
Next section: The option reference is your map.
11.2LOOK UP THE OPTION

The option reference is your map.

Options describe accepted types, defaults, and behavior. Search the NixOS option reference instead of guessing names from package names. User accounts similarly belong under users.users, with deliberate group and authentication choices.

Keep plaintext secrets out of Nix expressions: generated store files are generally readable by local users. Use a suitable runtime secret-management approach for credentials.

TAKE THIS WITH YOU

Packages provide tools; NixOS service modules describe how those tools should run.

Go a little deeperNixOS option search
UP NEXT

A maintainable system

A few habits make a declarative system easier to live with.

Next lesson