nixos-config/nixos/modules/services/home-assistant.nix
2021-11-01 09:20:42 +01:00

40 lines
812 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; };
}