From 103e4e43cc09df94348b08cfc4883dfa388d3d20 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 24 Nov 2014 15:14:07 +0100 Subject: [PATCH] Update quick start section --- doc/manual/introduction/about-nix.xml | 70 ++++++++++++++++++------- doc/manual/introduction/quick-start.xml | 33 ++++++++++-- 2 files changed, 81 insertions(+), 22 deletions(-) diff --git a/doc/manual/introduction/about-nix.xml b/doc/manual/introduction/about-nix.xml index 4860b3d38..54c18a1e6 100644 --- a/doc/manual/introduction/about-nix.xml +++ b/doc/manual/introduction/about-nix.xml @@ -4,7 +4,7 @@ version="5.0" xml:id="ch-about-nix"> -Introduction +About Nix Nix is a purely functional package manager. This means that it treats packages like values in purely functional @@ -16,10 +16,10 @@ store, usually the directory subdirectory such as -/nix/store/nlc4z5y1hm8w9s8vm6m1f5hy962xjmp5-firefox-12.0 +/nix/store/b6gvzjyb2pg0kjfwrjmg1vfhh54ad73z-firefox-33.1/ -where nlc4z5… is a unique identifier for the +where b6gvzjyb2pg0… is a unique identifier for the package that captures all its dependencies (it’s a cryptographic hash of the package’s build dependency graph). This enables many powerful features. @@ -165,12 +165,6 @@ skip building from source and download a pre-built binary instead if it knows about it. Nix channels provide Nix expressions along with pre-built binaries. - - @@ -193,10 +187,48 @@ collection (Nixpkgs). +Managing build environments + +Nix is extremely useful for developers as it makes it easy to +automatically set up the the build environment for a package. Given a +Nix expression that describes the dependencies of your package, the +command nix-shell will build or download those +dependencies if they’re not already in your Nix store, and then start +a Bash shell in which all necessary environment variables (such as +compiler search paths) are set. + +For example, the following command gets all dependencies of the +Pan newsreader, as described by its +Nix expression: + + +$ nix-shell '<nixpkgs>' -A pan + + +You’re then dropped into a shell where you can edit, build and test +the package: + + +[nix-shell]$ tar xf $src +[nix-shell]$ cd pan-* +[nix-shell]$ ./configure +[nix-shell]$ make +[nix-shell]$ ./pan/gui/pan + + + + + + + Portability -Nix should run on most Unix systems, including Linux and Mac OS -X. +Nix runs on Linux and Mac OS X. @@ -206,20 +238,22 @@ X. NixOS is a Linux distribution based on Nix. It uses Nix not just for package management but also to manage the system configuration (e.g., to build configuration files in -/etc). This means, among other things, that it’s -possible to easily roll back the entire configuration of the system to -an earlier state. Also, users can install software without root +/etc). This means, among other things, that it +is easy to roll back the entire configuration of the system to an +earlier state. Also, users can install software without root privileges. For more information and downloads, see the NixOS homepage. - diff --git a/doc/manual/introduction/quick-start.xml b/doc/manual/introduction/quick-start.xml index 396b7b167..0d13651e0 100644 --- a/doc/manual/introduction/quick-start.xml +++ b/doc/manual/introduction/quick-start.xml @@ -28,10 +28,11 @@ in the channel: $ nix-env -qa -docbook-xml-4.2 -firefox-1.0pre-PR-0.10.1 -hello-2.1.1 -libxslt-1.1.0 +docbook-xml-4.3 +docbook-xml-4.5 +firefox-33.0.2 +hello-2.9 +libxslt-1.1.28 ... @@ -62,6 +63,28 @@ $ nix-env -e hello +You can also test a package without installing it: + + +$ nix-shell -p hello + + +This builds or downloads GNU Hello and its dependencies, then drops +you into a Bash shell where the hello command is +present, all without affecting your normal environment: + + +[nix-shell:~]$ hello +Hello, world! + +[nix-shell:~]$ exit + +$ hello +hello: command not found + + + + To keep up-to-date with the channel, do: @@ -72,6 +95,7 @@ The latter command will upgrade each installed package for which there is a “newer” version (as determined by comparing the version numbers). + If you're unhappy with the result of a nix-env action (e.g., an upgraded package turned