From 358c74b3328b27639b3a97264effb74fa0f90e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Thu, 7 Nov 2024 01:03:16 +0100 Subject: [PATCH] bruno-cli: init at 1.34.2 --- pkgs/by-name/br/bruno-cli/package.nix | 99 +++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 pkgs/by-name/br/bruno-cli/package.nix diff --git a/pkgs/by-name/br/bruno-cli/package.nix b/pkgs/by-name/br/bruno-cli/package.nix new file mode 100644 index 000000000000..51d771e9a3eb --- /dev/null +++ b/pkgs/by-name/br/bruno-cli/package.nix @@ -0,0 +1,99 @@ +{ + lib, + stdenv, + buildNpmPackage, + bruno, + pkg-config, + pango, + apple-sdk_11, + testers, + bruno-cli, +}: + +let + pname = "bruno-cli"; +in +buildNpmPackage { + inherit pname; + + # since they only make releases and git tags for bruno, + # we lie about bruno-cli's version and say it's the same as bruno's + # to keep them in sync with easier maintenance + inherit (bruno) version src npmDepsHash; + + npmWorkspace = "packages/bruno-cli"; + npmFlags = [ "--legacy-peer-deps" ]; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = + [ + pango + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # fix for: https://github.com/NixOS/nixpkgs/issues/272156 + apple-sdk_11 + ]; + + ELECTRON_SKIP_BINARY_DOWNLOAD = 1; + + buildPhase = '' + runHook preBuild + + npm run build --workspace=packages/bruno-common + npm run build --workspace=packages/bruno-graphql-docs + npm run build --workspace=packages/bruno-query + + npm run sandbox:bundle-libraries --workspace=packages/bruno-js + + runHook postBuild + ''; + + npmPackFlags = [ "--ignore-scripts" ]; + + postInstall = '' + cp -r packages $out/lib/node_modules/usebruno + + echo "Removing unnecessary files" + pushd $out/lib/node_modules/usebruno + rm -rfv packages/bruno-{app,electron,tests,toml,schema,docs} + rm -rfv packages/*/node_modules/typescript + rm -rfv node_modules/{next,@next,@tabler,pdfjs-dist,*redux*,*babel*,prettier,@types*,*react*,*graphiql*} + for pattern in '*.map' '*.map.js' '*.ts'; do + find . -type f -name "$pattern" -exec rm -v {} + + done + popd + echo "Removed unnecessary files" + ''; + + postFixup = '' + wrapProgram $out/bin/bru \ + --prefix NODE_PATH : $out/lib/node_modules/usebruno/packages/bruno-cli/node_modules \ + --prefix NODE_PATH : $out/lib/node_modules + ''; + + passthru.tests.help = testers.runCommand { + name = "${pname}-help-test"; + nativeBuildInputs = [ bruno-cli ]; + script = '' + bru --help && touch $out + ''; + }; + + meta = { + description = "CLI of the open-source IDE For exploring and testing APIs"; + homepage = "https://www.usebruno.com"; + license = lib.licenses.mit; + mainProgram = "bru"; + maintainers = with lib.maintainers; [ + gepbird + kashw2 + lucasew + mattpolzin + water-sucks + ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + }; +}