Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

palette: fix eval fail when image is null #912

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions stylix/palette.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,13 @@ in
'';
type =
with lib.types;
oneOf [
nullOr (oneOf [
path
lines
attrs
];
default = cfg.generated.palette;
]);
# defaults to null when cfg.image is also null, in order to trigger the assertion below correctly
default = if cfg.image == null then null else cfg.generated.palette;
defaultText = lib.literalMD ''
The colors used in the theming.

Expand Down Expand Up @@ -159,9 +160,9 @@ in
# https://github.com/SenchoPens/base16.nix/blob/b390e87cd404e65ab4d786666351f1292e89162a/README.md#theme-step-22
lib.stylix.colors = (cfg.base16.mkSchemeAttrs cfg.base16Scheme).override cfg.override;

assertions = [
assertions = lib.mkIf cfg.enable [
{
assertion = !(cfg.image == null && cfg.base16Scheme == null);
assertion = cfg.base16Scheme != null;
message = "One of `stylix.image` or `stylix.base16Scheme` must be set";
}
];
Expand Down