depot/pkgs/development/compilers/jrsonnet/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

46 lines
1.3 KiB
Nix

{ lib, rustPlatform, fetchFromGitHub, installShellFiles, stdenv }:
rustPlatform.buildRustPackage rec {
pname = "jrsonnet";
version = "0.4.2";
src = fetchFromGitHub {
rev = "v${version}";
owner = "CertainLach";
repo = "jrsonnet";
sha256 = "sha256-OX+iJJ3vdCsWWr8x31psV9Vne6xWDZnJc83NbJqMK1A=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"clap-3.0.0-beta.2" = "sha256-BaLzm2JZEicktfsCIXQipHtEKlEv2lBktfvHP58rjeM=";
};
};
nativeBuildInputs = [ installShellFiles ];
# skip flaky tests
checkFlags = [
"--skip=tests::native_ext"
];
postInstall = ''
ln -s $out/bin/jrsonnet $out/bin/jsonnet
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
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
'';
meta = with lib; {
description = "Purely-functional configuration language that helps you define JSON data";
homepage = "https://github.com/CertainLach/jrsonnet";
license = licenses.mit;
maintainers = with maintainers; [ figsoda lach ];
};
}