nixpkgs-suyu/pkgs/development/tools/cue/default.nix
stuebinm ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00

53 lines
1.2 KiB
Nix

{ buildGoModule
, fetchFromGitHub
, lib
, installShellFiles
, testers
, cue
}:
buildGoModule rec {
pname = "cue";
version = "0.7.1";
src = fetchFromGitHub {
owner = "cue-lang";
repo = "cue";
rev = "v${version}";
hash = "sha256-x8DXAKrkqrZE6mxkIfjMhxZBnFbQnqWhmrvjrFjnQuc=";
};
vendorHash = "sha256-Eq51sydt2eu3pSCRjepvxpU01T0vr0axx9XEk34db28=";
subPackages = [ "cmd/cue" ];
nativeBuildInputs = [ installShellFiles ];
ldflags = [ "-s" "-w" "-X cuelang.org/go/cmd/cue/cmd.version=${version}" ];
postInstall = ''
# Completions
installShellCompletion --cmd cue \
--bash <($out/bin/cue completion bash) \
--fish <($out/bin/cue completion fish) \
--zsh <($out/bin/cue completion zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
$out/bin/cue eval - <<<'a: "all good"' > /dev/null
'';
passthru.tests.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";
mainProgram = "cue";
homepage = "https://cuelang.org/";
license = lib.licenses.asl20;
maintainers = with maintainers; [ aaronjheng ];
};
}