Skip to content

Commit

Permalink
fix(nixos): Don't configure monitors on laptop
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Nov 26, 2024
1 parent 5808e95 commit 7dd173a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 4 additions & 2 deletions home-manager/modules/gnome/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{ isLinux, pkgs, ... }:
{ isLinux, isThinkpad, lib, pkgs, ... }:
if isLinux then {
imports = [ ./dconf.nix ];
xdg.configFile = {
"monitors.xml".source = ../../../conf.d/gnome-monitors.xml;
# workaround for https://github.com/nix-community/home-manager/issues/3447
# autostart 1Password in the background so I can use the SSH agent without manually opening the app first
"autostart/1password.desktop".text = ''
Expand Down Expand Up @@ -30,6 +29,9 @@ if isLinux then {
MimeType=x-scheme-handler/sgnl;x-scheme-handler/signalcaptcha;
Categories=Network;InstantMessaging;Chat;
'';
} // lib.attrsets.optionalAttrs (!isThinkpad) {
# On desktop, statically configure monitors
"monitors.xml".source = ../../../conf.d/gnome-monitors.xml;
};
} else
{ }
1 change: 0 additions & 1 deletion hosts/pc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,4 @@
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?

}
12 changes: 7 additions & 5 deletions nixos-modules/desktop_environment.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, lib, isThinkpad, ... }:
let
monitor_config = pkgs.writeText "gdm_monitors.xml"
(builtins.readFile ../conf.d/gnome-monitors.xml);
Expand All @@ -22,10 +22,7 @@ in {
});
})
];
# make GDM use the same monitor config as GNOME;
# see: https://discourse.nixos.org/t/set-external-monitor-as-primary-display-before-login/37844/4
systemd.tmpfiles.rules =
[ "L+ /run/gdm/.config/monitors.xml - - - - ${monitor_config}" ];

services = {
displayManager.defaultSession = "gnome-xorg";
xserver = {
Expand Down Expand Up @@ -61,4 +58,9 @@ in {
package = pkgs.gnomeExtensions.gsconnect;
};
programs.dconf.enable = true;
} // lib.attrsets.optionalAttrs (!isThinkpad) {
# make GDM use the same monitor config as GNOME;
# see: https://discourse.nixos.org/t/set-external-monitor-as-primary-display-before-login/37844/4
systemd.tmpfiles.rules =
[ "L+ /run/gdm/.config/monitors.xml - - - - ${monitor_config}" ];
}

0 comments on commit 7dd173a

Please sign in to comment.