geph, gephgui-wry: support aarch64 and darwin
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
makeBinaryWrapper,
|
||||
@@ -34,7 +35,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
|
||||
cargoHash = "sha256-zFCq29vtsbwbo6JBRdX+CziKZVoxwpt6y3BYVlIqZfc=";
|
||||
|
||||
postPatch = ''
|
||||
postPatch = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
substituteInPlace binaries/geph5-client/src/vpn/*.sh \
|
||||
--replace-fail 'PATH=' 'PATH=${binPath}:'
|
||||
|
||||
@@ -43,6 +44,10 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
--replace-fail '/usr/bin/env ' '${lib.getExe' coreutils "env"} '
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
rm -rf "$out/lib"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeBinaryWrapper
|
||||
pkg-config
|
||||
@@ -61,7 +66,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
|
||||
buildFeatures = [
|
||||
"aws_lambda"
|
||||
"windivert"
|
||||
# "windivert" # Only on Windows
|
||||
];
|
||||
|
||||
checkFlags = [
|
||||
@@ -74,9 +79,14 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
"--skip=tests::test_blind_sign"
|
||||
"--skip=tests::test_generate_secret_key"
|
||||
"--skip=tests::ping_pong"
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
# Cannot connect to the internet within the macOS sandbox
|
||||
"--skip=tests::test_successful_ping"
|
||||
"--skip=tests::test_failed_ping"
|
||||
];
|
||||
|
||||
postFixup = ''
|
||||
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
for program in $out/bin/*; do
|
||||
wrapProgram "$program" --prefix PATH : ${binPath}
|
||||
done
|
||||
@@ -94,7 +104,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
homepage = "https://github.com/geph-official/geph5";
|
||||
changelog = "https://github.com/geph-official/geph5/releases/tag/geph5-client-v${finalAttrs.version}";
|
||||
mainProgram = "geph5-client";
|
||||
platforms = lib.platforms.unix;
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin; # VPN mode is not yet available on macOS.
|
||||
license = lib.licenses.mpl20;
|
||||
maintainers = with lib.maintainers; [
|
||||
penalty1083
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
rustPlatform,
|
||||
webkitgtk_4_1,
|
||||
pkg-config,
|
||||
openssl,
|
||||
buildNpmPackage,
|
||||
makeDesktopItem,
|
||||
fetchFromGitHub,
|
||||
@@ -12,7 +13,6 @@
|
||||
glib,
|
||||
copyDesktopItems,
|
||||
wrapGAppsHook4,
|
||||
nodejs_22,
|
||||
}:
|
||||
let
|
||||
pac-cmd = stdenv.mkDerivation {
|
||||
@@ -28,11 +28,18 @@ let
|
||||
|
||||
postPatch = ''
|
||||
rm binaries/*/pac
|
||||
substituteInPlace Makefile --replace-fail 'uname -p' 'uname -m'
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail 'uname -p' 'uname -m' \
|
||||
--replace-fail 'ifneq ($(filter arm%,$(UNAME_P)),)' 'ifneq ($(filter aarch64 arm%,$(UNAME_P)),)'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [ glib ];
|
||||
|
||||
preBuild = ''
|
||||
mkdir -p binaries/linux_arm
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
@@ -69,9 +76,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
sourceRoot = "${finalAttrs.src.name}/gephgui-wry/gephgui";
|
||||
npmDepsHash = "sha256-dGzmdvzKp/JHCgDf3NJb0oolgW4Y/spagzpeVpMF28w=";
|
||||
|
||||
# npm dependency install fails with nodejs_24: https://github.com/NixOS/nixpkgs/issues/474535
|
||||
nodejs = nodejs_22;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
@@ -88,27 +92,39 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
perl
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
copyDesktopItems
|
||||
wrapGAppsHook4
|
||||
];
|
||||
|
||||
buildInputs = [ webkitgtk_4_1 ];
|
||||
buildInputs =
|
||||
lib.optionals stdenv.hostPlatform.isLinux [ webkitgtk_4_1 ]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ openssl ];
|
||||
|
||||
preBuild = ''
|
||||
cp -r ${finalAttrs.gephgui}/ gephgui/dist/
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
install -m 444 -D gephgui/public/gephlogo.png $out/share/icons/hicolor/512x512/apps/geph.png
|
||||
'';
|
||||
postInstall =
|
||||
lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
install -m 444 -D gephgui/public/gephlogo.png $out/share/icons/hicolor/512x512/apps/geph.png
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
mkdir -p "$out/Applications"
|
||||
cp -a ../macos/template.app "$out/Applications/Geph.app"
|
||||
chmod -R u+w "$out/Applications/Geph.app"
|
||||
install -Dm755 "$out/bin/gephgui-wry" "$out/Applications/Geph.app/Contents/MacOS/bin/gephgui-wry"
|
||||
ln -s "$out/Applications/Geph.app/Contents/MacOS/entrypoint" "$out/bin/Geph"
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
gappsWrapperArgs+=(
|
||||
--suffix PATH : ${lib.makeBinPath [ pac-cmd ]}
|
||||
)
|
||||
'';
|
||||
|
||||
desktopItems = [
|
||||
desktopItems = lib.optionals stdenv.hostPlatform.isLinux [
|
||||
(makeDesktopItem {
|
||||
name = "Geph";
|
||||
desktopName = "Geph";
|
||||
@@ -133,8 +149,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
meta = {
|
||||
description = "Modular Internet censorship circumvention system designed specifically to deal with national filtering";
|
||||
homepage = "https://github.com/geph-official/gephgui-wry";
|
||||
mainProgram = "gephgui-wry";
|
||||
platforms = lib.platforms.linux;
|
||||
mainProgram = if stdenv.hostPlatform.isDarwin then "Geph" else "gephgui-wry";
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
license = lib.licenses.mpl20;
|
||||
maintainers = with lib.maintainers; [
|
||||
penalty1083
|
||||
|
||||
Reference in New Issue
Block a user