JFYI: My conclusion is that there is too much friction when building Pharo images under Nix.

Nix and Pharo seem to make opposite trade-offs on the reproducibility-vs-convenience axis. Pharo hackers seem to expect a lot of freedom during builds, like unrestricted internet access, and that doesn't really fit with Nix's goal of referentially transparent builds.

Damien Cassou tried to tell me that I was on the wrong track from the beginning but I was too stubborn to listen :).
https://github.com/NixOS/nixpkgs/issues/21715#issuecomment-271239370

So I reckon that I will fall back to using two parallel build/CI systems. I'll build the Pharo images using Jenkins and then import them into Nix as binary blobs. This should work fine. Just means that I depend on two CI systems instead of one and I'll need to maintain my image builds using different tools that my other software builds.

(I will stick with Nix for building the VM for now...)


On 30 June 2017 at 14:27, Luke Gorrie <luke@snabb.co> wrote:
I have done some work on packaging up pharo projects for Nix so that images can be created in the sandboxed build environment. I am a bit stuck though.

I have a script that takes a project named and creates a specification of all the required mcz files, recursing into dependencies:

Here is the spec for a small project, NeoJSON:

[
�� { name �� ��= "ConfigurationOfNeoJSON-SvenVanCaekenberghe.20";
�� �� package = "ConfigurationOfNeoJSON-SvenVanCaekenberghe.20";
�� �� sha256 ��= "0y5yqmb2hjfya2s4a8pkrz0q6pdm01vrfhvfj5knk6slgsy8c2my"; }
�� { name �� ��= "Neo-JSON-Core-SvenVanCaekenberghe.37";
�� �� package = "Neo-JSON-Core-SvenVanCaekenberghe.37";
�� �� sha256 ��= "054hcp1lcriby5a8gpc54gcrd9agbpjv6f0n81bk7f091n9m01z0"; }
�� { name �� ��= "Neo-JSON-Tests-SvenVanCaekenberghe.36";
�� �� package = "Neo-JSON-Tests-SvenVanCaekenberghe.36";
�� �� sha256 ��= "1c3nxi09l785npjypjmzcn5bhy5sswp1agj7pfqs640vg7l80l4k"; }
]

Nix then uses this to construct a package cache directory with a local copy of each mcz file:

$ ls -1 /nix/store/41jbwrsdpcvh684ll3qqk9lcfrrvxy59-pharo-package-cache/
ConfigurationOfNeoJSON-SvenVanCaekenberghe.20.mcz
Neo-JSON-Core-SvenVanCaekenberghe.37.mcz
Neo-JSON-Tests-SvenVanCaekenberghe.36.mcz

So this looks promising: I have all the code and should be able to load it without using the network.

However - I do in practice get an error when I try to do this. I guess Metacello wants to access the network for some reasons I have not anticipated.

Here is my script:

Metacello new
�� configuration: 'NeoJSON';
�� cacheRepository: '/nix/store/rdy7wp3cx4z86wy537idkhjb0q70xzjp-pharo-package-cache/';
�� ignoreImage;
�� load.
Smalltalk saveAs: 'pharo'.
Smalltalk exitSuccess.

and my Metacello error here:��https://gist.github.com/lukego/ab105c257457e7b9a53f6378425df9a8

Any advice to make this work?

(Could I perhaps bypass Metacello entirely and just load the mcz files directly? Guessing not...?)