Skip to content

Commit

Permalink
feat(nix): package + devShell
Browse files Browse the repository at this point in the history
  • Loading branch information
lafeychine authored and JuneRousseau committed Jan 19, 2024
1 parent e9e80d5 commit f7fc2cf
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 14 deletions.
10 changes: 8 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
(lang dune 2.0)
(using menhir 2.0)
(lang dune 3.4)
(using menhir 2.1)
(name cerise-interpreter)

; https://dune.readthedocs.io/en/stable/concepts.html#package-specification
(package
(name cerise-interpreter)
(synopsis "Interpreter for Cerise capability machine"))
77 changes: 77 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-filter.url = "github:numtide/nix-filter";
};

outputs = { self, flake-utils, nixpkgs, nix-filter}:
flake-utils.lib.eachSystem ["x86_64-linux"] (system:
let
pkgs = import nixpkgs { inherit system; };
ocamlPackages = pkgs.ocamlPackages;
in with ocamlPackages; rec {
defaultPackage = buildDunePackage {
pname = "cerise-interpreter";
version = "0.0.0";
duneVersion = "3";

src = with nix-filter.lib;
nix-filter {
root = ./.;
include = [
"dune-project"
(inDirectory "src")
(inDirectory "lib")
(inDirectory "tests")
];
};

nativeBuildInputs = [menhir];
buildInputs = [containers notty zarith];
checkInputs = [alcotest];

doCheck = true;

meta = with pkgs.lib; {
description = "Cerise interpreter, interpreter for capability machines";
homepage = "https://github.com/logsem/cerise-interpreter";
license = licenses.bsd3;
};
};

devShell =
pkgs.mkShell {
packages = [
ocaml-lsp
merlin
ocamlformat
];

inputsFrom = [defaultPackage];
};
});
}
2 changes: 1 addition & 1 deletion lib/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(library
(name libinterp)
(libraries zarith notty notty.unix containers))
(libraries containers notty notty.unix zarith))

(ocamllex lexer lexer_regfile)
(menhir (modules parser parser_regfile) )
14 changes: 3 additions & 11 deletions src/dune
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
(executable
(name interpreter)
(public_name cerise-interpreter)
(modules interpreter)
(libraries libinterp notty notty.unix containers))

(executable
(name awkward_ucaps)
(modules awkward_ucaps)
(libraries libinterp))

(executable
(name awkward_dcaps)
(modules awkward_dcaps)
(libraries libinterp))
; (libraries containers libinterp notty notty.unix))
(libraries containers libinterp notty))

0 comments on commit f7fc2cf

Please sign in to comment.