home-assistant: move out of module
This commit is contained in:
parent
d7779df053
commit
8d4f1eb419
@ -8,6 +8,7 @@
|
|||||||
imports = [
|
imports = [
|
||||||
self.inputs.nixos-hardware.nixosModules.raspberry-pi-4
|
self.inputs.nixos-hardware.nixosModules.raspberry-pi-4
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
./home-assistant
|
||||||
../server.nix
|
../server.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -124,7 +125,6 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
repoPath = "ssh://qcw86s11@qcw86s11.repo.borgbase.com/./repo";
|
repoPath = "ssh://qcw86s11@qcw86s11.repo.borgbase.com/./repo";
|
||||||
};
|
};
|
||||||
home-assistant.enable = true;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
297
hosts/pi/home-assistant/default.nix
Normal file
297
hosts/pi/home-assistant/default.nix
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./floorplan/default.nix
|
||||||
|
./mqtt.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
age.secrets."files/services/home-assistant/secrets.yaml" = {
|
||||||
|
file = "${self.inputs.secrets}/files/services/home-assistant/secrets.yaml.age";
|
||||||
|
path = "${config.services.home-assistant.configDir}/secrets.yaml";
|
||||||
|
owner = "hass";
|
||||||
|
group = "hass";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.home-assistant = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
config = {
|
||||||
|
automation = "!include automations.yaml";
|
||||||
|
backup = { };
|
||||||
|
binary_sensor = [ ];
|
||||||
|
default_config = { };
|
||||||
|
http = {
|
||||||
|
server_host = "::1";
|
||||||
|
trusted_proxies = [ "::1" ];
|
||||||
|
use_x_forwarded_for = true;
|
||||||
|
};
|
||||||
|
ffmpeg = { };
|
||||||
|
homeassistant = {
|
||||||
|
name = "Home";
|
||||||
|
latitude = "!secret latitude";
|
||||||
|
longitude = "!secret longitude";
|
||||||
|
country = "GB";
|
||||||
|
temperature_unit = "C";
|
||||||
|
time_zone = config.time.timeZone;
|
||||||
|
unit_system = "metric";
|
||||||
|
auth_providers = [
|
||||||
|
{
|
||||||
|
type = "trusted_networks";
|
||||||
|
trusted_networks = [
|
||||||
|
"100.64.0.0/10"
|
||||||
|
"127.0.0.1"
|
||||||
|
];
|
||||||
|
allow_bypass_login = true;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
type = "homeassistant";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
logger = {
|
||||||
|
default = "info";
|
||||||
|
logs = { };
|
||||||
|
};
|
||||||
|
lovelace = {
|
||||||
|
mode = "yaml";
|
||||||
|
};
|
||||||
|
media_player = [ ];
|
||||||
|
mobile_app = { };
|
||||||
|
onkyo = { };
|
||||||
|
open_meteo = { };
|
||||||
|
recorder = {
|
||||||
|
purge_keep_days = 365;
|
||||||
|
};
|
||||||
|
scene = "!include scenes.yaml";
|
||||||
|
script = "!include scripts.yaml";
|
||||||
|
sensor = [ ];
|
||||||
|
system_health = { };
|
||||||
|
zeroconf = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
extraComponents = [
|
||||||
|
"air_quality"
|
||||||
|
"airly"
|
||||||
|
"alert"
|
||||||
|
"api"
|
||||||
|
"application_credentials"
|
||||||
|
"asuswrt"
|
||||||
|
"auth"
|
||||||
|
"automation"
|
||||||
|
"bayesian"
|
||||||
|
"binary_sensor"
|
||||||
|
# "blackbird"
|
||||||
|
"blueprint"
|
||||||
|
"bluetooth_adapters"
|
||||||
|
"bluetooth_le_tracker"
|
||||||
|
"button"
|
||||||
|
"calendar"
|
||||||
|
"camera"
|
||||||
|
"cast"
|
||||||
|
"cert_expiry"
|
||||||
|
"climate"
|
||||||
|
"co2signal"
|
||||||
|
"color_extractor"
|
||||||
|
"command_line"
|
||||||
|
"compensation"
|
||||||
|
"configurator"
|
||||||
|
"counter"
|
||||||
|
"cover"
|
||||||
|
"cpuspeed"
|
||||||
|
"default_config"
|
||||||
|
"demo"
|
||||||
|
"derivative"
|
||||||
|
"device_automation"
|
||||||
|
"device_sun_light_trigger"
|
||||||
|
"device_tracker"
|
||||||
|
"dlna_dmr"
|
||||||
|
"dlna_dms"
|
||||||
|
"dnsip"
|
||||||
|
"esphome"
|
||||||
|
"fail2ban"
|
||||||
|
"fan"
|
||||||
|
"feedreader"
|
||||||
|
"ffmpeg"
|
||||||
|
"file"
|
||||||
|
"file_upload"
|
||||||
|
"filesize"
|
||||||
|
"folder"
|
||||||
|
"folder_watcher"
|
||||||
|
"forecast_solar"
|
||||||
|
"frontend"
|
||||||
|
"gdacs"
|
||||||
|
"generic"
|
||||||
|
"generic_hygrostat"
|
||||||
|
"generic_thermostat"
|
||||||
|
"geo_json_events"
|
||||||
|
"geo_location"
|
||||||
|
"geo_rss_events"
|
||||||
|
"github"
|
||||||
|
"group"
|
||||||
|
"hardware"
|
||||||
|
"hdmi_cec"
|
||||||
|
"history_stats"
|
||||||
|
"homeassistant"
|
||||||
|
"homekit"
|
||||||
|
"homekit_controller"
|
||||||
|
"html5"
|
||||||
|
"http"
|
||||||
|
"humidifier"
|
||||||
|
"icloud"
|
||||||
|
"image_processing"
|
||||||
|
"input_boolean"
|
||||||
|
"input_button"
|
||||||
|
"input_datetime"
|
||||||
|
"input_number"
|
||||||
|
"input_select"
|
||||||
|
"input_text"
|
||||||
|
"integration"
|
||||||
|
"ios"
|
||||||
|
"jellyfin"
|
||||||
|
"light"
|
||||||
|
"local_calendar"
|
||||||
|
"local_file"
|
||||||
|
"local_ip"
|
||||||
|
"local_todo"
|
||||||
|
"lock"
|
||||||
|
"logentries"
|
||||||
|
"logger"
|
||||||
|
"lovelace"
|
||||||
|
"manual"
|
||||||
|
"manual_mqtt"
|
||||||
|
"matter"
|
||||||
|
"media_player"
|
||||||
|
"min_max"
|
||||||
|
"mjpeg"
|
||||||
|
"modern_forms"
|
||||||
|
"mold_indicator"
|
||||||
|
"moon"
|
||||||
|
"mysensors"
|
||||||
|
"network"
|
||||||
|
"nmap_tracker"
|
||||||
|
"notify"
|
||||||
|
"number"
|
||||||
|
"onboarding"
|
||||||
|
"onkyo"
|
||||||
|
"panel_custom"
|
||||||
|
"persistent_notification"
|
||||||
|
"person"
|
||||||
|
"ping"
|
||||||
|
"plant"
|
||||||
|
"prometheus"
|
||||||
|
"proximity"
|
||||||
|
"push"
|
||||||
|
"proximity"
|
||||||
|
"python_script"
|
||||||
|
"radio_browser"
|
||||||
|
"random"
|
||||||
|
"recorder"
|
||||||
|
"remote"
|
||||||
|
"repairs"
|
||||||
|
"rest"
|
||||||
|
"rest_command"
|
||||||
|
"rss_feed_template"
|
||||||
|
"scene"
|
||||||
|
"schedule"
|
||||||
|
"scrape"
|
||||||
|
"script"
|
||||||
|
"search"
|
||||||
|
"season"
|
||||||
|
"select"
|
||||||
|
"sense"
|
||||||
|
"sensor"
|
||||||
|
"sensorpush"
|
||||||
|
"shell_command"
|
||||||
|
"shopping_list"
|
||||||
|
"siren"
|
||||||
|
"smtp"
|
||||||
|
"snmp"
|
||||||
|
"sql"
|
||||||
|
"statistics"
|
||||||
|
"sun"
|
||||||
|
"switch"
|
||||||
|
"switch_as_x"
|
||||||
|
"system_health"
|
||||||
|
"system_log"
|
||||||
|
"systemmonitor"
|
||||||
|
"tag"
|
||||||
|
"tailscale"
|
||||||
|
"tcp"
|
||||||
|
"template"
|
||||||
|
"text"
|
||||||
|
"thread"
|
||||||
|
"threshold"
|
||||||
|
"time_date"
|
||||||
|
"timer"
|
||||||
|
"tod"
|
||||||
|
"todo"
|
||||||
|
"tomorrowio"
|
||||||
|
"trend"
|
||||||
|
"universal"
|
||||||
|
"upb"
|
||||||
|
"update"
|
||||||
|
"upnp"
|
||||||
|
"uptime"
|
||||||
|
"utility_meter"
|
||||||
|
"vacuum"
|
||||||
|
"vlc"
|
||||||
|
"vlc_telnet"
|
||||||
|
"wake_on_lan"
|
||||||
|
"water_heater"
|
||||||
|
"weather"
|
||||||
|
"websocket_api"
|
||||||
|
"wled"
|
||||||
|
"workday"
|
||||||
|
"worldclock"
|
||||||
|
"zone"
|
||||||
|
];
|
||||||
|
|
||||||
|
extraPackages =
|
||||||
|
python3Packages: with python3Packages; [
|
||||||
|
onkyo-eiscp
|
||||||
|
zeroconf
|
||||||
|
];
|
||||||
|
|
||||||
|
customComponents = with pkgs; [
|
||||||
|
home-assistant-browser-mod
|
||||||
|
];
|
||||||
|
|
||||||
|
customLovelaceModules = with pkgs.home-assistant-custom-lovelace-modules; [
|
||||||
|
bubble-card
|
||||||
|
button-card
|
||||||
|
card-mod
|
||||||
|
light-entity-card
|
||||||
|
mini-graph-card
|
||||||
|
mini-media-player
|
||||||
|
mushroom
|
||||||
|
sankey-chart
|
||||||
|
universal-remote-card
|
||||||
|
];
|
||||||
|
|
||||||
|
lovelaceConfigWritable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
modules.services.borgmatic.directories = [
|
||||||
|
config.services.home-assistant.configDir
|
||||||
|
];
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
virtualHosts."home.mesh.vimium.net" = {
|
||||||
|
forceSSL = false;
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_buffering off;
|
||||||
|
'';
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://[::1]:8123";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -1,306 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
self,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.modules.services.home-assistant;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./floorplan/default.nix
|
|
||||||
./mqtt.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
options.modules.services.home-assistant.enable = lib.mkEnableOption "home-assistant";
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
|
|
||||||
age.secrets."files/services/home-assistant/secrets.yaml" = {
|
|
||||||
file = "${self.inputs.secrets}/files/services/home-assistant/secrets.yaml.age";
|
|
||||||
path = "${config.services.home-assistant.configDir}/secrets.yaml";
|
|
||||||
owner = "hass";
|
|
||||||
group = "hass";
|
|
||||||
};
|
|
||||||
|
|
||||||
services.home-assistant = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
config = {
|
|
||||||
automation = "!include automations.yaml";
|
|
||||||
backup = { };
|
|
||||||
binary_sensor = [ ];
|
|
||||||
default_config = { };
|
|
||||||
http = {
|
|
||||||
server_host = "::1";
|
|
||||||
trusted_proxies = [ "::1" ];
|
|
||||||
use_x_forwarded_for = true;
|
|
||||||
};
|
|
||||||
ffmpeg = { };
|
|
||||||
homeassistant = {
|
|
||||||
name = "Home";
|
|
||||||
latitude = "!secret latitude";
|
|
||||||
longitude = "!secret longitude";
|
|
||||||
country = "GB";
|
|
||||||
temperature_unit = "C";
|
|
||||||
time_zone = config.time.timeZone;
|
|
||||||
unit_system = "metric";
|
|
||||||
auth_providers = [
|
|
||||||
{
|
|
||||||
type = "trusted_networks";
|
|
||||||
trusted_networks = [
|
|
||||||
"100.64.0.0/10"
|
|
||||||
"127.0.0.1"
|
|
||||||
];
|
|
||||||
allow_bypass_login = true;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
type = "homeassistant";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
logger = {
|
|
||||||
default = "info";
|
|
||||||
logs = { };
|
|
||||||
};
|
|
||||||
lovelace = {
|
|
||||||
mode = "yaml";
|
|
||||||
};
|
|
||||||
media_player = [ ];
|
|
||||||
mobile_app = { };
|
|
||||||
onkyo = { };
|
|
||||||
open_meteo = { };
|
|
||||||
recorder = {
|
|
||||||
purge_keep_days = 365;
|
|
||||||
};
|
|
||||||
scene = "!include scenes.yaml";
|
|
||||||
script = "!include scripts.yaml";
|
|
||||||
sensor = [ ];
|
|
||||||
system_health = { };
|
|
||||||
zeroconf = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
extraComponents = [
|
|
||||||
"air_quality"
|
|
||||||
"airly"
|
|
||||||
"alert"
|
|
||||||
"api"
|
|
||||||
"application_credentials"
|
|
||||||
"asuswrt"
|
|
||||||
"auth"
|
|
||||||
"automation"
|
|
||||||
"bayesian"
|
|
||||||
"binary_sensor"
|
|
||||||
# "blackbird"
|
|
||||||
"blueprint"
|
|
||||||
"bluetooth_adapters"
|
|
||||||
"bluetooth_le_tracker"
|
|
||||||
"button"
|
|
||||||
"calendar"
|
|
||||||
"camera"
|
|
||||||
"cast"
|
|
||||||
"cert_expiry"
|
|
||||||
"climate"
|
|
||||||
"co2signal"
|
|
||||||
"color_extractor"
|
|
||||||
"command_line"
|
|
||||||
"compensation"
|
|
||||||
"configurator"
|
|
||||||
"counter"
|
|
||||||
"cover"
|
|
||||||
"cpuspeed"
|
|
||||||
"default_config"
|
|
||||||
"demo"
|
|
||||||
"derivative"
|
|
||||||
"device_automation"
|
|
||||||
"device_sun_light_trigger"
|
|
||||||
"device_tracker"
|
|
||||||
"dlna_dmr"
|
|
||||||
"dlna_dms"
|
|
||||||
"dnsip"
|
|
||||||
"esphome"
|
|
||||||
"fail2ban"
|
|
||||||
"fan"
|
|
||||||
"feedreader"
|
|
||||||
"ffmpeg"
|
|
||||||
"file"
|
|
||||||
"file_upload"
|
|
||||||
"filesize"
|
|
||||||
"folder"
|
|
||||||
"folder_watcher"
|
|
||||||
"forecast_solar"
|
|
||||||
"frontend"
|
|
||||||
"gdacs"
|
|
||||||
"generic"
|
|
||||||
"generic_hygrostat"
|
|
||||||
"generic_thermostat"
|
|
||||||
"geo_json_events"
|
|
||||||
"geo_location"
|
|
||||||
"geo_rss_events"
|
|
||||||
"github"
|
|
||||||
"group"
|
|
||||||
"hardware"
|
|
||||||
"hdmi_cec"
|
|
||||||
"history_stats"
|
|
||||||
"homeassistant"
|
|
||||||
"homekit"
|
|
||||||
"homekit_controller"
|
|
||||||
"html5"
|
|
||||||
"http"
|
|
||||||
"humidifier"
|
|
||||||
"icloud"
|
|
||||||
"image_processing"
|
|
||||||
"input_boolean"
|
|
||||||
"input_button"
|
|
||||||
"input_datetime"
|
|
||||||
"input_number"
|
|
||||||
"input_select"
|
|
||||||
"input_text"
|
|
||||||
"integration"
|
|
||||||
"ios"
|
|
||||||
"jellyfin"
|
|
||||||
"light"
|
|
||||||
"local_calendar"
|
|
||||||
"local_file"
|
|
||||||
"local_ip"
|
|
||||||
"local_todo"
|
|
||||||
"lock"
|
|
||||||
"logentries"
|
|
||||||
"logger"
|
|
||||||
"lovelace"
|
|
||||||
"manual"
|
|
||||||
"manual_mqtt"
|
|
||||||
"matter"
|
|
||||||
"media_player"
|
|
||||||
"min_max"
|
|
||||||
"mjpeg"
|
|
||||||
"modern_forms"
|
|
||||||
"mold_indicator"
|
|
||||||
"moon"
|
|
||||||
"mysensors"
|
|
||||||
"network"
|
|
||||||
"nmap_tracker"
|
|
||||||
"notify"
|
|
||||||
"number"
|
|
||||||
"onboarding"
|
|
||||||
"onkyo"
|
|
||||||
"panel_custom"
|
|
||||||
"persistent_notification"
|
|
||||||
"person"
|
|
||||||
"ping"
|
|
||||||
"plant"
|
|
||||||
"prometheus"
|
|
||||||
"proximity"
|
|
||||||
"push"
|
|
||||||
"proximity"
|
|
||||||
"python_script"
|
|
||||||
"radio_browser"
|
|
||||||
"random"
|
|
||||||
"recorder"
|
|
||||||
"remote"
|
|
||||||
"repairs"
|
|
||||||
"rest"
|
|
||||||
"rest_command"
|
|
||||||
"rss_feed_template"
|
|
||||||
"scene"
|
|
||||||
"schedule"
|
|
||||||
"scrape"
|
|
||||||
"script"
|
|
||||||
"search"
|
|
||||||
"season"
|
|
||||||
"select"
|
|
||||||
"sense"
|
|
||||||
"sensor"
|
|
||||||
"sensorpush"
|
|
||||||
"shell_command"
|
|
||||||
"shopping_list"
|
|
||||||
"siren"
|
|
||||||
"smtp"
|
|
||||||
"snmp"
|
|
||||||
"sql"
|
|
||||||
"statistics"
|
|
||||||
"sun"
|
|
||||||
"switch"
|
|
||||||
"switch_as_x"
|
|
||||||
"system_health"
|
|
||||||
"system_log"
|
|
||||||
"systemmonitor"
|
|
||||||
"tag"
|
|
||||||
"tailscale"
|
|
||||||
"tcp"
|
|
||||||
"template"
|
|
||||||
"text"
|
|
||||||
"thread"
|
|
||||||
"threshold"
|
|
||||||
"time_date"
|
|
||||||
"timer"
|
|
||||||
"tod"
|
|
||||||
"todo"
|
|
||||||
"tomorrowio"
|
|
||||||
"trend"
|
|
||||||
"universal"
|
|
||||||
"upb"
|
|
||||||
"update"
|
|
||||||
"upnp"
|
|
||||||
"uptime"
|
|
||||||
"utility_meter"
|
|
||||||
"vacuum"
|
|
||||||
"vlc"
|
|
||||||
"vlc_telnet"
|
|
||||||
"wake_on_lan"
|
|
||||||
"water_heater"
|
|
||||||
"weather"
|
|
||||||
"websocket_api"
|
|
||||||
"wled"
|
|
||||||
"workday"
|
|
||||||
"worldclock"
|
|
||||||
"zone"
|
|
||||||
];
|
|
||||||
|
|
||||||
extraPackages =
|
|
||||||
python3Packages: with python3Packages; [
|
|
||||||
onkyo-eiscp
|
|
||||||
zeroconf
|
|
||||||
];
|
|
||||||
|
|
||||||
customComponents = with pkgs; [
|
|
||||||
home-assistant-browser-mod
|
|
||||||
];
|
|
||||||
|
|
||||||
customLovelaceModules = with pkgs.home-assistant-custom-lovelace-modules; [
|
|
||||||
bubble-card
|
|
||||||
button-card
|
|
||||||
card-mod
|
|
||||||
light-entity-card
|
|
||||||
mini-graph-card
|
|
||||||
mini-media-player
|
|
||||||
mushroom
|
|
||||||
sankey-chart
|
|
||||||
universal-remote-card
|
|
||||||
];
|
|
||||||
|
|
||||||
lovelaceConfigWritable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
modules.services.borgmatic.directories = [
|
|
||||||
config.services.home-assistant.configDir
|
|
||||||
];
|
|
||||||
|
|
||||||
services.nginx = {
|
|
||||||
enable = true;
|
|
||||||
virtualHosts."home.mesh.vimium.net" = {
|
|
||||||
forceSSL = false;
|
|
||||||
extraConfig = ''
|
|
||||||
proxy_buffering off;
|
|
||||||
'';
|
|
||||||
locations."/" = {
|
|
||||||
proxyPass = "http://[::1]:8123";
|
|
||||||
proxyWebsockets = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user