Home manager waybar doubling some config values

Hello, I am using home-manager and nixpkgs in the unstable branch and with the latest releases (literally just ran nix flake update). I have waybar installed using home-manager, currently the generated waybar config contains doubled values for certain keys for example:

"modules-left": [
 135   │       "hyprland/workspaces",
 136   │       "hyprland/workspaces"
 137   │     ],

when my home manager config is:

 95   |     "modules-left" = {
 96   │       "hyprland/workspaces"
 67   │     };

which baffles me since i cannot seem to find any other mentions of a similar issue so i will put this up here while i keep looking for answers and if anyone wants to help please do and if you need more information i will happily provide

That should be [] not {}. And if that’s already set in some other module then you’re doubling it by setting it again, since list definitions are merged by concatenation.

You could use the nixos-option binary to check in which files "modules-left" is set.

2 Likes

You are correct, this was a copy-error since I wrote it over manually it is [] in the config already, my bad :sweat_smile:

The error remains :upside_down_face:

What error? You mentioned a doubling, did you use nixos-option as mentioned?

1 Like

Probably should have phrased it better, the duplication bug was what I meant. I am currently attempting to explore around with nixos-option but it seems kinda wonky with home-manager, doesn’t seem to want to evaluate everything properly but throws errors like

The option `home-manager.users.myUser.accounts.calendar.basePath' was accessed but has no value defined. Try setting the option.

even though I have never touched accounts

Oh, whoops, I didn’t read carefully that it’s about HM. Are you using HM as a NixOS module or standalone HM?

In the latter case, use nix eval FLAKE#homeConfigurations.USERNAME.options.OPTIONPATH.definitionsWithLocation, replacing FLAKE, USERNAME and OPTIONPATH accordingly. If the former then nixos-option should work with just home-manager.users.USERNAME.OPTIONPATH

2 Likes

Ok so this is just getting weirder:
According to nixos-option the value of
home-manager.users.myUser.programs.waybar.settings is [ ] which it really shouldnt be? (tried using the example values as well but it got the same issue as my own value with duplication)
I am unable to access anything below settings

From what I can see in the definition here:

# The clean list of configurations
 276   │     finalConfiguration = map makeConfiguration settings;
 277   │ 
 278   │     configSource = jsonFormat.generate "waybar-config.json" finalConfiguration;

From what I can gather, the bug should be in jsonFormat.generate but this seems to be some kind of custom function since I cannot really find it on google or noogle and I am too tired to dig through home-managers github right now so will probably continue tomorow.

Thank you both for the help!

First of all that function is defined at the top as jsonFormat = pkgs.formats.json { }; here:

Which again refers to nixpkgs here:

But I doubt that this is a bug as there haven’t been any changes to both files lately on the json code.

Do you have your config somewhere accessible?

1 Like

Gonna fix a minimal config to GH, stay tuned :sunglasses: :point_right: :point_right:

1 Like

Ok, after much tomfoolery and shenanigans I finally got a minimalized (not completely minimal but I do like some functionality to be able to do stuff). Its also anonymized with myUser as the user and hardware-config.nix is missing so you cannot accidentally build with it:

The hunt continues

In troubleshooting we say minimal config/example to mean a config that reproduces the issue - which means it should be buildable as-is.

2 Likes

It should be, only really need to change to correct hardware-config.nix. I could set the default import to /etc/nixos/hardware-configuration if that would be more appropriate?

Edit: now set the import to /etc/nixos/hardware-configuration.nix

This took me way too much time to figure out :smiley:. But you load your home.nix both in your flake.nix as well as in hosts/laptop/configuration.nix.

To be honest this was quite a good learning for me again on troubleshooting.

2 Likes

Thanks! A bit of a stupid bug lol, thought there would be a warning if something like that occurred :grin:

There’s no way for nix or the module system to warn for that - import is a nix builtin, and you can think of it as just placing the entire contents of the import-ed file where you import it.

I personally try to stick to a consistent way of laying out my configs, so that I don’t accidentally make those kinds of errors.

2 Likes