{equicord, equibop}: init (#349863)

This commit is contained in:
Sefa Eyeoglu 2024-10-21 09:25:10 +02:00 committed by GitHub
commit 738406dda8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 249 additions and 0 deletions

View File

@ -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

View File

@ -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;
};
})

View File

@ -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)`;

View File

@ -0,0 +1,63 @@
{
fetchFromGitHub,
git,
lib,
nodejs,
pnpm_9,
stdenv,
buildWebExtension ? false,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "equicord";
version = "1.10.4"; # from package.json
src = fetchFromGitHub {
owner = "Equicord";
repo = "Equicord";
rev = "440b68ea82b6fd44bf5ec70b759a0207ee9f4ca7";
hash = "sha256-9GIw8g2HZ6/5Lb4gtDyuBqZWi5YK5Uz0lo+u+LrIZwI=";
};
pnpmDeps = pnpm_9.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-kGLF6uIr0xxlB5LaSqKiBKESbmWN7PzDErrCmiT6vXA=";
};
nativeBuildInputs = [
git
nodejs
pnpm_9.configHook
];
env = {
EQUICORD_REMOTE = "${finalAttrs.src.owner}/${finalAttrs.src.repo}";
EQUICORD_HASH = "${finalAttrs.src.rev}";
};
buildPhase = ''
runHook preBuild
pnpm run ${if buildWebExtension then "buildWeb" else "build"} \
-- --standalone --disable-updater
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist/${lib.optionalString buildWebExtension "chromium-unpacked/"} $out
runHook postInstall
'';
meta = {
description = "The other cutest Discord client mod";
homepage = "https://github.com/Equicord/Equicord";
license = lib.licenses.gpl3Only;
platforms = lib.platforms.linux;
maintainers = [
lib.maintainers.NotAShelf
];
};
})