From 0fcb6e07f73a6a5e8d18cb7fd3ee4e762ad8bd8e Mon Sep 17 00:00:00 2001 From: mjallen18 Date: Tue, 15 Jul 2025 15:28:05 -0500 Subject: [PATCH] update hass components --- flake.lock | 34 ----- hosts/homeassistant/boot.nix | 40 ----- hosts/homeassistant/configuration.nix | 141 ------------------ .../homeassistant/hardware-configuration.nix | 70 --------- hosts/homeassistant/home.nix | 64 -------- hosts/homeassistant/impermanence.nix | 57 ------- hosts/nas/networking.nix | 2 + hosts/nas/services.nix | 1 + modules/home/vscode.nix | 2 +- .../homeassistant/automations.yaml | 0 .../homeassistant/automations.yaml.ori | 0 modules/homeassistant/hacs/anycubic.nix | 47 ++++++ modules/homeassistant/hacs/bambulab.nix | 31 ++++ modules/homeassistant/hacs/default.nix | 14 ++ modules/homeassistant/hacs/gehome.nix | 54 +++++++ modules/homeassistant/hacs/icloud3.nix | 31 ++++ .../homeassistant/hacs/mail-and-packages.nix | 33 ++++ modules/homeassistant/hacs/nanokvm.nix | 59 ++++++++ modules/homeassistant/hacs/overseerr.nix | 47 ++++++ modules/homeassistant/hacs/petlibro.nix | 27 ++++ modules/homeassistant/hacs/wyzeapi.nix | 59 ++++++++ {hosts/pi5 => modules/homeassistant}/hass.nix | 10 +- .../homeassistant/homeassistant.nix | 130 +++------------- {hosts => modules}/homeassistant/scenes.yaml | 0 {hosts => modules}/homeassistant/scripts.yaml | 0 25 files changed, 430 insertions(+), 523 deletions(-) delete mode 100755 hosts/homeassistant/boot.nix delete mode 100755 hosts/homeassistant/configuration.nix delete mode 100755 hosts/homeassistant/hardware-configuration.nix delete mode 100755 hosts/homeassistant/home.nix delete mode 100755 hosts/homeassistant/impermanence.nix rename {hosts => modules}/homeassistant/automations.yaml (100%) rename {hosts => modules}/homeassistant/automations.yaml.ori (100%) create mode 100644 modules/homeassistant/hacs/anycubic.nix create mode 100644 modules/homeassistant/hacs/bambulab.nix create mode 100644 modules/homeassistant/hacs/default.nix create mode 100644 modules/homeassistant/hacs/gehome.nix create mode 100644 modules/homeassistant/hacs/icloud3.nix create mode 100644 modules/homeassistant/hacs/mail-and-packages.nix create mode 100644 modules/homeassistant/hacs/nanokvm.nix create mode 100644 modules/homeassistant/hacs/overseerr.nix create mode 100644 modules/homeassistant/hacs/petlibro.nix create mode 100644 modules/homeassistant/hacs/wyzeapi.nix rename {hosts/pi5 => modules/homeassistant}/hass.nix (85%) rename {hosts => modules}/homeassistant/homeassistant.nix (68%) rename {hosts => modules}/homeassistant/scenes.yaml (100%) rename {hosts => modules}/homeassistant/scripts.yaml (100%) diff --git a/flake.lock b/flake.lock index 4dc25fb..7d63614 100755 --- a/flake.lock +++ b/flake.lock @@ -296,24 +296,6 @@ "type": "github" } }, - "dxvk_2_git": { - "flake": false, - "locked": { - "lastModified": 1752147070, - "narHash": "sha256-FsjTB7yalDZ/qvMh2iFk3i4sRnKVS0lzT30aqBnFvLQ=", - "ref": "refs/heads/master", - "rev": "e940893bdc00c3f76529bd05df4616d90ddb2444", - "revCount": 7209, - "submodules": true, - "type": "git", - "url": "https://github.com/doitsujin/dxvk" - }, - "original": { - "submodules": true, - "type": "git", - "url": "https://github.com/doitsujin/dxvk" - } - }, "flake-compat": { "flake": false, "locked": { @@ -1589,22 +1571,6 @@ "type": "github" } }, - "pe_parse_git": { - "flake": false, - "locked": { - "lastModified": 1732739339, - "narHash": "sha256-DMwgFvEbsAf3hm7BdfN168qlFkDcoMcdIK7FMV/QGUQ=", - "owner": "trailofbits", - "repo": "pe-parse", - "rev": "31ac5966503689d5693cd9fb520bd525a8710e17", - "type": "github" - }, - "original": { - "owner": "trailofbits", - "repo": "pe-parse", - "type": "github" - } - }, "pi4-disko": { "inputs": { "nixpkgs": [ diff --git a/hosts/homeassistant/boot.nix b/hosts/homeassistant/boot.nix deleted file mode 100755 index a236a14..0000000 --- a/hosts/homeassistant/boot.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ lib, pkgs, ... }: -let - kernel = pkgs.linuxPackages_latest; -in -{ - # Configure bootloader with lanzaboot and secureboot - boot = { - kernelModules = [ "nct6775" ]; - loader = { - systemd-boot.enable = true; - efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot"; - }; - }; - - initrd = { - verbose = false; - systemd.enable = true; - }; - - plymouth = { - enable = true; - }; - - kernelPackages = kernel; - - kernelParams = [ - "quiet" - "splash" - ]; - - consoleLogLevel = 3; - bootspec.enable = true; - }; - - environment.systemPackages = with pkgs; [ - edk2-uefi-shell - ]; -} diff --git a/hosts/homeassistant/configuration.nix b/hosts/homeassistant/configuration.nix deleted file mode 100755 index 6bd15ef..0000000 --- a/hosts/homeassistant/configuration.nix +++ /dev/null @@ -1,141 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page, on -# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - -{ config, lib, pkgs, ... }: - -let - user = "hass-admin"; - password = "$y$j9T$EkPXmsmIMFFZ.WRrBYCxS1$P0kwo6e4.WM5DsqUcEqWC3MrZp5KfCjxffraMFZWu06"; - SSID = "Joey's Jungle 5G"; - SSIDpassword = "kR8v&3Qd"; # config.sops.templates."wifi-password".content; - interface = "wlp0s20f3"; - timezone = "America/Chicago"; - hostname = "jallen-hass"; -in -{ - imports = [ - # Include the results of the hardware scan. - ./boot.nix - ./hardware-configuration.nix - ./impermanence.nix - ./homeassistant.nix - ../default.nix - ]; - - # Enable nix flakes and nix-command tools - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - - nix.settings.trusted-users = [ "@wheel" ]; - - # Set your time zone. - time.timeZone = timezone; - - networking = { - networkmanager = { - enable = true; - - # Configure the static connection for eno1 -# ensureProfiles = { -# profiles = { -# joeys-jungle = { -# connection = { -# id = "joeys-jungle"; -# permissions = ""; -# type = "wifi"; -# }; -# ipv4 = { -# dns-search = ""; -# method = "auto"; -# }; -# ipv6 = { -# addr-gen-mode = "stable-privacy"; -# dns-search = ""; -# method = "auto"; -# }; -# wifi = { -# mac-address-blacklist = ""; -# mode = "infrastructure"; -## ssid = SSID; -# }; -# wifi-security = { -# auth-alg = "open"; -# key-mgmt = "wpa-psk"; -# psk = SSIDpassword; -# }; -# }; -# "static-eno1" = { -# connection = { -# id = "static-eno1"; -# type = "ethernet"; -# interface-name = "eno1"; -# }; -# ipv4 = { -# method = "manual"; -# addresses = "10.0.1.19/24"; -# gateway = "10.0.1.1"; -# dns = "10.0.1.1"; -# }; -# }; -# }; -# }; - }; - hostName = hostname; - wireless = { - enable = false; - networks."${SSID}".psk = SSIDpassword; - interfaces = [ interface ]; - }; - }; - - environment.systemPackages = with pkgs; [ - vim - htop - git - protonmail-bridge - pass - gnome-keyring - openssl - ]; - - services.xserver.desktopManager.surf-display = { - enable = true; - defaultWwwUri = "http://jallen-hass:8123"; # todo: external maybe for reasons??? - }; - - services.openssh.enable = true; - services.protonmail-bridge = { - enable = true; - path = with pkgs; [ pass gnome-keyring ]; - }; - - # Enable Avahi for .local hostname resolution - services.avahi = { - enable = true; - nssmdns4 = true; # For modern systems, use nssmdns4 instead of nssmdns - publish = { - enable = true; - addresses = true; - domain = true; - workstation = true; - }; - }; - - users = { - mutableUsers = false; - users."${user}" = { - isNormalUser = lib.mkForce true; - initialHashedPassword = password; - extraGroups = [ - "wheel" - "docker" - "network-manager" - "hass" - ]; - shell = pkgs.zsh; - }; - }; -} diff --git a/hosts/homeassistant/hardware-configuration.nix b/hosts/homeassistant/hardware-configuration.nix deleted file mode 100755 index d560431..0000000 --- a/hosts/homeassistant/hardware-configuration.nix +++ /dev/null @@ -1,70 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "none"; - fsType = "tmpfs"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/AB0D-A6A2"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - fileSystems."/nix" = - { device = "/dev/disk/by-uuid/a6ef033d-c305-42d9-88b2-5591008b2a11"; - fsType = "btrfs"; - options = [ "subvol=nix" ]; - }; - - fileSystems."/etc" = - { device = "/dev/disk/by-uuid/a6ef033d-c305-42d9-88b2-5591008b2a11"; - fsType = "btrfs"; - options = [ "subvol=etc" ]; - }; - - fileSystems."/var/log" = - { device = "/dev/disk/by-uuid/a6ef033d-c305-42d9-88b2-5591008b2a11"; - fsType = "btrfs"; - options = [ "subvol=log" ]; - }; - - fileSystems."/root" = - { device = "/dev/disk/by-uuid/a6ef033d-c305-42d9-88b2-5591008b2a11"; - fsType = "btrfs"; - options = [ "subvol=root" ]; - }; - - fileSystems."/home" = - { device = "/dev/disk/by-uuid/a6ef033d-c305-42d9-88b2-5591008b2a11"; - fsType = "btrfs"; - options = [ "subvol=home" ]; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/d631d42b-b70a-4579-bfb4-57412ae7c682"; } - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.eno1.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} \ No newline at end of file diff --git a/hosts/homeassistant/home.nix b/hosts/homeassistant/home.nix deleted file mode 100755 index 4c8cce6..0000000 --- a/hosts/homeassistant/home.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ lib, pkgs, ... }: -let - shellAliases = { - ll = "ls -alh"; - update-boot = "sudo nixos-rebuild boot --max-jobs 10 --build-host admin@10.0.1.3"; - update-switch = "sudo nixos-rebuild switch --max-jobs 10 --build-host admin@10.0.1.3"; - update-flake = "sudo nix flake update ~/nix-config"; - update-nas = "nixos-rebuild switch --use-remote-sudo --target-host admin@10.0.1.3 --build-host admin@10.0.1.3 --flake ~/nix-config#jallen-nas"; - nas-ssh = "kitten ssh admin@10.0.1.3"; - ducks = "du -cksh * | sort -hr | head -n 15"; - }; - - gitAliases = { - co = "checkout"; - ci = "commit"; - cia = "commit --amend"; - s = "status"; - st = "status"; - b = "branch"; - p = "pull --rebase"; - pu = "push"; - }; -in -{ - - home.username = "hass-admin"; - home.homeDirectory = "/home/hass-admin"; - home.stateVersion = "23.11"; - programs.home-manager.enable = true; - - programs = { - fish.enable = false; - mangohud.enable = true; - java.enable = true; - - zsh = { - enable = true; - enableCompletion = true; - autosuggestion.enable = true; - syntaxHighlighting.enable = true; - - shellAliases = shellAliases; - - oh-my-zsh = { - enable = true; - plugins = [ "git" ]; - theme = "fishy"; - }; - }; - }; - - programs.git = { - enable = true; - userName = "mjallen18"; - userEmail = "matt.l.jallen@gmail.com"; - aliases = gitAliases; - }; - - home.packages = with pkgs; [ - age - fastfetch - firefox - ]; -} diff --git a/hosts/homeassistant/impermanence.nix b/hosts/homeassistant/impermanence.nix deleted file mode 100755 index 300b1df..0000000 --- a/hosts/homeassistant/impermanence.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ ... }: -{ - # Set up impernance configuration for things like bluetooth - # In this configuration with /etc and /var/log being persistent, only directories outside of that need to be done here. See hardware configuration for all mountpoints. - - environment.persistence."/nix/persist/system" = { - hideMounts = true; - directories = [ - "/var/lib/bluetooth" - "/var/lib/nixos" - "/var/lib/tailscale" - "/var/lib/systemd/coredump" - "/var/lib/zigbee2mqtt" - "/var/lib/postgresql" -# "/var/lib/music-assistant" - "/etc/NetworkManager/system-connections" - "/etc/secureboot" - { - directory = "/var/lib/private/authentik/media"; - user = "authentik"; - group = "authentik"; - mode = "u=rwx,g=,o="; - } - { - directory = "/var/lib/hass"; - user = "hass"; - group = "hass"; - mode = "u=rwx,g=,o="; - } - { - directory = "/var/lib/private"; - mode = "u=rwx,g=rx,o="; - } - { - directory = "/var/lib/colord"; - user = "colord"; - group = "colord"; - mode = "u=rwx,g=rx,o="; - } - { - directory = "/etc/nix"; - user = "root"; - group = "wheel"; - mode = "u=rwx,g=rx,o=rx"; - } - ]; - files = [ - "/var/cache-priv-key.pem" - "/etc/machine-id" - ]; - }; - - security.sudo.extraConfig = '' - # rollback results in sudo lectures after each reboot - Defaults lecture = never - ''; -} diff --git a/hosts/nas/networking.nix b/hosts/nas/networking.nix index 90a9514..547dbdc 100755 --- a/hosts/nas/networking.nix +++ b/hosts/nas/networking.nix @@ -22,6 +22,8 @@ let 2283 # immich 4444 # code-server 9012 + + 8192 ]; in { diff --git a/hosts/nas/services.nix b/hosts/nas/services.nix index 23d4f77..0fc6b46 100755 --- a/hosts/nas/services.nix +++ b/hosts/nas/services.nix @@ -310,6 +310,7 @@ in }; hd-idle = { + enable = false; environment = { HD_IDLE_OPTS = "-a /dev/disk/by-id/ata-Samsung_SSD_860_EVO_500GB_S3Z1NW0KA10457X,/dev/disk/by-id/ata-SSD2SC240G1SA754D117-820_PNY29140000558890457,/dev/disk/by-id/ata-ST3000DM007-1WY10G_ZFN28XXS,/dev/disk/by-id/ata-ST3000DM007-1WY10G_ZFQ052KN,/dev/disk/by-id/ata-ST3000DM007-1WY10G_ZFQ052NN,/dev/disk/by-id/ata-ST3000VN007-2E4166_Z731JVZJ,/dev/disk/by-id/ata-ST4000VN008-2DR166_ZDHBNBGP,/dev/disk/by-id/ata-ST8000AS0002-1NA17Z_Z8411RMB"; }; diff --git a/modules/home/vscode.nix b/modules/home/vscode.nix index 34439f3..a0fff40 100644 --- a/modules/home/vscode.nix +++ b/modules/home/vscode.nix @@ -40,7 +40,7 @@ in vscode-extensions.yy0931.vscode-sqlite3-editor # open-remote-ssh - nix-vscode-extensions.open-vsx.jeanp413.open-remote-ssh + # nix-vscode-extensions.open-vsx.jeanp413.open-remote-ssh ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ { name = "copilot-mcp"; diff --git a/hosts/homeassistant/automations.yaml b/modules/homeassistant/automations.yaml similarity index 100% rename from hosts/homeassistant/automations.yaml rename to modules/homeassistant/automations.yaml diff --git a/hosts/homeassistant/automations.yaml.ori b/modules/homeassistant/automations.yaml.ori similarity index 100% rename from hosts/homeassistant/automations.yaml.ori rename to modules/homeassistant/automations.yaml.ori diff --git a/modules/homeassistant/hacs/anycubic.nix b/modules/homeassistant/hacs/anycubic.nix new file mode 100644 index 0000000..89376bd --- /dev/null +++ b/modules/homeassistant/hacs/anycubic.nix @@ -0,0 +1,47 @@ +{ pkgs, ... }: +let + uart-wifi = pkgs.python3Packages.buildPythonPackage rec { + pname = "uart-wifi"; + version = "0.2.1"; + format = "pyproject"; + src = pkgs.fetchPypi { + inherit pname version; + sha256 = "sha256-yquZ5V8f+EqetCf0nc9WlhHhnHkOASYRuYvqEIMc5HI="; + }; + + buildInputs = with pkgs.python3Packages; [ setuptools ]; + + doCheck = false; # no tests in the PyPI tarball + }; + + ha-anycubic = pkgs.buildHomeAssistantComponent rec { + owner = "adamoutler"; + domain = "anycubic_wifi"; + version = "HACS-10"; + + src = pkgs.fetchFromGitHub { + owner = owner; + repo = "anycubic-homeassistant"; + rev = version; + hash = "sha256-TfZadwgdEJR11MaL+nfIgEYld3trWg3v6lOHSoxQ98Q="; + }; + + # PYTHONPATH = [ "${src}/uart-wifi" ]; + + propagatedBuildInputs = [ + uart-wifi + ]; + + meta = { + changelog = "https://github.com/adamoutler/anycubic-homeassistant/releases/tag/${version}"; + description = "This is a library to provide support for Mono X Printers."; + homepage = "https://github.com/adamoutler/anycubic-homeassistant"; + maintainers = [ ]; + }; + }; +in +{ + services.home-assistant.customComponents = [ + ha-anycubic + ]; +} diff --git a/modules/homeassistant/hacs/bambulab.nix b/modules/homeassistant/hacs/bambulab.nix new file mode 100644 index 0000000..60ebd4f --- /dev/null +++ b/modules/homeassistant/hacs/bambulab.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: +let + ha-bambulab = pkgs.buildHomeAssistantComponent rec { + owner = "greghesp"; + domain = "bambu_lab"; + version = "v2.1.27"; + + src = pkgs.fetchFromGitHub { + owner = owner; + repo = "ha-bambulab"; + rev = version; + hash = "sha256-zHPXPYsHrJXOnSqllZqDrxGZDDqyXllC3XEGZRJil0Q="; + }; + + propagatedBuildInputs = with pkgs.python3Packages; [ + beautifulsoup4 + ]; + + meta = { + changelog = "https://github.com/greghesp/ha-bambulab/releases/tag/${version}"; + description = "A Home Assistant Integration for Bambu Lab printers."; + homepage = "https://github.com/greghesp/ha-bambulab"; + maintainers = [ ]; + }; + }; +in +{ + services.home-assistant.customComponents = [ + ha-bambulab + ]; +} diff --git a/modules/homeassistant/hacs/default.nix b/modules/homeassistant/hacs/default.nix new file mode 100644 index 0000000..f54d776 --- /dev/null +++ b/modules/homeassistant/hacs/default.nix @@ -0,0 +1,14 @@ +{ ... }: +{ + imports = [ + ./anycubic.nix + ./bambulab.nix + ./gehome.nix + ./icloud3.nix + ./mail-and-packages.nix + ./nanokvm.nix + ./overseerr.nix + ./petlibro.nix + ./wyzeapi.nix + ]; +} \ No newline at end of file diff --git a/modules/homeassistant/hacs/gehome.nix b/modules/homeassistant/hacs/gehome.nix new file mode 100644 index 0000000..8fb26af --- /dev/null +++ b/modules/homeassistant/hacs/gehome.nix @@ -0,0 +1,54 @@ +{ pkgs, ... }: +let + magicattr_cust = pkgs.python3Packages.buildPythonPackage rec { + pname = "magicattr"; + version = "0.1.6"; + format = "setuptools"; + + src = pkgs.fetchFromGitHub { + owner = "frmdstryr"; + repo = pname; + rev = "master"; + sha256 = "sha256-FJtWU5AuunZbdlndGdfD1c9/0s7oRdoTi202pWjuAd8="; + }; + + buildInputs = with pkgs.python3Packages; [ setuptools ]; + doCheck = false; + }; + + ha-gehome = pkgs.buildHomeAssistantComponent rec { + owner = "simbaja"; + domain = "ge_home"; + version = "v2025.5.0"; + + src = pkgs.fetchFromGitHub { + owner = owner; + repo = domain; + rev = version; + hash = "sha256-NlUkM70yvBeC5s7S5BkNxIC2GztfEq8xYrQZr4pkaGU="; + }; + + propagatedBuildInputs = with pkgs.python3Packages; [ + gehomesdk + magicattr_cust + slixmpp + ]; + + postPatch = '' + substituteInPlace custom_components/ge_home/manifest.json \ + --replace '"slixmpp==1.8.3"' '"slixmpp>=1.8.3"' + ''; + + meta = { + changelog = "https://github.com/simbaja/ha_gehome/releases/tag/${version}"; + description = "Integration for GE WiFi-enabled appliances into Home Assistant."; + homepage = "https://github.com/simbaja/ha_gehome"; + maintainers = [ ]; + }; + }; +in +{ + services.home-assistant.customComponents = [ + ha-gehome + ]; +} diff --git a/modules/homeassistant/hacs/icloud3.nix b/modules/homeassistant/hacs/icloud3.nix new file mode 100644 index 0000000..f1472e4 --- /dev/null +++ b/modules/homeassistant/hacs/icloud3.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: +let + ha-icloud3 = pkgs.buildHomeAssistantComponent rec { + owner = "gcobb321"; + domain = "icloud3"; + version = "3.2.2.3"; + + src = pkgs.fetchFromGitHub { + owner = owner; + repo = "icloud3"; + rev = "v.${version}"; + hash = "sha256-OjXioS73jE/U2YeKYf84QnStdQj3Seid4hJ2TH6z13M="; + }; + + propagatedBuildInputs = with pkgs.python3Packages; [ + srp + ]; + + meta = { + changelog = "https://github.com/gcobb321/icloud3/releases/tag/${version}"; + description = "Cloud3 is a device tracker custom component that tracks your iPhones, iPads and Apple Watches. Devices in the Family Sharing List and the HA Mobile App Integration are trackable."; + homepage = "https://github.com/gcobb321/icloud3"; + maintainers = [ ]; + }; + }; +in +{ + services.home-assistant.customComponents = [ + ha-icloud3 + ]; +} diff --git a/modules/homeassistant/hacs/mail-and-packages.nix b/modules/homeassistant/hacs/mail-and-packages.nix new file mode 100644 index 0000000..497f804 --- /dev/null +++ b/modules/homeassistant/hacs/mail-and-packages.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: +let + ha-mail-and-packages = pkgs.buildHomeAssistantComponent rec { + owner = "moralmunky"; + domain = "mail_and_packages"; + version = "0.4.2"; + + src = pkgs.fetchFromGitHub { + owner = owner; + repo = "Home-Assistant-Mail-And-Packages"; + rev = version; + hash = "sha256-5LBTlRlkSUx8DOY+F7UvUs4dzjZKdBdgnDUdK6DBdew="; + }; + + propagatedBuildInputs = with pkgs.python3Packages; [ + beautifulsoup4 + dateparser + pillow + ]; + + meta = { + changelog = "https://github.com/moralmunky/Home-Assistant-Mail-And-Packages/releases/tag/${version}"; + description = "The Mail and Packages integration creates sensors for supported shippers to show a snapshot of mail and packages that are scheduled to be delivered the current day."; + homepage = "https://github.com/moralmunky/Home-Assistant-Mail-And-Packages"; + maintainers = [ ]; + }; + }; +in +{ + services.home-assistant.customComponents = [ + ha-mail-and-packages + ]; +} diff --git a/modules/homeassistant/hacs/nanokvm.nix b/modules/homeassistant/hacs/nanokvm.nix new file mode 100644 index 0000000..1701466 --- /dev/null +++ b/modules/homeassistant/hacs/nanokvm.nix @@ -0,0 +1,59 @@ +{ pkgs, ... }: +let + python-nanokvm = pkgs.python3Packages.buildPythonPackage rec { + pname = "python-nanokvm"; + version = "v0.0.3"; + format = "pyproject"; + + src = pkgs.fetchFromGitHub { + owner = "puddly"; + repo = pname; + rev = version; + sha256 = "sha256-jBBd+O3S/4AlxAhrF9j9Bi5vMKZNk0M17ok9JzcI8F8="; + }; + + buildInputs = with pkgs.python3Packages; [ + setuptools + setuptools-git-versioning + ]; + + nativeBuildInputs = with pkgs.python3Packages; [ + aiohttp + cryptography + yarl + pillow + pydantic + ]; + + doCheck = false; + }; + + ha-nanokvm = pkgs.buildHomeAssistantComponent rec { + owner = "Wouter0100"; + domain = "nanokvm"; + version = "v0.0.1"; + + src = pkgs.fetchFromGitHub { + owner = owner; + repo = "homeassistant-nanokvm"; + rev = "663f9710dfea109f0bb0417df5828b8d639e70c4"; + hash = "sha256-6rTEOshNCe0x4iEHljqY/6p2TK1HasgNycRHkmo2Hhw="; + }; + + propagatedBuildInputs = [ + python-nanokvm + ]; + + meta = { + changelog = "https://github.com/Wouter0100/homeassistant-nanokvm/releases/tag/${version}"; + description = "This integration allows you to control and monitor your Sipeed NanoKVM device from Home Assistant."; + homepage = "https://github.com/Wouter0100/homeassistant-nanokvm"; + maintainers = [ ]; + }; + }; +in +{ + services.home-assistant.customComponents = [ + ha-nanokvm + ]; +} diff --git a/modules/homeassistant/hacs/overseerr.nix b/modules/homeassistant/hacs/overseerr.nix new file mode 100644 index 0000000..54baf0b --- /dev/null +++ b/modules/homeassistant/hacs/overseerr.nix @@ -0,0 +1,47 @@ +{ pkgs, ... }: +let + pyoverseerr = pkgs.python3Packages.buildPythonPackage rec { + pname = "pyoverseerr"; + version = "0.1.40"; + format = "setuptools"; + + src = pkgs.fetchFromGitHub { + owner = "vaparr"; + repo = pname; + rev = "master"; + sha256 = "sha256-sWYe6EV/IO/tGGXcnKiebb47eidIj0xnM/aZUfdZXyY="; + }; + + buildInputs = with pkgs.python3Packages; [ setuptools ]; + doCheck = false; # no tests in the PyPI tarball + }; + + ha-overseerr = pkgs.buildHomeAssistantComponent rec { + owner = "vaparr"; + domain = "overseerr"; + version = "0.1.42"; + + src = pkgs.fetchFromGitHub { + owner = owner; + repo = "ha-overseerr"; + rev = version; + hash = "sha256-UvUowCgfay9aRV+iC/AQ9vvJzhGZbH+/1kVjxPFBKcI="; + }; + + propagatedBuildInputs = [ + pyoverseerr + ]; + + meta = { + changelog = "https://github.com/vaparr/ha-overseerr/releases/tag/${version}"; + description = "The Overseerr integration monitors data from your Overseerr instance."; + homepage = "https://github.com/vaparr/ha-overseerr"; + maintainers = [ ]; + }; + }; +in +{ + services.home-assistant.customComponents = [ + ha-overseerr + ]; +} diff --git a/modules/homeassistant/hacs/petlibro.nix b/modules/homeassistant/hacs/petlibro.nix new file mode 100644 index 0000000..6e50315 --- /dev/null +++ b/modules/homeassistant/hacs/petlibro.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: +let + ha-petlibro = pkgs.buildHomeAssistantComponent rec { + owner = "jjjonesjr33"; + domain = "petlibro"; + version = "v1.0.22.3"; + + src = pkgs.fetchFromGitHub { + owner = owner; + repo = "petlibro"; + rev = version; + hash = "sha256-fYzy4OpK9Fs+KQ44H4G6DJlcSg9Zyi56fjsmdxDBviM="; + }; + + meta = { + changelog = "https://github.com/jjjonesjr33/petlibro/releases/tag/${version}"; + description = "PETLIBRO integration for Home Assistant."; + homepage = "https://github.com/jjjonesjr33/petlibro"; + maintainers = [ ]; + }; + }; +in +{ + services.home-assistant.customComponents = [ + ha-petlibro + ]; +} diff --git a/modules/homeassistant/hacs/wyzeapi.nix b/modules/homeassistant/hacs/wyzeapi.nix new file mode 100644 index 0000000..0d8b6ad --- /dev/null +++ b/modules/homeassistant/hacs/wyzeapi.nix @@ -0,0 +1,59 @@ +{ pkgs, ... }: +let + wyzeapy = pkgs.python3Packages.buildPythonPackage rec { + pname = "wyzeapy"; + version = "0.5.27"; + format = "pyproject"; + + src = pkgs.fetchFromGitHub { + owner = "SecKatie"; + repo = "wyzeapy"; + rev = version; + sha256 = "sha256-IfhRsVWj/bcKOtpCdmpgrz3L8iY73e+weHlOo5rfKHw="; + }; + + buildInputs = with pkgs.python3Packages; [ poetry-core ]; + + nativeBuildInputs = with pkgs.python3Packages; [ + aiodns + aiohttp + pycryptodome + ]; + + doCheck = false; # no tests in the PyPI tarball + }; + + ha-wyzeapi = pkgs.buildHomeAssistantComponent rec { + owner = "SecKatie"; + domain = "wyzeapi"; + version = "0.1.33"; + + src = pkgs.fetchFromGitHub { + owner = owner; + repo = "ha-wyzeapi"; + rev = version; + hash = "sha256-Hl1Vmi2lhoJW3bdkrtO2mNqfLxURPwqFPjYgdrHRxYk="; + }; + + propagatedBuildInputs = [ + wyzeapy + ]; + + postPatch = '' + substituteInPlace custom_components/wyzeapi/manifest.json \ + --replace '"wyzeapy>=0.5.28,<0.6"' '"wyzeapy>=0.5.27,<0.6"' + ''; + + meta = { + changelog = "https://github.com/SecKatie/ha-wyzeapi/releases/tag/${version}"; + description = "This is a custom component to allow control of various Wyze devices in Home Assistant using the unofficial API."; + homepage = "https://github.com/SecKatie/ha-wyzeapi"; + maintainers = [ ]; + }; + }; +in +{ + services.home-assistant.customComponents = [ + ha-wyzeapi + ]; +} diff --git a/hosts/pi5/hass.nix b/modules/homeassistant/hass.nix similarity index 85% rename from hosts/pi5/hass.nix rename to modules/homeassistant/hass.nix index 0d2ee04..2def729 100644 --- a/hosts/pi5/hass.nix +++ b/modules/homeassistant/hass.nix @@ -1,7 +1,7 @@ -{ ... }: +{ dream2nix, ... }: let hostAddress = "10.0.1.3"; - localAddress = "10.0.5.18"; + localAddress = "10.0.2.3"; hassPort = 8192; in { @@ -13,7 +13,11 @@ in config = { lib, ... }: { - imports = [ ../homeassistant/homeassistant.nix ]; + imports = [ + ./homeassistant.nix + ({ ... }: { _module.args.dream2nix = dream2nix; }) + ]; + # inherit dream2nix; networking = { firewall = { diff --git a/hosts/homeassistant/homeassistant.nix b/modules/homeassistant/homeassistant.nix similarity index 68% rename from hosts/homeassistant/homeassistant.nix rename to modules/homeassistant/homeassistant.nix index 983efa2..0099049 100755 --- a/hosts/homeassistant/homeassistant.nix +++ b/modules/homeassistant/homeassistant.nix @@ -1,116 +1,25 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: let mosquittoPort = 1883; zigbee2mqttPort = 8080; - - 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-iVcNFdkzdMVjbQuzrTLib8fhirnc+OJdPzM60EnyVe0="; # 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 configuration.nix or a separate file - pythonSteam = pkgs.python3.withPackages (ps: [ - (ps.buildPythonPackage rec { - pname = "steam"; - version = "1.4.4"; # Check for the latest version - src = pkgs.fetchPypi { - inherit pname version; - sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Get the correct hash - }; - doCheck = false; - propagatedBuildInputs = [ ps.requests ps.protobuf ]; - }) - ]); + python-steam = pkgs.python3Packages.buildPythonPackage rec { + pname = "steam"; + version = "1.4.4"; + pyproject = false; + src = pkgs.fetchPypi { + inherit pname version; + sha256 = "sha256-K1vWkRwNSnMS9EG40WK52NR8i+u478bIhnOTsDI/pS4="; + }; + + buildInputs = with pkgs.python3Packages; [ setuptools ]; + + doCheck = false; # no tests in the PyPI tarball + }; in { + imports = [ ./hacs ]; services.home-assistant = { enable = true; @@ -136,6 +45,7 @@ in ]; customComponents = with pkgs.home-assistant-custom-components; [ auth-header + localtuya ]; customLovelaceModules = with pkgs.home-assistant-custom-lovelace-modules; [ atomic-calendar-revive @@ -235,7 +145,7 @@ in gehomesdk onedrive-personal-sdk python-roborock - pythonSteam + python-steam apple-weatherkit ]; @@ -286,12 +196,6 @@ in # 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/homeassistant/automations.yaml ${config.services.home-assistant.configDir}/automations.yaml ln -sf /etc/nixos/hosts/homeassistant/scenes.yaml ${config.services.home-assistant.configDir}/scenes.yaml diff --git a/hosts/homeassistant/scenes.yaml b/modules/homeassistant/scenes.yaml similarity index 100% rename from hosts/homeassistant/scenes.yaml rename to modules/homeassistant/scenes.yaml diff --git a/hosts/homeassistant/scripts.yaml b/modules/homeassistant/scripts.yaml similarity index 100% rename from hosts/homeassistant/scripts.yaml rename to modules/homeassistant/scripts.yaml