fractalide/racket2nix

Workaround: Getting a derviation that can execute Pollen

MazeChaZer opened this issue · 2 comments

Now that the Pollen package builds again there was one last step for me to be able to actually use it with Nix: Getting a derivation where I can execute raco pollen start. Selecting just the pollen package gives me no binaries at all, and unlike with Scribble, there is no pollen-lib package. I poked around a little and found this workaround working for me:

{ pkgs ? import <nixpkgs> {}
, racket2nix ? pkgs.fetchFromGitHub {
      owner = "fractalide"; repo = "racket2nix";
      rev = "073a25e536ed9cc8d7267fc78019992bd171d4cf";
      sha256 = "0s7xp0j2vnwsqc0isbpw8pibdagwh0cai15w5z753wqllliz8qa9";
  }
}:
let pollenPackage = import racket2nix { package = "pollen"; };
    pollen = pkgs.runCommand "pollen" {} ''
        ln -s \
            $(cat ${pollenPackage}/nix-support/propagated-build-inputs) \
            $out
    '';
in pollen

It's not very pretty, but it seems to work and if I don't have any further problems this is fine for now. I read in other issues that perhaps someday there could be a racket.withPackages, at least then this workaround will no longer be necessary. I just wanted to post this here in case someone else wants to use Pollen with racket2nix right now.

I'm surprised that the above works, I'll have to figure out why some day. :-)

Less surprising (but no more documented :-) ) would be to access the lib output of the pollen package. That's where a raco lives that knows about pollen:

{ pkgs ? import <nixpkgs> {}
, racket2nix ? pkgs.fetchFromGitHub {
      owner = "fractalide"; repo = "racket2nix";
      rev = "073a25e536ed9cc8d7267fc78019992bd171d4cf";
      sha256 = "0s7xp0j2vnwsqc0isbpw8pibdagwh0cai15w5z753wqllliz8qa9";
  }
}:
(import racket2nix { package = "pollen"; }).lib

That's what I was talking about in the other issue, but not in as clear and concrete terms.

That is simpler and for me works just as well, thanks :)