nixpkgs/pkgs/shells/nushell/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

86 lines
2.3 KiB
Nix
Raw Normal View History

2019-11-09 09:20:00 +00:00
{ stdenv
2020-01-29 20:03:54 +00:00
, lib
2019-11-09 09:20:00 +00:00
, fetchFromGitHub
, rustPlatform
, openssl
, zlib
2021-08-06 21:34:58 +00:00
, zstd
2019-11-09 09:20:00 +00:00
, pkg-config
, python3
, xorg
2023-02-16 16:50:14 +00:00
, Libsystem
, AppKit
2019-11-09 09:20:00 +00:00
, Security
2021-05-08 00:53:04 +00:00
, nghttp2
, libgit2
, withDefaultFeatures ? true
, additionalFeatures ? (p: p)
2022-05-26 15:12:31 +00:00
, testers
, nushell
2022-12-24 01:44:23 +00:00
, nix-update-script
2019-11-09 09:20:00 +00:00
}:
let
2024-11-13 11:33:04 +00:00
version = "0.100.0";
in
rustPlatform.buildRustPackage {
pname = "nushell";
inherit version;
2019-11-09 09:20:00 +00:00
src = fetchFromGitHub {
owner = "nushell";
repo = "nushell";
2024-10-20 23:19:46 +00:00
rev = "refs/tags/${version}";
2024-11-13 11:33:04 +00:00
hash = "sha256-lbVvKpaG9HSm2W+NaVUuEOxTNUIf0iRATTVDKFPjqV4=";
2019-11-09 09:20:00 +00:00
};
2024-11-13 11:33:04 +00:00
cargoHash = "sha256-omC/qcpgy65Md1MC0QGUVCRVNl9sWlFcCRxdS4aeU+g=";
nativeBuildInputs = [ pkg-config ]
++ lib.optionals (withDefaultFeatures && stdenv.hostPlatform.isLinux) [ python3 ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ rustPlatform.bindgenHook ];
2019-11-09 09:20:00 +00:00
2021-08-06 21:34:58 +00:00
buildInputs = [ openssl zstd ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ zlib Libsystem Security ]
++ lib.optionals (withDefaultFeatures && stdenv.hostPlatform.isLinux) [ xorg.libX11 ]
++ lib.optionals (withDefaultFeatures && stdenv.hostPlatform.isDarwin) [ AppKit nghttp2 libgit2 ];
buildNoDefaultFeatures = !withDefaultFeatures;
buildFeatures = additionalFeatures [ ];
2020-01-29 20:03:54 +00:00
doCheck = ! stdenv.hostPlatform.isDarwin; # Skip checks on darwin. Failing tests since 0.96.0
checkPhase = ''
runHook preCheck
2024-06-26 09:28:17 +00:00
(
# The skipped tests all fail in the sandbox because in the nushell test playground,
# the tmp $HOME is not set, so nu falls back to looking up the passwd dir of the build
# user (/var/empty). The assertions however do respect the set $HOME.
set -x
HOME=$(mktemp -d) cargo test -j $NIX_BUILD_CORES --offline -- \
--test-threads=$NIX_BUILD_CORES \
--skip=repl::test_config_path::test_default_config_path \
--skip=repl::test_config_path::test_xdg_config_bad \
--skip=repl::test_config_path::test_xdg_config_empty
)
runHook postCheck
'';
2019-11-09 09:20:00 +00:00
passthru = {
shellPath = "/bin/nu";
2022-05-26 15:12:31 +00:00
tests.version = testers.testVersion {
package = nushell;
};
updateScript = nix-update-script { };
2019-11-09 09:20:00 +00:00
};
meta = with lib; {
description = "Modern shell written in Rust";
homepage = "https://www.nushell.sh/";
license = licenses.mit;
2024-04-24 04:20:00 +00:00
maintainers = with maintainers; [ Br1ght0ne johntitor joaquintrinanes ];
mainProgram = "nu";
};
}