elvish: refactor
- move installCheck to passthru.tests - migrate to by-name
This commit is contained in:
parent
88a627e012
commit
c3f4c7f54c
4 changed files with 39 additions and 23 deletions
|
@ -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 ];
|
||||
};
|
||||
}
|
8
pkgs/by-name/el/elvish/tests/expect-version.elv
Normal file
8
pkgs/by-name/el/elvish/tests/expect-version.elv
Normal file
|
@ -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@
|
25
pkgs/by-name/el/elvish/tests/expect-version.nix
Normal file
25
pkgs/by-name/el/elvish/tests/expect-version.nix
Normal file
|
@ -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;
|
||||
}
|
|
@ -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 { };
|
||||
|
|
Loading…
Reference in a new issue