depot/third_party/nixpkgs/pkgs/shells/nushell/default.nix
Default email 686ce24904 Project import generated by Copybara.
GitOrigin-RevId: ac1f5b72a9e95873d1de0233fddcb56f99884b37
2023-02-16 18:41:37 +01:00

79 lines
1.8 KiB
Nix

{ stdenv
, lib
, fetchFromGitHub
, fetchpatch
, runCommand
, rustPlatform
, openssl
, zlib
, zstd
, pkg-config
, python3
, xorg
, libiconv
, Libsystem
, AppKit
, Security
, nghttp2
, libgit2
, withExtraFeatures ? true
, testers
, nushell
, nix-update-script
}:
rustPlatform.buildRustPackage rec {
pname = "nushell";
version = "0.75.0";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = version;
sha256 = "sha256-u8/SvuR/RpJaBX4Dr3Onrk0AVpIAeVb+399+NUpgkfI=";
};
cargoSha256 = "sha256-hnSumfZd9ylEx3dkTGW2s4VSv107MHOn21ytOcimhPw=";
# enable pkg-config feature of zstd
cargoPatches = [ ./zstd-pkg-config.patch ];
nativeBuildInputs = [ pkg-config ]
++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ python3 ]
++ lib.optionals stdenv.isDarwin [ rustPlatform.bindgenHook ];
buildInputs = [ openssl zstd ]
++ lib.optionals stdenv.isDarwin [ zlib libiconv Libsystem Security ]
++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ xorg.libX11 ]
++ lib.optionals (withExtraFeatures && stdenv.isDarwin) [ AppKit nghttp2 libgit2 ];
buildFeatures = lib.optional withExtraFeatures "extra";
# TODO investigate why tests are broken on darwin
# failures show that tests try to write to paths
# outside of TMPDIR
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 { };
};
}