mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
sing-box: install shell completions directly
This commit is contained in:
parent
828eac07e7
commit
dedb89c43d
1 changed files with 7 additions and 16 deletions
|
@ -1,10 +1,8 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
installShellFiles,
|
||||
buildPackages,
|
||||
coreutils,
|
||||
nix-update-script,
|
||||
nixosTests,
|
||||
|
@ -45,21 +43,14 @@ buildGoModule (finalAttrs: {
|
|||
"-X=github.com/sagernet/sing-box/constant.Version=${finalAttrs.version}"
|
||||
];
|
||||
|
||||
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 )
|
||||
postInstall = ''
|
||||
installShellCompletion release/completions/sing-box.{bash,fish,zsh}
|
||||
|
||||
substituteInPlace release/config/sing-box{,@}.service \
|
||||
--replace-fail "/usr/bin/sing-box" "$out/bin/sing-box" \
|
||||
--replace-fail "/bin/kill" "${coreutils}/bin/kill"
|
||||
install -Dm444 -t "$out/lib/systemd/system/" release/config/sing-box{,@}.service
|
||||
'';
|
||||
substituteInPlace release/config/sing-box{,@}.service \
|
||||
--replace-fail "/usr/bin/sing-box" "$out/bin/sing-box" \
|
||||
--replace-fail "/bin/kill" "${coreutils}/bin/kill"
|
||||
install -Dm444 -t "$out/lib/systemd/system/" release/config/sing-box{,@}.service
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue