Skip to content

Commit

Permalink
chore(nix): switch to flakes
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>

ps-id: 361819b3-0b29-43f8-b342-dabb9b17dec5
  • Loading branch information
rgrinberg committed Aug 20, 2022
1 parent 69fde05 commit 5226892
Show file tree
Hide file tree
Showing 9 changed files with 258 additions and 2,758 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ _perf
dune.exe
Makefile.dev
src/dune_rules/setup.ml
result

.DS_Store
32 changes: 0 additions & 32 deletions default.nix

This file was deleted.

2 changes: 2 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(dirs :standard \ result)

(rule
(copy dune-private-libs.opam.template dune-configurator.opam.template))

Expand Down
199 changes: 199 additions & 0 deletions flake.lock

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

56 changes: 56 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
inputs = {
opam-nix.url = "github:tweag/opam-nix";
flake-utils.url = "github:numtide/flake-utils";
ocamllsp.url = "git+https://github.com/ocaml/ocaml-lsp?submodules=1";
opam-nix.follows = "ocamllsp/opam-nix";
nixpkgs.follows = "ocamllsp/nixpkgs";
};
outputs = { self, flake-utils, opam-nix, nixpkgs, ocamllsp }@inputs:
let package = "dune";
in flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
devPackages = {
menhir = null;
lwt = null;
csexp = null;
core_bench = null;
bisect_ppx = null;
js_of_ocaml = null;
js_of_ocaml-compiler = null;
mdx = null;
merlin = null;
odoc = null;
ppx_expect = null;
ppxlib = null;
ctypes = null;
utop = null;
cinaps = null;
ocamlfind = "1.9.2";
};
on = opam-nix.lib.${system};
in {
legacyPackages = let
scope = on.buildOpamProject { } package ./. devPackages;
overlay = self: super: { };
in scope.overrideScope' overlay;

defaultPackage = self.legacyPackages.${system}.${package};

devShell = pkgs.mkShell {
nativeBuildInputs = let scope = self.legacyPackages.${system};
in with pkgs;
[
ocamllsp.outputs.defaultPackage.${system}
# dev tools
ocamlformat_0_21_0
opam
nodejs-slim
pkg-config
] ++ (builtins.map (s: builtins.getAttr s scope)
(builtins.attrNames devPackages));
inputsFrom = [ self.defaultPackage.${system} ];
};
});
}
64 changes: 0 additions & 64 deletions nix/default.nix

This file was deleted.

Loading

0 comments on commit 5226892

Please sign in to comment.