2023-10-09 19:29:22 +00:00
|
|
|
{ lib
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
, stdenv
|
2024-01-02 11:29:13 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, buildNpmPackage
|
2023-10-09 19:29:22 +00:00
|
|
|
, nix-update-script
|
2024-01-02 11:29:13 +00:00
|
|
|
, electron
|
|
|
|
, writeShellScriptBin
|
|
|
|
, makeWrapper
|
|
|
|
, copyDesktopItems
|
2024-06-20 14:57:18 +00:00
|
|
|
, giflib
|
2024-01-02 11:29:13 +00:00
|
|
|
, makeDesktopItem
|
|
|
|
, pkg-config
|
|
|
|
, pixman
|
|
|
|
, cairo
|
|
|
|
, pango
|
|
|
|
, npm-lockfile-fix
|
2024-04-21 15:54:59 +00:00
|
|
|
, overrideSDK
|
|
|
|
, darwin
|
2023-10-09 19:29:22 +00:00
|
|
|
}:
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
let
|
|
|
|
# fix for: https://github.com/NixOS/nixpkgs/issues/272156
|
|
|
|
buildNpmPackage' =
|
|
|
|
buildNpmPackage.override {
|
|
|
|
stdenv = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
buildNpmPackage' rec {
|
2023-10-09 19:29:22 +00:00
|
|
|
pname = "bruno";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "1.22.0";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "usebruno";
|
|
|
|
repo = "bruno";
|
|
|
|
rev = "v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-RcMmW1+XbQSVeaYnK7y8/WdQLYOIozyt9OCDAsSZ3HU=";
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
postFetch = ''
|
|
|
|
${lib.getExe npm-lockfile-fix} $out/package-lock.json
|
|
|
|
'';
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
npmDepsHash = "sha256-157hm7h5FWuOuxoo6WTtlMPq5LcRZIsSt5NDg0pvim8=";
|
2024-04-21 15:54:59 +00:00
|
|
|
npmFlags = [ "--legacy-peer-deps" ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
(writeShellScriptBin "phantomjs" "echo 2.1.1")
|
2024-01-25 14:12:00 +00:00
|
|
|
pkg-config
|
|
|
|
] ++ lib.optionals (! stdenv.isDarwin) [
|
2024-01-02 11:29:13 +00:00
|
|
|
makeWrapper
|
|
|
|
copyDesktopItems
|
|
|
|
];
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2024-01-02 11:29:13 +00:00
|
|
|
pixman
|
|
|
|
cairo
|
|
|
|
pango
|
2024-04-21 15:54:59 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
darwin.apple_sdk_11_0.frameworks.CoreText
|
2024-06-20 14:57:18 +00:00
|
|
|
giflib
|
2024-01-02 11:29:13 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "bruno";
|
|
|
|
desktopName = "Bruno";
|
|
|
|
exec = "bruno %U";
|
|
|
|
icon = "bruno";
|
|
|
|
comment = "Opensource API Client for Exploring and Testing APIs";
|
|
|
|
categories = [ "Development" ];
|
|
|
|
startupWMClass = "Bruno";
|
|
|
|
})
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace scripts/build-electron.sh \
|
2024-04-21 15:54:59 +00:00
|
|
|
--replace-fail 'if [ "$1" == "snap" ]; then' 'exit 0; if [ "$1" == "snap" ]; then'
|
2024-01-02 11:29:13 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
ELECTRON_SKIP_BINARY_DOWNLOAD=1;
|
|
|
|
|
|
|
|
dontNpmBuild = true;
|
|
|
|
postBuild = ''
|
2024-04-21 15:54:59 +00:00
|
|
|
npm run build --workspace=packages/bruno-common
|
2024-01-02 11:29:13 +00:00
|
|
|
npm run build --workspace=packages/bruno-graphql-docs
|
|
|
|
npm run build --workspace=packages/bruno-app
|
|
|
|
npm run build --workspace=packages/bruno-query
|
|
|
|
|
|
|
|
bash scripts/build-electron.sh
|
|
|
|
|
|
|
|
pushd packages/bruno-electron
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
${if stdenv.isDarwin then ''
|
|
|
|
cp -r ${electron}/Applications/Electron.app ./
|
|
|
|
find ./Electron.app -name 'Info.plist' | xargs -d '\n' chmod +rw
|
|
|
|
|
|
|
|
substituteInPlace electron-builder-config.js \
|
2024-04-21 15:54:59 +00:00
|
|
|
--replace-fail "identity: 'Anoop MD (W7LPPWA48L)'" 'identity: null' \
|
|
|
|
--replace-fail "afterSign: 'notarize.js'," ""
|
2024-01-25 14:12:00 +00:00
|
|
|
|
|
|
|
npm exec electron-builder -- \
|
|
|
|
--dir \
|
|
|
|
--config electron-builder-config.js \
|
|
|
|
-c.electronDist=./ \
|
|
|
|
-c.electronVersion=${electron.version} \
|
|
|
|
-c.npmRebuild=false
|
|
|
|
'' else ''
|
2024-01-02 11:29:13 +00:00
|
|
|
npm exec electron-builder -- \
|
|
|
|
--dir \
|
|
|
|
-c.electronDist=${electron}/libexec/electron \
|
|
|
|
-c.electronVersion=${electron.version} \
|
|
|
|
-c.npmRebuild=false
|
2024-01-25 14:12:00 +00:00
|
|
|
''}
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
|
|
|
npmPackFlags = [ "--ignore-scripts" ];
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
|
|
|
|
${if stdenv.isDarwin then ''
|
|
|
|
mkdir -p $out/Applications
|
|
|
|
|
|
|
|
cp -R packages/bruno-electron/out/**/Bruno.app $out/Applications/
|
|
|
|
'' else ''
|
2024-01-02 11:29:13 +00:00
|
|
|
mkdir -p $out/opt/bruno $out/bin
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
cp -r packages/bruno-electron/dist/linux*-unpacked/{locales,resources{,.pak}} $out/opt/bruno
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
makeWrapper ${lib.getExe electron} $out/bin/bruno \
|
|
|
|
--add-flags $out/opt/bruno/resources/app.asar \
|
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
|
|
|
|
--set-default ELECTRON_IS_DEV 0 \
|
|
|
|
--inherit-argv0
|
|
|
|
|
|
|
|
for s in 16 32 48 64 128 256 512 1024; do
|
|
|
|
size=${"$"}{s}x$s
|
|
|
|
install -Dm644 $src/packages/bruno-electron/resources/icons/png/$size.png $out/share/icons/hicolor/$size/apps/bruno.png
|
|
|
|
done
|
2024-01-25 14:12:00 +00:00
|
|
|
''}
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2023-10-09 19:29:22 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Open-source IDE For exploring and testing APIs";
|
2023-10-09 19:29:22 +00:00
|
|
|
homepage = "https://www.usebruno.com";
|
2024-07-27 06:49:29 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2023-10-09 19:29:22 +00:00
|
|
|
license = licenses.mit;
|
2024-07-27 06:49:29 +00:00
|
|
|
maintainers = with maintainers; [ gepbird kashw2 lucasew mattpolzin water-sucks redyf ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "bruno";
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
|
|
|
}
|