1{ stdenv, lib, fetchFromGitHub, rustPlatform, installShellFiles }:
2
3rustPlatform.buildRustPackage rec {
4 pname = "jrsonnet";
5 version = "0.4.2";
6
7 src = fetchFromGitHub {
8 rev = "v${version}";
9 owner = "CertainLach";
10 repo = "jrsonnet";
11 sha256 = "sha256-OX+iJJ3vdCsWWr8x31psV9Vne6xWDZnJc83NbJqMK1A=";
12 };
13
14 nativeBuildInputs = [ installShellFiles ];
15
16 postInstall = ''
17 ln -s $out/bin/jrsonnet $out/bin/jsonnet
18
19 for shell in bash zsh fish; do
20 installShellCompletion --cmd jrsonnet \
21 --$shell <($out/bin/jrsonnet --generate $shell /dev/null)
22 installShellCompletion --cmd jsonnet \
23 --$shell <($out/bin/jrsonnet --generate $shell /dev/null | sed s/jrsonnet/jsonnet/g)
24 done
25 '';
26
27 cargoSha256 = "sha256-eFfAU9Q3nYAJK+kKP1Y6ONjOIfkuYTlelrFrEW9IJ8c=";
28
29 meta = {
30 description = "Purely-functional configuration language that helps you define JSON data";
31 maintainers = with lib.maintainers; [ lach ];
32 license = lib.licenses.mit;
33 homepage = "https://github.com/CertainLach/jrsonnet";
34 };
35}