vscode: Update remote-ssh commit hash with updater

This commit is contained in:
Michael Hoang 2022-03-13 20:38:22 +11:00
parent b2ff7ceff2
commit fbf5e75aa2
2 changed files with 23 additions and 3 deletions

View File

@ -14,14 +14,34 @@ if [ ! -f "$ROOT/vscode.nix" ]; then
exit 1
fi
NIXPKGS_ROOT="$(git rev-parse --show-toplevel)"
if [ ! -f "$NIXPKGS_ROOT/nixos/tests/vscode-remote-ssh.nix" ]; then
echo "ERROR: cannot find nixos/tests/vscode-remote-ssh.nix"
exit 1
fi
# VSCode
VSCODE_VER=$(curl --fail --silent https://api.github.com/repos/Microsoft/vscode/releases/latest | jq --raw-output .tag_name)
sed -i "s/version = \".*\"/version = \"${VSCODE_VER}\"/" "$ROOT/vscode.nix"
TEMP_FOLDER=$(mktemp -d)
VSCODE_X64_LINUX_URL="https://update.code.visualstudio.com/${VSCODE_VER}/linux-x64/stable"
VSCODE_X64_LINUX_SHA256=$(nix-prefetch-url ${VSCODE_X64_LINUX_URL})
sed -i "s/x86_64-linux = \".\{52\}\"/x86_64-linux = \"${VSCODE_X64_LINUX_SHA256}\"/" "$ROOT/vscode.nix"
# Split output by newlines into Bash array
readarray -t VSCODE_X64_LINUX <<< $(nix-prefetch-url --print-path ${VSCODE_X64_LINUX_URL})
sed -i "s/x86_64-linux = \".\{52\}\"/x86_64-linux = \"${VSCODE_X64_LINUX[0]}\"/" "$ROOT/vscode.nix"
tar xf $VSCODE_X64_LINUX[1] -C $TEMP_FOLDER
VSCODE_COMMIT=$(jq --raw-output .commit $TEMP_FOLDER/VSCode-linux-x64/resources/app/product.json)
sed -i "s/rev = \".\{40\}\"/rev = \"${VSCODE_COMMIT}\"/" "$NIXPKGS_ROOT/nixos/tests/vscode-remote-ssh.nix"
SERVER_X64_LINUX_URL="https://update.code.visualstudio.com/commit:${VSCODE_COMMIT}/server-linux-x64/stable"
SERVER_X64_LINUX_SHA256=$(nix-prefetch-url ${SERVER_X64_LINUX_URL})
sed -i "s/sha256 = \".\{51,52\}\"/sha256 = \"${SERVER_X64_LINUX_SHA256}\"/" "$NIXPKGS_ROOT/nixos/tests/vscode-remote-ssh.nix"
VSCODE_X64_DARWIN_URL="https://update.code.visualstudio.com/${VSCODE_VER}/darwin/stable"
VSCODE_X64_DARWIN_SHA256=$(nix-prefetch-url ${VSCODE_X64_DARWIN_URL})

View File

@ -77,7 +77,7 @@ in
homepage = "https://code.visualstudio.com/";
downloadPage = "https://code.visualstudio.com/Updates";
license = licenses.unfree;
maintainers = with maintainers; [ eadwu synthetica maxeaubrey bobby285271 ];
maintainers = with maintainers; [ eadwu synthetica maxeaubrey bobby285271 Enzime ];
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" "armv7l-linux" ];
};
}