amber-lang: generate bash completion

This commit is contained in:
aleksana
2025-03-09 19:11:22 +08:00
parent d937155429
commit 5ddda18983
+14 -4
View File
@@ -5,6 +5,8 @@
bc,
util-linux,
makeWrapper,
installShellFiles,
stdenv,
runCommand,
amber-lang,
nix-update-script,
@@ -29,7 +31,10 @@ rustPlatform.buildRustPackage rec {
--replace-fail 'Command::new("/usr/bin/env")' 'Command::new("env")'
'';
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [
makeWrapper
installShellFiles
];
nativeCheckInputs = [
bc
@@ -43,9 +48,14 @@ rustPlatform.buildRustPackage rec {
"--skip=tests::formatter::all_exist"
];
postInstall = ''
wrapProgram "$out/bin/amber" --prefix PATH : "${lib.makeBinPath [ bc ]}"
'';
postInstall =
''
wrapProgram "$out/bin/amber" --prefix PATH : "${lib.makeBinPath [ bc ]}"
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd amber \
--bash <($out/bin/amber completion)
'';
passthru = {
updateScript = nix-update-script { };