nix3-flake-update(1) General Commands Manual nix3-flake-update(1)

Warning: This program is experimental and its interface is subject to change.

nix flake update - update flake lock file

nix flake update [option…] flake-url

Recreate the lock file (i.e. update all inputs) and commit the new lock file:
# nix flake update
* Updated 'nix': 'github:NixOS/nix/9fab14adbc3810d5cc1f88672fde1eee4358405c' -> 'github:NixOS/nix/8927cba62f5afb33b01016d5c4f7f8b7d0adde3c'
* Updated 'nixpkgs': 'github:NixOS/nixpkgs/3d2d8f281a27d466fa54b469b5993f7dde198375' -> 'github:NixOS/nixpkgs/a3a3dda3bacf61e8a39258a0ed9c924eeca8e293'
…
warning: committed new revision '158bcbd9d6cc08ab859c0810186c1beebc982aad'

This command recreates the lock file of a flake (flake.lock), thus updating the lock for every mutable input (like nixpkgs) to its current version. This is equivalent to passing --recreate-lock-file to any command that operates on a flake. That is,

# nix flake update
# nix build

is equivalent to:

# nix build --recreate-lock-file

Common evaluation options:

  • --arg name expr
    Pass the value expr as the argument name to Nix functions.
  • --argstr name string
    Pass the string string as the argument name to Nix functions.
  • --eval-store store-url
    The Nix store to use for evaluations.
  • --impure
    Allow access to mutable paths and repositories.
  • --include / -I path
    Add path to the list of locations used to look up <...> file names.
  • --override-flake original-ref resolved-ref
    Override the flake registries, redirecting original-ref to resolved-ref.

Common flake-related options:

  • --commit-lock-file
    Commit changes to the flake’s lock file.
  • --inputs-from flake-url
    Use the inputs of the specified flake as registry entries.
  • --no-registries
    Don’t allow lookups in the flake registries. This option is deprecated; use --no-use-registries.
  • --override-input input-path flake-url
    Override a specific flake input (e.g. dwarffs/nixpkgs). This implies --no-write-lock-file.