summary refs log tree commit diff
path: root/pkgs/development/compilers/jrsonnet
diff options
context:
space:
mode:
authorTom Wieczorek <t.wieczorek@yieldlab.de>2021-10-08 11:26:48 +0200
committerTom Wieczorek <t.wieczorek@yieldlab.de>2021-10-08 11:26:48 +0200
commit568edc1d4f14b97903f4d00246a852469527250c (patch)
tree3e3bd5c8f6efd823b6fb2a5598acca0d29965ca9 /pkgs/development/compilers/jrsonnet
parentbe4d1ca79c85cf42b35a71e9138ff8e32153c408 (diff)
jrsonnet: install shell completions
Added the completions for bash, zsh and fish to postInstall, both for
jrsonnet and the jsonnet symlink.
Diffstat (limited to 'pkgs/development/compilers/jrsonnet')
-rw-r--r--pkgs/development/compilers/jrsonnet/default.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/pkgs/development/compilers/jrsonnet/default.nix b/pkgs/development/compilers/jrsonnet/default.nix
index 512e0aa0247b5..5f99fb10cee25 100644
--- a/pkgs/development/compilers/jrsonnet/default.nix
+++ b/pkgs/development/compilers/jrsonnet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchFromGitHub, rustPlatform }:
+{ stdenv, lib, fetchFromGitHub, rustPlatform, installShellFiles }:
 
 rustPlatform.buildRustPackage rec {
   pname = "jrsonnet";
@@ -11,8 +11,17 @@ rustPlatform.buildRustPackage rec {
     sha256 = "sha256-OX+iJJ3vdCsWWr8x31psV9Vne6xWDZnJc83NbJqMK1A=";
   };
 
+  nativeBuildInputs = [ installShellFiles ];
+
   postInstall = ''
     ln -s $out/bin/jrsonnet $out/bin/jsonnet
+
+    for shell in bash zsh fish; do
+      installShellCompletion --cmd jrsonnet \
+        --$shell <($out/bin/jrsonnet --generate $shell /dev/null)
+      installShellCompletion --cmd jsonnet \
+        --$shell <($out/bin/jrsonnet --generate $shell /dev/null | sed s/jrsonnet/jsonnet/g)
+    done
   '';
 
   cargoSha256 = "sha256-eFfAU9Q3nYAJK+kKP1Y6ONjOIfkuYTlelrFrEW9IJ8c=";