stylix: check base16Scheme is not null before using mkSchemeAttrs (#1408)

Link: https://github.com/nix-community/stylix/pull/1408
Closes: https://github.com/nix-community/stylix/issues/1046
Closes: https://github.com/nix-community/stylix/issues/1385

Reviewed-by: awwpotato <awwpotato@voidq.com>
This commit is contained in:
Matt Sturgeon 2025-05-29 18:41:30 +01:00 committed by GitHub
parent 2579395763
commit 3a4599a330
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -164,7 +164,14 @@ in
config = {
# This attrset can be used like a function too, see
# https://github.com/SenchoPens/base16.nix/blob/b390e87cd404e65ab4d786666351f1292e89162a/README.md#theme-step-22
lib.stylix.colors = (cfg.base16.mkSchemeAttrs cfg.base16Scheme).override cfg.override;
#
# NOTE: base16Scheme is nullable. If null, we cannot pass it to mkSchemeAttrs.
# See https://github.com/nix-community/stylix/pull/1408
lib.stylix.colors =
if cfg.base16Scheme == null then
null
else
(cfg.base16.mkSchemeAttrs cfg.base16Scheme).override cfg.override;
assertions = lib.mkIf cfg.enable [
{