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: