Merge staging-next into staging
This commit is contained in:
commit
f120248daf
|
@ -921,7 +921,7 @@ src = fetchFromGitHub {
|
|||
<para>
|
||||
You can convert between formats with nix-hash, for example:
|
||||
<screen>
|
||||
$ nix-hash --type sha256 --to-base32 <replaceable>HASH</replaceable>
|
||||
<prompt>$ </prompt>nix-hash --type sha256 --to-base32 <replaceable>HASH</replaceable>
|
||||
</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -1038,7 +1038,7 @@ patches = [ ./0001-changes.patch ];
|
|||
<para>
|
||||
Move to the root directory of the source code you're patching.
|
||||
<screen>
|
||||
$ cd the/program/source</screen>
|
||||
<prompt>$ </prompt>cd the/program/source</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -1046,8 +1046,8 @@ $ cd the/program/source</screen>
|
|||
If a git repository is not already present, create one and stage all of
|
||||
the source files.
|
||||
<screen>
|
||||
$ git init
|
||||
$ git add .</screen>
|
||||
<prompt>$ </prompt>git init
|
||||
<prompt>$ </prompt>git add .</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -1060,7 +1060,7 @@ $ git add .</screen>
|
|||
<para>
|
||||
Use git to create a diff, and pipe the output to a patch file:
|
||||
<screen>
|
||||
$ git diff > nixpkgs/pkgs/the/package/0001-changes.patch</screen>
|
||||
<prompt>$ </prompt>git diff > nixpkgs/pkgs/the/package/0001-changes.patch</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
|
|
@ -12,9 +12,9 @@ xlink:href="https://github.com/NixOS/nixpkgs/tree/master/doc">doc</filename>
|
|||
You can quickly check your edits with <command>make</command>:
|
||||
</para>
|
||||
<screen>
|
||||
$ cd /path/to/nixpkgs/doc
|
||||
$ nix-shell
|
||||
[nix-shell]$ make
|
||||
<prompt>$ </prompt>cd /path/to/nixpkgs/doc
|
||||
<prompt>$ </prompt>nix-shell
|
||||
<prompt>[nix-shell]$ </prompt>make
|
||||
</screen>
|
||||
<para>
|
||||
If you experience problems, run <command>make debug</command> to help
|
||||
|
@ -24,10 +24,10 @@ xlink:href="https://github.com/NixOS/nixpkgs/tree/master/doc">doc</filename>
|
|||
After making modifications to the manual, it's important to build it before
|
||||
committing. You can do that as follows:
|
||||
<screen>
|
||||
$ cd /path/to/nixpkgs/doc
|
||||
$ nix-shell
|
||||
[nix-shell]$ make clean
|
||||
[nix-shell]$ nix-build .
|
||||
<prompt>$ </prompt>cd /path/to/nixpkgs/doc
|
||||
<prompt>$ </prompt>nix-shell
|
||||
<prompt>[nix-shell]$ </prompt>make clean
|
||||
<prompt>[nix-shell]$ </prompt>nix-build .
|
||||
</screen>
|
||||
If the build succeeds, the manual will be in
|
||||
<filename>./result/share/doc/nixpkgs/manual.html</filename>.
|
||||
|
|
|
@ -52,7 +52,7 @@ spot sensor temperature 0.000000, unit celsius, color scheme 0, calibration: off
|
|||
|
||||
<prompt>$ </prompt>file -k type2.AppImage
|
||||
type2.AppImage: ELF 64-bit LSB executable, x86-64, version 1 (SYSV) (Lepton 3.x), scale 232-60668, spot sensor temperature -4.187500, color scheme 15, show scale bar, calibration: offset -0.000000, slope 0.000000 (Lepton 2.x), scale 4111-45000, spot sensor temperature 412442.250000, color scheme 3, minimum point enabled, calibration: offset -75402534979642766821519867692934234112.000000, slope 5815371847733706829839455140374904832.000000, dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=79dcc4e55a61c293c5e19edbd8d65b202842579f, stripped\012- data
|
||||
</screen>
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
Note how the type 1 AppImage is described as an <literal>ISO 9660 CD-ROM
|
||||
|
|
|
@ -480,9 +480,9 @@ pullImage {
|
|||
<literal>nix-prefetch-docker</literal> command can be used to get required
|
||||
image parameters:
|
||||
|
||||
<programlisting>
|
||||
$ nix run nixpkgs.nix-prefetch-docker -c nix-prefetch-docker --image-name mysql --image-tag 5
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>nix run nixpkgs.nix-prefetch-docker -c nix-prefetch-docker --image-name mysql --image-tag 5
|
||||
</screen>
|
||||
|
||||
Since a given <varname>imageName</varname> may transparently refer to a
|
||||
manifest list of images which support multiple architectures and/or
|
||||
|
@ -491,17 +491,17 @@ $ nix run nixpkgs.nix-prefetch-docker -c nix-prefetch-docker --image-name mysql
|
|||
By default it will match the OS and architecture of the host the command is
|
||||
run on.
|
||||
|
||||
<programlisting>
|
||||
$ nix-prefetch-docker --image-name mysql --image-tag 5 --arch x86_64 --os linux
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>nix-prefetch-docker --image-name mysql --image-tag 5 --arch x86_64 --os linux
|
||||
</screen>
|
||||
|
||||
Desired image name and tag can be set using
|
||||
<option>--final-image-name</option> and <option>--final-image-tag</option>
|
||||
arguments:
|
||||
|
||||
<programlisting>
|
||||
$ nix-prefetch-docker --image-name mysql --image-tag 5 --final-image-name eu.gcr.io/my-project/mysql --final-image-tag prod
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>nix-prefetch-docker --image-name mysql --image-tag 5 --final-image-name eu.gcr.io/my-project/mysql --final-image-tag prod
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
@ -537,7 +537,7 @@ exportImage {
|
|||
|
||||
name = someLayeredImage.name;
|
||||
}
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -10,16 +10,16 @@
|
|||
upload while the builder can fetch faster directly from the source. To use
|
||||
it, put the following snippet as a new overlay:
|
||||
<programlisting>
|
||||
self: super:
|
||||
(super.prefer-remote-fetch self super)
|
||||
</programlisting>
|
||||
self: super:
|
||||
(super.prefer-remote-fetch self super)
|
||||
</programlisting>
|
||||
A full configuration example for that sets the overlay up for your own
|
||||
account, could look like this
|
||||
<programlisting>
|
||||
$ mkdir ~/.config/nixpkgs/overlays/
|
||||
$ cat > ~/.config/nixpkgs/overlays/prefer-remote-fetch.nix <<EOF
|
||||
self: super: super.prefer-remote-fetch self super
|
||||
EOF
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>mkdir ~/.config/nixpkgs/overlays/
|
||||
<prompt>$ </prompt>cat > ~/.config/nixpkgs/overlays/prefer-remote-fetch.nix <<EOF
|
||||
self: super: super.prefer-remote-fetch self super
|
||||
EOF
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
|
|
@ -35,25 +35,25 @@
|
|||
An example of using <literal>runCommand</literal> is provided below.
|
||||
</para>
|
||||
<programlisting>
|
||||
(import <nixpkgs> {}).runCommand "my-example" {} ''
|
||||
echo My example command is running
|
||||
(import <nixpkgs> {}).runCommand "my-example" {} ''
|
||||
echo My example command is running
|
||||
|
||||
mkdir $out
|
||||
mkdir $out
|
||||
|
||||
echo I can write data to the Nix store > $out/message
|
||||
echo I can write data to the Nix store > $out/message
|
||||
|
||||
echo I can also run basic commands like:
|
||||
echo I can also run basic commands like:
|
||||
|
||||
echo ls
|
||||
ls
|
||||
echo ls
|
||||
ls
|
||||
|
||||
echo whoami
|
||||
whoami
|
||||
echo whoami
|
||||
whoami
|
||||
|
||||
echo date
|
||||
date
|
||||
''
|
||||
</programlisting>
|
||||
echo date
|
||||
date
|
||||
''
|
||||
</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
|
|
@ -131,8 +131,8 @@
|
|||
in <literal>beamPackages</literal>, use the following command:
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
$ nix-env -f "<nixpkgs>" -qaP -A beamPackages
|
||||
<screen>
|
||||
<prompt>$ </prompt>nix-env -f "<nixpkgs>" -qaP -A beamPackages
|
||||
beamPackages.esqlite esqlite-0.2.1
|
||||
beamPackages.goldrush goldrush-0.1.7
|
||||
beamPackages.ibrowse ibrowse-4.2.2
|
||||
|
@ -140,16 +140,16 @@ beamPackages.jiffy jiffy-0.14.5
|
|||
beamPackages.lager lager-3.0.2
|
||||
beamPackages.meck meck-0.8.3
|
||||
beamPackages.rebar3-pc pc-1.1.0
|
||||
</programlisting>
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
To install any of those packages into your profile, refer to them by their
|
||||
attribute path (first column):
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
$ nix-env -f "<nixpkgs>" -iA beamPackages.ibrowse
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>nix-env -f "<nixpkgs>" -iA beamPackages.ibrowse
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
The attribute path of any BEAM package corresponds to the name of that
|
||||
|
@ -178,22 +178,22 @@ $ nix-env -f "<nixpkgs>" -iA beamPackages.ibrowse
|
|||
</para>
|
||||
|
||||
<programlisting>
|
||||
{ stdenv, fetchFromGitHub, buildRebar3, ibrowse, jsx, erlware_commons }:
|
||||
{ stdenv, fetchFromGitHub, buildRebar3, ibrowse, jsx, erlware_commons }:
|
||||
|
||||
buildRebar3 rec {
|
||||
name = "hex2nix";
|
||||
version = "0.0.1";
|
||||
buildRebar3 rec {
|
||||
name = "hex2nix";
|
||||
version = "0.0.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ericbmerritt";
|
||||
repo = "hex2nix";
|
||||
rev = "${version}";
|
||||
sha256 = "1w7xjidz1l5yjmhlplfx7kphmnpvqm67w99hd2m7kdixwdxq0zqg";
|
||||
};
|
||||
src = fetchFromGitHub {
|
||||
owner = "ericbmerritt";
|
||||
repo = "hex2nix";
|
||||
rev = "${version}";
|
||||
sha256 = "1w7xjidz1l5yjmhlplfx7kphmnpvqm67w99hd2m7kdixwdxq0zqg";
|
||||
};
|
||||
|
||||
beamDeps = [ ibrowse jsx erlware_commons ];
|
||||
}
|
||||
</programlisting>
|
||||
beamDeps = [ ibrowse jsx erlware_commons ];
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
Such derivations are callable with
|
||||
|
@ -228,29 +228,29 @@ $ nix-env -f "<nixpkgs>" -iA beamPackages.ibrowse
|
|||
</para>
|
||||
|
||||
<programlisting>
|
||||
{ buildErlangMk, fetchHex, cowlib, ranch }:
|
||||
{ buildErlangMk, fetchHex, cowlib, ranch }:
|
||||
|
||||
buildErlangMk {
|
||||
name = "cowboy";
|
||||
version = "1.0.4";
|
||||
buildErlangMk {
|
||||
name = "cowboy";
|
||||
version = "1.0.4";
|
||||
|
||||
src = fetchHex {
|
||||
pkg = "cowboy";
|
||||
version = "1.0.4";
|
||||
sha256 = "6a0edee96885fae3a8dd0ac1f333538a42e807db638a9453064ccfdaa6b9fdac";
|
||||
};
|
||||
src = fetchHex {
|
||||
pkg = "cowboy";
|
||||
version = "1.0.4";
|
||||
sha256 = "6a0edee96885fae3a8dd0ac1f333538a42e807db638a9453064ccfdaa6b9fdac";
|
||||
};
|
||||
|
||||
beamDeps = [ cowlib ranch ];
|
||||
beamDeps = [ cowlib ranch ];
|
||||
|
||||
meta = {
|
||||
description = ''
|
||||
Small, fast, modular HTTP server written in Erlang
|
||||
'';
|
||||
license = stdenv.lib.licenses.isc;
|
||||
homepage = https://github.com/ninenines/cowboy;
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
meta = {
|
||||
description = ''
|
||||
Small, fast, modular HTTP server written in Erlang
|
||||
'';
|
||||
license = stdenv.lib.licenses.isc;
|
||||
homepage = https://github.com/ninenines/cowboy;
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
<section xml:id="mix-packages">
|
||||
|
@ -262,56 +262,56 @@ $ nix-env -f "<nixpkgs>" -iA beamPackages.ibrowse
|
|||
</para>
|
||||
|
||||
<programlisting>
|
||||
{ buildMix, fetchHex, plug, absinthe }:
|
||||
{ buildMix, fetchHex, plug, absinthe }:
|
||||
|
||||
buildMix {
|
||||
name = "absinthe_plug";
|
||||
version = "1.0.0";
|
||||
buildMix {
|
||||
name = "absinthe_plug";
|
||||
version = "1.0.0";
|
||||
|
||||
src = fetchHex {
|
||||
pkg = "absinthe_plug";
|
||||
version = "1.0.0";
|
||||
sha256 = "08459823fe1fd4f0325a8bf0c937a4520583a5a26d73b193040ab30a1dfc0b33";
|
||||
};
|
||||
src = fetchHex {
|
||||
pkg = "absinthe_plug";
|
||||
version = "1.0.0";
|
||||
sha256 = "08459823fe1fd4f0325a8bf0c937a4520583a5a26d73b193040ab30a1dfc0b33";
|
||||
};
|
||||
|
||||
beamDeps = [ plug absinthe ];
|
||||
beamDeps = [ plug absinthe ];
|
||||
|
||||
meta = {
|
||||
description = ''
|
||||
A plug for Absinthe, an experimental GraphQL toolkit
|
||||
'';
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
homepage = https://github.com/CargoSense/absinthe_plug;
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
meta = {
|
||||
description = ''
|
||||
A plug for Absinthe, an experimental GraphQL toolkit
|
||||
'';
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
homepage = https://github.com/CargoSense/absinthe_plug;
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
Alternatively, we can use <literal>buildHex</literal> as a shortcut:
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
{ buildHex, buildMix, plug, absinthe }:
|
||||
{ buildHex, buildMix, plug, absinthe }:
|
||||
|
||||
buildHex {
|
||||
name = "absinthe_plug";
|
||||
version = "1.0.0";
|
||||
buildHex {
|
||||
name = "absinthe_plug";
|
||||
version = "1.0.0";
|
||||
|
||||
sha256 = "08459823fe1fd4f0325a8bf0c937a4520583a5a26d73b193040ab30a1dfc0b33";
|
||||
sha256 = "08459823fe1fd4f0325a8bf0c937a4520583a5a26d73b193040ab30a1dfc0b33";
|
||||
|
||||
builder = buildMix;
|
||||
builder = buildMix;
|
||||
|
||||
beamDeps = [ plug absinthe ];
|
||||
beamDeps = [ plug absinthe ];
|
||||
|
||||
meta = {
|
||||
description = ''
|
||||
A plug for Absinthe, an experimental GraphQL toolkit
|
||||
'';
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
homepage = https://github.com/CargoSense/absinthe_plug;
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
meta = {
|
||||
description = ''
|
||||
A plug for Absinthe, an experimental GraphQL toolkit
|
||||
'';
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
homepage = https://github.com/CargoSense/absinthe_plug;
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -330,47 +330,47 @@ $ nix-env -f "<nixpkgs>" -iA beamPackages.ibrowse
|
|||
could do the following:
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
$ nix-shell -A beamPackages.ibrowse.env --run "erl"
|
||||
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
|
||||
<screen>
|
||||
<prompt>$ </prompt><userinput>nix-shell -A beamPackages.ibrowse.env --run "erl"</userinput>
|
||||
<computeroutput>Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
|
||||
|
||||
Eshell V7.0 (abort with ^G)
|
||||
1> m(ibrowse).
|
||||
Module: ibrowse
|
||||
MD5: 3b3e0137d0cbb28070146978a3392945
|
||||
Compiled: January 10 2016, 23:34
|
||||
Object file: /nix/store/g1rlf65rdgjs4abbyj4grp37ry7ywivj-ibrowse-4.2.2/lib/erlang/lib/ibrowse-4.2.2/ebin/ibrowse.beam
|
||||
Compiler options: [{outdir,"/tmp/nix-build-ibrowse-4.2.2.drv-0/hex-source-ibrowse-4.2.2/_build/default/lib/ibrowse/ebin"},
|
||||
debug_info,debug_info,nowarn_shadow_vars,
|
||||
warn_unused_import,warn_unused_vars,warnings_as_errors,
|
||||
{i,"/tmp/nix-build-ibrowse-4.2.2.drv-0/hex-source-ibrowse-4.2.2/_build/default/lib/ibrowse/include"}]
|
||||
Exports:
|
||||
add_config/1 send_req_direct/7
|
||||
all_trace_off/0 set_dest/3
|
||||
code_change/3 set_max_attempts/3
|
||||
get_config_value/1 set_max_pipeline_size/3
|
||||
get_config_value/2 set_max_sessions/3
|
||||
get_metrics/0 show_dest_status/0
|
||||
get_metrics/2 show_dest_status/1
|
||||
handle_call/3 show_dest_status/2
|
||||
handle_cast/2 spawn_link_worker_process/1
|
||||
handle_info/2 spawn_link_worker_process/2
|
||||
init/1 spawn_worker_process/1
|
||||
module_info/0 spawn_worker_process/2
|
||||
module_info/1 start/0
|
||||
rescan_config/0 start_link/0
|
||||
rescan_config/1 stop/0
|
||||
send_req/3 stop_worker_process/1
|
||||
send_req/4 stream_close/1
|
||||
send_req/5 stream_next/1
|
||||
send_req/6 terminate/2
|
||||
send_req_direct/4 trace_off/0
|
||||
send_req_direct/5 trace_off/2
|
||||
send_req_direct/6 trace_on/0
|
||||
trace_on/2
|
||||
ok
|
||||
2>
|
||||
</programlisting>
|
||||
Eshell V7.0 (abort with ^G)</computeroutput>
|
||||
<prompt>1> </prompt><userinput>m(ibrowse).</userinput>
|
||||
<computeroutput>Module: ibrowse
|
||||
MD5: 3b3e0137d0cbb28070146978a3392945
|
||||
Compiled: January 10 2016, 23:34
|
||||
Object file: /nix/store/g1rlf65rdgjs4abbyj4grp37ry7ywivj-ibrowse-4.2.2/lib/erlang/lib/ibrowse-4.2.2/ebin/ibrowse.beam
|
||||
Compiler options: [{outdir,"/tmp/nix-build-ibrowse-4.2.2.drv-0/hex-source-ibrowse-4.2.2/_build/default/lib/ibrowse/ebin"},
|
||||
debug_info,debug_info,nowarn_shadow_vars,
|
||||
warn_unused_import,warn_unused_vars,warnings_as_errors,
|
||||
{i,"/tmp/nix-build-ibrowse-4.2.2.drv-0/hex-source-ibrowse-4.2.2/_build/default/lib/ibrowse/include"}]
|
||||
Exports:
|
||||
add_config/1 send_req_direct/7
|
||||
all_trace_off/0 set_dest/3
|
||||
code_change/3 set_max_attempts/3
|
||||
get_config_value/1 set_max_pipeline_size/3
|
||||
get_config_value/2 set_max_sessions/3
|
||||
get_metrics/0 show_dest_status/0
|
||||
get_metrics/2 show_dest_status/1
|
||||
handle_call/3 show_dest_status/2
|
||||
handle_cast/2 spawn_link_worker_process/1
|
||||
handle_info/2 spawn_link_worker_process/2
|
||||
init/1 spawn_worker_process/1
|
||||
module_info/0 spawn_worker_process/2
|
||||
module_info/1 start/0
|
||||
rescan_config/0 start_link/0
|
||||
rescan_config/1 stop/0
|
||||
send_req/3 stop_worker_process/1
|
||||
send_req/4 stream_close/1
|
||||
send_req/5 stream_next/1
|
||||
send_req/6 terminate/2
|
||||
send_req_direct/4 trace_off/0
|
||||
send_req_direct/5 trace_off/2
|
||||
send_req_direct/6 trace_on/0
|
||||
trace_on/2
|
||||
ok</computeroutput>
|
||||
<prompt>2></prompt>
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
Notice the <literal>-A beamPackages.ibrowse.env</literal>. That is the key
|
||||
|
@ -408,7 +408,7 @@ let
|
|||
in
|
||||
|
||||
drv
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
|
||||
<section xml:id="building-in-a-shell">
|
||||
<title>Building in a Shell (for Mix Projects)</title>
|
||||
|
@ -474,7 +474,7 @@ plt:
|
|||
analyze: build plt
|
||||
$(NIX_SHELL) --run "mix dialyzer --no-compile"
|
||||
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
Using a <literal>shell.nix</literal> as described (see
|
||||
|
@ -513,9 +513,9 @@ analyze: build plt
|
|||
<literal>nixpkgs</literal> repository:
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
$ nix-build -A beamPackages
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>nix-build -A beamPackages
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
That will attempt to build every package in <literal>beamPackages</literal>.
|
||||
|
|
|
@ -218,12 +218,12 @@ deis = buildGoPackage rec {
|
|||
<varname>bin</varname> includes program binaries. You can test build a Go
|
||||
binary as follows:
|
||||
<screen>
|
||||
$ nix-build -A deis.bin
|
||||
</screen>
|
||||
<prompt>$ </prompt>nix-build -A deis.bin
|
||||
</screen>
|
||||
or build all outputs with:
|
||||
<screen>
|
||||
$ nix-build -A deis.all
|
||||
</screen>
|
||||
<prompt>$ </prompt>nix-build -A deis.all
|
||||
</screen>
|
||||
<varname>bin</varname> output will be installed by default with
|
||||
<varname>nix-env -i</varname> or <varname>systemPackages</varname>.
|
||||
</para>
|
||||
|
|
|
@ -68,7 +68,7 @@ installPhase =
|
|||
can be done in a generic fashion with the <literal>--set</literal> argument
|
||||
of <literal>makeWrapper</literal>:
|
||||
<programlisting>
|
||||
--set JAVA_HOME ${jdk.home}
|
||||
--set JAVA_HOME ${jdk.home}
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ fileSystem = buildLuaPackage {
|
|||
maintainers = with maintainers; [ flosse ];
|
||||
};
|
||||
};
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -62,7 +62,7 @@ buildDunePackage rec {
|
|||
maintainers = with stdenv.lib.maintainers; [ sternenseemann ];
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
Here is a second example, this time using a source archive generated with
|
||||
|
@ -93,5 +93,5 @@ buildDunePackage rec {
|
|||
maintainers = [ maintainers.eqyiel ];
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</section>
|
||||
|
|
|
@ -47,13 +47,13 @@ foo = import ../path/to/foo.nix {
|
|||
in <filename>all-packages.nix</filename>. You can test building a Perl
|
||||
package as follows:
|
||||
<screen>
|
||||
$ nix-build -A perlPackages.ClassC3
|
||||
<prompt>$ </prompt>nix-build -A perlPackages.ClassC3
|
||||
</screen>
|
||||
<varname>buildPerlPackage</varname> adds <literal>perl-</literal> to the
|
||||
start of the name attribute, so the package above is actually called
|
||||
<literal>perl-Class-C3-0.21</literal>. So to install it, you can say:
|
||||
<screen>
|
||||
$ nix-env -i perl-Class-C3
|
||||
<prompt>$ </prompt>nix-env -i perl-Class-C3
|
||||
</screen>
|
||||
(Of course you can also install using the attribute name: <literal>nix-env -i
|
||||
-A perlPackages.ClassC3</literal>.)
|
||||
|
@ -148,7 +148,7 @@ ClassC3Componentised = buildPerlPackage rec {
|
|||
</para>
|
||||
|
||||
<screen>
|
||||
$ nix-env -i nix-generate-from-cpan
|
||||
<prompt>$ </prompt>nix-env -i nix-generate-from-cpan
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
|
@ -156,7 +156,7 @@ $ nix-env -i nix-generate-from-cpan
|
|||
unpacks the corresponding package, and prints a Nix expression on standard
|
||||
output. For example:
|
||||
<screen>
|
||||
$ nix-generate-from-cpan XML::Simple
|
||||
<prompt>$ </prompt>nix-generate-from-cpan XML::Simple
|
||||
XMLSimple = buildPerlPackage rec {
|
||||
name = "XML-Simple-2.22";
|
||||
src = fetchurl {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
texlive.combine {
|
||||
inherit (texlive) scheme-small collection-langkorean algorithms cm-super;
|
||||
}
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
There are all the schemes, collections and a few thousand packages, as
|
||||
defined upstream (perhaps with tiny differences).
|
||||
</para>
|
||||
|
@ -44,7 +44,7 @@ texlive.combine {
|
|||
# elem tlType [ "run" "bin" "doc" "source" ]
|
||||
# there are also other attributes: version, name
|
||||
}
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
|
|
@ -30,7 +30,7 @@ meta = with stdenv.lib; {
|
|||
The meta-attributes of a package can be queried from the command-line using
|
||||
<command>nix-env</command>:
|
||||
<screen>
|
||||
$ nix-env -qa hello --json
|
||||
<prompt>$ </prompt>nix-env -qa hello --json
|
||||
{
|
||||
"hello": {
|
||||
"meta": {
|
||||
|
@ -70,7 +70,7 @@ $ nix-env -qa hello --json
|
|||
<command>nix-env</command> knows about the <varname>description</varname>
|
||||
field specifically:
|
||||
<screen>
|
||||
$ nix-env -qa hello --description
|
||||
<prompt>$ </prompt>nix-env -qa hello --description
|
||||
hello-2.3 A program that produces a familiar, friendly greeting
|
||||
</screen>
|
||||
</para>
|
||||
|
|
|
@ -92,9 +92,9 @@ modulesTree = [kernel]
|
|||
<para>
|
||||
If needed you can also run <literal>make menuconfig</literal>:
|
||||
<screen>
|
||||
$ nix-env -i ncurses
|
||||
$ export NIX_CFLAGS_LINK=-lncurses
|
||||
$ make menuconfig ARCH=<replaceable>arch</replaceable></screen>
|
||||
<prompt>$ </prompt>nix-env -i ncurses
|
||||
<prompt>$ </prompt>export NIX_CFLAGS_LINK=-lncurses
|
||||
<prompt>$ </prompt>make menuconfig ARCH=<replaceable>arch</replaceable></screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -142,8 +142,8 @@ $ make menuconfig ARCH=<replaceable>arch</replaceable></screen>
|
|||
<para>
|
||||
The generator is invoked as follows:
|
||||
<screen>
|
||||
$ cd pkgs/servers/x11/xorg
|
||||
$ cat tarballs-7.5.list extra.list old.list \
|
||||
<prompt>$ </prompt>cd pkgs/servers/x11/xorg
|
||||
<prompt>$ </prompt>cat tarballs-7.5.list extra.list old.list \
|
||||
| perl ./generate-expr-from-tarballs.pl
|
||||
</screen>
|
||||
For each of the tarballs in the <filename>.list</filename> files, the script
|
||||
|
@ -160,8 +160,8 @@ $ cat tarballs-7.5.list extra.list old.list \
|
|||
A file like <filename>tarballs-7.5.list</filename> contains all tarballs in
|
||||
a X.org release. It can be generated like this:
|
||||
<screen>
|
||||
$ export i="mirror://xorg/X11R7.4/src/everything/"
|
||||
$ cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \
|
||||
<prompt>$ </prompt>export i="mirror://xorg/X11R7.4/src/everything/"
|
||||
<prompt>$ </prompt>cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \
|
||||
| perl -e 'while (<>) { if (/(href|HREF)="([^"]*.bz2)"/) { print "$ENV{'i'}$2\n"; }; }' \
|
||||
| sort > tarballs-7.4.list
|
||||
</screen>
|
||||
|
@ -210,7 +210,7 @@ $ cat $(PRINT_PATH=1 nix-prefetch-url $i | tail -n 1) \
|
|||
often available. It is possible to list available Eclipse packages by
|
||||
issuing the command:
|
||||
<screen>
|
||||
$ nix-env -f '<nixpkgs>' -qaP -A eclipses --description
|
||||
<prompt>$ </prompt>nix-env -f '<nixpkgs>' -qaP -A eclipses --description
|
||||
</screen>
|
||||
Once an Eclipse variant is installed it can be run using the
|
||||
<command>eclipse</command> command, as expected. From within Eclipse it is
|
||||
|
@ -250,7 +250,7 @@ packageOverrides = pkgs: {
|
|||
available for installation using <varname>eclipseWithPlugins</varname> by
|
||||
running
|
||||
<screen>
|
||||
$ nix-env -f '<nixpkgs>' -qaP -A eclipses.plugins --description
|
||||
<prompt>$ </prompt>nix-env -f '<nixpkgs>' -qaP -A eclipses.plugins --description
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
scripts.
|
||||
</para>
|
||||
<programlisting>
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
# ...
|
||||
buildPhase = ''
|
||||
$CC -o hello hello.c
|
||||
'';
|
||||
}
|
||||
</programlisting>
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
# ...
|
||||
buildPhase = ''
|
||||
$CC -o hello hello.c
|
||||
'';
|
||||
}
|
||||
</programlisting>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@ -39,12 +39,12 @@
|
|||
<function>fixupPhase</function>.
|
||||
</para>
|
||||
<programlisting>
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
# ...
|
||||
makeFlags = stdenv.lib.optional stdenv.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/libfoo.dylib";
|
||||
}
|
||||
</programlisting>
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
# ...
|
||||
makeFlags = stdenv.lib.optional stdenv.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/libfoo.dylib";
|
||||
}
|
||||
</programlisting>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@ -62,19 +62,19 @@
|
|||
<manvolnum>1</manvolnum></citerefentry> manpage.
|
||||
</para>
|
||||
<programlisting>
|
||||
dyld: Library not loaded: /nix/store/7hnmbscpayxzxrixrgxvvlifzlxdsdir-jq-1.5-lib/lib/libjq.1.dylib
|
||||
Referenced from: /private/tmp/nix-build-jq-1.5.drv-0/jq-1.5/tests/../jq
|
||||
Reason: image not found
|
||||
./tests/jqtest: line 5: 75779 Abort trap: 6
|
||||
</programlisting>
|
||||
dyld: Library not loaded: /nix/store/7hnmbscpayxzxrixrgxvvlifzlxdsdir-jq-1.5-lib/lib/libjq.1.dylib
|
||||
Referenced from: /private/tmp/nix-build-jq-1.5.drv-0/jq-1.5/tests/../jq
|
||||
Reason: image not found
|
||||
./tests/jqtest: line 5: 75779 Abort trap: 6
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
# ...
|
||||
doInstallCheck = true;
|
||||
installCheckTarget = "check";
|
||||
}
|
||||
</programlisting>
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
# ...
|
||||
doInstallCheck = true;
|
||||
installCheckTarget = "check";
|
||||
}
|
||||
</programlisting>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@ -85,15 +85,15 @@
|
|||
on xcode.
|
||||
</para>
|
||||
<programlisting>
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
# ...
|
||||
prePatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace '/usr/bin/xcrun clang' clang
|
||||
'';
|
||||
}
|
||||
</programlisting>
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
# ...
|
||||
prePatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace '/usr/bin/xcrun clang' clang
|
||||
'';
|
||||
}
|
||||
</programlisting>
|
||||
<para>
|
||||
The package <literal>xcbuild</literal> can be used to build projects that
|
||||
really depend on Xcode. However, this replacement is not 100% compatible
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<para>
|
||||
Checkout the Nixpkgs source tree:
|
||||
<screen>
|
||||
$ git clone https://github.com/NixOS/nixpkgs
|
||||
$ cd nixpkgs</screen>
|
||||
<prompt>$ </prompt>git clone https://github.com/NixOS/nixpkgs
|
||||
<prompt>$ </prompt>cd nixpkgs</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -23,7 +23,7 @@ $ cd nixpkgs</screen>
|
|||
See <xref linkend="sec-organisation" /> for some hints on the tree
|
||||
organisation. Create a directory for your package, e.g.
|
||||
<screen>
|
||||
$ mkdir pkgs/development/libraries/libfoo</screen>
|
||||
<prompt>$ </prompt>mkdir pkgs/development/libraries/libfoo</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -34,8 +34,8 @@ $ mkdir pkgs/development/libraries/libfoo</screen>
|
|||
as arguments, and returns a build of the package in the Nix store. The
|
||||
expression should usually be called <filename>default.nix</filename>.
|
||||
<screen>
|
||||
$ emacs pkgs/development/libraries/libfoo/default.nix
|
||||
$ git add pkgs/development/libraries/libfoo/default.nix</screen>
|
||||
<prompt>$ </prompt>emacs pkgs/development/libraries/libfoo/default.nix
|
||||
<prompt>$ </prompt>git add pkgs/development/libraries/libfoo/default.nix</screen>
|
||||
</para>
|
||||
<para>
|
||||
You can have a look at the existing Nix expressions under
|
||||
|
@ -180,7 +180,7 @@ $ git add pkgs/development/libraries/libfoo/default.nix</screen>
|
|||
with some descriptive name for the variable, e.g.
|
||||
<varname>libfoo</varname>.
|
||||
<screen>
|
||||
$ emacs pkgs/top-level/all-packages.nix</screen>
|
||||
<prompt>$ </prompt>emacs pkgs/top-level/all-packages.nix</screen>
|
||||
</para>
|
||||
<para>
|
||||
The attributes in that file are sorted by category (like “Development /
|
||||
|
@ -193,7 +193,7 @@ $ emacs pkgs/top-level/all-packages.nix</screen>
|
|||
To test whether the package builds, run the following command from the
|
||||
root of the nixpkgs source tree:
|
||||
<screen>
|
||||
$ nix-build -A libfoo</screen>
|
||||
<prompt>$ </prompt>nix-build -A libfoo</screen>
|
||||
where <varname>libfoo</varname> should be the variable name defined in the
|
||||
previous step. You may want to add the flag <option>-K</option> to keep
|
||||
the temporary build directory in case something fails. If the build
|
||||
|
@ -205,7 +205,7 @@ $ nix-build -A libfoo</screen>
|
|||
<para>
|
||||
If you want to install the package into your profile (optional), do
|
||||
<screen>
|
||||
$ nix-env -f . -iA libfoo</screen>
|
||||
<prompt>$ </prompt>nix-env -f . -iA libfoo</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
|
|
@ -153,11 +153,11 @@
|
|||
nixpkgs-unstable for easier review by running the following commands
|
||||
from a nixpkgs clone.
|
||||
<screen>
|
||||
$ git remote add channels https://github.com/NixOS/nixpkgs-channels.git <co
|
||||
<prompt>$ </prompt>git remote add channels https://github.com/NixOS/nixpkgs-channels.git <co
|
||||
xml:id='reviewing-rebase-1' />
|
||||
$ git fetch channels nixos-unstable <co xml:id='reviewing-rebase-2' />
|
||||
$ git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' />
|
||||
$ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
|
||||
<prompt>$ </prompt>git fetch channels nixos-unstable <co xml:id='reviewing-rebase-2' />
|
||||
<prompt>$ </prompt>git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' />
|
||||
<prompt>$ </prompt>git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
|
||||
xml:id='reviewing-rebase-4' />
|
||||
</screen>
|
||||
<calloutlist>
|
||||
|
@ -197,7 +197,7 @@ $ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
|
|||
request url.
|
||||
</para>
|
||||
<screen>
|
||||
$ nix-shell -p nix-review --run "nix-review pr PRNUMBER"
|
||||
<prompt>$ </prompt>nix-shell -p nix-review --run "nix-review pr PRNUMBER"
|
||||
</screen>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
|
|
@ -31,9 +31,28 @@ stdenv.mkDerivation {
|
|||
separate Nix expression from <filename>pkgs/all-packages.nix</filename>, you
|
||||
need to pass it as a function argument.) Specifying a
|
||||
<varname>name</varname> and a <varname>src</varname> is the absolute minimum
|
||||
you need to do. Many packages have dependencies that are not provided in the
|
||||
standard environment. It’s usually sufficient to specify those
|
||||
dependencies in the <varname>buildInputs</varname> attribute:
|
||||
Nix requires. For convenience, you can also use <varname>pname</varname> and
|
||||
<varname>version</varname> attributes and <literal>mkDerivation</literal>
|
||||
will automatically set <varname>name</varname> to
|
||||
<literal>"${pname}-${version}"</literal> by default. Since
|
||||
<link xlink:href="https://github.com/NixOS/rfcs/pull/35">RFC 0035</link>,
|
||||
this is preferred for packages in Nixpkgs, as it allows us to reuse the
|
||||
version easily:
|
||||
<programlisting>
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "libfoo";
|
||||
version = "1.2.3";
|
||||
src = fetchurl {
|
||||
url = "http://example.org/libfoo-source-${version}.tar.bz2";
|
||||
sha256 = "0x2g1jqygyr5wiwg4ma1nd7w4ydpy82z9gkcv8vh2v8dn3y58v5m";
|
||||
};
|
||||
}</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Many packages have dependencies that are not provided in the standard
|
||||
environment. It’s usually sufficient to specify those dependencies in the
|
||||
<varname>buildInputs</varname> attribute:
|
||||
<programlisting>
|
||||
stdenv.mkDerivation {
|
||||
name = "libfoo-1.2.3";
|
||||
|
@ -324,7 +343,7 @@ let f(h, t, i) = i + (if i <= 0 then h else t - 1)
|
|||
let f(h, h + 1, i) = i + (if i <= 0 then h else (h + 1) - 1)
|
||||
let f(h, h + 1, i) = i + (if i <= 0 then h else h)
|
||||
let f(h, h + 1, i) = i + h
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
This is where "sum-like" comes in from above: We can just sum all of the
|
||||
host offsets to get the host offset of the transitive dependency. The target
|
||||
offset is the transitive dependency is simply the host offset + 1, just as
|
||||
|
@ -2210,7 +2229,7 @@ someVar=$(stripHash $name)
|
|||
array by doing something like
|
||||
<programlisting language="bash">
|
||||
addEnvHooks "$hostOffset" myBashFunction
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -2648,8 +2667,8 @@ addEnvHooks "$hostOffset" myBashFunction
|
|||
that is supposed to be inspected, add <literal>breakpointHook</literal>
|
||||
to <literal>nativeBuildInputs</literal>.
|
||||
<programlisting>
|
||||
nativeBuildInputs = [ breakpointHook ];
|
||||
</programlisting>
|
||||
nativeBuildInputs = [ breakpointHook ];
|
||||
</programlisting>
|
||||
When a build failure happens there will be an instruction printed that
|
||||
shows how to attach with <literal>cntr</literal> to the build sandbox.
|
||||
</para>
|
||||
|
@ -2844,7 +2863,7 @@ addEnvHooks "$hostOffset" myBashFunction
|
|||
printf(help_message);
|
||||
^
|
||||
cc1plus: some warnings being treated as errors
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -2866,7 +2885,7 @@ cc1plus: some warnings being treated as errors
|
|||
<programlisting>
|
||||
bin/blib.a(bios_console.o): In function `bios_handle_cup':
|
||||
/tmp/nix-build-ipxe-20141124-5cbdc41.drv-0/ipxe-5cbdc41/src/arch/i386/firmware/pcbios/bios_console.c:86: undefined reference to `__stack_chk_fail'
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -2895,19 +2914,19 @@ bin/blib.a(bios_console.o): In function `bios_handle_cup':
|
|||
<programlisting>
|
||||
malloc.c:404:15: error: return type is an incomplete type
|
||||
malloc.c:410:19: error: storage size of 'ms' isn't known
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
strdup.h:22:1: error: expected identifier or '(' before '__extension__'
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
strsep.c:65:23: error: register name not specified for 'delim'
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
installwatch.c:3751:5: error: conflicting types for '__open_2'
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
fcntl2.h:50:4: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -2932,7 +2951,7 @@ fcntl2.h:50:4: error: call to '__open_missing_mode' declared with attribute erro
|
|||
<programlisting>
|
||||
ccbLfRgg.s: Assembler messages:
|
||||
ccbLfRgg.s:33: Error: missing or invalid displacement expression `private_key_len@GOTOFF'
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -2996,7 +3015,7 @@ ccbLfRgg.s:33: Error: missing or invalid displacement expression `private_key_le
|
|||
</para>
|
||||
<programlisting>
|
||||
intel_drv.so: undefined symbol: vgaHWFreeHWRec
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
</listitem>
|
||||
</itemizedlist>
|
||||
<screen>
|
||||
$ git checkout 0998212
|
||||
$ git checkout -b 'fix/pkg-name-update'
|
||||
<prompt>$ </prompt>git checkout 0998212
|
||||
<prompt>$ </prompt>git checkout -b 'fix/pkg-name-update'
|
||||
</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -514,7 +514,7 @@ The original commit message describing the reason why the world was torn apart.
|
|||
(cherry picked from commit abcdef)
|
||||
Reason: I just had a gut feeling that this would also be wanted by people from
|
||||
the stone age.
|
||||
</screen>
|
||||
</screen>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
|
|
@ -428,7 +428,7 @@ rec {
|
|||
|
||||
mkSystemFromString = s: mkSystemFromSkeleton (mkSkeletonFromList (lib.splitString "-" s));
|
||||
|
||||
doubleFromSystem = { cpu, vendor, kernel, abi, ... }:
|
||||
doubleFromSystem = { cpu, kernel, abi, ... }:
|
||||
/**/ if abi == abis.cygnus then "${cpu.name}-cygwin"
|
||||
else if kernel.families ? darwin then "${cpu.name}-darwin"
|
||||
else "${cpu.name}-${kernel.name}";
|
||||
|
|
|
@ -4443,6 +4443,10 @@
|
|||
email = "robert@rycee.net";
|
||||
github = "rycee";
|
||||
name = "Robert Helgesson";
|
||||
keys = [{
|
||||
longkeyid = "rsa4096/0x3573356C25C424D4";
|
||||
fingerprint = "36CA CF52 D098 CC0E 78FB 0CB1 3573 356C 25C4 24D4";
|
||||
}];
|
||||
};
|
||||
ryneeverett = {
|
||||
email = "ryneeverett@gmail.com";
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
Nix’s <emphasis>garbage collector</emphasis> to remove old, unreferenced
|
||||
packages. This is easy:
|
||||
<screen>
|
||||
$ nix-collect-garbage
|
||||
<prompt>$ </prompt>nix-collect-garbage
|
||||
</screen>
|
||||
Alternatively, you can use a systemd unit that does the same in the
|
||||
background:
|
||||
<screen>
|
||||
# systemctl start nix-gc.service
|
||||
<prompt># </prompt>systemctl start nix-gc.service
|
||||
</screen>
|
||||
You can tell NixOS in <filename>configuration.nix</filename> to run this unit
|
||||
automatically at certain points in time, for instance, every night at 03:15:
|
||||
|
@ -31,11 +31,11 @@ $ nix-collect-garbage
|
|||
configurations. The following command deletes old roots, removing the ability
|
||||
to roll back to them:
|
||||
<screen>
|
||||
$ nix-collect-garbage -d
|
||||
<prompt>$ </prompt>nix-collect-garbage -d
|
||||
</screen>
|
||||
You can also do this for specific profiles, e.g.
|
||||
<screen>
|
||||
$ nix-env -p /nix/var/nix/profiles/per-user/eelco/profile --delete-generations old
|
||||
<prompt>$ </prompt>nix-env -p /nix/var/nix/profiles/per-user/eelco/profile --delete-generations old
|
||||
</screen>
|
||||
Note that NixOS system configurations are stored in the profile
|
||||
<filename>/nix/var/nix/profiles/system</filename>.
|
||||
|
@ -45,7 +45,7 @@ $ nix-env -p /nix/var/nix/profiles/per-user/eelco/profile --delete-generations o
|
|||
Nix store) is to run Nix’s store optimiser, which seeks out identical files
|
||||
in the store and replaces them with hard links to a single copy.
|
||||
<screen>
|
||||
$ nix-store --optimise
|
||||
<prompt>$ </prompt>nix-store --optimise
|
||||
</screen>
|
||||
Since this command needs to read the entire Nix store, it can take quite a
|
||||
while to finish.
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
<literal>10.233.0.0/16</literal>. You can get the container’s IPv4 address
|
||||
as follows:
|
||||
<screen>
|
||||
# nixos-container show-ip foo
|
||||
<prompt># </prompt>nixos-container show-ip foo
|
||||
10.233.4.2
|
||||
|
||||
$ ping -c1 10.233.4.2
|
||||
<prompt>$ </prompt>ping -c1 10.233.4.2
|
||||
64 bytes from 10.233.4.2: icmp_seq=1 ttl=64 time=0.106 ms
|
||||
</screen>
|
||||
</para>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<literal>systemd</literal> hierarchy, which is what systemd uses to keep
|
||||
track of the processes belonging to each service or user session:
|
||||
<screen>
|
||||
$ systemd-cgls
|
||||
<prompt>$ </prompt>systemd-cgls
|
||||
├─user
|
||||
│ └─eelco
|
||||
│ └─c1
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
The command <literal>journalctl</literal> allows you to see the contents of
|
||||
the journal. For example,
|
||||
<screen>
|
||||
$ journalctl -b
|
||||
<prompt>$ </prompt>journalctl -b
|
||||
</screen>
|
||||
shows all journal entries since the last reboot. (The output of
|
||||
<command>journalctl</command> is piped into <command>less</command> by
|
||||
default.) You can use various options and match operators to restrict output
|
||||
to messages of interest. For instance, to get all messages from PostgreSQL:
|
||||
<screen>
|
||||
$ journalctl -u postgresql.service
|
||||
<prompt>$ </prompt>journalctl -u postgresql.service
|
||||
-- Logs begin at Mon, 2013-01-07 13:28:01 CET, end at Tue, 2013-01-08 01:09:57 CET. --
|
||||
...
|
||||
Jan 07 15:44:14 hagbard postgres[2681]: [2-1] LOG: database system is shut down
|
||||
|
@ -29,7 +29,7 @@ Jan 07 15:45:13 hagbard postgres[2500]: [1-1] LOG: database system is ready to
|
|||
Or to get all messages since the last reboot that have at least a
|
||||
“critical” severity level:
|
||||
<screen>
|
||||
$ journalctl -b -p crit
|
||||
<prompt>$ </prompt>journalctl -b -p crit
|
||||
Dec 17 21:08:06 mandark sudo[3673]: pam_unix(sudo:auth): auth could not identify password for [alice]
|
||||
Dec 29 01:30:22 mandark kernel[6131]: [1053513.909444] CPU6: Core temperature above threshold, cpu clock throttled (total events = 1)
|
||||
</screen>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
where <replaceable>N</replaceable> is the number of the NixOS system
|
||||
configuration. To get a list of the available configurations, do:
|
||||
<screen>
|
||||
$ ls -l /nix/var/nix/profiles/system-*-link
|
||||
<prompt>$ </prompt>ls -l /nix/var/nix/profiles/system-*-link
|
||||
<replaceable>...</replaceable>
|
||||
lrwxrwxrwx 1 root root 78 Aug 12 13:54 /nix/var/nix/profiles/system-268-link -> /nix/store/202b...-nixos-13.07pre4932_5a676e4-4be1055
|
||||
</screen>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<command>systemd</command>. Without any arguments, it shows the status of
|
||||
active units:
|
||||
<screen>
|
||||
$ systemctl
|
||||
<prompt>$ </prompt>systemctl
|
||||
-.mount loaded active mounted /
|
||||
swapfile.swap loaded active active /swapfile
|
||||
sshd.service loaded active running SSH Daemon
|
||||
|
@ -33,7 +33,7 @@ graphical.target loaded active active Graphical Interface
|
|||
You can ask for detailed status information about a unit, for instance, the
|
||||
PostgreSQL database service:
|
||||
<screen>
|
||||
$ systemctl status postgresql.service
|
||||
<prompt>$ </prompt>systemctl status postgresql.service
|
||||
postgresql.service - PostgreSQL Server
|
||||
Loaded: loaded (/nix/store/pn3q73mvh75gsrl8w7fdlfk3fq5qm5mw-unit/postgresql.service)
|
||||
Active: active (running) since Mon, 2013-01-07 15:55:57 CET; 9h ago
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
If the corruption is in a path in the closure of the NixOS system
|
||||
configuration, you can fix it by doing
|
||||
<screen>
|
||||
# nixos-rebuild switch --repair
|
||||
<prompt># </prompt>nixos-rebuild switch --repair
|
||||
</screen>
|
||||
This will cause Nix to check every path in the closure, and if its
|
||||
cryptographic hash differs from the hash recorded in Nix’s database, the
|
||||
|
@ -28,7 +28,7 @@
|
|||
<para>
|
||||
You can also scan the entire Nix store for corrupt paths:
|
||||
<screen>
|
||||
# nix-store --verify --check-contents --repair
|
||||
<prompt># </prompt>nix-store --verify --check-contents --repair
|
||||
</screen>
|
||||
Any corrupt paths will be redownloaded if they’re available in a binary
|
||||
cache; otherwise, they cannot be repaired.
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
allows querying and manipulating user sessions. For instance, to list all
|
||||
user sessions:
|
||||
<screen>
|
||||
$ loginctl
|
||||
<prompt>$ </prompt>loginctl
|
||||
SESSION UID USER SEAT
|
||||
c1 500 eelco seat0
|
||||
c3 0 root seat0
|
||||
|
@ -21,7 +21,7 @@ $ loginctl
|
|||
devices attached to the system; usually, there is only one seat.) To get
|
||||
information about a session:
|
||||
<screen>
|
||||
$ loginctl session-status c3
|
||||
<prompt>$ </prompt>loginctl session-status c3
|
||||
c3 - root (0)
|
||||
Since: Tue, 2013-01-08 01:17:56 CET; 4min 42s ago
|
||||
Leader: 2536 (login)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
With the command <command>nix-env</command>, you can install and uninstall
|
||||
packages from the command line. For instance, to install Mozilla Thunderbird:
|
||||
<screen>
|
||||
$ nix-env -iA nixos.thunderbird</screen>
|
||||
<prompt>$ </prompt>nix-env -iA nixos.thunderbird</screen>
|
||||
If you invoke this as root, the package is installed in the Nix profile
|
||||
<filename>/nix/var/nix/profiles/default</filename> and visible to all users
|
||||
of the system; otherwise, the package ends up in
|
||||
|
@ -25,7 +25,7 @@ $ nix-env -iA nixos.thunderbird</screen>
|
|||
Packages come from the NixOS channel. You typically upgrade a package by
|
||||
updating to the latest version of the NixOS channel:
|
||||
<screen>
|
||||
$ nix-channel --update nixos
|
||||
<prompt>$ </prompt>nix-channel --update nixos
|
||||
</screen>
|
||||
and then running <literal>nix-env -i</literal> again. Other packages in the
|
||||
profile are <emphasis>not</emphasis> affected; this is the crucial difference
|
||||
|
@ -34,21 +34,21 @@ $ nix-channel --update nixos
|
|||
their current versions in the NixOS channel. You can however upgrade all
|
||||
packages for which there is a newer version by doing:
|
||||
<screen>
|
||||
$ nix-env -u '*'
|
||||
<prompt>$ </prompt>nix-env -u '*'
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A package can be uninstalled using the <option>-e</option> flag:
|
||||
<screen>
|
||||
$ nix-env -e thunderbird
|
||||
<prompt>$ </prompt>nix-env -e thunderbird
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Finally, you can roll back an undesirable <command>nix-env</command> action:
|
||||
<screen>
|
||||
$ nix-env --rollback
|
||||
<prompt>$ </prompt>nix-env --rollback
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
xlink:href="http://nixos.org/nixpkgs/manual">Nixpkgs
|
||||
manual</link>. In short, you clone Nixpkgs:
|
||||
<screen>
|
||||
$ git clone https://github.com/NixOS/nixpkgs
|
||||
$ cd nixpkgs
|
||||
<prompt>$ </prompt>git clone https://github.com/NixOS/nixpkgs
|
||||
<prompt>$ </prompt>cd nixpkgs
|
||||
</screen>
|
||||
Then you write and test the package as described in the Nixpkgs manual.
|
||||
Finally, you add it to <literal>environment.systemPackages</literal>, e.g.
|
||||
|
@ -65,8 +65,8 @@ stdenv.mkDerivation rec {
|
|||
</programlisting>
|
||||
This allows testing the package easily:
|
||||
<screen>
|
||||
$ nix-build my-hello.nix
|
||||
$ ./result/bin/hello
|
||||
<prompt>$ </prompt>nix-build my-hello.nix
|
||||
<prompt>$ </prompt>./result/bin/hello
|
||||
Hello, world!
|
||||
</screen>
|
||||
</para>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<para>
|
||||
You can get a list of the available packages as follows:
|
||||
<screen>
|
||||
$ nix-env -qaP '*' --description
|
||||
<prompt>$ </prompt>nix-env -qaP '*' --description
|
||||
nixos.firefox firefox-23.0 Mozilla Firefox - the browser, reloaded
|
||||
<replaceable>...</replaceable>
|
||||
</screen>
|
||||
|
|
|
@ -33,91 +33,91 @@
|
|||
<link xlink:href="https://github.com/matrix-org/synapse#synapse-installation">
|
||||
installation instructions of Synapse </link>.
|
||||
<programlisting>
|
||||
let
|
||||
fqdn =
|
||||
let
|
||||
fqdn =
|
||||
let
|
||||
join = hostName: domain: hostName + optionalString (domain != null) ".${domain}";
|
||||
in join config.networking.hostName config.networking.domain;
|
||||
in {
|
||||
networking = {
|
||||
hostName = "myhostname";
|
||||
domain = "example.org";
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
join = hostName: domain: hostName + optionalString (domain != null) ".${domain}";
|
||||
in join config.networking.hostName config.networking.domain;
|
||||
in {
|
||||
networking = {
|
||||
hostName = "myhostname";
|
||||
domain = "example.org";
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
# only recommendedProxySettings and recommendedGzipSettings are strictly required,
|
||||
# but the rest make sense as well
|
||||
recommendedTlsSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedProxySettings = true;
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
# only recommendedProxySettings and recommendedGzipSettings are strictly required,
|
||||
# but the rest make sense as well
|
||||
recommendedTlsSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedGzipSettings = true;
|
||||
recommendedProxySettings = true;
|
||||
|
||||
virtualHosts = {
|
||||
# This host section can be placed on a different host than the rest,
|
||||
# i.e. to delegate from the host being accessible as ${config.networking.domain}
|
||||
# to another host actually running the Matrix homeserver.
|
||||
"${config.networking.domain}" = {
|
||||
locations."= /.well-known/matrix/server".extraConfig =
|
||||
let
|
||||
# use 443 instead of the default 8448 port to unite
|
||||
# the client-server and server-server port for simplicity
|
||||
server = { "m.server" = "${fqdn}:443"; };
|
||||
in ''
|
||||
add_header Content-Type application/json;
|
||||
return 200 '${builtins.toJSON server}';
|
||||
'';
|
||||
locations."= /.well-known/matrix/client".extraConfig =
|
||||
let
|
||||
client = {
|
||||
"m.homeserver" = { "base_url" = "https://${fqdn}"; };
|
||||
"m.identity_server" = { "base_url" = "https://vector.im"; };
|
||||
};
|
||||
# ACAO required to allow riot-web on any URL to request this json file
|
||||
in ''
|
||||
add_header Content-Type application/json;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
return 200 '${builtins.toJSON client}';
|
||||
'';
|
||||
};
|
||||
|
||||
# Reverse proxy for Matrix client-server and server-server communication
|
||||
${fqdn} = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
|
||||
# Or do a redirect instead of the 404, or whatever is appropriate for you.
|
||||
# But do not put a Matrix Web client here! See the Riot Web section below.
|
||||
locations."/".extraConfig = ''
|
||||
return 404;
|
||||
'';
|
||||
|
||||
# forward all Matrix API calls to the synapse Matrix homeserver
|
||||
locations."/_matrix" = {
|
||||
proxyPass = "http://[::1]:8008";
|
||||
virtualHosts = {
|
||||
# This host section can be placed on a different host than the rest,
|
||||
# i.e. to delegate from the host being accessible as ${config.networking.domain}
|
||||
# to another host actually running the Matrix homeserver.
|
||||
"${config.networking.domain}" = {
|
||||
locations."= /.well-known/matrix/server".extraConfig =
|
||||
let
|
||||
# use 443 instead of the default 8448 port to unite
|
||||
# the client-server and server-server port for simplicity
|
||||
server = { "m.server" = "${fqdn}:443"; };
|
||||
in ''
|
||||
add_header Content-Type application/json;
|
||||
return 200 '${builtins.toJSON server}';
|
||||
'';
|
||||
locations."= /.well-known/matrix/client".extraConfig =
|
||||
let
|
||||
client = {
|
||||
"m.homeserver" = { "base_url" = "https://${fqdn}"; };
|
||||
"m.identity_server" = { "base_url" = "https://vector.im"; };
|
||||
};
|
||||
};
|
||||
# ACAO required to allow riot-web on any URL to request this json file
|
||||
in ''
|
||||
add_header Content-Type application/json;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
return 200 '${builtins.toJSON client}';
|
||||
'';
|
||||
};
|
||||
|
||||
# Reverse proxy for Matrix client-server and server-server communication
|
||||
${fqdn} = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
|
||||
# Or do a redirect instead of the 404, or whatever is appropriate for you.
|
||||
# But do not put a Matrix Web client here! See the Riot Web section below.
|
||||
locations."/".extraConfig = ''
|
||||
return 404;
|
||||
'';
|
||||
|
||||
# forward all Matrix API calls to the synapse Matrix homeserver
|
||||
locations."/_matrix" = {
|
||||
proxyPass = "http://[::1]:8008";
|
||||
};
|
||||
};
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
server_name = config.networking.domain;
|
||||
listeners = [
|
||||
{
|
||||
port = 8008;
|
||||
bind_address = "::1";
|
||||
type = "http";
|
||||
tls = false;
|
||||
x_forwarded = true;
|
||||
resources = [
|
||||
{ names = [ "client" "federation" ]; compress = false; }
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
</programlisting>
|
||||
};
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
server_name = config.networking.domain;
|
||||
listeners = [
|
||||
{
|
||||
port = 8008;
|
||||
bind_address = "::1";
|
||||
type = "http";
|
||||
tls = false;
|
||||
x_forwarded = true;
|
||||
resources = [
|
||||
{ names = [ "client" "federation" ]; compress = false; }
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -141,15 +141,15 @@
|
|||
<option>services.matrix-synapse.registration_shared_secret</option>. To
|
||||
create a new user or admin, run the following after you have set the secret
|
||||
and have rebuilt NixOS:
|
||||
<programlisting>
|
||||
$ nix run nixpkgs.matrix-synapse
|
||||
$ register_new_matrix_user -k <your-registration-shared-secret> http://localhost:8008
|
||||
New user localpart: <your-username>
|
||||
Password:
|
||||
Confirm password:
|
||||
Make admin [no]:
|
||||
Success!
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>nix run nixpkgs.matrix-synapse
|
||||
<prompt>$ </prompt>register_new_matrix_user -k <replaceable>your-registration-shared-secret</replaceable> http://localhost:8008
|
||||
<prompt>New user localpart: </prompt><replaceable>your-username</replaceable>
|
||||
<prompt>Password:</prompt>
|
||||
<prompt>Confirm password:</prompt>
|
||||
<prompt>Make admin [no]:</prompt>
|
||||
Success!
|
||||
</screen>
|
||||
In the example, this would create a user with the Matrix Identifier
|
||||
<literal>@your-username:example.org</literal>. Note that the registration
|
||||
secret ends up in the nix store and therefore is world-readable by any user
|
||||
|
@ -177,16 +177,16 @@
|
|||
Matrix Now!</link> for a list of existing clients and their supported
|
||||
featureset.
|
||||
<programlisting>
|
||||
services.nginx.virtualHosts."riot.${fqdn}" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
serverAliases = [
|
||||
"riot.${config.networking.domain}"
|
||||
];
|
||||
services.nginx.virtualHosts."riot.${fqdn}" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
serverAliases = [
|
||||
"riot.${config.networking.domain}"
|
||||
];
|
||||
|
||||
root = pkgs.riot-web;
|
||||
};
|
||||
</programlisting>
|
||||
root = pkgs.riot-web;
|
||||
};
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -106,21 +106,21 @@ The unique option `services.httpd.adminAddr' is defined multiple times, in `/etc
|
|||
configuration option is. The command <option>nixos-option</option> allows you
|
||||
to find out:
|
||||
<screen>
|
||||
$ nixos-option <xref linkend="opt-services.xserver.enable"/>
|
||||
<prompt>$ </prompt>nixos-option <xref linkend="opt-services.xserver.enable"/>
|
||||
true
|
||||
|
||||
$ nixos-option <xref linkend="opt-boot.kernelModules"/>
|
||||
<prompt>$ </prompt>nixos-option <xref linkend="opt-boot.kernelModules"/>
|
||||
[ "tun" "ipv6" "loop" <replaceable>...</replaceable> ]
|
||||
</screen>
|
||||
Interactive exploration of the configuration is possible using <command>nix
|
||||
repl</command>, a read-eval-print loop for Nix expressions. A typical use:
|
||||
<screen>
|
||||
$ nix repl '<nixpkgs/nixos>'
|
||||
<prompt>$ </prompt>nix repl '<nixpkgs/nixos>'
|
||||
|
||||
nix-repl> config.<xref linkend="opt-networking.hostName"/>
|
||||
<prompt>nix-repl> </prompt>config.<xref linkend="opt-networking.hostName"/>
|
||||
"mandark"
|
||||
|
||||
nix-repl> map (x: x.hostName) config.<xref linkend="opt-services.httpd.virtualHosts"/>
|
||||
<prompt>nix-repl> </prompt>map (x: x.hostName) config.<xref linkend="opt-services.httpd.virtualHosts"/>
|
||||
[ "example.org" "example.gov" ]
|
||||
</screen>
|
||||
</para>
|
||||
|
@ -129,17 +129,17 @@ nix-repl> map (x: x.hostName) config.<xref linkend="opt-services.httpd.virtualHo
|
|||
While abstracting your configuration, you may find it useful to generate
|
||||
modules using code, instead of writing files. The example below would have
|
||||
the same effect as importing a file which sets those options.
|
||||
<screen>
|
||||
{ config, pkgs, ... }:
|
||||
<programlisting>
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let netConfig = { hostName }: {
|
||||
networking.hostName = hostName;
|
||||
networking.useDHCP = false;
|
||||
};
|
||||
let netConfig = { hostName }: {
|
||||
networking.hostName = hostName;
|
||||
networking.useDHCP = false;
|
||||
};
|
||||
|
||||
in
|
||||
in
|
||||
|
||||
{ imports = [ (netConfig "nixos.localdomain") ]; }
|
||||
</screen>
|
||||
{ imports = [ (netConfig "nixos.localdomain") ]; }
|
||||
</programlisting>
|
||||
</para>
|
||||
</section>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
imports = [
|
||||
<nixpkgs/nixos/modules/profiles/profile-name.nix>
|
||||
];
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
<para>
|
||||
Even if some of these profiles seem only useful in the context of install
|
||||
media, many are actually intended to be used in real installs.
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
A user ID (uid) is assigned automatically. You can also specify a uid
|
||||
manually by adding
|
||||
<programlisting>
|
||||
uid = 1000;
|
||||
uid = 1000;
|
||||
</programlisting>
|
||||
to the user specification.
|
||||
</para>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
If you are using WPA2 you can generate pskRaw key using
|
||||
<command>wpa_passphrase</command>:
|
||||
<screen>
|
||||
$ wpa_passphrase ESSID PSK
|
||||
<prompt>$ </prompt>wpa_passphrase ESSID PSK
|
||||
network={
|
||||
ssid="echelon"
|
||||
#psk="abcdefgh"
|
||||
|
@ -54,10 +54,10 @@ network={
|
|||
or you can use it to directly generate the
|
||||
<literal>wpa_supplicant.conf</literal>:
|
||||
<screen>
|
||||
# wpa_passphrase ESSID PSK > /etc/wpa_supplicant.conf</screen>
|
||||
<prompt># </prompt>wpa_passphrase ESSID PSK > /etc/wpa_supplicant.conf</screen>
|
||||
After you have edited the <literal>wpa_supplicant.conf</literal>, you need to
|
||||
restart the wpa_supplicant service.
|
||||
<screen>
|
||||
# systemctl restart wpa_supplicant.service</screen>
|
||||
<prompt># </prompt>systemctl restart wpa_supplicant.service</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<link linkend="opt-services.xserver.desktopManager.xfce.enable">xfce.enable</link> = true;
|
||||
<link linkend="opt-services.xserver.desktopManager.default">default</link> = "xfce";
|
||||
};
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Optionally, <emphasis>compton</emphasis> can be enabled for nice graphical
|
||||
|
@ -24,7 +24,7 @@
|
|||
<link linkend="opt-services.compton.shadow">shadow</link> = true;
|
||||
<link linkend="opt-services.compton.fadeDelta">fadeDelta</link> = 4;
|
||||
};
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Some Xfce programs are not installed automatically. To install them manually
|
||||
|
@ -37,7 +37,7 @@
|
|||
To enable <emphasis>Thunar</emphasis> volume support, put
|
||||
<programlisting>
|
||||
<xref linkend="opt-services.xserver.desktopManager.xfce.enable"/> = true;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
into your <emphasis>configuration.nix</emphasis>.
|
||||
</para>
|
||||
</simplesect>
|
||||
|
@ -58,14 +58,14 @@
|
|||
on start (look at <command>journalctl --user -b</command>).
|
||||
<programlisting>
|
||||
Thunar:2410): GVFS-RemoteVolumeMonitor-WARNING **: remote volume monitor with dbus name org.gtk.Private.UDisks2VolumeMonitor is not supported
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
This is caused by some needed GNOME services not running. This is all fixed
|
||||
by enabling "Launch GNOME services on startup" in the Advanced tab of the
|
||||
Session and Startup settings panel. Alternatively, you can run this command
|
||||
to do the same thing.
|
||||
<programlisting>
|
||||
$ xfconf-query -c xfce4-session -p /compat/LaunchGNOME -s true
|
||||
</programlisting>
|
||||
<prompt>$ </prompt>xfconf-query -c xfce4-session -p /compat/LaunchGNOME -s true
|
||||
</programlisting>
|
||||
A log-out and re-log will be needed for this to take effect.
|
||||
</para>
|
||||
</simplesect>
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
Default CD/DVD configurations are available inside
|
||||
<filename>nixos/modules/installer/cd-dvd</filename>.
|
||||
<screen>
|
||||
$ git clone https://github.com/NixOS/nixpkgs.git
|
||||
$ cd nixpkgs/nixos
|
||||
$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix default.nix</screen>
|
||||
<prompt>$ </prompt>git clone https://github.com/NixOS/nixpkgs.git
|
||||
<prompt>$ </prompt>cd nixpkgs/nixos
|
||||
<prompt>$ </prompt>nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix default.nix</screen>
|
||||
</para>
|
||||
<para>
|
||||
Before burning your CD/DVD, you can check the content of the image by
|
||||
mounting anywhere like suggested by the following command:
|
||||
<screen>
|
||||
# mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso</screen>
|
||||
<prompt># </prompt>mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso</screen>
|
||||
</para>
|
||||
</chapter>
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
With the command <command>nix-build</command>, you can build specific parts
|
||||
of your NixOS configuration. This is done as follows:
|
||||
<screen>
|
||||
$ cd <replaceable>/path/to/nixpkgs/nixos</replaceable>
|
||||
$ nix-build -A config.<replaceable>option</replaceable></screen>
|
||||
<prompt>$ </prompt>cd <replaceable>/path/to/nixpkgs/nixos</replaceable>
|
||||
<prompt>$ </prompt>nix-build -A config.<replaceable>option</replaceable></screen>
|
||||
where <replaceable>option</replaceable> is a NixOS option with type
|
||||
“derivation” (i.e. something that can be built). Attributes of interest
|
||||
include:
|
||||
|
@ -28,7 +28,7 @@ $ nix-build -A config.<replaceable>option</replaceable></screen>
|
|||
<para>
|
||||
A shortcut to build this is:
|
||||
<screen>
|
||||
$ nix-build -A system</screen>
|
||||
<prompt>$ </prompt>nix-build -A system</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -66,9 +66,9 @@ $ nix-build -A system</screen>
|
|||
test whether the kernel and the initial ramdisk boot correctly, by using
|
||||
QEMU’s <option>-kernel</option> and <option>-initrd</option> options:
|
||||
<screen>
|
||||
$ nix-build -A config.system.build.initialRamdisk -o initrd
|
||||
$ nix-build -A config.system.build.kernel -o kernel
|
||||
$ qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/null
|
||||
<prompt>$ </prompt>nix-build -A config.system.build.initialRamdisk -o initrd
|
||||
<prompt>$ </prompt>nix-build -A config.system.build.kernel -o kernel
|
||||
<prompt>$ </prompt>qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/null
|
||||
</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -99,15 +99,15 @@ $ qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/
|
|||
contain dots (e.g. <literal>httpd.service</literal>), you need to put
|
||||
them between quotes, like this:
|
||||
<screen>
|
||||
$ nix-build -A 'config.systemd.units."httpd.service".unit'
|
||||
<prompt>$ </prompt>nix-build -A 'config.systemd.units."httpd.service".unit'
|
||||
</screen>
|
||||
You can also test individual units, without rebuilding the whole system,
|
||||
by putting them in <filename>/run/systemd/system</filename>:
|
||||
<screen>
|
||||
$ cp $(nix-build -A 'config.systemd.units."httpd.service".unit')/httpd.service \
|
||||
<prompt>$ </prompt>cp $(nix-build -A 'config.systemd.units."httpd.service".unit')/httpd.service \
|
||||
/run/systemd/system/tmp-httpd.service
|
||||
# systemctl daemon-reload
|
||||
# systemctl start tmp-httpd.service
|
||||
<prompt># </prompt>systemctl daemon-reload
|
||||
<prompt># </prompt>systemctl start tmp-httpd.service
|
||||
</screen>
|
||||
Note that the unit must not have the same name as any unit in
|
||||
<filename>/etc/systemd/system</filename> since those take precedence over
|
||||
|
|
|
@ -9,17 +9,17 @@
|
|||
The test itself can be run interactively. This is particularly useful when
|
||||
developing or debugging a test:
|
||||
<screen>
|
||||
$ nix-build nixos/tests/login.nix -A driver
|
||||
$ ./result/bin/nixos-test-driver
|
||||
<prompt>$ </prompt>nix-build nixos/tests/login.nix -A driver
|
||||
<prompt>$ </prompt>./result/bin/nixos-test-driver
|
||||
starting VDE switch for network 1
|
||||
>
|
||||
<prompt>></prompt>
|
||||
</screen>
|
||||
You can then take any Perl statement, e.g.
|
||||
<screen>
|
||||
> startAll
|
||||
> testScript
|
||||
> $machine->succeed("touch /tmp/foo")
|
||||
> print($machine->succeed("pwd")) # Show stdout of command
|
||||
<prompt>></prompt> startAll
|
||||
<prompt>></prompt> testScript
|
||||
<prompt>></prompt> $machine->succeed("touch /tmp/foo")
|
||||
<prompt>></prompt> print($machine->succeed("pwd")) # Show stdout of command
|
||||
</screen>
|
||||
The function <command>testScript</command> executes the entire test script
|
||||
and drops you back into the test driver command line upon its completion.
|
||||
|
@ -30,8 +30,8 @@ starting VDE switch for network 1
|
|||
<para>
|
||||
To just start and experiment with the VMs, run:
|
||||
<screen>
|
||||
$ nix-build nixos/tests/login.nix -A driver
|
||||
$ ./result/bin/nixos-run-vms
|
||||
<prompt>$ </prompt>nix-build nixos/tests/login.nix -A driver
|
||||
<prompt>$ </prompt>./result/bin/nixos-run-vms
|
||||
</screen>
|
||||
The script <command>nixos-run-vms</command> starts the virtual machines
|
||||
defined by test.
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
xlink:href="https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/login.nix">login.nix</filename>,
|
||||
you just do:
|
||||
<screen>
|
||||
$ nix-build '<nixpkgs/nixos/tests/login.nix>'
|
||||
<prompt>$ </prompt>nix-build '<nixpkgs/nixos/tests/login.nix>'
|
||||
</screen>
|
||||
or, if you don’t want to rely on <envar>NIX_PATH</envar>:
|
||||
<screen>
|
||||
$ cd /my/nixpkgs/nixos/tests
|
||||
$ nix-build login.nix
|
||||
<prompt>$ </prompt>cd /my/nixpkgs/nixos/tests
|
||||
<prompt>$ </prompt>nix-build login.nix
|
||||
…
|
||||
running the VM test script
|
||||
machine: QEMU running (pid 8841)
|
||||
|
@ -30,7 +30,7 @@ machine: QEMU running (pid 8841)
|
|||
fast, as no disk image needs to be created. Afterwards, you can view a
|
||||
pretty-printed log of the test:
|
||||
<screen>
|
||||
$ firefox result/log.html
|
||||
<prompt>$ </prompt>firefox result/log.html
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
modify NixOS, however, you should check out the latest sources from Git. This
|
||||
is as follows:
|
||||
<screen>
|
||||
$ git clone https://github.com/NixOS/nixpkgs
|
||||
$ cd nixpkgs
|
||||
$ git remote add channels https://github.com/NixOS/nixpkgs-channels
|
||||
$ git remote update channels
|
||||
<prompt>$ </prompt>git clone https://github.com/NixOS/nixpkgs
|
||||
<prompt>$ </prompt>cd nixpkgs
|
||||
<prompt>$ </prompt>git remote add channels https://github.com/NixOS/nixpkgs-channels
|
||||
<prompt>$ </prompt>git remote update channels
|
||||
</screen>
|
||||
This will check out the latest Nixpkgs sources to
|
||||
<filename>./nixpkgs</filename> the NixOS sources to
|
||||
|
@ -32,23 +32,23 @@ $ git remote update channels
|
|||
not have caught up yet and you’ll have to rebuild everything from source.
|
||||
So you may want to create a local branch based on your current NixOS version:
|
||||
<screen>
|
||||
$ nixos-version
|
||||
<prompt>$ </prompt>nixos-version
|
||||
17.09pre104379.6e0b727 (Hummingbird)
|
||||
|
||||
$ git checkout -b local 6e0b727
|
||||
<prompt>$ </prompt>git checkout -b local 6e0b727
|
||||
</screen>
|
||||
Or, to base your local branch on the latest version available in a NixOS
|
||||
channel:
|
||||
<screen>
|
||||
$ git remote update channels
|
||||
$ git checkout -b local channels/nixos-17.03
|
||||
<prompt>$ </prompt>git remote update channels
|
||||
<prompt>$ </prompt>git checkout -b local channels/nixos-17.03
|
||||
</screen>
|
||||
(Replace <literal>nixos-17.03</literal> with the name of the channel you want
|
||||
to use.) You can use <command>git merge</command> or <command>git
|
||||
rebase</command> to keep your local branch in sync with the channel, e.g.
|
||||
<screen>
|
||||
$ git remote update channels
|
||||
$ git merge channels/nixos-17.03
|
||||
<prompt>$ </prompt>git remote update channels
|
||||
<prompt>$ </prompt>git merge channels/nixos-17.03
|
||||
</screen>
|
||||
You can use <command>git cherry-pick</command> to copy commits from your
|
||||
local branch to the upstream branch.
|
||||
|
@ -58,7 +58,7 @@ $ git merge channels/nixos-17.03
|
|||
tell <command>nixos-rebuild</command> about them using the
|
||||
<option>-I</option> flag:
|
||||
<screen>
|
||||
# nixos-rebuild switch -I nixpkgs=<replaceable>/my/sources</replaceable>/nixpkgs
|
||||
<prompt># </prompt>nixos-rebuild switch -I nixpkgs=<replaceable>/my/sources</replaceable>/nixpkgs
|
||||
</screen>
|
||||
</para>
|
||||
<para>
|
||||
|
@ -67,7 +67,7 @@ $ git merge channels/nixos-17.03
|
|||
<replaceable>/my/sources</replaceable>/nixpkgs</command>, or change the
|
||||
default by adding a symlink in <filename>~/.nix-defexpr</filename>:
|
||||
<screen>
|
||||
$ ln -s <replaceable>/my/sources</replaceable>/nixpkgs ~/.nix-defexpr/nixpkgs
|
||||
<prompt>$ </prompt>ln -s <replaceable>/my/sources</replaceable>/nixpkgs ~/.nix-defexpr/nixpkgs
|
||||
</screen>
|
||||
You may want to delete the symlink
|
||||
<filename>~/.nix-defexpr/channels_root</filename> to prevent root’s NixOS
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
Building, burning, and booting from an installation CD is rather tedious, so
|
||||
here is a quick way to see if the installer works properly:
|
||||
<screen>
|
||||
# mount -t tmpfs none /mnt
|
||||
# nixos-generate-config --root /mnt
|
||||
$ nix-build '<nixpkgs/nixos>' -A config.system.build.nixos-install
|
||||
# ./result/bin/nixos-install</screen>
|
||||
<prompt># </prompt>mount -t tmpfs none /mnt
|
||||
<prompt># </prompt>nixos-generate-config --root /mnt
|
||||
<prompt>$ </prompt>nix-build '<nixpkgs/nixos>' -A config.system.build.nixos-install
|
||||
<prompt># </prompt>./result/bin/nixos-install</screen>
|
||||
To start a login shell in the new NixOS installation in
|
||||
<filename>/mnt</filename>:
|
||||
<screen>
|
||||
$ nix-build '<nixpkgs/nixos>' -A config.system.build.nixos-enter
|
||||
# ./result/bin/nixos-enter
|
||||
<prompt>$ </prompt>nix-build '<nixpkgs/nixos>' -A config.system.build.nixos-enter
|
||||
<prompt># </prompt>./result/bin/nixos-enter
|
||||
</screen>
|
||||
</para>
|
||||
</chapter>
|
||||
|
|
|
@ -397,9 +397,9 @@ startAll;
|
|||
</para>
|
||||
<para>
|
||||
<programlisting>
|
||||
$machine->systemctl("list-jobs --no-pager"); // runs `systemctl list-jobs --no-pager`
|
||||
$machine->systemctl("list-jobs --no-pager", "any-user"); // spawns a shell for `any-user` and runs `systemctl --user list-jobs --no-pager`
|
||||
</programlisting>
|
||||
$machine->systemctl("list-jobs --no-pager"); // runs `systemctl list-jobs --no-pager`
|
||||
$machine->systemctl("list-jobs --no-pager", "any-user"); // spawns a shell for `any-user` and runs `systemctl --user list-jobs --no-pager`
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -410,10 +410,10 @@ startAll;
|
|||
To test user units declared by <literal>systemd.user.services</literal> the
|
||||
optional <literal>$user</literal> argument can be used:
|
||||
<programlisting>
|
||||
$machine->start;
|
||||
$machine->waitForX;
|
||||
$machine->waitForUnit("xautolock.service", "x-session-user");
|
||||
</programlisting>
|
||||
$machine->start;
|
||||
$machine->waitForX;
|
||||
$machine->waitForUnit("xautolock.service", "x-session-user");
|
||||
</programlisting>
|
||||
This applies to <literal>systemctl</literal>, <literal>getUnitInfo</literal>,
|
||||
<literal>waitForUnit</literal>, <literal>startJob</literal> and
|
||||
<literal>stopJob</literal>.
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<link linkend="ch-configuration">changed something</link> in that file, you
|
||||
should do
|
||||
<screen>
|
||||
# nixos-rebuild switch</screen>
|
||||
<prompt># </prompt>nixos-rebuild switch
|
||||
</screen>
|
||||
to build the new configuration, make it the default configuration for
|
||||
booting, and try to realise the configuration in the running system (e.g., by
|
||||
restarting system services).
|
||||
|
@ -23,7 +24,8 @@
|
|||
<para>
|
||||
You can also do
|
||||
<screen>
|
||||
# nixos-rebuild test</screen>
|
||||
<prompt># </prompt>nixos-rebuild test
|
||||
</screen>
|
||||
to build the configuration and switch the running system to it, but without
|
||||
making it the boot default. So if (say) the configuration locks up your
|
||||
machine, you can just reboot to get back to a working configuration.
|
||||
|
@ -31,7 +33,8 @@
|
|||
<para>
|
||||
There is also
|
||||
<screen>
|
||||
# nixos-rebuild boot</screen>
|
||||
<prompt># </prompt>nixos-rebuild boot
|
||||
</screen>
|
||||
to build the configuration and make it the boot default, but not switch to it
|
||||
now (so it will only take effect after the next reboot).
|
||||
</para>
|
||||
|
@ -39,7 +42,8 @@
|
|||
You can make your configuration show up in a different submenu of the GRUB 2
|
||||
boot screen by giving it a different <emphasis>profile name</emphasis>, e.g.
|
||||
<screen>
|
||||
# nixos-rebuild switch -p test </screen>
|
||||
<prompt># </prompt>nixos-rebuild switch -p test
|
||||
</screen>
|
||||
which causes the new configuration (and previous ones created using
|
||||
<literal>-p test</literal>) to show up in the GRUB submenu “NixOS - Profile
|
||||
'test'”. This can be useful to separate test configurations from
|
||||
|
@ -48,7 +52,8 @@
|
|||
<para>
|
||||
Finally, you can do
|
||||
<screen>
|
||||
$ nixos-rebuild build</screen>
|
||||
<prompt>$ </prompt>nixos-rebuild build
|
||||
</screen>
|
||||
to build the configuration but nothing more. This is useful to see whether
|
||||
everything compiles cleanly.
|
||||
</para>
|
||||
|
@ -58,8 +63,8 @@ $ nixos-rebuild build</screen>
|
|||
<emphasis>virtual machine</emphasis> that contains the desired configuration.
|
||||
Just do
|
||||
<screen>
|
||||
$ nixos-rebuild build-vm
|
||||
$ ./result/bin/run-*-vm
|
||||
<prompt>$ </prompt>nixos-rebuild build-vm
|
||||
<prompt>$ </prompt>./result/bin/run-*-vm
|
||||
</screen>
|
||||
The VM does not have any data from your host system, so your existing user
|
||||
accounts and home directories will not be available unless you have set
|
||||
|
@ -74,12 +79,12 @@ $ ./result/bin/run-*-vm
|
|||
guest. For instance, the following will forward host port 2222 to guest port
|
||||
22 (SSH):
|
||||
<screen>
|
||||
$ QEMU_NET_OPTS="hostfwd=tcp::2222-:22" ./result/bin/run-*-vm
|
||||
<prompt>$ </prompt>QEMU_NET_OPTS="hostfwd=tcp::2222-:22" ./result/bin/run-*-vm
|
||||
</screen>
|
||||
allowing you to log in via SSH (assuming you have set the appropriate
|
||||
passwords or SSH authorized keys):
|
||||
<screen>
|
||||
$ ssh -p 2222 localhost
|
||||
<prompt>$ </prompt>ssh -p 2222 localhost
|
||||
</screen>
|
||||
</para>
|
||||
</chapter>
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
Short version:
|
||||
</para>
|
||||
<screen>
|
||||
$ curl https://nixos.org/nix/install | sh
|
||||
$ . $HOME/.nix-profile/etc/profile.d/nix.sh # …or open a fresh shell</screen>
|
||||
<prompt>$ </prompt>curl https://nixos.org/nix/install | sh
|
||||
<prompt>$ </prompt>. $HOME/.nix-profile/etc/profile.d/nix.sh # …or open a fresh shell</screen>
|
||||
<para>
|
||||
More details in the
|
||||
<link
|
||||
|
@ -65,14 +65,14 @@ $ . $HOME/.nix-profile/etc/profile.d/nix.sh # …or open a fresh shell</screen>
|
|||
the <literal>nixpkgs</literal> channel by default.
|
||||
</para>
|
||||
<screen>
|
||||
$ nix-channel --list
|
||||
<prompt>$ </prompt>nix-channel --list
|
||||
nixpkgs https://nixos.org/channels/nixpkgs-unstable</screen>
|
||||
<para>
|
||||
As that channel gets released without running the NixOS tests, it will be
|
||||
safer to use the <literal>nixos-*</literal> channels instead:
|
||||
</para>
|
||||
<screen>
|
||||
$ nix-channel --add https://nixos.org/channels/nixos-<replaceable>version</replaceable> nixpkgs</screen>
|
||||
<prompt>$ </prompt>nix-channel --add https://nixos.org/channels/nixos-<replaceable>version</replaceable> nixpkgs</screen>
|
||||
<para>
|
||||
You may want to throw in a <literal>nix-channel --update</literal> for good
|
||||
measure.
|
||||
|
@ -89,7 +89,7 @@ $ nix-channel --add https://nixos.org/channels/nixos-<replaceable>version</repla
|
|||
NixOS partition. They are installed by default on NixOS, but you don't have
|
||||
NixOS yet..
|
||||
</para>
|
||||
<screen>$ nix-env -iE "_: with import <nixpkgs/nixos> { configuration = {}; }; with config.system.build; [ nixos-generate-config nixos-install nixos-enter manual.manpages ]"</screen>
|
||||
<screen><prompt>$ </prompt>nix-env -iE "_: with import <nixpkgs/nixos> { configuration = {}; }; with config.system.build; [ nixos-generate-config nixos-install nixos-enter manual.manpages ]"</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<note>
|
||||
|
@ -116,7 +116,7 @@ $ nix-channel --add https://nixos.org/channels/nixos-<replaceable>version</repla
|
|||
<para>
|
||||
Generate your NixOS configuration:
|
||||
</para>
|
||||
<screen>$ sudo `which nixos-generate-config` --root /mnt</screen>
|
||||
<screen><prompt>$ </prompt>sudo `which nixos-generate-config` --root /mnt</screen>
|
||||
<para>
|
||||
You'll probably want to edit the configuration files. Refer to the
|
||||
<literal>nixos-generate-config</literal> step in
|
||||
|
@ -148,8 +148,8 @@ $ nix-channel --add https://nixos.org/channels/nixos-<replaceable>version</repla
|
|||
distribution:
|
||||
</para>
|
||||
<screen>
|
||||
$ sudo groupadd -g 30000 nixbld
|
||||
$ sudo useradd -u 30000 -g nixbld -G nixbld nixbld</screen>
|
||||
<prompt>$ </prompt>sudo groupadd -g 30000 nixbld
|
||||
<prompt>$ </prompt>sudo useradd -u 30000 -g nixbld -G nixbld nixbld</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@ -161,7 +161,7 @@ $ sudo useradd -u 30000 -g nixbld -G nixbld nixbld</screen>
|
|||
existing systems without the help of a rescue USB drive or similar.
|
||||
</para>
|
||||
</warning>
|
||||
<screen>$ sudo PATH="$PATH" NIX_PATH="$NIX_PATH" `which nixos-install` --root /mnt</screen>
|
||||
<screen><prompt>$ </prompt>sudo PATH="$PATH" NIX_PATH="$NIX_PATH" `which nixos-install` --root /mnt</screen>
|
||||
<para>
|
||||
Again, please refer to the <literal>nixos-install</literal> step in
|
||||
<xref linkend="sec-installation" /> for more information.
|
||||
|
@ -175,8 +175,8 @@ $ sudo useradd -u 30000 -g nixbld -G nixbld nixbld</screen>
|
|||
Optionally, you may want to clean up your non-NixOS distribution:
|
||||
</para>
|
||||
<screen>
|
||||
$ sudo userdel nixbld
|
||||
$ sudo groupdel nixbld</screen>
|
||||
<prompt>$ </prompt>sudo userdel nixbld
|
||||
<prompt>$ </prompt>sudo groupdel nixbld</screen>
|
||||
<para>
|
||||
If you do not wish to keep the Nix package manager installed either, run
|
||||
something like <literal>sudo rm -rv ~/.nix-* /nix</literal> and remove the
|
||||
|
@ -193,7 +193,7 @@ $ sudo groupdel nixbld</screen>
|
|||
<para>
|
||||
Generate your NixOS configuration:
|
||||
</para>
|
||||
<screen>$ sudo `which nixos-generate-config` --root /</screen>
|
||||
<screen><prompt>$ </prompt>sudo `which nixos-generate-config` --root /</screen>
|
||||
<para>
|
||||
Note that this will place the generated configuration files in
|
||||
<literal>/etc/nixos</literal>. You'll probably want to edit the
|
||||
|
@ -212,21 +212,21 @@ $ sudo groupdel nixbld</screen>
|
|||
</para>
|
||||
<programlisting>
|
||||
<link linkend="opt-users.users._name__.initialHashedPassword">users.users.root.initialHashedPassword</link> = "";
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Build the NixOS closure and install it in the <literal>system</literal>
|
||||
profile:
|
||||
</para>
|
||||
<screen>$ nix-env -p /nix/var/nix/profiles/system -f '<nixpkgs/nixos>' -I nixos-config=/etc/nixos/configuration.nix -iA system</screen>
|
||||
<screen><prompt>$ </prompt>nix-env -p /nix/var/nix/profiles/system -f '<nixpkgs/nixos>' -I nixos-config=/etc/nixos/configuration.nix -iA system</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Change ownership of the <literal>/nix</literal> tree to root (since your
|
||||
Nix install was probably single user):
|
||||
</para>
|
||||
<screen>$ sudo chown -R 0.0 /nix</screen>
|
||||
<screen><prompt>$ </prompt>sudo chown -R 0.0 /nix</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@ -284,16 +284,16 @@ $ sudo groupdel nixbld</screen>
|
|||
Let's create the files:
|
||||
</para>
|
||||
<screen>
|
||||
$ sudo touch /etc/NIXOS
|
||||
$ sudo touch /etc/NIXOS_LUSTRATE
|
||||
</screen>
|
||||
<prompt>$ </prompt>sudo touch /etc/NIXOS
|
||||
<prompt>$ </prompt>sudo touch /etc/NIXOS_LUSTRATE
|
||||
</screen>
|
||||
<para>
|
||||
Let's also make sure the NixOS configuration files are kept once we reboot
|
||||
on NixOS:
|
||||
</para>
|
||||
<screen>
|
||||
$ echo etc/nixos | sudo tee -a /etc/NIXOS_LUSTRATE
|
||||
</screen>
|
||||
<prompt>$ </prompt>echo etc/nixos | sudo tee -a /etc/NIXOS_LUSTRATE
|
||||
</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@ -312,8 +312,9 @@ $ echo etc/nixos | sudo tee -a /etc/NIXOS_LUSTRATE
|
|||
</para>
|
||||
</warning>
|
||||
<screen>
|
||||
$ sudo mv -v /boot /boot.bak &&
|
||||
sudo /nix/var/nix/profiles/system/bin/switch-to-configuration boot</screen>
|
||||
<prompt>$ </prompt>sudo mv -v /boot /boot.bak &&
|
||||
sudo /nix/var/nix/profiles/system/bin/switch-to-configuration boot
|
||||
</screen>
|
||||
<para>
|
||||
Cross your fingers, reboot, hopefully you should get a NixOS prompt!
|
||||
</para>
|
||||
|
|
|
@ -15,16 +15,16 @@
|
|||
<note>
|
||||
<title>On macOS</title>
|
||||
<para>
|
||||
<programlisting>
|
||||
$ diskutil list
|
||||
<screen>
|
||||
<prompt>$ </prompt>diskutil list
|
||||
[..]
|
||||
/dev/diskN (external, physical):
|
||||
#: TYPE NAME SIZE IDENTIFIER
|
||||
[..]
|
||||
$ diskutil unmountDisk diskN
|
||||
<prompt>$ </prompt>diskutil unmountDisk diskN
|
||||
Unmount of all volumes on diskN was successful
|
||||
$ sudo dd if=nix.iso of=/dev/rdiskN
|
||||
</programlisting>
|
||||
<prompt>$ </prompt>sudo dd if=nix.iso of=/dev/rdiskN
|
||||
</screen>
|
||||
Using the 'raw' <command>rdiskN</command> device instead of
|
||||
<command>diskN</command> completes in minutes instead of hours. After
|
||||
<command>dd</command> completes, a GUI dialog "The disk you inserted was
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Create a <emphasis>GPT</emphasis> partition table.
|
||||
<screen language="commands"># parted /dev/sda -- mklabel gpt</screen>
|
||||
<screen language="commands"><prompt># </prompt>parted /dev/sda -- mklabel gpt</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -118,14 +118,14 @@
|
|||
Add the <emphasis>root</emphasis> partition. This will fill the disk
|
||||
except for the end part, where the swap will live, and the space left in
|
||||
front (512MiB) which will be used by the boot partition.
|
||||
<screen language="commands"># parted /dev/sda -- mkpart primary 512MiB -8GiB</screen>
|
||||
<screen language="commands"><prompt># </prompt>parted /dev/sda -- mkpart primary 512MiB -8GiB</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Next, add a <emphasis>swap</emphasis> partition. The size required will
|
||||
vary according to needs, here a 8GiB one is created.
|
||||
<screen language="commands"># parted /dev/sda -- mkpart primary linux-swap -8GiB 100%</screen>
|
||||
<screen language="commands"><prompt># </prompt>parted /dev/sda -- mkpart primary linux-swap -8GiB 100%</screen>
|
||||
<note>
|
||||
<para>
|
||||
The swap partition size rules are no different than for other Linux
|
||||
|
@ -140,8 +140,8 @@
|
|||
the ESP (EFI system partition) as its <emphasis>/boot</emphasis>
|
||||
partition. It uses the initially reserved 512MiB at the start of the
|
||||
disk.
|
||||
<screen language="commands"># parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB
|
||||
# parted /dev/sda -- set 3 boot on</screen>
|
||||
<screen language="commands"><prompt># </prompt>parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB
|
||||
<prompt># </prompt>parted /dev/sda -- set 3 boot on</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
@ -172,21 +172,21 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Create a <emphasis>MBR</emphasis> partition table.
|
||||
<screen language="commands"># parted /dev/sda -- mklabel msdos</screen>
|
||||
<screen language="commands"><prompt># </prompt>parted /dev/sda -- mklabel msdos</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Add the <emphasis>root</emphasis> partition. This will fill the the disk
|
||||
except for the end part, where the swap will live.
|
||||
<screen language="commands"># parted /dev/sda -- mkpart primary 1MiB -8GiB</screen>
|
||||
<screen language="commands"><prompt># </prompt>parted /dev/sda -- mkpart primary 1MiB -8GiB</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Finally, add a <emphasis>swap</emphasis> partition. The size required
|
||||
will vary according to needs, here a 8GiB one is created.
|
||||
<screen language="commands"># parted /dev/sda -- mkpart primary linux-swap -8GiB 100%</screen>
|
||||
<screen language="commands"><prompt># </prompt>parted /dev/sda -- mkpart primary linux-swap -8GiB 100%</screen>
|
||||
<note>
|
||||
<para>
|
||||
The swap partition size rules are no different than for other Linux
|
||||
|
@ -218,7 +218,7 @@
|
|||
since this makes the file system configuration independent from device
|
||||
changes. For example:
|
||||
<screen>
|
||||
# mkfs.ext4 -L nixos /dev/sda1</screen>
|
||||
<prompt># </prompt>mkfs.ext4 -L nixos /dev/sda1</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -227,7 +227,7 @@
|
|||
recommended to assign a label to the swap partition: <option>-L
|
||||
<replaceable>label</replaceable></option>. For example:
|
||||
<screen>
|
||||
# mkswap -L swap /dev/sda2</screen>
|
||||
<prompt># </prompt>mkswap -L swap /dev/sda2</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -242,7 +242,7 @@
|
|||
it’s recommended to assign a label to the boot partition:
|
||||
<option>-n <replaceable>label</replaceable></option>. For example:
|
||||
<screen>
|
||||
# mkfs.fat -F 32 -n boot /dev/sda3</screen>
|
||||
<prompt># </prompt>mkfs.fat -F 32 -n boot /dev/sda3</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -273,7 +273,7 @@
|
|||
Mount the target file system on which NixOS should be installed on
|
||||
<filename>/mnt</filename>, e.g.
|
||||
<screen>
|
||||
# mount /dev/disk/by-label/nixos /mnt
|
||||
<prompt># </prompt>mount /dev/disk/by-label/nixos /mnt
|
||||
</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -287,8 +287,8 @@
|
|||
<para>
|
||||
Mount the boot file system on <filename>/mnt/boot</filename>, e.g.
|
||||
<screen>
|
||||
# mkdir -p /mnt/boot
|
||||
# mount /dev/disk/by-label/boot /mnt/boot
|
||||
<prompt># </prompt>mkdir -p /mnt/boot
|
||||
<prompt># </prompt>mount /dev/disk/by-label/boot /mnt/boot
|
||||
</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -303,7 +303,7 @@
|
|||
the build actions that it may spawn) may need quite a bit of RAM,
|
||||
depending on your configuration.
|
||||
<screen>
|
||||
# swapon /dev/sda2</screen>
|
||||
<prompt># </prompt>swapon /dev/sda2</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -325,11 +325,11 @@
|
|||
The command <command>nixos-generate-config</command> can generate an
|
||||
initial configuration file for you:
|
||||
<screen>
|
||||
# nixos-generate-config --root /mnt</screen>
|
||||
<prompt># </prompt>nixos-generate-config --root /mnt</screen>
|
||||
You should then edit <filename>/mnt/etc/nixos/configuration.nix</filename>
|
||||
to suit your needs:
|
||||
<screen>
|
||||
# nano /mnt/etc/nixos/configuration.nix
|
||||
<prompt># </prompt>nano /mnt/etc/nixos/configuration.nix
|
||||
</screen>
|
||||
If you’re using the graphical ISO image, other editors may be available
|
||||
(such as <command>vim</command>). If you have network access, you can also
|
||||
|
@ -412,7 +412,7 @@
|
|||
<para>
|
||||
Do the installation:
|
||||
<screen>
|
||||
# nixos-install</screen>
|
||||
<prompt># </prompt>nixos-install</screen>
|
||||
Cross fingers. If this fails due to a temporary problem (such as a network
|
||||
issue while downloading binaries from the NixOS binary cache), you can
|
||||
just re-run <command>nixos-install</command>. Otherwise, fix your
|
||||
|
@ -439,7 +439,7 @@ Retype new UNIX password: ***</screen>
|
|||
<para>
|
||||
If everything went well:
|
||||
<screen>
|
||||
# reboot</screen>
|
||||
<prompt># </prompt>reboot</screen>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -460,16 +460,16 @@ Retype new UNIX password: ***</screen>
|
|||
You’ll probably want to create some user accounts as well, which can be
|
||||
done with <command>useradd</command>:
|
||||
<screen>
|
||||
$ useradd -c 'Eelco Dolstra' -m eelco
|
||||
$ passwd eelco</screen>
|
||||
<prompt>$ </prompt>useradd -c 'Eelco Dolstra' -m eelco
|
||||
<prompt>$ </prompt>passwd eelco</screen>
|
||||
</para>
|
||||
<para>
|
||||
You may also want to install some software. For instance,
|
||||
<screen>
|
||||
$ nix-env -qa \*</screen>
|
||||
<prompt>$ </prompt>nix-env -qa \*</screen>
|
||||
shows what packages are available, and
|
||||
<screen>
|
||||
$ nix-env -i w3m</screen>
|
||||
<prompt>$ </prompt>nix-env -i w3m</screen>
|
||||
install the <literal>w3m</literal> browser.
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -489,19 +489,19 @@ $ nix-env -i w3m</screen>
|
|||
<example xml:id="ex-partition-scheme-MBR">
|
||||
<title>Example partition schemes for NixOS on <filename>/dev/sda</filename> (MBR)</title>
|
||||
<screen language="commands">
|
||||
# parted /dev/sda -- mklabel msdos
|
||||
# parted /dev/sda -- mkpart primary 1MiB -8GiB
|
||||
# parted /dev/sda -- mkpart primary linux-swap -8GiB 100%</screen>
|
||||
<prompt># </prompt>parted /dev/sda -- mklabel msdos
|
||||
<prompt># </prompt>parted /dev/sda -- mkpart primary 1MiB -8GiB
|
||||
<prompt># </prompt>parted /dev/sda -- mkpart primary linux-swap -8GiB 100%</screen>
|
||||
</example>
|
||||
|
||||
<example xml:id="ex-partition-scheme-UEFI">
|
||||
<title>Example partition schemes for NixOS on <filename>/dev/sda</filename> (UEFI)</title>
|
||||
<screen language="commands">
|
||||
# parted /dev/sda -- mklabel gpt
|
||||
# parted /dev/sda -- mkpart primary 512MiB -8GiB
|
||||
# parted /dev/sda -- mkpart primary linux-swap -8GiB 100%
|
||||
# parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB
|
||||
# parted /dev/sda -- set 3 boot on</screen>
|
||||
<prompt># </prompt>parted /dev/sda -- mklabel gpt
|
||||
<prompt># </prompt>parted /dev/sda -- mkpart primary 512MiB -8GiB
|
||||
<prompt># </prompt>parted /dev/sda -- mkpart primary linux-swap -8GiB 100%
|
||||
<prompt># </prompt>parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB
|
||||
<prompt># </prompt>parted /dev/sda -- set 3 boot on</screen>
|
||||
</example>
|
||||
|
||||
<example xml:id="ex-install-sequence">
|
||||
|
@ -509,23 +509,23 @@ $ nix-env -i w3m</screen>
|
|||
<para>
|
||||
With a partitioned disk.
|
||||
<screen language="commands">
|
||||
# mkfs.ext4 -L nixos /dev/sda1
|
||||
# mkswap -L swap /dev/sda2
|
||||
# swapon /dev/sda2
|
||||
# mkfs.fat -F 32 -n boot /dev/sda3 # <lineannotation>(for UEFI systems only)</lineannotation>
|
||||
# mount /dev/disk/by-label/nixos /mnt
|
||||
# mkdir -p /mnt/boot # <lineannotation>(for UEFI systems only)</lineannotation>
|
||||
# mount /dev/disk/by-label/boot /mnt/boot # <lineannotation>(for UEFI systems only)</lineannotation>
|
||||
# nixos-generate-config --root /mnt
|
||||
# nano /mnt/etc/nixos/configuration.nix
|
||||
# nixos-install
|
||||
# reboot</screen>
|
||||
<prompt># </prompt>mkfs.ext4 -L nixos /dev/sda1
|
||||
<prompt># </prompt>mkswap -L swap /dev/sda2
|
||||
<prompt># </prompt>swapon /dev/sda2
|
||||
<prompt># </prompt>mkfs.fat -F 32 -n boot /dev/sda3 # <lineannotation>(for UEFI systems only)</lineannotation>
|
||||
<prompt># </prompt>mount /dev/disk/by-label/nixos /mnt
|
||||
<prompt># </prompt>mkdir -p /mnt/boot # <lineannotation>(for UEFI systems only)</lineannotation>
|
||||
<prompt># </prompt>mount /dev/disk/by-label/boot /mnt/boot # <lineannotation>(for UEFI systems only)</lineannotation>
|
||||
<prompt># </prompt>nixos-generate-config --root /mnt
|
||||
<prompt># </prompt>nano /mnt/etc/nixos/configuration.nix
|
||||
<prompt># </prompt>nixos-install
|
||||
<prompt># </prompt>reboot</screen>
|
||||
</para>
|
||||
</example>
|
||||
|
||||
<example xml:id='ex-config'>
|
||||
<title>NixOS Configuration</title>
|
||||
<screen>
|
||||
<programlisting>
|
||||
{ config, pkgs, ... }: {
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
|
@ -543,7 +543,7 @@ $ nix-env -i w3m</screen>
|
|||
# Enable the OpenSSH server.
|
||||
services.sshd.enable = true;
|
||||
}
|
||||
</screen>
|
||||
</programlisting>
|
||||
</example>
|
||||
</section>
|
||||
<section xml:id="sec-installation-additional-notes">
|
||||
|
|
|
@ -13,18 +13,18 @@
|
|||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nixos-generate-config</command>
|
||||
<command>nixos-generate-config</command>
|
||||
<arg>
|
||||
<option>--force</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<arg choice='plain'>
|
||||
<option>--root</option>
|
||||
</arg>
|
||||
<replaceable>root</replaceable>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<arg choice='plain'>
|
||||
<option>--dir</option>
|
||||
|
@ -154,7 +154,7 @@
|
|||
file systems on <filename>/mnt</filename> and
|
||||
<filename>/mnt/boot</filename>, you would run:
|
||||
<screen>
|
||||
$ nixos-generate-config --root /mnt
|
||||
<prompt>$ </prompt>nixos-generate-config --root /mnt
|
||||
</screen>
|
||||
The resulting file
|
||||
<filename>/mnt/etc/nixos/hardware-configuration.nix</filename> might look
|
||||
|
@ -204,7 +204,7 @@ $ nixos-generate-config --root /mnt
|
|||
<para>
|
||||
After installation, if your hardware configuration changes, you can run:
|
||||
<screen>
|
||||
$ nixos-generate-config
|
||||
<prompt>$ </prompt>nixos-generate-config
|
||||
</screen>
|
||||
to update <filename>/etc/nixos/hardware-configuration.nix</filename>. Your
|
||||
<filename>/etc/nixos/configuration.nix</filename> will
|
||||
|
|
|
@ -13,72 +13,72 @@
|
|||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nixos-install</command>
|
||||
<command>nixos-install</command>
|
||||
<arg>
|
||||
<arg choice='plain'>
|
||||
<option>-I</option>
|
||||
</arg>
|
||||
<replaceable>path</replaceable>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<arg choice='plain'>
|
||||
<option>--root</option>
|
||||
</arg>
|
||||
<replaceable>root</replaceable>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<arg choice='plain'>
|
||||
<option>--system</option>
|
||||
</arg>
|
||||
<replaceable>path</replaceable>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<arg choice='plain'>
|
||||
<option>--no-channel-copy</option>
|
||||
</arg>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<arg choice='plain'>
|
||||
<option>--no-root-passwd</option>
|
||||
</arg>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<arg choice='plain'>
|
||||
<option>--no-bootloader</option>
|
||||
</arg>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'>
|
||||
<option>--max-jobs</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice='plain'>
|
||||
<option>-j</option>
|
||||
</arg>
|
||||
</group> <replaceable>number</replaceable>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<option>--cores</option> <replaceable>number</replaceable>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<option>--option</option> <replaceable>name</replaceable> <replaceable>value</replaceable>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<arg choice='plain'>
|
||||
<option>--show-trace</option>
|
||||
</arg>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<arg choice='plain'>
|
||||
<option>--help</option>
|
||||
|
@ -255,12 +255,12 @@
|
|||
on an <literal>ext4</literal> file system created in
|
||||
<filename>/dev/sda1</filename>:
|
||||
<screen>
|
||||
$ mkfs.ext4 /dev/sda1
|
||||
$ mount /dev/sda1 /mnt
|
||||
$ nixos-generate-config --root /mnt
|
||||
$ # edit /mnt/etc/nixos/configuration.nix
|
||||
$ nixos-install
|
||||
$ reboot
|
||||
<prompt>$ </prompt>mkfs.ext4 /dev/sda1
|
||||
<prompt>$ </prompt>mount /dev/sda1 /mnt
|
||||
<prompt>$ </prompt>nixos-generate-config --root /mnt
|
||||
<prompt>$ </prompt># edit /mnt/etc/nixos/configuration.nix
|
||||
<prompt>$ </prompt>nixos-install
|
||||
<prompt>$ </prompt>reboot
|
||||
</screen>
|
||||
</para>
|
||||
</refsection>
|
||||
|
|
|
@ -13,19 +13,19 @@
|
|||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nixos-option</command>
|
||||
<command>nixos-option</command>
|
||||
<arg>
|
||||
<option>-I</option> <replaceable>path</replaceable>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<option>--verbose</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<option>--xml</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice="plain">
|
||||
<replaceable>option.name</replaceable>
|
||||
</arg>
|
||||
|
@ -103,13 +103,13 @@
|
|||
<title>Examples</title>
|
||||
<para>
|
||||
Investigate option values:
|
||||
<screen>$ nixos-option boot.loader
|
||||
<screen><prompt>$ </prompt>nixos-option boot.loader
|
||||
This attribute set contains:
|
||||
generationsDir
|
||||
grub
|
||||
initScript
|
||||
|
||||
$ nixos-option boot.loader.grub.enable
|
||||
<prompt>$ </prompt>nixos-option boot.loader.grub.enable
|
||||
Value:
|
||||
true
|
||||
|
||||
|
|
|
@ -13,39 +13,39 @@
|
|||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>nixos-rebuild</command><group choice='req'>
|
||||
<command>nixos-rebuild</command><group choice='req'>
|
||||
<arg choice='plain'>
|
||||
<option>switch</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice='plain'>
|
||||
<option>boot</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice='plain'>
|
||||
<option>test</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice='plain'>
|
||||
<option>build</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice='plain'>
|
||||
<option>dry-build</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice='plain'>
|
||||
<option>dry-activate</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice='plain'>
|
||||
<option>edit</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice='plain'>
|
||||
<option>build-vm</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice='plain'>
|
||||
<option>build-vm-with-bootloader</option>
|
||||
</arg>
|
||||
|
@ -54,33 +54,33 @@
|
|||
<arg>
|
||||
<option>--upgrade</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<option>--install-bootloader</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<option>--no-build-nix</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<option>--fast</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<option>--rollback</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg>
|
||||
<option>--builders</option> <replaceable>builder-spec</replaceable>
|
||||
</arg>
|
||||
<sbr />
|
||||
<arg>
|
||||
<group choice='req'>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'>
|
||||
<option>--profile-name</option>
|
||||
</arg>
|
||||
|
||||
|
||||
<arg choice='plain'>
|
||||
<option>-p</option>
|
||||
</arg>
|
||||
|
@ -160,7 +160,7 @@
|
|||
the current directory, which points to the output of the top-level
|
||||
“system” derivation. This is essentially the same as doing
|
||||
<screen>
|
||||
$ nix-build /path/to/nixpkgs/nixos -A system
|
||||
<prompt>$ </prompt>nix-build /path/to/nixpkgs/nixos -A system
|
||||
</screen>
|
||||
Note that you do not need to be <literal>root</literal> to run
|
||||
<command>nixos-rebuild build</command>.
|
||||
|
@ -215,8 +215,8 @@ $ nix-build /path/to/nixpkgs/nixos -A system
|
|||
at the script that starts the VM. Thus, to test a NixOS configuration in
|
||||
a virtual machine, you should do the following:
|
||||
<screen>
|
||||
$ nixos-rebuild build-vm
|
||||
$ ./result/bin/run-*-vm
|
||||
<prompt>$ </prompt>nixos-rebuild build-vm
|
||||
<prompt>$ </prompt>./result/bin/run-*-vm
|
||||
</screen>
|
||||
</para>
|
||||
<para>
|
||||
|
@ -375,7 +375,7 @@ $ ./result/bin/run-*-vm
|
|||
<filename>test.nix</filename> without affecting the default system
|
||||
profile, you would do:
|
||||
<screen>
|
||||
$ nixos-rebuild switch -p test -I nixos-config=./test.nix
|
||||
<prompt>$ </prompt>nixos-rebuild switch -p test -I nixos-config=./test.nix
|
||||
</screen>
|
||||
The new configuration will appear in the GRUB 2 submenu “NixOS -
|
||||
Profile 'test'”.
|
||||
|
|
|
@ -627,7 +627,7 @@ nix-env -f "<nixpkgs>" -iA haskellPackages.pandoc
|
|||
In case of an infinite loop, use the <command>--show-trace</command>
|
||||
command line argument and read the line just above the error message.
|
||||
<screen>
|
||||
$ nixos-rebuild build --show-trace
|
||||
<prompt>$ </prompt>nixos-rebuild build --show-trace
|
||||
…
|
||||
while evaluating the module argument `pkgs' in "/etc/nixos/my-module.nix":
|
||||
infinite recursion encountered
|
||||
|
|
|
@ -626,17 +626,17 @@
|
|||
xlink:href="https://nixos.org/nixpkgs/manual/#sec-overlays-install">
|
||||
overlays</link>. For example, the following code:
|
||||
<programlisting>
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in
|
||||
pkgs.overridePackages (self: super: ...)
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in
|
||||
pkgs.overridePackages (self: super: ...)
|
||||
</programlisting>
|
||||
should be replaced by:
|
||||
<programlisting>
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in
|
||||
import pkgs.path { overlays = [(self: super: ...)]; }
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in
|
||||
import pkgs.path { overlays = [(self: super: ...)]; }
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This module provides the proprietary NVIDIA X11 / OpenGL drivers.
|
||||
|
||||
{ stdenv, config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This module contains the basic configuration for building a graphical NixOS
|
||||
# installation CD.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This module defines a NixOS installation CD that contains X11 and
|
||||
# GNOME 3.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
|
|
@ -264,6 +264,11 @@ if (scalar @bcacheDevices > 0) {
|
|||
push @initrdAvailableKernelModules, "bcache";
|
||||
}
|
||||
|
||||
# Prevent unbootable systems if LVM snapshots are present at boot time.
|
||||
if (`lsblk -o TYPE` =~ "lvm") {
|
||||
push @initrdKernelModules, "dm-snapshot";
|
||||
}
|
||||
|
||||
my $virt = `systemd-detect-virt`;
|
||||
chomp $virt;
|
||||
|
||||
|
@ -324,10 +329,19 @@ my @swapDevices;
|
|||
if (@swaps) {
|
||||
shift @swaps;
|
||||
foreach my $swap (@swaps) {
|
||||
$swap =~ /^(\S+)\s/;
|
||||
next unless -e $1;
|
||||
my $dev = findStableDevPath $1;
|
||||
push @swapDevices, "{ device = \"$dev\"; }";
|
||||
my @fields = split ' ', $swap;
|
||||
my $swapFilename = $fields[0];
|
||||
my $swapType = $fields[1];
|
||||
next unless -e $swapFilename;
|
||||
my $dev = findStableDevPath $swapFilename;
|
||||
if ($swapType =~ "partition") {
|
||||
push @swapDevices, "{ device = \"$dev\"; }";
|
||||
} elsif ($swapType =~ "file") {
|
||||
# swap *files* are more likely specified in configuration.nix, so
|
||||
# ignore them here.
|
||||
} else {
|
||||
die "Unsupported swap type: $swapType\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,6 +441,10 @@ EOF
|
|||
}
|
||||
}
|
||||
|
||||
# Don't emit tmpfs entry for /tmp, because it most likely comes from the
|
||||
# boot.tmpOnTmpfs option in configuration.nix (managed declaratively).
|
||||
next if ($mountPoint eq "/tmp" && $fsType eq "tmpfs");
|
||||
|
||||
# Emit the filesystem.
|
||||
$fileSystems .= <<EOF;
|
||||
fileSystems.\"$mountPoint\" =
|
||||
|
@ -517,6 +535,7 @@ sub multiLineList {
|
|||
}
|
||||
|
||||
my $initrdAvailableKernelModules = toNixStringList(uniq @initrdAvailableKernelModules);
|
||||
my $initrdKernelModules = toNixStringList(uniq @initrdKernelModules);
|
||||
my $kernelModules = toNixStringList(uniq @kernelModules);
|
||||
my $modulePackages = toNixList(uniq @modulePackages);
|
||||
|
||||
|
@ -536,6 +555,7 @@ my $hwConfig = <<EOF;
|
|||
imports =${\multiLineList(" ", @imports)};
|
||||
|
||||
boot.initrd.availableKernelModules = [$initrdAvailableKernelModules ];
|
||||
boot.initrd.kernelModules = [$initrdKernelModules ];
|
||||
boot.kernelModules = [$kernelModules ];
|
||||
boot.extraModulePackages = [$modulePackages ];
|
||||
$fsAndSwap
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{ config, options, lib, ... }:
|
||||
let
|
||||
path = [ "deployment" "autoLuks" ];
|
||||
hasAutoLuksOption = lib.hasAttrByPath path options;
|
||||
hasAutoLuksConfig = lib.hasAttrByPath path config && (lib.attrByPath path {} config) != {};
|
||||
|
||||
inherit (config.nixops) enableDeprecatedAutoLuks;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ with lib;
|
|||
|
||||
let
|
||||
|
||||
package = "snapcast";
|
||||
name = "snapserver";
|
||||
|
||||
cfg = config.services.snapserver;
|
||||
|
|
|
@ -72,13 +72,6 @@ let
|
|||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
kubeConfigDefaults = {
|
||||
server = mkDefault cfg.kubeconfig.server;
|
||||
caFile = mkDefault cfg.kubeconfig.caFile;
|
||||
certFile = mkDefault cfg.kubeconfig.certFile;
|
||||
keyFile = mkDefault cfg.kubeconfig.keyFile;
|
||||
};
|
||||
in {
|
||||
|
||||
###### interface
|
||||
|
|
|
@ -28,13 +28,6 @@ let
|
|||
|
||||
kubeconfig = top.lib.mkKubeConfig "kubelet" cfg.kubeconfig;
|
||||
|
||||
manifests = pkgs.buildEnv {
|
||||
name = "kubernetes-manifests";
|
||||
paths = mapAttrsToList (name: manifest:
|
||||
pkgs.writeTextDir "${name}.json" (builtins.toJSON manifest)
|
||||
) cfg.manifests;
|
||||
};
|
||||
|
||||
manifestPath = "kubernetes/manifests";
|
||||
|
||||
taintOptions = with lib.types; { name, ... }: {
|
||||
|
|
|
@ -118,7 +118,6 @@ in
|
|||
cfsslCertPathPrefix = "${config.services.cfssl.dataDir}/cfssl";
|
||||
cfsslCert = "${cfsslCertPathPrefix}.pem";
|
||||
cfsslKey = "${cfsslCertPathPrefix}-key.pem";
|
||||
cfsslPort = toString config.services.cfssl.port;
|
||||
|
||||
certmgrPaths = [
|
||||
top.caFile
|
||||
|
|
|
@ -47,14 +47,14 @@ services.foundationdb.package = pkgs.foundationdb52; # FoundationDB 5.2.x
|
|||
After running <command>nixos-rebuild</command>, you can verify whether
|
||||
FoundationDB is running by executing <command>fdbcli</command> (which is
|
||||
added to <option>environment.systemPackages</option>):
|
||||
<programlisting>
|
||||
$ sudo -u foundationdb fdbcli
|
||||
<screen>
|
||||
<prompt>$ </prompt>sudo -u foundationdb fdbcli
|
||||
Using cluster file `/etc/foundationdb/fdb.cluster'.
|
||||
|
||||
The database is available.
|
||||
|
||||
Welcome to the fdbcli. For help, type `help'.
|
||||
fdb> status
|
||||
<prompt>fdb> </prompt>status
|
||||
|
||||
Using cluster file `/etc/foundationdb/fdb.cluster'.
|
||||
|
||||
|
@ -72,8 +72,8 @@ Cluster:
|
|||
|
||||
...
|
||||
|
||||
fdb>
|
||||
</programlisting>
|
||||
<prompt>fdb></prompt>
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -82,8 +82,8 @@ fdb>
|
|||
cluster status, as a quick example. (This example uses
|
||||
<command>nix-shell</command> shebang support to automatically supply the
|
||||
necessary Python modules).
|
||||
<programlisting>
|
||||
a@link> cat fdb-status.py
|
||||
<screen>
|
||||
<prompt>a@link> </prompt>cat fdb-status.py
|
||||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i python -p python pythonPackages.foundationdb52
|
||||
|
||||
|
@ -103,11 +103,11 @@ def main():
|
|||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
a@link> chmod +x fdb-status.py
|
||||
a@link> ./fdb-status.py
|
||||
<prompt>a@link> </prompt>chmod +x fdb-status.py
|
||||
<prompt>a@link> </prompt>./fdb-status.py
|
||||
FoundationDB available: True
|
||||
a@link>
|
||||
</programlisting>
|
||||
<prompt>a@link></prompt>
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -266,10 +266,10 @@ services.foundationdb.dataDir = "/data/fdb";
|
|||
<emphasis>every</emphasis> node a coordinator automatically:
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
fdbcli> configure double ssd
|
||||
fdbcli> coordinators auto
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>fdbcli> </prompt>configure double ssd
|
||||
<prompt>fdbcli> </prompt>coordinators auto
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
This will transparently update all the servers within seconds, and
|
||||
|
@ -386,10 +386,10 @@ services.foundationdb.extraReadWritePaths = [ "/opt/fdb-backups" ];
|
|||
You can now perform a backup:
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
$ sudo -u foundationdb fdbbackup start -t default -d file:///opt/fdb-backups
|
||||
$ sudo -u foundationdb fdbbackup status -t default
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>sudo -u foundationdb fdbbackup start -t default -d file:///opt/fdb-backups
|
||||
<prompt>$ </prompt>sudo -u foundationdb fdbbackup status -t default
|
||||
</screen>
|
||||
</section>
|
||||
<section xml:id="module-services-foundationdb-limitations">
|
||||
<title>Known limitations</title>
|
||||
|
|
|
@ -42,11 +42,11 @@
|
|||
whether PostgreSQL works by running <command>psql</command>:
|
||||
|
||||
<screen>
|
||||
$ psql
|
||||
<prompt>$ </prompt>psql
|
||||
psql (9.2.9)
|
||||
Type "help" for help.
|
||||
|
||||
alice=>
|
||||
<prompt>alice=></prompt>
|
||||
</screen>
|
||||
-->
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<filename>configuration.nix</filename>:
|
||||
<programlisting>
|
||||
<xref linkend="opt-services.flatpak.enable"/> = true;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
For the sandboxed apps to work correctly, desktop integration portals need to
|
||||
|
@ -30,27 +30,27 @@
|
|||
<filename>configuration.nix</filename>:
|
||||
<programlisting>
|
||||
<xref linkend="opt-services.flatpak.extraPortals"/> = [ pkgs.xdg-desktop-portal-gtk ];
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Then, you will need to add a repository, for example,
|
||||
<link xlink:href="https://github.com/flatpak/flatpak/wiki">Flathub</link>,
|
||||
either using the following commands:
|
||||
<programlisting>
|
||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
flatpak update
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
<prompt>$ </prompt>flatpak update
|
||||
</screen>
|
||||
or by opening the
|
||||
<link xlink:href="https://flathub.org/repo/flathub.flatpakrepo">repository
|
||||
file</link> in GNOME Software.
|
||||
</para>
|
||||
<para>
|
||||
Finally, you can search and install programs:
|
||||
<programlisting>
|
||||
flatpak search bustle
|
||||
flatpak install flathub org.freedesktop.Bustle
|
||||
flatpak run org.freedesktop.Bustle
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>flatpak search bustle
|
||||
<prompt>$ </prompt>flatpak install flathub org.freedesktop.Bustle
|
||||
<prompt>$ </prompt>flatpak run org.freedesktop.Bustle
|
||||
</screen>
|
||||
Again, GNOME Software offers graphical interface for these tasks.
|
||||
</para>
|
||||
</chapter>
|
||||
|
|
|
@ -238,8 +238,8 @@ in
|
|||
<para>
|
||||
You can check that it works by executing this in a terminal:
|
||||
<screen>
|
||||
$ nix-build emacs.nix
|
||||
$ ./result/bin/emacs -q
|
||||
<prompt>$ </prompt>nix-build emacs.nix
|
||||
<prompt>$ </prompt>./result/bin/emacs -q
|
||||
</screen>
|
||||
and then typing <literal>M-x package-initialize</literal>. Check that you
|
||||
can use all the packages you want in this Emacs instance. For example, try
|
||||
|
@ -403,9 +403,9 @@ in [...]
|
|||
<para>
|
||||
To start the daemon, execute the following:
|
||||
<screen>
|
||||
$ nixos-rebuild switch # to activate the new configuration.nix
|
||||
$ systemctl --user daemon-reload # to force systemd reload
|
||||
$ systemctl --user start emacs.service # to start the Emacs daemon
|
||||
<prompt>$ </prompt>nixos-rebuild switch # to activate the new configuration.nix
|
||||
<prompt>$ </prompt>systemctl --user daemon-reload # to force systemd reload
|
||||
<prompt>$ </prompt>systemctl --user start emacs.service # to start the Emacs daemon
|
||||
</screen>
|
||||
The server should now be ready to serve Emacs clients.
|
||||
</para>
|
||||
|
|
|
@ -17,7 +17,7 @@ let
|
|||
${cfg.extraConfig}
|
||||
'';
|
||||
|
||||
bindingCfg = { config, ... }: {
|
||||
bindingCfg = { ... }: {
|
||||
options = {
|
||||
|
||||
keys = mkOption {
|
||||
|
|
|
@ -5,7 +5,6 @@ with lib;
|
|||
let
|
||||
|
||||
cfg = config.services.rspamd;
|
||||
opts = options.services.rspamd;
|
||||
postfixCfg = config.services.postfix;
|
||||
|
||||
bindSocketOpts = {options, config, ... }: {
|
||||
|
|
|
@ -138,13 +138,13 @@ services.gitlab = {
|
|||
|
||||
<para>
|
||||
For example, to backup a Gitlab instance:
|
||||
<programlisting>
|
||||
$ sudo -u git -H gitlab-rake gitlab:backup:create
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>sudo -u git -H gitlab-rake gitlab:backup:create
|
||||
</screen>
|
||||
A list of all availabe rake tasks can be obtained by running:
|
||||
<programlisting>
|
||||
$ sudo -u git -H gitlab-rake -T
|
||||
</programlisting>
|
||||
<screen>
|
||||
<prompt>$ </prompt>sudo -u git -H gitlab-rake -T
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
</chapter>
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
Now in order to import the <literal>alice</literal> user to another machine
|
||||
<literal>alicebox</literal>, all we need to do is something like this:
|
||||
<screen>
|
||||
$ ssh server nixos-taskserver user export my-company alice | sh
|
||||
<prompt>$ </prompt>ssh server nixos-taskserver user export my-company alice | sh
|
||||
</screen>
|
||||
Of course, if no SSH daemon is available on the server you can also copy
|
||||
& paste it directly into a shell.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
|
|
@ -112,65 +112,65 @@
|
|||
directory, which will be called postfix.nix and contains all exporter
|
||||
specific options and configuration:
|
||||
<programlisting>
|
||||
# nixpgs/nixos/modules/services/prometheus/exporters/postfix.nix
|
||||
{ config, lib, pkgs }:
|
||||
# nixpgs/nixos/modules/services/prometheus/exporters/postfix.nix
|
||||
{ config, lib, pkgs }:
|
||||
|
||||
with lib;
|
||||
with lib;
|
||||
|
||||
let
|
||||
# for convenience we define cfg here
|
||||
cfg = config.services.prometheus.exporters.postfix;
|
||||
in
|
||||
{
|
||||
port = 9154; # The postfix exporter listens on this port by default
|
||||
let
|
||||
# for convenience we define cfg here
|
||||
cfg = config.services.prometheus.exporters.postfix;
|
||||
in
|
||||
{
|
||||
port = 9154; # The postfix exporter listens on this port by default
|
||||
|
||||
# `extraOpts` is an attribute set which contains additional options
|
||||
# (and optional overrides for default options).
|
||||
# Note that this attribute is optional.
|
||||
extraOpts = {
|
||||
telemetryPath = mkOption {
|
||||
type = types.str;
|
||||
default = "/metrics";
|
||||
description = ''
|
||||
Path under which to expose metrics.
|
||||
'';
|
||||
};
|
||||
logfilePath = mkOption {
|
||||
type = types.path;
|
||||
default = /var/log/postfix_exporter_input.log;
|
||||
example = /var/log/mail.log;
|
||||
description = ''
|
||||
Path where Postfix writes log entries.
|
||||
This file will be truncated by this exporter!
|
||||
'';
|
||||
};
|
||||
showqPath = mkOption {
|
||||
type = types.path;
|
||||
default = /var/spool/postfix/public/showq;
|
||||
example = /var/lib/postfix/queue/public/showq;
|
||||
description = ''
|
||||
Path at which Postfix places its showq socket.
|
||||
'';
|
||||
};
|
||||
};
|
||||
# `extraOpts` is an attribute set which contains additional options
|
||||
# (and optional overrides for default options).
|
||||
# Note that this attribute is optional.
|
||||
extraOpts = {
|
||||
telemetryPath = mkOption {
|
||||
type = types.str;
|
||||
default = "/metrics";
|
||||
description = ''
|
||||
Path under which to expose metrics.
|
||||
'';
|
||||
};
|
||||
logfilePath = mkOption {
|
||||
type = types.path;
|
||||
default = /var/log/postfix_exporter_input.log;
|
||||
example = /var/log/mail.log;
|
||||
description = ''
|
||||
Path where Postfix writes log entries.
|
||||
This file will be truncated by this exporter!
|
||||
'';
|
||||
};
|
||||
showqPath = mkOption {
|
||||
type = types.path;
|
||||
default = /var/spool/postfix/public/showq;
|
||||
example = /var/lib/postfix/queue/public/showq;
|
||||
description = ''
|
||||
Path at which Postfix places its showq socket.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# `serviceOpts` is an attribute set which contains configuration
|
||||
# for the exporter's systemd service. One of
|
||||
# `serviceOpts.script` and `serviceOpts.serviceConfig.ExecStart`
|
||||
# has to be specified here. This will be merged with the default
|
||||
# service confiuration.
|
||||
serviceOpts = {
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-postfix-exporter}/bin/postfix_exporter \
|
||||
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
||||
--web.telemetry-path ${cfg.telemetryPath} \
|
||||
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
# `serviceOpts` is an attribute set which contains configuration
|
||||
# for the exporter's systemd service. One of
|
||||
# `serviceOpts.script` and `serviceOpts.serviceConfig.ExecStart`
|
||||
# has to be specified here. This will be merged with the default
|
||||
# service confiuration.
|
||||
serviceOpts = {
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-postfix-exporter}/bin/postfix_exporter \
|
||||
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
|
||||
--web.telemetry-path ${cfg.telemetryPath} \
|
||||
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
|
|
@ -86,10 +86,10 @@ in
|
|||
|
||||
<note>
|
||||
<para>If you use the firewall consider adding the following:</para>
|
||||
<programlisting>
|
||||
networking.firewall.allowedTCPPorts = [ 139 445 ];
|
||||
networking.firewall.allowedUDPPorts = [ 137 138 ];
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
networking.firewall.allowedTCPPorts = [ 139 445 ];
|
||||
networking.firewall.allowedUDPPorts = [ 137 138 ];
|
||||
</programlisting>
|
||||
</note>
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -28,7 +28,7 @@ let
|
|||
"-datadir=${cfg.dataDir}"
|
||||
"-pid=${pidFile}"
|
||||
];
|
||||
hexStr = types.strMatching "[0-9a-f]+";
|
||||
|
||||
rpcUserOpts = { name, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
To enable the client proxy, set
|
||||
<programlisting>
|
||||
<xref linkend="opt-services.dnscrypt-proxy.enable"/> = true;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -36,7 +36,7 @@
|
|||
the other client to it:
|
||||
<programlisting>
|
||||
<xref linkend="opt-services.dnscrypt-proxy.localPort"/> = 43;
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<sect2 xml:id="sec-dnscrypt-proxy-forwarder-dsnmasq">
|
||||
|
@ -47,7 +47,7 @@
|
|||
<xref linkend="opt-services.dnsmasq.enable"/> = true;
|
||||
<xref linkend="opt-services.dnsmasq.servers"/> = [ "127.0.0.1#43" ];
|
||||
}
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
<xref linkend="opt-services.unbound.enable"/> = true;
|
||||
<xref linkend="opt-services.unbound.forwardAddresses"/> = [ "127.0.0.1@43" ];
|
||||
}
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
|
|
@ -101,17 +101,17 @@ in
|
|||
'';
|
||||
example = literalExample ''
|
||||
# near constant pings.
|
||||
step = 30
|
||||
pings = 20
|
||||
# consfn mrhb steps total
|
||||
AVERAGE 0.5 1 10080
|
||||
AVERAGE 0.5 12 43200
|
||||
MIN 0.5 12 43200
|
||||
MAX 0.5 12 43200
|
||||
AVERAGE 0.5 144 7200
|
||||
MAX 0.5 144 7200
|
||||
MIN 0.5 144 7200
|
||||
'';
|
||||
step = 30
|
||||
pings = 20
|
||||
# consfn mrhb steps total
|
||||
AVERAGE 0.5 1 10080
|
||||
AVERAGE 0.5 12 43200
|
||||
MIN 0.5 12 43200
|
||||
MAX 0.5 12 43200
|
||||
AVERAGE 0.5 144 7200
|
||||
MAX 0.5 144 7200
|
||||
MIN 0.5 144 7200
|
||||
'';
|
||||
description = ''Configure the ping frequency and retention of the rrd files.
|
||||
Once set, changing the interval will require deletion or migration of all
|
||||
the collected data.'';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{pkgs, config, lib, ...}:
|
||||
{config, lib, ...}:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption mkIf types length attrNames;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
let
|
||||
inherit (lib) mkIf concatStringsSep concatMapStrings toList mapAttrs
|
||||
mapAttrsToList attrValues;
|
||||
mapAttrsToList;
|
||||
cfg = config.services.kerberos_server;
|
||||
kerberos = config.krb5.kerberos;
|
||||
stateDir = "/var/heimdal";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
let
|
||||
inherit (lib) mkIf concatStrings concatStringsSep concatMapStrings toList
|
||||
mapAttrs mapAttrsToList attrValues;
|
||||
mapAttrs mapAttrsToList;
|
||||
cfg = config.services.kerberos_server;
|
||||
kerberos = config.krb5.kerberos;
|
||||
stateDir = "/var/lib/krb5kdc";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
let
|
||||
|
||||
inherit (lib) mkDefault mkEnableOption mkForce mkIf mkMerge mkOption;
|
||||
inherit (lib) mkDefault mkEnableOption mkForce mkIf mkOption;
|
||||
inherit (lib) mapAttrs optional optionalString types;
|
||||
|
||||
cfg = config.services.limesurvey;
|
||||
|
|
|
@ -21,18 +21,18 @@
|
|||
passwordless database authentication via the UNIX_SOCKET authentication
|
||||
plugin with the following SQL commands:
|
||||
<programlisting>
|
||||
# For MariaDB
|
||||
INSTALL PLUGIN unix_socket SONAME 'auth_socket';
|
||||
CREATE DATABASE matomo;
|
||||
CREATE USER 'matomo'@'localhost' IDENTIFIED WITH unix_socket;
|
||||
GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
|
||||
# For MariaDB
|
||||
INSTALL PLUGIN unix_socket SONAME 'auth_socket';
|
||||
CREATE DATABASE matomo;
|
||||
CREATE USER 'matomo'@'localhost' IDENTIFIED WITH unix_socket;
|
||||
GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
|
||||
|
||||
# For MySQL
|
||||
INSTALL PLUGIN auth_socket SONAME 'auth_socket.so';
|
||||
CREATE DATABASE matomo;
|
||||
CREATE USER 'matomo'@'localhost' IDENTIFIED WITH auth_socket;
|
||||
GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
|
||||
</programlisting>
|
||||
# For MySQL
|
||||
INSTALL PLUGIN auth_socket SONAME 'auth_socket.so';
|
||||
CREATE DATABASE matomo;
|
||||
CREATE USER 'matomo'@'localhost' IDENTIFIED WITH auth_socket;
|
||||
GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';
|
||||
</programlisting>
|
||||
Then fill in <literal>matomo</literal> as database user and database name,
|
||||
and leave the password field blank. This authentication works by allowing
|
||||
only the <literal>matomo</literal> unix user to authenticate as the
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }@args:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ let
|
|||
else cfg.database.port;
|
||||
|
||||
poolName = "tt-rss";
|
||||
phpfpmSocketName = "/run/phpfpm/${poolName}.sock";
|
||||
|
||||
tt-rss-config = pkgs.writeText "config.php" ''
|
||||
<?php
|
||||
|
|
|
@ -269,17 +269,6 @@ let
|
|||
${optionalString (config.proxyPass != null && cfg.recommendedProxySettings) "include ${recommendedProxyConfig};"}
|
||||
}
|
||||
'') (sortProperties (mapAttrsToList (k: v: v // { location = k; }) locations)));
|
||||
mkBasicAuth = vhostName: authDef: let
|
||||
htpasswdFile = pkgs.writeText "${vhostName}.htpasswd" (
|
||||
concatStringsSep "\n" (mapAttrsToList (user: password: ''
|
||||
${user}:{PLAIN}${password}
|
||||
'') authDef)
|
||||
);
|
||||
in ''
|
||||
auth_basic secured;
|
||||
auth_basic_user_file ${htpasswdFile};
|
||||
'';
|
||||
|
||||
mkHtpasswd = vhostName: authDef: pkgs.writeText "${vhostName}.htpasswd" (
|
||||
concatStringsSep "\n" (mapAttrsToList (user: password: ''
|
||||
${user}:{PLAIN}${password}
|
||||
|
|
|
@ -4,8 +4,6 @@ with lib;
|
|||
|
||||
let
|
||||
|
||||
kernelPackages = config.boot.kernelPackages;
|
||||
|
||||
# Abbreviations.
|
||||
cfg = config.services.xserver;
|
||||
xorg = pkgs.xorg;
|
||||
|
|
|
@ -9,7 +9,6 @@ let
|
|||
mergeAnswer = winners: locs: defs:
|
||||
let
|
||||
values = map (x: x.value) defs;
|
||||
freeformAnswer = intersectLists values winners;
|
||||
inter = intersectLists values winners;
|
||||
winner = head winners;
|
||||
in
|
||||
|
|
|
@ -100,12 +100,7 @@ in
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "systemd-udev-settle.service" ];
|
||||
preStart = let
|
||||
initsh = let
|
||||
ip = cfg.ipv4.container.address;
|
||||
gw = cfg.ipv4.gateway.address;
|
||||
dns = cfg.ipv4.dns;
|
||||
in
|
||||
pkgs.writeText "nixos-init" (''
|
||||
initsh = pkgs.writeText "nixos-init" (''
|
||||
#!/system/bin/sh
|
||||
setprop nixos.version ${config.system.nixos.version}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ let
|
|||
cfg = config.docker-containers;
|
||||
|
||||
dockerContainer =
|
||||
{ name, config, ... }: {
|
||||
{ ... }: {
|
||||
|
||||
options = {
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
with lib;
|
||||
let
|
||||
gce = pkgs.google-compute-engine;
|
||||
cfg = config.virtualisation.googleComputeImage;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
|
|
@ -46,22 +46,24 @@ in {
|
|||
message = "KVMGT is not properly supported for kernels older than 4.16";
|
||||
};
|
||||
boot.kernelParams = [ "i915.enable_gvt=1" ];
|
||||
systemd.paths = mapAttrs' (name: value:
|
||||
nameValuePair "kvmgt-${name}" {
|
||||
description = "KVMGT VGPU ${name} path";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
pathConfig = {
|
||||
PathExists = "/sys/bus/pci/devices/${cfg.device}/mdev_supported_types/${name}/create";
|
||||
};
|
||||
}
|
||||
) cfg.vgpus;
|
||||
systemd.services = mapAttrs' (name: value:
|
||||
nameValuePair "kvmgt-${name}" {
|
||||
description = "KVMGT VGPU ${name}";
|
||||
serviceConfig = {
|
||||
Type = "forking";
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
Restart = "on-failure";
|
||||
RestartSec = 5;
|
||||
ExecStart = "${pkgs.runtimeShell} -c 'echo ${value.uuid} > /sys/bus/pci/devices/${cfg.device}/mdev_supported_types/${name}/create'";
|
||||
ExecStop = "${pkgs.runtimeShell} -c 'echo 1 > /sys/bus/pci/devices/${cfg.device}/${value.uuid}/remove'";
|
||||
};
|
||||
unitConfig = {
|
||||
StartLimitBurst = 5;
|
||||
StartLimitIntervalSec = 30;
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
}
|
||||
) cfg.vgpus;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{ stdenv, fetchurl, pkgconfig, autoreconfHook, hexdump, openssl, db48
|
||||
, boost, zlib, miniupnpc, qt4, utillinux, protobuf, qrencode, libevent
|
||||
, boost, zlib, miniupnpc, qt4, protobuf, qrencode, libevent
|
||||
, AppKit
|
||||
, withGui ? !stdenv.isDarwin
|
||||
}:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ callPackage, boost155, boost165, openssl_1_1, haskellPackages, darwin, libsForQt5, libsForQt59, miniupnpc_2, python3, buildGo110Package }:
|
||||
{ callPackage, boost155, boost165, openssl_1_1, darwin, libsForQt5, libsForQt59, miniupnpc_2, python3, buildGo110Package }:
|
||||
|
||||
rec {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, lib, makeWrapper, fetchurl, unzip, glib, systemd, nss, nspr, gtk3-x11, gnome2,
|
||||
{ stdenv, lib, fetchurl, unzip, glib, systemd, nss, nspr, gtk3-x11, gnome2,
|
||||
atk, cairo, gdk_pixbuf, xorg, xorg_sys_opengl, utillinux, alsaLib, dbus, at-spi2-atk,
|
||||
cups, vivaldi-ffmpeg-codecs, libpulseaudio }:
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue