[Nix-dev] Using Nix as a package manager (for yet another language)

stewart mackenzie setori88 at gmail.com
Fri Feb 12 18:38:08 CET 2016


If you don't mind I'll use this thread as the umbrella "nix as yet
another language package manager" issue thread.

I want to do this:

create a derivation that creates a shell file.
This shell file does one thing and one thing only: it creates a custom
virtual machine depending on the inputs of the flow-based programming
file.
(later I'll implement a recursive decent function which determines the
transitive deps of a flow-based programming file.
<tangential information>
This fbp file consists of exactly two dependencies:
'maths_boolean:(boolean="true"' -> a nand(maths_boolean_nand) output
-> input disp(maths_boolean_print)
'maths_boolean:(boolean="true"' -> b nand()

1) maths_boolean_nand :
https://github.com/sjmackenzie/fractalide/tree/fractalide/components/maths/boolean/nand
2) maths_boolean_print :
https://github.com/sjmackenzie/fractalide/tree/fractalide/components/maths/boolean/print

Both of these libraries are shared libraries programmed in the Rust
programming language.
</tangential information>

I need to ensure the below user experience:

$ git clone git://github.com/sjmackenzie/fractalide (fractalide branch)
$ nix-build          -----> creates a sh file, and copies a snapshot
of the current state of the fractalide codebase to /nix/store/
$ ./result/bin/fvm ~/path/to/fbp/file.subnet        -------> pass the
fbp file to the sh script, the sh script compiles a custom virtual
machine with all the deps then
immediately executes the subnet

If the fvm is installed via
$ nix-env -iA nixos.fvm

whenever one runs
$ fvm ~/path/to/fvm.fbp (where the *.fbp has continuously changing
contents, a new fvm with exactly those deps are compiled, symlinked
then executed.)

This is what I have... and it sucks batshit:
The problem lies here:
https://github.com/sjmackenzie/fractalide/blob/fractalide/default.nix#L21

What am I doing wrong?

This approach allows fvm to be lazily evaluated, thus allowing the
repo to expand massively (similarly to nixpkgs) without having to
compile everything up front.
This is an extremely desirable feature, as rust compilation times are
cause for suicide.

>From a higher level: does anyone have a better suggestion on
approaching this kind of system? The we're all trail blazing and it
would be good to head bang.

/sjm


More information about the nix-dev mailing list