mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-25 21:44:49 +00:00
Merge pull request #238506 from Enzime/mullvad-aarch64
mullvad-vpn: support `aarch64-linux`
This commit is contained in:
commit
d647798822
@ -64,15 +64,28 @@ let
|
||||
systemd
|
||||
];
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "mullvad-vpn";
|
||||
version = "2023.4";
|
||||
|
||||
selectSystem = attrs: attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
|
||||
platform = selectSystem {
|
||||
x86_64-linux = "amd64";
|
||||
aarch64-linux = "arm64";
|
||||
};
|
||||
|
||||
hash = selectSystem {
|
||||
x86_64-linux = "sha256-7NoifrX1/3pUJHTYK+2dVos/oFsKiYwyhCGi07SsEhM=";
|
||||
aarch64-linux = "sha256-e0lp+SpBUmtYBcJPvql8ALeCkVtneZ1Cd3IFMVX6R2Q=";
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "mullvad-vpn";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/mullvad/mullvadvpn-app/releases/download/${version}/MullvadVPN-${version}_amd64.deb";
|
||||
sha256 = "sha256-7NoifrX1/3pUJHTYK+2dVos/oFsKiYwyhCGi07SsEhM=";
|
||||
url = "https://github.com/mullvad/mullvadvpn-app/releases/download/${version}/MullvadVPN-${version}_${platform}.deb";
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
@ -114,13 +127,15 @@ stdenv.mkDerivation rec {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/mullvad/mullvadvpn-app";
|
||||
description = "Client for Mullvad VPN";
|
||||
changelog = "https://github.com/mullvad/mullvadvpn-app/blob/${version}/CHANGELOG.md";
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
license = licenses.gpl3Only;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
||||
maintainers = with maintainers; [ Br1ght0ne ymarkus ataraxiasjel ];
|
||||
};
|
||||
|
||||
|
36
pkgs/applications/networking/mullvad-vpn/update.sh
Executable file
36
pkgs/applications/networking/mullvad-vpn/update.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnused gawk jq nix-prefetch
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(dirname "$(readlink -f "$0")")"
|
||||
NIX_DRV="$ROOT/default.nix"
|
||||
if [ ! -f "$NIX_DRV" ]; then
|
||||
echo "ERROR: cannot find default.nix in $ROOT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fetch_arch() {
|
||||
VER="$1"; ARCH="$2"
|
||||
URL="https://github.com/mullvad/mullvadvpn-app/releases/download/${VER}/MullvadVPN-${VER}_${ARCH}.deb"
|
||||
nix-prefetch "{ stdenv, fetchzip }:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = \"mullvad-vpn\"; version = \"${VER}\";
|
||||
src = fetchurl { url = \"$URL\"; };
|
||||
}
|
||||
"
|
||||
}
|
||||
|
||||
replace_sha() {
|
||||
sed -i "s#$1 = \"sha256-.\{44\}\"#$1 = \"$2\"#" "$NIX_DRV"
|
||||
}
|
||||
|
||||
MULLVAD_VER=$(curl -s https://api.mullvad.net/app/v1/releases/linux/2022.5 | jq -r '.latest_stable')
|
||||
|
||||
MULLVAD_LINUX_X64_SHA256=$(fetch_arch "$MULLVAD_VER" "amd64")
|
||||
MULLVAD_LINUX_AARCH64_SHA256=$(fetch_arch "$MULLVAD_VER" "arm64")
|
||||
|
||||
sed -i "s/version = \".*\"/version = \"$MULLVAD_VER\"/" "$NIX_DRV"
|
||||
|
||||
replace_sha "x86_64-linux" "$MULLVAD_LINUX_X64_SHA256"
|
||||
replace_sha "aarch64-linux" "$MULLVAD_LINUX_AARCH64_SHA256"
|
@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
|
||||
bin = "source/macos/fasmg";
|
||||
asm = "source/macos/fasmg.asm";
|
||||
};
|
||||
}.${system} or (throw "Unsopported system: ${system}");
|
||||
}.${system} or (throw "Unsupported system: ${system}");
|
||||
|
||||
in ''
|
||||
chmod +x ${path.bin}
|
||||
|
Loading…
Reference in New Issue
Block a user