nixos-config/nixos/modules/services/home-assistant.nix

41 lines
812 B
Nix
Raw Normal View History

2019-10-24 02:20:38 +02:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.homeAssistantConfig;
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)
]) // {
description = "";
emptyValue.value = { };
};
2021-11-01 09:20:42 +01:00
in
valueType;
};
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
options.services.homeAssistantConfig = mkMagicMergeOption {
2019-10-24 02:20:38 +02:00
description = ''
home-assistant configuration
'';
};
config = mkIf (cfg != null) { services.home-assistant.config = cfg; };
2019-10-24 02:20:38 +02:00
}