functional home assistant

This commit is contained in:
mjallen18
2025-07-18 14:50:13 -05:00
parent 407f8ede87
commit 91be65bc39
41 changed files with 337 additions and 304 deletions

View File

@@ -1,43 +1,10 @@
{ pkgs, ... }:
{ config, lib, namespace, ... }:
with lib;
let
homeassistant-api = pkgs.python3.pkgs.buildPythonPackage rec {
pname = "homeassistant_api";
version = "5.0.0";
format = "pyproject";
src = pkgs.fetchPypi {
inherit pname version;
sha256 = "sha256-UNKTtgInrVJtjHb1WVlUbcbhjBOtTX00eHmm54ww0rY=";
};
# do not run tests
doCheck = false;
nativeBuildInputs = with pkgs.python3.pkgs; [ poetry-core requests-cache ];
dependencies = with pkgs.python3.pkgs; [
requests-cache
pydantic
websockets
];
propagatedBuildInputs = with pkgs.python3.pkgs; [
aiohttp
aiohttp-client-cache
pydantic
requests
requests-cache
simplejson
websockets
];
pythonRelaxDeps = [
"requests-cache"
"pydantic"
"websockets"
];
pythonImportsCheck = [
"homeassistant_api"
];
};
cfg = config.mjallen.desktop.extra.waybar;
pythonEnv = pkgs.python3.withPackages (ps: [
homeassistant-api
pkgs.${namespace}.homeassistant-api
]);
waybar-hass = pkgs.writeScriptBin "waybar-hass" ''
@@ -102,5 +69,9 @@ let
'';
in
{
home.packages = [ waybar-hass ];
imports = [ ../options.nix ];
config = lib.mkIf cfg.enable {
home.packages = [ waybar-hass ];
};
}

View File

@@ -1,5 +1,8 @@
{ pkgs, ... }:
{ config, lib, namespace, ... }:
with lib;
let
cfg = config.mjallen.desktop.extra.waybar;
waybar-weather = pkgs.writeScriptBin "waybar-weather" ''
#!/usr/bin/env nix-shell
#! nix-shell -i python3 --pure
@@ -429,5 +432,9 @@ let
'';
in
{
home.packages = [ waybar-weather ];
imports = [ ../options.nix ];
config = lib.mkIf cfg.enable {
home.packages = [ waybar-weather ];
};
}