1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl gnused gawk jq nix-prefetch
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"
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\"; };
25 sed -i "s#$1 = \"sha256-.\{44\}\"#$1 = \"$2\"#" "$NIX_DRV"
28 MULLVAD_VER
=$
(curl
-s https
://api.mullvad.net
/app
/v
1/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"