Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 56 lines 1.4 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 dtc, 6 pkgsCross, 7}: 8 9stdenv.mkDerivation { 10 pname = "spike"; 11 version = "1.1.0-unstable-2024-09-21"; 12 13 src = fetchFromGitHub { 14 owner = "riscv"; 15 repo = "riscv-isa-sim"; 16 rev = "de5094a1a901d77ff44f89b38e00fefa15d4018e"; 17 sha256 = "sha256-mAgR2VzDgeuIdmPEgrb+MaA89BnWfmNanOVidqn0cgc="; 18 }; 19 20 nativeBuildInputs = [ dtc ]; 21 enableParallelBuilding = true; 22 23 postPatch = '' 24 patchShebangs scripts/*.sh 25 ''; 26 27 doCheck = true; 28 29 # To test whether spike is working, we run the RISC-V hello applications using the RISC-V proxy 30 # kernel on the Spike emulator and see whether we get the expected output. 31 doInstallCheck = true; 32 installCheckPhase = 33 let 34 riscvPkgs = pkgsCross.riscv64-embedded; 35 in 36 '' 37 runHook preInstallCheck 38 39 echo -e "#include<stdio.h>\nint main() {printf(\"Hello, world\");return 0;}" > hello.c 40 ${riscvPkgs.stdenv.cc}/bin/${riscvPkgs.stdenv.cc.targetPrefix}cc -o hello hello.c 41 $out/bin/spike -m64 ${riscvPkgs.riscv-pk}/bin/pk hello | grep -Fq "Hello, world" 42 43 runHook postInstallCheck 44 ''; 45 46 meta = with lib; { 47 description = "RISC-V ISA Simulator"; 48 homepage = "https://github.com/riscv/riscv-isa-sim"; 49 license = licenses.bsd3; 50 platforms = [ 51 "x86_64-linux" 52 "aarch64-linux" 53 ]; 54 maintainers = with maintainers; [ blitz ]; 55 }; 56}