diff --git a/pkgs/by-name/eq/equibop/disable_update_checking.patch b/pkgs/by-name/eq/equibop/disable_update_checking.patch new file mode 100644 index 000000000000..6b2a9a4cb577 --- /dev/null +++ b/pkgs/by-name/eq/equibop/disable_update_checking.patch @@ -0,0 +1,16 @@ +diff --git i/src/main/index.ts w/src/main/index.ts +index 23ea0d6..1ef465f 100644 +--- i/src/main/index.ts ++++ w/src/main/index.ts +@@ -32,7 +32,9 @@ if (process.platform === "linux") { + if (IS_DEV) { + require("source-map-support").install(); + } else { +- autoUpdater.checkForUpdatesAndNotify(); ++ console.log("Update checking is disabled. Skipping..."); ++ // autoUpdater.checkForUpdatesAndNotify(); ++ + } + + // Make the Vencord files use our DATA_DIR + diff --git a/pkgs/by-name/eq/equibop/package.nix b/pkgs/by-name/eq/equibop/package.nix new file mode 100644 index 000000000000..dd5688115b09 --- /dev/null +++ b/pkgs/by-name/eq/equibop/package.nix @@ -0,0 +1,153 @@ +{ + lib, + stdenv, + fetchFromGitHub, + substituteAll, + makeWrapper, + makeDesktopItem, + copyDesktopItems, + equicord, + electron, + libicns, + pipewire, + libpulseaudio, + autoPatchelfHook, + pnpm_9, + nodejs, + nix-update-script, + withTTS ? true, + withMiddleClickScroll ? false, + # Enables the use of Equicord from nixpkgs instead of + # letting Equibop manage it's own version + withSystemEquicord ? false, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "equibop"; + version = "2.0.9"; + + src = fetchFromGitHub { + owner = "Equicord"; + repo = "Equibop"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-mK/zoW8Km6xlppxJnVbuas4yE1rpAOd9QnjETlxxnsE="; + }; + + pnpmDeps = pnpm_9.fetchDeps { + inherit (finalAttrs) + pname + version + src + patches + ; + hash = "sha256-TSdkHSZTbFf3Nq0QHDNTeUHmd6N+L1N1kSiKt0uNF6s="; + }; + + nativeBuildInputs = [ + nodejs + pnpm_9.configHook + # XXX: Equibop *does not* ship venmic as a prebuilt node module. The package + # seems to build with or without this hook, but I (NotAShelf) don't have the + # time to test the consequences of removing this hook. Please open a pull + # request if this bothers you in some way. + autoPatchelfHook + copyDesktopItems + # we use a script wrapper here for environment variable expansion at runtime + # https://github.com/NixOS/nixpkgs/issues/172583 + makeWrapper + ]; + + buildInputs = [ + libpulseaudio + pipewire + stdenv.cc.cc.lib + ]; + + patches = + [ ./disable_update_checking.patch ] + ++ lib.optional withSystemEquicord (substituteAll { + inherit equicord; + src = ./use_system_equicord.patch; + }); + + env = { + ELECTRON_SKIP_BINARY_DOWNLOAD = 1; + }; + + buildPhase = '' + runHook preBuild + + pnpm build + pnpm exec electron-builder \ + --dir \ + -c.asarUnpack="**/*.node" \ + -c.electronDist=${electron.dist} \ + -c.electronVersion=${electron.version} + + runHook postBuild + ''; + + postBuild = '' + pushd build + ${libicns}/bin/icns2png -x icon.icns + popd + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out/opt/Equibop + cp -r dist/*unpacked/resources $out/opt/Equibop/ + + for file in build/icon_*x32.png; do + file_suffix=''${file//build\/icon_} + install -Dm0644 $file $out/share/icons/hicolor/''${file_suffix//x32.png}/apps/equibop.png + done + + runHook postInstall + ''; + + postFixup = '' + makeWrapper ${electron}/bin/electron $out/bin/equibop \ + --add-flags $out/opt/Equibop/resources/app.asar \ + ${lib.optionalString withTTS "--add-flags \"--enable-speech-dispatcher\""} \ + ${lib.optionalString withMiddleClickScroll "--add-flags \"--enable-blink-features=MiddleClickAutoscroll\""} \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime}}" + ''; + + desktopItems = makeDesktopItem { + name = "equibop"; + desktopName = "Equibop"; + exec = "equibop %U"; + icon = "equibop"; + startupWMClass = "Equibop"; + genericName = "Internet Messenger"; + keywords = [ + "discord" + "equibop" + "electron" + "chat" + ]; + categories = [ + "Network" + "InstantMessaging" + "Chat" + ]; + }; + + passthru = { + inherit (finalAttrs) pnpmDeps; + updateScript = nix-update-script { }; + }; + + meta = { + description = "Custom Discord App aiming to give you better performance and improve linux support"; + homepage = "https://github.com/Equicord/Equibop"; + changelog = "https://github.com/Equicord/Equibop/releases/tag/${finalAttrs.src.rev}"; + license = lib.licenses.gpl3Only; + maintainers = [ + lib.maintainers.NotAShelf + ]; + mainProgram = "equibop"; + # I am not confident in my ability to support Darwin, please PR if this is important to you + platforms = lib.platforms.linux; + }; +}) diff --git a/pkgs/by-name/eq/equibop/use_system_equicord.patch b/pkgs/by-name/eq/equibop/use_system_equicord.patch new file mode 100644 index 000000000000..3321b72bb5e2 --- /dev/null +++ b/pkgs/by-name/eq/equibop/use_system_equicord.patch @@ -0,0 +1,17 @@ +diff --git i/src/main/constants.ts w/src/main/constants.ts +index afb171f..c6a014e 100644 +--- i/src/main/constants.ts ++++ w/src/main/constants.ts +@@ -47,10 +47,7 @@ export const VENCORD_THEMES_DIR = join(DATA_DIR, "themes"); + + // needs to be inline require because of circular dependency + // as otherwise "DATA_DIR" (which is used by ./settings) will be uninitialised +-export const VENCORD_DIR = (() => { +- const { State } = require("./settings") as typeof import("./settings"); +- return State.store.vencordDir ? join(State.store.vencordDir, "equibop") : join(SESSION_DATA_DIR, "equicord.asar"); +-})(); ++export const VENCORD_DIR = "@equicord@"; + + export const USER_AGENT = `Equibop/${app.getVersion()} (https://github.com/Equicord/Equibop)`; + +