Correctly using directory scope to install packages

Good morning.
I'm currently experimenting with directory scope in Raco with the objective of managing packets in a more efficient way, but I'm stuck with a strange behavior that I can't seem to understand just by looking at the docs.
For what I can comprehend from the config.rkt reference, the following configuration should allow me to use /usr/racketpkgs as a directory scope, therefore allowing me to install packages in it while using the dependencies present in the installation scope:

#hash(
      (doc-dir . "/usr/share/doc/racket")
      (lib-dir . "/usr/lib/racket")
      (pkgs-dir . "/usr/share/racket/pkgs")
      (share-dir . "/usr/share/racket")
      (include-dir . "/usr/include/racket")
      (bin-dir . "/usr/bin")
      (apps-dir . "/usr/share/applications")
      (man-dir . "/usr/share/man")
      (absolute-installation? . #t)
      (compiled-file-roots . (same "/usr/lib/racket/compiled"))
      (build-stamp . "")
      (doc-search-url . "https://download.racket-lang.org/releases/8.8/doc/local-redirect/index.html")
      (catalogs . ("https://download.racket-lang.org/releases/8.8/catalog/" #f))
      (collects-search-dirs . ("/usr/racketpkgs" #f))
      (links-search-files . ("/usr/racketpkgs/links.rktd" #f))
      (pkgs-search-dirs . ("/usr/racketpkgs" #f))
)

The problem, however, is that when I try to run sudo raco pkg install --scope-dir /usr/racketpkgs/ resource-pool-lib (with resource-pool-lib being a simple package I found that only depends on base) Raco prints out

Resolving "resource-pool-lib" via https://download.racket-lang.org/releases/8.8/catalog/
Resolving "resource-pool-lib" via https://pkgs.racket-lang.org
Using cached16825330941682533094018 for https://github.com/Bogdanp/racket-resource-pool.git?path=resource-pool-lib
The following uninstalled packages are listed as dependencies of resource-pool-lib:
   base
Would you like to install these dependencies? [Y/n/a/c/?] n
raco pkg install: missing dependencies
  missing packages:
   base

suggesting that base is not present on my system.
Since base is obviously present in the installation scope, I can only conclude that I did something wrong in the configuration that makes Raco only look for the dependencies in the target directory itself, but since the meaning of the single parameters is not so clear to me, I'm unable to find out what.
Thank you in advance to anyone who can help me with this problem.

What happens if you put the #f first in the list?

Also, shouldn't it be collects-search-dirs . ("/usr/racketpkgs/collects" and pkgs-search-dirs . ("/usr/racketpkgs/pkgs" ?

Thank you for your replies, @xgqt!

Nothing; moving the #f at the first place in the list and re-executing the install command yields the exact same result.

I tried this change too, but it doesn't produce any effect.

"Directory" package scope has turned out to be a very low-level construct. What you want to do is create a Layered Installation, likely a Tethered Installation. Even this is a bit low-level: these features provide the right building blocks for tools, but few uses of them exist yet. If you want something that works out of the box, try Cross-Compilation and Multi-Version Manager: raco cross.

That said, you certainly can use layered and tethered installations to do what you want. Instead of raco pkg install --scope-dir, you will likely use racket --config /path/to/config/dir -l raco -- pkg install resource-pool-lib. If you set up a tethered layer, you can instead start by running racket --config /path/to/config/dir -l raco -- setup, and your layer will get its own racket and raco executables that operate on that layer by default. (Creation of such "tethered" executables etc. is what distinguishes a tethered layer from a non-tethered layer.)

I have some repositories with relatively simple examples of layered installations:

The most extensive use of layers I know of is my packaging of Racket for Guix. Here is the code we currently use to configure layers for our racket-minimal and then racket packages on top of bare-bones internal packages like racket-vm-cs: racket.scm\packages\gnu - guix.git - GNU Guix and GNU Guix System (While the overall license of Guix is GPL-3.0-or-later, I additionally license this code, which I wrote, under Apache-2.0 or MIT, at your option.) Alternatively, here is a more elaborate version I use in my ongoing (albeit slowly) experimental work to expose individual Racket packages as Guix packages, each built in its own layer: wip-gnu/packages/aux-files/racket/guix-racket-build-lib/build/configure-layer.rkt · main · Philip McGrath / guix-racket-experiment · GitLab

2 Likes