[Nix-dev] Creating dependency trees.

stewart mackenzie setori88 at gmail.com
Fri Jan 22 17:20:56 CET 2016


This is the solution which allows developers to mistakenly create
incorrect dependency trees
https://github.com/sjmackenzie/fractalide/commit/11b383c10c10aebe7093c11d28d2d257b7d61b64

sigh.

On Fri, Jan 22, 2016 at 9:35 PM, stewart mackenzie <setori88 at gmail.com> wrote:
> On Fri, Jan 22, 2016 at 4:48 PM, aszlig <aszlig at redmoonstudios.org> wrote:
>> import "${shinyDerivation}/nix-support/shiny.nix"
>
> So from this subnet implementation: [4]
>
> in => a nand (maths_boolean_nand) out => out
> in => b nand ()
>
> a /tmp/nix-build-maths_boolean_not.drv-*/lib/subnetDeps.nix should be
> generated round about here: [5] (not yet implemented in the link)
> That subnetDeps.nix should be generated on the fly then ${include
> "$(pwd)/lib/subnetDeps.nix"} (<- this doesn't work) during one of the
> phases of [3]. Is this what you suggested?
>
> subnetDeps.nix should contain expressions to import all the
> derivations such as "maths_boolean_nand" and what ever else is used in
> a lib.subnet (anything between the paretheses in lib.subnet).
>
> Alternatively, the developer needs to explicitly describe the
> dependencies such as what I've done with components which have
> capnproto contract dependencies here: [1]
> Here is the interface of such an endeavour: [2]
>
> It's probably better to go with the alternative way. It goes with the
> nix design flow, but it'll cause bugs down the road, if the developer
> forgets to properly write the `filteredSubnets` (for reference see [2]
> the equivalent of `filteredContracts` in [1]) then the build-system
> won't catch missing subnet derivations.
>
> Why will it cause bugs down the line?: Later when `fvm` (the
> fractalide virtual machine [6]) downloads and queries hydra's
> generated MANIFEST file it'll download partial dependencies for the
> subnet (because the subnet developer forgot to properly write the
> subnet deps in `filteredSubnets`) which means a partial dep set will
> be downloaded from hydra's cache and thus the subnet won't execute
> properly!
>
> By far the best way would be to extract the derivation names directly
> from the [4] lib.subnet file, write a
> /tmp/nix-build-maths_boolean_not.drv-*/lib/subnetDeps.nix then import
> that during a buildFractalideSubnet.nix phase, that way if the
> developer made a spelling mistake in the subnet say "...
> nand(maths_boooolean_nand) out ...", the fractalide build would
> immediately fail as it can't find the "maths_boooolean_nand"
> derivation. The alternative way also handles misspelling of subnet
> derivations but does not handle the case of forgotten dependencies.
>
> I'm really sorry if my explanation is too vague or too complex.
>
> [1] https://github.com/fractalide/fractalide/blob/master/build-support/buildFractalideComponent.nix#L91-L93
> [2] https://github.com/fractalide/fractalide/blob/master/components/maths/boolean/nand/default.nix#L6
> [3] https://github.com/fractalide/fractalide/blob/master/build-support/buildFractalideSubnet.nix
> [4] https://github.com/fractalide/fractalide/blob/master/components/maths/boolean/not/lib.subnet
> [5] https://github.com/fractalide/fractalide/blob/master/build-support/buildFractalideSubnet.nix#L16
> [6] https://github.com/fractalide/fractalide/tree/master/fvm


More information about the nix-dev mailing list