elvish: rewrite

This commit is contained in:
Anderson Torres 2023-03-21 23:16:39 -03:00
parent 4dc8a5c2dc
commit 6477d7f0ea

View file

@ -1,30 +1,42 @@
{ lib, buildGoModule, fetchFromGitHub, runCommand }:
{ lib
, buildGoModule
, fetchFromGitHub
, runCommand
}:
buildGoModule rec {
let
pname = "elvish";
version = "0.19.2";
subPackages = [ "cmd/elvish" ];
ldflags = [ "-s" "-w" "-X src.elv.sh/pkg/buildinfo.Version==${version}" ];
shellPath = "/bin/elvish";
in
buildGoModule {
inherit pname version;
src = fetchFromGitHub {
owner = "elves";
repo = pname;
repo = "elvish";
rev = "v${version}";
sha256 = "sha256-eCPJXCgmMvrJ2yVqYgXHXJWb6Ec0sutc91LNs4yRBYk=";
hash = "sha256-eCPJXCgmMvrJ2yVqYgXHXJWb6Ec0sutc91LNs4yRBYk=";
};
vendorSha256 = "sha256-VMI20IP1jVkUK3rJm35szaFDfZGEEingUEL/xfVJ1cc=";
vendorHash = "sha256-VMI20IP1jVkUK3rJm35szaFDfZGEEingUEL/xfVJ1cc=";
subPackages = [ "cmd/elvish" ];
ldflags = [
"-s"
"-w"
"-X src.elv.sh/pkg/buildinfo.Version==${version}"
];
strictDeps = true;
doCheck = false;
doCheck = false;
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out${passthru.shellPath} -c "
$out${shellPath} -c "
fn expect {|key expected|
var actual = \$buildinfo[\$key]
if (not-eq \$actual \$expected) {
@ -38,17 +50,19 @@ buildGoModule rec {
runHook postInstallCheck
'';
meta = with lib; {
passthru = {
inherit shellPath;
};
meta = {
homepage = "https://elv.sh/";
description = "A friendly and expressive command shell";
longDescription = ''
Elvish is a friendly interactive shell and an expressive programming
language. It runs on Linux, BSDs, macOS and Windows. Despite its pre-1.0
status, it is already suitable for most daily interactive use.
'';
homepage = "https://elv.sh/";
license = licenses.bsd2;
maintainers = with maintainers; [ vrthra AndersonTorres ];
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ vrthra AndersonTorres ];
};
passthru.shellPath = "/bin/elvish";
}