3
0
Fork 0
forked from mirrors/nixpkgs

vscodium: Add support for aarch64-darwin (M1)

This commit is contained in:
mat ess 2022-04-27 21:53:24 -04:00
parent 2627bb20f9
commit 2d985f3fd1
2 changed files with 21 additions and 20 deletions

View file

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

View file

@ -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" ];
};
}