-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa72bc2
commit 2b71ca9
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
fetchFromGitHub, | ||
fetchYarnDeps, | ||
fetchpatch, | ||
lib, | ||
mqttx-cli, | ||
nodejs, | ||
stdenv, | ||
testers, | ||
yarnConfigHook, | ||
yarnInstallHook, | ||
}: | ||
|
||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "mqttx-cli"; | ||
version = "1.11.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "emqx"; | ||
repo = "MQTTX"; | ||
rev = "refs/tags/v${finalAttrs.version}"; | ||
hash = "sha256-IPIiSav6MPJmzetBgVw9fLGPjJ+JKS3oWMEfCJmEY84="; | ||
}; | ||
|
||
patches = [ | ||
# moves @faker-js/faker from devDependencies to dependencies | ||
# because the final package depends on it | ||
# https://github.com/emqx/MQTTX/pull/1801 | ||
(fetchpatch { | ||
url = "https://github.com/emqx/MQTTX/commit/3d89c3a08477e9e2b5d83f2a222ceaa8c08e50ce.patch"; | ||
hash = "sha256-Rd6YpGHsvAYD7/XCJq6dgvGeKfOiLh7IUQFr/AQz0mY="; | ||
}) | ||
]; | ||
|
||
yarnOfflineCache = fetchYarnDeps { | ||
yarnLock = "${finalAttrs.src}/cli/yarn.lock"; | ||
hash = "sha256-vwPwSE6adxM1gkdsJBq3LH2eXze9yXADvnM90LsKjjo="; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
nodejs | ||
yarnConfigHook | ||
yarnInstallHook | ||
]; | ||
|
||
preConfigure = '' | ||
cd cli | ||
''; | ||
|
||
# Using custom build script instead of `yarnBuildHook` | ||
# because it needs `--ignore-engines` before `build`. | ||
buildPhase = '' | ||
runHook preBuild | ||
yarn --offline --ignore-engines build | ||
runHook postBuild | ||
''; | ||
|
||
postInstall = '' | ||
# rename binary so it does not conflict with the desktop app | ||
mv $out/bin/mqttx $out/bin/mqttx-cli | ||
''; | ||
|
||
passthru.tests.version = testers.testVersion { package = mqttx-cli; }; | ||
|
||
meta = { | ||
description = "MQTTX Command Line Tools"; | ||
homepage = "https://mqttx.app/"; | ||
changelog = "https://mqttx.app/changelogs/v${finalAttrs.version}"; | ||
license = lib.licenses.asl20; | ||
maintainers = with lib.maintainers; [ pineapplehunter ]; | ||
platforms = lib.platforms.all; | ||
mainProgram = "mqttx-cli"; | ||
}; | ||
}) |