about summary refs log tree commit diff
path: root/pkgs/applications/networking/mullvad
diff options
context:
space:
mode:
authorlelgenio <lelgenio@disroot.org>2023-03-08 22:23:05 -0300
committerCole Helbling <cole.e.helbling@outlook.com>2023-03-09 07:24:04 -0800
commit130fa0baaa2b93ec45523fdcde942f6844ee9f6e (patch)
tree334977da567e5d31b3ff4063f2a6d09c30a49069 /pkgs/applications/networking/mullvad
parent8009798849bc1e8d3540b0dd38e3a3260257bd88 (diff)
mullvad: add shell completion
Diffstat (limited to 'pkgs/applications/networking/mullvad')
-rw-r--r--pkgs/applications/networking/mullvad/mullvad.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/applications/networking/mullvad/mullvad.nix b/pkgs/applications/networking/mullvad/mullvad.nix
index 0d62c3c7ce96c..f23ba1561a6c3 100644
--- a/pkgs/applications/networking/mullvad/mullvad.nix
+++ b/pkgs/applications/networking/mullvad/mullvad.nix
@@ -15,6 +15,7 @@
 , enableOpenvpn ? true
 , openvpn-mullvad
 , shadowsocks-rust
+, installShellFiles
 }:
 rustPlatform.buildRustPackage rec {
   pname = "mullvad";
@@ -44,6 +45,7 @@ rustPlatform.buildRustPackage rec {
     protobuf
     makeWrapper
     git
+    installShellFiles
   ];
 
   buildInputs = [
@@ -59,6 +61,17 @@ rustPlatform.buildRustPackage rec {
     ln -s ${libwg}/lib/libwg.a $dest
   '';
 
+  postInstall = ''
+    compdir=$(mktemp -d)
+    for shell in bash zsh fish; do
+      $out/bin/mullvad shell-completions $shell $compdir
+    done
+    installShellCompletion --cmd mullvad \
+      --bash $compdir/mullvad.bash \
+      --zsh $compdir/_mullvad \
+      --fish $compdir/mullvad.fish
+  '';
+
   postFixup =
     # Place all binaries in the 'mullvad-' namespace, even though these
     # specific binaries aren't used in the lifetime of the program.