aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake-update.md
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-02-26 14:55:54 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-02-26 14:55:54 +0100
commit453c3a603f4e6fa3f8c706e73f9869bc7f76c640 (patch)
tree87d70db57d33a66cb8752a1fd6ee4ae57202c30e /src/nix/flake-update.md
parent20ea1de77d9210e145d5ebb1dccd34c856149b2c (diff)
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.
Diffstat (limited to 'src/nix/flake-update.md')
-rw-r--r--src/nix/flake-update.md37
1 files changed, 9 insertions, 28 deletions
diff --git a/src/nix/flake-update.md b/src/nix/flake-update.md
index a2ffedd2a..03b50e38e 100644
--- a/src/nix/flake-update.md
+++ b/src/nix/flake-update.md
@@ -2,52 +2,33 @@ R""(
# Examples
-* Update the `nixpkgs` and `nix` inputs of the flake in the current
- directory:
-
- ```console
- # nix flake update --update-input nixpkgs --update-input nix
- * Updated 'nix': 'github:NixOS/nix/9fab14adbc3810d5cc1f88672fde1eee4358405c' -> 'github:NixOS/nix/8927cba62f5afb33b01016d5c4f7f8b7d0adde3c'
- * Updated 'nixpkgs': 'github:NixOS/nixpkgs/3d2d8f281a27d466fa54b469b5993f7dde198375' -> 'github:NixOS/nixpkgs/a3a3dda3bacf61e8a39258a0ed9c924eeca8e293'
- ```
-
* Recreate the lock file (i.e. update all inputs) and commit the new
lock file:
```console
- # nix flake update --recreate-lock-file --commit-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 updates the lock file of a flake (`flake.lock`) so that
-it contains a lock for every flake input specified in
-`flake.nix`. Note that every command that operates on a flake will
-also update the lock file if needed, and supports the same
-flags. Therefore,
+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,
```console
-# nix flake update --update-input nixpkgs
+# nix flake update
# nix build
```
is equivalent to:
```console
-# nix build --update-input nixpkgs
+# nix build --recreate-lock-file
```
-Thus, this command is only useful if you want to update the lock file
-separately from any other action such as building.
-
-> **Note**
->
-> This command does *not* update locks that are already present unless
-> you explicitly ask for it using `--update-input` or
-> `--recreate-lock-file`. Thus, if the lock file already has locks for
-> every input, then `nix flake update` (without arguments) does
-> nothing.
-
)""