Skip to content

Commit

Permalink
elvish: rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersonTorres committed Mar 22, 2023
1 parent 4dc8a5c commit 6477d7f
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions pkgs/shells/elvish/default.nix
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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";
}

0 comments on commit 6477d7f

Please sign in to comment.