diff --git a/pkgs/by-name/pv/pvzge/main.js b/pkgs/by-name/pv/pvzge/main.js new file mode 100644 index 000000000000..0c60c9005da7 --- /dev/null +++ b/pkgs/by-name/pv/pvzge/main.js @@ -0,0 +1,33 @@ +const { app, BrowserWindow } = require('electron/main') + +function createWindow() { + const win = new BrowserWindow({ + useContentSize: true, + width: 975, + height: 608, + minWidth: 515, + minHeight: 304, + webPreferences: { + nodeIntegration: true, + enableRemoteModule: true, + contextIsolation: false, + }, + }); + win.loadFile('index.html'); + win.removeMenu(); +} + +app.whenReady().then(() => { + createWindow(); + app.on('activate', () => { + if (BrowserWindow.getAllWindows().length === 0) { + createWindow(); + } + }) +}); + +app.on('window-all-closed', () => { + if (process.platform !== 'darwin') { + app.quit(); + } +}); diff --git a/pkgs/by-name/pv/pvzge/package.nix b/pkgs/by-name/pv/pvzge/package.nix new file mode 100644 index 000000000000..36280da99b38 --- /dev/null +++ b/pkgs/by-name/pv/pvzge/package.nix @@ -0,0 +1,105 @@ +{ + lib, + stdenvNoCC, + fetchurl, + fetchFromGitHub, + copyDesktopItems, + makeWrapper, + makeDesktopItem, + desktopToDarwinBundle, + electron, + imagemagick, + nix-update-script, +}: + +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "pvzge"; + version = "0.7.1"; + + src = fetchFromGitHub { + owner = "Gzh0821"; + repo = "pvzge_web"; + tag = "v${finalAttrs.version}"; + hash = "sha256-IZaJBbliudkVLOEgOwxXkUn9aET+NJrgdPi8FAA7HCE="; + }; + + iconSrc = fetchurl { + url = "https://raw.githubusercontent.com/Gzh0821/pvzg_site/refs/tags/${finalAttrs.version}/src/.vuepress/public/pvz_logo.webp"; + hash = "sha256-PkUS4iESw+R8o+tZMDJ+PTyu6PTmKeRkq/VG3+egsQY="; + meta.license = lib.licenses.unfree; + }; + + nativeBuildInputs = [ + copyDesktopItems + makeWrapper + imagemagick + ] + ++ lib.optional stdenvNoCC.hostPlatform.isDarwin [ desktopToDarwinBundle ]; + + postPatch = '' + sed -i "s|