Gnome3 settings via configuration.nix

Hi all,

I am trying to configure my gnome3 desktop from configuration.nix.
In particular, I would like to set the theme and the background image. I guess that if this works, then I can do more :slight_smile:

I am trying to set it this way:

services.xserver.desktopManager.gnome3.extraGSettingsOverrides = ''
[org.gnome.desktop.background]
picture-uri='file://home/alexey/my-background.jpg'
'';

but it doesnā€™t seem to have any effect after nixos-rebuild switch.
When I dump the configuration with dconf it still shows the ā€œoldā€ background image.

Can anyone explain me how to configure gnome3 from configuration.nix?

Unfortunately, gsettings overrides only effect the default value. So youā€™d have to reset the keys if already changed. In the hopefully very near future, you could do any dconf setting nixos/dconf: Allow creating custom databases Ā· Issue #54150 Ā· NixOS/nixpkgs Ā· GitHub.

Oh, awesome! It means that my settings are going to be applied when I configure the machine for the first time, right?
What would be the way of testing it? Nuke something from my home directory?

You can use dconf Editor (gnome3.dconf-editor) to easily nuke individual settings to test.

As an alternative, you can also use home-managerā€™s dconf.settings module (docs); this is per-user, but will actually reset existing keys when you run home-manager switch. home-manager can be integrated into your configuration.nix as a module; I presume that things like dconf.settings work similarly in this case, but Iā€™ve never used the module functionality myself so Iā€™m not 100% sure.

Thanks! I just tried to configure a fresh machine and it worked like a charm!

I havenā€™t used home-manager, maybe it is something that I need to learnā€¦

Hello worldofpeace,

First, thank you for the amazing Pantheon desktop environment! It is possible to use home-managers dconf.setting module for Pantheon?

Thank you!

1 Like

FWIW, using home-managerā€™s dconf.settings module to configure Pantheon is exactly how I handle things. Hereā€™s the relevant file from my ā€œdotfilesā€ (that repo is a bit of a work-in-progress right now).

The only problem Iā€™ve run into is that /org/gnome/settings-daemon/plugins/color/night-light-temperature expects an unsigned 32-bit INT, but home-manager inserts a signed 32-bit INTā€¦ Which then gets promptly ignored. But as you can tell from the path, this is actually a GNOME component that Pantheonā€™s re-using, and the deficiency is technically in home-manager anyway (Iā€™ve run into a few other similar issues).

1 Like

Thank you! I have basically every dcofig setting working after looking at your configs. However, I canā€™t get the ā€œmiller_columnsā€ configuration to work (the three column view in Files).

I have the following

ā€œio/elementary/files/preferencesā€ = {
default-viewmode = ā€œmiller_columnsā€;
};

Doesnā€™t seem to work. Also, my dconf-editor is telling me there is no schema. Why is that?

Anyway, I really appreciate you taking the time to help me with my original question!

A lot of per-application schemas on NixOS show the No schema found note. I think this is because of how Nix handles applications files, and Iā€™ve rarely run into any problems this approach causes (though this might be an exception).

I did some experimentation around the default-viewmode for Files, and can reproduce your issue. It looks like the reason for this is that setting default-viewmode isnā€™t sufficient in and of itself; tab-info-list also needs to be set (you can see this second key change after switching the view mode in Files and then closing the window). Digging around in Filesā€¦ wellā€¦ files reveals that tab-info-list is a tuple with the following schema:

<key type="a(uss)" name="tab-info-list">
  <summary>Details of open tabs</summary>
  <default>[(0,'','')]</default>
  <description>Array of tab info:  View mode, root uri, tip uri (for Miller view)</description>
</key>

The ā€œview modeā€ here corresponds to 0 for the icon view, 1 for the list view, and 2 for miller_columns. The two strings are of the form file:///path/to/directory, with the second string being empty for the icon and list views.

Unfortunately, home-manager canā€™t yet set dconf tuples (though thereā€™s a pull request open to add this functionality), so it doesnā€™t look like Fileā€™s view mode can be fully set yet. :frowning:

Wow! Thanks for the detailed information. Users like you keep people like me here (on second thought, I am not so sure that is a good thing):grin: