connman-gtk: fix FTBFS with GCC-14 (incompatible pointer types) (#376077)
[NixPkgs.git] / pkgs / by-name / mu / mullvad-vpn / update.sh
blob97a6e2a448459b36f0654469b620cb1761fab24d
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl gnused gawk jq nix-prefetch
4 set -euo pipefail
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
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\"; };
24 replace_sha() {
25 sed -i "s#$1 = \"sha256-.\{44\}\"#$1 = \"$2\"#" "$NIX_DRV"
28 MULLVAD_VER=$(curl -s https://api.mullvad.net/app/v1/releases/linux/2022.5 | jq -r '.latest_stable')
30 MULLVAD_LINUX_X64_SHA256=$(fetch_arch "$MULLVAD_VER" "amd64")
31 MULLVAD_LINUX_AARCH64_SHA256=$(fetch_arch "$MULLVAD_VER" "arm64")
33 sed -i "s/version = \".*\"/version = \"$MULLVAD_VER\"/" "$NIX_DRV"
35 replace_sha "x86_64-linux" "$MULLVAD_LINUX_X64_SHA256"
36 replace_sha "aarch64-linux" "$MULLVAD_LINUX_AARCH64_SHA256"