From 90d9ce0e26a39d72be0789fb01d788abc41f7071 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 29 Mar 2024 15:03:54 -0300 Subject: [PATCH 1/3] cue: internalize writeCueValidator via passthru A small step to by-name migration. --- pkgs/development/tools/cue/default.nix | 12 +++++++++--- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/cue/default.nix b/pkgs/development/tools/cue/default.nix index ee9af03bb888..fd82fc9df869 100644 --- a/pkgs/development/tools/cue/default.nix +++ b/pkgs/development/tools/cue/default.nix @@ -4,6 +4,7 @@ , installShellFiles , testers , cue +, callPackage }: buildGoModule rec { @@ -38,9 +39,14 @@ buildGoModule rec { $out/bin/cue eval - <<<'a: "all good"' > /dev/null ''; - passthru.tests.version = testers.testVersion { - package = cue; - command = "cue version"; + passthru = { + writeCueValidator = callPackage ./validator.nix { }; + tests = { + version = testers.testVersion { + package = cue; + command = "cue version"; + }; + }; }; meta = with lib; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 039950c8bc9e..fa0a34e2ab76 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3680,7 +3680,7 @@ with pkgs; cue = callPackage ../development/tools/cue { }; - writeCueValidator = callPackage ../development/tools/cue/validator.nix { }; + inherit (cue) writeCueValidator; cuelsp = callPackage ../development/tools/cuelsp { }; From 1861d88ec84e9a918480ec36eedaaa789fa3b964 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 29 Mar 2024 15:43:10 -0300 Subject: [PATCH 2/3] cue: move custom installCheckPhase to passthru.tests As recommended by the Nixpkgs documentation, custom tests are better served by passthru.tests, whilst installCheckPhase is recommended for tests that come from the upstream. --- pkgs/development/tools/cue/default.nix | 7 +------ pkgs/development/tools/cue/tests/001-all-good.nix | 11 +++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 pkgs/development/tools/cue/tests/001-all-good.nix diff --git a/pkgs/development/tools/cue/default.nix b/pkgs/development/tools/cue/default.nix index fd82fc9df869..6f86bd745a24 100644 --- a/pkgs/development/tools/cue/default.nix +++ b/pkgs/development/tools/cue/default.nix @@ -27,21 +27,16 @@ buildGoModule rec { 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 = { writeCueValidator = callPackage ./validator.nix { }; tests = { + test-001-all-good = callPackage ./tests/001-all-good.nix { }; version = testers.testVersion { package = cue; command = "cue version"; diff --git a/pkgs/development/tools/cue/tests/001-all-good.nix b/pkgs/development/tools/cue/tests/001-all-good.nix new file mode 100644 index 000000000000..d9919cd7fee4 --- /dev/null +++ b/pkgs/development/tools/cue/tests/001-all-good.nix @@ -0,0 +1,11 @@ +{ lib +, cue +, runCommand +}: + +runCommand "cue-test-001-all-good-${cue.version}" { + nativeBuildInputs = [ cue ]; + meta.timeout = 10; +} '' + cue eval - <<<'a: "all good"' > $out + '' From 4653fbade9b5b242da3deedf9430f2c40685709a Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 29 Mar 2024 15:49:50 -0300 Subject: [PATCH 3/3] cue: migrate to by-name --- .../tools/cue/default.nix => by-name/cu/cue/package.nix} | 0 .../tools => by-name/cu}/cue/tests/001-all-good.nix | 0 pkgs/{development/tools => by-name/cu}/cue/validator.nix | 0 pkgs/top-level/all-packages.nix | 2 -- 4 files changed, 2 deletions(-) rename pkgs/{development/tools/cue/default.nix => by-name/cu/cue/package.nix} (100%) rename pkgs/{development/tools => by-name/cu}/cue/tests/001-all-good.nix (100%) rename pkgs/{development/tools => by-name/cu}/cue/validator.nix (100%) diff --git a/pkgs/development/tools/cue/default.nix b/pkgs/by-name/cu/cue/package.nix similarity index 100% rename from pkgs/development/tools/cue/default.nix rename to pkgs/by-name/cu/cue/package.nix diff --git a/pkgs/development/tools/cue/tests/001-all-good.nix b/pkgs/by-name/cu/cue/tests/001-all-good.nix similarity index 100% rename from pkgs/development/tools/cue/tests/001-all-good.nix rename to pkgs/by-name/cu/cue/tests/001-all-good.nix diff --git a/pkgs/development/tools/cue/validator.nix b/pkgs/by-name/cu/cue/validator.nix similarity index 100% rename from pkgs/development/tools/cue/validator.nix rename to pkgs/by-name/cu/cue/validator.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fa0a34e2ab76..71b1e419aa93 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3678,8 +3678,6 @@ with pkgs; cudd = callPackage ../development/libraries/cudd { }; - cue = callPackage ../development/tools/cue { }; - inherit (cue) writeCueValidator; cuelsp = callPackage ../development/tools/cuelsp { };