diff --git a/Makefile b/Makefile index 78c19c5..5aca9f1 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,18 @@ clean: watch: @dune build @all -w -onix-lock: +nix-lock: + nix run .#onix-lock + +.PHONY: onix-lock.json +onix-lock.json: onix lock ./imandra-document.opam --resolutions="ocaml-system=5.2.0" --lock-file ./onix-lock.json - onix lock ./imandra-document.opam --resolutions="ocaml-system=5.2.0,ocaml-lsp-server" --with-test=true --lock-file ./onix-lock-dev.json + +.PHONY: onix-lock-dev.json +onix-lock-dev.json: + onix lock ./imandra-document.opam --resolutions="ocaml-system=5.2.0,ocaml-lsp-server,utop" --with-test=true --lock-file ./onix-lock-dev.json + +.PHONY: lock +lock: onix-lock.json onix-lock-dev.json git add onix-lock.json onix-lock-dev.json diff --git a/flake.lock b/flake.lock index b750acc..73e8b0b 100644 --- a/flake.lock +++ b/flake.lock @@ -66,6 +66,7 @@ "original": { "owner": "rizo", "repo": "onix", + "rev": "3740a2beb84bc21860385f8bbb0d5f557842de03", "type": "github" } }, diff --git a/flake.nix b/flake.nix index db2e006..6a8e5fc 100644 --- a/flake.nix +++ b/flake.nix @@ -3,54 +3,100 @@ nixpkgs.url = "nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; - onix.url = "github:rizo/onix"; - onix.inputs.nixpkgs.follows = "nixpkgs"; + onix = { + url = "github:rizo/onix/3740a2beb84bc21860385f8bbb0d5f557842de03"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, flake-utils, onix }@inputs: - flake-utils.lib.eachDefaultSystem (system: + outputs = + { + self, + nixpkgs, + flake-utils, + onix, + }@inputs: + flake-utils.lib.eachDefaultSystem ( + system: let pkgs = nixpkgs.legacyPackages.${system}; onix' = onix.packages.${system}.latest; - opamFiles = [ + compilerVersion = "5.2.0"; + opamFiles = [ ./imandra-document.opam ]; onixEnv = onix'.env { path = ./.; roots = opamFiles; lock = ./onix-lock.json; - deps = { "ocaml-system" = "*"; }; + deps = { + "ocaml-system" = compilerVersion; + }; }; onixEnvDev = onix'.env { path = ./.; roots = opamFiles; lock = ./onix-lock-dev.json; deps = { - "ocaml-system" = "*"; + "ocaml-system" = compilerVersion; "ocaml-lsp-server" = "*"; + "utop" = "*"; }; }; - - in rec { + onixLock = + let + shellHook = pkgs.writeText "onix-lock-shellHook" onixEnv.lock.shellHook; + lockPatched = pkgs.runCommand "onix-lock-shellHook-patched" { } '' + sed 's:--lock-file=/nix/store/.*/onix-lock.json::' "${shellHook}" > "$out" + chmod +x "$out" + ''; + in + pkgs.writeShellApplication { + name = "onix-lock"; + runtimeInputs = [ onix' ]; + text = lockPatched; + }; + onixLockDev = + let + shellHook = pkgs.writeText "onix-lock-dev-shellHook" onixEnvDev.lock.shellHook; + lockPatched = pkgs.runCommand "onix-lock-dev-shellHook-patched" { } '' + sed 's:--lock-file=/nix/store/.*/onix-lock-dev.json::' "${shellHook}" > "$out" + chmod +x "$out" + ''; + in + pkgs.writeShellApplication { + name = "onix-lock-dev"; + runtimeInputs = [ onix' ]; + text = lockPatched; + }; + in + rec { formatter = pkgs.nixfmt-rfc-style; packages.imandra-document = onixEnv.pkgs.imandra-document; + packages.default = onixEnv.pkgs.imandra-document; - devShells.onixLock = pkgs.mkShell { + packages.onix-lock = onixLock; + packages.onix-lock-dev = onixLockDev; + devShells.onixLock = pkgs.mkShell { buildInputs = [ onix' - ]; + ]; }; - devShells.default = onixEnvDev.shell.overrideAttrs (final: prev: { - buildInputs = prev.buildInputs ++ [ - pkgs.ocamlformat_0_22_4 - pkgs.dune_3 - pkgs.ocaml - onix' - ]; - }); + devShells.default = onixEnvDev.shell.overrideAttrs ( + final: prev: { + buildInputs = prev.buildInputs ++ [ + pkgs.ocamlformat_0_22_4 + pkgs.dune_3 + pkgs.ocaml + onix' + ]; + } + ); - packages.dev-shell = devShells.default.inputDerivation; - }); + # Allows the default devshell to be cached + packages.devShell-default = devShells.default.inputDerivation; + } + ); } diff --git a/onix-lock-dev.json b/onix-lock-dev.json index 0760257..e69bf51 100644 --- a/onix-lock-dev.json +++ b/onix-lock-dev.json @@ -3,7 +3,7 @@ "repositories": [ { "url": "https://github.com/ocaml/opam-repository.git", - "rev": "a6cd5e92975350b992cb58b4351df6fceefc8144" + "rev": "e57ab1a26e2a9ef176034f22915009039c5dc390" } ], "packages" : { @@ -43,6 +43,16 @@ "base-bigarray": { "version": "base" }, + "base-bytes": { + "version": "base", + "depends": [ + "ocaml", + "ocamlfind" + ], + "build-depends": [ + "ocamlfind" + ] + }, "base-domains": { "version": "base", "depends": [ @@ -126,6 +136,21 @@ "dune-configurator" ] }, + "cppo": { + "version": "1.7.0", + "src": { + "url": "https://github.com/ocaml-community/cppo/archive/refs/tags/v1.7.0.tar.gz", + "sha512": "cafa2f7add42912b413f39e1d9fb7a2a42a9be134128c179dfe353f35a6c32840720d2166a77d985941300cb945b9c424b38401d20027d814b25f3bac534506d" + }, + "depends": [ + "base-unix", + "dune", + "ocaml" + ], + "build-depends": [ + "dune" + ] + }, "csexp": { "version": "1.5.2", "src": { @@ -278,6 +303,43 @@ "dune" ] }, + "lambda-term": { + "version": "3.3.2", + "src": { + "url": "https://github.com/ocaml-community/lambda-term/archive/refs/tags/3.3.2.tar.gz", + "sha512": "78648768644058337e22c79cf1fbb1a36472b24f11b1dc0461fc38419be6ec01b02d8d0ac45fed0bc99f91ba4c0f19d3bda113e834e064bee973b734527b9766" + }, + "depends": [ + "dune", + "logs", + "lwt", + "lwt_react", + "mew_vi", + "ocaml", + "react", + "zed" + ], + "build-depends": [ + "dune" + ] + }, + "logs": { + "version": "0.7.0", + "src": { + "url": "https://erratique.ch/software/logs/releases/logs-0.7.0.tbz", + "sha256": "86f4a02807eb1a297aae44977d9f61e419c31458a5d7b23c6f55575e8e69d5ca" + }, + "depends": [ + "base-threads", + "lwt", + "ocaml" + ], + "build-depends": [ + "ocamlbuild", + "ocamlfind", + "topkg" + ] + }, "lsp": { "version": "1.19.0", "src": { @@ -296,6 +358,43 @@ "dune" ] }, + "lwt": { + "version": "5.9.0", + "src": { + "url": "https://github.com/ocsigen/lwt/archive/refs/tags/5.9.0.tar.gz", + "sha512": "35574743df40170a8d1676254952c060090421a40d5f8ad37a6691f4f8bb0e28fca61f5efff1050edc4f8a3ffa2f06a1e23d0c084c89bfc105c1235e249bbc75" + }, + "depends": [ + "base-threads", + "base-unix", + "dune", + "dune-configurator", + "ocaml", + "ocplib-endian" + ], + "build-depends": [ + "cppo", + "dune", + "dune-configurator" + ] + }, + "lwt_react": { + "version": "1.2.0", + "src": { + "url": "https://github.com/ocsigen/lwt/archive/5.6.0.tar.gz", + "sha512": "d616389bc9e0da11f25843ab7541ac2d40c9543700a89455f14115b339bbe58cef2b8acf0ae97fd54e15a4cb93149cfe1ebfda301aa93933045f76b7d9344160" + }, + "depends": [ + "dune", + "lwt", + "ocaml", + "react" + ], + "build-depends": [ + "cppo", + "dune" + ] + }, "merlin-lib": { "version": "5.2.1-502", "src": { @@ -311,6 +410,38 @@ "dune" ] }, + "mew": { + "version": "0.1.0", + "src": { + "url": "https://github.com/kandu/mew/archive/0.1.0.tar.gz", + "sha256": "64d38ceb52ef574cb314bdd693f7e4a9c9e483e80a58595db22f2df76a8a59e6" + }, + "depends": [ + "dune", + "ocaml", + "result", + "trie" + ], + "build-depends": [ + "dune" + ] + }, + "mew_vi": { + "version": "0.5.0", + "src": { + "url": "https://github.com/kandu/mew_vi/archive/0.5.0.tar.gz", + "sha256": "a692fa7cdcc9e80fd9387c4f61677776b9fc15f9f7175b4220fcd1a73d1bafda" + }, + "depends": [ + "dune", + "mew", + "ocaml", + "react" + ], + "build-depends": [ + "dune" + ] + }, "ocaml": { "version": "5.2.0", "depends": [ @@ -476,6 +607,22 @@ "dune" ] }, + "ocplib-endian": { + "version": "1.2", + "src": { + "url": "https://github.com/OCamlPro/ocplib-endian/archive/refs/tags/1.2.tar.gz", + "sha512": "2e70be5f3d6e377485c60664a0e235c3b9b24a8d6b6a03895d092c6e40d53810bfe1f292ee69e5181ce6daa8a582bfe3d59f3af889f417134f658812be5b8b85" + }, + "depends": [ + "base-bytes", + "dune", + "ocaml" + ], + "build-depends": [ + "cppo", + "dune" + ] + }, "ordering": { "version": "3.16.1", "src": { @@ -534,6 +681,35 @@ "dune" ] }, + "react": { + "version": "1.2.2", + "src": { + "url": "https://erratique.ch/software/react/releases/react-1.2.2.tbz", + "sha512": "18cdd544d484222ba02db6bd9351571516532e7a1c107b59bbe39193837298f5c745eab6754f8bc6ff125b387be7018c6d6e6ac99f91925a5e4f53af688522b1" + }, + "depends": [ + "ocaml" + ], + "build-depends": [ + "ocamlbuild", + "ocamlfind", + "topkg" + ] + }, + "result": { + "version": "1.5", + "src": { + "url": "https://github.com/janestreet/result/releases/download/1.5/result-1.5.tbz", + "sha256": "7c3a5e238558f4c1a4f5acca816bc705a0e12f68dc0005c61ddbf2e6cab8ee32" + }, + "depends": [ + "dune", + "ocaml" + ], + "build-depends": [ + "dune" + ] + }, "seq": { "version": "base", "src-extra": { @@ -565,10 +741,10 @@ ] }, "spawn": { - "version": "v0.15.1", + "version": "v0.17.0", "src": { - "url": "https://github.com/janestreet/spawn/archive/v0.15.1.tar.gz", - "sha256": "9afdee314fab6c3fcd689ab6eb5608d6b78078e6dede3953a47debde06c19d50" + "url": "https://github.com/janestreet/spawn/releases/download/v0.17.0/spawn-v0.17.0.tbz", + "sha256": "33fbb5cd4c3387a6829095cfa73d5fc2eff572be61647e6052010bfbd0c2df49" }, "depends": [ "dune", @@ -612,6 +788,92 @@ "ocamlfind" ] }, + "trie": { + "version": "1.0.0", + "src": { + "url": "https://github.com/kandu/trie/archive/1.0.0.tar.gz", + "sha256": "c2f8054ea44216e6a3a961b28f7630e0e3dbfbd1b504ae741be230cbe32498ea" + }, + "depends": [ + "dune", + "ocaml" + ], + "build-depends": [ + "dune" + ] + }, + "uchar": { + "version": "0.0.2", + "src": { + "url": "https://github.com/ocaml/uchar/releases/download/v0.0.2/uchar-0.0.2.tbz", + "sha256": "47397f316cbe76234af53c74a1f9452154ba3bdb54fced5caac959f50f575af0" + }, + "depends": [ + "ocaml" + ], + "build-depends": [ + "ocamlbuild" + ] + }, + "utop": { + "version": "2.14.0", + "src": { + "url": "https://github.com/ocaml-community/utop/releases/download/2.14.0/utop-2.14.0.tbz", + "sha256": "0fd5a9bc5b458524a71463a1fe0cd16f9b7be13673ae303118b7216e0d273ba9" + }, + "depends": [ + "base-threads", + "base-unix", + "cppo", + "dune", + "lambda-term", + "logs", + "lwt", + "lwt_react", + "ocaml", + "ocamlfind", + "react", + "xdg", + "zed" + ], + "build-depends": [ + "cppo", + "dune", + "ocamlfind" + ] + }, + "uucp": { + "version": "16.0.0", + "src": { + "url": "https://erratique.ch/software/uucp/releases/uucp-16.0.0.tbz", + "sha512": "5c06d8cadb2b011b1e4ac52e14732044f6ab8e9c11e1184950ff8629b26bd173f1264247623a635b8aa4033e287bfe42d709994f19a3d79f7cbfd20158aa4992" + }, + "depends": [ + "ocaml" + ], + "build-depends": [ + "ocamlbuild", + "ocamlfind", + "topkg" + ] + }, + "uuseg": { + "version": "16.0.0", + "src": { + "url": "https://erratique.ch/software/uuseg/releases/uuseg-16.0.0.tbz", + "sha512": "355139aee2a72baddf3d811e522948456147546ee946b6eca20f57711865770d4b8d32ea01a7338b8e6cdedb4423ee65cee387704bb9c0c057bcbd65012679b8" + }, + "depends": [ + "ocaml", + "uucp", + "uutf" + ], + "build-depends": [ + "ocamlbuild", + "ocamlfind", + "topkg" + ] + }, "uutf": { "version": "1.0.3", "src": { @@ -671,6 +933,26 @@ "build-depends": [ "ocamlfind" ] + }, + "zed": { + "version": "3.2.3", + "src": { + "url": "https://github.com/ocaml-community/zed/archive/refs/tags/3.2.3.tar.gz", + "sha512": "637f75129550f6459417549d44bed16bdc62721d2e9e0c6bb5bfab30c5bc6478de15faece8c091b56f238375cb79a7bc176375400e543120bb31d7ea626b7c5b" + }, + "depends": [ + "dune", + "ocaml", + "react", + "result", + "uchar", + "uucp", + "uuseg", + "uutf" + ], + "build-depends": [ + "dune" + ] } } } diff --git a/onix-lock.json b/onix-lock.json index c28519a..13401eb 100644 --- a/onix-lock.json +++ b/onix-lock.json @@ -3,7 +3,7 @@ "repositories": [ { "url": "https://github.com/ocaml/opam-repository.git", - "rev": "a6cd5e92975350b992cb58b4351df6fceefc8144" + "rev": "e57ab1a26e2a9ef176034f22915009039c5dc390" } ], "packages" : {