From fd1ad8f08c919bea4b991689b85b27067ebcef70 Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:51:24 +0200 Subject: [PATCH 1/3] {update-vencord.sh,vencord.nix}: add update logic for `pnpmDeps.hash` --- update-vencord.sh | 63 +++++++++++++++++++++++++++++++++++++++++------ vencord.nix | 11 +++++---- 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/update-vencord.sh b/update-vencord.sh index b41ff14..5051dec 100755 --- a/update-vencord.sh +++ b/update-vencord.sh @@ -28,8 +28,6 @@ trap cleanup EXIT OWNER="Vendicated" REPO="Vencord" -echo "Updating $ABS_NIX_FILE for $OWNER/$REPO ($UPDATE_TYPE)..." - # Create a wrapper that calls the package with the appropriate unstable flag cat >temp-wrapper.nix < {} }: @@ -38,28 +36,77 @@ cat >temp-wrapper.nix </dev/null; then + echo "${type}pnpmDeps hash is already correct" + return 0 + fi + + echo "Current hash invalid. Calculating new pnpmDeps hash for ${type}..." + + local build_output + build_output=$(nix-build --pure \ + --expr "with import (builtins.getFlake \"nixpkgs\") {}; (callPackage ${ABS_NIX_FILE} { unstable = ${is_unstable}; }).pnpmDeps" \ + --no-link 2>&1 || true) + + local new_hash + new_hash=$(echo "$build_output" | grep -oP 'got:\s+sha256-\K[A-Za-z0-9+/]*=' || true) + + if [ -n "$new_hash" ]; then + update_hash "$type" "$new_hash" + echo "Updated ${type} pnpmDeps hash" + + if nix-build --pure \ + --expr "with import (builtins.getFlake \"nixpkgs\") {}; (callPackage ${ABS_NIX_FILE} { unstable = ${is_unstable}; }).pnpmDeps" \ + --no-link &>/dev/null; then + echo "Verification successful - new hash works" + return 0 + else + echo "Error: New hash verification failed" + return 1 + fi + else + echo "Failed to extract new pnpmDeps hash" + return 1 + fi +} + if [ "$UPDATE_TYPE" = "stable" ]; then # For stable versions, we're getting latest tag and update - echo "Fetching latest stable version..." + update_pnpm_deps "stable" if ! nix-update --version-regex 'v(.*)' \ --url "https://github.com/$OWNER/$REPO" \ --format \ -f ./temp-wrapper.nix \ --override-filename "$ABS_NIX_FILE" \ "${REPO}"; then - echo "Failed to update stable version" - exit 1 + echo "Failed to update stable version, updating pnpm deps..." fi else # For unstable versions, we're just using branch update - echo "Fetching latest unstable version..." + update_pnpm_deps "unstable" if ! nix-update --version=branch \ --url "https://github.com/$OWNER/$REPO" \ --format \ -f ./temp-wrapper.nix \ --override-filename "$ABS_NIX_FILE" \ "${REPO}"; then - echo "Failed to update unstable version" - exit 1 + echo "Failed to update unstable version, updating pnpm deps..." fi fi diff --git a/vencord.nix b/vencord.nix index b81d535..151fe80 100644 --- a/vencord.nix +++ b/vencord.nix @@ -17,11 +17,12 @@ let stableVersion = "1.10.9"; stableHash = "sha256-sU2eJUUw7crvzMGGBQP6rbxISkL+S5nmT3QspyYXlRQ="; + stablePnpmDeps = "sha256-vVzERis1W3QZB/i6SQR9dQR56yDWadKWvFr+nLTQY9Y="; - unstableVersion = "1.10.9-unstable-2025-01-10"; - unstableRev = "3243120baaa56f65866b532b731bc3426512c90e"; - unstableHash = "sha256-ov1qLtBzLAO8k9pokOstEaeS/me+ElVvGzyFTSfaZM0="; - + unstableVersion = "1.10.9-unstable-2025-01-09"; + unstableRev = "4ab297c9e3e1898f2d72bd6055a3ee94f2f4f416"; + unstableHash = "sha256-mDqHuWDGCCR9wF4g9PFBdQNgDFwmZAPuAnSczEL8mEA="; + unstablePnpmDeps = "sha256-ZUwtNtOmxjhOBpYB7vuytunGBRSuVxdlQsceRmeyhhI="; in stdenv.mkDerivation (finalAttrs: { pname = "vencord" + lib.optionalString unstable "-unstable"; @@ -36,7 +37,7 @@ stdenv.mkDerivation (finalAttrs: { pnpmDeps = pnpm.fetchDeps { inherit (finalAttrs) pname src; - hash = "sha256-ZUwtNtOmxjhOBpYB7vuytunGBRSuVxdlQsceRmeyhhI="; + hash = if unstable then unstablePnpmDeps else stablePnpmDeps; }; nativeBuildInputs = [ From afd2033ac4a124b98c4948815cd8c64dee001a93 Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:03:01 +0200 Subject: [PATCH 2/3] .gitignore: init --- .gitignore | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4121e1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,91 @@ +# Nix +.direnv +.envrc +outputs/ +result-* +result +repl-result-* +/*.log +temp-wrapper.nix + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### VisualStudioCode ### +.vscode/* + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide From a383eca0f0688ca75e90bf7fbb034f71c83e9ae3 Mon Sep 17 00:00:00 2001 From: DontEatOreo <57304299+DontEatOreo@users.noreply.github.com> Date: Fri, 10 Jan 2025 22:45:00 +0200 Subject: [PATCH 3/3] vencord-unstable: 4ab297c -> 3243120 --- vencord.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vencord.nix b/vencord.nix index 151fe80..0f0f37d 100644 --- a/vencord.nix +++ b/vencord.nix @@ -19,9 +19,9 @@ let stableHash = "sha256-sU2eJUUw7crvzMGGBQP6rbxISkL+S5nmT3QspyYXlRQ="; stablePnpmDeps = "sha256-vVzERis1W3QZB/i6SQR9dQR56yDWadKWvFr+nLTQY9Y="; - unstableVersion = "1.10.9-unstable-2025-01-09"; - unstableRev = "4ab297c9e3e1898f2d72bd6055a3ee94f2f4f416"; - unstableHash = "sha256-mDqHuWDGCCR9wF4g9PFBdQNgDFwmZAPuAnSczEL8mEA="; + unstableVersion = "1.10.9-unstable-2025-01-10"; + unstableRev = "3243120baaa56f65866b532b731bc3426512c90e"; + unstableHash = "sha256-ov1qLtBzLAO8k9pokOstEaeS/me+ElVvGzyFTSfaZM0="; unstablePnpmDeps = "sha256-ZUwtNtOmxjhOBpYB7vuytunGBRSuVxdlQsceRmeyhhI="; in stdenv.mkDerivation (finalAttrs: {