Nicolas B. Pierron
Goal:
A typical Linux system has, among others, the following directories: /bin This directory contains executable programs which are needed in single user mode and to bring the system up or repair it. /lib This directory should hold those shared libraries that are necessary to boot the system and to run the commands in the root filesystem.
derivation {
name = "my-package";
builder = ./builder.sh;
system = "x86-64-linux";
envvar = 1;
}
{ stdenv, fetchurl, zlib, bzip2, …, openssl }:
stdenv.mkDerivation {
name = "python3-3.4.2";
src = fetchurl {
url = http://www.python.org/…/Python-3.4.2.tar.xz ;
sha256 = "1vrd9gqd…s619cv8w";
};
buildInputs = [ zlib bzip2 … openssl ];
// default: ./configure --prefix=$out; make; make install
}
python34.override {
# Test with LibreSSL fork.
openssl = libressl;
}
lib.overrideDerivation python34 {
# Do not fetch the sources
# Use a local copy instead.
src = /home/nicolas/cpython ;
}
Principle: Automate the configuration to reproduce it.
Many tools:
Only describe a subset of the configuration.
Incomplete: Cannot describe the absence of all unused packages.
Complete: Anything which is included is present.
Many tools:
{
services.openssh.enable = true;
users.extraUsers.root.openssh.authorizedKeys.keyFiles = [
/home/nicolas/.ssh/id.pub
];
}
{
imports = [ ./minimal-conf.nix ];
services.httpd = {
enable = true;
adminAddr = "email@local.host";
documentRoot = ./. ; # Serve the current directory
};
networking.firewall.allowedTCPPorts = [ 80 ];
}
{
pres =
{ config, pkgs, ... }:
{ imports = [ ./modular-conf.nix ];
deployment.targetEnv = "container";
deployment.container.host = "jupiter.nbp.name";
};
}
Benefits of isolation: