[Nix-dev] NiJS package manager

Sergey Mironov grrwlf at gmail.com
Tue Apr 1 21:11:23 CEST 2014


Hi! Interesting project, but I mostly agree with Colin: asynchronous
programming is hard and in my opinion wouldn't become a 'killer
feature'. More, I am sure there are concepts in functional languages
which will overcome the callback-passing approach of JavaScript. I
think, Haskell's continuation monad is one of such concepts since it
allows writing code with callbacks in a plain imperative manner.

>From the other side, Nix language has some uniq features which I found
to be very strong.

First one is recursive records which allows us to 'tie the knot' so
easily. Various `callPackage' functions use it and it is easy to
define new custom versions for different needs.

The second one is ' '  ...   ' ' (string notation sugar) with
anti-quotations. I don't know other languages supporting this thing
(Haskell is close with it's Template Haskell facilities) and I now
think it is a must have thing for a package management language. I use
this notation here and there for writing safer shell scripts and even
for in-nix C programming. The example [at the end of the letter] may
looks too complicated but it works flawlessly in Nix. In contrast, I
think JavaScript wouldn't give me enough flexibility to allow such
style.

Regards,
Sergey

--


let

mount = "${busybox}/bin/mount";

data_partition = rec {
    name = "Data";
    device = "/dev/sda3";
    mountpoint = "/mnt/${name}";
};

# Shell script snippet
with_mounted_partition = p: fn : ''
    ${mount} ${p.mountpoint}
    (  ${fn p.mountpoint} )
    ret=$?
    ${umount} ${p.mountpoint}
    (exit $ret)
  '';


# A 'safer' shell script
installation_script = writeText "install.sh" ''
    #!${shell}

    #.. a larger script ...

    ${with_mounted_partition data_partition (mp: ''
        cp bzImage ${mp}/kernel/bzImage
    '')}

    #.. continue larger script ..

    '';

in

makeIsoImage {

    buildCommand = ''
     cp ${installation_script} $out
    '';

  }





2014-04-01 14:11 GMT+04:00 Sander van der Burg - EWI <S.vanderBurg at tudelft.nl>:
> Hello Nixers,
>
> After a year of hard work, I proudly want to present you NiJS: the
> asynchronous package manager.
>
> In NiJS, you can use the more popular, innovating and future proof
> JavaScript language to specify package build specifications while still
> having most of the useful goodies that Nix has.
>
> Furthermore, because it's asynchronous and I/O events are non-blocking, it's
> also very fast and highly scalable.
>
> More info:
>
> http://sandervanderburg.blogspot.com/2014/04/asynchronous-package-management-with.html
>
> Best,
>
> Sander
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>


More information about the nix-dev mailing list