[Nix-dev] bring into scope only required deps

stewart mackenzie setori88 at gmail.com
Tue Aug 16 09:01:30 CEST 2016


Hello,

The fractalide repository consists of N components that can be
combined in Z different ways, called a subnet. A subnet represents a
normal application you are used to executing.

one tells the repository to build Z subnet via this command:

$ nix-build [other args] --argstr subnet test_sjm
or
$ nix-build [other args] --argstr subnet app_growtest
etc

Each component in a subnet connects with another component via a
capnproto contract.

A special component called contract_lookup has knowledge about the
file system path of every contract. This knowledge is needed for the
component oriented language to do "dynamic" lookups.
example: [1] notice the 'maths_boolean:(boolean=true)' that is a
contract called `maths_boolean` [2]

Problem: the component contract_lookup [3] is dependent on all
contracts [4]. When distributing the graph of components I want
contract_lookup to only see contracts that are used within the Z
subnet.

I don't want contract_lookup to be dependent on every single
contracts, because as the system grows and more contracts are added it
would mean I have to distribute every contract for Z subnet.
This is mental.

Is there a way I can somehow query the top level rust program [5] and
ask for only those contracts that are being used, then pass it into
the contract_lookup which will write the rust hashmap? [3]

(currently the rustUnstable.rustc on nixos-unstable is broken so
you'll need to use
$ nix-build --argstr debug true --argstr subnet test_sjm -I
nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/125ffff089b6bd360c82cf986d8cc9b17fc2e8ac.tar.gz
)

Kind regards
Stewart

[1] https://github.com/fractalide/fractalide/blob/master/components/test/sjm/default.nix#L9
[2] https://github.com/fractalide/fractalide/blob/master/contracts/maths/boolean/contract.capnp
[3] https://github.com/fractalide/fractalide/blob/master/support/contract_lookup/default.nix#L11-L13
[4] https://github.com/fractalide/fractalide/blob/master/contracts/default.nix
[5] https://github.com/fractalide/fractalide/blob/master/support/vm/default.nix


More information about the nix-dev mailing list