Merge pull request #238506 from Enzime/mullvad-aarch64

mullvad-vpn: support `aarch64-linux`

authored by

Weijia Wang and committed by
GitHub
d6477988 d61a701d

+57 -6
+20 -5
pkgs/applications/networking/mullvad-vpn/default.nix
··· 64 64 systemd 65 65 ]; 66 66 67 + version = "2023.4"; 68 + 69 + selectSystem = attrs: attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); 70 + 71 + platform = selectSystem { 72 + x86_64-linux = "amd64"; 73 + aarch64-linux = "arm64"; 74 + }; 75 + 76 + hash = selectSystem { 77 + x86_64-linux = "sha256-7NoifrX1/3pUJHTYK+2dVos/oFsKiYwyhCGi07SsEhM="; 78 + aarch64-linux = "sha256-e0lp+SpBUmtYBcJPvql8ALeCkVtneZ1Cd3IFMVX6R2Q="; 79 + }; 67 80 in 68 81 69 - stdenv.mkDerivation rec { 82 + stdenv.mkDerivation { 70 83 pname = "mullvad-vpn"; 71 - version = "2023.4"; 84 + inherit version; 72 85 73 86 src = fetchurl { 74 - url = "https://github.com/mullvad/mullvadvpn-app/releases/download/${version}/MullvadVPN-${version}_amd64.deb"; 75 - sha256 = "sha256-7NoifrX1/3pUJHTYK+2dVos/oFsKiYwyhCGi07SsEhM="; 87 + url = "https://github.com/mullvad/mullvadvpn-app/releases/download/${version}/MullvadVPN-${version}_${platform}.deb"; 88 + inherit hash; 76 89 }; 77 90 78 91 nativeBuildInputs = [ ··· 114 127 runHook postInstall 115 128 ''; 116 129 130 + passthru.updateScript = ./update.sh; 131 + 117 132 meta = with lib; { 118 133 homepage = "https://github.com/mullvad/mullvadvpn-app"; 119 134 description = "Client for Mullvad VPN"; 120 135 changelog = "https://github.com/mullvad/mullvadvpn-app/blob/${version}/CHANGELOG.md"; 121 136 sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 122 137 license = licenses.gpl3Only; 123 - platforms = [ "x86_64-linux" ]; 138 + platforms = [ "x86_64-linux" "aarch64-linux" ]; 124 139 maintainers = with maintainers; [ Br1ght0ne ymarkus ataraxiasjel ]; 125 140 }; 126 141
+36
pkgs/applications/networking/mullvad-vpn/update.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p curl gnused gawk jq nix-prefetch 3 + 4 + set -euo pipefail 5 + 6 + ROOT="$(dirname "$(readlink -f "$0")")" 7 + NIX_DRV="$ROOT/default.nix" 8 + if [ ! -f "$NIX_DRV" ]; then 9 + echo "ERROR: cannot find default.nix in $ROOT" 10 + exit 1 11 + fi 12 + 13 + fetch_arch() { 14 + VER="$1"; ARCH="$2" 15 + URL="https://github.com/mullvad/mullvadvpn-app/releases/download/${VER}/MullvadVPN-${VER}_${ARCH}.deb" 16 + nix-prefetch "{ stdenv, fetchzip }: 17 + stdenv.mkDerivation rec { 18 + pname = \"mullvad-vpn\"; version = \"${VER}\"; 19 + src = fetchurl { url = \"$URL\"; }; 20 + } 21 + " 22 + } 23 + 24 + replace_sha() { 25 + sed -i "s#$1 = \"sha256-.\{44\}\"#$1 = \"$2\"#" "$NIX_DRV" 26 + } 27 + 28 + MULLVAD_VER=$(curl -s https://api.mullvad.net/app/v1/releases/linux/2022.5 | jq -r '.latest_stable') 29 + 30 + MULLVAD_LINUX_X64_SHA256=$(fetch_arch "$MULLVAD_VER" "amd64") 31 + MULLVAD_LINUX_AARCH64_SHA256=$(fetch_arch "$MULLVAD_VER" "arm64") 32 + 33 + sed -i "s/version = \".*\"/version = \"$MULLVAD_VER\"/" "$NIX_DRV" 34 + 35 + replace_sha "x86_64-linux" "$MULLVAD_LINUX_X64_SHA256" 36 + replace_sha "aarch64-linux" "$MULLVAD_LINUX_AARCH64_SHA256"
+1 -1
pkgs/development/compilers/fasmg/default.nix
··· 32 32 bin = "source/macos/fasmg"; 33 33 asm = "source/macos/fasmg.asm"; 34 34 }; 35 - }.${system} or (throw "Unsopported system: ${system}"); 35 + }.${system} or (throw "Unsupported system: ${system}"); 36 36 37 37 in '' 38 38 chmod +x ${path.bin}