diff --git a/nix/configurations/vanadium/nixos/display.nix b/nix/configurations/vanadium/nixos/display.nix index e1967567..0e1a3f70 100644 --- a/nix/configurations/vanadium/nixos/display.nix +++ b/nix/configurations/vanadium/nixos/display.nix @@ -39,6 +39,8 @@ allExternDevices = map (portNumber: "DP-${toString portNumber}") (lib.range 1 12); + allDevices = ["eDP-1"] ++ allExternDevices; + /** Generate an attribute set by mapping a function over a list of attribute names. It allows setting the name of the attribute. @@ -55,19 +57,18 @@ # Note: the "position" field corresponds to the "pos" field outputted by autorandr # To get the current config, run `xrandr --auto` and then `autorandr --config` configs = { - allOff = genAttrs' allExternDevices (name: { + allOff = genAttrs' allDevices (name: { inherit name; value = {enable = false;}; }); - enableBuiltin = primary: { - eDP-1 = - { - enable = true; - crtc = 0; - mode = "2256x1504"; - rate = "60.00"; - } - // lib.optionalAttrs primary {primary = true;}; + enableBuiltin = { + eDP-1 = { + enable = true; + crtc = 0; + mode = "2256x1504"; + rate = "60.00"; + primary = true; + }; }; enableDevice = name: { ${name} = { @@ -84,32 +85,24 @@ frameworkBuiltin = { fingerprint.eDP-1 = built-in; config = with configs; - allOff // enableBuiltin true; + allOff // enableBuiltin; hooks.postswitch = mkExtSwitch {dpi = 150;}; }; - mkAsusProfile = name: withBuiltin: { + mkAsusProfile = name: { fingerprint = { ${name} = asus-monitor; eDP-1 = built-in; }; config = with configs; - allOff - // enableDevice name - // lib.optionalAttrs withBuiltin (enableBuiltin false); + allOff // enableDevice name; hooks.postswitch = mkExtSwitch {dpi = 120;}; }; in - genAttrs' allExternDevices (name: { - name = "asus-${name}-builtin"; - value = mkAsusProfile name true; - }) + {default = frameworkBuiltin;} // genAttrs' allExternDevices (name: { - name = "asus-${name}-no-builtin"; - value = mkAsusProfile name false; - }) - // { - laptop = frameworkBuiltin; - }; + name = "asus-${name}"; + value = mkAsusProfile name; + }); }; }