Skip to content

Commit

Permalink
update nix shell
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcoolen committed Jun 10, 2024
1 parent a303608 commit cca8161
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 30 deletions.
92 changes: 63 additions & 29 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,66 @@
{ system ? builtins.currentSystem, pkgs ? import <nixpkgs> { inherit system; } }:
let pkgs = import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/1f0e8ac1f9a783c4cfa0515483094eeff4315fe2.tar.gz";
sha256 = "1mdnn0fj81pgvhzmzxh0g54g6yqxfqd2fim4h4c7cf7yskcp8g48";
}) {inherit system; }; in
let ocamlPackages = pkgs.ocaml-ng.ocamlPackages_5_0;
#.overrideScope' (self: super: {
# ocaml = super.ocaml.override { flambdaSupport = true; };
#});
{ system ? builtins.currentSystem, pkgs ? import <nixpkgs> { inherit system; }
}:
let
pkgs = import (fetchTarball {
url =
"https://github.com/NixOS/nixpkgs/archive/90e4a08f48e2b3cd9f827dca60300c93b1fea7a3.tar.gz";
sha256 = "1hr9xic73ciycmgxcl0d446xk1lfbybb6p2q1gkw1zd4rxnbzkih";
}) { inherit system; };
in let
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_5_1;
#.overrideScope' (self: super: {
# ocaml = super.ocaml.override { flambdaSupport = true; };

ctypes-foreign = pkgs.lib.overrideDerivation (ocamlPackages.ctypes-foreign)
(old: {
NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-function-pointer-types";
});
in pkgs.fastStdenv.mkDerivation {
name = "ocaml_pari";
nativeBuildInputs =
(with ocamlPackages; [ ocaml findlib dune_3 merlin utop ppx_cstubs containers mdx odoc ocaml-lsp hacl-star hex iter qcheck memtrace ocamlformat ])
++ (with pkgs; [
bison
gnumake
pkg-config
gcc
gmp
gmpxx
libcxx
# for linux
#glibc
#glibc.static
clang # for i-shiny objects
nixfmt
ocamlformat
]);
buildInputs = (with ocamlPackages; [ core ppx_expect ctypes odoc ]);
# LD_LIBRARY_PATH = "${pkgs.glibc}/lib:${pkgs.glibc.static}/lib";
NIX_LDFLAGS = "-lc -lm";
nativeBuildInputs = (with ocamlPackages; [
ocaml
findlib
dune_3
merlin
utop
ppx_cstubs
ctypes
containers
mdx
odoc
ocaml-lsp
hacl-star
hex
iter
qcheck
memtrace
ocamlformat
]) ++ (with pkgs; [
bison
gnumake
pkg-config
gcc
gmp
gmpxx
libcxx
# for linux
#glibc
#glibc.static
clang # for i-shiny objects
nixfmt-rfc-style
ocamlformat
]);
dontDetectOcamlConflicts = true;
buildInputs =
(with ocamlPackages; [ core ppx_expect ctypes odoc ctypes-foreign ]);
#LD_LIBRARY_PATH = "${pkgs.glibc}/lib:${pkgs.glibc.static}/lib";
NIX_LDFLAGS = [ "-lc -lm" ]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ "-Wl,-no_compact_unwind" ];
NIX_CFLAGS_COMPILE =
# Silence errors (-Werror) for unsupported flags on MacOS.
pkgs.lib.optionals pkgs.stdenv.isDarwin [
"-Wno-unused-command-line-argument"
"-Wmacro-redefined"
"-Wincompatible-pointer-types-discards-qualifiers"
];
}
2 changes: 1 addition & 1 deletion pari_bindings/dune
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
(-I./_build/default/pari_bindings)
(-I../../../_build/default/pari_bindings)
(-I../../_build/default/pari_bindings))
(c_library_flags :standard -fPIC -lpari)))
(c_library_flags :standard -fPIC)))
(headers
(include "pari.h"))
(type_description
Expand Down

0 comments on commit cca8161

Please sign in to comment.