Home Explore Blog CI



nixpkgs

nixos/doc/manual/configuration/package-mgmt.chapter.md
4f490ac81ecfa520b19288aced28d33b8982d235f2d9078e00000003000002be
# Package Management {#sec-package-management}

This section describes how to add additional packages to your system.
NixOS has two distinct styles of package management:

-   *Declarative*, where you declare what packages you want in your
    `configuration.nix`. Every time you run `nixos-rebuild`, NixOS will
    ensure that you get a consistent set of binaries corresponding to
    your specification.

-   *Ad hoc*, where you install, upgrade and uninstall packages via the
    `nix-env` command. This style allows mixing packages from different
    Nixpkgs versions. It's the only choice for non-root users.

```{=include=} sections
declarative-packages.section.md
ad-hoc-packages.section.md
```

Chunks
ba32a479 (1st chunk of `nixos/doc/manual/configuration/package-mgmt.chapter.md`)
Title: Package Management in NixOS
Summary
This section introduces the two main ways to manage packages in NixOS: declarative package management, which uses the `configuration.nix` file to specify a consistent set of packages, and ad hoc package management, which uses the `nix-env` command to install, upgrade, and uninstall packages. Ad hoc management is the only option for non-root users and allows for mixing packages from different Nixpkgs versions.