Need help for NixOS Gnome scaling settings


Coming from PopOS, there are two places I need to set this.

  1. Display Settings → scaling to 200%
  2. modify /usr/share/glib-2.0/schemas/org.gnome.desktop.interface.gschema.xml file, I need to change scaling-factor to 2

Does anyone have an example on where to set the scaling factor for NixOS running Gnome?

Thank you.

You should not need to do that, that just changes the default value for the setting you changed in already display settings.

Setting it in Displays pane of GNOME Settings will work on NixOS too.

Thanks for the reply.

Changing the display to 200% ONLY change the scaling for the loggin user.

The log in screen will not change. I have to change /usr/share/glib-2.0/schemas/org.gnome.desktop.interface.gschema.xml to make log in screen scale 2.

Anyway, I was looking for a method to do this declaratively but I can’t seem to find the right tool to do it.

After spending hours searching, I was thinking maybe the autorandr could help.

So I did below

  1. disable wayland because autorandr was giving me error

  2. Include below in home manager setting (scale x=2, y=2 actually make things worse so I had to use 0.5x0.5)

  programs.autorandr = {
    enable = true;
    profiles = {
      "lenovo" = {
        fingerprint = {
          "DP-1" = "";
        config = {
          "DP-1" = {
            enable = true;
            primary = true;
            position = "0x0";
            mode = "3840x2160";
            #gamma = "1.0:0.909:0.833";
            rate = "60.00";
            scale = {
              x = 0.5;
              y = 0.5;

Although it seemed to be scaled, the display quality is quite blurry.

You are not supposed to edit files from packages on classic Linux distros, that will just lead to a mess. The immutable nature of Nix store prevents you from doing that, which makes tinkering a bit harder but at least it removes the temptation.

You could still override the gsettings-desktop-schemas package when building your system but that would end up rebuilding every package that depends on it, which is everything depending on GTK. Or you can replace transplant your overridden package with system.replaceRuntimeDependencies NixOS option to avoid the rebuilds but that is ugly hack.

But since the GDM display manager responsible for the login screen runs as a separate gdm user, configuring its settings is a bit complicated.

There are actually two proper options for changing the settings as a user:

  1. Updating dconf database.
    • This is what ends up happening when you change the settings in GNOME Settings.
    • Typically, each user has their own dconf database inside their home directory (~/.config/dconf/user).
      • But gdm’s home directory is /run/gdm which will not persist when system is shut down so you cannot just copy the database there.
        • You could create a systemd service that would populate the dconf database each time gdm user logs in. This is actually what home-manager does so you might want to use it.
  2. Using dconf overrides.

Until nixos/dconf: Allow creating custom databases · Issue #54150 · NixOS/nixpkgs · GitHub is implemented, I would recommend either using home-manager as NixOS module with the following options:

home-manager.users.gdm = { lib, ... }: {
  dconf.settings = {
    "org/gnome/desktop/interface" = {
      scaling-factor = 2;

or copying the definition of programs.dconf.profiles.gdm option from GDM module into your configuration, adding lib.mkForce to override the original value and adding the desired dconf snippet:

scaling-factor=uint32 1

as an alternate / experiment, does setting = true

get you close enough? That seems to affect gdm scaling.

Thank you so much for the solution. This works perfectly to scale the log in screen.

home-manager.users.gdm = { lib, ... }: {
  dconf.settings = {
    "org/gnome/desktop/interface" = {
      scaling-factor = 2;

I was trying to use the same for my user after logging in but it does not seem to do anything.

Can you please give me some advise on how to achieve the same as Go to Display Settings → scaling to 200% ?


This does not work for me.

I tried both = lib.mkDefault true;

and = true

If it works for the login screen, I would expect it to do so for the user as well. What specifically have you tried?

I have assumed that it changes the scaling-factor key of org/gnome/desktop/interface schema but it looks like the scaling is per display in the Settings app so it might actually do something else.

I do not have a HiDPI screen so I am not sure. Try running dconf watch / command and then try to change it in the Settings app.

Looking at the source code of the Settings app, it forwards the configuration to Mutter

Possibly it changes the scaling factor in ~/.config/monitors.xml, while the scaling-factor GSettings setting is just the default. Maybe try deleting ~/.config/monitors.xml and re log in.

Or you could copy the monitors.xml into your profile configuration and let home-manager manage it declaratively:

home-manager.users.fomm = { lib, ... }: {
  home.file.".config/monitors.xml".source = ./monitors.xml;

I would not recommend that. Looking at the source, it mostly just messes with fonts.

Deleting ~/.config/monitors.xml works.

TIL that some files are not rebuilt when I run nixos-rebuild switch --flake .# command. I had the impression Nix builds everything…

Thanks again for your help.

NixOS is not magic, it just automates what on different distros is often imperatively managed. So just like there, if you change a dconf database, it will not have an effect on completely unrelated file.

Also nixos-rebuild does not manage your home directory. You can use home-manager as a NixOS module and then it can modify the content of your home directory as a part of an activation script but that is opt-in on per-feature basis – you probably would not like it if it suddenly started overwriting random files in your home directory.

And if you want your system to be a real head of cattle, you will probably want to move your home directory on tmpfs.

I enabled scaling for GDM by doing this:

Not the best solution but it works.

In case I’m not the only one using this thread as a reference, I’ll mention that since nixos/dconf: support generating from attrs by linsui · Pull Request #234615 · NixOS/nixpkgs · GitHub (NixOS ≥ 23.11, and reviewed by @jtojnar actually) neither workaround is necessary: customization of dconf settings is supported out of the box using a snippet along the lines of

programs.dconf.profiles.gdm.database = [{
  settings."org/gnome/desktop/interface".scaling-factor = lib.gvariant.mkUint32 2;

(the followup discussion of per-monitor settings notwithstanding).

1 Like