about summary refs log tree commit diff
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2024-05-05 22:07:26 +0300
committerK900 <me@0upti.me>2024-05-05 22:35:53 +0300
commit34ea6b8c2e02daa6d6a0b07baf1398db26765996 (patch)
tree2f4a3a32c50d070774d3623dc6fe2173e6ab1521
parent7142a2dec9741d40004b9fd7ef76130e1a513cb9 (diff)
home-assistant-custom-lovelace-modules.android-tv-card: init at 3.6.1
-rw-r--r--pkgs/servers/home-assistant/custom-lovelace-modules/android-tv-card/default.nix39
-rw-r--r--pkgs/servers/home-assistant/custom-lovelace-modules/android-tv-card/dont-call-git.patch17
-rw-r--r--pkgs/servers/home-assistant/custom-lovelace-modules/default.nix2
3 files changed, 58 insertions, 0 deletions
diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/android-tv-card/default.nix b/pkgs/servers/home-assistant/custom-lovelace-modules/android-tv-card/default.nix
new file mode 100644
index 0000000000000..5382a0655f968
--- /dev/null
+++ b/pkgs/servers/home-assistant/custom-lovelace-modules/android-tv-card/default.nix
@@ -0,0 +1,39 @@
+{ lib
+, buildNpmPackage
+, fetchFromGitHub
+}:
+
+buildNpmPackage rec {
+  pname = "android-tv-card";
+  version = "3.6.1";
+
+  src = fetchFromGitHub {
+    owner = "Nerwyn";
+    repo = "android-tv-card";
+    rev = version;
+    hash = "sha256-bVfaB5s4b0bu8RiPGoyuPzhe2otCPugldmoVQuYX3P8=";
+  };
+
+  patches = [ ./dont-call-git.patch ];
+
+  npmDepsHash = "sha256-yLIf+VXrNF81pq8dbPa+JplNZqhrRnXHEdEk6wJN98A=";
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir $out
+    cp dist/android-tv-card.min.js $out
+
+    runHook postInstall
+  '';
+
+  passthru.entrypoint = "android-tv-card.min.js";
+
+  meta = with lib; {
+    description = "Universal Customizable TV Remote Card, with HA actions, super configurable touchpad, slider, haptics, and keyboard";
+    homepage = "https://github.com/Nerwyn/android-tv-card";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ k900 ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/android-tv-card/dont-call-git.patch b/pkgs/servers/home-assistant/custom-lovelace-modules/android-tv-card/dont-call-git.patch
new file mode 100644
index 0000000000000..ad409a30dc261
--- /dev/null
+++ b/pkgs/servers/home-assistant/custom-lovelace-modules/android-tv-card/dont-call-git.patch
@@ -0,0 +1,17 @@
+diff --git a/webpack.config.js b/webpack.config.js
+index 469ffe1..3233c4b 100644
+--- a/webpack.config.js
++++ b/webpack.config.js
+@@ -1,11 +1,7 @@
+ const path = require('path');
+ const { execSync } = require('child_process');
+ 
+-let env =
+-	execSync('git branch --show-current').toString().trim() == 'main'
+-		? 'production'
+-		: 'development';
+-env = 'production';
++let env = 'production';
+ 
+ module.exports = {
+ 	mode: env,
diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/default.nix b/pkgs/servers/home-assistant/custom-lovelace-modules/default.nix
index f7dbc32c8e935..7821191b59a3c 100644
--- a/pkgs/servers/home-assistant/custom-lovelace-modules/default.nix
+++ b/pkgs/servers/home-assistant/custom-lovelace-modules/default.nix
@@ -2,6 +2,8 @@
 }:
 
 {
+  android-tv-card = callPackage ./android-tv-card { };
+
   light-entity-card = callPackage ./light-entity-card { };
 
   mini-graph-card = callPackage ./mini-graph-card {};