[Nix-dev] Nix for internal projects and monorepos

Rok Garbas rok at garbas.si
Mon Mar 27 11:27:43 CEST 2017


At Mozilla Release Engineering team we have a sort of mono-repo with multiple deployments since we are managing a growing number of smaller internal services.

https://github.com/mozilla-releng/services

(1) each project resides in ``src/<name>``
(2) there is a Makefile (which we will soon replace with something nicer) which lets you do
(2.1) ``% make develop APP=<name>`` <- enter nix-shell
(2.2) ``% make develop-run APP=<name>`` <- run application in development mode
(2.3) ``% make build-app APP=<name>`` <- build an app aka. nix-build
(2.4) ``% make build-docker APP=<name>`` <- build docker image with application inside (used 
(2.5) ``% make deploy-staging APP=<name> ...secrets...`` <- deploy code to staging environment
(2.6) ``% make deploy-production APP=<name> ...secrets...`` <- deploy code to production environment
(3) all nix stuff is located in ``nix/`` folder so that nobody is scared :)

Currently, the only supported platform is Linux. In next weeks we will add an option (for development when nix is not installed) to use nix within docker which would give us an easy way to enable development on other platforms.

One important lesson I learned is that Nix is not easy to install. The installation script failed on some occasions (mostly due to a very custom environment). Also, you probably will want your users to have multi-user installation to avoid "works on my computer". Using Nix via docker is a currently (sadly) the easiest way.

I'll stop here since this is getting to long, but if there are any questions feel free to ping me.

-- Rok
> On 27 March 2017 at 06:21 Tikhon Jelvis <tikhon at jelv.is> wrote:
> 
> 
> I'm not the person who implemented it, so I can't say much. Understanding
> how it works is on my todo list, but has been a low priority thanks to an
> upcoming deadline :).
> 
> I believe my colleague is working on a writeup about it, and we would
> definitely like to open source parts of it when we can.
> 
> On Sat, Mar 25, 2017 at 6:02 PM, Luke Clifton <ltclifton at gmail.com> wrote:
> 
> >
> >
> > On 26 Mar. 2017 3:17 am, "Tikhon Jelvis" <tikhon at jelv.is> wrote:
> >
> > Instead, we're shipping statically linked Haskell executables that are
> > then run with Hadoop. Building statically linked Haskell binaries with Nix
> > was a bit of a pain, but now that it works deployment is easy. Also, it
> > still doesn't build statically on OS X, but we don't care because we're not
> > deploying to OS X servers :).
> >
> >
> > Building statically linked Haskell binaries with Nix has been on my todo
> > list for a while now. Any hints?
> >
> >
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev

-- Rok Garbas, https://garbas.si


More information about the nix-dev mailing list