Skip to content

Commit 2634ef7

Browse files
committed
sing-box: install shell completions directly
1 parent a3d80d5 commit 2634ef7

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

pkgs/by-name/si/sing-box/package.nix

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
22
lib,
3-
stdenv,
43
buildGoModule,
54
fetchFromGitHub,
65
installShellFiles,
7-
buildPackages,
86
coreutils,
97
nix-update-script,
108
nixosTests,
@@ -45,21 +43,14 @@ buildGoModule (finalAttrs: {
4543
"-X=github.com/sagernet/sing-box/constant.Version=${finalAttrs.version}"
4644
];
4745

48-
postInstall =
49-
let
50-
emulator = stdenv.hostPlatform.emulator buildPackages;
51-
in
52-
''
53-
installShellCompletion --cmd sing-box \
54-
--bash <(${emulator} $out/bin/sing-box completion bash) \
55-
--fish <(${emulator} $out/bin/sing-box completion fish) \
56-
--zsh <(${emulator} $out/bin/sing-box completion zsh )
46+
postInstall = ''
47+
installShellCompletion release/completions/sing-box.{bash,fish,zsh}
5748
58-
substituteInPlace release/config/sing-box{,@}.service \
59-
--replace-fail "/usr/bin/sing-box" "$out/bin/sing-box" \
60-
--replace-fail "/bin/kill" "${coreutils}/bin/kill"
61-
install -Dm444 -t "$out/lib/systemd/system/" release/config/sing-box{,@}.service
62-
'';
49+
substituteInPlace release/config/sing-box{,@}.service \
50+
--replace-fail "/usr/bin/sing-box" "$out/bin/sing-box" \
51+
--replace-fail "/bin/kill" "${coreutils}/bin/kill"
52+
install -Dm444 -t "$out/lib/systemd/system/" release/config/sing-box{,@}.service
53+
'';
6354

6455
passthru = {
6556
updateScript = nix-update-script { };

0 commit comments

Comments
 (0)