After updating NixOS, I can't use Slime (a package in Emacs) anymore

Hi,

I would like to ask for help. Since the installation in last November, It was necessary now for me to update my packages. Thus, I followed the instruction from this post.


[pedro@system:~]$ sudo nix-channel --list
[sudo] password for pedro:
nixos https://nixos.org/channels/nixos-21.05

[pedro@system:~]$ sudo nix-channel --remove nixos
building
'/nix/store/xsk9wjy0dpp7w7d3r3bkzxzaklqdzq6q-user-environment.drv'...
created 0 symlinks in user environment

[pedro@system:~]$ sudo nix-channel --add
https://nixos.org/channels/nixos-21.11

[pedro@system:~]$ sudo nix-channel --list
nixos-21.11 https://nixos.org/channels/nixos-21.11

[pedro@system:~]$ sudo nix-channel --update
unpacking channels...
created 1 symlinks in user environment

[pedro@system:~]$ sudo nixos-rebuild switch

Several messages were returned. There were some error reports:

warning: Nix search path entry
'/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist,
ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using
$NIX_PATH or -I)
building the system configuration...
warning: Nix search path entry
'/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist,
ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it
using $NIX_PATH or -I)

After rebooting the PC, I cannot start Slime on Emacs anymore. I receive the error message below which seems to be similar to the error reported after executing nixos-rebuild switch:

(progn (load "/home/pedro/.emacs.d/elpa/slime-20211108.2224/swank-loader.lisp" :verbose t) (funcall (read-from-string "swank-loader:init") :from-emacs t) (funcall (read-from-string "swank:start-server") "/tmp/slime.1771"))

warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at /home/pedro/projects/nyxt/build-scripts/shell.nix:6:17

Process inferior-lisp exited abnormally with code 1

This is my config file (in case this is relevant).

And this might be useful:

[pedro@system:~]$ sudo sh -c 'echo $NIX_PATH'
[sudo] password for pedro: 
nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels

[pedro@system:~]$ sudo nix-channel --list
nixos-21.11 https://nixos.org/channels/nixos-21.11

Why did this happen?

How do I solve it?

Thanks!

You need to add the channel with the explicit name nixos which everything later on is trying to look up, i. e. via sudo nix-channel --add https://nixos.org/channels/nixos-21.11 nixos. Make sure to clean up the channel you created before (should be name nixos-21.11) as well.

2 Likes