Home Explore Blog Models CI



nix

src/nix/profile-upgrade.md
93cb5aec41f6f24dad8930b154d55da4ca8cb293cbc006f10000000300000365
R""(

# Examples

* Upgrade all packages that were installed using an unlocked flake
  reference:

  ```console
  # nix profile upgrade --all
  ```

* Upgrade a specific package by name:

  ```console
  # nix profile upgrade hello
  ```

* Upgrade all packages that include 'vim' in their name:

  ```console
  # nix profile upgrade --regex '.*vim.*'
  ```

# Description

This command upgrades a previously installed package in a Nix profile,
by fetching and evaluating the latest version of the flake from which
the package was installed.

> **Warning**
>
> This only works if you used an *unlocked* flake reference at
> installation time, e.g. `nixpkgs#hello`. It does not work if you
> used a *locked* flake reference
> (e.g. `github:NixOS/nixpkgs/13d0c311e3ae923a00f734b43fd1d35b47d8943a#hello`),
> since in that case the "latest version" is always the same.

)""

Chunks
b19afd25 (1st chunk of `src/nix/profile-upgrade.md`)
Title: `nix profile upgrade` Command: Examples and Description
Summary
This text explains the `nix profile upgrade` command, providing examples for upgrading all packages, a specific package by name (e.g., `hello`), or packages matching a regular expression (e.g., `.*vim.*`). The command's function is to upgrade previously installed packages in a Nix profile by fetching and evaluating the latest version of their respective flakes. A crucial warning notes that this command only works if the packages were installed using *unlocked* flake references, as *locked* references always point to a fixed version.