aboutsummaryrefslogtreecommitdiffstats
path: root/flake.nix
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2024-10-16 01:31:05 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2024-10-16 01:31:05 -0300
commite339fa975e21c1b589a8dfc6ac083aba2b0a6394 (patch)
tree556b4fd1873fd7ec900ccd736543b04a68b02572 /flake.nix
parent0d01055df0b99bb696fb6a2e480513cebf8890a3 (diff)
downloadSakura-e339fa975e21c1b589a8dfc6ac083aba2b0a6394.tar.gz
Sakura-e339fa975e21c1b589a8dfc6ac083aba2b0a6394.zip
dune environment vars with flake and C++ interop with stubs
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix45
1 files changed, 29 insertions, 16 deletions
diff --git a/flake.nix b/flake.nix
index 2d50b55..d48082d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -12,6 +12,7 @@
# $ nix flake lock --update-input <input> ... --commit-lockfile
#
inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Convenience functions for writing flakes
flake-utils.url = "github:numtide/flake-utils";
# Precisely filter files copied to the nix store
@@ -28,6 +29,10 @@
ocamlPackages = legacyPackages.ocamlPackages;
# Library functions from nixpkgs
lib = legacyPackages.lib;
+ systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
+ forAllSystems = f: builtins.listToAttrs (map (name: { inherit name; value = f name; }) systems);
+ merklecpp = legacyPackages.callPackage ./deps/merklecpp.nix {};
+ libressl = legacyPackages.callPackage ./deps/libressl.nix {};
# Filtered sources (prevents unecessary rebuilds)
sources = {
@@ -63,26 +68,33 @@
# $ nix build
# $ nix run -- <args?>
#
- default = self.packages.${system}.relational_engine;
+ default = self.packages.${system}.relational_engine;
+
+ relational_engine = ocamlPackages.buildDunePackage {
+ pname = "relational_engine";
+ version = "0.1.0";
+ duneVersion = "3";
+ src = sources.ocaml;
- relational_engine = ocamlPackages.buildDunePackage {
- pname = "relational_engine";
- version = "0.1.0";
- duneVersion = "3";
- src = sources.ocaml;
+ env = {
+ MERKLECPP_INCLUDE_PATH="${merklecpp}/include";
+ LIBRESSL_INCLUDE_PATH="${libressl}/include";
+ LIBRESSL_LIB_PATH="${libressl}/lib";
+ };
- buildInputs = [
- # Ocaml package dependencies needed to build go here.
- ];
+ nativeInputs = [];
- strictDeps = true;
+ buildInputs = [
+ # Ocaml package dependencies needed to build go here.
+ ];
- preBuild = ''
- dune build relational_engine.opam
- '';
- };
- };
+ strictDeps = true;
+ preBuild = ''
+ dune build relational_engine.opam
+ '';
+ };
+ };
# Flake checks
#
# $ nix flake check
@@ -204,7 +216,8 @@
ocamlPackages.utop
# Libraries
ocamlPackages.menhir
- ocamlPackages.batteries
+ ocamlPackages.ctypes
+ ocamlPackages.ctypes-foreign
];
# Tools from packages