Files
dotfiles/config/modules/helium.nix
T
2026-08-05 02:57:59 +01:00

69 lines
2.9 KiB
Nix

{
den,
modules,
inputs,
lib,
stdenv,
...
}:
{
flake-file.inputs = {
heliumFlake = {
url = "github:vikingnope/helium-browser-nix-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
};
modules.helium = settings: {
homeManager =
{ pkgs, ... }:
let
heliumPkg = inputs.heliumFlake.packages.${pkgs.stdenv.hostPlatform.system}.helium;
# The upstream `helium` launcher is a plain Nix wrapper that ignores any
# *-flags.conf file (that convention is Arch-specific, not NixOS). So to
# actually pass command-line flags we re-wrap the launcher here.
#
# Flag names verified against this Helium build's binary strings.
# - AcceleratedVideoDecodeLinuxGL / ...ZeroCopyGL: the VA-API GL decode
# path (renamed from the old Vaapi* names, which are no-ops here).
# - VaapiOnNvidiaGPUs: required. Chromium disables VA-API on NVIDIA by
# default and hard-skips the nvidia-drm device ("Should skip nVidia
# device named: nvidia-drm" in the logs); this re-enables it, routing
# decode to NVDEC through the nvidia-vaapi-driver bridge.
# - VaapiIgnoreDriverChecks: bypass the driver allowlist.
# HEVC decode itself needs no runtime flag in this build (enable_platform_hevc
# is compiled in and on by default). Wayland-only: the NVIDIA VA-API path
# is broken under X11. Upstream considers nvidia-vaapi-driver unsupported,
# so confirm via chrome://media-internals (decoder should read VaapiVideoDecoder).
helium = pkgs.symlinkJoin {
name = "helium-wrapped";
paths = [ heliumPkg ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/helium \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ pkgs.vulkan-loader ]}" \
--add-flags "--enable-features=AcceleratedVideoDecodeLinuxGL,AcceleratedVideoDecodeLinuxZeroCopyGL,VaapiOnNvidiaGPUs,VaapiIgnoreDriverChecks" \
--add-flags "--ignore-gpu-blocklist" \
--add-flags "--disable-gpu-sandbox"
'';
};
in
{
home.packages = [ helium ];
nixpkgs.config.allowUnfree = true;
# Gives me widevine support. yay
xdg.configFile."net.imput.helium/WidevineCdm/latest-component-updated-widevine-cdm" = {
text = ''{"Path":"${pkgs.widevine-cdm}/share/google/chrome/WidevineCdm"}'';
};
wayland.windowManager.hyprland.extraLuaFiles = lib.mkIf settings.default {
"helium-bind.lua" = {
autoLoad = true;
content = ''
-- Helium launcher bind (lua config: settings.bind cannot express dispatchers)
hl.bind("SUPER + E", hl.dsp.exec_cmd("helium"))
'';
};
};
};
};
}