Add options availability checks (#100)

This allows using master on 22.11 and on NixOS without the HM module.
See #89 for design rationale.
This commit is contained in:
Arseniy Chekanov 2023-05-20 13:42:03 +03:00 committed by GitHub
parent 1c953ad0dc
commit cd9e19daa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View file

@ -1,4 +1,4 @@
{pkgs, config, lib, ... }:
{pkgs, config, lib, options, ... }:
with config.lib.stylix.colors.withHashtag;
with config.stylix.fonts;
@ -10,7 +10,7 @@ in
config.lib.stylix.mkEnableTarget "Avizo" true;
# Referenced https://github.com/stacyharper/base16-mako
config = lib.mkIf config.stylix.targets.avizo.enable {
config = lib.optionalAttrs (options.services ? avizo) (lib.mkIf config.stylix.targets.avizo.enable {
services.avizo = {
settings = {
default = {
@ -21,5 +21,5 @@ in
};
};
};
};
});
}

View file

@ -1,4 +1,4 @@
{pkgs, config, lib, ... }:
{pkgs, config, lib, options, ... }:
with config.lib.stylix.colors.withHashtag;
with config.stylix.fonts;
@ -9,7 +9,7 @@ in {
config.lib.stylix.mkEnableTarget "Mako" true;
# Referenced https://github.com/stacyharper/base16-mako
config = lib.mkIf config.stylix.targets.mako.enable {
config = lib.optionalAttrs (options.services ? mako) (lib.mkIf config.stylix.targets.mako.enable {
services.mako = {
backgroundColor = base00 + makoOpacity;
borderColor = base0D;
@ -29,5 +29,5 @@ in {
text-color=${base08}
'';
};
};
});
}

View file

@ -41,7 +41,7 @@ in {
};
};
config = lib.mkIf hm.autoImport {
config = lib.optionalAttrs (options ? home-manager) (lib.mkIf hm.autoImport {
home-manager.sharedModules = [ homeManagerModule ];
};
});
}