[Vm-dev] Fwd: Nix package for Pharo flavor of opensmalltalk-vm

Luke Gorrie luke at snabb.co
Mon Apr 17 20:13:27 UTC 2017


Hoi,

Just summarizing the "Pharo 6 snap install" thread from -users and -dev
list,

I made a nix package for the latest (git master) Pharo VM with much help
from the mailing list.

If you first install nix:

curl https://nixos.org/nix/install | sh


Then it's easy to install the package from my development branch:

nix-env -f https://github.com/lukego/nixpkgs/archive/pharo6.tar.gz -iA
pkgs.pharo-vm


and then you can run it with pharo-vm-x (or pharo-vm-nox for headless.)

Nix is a bit special. It will make a deep copy of all the dependencies
including libcairo, glibc, etc. This means that it really should work the
same on your computer as on mine, and it should also work the same if you
run that command 5 years from now. (Like a cross between apt-get and
docker.) The dependencies and be updated and debugged in a disciplined way
(see example cute trick <https://github.com/lukego/blog/issues/17>.)

Here is the source for the build script:
https://github.com/lukego/nixpkgs/blob/pharo6/pkgs/
development/pharo/vm/build-vm.nix

This is based on the mvm script for Pharo. On the one hand it's simpler
because nix takes care of all the third-party dependencies automatically,
but on the other hand it's complicated because nix builds have to be
referentially transparent and can't use curl, whoami, date, git, etc. There
are also potentially many versions of each program installed on the machine
and so you can't use global names like /bin/rm but rather have to rely on
$PATH to give you the right one.

So I made some straightforward adaptations to accommodate nix, and also
e.g. to avoid building with gcc5 which crashes during compilation.

My script is based on work by Damien Cassou who packaged an earlier version
of the VM and has since moved on to other projects. I picked up the
maintainership from him and will send this package to nix upstream once I
test it a little better.

Why bother packaging the Pharo VM with nix? There are a few reasons for me.
I already run NixOS and the Pharo binaries don't work there. Building from
source takes more work than 'configure && make install' so it's worth
automating. I'm not comfortable with the zeroconf installers because they
feel opaque and I am never quite sure what software I am running on each
machine. And I want to build a large application including Pharo + many
other components and I need a tool to keep me out of dependency hell.

Some open issues for me:

I'd like to be able to run the test suite, e.g. test runner for Pharo 6
image, and get a pass/fail result with no user interaction. I could have
the nix upstream CI do this to check for breakages when dependencies are
updated. Is there an easy way to do that? (How?)

I'd like to remove the warning asking for realtime scheduling at startup. I
feel that cost/benefit is too high. The message is scary and it's the very
first interaction with a new user. The instructions don't work on all
distros e.g. not on NixOS. Playing with realtime scheduler priorities can
have unintended consequences and has to be considered in context of the
whole machine. I'd expect the default scheduler to provide decent latency
with default settings e.g. ~10ms from event (?). So the benefits seem
uncertain to me, but I don't want to do something that will degrade the
user experience downstream and reflect badly on Pharo. I am open to words
of caution. (I hate it when people package _my_ software and take artistic
license.)

I have to think more about which VM variants to provide and how much magic
to employ in choosing the right one when opening an image. Just now I am
providing the 32-bit Spur VM by default and that seems to work with most
images. I also have the 64-bit Spur VM as an option for people who
specifically want to run 64-bit images. Do I need to provide more VMs?
Which interesting Pharo images would I _not_ be able to run using the
32-bit Spur VM? Feedback would be welcome.

Have to think about whether to support MacOSX. Probably. I wrote support
for it in the script but haven't tested it yet.

More on Nix: gentle introduction
<https://www.infoq.com/articles/configuration-management-with-nix> and deep
dive thesis <https://nixos.org/~eelco/pubs/phd-thesis.pdf>. This is the
best new technology that I have stumbled upon in the past couple of years.

Cheers!
-Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20170417/189cc4ef/attachment.html>


More information about the Vm-dev mailing list