nixos-config/nixos/modules/services/home-assistant.nix
2021-09-25 20:28:25 +02:00

37 lines
778 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.homeAssistantConfig;
mkMagicMergeOption = { description ? "", example ? { }, default ? { }, ... }:
mkOption {
inherit example description default;
type = with lib.types;
let
valueType = nullOr (oneOf [
bool
int
float
str
(attrsOf valueType)
(listOf valueType)
]) // {
description = "";
emptyValue.value = { };
};
in valueType;
};
in {
options.services.homeAssistantConfig = mkMagicMergeOption {
description = ''
home-assistant configuration
'';
};
config = mkIf (cfg != null) { services.home-assistant.config = cfg; };
}