Skip to content

Instantly share code, notes, and snippets.

@didmar
Last active September 14, 2022 13:08
Show Gist options
  • Save didmar/5528be415377c5656db03a4e8c3b5999 to your computer and use it in GitHub Desktop.
Save didmar/5528be415377c5656db03a4e8c3b5999 to your computer and use it in GitHub Desktop.
Script to uninstall Nix from Ubuntu, tested with Ubuntu 22.04
#!/bin/sh
# Uninstall Nix, tested with Ubuntu 22.04
# For your .bashrc and .zshrc, manually edit them to remove Nix related lines
for i in {1..32}; do sudo userdel nixbld${i}; done
sudo groupdel nixbld
sudo rm -rf /etc/nix /nix /var/root/.nix-profile /var/root/.nix-defexpr /var/root/.nix-channels \
~/.nix-profile ~/.nix-defexpr ~/.nix-channels /etc/systemd/system/nix-daemon.service \
/etc/systemd/system/nix-daemon.socket /etc/bash.bashrc.backup-before-nix /etc/zsh/zshrc.backup-before-nix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment