13 , enableOpenvpn ? true
20 # NOTE(cole-h): This is necessary because wireguard-go-rs executes go in its build.rs (whose goal
21 # is to produce $OUT_DIR/libwg.a), and a mixed Rust-Go build is non-trivial (read: I didn't want
22 # to attempt it). So, we just fake the "go" binary and do what it would have done: put libwg.a
23 # under $OUT_DIR so that it can be linked against.
24 fakeGoCopyLibwg = writeShellScriptBin "go" ''
25 [ ! -e "$OUT_DIR"/libwg.a ] && cp ${libwg}/lib/libwg.a "$OUT_DIR"/libwg.a
28 rustPlatform.buildRustPackage rec {
32 src = fetchFromGitHub {
34 repo = "mullvadvpn-app";
36 fetchSubmodules = true;
37 hash = "sha256-me0e8Cb1dRrnAeiCmsXiclcDMruVLV3t0eGAM3RU1es=";
41 lockFile = ./Cargo.lock;
43 "udp-over-tcp-0.3.0" = "sha256-5PeaM7/zhux1UdlaKpnQ2yIdmFy1n2weV/ux9lSRha4=";
47 checkFlags = "--skip=version_check";
66 for shell in bash zsh fish; do
67 $out/bin/mullvad shell-completions $shell $compdir
69 installShellCompletion --cmd mullvad \
70 --bash $compdir/mullvad.bash \
71 --zsh $compdir/_mullvad \
72 --fish $compdir/mullvad.fish
76 # Place all binaries in the 'mullvad-' namespace, even though these
77 # specific binaries aren't used in the lifetime of the program.
79 for bin in relay_list translations-converter tunnel-obfuscation; do
80 mv "$out/bin/$bin" "$out/bin/mullvad-$bin"
83 # Files necessary for OpenVPN tunnels to work.
84 lib.optionalString enableOpenvpn ''
85 mkdir -p $out/share/mullvad
86 cp dist-assets/ca.crt $out/share/mullvad
87 ln -s ${openvpn-mullvad}/bin/openvpn $out/share/mullvad
88 ln -s ${shadowsocks-rust}/bin/sslocal $out/share/mullvad
89 ln -s $out/lib/libtalpid_openvpn_plugin.so $out/share/mullvad
91 # Set the directory where Mullvad will look for its resources by default to
92 # `$out/share`, so that we can avoid putting the files in `$out/bin` --
93 # Mullvad defaults to looking inside the directory its binary is located in
96 wrapProgram $out/bin/mullvad-daemon \
97 --set-default MULLVAD_RESOURCE_DIR "$out/share/mullvad"
102 inherit openvpn-mullvad;
106 description = "Mullvad VPN command-line client tools";
107 homepage = "https://github.com/mullvad/mullvadvpn-app";
108 license = licenses.gpl3Only;
109 maintainers = with maintainers; [ cole-h ];