233 lines
7.5 KiB
Nix
233 lines
7.5 KiB
Nix
{
|
|
# https://github.com/vikingnope/helium-browser-nix-flake/blob/main/flake.nix
|
|
description = "A Nix flake for the Helium browser";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
utils,
|
|
}:
|
|
utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config.allowUnfree = true;
|
|
};
|
|
|
|
versions = {
|
|
linux = "0.7.9.1";
|
|
};
|
|
|
|
version = versions.linux;
|
|
|
|
srcs = {
|
|
x86_64-linux = {
|
|
url = "https://github.com/imputnet/helium-linux/releases/download/${versions.linux}/helium-${versions.linux}-x86_64_linux.tar.xz";
|
|
hash = "sha256-/NcL8aDA5S0zvulKcPwzcmoY+RHeyr78TZUVqv9VAjY=";
|
|
};
|
|
aarch64-linux = {
|
|
url = "https://github.com/imputnet/helium-linux/releases/download/${versions.linux}/helium-${versions.linux}-arm64_linux.tar.xz";
|
|
hash = "sha256-zvL0RMomHzHrTgdbJBg+GrrHPlsmpx0IhuKgYVgWzPA=";
|
|
};
|
|
};
|
|
|
|
widevinecdm = pkgs.widevine-cdm;
|
|
|
|
helium = pkgs.stdenv.mkDerivation {
|
|
pname = "helium";
|
|
inherit version;
|
|
|
|
src = pkgs.fetchurl (srcs.${system} or (throw "Unsupported system: ${system}"));
|
|
|
|
nativeBuildInputs =
|
|
with pkgs;
|
|
[
|
|
makeWrapper
|
|
]
|
|
++ pkgs.lib.optionals stdenv.isLinux [
|
|
autoPatchelfHook
|
|
copyDesktopItems
|
|
];
|
|
|
|
buildInputs =
|
|
with pkgs;
|
|
pkgs.lib.optionals stdenv.isLinux [
|
|
alsa-lib
|
|
at-spi2-atk
|
|
at-spi2-core
|
|
atk
|
|
cairo
|
|
cups
|
|
dbus
|
|
expat
|
|
fontconfig
|
|
freetype
|
|
gdk-pixbuf
|
|
glib
|
|
gtk3
|
|
libGL
|
|
xorg.libX11
|
|
xorg.libXScrnSaver
|
|
xorg.libXcomposite
|
|
xorg.libXcursor
|
|
xorg.libXdamage
|
|
xorg.libXext
|
|
xorg.libXfixes
|
|
xorg.libXi
|
|
xorg.libXrandr
|
|
xorg.libXrender
|
|
xorg.libXtst
|
|
libdrm
|
|
libgbm
|
|
libpulseaudio
|
|
xorg.libxcb
|
|
libxkbcommon
|
|
mesa
|
|
nspr
|
|
nss
|
|
pango
|
|
systemd
|
|
vulkan-loader
|
|
wayland
|
|
libxshmfence
|
|
libuuid
|
|
kdePackages.qtbase
|
|
];
|
|
|
|
autoPatchelfIgnoreMissingDeps = pkgs.lib.optionals pkgs.stdenv.isLinux [
|
|
"libQt6Core.so.6"
|
|
"libQt6Gui.so.6"
|
|
"libQt6Widgets.so.6"
|
|
"libQt5Core.so.5"
|
|
"libQt5Gui.so.5"
|
|
"libQt5Widgets.so.5"
|
|
];
|
|
|
|
dontWrapQtApps = pkgs.stdenv.isLinux;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin $out/opt/helium
|
|
cp -r * $out/opt/helium
|
|
|
|
# The binary is named 'chrome' in the tarball
|
|
makeWrapper $out/opt/helium/chrome $out/bin/helium \
|
|
--prefix LD_LIBRARY_PATH : "${
|
|
pkgs.lib.makeLibraryPath (
|
|
with pkgs;
|
|
[
|
|
libGL
|
|
libvdpau
|
|
libva
|
|
widevine-cdm
|
|
]
|
|
)
|
|
}" \
|
|
--add-flags "--ozone-platform-hint=auto" \
|
|
--add-flags "--enable-features=WaylandWindowDecorations" \
|
|
--add-flags "--disable-component-update" \
|
|
--add-flags "--simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT'" \
|
|
--add-flags "--check-for-update-interval=0" \
|
|
--add-flags "--disable-background-networking"
|
|
|
|
# Install icon
|
|
mkdir -p $out/share/icons/hicolor/256x256/apps
|
|
cp $out/opt/helium/product_logo_256.png $out/share/icons/hicolor/256x256/apps/helium.png
|
|
|
|
|
|
# chmod u+w $out/libexec/helium
|
|
# cp -a ${widevinecdm}/share/google/chrome/WidevineCdm $out/bin
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
desktopItems = pkgs.lib.optionals pkgs.stdenv.isLinux [
|
|
(pkgs.makeDesktopItem {
|
|
name = "helium";
|
|
exec = "helium %U";
|
|
icon = "helium";
|
|
desktopName = "Helium";
|
|
genericName = "Web Browser";
|
|
categories = [
|
|
"Network"
|
|
"WebBrowser"
|
|
];
|
|
terminal = false;
|
|
mimeTypes = [
|
|
"text/html"
|
|
"text/xml"
|
|
"application/xhtml+xml"
|
|
"x-scheme-handler/http"
|
|
"x-scheme-handler/https"
|
|
];
|
|
})
|
|
];
|
|
|
|
meta = with pkgs.lib; {
|
|
description = "Private, fast, and honest web browser based on ungoogled-chromium";
|
|
homepage = "https://helium.computer/";
|
|
license = licenses.gpl3Only;
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
];
|
|
mainProgram = "helium";
|
|
};
|
|
};
|
|
|
|
app = {
|
|
type = "app";
|
|
program = "${helium}/bin/helium";
|
|
meta = {
|
|
inherit (helium.meta)
|
|
description
|
|
homepage
|
|
license
|
|
platforms
|
|
;
|
|
};
|
|
};
|
|
homeManagerModules = {
|
|
widevine =
|
|
{ config, pkgs, ... }:
|
|
{
|
|
options.widevine = with pkgs.lib; {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Enable Widevine Cdm configuration for Chromium.";
|
|
};
|
|
};
|
|
|
|
config = pkgs.lib.mkIf config.widevine.enable {
|
|
# Define the file and its path
|
|
home.file.".config/net.imput.helium/WidevineCdm/latest-component-updated-widevine-cdm" = {
|
|
text = ''{"Path":"${widevinecdm}/share/google/chrome/WidevineCdm"}'';
|
|
permissions = "0644";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
in
|
|
{
|
|
packages.default = helium;
|
|
packages.helium = helium;
|
|
|
|
apps.default = app;
|
|
apps.helium = app;
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = [ helium ];
|
|
};
|
|
}
|
|
);
|
|
}
|