Error: … in the left operand of the update (//) operator

Not entirely sure what I did to cause this but when I try to run a nixos-rebuild switch, I am getting these errors - any idea on how to troubleshoot this?

building the system configuration…
error:
… in the left operand of the update (//) operator

     at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:113:35:

      112| in
      113| withWarnings nixosWithUserModules // {
         |                                   ^
      114|   inherit extraArgs;

   … while calling the 'import' builtin

     at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:32:9:

       31| , prefix ? []
       32| , lib ? import ../../lib
         |         ^
       33| , extraModules ? let e = builtins.getEnv "NIXOS_EXTRA_MODULE_PATH";

   error: syntax error, unexpected end of file

   at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/default.nix:1:1:

        1|
         | ^

I’m not sure about the cause, but the message makes me think this file is empty.

1 Like

it is empty - what’s the best way to restore it?

Looks like you’re using nix-channel.

Maybe repairing the store path works, as channel contents are stored in the store, but I don’t know if those are also available in the cache. That’d be a bit wasteful.

Probably best to repair your entire store, considering you have at least one corruption.

nix-store --verify --check-contents --repair

If that doesn’t work, nix-channel --update might serve as a workaround, if the remote channel has moved since.

2 Likes

looks like that repair did the trick - the nix rebuild was completed after that. thanks so much. I wonder what caused that to happen.

1 Like