Home-assistant setup

This commit is contained in:
Alexander Bantyev 2021-03-18 17:10:07 +03:00
parent 2bdccc9fdb
commit e54fd18fbb
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5
5 changed files with 73 additions and 0 deletions

View File

@ -413,6 +413,7 @@
"nixpkgs-wayland": "nixpkgs-wayland",
"simple-nixos-mailserver": "simple-nixos-mailserver",
"simple-osd-daemons": "simple-osd-daemons",
"sonoff-lan": "sonoff-lan",
"wee-slack": "wee-slack",
"weechat-notify-send": "weechat-notify-send",
"weechat-scripts": "weechat-scripts",
@ -454,6 +455,22 @@
"type": "github"
}
},
"sonoff-lan": {
"flake": false,
"locked": {
"lastModified": 1615813622,
"narHash": "sha256-05KhxvwHm3hya/9uibSggnRjmU1QOxJNzUacfsoYQ64=",
"owner": "AlexxIT",
"repo": "SonoffLAN",
"rev": "412b1b709c5f5de6f1266cf4e6f0b4795a827976",
"type": "github"
},
"original": {
"owner": "AlexxIT",
"repo": "SonoffLAN",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1610051610,

View File

@ -55,6 +55,10 @@
nix-zsh-completions.url = "github:Ma27/nix-zsh-completions/flakes";
nix-zsh-completions.flake = false;
emacs-overlay.url = "github:nix-community/emacs-overlay";
sonoff-lan = {
url = "github:AlexxIT/SonoffLAN";
flake = false;
};
};
outputs = { nixpkgs, nix, self, deploy-rs, ... }@inputs: {

View File

@ -10,6 +10,7 @@
nextcloud
nginx
vsftpd
home-assistant
];
services.logind.lidSwitch = "ignore";

View File

@ -32,6 +32,7 @@ builtins.listToAttrs (builtins.map (path: {
./servers/nextcloud.nix
./servers/nginx.nix
./servers/vsftpd.nix
./servers/home-assistant.nix
./services.nix
./themes.nix
./virtualisation.nix

View File

@ -0,0 +1,50 @@
{ config, pkgs, lib, inputs, ... }: {
services.home-assistant = {
enable = true;
package = (pkgs.home-assistant.override {
extraPackages = py: with py; [ aiohttp-cors zeroconf pycrypto ];
}).overrideAttrs (_: {
tests = [];
doInstallCheck = false;
});
config = {
homeassistant = {
name = "Home";
time_zone = "Europe/Moscow";
latitude = 1;
longitude = 1;
elevation = 1;
unit_system = "metric";
temperature_unit = "C";
};
# Enable the frontend
frontend = { };
sonoff = {
default_class = "light";
};
mobile_app = { };
};
};
systemd.tmpfiles.rules = [
"C /var/lib/hass/custom_components/sonoff - - - - ${inputs.sonoff-lan}/custom_components/sonoff"
"Z /var/lib/hass 770 hass hass - -"
];
services.nginx = {
virtualHosts."hass.balsoft.ru" = {
enableACME = true;
forceSSL = true;
extraConfig = ''
proxy_buffering off;
'';
locations."/" = {
proxyPass = "http://127.0.0.1:8123";
proxyWebsockets = true;
extraConfig = ''
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
'';
};
};
};
}