···2222in
2323 { inherit trivial lists strings stringsWithDeps attrsets sources options
2424 properties modules types meta debug maintainers licenses platforms systems;
2525+ # Pull in some builtins not included elsewhere.
2626+ inherit (builtins) pathExists readFile;
2527 }
2628 # !!! don't include everything at top-level; perhaps only the most
2729 # commonly used functions.
···11# General list operations.
22let
33+34 inherit (import ./trivial.nix) deepSeq;
4556 inc = builtins.add 1;
6778 dec = n: builtins.sub n 1;
8999- inherit (builtins) elemAt;
1010in rec {
1111- inherit (builtins) head tail length isList add sub lessThan;
1111+ inherit (builtins) head tail length isList add sub lessThan elemAt;
121213131414 # Create a list consisting of a single element. `singleton x' is
+1-3
lib/misc.nix
···206206 in
207207 work startSet [] [];
208208209209- genericClosure =
210210- if builtins ? genericClosure then builtins.genericClosure
211211- else lazyGenericClosure;
209209+ genericClosure = builtins.genericClosure or lazyGenericClosure;
212210213211 innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else
214212 innerModifySumArgs f x (a // b);
+1-2
lib/modules.nix
···185185 ) funs;
186186187187188188- moduleMerge = path: modules:
189189- let modules_ = modules; in
188188+ moduleMerge = path: modules_:
190189 let
191190 addName = name:
192191 if path == "" then name else path + "." + name;
+5-6
lib/options.nix
···11111212rec {
13131414- inherit (lib) isType;
1515-1616-1717- isOption = isType "option";
1414+ isOption = lib.isType "option";
1815 mkOption = attrs: attrs // {
1916 _type = "option";
2017 # name (this is the name of the attributem it is automatically generated by the traversal)
···6663 if all opt.check list then
6764 opt.merge list
6865 else
6969- throw "One of option ${name} values has a bad type.";
6666+ throw "A value of the option `${name}' has a bad type.";
7067 }
7168 else opt;
7269···7774 if opt.check opt.default then
7875 opt.default
7976 else
8080- throw "The default value of option ${name} has a bad type.";
7777+ throw "The default value of the option `${name}' has a bad type.";
8178 }
8279 else opt;
8380···275272 description = opt.description or (throw "Option ${opt.name}: No description.");
276273 declarations = map (x: toString x.source) opt.declarations;
277274 #definitions = map (x: toString x.source) opt.definitions;
275275+ internal = opt.internal or false;
276276+ visible = opt.visible or true;
278277 }
279278 // optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; }
280279 // optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; }
···13131414<!--===============================================================-->
15151616+<section xml:id="sec-configuration-syntax"><title>Configuration syntax</title>
1717+1818+<para>TODO</para>
1919+2020+</section>
2121+2222+2323+<!--===============================================================-->
2424+1625<section><title>Package management</title>
17261827<para>This section describes how to add additional packages to your
+29-11
nixos/doc/manual/default.nix
···11{ pkgs, options
22-# revision can have multiple values: local, HEAD or any revision number.
33-, revision ? "HEAD"
22+, revision ? "master"
43}:
5465with pkgs.lib;
7687let
981010- # To prevent infinite recursion, remove system.path from the
1111- # options. Not sure why this happens.
1212- options_ =
1313- options //
1414- { system = removeAttrs options.system ["path"]; };
99+ # Remove invisible and internal options.
1010+ options' = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options);
15111616- optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext
1717- (builtins.toXML (optionAttrSetToDocList options_)));
1212+ # Clean up declaration sites to not refer to the NixOS source tree.
1313+ options'' = flip map options' (opt: opt // {
1414+ declarations = map (fn: stripPrefix fn) opt.declarations;
1515+ });
1616+1717+ prefix = toString pkgs.path;
1818+1919+ stripPrefix = fn:
2020+ if substring 0 (stringLength prefix) fn == prefix then
2121+ substring (add (stringLength prefix) 1) 1000 fn
2222+ else
2323+ fn;
2424+2525+ optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML options''));
18261927 optionsDocBook = pkgs.runCommand "options-db.xml" {} ''
2828+ if grep /nixpkgs/nixos/modules ${optionsXML}; then
2929+ echo "The manual appears to depend on the location of Nixpkgs, which is bad"
3030+ echo "since this prevents sharing via the NixOS channel. This is typically"
3131+ echo "caused by an option default that refers to a relative path (see above"
3232+ echo "for hints about the offending path)."
3333+ exit 1
3434+ fi
2035 ${pkgs.libxslt}/bin/xsltproc \
2136 --stringparam revision '${revision}' \
2237 -o $out ${./options-to-docbook.xsl} ${optionsXML}
···64796580 cp ${./style.css} $dst/style.css
66816767- ensureDir $out/nix-support
8282+ mkdir -p $out/nix-support
8383+ echo "nix-build out $out" >> $out/nix-support/hydra-build-products
6884 echo "doc manual $dst manual.html" >> $out/nix-support/hydra-build-products
6985 ''; # */
8686+8787+ meta.description = "The NixOS manual in HTML format";
7088 };
71897290 # Generate the NixOS manpages.
···87105 ./man-pages.xml
8810689107 # Generate manpages.
9090- ensureDir $out/share/man
108108+ mkdir -p $out/share/man
91109 xsltproc --nonet --xinclude \
92110 --param man.output.in.separate.dir 1 \
93111 --param man.output.base.dir "'$out/share/man/'" \
+58-28
nixos/doc/manual/installation.xml
···4444 <listitem><para>The NixOS manual is available on virtual console 8
4545 (press Alt+F8 to access).</para></listitem>
46464747- <listitem><para>Login as <literal>root</literal>, empty
4747+ <listitem><para>Login as <literal>root</literal> and the empty
4848 password.</para></listitem>
49495050 <listitem><para>If you downloaded the graphical ISO image, you can
···8989 </para></listitem>
90909191 <listitem><para>Mount the target file system on which NixOS should
9292- be installed on <filename>/mnt</filename>.</para></listitem>
9292+ be installed on <filename>/mnt</filename>, e.g.
9393+9494+<screen>
9595+$ mount /dev/disk/by-label/nixos /mnt
9696+</screen>
9797+9898+ </para></listitem>
939994100 <listitem>
95101···97103 <filename>/mnt/etc/nixos/configuration.nix</filename> that
98104 specifies the intended configuration of the system. This is
99105 because NixOS has a <emphasis>declarative</emphasis> configuration
100100- model: you create or edit a description of the configuration that
101101- you want to be built and activated, and then NixOS takes care of
102102- realising that configuration. The command
103103- <command>nixos-option</command> can generate an initial
104104- configuration file for you:
106106+ model: you create or edit a description of the desired
107107+ configuration of your system, and then NixOS takes care of making
108108+ it happen. The syntax of the NixOS configuration file is
109109+ described in <xref linkend="sec-configuration-syntax"/>, while a
110110+ list of available configuration options appears in <xref
111111+ linkend="ch-options"/>. A minimal example is shown in <xref
112112+ linkend="ex-config"/>.</para>
113113+114114+ <para>The command <command>nixos-generate-config</command> can
115115+ generate an initial configuration file for you:
105116106117<screen>
107107-$ nixos-option --install</screen>
108108-109109- It tries to figure out the kernel modules necessary for mounting
110110- the root device, as well as various other hardware
111111- characteristics. However, it doesn’t try to figure out the
112112- <option>fileSystems</option> option yet.</para>
118118+$ nixos-generate-config --root /mnt</screen>
113119114114- <para>You should edit
120120+ You should then edit
115121 <filename>/mnt/etc/nixos/configuration.nix</filename> to suit your
116116- needs. The text editors <command>nano</command> and
117117- <command>vim</command> are available.</para>
122122+ needs:
118123119119- <para>You need to specify a root file system in
120120- <option>fileSystems</option> and the target device for the Grub boot
121121- loader in <option>boot.loader.grub.device</option>. See
122122- <xref linkend="ch-options"/> for a list of the available configuration
123123- options.</para>
124124+<screen>
125125+$ nano /mnt/etc/nixos/configuration.nix
126126+</screen>
124127125125- <note><para>It is very important that you specify in the option
126126- <option>boot.initrd.kernelModules</option> all kernel modules that
127127- are necessary for mounting the root file system, otherwise the
128128- installed system will not be able to boot. (If this happens, boot
129129- from the CD again, mount the target file system on
128128+ The <command>vim</command> text editor is also available.</para>
129129+130130+ <para>You <emphasis>must</emphasis> set the option
131131+ <option>boot.loader.grub.device</option> to specify on which disk
132132+ the GRUB boot loader is to be installed. Without it, NixOS cannot
133133+ boot.</para>
134134+135135+ <para>Another critical option is <option>fileSystems</option>,
136136+ specifying the file systems that need to be mounted by NixOS.
137137+ However, you typically don’t need to set it yourself, because
138138+ <command>nixos-generate-config</command> sets it automatically in
139139+ <filename>/mnt/etc/nixos/hardware-configuration.nix</filename>
140140+ from your currently mounted file systems. (The configuration file
141141+ <filename>hardware-configuration.nix</filename> is included from
142142+ <filename>configuration.nix</filename> and will be overwritten by
143143+ future invocations of <command>nixos-generate-config</command>;
144144+ thus, you generally should not modify it.)</para>
145145+146146+ <note><para>Depending on your hardware configuration or type of
147147+ file system, you may need to set the option
148148+ <option>boot.initrd.kernelModules</option> to include the kernel
149149+ modules that are necessary for mounting the root file system,
150150+ otherwise the installed system will not be able to boot. (If this
151151+ happens, boot from the CD again, mount the target file system on
130152 <filename>/mnt</filename>, fix
131153 <filename>/mnt/etc/nixos/configuration.nix</filename> and rerun
132154 <filename>nixos-install</filename>.) In most cases,
133133- <command>nixos-option --install</command> will figure out the
155155+ <command>nixos-generate-config</command> will figure out the
134156 required modules.</para></note>
135157136158 <para>Examples of real-world NixOS configuration files can be
···218240$ mkfs.ext4 -L nixos /dev/sda1 <lineannotation>(idem)</lineannotation>
219241$ mkswap -L swap /dev/sda2 <lineannotation>(idem)</lineannotation>
220242$ mount LABEL=nixos /mnt
221221-$ nixos-option --install
243243+$ nixos-generate-config
222244$ nano /mnt/etc/nixos/configuration.nix
223245<lineannotation>(in particular, set the fileSystems and swapDevices options)</lineannotation>
224246$ nixos-install
···228250<example xml:id='ex-config'><title>NixOS configuration</title>
229251<screen>
230252{
253253+ imports =
254254+ [ # Include the results of the hardware scan.
255255+ ./hardware-configuration.nix
256256+ ];
257257+231258 boot.loader.grub.device = "/dev/sda";
232259260260+ # Note: setting fileSystems and swapDevices is generally not
261261+ # necessary, since nixos-generate-config has set them automatically
262262+ # in hardware-configuration.nix.
233263 fileSystems."/".device = "/dev/disk/by-label/nixos";
234264235265 swapDevices =
+17
nixos/doc/manual/man-nixos-generate-config.xml
···110110 </listitem>
111111 </varlistentry>
112112113113+ <varlistentry>
114114+ <term><option>--no-filesystems</option></term>
115115+ <listitem>
116116+ <para>Omit everything concerning file system information
117117+ (which includes swap devices) from the hardware configuration.</para>
118118+ </listitem>
119119+ </varlistentry>
120120+121121+ <varlistentry>
122122+ <term><option>--show-hardware-config</option></term>
123123+ <listitem>
124124+ <para>Don't generate <filename>configuration.nix</filename> or
125125+ <filename>hardware-configuration.nix</filename> and print the
126126+ hardware configuration to stdout only.</para>
127127+ </listitem>
128128+ </varlistentry>
129129+113130</variablelist>
114131115132</refsection>
+2-2
nixos/doc/manual/manual.xml
···4242 xlink:href="irc://irc.freenode.net/#nixos">
4343 <literal>#nixos</literal> channel on Freenode</link>. Bugs should
4444 be reported in <link
4545- xlink:href="https://github.com/NixOS/nixos/issues">NixOS’ GitHub
4545+ xlink:href="https://github.com/NixOS/nixpkgs/issues">NixOS’ GitHub
4646 issue tracker</link>.</para>
47474848 </preface>
···5555 <xi:include href="troubleshooting.xml" />
5656 <xi:include href="development.xml" />
5757 <chapter xml:id="ch-options">
5858- <title>List of Options</title>
5858+ <title>List of options</title>
5959 <xi:include href="options-db.xml" />
6060 </chapter>
6161
+16-4
nixos/doc/manual/options-to-docbook.xsl
···125125 </xsl:template>
126126127127128128+ <xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalExample']]]">
129129+ <xsl:value-of select="attr[@name = 'text']/string/@value" />
130130+ </xsl:template>
131131+132132+128133 <xsl:template match="attrs">
129134 {
130135 <xsl:for-each select="attr">
···155160 repository (if it’s a module and we have a revision number),
156161 or to the local filesystem. -->
157162 <xsl:choose>
158158- <xsl:when test="$revision != 'local' and contains(@value, '/modules/')">
159159- <xsl:attribute name="xlink:href">https://github.com/NixOS/nixos/blob/<xsl:value-of select="$revision"/>/modules/<xsl:value-of select="substring-after(@value, '/modules/')"/></xsl:attribute>
163163+ <xsl:when test="not(starts-with(@value, '/'))">
164164+ <xsl:choose>
165165+ <xsl:when test="$revision = 'local'">
166166+ <xsl:attribute name="xlink:href">https://github.com/NixOS/nixpkgs/blob/master/<xsl:value-of select="@value"/></xsl:attribute>
167167+ </xsl:when>
168168+ <xsl:otherwise>
169169+ <xsl:attribute name="xlink:href">https://github.com/NixOS/nixpkgs/blob/<xsl:value-of select="$revision"/>/<xsl:value-of select="@value"/></xsl:attribute>
170170+ </xsl:otherwise>
171171+ </xsl:choose>
160172 </xsl:when>
161173 <xsl:when test="$revision != 'local' and contains(@value, 'nixops') and contains(@value, '/nix/')">
162174 <xsl:attribute name="xlink:href">https://github.com/NixOS/nixops/blob/<xsl:value-of select="$revision"/>/nix/<xsl:value-of select="substring-after(@value, '/nix/')"/></xsl:attribute>
···169181 /nix/store/<hash> prefix by the default location of nixos
170182 sources. -->
171183 <xsl:choose>
172172- <xsl:when test="contains(@value, '/modules/')">
173173- <nixos/modules/<xsl:value-of select="substring-after(@value, '/modules/')"/>>
184184+ <xsl:when test="not(starts-with(@value, '/'))">
185185+ <nixpkgs/<xsl:value-of select="@value"/>>
174186 </xsl:when>
175187 <xsl:when test="contains(@value, 'nixops') and contains(@value, '/nix/')">
176188 <nixops/<xsl:value-of select="substring-after(@value, '/nix/')"/>>
+1-2
nixos/lib/eval-config.nix
···6666 # Optionally check wether all config values have corresponding
6767 # option declarations.
6868 config =
6969- let doCheck = optionDefinitions.environment.checkConfigurationOptions; in
7070- assert doCheck -> pkgs.lib.checkModule "" systemModule;
6969+ assert optionDefinitions.environment.checkConfigurationOptions -> pkgs.lib.checkModule "" systemModule;
7170 systemModule.config;
7271}
+23-26
nixos/modules/config/system-path.nix
···7788let
991010- cfg = config.environment;
1111-1210 extraManpages = pkgs.runCommand "extra-manpages" { buildInputs = [ pkgs.help2man ]; }
1311 ''
1412 mkdir -p $out/share/man/man1
···8785 system = {
88868987 path = mkOption {
9090- default = cfg.systemPackages;
8888+ internal = true;
9189 description = ''
9290 The packages you want in the boot environment.
9391 '';
9494-9595- apply = list: pkgs.buildEnv {
9696- name = "system-path";
9797- paths = list;
9898- inherit (cfg) pathsToLink;
9999- ignoreCollisions = true;
100100- # !!! Hacky, should modularise.
101101- postBuild =
102102- ''
103103- if [ -x $out/bin/update-mime-database -a -w $out/share/mime/packages ]; then
104104- $out/bin/update-mime-database -V $out/share/mime
105105- fi
106106-107107- if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
108108- $out/bin/gtk-update-icon-cache $out/share/icons/hicolor
109109- fi
110110-111111- if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
112112- $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
113113- fi
114114- '';
115115- };
116116-11792 };
1189311994 };
···137112 "/share/terminfo"
138113 "/share/man"
139114 ];
115115+116116+ system.path = pkgs.buildEnv {
117117+ name = "system-path";
118118+ paths = config.environment.systemPackages;
119119+ inherit (config.environment) pathsToLink;
120120+ ignoreCollisions = true;
121121+ # !!! Hacky, should modularise.
122122+ postBuild =
123123+ ''
124124+ if [ -x $out/bin/update-mime-database -a -w $out/share/mime/packages ]; then
125125+ $out/bin/update-mime-database -V $out/share/mime
126126+ fi
127127+128128+ if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
129129+ $out/bin/gtk-update-icon-cache $out/share/icons/hicolor
130130+ fi
131131+132132+ if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
133133+ $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
134134+ fi
135135+ '';
136136+ };
140137141138 };
142139}
···39394040 # Subscribe the root user to the NixOS channel by default.
4141 if [ "$USER" = root -a ! -e $HOME/.nix-channels ]; then
4242- echo "http://nixos.org/channels/nixos-unstable nixos" > $HOME/.nix-channels
4242+ echo "${config.system.defaultChannel} nixos" > $HOME/.nix-channels
4343 fi
44444545 # Create the per-user garbage collector roots directory.
+8-5
nixos/modules/programs/ssh.nix
···11# Global configuration for the SSH client.
2233-{config, pkgs, ...}:
33+{ config, pkgs, ... }:
4455with pkgs.lib;
66···3131 setXAuthLocation = mkOption {
3232 default = true;
3333 description = ''
3434- Whether to set the path to xauth for X11-forwarded connections.
3434+ Whether to set the path to <command>xauth</command> for X11-forwarded connections.
3535 Pulls in X11 dependency.
3636 '';
3737 };
···4646 };
4747 };
48484949- assertions = [{ assertion = if cfg.forwardX11 then cfg.setXAuthLocation else true;
5050- message = "cannot enable X11 forwarding without setting xauth location";}];
4949+ config = {
5050+5151+ assertions = singleton
5252+ { assertion = cfg.forwardX11 -> cfg.setXAuthLocation;
5353+ message = "cannot enable X11 forwarding without setting XAuth location";
5454+ };
51555252- config = {
5356 environment.etc =
5457 [ { # SSH configuration. Slight duplication of the sshd_config
5558 # generation in the sshd service.
+82-66
nixos/modules/rename.nix
···11-{pkgs, options, config, ...}:
11+{ config, pkgs, options, ... }:
22+33+with pkgs.lib;
2435let
4655- alias = from: to: {
77+ alias = from: to: rename {
88+ inherit from to;
69 name = "Alias";
77- msg.use = x: x;
88- msg.define = x: x;
1010+ use = id;
1111+ define = id;
1212+ visible = true;
913 };
10141111- obsolete = from: to: {
1515+ obsolete = from: to: rename {
1616+ inherit from to;
1217 name = "Obsolete name";
1313- msg.use = x:
1414- builtins.trace "Obsolete option `${from}' is used instead of `${to}'." x;
1515- msg.define = x:
1616- builtins.trace "Obsolete option `${from}' is defined instead of `${to}'." x;
1818+ use = x: builtins.trace "Obsolete option `${showOption from}' is used instead of `${showOption to}'." x;
1919+ define = x: builtins.trace "Obsolete option `${showOption from}' is defined instead of `${showOption to}'." x;
1720 };
18211919- deprecated = from: to: {
2222+ deprecated = from: to: rename {
2323+ inherit from to;
2024 name = "Deprecated name";
2121- msg.use = x:
2222- abort "Deprecated option `${from}' is used instead of `${to}'.";
2323- msg.define = x:
2424- abort "Deprecated option `${from}' is defined instead of `${to}'.";
2525+ use = x: abort "Deprecated option `${showOption from}' is used instead of `${showOption to}'.";
2626+ define = x: abort "Deprecated option `${showOption from}' is defined instead of `${showOption to}'.";
2527 };
26282929+ showOption = concatStringsSep ".";
27302828- zipModules = list: with pkgs.lib;
3131+ zipModules = list:
2932 zipAttrsWith (n: v:
3033 if tail v != [] then
3134 if n == "_type" then (head v)
3232- else if n == "extraConfigs" then (concatLists v)
3535+ else if n == "extraConfigs" then concatLists v
3636+ else if n == "warnings" then concatLists v
3337 else if n == "description" || n == "apply" then
3438 abort "Cannot rename an option to multiple options."
3539 else zipModules v
3640 else head v
3741 ) list;
38423939- rename = statusTemplate: from: to: with pkgs.lib;
4343+ rename = { from, to, name, use, define, visible ? false }:
4044 let
4141- status = statusTemplate from to;
4242- setTo = setAttrByPath (splitString "." to);
4343- setFrom = setAttrByPath (splitString "." from);
4444- toOf = attrByPath (splitString "." to)
4545- (abort "Renaming error: option `${to}' does not exists.");
4646- fromOf = attrByPath (splitString "." from)
4747- (abort "Internal error: option `${from}' should be declared.");
4545+ setTo = setAttrByPath to;
4646+ setFrom = setAttrByPath from;
4747+ toOf = attrByPath to
4848+ (abort "Renaming error: option `${showOption to}' does not exists.");
4949+ fromOf = attrByPath from
5050+ (abort "Internal error: option `${showOption from}' should be declared.");
4851 in
4949- [{
5050- options = setFrom (mkOption {
5151- description = "${status.name} of <option>${to}</option>.";
5252- apply = x: status.msg.use (toOf config);
5353- });
5454- }] ++
5555- [{
5656- options = setTo (mkOption {
5757- extraConfigs =
5858- let externalDefs = (fromOf options).definitions; in
5959- if externalDefs == [] then []
6060- else map (def: def.value) (status.msg.define externalDefs);
6161- });
6262- }];
5252+ [ { options = setFrom (mkOption {
5353+ description = "${name} of <option>${showOption to}</option>.";
5454+ apply = x: use (toOf config);
5555+ inherit visible;
5656+ });
5757+ }
5858+ { options = setTo (mkOption {
5959+ extraConfigs =
6060+ let externalDefs = (fromOf options).definitions; in
6161+ if externalDefs == [] then []
6262+ else map (def: def.value) (define externalDefs);
6363+ });
6464+ }
6565+ ];
6666+6767+ obsolete' = option: singleton
6868+ { options = setAttrByPath option (mkOption {
6969+ default = null;
7070+ visible = false;
7171+ });
7272+ config.warnings = optional (getAttrFromPath option config != null)
7373+ "The option `${showOption option}' defined in your configuration no longer has any effect; please remove it.";
7474+ };
63756476in zipModules ([]
65776678# usage example:
6767-# ++ rename alias "services.xserver.slim.theme" "services.xserver.displayManager.slim.theme"
6868-++ rename obsolete "environment.extraPackages" "environment.systemPackages"
6969-++ rename obsolete "environment.enableBashCompletion" "programs.bash.enableCompletion"
7979+# ++ alias [ "services" "xserver" "slim" "theme" ] [ "services" "xserver" "displayManager" "slim" "theme" ]
8080+++ obsolete [ "environment" "extraPackages" ] [ "environment" "systemPackages" ]
8181+++ obsolete [ "environment" "enableBashCompletion" ] [ "programs" "bash" "enableCompletion" ]
70827171-++ rename obsolete "security.extraSetuidPrograms" "security.setuidPrograms"
7272-++ rename obsolete "networking.enableWLAN" "networking.wireless.enable"
7373-++ rename obsolete "networking.enableRT73Firmware" "networking.enableRalinkFirmware"
8383+++ obsolete [ "security" "extraSetuidPrograms" ] [ "security" "setuidPrograms" ]
8484+++ obsolete [ "networking" "enableWLAN" ] [ "networking" "wireless" "enable" ]
8585+++ obsolete [ "networking" "enableRT73Firmware" ] [ "networking" "enableRalinkFirmware" ]
74867587# FIXME: Remove these eventually.
7676-++ rename obsolete "boot.systemd.sockets" "systemd.sockets"
7777-++ rename obsolete "boot.systemd.targets" "systemd.targets"
7878-++ rename obsolete "boot.systemd.services" "systemd.services"
8888+++ obsolete [ "boot" "systemd" "sockets" ] [ "systemd" "sockets" ]
8989+++ obsolete [ "boot" "systemd" "targets" ] [ "systemd" "targets" ]
9090+++ obsolete [ "boot" "systemd" "services" ] [ "systemd" "services" ]
79918092# Old Grub-related options.
8181-++ rename obsolete "boot.copyKernels" "boot.loader.grub.copyKernels"
8282-++ rename obsolete "boot.extraGrubEntries" "boot.loader.grub.extraEntries"
8383-++ rename obsolete "boot.extraGrubEntriesBeforeNixos" "boot.loader.grub.extraEntriesBeforeNixOS"
8484-++ rename obsolete "boot.grubDevice" "boot.loader.grub.device"
8585-++ rename obsolete "boot.bootMount" "boot.loader.grub.bootDevice"
8686-++ rename obsolete "boot.grubSplashImage" "boot.loader.grub.splashImage"
9393+++ obsolete [ "boot" "copyKernels" ] [ "boot" "loader" "grub" "copyKernels" ]
9494+++ obsolete [ "boot" "extraGrubEntries" ] [ "boot" "loader" "grub" "extraEntries" ]
9595+++ obsolete [ "boot" "extraGrubEntriesBeforeNixos" ] [ "boot" "loader" "grub" "extraEntriesBeforeNixOS" ]
9696+++ obsolete [ "boot" "grubDevice" ] [ "boot" "loader" "grub" "device" ]
9797+++ obsolete [ "boot" "bootMount" ] [ "boot" "loader" "grub" "bootDevice" ]
9898+++ obsolete [ "boot" "grubSplashImage" ] [ "boot" "loader" "grub" "splashImage" ]
87998888-++ rename obsolete "boot.initrd.extraKernelModules" "boot.initrd.kernelModules"
100100+++ obsolete [ "boot" "initrd" "extraKernelModules" ] [ "boot" "initrd" "kernelModules" ]
8910190102# OpenSSH
9191-++ rename obsolete "services.sshd.ports" "services.openssh.ports"
9292-++ rename alias "services.sshd.enable" "services.openssh.enable"
9393-++ rename obsolete "services.sshd.allowSFTP" "services.openssh.allowSFTP"
9494-++ rename obsolete "services.sshd.forwardX11" "services.openssh.forwardX11"
9595-++ rename obsolete "services.sshd.gatewayPorts" "services.openssh.gatewayPorts"
9696-++ rename obsolete "services.sshd.permitRootLogin" "services.openssh.permitRootLogin"
9797-++ rename obsolete "services.xserver.startSSHAgent" "services.xserver.startOpenSSHAgent"
103103+++ obsolete [ "services" "sshd" "ports" ] [ "services" "openssh" "ports" ]
104104+++ alias [ "services" "sshd" "enable" ] [ "services" "openssh" "enable" ]
105105+++ obsolete [ "services" "sshd" "allowSFTP" ] [ "services" "openssh" "allowSFTP" ]
106106+++ obsolete [ "services" "sshd" "forwardX11" ] [ "services" "openssh" "forwardX11" ]
107107+++ obsolete [ "services" "sshd" "gatewayPorts" ] [ "services" "openssh" "gatewayPorts" ]
108108+++ obsolete [ "services" "sshd" "permitRootLogin" ] [ "services" "openssh" "permitRootLogin" ]
109109+++ obsolete [ "services" "xserver" "startSSHAgent" ] [ "services" "xserver" "startOpenSSHAgent" ]
9811099111# KDE
100100-++ rename deprecated "kde.extraPackages" "environment.kdePackages"
101101-# ++ rename obsolete "environment.kdePackages" "environment.systemPackages" # !!! doesn't work!
112112+++ deprecated [ "kde" "extraPackages" ] [ "environment" "kdePackages" ]
113113+# ++ obsolete [ "environment" "kdePackages" ] [ "environment" "systemPackages" ] # !!! doesn't work!
102114103115# Multiple efi bootloaders now
104104-++ rename obsolete "boot.loader.efi.efibootmgr.enable" "boot.loader.efi.canTouchEfiVariables"
116116+++ obsolete [ "boot" "loader" "efi" "efibootmgr" "enable" ] [ "boot" "loader" "efi" "canTouchEfiVariables" ]
105117106118# NixOS environment changes
107119# !!! this hardcodes bash, could we detect from config which shell is actually used?
108108-++ rename obsolete "environment.promptInit" "programs.bash.promptInit"
120120+++ obsolete [ "environment" "promptInit" ] [ "programs" "bash" "promptInit" ]
121121+122122+# Options that are obsolete and have no replacement.
123123+++ obsolete' [ "boot" "loader" "grub" "bootDevice" ]
124124+++ obsolete' [ "boot" "initrd" "luks" "enable" ]
109125110110-) # do not add renaming after this.
126126+)
+3-2
nixos/modules/services/audio/fuppes.nix
···6060 };
61616262 vfolder = mkOption {
6363- default = ./fuppes/vfolder.cfg;
6464- example = /etc/fuppes/vfolder.cfg;
6363+ example = literalExample "/etc/fuppes/vfolder.cfg";
6564 description = ''
6665 XML file describing the layout of virtual folder visible by the
6766 client.
···108107 };
109108110109 services.fuppesd.name = mkDefault config.networking.hostName;
110110+111111+ services.fuppesd.vfolder = mkDefault ./fuppes/vfolder.cfg;
111112112113 security.sudo.enable = true;
113114 };
+51-38
nixos/modules/services/databases/firebird.nix
···11{ config, pkgs, ... }:
2233-# TODO: this file needs some additional work - at least you can connect to
44-# firebird ..
55-# Example how to connect:
66-# isql /var/db/firebird/data/your-db.fdb -u sysdba -p <default password>
33+# TODO: This may file may need additional review, eg which configuartions to
44+# expose to the user.
55+#
66+# I only used it to access some simple databases.
77+88+# test:
99+# isql, then type the following commands:
1010+# CREATE DATABASE '/var/db/firebird/data/test.fdb' USER 'SYSDBA' PASSWORD 'masterkey';
1111+# CONNECT '/var/db/firebird/data/test.fdb' USER 'SYSDBA' PASSWORD 'masterkey';
1212+# CREATE TABLE test ( text varchar(100) );
1313+# DROP DATABASE;
1414+#
1515+# Be careful, virtuoso-opensource also provides a different isql command !
716817# There are at least two ways to run firebird. superserver has been choosen
918# however there are no strong reasons to prefer this or the other one AFAIK
···18271928 firebird = cfg.package;
20292121- pidFile = "${cfg.pidDir}/firebirdd.pid";
3030+ dataDir = "${cfg.baseDir}/data";
3131+ systemDir = "${cfg.baseDir}/system";
22322333in
2434···32423343 enable = mkOption {
3444 default = false;
3535- description = "
3636- Whether to enable the firebird super server.
3737- ";
4545+ description = ''
4646+ Whether to enable the Firebird super server.
4747+ '';
3848 };
39494050 package = mkOption {
···4555 reasons. See comments at the firebirdSuper derivation
4656 */
47574848- description = "
5858+ description = ''
4959 Which firebird derivation to use.
5050- ";
6060+ '';
5161 };
52625363 port = mkOption {
5464 default = "3050";
5555- description = "Port of Firebird.";
6565+ description = ''
6666+ Port Firebird uses.
6767+ '';
5668 };
57695870 user = mkOption {
5971 default = "firebird";
6060- description = "User account under which firebird runs.";
7272+ description = ''
7373+ User account under which firebird runs.
7474+ '';
6175 };
62766363- dataDir = mkOption {
6464- default = "/var/db/firebird/data"; # ubuntu is using /var/lib/firebird/2.1/data/.. ?
6565- description = "Location where firebird databases are stored.";
6666- };
6767-6868- pidDir = mkOption {
6969- default = "/run/firebird";
7070- description = "Location of the file which stores the PID of the firebird server.";
7777+ baseDir = mkOption {
7878+ default = "/var/db/firebird"; # ubuntu is using /var/lib/firebird/2.1/data/.. ?
7979+ description = ''
8080+ Location containing data/ and system/ directories.
8181+ data/ stores the databases, system/ stores the password database security2.fdb.
8282+ '';
7183 };
72847385 };
···79918092 config = mkIf config.services.firebird.enable {
81938282- users.extraUsers.firebird.description = "Firebird server user";
8383-8484- environment.systemPackages = [firebird];
9494+ environment.systemPackages = [cfg.package];
85958696 systemd.services.firebird =
8787- { description = "firebird super server";
9797+ { description = "Firebird Super-Server";
88988999 wantedBy = [ "multi-user.target" ];
90100···92102 # is a better way
93103 preStart =
94104 ''
9595- secureDir="${cfg.dataDir}/../system"
9696-97105 mkdir -m 0700 -p \
9898- "${cfg.dataDir}" \
9999- "${cfg.pidDir}" \
100100- /var/log/firebird \
101101- "$secureDir"
106106+ "${dataDir}" \
107107+ "${systemDir}" \
108108+ /var/log/firebird
102109103103- if ! test -e "$secureDir/security2.fdb"; then
104104- cp ${firebird}/security2.fdb "$secureDir"
110110+ if ! test -e "${systemDir}/security2.fdb"; then
111111+ cp ${firebird}/security2.fdb "${systemDir}"
105112 fi
106113107107- chown -R ${cfg.user} "${cfg.pidDir}" "${cfg.dataDir}" "$secureDir" /var/log/firebird
108108- chmod -R 700 "${cfg.pidDir}" "${cfg.dataDir}" "$secureDir" /var/log/firebird
114114+ chown -R ${cfg.user} "${dataDir}" "${systemDir}" /var/log/firebird
115115+ chmod -R 700 "${dataDir}" "${systemDir}" /var/log/firebird
109116 '';
110117111118 serviceConfig.PermissionsStartOnly = true; # preStart must be run as root
···119126120127 # think about this again - and eventually make it an option
121128 environment.etc."firebird/firebird.conf".text = ''
122122- # RootDirectory = Restrict ${cfg.dataDir}
123123- DatabaseAccess = Restrict ${cfg.dataDir}
124124- ExternalFileAccess = Restrict ${cfg.dataDir}
129129+ # RootDirectory = Restrict ${dataDir}
130130+ DatabaseAccess = Restrict ${dataDir}
131131+ ExternalFileAccess = Restrict ${dataDir}
125132 # what is this? is None allowed?
126133 UdfAccess = None
127134 # "Native" = traditional interbase/firebird, "mixed" is windows only
···142149 #RemoteAuxPort = 0
143150 # rsetrict connections to a network card:
144151 #RemoteBindAddress =
145145- # there are some more settings ..
152152+ # there are some additional settings which should be reviewed
146153 '';
154154+155155+ users.extraUsers.firebird = {
156156+ description = "Firebird server user";
157157+ group = "firebird";
158158+ uid = config.ids.uids.firebird;
147159 };
148160161161+ };
149162}
+2-2
nixos/modules/services/databases/mysql.nix
···9393 default = [];
9494 description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL";
9595 example = [
9696- { name = "foodatabase"; schema = ./foodatabase.sql; }
9797- { name = "bardatabase"; schema = ./bardatabase.sql; }
9696+ { name = "foodatabase"; schema = literalExample "./foodatabase.sql"; }
9797+ { name = "bardatabase"; schema = literalExample "./bardatabase.sql"; }
9898 ];
9999 };
100100
+2-2
nixos/modules/services/databases/mysql55.nix
···8686 default = [];
8787 description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL";
8888 example = [
8989- { name = "foodatabase"; schema = ./foodatabase.sql; }
9090- { name = "bardatabase"; schema = ./bardatabase.sql; }
8989+ { name = "foodatabase"; schema = literalExample "./foodatabase.sql"; }
9090+ { name = "bardatabase"; schema = literalExample "./bardatabase.sql"; }
9191 ];
9292 };
9393
···11111212 cfg = config.services.nixosManual;
13131414+ versionModule =
1515+ { system.nixosVersionSuffix = config.system.nixosVersionSuffix;
1616+ system.nixosRevision = config.system.nixosRevision;
1717+ };
1818+1419 manual = import ../../../doc/manual {
1515- inherit (cfg) revision;
1620 inherit pkgs;
1717- options = (fixMergeModules baseModules
2121+ revision = config.system.nixosRevision;
2222+ options = (fixMergeModules ([ versionModule ] ++ baseModules)
1823 (removeAttrs extraArgs ["config" "options"]) // {
1924 modules = [ ];
2025 }).options;
···7277 default = "${pkgs.w3m}/bin/w3m";
7378 description = ''
7479 Browser used to show the manual.
7575- '';
7676- };
7777-7878- services.nixosManual.revision = mkOption {
7979- default = "local";
8080- type = types.uniq types.string;
8181- description = ''
8282- Revision of the targeted source file. This value can either be
8383- <literal>"local"</literal>, <literal>"HEAD"</literal> or any
8484- revision number embedded in a string.
8580 '';
8681 };
8782
+215
nixos/modules/services/monitoring/munin.nix
···11+{ config, pkgs, ... }:
22+33+# TODO: support munin-async
44+# TODO: LWP/Pg perl libs aren't recognized
55+66+# TODO: support fastcgi
77+# http://munin-monitoring.org/wiki/CgiHowto2
88+# spawn-fcgi -s /var/run/munin/fastcgi-graph.sock -U www-data -u munin -g munin /usr/lib/munin/cgi/munin-cgi-graph
99+# spawn-fcgi -s /var/run/munin/fastcgi-html.sock -U www-data -u munin -g munin /usr/lib/munin/cgi/munin-cgi-html
1010+# https://paste.sh/vofcctHP#-KbDSXVeWoifYncZmLfZzgum
1111+# nginx http://munin.readthedocs.org/en/latest/example/webserver/nginx.html
1212+1313+1414+with pkgs.lib;
1515+1616+let
1717+ nodeCfg = config.services.munin-node;
1818+ cronCfg = config.services.munin-cron;
1919+2020+ muninPlugins = pkgs.stdenv.mkDerivation {
2121+ name = "munin-available-plugins";
2222+ buildCommand = ''
2323+ mkdir -p $out
2424+2525+ cp --preserve=mode ${pkgs.munin}/lib/plugins/* $out/
2626+2727+ for file in $out/*; do
2828+ case "$file" in
2929+ plugin.sh) continue;;
3030+ esac
3131+3232+ # read magic makers from the file
3333+ family=$(sed -nr 's/.*#%#\s+family\s*=\s*(\S+)\s*/\1/p' $file)
3434+ cap=$(sed -nr 's/.*#%#\s+capabilities\s*=\s*(.+)/\1/p' $file)
3535+3636+ wrapProgram $file \
3737+ --set PATH "/run/current-system/sw/bin:/run/current-system/sw/sbin" \
3838+ --set MUNIN_LIBDIR "${pkgs.munin}/lib" \
3939+ --set MUNIN_PLUGSTATE "/var/run/munin"
4040+4141+ # munin uses markers to tell munin-node-configure what a plugin can do
4242+ echo "#%# family=$family" >> $file
4343+ echo "#%# capabilities=$cap" >> $file
4444+ done
4545+4646+ # NOTE: we disable disktstats because plugin seems to fail and it hangs html generation (100% CPU + memory leak)
4747+ rm -f $out/diskstats
4848+ '';
4949+ buildInputs = [ pkgs.makeWrapper ];
5050+ };
5151+5252+ muninConf = pkgs.writeText "munin.conf"
5353+ ''
5454+ dbdir /var/lib/munin
5555+ htmldir /var/www/munin
5656+ logdir /var/log/munin
5757+ rundir /var/run/munin
5858+5959+ ${cronCfg.extraGlobalConfig}
6060+6161+ ${cronCfg.hosts}
6262+ '';
6363+6464+ nodeConf = pkgs.writeText "munin-node.conf"
6565+ ''
6666+ log_level 3
6767+ log_file Sys::Syslog
6868+ port 4949
6969+ host *
7070+ background 0
7171+ user root
7272+ group root
7373+ host_name ${config.networking.hostName}
7474+ setsid 0
7575+7676+ # wrapped plugins by makeWrapper being with dots
7777+ ignore_file ^\.
7878+7979+ allow ^127\.0\.0\.1$
8080+8181+ ${nodeCfg.extraConfig}
8282+ '';
8383+in
8484+8585+{
8686+8787+ options = {
8888+8989+ services.munin-node = {
9090+9191+ enable = mkOption {
9292+ default = false;
9393+ description = ''
9494+ Enable Munin Node agent. Munin node listens on 0.0.0.0 and
9595+ by default accepts connections only from 127.0.0.1 for security reasons.
9696+9797+ See <link xlink:href='http://munin-monitoring.org/wiki/munin-node.conf' />.
9898+ '';
9999+ };
100100+101101+ extraConfig = mkOption {
102102+ default = "";
103103+ description = ''
104104+ <filename>munin-node.conf</filename> extra configuration. See
105105+ <link xlink:href='http://munin-monitoring.org/wiki/munin-node.conf' />
106106+ '';
107107+ };
108108+109109+ # TODO: add option to add additional plugins
110110+111111+ };
112112+113113+ services.munin-cron = {
114114+115115+ enable = mkOption {
116116+ default = false;
117117+ description = ''
118118+ Enable munin-cron. Takes care of all heavy lifting to collect data from
119119+ nodes and draws graphs to html. Runs munin-update, munin-limits,
120120+ munin-graphs and munin-html in that order.
121121+122122+ HTML output is in <filename>/var/www/munin/</filename>, configure your
123123+ favourite webserver to serve static files.
124124+ '';
125125+ example = literalExample ''
126126+ services = {
127127+ munin-node.enable = true;
128128+ munin-cron = {
129129+ enable = true;
130130+ hosts = '''
131131+ [''${config.networking.hostName}]
132132+ address localhost
133133+ ''';
134134+ extraGlobalConfig = '''
135135+ contact.email.command mail -s "Munin notification for ''${var:host}" someone@example.com
136136+ ''';
137137+ };
138138+ };
139139+ '';
140140+ };
141141+142142+ extraGlobalConfig = mkOption {
143143+ default = "";
144144+ description = ''
145145+ <filename>munin.conf</filename> extra global configuration.
146146+ See <link xlink:href='http://munin-monitoring.org/wiki/munin.conf' />.
147147+ Useful to setup notifications, see
148148+ <link xlink:href='http://munin-monitoring.org/wiki/HowToContact' />
149149+ '';
150150+ };
151151+152152+ hosts = mkOption {
153153+ example = ''
154154+ [''${config.networking.hostName}]
155155+ address localhost
156156+ '';
157157+ description = ''
158158+ Definitions of hosts of nodes to collect data from. Needs at least one
159159+ hosts for cron to succeed. See
160160+ <link xlink:href='http://munin-monitoring.org/wiki/munin.conf' />
161161+ '';
162162+ };
163163+164164+ };
165165+166166+ };
167167+168168+ config = mkMerge [ (mkIf (nodeCfg.enable || cronCfg.enable) {
169169+170170+ environment.systemPackages = [ pkgs.munin ];
171171+172172+ users.extraUsers = [{
173173+ name = "munin";
174174+ description = "Munin monitoring user";
175175+ group = "munin";
176176+ }];
177177+178178+ users.extraGroups = [{
179179+ name = "munin";
180180+ }];
181181+182182+ }) (mkIf nodeCfg.enable {
183183+184184+ systemd.services.munin-node = {
185185+ description = "Munin node, the agent process";
186186+ after = [ "network.target" ];
187187+ wantedBy = [ "multi-user.target" ];
188188+ path = [ pkgs.munin ];
189189+ environment.MUNIN_PLUGSTATE = "/var/run/munin";
190190+ serviceConfig = {
191191+ ExecStart = "${pkgs.munin}/sbin/munin-node --config ${nodeConf} --servicedir /etc/munin/plugins/";
192192+ };
193193+ };
194194+195195+ system.activationScripts.munin-node = ''
196196+ echo "updating munin plugins..."
197197+198198+ mkdir -p /etc/munin/plugins
199199+ rm -rf /etc/munin/plugins/*
200200+ 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
201201+ '';
202202+203203+ }) (mkIf cronCfg.enable {
204204+205205+ services.cron.systemCronJobs = [
206206+ "*/5 * * * * munin ${pkgs.munin}/bin/munin-cron --config ${muninConf}"
207207+ ];
208208+209209+ system.activationScripts.munin-cron = stringAfter [ "users" "groups" ] ''
210210+ mkdir -p /var/{run,log,www,lib}/munin
211211+ chown -R munin:munin /var/{run,log,www,lib}/munin
212212+ '';
213213+214214+ })];
215215+}
+1-1
nixos/modules/services/networking/ejabberd.nix
···4444 loadDumps = mkOption {
4545 default = [];
4646 description = "Configuration dump that should be loaded on the first startup";
4747- example = [ ./myejabberd.dump ];
4747+ example = literalExample "[ ./myejabberd.dump ]";
4848 };
4949 };
5050
···11+{ config, pkgs, ... }:
22+with pkgs.lib;
33+let
44+ cfg = config.services.redshift;
55+66+in {
77+ options = {
88+ services.redshift.enable = mkOption {
99+ type = types.bool;
1010+ default = false;
1111+ example = true;
1212+ description = "Enable Redshift to change your screen's colour temperature depending on the time of day";
1313+ };
1414+1515+ services.redshift.latitude = mkOption {
1616+ description = "Your current latitude";
1717+ type = types.string;
1818+ };
1919+2020+ services.redshift.longitude = mkOption {
2121+ description = "Your current longitude";
2222+ type = types.string;
2323+ };
2424+2525+ services.redshift.temperature = {
2626+ day = mkOption {
2727+ description = "Colour temperature to use during day time";
2828+ default = 5500;
2929+ type = types.int;
3030+ };
3131+ night = mkOption {
3232+ description = "Colour temperature to use during night time";
3333+ default = 3700;
3434+ type = types.int;
3535+ };
3636+ };
3737+ };
3838+3939+ config = mkIf cfg.enable {
4040+ systemd.services.redshift = {
4141+ description = "Redshift colour temperature adjuster";
4242+ requires = [ "display-manager.service" ];
4343+ script = ''
4444+ ${pkgs.redshift}/bin/redshift \
4545+ -l ${cfg.latitude}:${cfg.longitude} \
4646+ -t ${toString cfg.temperature.day}:${toString cfg.temperature.night}
4747+ '';
4848+ environment = { DISPLAY = ":0"; };
4949+ };
5050+ };
5151+}
+5-2
nixos/modules/services/x11/xserver.nix
···232232 s3tcSupport = mkOption {
233233 default = false;
234234 description = ''
235235- Make S2TC via libtxc_dxtn available to OpenGL drivers. Using
236236- this library may require a patent license depending on your location.
235235+ Make S3TC(S3 Texture Compression) via libtxc_dxtn available
236236+ to OpenGL drivers. It is essential for many games to work
237237+ with FOSS GPU drivers.
238238+239239+ Using this library may require a patent license depending on your location.
237240 '';
238241 };
239242
···4444 };
45454646 description = ''
4747- Activate the new configuration (i.e., update /etc, make accounts,
4848- and so on).
4747+ A set of shell script fragments that are executed when a NixOS
4848+ system configuration is activated. Examples are updating
4949+ /etc, creating accounts, and so on. Since these are executed
5050+ every time you boot the system or run
5151+ <command>nixos-rebuild</command>, it's important that they are
5252+ idempotent and fast.
4953 '';
50545155 merge = mergeTypedOption "script" builtins.isAttrs (fold mergeAttrs {});
+4-1
nixos/modules/system/activation/top-level.nix
···122122 options = {
123123124124 system.build = mkOption {
125125+ internal = true;
125126 default = {};
126127 description = ''
127128 Attribute set of derivations used to setup the system.
···144145 };
145146146147 system.boot.loader.id = mkOption {
148148+ internal = true;
147149 default = "";
148150 description = ''
149151 Id string of the used bootloader.
···151153 };
152154153155 system.boot.loader.kernelFile = mkOption {
156156+ internal = true;
154157 default = pkgs.stdenv.platform.kernelTarget;
155158 type = types.uniq types.string;
156159 description = ''
···169172 };
170173171174 system.extraSystemBuilderCmds = mkOption {
172172- default = "";
173175 internal = true;
176176+ default = "";
174177 merge = concatStringsSep "\n";
175178 description = ''
176179 This code will be added to the builder creating the system store path.
+32-33
nixos/modules/system/boot/loader/grub/grub.nix
···8686 '';
8787 };
88888989- # !!! How can we mark options as obsolete?
9090- bootDevice = mkOption {
9191- default = "";
9292- description = "Obsolete.";
9393- };
9494-9589 configurationName = mkOption {
9690 default = "";
9791 example = "Stable 2.6.21";
···173167 };
174168175169 splashImage = mkOption {
176176- default =
177177- if cfg.version == 1
178178- then pkgs.fetchurl {
179179- url = http://www.gnome-look.org/CONTENT/content-files/36909-soft-tux.xpm.gz;
180180- sha256 = "14kqdx2lfqvh40h6fjjzqgff1mwk74dmbjvmqphi6azzra7z8d59";
181181- }
182182- # GRUB 1.97 doesn't support gzipped XPMs.
183183- else ./winkler-gnu-blue-640x480.png;
184184- example = null;
170170+ example = literalExample "./my-background.png";
185171 description = ''
186172 Background image used for GRUB. It must be a 640x480,
187173 14-colour image in XPM format, optionally compressed with
···233219234220 ###### implementation
235221236236- config = mkIf cfg.enable {
222222+ config = mkMerge [
223223+224224+ { boot.loader.grub.splashImage = mkDefault (
225225+ if cfg.version == 1 then pkgs.fetchurl {
226226+ url = http://www.gnome-look.org/CONTENT/content-files/36909-soft-tux.xpm.gz;
227227+ sha256 = "14kqdx2lfqvh40h6fjjzqgff1mwk74dmbjvmqphi6azzra7z8d59";
228228+ }
229229+ # GRUB 1.97 doesn't support gzipped XPMs.
230230+ else ./winkler-gnu-blue-640x480.png);
231231+ }
232232+233233+ (mkIf cfg.enable {
237234238238- boot.loader.grub.devices = optional (cfg.device != "") cfg.device;
235235+ boot.loader.grub.devices = optional (cfg.device != "") cfg.device;
236236+237237+ system.build.installBootLoader =
238238+ if cfg.devices == [] then
239239+ throw "You must set the ‘boot.loader.grub.device’ option to make the system bootable."
240240+ else
241241+ "PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " +
242242+ "${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
239243240240- system.build.installBootLoader =
241241- if cfg.devices == [] then
242242- throw "You must set the ‘boot.loader.grub.device’ option to make the system bootable."
243243- else
244244- "PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " +
245245- "${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
244244+ system.build.grub = grub;
246245247247- system.build.grub = grub;
246246+ # Common attribute for boot loaders so only one of them can be
247247+ # set at once.
248248+ system.boot.loader.id = "grub";
248249249249- # Common attribute for boot loaders so only one of them can be
250250- # set at once.
251251- system.boot.loader.id = "grub";
250250+ environment.systemPackages = [ grub ];
252251253253- environment.systemPackages = [ grub ];
252252+ boot.loader.grub.extraPrepareConfig =
253253+ concatStrings (mapAttrsToList (n: v: ''
254254+ ${pkgs.coreutils}/bin/cp -pf "${v}" "/boot/${n}"
255255+ '') config.boot.loader.grub.extraFiles);
254256255255- boot.loader.grub.extraPrepareConfig =
256256- concatStrings (mapAttrsToList (n: v: ''
257257- ${pkgs.coreutils}/bin/cp -pf "${v}" "/boot/${n}"
258258- '') config.boot.loader.grub.extraFiles);
257257+ })
259258260260- };
259259+ ];
261260262261}
···7777 });
787879798080-in rec {
8080+ attrs = rec {
8181+ # If you change much fix indentation
81828283 # This package has been split because most applications only need dbus.lib
8384 # which serves as an interface to a *system-wide* daemon,
···114115 docs = dbus_drv "docs" "doc" {
115116 postInstall = ''rm -r "$out/lib"'';
116117 };
117117-}
118118+};
119119+in attrs.libs // attrs
···11+{ stdenv, config, requireFile
22+, curl3, SDL, SDL_image, libpng12, libjpeg62, libvorbis, libogg, openal, mesa
33+, libX11, libXext, libXft, fontconfig, zlib }:
44+55+assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
66+77+stdenv.mkDerivation rec {
88+ name = "gsb-1.56.0";
99+1010+ goBuyItNow = ''
1111+ We cannot download the full version automatically, as you require a license.
1212+ Once you bought a license, you need to add your downloaded version to the nix store.
1313+ You can do this by using "nix-prefetch-url file://gsb1324679796.tar.gz" in the
1414+ directory where you saved it.
1515+ '';
1616+1717+ src = requireFile {
1818+ message = goBuyItNow;
1919+ name = "gsb1324679796.tar.gz";
2020+ sha256 = "12jsz9v55w9zxwiz4kbm6phkv60q3c2kyv5imsls13385pzwcs8i";
2121+ };
2222+2323+ arch = if stdenv.system == "i686-linux" then "x86" else "x86_64";
2424+2525+ phases = "unpackPhase installPhase";
2626+2727+ # XXX: stdenv.lib.makeLibraryPath doesn't pick up /lib64
2828+ libPath = stdenv.lib.makeLibraryPath [ stdenv.gcc.gcc stdenv.gcc.libc ]
2929+ + ":" + stdenv.lib.makeLibraryPath [ SDL SDL_image libjpeg62 libpng12 mesa ]
3030+ + ":" + stdenv.lib.makeLibraryPath [ curl3 openal libvorbis libogg ]
3131+ + ":" + stdenv.lib.makeLibraryPath [ libX11 libXext libXft fontconfig zlib ]
3232+ + ":" + stdenv.gcc.gcc + "/lib64";
3333+3434+ installPhase = ''
3535+ ensureDir $out/libexec/positech/GSB/
3636+ ensureDir $out/bin
3737+3838+ patchelf \
3939+ --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
4040+ --set-rpath $libPath \
4141+ ./GSB.bin.$arch
4242+4343+ cp -r * $out/libexec/positech/GSB/
4444+ rm -rf $out/libexec/positech/GSB/lib64/
4545+ rm -rf $out/libexec/positech/GSB/lib/
4646+4747+ #makeWrapper doesn't do cd. :(
4848+4949+ cat > $out/bin/GSB << EOF
5050+ #!/bin/sh
5151+ cd $out/libexec/positech/GSB
5252+ exec ./GSB.bin.$arch
5353+ EOF
5454+ chmod +x $out/bin/GSB
5555+ '';
5656+5757+ meta = {
5858+ description = "Gratuitous Space Battles";
5959+ longDescription = ''
6060+ a strategy / management / simulation game that does away with all the
6161+ base building and delays and gets straight to the meat and potatoes of
6262+ science-fiction games : The big space battles fought by huge spaceships with
6363+ tons of laser beams and things going 'zap!', 'ka-boom!' and 'ka-pow!'. In GSB
6464+ you put your ships together from modular components, arrange them into fleets,
6565+ give your ships orders of engagement and then hope they emerge victorious from
6666+ battle (or at least blow to bits in aesthetically pleasing ways).
6767+ '';
6868+ homepage = http://www.positech.co.uk/gratuitousspacebattles/index.html;
6969+ license = [ "unfree" ];
7070+ maintainers = with stdenv.lib.maintainers; [ jcumming ];
7171+ platforms = [ "x86_64-linux" "i686-linux" ] ;
7272+ };
7373+7474+}
···11+# https://rt.cpan.org/Public/Bug/Display.html?id=75112
22+diff --git a/master/lib/Munin/Master/HTMLOld.pm b/master/lib/Munin/Master/HTMLOld.pm
33+index 2b6e71f..c0aa2c0 100644
44+--- a/master/lib/Munin/Master/HTMLOld.pm
55++++ b/master/lib/Munin/Master/HTMLOld.pm
66+@@ -711,10 +711,12 @@ sub emit_main_index {
77+88+ sub copy_web_resources {
99+ my ($staticdir, $htmldir) = @_;
1010++ local $File::Copy::Recursive::KeepMode = 0;
1111+ unless(dircopy($staticdir, "$htmldir/static")){
1212+ ERROR "[ERROR] Could not copy contents from $staticdir to $htmldir";
1313+ die "[ERROR] Could not copy contents from $staticdir to $htmldir";
1414+ }
1515++ local $File::Copy::Recursive::KeepMode = 1;
1616+ }
1717+1818+ sub instanciate_comparison_templates {
···4949 # Add a utility function to produce derivations that use this
5050 # stdenv and its shell.
5151 mkDerivation = attrs:
5252- if !allowUnfree && (let l = attrs.meta.license or ""; in l == "unfree" || l == "unfree-redistributable") then
5252+ if !allowUnfree && (let l = lib.lists.toList attrs.meta.license or []; in lib.lists.elem "unfree" l || lib.lists.elem "unfree-redistributable" l) then
5353 throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate"
5454 else
5555 lib.addPassthru (derivation (