refactor(hass): clean up and remove sonos for spotifyplus
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-09-30 13:39:09 -04:00
parent b47ba67e64
commit c68779da23
5 changed files with 52 additions and 48 deletions

View file

@ -36,7 +36,6 @@ in {
extraComponents = [
"mpd"
"sonos"
# BT components
"ibeacon"

View file

@ -1,24 +1,9 @@
{pkgs, ...} @ inputs:
pkgs.lib.makeScope pkgs.newScope (hass: let
spotPython3Packages = pkgs.python3Packages.override {
overrides = self: super: rec {
smartinspect = pkgs.callPackage ./spotifyplus/smartinspect.nix {
inherit (inputs) smartinspect-src;
python3Packages = spotPython3Packages;
};
spotifywebapi = pkgs.callPackage ./spotifyplus/spotifywebapi.nix {
inherit (inputs) spotifywebapi-src;
inherit smartinspect;
python3Packages = spotPython3Packages;
};
};
};
buildHassComponent = file: extraArgs:
hass.callPackage file (inputs // extraArgs // {});
in {
extended-ollama-conversation = buildHassComponent ./extended-ollama-conversation {};
spotifyplus = import ./spotifyplus ({inherit buildHassComponent;} // inputs);
tuya-local = buildHassComponent ./tuya-local {};
spotifyplus = buildHassComponent ./spotifyplus {python3Packages = spotPython3Packages;};
})

View file

@ -1,34 +1,19 @@
{
spotifyplus-src,
buildHomeAssistantComponent,
python3Packages,
buildHassComponent,
smartinspect-src,
spotifywebapi-src,
pkgs,
...
}: let
inherit (builtins) fromJSON readFile;
manifest = fromJSON (readFile "${spotifyplus-src}/custom_components/spotifyplus/manifest.json");
python3Packages = pkgs.python3Packages.override {
overrides = self: super: rec {
smartinspect = pkgs.callPackage ./smartinspect.nix {
inherit python3Packages smartinspect-src;
};
spotifywebapi = pkgs.callPackage ./spotifywebapi.nix {
inherit python3Packages smartinspect spotifywebapi-src;
};
};
};
in
buildHomeAssistantComponent {
owner = "thlucas1";
inherit (manifest) domain version;
src = spotifyplus-src;
prePatch = ''
substituteInPlace ./custom_components/spotifyplus/manifest.json \
--replace-warn "urllib3>=1.21.1,<1.27" "urllib3>=1.21.1"
'';
propagatedBuildInputs = with python3Packages; [
oauthlib
platformdirs
requests
requests_oauthlib
soco
urllib3
zeroconf
smartinspect # overridden in this python3Packages
spotifywebapi # overridden in this python3Packages
];
}
buildHassComponent ./spotifyplus.nix {inherit python3Packages;}

View file

@ -0,0 +1,34 @@
{
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;
prePatch = ''
substituteInPlace ./custom_components/spotifyplus/manifest.json \
--replace-warn "urllib3>=1.21.1,<1.27" "urllib3>=1.21.1"
'';
propagatedBuildInputs = with python3Packages; [
oauthlib
platformdirs
requests
requests_oauthlib
soco
urllib3
zeroconf
smartinspect # overridden in this python3Packages
spotifywebapi # overridden in this python3Packages
];
}

View file

@ -12,6 +12,7 @@ in
src = spotifywebapi-src;
# FIXME: https://github.com/thlucas1/SpotifyWebApiPython/issues/1
patchPhase = ''
substituteInPlace ./setup.py --replace-warn \
"docspdoc/build/spotifywebapiPython/" \
@ -24,9 +25,9 @@ in
platformdirs
requests
requests_oauthlib
urllib3
zeroconf
smartinspect # overridden in this python3Packages
urllib3
];
pythonImportsCheck = [