mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2024-12-01 04:24:01 +01:00
17 lines
572 B
Markdown
17 lines
572 B
Markdown
# Updating the System
|
|
|
|
With Flakes, updating the system is straightforward. Simply execute the following commands in `/etc/nixos` or any other location where you keep the configuration:
|
|
|
|
```shell
|
|
# Update flake.lock
|
|
nix flake update
|
|
|
|
# Or replace only the specific input, such as home-manager:
|
|
nix flake lock --update-input home-manager
|
|
|
|
# Apply the updates
|
|
sudo nixos-rebuild switch --flake .
|
|
```
|
|
|
|
Occasionally, you may encounter a "sha256 mismatch" error when running `nixos-rebuild switch`. This error can be resolved by updating `flake.lock` using `nix flake update`.
|