From 4c705566d91b42ca4c22623346ac377d3932870c Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Fri, 22 Dec 2023 16:38:34 -0800 Subject: Adopt new services.home-assistant.customComponents --- hostnix/weebnix/home-assistant.nix | 77 ++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 33 deletions(-) (limited to 'hostnix/weebnix') diff --git a/hostnix/weebnix/home-assistant.nix b/hostnix/weebnix/home-assistant.nix index 16c73e7..ad07d2b 100644 --- a/hostnix/weebnix/home-assistant.nix +++ b/hostnix/weebnix/home-assistant.nix @@ -1,38 +1,6 @@ { pkgs, ... }: -let - # Being cleaned up; see https://github.com/NixOS/nixpkgs/pull/160346 - customComponentFromGitHub = { name, ... }@attrs: - { stdenv, fetchFromGitHub }: - stdenv.mkDerivation { - inherit name; - src = fetchFromGitHub (removeAttrs attrs [ "name" ]); - dontUnpack = true; - installPhase = "cp -r $src/custom_components/${name} $out"; - }; - mapComponentTmpfile = map (package: - let drv = pkgs.callPackage package { }; - in "L+ /var/lib/hass/custom_components/${drv.name} - - - - ${drv}/"); -in { - systemd.tmpfiles.rules = - [ "d /var/lib/hass/custom_components 0700 hass hass" ] - ++ mapComponentTmpfile [ - (customComponentFromGitHub { - name = "auth_header"; - owner = "BeryJu"; - repo = "hass-auth-header"; - rev = "v1.10"; - hash = "sha256-dSmY3d8Kx0pXl+20dTGAYgjSH6OhNh53jPX7VLCZs7Y="; - }) - (customComponentFromGitHub { - name = "tuya_local"; - owner = "make-all"; - repo = "tuya-local"; - rev = "2023.9.1"; - hash = "sha256-uHImitvHFU7JoBx+aKzZuvpKl2tJCXwsxxk+sJ1+igk="; - }) - ]; - +{ services.postgresql = { enable = true; ensureDatabases = [ "hass" ]; @@ -56,6 +24,49 @@ in { "met" "radio_browser" ]; + customComponents = [ + ( + pkgs.buildHomeAssistantComponent rec { + owner = "BeryJu"; + domain = "auth_header"; + version = "1.10"; + src = pkgs.fetchFromGitHub { + inherit owner; + repo = "hass-auth-header"; + rev = "refs/tags/v${version}"; + hash = "sha256-dSmY3d8Kx0pXl+20dTGAYgjSH6OhNh53jPX7VLCZs7Y="; + }; + dontBuild = true; + } + ) + ( + pkgs.buildHomeAssistantComponent rec { + owner = "make-all"; + domain = "tuya_local"; + version = "2023.12.1"; + src = pkgs.fetchFromGitHub { + inherit owner; + repo = "tuya-local"; + rev = "refs/tags/${version}"; + hash = "sha256-vi5EmtXAyXaUbJl+yAT5EL0yYb3XFRaAj6fybQRCM4A="; + }; + propagatedBuildInputs = with pkgs.home-assistant.python.pkgs; [ + ( + buildPythonPackage rec { + pname = "tinytuya"; + version = "1.13.1"; + format = "wheel"; + src = pkgs.fetchPypi { + inherit pname version format; + hash = "sha256-j7t4P4U9iuVHyb6HASkf7LmBheHN32IjdKE60HUbjIE="; + }; + } + ) + ]; + dontBuild = true; + } + ) + ]; config = { default_config = { }; http = { -- cgit v1.3.1