On Thu, Apr 27, 2017 at 9:33 AM, Eliot Miranda <[hidden email]> wrote:
and maybe its something changed recently in our build, but the nix packaging system I recently tuned in on would seem to solve some of these problem. IIUC, you can rock up anywhere, and replicate the *exact* same build environment on *any* linux machine. Good for setting up partners and new contributors. @Eliot, would this be something worthwhile for me to look into? @Luke, how would you rate the feasibility of a binary built on nix being packaged for other linux distributions? cheers -ben |
On 27 April 2017 at 05:40, Ben Coman <[hidden email]> wrote:
Could be instructive to check out how nix itself is built and distributed. They have a nix expression that builds nix (a C++ application), creates binary tarball/deb/rpm packages for multiple architectures, and tests each one in a virtual machine running the appropriate Linux distro. Code: Products (via CI): How to run the build including all tests in VMs (go for lunch the first time you run it...): $ git clone https://github.com/nixos/nix # Pin the exact same toolchain version as the Nix CI uses $ pkgs=https://github.com/nixos/nixpkgs-channels/archive/05db33f79b8b012107bab29e47f27ce3b8aa4aca.tar.gz$ nix-build -I nixpkgs=$pkgs nix/release.nix (My own experience is that distributing binaries for Linux is a hard problem, even getting glibc to link is fraught with symbol versioning leakage and so on, but guessing you guys know much more about this than I do and that Nix is one of the best tools for the job.) P.S. Great nix paper: Automating System Tests using Declarative Virtual Machines. Explains their approach to CI. Seems to work well. |
On 27 April 2017 at 09:22, Luke Gorrie <[hidden email]> wrote:
... if you really want to run this then it's probably worth giving e.g. '-j 10' to nix-build to parallelize downloads and execution, and also to test from the stable branch of nix instead of the master branch (git clone -b 1.11-maintenance ...). Note: Nix CI is also able to distribute builds across many machines automatically. This can make the big multiplatform builds and tests fast. I usually work with a Nix CI that has ~ 20 build machines and this lets us do nice things like run a machine-week of benchmark regression tests overnight. But I digress... :-) |
On 27 April 2017 at 09:41, Luke Gorrie <[hidden email]> wrote:
I actually ran the nix build process now for the first time myself :). Observations: By default it builds for Linux-i386, Linux-x86-64, and Darwin-x86-64. These platforms are all available in the CI but probably not on your local machine. So could pick a specific attribute to build e.g. '-A deb_ubuntu1604i386' at the end of the nix-build command. Interesting that to setup the VMs it actually _bootstraps_ nearly a dozen Linux distributions e.g. downloads the individual '.deb' files for an Ubuntu release and creates an image using 'debootstrap' with exactly the packages that the test suite wants. They could have otherwise taken a ready-made image from the vendor (with verified sha256 hash) but the bootstrapping seems to allow a lot of control over the build/runtime environment for a test case. Interesting that my machine is actually performing the bootstrapping of these images. In principle it could just download the cached image from the Nix CI because the builds are referentially transparent. I suppose that those binaries are not available, probably because the stable version of nix was built a ways back and its intermediate build/test artefacts have been garbage collected on the CI server. So they are built locally on my machine instead (and then cached until I clear them out here with 'nix-collect-garbage'.) After all the downloading and building it does work for me and produce packages: $ nix-build -j 10 -I nixpkgs=$pkgs nix/release.nix -A deb_ubuntu1604i386 ... lots of activity bootstrapping an ubuntu VM, etc... $ ls result/debs/ nix_1.11.9pre1234-abcdef-1_i386.deb $ file result/debs/nix_1.11.9pre1234-abcdef-1_i386.deb result/debs/nix_1.11.9pre1234-abcdef-1_i386.deb: Debian binary package (format 2.0) |
In reply to this post by Luke Gorrie
On Thursday 27 April 2017 12:52 PM, Luke Gorrie wrote: > How to run the build including all tests in VMs (go for lunch the first > time you run it...): If you have RAM to spare, have you tried mounting tmpfs on the build directory? Regards .. Subbu |
Free forum by Nabble | Edit this page |