aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hosts/c-pc/configuration.nix15
-rw-r--r--roles/desktop/default.nix8
-rw-r--r--roles/desktop/xserver.nix14
3 files changed, 24 insertions, 13 deletions
diff --git a/hosts/c-pc/configuration.nix b/hosts/c-pc/configuration.nix
index 6d49784..22ceed6 100644
--- a/hosts/c-pc/configuration.nix
+++ b/hosts/c-pc/configuration.nix
@@ -54,7 +54,20 @@
];
roles = {
- desktop.enable = true;
+ desktop = {
+ enable = true;
+ setupCommands = ''
+ if ${pkgs.xorg.xrandr}/bin/xrandr --query | grep 2560x1080; then
+ ${pkgs.xorg.xrandr}/bin/xrandr --output DVI-D-0 --mode 1920x1080 --rate 60 --pos 0x0
+ ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-2 --mode 2560x1080 --rate 60 --pos 1920x0 --primary
+ ${pkgs.xorg.xrandr}/bin/xrandr --output HDMI-A-0 --mode 1920x1080 --rate 75 --pos 4480x0
+ elif ${pkgs.xorg.xrandr}/bin/xrandr --query | grep 2560x1440; then
+ ${pkgs.xorg.xrandr}/bin/xrandr --output DVI-D-0 --mode 1920x1080 --rate 60 --pos 0x360
+ ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-2 --mode 2560x1440 --rate 165 --pos 1920x0 --primary
+ ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-1 --mode 1920x1200 --rate 60 --pos 4480x0
+ fi
+ '';
+ };
};
programs = {
diff --git a/roles/desktop/default.nix b/roles/desktop/default.nix
index f48b82c..ac6444f 100644
--- a/roles/desktop/default.nix
+++ b/roles/desktop/default.nix
@@ -9,6 +9,14 @@ let cfg = config.roles.desktop; in {
options.roles.desktop = {
enable = mkEnableOption "desktop";
+
+ setupCommands = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Shell commands executed just after the X server has started.
+ '';
+ };
};
config = mkIf cfg.enable {
diff --git a/roles/desktop/xserver.nix b/roles/desktop/xserver.nix
index 461de83..89e768e 100644
--- a/roles/desktop/xserver.nix
+++ b/roles/desktop/xserver.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ config, pkgs, ... }:
{
services.displayManager = {
@@ -9,17 +9,7 @@
videoDrivers = [ "amdgpu" ];
displayManager = {
- setupCommands = ''
- if ${pkgs.xorg.xrandr}/bin/xrandr --query | grep 2560x1080; then
- ${pkgs.xorg.xrandr}/bin/xrandr --output DVI-D-0 --mode 1920x1080 --rate 60 --pos 0x0
- ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-2 --mode 2560x1080 --rate 60 --pos 1920x0 --primary
- ${pkgs.xorg.xrandr}/bin/xrandr --output HDMI-A-0 --mode 1920x1080 --rate 75 --pos 4480x0
- elif ${pkgs.xorg.xrandr}/bin/xrandr --query | grep 2560x1440; then
- ${pkgs.xorg.xrandr}/bin/xrandr --output DVI-D-0 --mode 1920x1080 --rate 60 --pos 0x360
- ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-2 --mode 2560x1440 --rate 165 --pos 1920x0 --primary
- ${pkgs.xorg.xrandr}/bin/xrandr --output DisplayPort-1 --mode 1920x1200 --rate 60 --pos 4480x0
- fi
- '';
+ setupCommands = config.roles.desktop.setupCommands;
};
xkb.layout = "us";