feat(hass): force use of nixpkgs deps for custom integrations
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-09-22 20:22:37 -04:00
parent f8dd9f7891
commit 0d9c6bab75
6 changed files with 17 additions and 115 deletions

View file

@ -9,21 +9,15 @@ pkgs.lib.makeScope pkgs.newScope (hass: let
spotifywebapi = pkgs.callPackage ./spotifyplus/spotifywebapi.nix {
inherit (inputs) spotifywebapi-src;
inherit smartinspect urllib3;
inherit smartinspect;
python3Packages = spotPython3Packages;
};
urllib3 = spotPython3Packages.callPackage ./spotifyplus/urllib3.nix {};
};
};
buildHassComponent = file: extraArgs:
hass.callPackage file (inputs // extraArgs // {});
in {
extended-ollama-conversation = buildHassComponent ./extended-ollama-conversation {
openai = import ./extended-ollama-conversation/openai.nix pkgs;
};
spotifyplus = buildHassComponent ./spotifyplus {
python3Packages = spotPython3Packages;
};
extended-ollama-conversation = buildHassComponent ./extended-ollama-conversation {};
spotifyplus = buildHassComponent ./spotifyplus {python3Packages = spotPython3Packages;};
})

View file

@ -1,7 +1,6 @@
{
extended-ollama-conversation-src,
buildHomeAssistantComponent,
openai,
python3Packages,
...
}: let
@ -16,8 +15,13 @@ in
src = extended-ollama-conversation-src;
propagatedBuildInputs = [
python3Packages.ollama
prePatch = ''
substituteInPlace ./custom_components/extended_ollama_conversation/manifest.json \
--replace-warn "openai~=1.3.8" "openai>=1.3.8"
'';
propagatedBuildInputs = with python3Packages; [
ollama
openai
];
}

View file

@ -1,19 +0,0 @@
pkgs:
pkgs.python3Packages.openai.overrideAttrs (o: rec {
name = "${o.pname}-${version}";
version = "1.3.8";
src = pkgs.fetchFromGitHub {
owner = "openai";
repo = "openai-python";
rev = "refs/tags/v${version}";
hash = "sha256-yU0XWEDYl/oBPpYNFg256H0Hn5AaJiP0vOQhbRLnAxQ=";
};
disabledTests =
o.disabledTests
++ [
"test_retrying_timeout_errors_doesnt_leak"
"test_retrying_status_errors_doesnt_leak"
];
})

View file

@ -15,6 +15,11 @@ in
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
@ -23,6 +28,6 @@ in
zeroconf
smartinspect # overridden in this python3Packages
spotifywebapi # overridden in this python3Packages
urllib3 # overridden in this python3Packages
urllib3
];
}

View file

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

View file

@ -1,82 +0,0 @@
# From nixpkgs 4c0061c983a2bcb888f5c478cfb7631ec1090c22
{
lib,
brotli,
brotlicffi,
buildPythonPackage,
certifi,
cryptography,
fetchPypi,
idna,
isPyPy,
mock,
pyopenssl,
pysocks,
pytest-freezegun,
pytest-timeout,
pytestCheckHook,
python-dateutil,
tornado,
trustme,
}:
buildPythonPackage rec {
pname = "urllib3";
version = "1.26.16";
format = "setuptools";
src = fetchPypi {
inherit pname version;
hash = "sha256-jxNfZQJ1a95rKpsomJ31++h8mXDOyqaQQe3M5/BYmxQ=";
};
propagatedBuildInputs =
passthru.optional-dependencies.brotli
++ passthru.optional-dependencies.socks;
nativeCheckInputs = [
python-dateutil
mock
pytest-freezegun
pytest-timeout
pytestCheckHook
tornado
trustme
];
doCheck = false;
preCheck = ''
export CI # Increases LONG_TIMEOUT
'';
pythonImportsCheck = [
"urllib3"
];
passthru.optional-dependencies = {
brotli =
if isPyPy
then [
brotlicffi
]
else [
brotli
];
secure = [
certifi
cryptography
idna
pyopenssl
];
socks = [
pysocks
];
};
meta = with lib; {
description = "Powerful, sanity-friendly HTTP client for Python";
homepage = "https://github.com/shazow/urllib3";
changelog = "https://github.com/urllib3/urllib3/blob/${version}/CHANGES.rst";
license = licenses.mit;
};
}