Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Automatically determine boot libs that must be overridden #17

Open
kirelagin opened this issue Jun 17, 2018 · 2 comments
Open

Automatically determine boot libs that must be overridden #17

kirelagin opened this issue Jun 17, 2018 · 2 comments

Comments

@kirelagin
Copy link
Contributor

When there is a boot library in extra-deps, we need to find all other boot libraries that we have in our transitive dependencies which depend on this one and override them as well.

@kirelagin
Copy link
Contributor Author

kirelagin commented Jun 17, 2018

Here is a snippet that collects names and expected versions of boot packages.

  sedProgram =
    ''/^name:/N;s/name: (.*)\nversion: (.*)$/"\1" = "\2";/p;'';
  getBootPkgsDrv = ghc:
    pkgs.runCommand "nixage-boot-pkgs" {
      nativeBuildInputs = [ ghc ];
    } ''echo "{" >> "$out"
        ghc-pkg                  \
          --no-user-package-conf \
          dump                   \
        | sed -rne               \
            '${sedProgram}'      \
        >> "$out"
        echo "}" >> "$out"
    '';
  getBootPkgs = ghc: import (getBootPkgsDrv ghc);

  canOverride = n: v:
    !(elem n [
      "ghc"
      "ghc-prim"
      "rts"
      "base"
      "integer-gmp"
    ]);
  getOverridableBootPkgs = ghc: filterAttrs canOverride (getBootPkgs ghc);

@kirelagin
Copy link
Contributor Author

A straightforward implementation of this could be to simply see if our overrides override any of the boot packages and if this is the case, override them all with callHackage (of course before applying overrides form the project spec!).
This will potentially require to rebuild more boot packages than required, but whatever, there are not that many of them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant