1{ lib
2, buildGoModule
3, fetchFromGitHub
4, runCommand
5}:
6
7let
8 pname = "elvish";
9 version = "0.19.2";
10 shellPath = "/bin/elvish";
11in
12buildGoModule {
13 inherit pname version;
14
15 src = fetchFromGitHub {
16 owner = "elves";
17 repo = "elvish";
18 rev = "v${version}";
19 hash = "sha256-eCPJXCgmMvrJ2yVqYgXHXJWb6Ec0sutc91LNs4yRBYk=";
20 };
21
22 vendorHash = "sha256-VMI20IP1jVkUK3rJm35szaFDfZGEEingUEL/xfVJ1cc=";
23
24 subPackages = [ "cmd/elvish" ];
25
26 ldflags = [
27 "-s"
28 "-w"
29 "-X src.elv.sh/pkg/buildinfo.Version==${version}"
30 ];
31
32 strictDeps = true;
33
34 doCheck = false;
35 doInstallCheck = true;
36 installCheckPhase = ''
37 runHook preInstallCheck
38
39 $out${shellPath} -c "
40 fn expect {|key expected|
41 var actual = \$buildinfo[\$key]
42 if (not-eq \$actual \$expected) {
43 fail '\$buildinfo['\$key']: expected '(to-string \$expected)', got '(to-string \$actual)
44 }
45 }
46
47 expect version ${version}
48 "
49
50 runHook postInstallCheck
51 '';
52
53 passthru = {
54 inherit shellPath;
55 };
56
57 meta = {
58 homepage = "https://elv.sh/";
59 description = "A friendly and expressive command shell";
60 longDescription = ''
61 Elvish is a friendly interactive shell and an expressive programming
62 language. It runs on Linux, BSDs, macOS and Windows. Despite its pre-1.0
63 status, it is already suitable for most daily interactive use.
64 '';
65 license = lib.licenses.bsd2;
66 maintainers = with lib.maintainers; [ vrthra AndersonTorres ];
67 };
68}