esphome: Use proper dashboard version in update script
Also reduce faulty with scoping and use proper callPackage.
This commit is contained in:
parent
765bec3650
commit
b15f2af95e
|
@ -1,4 +1,5 @@
|
|||
{ lib
|
||||
, callPackage
|
||||
, python3
|
||||
, fetchFromGitHub
|
||||
, platformio
|
||||
|
@ -13,7 +14,7 @@ let
|
|||
};
|
||||
};
|
||||
in
|
||||
with python.pkgs; buildPythonApplication rec {
|
||||
python.pkgs.buildPythonApplication rec {
|
||||
pname = "esphome";
|
||||
version = "2022.12.4";
|
||||
format = "setuptools";
|
||||
|
@ -42,7 +43,7 @@ with python.pkgs; buildPythonApplication rec {
|
|||
# They have validation functions like:
|
||||
# - validate_cryptography_installed
|
||||
# - validate_pillow_installed
|
||||
propagatedBuildInputs = [
|
||||
propagatedBuildInputs = with python.pkgs; [
|
||||
aioesphomeapi
|
||||
click
|
||||
colorama
|
||||
|
@ -71,7 +72,7 @@ with python.pkgs; buildPythonApplication rec {
|
|||
"--set ESPHOME_USE_SUBPROCESS ''"
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
nativeCheckInputs = with python.pkgs; [
|
||||
hypothesis
|
||||
mock
|
||||
pytest-asyncio
|
||||
|
@ -92,7 +93,7 @@ with python.pkgs; buildPythonApplication rec {
|
|||
'';
|
||||
|
||||
passthru = {
|
||||
dashboard = esphome-dashboard;
|
||||
dashboard = python.pkgs.esphome-dashboard;
|
||||
updateScript = callPackage ./update.nix {};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,12 +1,23 @@
|
|||
{ writeShellScript
|
||||
, lib
|
||||
, curl
|
||||
, jq
|
||||
, git
|
||||
, gnugrep
|
||||
, gnused
|
||||
, nix-update
|
||||
}:
|
||||
|
||||
writeShellScript "update-esphome" ''
|
||||
PATH=${lib.makeBinPath [ git nix-update ]}
|
||||
PATH=${lib.makeBinPath [ curl gnugrep gnused jq git nix-update ]}
|
||||
|
||||
nix-update esphome.dashboard
|
||||
nix-update esphome
|
||||
LATEST=$(curl https://api.github.com/repos/esphome/esphome/releases/latest | jq -r '.name')
|
||||
echo "Latest version: $LATEST"
|
||||
|
||||
DASHBOARD_VERSION=$(curl https://raw.githubusercontent.com/esphome/esphome/$LATEST/requirements.txt | \
|
||||
grep "esphome-dashboard==" | sed "s/.*=//")
|
||||
echo "Dashboard version: $DASHBOARD_VERSION"
|
||||
|
||||
nix-update esphome.dashboard --version $DASHBOARD_VERSION
|
||||
nix-update esphome --version $LATEST
|
||||
''
|
||||
|
|
Loading…
Reference in a new issue