mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-22 00:04:20 +01:00
wip
Signed-off-by: main <magic_rb@redalder.org>
This commit is contained in:
parent
348b4e088e
commit
9063f43a50
|
@ -1,98 +1,136 @@
|
|||
{ nglib, nixpkgs }:
|
||||
nglib.makeSystem {
|
||||
system = "x86_64-linux";
|
||||
name = "nixng-home-assistant";
|
||||
inherit nixpkgs;
|
||||
config = ({ pkgs, config, nglib, ... }:
|
||||
let
|
||||
ids = config.ids;
|
||||
in
|
||||
{
|
||||
postgresql = nglib.makeSystem {
|
||||
system = "x86_64-linux";
|
||||
name = "nixng-hass-postgresql";
|
||||
inherit nixpkgs;
|
||||
config = { pkgs, config, ... }:
|
||||
{
|
||||
config = {
|
||||
dumb-init = {
|
||||
enable = true;
|
||||
type.services = { };
|
||||
type.services = {};
|
||||
};
|
||||
|
||||
init.services.home-assistant = {
|
||||
shutdownOnExit = true;
|
||||
environment = {
|
||||
PATH = with pkgs; pkgs.lib.makeBinPath [
|
||||
coreutils git ffmpeg bash runit
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.home-assistant = {
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
envsubst = true;
|
||||
customComponents = {
|
||||
xiaomi_gateway3 = pkgs.fetchFromGitHub {
|
||||
owner = "AlexxIT";
|
||||
repo = "XiaomiGateway3";
|
||||
rev = "v1.6.5";
|
||||
sha256 = "sha256-RSIJqsbgnktl7zNaxAKUoMjbkrJ1aJTej0vjlCgstJ8=";
|
||||
} + "/custom_components/xiaomi_gateway3";
|
||||
package = pkgs.postgresql_12;
|
||||
|
||||
initialScript = "/secrets/init.sql";
|
||||
enableTCPIP = true;
|
||||
|
||||
authentication = "host all all all md5";
|
||||
|
||||
ensureDatabases = [ "hass" ];
|
||||
ensureExtensions = {
|
||||
"pg_trgm" = [ "hass" ];
|
||||
};
|
||||
config =
|
||||
{ default_config = {};
|
||||
stream = {};
|
||||
http = {
|
||||
server_port = "8123";
|
||||
use_x_forwarded_for = true;
|
||||
trusted_proxies = [ "127.0.0.1" ];
|
||||
ensureUsers = [
|
||||
{ name = "hass"; ensurePermissions = {
|
||||
"DATABASE \"hass\"" = "ALL PRIVILEGES";
|
||||
};
|
||||
logger.default = "info";
|
||||
homeassistant =
|
||||
{ name = "Home";
|
||||
latitude = "\${LATITUDE}";
|
||||
longitude = "\${LONGTITUDE}";
|
||||
elevation = "\${ELEVATION}";
|
||||
# currency = "EUR";
|
||||
unit_system = "metric";
|
||||
time_zone = "\${TIME_ZONE}";
|
||||
internal_url = "http://localhost:8123/";
|
||||
};
|
||||
automation = "!include automations.yaml";
|
||||
"automation static" = [
|
||||
(import ./home-assistant/automations/alarm/pending.nix)
|
||||
(import ./home-assistant/automations/alarm/disarmed.nix)
|
||||
(import ./home-assistant/automations/alarm/triggered.nix)
|
||||
(import ./home-assistant/automations/alarm/motion-detected.nix)
|
||||
(import ./home-assistant/automations/alarm/motion-detected-away.nix)
|
||||
];
|
||||
alarm_control_panel = import ./home-assistant/alarm_control_panel.nix;
|
||||
frontend.themes =
|
||||
{ };
|
||||
};
|
||||
package =
|
||||
(pkgs.home-assistant.override
|
||||
{ extraComponents =
|
||||
[ "http"
|
||||
"homeassistant"
|
||||
"image"
|
||||
"person"
|
||||
"cloud"
|
||||
"onboarding"
|
||||
"frontend"
|
||||
"safe_mode"
|
||||
"met"
|
||||
"zha"
|
||||
"mobile_app"
|
||||
"dhcp"
|
||||
"logbook"
|
||||
"history"
|
||||
"ssdp"
|
||||
"mqtt"
|
||||
"stream"
|
||||
];
|
||||
extraPackages = ps: with ps;
|
||||
[ xmodem
|
||||
];
|
||||
}).overridePythonAttrs (old:
|
||||
{ doCheck = false;
|
||||
});
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
hass =
|
||||
nglib.makeSystem {
|
||||
system = "x86_64-linux";
|
||||
name = "nixng-home-assistant";
|
||||
inherit nixpkgs;
|
||||
config = ({ pkgs, config, nglib, ... }:
|
||||
let
|
||||
ids = config.ids;
|
||||
in
|
||||
{
|
||||
config = {
|
||||
dumb-init = {
|
||||
enable = true;
|
||||
type.services = { };
|
||||
};
|
||||
|
||||
init.services.home-assistant = {
|
||||
shutdownOnExit = true;
|
||||
environment = {
|
||||
PATH = with pkgs; pkgs.lib.makeBinPath [
|
||||
coreutils git ffmpeg bash runit
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
envsubst = true;
|
||||
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";
|
||||
use_x_forwarded_for = true;
|
||||
trusted_proxies = [ "127.0.0.1" ];
|
||||
};
|
||||
logger.default = "info";
|
||||
homeassistant =
|
||||
{ name = "Home";
|
||||
latitude = "\${LATITUDE}";
|
||||
longitude = "\${LONGTITUDE}";
|
||||
elevation = "\${ELEVATION}";
|
||||
# currency = "EUR";
|
||||
unit_system = "metric";
|
||||
time_zone = "\${TIME_ZONE}";
|
||||
internal_url = "http://localhost:8123/";
|
||||
};
|
||||
automation = "!include automations.yaml";
|
||||
"automation static" = [
|
||||
(import ./home-assistant/automations/alarm/pending.nix)
|
||||
(import ./home-assistant/automations/alarm/disarmed.nix)
|
||||
(import ./home-assistant/automations/alarm/triggered.nix)
|
||||
(import ./home-assistant/automations/alarm/motion-detected.nix)
|
||||
(import ./home-assistant/automations/alarm/motion-detected-away.nix)
|
||||
];
|
||||
alarm_control_panel = import ./home-assistant/alarm_control_panel.nix;
|
||||
frontend.themes =
|
||||
{ };
|
||||
};
|
||||
package =
|
||||
(pkgs.home-assistant.override
|
||||
{ extraComponents =
|
||||
[ "http"
|
||||
"homeassistant"
|
||||
"image"
|
||||
"person"
|
||||
"cloud"
|
||||
"onboarding"
|
||||
"frontend"
|
||||
"safe_mode"
|
||||
"met"
|
||||
"zha"
|
||||
"mobile_app"
|
||||
"dhcp"
|
||||
"logbook"
|
||||
"history"
|
||||
"ssdp"
|
||||
"mqtt"
|
||||
"stream"
|
||||
"recorder"
|
||||
];
|
||||
extraPackages = ps: with ps;
|
||||
[ xmodem
|
||||
psycopg2
|
||||
];
|
||||
}).overridePythonAttrs (old:
|
||||
{ doCheck = false;
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
flake_rev = "8b974684b5cf66fda7431a664d1b397a66687bd6"
|
||||
flake_ref = "conduit-wip"
|
||||
flake_host = "git+https://git.sr.ht/~magic_rb/cluster"
|
||||
flake_host_alt = "git+https://git.sr.ht/~magic_rb/cluster"
|
||||
|
||||
flake_sha = "sha256-OV1FhzVYnLmaLZb/IWXie4ZqjJPmuOJPEr0h5A3+ok8="
|
||||
|
|
Loading…
Reference in a new issue