[Ur] Nix-based deployment of Ur/Web application
Sergey Mironov
grrwlf at gmail.com
Sat Feb 13 17:35:59 EST 2016
I'm glad to report that there are some encouraging results, achieved
in the development of build system for Ur/Web. Nix[1] is both a
general purpose package manager and a functional language designed to
describe dependencies between packages. Luckily, it also can do all
the things, GNU Make normally does. The idea was to develop a set of
Nix combinators, which would allow user to build Ur/Web applications
as easy as possible.
The project location is
https://github.com/grwlf/urweb-build
Currently, the only nixified application is Oilprice [2]. Originally,
it was a hard task for user to build it, because Oilprice depends on 5
Ur/Web libraries which have their own dependencies too. Also, don't
forget about Ur/Web itself. More often than not we are to compile it
manually.
Urweb-build makes it possible to obtain the sources and immediately
build the application with a single command:
$ git clone https://github.com/grwlf/oilprice; cd oilprice; git
submodule update --init --recursive
$ nix-build build.nix
...
$ ls -l result
result -> /nix/store/36axkqc83wfg4bx4bvh4vvm7g0s1wfi5-urweb-urp-Oilprice
$ ./result/Oilprice.exe
Note, that the only prerequisites for this operation are Urweb-build
and Nix package manager. nix-build takes care of urweb and all its
dependencies including Postgres. It comes with NixOS Linux
distribution. For other distributions one may install it as usual.
[1] - http://nixos.org/nixos/about.html
[2] - https://github.com/grwlf/oilprice
Regards,
Sergey
PS
I had another build tool Cake (Haskell-based) which is deprecated now.
urweb-build still depends on it, but soon this dependency will gone.
More information about the Ur
mailing list