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 000000000000..5382a0655f96 --- /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 000000000000..ad409a30dc26 --- /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/button-card/default.nix b/pkgs/servers/home-assistant/custom-lovelace-modules/button-card/default.nix new file mode 100644 index 000000000000..d6ec293f31de --- /dev/null +++ b/pkgs/servers/home-assistant/custom-lovelace-modules/button-card/default.nix @@ -0,0 +1,52 @@ +{ lib +, mkYarnPackage +, fetchYarnDeps +, fetchFromGitHub +}: + +mkYarnPackage rec { + pname = "button-card"; + version = "4.1.2"; + + src = fetchFromGitHub { + owner = "custom-cards"; + repo = "button-card"; + rev = "v${version}"; + hash = "sha256-Ntg1sNgAehcL2fT0rP0YHzV5q6rB5p1TyFXtbZyB3Vo="; + }; + + packageJSON = ./package.json; + + offlineCache = fetchYarnDeps { + yarnLock = src + "/yarn.lock"; + hash = "sha256-OFnsRR9zA9D22xBdh4XfLueGVA2ERXmGEp54x0OFDFY="; + }; + + buildPhase = '' + runHook preBuild + + yarn build + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir $out + cp ./deps/button-card/dist/button-card.js $out + + runHook postInstall + ''; + + doDist = false; + + meta = with lib; { + description = "Lovelace button-card for home assistant"; + homepage = "https://github.com/custom-cards/button-card"; + changelog = "https://github.com/custom-cards/button-card/blob/${src.rev}/CHANGELOG.md"; + license = licenses.mit; + maintainers = with maintainers; [ k900 ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/button-card/package.json b/pkgs/servers/home-assistant/custom-lovelace-modules/button-card/package.json new file mode 100644 index 000000000000..55bf12512470 --- /dev/null +++ b/pkgs/servers/home-assistant/custom-lovelace-modules/button-card/package.json @@ -0,0 +1,78 @@ +{ + "name": "button-card", + "version": "4.1.2", + "description": "Button card for lovelace", + "main": "dist/button-card.js", + "scripts": { + "build": "npm run lint && npm run rollup", + "rollup": "rollup -c", + "babel": "babel dist/button-card.js --out-file dist/button-card.js", + "lint": "eslint src/*.ts", + "watch": "rollup -c --watch", + "postversion": "npm run build", + "audit-fix": "npx yarn-audit-fix" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/custom-cards/button-card.git" + }, + "keywords": [ + "lovelace" + ], + "author": "kuuji", + "contributors": [ + "Ian Richardson (https://github.com/iantrich)", + "Jérôme Wiedemann (https://github.com/RomRider)" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/custom-cards/button-card/issues" + }, + "homepage": "https://github.com/custom-cards/button-card#readme", + "devDependencies": { + "@babel/core": "^7.12.3", + "@babel/plugin-proposal-class-properties": "^7.12.1", + "@babel/plugin-proposal-decorators": "^7.12.1", + "@rollup/plugin-babel": "^5.2.1", + "@rollup/plugin-commonjs": "^16.0.0", + "@rollup/plugin-json": "^4.0.2", + "@rollup/plugin-node-resolve": "^10.0.0", + "@semantic-release/changelog": "^5.0.1", + "@semantic-release/commit-analyzer": "^8.0.1", + "@semantic-release/exec": "^5.0.0", + "@semantic-release/git": "^9.0.0", + "@semantic-release/npm": "^7.0.10", + "@semantic-release/release-notes-generator": "^9.0.1", + "@typescript-eslint/eslint-plugin": "^6.1.0", + "@typescript-eslint/parser": "^6.1.0", + "conventional-changelog-conventionalcommits": "^4.5.0", + "eslint": "7.12.1", + "eslint-config-airbnb-base": "^14.1.0", + "eslint-config-prettier": "^6.15.0", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-prettier": "^3.1.2", + "npm": "^6.14.3", + "prettier": "^2.1.2", + "prettier-eslint": "^11.0.0", + "rollup": "^2.33.1", + "rollup-plugin-cleanup": "^3.2.1", + "rollup-plugin-serve": "^1.1.0", + "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-typescript2": "^0.29.0", + "semantic-release": "^17.3.8", + "ts-lit-plugin": "^1.1.10", + "typescript": "^4.0.5", + "typescript-styled-plugin": "^0.15.0", + "yarn-audit-fix": "^9.3.10" + }, + "dependencies": { + "@ctrl/tinycolor": "^3.1.6", + "@material/mwc-ripple": "^0.19.1", + "fast-copy": "^2.1.0", + "home-assistant-js-websocket": "^8.2.0", + "lit": "^2.7.6", + "lit-element": "^3.3.2", + "lit-html": "^2.7.5", + "memoize-one": "^6.0.0" + } +} diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/card-mod/default.nix b/pkgs/servers/home-assistant/custom-lovelace-modules/card-mod/default.nix new file mode 100644 index 000000000000..bdca8771d00f --- /dev/null +++ b/pkgs/servers/home-assistant/custom-lovelace-modules/card-mod/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildNpmPackage +, fetchFromGitHub +}: + +buildNpmPackage rec { + pname = "lovelace-card-mod"; + version = "3.4.3"; + + src = fetchFromGitHub { + owner = "thomasloven"; + repo = "lovelace-card-mod"; + rev = "v${version}"; + hash = "sha256-LFKOTu0SBeHpf8Hjvsgc/xOUux9d4lBCshdD9u7eO5o="; + }; + + npmDepsHash = "sha256-JJexFmVbDHi2JCiCpcDupzVf0xfwy+vqWILq/dLVcBo="; + + installPhase = '' + runHook preInstall + + mkdir $out + cp card-mod.js $out + + runHook postInstall + ''; + + passthru.entrypoint = "card-mod.js"; + + meta = with lib; { + description = "Add CSS styles to (almost) any lovelace card"; + homepage = "https://github.com/thomasloven/lovelace-card-mod"; + license = licenses.mit; + maintainers = with maintainers; [ k900 ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/decluttering-card/default.nix b/pkgs/servers/home-assistant/custom-lovelace-modules/decluttering-card/default.nix new file mode 100644 index 000000000000..44a83e71e550 --- /dev/null +++ b/pkgs/servers/home-assistant/custom-lovelace-modules/decluttering-card/default.nix @@ -0,0 +1,36 @@ +{ lib +, buildNpmPackage +, fetchFromGitHub +}: + +buildNpmPackage rec { + pname = "decluttering-card"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "custom-cards"; + repo = "decluttering-card"; + rev = "v${version}"; + hash = "sha256-8pf7G6RbLdpIdXYz801+wwAc3NcNs8l0x4fSGqlAmG0="; + }; + + npmDepsHash = "sha256-9tmEfKo8n2LR+r40hEqOfn7w6/P29XQ+KZSHL97wUuY="; + + installPhase = '' + runHook preInstall + + mkdir $out + cp dist/decluttering-card.js $out + + runHook postInstall + ''; + + meta = with lib; { + description = "Declutter your lovelace configuration with the help of this card"; + homepage = "https://github.com/custom-cards/decluttering-card"; + changelog = "https://github.com/custom-cards/decluttering-card/blob/${src.rev}/CHANGELOG.md"; + license = licenses.mit; + maintainers = with maintainers; [ k900 ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/default.nix b/pkgs/servers/home-assistant/custom-lovelace-modules/default.nix index f7dbc32c8e93..d2b16943a59a 100644 --- a/pkgs/servers/home-assistant/custom-lovelace-modules/default.nix +++ b/pkgs/servers/home-assistant/custom-lovelace-modules/default.nix @@ -2,6 +2,16 @@ }: { + android-tv-card = callPackage ./android-tv-card { }; + + button-card = callPackage ./button-card { }; + + card-mod = callPackage ./card-mod { }; + + decluttering-card = callPackage ./decluttering-card { }; + + lg-webos-remote-control = callPackage ./lg-webos-remote-control { }; + light-entity-card = callPackage ./light-entity-card { }; mini-graph-card = callPackage ./mini-graph-card {}; @@ -12,5 +22,7 @@ mushroom = callPackage ./mushroom { }; + valetudo-map-card = callPackage ./valetudo-map-card { }; + zigbee2mqtt-networkmap = callPackage ./zigbee2mqtt-networkmap { }; } diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/lg-webos-remote-control/default.nix b/pkgs/servers/home-assistant/custom-lovelace-modules/lg-webos-remote-control/default.nix new file mode 100644 index 000000000000..9911fbfdce1a --- /dev/null +++ b/pkgs/servers/home-assistant/custom-lovelace-modules/lg-webos-remote-control/default.nix @@ -0,0 +1,37 @@ +{ lib +, buildNpmPackage +, fetchFromGitHub +}: + +buildNpmPackage rec { + pname = "lg-webos-remote-control"; + version = "2.0.3"; + + src = fetchFromGitHub { + owner = "madmicio"; + repo = "LG-WebOS-Remote-Control"; + rev = version; + hash = "sha256-ICOAi8q8dWrBFCv18JYSWc6MIwqxfDXOcc6kCKLGehs="; + }; + + npmDepsHash = "sha256-kN+i0ic1JWs6kqnAliiO4yVMDXwfZaQsRGKeV9A0MxE="; + + installPhase = '' + runHook preInstall + + mkdir $out + cp dist/lg-remote-control.js $out + + runHook postInstall + ''; + + passthru.entrypoint = "lg-remote-control.js"; + + meta = with lib; { + description = "Remote Control for LG TV WebOS"; + homepage = "https://github.com/madmicio/LG-WebOS-Remote-Control"; + license = licenses.mit; + maintainers = with maintainers; [ k900 ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/valetudo-map-card/default.nix b/pkgs/servers/home-assistant/custom-lovelace-modules/valetudo-map-card/default.nix new file mode 100644 index 000000000000..3203c59e7cd9 --- /dev/null +++ b/pkgs/servers/home-assistant/custom-lovelace-modules/valetudo-map-card/default.nix @@ -0,0 +1,39 @@ +{ lib +, buildNpmPackage +, fetchFromGitHub +}: + +buildNpmPackage rec { + pname = "lovelace-valetudo-map-card"; + version = "2023.04.0"; + + src = fetchFromGitHub { + owner = "Hypfer"; + repo = "lovelace-valetudo-map-card"; + rev = "v${version}"; + hash = "sha256-owOIbA1tRlnbWJ/p/wAUpeDnz/Wzu+GmUammJ6VFxHc="; + }; + + patches = [ ./remove-git-dependency.patch ]; + + npmDepsHash = "sha256-xHHbOt9HW+zJAhHEDy2V5eYyLv4e3OrUbnzqeJasSng="; + + installPhase = '' + runHook preInstall + + mkdir $out + cp dist/valetudo-map-card.js $out + + runHook postInstall + ''; + + passthru.entrypoint = "valetudo-map-card.js"; + + meta = with lib; { + description = "Display the map from a valetudo-enabled robot in a home assistant dashboard card"; + homepage = "https://github.com/Hypfer/lovelace-valetudo-map-card"; + license = licenses.mit; + maintainers = with maintainers; [ k900 ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/servers/home-assistant/custom-lovelace-modules/valetudo-map-card/remove-git-dependency.patch b/pkgs/servers/home-assistant/custom-lovelace-modules/valetudo-map-card/remove-git-dependency.patch new file mode 100644 index 000000000000..bedf4af3ac29 --- /dev/null +++ b/pkgs/servers/home-assistant/custom-lovelace-modules/valetudo-map-card/remove-git-dependency.patch @@ -0,0 +1,64 @@ +diff --git a/package-lock.json b/package-lock.json +index cce05ba..36020f8 100644 +--- a/package-lock.json ++++ b/package-lock.json +@@ -1,12 +1,12 @@ + { + "name": "lovelace-valetudo-map-card", +- "version": "2022.08.0", ++ "version": "2023.04.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "lovelace-valetudo-map-card", +- "version": "2022.08.0", ++ "version": "2023.04.0", + "license": "MIT", + "dependencies": { + "custom-card-helpers": "1.9.0" +@@ -21,7 +21,6 @@ + "eslint-plugin-jsdoc": "39.3.0", + "eslint-plugin-regexp": "1.7.0", + "eslint-plugin-sort-keys-fix": "1.1.2", +- "eslint-plugin-sort-requires": "git+https://npm@github.com/Hypfer/eslint-plugin-sort-requires.git#2.1.1", + "pako": "2.0.4", + "rollup": "2.58.0", + "rollup-plugin-babel": "4.4.0", +@@ -1596,12 +1595,6 @@ + "node": ">=6.0.0" + } + }, +- "node_modules/eslint-plugin-sort-requires": { +- "version": "2.1.0", +- "resolved": "git+https://npm@github.com/Hypfer/eslint-plugin-sort-requires.git#3e216dd9e9589b87671a3e7bf4084a0bd96e920e", +- "dev": true, +- "license": "MIT" +- }, + "node_modules/eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", +@@ -4358,11 +4351,6 @@ + } + } + }, +- "eslint-plugin-sort-requires": { +- "version": "git+https://npm@github.com/Hypfer/eslint-plugin-sort-requires.git#3e216dd9e9589b87671a3e7bf4084a0bd96e920e", +- "dev": true, +- "from": "eslint-plugin-sort-requires@git+https://npm@github.com/Hypfer/eslint-plugin-sort-requires.git#2.1.1" +- }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", +diff --git a/package.json b/package.json +index 85a9d35..d8c6865 100644 +--- a/package.json ++++ b/package.json +@@ -23,7 +23,6 @@ + "eslint-plugin-jsdoc": "39.3.0", + "eslint-plugin-regexp": "1.7.0", + "eslint-plugin-sort-keys-fix": "1.1.2", +- "eslint-plugin-sort-requires": "git+https://npm@github.com/Hypfer/eslint-plugin-sort-requires.git#2.1.1", + "@typescript-eslint/eslint-plugin": "5.25.0", + "@typescript-eslint/experimental-utils": "5.25.0", + "@typescript-eslint/parser": "5.25.0",