-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
223 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: "Build legacy Nix package on Ubuntu" | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: cachix/install-nix-action@v26 | ||
- name: Building package | ||
run: nix build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/target | ||
.direnv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(import ( | ||
fetchTarball { | ||
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; | ||
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; } | ||
) { | ||
src = ./.; | ||
}).defaultNix |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
inputs = { | ||
naersk.url = "github:nix-community/naersk/master"; | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, utils, naersk }: | ||
utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { inherit system; }; | ||
naersk-lib = pkgs.callPackage naersk { }; | ||
sail_csim = pkgs.callPackage ./nix/sail-riscv.nix { arch = "RV64"; }; | ||
in | ||
{ | ||
packages.default = naersk-lib.buildPackage ./.; | ||
devShells.default = with pkgs; mkShell { | ||
buildInputs = [ cargo rustc rustfmt pre-commit rustPackages.clippy python311Packages.riscof sail_csim ]; | ||
RUST_SRC_PATH = rustPlatform.rustLibSrc; | ||
}; | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Modified from https://github.com/NixOS/nixpkgs/blob/e0464e47880a69896f0fb1810f00e0de469f770a/pkgs/applications/virtualization/sail-riscv/default.nix | ||
|
||
{ stdenv | ||
, fetchFromGitHub | ||
, fetchpatch | ||
, lib | ||
, arch | ||
, pkgs | ||
, ocamlPackages | ||
, ocaml | ||
, zlib | ||
, z3 | ||
}: | ||
|
||
|
||
stdenv.mkDerivation rec { | ||
pname = "sail-riscv"; | ||
version = "8a2e0f565808e6f1ee02c6369005cd153b8205a0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "riscv"; | ||
repo = pname; | ||
rev = version; | ||
hash = "sha256-0dI/M6u/wSa41Xg0uWoJIN4BkAZ//WXommknA+JFPK4="; | ||
}; | ||
|
||
nativeBuildInputs = with ocamlPackages; [ ocamlbuild findlib ocaml z3 pkgs.pkg-config | ||
(sail.overrideAttrs (previousAttrs: { | ||
version = "0.18"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "rems-project"; | ||
repo = "sail"; | ||
rev = "0.18"; | ||
hash = "sha256-QvVK7KeAvJ/RfJXXYo6xEGEk5iOmVsZbvzW28MHRFic="; | ||
}; | ||
|
||
propagatedBuildInputs = previousAttrs.propagatedBuildInputs ++ [ ocamlPackages.menhirLib ]; | ||
}))]; | ||
buildInputs = with ocamlPackages; [ zlib linksem ]; | ||
strictDeps = true; | ||
|
||
postPatch = '' | ||
rm -r prover_snapshots | ||
'' + lib.optionalString stdenv.hostPlatform.isDarwin '' | ||
substituteInPlace Makefile --replace "-flto" "" | ||
''; | ||
|
||
makeFlags = [ | ||
"SAIL=sail" | ||
"ARCH=${arch}" | ||
"SAIL_DIR=${ocamlPackages.sail}/share/sail" | ||
"LEM_DIR=${ocamlPackages.sail}/share/lem" | ||
]; | ||
|
||
installPhase = '' | ||
sail -version | ||
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 = "Formal specification of the RISC-V architecture, written in Sail"; | ||
# maintainers = with maintainers; [ genericnerdyusername ]; | ||
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64; | ||
license = licenses.bsd2; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(import ( | ||
fetchTarball { | ||
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; | ||
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; } | ||
) { | ||
src = ./.; | ||
}).shellNix |