about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/br
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-01-06 02:12:23 +0100
committerAlyssa Ross <hi@alyssa.is>2024-01-06 02:12:23 +0100
commitf34a1b70eb86e4a63cfb88ea460345bb1aed88e3 (patch)
tree32834d23912250e0c4b86aa4420baacf8091c0fe /nixpkgs/pkgs/by-name/br
parent003ab91dd67b093890db1dd0bab564345db6e496 (diff)
parent7a7cfff8915e06365bc2365ff33d4d413184fa9f (diff)
downloadnixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.gz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.bz2
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.lz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.xz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.zst
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/by-name/br')
-rw-r--r--nixpkgs/pkgs/by-name/br/bruno/package.nix126
1 files changed, 92 insertions, 34 deletions
diff --git a/nixpkgs/pkgs/by-name/br/bruno/package.nix b/nixpkgs/pkgs/by-name/br/bruno/package.nix
index 3725e8c502d9..1687065fbd9b 100644
--- a/nixpkgs/pkgs/by-name/br/bruno/package.nix
+++ b/nixpkgs/pkgs/by-name/br/bruno/package.nix
@@ -1,52 +1,109 @@
 { lib
-, stdenv
-, fetchurl
-, autoPatchelfHook
-, dpkg
-, wrapGAppsHook
-, alsa-lib
-, gtk3
-, mesa
-, nspr
-, nss
-, systemd
+
+, fetchFromGitHub
+, buildNpmPackage
 , nix-update-script
+, electron
+, writeShellScriptBin
+, makeWrapper
+, copyDesktopItems
+, makeDesktopItem
+, pkg-config
+, pixman
+, cairo
+, pango
+, npm-lockfile-fix
 }:
 
-stdenv.mkDerivation rec {
+buildNpmPackage rec {
   pname = "bruno";
-  version = "1.4.0";
+  version = "1.5.1";
+
+  src = fetchFromGitHub {
+    owner = "usebruno";
+    repo = "bruno";
+    rev = "v${version}";
+    hash = "sha256-GgXnsPEUurPHrijf966x5ldp+1lDrgS1iBinU+EkdYU=b";
 
-  src = fetchurl {
-    url = "https://github.com/usebruno/bruno/releases/download/v${version}/bruno_${version}_amd64_linux.deb";
-    hash = "sha256-yCYI2c9M19d1+BpnM7YJLkZk8Vdix+YSWCa5qsCMBxw=";
+    postFetch = ''
+      ${lib.getExe npm-lockfile-fix} $out/package-lock.json
+    '';
   };
 
-  nativeBuildInputs = [ autoPatchelfHook dpkg wrapGAppsHook ];
+  npmDepsHash = "sha256-R5dEL4QbwCSE9+HHCXlf/pYLmjCaD15tmdSSLbZgmt0=";
+
+  nativeBuildInputs = [
+    (writeShellScriptBin "phantomjs" "echo 2.1.1")
+    makeWrapper
+    copyDesktopItems
+    pkg-config
+  ];
 
   buildInputs = [
-    alsa-lib
-    gtk3
-    mesa
-    nspr
-    nss
+    pixman
+    cairo
+    pango
+  ];
+
+  desktopItems = [
+    (makeDesktopItem {
+      name = "bruno";
+      desktopName = "Bruno";
+      exec = "bruno %U";
+      icon = "bruno";
+      comment = "Opensource API Client for Exploring and Testing APIs";
+      categories = [ "Development" ];
+      startupWMClass = "Bruno";
+    })
   ];
 
-  runtimeDependencies = [ (lib.getLib systemd) ];
+  postPatch = ''
+    substituteInPlace scripts/build-electron.sh \
+      --replace 'if [ "$1" == "snap" ]; then' 'exit 0; if [ "$1" == "snap" ]; then'
+  '';
+
+  ELECTRON_SKIP_BINARY_DOWNLOAD=1;
+
+  dontNpmBuild = true;
+  postBuild = ''
+    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
+
+    npm exec electron-builder -- \
+      --dir \
+      -c.electronDist=${electron}/libexec/electron \
+      -c.electronVersion=${electron.version} \
+      -c.npmRebuild=false
+
+    popd
+  '';
+
+  npmPackFlags = [ "--ignore-scripts" ];
 
   installPhase = ''
     runHook preInstall
-    mkdir -p "$out/bin"
-    cp -R opt $out
-    cp -R "usr/share" "$out/share"
-    ln -s "$out/opt/Bruno/bruno" "$out/bin/bruno"
-    chmod -R g-w "$out"
-    runHook postInstall
-  '';
 
-  postFixup = ''
-    substituteInPlace "$out/share/applications/bruno.desktop" \
-      --replace "/opt/Bruno/bruno" "$out/bin/bruno"
+    mkdir -p $out/opt/bruno $out/bin
+
+    cp -r packages/bruno-electron/dist/linux-unpacked/{locales,resources{,.pak}} $out/opt/bruno
+
+    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
+
+    runHook postInstall
   '';
 
   passthru.updateScript = nix-update-script { };
@@ -54,8 +111,9 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Open-source IDE For exploring and testing APIs.";
     homepage = "https://www.usebruno.com";
+    inherit (electron.meta) platforms;
     license = licenses.mit;
     maintainers = with maintainers; [ water-sucks lucasew kashw2 ];
-    platforms = [ "x86_64-linux" ];
+    mainProgram = "bruno";
   };
 }