The NixOS project and deploying systems declaratively

Sander van der Burg
Sander van der BurgSoftware Engineer and Researcher at Mendix
The NixOS project and deploying systems
declaratively
Sander van der Burg
March 12, 2016
Sander van der Burg The NixOS project and deploying systems declaratively
On being declarative
A declarative sentence makes a statement. It is punctuated by a
period:
The dog in the neighbor’s yard is barking.
(Source: http://www.slideshare.net/luigi a97/parts-of-a-sentence-8862361)
Sander van der Burg The NixOS project and deploying systems declaratively
On being imperative
An imperative sentence is a command or polite request:
(Source: https://xkcd.com/149/)
Sander van der Burg The NixOS project and deploying systems declaratively
On being declarative in programming
A style of building the structure and elements of computer
programs – that expresses the logic of a computation without
describing its control flow
(Source: https://en.wikipedia.org/wiki/Declarative programming)
Sander van der Burg The NixOS project and deploying systems declaratively
On being declarative in programming
Declarative: describing ”what” is to be computed rather than
”how” to compute the result/behavior
Imperative: a description of a computation that involves
implicit effects, usually mutable state and input/output.
(Source:
http://wcook.blogspot.com/2013/05/declarative-versus-imperative.html)
Sander van der Burg The NixOS project and deploying systems declaratively
On being declarative in programming
Declarative: describing ”what” is to be computed rather than
”how” to compute the result/behavior
Imperative: a description of a computation that involves
implicit effects, usually mutable state and input/output.
(Source:
http://wcook.blogspot.com/2013/05/declarative-versus-imperative.html)
Sander van der Burg The NixOS project and deploying systems declaratively
Declarative
“declarative” is a spectrum – hard to draw a hard line
between “what” and “how”.
Imperative is not necessarily the opposite of
declarative.
Example: HTML and CSS
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<link rel=”stylesheet” href=”style.css” type=”text/css”>
</head>
<body>
<div id=”outer”>
<div id=”inner”>
<p>HTML and CSS are declarative and so cool!</p>
</div>
</div>
</body>
</html>
#outer {
margin−left: auto;
margin−right: auto;
width: 20%;
border−style: solid;
}
#inner {
width: 500px;
}
Sander van der Burg The NixOS project and deploying systems declaratively
Example: HTML and CSS
Sander van der Burg The NixOS project and deploying systems declaratively
Deployment: What do we want?
Sander van der Burg The NixOS project and deploying systems declaratively
Deployment: Activities
Building
Packaging
Transferring packages from producer to consumer site
Activating
Deactivating
Modifying configuration files
Upgrading
Sander van der Burg The NixOS project and deploying systems declaratively
Deployment complexity
Diverse technology imposes many kinds of deployment procedures:
Different operating systems, different dependencies, many
variants
Sander van der Burg The NixOS project and deploying systems declaratively
Deployment complexity
Deployment may need to be done on a large scale:
Sander van der Burg The NixOS project and deploying systems declaratively
Deployment complexity
How to update the deployment frequently?
How not to break the system while upgrading?
How to minimize downtimes?
How to roll back in case of a failure?
Sander van der Burg The NixOS project and deploying systems declaratively
Deployment automation
To deal with deployment complexities automation is needed!
Sander van der Burg The NixOS project and deploying systems declaratively
Deployment automation
To deal with deployment complexities automation is needed!
Many automated deployment solutions available
Automation is typically driven by a specification
Some solutions have been developed for specific kinds of
technology:
Apache Felix (for OSGi components)
Some solutions are general:
Chef
Puppet
CFEngine
Nix
Some solutions use declarative deployment specifications
Sander van der Burg The NixOS project and deploying systems declaratively
On being declarative in deployment
Declare what system you want to run in the consumer environment,
not the activities that need to be executed to accomplish it!
Sander van der Burg The NixOS project and deploying systems declaratively
Chef: convergent declarative deployment
wordpress_latest = Chef::Config[:file_cache_path] + "/wordpress-latest.tar.gz"
remote_file wordpress_latest do
source "http://wordpress.org/latest.tar.gz"
mode "0644"
end
directory node["phpapp"]["path"] do
owner "root"
group "root"
mode "0755"
action :create
recursive true
end
execute "untar-wordpress" do
cwd node[’phpapp’][’path’]
command "tar --strip-components 1 -xzf " + wordpress_latest
creates node[’phpapp’][’path’] + "/wp-settings.php"
end
(Source: http://gettingstartedwithchef.com/first-steps-with-chef.html)
Sander van der Burg The NixOS project and deploying systems declaratively
Chef: convergent declarative deployment
wordpress_latest = Chef::Config[:file_cache_path] + "/wordpress-latest.tar.gz"
remote_file wordpress_latest do
source "http://wordpress.org/latest.tar.gz"
mode "0644"
end
directory node["phpapp"]["path"] do
owner "root"
group "root"
mode "0755"
action :create
recursive true
end
execute "untar-wordpress" do
cwd node[’phpapp’][’path’]
command "tar --strip-components 1 -xzf " + wordpress_latest
creates node[’phpapp’][’path’] + "/wp-settings.php"
end
(Source: http://gettingstartedwithchef.com/first-steps-with-chef.html)
Sander van der Burg The NixOS project and deploying systems declaratively
Declarative
The specification captures the outcome of a set of
changes as a fixpoint. Chef converges to the outcome.
Specification applies to set of machines – but does not
guarantee that an entire machine’s configuration can
be reproduced elsewhere
How to roll back to a previous configuration?
How to mimimize downtime?
NixOS
NixOS: A GNU/Linux distribution using the Nix package manager
Sander van der Burg The NixOS project and deploying systems declaratively
NixOS configuration
/etc/nixos/configuration.nix
{pkgs, ...}:
{
boot.loader.grub.device = "/dev/sda";
fileSystems = [ { mountPoint = "/"; device = "/dev/sda2"; } ];
swapDevices = [ { device = "/dev/sda1"; } ];
services = {
openssh.enable = true;
xserver = {
enable = true;
desktopManager.kde4.enable = true;
};
};
environment.systemPackages = [ pkgs.mc pkgs.firefox ];
}
Sander van der Burg The NixOS project and deploying systems declaratively
NixOS configuration
nixos-rebuild switch
Nix package manager builds a complete system configuration
Includes all packages and generates all configuration files, e.g.
OpenSSH configuration
Upgrades are (almost) atomic
Components are stored safely next to each other, due to hashes
No files are automatically removed or overwritten
Users can switch to older generations of system configurations
not garbage collected yet
Sander van der Burg The NixOS project and deploying systems declaratively
NixOS bootloader
Sander van der Burg The NixOS project and deploying systems declaratively
Nix store
Main idea: store all packages
in isolation from each other:
/nix/store/rpdqxnilb0cg...
-firefox-3.5.4
Paths contain a 160-bit
cryptographic hash of all
inputs used to build the
package:
Sources
Libraries
Compilers
Build scripts
. . .
/nix/store
l9w6773m1msy...-openssh-4.6p1
bin
ssh
sbin
sshd
smkabrbibqv7...-openssl-0.9.8e
lib
libssl.so.0.9.8
c6jbqm2mc0a7...-zlib-1.2.3
lib
libz.so.1.2.3
im276akmsrhv...-glibc-2.5
lib
libc.so.6
Sander van der Burg The NixOS project and deploying systems declaratively
Nix expressions
openssh.nix
{ stdenv, fetchurl, openssl, zlib }:
stdenv.mkDerivation {
name = "openssh-4.6p1";
src = fetchurl {
url = http://.../openssh-4.6p1.tar.gz;
sha256 = "0fpjlr3bfind0y94bk442x2p...";
};
buildCommand = ’’
tar xjf $src
./configure --prefix=$out --with-openssl=${openssl}
make; make install
’’;
}
Sander van der Burg The NixOS project and deploying systems declaratively
Nix expressions
all-packages.nix
openssh = import ../tools/networking/openssh {
inherit fetchurl stdenv openssl zlib;
};
openssl = import ../development/libraries/openssl {
inherit fetchurl stdenv perl;
};
stdenv = ...;
openssl = ...;
zlib = ...;
perl = ...;
nix-env -f all-packages.nix -iA openssh
Produces a /nix/store/l9w6773m1msy...-openssh-4.6p1
package in the Nix store.
Sander van der Burg The NixOS project and deploying systems declaratively
User environments
Users can have
different sets of
installed applications.
PATH
/nix/.../profiles
current
42
/nix/store
pp56i0a01si5...-user-env
bin
firefox
ssh
l9w6773m1msy...-openssh-4.6p1
bin
ssh
rpdqxnilb0cg...-firefox-3.5.4
bin
firefox
Sander van der Burg The NixOS project and deploying systems declaratively
User environments
Users can have
different sets of
installed applications.
nix-env operations
create new user
environments in the
store.
PATH
/nix/.../profiles
current
42
/nix/store
pp56i0a01si5...-user-env
bin
firefox
ssh
l9w6773m1msy...-openssh-4.6p1
bin
ssh
rpdqxnilb0cg...-firefox-3.5.4
bin
firefox
aqn3wygq9jzk...-openssh-5.2p1
bin
ssh
(nix-env -u openssh)
Sander van der Burg The NixOS project and deploying systems declaratively
User environments
Users can have
different sets of
installed applications.
nix-env operations
create new user
environments in the
store.
PATH
/nix/.../profiles
current
42
/nix/store
pp56i0a01si5...-user-env
bin
firefox
ssh
l9w6773m1msy...-openssh-4.6p1
bin
ssh
rpdqxnilb0cg...-firefox-3.5.4
bin
firefox
aqn3wygq9jzk...-openssh-5.2p1
bin
ssh
i3d9vh6d8ip1...-user-env
bin
ssh
firefox
(nix-env -u openssh)
Sander van der Burg The NixOS project and deploying systems declaratively
User environments
Users can have
different sets of
installed applications.
nix-env operations
create new user
environments in the
store.
PATH
/nix/.../profiles
current
42
43
/nix/store
pp56i0a01si5...-user-env
bin
firefox
ssh
l9w6773m1msy...-openssh-4.6p1
bin
ssh
rpdqxnilb0cg...-firefox-3.5.4
bin
firefox
aqn3wygq9jzk...-openssh-5.2p1
bin
ssh
i3d9vh6d8ip1...-user-env
bin
ssh
firefox
(nix-env -u openssh)
Sander van der Burg The NixOS project and deploying systems declaratively
User environments
Users can have
different sets of
installed applications.
nix-env operations
create new user
environments in the
store.
We can atomically
switch between them.
PATH
/nix/.../profiles
current
42
43
/nix/store
pp56i0a01si5...-user-env
bin
firefox
ssh
l9w6773m1msy...-openssh-4.6p1
bin
ssh
rpdqxnilb0cg...-firefox-3.5.4
bin
firefox
aqn3wygq9jzk...-openssh-5.2p1
bin
ssh
i3d9vh6d8ip1...-user-env
bin
ssh
firefox
(nix-env -u openssh)
Sander van der Burg The NixOS project and deploying systems declaratively
User environments
Users can have
different sets of
installed applications.
nix-env operations
create new user
environments in the
store.
We can atomically
switch between them.
These are roots of the
garbage collector.
PATH
/nix/.../profiles
current
43
/nix/store
pp56i0a01si5...-user-env
bin
firefox
ssh
l9w6773m1msy...-openssh-4.6p1
bin
ssh
rpdqxnilb0cg...-firefox-3.5.4
bin
firefox
aqn3wygq9jzk...-openssh-5.2p1
bin
ssh
i3d9vh6d8ip1...-user-env
bin
ssh
firefox
(nix-env --remove-generations old)
Sander van der Burg The NixOS project and deploying systems declaratively
User environments
Users can have
different sets of
installed applications.
nix-env operations
create new user
environments in the
store.
We can atomically
switch between them.
These are roots of the
garbage collector.
PATH
/nix/.../profiles
current
43
/nix/store
rpdqxnilb0cg...-firefox-3.5.4
bin
firefox
aqn3wygq9jzk...-openssh-5.2p1
bin
ssh
i3d9vh6d8ip1...-user-env
bin
ssh
firefox
(nix-collect-garbage)
Sander van der Burg The NixOS project and deploying systems declaratively
NixOS
In NixOS, all packages including the Linux kernel and
configuration files are managed by Nix.
NixOS does not have directories such as: /lib and /usr
NixOS has a minimal /bin and /etc
Sander van der Burg The NixOS project and deploying systems declaratively
Distributed deployment
NixOS has good properties for deployment of a single system
Can we extend these properties to distributed systems?
Sander van der Burg The NixOS project and deploying systems declaratively
Motivating example: Trac
Sander van der Burg The NixOS project and deploying systems declaratively
Motivating example: Trac
Trac can be deployed in a distributed environment:
Subversion server
Database server
Web server
Sander van der Burg The NixOS project and deploying systems declaratively
Distributed NixOS configuration
network.nix
{ storage = {pkgs, ...}:
{
services.nfsKernel.server.enable = true; ...
};
postgresql = {pkgs, ...}:
{
services.postgresql.enable = true; ...
};
webserver = {pkgs, ...}:
{
fileSystems = [
{ mountPoint = "/repos"; device = "storage:/repos"; } ];
services.httpd.enable = true;
services.httpd.extraSubservices = [ { serviceType = "trac"; } ]; ...
};
...
}
Sander van der Burg The NixOS project and deploying systems declaratively
Distributed deployment
$ nixops create network.nix -d production
$ nixops deploy -d production
Build system configurations by the Nix package manager
Transfer complete system and all dependencies to target
machines in the network
Efficient: only missing store paths must be transferred
Safe: Existing configuration is not affected, because no files
are overwritten or removed
Activate new system configuration
In case of a failure, roll back all configurations
Relatively cheap operation, because old configuration is stored
next to new configuration
Sander van der Burg The NixOS project and deploying systems declaratively
The Nix project
Tools part of the Nix-project: http://nixos.org:
Nix. A purely functional package manager
NixOS. Nix based GNU/Linux distribution
Hydra. Nix based continuous build and integration server
Disnix. Nix based distributed service deployment
NixOps. NixOS-based multi-cloud deployment tool
Sander van der Burg The NixOS project and deploying systems declaratively
The Nix project
Automated deployment using declarative specifications with the
following properties:
Generic. Can be used with many programming languages,
component technologies, and operating systems.
Reproducible. (Almost) no impurities – if inputs are the same,
result should be the same regardless of its location
Reliable. Dependency completeness, (almost) atomic
upgrades and rollbacks.
Efficient. Only the required deployment activities are
executed.
Sander van der Burg The NixOS project and deploying systems declaratively
Nix-related tools: how declarative are they?
Nix-related tools solve problems in a technical domain:
e.g. deployment of packages, machines, services, ...
What about your domain?
Sander van der Burg The NixOS project and deploying systems declaratively
A real world example: Conference Compass
Conference Compass provides a service to improve the way
people experience events
Most visible part of the service: apps for conference attendees
Each customer basically gets “their own” app.
Sander van der Burg The NixOS project and deploying systems declaratively
A real world example: Conference Compass
We have a product-line using a Nix-based build infrastructure,
including Hydra, driven by simple app specific configurations:
{
name = "wroclove.rb 2016";
homepage = "http://www.wrocloverb.com";
iconSet = ./icons;
backgroundImage" = ./background.png;
...
}
Sander van der Burg The NixOS project and deploying systems declaratively
A real world example: Conference Compass
The app’s contents is customizable with a configurator service
allowing organizers to create and update their content
Apps connect to a configurator to retrieve the data to be
displayed and other configuration settings
Integration with third party information systems is also
possible
Sander van der Burg The NixOS project and deploying systems declaratively
A real world example: Conference Compass
{
wrocloverb = {
eventName = "wroclove.rb 2016";
domain = "http://www.wrocloverb.com";
channels = [ "wrocloverb" ];
};
otherevent = ...;
yetanotherevent = ...;
...
}
We have developed a formalism to concisely model such
configurations and to automatically deploy them
Tool figures out which machines to configure, what services to
deploy etc.
If underlying implementation and technology evolves,
specifications (probably) remains the same.
Sander van der Burg The NixOS project and deploying systems declaratively
Conclusions
I have illustated a declarative deployment vision
I have demonstrated NixOS and the Nix package manager
I have explained that domain specific deployment tools can be
built on top of tools from the Nix project
Sander van der Burg The NixOS project and deploying systems declaratively
References
NixOS project homepage: http://nixos.org
Software available under free and open-source licenses
(LGPL/X11)
Nix package manager can be used on any Linux system, Mac
OS X, and (in some extent) Cygwin and FreeBSD.
Sander van der Burg The NixOS project and deploying systems declaratively
Questions
Sander van der Burg The NixOS project and deploying systems declaratively
1 of 48

Recommended

H2O - the optimized HTTP server by
H2O - the optimized HTTP serverH2O - the optimized HTTP server
H2O - the optimized HTTP serverKazuho Oku
76.6K views74 slides
Inter-Process Communication in Microservices using gRPC by
Inter-Process Communication in Microservices using gRPCInter-Process Communication in Microservices using gRPC
Inter-Process Communication in Microservices using gRPCShiju Varghese
5.9K views20 slides
Data Presentations Cassandra Sigmod by
Data  Presentations  Cassandra SigmodData  Presentations  Cassandra Sigmod
Data Presentations Cassandra SigmodJeff Hammerbacher
12.2K views20 slides
Presto query optimizer: pursuit of performance by
Presto query optimizer: pursuit of performancePresto query optimizer: pursuit of performance
Presto query optimizer: pursuit of performanceDataWorks Summit
4.3K views31 slides
A Practical Guide to Domain Driven Design: Presentation Slides by
A Practical Guide to Domain Driven Design: Presentation SlidesA Practical Guide to Domain Driven Design: Presentation Slides
A Practical Guide to Domain Driven Design: Presentation Slidesthinkddd
11.4K views33 slides

More Related Content

What's hot

Domain Driven Design Ch7 by
Domain Driven Design Ch7Domain Driven Design Ch7
Domain Driven Design Ch7Ryan Park
1.5K views30 slides
Introduction to Google Guice by
Introduction to Google GuiceIntroduction to Google Guice
Introduction to Google GuiceKnoldus Inc.
4.4K views26 slides
Laravel and SOLR by
Laravel and SOLRLaravel and SOLR
Laravel and SOLRPeter Steenbergen
4.1K views34 slides
LINE's messaging service architecture underlying more than 200 million monthl... by
LINE's messaging service architecture underlying more than 200 million monthl...LINE's messaging service architecture underlying more than 200 million monthl...
LINE's messaging service architecture underlying more than 200 million monthl...kawamuray
2.1K views26 slides
openCypher: Introducing subqueries by
openCypher: Introducing subqueriesopenCypher: Introducing subqueries
openCypher: Introducing subqueriesopenCypher
761 views14 slides
스터디그룹 패턴 (A PATTERN LANGUAGE FOR STUDY GROUPS) by
스터디그룹 패턴 (A PATTERN LANGUAGE FOR STUDY GROUPS)스터디그룹 패턴 (A PATTERN LANGUAGE FOR STUDY GROUPS)
스터디그룹 패턴 (A PATTERN LANGUAGE FOR STUDY GROUPS)hyun soomyung
5.4K views75 slides

What's hot(20)

Domain Driven Design Ch7 by Ryan Park
Domain Driven Design Ch7Domain Driven Design Ch7
Domain Driven Design Ch7
Ryan Park1.5K views
Introduction to Google Guice by Knoldus Inc.
Introduction to Google GuiceIntroduction to Google Guice
Introduction to Google Guice
Knoldus Inc.4.4K views
LINE's messaging service architecture underlying more than 200 million monthl... by kawamuray
LINE's messaging service architecture underlying more than 200 million monthl...LINE's messaging service architecture underlying more than 200 million monthl...
LINE's messaging service architecture underlying more than 200 million monthl...
kawamuray2.1K views
openCypher: Introducing subqueries by openCypher
openCypher: Introducing subqueriesopenCypher: Introducing subqueries
openCypher: Introducing subqueries
openCypher761 views
스터디그룹 패턴 (A PATTERN LANGUAGE FOR STUDY GROUPS) by hyun soomyung
스터디그룹 패턴 (A PATTERN LANGUAGE FOR STUDY GROUPS)스터디그룹 패턴 (A PATTERN LANGUAGE FOR STUDY GROUPS)
스터디그룹 패턴 (A PATTERN LANGUAGE FOR STUDY GROUPS)
hyun soomyung5.4K views
Netflix Recommendations Using Spark + Cassandra (Prasanna Padmanabhan & Roopa... by DataStax
Netflix Recommendations Using Spark + Cassandra (Prasanna Padmanabhan & Roopa...Netflix Recommendations Using Spark + Cassandra (Prasanna Padmanabhan & Roopa...
Netflix Recommendations Using Spark + Cassandra (Prasanna Padmanabhan & Roopa...
DataStax6.6K views
Intro to Telegraf by InfluxData
Intro to TelegrafIntro to Telegraf
Intro to Telegraf
InfluxData709 views
Power of the Log: LSM & Append Only Data Structures by confluent
Power of the Log: LSM & Append Only Data StructuresPower of the Log: LSM & Append Only Data Structures
Power of the Log: LSM & Append Only Data Structures
confluent6.8K views
(Big) Data Serialization with Avro and Protobuf by Guido Schmutz
(Big) Data Serialization with Avro and Protobuf(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf
Guido Schmutz8.9K views
Spark & Zeppelin을 활용한 한국어 텍스트 분류 by Taejun Kim
Spark & Zeppelin을 활용한 한국어 텍스트 분류Spark & Zeppelin을 활용한 한국어 텍스트 분류
Spark & Zeppelin을 활용한 한국어 텍스트 분류
Taejun Kim7.3K views
From Mainframe to Microservice: An Introduction to Distributed Systems by Tyler Treat
From Mainframe to Microservice: An Introduction to Distributed SystemsFrom Mainframe to Microservice: An Introduction to Distributed Systems
From Mainframe to Microservice: An Introduction to Distributed Systems
Tyler Treat37.4K views
Camunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan by camunda services GmbH
Camunda for Modern Web Applications by Corinna Cohn and Sowmya RaghunathanCamunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
Camunda for Modern Web Applications by Corinna Cohn and Sowmya Raghunathan
Postman: An Introduction for Developers by Postman
Postman: An Introduction for DevelopersPostman: An Introduction for Developers
Postman: An Introduction for Developers
Postman857 views
A visual introduction to Apache Kafka by Paul Brebner
A visual introduction to Apache KafkaA visual introduction to Apache Kafka
A visual introduction to Apache Kafka
Paul Brebner4.7K views
Atlassian jql-cheat-sheet-2 by Khushal Chate
Atlassian jql-cheat-sheet-2Atlassian jql-cheat-sheet-2
Atlassian jql-cheat-sheet-2
Khushal Chate169 views
Building an Event Streaming Architecture with Apache Pulsar by ScyllaDB
Building an Event Streaming Architecture with Apache PulsarBuilding an Event Streaming Architecture with Apache Pulsar
Building an Event Streaming Architecture with Apache Pulsar
ScyllaDB136 views
Introduction to REST API with Node.js by Yoann Gotthilf
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
Yoann Gotthilf3.5K views
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi... by StreamNative
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
StreamNative318 views

Similar to The NixOS project and deploying systems declaratively

A Reference Architecture for Distributed Software Deployment by
A Reference Architecture for Distributed Software DeploymentA Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software DeploymentSander van der Burg
1.6K views56 slides
The Nix project by
The Nix projectThe Nix project
The Nix projectSander van der Burg
592 views42 slides
The Nix project by
The Nix projectThe Nix project
The Nix projectSander van der Burg
962 views49 slides
Using NixOS for declarative deployment and testing by
Using NixOS for declarative deployment and testingUsing NixOS for declarative deployment and testing
Using NixOS for declarative deployment and testingSander van der Burg
1.4K views31 slides
Techniques and lessons for improvement of deployment processes by
Techniques and lessons for improvement of deployment processesTechniques and lessons for improvement of deployment processes
Techniques and lessons for improvement of deployment processesSander van der Burg
444 views19 slides
Deploying .NET applications with the Nix package manager by
Deploying .NET applications with the Nix package managerDeploying .NET applications with the Nix package manager
Deploying .NET applications with the Nix package managerSander van der Burg
1.8K views36 slides

Similar to The NixOS project and deploying systems declaratively(20)

A Reference Architecture for Distributed Software Deployment by Sander van der Burg
A Reference Architecture for Distributed Software DeploymentA Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software Deployment
Sander van der Burg1.6K views
Using NixOS for declarative deployment and testing by Sander van der Burg
Using NixOS for declarative deployment and testingUsing NixOS for declarative deployment and testing
Using NixOS for declarative deployment and testing
Sander van der Burg1.4K views
Techniques and lessons for improvement of deployment processes by Sander van der Burg
Techniques and lessons for improvement of deployment processesTechniques and lessons for improvement of deployment processes
Techniques and lessons for improvement of deployment processes
Deploying .NET applications with the Nix package manager by Sander van der Burg
Deploying .NET applications with the Nix package managerDeploying .NET applications with the Nix package manager
Deploying .NET applications with the Nix package manager
Sander van der Burg1.8K views
Deploying NPM packages with the Nix package manager by Sander van der Burg
Deploying NPM packages with the Nix package managerDeploying NPM packages with the Nix package manager
Deploying NPM packages with the Nix package manager
Sander van der Burg5.4K views
nix-processmgmt: An experimental Nix-based process manager-agnostic framework by Sander van der Burg
nix-processmgmt: An experimental Nix-based process manager-agnostic frameworknix-processmgmt: An experimental Nix-based process manager-agnostic framework
nix-processmgmt: An experimental Nix-based process manager-agnostic framework
Sander van der Burg1.8K views
Hydra: Continuous Integration and Testing for Demanding People: The Details by Sander van der Burg
Hydra: Continuous Integration and Testing for Demanding People: The DetailsHydra: Continuous Integration and Testing for Demanding People: The Details
Hydra: Continuous Integration and Testing for Demanding People: The Details
Sander van der Burg3.8K views
Automating Mendix application deployments with Nix by Sander van der Burg
Automating Mendix application deployments with NixAutomating Mendix application deployments with Nix
Automating Mendix application deployments with Nix
Sander van der Burg2.4K views
Dysnomia: complementing Nix deployments with state deployment by Sander van der Burg
Dysnomia: complementing Nix deployments with state deploymentDysnomia: complementing Nix deployments with state deployment
Dysnomia: complementing Nix deployments with state deployment
A Generic Approach for Deploying and Upgrading Mutable Software Components by Sander van der Burg
A Generic Approach for Deploying and Upgrading Mutable Software ComponentsA Generic Approach for Deploying and Upgrading Mutable Software Components
A Generic Approach for Deploying and Upgrading Mutable Software Components
Microservices Application Tracing Standards and Simulators - Adrians at OSCON by Adrian Cockcroft
Microservices Application Tracing Standards and Simulators - Adrians at OSCONMicroservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
Adrian Cockcroft5.9K views
Automate drupal deployments with linux containers, docker and vagrant by Ricardo Amaro
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant
Ricardo Amaro9.8K views
Drupalcamp es 2013 drupal with lxc docker and vagrant by Ricardo Amaro
Drupalcamp es 2013  drupal with lxc docker and vagrant Drupalcamp es 2013  drupal with lxc docker and vagrant
Drupalcamp es 2013 drupal with lxc docker and vagrant
Ricardo Amaro3.8K views
Weave User Group Talk - DockerCon 2017 Recap by Patrick Chanezon
Weave User Group Talk - DockerCon 2017 RecapWeave User Group Talk - DockerCon 2017 Recap
Weave User Group Talk - DockerCon 2017 Recap
Patrick Chanezon2.9K views

More from Sander van der Burg

The Monitoring Playground by
The Monitoring PlaygroundThe Monitoring Playground
The Monitoring PlaygroundSander van der Burg
1.2K views37 slides
Using Nix and Docker as automated deployment solutions by
Using Nix and Docker as automated deployment solutionsUsing Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutionsSander van der Burg
6.4K views52 slides
Hydra: Continuous Integration and Testing for Demanding People: The Basics by
Hydra: Continuous Integration and Testing for Demanding People: The BasicsHydra: Continuous Integration and Testing for Demanding People: The Basics
Hydra: Continuous Integration and Testing for Demanding People: The BasicsSander van der Burg
2K views25 slides
A Reference Architecture for Distributed Software Deployment by
A Reference Architecture for Distributed Software DeploymentA Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software DeploymentSander van der Burg
471 views24 slides
A Self-Adaptive Deployment Framework for Service-Oriented Systems by
A Self-Adaptive Deployment Framework for Service-Oriented SystemsA Self-Adaptive Deployment Framework for Service-Oriented Systems
A Self-Adaptive Deployment Framework for Service-Oriented SystemsSander van der Burg
557 views25 slides
Pull Deployment of Services by
Pull Deployment of ServicesPull Deployment of Services
Pull Deployment of ServicesSander van der Burg
408 views16 slides

More from Sander van der Burg(13)

Using Nix and Docker as automated deployment solutions by Sander van der Burg
Using Nix and Docker as automated deployment solutionsUsing Nix and Docker as automated deployment solutions
Using Nix and Docker as automated deployment solutions
Sander van der Burg6.4K views
Hydra: Continuous Integration and Testing for Demanding People: The Basics by Sander van der Burg
Hydra: Continuous Integration and Testing for Demanding People: The BasicsHydra: Continuous Integration and Testing for Demanding People: The Basics
Hydra: Continuous Integration and Testing for Demanding People: The Basics
A Reference Architecture for Distributed Software Deployment by Sander van der Burg
A Reference Architecture for Distributed Software DeploymentA Reference Architecture for Distributed Software Deployment
A Reference Architecture for Distributed Software Deployment
A Self-Adaptive Deployment Framework for Service-Oriented Systems by Sander van der Burg
A Self-Adaptive Deployment Framework for Service-Oriented SystemsA Self-Adaptive Deployment Framework for Service-Oriented Systems
A Self-Adaptive Deployment Framework for Service-Oriented Systems
Automated Deployment of Hetergeneous Service-Oriented System by Sander van der Burg
Automated Deployment of Hetergeneous Service-Oriented SystemAutomated Deployment of Hetergeneous Service-Oriented System
Automated Deployment of Hetergeneous Service-Oriented System
Pull Deployment of Services: Introduction, Progress and Challenges by Sander van der Burg
Pull Deployment of Services: Introduction, Progress and ChallengesPull Deployment of Services: Introduction, Progress and Challenges
Pull Deployment of Services: Introduction, Progress and Challenges
Model-driven Distributed Software Deployment laymen's talk by Sander van der Burg
Model-driven Distributed Software Deployment laymen's talkModel-driven Distributed Software Deployment laymen's talk
Model-driven Distributed Software Deployment laymen's talk

Recently uploaded

Using Qt under LGPL-3.0 by
Using Qt under LGPL-3.0Using Qt under LGPL-3.0
Using Qt under LGPL-3.0Burkhard Stubert
14 views11 slides
predicting-m3-devopsconMunich-2023.pptx by
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptxTier1 app
10 views24 slides
Electronic AWB - Electronic Air Waybill by
Electronic AWB - Electronic Air Waybill Electronic AWB - Electronic Air Waybill
Electronic AWB - Electronic Air Waybill Freightoscope
6 views1 slide
tecnologia18.docx by
tecnologia18.docxtecnologia18.docx
tecnologia18.docxnosi6702
6 views5 slides
nintendo_64.pptx by
nintendo_64.pptxnintendo_64.pptx
nintendo_64.pptxpaiga02016
7 views7 slides
What is API by
What is APIWhat is API
What is APIartembondar5
15 views15 slides

Recently uploaded(20)

predicting-m3-devopsconMunich-2023.pptx by Tier1 app
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptx
Tier1 app10 views
Electronic AWB - Electronic Air Waybill by Freightoscope
Electronic AWB - Electronic Air Waybill Electronic AWB - Electronic Air Waybill
Electronic AWB - Electronic Air Waybill
Freightoscope 6 views
tecnologia18.docx by nosi6702
tecnologia18.docxtecnologia18.docx
tecnologia18.docx
nosi67026 views
Supercharging your Python Development Environment with VS Code and Dev Contai... by Dawn Wages
Supercharging your Python Development Environment with VS Code and Dev Contai...Supercharging your Python Development Environment with VS Code and Dev Contai...
Supercharging your Python Development Environment with VS Code and Dev Contai...
Dawn Wages5 views
predicting-m3-devopsconMunich-2023-v2.pptx by Tier1 app
predicting-m3-devopsconMunich-2023-v2.pptxpredicting-m3-devopsconMunich-2023-v2.pptx
predicting-m3-devopsconMunich-2023-v2.pptx
Tier1 app14 views
FOSSLight Community Day 2023-11-30 by Shane Coughlan
FOSSLight Community Day 2023-11-30FOSSLight Community Day 2023-11-30
FOSSLight Community Day 2023-11-30
Shane Coughlan8 views
How to build dyanmic dashboards and ensure they always work by Wiiisdom
How to build dyanmic dashboards and ensure they always workHow to build dyanmic dashboards and ensure they always work
How to build dyanmic dashboards and ensure they always work
Wiiisdom16 views
Ports-and-Adapters Architecture for Embedded HMI by Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert35 views
Advanced API Mocking Techniques Using Wiremock by Dimpy Adhikary
Advanced API Mocking Techniques Using WiremockAdvanced API Mocking Techniques Using Wiremock
Advanced API Mocking Techniques Using Wiremock
Dimpy Adhikary5 views
Introduction to Git Source Control by John Valentino
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source Control
John Valentino8 views
aATP - New Correlation Confirmation Feature.pptx by EsatEsenek1
aATP - New Correlation Confirmation Feature.pptxaATP - New Correlation Confirmation Feature.pptx
aATP - New Correlation Confirmation Feature.pptx
EsatEsenek1222 views
Top-5-production-devconMunich-2023.pptx by Tier1 app
Top-5-production-devconMunich-2023.pptxTop-5-production-devconMunich-2023.pptx
Top-5-production-devconMunich-2023.pptx
Tier1 app10 views

The NixOS project and deploying systems declaratively

  • 1. The NixOS project and deploying systems declaratively Sander van der Burg March 12, 2016 Sander van der Burg The NixOS project and deploying systems declaratively
  • 2. On being declarative A declarative sentence makes a statement. It is punctuated by a period: The dog in the neighbor’s yard is barking. (Source: http://www.slideshare.net/luigi a97/parts-of-a-sentence-8862361) Sander van der Burg The NixOS project and deploying systems declaratively
  • 3. On being imperative An imperative sentence is a command or polite request: (Source: https://xkcd.com/149/) Sander van der Burg The NixOS project and deploying systems declaratively
  • 4. On being declarative in programming A style of building the structure and elements of computer programs – that expresses the logic of a computation without describing its control flow (Source: https://en.wikipedia.org/wiki/Declarative programming) Sander van der Burg The NixOS project and deploying systems declaratively
  • 5. On being declarative in programming Declarative: describing ”what” is to be computed rather than ”how” to compute the result/behavior Imperative: a description of a computation that involves implicit effects, usually mutable state and input/output. (Source: http://wcook.blogspot.com/2013/05/declarative-versus-imperative.html) Sander van der Burg The NixOS project and deploying systems declaratively
  • 6. On being declarative in programming Declarative: describing ”what” is to be computed rather than ”how” to compute the result/behavior Imperative: a description of a computation that involves implicit effects, usually mutable state and input/output. (Source: http://wcook.blogspot.com/2013/05/declarative-versus-imperative.html) Sander van der Burg The NixOS project and deploying systems declaratively Declarative “declarative” is a spectrum – hard to draw a hard line between “what” and “how”. Imperative is not necessarily the opposite of declarative.
  • 7. Example: HTML and CSS <!DOCTYPE html> <html> <head> <title>Test</title> <link rel=”stylesheet” href=”style.css” type=”text/css”> </head> <body> <div id=”outer”> <div id=”inner”> <p>HTML and CSS are declarative and so cool!</p> </div> </div> </body> </html> #outer { margin−left: auto; margin−right: auto; width: 20%; border−style: solid; } #inner { width: 500px; } Sander van der Burg The NixOS project and deploying systems declaratively
  • 8. Example: HTML and CSS Sander van der Burg The NixOS project and deploying systems declaratively
  • 9. Deployment: What do we want? Sander van der Burg The NixOS project and deploying systems declaratively
  • 10. Deployment: Activities Building Packaging Transferring packages from producer to consumer site Activating Deactivating Modifying configuration files Upgrading Sander van der Burg The NixOS project and deploying systems declaratively
  • 11. Deployment complexity Diverse technology imposes many kinds of deployment procedures: Different operating systems, different dependencies, many variants Sander van der Burg The NixOS project and deploying systems declaratively
  • 12. Deployment complexity Deployment may need to be done on a large scale: Sander van der Burg The NixOS project and deploying systems declaratively
  • 13. Deployment complexity How to update the deployment frequently? How not to break the system while upgrading? How to minimize downtimes? How to roll back in case of a failure? Sander van der Burg The NixOS project and deploying systems declaratively
  • 14. Deployment automation To deal with deployment complexities automation is needed! Sander van der Burg The NixOS project and deploying systems declaratively
  • 15. Deployment automation To deal with deployment complexities automation is needed! Many automated deployment solutions available Automation is typically driven by a specification Some solutions have been developed for specific kinds of technology: Apache Felix (for OSGi components) Some solutions are general: Chef Puppet CFEngine Nix Some solutions use declarative deployment specifications Sander van der Burg The NixOS project and deploying systems declaratively
  • 16. On being declarative in deployment Declare what system you want to run in the consumer environment, not the activities that need to be executed to accomplish it! Sander van der Burg The NixOS project and deploying systems declaratively
  • 17. Chef: convergent declarative deployment wordpress_latest = Chef::Config[:file_cache_path] + "/wordpress-latest.tar.gz" remote_file wordpress_latest do source "http://wordpress.org/latest.tar.gz" mode "0644" end directory node["phpapp"]["path"] do owner "root" group "root" mode "0755" action :create recursive true end execute "untar-wordpress" do cwd node[’phpapp’][’path’] command "tar --strip-components 1 -xzf " + wordpress_latest creates node[’phpapp’][’path’] + "/wp-settings.php" end (Source: http://gettingstartedwithchef.com/first-steps-with-chef.html) Sander van der Burg The NixOS project and deploying systems declaratively
  • 18. Chef: convergent declarative deployment wordpress_latest = Chef::Config[:file_cache_path] + "/wordpress-latest.tar.gz" remote_file wordpress_latest do source "http://wordpress.org/latest.tar.gz" mode "0644" end directory node["phpapp"]["path"] do owner "root" group "root" mode "0755" action :create recursive true end execute "untar-wordpress" do cwd node[’phpapp’][’path’] command "tar --strip-components 1 -xzf " + wordpress_latest creates node[’phpapp’][’path’] + "/wp-settings.php" end (Source: http://gettingstartedwithchef.com/first-steps-with-chef.html) Sander van der Burg The NixOS project and deploying systems declaratively Declarative The specification captures the outcome of a set of changes as a fixpoint. Chef converges to the outcome. Specification applies to set of machines – but does not guarantee that an entire machine’s configuration can be reproduced elsewhere How to roll back to a previous configuration? How to mimimize downtime?
  • 19. NixOS NixOS: A GNU/Linux distribution using the Nix package manager Sander van der Burg The NixOS project and deploying systems declaratively
  • 20. NixOS configuration /etc/nixos/configuration.nix {pkgs, ...}: { boot.loader.grub.device = "/dev/sda"; fileSystems = [ { mountPoint = "/"; device = "/dev/sda2"; } ]; swapDevices = [ { device = "/dev/sda1"; } ]; services = { openssh.enable = true; xserver = { enable = true; desktopManager.kde4.enable = true; }; }; environment.systemPackages = [ pkgs.mc pkgs.firefox ]; } Sander van der Burg The NixOS project and deploying systems declaratively
  • 21. NixOS configuration nixos-rebuild switch Nix package manager builds a complete system configuration Includes all packages and generates all configuration files, e.g. OpenSSH configuration Upgrades are (almost) atomic Components are stored safely next to each other, due to hashes No files are automatically removed or overwritten Users can switch to older generations of system configurations not garbage collected yet Sander van der Burg The NixOS project and deploying systems declaratively
  • 22. NixOS bootloader Sander van der Burg The NixOS project and deploying systems declaratively
  • 23. Nix store Main idea: store all packages in isolation from each other: /nix/store/rpdqxnilb0cg... -firefox-3.5.4 Paths contain a 160-bit cryptographic hash of all inputs used to build the package: Sources Libraries Compilers Build scripts . . . /nix/store l9w6773m1msy...-openssh-4.6p1 bin ssh sbin sshd smkabrbibqv7...-openssl-0.9.8e lib libssl.so.0.9.8 c6jbqm2mc0a7...-zlib-1.2.3 lib libz.so.1.2.3 im276akmsrhv...-glibc-2.5 lib libc.so.6 Sander van der Burg The NixOS project and deploying systems declaratively
  • 24. Nix expressions openssh.nix { stdenv, fetchurl, openssl, zlib }: stdenv.mkDerivation { name = "openssh-4.6p1"; src = fetchurl { url = http://.../openssh-4.6p1.tar.gz; sha256 = "0fpjlr3bfind0y94bk442x2p..."; }; buildCommand = ’’ tar xjf $src ./configure --prefix=$out --with-openssl=${openssl} make; make install ’’; } Sander van der Burg The NixOS project and deploying systems declaratively
  • 25. Nix expressions all-packages.nix openssh = import ../tools/networking/openssh { inherit fetchurl stdenv openssl zlib; }; openssl = import ../development/libraries/openssl { inherit fetchurl stdenv perl; }; stdenv = ...; openssl = ...; zlib = ...; perl = ...; nix-env -f all-packages.nix -iA openssh Produces a /nix/store/l9w6773m1msy...-openssh-4.6p1 package in the Nix store. Sander van der Burg The NixOS project and deploying systems declaratively
  • 26. User environments Users can have different sets of installed applications. PATH /nix/.../profiles current 42 /nix/store pp56i0a01si5...-user-env bin firefox ssh l9w6773m1msy...-openssh-4.6p1 bin ssh rpdqxnilb0cg...-firefox-3.5.4 bin firefox Sander van der Burg The NixOS project and deploying systems declaratively
  • 27. User environments Users can have different sets of installed applications. nix-env operations create new user environments in the store. PATH /nix/.../profiles current 42 /nix/store pp56i0a01si5...-user-env bin firefox ssh l9w6773m1msy...-openssh-4.6p1 bin ssh rpdqxnilb0cg...-firefox-3.5.4 bin firefox aqn3wygq9jzk...-openssh-5.2p1 bin ssh (nix-env -u openssh) Sander van der Burg The NixOS project and deploying systems declaratively
  • 28. User environments Users can have different sets of installed applications. nix-env operations create new user environments in the store. PATH /nix/.../profiles current 42 /nix/store pp56i0a01si5...-user-env bin firefox ssh l9w6773m1msy...-openssh-4.6p1 bin ssh rpdqxnilb0cg...-firefox-3.5.4 bin firefox aqn3wygq9jzk...-openssh-5.2p1 bin ssh i3d9vh6d8ip1...-user-env bin ssh firefox (nix-env -u openssh) Sander van der Burg The NixOS project and deploying systems declaratively
  • 29. User environments Users can have different sets of installed applications. nix-env operations create new user environments in the store. PATH /nix/.../profiles current 42 43 /nix/store pp56i0a01si5...-user-env bin firefox ssh l9w6773m1msy...-openssh-4.6p1 bin ssh rpdqxnilb0cg...-firefox-3.5.4 bin firefox aqn3wygq9jzk...-openssh-5.2p1 bin ssh i3d9vh6d8ip1...-user-env bin ssh firefox (nix-env -u openssh) Sander van der Burg The NixOS project and deploying systems declaratively
  • 30. User environments Users can have different sets of installed applications. nix-env operations create new user environments in the store. We can atomically switch between them. PATH /nix/.../profiles current 42 43 /nix/store pp56i0a01si5...-user-env bin firefox ssh l9w6773m1msy...-openssh-4.6p1 bin ssh rpdqxnilb0cg...-firefox-3.5.4 bin firefox aqn3wygq9jzk...-openssh-5.2p1 bin ssh i3d9vh6d8ip1...-user-env bin ssh firefox (nix-env -u openssh) Sander van der Burg The NixOS project and deploying systems declaratively
  • 31. User environments Users can have different sets of installed applications. nix-env operations create new user environments in the store. We can atomically switch between them. These are roots of the garbage collector. PATH /nix/.../profiles current 43 /nix/store pp56i0a01si5...-user-env bin firefox ssh l9w6773m1msy...-openssh-4.6p1 bin ssh rpdqxnilb0cg...-firefox-3.5.4 bin firefox aqn3wygq9jzk...-openssh-5.2p1 bin ssh i3d9vh6d8ip1...-user-env bin ssh firefox (nix-env --remove-generations old) Sander van der Burg The NixOS project and deploying systems declaratively
  • 32. User environments Users can have different sets of installed applications. nix-env operations create new user environments in the store. We can atomically switch between them. These are roots of the garbage collector. PATH /nix/.../profiles current 43 /nix/store rpdqxnilb0cg...-firefox-3.5.4 bin firefox aqn3wygq9jzk...-openssh-5.2p1 bin ssh i3d9vh6d8ip1...-user-env bin ssh firefox (nix-collect-garbage) Sander van der Burg The NixOS project and deploying systems declaratively
  • 33. NixOS In NixOS, all packages including the Linux kernel and configuration files are managed by Nix. NixOS does not have directories such as: /lib and /usr NixOS has a minimal /bin and /etc Sander van der Burg The NixOS project and deploying systems declaratively
  • 34. Distributed deployment NixOS has good properties for deployment of a single system Can we extend these properties to distributed systems? Sander van der Burg The NixOS project and deploying systems declaratively
  • 35. Motivating example: Trac Sander van der Burg The NixOS project and deploying systems declaratively
  • 36. Motivating example: Trac Trac can be deployed in a distributed environment: Subversion server Database server Web server Sander van der Burg The NixOS project and deploying systems declaratively
  • 37. Distributed NixOS configuration network.nix { storage = {pkgs, ...}: { services.nfsKernel.server.enable = true; ... }; postgresql = {pkgs, ...}: { services.postgresql.enable = true; ... }; webserver = {pkgs, ...}: { fileSystems = [ { mountPoint = "/repos"; device = "storage:/repos"; } ]; services.httpd.enable = true; services.httpd.extraSubservices = [ { serviceType = "trac"; } ]; ... }; ... } Sander van der Burg The NixOS project and deploying systems declaratively
  • 38. Distributed deployment $ nixops create network.nix -d production $ nixops deploy -d production Build system configurations by the Nix package manager Transfer complete system and all dependencies to target machines in the network Efficient: only missing store paths must be transferred Safe: Existing configuration is not affected, because no files are overwritten or removed Activate new system configuration In case of a failure, roll back all configurations Relatively cheap operation, because old configuration is stored next to new configuration Sander van der Burg The NixOS project and deploying systems declaratively
  • 39. The Nix project Tools part of the Nix-project: http://nixos.org: Nix. A purely functional package manager NixOS. Nix based GNU/Linux distribution Hydra. Nix based continuous build and integration server Disnix. Nix based distributed service deployment NixOps. NixOS-based multi-cloud deployment tool Sander van der Burg The NixOS project and deploying systems declaratively
  • 40. The Nix project Automated deployment using declarative specifications with the following properties: Generic. Can be used with many programming languages, component technologies, and operating systems. Reproducible. (Almost) no impurities – if inputs are the same, result should be the same regardless of its location Reliable. Dependency completeness, (almost) atomic upgrades and rollbacks. Efficient. Only the required deployment activities are executed. Sander van der Burg The NixOS project and deploying systems declaratively
  • 41. Nix-related tools: how declarative are they? Nix-related tools solve problems in a technical domain: e.g. deployment of packages, machines, services, ... What about your domain? Sander van der Burg The NixOS project and deploying systems declaratively
  • 42. A real world example: Conference Compass Conference Compass provides a service to improve the way people experience events Most visible part of the service: apps for conference attendees Each customer basically gets “their own” app. Sander van der Burg The NixOS project and deploying systems declaratively
  • 43. A real world example: Conference Compass We have a product-line using a Nix-based build infrastructure, including Hydra, driven by simple app specific configurations: { name = "wroclove.rb 2016"; homepage = "http://www.wrocloverb.com"; iconSet = ./icons; backgroundImage" = ./background.png; ... } Sander van der Burg The NixOS project and deploying systems declaratively
  • 44. A real world example: Conference Compass The app’s contents is customizable with a configurator service allowing organizers to create and update their content Apps connect to a configurator to retrieve the data to be displayed and other configuration settings Integration with third party information systems is also possible Sander van der Burg The NixOS project and deploying systems declaratively
  • 45. A real world example: Conference Compass { wrocloverb = { eventName = "wroclove.rb 2016"; domain = "http://www.wrocloverb.com"; channels = [ "wrocloverb" ]; }; otherevent = ...; yetanotherevent = ...; ... } We have developed a formalism to concisely model such configurations and to automatically deploy them Tool figures out which machines to configure, what services to deploy etc. If underlying implementation and technology evolves, specifications (probably) remains the same. Sander van der Burg The NixOS project and deploying systems declaratively
  • 46. Conclusions I have illustated a declarative deployment vision I have demonstrated NixOS and the Nix package manager I have explained that domain specific deployment tools can be built on top of tools from the Nix project Sander van der Burg The NixOS project and deploying systems declaratively
  • 47. References NixOS project homepage: http://nixos.org Software available under free and open-source licenses (LGPL/X11) Nix package manager can be used on any Linux system, Mac OS X, and (in some extent) Cygwin and FreeBSD. Sander van der Burg The NixOS project and deploying systems declaratively
  • 48. Questions Sander van der Burg The NixOS project and deploying systems declaratively