From 6477d7f0eae45ca9dffb04127616ec26b9ebaeb2 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Tue, 21 Mar 2023 23:16:39 -0300 Subject: [PATCH] elvish: rewrite --- pkgs/shells/elvish/default.nix | 48 ++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/pkgs/shells/elvish/default.nix b/pkgs/shells/elvish/default.nix index 38ab7cb8dcce..1bd0c138c9c0 100644 --- a/pkgs/shells/elvish/default.nix +++ b/pkgs/shells/elvish/default.nix @@ -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"; }