New user here, can anyone look at my configuration.nix weird error

Yeah, these are always a bit of a pain. One or more of the configuration options you set does not have the correct type for whatever it’s supposed to be.

Apparently getting a nicer error message would require writing a SAT solver because nix doesn’t currently expose enough metadata to the language itself (and nixpkgs is written in nix and therefore has no lower level access to what nix is doing), so this is what we’re stuck with - or at least that’s how I understood the last discussion on why these errors are so bad.

What’s wrong can be hard to see at a glance if you make lots of changes in one go, usually easier to know where the culprit is if the last change you made caused the error. So to avoid things like this, I advise not writing full system configurations without incrementally testing them. Language servers like nil or nixd can help spot these things right in your editor so you don’t even need to try and evaluate it manually.

That said, knowing how to avoid an issue doesn’t help if you already have it.

In this case, I’m going to guess it’s all the nixos.<something> packages:

Specifically, nixos.betterbird, nixos.git, nixos.ripcord and nixos.vscode. You have similar things elsewhere, too.

You don’t have any weird overlays that would create a nixos attribute in pkgs, so this is something in nixpkgs by default.

Can’t say I’ve touched it myself before, but here’s the definition if you’re curious. It basically seems to just give you the result of import <nixpkgs> { }, to be used as a dependency when people define spicy packages that want to contain a NixOS (e.g. some virtual machine thing). Definitely not to include in your package list :wink:

So, pkgs.nixos is a function then, and you’re trying to access the betterbird attribute (among others) of it. Since functions aren’t sets, nix sees that the type is wrong (since . can only be used on sets), and you get the error you’re seeing.

Just remove all the nixos. from your package lists and you should be good to go.

Where did you get the idea you needed that in the first place?

1 Like