From 2d985f3fd132e9372147dc37a6c4e39ae31bbc00 Mon Sep 17 00:00:00 2001 From: mat ess Date: Wed, 27 Apr 2022 21:53:24 -0400 Subject: [PATCH] vscodium: Add support for aarch64-darwin (M1) --- .../editors/vscode/update-vscodium.sh | 28 +++++++++++-------- pkgs/applications/editors/vscode/vscodium.nix | 13 ++++----- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/pkgs/applications/editors/vscode/update-vscodium.sh b/pkgs/applications/editors/vscode/update-vscodium.sh index 377068c08214..c7d9c1068b14 100755 --- a/pkgs/applications/editors/vscode/update-vscodium.sh +++ b/pkgs/applications/editors/vscode/update-vscodium.sh @@ -14,23 +14,27 @@ if [ ! -f "$ROOT/vscodium.nix" ]; then exit 1 fi +update_vscodium () { + VSCODIUM_VER=$1 + ARCH=$2 + ARCH_LONG=$3 + ARCHIVE_FMT=$4 + VSCODIUM_URL="https://github.com/VSCodium/vscodium/releases/download/${VSCODIUM_VER}/VSCodium-${ARCH}-${VSCODIUM_VER}.${ARCHIVE_FMT}" + VSCODIUM_SHA256=$(nix-prefetch-url ${VSCODIUM_URL}) + sed -i "s/${ARCH_LONG} = \".\{52\}\"/${ARCH_LONG} = \"${VSCODIUM_SHA256}\"/" "$ROOT/vscodium.nix" +} + # VSCodium VSCODIUM_VER=$(curl -Ls -w %{url_effective} -o /dev/null https://github.com/VSCodium/vscodium/releases/latest | awk -F'/' '{print $NF}') sed -i "s/version = \".*\"/version = \"${VSCODIUM_VER}\"/" "$ROOT/vscodium.nix" -VSCODIUM_LINUX_X64_URL="https://github.com/VSCodium/vscodium/releases/download/${VSCODIUM_VER}/VSCodium-linux-x64-${VSCODIUM_VER}.tar.gz" -VSCODIUM_LINUX_X64_SHA256=$(nix-prefetch-url ${VSCODIUM_LINUX_X64_URL}) -sed -i "s/x86_64-linux = \".\{52\}\"/x86_64-linux = \"${VSCODIUM_LINUX_X64_SHA256}\"/" "$ROOT/vscodium.nix" +update_vscodium $VSCODIUM_VER linux-x64 x86_64-linux tar.gz -VSCODIUM_DARWIN_X64_URL="https://github.com/VSCodium/vscodium/releases/download/${VSCODIUM_VER}/VSCodium-darwin-x64-${VSCODIUM_VER}.zip" -VSCODIUM_DARWIN_X64_SHA256=$(nix-prefetch-url ${VSCODIUM_DARWIN_X64_URL}) -sed -i "s/x86_64-darwin = \".\{52\}\"/x86_64-darwin = \"${VSCODIUM_DARWIN_X64_SHA256}\"/" "$ROOT/vscodium.nix" +update_vscodium $VSCODIUM_VER darwin-x64 x86_64-darwin zip -VSCODIUM_LINUX_AARCH64_URL="https://github.com/VSCodium/vscodium/releases/download/${VSCODIUM_VER}/VSCodium-linux-arm64-${VSCODIUM_VER}.tar.gz" -VSCODIUM_LINUX_AARCH64_SHA256=$(nix-prefetch-url ${VSCODIUM_LINUX_AARCH64_URL}) -sed -i "s/aarch64-linux = \".\{52\}\"/aarch64-linux = \"${VSCODIUM_LINUX_AARCH64_SHA256}\"/" "$ROOT/vscodium.nix" +update_vscodium $VSCODIUM_VER linux-arm64 aarch64-linux tar.gz -VSCODIUM_LINUX_ARMV7L_URL="https://github.com/VSCodium/vscodium/releases/download/${VSCODIUM_VER}/VSCodium-linux-armhf-${VSCODIUM_VER}.tar.gz" -VSCODIUM_LINUX_ARMV7L_SHA256=$(nix-prefetch-url ${VSCODIUM_LINUX_ARMV7L_URL}) -sed -i "s/armv7l-linux = \".\{52\}\"/armv7l-linux = \"${VSCODIUM_LINUX_ARMV7L_SHA256}\"/" "$ROOT/vscodium.nix" +update_vscodium $VSCODIUM_VER darwin-arm64 aarch64-darwin zip + +update_vscodium $VSCODIUM_VER linux-armhf armv7l-linux tar.gz diff --git a/pkgs/applications/editors/vscode/vscodium.nix b/pkgs/applications/editors/vscode/vscodium.nix index 6f42778d31e2..41dfc3b11453 100644 --- a/pkgs/applications/editors/vscode/vscodium.nix +++ b/pkgs/applications/editors/vscode/vscodium.nix @@ -7,24 +7,21 @@ let x86_64-linux = "linux-x64"; x86_64-darwin = "darwin-x64"; aarch64-linux = "linux-arm64"; + aarch64-darwin = "darwin-arm64"; armv7l-linux = "linux-armhf"; }.${system}; - archive_fmt = if system == "x86_64-darwin" then "zip" else "tar.gz"; + archive_fmt = if stdenv.isDarwin then "zip" else "tar.gz"; sha256 = { x86_64-linux = "1i76ix318y6b2dcfnisg13bp5d7nzvcx7zcpl94mkrn974db30pn"; x86_64-darwin = "1qk1vykl838vwsffyjpazx7x9ajwxczpgz5vhch16iikfz2vh1vk"; aarch64-linux = "13jifiqn2v17d6vwacq6aib1lzyp2021kjdswkp7wpx6ck5lkm21"; + aarch64-darwin = "1jgmvw52hp2zfvk6z51yni4vn7wfq63gsih42mzadg5a1b2fr9rx"; armv7l-linux = "1zhriscsmfcsagsp2ds0fn316fybs5f2f2r3w5q29jwczgcnlam4"; }.${system}; - sourceRoot = { - x86_64-linux = "."; - x86_64-darwin = ""; - aarch64-linux = "."; - armv7l-linux = "."; - }.${system}; + sourceRoot = if stdenv.isDarwin then "" else "."; in callPackage ./generic.nix rec { inherit sourceRoot; @@ -63,6 +60,6 @@ in downloadPage = "https://github.com/VSCodium/vscodium/releases"; license = licenses.mit; maintainers = with maintainers; [ synthetica turion bobby285271 ]; - platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "armv7l-linux" ]; + platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" "armv7l-linux" ]; }; }