AppImage and polkit (Outline VPN client)

I’m trying to install Outline VPN Client on NixOs. For this I have downloaded Outline-Client.AppImage from here (for Linux) and have written the following derivation:

with import <nixpkgs> {};

let app = appimageTools.wrapType2 {
      name = "outline-client";
      src = ./Outline-Client.AppImage;
    };
in
  stdenv.mkDerivation {
    name =  "outline-to-scope";
    buildInputs = [ app ];
  }

(saved in file outline-client.nix and have Outline-Client.Appimage in the same folder). When I run

$ nix-shell outline-client.nix
$ outline-client

the outline client starts and I can add a key, but if I try to connect, it can’t with the following error in console:

command is running as root but failed:  Error: Unable to find pkexec or kdesudo. at e (/nix/store/f1..bx5-outline-client-extracted/resources/app.asar/build/electron/electron/index.js:2:408556) at /nix/store/f1..bx5-outline-client-extracted/resource
s/app.asar/build/electron/electron/index.js:2:408709

I have polkit enabled and pkexec command is /run/wrappers/bin/pkexec.
How can I install the Outline client properly?

Hi, I’ve tried to package outline-client, but it uses a weird bash script + systemd service + its own binary that crashes in NixOS, so do not wait for that app to be packaged(at least soon).
But there is a solution for connecting to outline without an official client. Add package tun2socks to your configuration and use bash script:

#!/usr/bin/env bash

device=$(echo $(ip route | grep default | sort -k5n | head -n1) | awk '{print $5}')

if [ -z "$(ip tuntap | grep tun0)" ]; then
  ip tuntap add mode tun dev tun0
  ip addr add 198.18.0.1/15 dev tun0
fi

if [ ! -z "$(pidof tun2socks)" ]; then
  kill $(pidof tun2socks)
  ip route del default via 198.18.0.1 dev tun0
  ip link set dev tun0 down
  ip6tables -P INPUT ACCEPT
  ip6tables -P FORWARD ACCEPT
  ip6tables -P OUTPUT ACCEPT
else
  ip link set dev tun0 up
  ip6tables -P INPUT DROP
  ip6tables -P FORWARD DROP
  ip6tables -P OUTPUT DROP
  ip route add default via 198.18.0.1 dev tun0 metric 50
  tun2socks -device tun0 -proxy <key> -interface $device &
fi

Replace with your outline key without /?outline=1 and call this script with sudo, pkexec or kdesudo

2 Likes

Thank you for you reply, hope it will help someone! I will not try it, because I’m using XRay now instead of Outline.