<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.nixos.org/w/index.php?action=history&amp;feed=atom&amp;title=NixOS_Maintenance_Quick_Reference</id>
	<title>NixOS Maintenance Quick Reference - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.nixos.org/w/index.php?action=history&amp;feed=atom&amp;title=NixOS_Maintenance_Quick_Reference"/>
	<link rel="alternate" type="text/html" href="https://wiki.nixos.org/w/index.php?title=NixOS_Maintenance_Quick_Reference&amp;action=history"/>
	<updated>2026-11-26T15:34:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://wiki.nixos.org/w/index.php?title=NixOS_Maintenance_Quick_Reference&amp;diff=35567&amp;oldid=prev</id>
		<title>R1w1s1: Created page with &quot;A concise command reference for everyday maintenance of a channel-based NixOS system.  == System updates ==  &lt;syntaxhighlight lang=&quot;bash&quot;&gt; # Show the current NixOS version nixos-version  # List configured system channels sudo nix-channel --list  # Update system channels sudo nix-channel --update  # Preview required builds and downloads sudo nixos-rebuild dry-build  # Build and activate the updated system sudo nixos-rebuild switch  # Alternatively, update and rebuild in o...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.nixos.org/w/index.php?title=NixOS_Maintenance_Quick_Reference&amp;diff=35567&amp;oldid=prev"/>
		<updated>2026-11-25T20:28:01Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;A concise command reference for everyday maintenance of a channel-based NixOS system.  == System updates ==  &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # Show the current NixOS version nixos-version  # List configured system channels sudo nix-channel --list  # Update system channels sudo nix-channel --update  # Preview required builds and downloads sudo nixos-rebuild dry-build  # Build and activate the updated system sudo nixos-rebuild switch  # Alternatively, update and rebuild in o...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;A concise command reference for everyday maintenance of a channel-based NixOS system.&lt;br /&gt;
&lt;br /&gt;
== System updates ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Show the current NixOS version&lt;br /&gt;
nixos-version&lt;br /&gt;
&lt;br /&gt;
# List configured system channels&lt;br /&gt;
sudo nix-channel --list&lt;br /&gt;
&lt;br /&gt;
# Update system channels&lt;br /&gt;
sudo nix-channel --update&lt;br /&gt;
&lt;br /&gt;
# Preview required builds and downloads&lt;br /&gt;
sudo nixos-rebuild dry-build&lt;br /&gt;
&lt;br /&gt;
# Build and activate the updated system&lt;br /&gt;
sudo nixos-rebuild switch&lt;br /&gt;
&lt;br /&gt;
# Alternatively, update and rebuild in one step&lt;br /&gt;
sudo nixos-rebuild switch --upgrade&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuration management ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Edit the system configuration&lt;br /&gt;
sudo vim /etc/nixos/configuration.nix&lt;br /&gt;
&lt;br /&gt;
# Format the configuration (requires nixfmt)&lt;br /&gt;
sudo nixfmt /etc/nixos/configuration.nix&lt;br /&gt;
&lt;br /&gt;
# Validate configuration syntax&lt;br /&gt;
nix-instantiate --parse /etc/nixos/configuration.nix &amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
# Evaluate the system configuration&lt;br /&gt;
sudo nix-instantiate &amp;#039;&amp;lt;nixpkgs/nixos&amp;gt;&amp;#039; -A system&lt;br /&gt;
&lt;br /&gt;
# Build without activating&lt;br /&gt;
sudo nixos-rebuild build&lt;br /&gt;
&lt;br /&gt;
# Build and activate the configuration&lt;br /&gt;
sudo nixos-rebuild switch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== System generations ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# List system generations&lt;br /&gt;
sudo nixos-rebuild list-generations&lt;br /&gt;
&lt;br /&gt;
# Roll back to the previous generation&lt;br /&gt;
sudo nixos-rebuild switch --rollback&lt;br /&gt;
&lt;br /&gt;
# Delete specific generations (verify numbers first)&lt;br /&gt;
sudo nix-env --profile /nix/var/nix/profiles/system \&lt;br /&gt;
  --delete-generations 42 43 44&lt;br /&gt;
&lt;br /&gt;
# Refresh boot entries without rebuilding&lt;br /&gt;
sudo /nix/var/nix/profiles/system/bin/switch-to-configuration boot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Garbage collection and storage optimization ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Collect unreachable store paths while preserving generations&lt;br /&gt;
sudo nix-collect-garbage&lt;br /&gt;
&lt;br /&gt;
# Delete old profile generations and collect garbage&lt;br /&gt;
sudo nix-collect-garbage -d&lt;br /&gt;
&lt;br /&gt;
# Delete generations older than seven days and collect garbage&lt;br /&gt;
sudo nix-collect-garbage --delete-older-than 7d&lt;br /&gt;
&lt;br /&gt;
# Deduplicate identical store files using hard links&lt;br /&gt;
sudo nix-store --optimise&lt;br /&gt;
&lt;br /&gt;
# Check Nix store disk usage&lt;br /&gt;
sudo du -sh /nix/store&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Warning:&amp;#039;&amp;#039;&amp;#039; Deleted generations are no longer available for rollback. Refresh boot entries after deleting system generations.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Updating NixOS]]&lt;br /&gt;
* [[Nixos-rebuild|nixos-rebuild]]&lt;br /&gt;
* [[Storage optimization]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* [https://search.nixos.org/packages NixOS Packages]&lt;br /&gt;
* [https://search.nixos.org/options NixOS Options]&lt;br /&gt;
&lt;br /&gt;
[[Category:Guide]]&lt;/div&gt;</summary>
		<author><name>R1w1s1</name></author>
	</entry>
</feed>