mlabs-haskell / lambda-buffers

LambdaBuffers toolkit for sharing types and their semantics between different languages
https://mlabs-haskell.github.io/lambda-buffers/
Apache License 2.0
29 stars 0 forks source link

haskell.nix: One must pick out targets explicitly or infinite recursion hell #139

Closed bladyjoker closed 5 months ago

bladyjoker commented 8 months ago

Check out some of the Haskell build.nix files in the repo...

runtimes/haskell/lbr-prelude/build.nix:

...
   {
      devShells.dev-lbr-prelude-haskell = hsFlake.devShell;

      packages = {

        lbr-prelude-haskell-src = pkgs.stdenv.mkDerivation {
          name = "lbr-prelude-haskell-src";
          src = ./.;
          phases = "installPhase";
          installPhase = "ln -s $src $out";
        };

      } // hsFlake.packages;

      inherit (hsFlake) checks;

    };
}

or

runtimes/haskell/lbr-plutus/build.nix:

      devShells.dev-lbr-plutus-haskell = hsFlake.devShell;

      packages = {

        lbr-plutus-haskell-src = pkgs.stdenv.mkDerivation {
          name = "lbr-plutus-haskell-src";
          src = ./.;
          phases = "installPhase";
          installPhase = "ln -s $src $out";
        };

        lbr-plutus-haskell-lib = hsFlake.packages."lbr-plutus:lib:lbr-plutus";
        lbr-plutus-haskell-tests = hsFlake.packages."lbr-plutus:test:tests";
      };

      inherit (hsFlake) checks;

    };

Ideally one would just inherit hsFlake (packages, devShell, checks) but for SOME reason this ends in infinite recursion encountered.

It's not urgent, but I foresee people being very confused by this.

jaredponn commented 7 months ago

This same problem also appears with Typescript's runtime.

bladyjoker commented 5 months ago

Handled in https://github.com/mlabs-haskell/flake-lang.nix/issues/35