98 current 2024-04-29 18:13:45 24.05.20240419.5c24cf2 6.6.28 *

This commit is contained in:
sadanslargehole 2024-04-29 18:13:55 -04:00
parent e59a29bba0
commit 8d86faab27
No known key found for this signature in database
GPG key ID: B2E2F4A5161A7800
10 changed files with 11560 additions and 7 deletions

View file

@ -67,11 +67,8 @@ jdk19
bitwarden
spotify
vscodium
(discord.override {
withVencord = true;
})
# cpkg.discord
# uns.vesktop
pulseaudioFull
cpkg.vesktop
kitty
rofi
go

View file

@ -1,5 +1,6 @@
{pkgs}:{
{pkgs}:rec{
# discord = nixpkgs.callPackage ./discord { };
discord = pkgs.callPackage ./discord/default.nix {};
vesktop = pkgs.callPackage ./vesktop/default.nix {};
vesktop = pkgs.callPackage ./vesktop/default.nix {inherit vencord;};
vencord = pkgs.callPackage ./vencord/default.nix {};
}

View file

@ -0,0 +1,65 @@
{ buildNpmPackage
, fetchFromGitHub
, lib
, esbuild
, buildWebExtension ? false
}:
let
version = "1.7.9";
gitHash = "97ce410";
in
buildNpmPackage rec {
pname = "vencord";
inherit version;
src = fetchFromGitHub {
owner = "Vendicated";
repo = "Vencord";
rev = "v${version}";
hash = "sha256-5kMBUdFupVxmlQ7NVJ7qzFoyQieDGHrFNkrzhlhEzJ0=";
};
ESBUILD_BINARY_PATH = lib.getExe (esbuild.overrideAttrs (final: _: {
version = "0.15.18";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${final.version}";
hash = "sha256-b9R1ML+pgRg9j2yrkQmBulPuLHYLUQvW+WTyR/Cq6zE=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
}));
# Supresses an error about esbuild's version.
npmRebuildFlags = [ "|| true" ];
makeCacheWritable = true;
npmDepsHash = "sha256-G3adLiSrEyAShTsNEaYLEPYACHoXTISiNp/9jru0mUc=";
npmFlags = [ "--legacy-peer-deps" ];
npmBuildScript = if buildWebExtension then "buildWeb" else "build";
npmBuildFlags = [ "--" "--standalone" "--disable-updater" ];
prePatch = ''
cp ${./package-lock.json} ./package-lock.json
chmod +w ./package-lock.json
'';
VENCORD_HASH = gitHash;
VENCORD_REMOTE = "${src.owner}/${src.repo}";
installPhase =
if buildWebExtension then ''
cp -r dist/chromium-unpacked/ $out
'' else ''
cp -r dist/ $out
'';
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "Vencord web extension";
homepage = "https://github.com/Vendicated/Vencord";
license = licenses.gpl3Only;
maintainers = with maintainers; [ FlafyDev fwam NotAShelf Scrumplex ];
};
}

5597
customPackages/vencord/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,65 @@
{ buildNpmPackage
, fetchFromGitHub
, lib
, esbuild
, buildWebExtension ? false
}:
let
version = "1.7.9";
gitHash = "d294128";
in
buildNpmPackage rec {
pname = "vencord";
inherit version;
src = fetchFromGitHub {
owner = "Vendicated";
repo = "Vencord";
rev = "v${version}";
hash = "sha256-5kMBUdFupVxmlQ7NVJ7qzFoyQieDGHrFNkrzhlhEzJ0=";
};
ESBUILD_BINARY_PATH = lib.getExe (esbuild.overrideAttrs (final: _: {
version = "0.15.18";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${final.version}";
hash = "sha256-b9R1ML+pgRg9j2yrkQmBulPuLHYLUQvW+WTyR/Cq6zE=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
}));
# Supresses an error about esbuild's version.
npmRebuildFlags = [ "|| true" ];
makeCacheWritable = true;
npmDepsHash = "sha256-G3adLiSrEyAShTsNEaYLEPYACHoXTISiNp/9jru0mUc=";
npmFlags = [ "--legacy-peer-deps" ];
npmBuildScript = if buildWebExtension then "buildWeb" else "build";
npmBuildFlags = [ "--" "--standalone" "--disable-updater" ];
prePatch = ''
cp ${./package-lock.json} ./package-lock.json
chmod +w ./package-lock.json
'';
VENCORD_HASH = gitHash;
VENCORD_REMOTE = "${src.owner}/${src.repo}";
installPhase =
if buildWebExtension then ''
cp -r dist/chromium-unpacked/ $out
'' else ''
cp -r dist/ $out
'';
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "Vencord web extension";
homepage = "https://github.com/Vendicated/Vencord";
license = licenses.gpl3Only;
maintainers = with maintainers; [ FlafyDev fwam NotAShelf Scrumplex ];
};
}

View file

@ -0,0 +1,24 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq common-updater-scripts prefetch-npm-deps nodejs
set -eou pipefail
pkgDir="$(dirname "$(readlink -f "$0")")"
tempDir=$(mktemp -d)
ghTags=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/Vendicated/Vencord/tags")
latestTag=$(echo "$ghTags" | jq -r .[0].name)
gitHash=$(echo "$ghTags" | jq -r .[0].commit.sha)
pushd "$tempDir"
curl "https://raw.githubusercontent.com/Vendicated/Vencord/$latestTag/package.json" -o package.json
npm install --legacy-peer-deps -f
npmDepsHash=$(prefetch-npm-deps ./package-lock.json)
popd
# update-source-version vencord "${latestTag#v}"
sed -E 's#\bgitHash = ".*?"#gitHash = "'"${gitHash:0:7}"'"#' -i "$pkgDir/package.nix"
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'"$npmDepsHash"'"#' -i "$pkgDir/package.nix"
cp "$tempDir/package-lock.json" "$pkgDir/package-lock.json"

View file

@ -0,0 +1,181 @@
{ lib
, stdenv
, stdenvNoCC
, gcc13Stdenv
, fetchFromGitHub
, fetchpatch
, substituteAll
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, vencord
, electron
, pipewire
, libpulseaudio
, libicns
, libnotify
, jq
, moreutils
, cacert
, nodePackages
, speechd
, withTTS ? true
}:
stdenv.mkDerivation (finalAttrs: {
pname = "vesktop";
version = "1.5.2-alpha.1";
src = fetchFromGitHub {
owner = "Vencord";
repo = "Vesktop";
rev = "v${finalAttrs.version}";
hash = "sha1-HGvzAE14x08Oqkjnw6zB3IMgcAk=";
};
# NOTE: This requires pnpm 8.10.0 or newer
# https://github.com/pnpm/pnpm/pull/7214
pnpmDeps =
assert lib.versionAtLeast nodePackages.pnpm.version "8.10.0";
stdenvNoCC.mkDerivation {
pname = "${finalAttrs.pname}-pnpm-deps";
inherit (finalAttrs) src version patches ELECTRON_SKIP_BINARY_DOWNLOAD;
nativeBuildInputs = [
jq
moreutils
nodePackages.pnpm
cacert
];
pnpmPatch = builtins.toJSON {
pnpm.supportedArchitectures = {
os = [ "linux" ];
cpu = [ "x64" "arm64" ];
};
};
postPatch = ''
mv package.json package.json.orig
jq --raw-output ". * $pnpmPatch" package.json.orig > package.json
'';
# https://github.com/NixOS/nixpkgs/blob/763e59ffedb5c25774387bf99bc725df5df82d10/pkgs/applications/misc/pot/default.nix#L56
installPhase = ''
export HOME=$(mktemp -d)
pnpm config set store-dir $out
pnpm install --frozen-lockfile --ignore-script
rm -rf $out/v3/tmp
for f in $(find $out -name "*.json"); do
sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
jq --sort-keys . $f | sponge $f
done
'';
dontBuild = true;
dontFixup = true;
outputHashMode = "recursive";
outputHash = "sha256-6ezEBeYmK5va3gCh00YnJzZ77V/Ql7A3l/+csohkz68=";
};
nativeBuildInputs = [
copyDesktopItems
nodePackages.pnpm
nodePackages.nodejs
makeWrapper
];
patches = [
(substituteAll { inherit vencord; src = ./use_system_vencord.patch; })
./disable_update_checking.patch
# (fetchpatch {
# name = "use-tsx-4.6.1.patch";
# url = "https://github.com/pluiedev/Vesktop/commit/5651f2674e90e21dc557733dcfcce9c9d316a10f.patch";
# hash = "sha256-Qs87MuRrc8Sx3Gctfb90QJW3JyGqW6wI0aqtyzsP1aQ=";
# })
];
ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
preBuild = ''
export HOME=$(mktemp -d)
export STORE_PATH=$(mktemp -d)
cp -Tr "$pnpmDeps" "$STORE_PATH"
chmod -R +w "$STORE_PATH"
pnpm config set store-dir "$STORE_PATH"
pnpm install --offline --frozen-lockfile --ignore-script
patchShebangs node_modules/{*,.*}
'';
postBuild = ''
pnpm build
# using `pnpm exec` here apparently makes it ignore ELECTRON_SKIP_BINARY_DOWNLOAD
./node_modules/.bin/electron-builder \
--dir \
-c.electronDist=${electron}/libexec/electron \
-c.electronVersion=${electron.version}
'';
# this is consistent with other nixpkgs electron packages and upstream, as far as I am aware
# yes, upstream really packages it as "vesktop" but uses "vencorddesktop" file names
installPhase =
let
# this is mainly required for venmic
libPath = lib.makeLibraryPath ([
libpulseaudio
libnotify
pipewire
gcc13Stdenv.cc.cc.lib
] ++ lib.optional withTTS speechd);
in
''
runHook preInstall
mkdir -p $out/opt/Vesktop/resources
cp dist/linux-*unpacked/resources/app.asar $out/opt/Vesktop/resources
pushd build
${libicns}/bin/icns2png -x icon.icns
for file in icon_*x32.png; do
file_suffix=''${file//icon_}
install -Dm0644 $file $out/share/icons/hicolor/''${file_suffix//x32.png}/apps/vencorddesktop.png
done
makeWrapper ${electron}/bin/electron $out/bin/vencorddesktop \
--prefix LD_LIBRARY_PATH : ${libPath} \
--add-flags $out/opt/Vesktop/resources/app.asar \
${lib.optionalString withTTS "--add-flags \"--enable-speech-dispatcher\""} \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
runHook postInstall
'';
desktopItems = [
(makeDesktopItem {
name = "vencorddesktop";
desktopName = "Vesktop";
exec = "vencorddesktop %U";
icon = "vencorddesktop";
startupWMClass = "VencordDesktop";
genericName = "Internet Messenger";
keywords = [ "discord" "vencord" "electron" "chat" ];
categories = [ "Network" "InstantMessaging" "Chat" ];
})
];
passthru = {
inherit (finalAttrs) pnpmDeps;
};
meta = with lib; {
description = "An alternate client for Discord with Vencord built-in";
homepage = "https://github.com/Vencord/Vesktop";
license = licenses.gpl3Only;
maintainers = with maintainers; [ getchoo Scrumplex vgskye pluiedev ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
mainProgram = "vencorddesktop";
};
})

View file

@ -0,0 +1,12 @@
diff --git a/src/updater/main.ts b/src/updater/main.ts
index 059afb9..274802e 100644
--- a/src/updater/main.ts
+++ b/src/updater/main.ts
@@ -77,6 +77,7 @@ function isOutdated(oldVersion: string, newVersion: string) {
}
export async function checkUpdates() {
+ return;
if (Settings.store.checkUpdates === false) return;
try {

View file

@ -0,0 +1,13 @@
diff --git a/src/main/constants.ts b/src/main/constants.ts
index d5c5fa6..a1b32f1 100644
--- a/src/main/constants.ts
+++ b/src/main/constants.ts
@@ -16,7 +16,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_FILES_DIR =
- (require("./settings") as typeof import("./settings")).Settings.store.vencordDir || join(DATA_DIR, "vencordDist");
+ (require("./settings") as typeof import("./settings")).Settings.store.vencordDir || "@vencord@";
export const USER_AGENT = `Vesktop/${app.getVersion()} (https://github.com/Vencord/Vesktop)`;