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