Updating NixOS: Difference between revisions
m link to channel branches |
Reference to NixOS manual and re-introduce nixos-rebuild switch --upgrade as a shortcut. |
||
| (One intermediate revision by one other user not shown) | |||
| Line 10: | Line 10: | ||
== For non-flake configurations == | == For non-flake configurations == | ||
What follows is a short set of instructions. Further details can be found in the [https://nixos.org/manual/nixos/stable/#sec-upgrading NixOS Manual.] | |||
=== Updating NixOS channels === | === Updating NixOS channels === | ||
| Line 21: | Line 23: | ||
=== Rebuilding the system after updating channels === | === Rebuilding the system after updating channels === | ||
If you want to not only apply your configuration changes but also update the packages and system environment to the latest versions available from the Nixpkgs repository. This is typically used when you want to ensure you are using the latest versions of your software and system services:<syntaxhighlight lang="console"> | If you want to not only apply your configuration changes but also update the packages and system environment to the latest versions available from the Nixpkgs repository. This is typically used when you want to ensure you are using the latest versions of your software and system services:<syntaxhighlight lang="console"> | ||
# nixos-rebuild switch | |||
</syntaxhighlight>To apply configuration changes and new package updates only '''after''' rebooting the system, use the following command instead:<syntaxhighlight lang="console"> | |||
# nixos-rebuild boot | |||
</syntaxhighlight> | |||
=== Updating channel and rebuilding the system === | |||
The below command is a shortcut equivalent to running '''nix-channel --update nixos; nixos-rebuild switch''' previously described: | |||
<syntaxhighlight lang="console"> | |||
# nixos-rebuild switch --upgrade | # nixos-rebuild switch --upgrade | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 36: | Line 46: | ||
=== Example of a system update === | === Example of a system update === | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
# nix-channel --update && nixos-rebuild switch | # nix-channel --update && nixos-rebuild switch && reboot | ||
</syntaxhighlight> | </syntaxhighlight> | ||