diff --git a/pkgs/by-name/on/onlykey/package.nix b/pkgs/by-name/on/onlykey/package.nix index 8ae4619a7ab9..98220dd8dd2d 100644 --- a/pkgs/by-name/on/onlykey/package.nix +++ b/pkgs/by-name/on/onlykey/package.nix @@ -46,11 +46,43 @@ buildNpmPackage (finalAttrs: { # should not break other things. npmFlags = [ "--ignore-scripts" ]; + postPatch = '' + # NW.js 0.102 in Chrome-packaged-app mode never advances + # document.readyState past "loading", so DOMContentLoaded and load + # events never fire and the wizard UI never initializes (the window + # only shows the page background and the "Last message received" + # footer text). Dispatch the events manually after the bottom-of-body + # scripts have registered their listeners. + substituteInPlace app/app.html \ + --replace-fail \ + '' \ + ' + ' + + # The app should not create autostart entries on first launch. + substituteInPlace app/app.js \ + --replace-fail \ + "} else if (!localStorage.hasOwnProperty('autoLaunch')) {" \ + "} else if (false && !localStorage.hasOwnProperty('autoLaunch')) {" + ''; + + postBuild = '' + substituteInPlace build/package.json \ + --replace-fail '"name": "OnlyKey-dev"' '"name": "OnlyKey"' \ + --replace-fail '"toolbar": true' '"toolbar": false' + ''; + installPhase = '' runHook preInstall + rm -rf node_modules + npm ci --omit=dev --omit=optional --ignore-scripts + rm -rf node_modules/nw + rm -f node_modules/.bin/nw + mkdir -p "$out/share" cp -r build "$out/share/onlykey" + cp -r node_modules "$out/share/onlykey/node_modules" ln -s "${finalAttrs.desktopItem}/share/applications" "$out/share/applications"