Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/development/ocaml-modules/caqti/type-calendar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];

Expand Down
4 changes: 2 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
56 changes: 48 additions & 8 deletions pkgs/top-level/ocaml-packages.nix
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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 { });
Expand All @@ -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}";
})