From bb8ea696a938704e886ae0d5664ea4f770cf5b69 Mon Sep 17 00:00:00 2001 From: Doloro1978 Date: Sun, 4 Jan 2026 20:24:33 +0000 Subject: [PATCH] init --- .gitignore | 1 + flake.lock | 61 ++++++++++++++ flake.nix | 232 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 294 insertions(+) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8c74e57 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1767379071, + "narHash": "sha256-EgE0pxsrW9jp9YFMkHL9JMXxcqi/OoumPJYwf+Okucw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fb7944c166a3b630f177938e478f0378e64ce108", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..646a6e7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,232 @@ +{ + # 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 ]; + }; + } + ); +}