mirror of
https://github.com/jbowdre/dotfiles.git
synced 2024-11-26 02:52:18 +00:00
59 lines
1.3 KiB
Nix
59 lines
1.3 KiB
Nix
|
{ lib, config, ... }:
|
||
|
|
||
|
let
|
||
|
inherit (lib) mkOption types;
|
||
|
cfg = config.monitors;
|
||
|
in
|
||
|
{
|
||
|
options.monitors = mkOption {
|
||
|
type = types.listOf (types.submodule {
|
||
|
options = {
|
||
|
name = mkOption {
|
||
|
type = types.str;
|
||
|
example = "DP-1";
|
||
|
};
|
||
|
primary = mkOption {
|
||
|
type = types.bool;
|
||
|
default = false;
|
||
|
};
|
||
|
width = mkOption {
|
||
|
type = types.int;
|
||
|
example = 1920;
|
||
|
};
|
||
|
height = mkOption {
|
||
|
type = types.int;
|
||
|
example = 1080;
|
||
|
};
|
||
|
refreshRate = mkOption {
|
||
|
type = types.int;
|
||
|
default = 60;
|
||
|
};
|
||
|
x = mkOption {
|
||
|
type = types.int;
|
||
|
default = 0;
|
||
|
};
|
||
|
y = mkOption {
|
||
|
type = types.int;
|
||
|
default = 0;
|
||
|
};
|
||
|
enabled = mkOption {
|
||
|
type = types.bool;
|
||
|
default = true;
|
||
|
};
|
||
|
workspace = mkOption {
|
||
|
type = types.nullOr types.str;
|
||
|
default = null;
|
||
|
};
|
||
|
};
|
||
|
});
|
||
|
default = [ ];
|
||
|
};
|
||
|
config = {
|
||
|
assertions = [{
|
||
|
assertion = ((lib.length config.monitors) != 0) ->
|
||
|
((lib.length (lib.filter (m: m.primary) config.monitors)) == 1);
|
||
|
message = "Exactly one monitor must be set to primary.";
|
||
|
}];
|
||
|
};
|
||
|
}
|