anchor.diff:  let
     cfg = config.services.home-assistant;
   
  -  configFile = pkgs.writeText "configuration.yaml" (builtins.toJSON cfg.config);
  +  configFile = pkgs.writeText "configuration.json" (builtins.toJSON (if cfg.applyDefaultConfig
  +    then (lib.recursiveUpdate defaultConfig (if (isNull cfg.config) then {} else cfg.config))
  +    else cfg.config));
   
     availableComponents = pkgs.home-assistant.availableComponents;
   
  
positive.code:         ln -s ${configFile} ${cfg.configDir}/configuration.yaml
        '';
        serviceConfig = {
          ExecStart = ''
            ${package}/bin/hass --config "${cfg.configDir}"
          '';
          User = "hass";
          Group = "hass";
          Restart = "on-failure";
          ProtectSystem = "strict";
          ReadWritePaths = "${cfg.configDir}";
          PrivateTmp = true;
        };
        path = [
          "/run/wrappers" # needed for ping
  
negative.code:     then (cfg.package.override { inherit extraComponents; })
      else cfg.package;
  
    # If you are changing this, please update the description in applyDefaultConfig
    defaultConfig = {
      homeassistant.time_zone = config.time.timeZone;
      http.server_port = (toString cfg.port);
    };
  
  in {
    meta.maintainers = with maintainers; [ dotlambda ];
  
  