Skip to content

Instantly share code, notes, and snippets.

@Tknott95
Last active June 7, 2023 08:02
Show Gist options
  • Save Tknott95/94d341d3e81595ba4cae31a04505f4e5 to your computer and use it in GitHub Desktop.
Save Tknott95/94d341d3e81595ba4cae31a04505f4e5 to your computer and use it in GitHub Desktop.
cannot connect to socket at '/nix/var/nix/daemon-socket/socket': No such file or directory

FOR SINGLE USER INSTALL

cannot connect to socket at '/nix/var/nix/daemon-socket/socket': No such file or directory

remove nix - stop daemon - remove env vars trying to run multi-user style via daemon
if you are trying to remove a multi user install on linux and revert to a single user install 
you need to remove your NIX_REMOTE variable
or just set it to export NIX_REMOTE=

so this is blank and not calling the daemon - as you are installing without it for single user


THIS IS IMPORTANT AND NOT ONE PLACE HAS DOCS THAT TELL YOU SUCH

  sudo systemctl disable nix-daemon.socket
  sudo systemctl disable nix-daemon.service

  sudo systemctl stop|kill nix-daemon.socket
  sudo systemctl stop|kill  nix-daemon.service
  rm -rf ~/.nix-*

  sudo rm /etc/profile.d/nix.sh
 
  sudo rm -rf /nix
  sudo rm -rf /etc/nix

shell script to remove groups

#!/bin/sh
i=0
while [ $i -ne 32 ]
do
  i=$(($i+1))
  # echo "$i"
  sudo userdel nixbld$1
done 


 
  sudo userdel nixbld01-32   (use shell script above for ease)
    (actually del all from # 1-32)  
  or sudo userdel nixbld1-31 
  
  
  sudo rm -rf /nix /etc/nix

  sudo groupdel nixbld
  
CONFIG IN

~/.config/nix/nix.conf

INSTALL SINGLE USER AFTER REMOVING MULTI

https://nixos.wiki/wiki/Nix_Installation_Guide

$ sudo install -d -m755 -o $(id -u) -g $(id -g) /nix
$ curl -L https://nixos.org/nix/install | sh
source $HOME/.nix-profile/etc/profile.d/nix.sh

sh <(curl -L https://nixos.org/nix/install) --no-daemon

@JanCVanB
Copy link

Thank you! 😄

@RealStr1ke
Copy link

I've been trying to install nix for the past 2 hours and finally this worked thanks a ton 👏 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment