autorandr: deterministic and applies for LigthDM

This commit is contained in:
Geoffrey Frogeye 2024-06-09 14:52:31 +02:00
parent f72112f332
commit 7b9d9053bf
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
6 changed files with 78 additions and 7 deletions

View file

@ -1,4 +1,20 @@
{ pkgs, lib, config, nixos-hardware, displaylinknixpkgs, ... }:
let
displays = {
embedded = {
output = "eDP-1";
edid = "00ffffffffffff000dae381700000000011c01049526157802a155a556519d280b505400000001010101010101010101010101010101b43b804a71383440302035007dd61000001ac32f804a71383440302035007dd61000001a000000fe003059395747803137334843450a00000000000041319e001000000a010a2020004f";
};
deskLeft = {
output = "HDMI-1-3"; # Internal HDMI port
edid = "00ffffffffffff004c2d7b09333032302f160103803420782a01f1a257529f270a505423080081c0810081809500a9c0b300d1c00101283c80a070b023403020360006442100001a000000fd00353f1e5111000a202020202020000000fc00533234423432300a2020202020000000ff0048344d434230333533340a2020010702010400023a80d072382d40102c458006442100001e011d007251d01e206e28550006442100001e011d00bc52d01e20b828554006442100001e8c0ad090204031200c4055000644210000188c0ad08a20e02d10103e9600064421000018000000000000000000000000000000000000000000000000000000000000000000d2";
};
deskRight = {
output = "DVI-I-2-1"; # DisplayLink
edid = "00ffffffffffff004c2d7b093330323020160103803420782a01f1a257529f270a505423080081c0810081809500a9c0b300d1c00101283c80a070b023403020360006442100001a000000fd00353f1e5111000a202020202020000000fc00533234423432300a2020202020000000ff0048344d433830303836350a2020011c02010400023a80d072382d40102c458006442100001e011d007251d01e206e28550006442100001e011d00bc52d01e20b828554006442100001e8c0ad090204031200c4055000644210000188c0ad08a20e02d10103e9600064421000018000000000000000000000000000000000000000000000000000000000000000000d2";
};
};
in
{
config = {
# UEFI works here, and variables can be touched
@ -14,8 +30,8 @@
hardware.cpu.intel.updateMicrocode = true;
frogeye.desktop = {
x11_screens = [
"HDMI-1-3"
"DVI-I-2-1"
displays.deskLeft.output
displays.deskRight.output
];
maxVideoHeight = 1440;
numlock = true;
@ -31,9 +47,41 @@
displaylink = (import displaylinknixpkgs { inherit (super) system; config.allowUnfree = true; }).displaylink;
})
];
# Needs prefetched binary blobs, see https://nixos.wiki/wiki/Displaylink
services.xserver.videoDrivers = [ "displaylink" "modesetting" ];
# TODO See if nvidia and DL can work together.
services = {
autorandr = {
profiles = {
portable = {
fingerprint.${displays.embedded.output} = displays.embedded.edid;
config.${displays.embedded.output} = { };
};
extOnly = {
fingerprint = {
${displays.embedded.output} = displays.embedded.edid;
${displays.deskLeft.output} = displays.deskLeft.edid;
${displays.deskRight.output} = displays.deskRight.edid;
};
config = {
${displays.embedded.output}.enable = false;
${displays.deskLeft.output} = {
primary = true;
mode = "1920x1200";
rate = "59.95";
position = "0x0";
};
${displays.deskRight.output} = {
mode = "1920x1200";
rate = "59.95";
position = "1920x0";
};
};
};
# TODO leftOnly and other things.Might want to abstract a few things first.
};
};
# Needs prefetched binary blobs, see https://nixos.wiki/wiki/Displaylink
xserver.videoDrivers = [ "displaylink" "modesetting" ];
# TODO See if nvidia and DL can work together.
};
};
imports = [
nixos-hardware.nixosModules.dell-g3-3779

View file

@ -29,4 +29,3 @@ in
services.autorandr.enable = true;
};
}
# TODO Deterministic configs?

View file

@ -7,7 +7,7 @@
./boot
./ccc
./common.nix
./desktop.nix
./desktop
./dev
./diff
disko.nixosModules.disko

21
os/desktop/autorandr.nix Normal file
View file

@ -0,0 +1,21 @@
{ pkgs, lib, config, ... }:
let
setupScript = "${pkgs.writeShellApplication {
name = "greeter-setup-script";
runtimeInputs = [ pkgs.autorandr ];
text = ''
autorandr --change
'';
}}/bin/greeter-setup-script";
in
{
config = {
services = {
autorandr.enable = true;
xserver.displayManager.lightdm.extraConfig = ''
[Seat:*]
display-setup-script = ${setupScript}
'';
};
};
}

View file

@ -45,4 +45,7 @@
# So we can use gnome3 pinentry flavour
services.dbus.packages = [ pkgs.gcr ];
};
imports = [
./autorandr.nix
];
}