Nix at LumiGuide

Video thumbnail (Frame 0) Video thumbnail (Frame 1636) Video thumbnail (Frame 2194) Video thumbnail (Frame 2740) Video thumbnail (Frame 3278) Video thumbnail (Frame 4451) Video thumbnail (Frame 8506) Video thumbnail (Frame 9112) Video thumbnail (Frame 9877) Video thumbnail (Frame 10657) Video thumbnail (Frame 11416) Video thumbnail (Frame 15294) Video thumbnail (Frame 16861) Video thumbnail (Frame 17836) Video thumbnail (Frame 18627) Video thumbnail (Frame 20895) Video thumbnail (Frame 22474) Video thumbnail (Frame 24856) Video thumbnail (Frame 27208) Video thumbnail (Frame 28683) Video thumbnail (Frame 29246) Video thumbnail (Frame 40812) Video thumbnail (Frame 41623)
Video in TIB AV-Portal: Nix at LumiGuide

Formal Metadata

Nix at LumiGuide
Title of Series
CC Attribution 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Release Date
Production Year

Content Metadata

Subject Area
LumiGuide develops and maintains bicycle and car parking guidance systems that are deployed in various cities in the Netherlands and abroad. To run this system a number of different machines are needed: image analysis servers deployed locally in facilities, central web-servers and support servers in data centers, embedded machines like Raspberry Pi's and ARM FPGA's to power our various displays in facilities and on the streets. Finally our engineers have workstation to write our software. All these machines need to be developed, tested, provisioned, configured, installed and rolled back (in case we make a mistake). Since we don't have a dedicated sys-admin we rely on automation to do most of these tasks. We use the Nix ecosystem of tools to help us with that. I will talk about how we've structured our mono-repository, how we make sure each engineer uses the exact same version of nixpkgs and the exact same NixOS configuration, how we override our Haskell packages, how we use Continuous Integration wit hydra and how we deploy our machines using nixops. Finally I will also talk about the things that we don't like about the Nix ecosystem.
Functional programming Programmer (hardware) Software engineering Electronic program guide Bus (computing) Videoconferencing Musical ensemble Client (computing)
Sign (mathematics) Computer worm Digital signal Plastikkarte
Sign (mathematics) Computer network Musical ensemble Physical system
Mereology Musical ensemble Physical system Physical system
Laptop Statistics Server (computing) Mobile app Electric generator Mapping Software developer Multiplication sign Workstation <Musikinstrument> Information systems Virtual machine Client (computing) Measurement Machine vision Neuroinformatik Web application Data management Pi Internetworking Single-precision floating-point format Data center Right angle Physical system Task (computing)
Repository (publishing) Mixed reality Data structure Template (C++)
Point (geometry) Graphical user interface Debugger Sieve of Eratosthenes Database Physical system Front and back ends
Workstation <Musikinstrument> Functional (mathematics) Link (knot theory) Computer file Link (knot theory) Workstation <Musikinstrument> Binary code Set (mathematics) Image registration Mereology Attribute grammar Neuroinformatik Revision control Repository (publishing) Personal digital assistant Order (biology) Software repository Revision control Configuration space Configuration space Physical system Cloning
Module (mathematics) Cone penetration test Patch (Unix) Line (geometry) Patch (Unix) Electronic mailing list Code Branch (computer science) Bit Open set Revision control Software repository Information security Social class Point cloud
Workstation <Musikinstrument> Functional (mathematics) Scripting language Trail Patch (Unix) Patch (Unix) Computer file Revision control Uniform resource locator Hash function Interactive kiosk Software testing Website Default (computer science)
Scripting language Module (mathematics) Computer file Patch (Unix) Server (computing) Patch (Unix) Mass Bit Revision control Software repository Default (computer science) Data buffer Elasticity (physics)
Point (geometry) Computer file Patch (Unix) Software developer Multiplication sign Computer program Virtual machine Bit Complete metric space Type theory Repository (publishing) Gastropod shell Abstraction
Scripting language Default (computer science) Building Link (knot theory) Multiplication sign Source code Computer program Virtual machine Core dump Bit Rollback (data management) Complete metric space Statistics Virtual machine Type theory Cache (computing) Repository (publishing) Operator (mathematics) Gastropod shell Figurate number Physical system
Point (geometry) Flock (web browser) Suite (music) Multiplication Module (mathematics) Link (knot theory) Patch (Unix) Building 1 (number) Maxima and minima Wave packet Product (business) Number Word Process (computing) Software Different (Kate Ryan album) Password Software testing Software testing output Mathematical optimization
Scripting language Workstation <Musikinstrument> Touchscreen Execution unit Server (computing) Scripting language Zoom lens Virtual machine Bilderkennung Bit Function (mathematics) Centralizer and normalizer Interactive kiosk Software testing Software testing Website Traffic reporting Default (computer science)
Presentation of a group Scripting language Multiplication sign Rollback (data management) Sign (mathematics) Electronic visual display Office suite Endliche Modelltheorie Physical system Overlay-Netz Workstation <Musikinstrument> Service (economics) Rollback (data management) Statistics Virtual machine Skelettieren <Bildverarbeitung> Type theory Software repository Repository (publishing) Computer cluster Configuration space Software testing Moving average Right angle Physical system Booting Web page Point (geometry) Dialect Server (computing) Computer file Monad (category theory) Patch (Unix) Virtual machine Directory service Number Revision control Goodness of fit Pi Cache (computing) Rootkit System programming Software testing Traffic reporting Form (programming) Default (computer science) Module (mathematics) Default (computer science) Execution unit Demon Server (computing) Client (computing) Computer network Event horizon Error message Musical ensemble Electronic visual display Window Address space
Musical ensemble
our next speaker is bus CTO of luma guide
he's a functional programming enthusiast
and has been a Haskell programmer for fifteen years three years ago he decided to try Nick's at luma Guide I love stuck at next home and this is actually my first I really liked it so yeah next halloumi guys so we are a very small company we're about 10 people we have three full-time software engineers including myself and my colleague actually Falco is sitting in the back he is also a next contributor at our company basically to set the stage I'd like to begin with a small of a short video about what we do a little guide it was produced by the city of Utrecht which is one of our clients so let's see if if the sound is working [Music]
and you can see kind of what the problem that we have in the Netherlands if this facility is like nearly fool like 80 percent fool then if you come here then yeah you need really need some kind of guidance system that tells you where there's a free place to park your bicycle and what you can see there our sensors are mounted to the ceiling they're basically cameras and they see where the free places are so how does
our system work and so I have a kind of a schematic here what you see at the top are the facilities in the facilities we have this sense of system cameras they are connected to a facility server so a local computer that does all the computer vision work and then the server uploads is its measurements to a central system which is hosted at a professional data center somewhere on the internet actually it's hosted at hats nerve I think not too far from Munich you yes and this central system those are a few things so it provides it serves an API that are that turret that is used by third parties and also by our own smartphone apps and then you see on the right it also serves a web-based management information system that our clients use to see you know how is my facility being used and yeah you can see all kinds of statistics and you can see like a live map of the facility and then finally the most important thing is that this system drives the this place that that are mounted in facilities and our almost streets in Utrecht so how does next fit in into this picture well all the computers all the machines in the in this system are running next to us so first of all the facilities are running next to us our central server is running next to us and this is not just a single server it's like a cluster and/or a bunch of machines that do kind of support tasks we have our Hydra server also there and then finally the displace themselves are also running Nix OS so these these are actually so the first generation were raspberry PI's so it's an aram machine the the the next generation of our jet this place is running house of gold's fpga sock so it's kind of like an a ram device with an FPGA attached to it and then the FPGA is driving the this place and then the a ram chip is running next to us oh yes and the last but not least our workstation so the laptops that that we use for developments are also running next to us actually this is my workstation it's currently it's also a Mac so it's running OSX but I have Nexus running natively on this as well and then I have also like a VirtualBox
running next to us last week I switched to 1709 yay it took me about a month to actually upgrade also like yeah not nothing like I wasn't like working for a month but there are a few broken packages that I had to wait before they were merged with I was took her quite some time right so
yeah I've been using you next now for the last three years but when I started I like I really had no idea how to kind of structure our repository and to kind of mix if I it so I think what would have helped me back then was if I had some kind of templates that I could use and I think Doman also mentioned that in his talk that we need to have some kind of example that you can start from so
three weeks ago Peter Simonson I organized the workshop in London at the high school exchange where we teach people next and for that I prepared this next to do example and I think Jonas also created that next to do or a kind of a to do NPC example so we kind of maybe we should team up to make it better but yeah this is basically the template that I would like to have three years ago and if this is actually a
running system it's just it's just an example that you can have something to play with just to show that it actually works I have it here yeah so you can add
to-do items and then you can you know do this there's actually a high school front end which is compiled to JavaScript and it has a high school back-end with a database that are storing these to-do items but the point of this is that yeah that you have something real to play with and then you
can just copy this and then adapt it to your own company yeah if you're
interested check it out you can clone it on your URL just to go back to to our
workstations we are a small company so we have kind of an extreme situation that everybody is running actually the next OS and we go even further our registration configurations are actually stored in our company repository so everybody all engineers have their configuration in the repository and the way we do that is we puts this next to us config attributes in the next part and then when you do an X well next to us rebuild switch next to us we'll take this configuration to be your system configuration and this is a actually a link that is put inside our repository and this actually points to the actual file of an engineer which is committed in the repository so in this case it points to my my VirtualBox configuration which is running this system here and then if you look in that file all engineers they have like their own customizations but what all of them have in common is that they import this base layer and that's this base layer yeah configure some shared settings like it computer our own binary cash so that people don't have to set it up themselves and a whole order all over a bunch of things yeah the Jonas & Dolman both talked about pinning next packages I'm not going to tell that much about it but yeah it's clearly important you want to make sure all engineers were in the same version of next packages we can diffuse the currently old approach where we call the fetch from github function and you just pass a revision which is actually coming from this JSON file which you can get using an extra fetch get yeah and we saw the problems with that this this actually depends on this next packages that that expected is in your path and as of course kind of impure but this works for us actually I do intend to switch to this new approach
that Gabriel wrote in this in this pool request and of course when we go to next
112 we will can do this nice thing and then you can just skip the whole whole fetch from yeah you can it's much easier one thing I do like to say about this approach is what we actually do as maybe you'll find this out yourself but if you depend on next packages you often want to the often maybe have some pull request open with some fixtures fixes too so next class module and you actually want to use that at your company but it's not yet merged in next packages so what you could do is you could you can maintain your own branch of next packages and rebase all your pool requests on a branch and then put that here after in this revision and then that will work but it's kind of cumbersome to kind of keep maintaining this branch so what we did is we provide actually a list of patches so if I scroll down a bit you have these
patches here we use the fetch patch function and you just pass this URL to a gets hope to a git commit and if you post fix it with dope patch you actually get a patch file and you give it a hash and then what we do is we so we take the original next packages function and then we run all the patches on it we apply all the patches and then you get your patch version of next packages and I have found out I think this is more maintainable than maintaining your own Fork and just gives an example so this
is actually oh let's see oh no I
actually have it here if you look at our
actual file which we had a before last last week because now our patches are empty because we switched to the new release but this is these are all the packages that you actually have in here that's quite a lot but yeah I think this is a bit more easy easy to maintain than
a 10 a fork ok so so at a company we
have basically two people me and Anne so who are the kind of Nick's guys but all our engineers they don't really care about next they just care that it works but not really how it works so the very first thing I did was I kind of made a make file that had all the commands that you typically need to do like entering a development shell building a package deploying a machine using neck soaps but then with kind of familiar names and we use this for a long time but make files they have a bit of a few abstraction problems they are quite hard to kind of abstract so if you want to like have a target for every Haskell package that it is possible that's but it's a bit hard to do so at some point we decided to go to do Haskell - to have try and make kind of a haskell command that you can invoke and then which will do all the things that you need to do and a very important thing that we had from the make files its completion so when you're in your your shell you can type make and I for example machine dub deploy and it will complete that so you don't have to type it in all the time and that saves a lot of time and we did want to have this in our new lumi tool this Haskell tool and I'm just going to show quickly how this works so I'm in my repository here so by
the way if I'm just somewhere on my faucet I can type in lumi and it will jump to my to our repository and then for example you can say ok we have the machine called zeus and you here you can see the completion working and say choose for example build and then this will invoke next ops and it will start building the machine actually this script uses the shake build system maybe some people will know it it's kind of like a make DSL in Haskell and manages all your dependencies for you I'll just skip this not that important so how does it work well lumi is actually not the name of this this Haskell package is actually installed as a shell alias so when we type Lumiere this actual script is executed Lumi do script and what the script oh I told her already
so what the script will do as you can see hit a function next build to build this leave me do Haskell package and it will install a link to the to this package in the end dot slew me do and inside our upholstery and then we follow that link and yeah basically execute the script but if you if you would only do this then it would take quite a long time because next build is kind of slow even if it's already cached it still has to kind of figure as you can see here we we we invoke the default next well in our upholstery and that is kind of big so evaluating this takes time and that's not nice when you want to have Auto completion needs to be really quick so we extended it with a bit of kind of caching so when the Haskell source file so this source file if the if it's if it's older than the time of the link then yeah then then you only need to build it but if it's if it's younger then you can just follow the link and be sure it's up to date and so yeah and as you can see it's pretty pretty quick oh yeah there's some more stuff yeah so I would recommend this if you're you know want to introduce Nicks and your company try to abstract it away so that nobody sees you're actually using X all right
so we have our own Hydra I can actually show it so we have a training here it's
actually still on a public URL but of course it is protected with a password but at some point I want to put it in our VPN so that you know even when the password doesn't work yeah you can't access it so here we see one job set let's just go to our jobs so you can see quite a number of jobs most of them are actual Haskell packages that we use and that we develop ourselves it may appear that we have lots of Haskell packages well we have about you know 50 or so but we have multiple different configurations of packages so in here the devil ones are packages that we built with - oh here oh so we disabled optimizations and we also have production bills like here where we do put in the - oh so that we get optimize bills one thing that I want to zoom into is this thing test stalling that so stalling that that's the Dutch installing is a Dutch word for parking facility and stalling net as our make soaps Network and we we have this test suite which is using the standard next to as testing infrastructure and I was really surprised that when I as I wrote this test so I had this I can show
it here yeah here we have this this test so we we say make test you put in a bunch of notes so we have a central server a facility server which is doing the image analysis we have a bunch of other things we even put in a workstations like like this machine and then we have like a build script where it is here this Brill script which starts all the machines and then it runs a few tests for Santoli we check ok is nginx running it's our Haskell a Loomis central server has full server running and yeah we do that for all kinds of things I was really surprised that when I ran this I you get this nice test report I didn't know that existed so I was really surprised by that you get this really cool test support let's zoom in a bit and you can this is kind of you can actually click this open and then you can see like all the tests and you can see the outputs so this is this is
really cool that you can just be Burke a
test well the one thing that's not so nice if your test fails you don't get this report that's a yeah that can be
so we use next hops for deployment one thing that is that we ran into so say you you want to deploy a sign some sign of display in Utrecht say type in X of deploy includes this my sign or my machine and then you deploy and then later you want to connect to this machine and then certainly you discover you can't reach it anymore you know it's offline for some reason and you and this actually happened to us in practice we screwed up our VPN configuration and then the sign was certainly not accessible anymore if you're still running but we just screwed something up yeah and the only way to fix this is to actually get out of the office getting into your car drive to another city or possibly in other country because we have also in we have systems in Belgium and we are installing a system in the UK so yeah that's that's not the way to fix this so actually Falco he he made this automatic rollback system and the way it works is we every system has this bloomie automatic rollback timer installed and when the time of fires that always fires after 20 minutes we roll back the system so we call next to us rebuild switch rollback and we'll roll back to the previous configuration but you don't know of course always want to rollback you only want to do that when yeah when you can't reach the system anymore so what what you do is typically you deploy a system and then this timer starts running and then in that window a 20-minute window you will you execute some command to stop the rollback and a way to stop it as to we have this file here the rollback version if you put that at the version that you that it needs to run at then it won't roll back so if the current version of the system is bigger than yeah if it's bigger than the the rollback version it will roll back so if you put in yeah the right version then we'll stop and this actually has saved us a number of times when we screwed something up and then the system will just be online again after 20 minutes that's very useful and I think it might be nice to actually kind of packages for Nexo s because I think this can be generalized for for all next to s systems oh and yeah this was already I guess we have plenty of time for questions yeah we have our own Raspberry Pi built form so we have a - raspberry PI's on a desk and they are doing the the bills first they're actually not who to hide right yet we had some problem kind of connecting the Hydra server which is running on Hutzler to the raspberry PI's that kind of wasn't really reliable but we shoot actually August and the nice thing is you you if you do it on Hydra then all the built artifacts will be on Hydra and now they are always on the Raspberry Pi built machines and you have to kind of copy them over to your machine when you want to deploy a sign and it's kind of cumbersome if you have it on Hydra then it will be smoother yeah sure yeah yeah you mean a sub-module oh yes keeping next packages as a sub module in your own repo I did use certain modules at some point I'm not sure I use it for next packages but they're always kind of tedious to handle because yeah every engine ears really need to be aware that you have these sir modules then when you I think when you update a certain molecule you're really I'm not sure you can automate that everybody doesn't so much it'll update that I don't know the exact amount but yeah that's good that would work that would work yeah but I think that the next 1.12 approach would be ideal just have this point to a tarball and then yeah the the which one all right okay yeah but then the question is how do you do this on Hydra well okay you can you can tell Hydra to also fetch all the sub modules I guess right question so there's two reasons first of all if you get clone Nix packages it's gonna take forever because it's like 500 megabytes so you really want to use the trouble right and that the other thing is that get sub modules are not pure so they get stripped out and and you might run into problems if you want to build that on Hydra for example so that makes it not not that you yeah that's a good point yeah thank you [Music] any more questions so thanks for the presentation was really good I like the way you take a thin version of Nix packages and apply patches to it right I wanted to mention that basically what you're doing is something that you can do with both overlays and modules you there is a new way in Nix waste modules which didn't went into real business I don't know what maybe did and it managed to not appear as one of the top teachers which is that you can discard one of the previous models which is provided by default oh yes yes it I know that feature yeah you can disable a module and then replace it by your own version yes yeah one thing I like about actually patching next packages is that say you have a pool or cross open and yeah you kind of fix the module of course you can put the fixed module in your own repository but then you kind of have to maintain like this pool of crust and this and your own module and I think with patch you just you point to a single one right you point just to your pool request and then you yeah you just need to remove the patch once it's merged otherwise you also have to remember oh I have to kind of also remove my custom module and yeah that's why I kind of prefer the patching approach and another question I have for you is can you show against the Knicks to do web page and refresh it oh yeah sure yay
[Applause] well let's I will check this and then I'll do the celebration later
[Music] you