about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/home-assistant/custom-components
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/home-assistant/custom-components')
-rw-r--r--nixpkgs/pkgs/servers/home-assistant/custom-components/README.md30
-rw-r--r--nixpkgs/pkgs/servers/home-assistant/custom-components/adaptive_lighting/default.nix30
-rw-r--r--nixpkgs/pkgs/servers/home-assistant/custom-components/default.nix8
-rw-r--r--nixpkgs/pkgs/servers/home-assistant/custom-components/govee-lan/default.nix39
-rw-r--r--nixpkgs/pkgs/servers/home-assistant/custom-components/miele/default.nix35
-rw-r--r--nixpkgs/pkgs/servers/home-assistant/custom-components/prometheus_sensor/default.nix (renamed from nixpkgs/pkgs/servers/home-assistant/custom-components/prometheus-sensor/default.nix)3
6 files changed, 136 insertions, 9 deletions
diff --git a/nixpkgs/pkgs/servers/home-assistant/custom-components/README.md b/nixpkgs/pkgs/servers/home-assistant/custom-components/README.md
index a7244b25c173..d7137e5c62f7 100644
--- a/nixpkgs/pkgs/servers/home-assistant/custom-components/README.md
+++ b/nixpkgs/pkgs/servers/home-assistant/custom-components/README.md
@@ -25,7 +25,7 @@ versions into the Python environment.
 }:
 
 buildHomeAssistantComponent {
-  # pname, version
+  # owner, domain, version
 
   src = fetchFromGithub {
     # owner, repo, rev, hash
@@ -40,18 +40,34 @@ buildHomeAssistantComponent {
   }
 }
 
-## Package name normalization
+## Package attribute
 
-Apply the same normalization rules as defined for python packages in
-[PEP503](https://peps.python.org/pep-0503/#normalized-names).
-The name should be lowercased and dots, underlines or multiple
-dashes should all be replaced by a single dash.
+The attribute name must reflect the domain as seen in the
+`manifest.json`, which in turn will match the python module name below
+in the `custom_components/` directory.
+
+**Example:**
+
+The project [mweinelt/ha-prometheus-sensor](https://github.com/mweinelt/ha-prometheus-sensor/blob/1.0.0/custom_components/prometheus_sensor/manifest.json#L2)
+would receive the attribute name `"prometheus_sensor"`, because both
+domain in the `manifest.json` as well as the module name are
+`prometheus_sensor`.
+
+## Package name
+
+The `pname` attribute is a composition of both `owner` and `domain`.
+
+Don't set `pname`, set `owner and `domain` instead.
+
+Exposing the `domain` attribute separately allows checking for
+conflicting components at eval time.
 
 ## Manifest check
 
 The `buildHomeAssistantComponent` builder uses a hook to check whether
 the dependencies specified in the `manifest.json` are present and
-inside the specified version range.
+inside the specified version range. It also makes sure derivation
+and manifest agree about the domain name.
 
 There shouldn't be a need to disable this hook, but you can set
 `dontCheckManifest` to `true` in the derivation to achieve that.
diff --git a/nixpkgs/pkgs/servers/home-assistant/custom-components/adaptive_lighting/default.nix b/nixpkgs/pkgs/servers/home-assistant/custom-components/adaptive_lighting/default.nix
new file mode 100644
index 000000000000..1d2ae2228a5b
--- /dev/null
+++ b/nixpkgs/pkgs/servers/home-assistant/custom-components/adaptive_lighting/default.nix
@@ -0,0 +1,30 @@
+{ lib
+, fetchFromGitHub
+, buildHomeAssistantComponent
+, ulid-transform
+}:
+
+buildHomeAssistantComponent rec {
+  owner = "basnijholt";
+  domain = "adaptive_lighting";
+  version = "1.19.1";
+
+  src = fetchFromGitHub {
+    owner = "basnijholt";
+    repo = "adaptive-lighting";
+    rev = "refs/tags/${version}";
+    hash = "sha256-AZsloE1vNQ9o2pg878J6I5qYXyI4fqYEvr18SrTocWo=";
+  };
+
+  propagatedBuildInputs = [
+    ulid-transform
+  ];
+
+  meta = with lib; {
+    changelog = "https://github.com/basnijholt/adaptive-lighting/releases/tag/${version}";
+    description = "Home Assistant Adaptive Lighting Plugin - Sun Synchronized Lighting";
+    homepage = "https://github.com/basnijholt/adaptive-lighting";
+    maintainers = with maintainers; [ mindstorms6 ];
+    license = licenses.asl20;
+  };
+}
diff --git a/nixpkgs/pkgs/servers/home-assistant/custom-components/default.nix b/nixpkgs/pkgs/servers/home-assistant/custom-components/default.nix
index 4a96b305964a..fe1c39487903 100644
--- a/nixpkgs/pkgs/servers/home-assistant/custom-components/default.nix
+++ b/nixpkgs/pkgs/servers/home-assistant/custom-components/default.nix
@@ -2,5 +2,11 @@
 }:
 
 {
-  prometheus-sensor = callPackage ./prometheus-sensor {};
+  adaptive_lighting = callPackage ./adaptive_lighting {};
+
+  govee-lan = callPackage ./govee-lan {};
+
+  miele = callPackage ./miele {};
+
+  prometheus_sensor = callPackage ./prometheus_sensor {};
 }
diff --git a/nixpkgs/pkgs/servers/home-assistant/custom-components/govee-lan/default.nix b/nixpkgs/pkgs/servers/home-assistant/custom-components/govee-lan/default.nix
new file mode 100644
index 000000000000..60c58bb85850
--- /dev/null
+++ b/nixpkgs/pkgs/servers/home-assistant/custom-components/govee-lan/default.nix
@@ -0,0 +1,39 @@
+{ lib
+, buildHomeAssistantComponent
+, fetchFromGitHub
+, govee-led-wez
+}:
+
+buildHomeAssistantComponent {
+  owner = "wez";
+  domain = "govee_lan";
+  version = "unstable-2023-06-10";
+
+  src = fetchFromGitHub {
+    owner = "wez";
+    repo = "govee-lan-hass";
+    rev = "18d8455510d158496f7e5d4f0286f58bd61042bb";
+    hash = "sha256-ZhrxEPBEi+Z+2ZOAQ1amhO0tqvhM6tyFQgoRIVNDtXY=";
+  };
+
+  dontBuild = true;
+
+  propagatedBuildInputs = [
+    govee-led-wez
+  ];
+
+  # enable when pytest-homeassistant-custom-component is packaged
+  doCheck = false;
+
+  # nativeCheckInputs = [
+  #   pytest-homeassistant-custom-component
+  #   pytestCheckHook
+  # ];
+
+  meta = with lib; {
+    description = "Control Govee lights via the LAN API from Home Assistant";
+    homepage = "https://github.com/wez/govee-lan-hass";
+    maintainers = with maintainers; [ SuperSandro2000 ];
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/servers/home-assistant/custom-components/miele/default.nix b/nixpkgs/pkgs/servers/home-assistant/custom-components/miele/default.nix
new file mode 100644
index 000000000000..71624f674b4d
--- /dev/null
+++ b/nixpkgs/pkgs/servers/home-assistant/custom-components/miele/default.nix
@@ -0,0 +1,35 @@
+{
+  lib,
+  fetchFromGitHub,
+  buildHomeAssistantComponent,
+  flatdict,
+  pymiele,
+}:
+buildHomeAssistantComponent rec {
+  owner = "astrandb";
+  domain = "miele";
+  version = "0.1.19";
+
+  src = fetchFromGitHub {
+    inherit owner;
+    repo = domain;
+    rev = "refs/tags/v${version}";
+    hash = "sha256-od7DV10/rkIw9eFMsTRw4bMmhQo9BAmw2rCbKKySeIk=";
+  };
+
+  propagatedBuildInputs = [
+    flatdict
+    pymiele
+  ];
+
+  # Makefile only used for bumping the version
+  dontBuild = true;
+
+  meta = with lib; {
+    changelog = "https://github.com/astrandb/miele/releases/tag/v${version}";
+    description = "A modern integration for Miele devices in Home Assistant";
+    homepage = "https://github.com/astrandb/miele";
+    maintainers = with maintainers; [jamiemagee];
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/servers/home-assistant/custom-components/prometheus-sensor/default.nix b/nixpkgs/pkgs/servers/home-assistant/custom-components/prometheus_sensor/default.nix
index 07bcd9abec1c..2368d85552b2 100644
--- a/nixpkgs/pkgs/servers/home-assistant/custom-components/prometheus-sensor/default.nix
+++ b/nixpkgs/pkgs/servers/home-assistant/custom-components/prometheus_sensor/default.nix
@@ -4,7 +4,8 @@
 }:
 
 buildHomeAssistantComponent rec {
-  pname = "prometheus-sensor";
+  owner = "mweinelt";
+  domain = "prometheus_sensor";
   version = "1.0.0";
 
   src = fetchFromGitHub {