mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-21 15:54:21 +01:00
Switch home-assistant to PostgreSQL
Signed-off-by: main <magic_rb@redalder.org>
This commit is contained in:
parent
ecdcf01e77
commit
b6dc065c5d
|
@ -1,4 +1,40 @@
|
|||
{ nglib, nixpkgs }:
|
||||
{
|
||||
postgresql = nglib.makeSystem {
|
||||
system = "x86_64-linux";
|
||||
name = "nixng-hass-postgresql";
|
||||
inherit nixpkgs;
|
||||
config = { pkgs, config, ... }:
|
||||
{
|
||||
config = {
|
||||
dumb-init = {
|
||||
enable = true;
|
||||
type.services = {};
|
||||
};
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_12;
|
||||
|
||||
initialScript = "/secrets/init.sql";
|
||||
enableTCPIP = true;
|
||||
|
||||
authentication = "host all all all md5";
|
||||
|
||||
ensureDatabases = [ "hass" ];
|
||||
ensureExtensions = {
|
||||
"pg_trgm" = [ "hass" ];
|
||||
};
|
||||
ensureUsers = [
|
||||
{ name = "hass"; ensurePermissions = {
|
||||
"DATABASE \"hass\"" = "ALL PRIVILEGES";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
hass =
|
||||
nglib.makeSystem {
|
||||
system = "x86_64-linux";
|
||||
name = "nixng-home-assistant";
|
||||
|
@ -26,16 +62,14 @@ nglib.makeSystem {
|
|||
services.home-assistant = {
|
||||
enable = true;
|
||||
envsubst = true;
|
||||
customComponents = {
|
||||
xiaomi_gateway3 = pkgs.fetchFromGitHub {
|
||||
owner = "AlexxIT";
|
||||
repo = "XiaomiGateway3";
|
||||
rev = "v1.6.5";
|
||||
sha256 = "sha256-RSIJqsbgnktl7zNaxAKUoMjbkrJ1aJTej0vjlCgstJ8=";
|
||||
} + "/custom_components/xiaomi_gateway3";
|
||||
};
|
||||
customComponents = {};
|
||||
config =
|
||||
{ default_config = {};
|
||||
recorder = {
|
||||
db_url = "postgresql://hass:\${PSQL_PASSWORD}@127.0.0.1/hass";
|
||||
db_max_retries = 5;
|
||||
db_retry_wait = 30;
|
||||
};
|
||||
stream = {};
|
||||
http = {
|
||||
server_port = "8123";
|
||||
|
@ -85,9 +119,11 @@ nglib.makeSystem {
|
|||
"ssdp"
|
||||
"mqtt"
|
||||
"stream"
|
||||
"recorder"
|
||||
];
|
||||
extraPackages = ps: with ps;
|
||||
[ xmodem
|
||||
psycopg2
|
||||
];
|
||||
}).overridePythonAttrs (old:
|
||||
{ doCheck = false;
|
||||
|
@ -95,4 +131,6 @@ nglib.makeSystem {
|
|||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue