2023-06-30 11:00:03 +02:00
|
|
|
# Updating the System
|
2023-06-23 14:29:12 +02:00
|
|
|
|
2024-03-16 12:29:05 +01:00
|
|
|
With Flakes, updating the system is straightforward. Simply execute the following commands
|
|
|
|
in `/etc/nixos` or any other location where you keep the configuration:
|
2023-06-23 14:29:12 +02:00
|
|
|
|
|
|
|
```shell
|
2023-06-28 11:41:46 +02:00
|
|
|
# Update flake.lock
|
2023-06-23 14:29:12 +02:00
|
|
|
nix flake update
|
2023-07-04 06:18:46 +02:00
|
|
|
|
2024-01-11 06:30:33 +01:00
|
|
|
# Or replace only the specific input, such as home-manager:
|
2024-06-03 03:36:38 +02:00
|
|
|
nix flake update home-manager
|
2024-01-11 06:30:33 +01:00
|
|
|
|
2023-06-28 11:41:46 +02:00
|
|
|
# Apply the updates
|
2023-07-03 12:18:24 +02:00
|
|
|
sudo nixos-rebuild switch --flake .
|
2024-08-09 03:39:30 +02:00
|
|
|
|
|
|
|
# Or to update flake.lock & apply with one command (i.e. same as running "nix flake update" before)
|
|
|
|
sudo nixos-rebuild switch --recreate-lock-file --flake .
|
2023-06-23 14:29:12 +02:00
|
|
|
```
|
|
|
|
|
2024-03-16 12:29:05 +01:00
|
|
|
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`.
|