diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-09-18 14:24:35 -0300 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-09-19 00:02:22 -0300 |
commit | c3f4c7f54ce38f1bf69d2a557c4c37c036436073 (patch) | |
tree | e861bae240f40cd4d8595dadae2f4871e33a8e03 | |
parent | 88a627e01273c4301e3ab533a5e85fea51d5ecd9 (diff) |
elvish: refactor
- move installCheck to passthru.tests - migrate to by-name
-rw-r--r-- | pkgs/by-name/el/elvish/package.nix (renamed from pkgs/shells/elvish/default.nix) | 27 | ||||
-rw-r--r-- | pkgs/by-name/el/elvish/tests/expect-version.elv | 8 | ||||
-rw-r--r-- | pkgs/by-name/el/elvish/tests/expect-version.nix | 25 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
4 files changed, 39 insertions, 23 deletions
diff --git a/pkgs/shells/elvish/default.nix b/pkgs/by-name/el/elvish/package.nix index 1bd0c138c9c0d..0069dad4f0c69 100644 --- a/pkgs/shells/elvish/default.nix +++ b/pkgs/by-name/el/elvish/package.nix @@ -1,13 +1,12 @@ { lib , buildGoModule , fetchFromGitHub -, runCommand +, callPackage }: let pname = "elvish"; version = "0.19.2"; - shellPath = "/bin/elvish"; in buildGoModule { inherit pname version; @@ -32,26 +31,12 @@ buildGoModule { strictDeps = true; doCheck = false; - doInstallCheck = true; - installCheckPhase = '' - runHook preInstallCheck - - $out${shellPath} -c " - fn expect {|key expected| - var actual = \$buildinfo[\$key] - if (not-eq \$actual \$expected) { - fail '\$buildinfo['\$key']: expected '(to-string \$expected)', got '(to-string \$actual) - } - } - - expect version ${version} - " - - runHook postInstallCheck - ''; passthru = { - inherit shellPath; + shellPath = "/bin/elvish"; + tests = { + expectVersion = callPackage ./tests/expect-version.nix { }; + }; }; meta = { @@ -63,6 +48,6 @@ buildGoModule { status, it is already suitable for most daily interactive use. ''; license = lib.licenses.bsd2; - maintainers = with lib.maintainers; [ vrthra AndersonTorres ]; + maintainers = with lib.maintainers; [ AndersonTorres ]; }; } diff --git a/pkgs/by-name/el/elvish/tests/expect-version.elv b/pkgs/by-name/el/elvish/tests/expect-version.elv new file mode 100644 index 0000000000000..72f8c081f61bc --- /dev/null +++ b/pkgs/by-name/el/elvish/tests/expect-version.elv @@ -0,0 +1,8 @@ +fn expect {|key expected| + var actual = $buildinfo[$key] + if (not-eq $actual $expected) { + fail '$buildinfo['$key']: expected '(to-string $expected)', got '(to-string $actual) + } +} + +expect version @version@ diff --git a/pkgs/by-name/el/elvish/tests/expect-version.nix b/pkgs/by-name/el/elvish/tests/expect-version.nix new file mode 100644 index 0000000000000..406f2131199d3 --- /dev/null +++ b/pkgs/by-name/el/elvish/tests/expect-version.nix @@ -0,0 +1,25 @@ +{ lib +, stdenv +, elvish +, substituteAll +}: + +stdenv.mkDerivation { + pname = "elvish-simple-test"; + inherit (elvish) version; + + nativeBuildInputs = [ elvish ]; + + dontInstall = true; + + buildCommand = '' + elvish ${substituteAll { + src = ./expect-version.elv; + inherit (elvish) version; + }} + + touch $out + ''; + + meta.timeout = 10; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e86cbda962138..a2a8b29b5b7bf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3749,8 +3749,6 @@ with pkgs; sedutil = callPackage ../tools/security/sedutil { }; - elvish = callPackage ../shells/elvish { }; - emplace = callPackage ../tools/package-management/emplace { }; enchive = callPackage ../tools/security/enchive { }; |