Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Uninstalling Nix' section to the documentation #1624

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/manual/installation/installation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<xi:include href="installing-source.xml" />
<xi:include href="nix-security.xml" />
<xi:include href="env-variables.xml" />
<xi:include href="uninstalling-nix.xml" />

<!-- TODO: should be updated
<section><title>Upgrading Nix through Nix</title>
Expand Down
56 changes: 56 additions & 0 deletions doc/manual/installation/uninstalling-nix.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="ch-uninstalling-nix">

<title>Uninstalling Nix</title>

<para>The following steps describes how to remove Nix from your system.</para>

<para>First of all you need to remove the <filename>/nix</filename>
directory:</para>

<screen>sudo rm -rf /nix</screen>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and removing the sourcing of nix-profile.sh are really the only steps that are required.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does one remove the nix-profile.sh on osx, how do I locate it from the terminal (if that's what I am using)


<para>You also need to remove some files from your home directory:</para>

<screen>
rm -rf $HOME/.nix-profile
rm -rf $HOME/.nix-defexpr
rm -rf $HOME/.nix-channels
rm -rf $HOME/.config/nixpkgs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files do not need to be removed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But shouldn't they be? If I was testing out some new software on my machine, I wouldn't want it to leave behind unnecessary files or directories. Perhaps we could move these commands into a sub-section describing how to completely purge Nix from your system?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be better to have a section which lists all files that are (typically) existing/generated by Nix and what their purpose is. Based on that a reader can easily decide what they need to remove.

</screen>

<para>Then you need to remove the line that references Nix from your
<filename><envar>$HOME</envar>/.profile</filename>. Assuming that your username
is <literal>user</literal> it should look something like this:</para>

<screen>
if [ -e /home/user/.nix-profile/etc/profile.d/nix.sh ]; then . /home/user/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
</screen>

<para>There might also be some configuration files in
<filename>/etc/nix</filename> that you need to delete:</para>

<screen>
sudo rm -rf /etc/nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, these files do not need to be deleted.

</screen>

<para>Finally, on a multi-user installation of Nix, you will also need to remove
the <literal>nixbld[0-9]</literal> users.</para>

<screen>
sudo userdel nixbld0
sudo userdel nixbld1
sudo userdel nixbld2
sudo userdel nixbld3
sudo userdel nixbld4
sudo userdel nixbld5
sudo userdel nixbld6
sudo userdel nixbld7
sudo userdel nixbld8
sudo userdel nixbld9
</screen>

</chapter>