Skip to content

Commit

Permalink
gfn-electron: init at 2.1.2 (#353887)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrumplex authored Nov 11, 2024
2 parents fcf7e79 + 6019015 commit c598a00
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions pkgs/by-name/gf/gfn-electron/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
lib,
buildNpmPackage,
fetchFromGitHub,
electron,
nix-update-script,
makeBinaryWrapper,
}:
let
version = "2.1.2";
in
buildNpmPackage {
pname = "gfn-electron";
inherit version;

src = fetchFromGitHub {
owner = "hmlendea";
repo = "gfn-electron";
rev = "refs/tags/v${version}";
hash = "sha256-kTnM4wSDqP2V8hb4mDhbQYpVYouSnUkjuuCfITb/xgY=";
};

npmDepsHash = "sha256-27N0hWOfkLQGaGspm4aCoVF6PWiUOAKs+JzbdQV94lo=";

nativeBuildInputs = [ makeBinaryWrapper ];

env.ELECTRON_SKIP_BINARY_DOWNLOAD = true;

# FIXME: Git dependency node_modules/register-scheme contains install scripts,
# but has no lockfile, which is something that will probably break.
forceGitDeps = true;

makeCacheWritable = true;

buildPhase = ''
runHook preBuild
# NOTE: Upstream explicitly opts to not build an ASAR as it would cause all
# text to disappear in the app.
npm exec electron-builder -- \
--dir \
-c.electronDist=${electron.dist} \
-c.electronVersion=${electron.version}
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out
cp -r dist/*-unpacked $out/dist
install -Dm644 com.github.hmlendea.geforcenow-electron.desktop -t $out/share/applications
install -Dm644 icon.png $out/share/icons/hicolor/512x512/apps/geforcenow-electron.png
runHook postInstall
'';

postFixup = ''
makeWrapper $out/dist/geforcenow-electron $out/bin/geforcenow-electron \
--add-flags "--no-sandbox --disable-gpu-sandbox" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime}}"
substituteInPlace $out/share/applications/com.github.hmlendea.geforcenow-electron.desktop \
--replace-fail "/opt/geforcenow-electron/geforcenow-electron" "geforcenow-electron" \
--replace-fail "Icon=nvidia" "Icon=geforcenow-electron"
'';

passthru.updateScript = nix-update-script { };

meta = {
description = "Linux Desktop client for Nvidia's GeForce NOW game streaming service";
homepage = "https://github.com/hmlendea/gfn-electron";
license = with lib.licenses; [ gpl3Only ];
platforms = lib.intersectLists lib.platforms.linux electron.meta.platforms;
maintainers = with lib.maintainers; [ pluiedev ];
mainProgram = "geforcenow-electron";
};
}

0 comments on commit c598a00

Please sign in to comment.