default.nix: Fix shell auto-complete generation

This commit is contained in:
Zhaofeng Li 2021-06-29 01:02:43 -07:00
parent ac67d87be5
commit 8a95ee87b6

View file

@ -2,6 +2,7 @@
pkgs ? import ./pkgs.nix,
}: let
lib = pkgs.lib;
stdenv = pkgs.stdenv;
rustPlatform = pkgs.rustPlatform;
in rustPlatform.buildRustPackage {
name = "colmena-dev";
@ -16,14 +17,12 @@ in rustPlatform.buildRustPackage {
};
cargoSha256 = "10h8bsy8hh36mvdgpnbw4vxnzkxyfw2vb4r1pn7fxfn0nklgakq7";
postBuild = ''
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
mkdir completions
for shell in bash fish zsh; do
cargo run --frozen -- gen-completions $shell > completions/$shell
$out/bin/colmena gen-completions $shell > completions/$shell
done
'';
postInstall = ''
mkdir -p "$out/share/"{bash-completion/completions,fish/vendor_completions.d,zsh/site-functions}
cp completions/bash $out/share/bash-completion/completions/colmena
cp completions/fish $out/share/fish/vendor_completions.d/colmena.fish