fix: avoid duplicate config for services.home-assistant
This commit is contained in:
@@ -83,52 +83,12 @@ in
|
|||||||
"mobile_app"
|
"mobile_app"
|
||||||
"backup"
|
"backup"
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.install-hacs = {
|
extraPackages = ps: with ps; [
|
||||||
description = "Install HACS";
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
};
|
|
||||||
script = ''
|
|
||||||
set -e
|
|
||||||
HACS_VERSION="2.0.5" # Replace with the latest version
|
|
||||||
HACS_DIR="/var/lib/hass/custom_components/hacs"
|
|
||||||
|
|
||||||
mkdir -p "$HACS_DIR"
|
|
||||||
${pkgs.curl}/bin/curl -L "https://github.com/hacs/integration/releases/download/$HACS_VERSION/hacs.zip" -o /tmp/hacs.zip
|
|
||||||
${pkgs.unzip}/bin/unzip -o /tmp/hacs.zip -d "$HACS_DIR"
|
|
||||||
rm /tmp/hacs.zip
|
|
||||||
chown -R hass:hass "$HACS_DIR"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
services.home-assistant.extraPackages = ps: with ps; [
|
|
||||||
mysqlclient
|
mysqlclient
|
||||||
];
|
];
|
||||||
|
|
||||||
services.mysql = {
|
config =
|
||||||
enable = true;
|
|
||||||
package = pkgs.mariadb;
|
|
||||||
ensureDatabases = [ "hass" ];
|
|
||||||
ensureUsers = [
|
|
||||||
{
|
|
||||||
name = "hass";
|
|
||||||
ensurePermissions = {
|
|
||||||
"hass.*" = "ALL PRIVILEGES";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
services.mysqlBackup = {
|
|
||||||
enable = true;
|
|
||||||
databases = [ "hass" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
services.home-assistant.config =
|
|
||||||
let
|
let
|
||||||
hiddenEntities = [
|
hiddenEntities = [
|
||||||
"sensor.last_boot"
|
"sensor.last_boot"
|
||||||
@@ -187,6 +147,46 @@ in
|
|||||||
default_config = { };
|
default_config = { };
|
||||||
system_log = { };
|
system_log = { };
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.install-hacs = {
|
||||||
|
description = "Install HACS";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
set -e
|
||||||
|
HACS_VERSION="2.0.5" # Replace with the latest version
|
||||||
|
HACS_DIR="/var/lib/hass/custom_components/hacs"
|
||||||
|
|
||||||
|
mkdir -p "$HACS_DIR"
|
||||||
|
${pkgs.curl}/bin/curl -L "https://github.com/hacs/integration/releases/download/$HACS_VERSION/hacs.zip" -o /tmp/hacs.zip
|
||||||
|
${pkgs.unzip}/bin/unzip -o /tmp/hacs.zip -d "$HACS_DIR"
|
||||||
|
rm /tmp/hacs.zip
|
||||||
|
chown -R hass:hass "$HACS_DIR"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
services.mysql = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.mariadb;
|
||||||
|
ensureDatabases = [ "hass" ];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "hass";
|
||||||
|
ensurePermissions = {
|
||||||
|
"hass.*" = "ALL PRIVILEGES";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
services.mysqlBackup = {
|
||||||
|
enable = true;
|
||||||
|
databases = [ "hass" ];
|
||||||
|
};
|
||||||
|
|
||||||
users.users.hass.extraGroups = [ "dialout" ];
|
users.users.hass.extraGroups = [ "dialout" ];
|
||||||
networking.firewall.allowedTCPPorts = [ 8123 ];
|
networking.firewall.allowedTCPPorts = [ 8123 ];
|
||||||
|
|||||||
Reference in New Issue
Block a user