lol
1{ buildGoModule
2, fetchFromGitHub
3, fetchpatch
4, lib
5, installShellFiles
6, testers
7, cue
8}:
9
10buildGoModule rec {
11 pname = "cue";
12 version = "0.6.0";
13
14 src = fetchFromGitHub {
15 owner = "cue-lang";
16 repo = "cue";
17 rev = "v${version}";
18 hash = "sha256-1svWb83xbVZIlI9pviCYfQ6Kkp0QRjZwrauL7PPJLts=";
19 };
20
21 vendorHash = "sha256-ku4tPTXdnKau0kqnAAEHDdSF4oAC/6SDkTq8cECOiEk=";
22
23 patches = [
24 # Fix tests with go1.21. See https://github.com/cue-lang/cue/issues/2548.
25 (fetchpatch {
26 url = "https://github.com/cue-lang/cue/commit/3bf3dbd655284d3628399a83a703f4849b5f9374.patch";
27 hash = "sha256-9Zi2mrqB1JTFvadiqWTgzzi1pffZ3gOmTtrDDQWye1Q=";
28 })
29 ];
30
31 postPatch = ''
32 # Disable script tests
33 rm -f cmd/cue/cmd/script_test.go
34 '';
35
36 excludedPackages = [ "internal/ci/updatetxtar" "internal/cmd/embedpkg" "internal/cmd/qgo" "pkg/gen" ];
37
38 nativeBuildInputs = [ installShellFiles ];
39
40 ldflags = [ "-s" "-w" "-X cuelang.org/go/cmd/cue/cmd.version=${version}" ];
41
42 postInstall = ''
43 # Completions
44 installShellCompletion --cmd cue \
45 --bash <($out/bin/cue completion bash) \
46 --fish <($out/bin/cue completion fish) \
47 --zsh <($out/bin/cue completion zsh)
48 '';
49
50 doInstallCheck = true;
51 installCheckPhase = ''
52 $out/bin/cue eval - <<<'a: "all good"' > /dev/null
53 '';
54
55 passthru.tests.version = testers.testVersion {
56 package = cue;
57 command = "cue version";
58 };
59
60 meta = with lib; {
61 description = "A data constraint language which aims to simplify tasks involving defining and using data";
62 homepage = "https://cuelang.org/";
63 license = lib.licenses.asl20;
64 maintainers = with maintainers; [ aaronjheng ];
65 };
66}