proton-vpn: init darwin version at 6.4.0

- Separated platform-specific configurations into dedicated files:
  - `linux.nix` for Linux-specific package declaration
  - `darwin.nix` for macOS-specific package declaration
  - `package.nix` as the main orchestrator
- Added `nix-update-script` to the Linux package
- Use `writableTmpDirAsHomeHook` in Linux package
This commit is contained in:
Thierry Delafontaine
2026-03-14 09:05:41 +01:00
parent 5a05e8011b
commit 4d82c9269e
3 changed files with 155 additions and 90 deletions
+46
View File
@@ -0,0 +1,46 @@
{
lib,
meta,
stdenvNoCC,
_7zz,
fetchurl,
nix-update-script,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "proton-vpn";
version = "6.4.0";
src = fetchurl {
url = "https://github.com/ProtonVPN/ios-mac-app/releases/download/mac%2F${finalAttrs.version}/ProtonVPN_mac_v${finalAttrs.version}.dmg";
hash = "sha256-F5NS7NNqxNJcl7gFaqWtWxBxBbV6Btp7cyyDpegEGLQ=";
};
sourceRoot = ".";
nativeBuildInputs = [ _7zz ];
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -R ./ProtonVPN/ProtonVPN.app $out/Applications
runHook postInstall
'';
passthru.updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"mac/(.*)"
];
};
meta = meta // {
changelog = "https://github.com/ProtonVPN/ios-mac-app/releases/tag/mac%2F${finalAttrs.version}";
platforms = [
"x86_64-darwin"
"aarch64-darwin"
];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})
+96
View File
@@ -0,0 +1,96 @@
{
lib,
meta,
python3Packages,
fetchFromGitHub,
gobject-introspection,
libappindicator-gtk3,
libayatana-appindicator,
libnotify,
wrapGAppsHook4,
writableTmpDirAsHomeHook,
nix-update-script,
withIndicator ? true,
}:
python3Packages.buildPythonApplication (finalAttrs: {
pname = "proton-vpn";
version = "4.15.0";
pyproject = true;
src = fetchFromGitHub {
owner = "ProtonVPN";
repo = "proton-vpn-gtk-app";
tag = "v${finalAttrs.version}";
hash = "sha256-bKUhrbfOLVjknljwW9UPo3Ros1Ayzb+be5KTUjPnIW0=";
};
nativeBuildInputs = [
# Needed for the NM namespace
gobject-introspection
wrapGAppsHook4
];
buildInputs = [
libnotify # gir typelib is used
]
++ lib.optionals withIndicator [
# Adds AppIndicator3 namespace
libappindicator-gtk3
# Adds AyatanaAppIndicator3 namespace
libayatana-appindicator
];
build-system = with python3Packages; [
setuptools
];
dependencies = with python3Packages; [
dbus-python
packaging
proton-core
proton-keyring-linux
proton-vpn-api-core
proton-vpn-local-agent
pycairo
pygobject3
];
dontWrapGApps = true;
preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';
postInstall = ''
mkdir -p $out/share/{applications,pixmaps}
# Fix the desktop file to correctly identify the wrapped app and show the icon during runtime
substitute ${finalAttrs.src}/rpmbuild/SOURCES/proton.vpn.app.gtk.desktop $out/share/applications/proton.vpn.app.gtk.desktop \
--replace-fail "StartupWMClass=protonvpn-app" "StartupWMClass=.protonvpn-app-wrapped"
install -Dm 644 ${finalAttrs.src}/rpmbuild/SOURCES/proton-vpn-logo.svg $out/share/pixmaps
'';
preCheck = ''
export XDG_RUNTIME_DIR=$(mktemp -d)
'';
nativeCheckInputs = [
writableTmpDirAsHomeHook
]
++ (with python3Packages; [
pytestCheckHook
pytest-cov-stub
]);
disabledTestPaths = [
# Segmentation fault during widgets tests
"tests/unit/widgets"
];
passthru.updateScript = nix-update-script { };
meta = meta // {
platforms = lib.platforms.linux;
mainProgram = "protonvpn-app";
};
})
+13 -90
View File
@@ -1,99 +1,22 @@
{
lib,
python3Packages,
fetchFromGitHub,
gobject-introspection,
libappindicator-gtk3,
libayatana-appindicator,
libnotify,
wrapGAppsHook4,
withIndicator ? true,
stdenv,
callPackage,
}:
python3Packages.buildPythonApplication (finalAttrs: {
pname = "proton-vpn";
version = "4.15.0";
pyproject = true;
src = fetchFromGitHub {
owner = "ProtonVPN";
repo = "proton-vpn-gtk-app";
tag = "v${finalAttrs.version}";
hash = "sha256-bKUhrbfOLVjknljwW9UPo3Ros1Ayzb+be5KTUjPnIW0=";
};
nativeBuildInputs = [
# Needed for the NM namespace
gobject-introspection
wrapGAppsHook4
];
buildInputs = [
libnotify # gir typelib is used
]
++ lib.optionals withIndicator [
# Adds AppIndicator3 namespace
libappindicator-gtk3
# Adds AyatanaAppIndicator3 namespace
libayatana-appindicator
];
build-system = with python3Packages; [
setuptools
];
dependencies = with python3Packages; [
dbus-python
packaging
proton-core
proton-keyring-linux
proton-vpn-api-core
proton-vpn-local-agent
pycairo
pygobject3
];
dontWrapGApps = true;
preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';
postInstall = ''
mkdir -p $out/share/{applications,pixmaps}
# Fix the desktop file to correctly identify the wrapped app and show the icon during runtime
substitute ${finalAttrs.src}/rpmbuild/SOURCES/proton.vpn.app.gtk.desktop $out/share/applications/proton.vpn.app.gtk.desktop \
--replace-fail "StartupWMClass=protonvpn-app" "StartupWMClass=.protonvpn-app-wrapped"
install -Dm 644 ${finalAttrs.src}/rpmbuild/SOURCES/proton-vpn-logo.svg $out/share/pixmaps
'';
preCheck = ''
# Needed for Permission denied: '/homeless-shelter'
export HOME=$(mktemp -d)
export XDG_RUNTIME_DIR=$(mktemp -d)
'';
nativeCheckInputs = with python3Packages; [
pytestCheckHook
pytest-cov-stub
];
disabledTestPaths = [
# Segmentation fault during widgets tests
"tests/unit/widgets"
];
let
meta = {
description = "Proton VPN GTK app for Linux";
homepage = "https://github.com/ProtonVPN/proton-vpn-gtk-app";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.linux;
mainProgram = "protonvpn-app";
description = "Official Proton VPN client";
homepage = "https://protonvpn.com/";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
anthonyroussel
sebtm
delafthi
rapiteanu
sebtm
];
};
})
in
if stdenv.hostPlatform.isDarwin then
callPackage ./darwin.nix { inherit meta; }
else
callPackage ./linux.nix { inherit meta; }