nixpkgs/pkgs/by-name/cu/cue/package.nix
2024-04-03 12:38:59 +00:00

55 lines
1.3 KiB
Nix

{ buildGoModule
, fetchFromGitHub
, lib
, installShellFiles
, testers
, cue
, callPackage
}:
buildGoModule rec {
pname = "cue";
version = "0.8.1";
src = fetchFromGitHub {
owner = "cue-lang";
repo = "cue";
rev = "v${version}";
hash = "sha256-0HNE7NzTdq1bXj9tBZvBQ3m6Q5iuyAMKMOz0kyOJi7w=";
};
vendorHash = "sha256-0OZtKIDdEnQLnSj109EpGvaZvMIy7gPAZ+weHzYKGSg=";
subPackages = [ "cmd/*" ];
nativeBuildInputs = [ installShellFiles ];
ldflags = [ "-s" "-w" "-X cuelang.org/go/cmd/cue/cmd.version=${version}" ];
postInstall = ''
installShellCompletion --cmd cue \
--bash <($out/bin/cue completion bash) \
--fish <($out/bin/cue completion fish) \
--zsh <($out/bin/cue completion zsh)
'';
passthru = {
writeCueValidator = callPackage ./validator.nix { };
tests = {
test-001-all-good = callPackage ./tests/001-all-good.nix { };
version = testers.testVersion {
package = cue;
command = "cue version";
};
};
};
meta = with lib; {
description = "A data constraint language which aims to simplify tasks involving defining and using data";
homepage = "https://cuelang.org/";
license = lib.licenses.asl20;
maintainers = with maintainers; [ aaronjheng ];
mainProgram = "cue";
};
}