Skip to content

Commit

Permalink
Fix Nix and convert to flakes
Browse files Browse the repository at this point in the history
  • Loading branch information
W95Psp committed May 30, 2022
1 parent 4c43b53 commit 33773f4
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 87 deletions.
56 changes: 0 additions & 56 deletions .nix/no-web.patch

This file was deleted.

19 changes: 19 additions & 0 deletions .nix/packages.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 0 deletions .nix/ppx_yojson_conv.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 5 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
, menhir
, unionfind
, bindlib
, cmdliner
, cmdliner_1_1_0
, re
, zarith
, zarith_stubs_js
Expand All @@ -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";

Expand All @@ -40,7 +41,7 @@ buildDunePackage rec {
sedlex_2
menhir
menhirLib
cmdliner
cmdliner_1_1_0
re
zarith
zarith_stubs_js
Expand All @@ -50,6 +51,7 @@ buildDunePackage rec {
benchmark
js_of_ocaml
js_of_ocaml-ppx
ppx_yojson_conv
camomile
cppo
z3
Expand All @@ -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 =
Expand Down
43 changes: 43 additions & 0 deletions flake.lock

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

33 changes: 33 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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
];
};
}
);
}
7 changes: 0 additions & 7 deletions release.nix

This file was deleted.

19 changes: 0 additions & 19 deletions shell.nix

This file was deleted.

0 comments on commit 33773f4

Please sign in to comment.