New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/gdm: add option to configure monitors.xml #107850
Conversation
This option allows users to configure GDM to respect custom monitor setups, such as those generated by GNOME in `~/.config/monitors.xml`. See this section of the ArchWiki GDM page regarding monitor settings: https://wiki.archlinux.org/index.php/GDM#Setup_default_monitor_settings The GDM home directory in NixOS is a tmpfs at `/run/gdm`, so the config is persisted in a similar way to the pulseaudio config, by adding a systemd tmpfiles rule to symlink it from a generated file written to the nix store. Relevant discourse thread: https://discourse.nixos.org/t/gdm-monitor-configuration/6356
7e4c8a0
to
b15435e
Compare
I changed the type from Tested and confirmed working using One other thing I wanted to note is that removing a definition for this option (after setting it and building at least once) won't have an effect until the system is restarted since the rebuild will only remove the tmpfile rule, which doesn't result in the config being unlinked until a fresh tmpfs is created on reboot. Open to suggestions if there's an approach that avoids this or if I should make a note of that behavior somehow. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/gdm-monitor-configuration/6356/3 |
Prematurely: not stale. I'm interested in this. |
@isobit it would be unexpected for a reboot is necessary unless it it documented. For this reason the tmpfile.rules system is not ideal. Often you'll see an ExecPreStart populating this directory with content. You'll also see the usage of serviceConfig.StateDirectory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on nixos-21.05 and fixed my issue. Backport would be appreciated.
@NixOS/gnome can this be merged with tomberek's recommendations? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Any news on that? |
Hi, may I ask if we could merge this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I feel that this is too niche a feature to warrant a NixOS option. It does not really add anything over users customizing the contents of /run/gdm/.config/monitors.xml
themselves, other that somewhat obscure documentation that already understaffed GNOME team would have to end up maintaining.
By the way, if you use home-manager through NixOS configuration, you can just do:
home-manager.users.gdm = {
home.file.".config/monitors.xml".text = ''
<monitors version="2">
…
</monitors>
'';
};
Though note that gdm
will have to be in nix.settings.allowed-users
NixOS option in order for the home-manager activation systemd service to be able to run. This is true unless you override the NixOS option, since the option defaults to [ "*" ]
.
My thought was that the To elaborate a bit, the issue that I and other users in the discourse thread ran into was needing the config to exist at the system level so that even the GDM login screen would display on a preferred monitor, so |
I have the file already in This is what I have ended up with:
Using the symlink approach, I still see the link under root user, that's why I use |
Motivation for this change
This option allows users to configure GDM to respect custom monitor
setups, such as those generated by GNOME in
~/.config/monitors.xml
.See this section of the ArchWiki GDM page regarding monitor settings:
https://wiki.archlinux.org/index.php/GDM#Setup_default_monitor_settings
The GDM home directory in NixOS is a tmpfs at
/run/gdm
, so the configis persisted in a similar way to the pulseaudio config, by adding a
systemd tmpfiles rule to symlink it from a generated file written to the
nix store.
Relevant discourse thread: https://discourse.nixos.org/t/gdm-monitor-configuration/6356
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)