From 0b3f6d181b89fae6a7a5c97514244e05f7e45718 Mon Sep 17 00:00:00 2001 From: Fea Date: Tue, 17 Jun 2025 14:39:26 +0200 Subject: [PATCH] steel: Add shell completions --- pkgs/by-name/st/steel/package.nix | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/pkgs/by-name/st/steel/package.nix b/pkgs/by-name/st/steel/package.nix index 103eea30bb3b..b6c4f1f7c257 100644 --- a/pkgs/by-name/st/steel/package.nix +++ b/pkgs/by-name/st/steel/package.nix @@ -1,10 +1,12 @@ { lib, + stdenv, rustPlatform, fetchFromGitHub, curl, pkg-config, makeBinaryWrapper, + installShellFiles, libgit2, oniguruma, openssl, @@ -34,6 +36,7 @@ rustPlatform.buildRustPackage { makeBinaryWrapper pkg-config rustPlatform.bindgenHook + installShellFiles ]; buildInputs = [ @@ -68,19 +71,26 @@ rustPlatform.buildRustPackage { # Tests are disabled since they always fail when building with Nix doCheck = false; - postInstall = '' - mkdir -p $out/lib/steel + postInstall = + '' + mkdir -p $out/lib/steel - substituteInPlace cogs/installer/download.scm \ - --replace-fail '"cargo-steel-lib"' '"$out/bin/cargo-steel-lib"' + substituteInPlace cogs/installer/download.scm \ + --replace-fail '"cargo-steel-lib"' '"$out/bin/cargo-steel-lib"' - pushd cogs - $out/bin/steel install.scm - popd + pushd cogs + $out/bin/steel install.scm + popd - mv $out/lib/steel/bin/repl-connect $out/bin - rm -rf $out/lib/steel/bin - ''; + mv $out/lib/steel/bin/repl-connect $out/bin + rm -rf $out/lib/steel/bin + '' + + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd steel \ + --bash <($out/bin/steel completions bash) \ + --fish <($out/bin/steel completions fish) \ + --zsh <($out/bin/steel completions zsh) + ''; postFixup = '' wrapProgram $out/bin/steel --set-default STEEL_HOME "$out/lib/steel"