main
  1{
  2  lib,
  3  stdenv,
  4  fetchurl,
  5  alsa-lib,
  6  at-spi2-atk,
  7  at-spi2-core,
  8  atk,
  9  autoPatchelfHook,
 10  cairo,
 11  copyDesktopItems,
 12  cups,
 13  dbus,
 14  expat,
 15  fontconfig,
 16  freetype,
 17  gdk-pixbuf,
 18  glib,
 19  gtk3,
 20  libGL,
 21  libdrm,
 22  libgbm,
 23  libpulseaudio,
 24  libuuid,
 25  libvdpau,
 26  libva,
 27  libx11,
 28  libxcb,
 29  libxcomposite,
 30  libxcursor,
 31  libxdamage,
 32  libxext,
 33  libxfixes,
 34  libxi,
 35  libxkbcommon,
 36  libxrandr,
 37  libxrender,
 38  libxscrnsaver,
 39  libxshmfence,
 40  libxtst,
 41  makeDesktopItem,
 42  makeWrapper,
 43  mesa,
 44  nspr,
 45  nss,
 46  pango,
 47  pipewire,
 48  systemd,
 49  vulkan-loader,
 50  wayland,
 51  kdePackages,
 52}:
 53stdenv.mkDerivation rec {
 54  pname = "helium";
 55  version = "0.20.1.1";
 56
 57  passthru.updateScript = [(toString ./update.sh)];
 58  preferLocalBuild = true;
 59
 60  src =
 61    if stdenv.hostPlatform.isAarch64
 62    then
 63      fetchurl {
 64        url = "https://github.com/imputnet/helium-linux/releases/download/${version}/helium-${version}-arm64_linux.tar.xz";
 65        hash = "sha256-IRqV4Qlg1is3Z1GSD7uTzf8FH1v8+hNrUulw9OaWNXc=";
 66      }
 67    else
 68      fetchurl {
 69        url = "https://github.com/imputnet/helium-linux/releases/download/${version}/helium-${version}-x86_64_linux.tar.xz";
 70        hash = "sha256-ICP6RM76D70+GQcch+kNYSdfCLqPW0jVjCNSFVZem1M=";
 71      };
 72
 73  nativeBuildInputs = [
 74    autoPatchelfHook
 75    copyDesktopItems
 76    makeWrapper
 77  ];
 78
 79  buildInputs = [
 80    alsa-lib
 81    at-spi2-atk
 82    at-spi2-core
 83    atk
 84    cairo
 85    cups
 86    dbus
 87    expat
 88    fontconfig
 89    freetype
 90    gdk-pixbuf
 91    glib
 92    gtk3
 93    libGL
 94    libdrm
 95    libgbm
 96    libpulseaudio
 97    libuuid
 98    libvdpau
 99    libva
100    libx11
101    libxcb
102    libxcomposite
103    libxcursor
104    libxdamage
105    libxext
106    libxfixes
107    libxi
108    libxkbcommon
109    libxrandr
110    libxrender
111    libxscrnsaver
112    libxshmfence
113    libxtst
114    mesa
115    nspr
116    nss
117    pango
118    pipewire
119    systemd
120    vulkan-loader
121    wayland
122    kdePackages.qtbase
123  ];
124
125  runtimeDependencies = [gtk3];
126
127  # Qt is linked by optional KDE integration helpers only, so the browser must
128  # not be wrapped with a QPA environment.
129  dontWrapQtApps = true;
130
131  autoPatchelfIgnoreMissingDeps = [
132    "libQt6Core.so.6"
133    "libQt6Gui.so.6"
134    "libQt6Widgets.so.6"
135    "libQt5Core.so.5"
136    "libQt5Gui.so.5"
137    "libQt5Widgets.so.5"
138  ];
139
140  installPhase = ''
141    runHook preInstall
142
143    mkdir -p $out/bin $out/opt/helium
144    cp -r * $out/opt/helium
145
146    makeWrapper $out/opt/helium/helium $out/bin/helium \
147      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [libGL libvdpau libva pipewire alsa-lib libpulseaudio]}" \
148      --add-flags "--ozone-platform-hint=auto" \
149      --add-flags "--enable-features=WaylandWindowDecorations"
150
151    install -Dm444 $out/opt/helium/product_logo_256.png \
152      $out/share/icons/hicolor/256x256/apps/helium.png
153
154    runHook postInstall
155  '';
156
157  desktopItems = [
158    (makeDesktopItem {
159      name = "helium";
160      exec = "helium %U";
161      icon = "helium";
162      desktopName = "Helium";
163      genericName = "Web Browser";
164      comment = "Private, fast, and honest web browser";
165      categories = ["Network" "WebBrowser"];
166      mimeTypes = [
167        "text/html"
168        "text/xml"
169        "application/xhtml+xml"
170        "x-scheme-handler/http"
171        "x-scheme-handler/https"
172      ];
173    })
174  ];
175
176  meta = {
177    description = "Private, fast, and honest web browser based on ungoogled-chromium";
178    homepage = "https://helium.computer/";
179    license = lib.licenses.gpl3Only;
180    mainProgram = "helium";
181    platforms = ["x86_64-linux" "aarch64-linux"];
182  };
183}