mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-20 00:41:05 +03:00
Merge pull request #270 from W95Psp/convert-nix-to-flake
Fix Nix expressions and convert them to flakes
This commit is contained in:
commit
6d0b3d2a3f
@ -1,56 +0,0 @@
|
||||
diff --git a/compiler/catala_web_interpreter.ml b/compiler/catala_web_interpreter.ml
|
||||
deleted file mode 100644
|
||||
index 3b8d660..0000000
|
||||
--- a/compiler/catala_web_interpreter.ml
|
||||
+++ /dev/null
|
||||
@@ -1,29 +0,0 @@
|
||||
-open Driver
|
||||
-open Js_of_ocaml
|
||||
-
|
||||
-let _ =
|
||||
- Js.export_all
|
||||
- (object%js
|
||||
- method interpret
|
||||
- (contents : Js.js_string Js.t)
|
||||
- (scope : Js.js_string Js.t)
|
||||
- (language : Js.js_string Js.t)
|
||||
- (trace : bool) =
|
||||
- driver
|
||||
- (Contents (Js.to_string contents))
|
||||
- {
|
||||
- Utils.Cli.debug = false;
|
||||
- unstyled = false;
|
||||
- wrap_weaved_output = false;
|
||||
- avoid_exceptions = false;
|
||||
- backend = "Interpret";
|
||||
- language = Some (Js.to_string language);
|
||||
- max_prec_digits = None;
|
||||
- closure_conversion = false;
|
||||
- trace;
|
||||
- disable_counterexamples = false;
|
||||
- optimize = false;
|
||||
- ex_scope = Some (Js.to_string scope);
|
||||
- output_file = None;
|
||||
- }
|
||||
- end)
|
||||
diff --git a/compiler/dune b/compiler/dune
|
||||
index 2c5a1996..f6c38809 100644
|
||||
--- a/compiler/dune
|
||||
+++ b/compiler/dune
|
||||
@@ -19,16 +19,6 @@
|
||||
(libraries calendar zarith zarith_stubs_js)
|
||||
(modules runtime))
|
||||
|
||||
-(executable
|
||||
- (name catala_web_interpreter)
|
||||
- (modes byte js)
|
||||
- (package catala)
|
||||
- (public_name catala_web_interpreter)
|
||||
- (modules catala_web_interpreter)
|
||||
- (preprocess
|
||||
- (pps js_of_ocaml-ppx))
|
||||
- (libraries catala.driver js_of_ocaml))
|
||||
-
|
||||
(executable
|
||||
(name catala)
|
||||
(modes native js)
|
19
.nix/packages.nix
Normal file
19
.nix/packages.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ ocamlPackages, fetchurl }:
|
||||
|
||||
ocamlPackages.overrideScope' (self: super: {
|
||||
cmdliner_1_1_0 = super.cmdliner.overrideAttrs (o: rec {
|
||||
version = "1.1.0";
|
||||
src = fetchurl {
|
||||
url = "https://erratique.ch/software/${o.pname}/releases/${o.pname }-${version}.tbz";
|
||||
sha256 = "sha256-irWd4HTlJSYuz3HMgi1de2GVL2qus0QjeCe1WdsSs8Q=";
|
||||
};
|
||||
});
|
||||
alcotest = (super.alcotest.override {
|
||||
cmdliner = self.cmdliner_1_1_0;
|
||||
}).overrideAttrs (_: {
|
||||
doCheck = false;
|
||||
});
|
||||
bindlib = ocamlPackages.callPackage ./bindlib.nix { };
|
||||
unionfind = ocamlPackages.callPackage ./unionfind.nix { };
|
||||
ppx_yojson_conv = ocamlPackages.callPackage ./ppx_yojson_conv.nix { };
|
||||
})
|
20
.nix/ppx_yojson_conv.nix
Normal file
20
.nix/ppx_yojson_conv.nix
Normal file
@ -0,0 +1,20 @@
|
||||
{ lib, fetchurl, buildDunePackage, ppxlib, ppx_yojson_conv_lib, ppx_js_style }:
|
||||
|
||||
buildDunePackage rec {
|
||||
pname = "ppx_yojson_conv";
|
||||
version = "0.14.0";
|
||||
|
||||
minimumOCamlVersion = "4.0.8";
|
||||
|
||||
useDune2 = true;
|
||||
|
||||
propagatedBuildInputs = [
|
||||
ppxlib ppx_yojson_conv_lib ppx_js_style
|
||||
];
|
||||
|
||||
src = fetchurl
|
||||
{
|
||||
url = "https://ocaml.janestreet.com/ocaml-core/v0.14/files/ppx_yojson_conv-v0.14.0.tar.gz";
|
||||
sha256 = "0ls6vzj7k0wrjliifqczs78anbc8b88as5w7a3wixfcs1gjfsp2w";
|
||||
};
|
||||
}
|
10
default.nix
10
default.nix
@ -7,7 +7,7 @@
|
||||
, menhir
|
||||
, unionfind
|
||||
, bindlib
|
||||
, cmdliner
|
||||
, cmdliner_1_1_0
|
||||
, re
|
||||
, zarith
|
||||
, zarith_stubs_js
|
||||
@ -22,12 +22,13 @@
|
||||
, ppx_deriving
|
||||
, z3
|
||||
, alcotest
|
||||
, ppx_yojson_conv
|
||||
, menhirLib ? null #for nixos-unstable compatibility.
|
||||
}:
|
||||
|
||||
buildDunePackage rec {
|
||||
pname = "catala";
|
||||
version = "0.5.0";
|
||||
version = "0.6.0"; # TODO parse `catala.opam` with opam2json
|
||||
|
||||
minimumOCamlVersion = "4.11";
|
||||
|
||||
@ -40,7 +41,7 @@ buildDunePackage rec {
|
||||
sedlex_2
|
||||
menhir
|
||||
menhirLib
|
||||
cmdliner
|
||||
cmdliner_1_1_0
|
||||
re
|
||||
zarith
|
||||
zarith_stubs_js
|
||||
@ -50,6 +51,7 @@ buildDunePackage rec {
|
||||
benchmark
|
||||
js_of_ocaml
|
||||
js_of_ocaml-ppx
|
||||
ppx_yojson_conv
|
||||
camomile
|
||||
cppo
|
||||
z3
|
||||
@ -65,8 +67,6 @@ buildDunePackage rec {
|
||||
] ++ (if isNull menhirLib then [ ] else [ menhirLib ]);
|
||||
doCheck = true;
|
||||
|
||||
patches = [ ./.nix/no-web.patch ];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://catala-lang.org";
|
||||
description =
|
||||
|
43
flake.lock
Normal file
43
flake.lock
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1653581809,
|
||||
"narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "83658b28fe638a170a19b8933aa008b30640fbd1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
33
flake.nix
Normal file
33
flake.nix
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
inputs = {
|
||||
flake-utils.url = github:numtide/flake-utils;
|
||||
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
|
||||
};
|
||||
|
||||
outputs = {nixpkgs, flake-utils, ...}:
|
||||
let
|
||||
systems = [ "x86_64-linux" ];
|
||||
in flake-utils.lib.eachSystem systems (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
ocamlPackages = pkgs.callPackage ./.nix/packages.nix {};
|
||||
in
|
||||
rec {
|
||||
packages = {
|
||||
catala = ocamlPackages.callPackage ./. {};
|
||||
};
|
||||
defaultPackage = packages.catala;
|
||||
devShell = pkgs.mkShell {
|
||||
inputsFrom = [packages.catala];
|
||||
buildInputs = [
|
||||
pkgs.inotify-tools
|
||||
ocamlPackages.merlin
|
||||
pkgs.ocamlformat
|
||||
ocamlPackages.ocp-indent
|
||||
ocamlPackages.utop
|
||||
ocamlPackages.ocaml-lsp
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
with pkgs;
|
||||
ocamlPackages.callPackage ./. {
|
||||
bindlib = ocamlPackages.callPackage ./.nix/bindlib.nix { };
|
||||
unionfind = ocamlPackages.callPackage ./.nix/unionfind.nix { };
|
||||
}
|
19
shell.nix
19
shell.nix
@ -1,19 +0,0 @@
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
with pkgs;
|
||||
let
|
||||
pkg = ocamlPackages.callPackage ./. {
|
||||
bindlib = ocamlPackages.callPackage ./.nix/bindlib.nix { };
|
||||
unionfind = ocamlPackages.callPackage ./.nix/unionfind.nix { };
|
||||
};
|
||||
in mkShell {
|
||||
inputsFrom = [ pkg ];
|
||||
buildInputs = pkg.propagatedBuildInputs ++ [
|
||||
inotify-tools
|
||||
ocamlPackages.merlin
|
||||
ocamlformat
|
||||
ocamlPackages.ocp-indent
|
||||
ocamlPackages.utop
|
||||
ocamlPackages.ocaml-lsp
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue
Block a user