/nix/var/nix/daemon-socket/socket doesn't exist on fresh install

I had installed Nix from the Ubuntu package. I had some issues that are apparently fixed in the latest version so I uninstalled it by removing the apt package, then also following the uninstall instructions (the Ubuntu package is broken, it doesn’t remove the Nix users).

Then I installed Nix again using sh <(curl -L https://nixos.org/nix/install) --daemon. But there’s no socket to talk to it:

❯❯  journalctl -u nix-daemon | tail                                                                                                                                                                                                                           
Apr 18 13:36:44 chungito systemd[1]: Stopped nix-daemon.service - Nix Daemon.                                                                                                                                                                                 
Apr 18 13:36:44 chungito systemd[1]: Started nix-daemon.service - Nix Daemon.                                                                                                                                                                                 
Apr 18 13:38:55 chungito systemd[1]: Stopping nix-daemon.service - Nix Daemon...                                                                                                                                                                              
Apr 18 13:38:55 chungito systemd[1]: nix-daemon.service: Deactivated successfully.                                                                                                                                                                            
Apr 18 13:38:55 chungito systemd[1]: Stopped nix-daemon.service - Nix Daemon.                                                  
Apr 18 13:38:55 chungito systemd[1]: Started nix-daemon.service - Nix Daemon.                                                  
Apr 18 13:41:17 chungito systemd[1]: Stopping nix-daemon.service - Nix Daemon...                                               
Apr 18 13:41:17 chungito systemd[1]: nix-daemon.service: Deactivated successfully.                                             
Apr 18 13:41:17 chungito systemd[1]: Stopped nix-daemon.service - Nix Daemon.                                                  
Apr 18 13:41:17 chungito systemd[1]: Started nix-daemon.service - Nix Daemon.                                                  

❯❯  systemctl status nix-daemon
● nix-daemon.service - Nix Daemon
     Loaded: loaded (/etc/systemd/system/nix-daemon.service; linked; preset: enabled)
     Active: active (running) since Fri 2025-04-18 13:41:17 CEST; 59s ago
TriggeredBy: ● nix-daemon.socket
       Docs: man:nix-daemon
             https://nixos.org/manual
   Main PID: 182342 (nix-daemon)
      Tasks: 2 (limit: 1048576)
     Memory: 4.0M (peak: 4.3M)
        CPU: 16ms
     CGroup: /system.slice/nix-daemon.service
             └─182342 nix-daemon --daemon

Apr 18 13:41:17 chungito systemd[1]: Started nix-daemon.service - Nix Daemon.

❯❯  nix --version
nix (Nix) 2.28.2

❯❯  nix-daemon --version
nix-daemon (Nix) 2.28.2

❯❯  nix-shell -p nix-info --run "nix-info -m"
warning: Nix search path entry '/nix/var/nix/profiles/per-user/brendan/channels/nixpkgs' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/brendan/channels' does not exist, ignoring
error:
       … while evaluating a branch condition
         at /nix/store/caflilr6s25zpmanjayzp91nkc711b98-nixpkgs/nixpkgs/pkgs/stdenv/booter.nix:107:9:
          106|       thisStage =
          107|         if args.__raw or false then
             |         ^
          108|           args'

       … in the right operand of the update (//) operator
         at /nix/store/caflilr6s25zpmanjayzp91nkc711b98-nixpkgs/nixpkgs/pkgs/stdenv/booter.nix:90:44:
           89|     # for the final stage.
           90|     { allowCustomOverrides = index == 1; } // (stageFun prevStage)
             |                                            ^
           91|   ) (lib.lists.reverseList stageFuns);

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

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

❯❯  ls /nix/var/nix/daemon-socket/

Any idea what could be the cause of this? I’m on Ubuntu 24.04.2 LTS

Hm, fixed after a reboot. My guess is there’s some other service besides nix-daemon that was enabled but not started or something?

The default behaviour is socket activation, so probably nix-deamon.socket was missing.