nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 buildGoModule,
3 fetchFromGitHub,
4 lib,
5 stdenv,
6 installShellFiles,
7 testers,
8 callPackage,
9}:
10
11buildGoModule (finalAttrs: {
12 pname = "cue";
13 version = "0.15.4";
14
15 src = fetchFromGitHub {
16 owner = "cue-lang";
17 repo = "cue";
18 tag = "v${finalAttrs.version}";
19 hash = "sha256-5qu+CilTLYdTCfW15ifGIhr/fVH7NshrFxecwED1hkQ=";
20 };
21
22 vendorHash = "sha256-ivFw62+pg503EEpRsdGSQrFNah87RTUrRXUSPZMFLG4=";
23
24 subPackages = [ "cmd/*" ];
25
26 nativeBuildInputs = [ installShellFiles ];
27
28 ldflags = [
29 "-s"
30 "-w"
31 "-X cuelang.org/go/cmd/cue/cmd.version=v${finalAttrs.version}"
32 ];
33
34 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
35 installShellCompletion --cmd cue \
36 --bash <($out/bin/cue completion bash) \
37 --fish <($out/bin/cue completion fish) \
38 --zsh <($out/bin/cue completion zsh)
39 '';
40
41 passthru = {
42 writeCueValidator = callPackage ./validator.nix { };
43 tests = {
44 test-001-all-good = callPackage ./tests/001-all-good.nix { };
45 version = testers.testVersion {
46 package = finalAttrs.finalPackage;
47 command = "cue version";
48 version = "v${finalAttrs.version}";
49 };
50 };
51 };
52
53 meta = {
54 description = "Data constraint language which aims to simplify tasks involving defining and using data";
55 homepage = "https://cuelang.org/";
56 license = lib.licenses.asl20;
57 maintainers = with lib.maintainers; [ aaronjheng ];
58 mainProgram = "cue";
59 };
60})