Is there a way to build Pants in a sandbox? I want...
# general
Is there a way to build Pants in a sandbox? I want to create a package for [Nix](, and it builds everything in a sandbox to ensure reproducibility.
building pants from source involves downloading a fair number of tools… it currently manages its own copy of rust in a cache directory
we’d be happy to help patch the bootstrap scripts to allow overriding that to use Nix’s copies instead?
the two things that would be likely to need adaptation are: 1. creating a virtualenv for pants to build itself in… there are probably Nix conventions for this 2. adapting to use Nix’s tools
let me know how this goes...i'm more interested in the inverse...using pants to build nix pacakges, but this sounds interesting anyways
Another option is pre-fetching everything before building inside a given directory. A fixed output derivation can run arbitrary commands, the only requirement is the output must be reproducible, because it's verified by hash.
yea, prefetching is likely also an option.
the rough idea is that checking out an arbitrary SHA of and then running the
script will bootstrap all of the tools necessary to run from source. you can then use that copy of pants to build a PEX of pants
build-support/bin/ -q
will build a PEX locally (needs network access for the venv and cargo tools, as mentioned above)
Building in a fixed-output derivation is not a very good idea, it's main purpose is to fetch sources to be used as an input for a normal derivation.
yea, i don’t have any experience with Nix, but the concepts of reproducible builds are quite clear, because we try to apply them in Pants as well
happy to help change our scripts however is necessary to help you!
Nix is indeed very similar to tools like bazel, please or pants.
Except it's a package manager and uses a lazy functional language instead of Python.
are lazy and pure as well!
anywho. i would try out
build-support/bin/ -q
and see what is missing from the Nix environment… from there we’ll be happy to help!