diff --git a/pkgs/development/ocaml-modules/caqti/type-calendar.nix b/pkgs/development/ocaml-modules/caqti/type-calendar.nix index d2050e2cf4743..336af15e18413 100644 --- a/pkgs/development/ocaml-modules/caqti/type-calendar.nix +++ b/pkgs/development/ocaml-modules/caqti/type-calendar.nix @@ -4,7 +4,7 @@ buildDunePackage { pname = "caqti-type-calendar"; version = "1.2.0"; useDune2 = true; - inherit (caqti) src; + inherit (caqti) minimumOCamlVersion src; propagatedBuildInputs = [ calendar caqti ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 03fcbd4d10120..b9bef69b54084 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10843,10 +10843,10 @@ in ocamlPackages = ocaml-ng.ocamlPackages_4_05; }; - ocaml-ng = callPackage ./ocaml-packages.nix { }; + ocaml-ng = recurseIntoAttrs (callPackage ./ocaml-packages.nix { }); ocaml = ocamlPackages.ocaml; - ocamlPackages = recurseIntoAttrs ocaml-ng.ocamlPackages; + ocamlPackages = ocaml-ng.ocamlPackages; ocaml-crunch = ocamlPackages.crunch.bin; diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index a0556ccecb161..faec90199c2e3 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -1,10 +1,51 @@ { lib, newScope, pkgs, config }: let + defaultVersion = [ "4" "10" ]; + liftJaneStreet = self: super: super.janeStreet // super; + whitelist = ocamlVersion: [ + "ocaml" + "dune_2" + "stog" + "google-drive-ocamlfuse" + "hol_light" + "dune-release" + "reason" + "bap" + "findlib" + "ctypes" + ] ++ lib.optionals (lib.versionOlder ocamlVersion "4.12") [ + "dune_1" + ]; + + # override setting hydraPlatforms = [] for all packages in + # ocamlPackages except a few whitelisted ones + normalPkgsNoHydra = self: super: + let + isDefaultVersion = v: + lib.take 2 (lib.splitVersion v) == defaultVersion; + transformAttr = name: value: + let + allowedAttrs = whitelist super.ocaml.version; + in + if lib.elem name allowedAttrs || !lib.isDerivation value + then value + else value // { + meta = (value.meta or {}) // { + hydraPlatforms = []; + }; + }; + in + if isDefaultVersion super.ocaml.version + then super # default set gets no special treatment + else lib.mapAttrs transformAttr super; + + overrides = lib.composeExtensions liftJaneStreet normalPkgsNoHydra; + mkOcamlPackages = ocaml: - (lib.makeScope newScope (self: with self; + (lib.makeScope newScope (self: with self; (lib.recurseIntoAttrs { inherit ocaml; @@ -1396,11 +1437,10 @@ let hol_light = callPackage ../applications/science/logic/hol_light { }; - })).overrideScope' liftJaneStreet; - -in let inherit (pkgs) callPackage; in rec -{ + }))).overrideScope' overrides; +in let inherit (pkgs) callPackage; in lib.fix +(self: { ocamlPackages_4_00_1 = mkOcamlPackages (callPackage ../development/compilers/ocaml/4.00.1.nix { }); ocamlPackages_4_01_0 = mkOcamlPackages (callPackage ../development/compilers/ocaml/4.01.0.nix { }); @@ -1427,7 +1467,7 @@ in let inherit (pkgs) callPackage; in rec ocamlPackages_4_12 = mkOcamlPackages (callPackage ../development/compilers/ocaml/4.12.nix { }); - ocamlPackages_latest = ocamlPackages_4_12; + ocamlPackages_latest = self.ocamlPackages_4_12; - ocamlPackages = ocamlPackages_4_10; -} + ocamlPackages = self."ocamlPackages_${lib.concatStringsSep "_" defaultVersion}"; +})