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>
This commit is contained in:
Flameopathic 2025-04-02 10:06:11 -04:00 committed by GitHub
parent 54721996d6
commit 1832ffa9a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,26 +1,47 @@
{ lib, ... }:
{ lib, config, ... }:
{
options.stylix.cursor = lib.mkOption {
description = "Attributes defining the systemwide cursor.";
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.str;
type = lib.types.nullOr lib.types.str;
default = null;
};
package = lib.mkOption {
description = "Package providing the cursor theme.";
type = lib.types.package;
type = lib.types.nullOr lib.types.package;
default = null;
};
size = lib.mkOption {
description = "The cursor size.";
type = lib.types.int;
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.
'';
}
];
}