sing-box: install shell completions

This commit is contained in:
Nick Cao 2022-12-28 17:39:42 +08:00
parent b851cbd5b2
commit 433a78bcdb
No known key found for this signature in database

View File

@ -1,6 +1,9 @@
{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, installShellFiles
, buildPackages
}:
buildGoModule rec {
@ -33,6 +36,15 @@ buildGoModule rec {
"cmd/sing-box"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in ''
installShellCompletion --cmd sing-box \
--bash <(${emulator} $out/bin/sing-box completion bash) \
--fish <(${emulator} $out/bin/sing-box completion fish) \
--zsh <(${emulator} $out/bin/sing-box completion zsh )
'';
meta = with lib;{
homepage = "https://sing-box.sagernet.org";
description = "The universal proxy platform";