-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use tweag/opam-nix for supporting and building Owl - Add 'owl' as a default library to build
- Loading branch information
1 parent
c788252
commit 7573ba1
Showing
3 changed files
with
259 additions
and
1 deletion.
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
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,61 @@ | ||
{ | ||
inputs = { | ||
opam-nix.url = "github:tweag/opam-nix"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
nixpkgs.follows = "opam-nix/nixpkgs"; | ||
}; | ||
outputs = { self, flake-utils, opam-nix, nixpkgs }@inputs: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
on = opam-nix.lib.${system}; | ||
localPackagesQuery = builtins.mapAttrs (_: pkgs.lib.last) | ||
(on.listRepo (on.makeOpamRepo ./.)); | ||
devPackagesQuery = { | ||
# You can add "development" packages here. They will get added to the devShell automatically. | ||
ocaml-lsp-server = "*"; | ||
ocamlformat = "*"; | ||
}; | ||
query = devPackagesQuery // { | ||
## You can force versions of certain packages here, e.g: | ||
## - force the ocaml compiler to be taken from opam-repository: | ||
ocaml-base-compiler = "*"; | ||
## - or force the compiler to be taken from nixpkgs and be a certain version: | ||
# ocaml-system = "4.14.0"; | ||
## - or force ocamlfind to be a certain version: | ||
# ocamlfind = "1.9.2"; | ||
ocaml-compiler-libs = "*"; | ||
alcotest = "*"; | ||
dune-configurator = "*"; | ||
bigarray-compat = "*"; | ||
}; | ||
scope = on.buildOpamProject' { } ./. query; | ||
overlay = final: prev: | ||
{ | ||
# You can add overrides here | ||
# dune = prev.dune.overrideAttrs (_: { buildPhase = "make && make install"; }); | ||
}; | ||
scope' = scope.overrideScope' overlay; | ||
# Packages from devPackagesQuery | ||
devPackages = builtins.attrValues | ||
(pkgs.lib.getAttrs (builtins.attrNames devPackagesQuery) scope'); | ||
# Packages in this workspace | ||
packages = | ||
pkgs.lib.getAttrs (builtins.attrNames localPackagesQuery) scope'; | ||
in { | ||
legacyPackages = scope'; | ||
|
||
#inherit packages; | ||
|
||
## If you want to have a "default" package which will be built with just `nix build`, do this instead of `inherit packages;`: | ||
packages = packages // { default = packages.owl; }; | ||
|
||
devShells.default = pkgs.mkShell { | ||
inputsFrom = builtins.attrValues packages; | ||
buildInputs = devPackages ++ [ | ||
# You can add packages from nixpkgs here | ||
pkgs.openblas | ||
]; | ||
}; | ||
}); | ||
} |