{ config, lib, ... }: let cfg = config.poz.other.hardware; inherit (lib.attrsets) mapAttrsToList; inherit (lib.modules) mkIf; inherit (lib.options) mkOption; inherit (lib.types) attrsOf float int submodule; inherit (lib.types.ints) positive; in { options.poz.other.hardware = { monitors = mkOption { description = "hostname for this system"; type = attrsOf (submodule { options = { resolution = mkOption { description = "monitor resolution"; type = submodule { options = { w = mkOption { description = "monitor width"; type = positive; }; h = mkOption { description = "monitor height"; type = positive; }; }; }; }; refreshRate = mkOption { description = "monitor refresh rate"; type = positive; }; position = mkOption { description = "monitor position"; type = submodule { options = { x = mkOption { description = "monitor x position"; type = int; }; y = mkOption { description = "monitor y position"; type = int; }; }; }; }; scale = mkOption { description = "monitor scale"; type = float; }; }; }); default = {}; }; }; config = mkIf (cfg.monitors != {}) { boot.kernelParams = mapAttrsToList (name: m: let xres = toString m.resolution.w; yres = toString m.resolution.h; refresh = toString m.refreshRate; in # https://www.kernel.org/doc/html/latest/fb/modedb.html "video=${name}:${xres}x${yres}@${refresh}" ) cfg.monitors; }; }