refactor(hass-components): use same python3Packages
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2025-01-10 23:59:29 -05:00
parent 0aeedb3042
commit 35f1041105
9 changed files with 92 additions and 91 deletions

View file

@ -1,17 +1,33 @@
{
lib,
pkgs,
self,
...
} @ inputs:
lib.makeScope pkgs.newScope (hass: let
inherit (self.lib) mergeAttrsList;
python3Packages = pkgs.python312Packages.override {
overrides = final: prev: (mergeAttrsList (map (x: x python3Packages final prev) [
(import ./spotifyplus/overrides.nix ({inherit pkgs;} // inputs))
(import ./tuya-local/overrides.nix {inherit pkgs;})
]));
};
buildHassComponent = file: extraArgs:
hass.callPackage file (inputs // extraArgs // {});
hass.callPackage file (inputs // extraArgs // {inherit python3Packages;});
in {
extended-ollama-conversation = buildHassComponent ./extended-ollama-conversation {};
ha-fallback-conversation = buildHassComponent ./ha-fallback-conversation {};
material-symbols = buildHassComponent ./material-symbols {};
netdaemon = buildHassComponent ./netdaemon {};
spotifyplus = import ./spotifyplus ({inherit buildHassComponent;} // inputs);
tuya-local = import ./tuya-local ({inherit buildHassComponent;} // inputs);
spotifyplus = buildHassComponent ./spotifyplus {};
tuya-local = buildHassComponent ./tuya-local {};
yamaha-soundbar = buildHassComponent ./yamaha-soundbar {};
})

View file

@ -1,23 +1,29 @@
{
self,
buildHassComponent,
smartinspect-src,
spotifywebapi-src,
pkgs,
spotifyplus-src,
buildHomeAssistantComponent,
python3Packages,
...
}: let
python3Packages = pkgs.python3Packages.override {
overrides = _: super: rec {
smartinspect = pkgs.callPackage ./smartinspect.nix {
inherit python3Packages smartinspect-src;
};
spotifywebapi = pkgs.callPackage ./spotifywebapi.nix {
inherit python3Packages smartinspect spotifywebapi-src;
};
urllib3 = self.packages.${pkgs.system}.urllib3.override {
inherit python3Packages;
};
};
};
inherit (builtins) fromJSON readFile;
manifest = fromJSON (readFile "${spotifyplus-src}/custom_components/spotifyplus/manifest.json");
in
buildHassComponent ./spotifyplus.nix {inherit python3Packages;}
buildHomeAssistantComponent {
owner = "thlucas1";
inherit (manifest) domain version;
src = spotifyplus-src;
propagatedBuildInputs = with python3Packages; [
oauthlib
platformdirs
requests
requests_oauthlib
soco
urllib3
zeroconf
smartinspect # overridden in python3Packages
spotifywebapi # overridden in python3Packages
];
}

View file

@ -0,0 +1,17 @@
{
self,
smartinspect-src,
spotifywebapi-src,
pkgs,
...
}: python3Packages: final: prev: rec {
smartinspect = pkgs.callPackage ./smartinspect.nix {
inherit python3Packages smartinspect-src;
};
spotifywebapi = pkgs.callPackage ./spotifywebapi.nix {
inherit python3Packages smartinspect spotifywebapi-src;
};
urllib3 = self.packages.${pkgs.system}.urllib3.override {
inherit python3Packages;
};
}

View file

@ -1,29 +0,0 @@
{
spotifyplus-src,
buildHomeAssistantComponent,
python3Packages,
...
}: let
inherit (builtins) fromJSON readFile;
manifest = fromJSON (readFile "${spotifyplus-src}/custom_components/spotifyplus/manifest.json");
in
buildHomeAssistantComponent {
owner = "thlucas1";
inherit (manifest) domain version;
src = spotifyplus-src;
propagatedBuildInputs = with python3Packages; [
oauthlib
platformdirs
requests
requests_oauthlib
soco
urllib3
zeroconf
smartinspect # overridden in this python3Packages
spotifywebapi # overridden in this python3Packages
];
}

View file

@ -22,7 +22,7 @@ in
setuptools
urllib3
zeroconf
smartinspect # overridden in this python3Packages
smartinspect # overridden in python3Packages
];
pythonImportsCheck = [

View file

@ -1,20 +1,22 @@
{
buildHassComponent,
pkgs,
tuya-local-src,
buildHomeAssistantComponent,
python3Packages,
...
}: let
python3Packages = pkgs.python3Packages.override {
overrides = final: prev: {
tinytuya = prev.tinytuya.overridePythonAttrs (o: rec {
version = "1.16.0";
src = pkgs.fetchFromGitHub {
owner = "jasonacox";
repo = "tinytuya";
rev = "v${version}";
hash = "sha256-K65kZjLa5AJG9FEYAs/Jf2UC8qiP7BkC8znHMHMYeg4=";
};
});
};
};
inherit (builtins) fromJSON readFile;
manifest = fromJSON (readFile "${tuya-local-src}/custom_components/tuya_local/manifest.json");
in
buildHassComponent ./tinytuya.nix {inherit python3Packages;}
buildHomeAssistantComponent {
owner = "make-all";
inherit (manifest) domain version;
src = tuya-local-src;
propagatedBuildInputs = with python3Packages; [
tinytuya
tuya-device-sharing-sdk
];
}

View file

@ -0,0 +1,11 @@
{pkgs, ...}: python3Packages: final: prev: {
tinytuya = prev.tinytuya.overridePythonAttrs (o: rec {
version = "1.16.0";
src = pkgs.fetchFromGitHub {
owner = "jasonacox";
repo = "tinytuya";
rev = "v${version}";
hash = "sha256-K65kZjLa5AJG9FEYAs/Jf2UC8qiP7BkC8znHMHMYeg4=";
};
});
}

View file

@ -1,22 +0,0 @@
{
tuya-local-src,
buildHomeAssistantComponent,
python3Packages,
...
}: let
inherit (builtins) fromJSON readFile;
manifest = fromJSON (readFile "${tuya-local-src}/custom_components/tuya_local/manifest.json");
in
buildHomeAssistantComponent {
owner = "make-all";
inherit (manifest) domain version;
src = tuya-local-src;
propagatedBuildInputs = with python3Packages; [
tinytuya
tuya-device-sharing-sdk
];
}