Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.03 63 lines 1.7 kB view raw
1{ stdenv 2, lib 3, fetchFromGitHub 4, rustPlatform 5, openssl 6, pkg-config 7, python3 8, xorg 9, libiconv 10, AppKit 11, Security 12, withStableFeatures ? true 13, withTestBinaries ? true 14}: 15 16rustPlatform.buildRustPackage rec { 17 pname = "nushell"; 18 version = "0.9.0"; 19 20 src = fetchFromGitHub { 21 owner = pname; 22 repo = pname; 23 rev = version; 24 sha256 = "0p1aykhkz5rixj6x0rskg77q31xw11mirvjhzp7n4nmbx3rfkagc"; 25 }; 26 27 cargoSha256 = "0143mm9cdswd1azpzzpbfc5x7dy3ryywvq44mwkd6h1027n5idap"; 28 29 nativeBuildInputs = [ pkg-config ] 30 ++ lib.optionals (withStableFeatures && stdenv.isLinux) [ python3 ]; 31 32 buildInputs = lib.optionals stdenv.isLinux [ openssl ] 33 ++ lib.optionals stdenv.isDarwin [ libiconv Security ] 34 ++ lib.optionals (withStableFeatures && stdenv.isLinux) [ xorg.libX11 ] 35 ++ lib.optionals (withStableFeatures && stdenv.isDarwin) [ AppKit ]; 36 37 cargoBuildFlags = lib.optional withStableFeatures "--features stable"; 38 39 cargoTestFlags = lib.optional withTestBinaries "--features test-bins"; 40 41 preCheck = '' 42 export HOME=$TMPDIR 43 ''; 44 45 checkPhase = '' 46 runHook preCheck 47 echo "Running cargo cargo test ${lib.strings.concatStringsSep " " cargoTestFlags} -- ''${checkFlags} ''${checkFlagsArray+''${checkFlagsArray[@]}}" 48 cargo test ${lib.strings.concatStringsSep " " cargoTestFlags} -- ''${checkFlags} ''${checkFlagsArray+"''${checkFlagsArray[@]}"} 49 runHook postCheck 50 ''; 51 52 meta = with lib; { 53 description = "A modern shell written in Rust"; 54 homepage = "https://www.nushell.sh/"; 55 license = licenses.mit; 56 maintainers = with maintainers; [ filalex77 marsam ]; 57 platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ]; 58 }; 59 60 passthru = { 61 shellPath = "/bin/nu"; 62 }; 63}