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 22:34:58 +01: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 01:53:04 +01:00
, nghttp2
, libgit2
, withDefaultFeatures ? true
, additionalFeatures ? (p: p)
2022-05-26 16:12:31 +01:00
, testers
, nushell
2022-12-24 01:44:23 +00:00
, nix-update-script
2019-11-09 09:20:00 +00:00
}:
let
2024-10-21 00:19:46 +01:00
version = "0.99.1";
in
rustPlatform.buildRustPackage {
pname = "nushell";
inherit version;
2019-11-09 09:20:00 +00:00
src = fetchFromGitHub {
owner = "nushell";
repo = "nushell";
2024-10-21 00:19:46 +01:00
rev = "refs/tags/${version}";
hash = "sha256-amPQJW8ofSMh2cQQrqPNOp/p33KwPNX7fpZ4SiJGQHU=";
2019-11-09 09:20:00 +00:00
};
2024-10-21 00:19:46 +01:00
cargoHash = "sha256-AblXOeSJGqrZY5aRzdst9F+ZB++/3Adu7Kri5lDsDH8=";
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 22:34:58 +01: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 10:28:17 +01: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 16:12:31 +01: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 05:20:00 +01:00
maintainers = with maintainers; [ Br1ght0ne johntitor joaquintrinanes ];
mainProgram = "nu";
};
}