11.stylix/stylix/cursor.nix
Flameopathic 1832ffa9a2
stylix: prevent partially declared cursor (#1080)
Closes: https://github.com/danth/stylix/issues/1064
Link: https://github.com/danth/stylix/pull/1080

Reviewed-by: awwpotato <153149335+awwpotato@users.noreply.github.com>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
2025-04-02 07:06:11 -07:00

47 lines
1.2 KiB
Nix

{ lib, config, ... }:
{
options.stylix.cursor = lib.mkOption {
description = ''
Attributes defining the systemwide cursor. Set either all or none of
these attributes.
'';
type = lib.types.nullOr (
lib.types.submodule {
options = {
name = lib.mkOption {
description = "The cursor name within the package.";
type = lib.types.nullOr lib.types.str;
default = null;
};
package = lib.mkOption {
description = "Package providing the cursor theme.";
type = lib.types.nullOr lib.types.package;
default = null;
};
size = lib.mkOption {
description = "The cursor size.";
type = lib.types.nullOr lib.types.int;
default = null;
};
};
}
);
default = null;
};
config.assertions =
let
inherit (config.stylix) cursor;
in
[
{
assertion =
cursor == null
|| cursor.name != null && cursor.package != null && cursor.size != null;
message = ''
stylix: `stylix.cursor` is only partially defined. Set either none or
all of the `stylix.cursor` options.
'';
}
];
}