diff --git a/flake.lock b/flake.lock index aa12f2919..3d9358514 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -35,9 +35,7 @@ }, "nixpkgs": { "inputs": { - "flake-utils": [ - "flake-utils" - ], + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs_2" }, "locked": { @@ -72,7 +70,6 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nix-filter": "nix-filter", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index 14c4146ea..bb321eab8 100644 --- a/flake.nix +++ b/flake.nix @@ -3,92 +3,98 @@ inputs = { nix-filter.url = "github:numtide/nix-filter"; - flake-utils.url = "github:numtide/flake-utils"; - nixpkgs = { - url = "github:nix-ocaml/nix-overlays"; - inputs.flake-utils.follows = "flake-utils"; - }; + nixpkgs.url = "github:nix-ocaml/nix-overlays"; }; - outputs = { self, nixpkgs, flake-utils, nix-filter }: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages."${system}".appendOverlays [ - (self: super: { ocamlPackages = super.ocaml-ng.ocamlPackages_5_2; }) - ]; - - makeDevShell = { packages, release-mode ? false }: - pkgs.mkShell { - # dontDetectOcamlConflicts = true; - inputsFrom = pkgs.lib.attrValues packages; - nativeBuildInputs = - with pkgs.ocamlPackages; [ ocamlformat pkgs.nodejs_latest ] - ++ pkgs.lib.optionals release-mode (with pkgs; [ - cacert - curl - ocamlPackages.dune-release - ocamlPackages.odoc - git - ]); - propagatedBuildInputs = with pkgs.ocamlPackages; [ merlin ]; - }; - in - - rec { - packages = with pkgs.ocamlPackages; rec { - reason-react-ppx = buildDunePackage { - pname = "reason-react-ppx"; - version = "n/a"; - src = with nix-filter.lib; filter { - root = ./.; - include = [ - "dune-project" - "dune" - "reason-react-ppx.opam" - "reason-react.opam" - "ppx" - ]; + outputs = { self, nixpkgs, nix-filter }: + let + forAllSystems = f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system: + let + pkgs = nixpkgs.legacyPackages.${system}.extend (self: super: { + ocamlPackages = super.ocaml-ng.ocamlPackages_5_2.overrideScope (oself: osuper: { + ppxlib = osuper.ppxlib.overrideAttrs (o: { + propagatedBuildInputs = o.propagatedBuildInputs ++ [ osuper.stdio ]; + }); + }); + }); + in + f pkgs); + in + { + packages = forAllSystems (pkgs: + let + inherit (pkgs.ocamlPackages) + buildDunePackage melange merlin ppxlib reason; + packages = rec { + reason-react-ppx = buildDunePackage { + pname = "reason-react-ppx"; + version = "n/a"; + src = with nix-filter.lib; filter { + root = ./.; + include = [ + "dune-project" + "dune" + "reason-react-ppx.opam" + "reason-react.opam" + "ppx" + ]; + }; + # Due to a Reason version mismatch, the generated OCaml PPX diff + # looks different + doCheck = false; + checkInputs = [ ]; + checkPhase = "dune build @runtest -p reason-react,reason-react-ppx"; + nativeCheckInputs = [ reason merlin pkgs.jq ]; + propagatedBuildInputs = [ ppxlib ]; }; - # Due to a Reason version mismatch, the generated OCaml PPX diff - # looks different - doCheck = false; - checkInputs = [ ]; - checkPhase = "dune build @runtest -p reason-react,reason-react-ppx"; - nativeCheckInputs = [ reason merlin pkgs.jq ]; - propagatedBuildInputs = [ ppxlib ]; - }; - reason-react = buildDunePackage { - pname = "reason-react"; - version = "n/a"; - src = with nix-filter.lib; filter { - root = ./.; - include = [ - "dune-project" - "dune" - "reason-react-ppx.opam" - "reason-react.opam" - "src" - "test" - ]; + reason-react = buildDunePackage { + pname = "reason-react"; + version = "n/a"; + src = with nix-filter.lib; filter { + root = ./.; + include = [ + "dune-project" + "dune" + "reason-react-ppx.opam" + "reason-react.opam" + "src" + "test" + ]; + }; + doCheck = true; + nativeBuildInputs = [ melange reason ]; + propagatedBuildInputs = [ melange reason-react-ppx ]; }; - doCheck = true; - nativeBuildInputs = [ pkgs.ocamlPackages.melange reason ]; - propagatedBuildInputs = [ - pkgs.ocamlPackages.melange - reason-react-ppx - ]; }; + in + packages // { default = packages.reason-react; }); - default = packages.reason-react; - }; - - devShells = { + devShells = forAllSystems (pkgs: + let + makeDevShell = { packages, release-mode ? false }: + pkgs.mkShell { + # dontDetectOcamlConflicts = true; + inputsFrom = pkgs.lib.attrValues packages; + nativeBuildInputs = + with pkgs.ocamlPackages; [ ocamlformat pkgs.nodejs_latest ] + ++ pkgs.lib.optionals release-mode (with pkgs; [ + cacert + curl + ocamlPackages.dune-release + ocamlPackages.odoc + git + ]); + propagatedBuildInputs = with pkgs.ocamlPackages; [ merlin ]; + }; + packages = self.packages.${pkgs.system}; + in + { default = makeDevShell { inherit packages; }; release = makeDevShell { inherit packages; release-mode = true; }; - }; - }); + }); + }; }