about summary refs log tree commit diff
path: root/pkgs/applications/virtualization
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2023-02-09 08:31:26 +0800
committerGitHub <noreply@github.com>2023-02-09 08:31:26 +0800
commitaa060960641ca96950ba4a554e48f1172e375332 (patch)
treeeae331a8058340608762e2e0d7a172a954a76626 /pkgs/applications/virtualization
parent53d5dddac89cdc78a674ce51645d165b5c95603d (diff)
parent530af6b5b99b2dbdb039c55092ad118a8d35d115 (diff)
Merge pull request #213832 from GenericNerdyUsername/riscof
python3Packages.riscof: init 1.25.2
Diffstat (limited to 'pkgs/applications/virtualization')
-rw-r--r--pkgs/applications/virtualization/sail-riscv/default.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/applications/virtualization/sail-riscv/default.nix b/pkgs/applications/virtualization/sail-riscv/default.nix
new file mode 100644
index 0000000000000..b952b0f189185
--- /dev/null
+++ b/pkgs/applications/virtualization/sail-riscv/default.nix
@@ -0,0 +1,55 @@
+{ stdenv
+, fetchFromGitHub
+, lib
+, arch
+, ocamlPackages
+, ocaml
+, zlib
+, z3
+}:
+
+
+stdenv.mkDerivation rec {
+  pname = "sail-riscv";
+  version = "0.5";
+
+  src = fetchFromGitHub {
+    owner = "riscv";
+    repo = pname;
+    rev = version;
+    hash = "sha256-7PZNNUMaCZEBf0lOCqkquewRgZPooBOjIbGF7JlLnEo=";
+  };
+
+  nativeBuildInputs = with ocamlPackages; [ ocamlbuild findlib ocaml z3 sail ];
+  buildInputs = with ocamlPackages; [ zlib linksem ];
+  strictDeps = true;
+
+  postPatch = ''
+    rm -r prover_snapshots
+  '';
+
+  makeFlags = [
+    "SAIL=sail"
+    "ARCH=${arch}"
+    "SAIL_DIR=${ocamlPackages.sail}/share/sail"
+  ];
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/bin
+    cp c_emulator/riscv_sim_${arch} $out/bin
+    mkdir $out/share/
+    cp -r generated_definitions/{coq,hol4,isabelle} $out/share/
+
+    runHook postInstall
+  '';
+
+
+  meta = with lib; {
+    homepage = "https://github.com/riscv/sail-riscv";
+    description = "A formal specification of the RISC-V architecture, written in Sail";
+    maintainers = with maintainers; [ genericnerdyusername ];
+    license = licenses.bsd2;
+  };
+}