Syntax error /etc/nixos/configuration.nix:162.1:

Hello! Im new to NixOs (and Linux in general) and I’m having trouble with rebuilds.

I was able to do 3 rebuilds just fine, then I tried activating a few modules at once (nexus mod manager and two others I don’t remember) and that’s when the rebuild error started happening. I tried reverting to previous builds (even the original) but now it’s a problem for all of them.

I also can’t find that file to fix it, it doesn’t seem to be in the config file.

Thank you in advance!

Full Error log after rebuild attempts below:

error:
… while evaluating the attribute ‘config’
at /nix/store/k0yaq0ngk05qm9ds7182nbss5di6k8i8-nixos-26.05.10882
.7fc6f2c20af0/nixos/lib/modules.nix:402:9:
401| options = checked options;
402| config = checked (removeAttrs config [ “_module” ]
);
| ^
403| _module = checked (config._module);

   … while calling the '**seq**' builtin 
     **at /nix/store/k0yaq0ngk05qm9ds7182nbss5di6k8i8-nixos-26.05.10882**

.7fc6f2c20af0/nixos/lib/modules.nix:402:18:
401| options = checked options;
402| config = checked (removeAttrs config [ “_module” ]
);
| ^
403| _module = checked (config._module);

   **(stack trace truncated; use '--show-trace' to show the full, detai**

led trace)

   **error:** syntax error, unexpected end of file, expecting '"' 
   **at /etc/nixos/configuration.nix:162:1**: 
      161| } 
      162| 
         | **^**

According your error message there is a syntax error in your configuration.nix file.

Due to the message I’d assume a missing "

But as there is no code available it’s just guessing

Thank you! I was looking for something specifically with that name. I was able to fix it and rebuild.

Do you know why it would persist even in past rebuilds? I thought going back reverted the config file. (and is the number at the end of the config file indicating the build version?)

If you mean the :402:9-type stuff, that’s the line number+column. The 26.05.10882 .7fc6f2c20af0 part is the version of nixpkgs that your channel is on. You really should keep your config in git (or, even better but also more to learn, a colocated Jujutsu+git repo) if you’re not already.

It persists when booting to past builds because a rebuild evaluates the current config from /etc/nixos, which is a mutable folder on your filesystem (nixos-rebuild wouldn’t be able to pick up your changes to it otherwise!).

Thank you! That’s super informative!