On Sunday, February 11, 2018 at 9:43:34 PM UTC+8, stewart mackenzie wrote:
> Hello,
> We're partially through the development of a nix{os} utility which 
> transforms an info.rkt into a nix expression.
> https://github.com/clacke/racket2nix
> It'll be helpful if other nixers/racketers could contribute or test the 
> project!

Hi, Racketeers! I'm the one mainly working on this, and I could use some 
help right now. :-)

I have a concrete problem, and I've been banging my head against this for a 
bit, so I hope someone has some insights to share.

First some background:

The way Nix works is, each package has its own directory under /nix/store 
with an FHS-like structure. The directory is called /nix/store/<unique 32 
character hash>-<package name>, so for example we would have a directory 
/nix/store/vawj9y05mlvaflflswd7f7ibw3kj4x92-base/share/racket/pkgs/base , 
where the info.rkt for base would reside.

Now, when I want to build another package I would need that package to find 
racket-lib (in the racket package itself) and base (in the package base). 
What I have been doing, just to get things working, is to `raco pkg install 
--scope-dir /nix/...mypkg/share/racket/pkgs 
/nix/...base/share/racket/pkgs/base`, and so on for each transitive 
dependency of mypkg, and then finally `raco pkg install --copy --scope-dir 
/nix/.../pkgs ./mypkg`.

If you're familiar with the bowels of racket packaging, you are probably 
already seeing a number of issues with this. It "works", as in, I manage to 
build packages that depend on other packages, but it seems that doing 
install on each transitive dependency creates quite a lot of unnecessary 
work, and using --scope-dir the way I am places links.rktd in an unexpected 
place. I'm also having trouble with packages that want to write to 
collects, or copy man pages.

To improve this I'd like to do a number of things:
1. The package I'm currently building probably needs to be the installation 
path for racket, so that I can use installation scope and have links.rktd 
and other things end up in the expected places.
2. As my dependencies and their dependencies have already been installed 
once, and I want to use them from their already-prepared destination, it 
should be possible to just merge together the links.rktd of my dependencies 
and add my own package to the list, and that should be my new links.rktd.

Are you following me so far, or am I already misunderstanding something?

I've finally found that the way to customize where racket finds things is 
to mess about with `racket -G` and the config.rktd file. I was hoping that 
I could just add the share/racket directories of my dependencies to 
'links-search-files, but it doesn't seem that simple.

Here's what I'm currently getting when installing base:

++ /nix/store/hmdy6zq34vq0761l4lym9cl3piw9b6gc-racket-6.12/bin/racket -G 
/nix/store/m5msdbznjzjn0jkrknbk6cswybjqpi4m-base/etc/racket -U -X 
/nix/store/m5msdbznjzjn0jkrknbk6cswybjqpi4m-base/share/racket/collects -S 
-e '
(require setup/dirs)
(display (format "(current-library-collection-links): ~a~n" 
(display (format "(find-library-collection-links): ~a~n" 
(display (format "(find-links-file): ~a~n" (find-links-file)))
(current-library-collection-links): (#f 
(find-library-collection-links): (#f 
++ /nix/store/hmdy6zq34vq0761l4lym9cl3piw9b6gc-racket-6.12/bin/racket -G 
/nix/store/m5msdbznjzjn0jkrknbk6cswybjqpi4m-base/etc/racket -U -X 
/nix/store/m5msdbznjzjn0jkrknbk6cswybjqpi4m-base/share/racket/collects -S 
pkg install --copy --deps fail --fail-fast --scope installation ./base
main.rkt pkg install: missing dependencies;
 specify `--deps search-auto' to install them, or
 specify `--deps search-ask' to be asked about installing them
  for package: ./base
  missing packages:

/nix/store/m5msdbznjzjn0jkrknbk6cswybjqpi4m-base/etc/racket/config.rktd is:
  (share-dir . 
  (links-search-files . ( 
"/nix/store/hmdy6zq34vq0761l4lym9cl3piw9b6gc-racket-6.12/share/racket" ))

I would be very grateful for just a hint or nudge in the right direction. 
I'm happy to already have received a PR on my code style from Felleisen 
himself, and am open to suggestions on everything. I want this to be a tool 
that will benefit the community, not something you will have to fight to 
have any use for it, or something that is too obscure or idiosyncratic for 
anybody to be able to contribute.


You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to