94427deb9d
GitOrigin-RevId: f91ee3065de91a3531329a674a45ddcb3467a650
79 lines
1.8 KiB
Nix
79 lines
1.8 KiB
Nix
{ stdenv
|
|
, lib
|
|
, fetchFromGitHub
|
|
, rustPlatform
|
|
, openssl
|
|
, zlib
|
|
, zstd
|
|
, pkg-config
|
|
, python3
|
|
, xorg
|
|
, libiconv
|
|
, Libsystem
|
|
, AppKit
|
|
, Security
|
|
, nghttp2
|
|
, libgit2
|
|
, doCheck ? true
|
|
, withDefaultFeatures ? true
|
|
, additionalFeatures ? (p: p)
|
|
, testers
|
|
, nushell
|
|
, nix-update-script
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage (
|
|
let
|
|
version = "0.80.0";
|
|
pname = "nushell";
|
|
in {
|
|
inherit version pname;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = pname;
|
|
repo = pname;
|
|
rev = version;
|
|
hash = "sha256-XPN2ziwQNOilYei9SQ+e8w7g90e7/qGXgU8Gb28c5Wc=";
|
|
};
|
|
|
|
cargoHash = "sha256-j3YYKEGB/fDQVQIsGx+/gjPQggtQ+7YcmGi1V7bJJqM=";
|
|
|
|
nativeBuildInputs = [ pkg-config ]
|
|
++ lib.optionals (withDefaultFeatures && stdenv.isLinux) [ python3 ]
|
|
++ lib.optionals stdenv.isDarwin [ rustPlatform.bindgenHook ];
|
|
|
|
buildInputs = [ openssl zstd ]
|
|
++ lib.optionals stdenv.isDarwin [ zlib libiconv Libsystem Security ]
|
|
++ lib.optionals (withDefaultFeatures && stdenv.isLinux) [ xorg.libX11 ]
|
|
++ lib.optionals (withDefaultFeatures && stdenv.isDarwin) [ AppKit nghttp2 libgit2 ];
|
|
|
|
buildFeatures = additionalFeatures [ (lib.optional withDefaultFeatures "default") ];
|
|
|
|
# TODO investigate why tests are broken on darwin
|
|
# failures show that tests try to write to paths
|
|
# outside of TMPDIR
|
|
doCheck = doCheck && !stdenv.isDarwin;
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
echo "Running cargo test"
|
|
HOME=$TMPDIR cargo test
|
|
runHook postCheck
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "A modern shell written in Rust";
|
|
homepage = "https://www.nushell.sh/";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ Br1ght0ne johntitor marsam ];
|
|
mainProgram = "nu";
|
|
};
|
|
|
|
passthru = {
|
|
shellPath = "/bin/nu";
|
|
tests.version = testers.testVersion {
|
|
package = nushell;
|
|
};
|
|
updateScript = nix-update-script { };
|
|
};
|
|
})
|