nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 63 lines 1.4 kB view raw
1{ 2 fetchFromGitHub, 3 fetchYarnDeps, 4 lib, 5 mqttx-cli, 6 nodejs, 7 stdenv, 8 testers, 9 yarnConfigHook, 10 yarnInstallHook, 11}: 12 13stdenv.mkDerivation (finalAttrs: { 14 pname = "mqttx-cli"; 15 version = "1.11.1"; 16 17 src = fetchFromGitHub { 18 owner = "emqx"; 19 repo = "MQTTX"; 20 tag = "v${finalAttrs.version}"; 21 hash = "sha256-kxK/c1tOwK9hCxX19um0z1MWBZQOwADYEh4xEqJNgWI="; 22 }; 23 24 yarnOfflineCache = fetchYarnDeps { 25 yarnLock = "${finalAttrs.src}/cli/yarn.lock"; 26 hash = "sha256-vwPwSE6adxM1gkdsJBq3LH2eXze9yXADvnM90LsKjjo="; 27 }; 28 29 nativeBuildInputs = [ 30 nodejs 31 yarnConfigHook 32 yarnInstallHook 33 ]; 34 35 preConfigure = '' 36 cd cli 37 ''; 38 39 # Using custom build script instead of `yarnBuildHook` 40 # because it needs `--ignore-engines` before `build`. 41 buildPhase = '' 42 runHook preBuild 43 yarn --offline --ignore-engines build 44 runHook postBuild 45 ''; 46 47 postInstall = '' 48 # rename binary so it does not conflict with the desktop app 49 mv $out/bin/mqttx $out/bin/mqttx-cli 50 ''; 51 52 passthru.tests.version = testers.testVersion { package = mqttx-cli; }; 53 54 meta = { 55 description = "MQTTX Command Line Tools"; 56 homepage = "https://mqttx.app/"; 57 changelog = "https://mqttx.app/changelogs/v${finalAttrs.version}"; 58 license = lib.licenses.asl20; 59 maintainers = with lib.maintainers; [ pineapplehunter ]; 60 platforms = lib.platforms.all; 61 mainProgram = "mqttx-cli"; 62 }; 63})