From fbadd5335ffa8f1e262bf73e1adaf86600498ab9 Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Thu, 17 Aug 2023 16:51:10 +0100 Subject: [PATCH 1/3] Set up a nix shell for the playground project --- flake.lock | 86 +++++++++++++++++++++++++++++++++++++++++++++++------- flake.nix | 31 +++++++++++++++++--- 2 files changed, 103 insertions(+), 14 deletions(-) diff --git a/flake.lock b/flake.lock index 2bcb845a4..49fd108d2 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", "type": "github" }, "original": { @@ -18,6 +18,71 @@ "type": "github" } }, + "melange-compiler-libs": { + "inputs": { + "flake-utils": [ + "melange-flake", + "flake-utils" + ], + "nixpkgs": [ + "melange-flake", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1691878293, + "narHash": "sha256-XRYjFRwjDFYFhUzo4zjHiaMyXk3+wTvUAmJoE84HBT0=", + "owner": "melange-re", + "repo": "melange-compiler-libs", + "rev": "55d2714f4187c4b2a0a50c8574aaf26d392b3a0e", + "type": "github" + }, + "original": { + "owner": "melange-re", + "repo": "melange-compiler-libs", + "type": "github" + } + }, + "melange-flake": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "melange-compiler-libs": "melange-compiler-libs", + "nix-filter": "nix-filter", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1691881541, + "narHash": "sha256-1jJs0emKFrvBCepeH9XgHcxoGrsjAtOhBBt+OimcWk4=", + "owner": "melange-re", + "repo": "melange", + "rev": "a662d964185d862bc31e7854cf0c9988d6f23429", + "type": "github" + }, + "original": { + "owner": "melange-re", + "repo": "melange", + "type": "github" + } + }, + "nix-filter": { + "locked": { + "lastModified": 1687178632, + "narHash": "sha256-HS7YR5erss0JCaUijPeyg2XrisEb959FIct3n2TMGbE=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "d90c75e8319d0dd9be67d933d8eb9d0894ec9174", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nixpkgs": { "inputs": { "flake-utils": [ @@ -26,11 +91,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1684225565, - "narHash": "sha256-Pj75M8cWGJumPuqLGUe1XFQEcrlCeH6zvtGqOXzAE4U=", + "lastModified": 1689474348, + "narHash": "sha256-ahbwC8FkW0m2KH5xKB+LzB8kNofsBAo/r1NaQ+csSEI=", "owner": "nix-ocaml", "repo": "nix-overlays", - "rev": "9a29b315228574accfe25224e0842027bc691c50", + "rev": "e48f146965f62cfe425c25b18be47f5a9acd113e", "type": "github" }, "original": { @@ -41,23 +106,24 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1684193874, - "narHash": "sha256-mYTCtTQMcWLBa7r5TxFrwGIb3MQ8QjalaDs1dRuMfHw=", + "lastModified": 1689353800, + "narHash": "sha256-otYIhlggg1kspAfl3EFTuiPv5zF8QcBSyO7K5uEnqo8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d38127eb1361b79417f4dfb1719e5fe0d6a326ca", + "rev": "af59b3fb98ba6c3868522a3bc1c13388c09163ab", "type": "github" }, "original": { "owner": "NixOS", "repo": "nixpkgs", - "rev": "d38127eb1361b79417f4dfb1719e5fe0d6a326ca", + "rev": "af59b3fb98ba6c3868522a3bc1c13388c09163ab", "type": "github" } }, "root": { "inputs": { "flake-utils": "flake-utils", + "melange-flake": "melange-flake", "nixpkgs": "nixpkgs" } }, diff --git a/flake.nix b/flake.nix index ba7e17e30..c98b8fc37 100644 --- a/flake.nix +++ b/flake.nix @@ -7,12 +7,22 @@ url = "github:nix-ocaml/nix-overlays"; inputs.flake-utils.follows = "flake-utils"; }; + melange-flake = { + url = "github:melange-re/melange"; + inputs.flake-utils.follows = "flake-utils"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils, melange-flake }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages."${system}"; + pkgs = nixpkgs.legacyPackages."${system}".appendOverlays [ + (self: super: { + ocamlPackages = super.ocaml-ng.ocamlPackages_5_1; + }) + melange-flake.overlays.default + ]; python3Packages = pkgs.python3.pkgs.overrideScope (pyself: pysuper: { mkdocs-print-site-plugin = pyself.buildPythonPackage rec { pname = "mkdocs-print-site-plugin"; @@ -33,10 +43,23 @@ { devShells = { default = pkgs.mkShell { - buildInputs = with python3Packages; [ + nativeBuildInputs = with pkgs.ocamlPackages; [ ocaml findlib ]; + buildInputs = (with python3Packages; [ + beautifulsoup4 mkdocs mkdocs-print-site-plugin - ]; + tiktoken + pandas + tabulate + openai + numpy + markdownify + ]) ++ (with pkgs.ocamlPackages; [ + melange + # ocaml-lsp + merlin + reason + ]); }; }; }); From 7f315cdc29f9bff4d0a967d837e40095c5198bda Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Thu, 17 Aug 2023 17:00:39 +0100 Subject: [PATCH 2/3] add missing deps --- flake.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index c98b8fc37..651c6ce69 100644 --- a/flake.nix +++ b/flake.nix @@ -43,7 +43,7 @@ { devShells = { default = pkgs.mkShell { - nativeBuildInputs = with pkgs.ocamlPackages; [ ocaml findlib ]; + nativeBuildInputs = with pkgs.ocamlPackages; [ ocaml findlib dune ]; buildInputs = (with python3Packages; [ beautifulsoup4 mkdocs @@ -59,6 +59,7 @@ # ocaml-lsp merlin reason + cmarkit ]); }; }; From 5794ebe8eb8adf3526694ec3ebbbda73cb3a70e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Thu, 17 Aug 2023 18:40:39 +0100 Subject: [PATCH 3/3] update flakes --- Makefile | 2 +- flake.lock | 14 +++++++------- flake.nix | 27 +++++++++++++++++---------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index ab07270da..6a969da80 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ project_name = documentation-site -DUNE = opam exec -- dune +DUNE = dune .DEFAULT_GOAL := help diff --git a/flake.lock b/flake.lock index 49fd108d2..e3b97a2e4 100644 --- a/flake.lock +++ b/flake.lock @@ -91,11 +91,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1689474348, - "narHash": "sha256-ahbwC8FkW0m2KH5xKB+LzB8kNofsBAo/r1NaQ+csSEI=", + "lastModified": 1692284462, + "narHash": "sha256-5nfL4s3zLUKW1K/ouX01dbIOSO/0cq0jRQ0vpbr59u0=", "owner": "nix-ocaml", "repo": "nix-overlays", - "rev": "e48f146965f62cfe425c25b18be47f5a9acd113e", + "rev": "9f8ce5694aca5be7a63067927180c4b28abae993", "type": "github" }, "original": { @@ -106,17 +106,17 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1689353800, - "narHash": "sha256-otYIhlggg1kspAfl3EFTuiPv5zF8QcBSyO7K5uEnqo8=", + "lastModified": 1692231980, + "narHash": "sha256-tvkB3PIrkRaaP0nVFsCKYrr2Ij3VLLHI7k5mjlDSnB4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "af59b3fb98ba6c3868522a3bc1c13388c09163ab", + "rev": "5414083f0ba82e98e49976311e1fddf7d7a2074d", "type": "github" }, "original": { "owner": "NixOS", "repo": "nixpkgs", - "rev": "af59b3fb98ba6c3868522a3bc1c13388c09163ab", + "rev": "5414083f0ba82e98e49976311e1fddf7d7a2074d", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 651c6ce69..222f5d3fc 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,16 @@ let pkgs = nixpkgs.legacyPackages."${system}".appendOverlays [ (self: super: { - ocamlPackages = super.ocaml-ng.ocamlPackages_5_1; + ocamlPackages = super.ocaml-ng.ocamlPackages_5_1.overrideScope' (ocamlself: ocamlsuper: { + cmarkit = ocamlsuper.cmarkit.overrideAttrs (oldattrs: { + src = pkgs.fetchFromGitHub { + owner = "dbuenzli"; + repo = "cmarkit"; + rev = "f37c8ea86fd0be8dba7a8babcee3682e0e047d91"; + hash = "sha256-3CD49b8jUFkytKZ9+2sEUQr4YsZL6zI6myMLNN5NQJ4="; + }; + }); + }); }) melange-flake.overlays.default ]; @@ -45,22 +54,20 @@ default = pkgs.mkShell { nativeBuildInputs = with pkgs.ocamlPackages; [ ocaml findlib dune ]; buildInputs = (with python3Packages; [ - beautifulsoup4 mkdocs mkdocs-print-site-plugin - tiktoken - pandas - tabulate - openai - numpy - markdownify + mike ]) ++ (with pkgs.ocamlPackages; [ + cmarkit + js_of_ocaml melange - # ocaml-lsp merlin + ocaml-lsp + ocamlformat-lib reason - cmarkit + reason-react ]); + dontDetectOcamlConflicts = true; }; }; });