summaryrefslogtreecommitdiffstats
path: root/lass/3modules/hass.nix
blob: 30158e78adccb6fc10652572f75a17f619c90e5f (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
{ 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;
    };
  };

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