nixpkgs/pkgs/development/ocaml-modules/janestreet
sterni 2140791f9b
ocamlPackages.janeStreet{,_0_9_0}: join the ocamlPackages fix point, allowing overriding to work as expected (#113696)
* ocamlPackages.janeStreet_0_9_0: join the ocamlPackages fix point

Internal dependencies in the janeStreet sets were always taken from the
own rec attribute set. While this is pretty simple and convenient, it
has the disadvantage that it doesn't play nice with overriding: If you'd
override an attribute in a janeStreet set previously, it would be
changed when referenced directly, but the other packages in that
janeStreet set still would use the original, non-overridden version of
the derivation.

This is easily fixed by passing janeStreet_0_9_0 itself from the fix
point of ocamlPackages and using it to reference the dependencies.

Example showing it now works as expected:

test-overlay.nix:

    self: super: {
      ocamlPackages = super.ocamlPackages.overrideScope (old: _: {
        janeStreet_0_9_0 = old.janeStreet_0_9_0 // {
          base = old.janeStreet_0_9_0.base.overrideAttrs (_: {
            meta.broken = true;
          });
        };
      });
    }

nix-repl> (import ./. {
  overlays = [ (import ./test-overlay.nix) ];
}).ocamlPackages.janeStreet_0_9_0.stdio

error: Package ‘ocaml4.10.0-base-0.9.4’ in /home/lukas/src/nix/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage.nix:6 is marked as broken, refusing to evaluate.

a) To temporarily allow broken packages, you can use an environment variable
   for a single invocation of the nix tools.

     $ export NIXPKGS_ALLOW_BROKEN=1

b) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.

* ocamlPackages.janeStreet: take part in fixpoint for OCaml >= 4.08

This change makes overrides to the janeStreet set work as expected by
making the janeStreet set take part in the ocamlPackages fixpoint for
janeStreet 0.14, i. e. OCaml >= 4.08

* ocamlPackages.janeStreet: take part in fixpoint for OCaml == 4.07

This change makes overrides to the janeStreet set work as expected by
making the janeStreet set take part in the ocamlPackages fixpoint for
janeStreet 0.12, i. e. OCaml == 4.07

* ocamlPackages.janeStreet: take part in fixpoint for OCaml < 4.07

This change makes overrides to the janeStreet set work as expected by
making the janeStreet set take part in the ocamlPackages fixpoint for
janeStreet 0.11, i. e. OCaml < 4.07

* ocamlPackages.janeStreet: remove self - super distinction

Previously, we inherited non-janestreet ocaml dependencies from super
and janestreet dependencies from self which always was super.janeStreet.

This behavior is however not really what we want due to liftJaneStreet:
Users and other packages will use ocamlPackages.base etc. instead of
ocamlPackages.janeStreet.base and the like. Consequently they also would
override the top-level attributes which would mean that other janestreet
packages would not pick up on it however.

As a consequence however, overriding ocamlPackages.janeStreet.base
doesn't work. Since this was never possible, I don't think this is an
issue. It is probably a good idea to deprecate that set anyways and
printing a warning when it is used via trace.

janeStreet_0_9_0 is unchanged as the disticniton between self and super
makes sense for it.

Below is an example showing how overriding would work from an user's
perspective:

test-overlay.nix:

    self: super: {
      ocamlPackages = super.ocamlPackages.overrideScope (old: _: {
        base = old.base.overrideAttrs (_: {
          meta.broken = true;
        });
      });
    }

nix-repl> (import ./. { overlays = [ (import ./test-overlay.nix) ]; }).ocamlPackages.
stdio
error: Package ‘ocaml4.10.0-base-0.14.0’ in /home/lukas/src/nix/nixpkgs/pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix:12 is marked as broken, refusing to evaluate.

a) To temporarily allow broken packages, you can use an environment variable
   for a single invocation of the nix tools.

     $ export NIXPKGS_ALLOW_BROKEN=1

b) For `nixos-rebuild` you can set
  { nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.

c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowBroken = true; }
to ~/.config/nixpkgs/config.nix.
2021-04-11 12:26:10 +02:00
..
0.12.nix ocamlPackages.janeStreet{,_0_9_0}: join the ocamlPackages fix point, allowing overriding to work as expected (#113696) 2021-04-11 12:26:10 +02:00
0.14.nix ocamlPackages.janeStreet{,_0_9_0}: join the ocamlPackages fix point, allowing overriding to work as expected (#113696) 2021-04-11 12:26:10 +02:00
async-rpc-kernel.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
bin_prot.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
buildOcamlJane.nix ocamlPackages.buildOcamlJane: use opaline 2018-06-06 07:14:25 +00:00
core_bench.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
default.nix ocamlPackages.janeStreet{,_0_9_0}: join the ocamlPackages fix point, allowing overriding to work as expected (#113696) 2021-04-11 12:26:10 +02:00
fieldslib.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
janePackage.nix ocamlPackages.janePackage: don't delete meta set in args 2021-03-10 16:12:03 +01:00
janePackage_0_12.nix ocamlPackages.janePackage: don't delete meta set in args 2021-03-10 16:12:03 +01:00
janePackage_0_14.nix ocamlPackages.janePackage: don't delete meta set in args 2021-03-10 16:12:03 +01:00
js-build-tools-darwin.patch
js-build-tools.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
old.nix ocamlPackages.janeStreet{,_0_9_0}: join the ocamlPackages fix point, allowing overriding to work as expected (#113696) 2021-04-11 12:26:10 +02:00
ppx-assert.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-bench.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-bin-prot.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-compare.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-custom-printf.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-enumerate.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-expect.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-fields-conv.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-here.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-inline-test.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-jane.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-let.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-optcomp.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-pipebang.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-sexp-conv.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-sexp-message.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-sexp-value.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-typerep-conv.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
ppx-variants-conv.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
sexp.patch ocamlPackages.sexp: init at 0.13 2020-10-27 16:04:06 +01:00
sexplib.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
typerep.nix ocamlPackages: remove redundant stdenv imports 2021-01-12 16:33:18 +01:00
variantslib.nix treewide: remove stdenv where not needed 2021-01-25 18:31:47 +01:00