fix: remove multiple recursiveUpdate
This commit is contained in:
@@ -9,76 +9,6 @@ let
|
|||||||
|
|
||||||
home-assistant-config = recursiveUpdate config.home-assistant {
|
home-assistant-config = recursiveUpdate config.home-assistant {
|
||||||
package = pkgs-with-home-assistant.home-assistant;
|
package = pkgs-with-home-assistant.home-assistant;
|
||||||
};
|
|
||||||
uid = config.ids.uids.hass;
|
|
||||||
gid = config.ids.gids.hass;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
users.users.hass = {
|
|
||||||
home = "/var/lib/hass";
|
|
||||||
createHome = true;
|
|
||||||
group = "hass";
|
|
||||||
uid = uid;
|
|
||||||
extraGroups = [ "dialout" ];
|
|
||||||
};
|
|
||||||
users.groups.hass.gid = gid;
|
|
||||||
|
|
||||||
services.nginx.enable = true;
|
|
||||||
services.nginx.virtualHosts."${domain}" = {
|
|
||||||
forceSSL = true;
|
|
||||||
extraConfig = ''
|
|
||||||
proxy_buffering off;
|
|
||||||
'';
|
|
||||||
locations."/".extraConfig = ''
|
|
||||||
proxy_pass http://10.233.0.2:8123;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_redirect http:// https://;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection $connection_upgrade;
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
security.acme.certs."${domain}" = {
|
|
||||||
group = "ssl-users";
|
|
||||||
allowKeysForGroup = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
users.groups.ssl-users = {};
|
|
||||||
|
|
||||||
sops.secrets."home-assistant-secrets.yaml" = {
|
|
||||||
owner = "hass";
|
|
||||||
restartUnits = [ "container@hass.service" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
containers.hass = {
|
|
||||||
autoStart = true;
|
|
||||||
ephemeral = false;
|
|
||||||
privateNetwork = true;
|
|
||||||
hostAddress = "10.233.0.1";
|
|
||||||
localAddress = "10.233.0.2";
|
|
||||||
bindMounts = {
|
|
||||||
"/etc/localtime" = {
|
|
||||||
hostPath = "/etc/localtime";
|
|
||||||
};
|
|
||||||
"/var/lib/hass" = {
|
|
||||||
hostPath = "/var/lib/hass/";
|
|
||||||
isReadOnly = false;
|
|
||||||
};
|
|
||||||
"/var/lib/hass/secrets.yaml" = {
|
|
||||||
hostPath = config.sops.secrets."home-assistant-secrets.yaml".path;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = { lib, config, pkgs, ... }: {
|
|
||||||
imports = [
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.systemPackages = [
|
|
||||||
pkgs.mariadb
|
|
||||||
];
|
|
||||||
|
|
||||||
services.home-assistant = recursiveUpdate home-assistant-config {
|
|
||||||
extraComponents = [
|
extraComponents = [
|
||||||
"mobile_app"
|
"mobile_app"
|
||||||
"backup"
|
"backup"
|
||||||
@@ -149,6 +79,76 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uid = config.ids.uids.hass;
|
||||||
|
gid = config.ids.gids.hass;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
users.users.hass = {
|
||||||
|
home = "/var/lib/hass";
|
||||||
|
createHome = true;
|
||||||
|
group = "hass";
|
||||||
|
uid = uid;
|
||||||
|
extraGroups = [ "dialout" ];
|
||||||
|
};
|
||||||
|
users.groups.hass.gid = gid;
|
||||||
|
|
||||||
|
services.nginx.enable = true;
|
||||||
|
services.nginx.virtualHosts."${domain}" = {
|
||||||
|
forceSSL = true;
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_buffering off;
|
||||||
|
'';
|
||||||
|
locations."/".extraConfig = ''
|
||||||
|
proxy_pass http://10.233.0.2:8123;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_redirect http:// https://;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
security.acme.certs."${domain}" = {
|
||||||
|
group = "ssl-users";
|
||||||
|
allowKeysForGroup = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups.ssl-users = {};
|
||||||
|
|
||||||
|
sops.secrets."home-assistant-secrets.yaml" = {
|
||||||
|
owner = "hass";
|
||||||
|
restartUnits = [ "container@hass.service" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
containers.hass = {
|
||||||
|
autoStart = true;
|
||||||
|
ephemeral = false;
|
||||||
|
privateNetwork = true;
|
||||||
|
hostAddress = "10.233.0.1";
|
||||||
|
localAddress = "10.233.0.2";
|
||||||
|
bindMounts = {
|
||||||
|
"/etc/localtime" = {
|
||||||
|
hostPath = "/etc/localtime";
|
||||||
|
};
|
||||||
|
"/var/lib/hass" = {
|
||||||
|
hostPath = "/var/lib/hass/";
|
||||||
|
isReadOnly = false;
|
||||||
|
};
|
||||||
|
"/var/lib/hass/secrets.yaml" = {
|
||||||
|
hostPath = config.sops.secrets."home-assistant-secrets.yaml".path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = { lib, config, pkgs, ... }: {
|
||||||
|
imports = [
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgs.mariadb
|
||||||
|
];
|
||||||
|
|
||||||
|
services.home-assistant = home-assistant-config;
|
||||||
|
|
||||||
systemd.services.install-hacs = {
|
systemd.services.install-hacs = {
|
||||||
description = "Install HACS";
|
description = "Install HACS";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|||||||
Reference in New Issue
Block a user