200 lines
6.9 KiB
Nix
200 lines
6.9 KiB
Nix
{ config, pkgs, ... }:
|
|
let
|
|
# "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
|
|
ha-bambulab = pkgs.stdenv.mkDerivation {
|
|
pname = "ha-bambulab";
|
|
version = "v2.1.5"; # Update with correct version
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "greghesp"; # Update with correct owner
|
|
repo = "ha-bambulab"; # Update with correct repo name
|
|
rev = "v2.1.5"; # Or specific tag/commit
|
|
sha256 = "sha256-giaQiCVblo3pgnZKCql6focjJJmLGLOSiar8tcEKrNc="; # Replace with actual hash
|
|
};
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/custom_components
|
|
cp -r custom_components/bambu_lab $out/custom_components/
|
|
'';
|
|
};
|
|
ha-gehome = pkgs.stdenv.mkDerivation {
|
|
pname = "ha-gehome";
|
|
version = "v2025.2.1"; # Update with correct version
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "simbaja"; # Update with correct owner
|
|
repo = "ha_gehome"; # Update with correct repo name
|
|
rev = "v2025.2.1"; # Or specific tag/commit
|
|
sha256 = "sha256-nb+KrJoWqvhqH6E7A22xXwQzTYp7yn+hl9WRDXn95Cc="; # Replace with actual hash
|
|
};
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/custom_components
|
|
cp -r custom_components/ge_home $out/custom_components/
|
|
'';
|
|
};
|
|
ha-mail-and-packages = pkgs.stdenv.mkDerivation {
|
|
pname = "Home-Assistant-Mail-And-Packages";
|
|
version = "0.4.2"; # Update with correct version
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "moralmunky"; # Update with correct owner
|
|
repo = "Home-Assistant-Mail-And-Packages"; # Update with correct repo name
|
|
rev = "0.4.2"; # Or specific tag/commit
|
|
sha256 = "sha256-5LBTlRlkSUx8DOY+F7UvUs4dzjZKdBdgnDUdK6DBdew="; # Replace with actual hash
|
|
};
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/custom_components
|
|
cp -r custom_components/mail_and_packages $out/custom_components/
|
|
'';
|
|
};
|
|
ha-overseerr = pkgs.stdenv.mkDerivation {
|
|
pname = "ha-overseerr";
|
|
version = "0.1.42"; # Update with correct version
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "vaparr"; # Update with correct owner
|
|
repo = "ha-overseerr"; # Update with correct repo name
|
|
rev = "0.1.42"; # Or specific tag/commit
|
|
sha256 = "sha256-UvUowCgfay9aRV+iC/AQ9vvJzhGZbH+/1kVjxPFBKcI="; # Replace with actual hash
|
|
};
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/custom_components
|
|
cp -r custom_components/overseerr $out/custom_components/
|
|
'';
|
|
};
|
|
ha-petlibro = pkgs.stdenv.mkDerivation {
|
|
pname = "ha-petlibro";
|
|
version = "v1.0.21.1"; # Update with correct version
|
|
|
|
src = pkgs.fetchzip {
|
|
url = "https://github.com/jjjonesjr33/petlibro/archive/refs/tags/v1.0.21.1.zip";
|
|
sha256 = "sha256-3EckyAgWxlZeqy9g13yP2nKCcjnyVIp8EdiE/A1pNu4="; # Replace with actual hash
|
|
};
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/custom_components
|
|
cp -r custom_components/petlibro $out/custom_components/
|
|
'';
|
|
};
|
|
ha-wyzeapi = pkgs.stdenv.mkDerivation {
|
|
pname = "ha-wyzeapi";
|
|
version = "0.1.32"; # Update with correct version
|
|
|
|
src = pkgs.fetchzip {
|
|
url = "https://github.com/SecKatie/ha-wyzeapi/archive/refs/tags/0.1.32.zip";
|
|
sha256 = "sha256-3xUynZBEHuO2hKLYCb2sBpJAe0JF/8uKqR304Y7JQmE="; # Replace with actual hash
|
|
};
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/custom_components
|
|
cp -r custom_components/wyzeapi $out/custom_components/
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
services.home-assistant = {
|
|
enable = true;
|
|
openFirewall = true;
|
|
extraComponents = [
|
|
# Components required to complete the onboarding
|
|
"analytics"
|
|
"google_translate"
|
|
"met"
|
|
"radio_browser"
|
|
"shopping_list"
|
|
# Recommended for fast zlib compression
|
|
# https://www.home-assistant.io/integrations/isal
|
|
"isal"
|
|
"subaru"
|
|
"vesync"
|
|
];
|
|
customComponents = with pkgs.home-assistant-custom-components; [
|
|
auth-header
|
|
];
|
|
# use postgresql instead of sqlite
|
|
extraPackages = ps: with ps; [ psycopg2 numpy hassil pyturbojpeg ];
|
|
|
|
config = {
|
|
# Includes dependencies for a basic setup
|
|
# https://www.home-assistant.io/integrations/default_config/
|
|
default_config = {};
|
|
|
|
cloud = false;
|
|
|
|
frontend = {
|
|
themes = "!include_dir_merge_named themes";
|
|
};
|
|
|
|
"automation ui" = "!include automations.yaml";
|
|
"scene ui" = "!include scenes.yaml";
|
|
"script ui" = "!include scripts.yaml";
|
|
|
|
http = {
|
|
use_x_forwarded_for = true;
|
|
trusted_proxies = [
|
|
"172.30.33.0/24"
|
|
"10.0.1.18"
|
|
];
|
|
};
|
|
|
|
recorder = {
|
|
db_url = "postgresql://@/hass";
|
|
purge_keep_days = 180;
|
|
};
|
|
|
|
auth_header = {
|
|
debug = false;
|
|
};
|
|
|
|
# https://www.home-assistant.io/integrations/ota_updater/
|
|
zha.zigpy_config.ota.z2m_remote_index = "https://raw.githubusercontent.com/Koenkk/zigbee-OTA/master/index.json";
|
|
};
|
|
};
|
|
|
|
# https://www.home-assistant.io/integrations/automation/
|
|
# systemd.tmpfiles.rules = [
|
|
# "f ${config.services.home-assistant.configDir}/automations.yaml 0755 hass hass"
|
|
# ];
|
|
|
|
# This bypasses the component validation and places it directly in HA's data directory
|
|
system.activationScripts.installCustomComponents = ''
|
|
mkdir -p ${config.services.home-assistant.configDir}/custom_components
|
|
cp -r ${ha-bambulab}/custom_components/bambu_lab ${config.services.home-assistant.configDir}/custom_components/
|
|
cp -r ${ha-gehome}/custom_components/ge_home ${config.services.home-assistant.configDir}/custom_components/
|
|
cp -r ${ha-mail-and-packages}/custom_components/mail_and_packages ${config.services.home-assistant.configDir}/custom_components/
|
|
cp -r ${ha-overseerr}/custom_components/overseerr ${config.services.home-assistant.configDir}/custom_components/
|
|
cp -r ${ha-petlibro}/custom_components/petlibro ${config.services.home-assistant.configDir}/custom_components/
|
|
cp -r ${ha-wyzeapi}/custom_components/wyzeapi ${config.services.home-assistant.configDir}/custom_components/
|
|
|
|
ln -sf /etc/nixos/hosts/nas/apps/homeassistant/automations.yaml ${config.services.home-assistant.configDir}/automations.yaml
|
|
chown hass:hass ${config.services.home-assistant.configDir}/automations.yaml
|
|
ln -sf /etc/nixos/hosts/nas/apps/homeassistant/scenes.yaml ${config.services.home-assistant.configDir}/scenes.yaml
|
|
chown hass:hass ${config.services.home-assistant.configDir}/scenes.yaml
|
|
ln -sf /etc/nixos/hosts/nas/apps/homeassistant/scripts.yaml ${config.services.home-assistant.configDir}/scripts.yaml
|
|
chown hass:hass ${config.services.home-assistant.configDir}/scripts.yaml
|
|
'';
|
|
|
|
services = {
|
|
postgresql = {
|
|
enable = true;
|
|
ensureDatabases = [ "hass" ];
|
|
ensureUsers = [{
|
|
name = "hass";
|
|
ensureDBOwnership = true;
|
|
}];
|
|
};
|
|
zigbee2mqtt = {
|
|
enable = true;
|
|
settings = {
|
|
homeassistant = config.services.home-assistant.enable;
|
|
permit_join = true;
|
|
serial = {
|
|
port = "/dev/ttyUSB0";
|
|
};
|
|
}
|
|
}
|
|
};
|
|
} |