···22in
23 { inherit trivial lists strings stringsWithDeps attrsets sources options
24 properties modules types meta debug maintainers licenses platforms systems;
0025 }
26 # !!! don't include everything at top-level; perhaps only the most
27 # commonly used functions.
···22in
23 { inherit trivial lists strings stringsWithDeps attrsets sources options
24 properties modules types meta debug maintainers licenses platforms systems;
25+ # Pull in some builtins not included elsewhere.
26+ inherit (builtins) pathExists readFile;
27 }
28 # !!! don't include everything at top-level; perhaps only the most
29 # commonly used functions.
···1# General list operations.
2let
03 inherit (import ./trivial.nix) deepSeq;
45 inc = builtins.add 1;
67 dec = n: builtins.sub n 1;
89- inherit (builtins) elemAt;
10in rec {
11- inherit (builtins) head tail length isList add sub lessThan;
121314 # Create a list consisting of a single element. `singleton x' is
···1# General list operations.
2let
3+4 inherit (import ./trivial.nix) deepSeq;
56 inc = builtins.add 1;
78 dec = n: builtins.sub n 1;
9010in rec {
11+ inherit (builtins) head tail length isList add sub lessThan elemAt;
121314 # Create a list consisting of a single element. `singleton x' is
+1-3
lib/misc.nix
···206 in
207 work startSet [] [];
208209- genericClosure =
210- if builtins ? genericClosure then builtins.genericClosure
211- else lazyGenericClosure;
212213 innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else
214 innerModifySumArgs f x (a // b);
···206 in
207 work startSet [] [];
208209+ genericClosure = builtins.genericClosure or lazyGenericClosure;
00210211 innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else
212 innerModifySumArgs f x (a // b);
+1-2
lib/modules.nix
···185 ) funs;
186187188- moduleMerge = path: modules:
189- let modules_ = modules; in
190 let
191 addName = name:
192 if path == "" then name else path + "." + name;
···185 ) funs;
186187188+ moduleMerge = path: modules_:
0189 let
190 addName = name:
191 if path == "" then name else path + "." + name;
+5-6
lib/options.nix
···1112rec {
1314- inherit (lib) isType;
15-16-17- isOption = isType "option";
18 mkOption = attrs: attrs // {
19 _type = "option";
20 # name (this is the name of the attributem it is automatically generated by the traversal)
···66 if all opt.check list then
67 opt.merge list
68 else
69- throw "One of option ${name} values has a bad type.";
70 }
71 else opt;
72···77 if opt.check opt.default then
78 opt.default
79 else
80- throw "The default value of option ${name} has a bad type.";
81 }
82 else opt;
83···275 description = opt.description or (throw "Option ${opt.name}: No description.");
276 declarations = map (x: toString x.source) opt.declarations;
277 #definitions = map (x: toString x.source) opt.definitions;
00278 }
279 // optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; }
280 // optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; }
···1112rec {
1314+ isOption = lib.isType "option";
00015 mkOption = attrs: attrs // {
16 _type = "option";
17 # name (this is the name of the attributem it is automatically generated by the traversal)
···63 if all opt.check list then
64 opt.merge list
65 else
66+ throw "A value of the option `${name}' has a bad type.";
67 }
68 else opt;
69···74 if opt.check opt.default then
75 opt.default
76 else
77+ throw "The default value of the option `${name}' has a bad type.";
78 }
79 else opt;
80···272 description = opt.description or (throw "Option ${opt.name}: No description.");
273 declarations = map (x: toString x.source) opt.declarations;
274 #definitions = map (x: toString x.source) opt.definitions;
275+ internal = opt.internal or false;
276+ visible = opt.visible or true;
277 }
278 // optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; }
279 // optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; }
···1314<!--===============================================================-->
1500000000016<section><title>Package management</title>
1718<para>This section describes how to add additional packages to your
···1314<!--===============================================================-->
1516+<section xml:id="sec-configuration-syntax"><title>Configuration syntax</title>
17+18+<para>TODO</para>
19+20+</section>
21+22+23+<!--===============================================================-->
24+25<section><title>Package management</title>
2627<para>This section describes how to add additional packages to your
···1{ pkgs, options
2+, revision ? "master"
03}:
45with pkgs.lib;
67let
89+ # Remove invisible and internal options.
10+ options' = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options);
0001112+ # Clean up declaration sites to not refer to the NixOS source tree.
13+ options'' = flip map options' (opt: opt // {
14+ declarations = map (fn: stripPrefix fn) opt.declarations;
15+ });
16+17+ prefix = toString pkgs.path;
18+19+ stripPrefix = fn:
20+ if substring 0 (stringLength prefix) fn == prefix then
21+ substring (add (stringLength prefix) 1) 1000 fn
22+ else
23+ fn;
24+25+ optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML options''));
2627 optionsDocBook = pkgs.runCommand "options-db.xml" {} ''
28+ if grep /nixpkgs/nixos/modules ${optionsXML}; then
29+ echo "The manual appears to depend on the location of Nixpkgs, which is bad"
30+ echo "since this prevents sharing via the NixOS channel. This is typically"
31+ echo "caused by an option default that refers to a relative path (see above"
32+ echo "for hints about the offending path)."
33+ exit 1
34+ fi
35 ${pkgs.libxslt}/bin/xsltproc \
36 --stringparam revision '${revision}' \
37 -o $out ${./options-to-docbook.xsl} ${optionsXML}
···7980 cp ${./style.css} $dst/style.css
8182+ mkdir -p $out/nix-support
83+ echo "nix-build out $out" >> $out/nix-support/hydra-build-products
84 echo "doc manual $dst manual.html" >> $out/nix-support/hydra-build-products
85 ''; # */
86+87+ meta.description = "The NixOS manual in HTML format";
88 };
8990 # Generate the NixOS manpages.
···105 ./man-pages.xml
106107 # Generate manpages.
108+ mkdir -p $out/share/man
109 xsltproc --nonet --xinclude \
110 --param man.output.in.separate.dir 1 \
111 --param man.output.base.dir "'$out/share/man/'" \
+58-28
nixos/doc/manual/installation.xml
···44 <listitem><para>The NixOS manual is available on virtual console 8
45 (press Alt+F8 to access).</para></listitem>
4647- <listitem><para>Login as <literal>root</literal>, empty
48 password.</para></listitem>
4950 <listitem><para>If you downloaded the graphical ISO image, you can
···89 </para></listitem>
9091 <listitem><para>Mount the target file system on which NixOS should
92- be installed on <filename>/mnt</filename>.</para></listitem>
0000009394 <listitem>
95···97 <filename>/mnt/etc/nixos/configuration.nix</filename> that
98 specifies the intended configuration of the system. This is
99 because NixOS has a <emphasis>declarative</emphasis> configuration
100- model: you create or edit a description of the configuration that
101- you want to be built and activated, and then NixOS takes care of
102- realising that configuration. The command
103- <command>nixos-option</command> can generate an initial
104- configuration file for you:
00000105106<screen>
107-$ nixos-option --install</screen>
108-109- It tries to figure out the kernel modules necessary for mounting
110- the root device, as well as various other hardware
111- characteristics. However, it doesn’t try to figure out the
112- <option>fileSystems</option> option yet.</para>
113114- <para>You should edit
115 <filename>/mnt/etc/nixos/configuration.nix</filename> to suit your
116- needs. The text editors <command>nano</command> and
117- <command>vim</command> are available.</para>
118119- <para>You need to specify a root file system in
120- <option>fileSystems</option> and the target device for the Grub boot
121- loader in <option>boot.loader.grub.device</option>. See
122- <xref linkend="ch-options"/> for a list of the available configuration
123- options.</para>
124125- <note><para>It is very important that you specify in the option
126- <option>boot.initrd.kernelModules</option> all kernel modules that
127- are necessary for mounting the root file system, otherwise the
128- installed system will not be able to boot. (If this happens, boot
129- from the CD again, mount the target file system on
0000000000000000000130 <filename>/mnt</filename>, fix
131 <filename>/mnt/etc/nixos/configuration.nix</filename> and rerun
132 <filename>nixos-install</filename>.) In most cases,
133- <command>nixos-option --install</command> will figure out the
134 required modules.</para></note>
135136 <para>Examples of real-world NixOS configuration files can be
···218$ mkfs.ext4 -L nixos /dev/sda1 <lineannotation>(idem)</lineannotation>
219$ mkswap -L swap /dev/sda2 <lineannotation>(idem)</lineannotation>
220$ mount LABEL=nixos /mnt
221-$ nixos-option --install
222$ nano /mnt/etc/nixos/configuration.nix
223<lineannotation>(in particular, set the fileSystems and swapDevices options)</lineannotation>
224$ nixos-install
···228<example xml:id='ex-config'><title>NixOS configuration</title>
229<screen>
230{
00000231 boot.loader.grub.device = "/dev/sda";
232000233 fileSystems."/".device = "/dev/disk/by-label/nixos";
234235 swapDevices =
···44 <listitem><para>The NixOS manual is available on virtual console 8
45 (press Alt+F8 to access).</para></listitem>
4647+ <listitem><para>Login as <literal>root</literal> and the empty
48 password.</para></listitem>
4950 <listitem><para>If you downloaded the graphical ISO image, you can
···89 </para></listitem>
9091 <listitem><para>Mount the target file system on which NixOS should
92+ be installed on <filename>/mnt</filename>, e.g.
93+94+<screen>
95+$ mount /dev/disk/by-label/nixos /mnt
96+</screen>
97+98+ </para></listitem>
99100 <listitem>
101···103 <filename>/mnt/etc/nixos/configuration.nix</filename> that
104 specifies the intended configuration of the system. This is
105 because NixOS has a <emphasis>declarative</emphasis> configuration
106+ model: you create or edit a description of the desired
107+ configuration of your system, and then NixOS takes care of making
108+ it happen. The syntax of the NixOS configuration file is
109+ described in <xref linkend="sec-configuration-syntax"/>, while a
110+ list of available configuration options appears in <xref
111+ linkend="ch-options"/>. A minimal example is shown in <xref
112+ linkend="ex-config"/>.</para>
113+114+ <para>The command <command>nixos-generate-config</command> can
115+ generate an initial configuration file for you:
116117<screen>
118+$ nixos-generate-config --root /mnt</screen>
00000119120+ You should then edit
121 <filename>/mnt/etc/nixos/configuration.nix</filename> to suit your
122+ needs:
0123124+<screen>
125+$ nano /mnt/etc/nixos/configuration.nix
126+</screen>
00127128+ The <command>vim</command> text editor is also available.</para>
129+130+ <para>You <emphasis>must</emphasis> set the option
131+ <option>boot.loader.grub.device</option> to specify on which disk
132+ the GRUB boot loader is to be installed. Without it, NixOS cannot
133+ boot.</para>
134+135+ <para>Another critical option is <option>fileSystems</option>,
136+ specifying the file systems that need to be mounted by NixOS.
137+ However, you typically don’t need to set it yourself, because
138+ <command>nixos-generate-config</command> sets it automatically in
139+ <filename>/mnt/etc/nixos/hardware-configuration.nix</filename>
140+ from your currently mounted file systems. (The configuration file
141+ <filename>hardware-configuration.nix</filename> is included from
142+ <filename>configuration.nix</filename> and will be overwritten by
143+ future invocations of <command>nixos-generate-config</command>;
144+ thus, you generally should not modify it.)</para>
145+146+ <note><para>Depending on your hardware configuration or type of
147+ file system, you may need to set the option
148+ <option>boot.initrd.kernelModules</option> to include the kernel
149+ modules that are necessary for mounting the root file system,
150+ otherwise the installed system will not be able to boot. (If this
151+ happens, boot from the CD again, mount the target file system on
152 <filename>/mnt</filename>, fix
153 <filename>/mnt/etc/nixos/configuration.nix</filename> and rerun
154 <filename>nixos-install</filename>.) In most cases,
155+ <command>nixos-generate-config</command> will figure out the
156 required modules.</para></note>
157158 <para>Examples of real-world NixOS configuration files can be
···240$ mkfs.ext4 -L nixos /dev/sda1 <lineannotation>(idem)</lineannotation>
241$ mkswap -L swap /dev/sda2 <lineannotation>(idem)</lineannotation>
242$ mount LABEL=nixos /mnt
243+$ nixos-generate-config
244$ nano /mnt/etc/nixos/configuration.nix
245<lineannotation>(in particular, set the fileSystems and swapDevices options)</lineannotation>
246$ nixos-install
···250<example xml:id='ex-config'><title>NixOS configuration</title>
251<screen>
252{
253+ imports =
254+ [ # Include the results of the hardware scan.
255+ ./hardware-configuration.nix
256+ ];
257+258 boot.loader.grub.device = "/dev/sda";
259260+ # Note: setting fileSystems and swapDevices is generally not
261+ # necessary, since nixos-generate-config has set them automatically
262+ # in hardware-configuration.nix.
263 fileSystems."/".device = "/dev/disk/by-label/nixos";
264265 swapDevices =
···3940 # Subscribe the root user to the NixOS channel by default.
41 if [ "$USER" = root -a ! -e $HOME/.nix-channels ]; then
42- echo "http://nixos.org/channels/nixos-unstable nixos" > $HOME/.nix-channels
43 fi
4445 # Create the per-user garbage collector roots directory.
···3940 # Subscribe the root user to the NixOS channel by default.
41 if [ "$USER" = root -a ! -e $HOME/.nix-channels ]; then
42+ echo "${config.system.defaultChannel} nixos" > $HOME/.nix-channels
43 fi
4445 # Create the per-user garbage collector roots directory.
+8-5
nixos/modules/programs/ssh.nix
···1# Global configuration for the SSH client.
23-{config, pkgs, ...}:
45with pkgs.lib;
6···31 setXAuthLocation = mkOption {
32 default = true;
33 description = ''
34- Whether to set the path to xauth for X11-forwarded connections.
35 Pulls in X11 dependency.
36 '';
37 };
···46 };
47 };
4849- assertions = [{ assertion = if cfg.forwardX11 then cfg.setXAuthLocation else true;
50- message = "cannot enable X11 forwarding without setting xauth location";}];
00005152- config = {
53 environment.etc =
54 [ { # SSH configuration. Slight duplication of the sshd_config
55 # generation in the sshd service.
···1# Global configuration for the SSH client.
23+{ config, pkgs, ... }:
45with pkgs.lib;
6···31 setXAuthLocation = mkOption {
32 default = true;
33 description = ''
34+ Whether to set the path to <command>xauth</command> for X11-forwarded connections.
35 Pulls in X11 dependency.
36 '';
37 };
···46 };
47 };
4849+ config = {
50+51+ assertions = singleton
52+ { assertion = cfg.forwardX11 -> cfg.setXAuthLocation;
53+ message = "cannot enable X11 forwarding without setting XAuth location";
54+ };
55056 environment.etc =
57 [ { # SSH configuration. Slight duplication of the sshd_config
58 # generation in the sshd service.
+82-66
nixos/modules/rename.nix
···1-{pkgs, options, config, ...}:
0023let
45- alias = from: to: {
06 name = "Alias";
7- msg.use = x: x;
8- msg.define = x: x;
09 };
1011- obsolete = from: to: {
012 name = "Obsolete name";
13- msg.use = x:
14- builtins.trace "Obsolete option `${from}' is used instead of `${to}'." x;
15- msg.define = x:
16- builtins.trace "Obsolete option `${from}' is defined instead of `${to}'." x;
17 };
1819- deprecated = from: to: {
020 name = "Deprecated name";
21- msg.use = x:
22- abort "Deprecated option `${from}' is used instead of `${to}'.";
23- msg.define = x:
24- abort "Deprecated option `${from}' is defined instead of `${to}'.";
25 };
2602728- zipModules = list: with pkgs.lib;
29 zipAttrsWith (n: v:
30 if tail v != [] then
31 if n == "_type" then (head v)
32- else if n == "extraConfigs" then (concatLists v)
033 else if n == "description" || n == "apply" then
34 abort "Cannot rename an option to multiple options."
35 else zipModules v
36 else head v
37 ) list;
3839- rename = statusTemplate: from: to: with pkgs.lib;
40 let
41- status = statusTemplate from to;
42- setTo = setAttrByPath (splitString "." to);
43- setFrom = setAttrByPath (splitString "." from);
44- toOf = attrByPath (splitString "." to)
45- (abort "Renaming error: option `${to}' does not exists.");
46- fromOf = attrByPath (splitString "." from)
47- (abort "Internal error: option `${from}' should be declared.");
48 in
49- [{
50- options = setFrom (mkOption {
51- description = "${status.name} of <option>${to}</option>.";
52- apply = x: status.msg.use (toOf config);
53- });
54- }] ++
55- [{
56- options = setTo (mkOption {
57- extraConfigs =
58- let externalDefs = (fromOf options).definitions; in
59- if externalDefs == [] then []
60- else map (def: def.value) (status.msg.define externalDefs);
61- });
62- }];
0000000006364in zipModules ([]
6566# usage example:
67-# ++ rename alias "services.xserver.slim.theme" "services.xserver.displayManager.slim.theme"
68-++ rename obsolete "environment.extraPackages" "environment.systemPackages"
69-++ rename obsolete "environment.enableBashCompletion" "programs.bash.enableCompletion"
7071-++ rename obsolete "security.extraSetuidPrograms" "security.setuidPrograms"
72-++ rename obsolete "networking.enableWLAN" "networking.wireless.enable"
73-++ rename obsolete "networking.enableRT73Firmware" "networking.enableRalinkFirmware"
7475# FIXME: Remove these eventually.
76-++ rename obsolete "boot.systemd.sockets" "systemd.sockets"
77-++ rename obsolete "boot.systemd.targets" "systemd.targets"
78-++ rename obsolete "boot.systemd.services" "systemd.services"
7980# Old Grub-related options.
81-++ rename obsolete "boot.copyKernels" "boot.loader.grub.copyKernels"
82-++ rename obsolete "boot.extraGrubEntries" "boot.loader.grub.extraEntries"
83-++ rename obsolete "boot.extraGrubEntriesBeforeNixos" "boot.loader.grub.extraEntriesBeforeNixOS"
84-++ rename obsolete "boot.grubDevice" "boot.loader.grub.device"
85-++ rename obsolete "boot.bootMount" "boot.loader.grub.bootDevice"
86-++ rename obsolete "boot.grubSplashImage" "boot.loader.grub.splashImage"
8788-++ rename obsolete "boot.initrd.extraKernelModules" "boot.initrd.kernelModules"
8990# OpenSSH
91-++ rename obsolete "services.sshd.ports" "services.openssh.ports"
92-++ rename alias "services.sshd.enable" "services.openssh.enable"
93-++ rename obsolete "services.sshd.allowSFTP" "services.openssh.allowSFTP"
94-++ rename obsolete "services.sshd.forwardX11" "services.openssh.forwardX11"
95-++ rename obsolete "services.sshd.gatewayPorts" "services.openssh.gatewayPorts"
96-++ rename obsolete "services.sshd.permitRootLogin" "services.openssh.permitRootLogin"
97-++ rename obsolete "services.xserver.startSSHAgent" "services.xserver.startOpenSSHAgent"
9899# KDE
100-++ rename deprecated "kde.extraPackages" "environment.kdePackages"
101-# ++ rename obsolete "environment.kdePackages" "environment.systemPackages" # !!! doesn't work!
102103# Multiple efi bootloaders now
104-++ rename obsolete "boot.loader.efi.efibootmgr.enable" "boot.loader.efi.canTouchEfiVariables"
105106# NixOS environment changes
107# !!! this hardcodes bash, could we detect from config which shell is actually used?
108-++ rename obsolete "environment.promptInit" "programs.bash.promptInit"
0000109110-) # do not add renaming after this.
···1+{ config, pkgs, options, ... }:
2+3+with pkgs.lib;
45let
67+ alias = from: to: rename {
8+ inherit from to;
9 name = "Alias";
10+ use = id;
11+ define = id;
12+ visible = true;
13 };
1415+ obsolete = from: to: rename {
16+ inherit from to;
17 name = "Obsolete name";
18+ use = x: builtins.trace "Obsolete option `${showOption from}' is used instead of `${showOption to}'." x;
19+ define = x: builtins.trace "Obsolete option `${showOption from}' is defined instead of `${showOption to}'." x;
0020 };
2122+ deprecated = from: to: rename {
23+ inherit from to;
24 name = "Deprecated name";
25+ use = x: abort "Deprecated option `${showOption from}' is used instead of `${showOption to}'.";
26+ define = x: abort "Deprecated option `${showOption from}' is defined instead of `${showOption to}'.";
0027 };
2829+ showOption = concatStringsSep ".";
3031+ zipModules = list:
32 zipAttrsWith (n: v:
33 if tail v != [] then
34 if n == "_type" then (head v)
35+ else if n == "extraConfigs" then concatLists v
36+ else if n == "warnings" then concatLists v
37 else if n == "description" || n == "apply" then
38 abort "Cannot rename an option to multiple options."
39 else zipModules v
40 else head v
41 ) list;
4243+ rename = { from, to, name, use, define, visible ? false }:
44 let
45+ setTo = setAttrByPath to;
46+ setFrom = setAttrByPath from;
47+ toOf = attrByPath to
48+ (abort "Renaming error: option `${showOption to}' does not exists.");
49+ fromOf = attrByPath from
50+ (abort "Internal error: option `${showOption from}' should be declared.");
051 in
52+ [ { options = setFrom (mkOption {
53+ description = "${name} of <option>${showOption to}</option>.";
54+ apply = x: use (toOf config);
55+ inherit visible;
56+ });
57+ }
58+ { options = setTo (mkOption {
59+ extraConfigs =
60+ let externalDefs = (fromOf options).definitions; in
61+ if externalDefs == [] then []
62+ else map (def: def.value) (define externalDefs);
63+ });
64+ }
65+ ];
66+67+ obsolete' = option: singleton
68+ { options = setAttrByPath option (mkOption {
69+ default = null;
70+ visible = false;
71+ });
72+ config.warnings = optional (getAttrFromPath option config != null)
73+ "The option `${showOption option}' defined in your configuration no longer has any effect; please remove it.";
74+ };
7576in zipModules ([]
7778# usage example:
79+# ++ alias [ "services" "xserver" "slim" "theme" ] [ "services" "xserver" "displayManager" "slim" "theme" ]
80+++ obsolete [ "environment" "extraPackages" ] [ "environment" "systemPackages" ]
81+++ obsolete [ "environment" "enableBashCompletion" ] [ "programs" "bash" "enableCompletion" ]
8283+++ obsolete [ "security" "extraSetuidPrograms" ] [ "security" "setuidPrograms" ]
84+++ obsolete [ "networking" "enableWLAN" ] [ "networking" "wireless" "enable" ]
85+++ obsolete [ "networking" "enableRT73Firmware" ] [ "networking" "enableRalinkFirmware" ]
8687# FIXME: Remove these eventually.
88+++ obsolete [ "boot" "systemd" "sockets" ] [ "systemd" "sockets" ]
89+++ obsolete [ "boot" "systemd" "targets" ] [ "systemd" "targets" ]
90+++ obsolete [ "boot" "systemd" "services" ] [ "systemd" "services" ]
9192# Old Grub-related options.
93+++ obsolete [ "boot" "copyKernels" ] [ "boot" "loader" "grub" "copyKernels" ]
94+++ obsolete [ "boot" "extraGrubEntries" ] [ "boot" "loader" "grub" "extraEntries" ]
95+++ obsolete [ "boot" "extraGrubEntriesBeforeNixos" ] [ "boot" "loader" "grub" "extraEntriesBeforeNixOS" ]
96+++ obsolete [ "boot" "grubDevice" ] [ "boot" "loader" "grub" "device" ]
97+++ obsolete [ "boot" "bootMount" ] [ "boot" "loader" "grub" "bootDevice" ]
98+++ obsolete [ "boot" "grubSplashImage" ] [ "boot" "loader" "grub" "splashImage" ]
99100+++ obsolete [ "boot" "initrd" "extraKernelModules" ] [ "boot" "initrd" "kernelModules" ]
101102# OpenSSH
103+++ obsolete [ "services" "sshd" "ports" ] [ "services" "openssh" "ports" ]
104+++ alias [ "services" "sshd" "enable" ] [ "services" "openssh" "enable" ]
105+++ obsolete [ "services" "sshd" "allowSFTP" ] [ "services" "openssh" "allowSFTP" ]
106+++ obsolete [ "services" "sshd" "forwardX11" ] [ "services" "openssh" "forwardX11" ]
107+++ obsolete [ "services" "sshd" "gatewayPorts" ] [ "services" "openssh" "gatewayPorts" ]
108+++ obsolete [ "services" "sshd" "permitRootLogin" ] [ "services" "openssh" "permitRootLogin" ]
109+++ obsolete [ "services" "xserver" "startSSHAgent" ] [ "services" "xserver" "startOpenSSHAgent" ]
110111# KDE
112+++ deprecated [ "kde" "extraPackages" ] [ "environment" "kdePackages" ]
113+# ++ obsolete [ "environment" "kdePackages" ] [ "environment" "systemPackages" ] # !!! doesn't work!
114115# Multiple efi bootloaders now
116+++ obsolete [ "boot" "loader" "efi" "efibootmgr" "enable" ] [ "boot" "loader" "efi" "canTouchEfiVariables" ]
117118# NixOS environment changes
119# !!! this hardcodes bash, could we detect from config which shell is actually used?
120+++ obsolete [ "environment" "promptInit" ] [ "programs" "bash" "promptInit" ]
121+122+# Options that are obsolete and have no replacement.
123+++ obsolete' [ "boot" "loader" "grub" "bootDevice" ]
124+++ obsolete' [ "boot" "initrd" "luks" "enable" ]
125126+)
+3-2
nixos/modules/services/audio/fuppes.nix
···60 };
6162 vfolder = mkOption {
63- default = ./fuppes/vfolder.cfg;
64- example = /etc/fuppes/vfolder.cfg;
65 description = ''
66 XML file describing the layout of virtual folder visible by the
67 client.
···108 };
109110 services.fuppesd.name = mkDefault config.networking.hostName;
00111112 security.sudo.enable = true;
113 };
···60 };
6162 vfolder = mkOption {
63+ example = literalExample "/etc/fuppes/vfolder.cfg";
064 description = ''
65 XML file describing the layout of virtual folder visible by the
66 client.
···107 };
108109 services.fuppesd.name = mkDefault config.networking.hostName;
110+111+ services.fuppesd.vfolder = mkDefault ./fuppes/vfolder.cfg;
112113 security.sudo.enable = true;
114 };
+51-38
nixos/modules/services/databases/firebird.nix
···1{ config, pkgs, ... }:
23-# TODO: this file needs some additional work - at least you can connect to
4-# firebird ..
5-# Example how to connect:
6-# isql /var/db/firebird/data/your-db.fdb -u sysdba -p <default password>
00000000078# There are at least two ways to run firebird. superserver has been choosen
9# however there are no strong reasons to prefer this or the other one AFAIK
···1819 firebird = cfg.package;
2021- pidFile = "${cfg.pidDir}/firebirdd.pid";
02223in
24···3233 enable = mkOption {
34 default = false;
35- description = "
36- Whether to enable the firebird super server.
37- ";
38 };
3940 package = mkOption {
···45 reasons. See comments at the firebirdSuper derivation
46 */
4748- description = "
49 Which firebird derivation to use.
50- ";
51 };
5253 port = mkOption {
54 default = "3050";
55- description = "Port of Firebird.";
0056 };
5758 user = mkOption {
59 default = "firebird";
60- description = "User account under which firebird runs.";
0061 };
6263- dataDir = mkOption {
64- default = "/var/db/firebird/data"; # ubuntu is using /var/lib/firebird/2.1/data/.. ?
65- description = "Location where firebird databases are stored.";
66- };
67-68- pidDir = mkOption {
69- default = "/run/firebird";
70- description = "Location of the file which stores the PID of the firebird server.";
71 };
7273 };
···7980 config = mkIf config.services.firebird.enable {
8182- users.extraUsers.firebird.description = "Firebird server user";
83-84- environment.systemPackages = [firebird];
8586 systemd.services.firebird =
87- { description = "firebird super server";
8889 wantedBy = [ "multi-user.target" ];
90···92 # is a better way
93 preStart =
94 ''
95- secureDir="${cfg.dataDir}/../system"
96-97 mkdir -m 0700 -p \
98- "${cfg.dataDir}" \
99- "${cfg.pidDir}" \
100- /var/log/firebird \
101- "$secureDir"
102103- if ! test -e "$secureDir/security2.fdb"; then
104- cp ${firebird}/security2.fdb "$secureDir"
105 fi
106107- chown -R ${cfg.user} "${cfg.pidDir}" "${cfg.dataDir}" "$secureDir" /var/log/firebird
108- chmod -R 700 "${cfg.pidDir}" "${cfg.dataDir}" "$secureDir" /var/log/firebird
109 '';
110111 serviceConfig.PermissionsStartOnly = true; # preStart must be run as root
···119120 # think about this again - and eventually make it an option
121 environment.etc."firebird/firebird.conf".text = ''
122- # RootDirectory = Restrict ${cfg.dataDir}
123- DatabaseAccess = Restrict ${cfg.dataDir}
124- ExternalFileAccess = Restrict ${cfg.dataDir}
125 # what is this? is None allowed?
126 UdfAccess = None
127 # "Native" = traditional interbase/firebird, "mixed" is windows only
···142 #RemoteAuxPort = 0
143 # rsetrict connections to a network card:
144 #RemoteBindAddress =
145- # there are some more settings ..
146 '';
00000147 };
1480149}
···1{ config, pkgs, ... }:
23+# TODO: This may file may need additional review, eg which configuartions to
4+# expose to the user.
5+#
6+# I only used it to access some simple databases.
7+8+# test:
9+# isql, then type the following commands:
10+# CREATE DATABASE '/var/db/firebird/data/test.fdb' USER 'SYSDBA' PASSWORD 'masterkey';
11+# CONNECT '/var/db/firebird/data/test.fdb' USER 'SYSDBA' PASSWORD 'masterkey';
12+# CREATE TABLE test ( text varchar(100) );
13+# DROP DATABASE;
14+#
15+# Be careful, virtuoso-opensource also provides a different isql command !
1617# There are at least two ways to run firebird. superserver has been choosen
18# however there are no strong reasons to prefer this or the other one AFAIK
···2728 firebird = cfg.package;
2930+ dataDir = "${cfg.baseDir}/data";
31+ systemDir = "${cfg.baseDir}/system";
3233in
34···4243 enable = mkOption {
44 default = false;
45+ description = ''
46+ Whether to enable the Firebird super server.
47+ '';
48 };
4950 package = mkOption {
···55 reasons. See comments at the firebirdSuper derivation
56 */
5758+ description = ''
59 Which firebird derivation to use.
60+ '';
61 };
6263 port = mkOption {
64 default = "3050";
65+ description = ''
66+ Port Firebird uses.
67+ '';
68 };
6970 user = mkOption {
71 default = "firebird";
72+ description = ''
73+ User account under which firebird runs.
74+ '';
75 };
7677+ baseDir = mkOption {
78+ default = "/var/db/firebird"; # ubuntu is using /var/lib/firebird/2.1/data/.. ?
79+ description = ''
80+ Location containing data/ and system/ directories.
81+ data/ stores the databases, system/ stores the password database security2.fdb.
82+ '';
0083 };
8485 };
···9192 config = mkIf config.services.firebird.enable {
9394+ environment.systemPackages = [cfg.package];
009596 systemd.services.firebird =
97+ { description = "Firebird Super-Server";
9899 wantedBy = [ "multi-user.target" ];
100···102 # is a better way
103 preStart =
104 ''
00105 mkdir -m 0700 -p \
106+ "${dataDir}" \
107+ "${systemDir}" \
108+ /var/log/firebird
0109110+ if ! test -e "${systemDir}/security2.fdb"; then
111+ cp ${firebird}/security2.fdb "${systemDir}"
112 fi
113114+ chown -R ${cfg.user} "${dataDir}" "${systemDir}" /var/log/firebird
115+ chmod -R 700 "${dataDir}" "${systemDir}" /var/log/firebird
116 '';
117118 serviceConfig.PermissionsStartOnly = true; # preStart must be run as root
···126127 # think about this again - and eventually make it an option
128 environment.etc."firebird/firebird.conf".text = ''
129+ # RootDirectory = Restrict ${dataDir}
130+ DatabaseAccess = Restrict ${dataDir}
131+ ExternalFileAccess = Restrict ${dataDir}
132 # what is this? is None allowed?
133 UdfAccess = None
134 # "Native" = traditional interbase/firebird, "mixed" is windows only
···149 #RemoteAuxPort = 0
150 # rsetrict connections to a network card:
151 #RemoteBindAddress =
152+ # there are some additional settings which should be reviewed
153 '';
154+155+ users.extraUsers.firebird = {
156+ description = "Firebird server user";
157+ group = "firebird";
158+ uid = config.ids.uids.firebird;
159 };
160161+ };
162}
+2-2
nixos/modules/services/databases/mysql.nix
···93 default = [];
94 description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL";
95 example = [
96- { name = "foodatabase"; schema = ./foodatabase.sql; }
97- { name = "bardatabase"; schema = ./bardatabase.sql; }
98 ];
99 };
100
···93 default = [];
94 description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL";
95 example = [
96+ { name = "foodatabase"; schema = literalExample "./foodatabase.sql"; }
97+ { name = "bardatabase"; schema = literalExample "./bardatabase.sql"; }
98 ];
99 };
100
+2-2
nixos/modules/services/databases/mysql55.nix
···86 default = [];
87 description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL";
88 example = [
89- { name = "foodatabase"; schema = ./foodatabase.sql; }
90- { name = "bardatabase"; schema = ./bardatabase.sql; }
91 ];
92 };
93
···86 default = [];
87 description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL";
88 example = [
89+ { name = "foodatabase"; schema = literalExample "./foodatabase.sql"; }
90+ { name = "bardatabase"; schema = literalExample "./bardatabase.sql"; }
91 ];
92 };
93
···1+{ config, pkgs, ... }:
2+3+# TODO: support munin-async
4+# TODO: LWP/Pg perl libs aren't recognized
5+6+# TODO: support fastcgi
7+# http://munin-monitoring.org/wiki/CgiHowto2
8+# spawn-fcgi -s /var/run/munin/fastcgi-graph.sock -U www-data -u munin -g munin /usr/lib/munin/cgi/munin-cgi-graph
9+# spawn-fcgi -s /var/run/munin/fastcgi-html.sock -U www-data -u munin -g munin /usr/lib/munin/cgi/munin-cgi-html
10+# https://paste.sh/vofcctHP#-KbDSXVeWoifYncZmLfZzgum
11+# nginx http://munin.readthedocs.org/en/latest/example/webserver/nginx.html
12+13+14+with pkgs.lib;
15+16+let
17+ nodeCfg = config.services.munin-node;
18+ cronCfg = config.services.munin-cron;
19+20+ muninPlugins = pkgs.stdenv.mkDerivation {
21+ name = "munin-available-plugins";
22+ buildCommand = ''
23+ mkdir -p $out
24+25+ cp --preserve=mode ${pkgs.munin}/lib/plugins/* $out/
26+27+ for file in $out/*; do
28+ case "$file" in
29+ plugin.sh) continue;;
30+ esac
31+32+ # read magic makers from the file
33+ family=$(sed -nr 's/.*#%#\s+family\s*=\s*(\S+)\s*/\1/p' $file)
34+ cap=$(sed -nr 's/.*#%#\s+capabilities\s*=\s*(.+)/\1/p' $file)
35+36+ wrapProgram $file \
37+ --set PATH "/run/current-system/sw/bin:/run/current-system/sw/sbin" \
38+ --set MUNIN_LIBDIR "${pkgs.munin}/lib" \
39+ --set MUNIN_PLUGSTATE "/var/run/munin"
40+41+ # munin uses markers to tell munin-node-configure what a plugin can do
42+ echo "#%# family=$family" >> $file
43+ echo "#%# capabilities=$cap" >> $file
44+ done
45+46+ # NOTE: we disable disktstats because plugin seems to fail and it hangs html generation (100% CPU + memory leak)
47+ rm -f $out/diskstats
48+ '';
49+ buildInputs = [ pkgs.makeWrapper ];
50+ };
51+52+ muninConf = pkgs.writeText "munin.conf"
53+ ''
54+ dbdir /var/lib/munin
55+ htmldir /var/www/munin
56+ logdir /var/log/munin
57+ rundir /var/run/munin
58+59+ ${cronCfg.extraGlobalConfig}
60+61+ ${cronCfg.hosts}
62+ '';
63+64+ nodeConf = pkgs.writeText "munin-node.conf"
65+ ''
66+ log_level 3
67+ log_file Sys::Syslog
68+ port 4949
69+ host *
70+ background 0
71+ user root
72+ group root
73+ host_name ${config.networking.hostName}
74+ setsid 0
75+76+ # wrapped plugins by makeWrapper being with dots
77+ ignore_file ^\.
78+79+ allow ^127\.0\.0\.1$
80+81+ ${nodeCfg.extraConfig}
82+ '';
83+in
84+85+{
86+87+ options = {
88+89+ services.munin-node = {
90+91+ enable = mkOption {
92+ default = false;
93+ description = ''
94+ Enable Munin Node agent. Munin node listens on 0.0.0.0 and
95+ by default accepts connections only from 127.0.0.1 for security reasons.
96+97+ See <link xlink:href='http://munin-monitoring.org/wiki/munin-node.conf' />.
98+ '';
99+ };
100+101+ extraConfig = mkOption {
102+ default = "";
103+ description = ''
104+ <filename>munin-node.conf</filename> extra configuration. See
105+ <link xlink:href='http://munin-monitoring.org/wiki/munin-node.conf' />
106+ '';
107+ };
108+109+ # TODO: add option to add additional plugins
110+111+ };
112+113+ services.munin-cron = {
114+115+ enable = mkOption {
116+ default = false;
117+ description = ''
118+ Enable munin-cron. Takes care of all heavy lifting to collect data from
119+ nodes and draws graphs to html. Runs munin-update, munin-limits,
120+ munin-graphs and munin-html in that order.
121+122+ HTML output is in <filename>/var/www/munin/</filename>, configure your
123+ favourite webserver to serve static files.
124+ '';
125+ example = literalExample ''
126+ services = {
127+ munin-node.enable = true;
128+ munin-cron = {
129+ enable = true;
130+ hosts = '''
131+ [''${config.networking.hostName}]
132+ address localhost
133+ ''';
134+ extraGlobalConfig = '''
135+ contact.email.command mail -s "Munin notification for ''${var:host}" someone@example.com
136+ ''';
137+ };
138+ };
139+ '';
140+ };
141+142+ extraGlobalConfig = mkOption {
143+ default = "";
144+ description = ''
145+ <filename>munin.conf</filename> extra global configuration.
146+ See <link xlink:href='http://munin-monitoring.org/wiki/munin.conf' />.
147+ Useful to setup notifications, see
148+ <link xlink:href='http://munin-monitoring.org/wiki/HowToContact' />
149+ '';
150+ };
151+152+ hosts = mkOption {
153+ example = ''
154+ [''${config.networking.hostName}]
155+ address localhost
156+ '';
157+ description = ''
158+ Definitions of hosts of nodes to collect data from. Needs at least one
159+ hosts for cron to succeed. See
160+ <link xlink:href='http://munin-monitoring.org/wiki/munin.conf' />
161+ '';
162+ };
163+164+ };
165+166+ };
167+168+ config = mkMerge [ (mkIf (nodeCfg.enable || cronCfg.enable) {
169+170+ environment.systemPackages = [ pkgs.munin ];
171+172+ users.extraUsers = [{
173+ name = "munin";
174+ description = "Munin monitoring user";
175+ group = "munin";
176+ }];
177+178+ users.extraGroups = [{
179+ name = "munin";
180+ }];
181+182+ }) (mkIf nodeCfg.enable {
183+184+ systemd.services.munin-node = {
185+ description = "Munin node, the agent process";
186+ after = [ "network.target" ];
187+ wantedBy = [ "multi-user.target" ];
188+ path = [ pkgs.munin ];
189+ environment.MUNIN_PLUGSTATE = "/var/run/munin";
190+ serviceConfig = {
191+ ExecStart = "${pkgs.munin}/sbin/munin-node --config ${nodeConf} --servicedir /etc/munin/plugins/";
192+ };
193+ };
194+195+ system.activationScripts.munin-node = ''
196+ echo "updating munin plugins..."
197+198+ mkdir -p /etc/munin/plugins
199+ rm -rf /etc/munin/plugins/*
200+ PATH="/run/current-system/sw/bin:/run/current-system/sw/sbin" ${pkgs.munin}/sbin/munin-node-configure --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${muninPlugins} --servicedir=/etc/munin/plugins 2>/dev/null | ${pkgs.bash}/bin/bash
201+ '';
202+203+ }) (mkIf cronCfg.enable {
204+205+ services.cron.systemCronJobs = [
206+ "*/5 * * * * munin ${pkgs.munin}/bin/munin-cron --config ${muninConf}"
207+ ];
208+209+ system.activationScripts.munin-cron = stringAfter [ "users" "groups" ] ''
210+ mkdir -p /var/{run,log,www,lib}/munin
211+ chown -R munin:munin /var/{run,log,www,lib}/munin
212+ '';
213+214+ })];
215+}
+1-1
nixos/modules/services/networking/ejabberd.nix
···44 loadDumps = mkOption {
45 default = [];
46 description = "Configuration dump that should be loaded on the first startup";
47- example = [ ./myejabberd.dump ];
48 };
49 };
50
···44 loadDumps = mkOption {
45 default = [];
46 description = "Configuration dump that should be loaded on the first startup";
47+ example = literalExample "[ ./myejabberd.dump ]";
48 };
49 };
50
···1+{ config, pkgs, ... }:
2+with pkgs.lib;
3+let
4+ cfg = config.services.redshift;
5+6+in {
7+ options = {
8+ services.redshift.enable = mkOption {
9+ type = types.bool;
10+ default = false;
11+ example = true;
12+ description = "Enable Redshift to change your screen's colour temperature depending on the time of day";
13+ };
14+15+ services.redshift.latitude = mkOption {
16+ description = "Your current latitude";
17+ type = types.string;
18+ };
19+20+ services.redshift.longitude = mkOption {
21+ description = "Your current longitude";
22+ type = types.string;
23+ };
24+25+ services.redshift.temperature = {
26+ day = mkOption {
27+ description = "Colour temperature to use during day time";
28+ default = 5500;
29+ type = types.int;
30+ };
31+ night = mkOption {
32+ description = "Colour temperature to use during night time";
33+ default = 3700;
34+ type = types.int;
35+ };
36+ };
37+ };
38+39+ config = mkIf cfg.enable {
40+ systemd.services.redshift = {
41+ description = "Redshift colour temperature adjuster";
42+ requires = [ "display-manager.service" ];
43+ script = ''
44+ ${pkgs.redshift}/bin/redshift \
45+ -l ${cfg.latitude}:${cfg.longitude} \
46+ -t ${toString cfg.temperature.day}:${toString cfg.temperature.night}
47+ '';
48+ environment = { DISPLAY = ":0"; };
49+ };
50+ };
51+}
+5-2
nixos/modules/services/x11/xserver.nix
···232 s3tcSupport = mkOption {
233 default = false;
234 description = ''
235- Make S2TC via libtxc_dxtn available to OpenGL drivers. Using
236- this library may require a patent license depending on your location.
000237 '';
238 };
239
···232 s3tcSupport = mkOption {
233 default = false;
234 description = ''
235+ Make S3TC(S3 Texture Compression) via libtxc_dxtn available
236+ to OpenGL drivers. It is essential for many games to work
237+ with FOSS GPU drivers.
238+239+ Using this library may require a patent license depending on your location.
240 '';
241 };
242
···44 };
4546 description = ''
47- Activate the new configuration (i.e., update /etc, make accounts,
48- and so on).
000049 '';
5051 merge = mergeTypedOption "script" builtins.isAttrs (fold mergeAttrs {});
···44 };
4546 description = ''
47+ A set of shell script fragments that are executed when a NixOS
48+ system configuration is activated. Examples are updating
49+ /etc, creating accounts, and so on. Since these are executed
50+ every time you boot the system or run
51+ <command>nixos-rebuild</command>, it's important that they are
52+ idempotent and fast.
53 '';
5455 merge = mergeTypedOption "script" builtins.isAttrs (fold mergeAttrs {});
+4-1
nixos/modules/system/activation/top-level.nix
···122 options = {
123124 system.build = mkOption {
0125 default = {};
126 description = ''
127 Attribute set of derivations used to setup the system.
···144 };
145146 system.boot.loader.id = mkOption {
0147 default = "";
148 description = ''
149 Id string of the used bootloader.
···151 };
152153 system.boot.loader.kernelFile = mkOption {
0154 default = pkgs.stdenv.platform.kernelTarget;
155 type = types.uniq types.string;
156 description = ''
···169 };
170171 system.extraSystemBuilderCmds = mkOption {
172- default = "";
173 internal = true;
0174 merge = concatStringsSep "\n";
175 description = ''
176 This code will be added to the builder creating the system store path.
···122 options = {
123124 system.build = mkOption {
125+ internal = true;
126 default = {};
127 description = ''
128 Attribute set of derivations used to setup the system.
···145 };
146147 system.boot.loader.id = mkOption {
148+ internal = true;
149 default = "";
150 description = ''
151 Id string of the used bootloader.
···153 };
154155 system.boot.loader.kernelFile = mkOption {
156+ internal = true;
157 default = pkgs.stdenv.platform.kernelTarget;
158 type = types.uniq types.string;
159 description = ''
···172 };
173174 system.extraSystemBuilderCmds = mkOption {
0175 internal = true;
176+ default = "";
177 merge = concatStringsSep "\n";
178 description = ''
179 This code will be added to the builder creating the system store path.
+32-33
nixos/modules/system/boot/loader/grub/grub.nix
···86 '';
87 };
8889- # !!! How can we mark options as obsolete?
90- bootDevice = mkOption {
91- default = "";
92- description = "Obsolete.";
93- };
94-95 configurationName = mkOption {
96 default = "";
97 example = "Stable 2.6.21";
···173 };
174175 splashImage = mkOption {
176- default =
177- if cfg.version == 1
178- then pkgs.fetchurl {
179- url = http://www.gnome-look.org/CONTENT/content-files/36909-soft-tux.xpm.gz;
180- sha256 = "14kqdx2lfqvh40h6fjjzqgff1mwk74dmbjvmqphi6azzra7z8d59";
181- }
182- # GRUB 1.97 doesn't support gzipped XPMs.
183- else ./winkler-gnu-blue-640x480.png;
184- example = null;
185 description = ''
186 Background image used for GRUB. It must be a 640x480,
187 14-colour image in XPM format, optionally compressed with
···233234 ###### implementation
235236- config = mkIf cfg.enable {
00000000000237238- boot.loader.grub.devices = optional (cfg.device != "") cfg.device;
0000000239240- system.build.installBootLoader =
241- if cfg.devices == [] then
242- throw "You must set the ‘boot.loader.grub.device’ option to make the system bootable."
243- else
244- "PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " +
245- "${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
246247- system.build.grub = grub;
00248249- # Common attribute for boot loaders so only one of them can be
250- # set at once.
251- system.boot.loader.id = "grub";
252253- environment.systemPackages = [ grub ];
000254255- boot.loader.grub.extraPrepareConfig =
256- concatStrings (mapAttrsToList (n: v: ''
257- ${pkgs.coreutils}/bin/cp -pf "${v}" "/boot/${n}"
258- '') config.boot.loader.grub.extraFiles);
259260- };
261262}
···86 '';
87 };
8800000089 configurationName = mkOption {
90 default = "";
91 example = "Stable 2.6.21";
···167 };
168169 splashImage = mkOption {
170+ example = literalExample "./my-background.png";
00000000171 description = ''
172 Background image used for GRUB. It must be a 640x480,
173 14-colour image in XPM format, optionally compressed with
···219220 ###### implementation
221222+ config = mkMerge [
223+224+ { boot.loader.grub.splashImage = mkDefault (
225+ if cfg.version == 1 then pkgs.fetchurl {
226+ url = http://www.gnome-look.org/CONTENT/content-files/36909-soft-tux.xpm.gz;
227+ sha256 = "14kqdx2lfqvh40h6fjjzqgff1mwk74dmbjvmqphi6azzra7z8d59";
228+ }
229+ # GRUB 1.97 doesn't support gzipped XPMs.
230+ else ./winkler-gnu-blue-640x480.png);
231+ }
232+233+ (mkIf cfg.enable {
234235+ boot.loader.grub.devices = optional (cfg.device != "") cfg.device;
236+237+ system.build.installBootLoader =
238+ if cfg.devices == [] then
239+ throw "You must set the ‘boot.loader.grub.device’ option to make the system bootable."
240+ else
241+ "PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " +
242+ "${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
243244+ system.build.grub = grub;
00000245246+ # Common attribute for boot loaders so only one of them can be
247+ # set at once.
248+ system.boot.loader.id = "grub";
249250+ environment.systemPackages = [ grub ];
00251252+ boot.loader.grub.extraPrepareConfig =
253+ concatStrings (mapAttrsToList (n: v: ''
254+ ${pkgs.coreutils}/bin/cp -pf "${v}" "/boot/${n}"
255+ '') config.boot.loader.grub.extraFiles);
256257+ })
000258259+ ];
260261}
···77 });
787980-in rec {
08182 # This package has been split because most applications only need dbus.lib
83 # which serves as an interface to a *system-wide* daemon,
···114 docs = dbus_drv "docs" "doc" {
115 postInstall = ''rm -r "$out/lib"'';
116 };
117-}
0
···77 });
787980+ attrs = rec {
81+ # If you change much fix indentation
8283 # This package has been split because most applications only need dbus.lib
84 # which serves as an interface to a *system-wide* daemon,
···115 docs = dbus_drv "docs" "doc" {
116 postInstall = ''rm -r "$out/lib"'';
117 };
118+};
119+in attrs.libs // attrs
···54 };
55 } merge ]); # poppler_drv
5657-in rec {
58 /* We always use cairo in poppler, so we always depend on glib,
59 so we always build the glib wrapper (~350kB).
60 We also always build the cpp wrapper (<100kB).
···69 NIX_LDFLAGS = "-lpoppler";
70 postConfigure = "cd qt4";
71 };
72-}
0
···54 };
55 } merge ]); # poppler_drv
56057 /* We always use cairo in poppler, so we always depend on glib,
58 so we always build the glib wrapper (~350kB).
59 We also always build the cpp wrapper (<100kB).
···68 NIX_LDFLAGS = "-lpoppler";
69 postConfigure = "cd qt4";
70 };
71+72+in { inherit poppler_glib poppler_qt4; } // poppler_glib
···1+{ stdenv, config, requireFile
2+, curl3, SDL, SDL_image, libpng12, libjpeg62, libvorbis, libogg, openal, mesa
3+, libX11, libXext, libXft, fontconfig, zlib }:
4+5+assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
6+7+stdenv.mkDerivation rec {
8+ name = "gsb-1.56.0";
9+10+ goBuyItNow = ''
11+ We cannot download the full version automatically, as you require a license.
12+ Once you bought a license, you need to add your downloaded version to the nix store.
13+ You can do this by using "nix-prefetch-url file://gsb1324679796.tar.gz" in the
14+ directory where you saved it.
15+ '';
16+17+ src = requireFile {
18+ message = goBuyItNow;
19+ name = "gsb1324679796.tar.gz";
20+ sha256 = "12jsz9v55w9zxwiz4kbm6phkv60q3c2kyv5imsls13385pzwcs8i";
21+ };
22+23+ arch = if stdenv.system == "i686-linux" then "x86" else "x86_64";
24+25+ phases = "unpackPhase installPhase";
26+27+ # XXX: stdenv.lib.makeLibraryPath doesn't pick up /lib64
28+ libPath = stdenv.lib.makeLibraryPath [ stdenv.gcc.gcc stdenv.gcc.libc ]
29+ + ":" + stdenv.lib.makeLibraryPath [ SDL SDL_image libjpeg62 libpng12 mesa ]
30+ + ":" + stdenv.lib.makeLibraryPath [ curl3 openal libvorbis libogg ]
31+ + ":" + stdenv.lib.makeLibraryPath [ libX11 libXext libXft fontconfig zlib ]
32+ + ":" + stdenv.gcc.gcc + "/lib64";
33+34+ installPhase = ''
35+ ensureDir $out/libexec/positech/GSB/
36+ ensureDir $out/bin
37+38+ patchelf \
39+ --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
40+ --set-rpath $libPath \
41+ ./GSB.bin.$arch
42+43+ cp -r * $out/libexec/positech/GSB/
44+ rm -rf $out/libexec/positech/GSB/lib64/
45+ rm -rf $out/libexec/positech/GSB/lib/
46+47+ #makeWrapper doesn't do cd. :(
48+49+ cat > $out/bin/GSB << EOF
50+ #!/bin/sh
51+ cd $out/libexec/positech/GSB
52+ exec ./GSB.bin.$arch
53+ EOF
54+ chmod +x $out/bin/GSB
55+ '';
56+57+ meta = {
58+ description = "Gratuitous Space Battles";
59+ longDescription = ''
60+ a strategy / management / simulation game that does away with all the
61+ base building and delays and gets straight to the meat and potatoes of
62+ science-fiction games : The big space battles fought by huge spaceships with
63+ tons of laser beams and things going 'zap!', 'ka-boom!' and 'ka-pow!'. In GSB
64+ you put your ships together from modular components, arrange them into fleets,
65+ give your ships orders of engagement and then hope they emerge victorious from
66+ battle (or at least blow to bits in aesthetically pleasing ways).
67+ '';
68+ homepage = http://www.positech.co.uk/gratuitousspacebattles/index.html;
69+ license = [ "unfree" ];
70+ maintainers = with stdenv.lib.maintainers; [ jcumming ];
71+ platforms = [ "x86_64-linux" "i686-linux" ] ;
72+ };
73+74+}
···1+# https://rt.cpan.org/Public/Bug/Display.html?id=75112
2+diff --git a/master/lib/Munin/Master/HTMLOld.pm b/master/lib/Munin/Master/HTMLOld.pm
3+index 2b6e71f..c0aa2c0 100644
4+--- a/master/lib/Munin/Master/HTMLOld.pm
5++++ b/master/lib/Munin/Master/HTMLOld.pm
6+@@ -711,10 +711,12 @@ sub emit_main_index {
7+8+ sub copy_web_resources {
9+ my ($staticdir, $htmldir) = @_;
10++ local $File::Copy::Recursive::KeepMode = 0;
11+ unless(dircopy($staticdir, "$htmldir/static")){
12+ ERROR "[ERROR] Could not copy contents from $staticdir to $htmldir";
13+ die "[ERROR] Could not copy contents from $staticdir to $htmldir";
14+ }
15++ local $File::Copy::Recursive::KeepMode = 1;
16+ }
17+18+ sub instanciate_comparison_templates {
···49 # Add a utility function to produce derivations that use this
50 # stdenv and its shell.
51 mkDerivation = attrs:
52- if !allowUnfree && (let l = attrs.meta.license or ""; in l == "unfree" || l == "unfree-redistributable") then
53 throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate"
54 else
55 lib.addPassthru (derivation (
···49 # Add a utility function to produce derivations that use this
50 # stdenv and its shell.
51 mkDerivation = attrs:
52+ if !allowUnfree && (let l = lib.lists.toList attrs.meta.license or []; in lib.lists.elem "unfree" l || lib.lists.elem "unfree-redistributable" l) then
53 throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate"
54 else
55 lib.addPassthru (derivation (