Skip to content

Commit

Permalink
Add flake for Sundials version of the compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
br4sco committed Jan 3, 2024
1 parent 4030b35 commit d52cad7
Show file tree
Hide file tree
Showing 2 changed files with 280 additions and 0 deletions.
218 changes: 218 additions & 0 deletions misc/packaging/sundials/flake.lock

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

62 changes: 62 additions & 0 deletions misc/packaging/sundials/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
description = "Builds the Miking compiler with Sundials support";

inputs = {
opam-nix.url = "github:tweag/opam-nix";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs";
nixpkgs-sundials-5_7_0.url = # SundialsML does not support Sundials after 6.1.1
"github:nixos/nixpkgs/4953d87fcb07b258561320044f96a25e0754427d";
};

outputs = { self, opam-nix, flake-utils, nixpkgs, nixpkgs-sundials-5_7_0 }:
let sundialsml = "sundialsml";
in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgs-sundials-5_7_0 = nixpkgs-sundials-5_7_0.legacyPackages.${system};
in {
legacyPackages = let
inherit (opam-nix.lib.${system}) queryToScope;
inherit pkgs;
# Build SundialsML from its OPAM package
scope = queryToScope { } {
${sundialsml} = "*";
# The following line forces opam to choose the compiler from opam
# instead of the nixpkgs one
# ocaml-base-compiler = "*";
};
buildInputs = with pkgs.ocamlPackages; [
ocaml
findlib
(pkgs-sundials-5_7_0.sundials.override ({ kluSupport = false; }))
];
in scope.overrideScope' (final: prev: {
${sundialsml} = prev.${sundialsml}.overrideAttrs (_: {
buildInputs = buildInputs;
nativeBuildInputs = buildInputs;
});
});

devShells.default = pkgs.mkShell {
name = "Miking dev shell";
buildInputs = with pkgs.ocamlPackages; [
pkgs.coreutils # Miking currently requires mkdir to be able to run
ocaml
linenoise
pkgs.minizinc
];
nativeBuildInputs = with pkgs.ocamlPackages; [
ocaml
findlib
dune_3
pkgs.gdb

lwt # For async-ext.mc
owl # For dist-ext.mc
toml # For toml-ext.mc
self.legacyPackages.${system}.${sundialsml} # for sundials-ext.mc
];
};
});
}

0 comments on commit d52cad7

Please sign in to comment.