Unverified Commit 32c08ba0 authored by Martin Weinelt's avatar Martin Weinelt
Browse files

esphome: build dashboard from source

parent ff589098
Loading
Loading
Loading
Loading
+35 −6
Original line number Diff line number Diff line
{ lib
, buildPythonPackage
, fetchPypi
, fetchFromGitHub
, fetchNpmDeps

# build-system
, setuptools
, nodejs
, npmHooks

}:

buildPythonPackage rec {
  pname = "esphome-dashboard";
  version = "20240620.0";
  format = "setuptools";
  pyproject = true;

  src = fetchPypi {
    pname = "esphome_dashboard";
    inherit version;
    hash = "sha256-lx3i8Z2PUefyibCNiQ4zPEwfgXr6r/TVa9TBF0YE5fA=";
  src = fetchFromGitHub {
    owner = "esphome";
    repo = "dashboard";
    rev = "refs/tags/${version}";
    hash = "sha256-LmIxfX3rcRK90h31J0B5T02f48MCctFERgXxf0zkDm0=";
  };

  npmDeps = fetchNpmDeps {
    inherit src;
    hash = "sha256-xMVESS1bPNJF07joUgY8ku+GWtflWhM8mYAv0emggc8=";
  };

  build-system = [ setuptools ];

  nativeBuildInputs = [
    nodejs
    npmHooks.npmConfigHook
  ];

  postPatch = ''
    # https://github.com/esphome/dashboard/pull/639
    patchShebangs script/build
  '';

  preBuild = ''
    script/build
  '';

  # no tests
  doCheck = false;