This commit is contained in:
2024-10-16 20:24:40 +02:00
parent b7bfb0f62a
commit c681eb3139
110 changed files with 2924 additions and 720 deletions

View File

@@ -1,6 +1,11 @@
{ config, pkgs, ... }:
let
domain = "home-assistant.cloonar.com";
pkgs-with-home-assistant = import (builtins.fetchGit {
name = "new-home-assistant";
url = "https://github.com/nixos/nixpkgs/";
rev = "268bb5090a3c6ac5e1615b38542a868b52ef8088";
}) {};
in
{
users.users.hass = {
@@ -35,21 +40,21 @@ in
extraFlags = [
"--capability=CAP_NET_ADMIN"
];
allowedDevices = [
{
modifier = "rwm";
node = "char-usb_device";
}
{
modifier = "rwm";
node = "char-ttyUSB";
}
];
# allowedDevices = [
# {
# modifier = "rwm";
# node = "char-usb_device";
# }
# {
# modifier = "rwm";
# node = "char-ttyUSB";
# }
# ];
bindMounts = {
"/dev/ttyUSB0" = {
hostPath = "/dev/ttyUSB0";
isReadOnly = false;
};
# "/dev/ttyUSB0" = {
# hostPath = "/dev/ttyUSB0";
# isReadOnly = false;
# };
"/etc/localtime" = {
hostPath = "/etc/localtime";
};
@@ -104,6 +109,7 @@ in
environment.systemPackages = [
pkgs.wol
pkgs.mariadb
];
services.nginx.enable = true;
@@ -127,6 +133,7 @@ in
};
services.home-assistant = {
package = pkgs-with-home-assistant.home-assistant;
enable = true;
};
@@ -140,6 +147,30 @@ in
"tplink_omada"
];
services.home-assistant.extraPackages = ps: with ps; [
mysqlclient
];
services.mysql = {
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
hiddenEntities = [
@@ -148,6 +179,9 @@ in
];
in
{
recorder = {
db_url = "mysql://hass@localhost/hass?unix_socket=/var/run/mysqld/mysqld.sock";
};
homeassistant = {
name = "Home";
latitude = "!secret home_latitude";