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 deleted file mode 100644 index 55bf12512470..000000000000 --- a/pkgs/servers/home-assistant/custom-lovelace-modules/button-card/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "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/button-card/package.nix b/pkgs/servers/home-assistant/custom-lovelace-modules/button-card/package.nix index e0c4883406cc..adab8aafae02 100644 --- a/pkgs/servers/home-assistant/custom-lovelace-modules/button-card/package.nix +++ b/pkgs/servers/home-assistant/custom-lovelace-modules/button-card/package.nix @@ -1,53 +1,50 @@ { lib, - mkYarnPackage, + stdenv, fetchYarnDeps, fetchFromGitHub, + yarnBuildHook, + yarnConfigHook, + nodejs, }: -mkYarnPackage rec { +stdenv.mkDerivation (finalAttrs: { pname = "button-card"; version = "4.1.2"; src = fetchFromGitHub { owner = "custom-cards"; repo = "button-card"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-Ntg1sNgAehcL2fT0rP0YHzV5q6rB5p1TyFXtbZyB3Vo="; }; - packageJSON = ./package.json; - offlineCache = fetchYarnDeps { - yarnLock = src + "/yarn.lock"; + inherit (finalAttrs) src; hash = "sha256-OFnsRR9zA9D22xBdh4XfLueGVA2ERXmGEp54x0OFDFY="; }; - buildPhase = '' - runHook preBuild - - yarn build - - runHook postBuild - ''; + nativeBuildInputs = [ + yarnConfigHook + yarnBuildHook + nodejs + ]; installPhase = '' runHook preInstall mkdir $out - cp ./deps/button-card/dist/button-card.js $out + cp ./dist/button-card.js $out runHook postInstall ''; - doDist = false; - - meta = with lib; { + meta = { 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; + changelog = "https://github.com/custom-cards/button-card/blob/v${finalAttrs.version}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ k900 ]; + platforms = lib.platforms.all; }; -} +})