From 8a95ee87b63c709720cade322bce49d06ff6527b Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Tue, 29 Jun 2021 01:02:43 -0700 Subject: [PATCH] default.nix: Fix shell auto-complete generation --- default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index 26c4434..0e423cf 100644 --- a/default.nix +++ b/default.nix @@ -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