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

Update uninstall methods for single user #8675

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
48 changes: 44 additions & 4 deletions doc/manual/src/installation/uninstall.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,52 @@
# Uninstalling Nix

## Sections
- [Single User](#single-user)
- [Manual Method](#manual-method)
- [Step 1: Restore Modified Files (if applicable)](#step-2-restore-modified-files-if-applicable)
- [Step 2: Delete Nix Files](#step-4-delete-nix-files)
- [Multi User](#multi-user)
- [Linux](#linux)
- [macOS](#macos)


Comment on lines +3 to +12
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand why we'd want that, but let's not create maintenance burden and opportunities for human error for the future. I'd rather review one PR adding automation for that than deal with broken links or missing TOC entries repeatedly.

Suggested change
## Sections
- [Single User](#single-user)
- [Manual Method](#manual-method)
- [Step 1: Restore Modified Files (if applicable)](#step-2-restore-modified-files-if-applicable)
- [Step 2: Delete Nix Files](#step-4-delete-nix-files)
- [Multi User](#multi-user)
- [Linux](#linux)
- [macOS](#macos)

## Single User
### If you have a [single-user installation](./installing-binary.md#single-user-installation) of Nix
### Manual Method
Comment on lines +14 to +15
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
### If you have a [single-user installation](./installing-binary.md#single-user-installation) of Nix
### Manual Method
These instructions apply for a [single-user installation](./installing-binary.md#single-user-installation) of Nix.


If you have a [single-user installation](./installing-binary.md#single-user-installation) of Nix, uninstall it by running:
#### Step 1: Restore Modified Files (if applicable)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#### Step 1: Restore Modified Files (if applicable)
### Step 1: Restore Modified Files

If they don't exist it's a no-op anyway


1. Nix may have modified certain files on your system. If you have created backup copies of these files before installing Nix, you can restore them. Here are the instructions for bash and zsh files:
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not perfectly correct to call them configuration files. Maybe @roberth has a better suggestion.

Suggested change
1. Nix may have modified certain files on your system. If you have created backup copies of these files before installing Nix, you can restore them. Here are the instructions for bash and zsh files:
Nix will create backup copies of shell configuration files before installation, an you can restore them.
Here are the instructions for Bash and Zsh:

There is no second item in that list, so don't make it a list. Use one line per sentence, it's easier to review and make focused suggestions. This is the general rule here, even if it's not consistently implemented yet. Use the project names with their original spelling (Bash, Zsh). Use monospace for command names (bash, zsh, but that's not applicable here). I will add a contribution guide for the manual this year, promised.


- Bash: Nix may have modified the `/etc/bash.bashrc` or `~/.bash_profile` file. If you have created a backup of this file before installing Nix, you can restore it using the following commands:
Copy link
Contributor

Choose a reason for hiding this comment

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

Dedent. I don't think Nix may have done it, pretty sure it just did. I doubt this introductory blurb is even needed.


```bash
sudo cp /etc/bash.bashrc.backup-before-nix /etc/bash.bashrc
sudo cp ~/.bash_profile.backup-before-nix ~/.bash_profile
Comment on lines +24 to +25
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not

Suggested change
sudo cp /etc/bash.bashrc.backup-before-nix /etc/bash.bashrc
sudo cp ~/.bash_profile.backup-before-nix ~/.bash_profile
sudo mv /etc/bash.bashrc.backup-before-nix /etc/bash.bashrc
sudo mv ~/.bash_profile.backup-before-nix ~/.bash_profile

Because if those files exist we're done; otherwise error showing they don't

```

Note: After restoring the file, you may need to close and reopen any bash terminal sessions to ensure they are using the restored configurations.
Copy link
Contributor

Choose a reason for hiding this comment

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

You sure have to. Same for the other note.

Suggested change
Note: After restoring the file, you may need to close and reopen any bash terminal sessions to ensure they are using the restored configurations.
> **Note**
>
> After restoring the file, you have to close and reopen any Bash sessions to ensure they are using the restored configurations.

We use this type of highlighting for admonitions everywhere


- Zsh: Nix may have modified the `~/.zshrc` file. If you have created a backup of this file before installing Nix, you can restore it using the following command:

```bash
sudo cp ~/.zshrc.backup-before-nix ~/.zshrc
```

Note: After restoring the file, you may need to close and reopen any zsh terminal sessions to ensure they are using the restored configurations.


#### Step 2: Delete Nix Files
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#### Step 2: Delete Nix Files
### Step 2: Delete Nix Files


1. Run the following command in a terminal to delete the files that Nix added to your system:
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't have to be a list, dedent.

```bash
sudo rm -rf "/etc/nix" "$HOME/.nix-profile" "$HOME/.nix-defexpr" "$HOME/.nix-channels" "$HOME/.cache/nix" "$NIX_ROOT" "/nix"
```

You have successfully uninstalled Nix from your system. Remember to double-check the commands before executing them and ensure that you have the necessary permissions to perform the uninstallation steps.
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a bit too much promised. The reminder should be a warning admonition before the commands.


If you ever need to use Nix again in the future, you can reinstall it following the installation instructions provided by the Nix documentation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Link to those.


```console
$ rm -rf /nix
```

## Multi User

Expand Down
1 change: 1 addition & 0 deletions scripts/install-multi-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ is_os_darwin() {
fi
}


Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

contact_us() {
echo "You can open an issue at"
echo "https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md"
Expand Down