Qutebrowser home-manager config issue

I have set up qutebrowser in my home.nix, and every setting seems to work except:

programs.qutebrowser.settings.tabs.padding = {"top" = 2; "bottom" = 4; "right" = 0; "left" = 0;};

I get the following error in qutebrowser:

Errors occurred while reading config.py:
Unhandled exception - AttributeError: ‘dict’ object has no attribute ‘bottom’

I have used the following with no problem in the past in the actual config.py:

c.tabs.padding = {'top': 2, 'bottom': 4, 'right': 0, 'left': 0}

I think I just need to figure out how to translate the qutebrowser syntax to the Nix syntax. Any help?

Qutebrowser expects c.tabs.padding to be a dict, but in nix

programs.qutebrowser.settings.tabs.padding = { "top" = 2; }

is equivalent to

programs.qutebrowser.settings.tabs.padding.top = 2;

so the home manager module will not generate a dict, but the following config

c.tabs.padding.bottom = 4;
c.tabs.padding.left = 0;
c.tabs.padding.right = 0;
c.tabs.padding.top = 2;
To work around this you should set the padding with
programs.qutebrowser.settings.tabs.padding =
  "{'top': 2, 'bottom': 4, 'right': 0, 'left': 0}";

EDIT: Nope that was not right, that wraps the dict in quotes so it still will not work. You should configure this in the extraConfig option

programs.qutebrowser.extraConfig = ''
  c.tabs.padding = {'top': 2, 'bottom': 4, 'right': 0, 'left': 0}
'';
1 Like

Thanks. That’s exactly what I ended up doing. Thanks for the help!