summaryrefslogtreecommitdiffstats
path: root/lass/3modules/hass.nix
blob: 96521aaa9736775b3cfe4eaf0504603ef27c6658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ config, lib, pkgs, ... }:
with import <stockholm/lib>;
let

  cfg = config.lass.hass;

in {
  options.lass.hass = {
    config = mkOption {
      default = {};
      type =  with lib.types; let
          valueType = nullOr (oneOf [
            bool
            int
            float
            str
            (attrsOf valueType)
            (listOf valueType)
          ]) // {
            description = "Yaml value";
            emptyValue.value = {};
          };
        in valueType;
    };
    love = mkOption {
      default = {};
      type =  with lib.types; let
          valueType = nullOr (oneOf [
            bool
            int
            float
            str
            (attrsOf valueType)
            (listOf valueType)
          ]) // {
            description = "Yaml value";
            emptyValue.value = {};
          };
        in valueType;
    };
  };

  config =
    assert versionOlder version "20.09";
    mkIf (cfg.config != {})
     {
      services.home-assistant.config = cfg.config;
      # services.home-assistant.lovelaceConfig = cfg.love;
    };
}