Happened during a nixos-rebuild, I’m pretty sure I didn’t mess up anything, and I just changed a value in
Module `/etc/nixos/configuration.nix' has an unsupported attribute `boot'. This is caused by introducing a top-level `config' or `options' attribute. Add configuration attributes immediately on the top le
vel instead, or move all of them (namely: boot environment fonts hardware home-manager i18n networking nix nixpkgs programs security services sound system time users virtualisation xdg zramSwap) into the explici
t `config' attribute.
I’ve searched for all occurrences of boot
opened in two editor
and even looked for unicode hidden chars (maybe a zwnj be in the boot causing issue),
this is all of my lines starting with boot
This can be confusing, but the latter syntax is used to define custom options, whereas the former is just used to set them. config in the latter should contain any options the module sets, and usually contains a whole bunch of conditionals so that it changes based on what is set with the options.
The way it works is that if you omit options and config, all keys will simply be treated as if they were in config.
However, if you define a configand try to set options at the same time, nix won’t be able to distinguish between these two modes, and you get the error message you have.
The reason it talks about boot is simply because it’s the first problem it encountered.
Thus, while looking for boot is nice and all, I really need to see your full config file to se where you went wrong. You probably added an options or config somewhere
Right, I wish the output would have mentioned to look for option and config clearly
the following line, caused me this issue config.firefox.enablePlasmaBrowserIntegration = true;
Thank you for the explanation. I now understood what is wrong with my configuration (why the error is being triggered) but I am unsure how I should go about fixing it. This is the incriminated file:
Essentially, to have the functionality I want (automount of USB thumb drives) I need to enable two services: one in home-manager and one in nixos proper.
Obviously I could simply create two different files each one with their option and config. It works. However it certainly feels like an anti-pattern to have a functionality split in two independently controlled files (that is: having to keep in sync the value of 2 different options).
What is the proper, idiomatic way to achieve what I want?
How did that project solve the described issue? Surely a thing that automatically imports multiple split modules can’t solve the problem that you can’t actually split your module in the first place?
To actually answer the question, though, I don’t think there is an “idiomatic” approach. This comes down to opinion.
The perceived problem is duplication of services between home-manager and NixOS (because there is a user and system service which do “the same” thing).
Personally, I argue that the correct approach is to keep home-manager and NixOS configuration separate, and not view this as a problem in the first place, because fundamentally you should not be mixing system-wide and user-specific configuration.
If you want to pretend there is no difference between user and system services though, and view them as components of the same thing that must therefore be in the same file, you can do that pretty easily in a NixOS module:
I’ve spent half of the day trying to use Haumea and remove all the imports = from my project… without luck. I’m pretty sure I was doing something wrong, but I couldn’t find the issue. By chance, I have found the project vic/import-tree and everything worked in 5 minutes.