74 lines
1.6 KiB
Nix
74 lines
1.6 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
options =
|
|
let
|
|
inherit (lib) mkOption types;
|
|
mkStrOption =
|
|
default:
|
|
mkOption {
|
|
type = types.str;
|
|
default = default;
|
|
};
|
|
mkIntOption =
|
|
default:
|
|
mkOption {
|
|
type = types.int;
|
|
default = default;
|
|
};
|
|
mkBoolOption =
|
|
default:
|
|
mkOption {
|
|
type = types.bool;
|
|
default = default;
|
|
};
|
|
in
|
|
{
|
|
monitors = mkOption {
|
|
type = types.listOf (
|
|
types.submodule {
|
|
options = {
|
|
isPrimary = mkBoolOption false;
|
|
name = mkStrOption null;
|
|
width = mkIntOption 1920;
|
|
height = mkIntOption 1080;
|
|
refreshRate = mkIntOption 60;
|
|
x = mkIntOption 0;
|
|
y = mkIntOption 0;
|
|
transform = mkOption {
|
|
type = types.enum [
|
|
"normal"
|
|
"clockwise"
|
|
"flip"
|
|
"counterclockwise"
|
|
];
|
|
default = "normal";
|
|
};
|
|
vrr = mkBoolOption false;
|
|
};
|
|
}
|
|
);
|
|
default = [ ];
|
|
};
|
|
};
|
|
config =
|
|
let
|
|
monitors = config.monitors;
|
|
primaryMonitor = lib.findSingle (m: m.isPrimary) "none" "multiple" monitors;
|
|
in
|
|
{
|
|
assertions = [
|
|
{
|
|
assertion = primaryMonitor != "none";
|
|
message = "No primary monitor";
|
|
}
|
|
{
|
|
assertion = primaryMonitor != "multiple";
|
|
message = "Multiple primary monitors";
|
|
}
|
|
];
|
|
};
|
|
}
|