2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
|
|
|
, openssl
|
2020-10-07 09:15:18 +00:00
|
|
|
, zlib
|
2021-08-08 23:34:03 +00:00
|
|
|
, zstd
|
2020-04-24 23:36:52 +00:00
|
|
|
, pkg-config
|
|
|
|
, python3
|
|
|
|
, xorg
|
2023-02-16 17:41:37 +00:00
|
|
|
, Libsystem
|
2020-04-24 23:36:52 +00:00
|
|
|
, AppKit
|
|
|
|
, Security
|
2021-05-20 23:08:51 +00:00
|
|
|
, nghttp2
|
|
|
|
, libgit2
|
2023-03-04 12:14:45 +00:00
|
|
|
, withDefaultFeatures ? true
|
|
|
|
, additionalFeatures ? (p: p)
|
2022-06-16 17:23:12 +00:00
|
|
|
, testers
|
|
|
|
, nushell
|
2022-12-28 21:21:41 +00:00
|
|
|
, nix-update-script
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
let
|
2024-07-01 15:47:52 +00:00
|
|
|
version = "0.95.0";
|
2023-07-15 17:15:38 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage {
|
|
|
|
pname = "nushell";
|
|
|
|
inherit version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-07-15 17:15:38 +00:00
|
|
|
owner = "nushell";
|
|
|
|
repo = "nushell";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = version;
|
2024-07-01 15:47:52 +00:00
|
|
|
hash = "sha256-NxdqQ5sWwDptX4jyQCkNX2pVCua5nN4v/VYHZ/Q1LpQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-07-01 15:47:52 +00:00
|
|
|
cargoHash = "sha256-PNZPljUDXqkyQicjwjaZsiSltxgO6I9/9VJDWKkvUFA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config ]
|
2023-03-04 12:14:45 +00:00
|
|
|
++ lib.optionals (withDefaultFeatures && stdenv.isLinux) [ python3 ]
|
2022-09-09 14:08:57 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ rustPlatform.bindgenHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
buildInputs = [ openssl zstd ]
|
2023-07-15 17:15:38 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ zlib Libsystem Security ]
|
2023-03-04 12:14:45 +00:00
|
|
|
++ lib.optionals (withDefaultFeatures && stdenv.isLinux) [ xorg.libX11 ]
|
|
|
|
++ lib.optionals (withDefaultFeatures && stdenv.isDarwin) [ AppKit nghttp2 libgit2 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
buildNoDefaultFeatures = !withDefaultFeatures;
|
|
|
|
buildFeatures = additionalFeatures [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
2024-07-01 15:47:52 +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
|
|
|
|
)
|
2020-07-18 16:06:22 +00:00
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
passthru = {
|
|
|
|
shellPath = "/bin/nu";
|
2022-06-16 17:23:12 +00:00
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = nushell;
|
|
|
|
};
|
2022-12-28 21:21:41 +00:00
|
|
|
updateScript = nix-update-script { };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Modern shell written in Rust";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://www.nushell.sh/";
|
|
|
|
license = licenses.mit;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = with maintainers; [ Br1ght0ne johntitor joaquintrinanes ];
|
2023-07-15 17:15:38 +00:00
|
|
|
mainProgram = "nu";
|
|
|
|
};
|
|
|
|
}
|