Nix/src/nix/flake-update.md
Eelco Dolstra 453c3a603f nix flake update: Recreate the lock file
This is probably what most people expect it to do. Fixes #3781.

There is a new command 'nix flake lock' that has the old behaviour of
'nix flake update', i.e. it just adds missing lock file entries unless
overriden using --update-input.
2021-02-26 14:55:54 +01:00

911 B

R""(

Examples

  • 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'
    

Description

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

)""