2019-10-24 02:20:38 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.homeAssistantConfig;
|
|
|
|
|
2020-06-01 23:20:15 +02:00
|
|
|
mkMagicMergeOption = { description ? "", example ? { }, default ? { }, ... }:
|
|
|
|
mkOption {
|
|
|
|
inherit example description default;
|
|
|
|
type = with lib.types;
|
|
|
|
let
|
2021-11-01 09:20:42 +01:00
|
|
|
valueType = nullOr
|
|
|
|
(oneOf [
|
|
|
|
bool
|
|
|
|
int
|
|
|
|
float
|
|
|
|
str
|
|
|
|
(attrsOf valueType)
|
|
|
|
(listOf valueType)
|
|
|
|
]) // {
|
2020-06-01 23:20:15 +02:00
|
|
|
description = "";
|
|
|
|
emptyValue.value = { };
|
|
|
|
};
|
2021-11-01 09:20:42 +01:00
|
|
|
in
|
|
|
|
valueType;
|
2020-06-01 23:20:15 +02:00
|
|
|
};
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2021-11-01 09:20:42 +01:00
|
|
|
in
|
|
|
|
{
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2020-06-01 23:20:15 +02:00
|
|
|
options.services.homeAssistantConfig = mkMagicMergeOption {
|
2019-10-24 02:20:38 +02:00
|
|
|
description = ''
|
|
|
|
home-assistant configuration
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-06-01 23:20:15 +02:00
|
|
|
config = mkIf (cfg != null) { services.home-assistant.config = cfg; };
|
2019-10-24 02:20:38 +02:00
|
|
|
}
|