Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.11 77 lines 1.7 kB view raw
1{ stdenv 2, lib 3, fetchFromGitHub 4, rustPlatform 5, openssl 6, zlib 7, zstd 8, pkg-config 9, python3 10, xorg 11, Libsystem 12, AppKit 13, Security 14, nghttp2 15, libgit2 16, doCheck ? true 17, withDefaultFeatures ? true 18, additionalFeatures ? (p: p) 19, testers 20, nushell 21, nix-update-script 22}: 23 24let 25 version = "0.87.0"; 26in 27 28rustPlatform.buildRustPackage { 29 pname = "nushell"; 30 inherit version; 31 32 src = fetchFromGitHub { 33 owner = "nushell"; 34 repo = "nushell"; 35 rev = version; 36 hash = "sha256-anIkIVRsJW2f2hj/Bz9lcw1vFoWhGHAE/XgIvnxbJg8="; 37 }; 38 39 cargoHash = "sha256-vwOAYigKItd2T/ze5H26cMfIssoAnt0XFQtfA8exLyM="; 40 41 nativeBuildInputs = [ pkg-config ] 42 ++ lib.optionals (withDefaultFeatures && stdenv.isLinux) [ python3 ] 43 ++ lib.optionals stdenv.isDarwin [ rustPlatform.bindgenHook ]; 44 45 buildInputs = [ openssl zstd ] 46 ++ lib.optionals stdenv.isDarwin [ zlib Libsystem Security ] 47 ++ lib.optionals (withDefaultFeatures && stdenv.isLinux) [ xorg.libX11 ] 48 ++ lib.optionals (withDefaultFeatures && stdenv.isDarwin) [ AppKit nghttp2 libgit2 ]; 49 50 buildNoDefaultFeatures = !withDefaultFeatures; 51 buildFeatures = additionalFeatures [ ]; 52 53 inherit doCheck; 54 55 checkPhase = '' 56 runHook preCheck 57 echo "Running cargo test" 58 HOME=$(mktemp -d) cargo test 59 runHook postCheck 60 ''; 61 62 passthru = { 63 shellPath = "/bin/nu"; 64 tests.version = testers.testVersion { 65 package = nushell; 66 }; 67 updateScript = nix-update-script { }; 68 }; 69 70 meta = with lib; { 71 description = "A modern shell written in Rust"; 72 homepage = "https://www.nushell.sh/"; 73 license = licenses.mit; 74 maintainers = with maintainers; [ Br1ght0ne johntitor marsam ]; 75 mainProgram = "nu"; 76 }; 77}