amnezia-vpn/amnezia-client

Packaging for NixOS

spl3g opened this issue · 7 comments

Desktop (please complete the following information):

  • OS: NixOS
  • Version 24.05

Additional context
I am trying to package amnezia-client for NixOS. But there's no cqtdeployer there so the build script wouldn't have worked.
I think i figured out the dependencies and i built the AmneziaVPN and AmneziaVPN-service binaries that kind of work but when i try to connect to the server i get this error:

2024-03-07 23:45:38 debug Amnezia "WireguardUtilsLinux" "Tunnel process encountered an error: QProcess::FailedToStart"
2024-03-07 23:45:38 debug Amnezia "WireguardUtilsLinux" "Unable to start tunnel process due to timeout"
2024-03-07 23:45:38 debug Amnezia "Daemon" "Interface creation failed."
2024-03-07 23:45:38 debug Amnezia "DaemonLocalServerConnection" "Failed to activate the interface"

There's my package so far:

{ stdenv
, lib
, fetchFromGitHub
, cmake
, pkg-config
, libsecret
, libgcrypt
, openssl
, openvpn
, tun2socks
, cloak
, shadowsocks-libev
, wireguard-go
, xray
, qtbase
, wrapQtAppsHook
, qtremoteobjects
, qtsvg
, qttools
, qt5compat
, qtkeychain
}:

stdenv.mkDerivation rec {
  pname = "amnezia-client";
  version = "4.4.0.0";
  
  src = fetchFromGitHub {
    repo = "${pname}";
    owner = "amnezia-vpn";

    rev = "${version}";
    sha256 = "0k0sjf1c8iqg9crq4sfzdg4cczaq5pbk5j2873yzsw88rps0awac";
    fetchSubmodules = true;
  };
  
  nativeBuildInputs = [
    cmake
    wrapQtAppsHook
    pkg-config
  ];

  buildInputs = [
    qtbase
    qtremoteobjects
    qtsvg
    qttools
    qt5compat
    qtkeychain
    libsecret
    libgcrypt
    openssl
    openvpn
    tun2socks
    cloak
    shadowsocks-libev
    wireguard-go
    xray
  ];

  installPhase = ''
  runHook preInstall
  make install
  mkdir $out/bin
  mkdir -p $out/usr/share/{pixmaps,applications}
  cp client/AmneziaVPN $out/bin/
  cp service/server/AmneziaVPN-service $out/bin/
  runHook postInstall
  '';
}

I am not very familiar with cmake, c++ and qt so i think i am doing something wrong.

I'll bump this issue, as I am NixOS user and going to try Amnezia, so the client is cruical for me. Maybe I'll also look into it.

There also is a possible OS integration issue, as there are two components of the error message: fail to start tunnel process (due to some error yet to explore), and interface creation fail (which is also something to explore i.e. through dmesg).

Hi!
Does AmneziaVPN-service has enough privileges to create tun devices in your package?
It's running with sudo privileges when installed by installer.