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 = [ extraComponents = [
"mpd" "mpd"
"sonos"
# BT components # BT components
"ibeacon" "ibeacon"

View file

@ -1,24 +1,9 @@
{pkgs, ...} @ inputs: {pkgs, ...} @ inputs:
pkgs.lib.makeScope pkgs.newScope (hass: let 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: buildHassComponent = file: extraArgs:
hass.callPackage file (inputs // extraArgs // {}); hass.callPackage file (inputs // extraArgs // {});
in { in {
extended-ollama-conversation = buildHassComponent ./extended-ollama-conversation {}; extended-ollama-conversation = buildHassComponent ./extended-ollama-conversation {};
spotifyplus = import ./spotifyplus ({inherit buildHassComponent;} // inputs);
tuya-local = buildHassComponent ./tuya-local {}; tuya-local = buildHassComponent ./tuya-local {};
spotifyplus = buildHassComponent ./spotifyplus {python3Packages = spotPython3Packages;};
}) })

View file

@ -1,34 +1,19 @@
{ {
spotifyplus-src, buildHassComponent,
buildHomeAssistantComponent, smartinspect-src,
python3Packages, spotifywebapi-src,
pkgs,
... ...
}: let }: let
inherit (builtins) fromJSON readFile; python3Packages = pkgs.python3Packages.override {
overrides = self: super: rec {
manifest = fromJSON (readFile "${spotifyplus-src}/custom_components/spotifyplus/manifest.json"); smartinspect = pkgs.callPackage ./smartinspect.nix {
inherit python3Packages smartinspect-src;
};
spotifywebapi = pkgs.callPackage ./spotifywebapi.nix {
inherit python3Packages smartinspect spotifywebapi-src;
};
};
};
in in
buildHomeAssistantComponent { buildHassComponent ./spotifyplus.nix {inherit python3Packages;}
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

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