···38 in foldl' (length list - 1);
3940000041 # map with index: `imap (i: v: "${v}-${toString i}") ["a" "b"] ==
42 # ["a-1" "b-2"]'
43 imap = f: list:
···59 # == [1 2 3 4 5]' and `flatten 1 == [1]'.
60 flatten = x:
61 if isList x
62- then fold (x: y: (flatten x) ++ y) [] x
63 else [x];
6465···8687 # Return true iff function `pred' returns true for at least element
88 # of `list'.
89- any = pred: fold (x: y: if pred x then true else y) false;
909192 # Return true iff function `pred' returns true for all elements of
93 # `list'.
94- all = pred: fold (x: y: if pred x then y else false) true;
959697 # Count how many times function `pred' returns true for the elements
98 # of `list'.
99- count = pred: fold (x: c: if pred x then c + 1 else c) 0;
100101102 # Return a singleton list or an empty list, depending on a boolean
···38 in foldl' (length list - 1);
394041+ # Strict version of foldl.
42+ foldl' = builtins.foldl' or foldl;
43+44+45 # map with index: `imap (i: v: "${v}-${toString i}") ["a" "b"] ==
46 # ["a-1" "b-2"]'
47 imap = f: list:
···63 # == [1 2 3 4 5]' and `flatten 1 == [1]'.
64 flatten = x:
65 if isList x
66+ then foldl' (x: y: x ++ (flatten y)) [] x
67 else [x];
6869···9091 # Return true iff function `pred' returns true for at least element
92 # of `list'.
93+ any = builtins.any or (pred: fold (x: y: if pred x then true else y) false);
949596 # Return true iff function `pred' returns true for all elements of
97 # `list'.
98+ all = builtins.all or (pred: fold (x: y: if pred x then y else false) true);
99100101 # Count how many times function `pred' returns true for the elements
102 # of `list'.
103+ count = pred: foldl' (c: x: if pred x then c + 1 else c) 0;
104105106 # Return a singleton list or an empty list, depending on a boolean
-2
lib/misc.nix
lib/deprecated.nix
···203 in
204 work startSet [] [];
205206- genericClosure = builtins.genericClosure or lazyGenericClosure;
207-208 innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else
209 innerModifySumArgs f x (a // b);
210 modifySumArgs = f: x: innerModifySumArgs f x {};
···203 in
204 work startSet [] [];
20500206 innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else
207 innerModifySumArgs f x (a // b);
208 modifySumArgs = f: x: innerModifySumArgs f x {};
+11-11
lib/modules.nix
···76 else yieldConfig (prefix ++ [n]) v) set) ["_definedNames"];
77 in
78 if options._module.check.value && set ? _definedNames then
79- fold (m: res:
80- fold (name: res:
81 if set ? ${name} then res else throw "The option `${showOption (prefix ++ [name])}' defined in `${m.file}' does not exist.")
82 res m.names)
83 res set._definedNames
···182 let
183 loc = prefix ++ [name];
184 # Get all submodules that declare ‘name’.
185- decls = concatLists (map (m:
186 if m.options ? ${name}
187 then [ { inherit (m) file; options = m.options.${name}; } ]
188 else []
189- ) options);
190 # Get all submodules that define ‘name’.
191- defns = concatLists (map (m:
192 if m.config ? ${name}
193 then map (config: { inherit (m) file; inherit config; })
194 (pushDownProperties m.config.${name})
195 else []
196- ) configs);
197 nrOptions = count (m: isOption m.options) decls;
198 # Extract the definitions for this loc
199 defns' = map (m: { inherit (m) file; value = m.config.${name}; })
···225 'opts' is a list of modules. Each module has an options attribute which
226 correspond to the definition of 'loc' in 'opt.file'. */
227 mergeOptionDecls = loc: opts:
228- fold (opt: res:
229 if opt.options ? default && res ? default ||
230 opt.options ? example && res ? example ||
231 opt.options ? description && res ? description ||
···251 else if opt.options ? options then map (coerceOption opt.file) options' ++ res.options
252 else res.options;
253 in opt.options // res //
254- { declarations = [opt.file] ++ res.declarations;
255 options = submodules;
256 }
257 ) { inherit loc; declarations = []; options = []; } opts;
···302 in
303 processOrder (processOverride (processIfAndMerge defs));
304305- # Type-check the remaining definitions, and merge them
306- mergedValue = fold (def: res:
307 if type.check def.value then res
308 else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.name}.")
309 (type.merge loc defsFinal) defsFinal;
···384 defaultPrio = 100;
385 getPrio = def: if def.value._type or "" == "override" then def.value.priority else defaultPrio;
386 min = x: y: if x < y then x else y;
387- highestPrio = fold (def: prio: min (getPrio def) prio) 9999 defs;
388 strip = def: if def.value._type or "" == "override" then def // { value = def.value.content; } else def;
389 in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
390
···76 else yieldConfig (prefix ++ [n]) v) set) ["_definedNames"];
77 in
78 if options._module.check.value && set ? _definedNames then
79+ foldl' (res: m:
80+ foldl' (res: name:
81 if set ? ${name} then res else throw "The option `${showOption (prefix ++ [name])}' defined in `${m.file}' does not exist.")
82 res m.names)
83 res set._definedNames
···182 let
183 loc = prefix ++ [name];
184 # Get all submodules that declare ‘name’.
185+ decls = concatMap (m:
186 if m.options ? ${name}
187 then [ { inherit (m) file; options = m.options.${name}; } ]
188 else []
189+ ) options;
190 # Get all submodules that define ‘name’.
191+ defns = concatMap (m:
192 if m.config ? ${name}
193 then map (config: { inherit (m) file; inherit config; })
194 (pushDownProperties m.config.${name})
195 else []
196+ ) configs;
197 nrOptions = count (m: isOption m.options) decls;
198 # Extract the definitions for this loc
199 defns' = map (m: { inherit (m) file; value = m.config.${name}; })
···225 'opts' is a list of modules. Each module has an options attribute which
226 correspond to the definition of 'loc' in 'opt.file'. */
227 mergeOptionDecls = loc: opts:
228+ foldl' (res: opt:
229 if opt.options ? default && res ? default ||
230 opt.options ? example && res ? example ||
231 opt.options ? description && res ? description ||
···251 else if opt.options ? options then map (coerceOption opt.file) options' ++ res.options
252 else res.options;
253 in opt.options // res //
254+ { declarations = res.declarations ++ [opt.file];
255 options = submodules;
256 }
257 ) { inherit loc; declarations = []; options = []; } opts;
···302 in
303 processOrder (processOverride (processIfAndMerge defs));
304305+ # Type-check the remaining definitions, and merge them.
306+ mergedValue = foldl' (res: def:
307 if type.check def.value then res
308 else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.name}.")
309 (type.merge loc defsFinal) defsFinal;
···384 defaultPrio = 100;
385 getPrio = def: if def.value._type or "" == "override" then def.value.priority else defaultPrio;
386 min = x: y: if x < y then x else y;
387+ highestPrio = foldl' (prio: def: min (getPrio def) prio) 9999 defs;
388 strip = def: if def.value._type or "" == "override" then def // { value = def.value.content; } else def;
389 in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
390
+5-7
lib/options.nix
···45with import ./trivial.nix;
6with import ./lists.nix;
7-with import ./misc.nix;
8with import ./attrsets.nix;
9with import ./strings.nix;
10···53 if length list == 1 then head list
54 else if all isFunction list then x: mergeDefaultOption loc (map (f: f x) list)
55 else if all isList list then concatLists list
56- else if all isAttrs list then fold lib.mergeAttrs {} list
57- else if all isBool list then fold lib.or false list
58 else if all isString list then lib.concatStrings list
59 else if all isInt list && all (x: x == head list) list then head list
60 else throw "Cannot merge definitions of `${showOption loc}' given in ${showFiles (getFiles defs)}.";
···68 /* "Merge" option definitions by checking that they all have the same value. */
69 mergeEqualOption = loc: defs:
70 if defs == [] then abort "This case should never happen."
71- else fold (def: val:
72 if def.value != val then
73 throw "The option `${showOption loc}' has conflicting definitions, in ${showFiles (getFiles defs)}."
74 else
···83 optionAttrSetToDocList = optionAttrSetToDocList' [];
8485 optionAttrSetToDocList' = prefix: options:
86- fold (opt: rest:
87 let
88 docOption = rec {
89 name = showOption opt.loc;
···101 let ss = opt.type.getSubOptions opt.loc;
102 in if ss != {} then optionAttrSetToDocList' opt.loc ss else [];
103 in
104- # FIXME: expensive, O(n^2)
105- [ docOption ] ++ subOptions ++ rest) [] (collect isOption options);
106107108 /* This function recursively removes all derivation attributes from
···45with import ./trivial.nix;
6with import ./lists.nix;
07with import ./attrsets.nix;
8with import ./strings.nix;
9···52 if length list == 1 then head list
53 else if all isFunction list then x: mergeDefaultOption loc (map (f: f x) list)
54 else if all isList list then concatLists list
55+ else if all isAttrs list then foldl' lib.mergeAttrs {} list
56+ else if all isBool list then foldl' lib.or false list
57 else if all isString list then lib.concatStrings list
58 else if all isInt list && all (x: x == head list) list then head list
59 else throw "Cannot merge definitions of `${showOption loc}' given in ${showFiles (getFiles defs)}.";
···67 /* "Merge" option definitions by checking that they all have the same value. */
68 mergeEqualOption = loc: defs:
69 if defs == [] then abort "This case should never happen."
70+ else foldl' (val: def:
71 if def.value != val then
72 throw "The option `${showOption loc}' has conflicting definitions, in ${showFiles (getFiles defs)}."
73 else
···82 optionAttrSetToDocList = optionAttrSetToDocList' [];
8384 optionAttrSetToDocList' = prefix: options:
85+ concatMap (opt:
86 let
87 docOption = rec {
88 name = showOption opt.loc;
···100 let ss = opt.type.getSubOptions opt.loc;
101 in if ss != {} then optionAttrSetToDocList' opt.loc ss else [];
102 in
103+ [ docOption ] ++ subOptions) (collect isOption options);
0104105106 /* This function recursively removes all derivation attributes from
+43-46
lib/strings.nix
···89rec {
1011- inherit (builtins) stringLength substring head tail isString;
121314 # Concatenate a list of strings.
15- concatStrings = lib.fold (x: y: x + y) "";
0000161718 # Map a function over a list and concatenate the resulting strings.
···25 intersperse = separator: list:
26 if list == [] || length list == 1
27 then list
28- else [(head list) separator]
29- ++ (intersperse separator (tail list));
303132 # Concatenate a list of strings with a separator between each element, e.g.
33 # concatStringsSep " " ["foo" "bar" "xyzzy"] == "foo bar xyzzy"
34- concatStringsSep = separator: list:
35- concatStrings (intersperse separator list);
3637 concatMapStringsSep = sep: f: list: concatStringsSep sep (map f list);
38 concatImapStringsSep = sep: f: list: concatStringsSep sep (lib.imap f list);
···6162 # Determine whether a string has given prefix/suffix.
63 hasPrefix = pref: str:
64- eqStrings (substring 0 (stringLength pref) str) pref;
65 hasSuffix = suff: str:
66 let
67 lenStr = stringLength str;
68 lenSuff = stringLength suff;
69 in lenStr >= lenSuff &&
70- eqStrings (substring (lenStr - lenSuff) lenStr str) suff;
717273 # Convert a string to a list of characters (i.e. singleton strings).
···76 # will likely be horribly inefficient; Nix is not a general purpose
77 # programming language. Complex string manipulations should, if
78 # appropriate, be done in a derivation.
79- stringToCharacters = s: let l = stringLength s; in
80- if l == 0
81- then []
82- else map (p: substring p 1 s) (lib.range 0 (l - 1));
838485- # Manipulate a string charcater by character and replace them by strings
86- # before concatenating the results.
87 stringAsChars = f: s:
88 concatStrings (
89 map f (stringToCharacters s)
90 );
919293- # same as vim escape function.
94- # Each character contained in list is prefixed by "\"
95- escape = list : string :
96- stringAsChars (c: if lib.elem c list then "\\${c}" else c) string;
979899- # still ugly slow. But more correct now
100- # [] for zsh
101 escapeShellArg = lib.escape (stringToCharacters "\\ ';$`()|<>\t*[]");
102103104- # replace characters by their substitutes. This function is equivalent to
105- # the `tr' command except that one character can be replace by multiple
106- # ones. e.g.,
107- # replaceChars ["<" ">"] ["<" ">"] "<foo>" returns "<foo>".
108- replaceChars = del: new: s:
109 let
110 substList = lib.zipLists del new;
111 subst = c:
···115 else
116 found.snd;
117 in
118- stringAsChars subst s;
119120121- # Case conversion utilities
122 lowerChars = stringToCharacters "abcdefghijklmnopqrstuvwxyz";
123 upperChars = stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
124 toLower = replaceChars upperChars lowerChars;
125 toUpper = replaceChars lowerChars upperChars;
126127- # Appends string context from another string
128- addContextFrom = a: b: substring 0 0 a + b;
129130- # Compares strings not requiring context equality
131- # Obviously, a workaround but works on all Nix versions
132- eqStrings = a: b: addContextFrom b a == addContextFrom a b;
133134135- # Cut a string with a separator and produces a list of strings which were
136- # separated by this separator. e.g.,
137- # `splitString "." "foo.bar.baz"' returns ["foo" "bar" "baz"].
138 splitString = _sep: _s:
139 let
140 sep = addContextFrom _s _sep;
···177 sufLen = stringLength suf;
178 sLen = stringLength s;
179 in
180- if sufLen <= sLen && eqStrings suf (substring (sLen - sufLen) sufLen s) then
181 substring 0 (sLen - sufLen) s
182 else
183 s;
···196197198 # Extract name with version from URL. Ask for separator which is
199- # supposed to start extension
200- nameFromURL = url: sep: let
201- components = splitString "/" url;
202- filename = lib.last components;
203- name = builtins.head (splitString sep filename);
204- in
205- assert ! eqStrings name filename;
206- name;
207208209 # Create an --{enable,disable}-<feat> string that can be passed to
210 # standard GNU Autoconf scripts.
211 enableFeature = enable: feat: "--${if enable then "enable" else "disable"}-${feat}";
212213- # Create a fixed width string with additional prefix to match required width
00214 fixedWidthString = width: filler: str:
215 let
216 strw = lib.stringLength str;
···219 assert strw <= width;
220 if strw == width then str else filler + fixedWidthString reqWidth filler str;
221222- # Format a number adding leading zeroes up to fixed width
0223 fixedWidthNumber = width: n: fixedWidthString width "0" (toString n);
224}
···89rec {
1011+ inherit (builtins) stringLength substring head tail isString replaceStrings;
121314 # Concatenate a list of strings.
15+ concatStrings =
16+ if builtins ? concatStringsSep then
17+ builtins.concatStringsSep ""
18+ else
19+ lib.foldl' (x: y: x + y) "";
202122 # Map a function over a list and concatenate the resulting strings.
···29 intersperse = separator: list:
30 if list == [] || length list == 1
31 then list
32+ else tail (lib.concatMap (x: [separator x]) list);
0333435 # Concatenate a list of strings with a separator between each element, e.g.
36 # concatStringsSep " " ["foo" "bar" "xyzzy"] == "foo bar xyzzy"
37+ concatStringsSep = builtins.concatStringsSep or (separator: list:
38+ concatStrings (intersperse separator list));
3940 concatMapStringsSep = sep: f: list: concatStringsSep sep (map f list);
41 concatImapStringsSep = sep: f: list: concatStringsSep sep (lib.imap f list);
···6465 # Determine whether a string has given prefix/suffix.
66 hasPrefix = pref: str:
67+ substring 0 (stringLength pref) str == pref;
68 hasSuffix = suff: str:
69 let
70 lenStr = stringLength str;
71 lenSuff = stringLength suff;
72 in lenStr >= lenSuff &&
73+ substring (lenStr - lenSuff) lenStr str == suff;
747576 # Convert a string to a list of characters (i.e. singleton strings).
···79 # will likely be horribly inefficient; Nix is not a general purpose
80 # programming language. Complex string manipulations should, if
81 # appropriate, be done in a derivation.
82+ stringToCharacters = s:
83+ map (p: substring p 1 s) (lib.range 0 (stringLength s - 1));
00848586+ # Manipulate a string charactter by character and replace them by
87+ # strings before concatenating the results.
88 stringAsChars = f: s:
89 concatStrings (
90 map f (stringToCharacters s)
91 );
929394+ # Escape occurrence of the elements of ‘list’ in ‘string’ by
95+ # prefixing it with a backslash. For example, ‘escape ["(" ")"]
96+ # "(foo)"’ returns the string ‘\(foo\)’.
97+ escape = list: replaceChars list (map (c: "\\${c}") list);
9899100+ # Escape all characters that have special meaning in the Bourne shell.
0101 escapeShellArg = lib.escape (stringToCharacters "\\ ';$`()|<>\t*[]");
102103104+ # Obsolete - use replaceStrings instead.
105+ replaceChars = builtins.replaceStrings or (
106+ del: new: s:
00107 let
108 substList = lib.zipLists del new;
109 subst = c:
···113 else
114 found.snd;
115 in
116+ stringAsChars subst s);
117118119+ # Case conversion utilities.
120 lowerChars = stringToCharacters "abcdefghijklmnopqrstuvwxyz";
121 upperChars = stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
122 toLower = replaceChars upperChars lowerChars;
123 toUpper = replaceChars lowerChars upperChars;
12400125126+ # Appends string context from another string.
127+ addContextFrom = a: b: substring 0 0 a + b;
0128129130+ # Cut a string with a separator and produces a list of strings which
131+ # were separated by this separator; e.g., `splitString "."
132+ # "foo.bar.baz"' returns ["foo" "bar" "baz"].
133 splitString = _sep: _s:
134 let
135 sep = addContextFrom _s _sep;
···172 sufLen = stringLength suf;
173 sLen = stringLength s;
174 in
175+ if sufLen <= sLen && suf == substring (sLen - sufLen) sufLen s then
176 substring 0 (sLen - sufLen) s
177 else
178 s;
···191192193 # Extract name with version from URL. Ask for separator which is
194+ # supposed to start extension.
195+ nameFromURL = url: sep:
196+ let
197+ components = splitString "/" url;
198+ filename = lib.last components;
199+ name = builtins.head (splitString sep filename);
200+ in assert name != filename; name;
0201202203 # Create an --{enable,disable}-<feat> string that can be passed to
204 # standard GNU Autoconf scripts.
205 enableFeature = enable: feat: "--${if enable then "enable" else "disable"}-${feat}";
206207+208+ # Create a fixed width string with additional prefix to match
209+ # required width.
210 fixedWidthString = width: filler: str:
211 let
212 strw = lib.stringLength str;
···215 assert strw <= width;
216 if strw == width then str else filler + fixedWidthString reqWidth filler str;
217218+219+ # Format a number adding leading zeroes up to fixed width.
220 fixedWidthNumber = width: n: fixedWidthString width "0" (toString n);
221}
+1-1
lib/trivial.nix
···22 inherit (builtins)
23 pathExists readFile isBool isFunction
24 isInt add sub lessThan
25- seq deepSeq;
2627 # Return the Nixpkgs version number.
28 nixpkgsVersion =
···22 inherit (builtins)
23 pathExists readFile isBool isFunction
24 isInt add sub lessThan
25+ seq deepSeq genericClosure;
2627 # Return the Nixpkgs version number.
28 nixpkgsVersion =
···88 attrs = mkOptionType {
89 name = "attribute set";
90 check = isAttrs;
91+ merge = loc: foldl' (res: def: mergeAttrs res def.value) {};
92 };
9394 # derivation is a reserved keyword.
+2-2
nixos/doc/manual/installation/installing-usb.xml
···67<title>Booting from a USB Drive</title>
89-<para>For systems without CD drive, the NixOS livecd can be booted from
10-a usb stick. For non-UEFI installations,
11<link xlink:href="http://unetbootin.sourceforge.net/">unetbootin</link>
12will work. For UEFI installations, you should mount the ISO, copy its contents
13verbatim to your drive, then either:
···67<title>Booting from a USB Drive</title>
89+<para>For systems without CD drive, the NixOS live CD can be booted from
10+a USB stick. For non-UEFI installations,
11<link xlink:href="http://unetbootin.sourceforge.net/">unetbootin</link>
12will work. For UEFI installations, you should mount the ISO, copy its contents
13verbatim to your drive, then either:
+9-5
nixos/modules/installer/cd-dvd/iso-image.nix
···30 # * COM32 entries (chainload, reboot, poweroff) are not recognized. They
31 # result in incorrect boot entries.
3233- baseIsolinuxCfg =
34- ''
35 SERIAL 0 38400
36 TIMEOUT ${builtins.toString syslinuxTimeout}
37 UI vesamenu.c32
···44 LINUX /boot/bzImage
45 APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
46 INITRD /boot/initrd
47- '';
4849 isolinuxMemtest86Entry = ''
50 LABEL memtest
···5556 isolinuxCfg = baseIsolinuxCfg + (optionalString config.boot.loader.grub.memtest86.enable isolinuxMemtest86Entry);
5758- # The efi boot image
59 efiDir = pkgs.runCommand "efi-directory" {} ''
60 mkdir -p $out/EFI/boot
61 cp -v ${pkgs.gummiboot}/lib/gummiboot/gummiboot${targetArch}.efi $out/EFI/boot/boot${targetArch}.efi
62 mkdir -p $out/loader/entries
63- echo "title NixOS LiveCD" > $out/loader/entries/nixos-livecd.conf
64 echo "linux /boot/bzImage" >> $out/loader/entries/nixos-livecd.conf
65 echo "initrd /boot/initrd" >> $out/loader/entries/nixos-livecd.conf
66 echo "options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}" >> $out/loader/entries/nixos-livecd.conf
···218 system.boot.loader.kernelFile = "bzImage";
219 environment.systemPackages = [ pkgs.grub2 pkgs.grub2_efi pkgs.syslinux ];
22000221 # In stage 1 of the boot, mount the CD as the root FS by label so
222 # that we don't need to know its device. We pass the label of the
223 # root filesystem on the kernel command line, rather than in
···229 boot.kernelParams =
230 [ "root=LABEL=${config.isoImage.volumeID}"
231 "boot.shell_on_fail"
0232 ];
233234 fileSystems."/" =
···267 };
268269 boot.initrd.availableKernelModules = [ "squashfs" "iso9660" "usb-storage" ];
00270271 boot.initrd.kernelModules = [ "loop" ];
272
···30 # * COM32 entries (chainload, reboot, poweroff) are not recognized. They
31 # result in incorrect boot entries.
3233+ baseIsolinuxCfg = ''
034 SERIAL 0 38400
35 TIMEOUT ${builtins.toString syslinuxTimeout}
36 UI vesamenu.c32
···43 LINUX /boot/bzImage
44 APPEND init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
45 INITRD /boot/initrd
46+ '';
4748 isolinuxMemtest86Entry = ''
49 LABEL memtest
···5455 isolinuxCfg = baseIsolinuxCfg + (optionalString config.boot.loader.grub.memtest86.enable isolinuxMemtest86Entry);
5657+ # The EFI boot image.
58 efiDir = pkgs.runCommand "efi-directory" {} ''
59 mkdir -p $out/EFI/boot
60 cp -v ${pkgs.gummiboot}/lib/gummiboot/gummiboot${targetArch}.efi $out/EFI/boot/boot${targetArch}.efi
61 mkdir -p $out/loader/entries
62+ echo "title NixOS Live CD" > $out/loader/entries/nixos-livecd.conf
63 echo "linux /boot/bzImage" >> $out/loader/entries/nixos-livecd.conf
64 echo "initrd /boot/initrd" >> $out/loader/entries/nixos-livecd.conf
65 echo "options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}" >> $out/loader/entries/nixos-livecd.conf
···217 system.boot.loader.kernelFile = "bzImage";
218 environment.systemPackages = [ pkgs.grub2 pkgs.grub2_efi pkgs.syslinux ];
219220+ boot.consoleLogLevel = 7;
221+222 # In stage 1 of the boot, mount the CD as the root FS by label so
223 # that we don't need to know its device. We pass the label of the
224 # root filesystem on the kernel command line, rather than in
···230 boot.kernelParams =
231 [ "root=LABEL=${config.isoImage.volumeID}"
232 "boot.shell_on_fail"
233+ "nomodeset"
234 ];
235236 fileSystems."/" =
···269 };
270271 boot.initrd.availableKernelModules = [ "squashfs" "iso9660" "usb-storage" ];
272+273+ boot.blacklistedKernelModules = [ "nouveau" ];
274275 boot.initrd.kernelModules = [ "loop" ];
276
···40 example = literalExample "[ pkgs.gnome3.gpaste ]";
41 description = "Additional list of packages to be added to the session search path.
42 Useful for gnome shell extensions or gsettings-conditionated autostart.";
43- apply = list: list ++ [ gnome3.gnome_shell ];
44 };
4546 environment.gnome3.packageSet = mkOption {
···40 example = literalExample "[ pkgs.gnome3.gpaste ]";
41 description = "Additional list of packages to be added to the session search path.
42 Useful for gnome shell extensions or gsettings-conditionated autostart.";
43+ apply = list: list ++ [ gnome3.gnome_shell gnome3.gnome-shell-extensions ];
44 };
4546 environment.gnome3.packageSet = mkOption {
+2-3
nixos/modules/system/boot/kernel.nix
···49 type = types.int;
50 default = 4;
51 description = ''
52- The kernel console log level. Only log messages with a
53- priority numerically less than this will appear on the
54- console.
55 '';
56 };
57
···49 type = types.int;
50 default = 4;
51 description = ''
52+ The kernel console log level. Log messages with a priority
53+ numerically less than this will not appear on the console.
054 '';
55 };
56
+21-21
nixos/modules/system/boot/loader/grub/grub.nix
···1011 realGrub = if cfg.version == 1 then pkgs.grub
12 else if cfg.zfsSupport then pkgs.grub2.override { zfsSupport = true; }
13- else if cfg.enableTrustedboot then pkgs.trustedGrub
14 else pkgs.grub2;
1516 grub =
···112 description = ''
113 The devices on which the boot loader, GRUB, will be
114 installed. Can be used instead of <literal>device</literal> to
115- install grub into multiple devices (e.g., if as softraid arrays holding /boot).
116 '';
117 };
118···135 example = "/boot1";
136 type = types.str;
137 description = ''
138- The path to the boot directory where grub will be written. Generally
139- this boot parth should double as an efi path.
140 '';
141 };
142···166 example = [ "/dev/sda" "/dev/sdb" ];
167 type = types.listOf types.str;
168 description = ''
169- The path to the devices which will have the grub mbr written.
170 Note these are typically device paths and not paths to partitions.
171 '';
172 };
···197 type = types.lines;
198 description = ''
199 Additional bash commands to be run at the script that
200- prepares the grub menu entries.
201 '';
202 };
203···276 example = "1024x768";
277 type = types.str;
278 description = ''
279- The gfxmode to pass to grub when loading a graphical boot interface under efi.
280 '';
281 };
282···285 example = "auto";
286 type = types.str;
287 description = ''
288- The gfxmode to pass to grub when loading a graphical boot interface under bios.
289 '';
290 };
291···330 type = types.addCheck types.str
331 (type: type == "uuid" || type == "label" || type == "provided");
332 description = ''
333- Determines how grub will identify devices when generating the
334 configuration file. A value of uuid / label signifies that grub
335 will always resolve the uuid or label of the device before using
336- it in the configuration. A value of provided means that grub will
337 use the device name as show in <command>df</command> or
338 <command>mount</command>. Note, zfs zpools / datasets are ignored
339 and will always be mounted using their labels.
···344 default = false;
345 type = types.bool;
346 description = ''
347- Whether grub should be build against libzfs.
348 ZFS support is only available for GRUB v2.
349 This option is ignored for GRUB v1.
350 '';
···354 default = false;
355 type = types.bool;
356 description = ''
357- Whether grub should be build with EFI support.
358 EFI support is only available for GRUB v2.
359 This option is ignored for GRUB v1.
360 '';
···364 default = false;
365 type = types.bool;
366 description = ''
367- Enable support for encrypted partitions. Grub should automatically
368 unlock the correct encrypted partition and look for filesystems.
369 '';
370 };
371372- enableTrustedboot = mkOption {
373 default = false;
374 type = types.bool;
375 description = ''
376- Enable trusted boot. Grub will measure all critical components during
377 the boot process to offer TCG (TPM) support.
378 '';
379 };
···429 assertions = [
430 {
431 assertion = !cfg.zfsSupport || cfg.version == 2;
432- message = "Only grub version 2 provides zfs support";
433 }
434 {
435 assertion = cfg.mirroredBoots != [ ];
···441 message = "You cannot have duplicated devices in mirroredBoots";
442 }
443 {
444- assertion = !cfg.enableTrustedboot || cfg.version == 2;
445 message = "Trusted GRUB is only available for GRUB 2";
446 }
447 {
448- assertion = !cfg.efiSupport || !cfg.enableTrustedboot;
449 message = "Trusted GRUB does not have EFI support";
450 }
451 {
452- assertion = !cfg.zfsSupport || !cfg.enableTrustedboot;
453 message = "Trusted GRUB does not have ZFS support";
454 }
455 {
456- assertion = !cfg.enableTrustedboot;
457 message = "Trusted GRUB can break your system. Remove assertion if you want to test trustedGRUB nevertheless.";
458 }
459 ] ++ flip concatMap cfg.mirroredBoots (args: [
···471 }
472 ] ++ flip map args.devices (device: {
473 assertion = device == "nodev" || hasPrefix "/" device;
474- message = "Grub devices must be absolute paths, not ${dev} in ${args.path}";
475 }));
476 })
477
···1011 realGrub = if cfg.version == 1 then pkgs.grub
12 else if cfg.zfsSupport then pkgs.grub2.override { zfsSupport = true; }
13+ else if cfg.enableTrustedBoot then pkgs.trustedGrub
14 else pkgs.grub2;
1516 grub =
···112 description = ''
113 The devices on which the boot loader, GRUB, will be
114 installed. Can be used instead of <literal>device</literal> to
115+ install GRUB onto multiple devices.
116 '';
117 };
118···135 example = "/boot1";
136 type = types.str;
137 description = ''
138+ The path to the boot directory where GRUB will be written. Generally
139+ this boot path should double as an EFI path.
140 '';
141 };
142···166 example = [ "/dev/sda" "/dev/sdb" ];
167 type = types.listOf types.str;
168 description = ''
169+ The path to the devices which will have the GRUB MBR written.
170 Note these are typically device paths and not paths to partitions.
171 '';
172 };
···197 type = types.lines;
198 description = ''
199 Additional bash commands to be run at the script that
200+ prepares the GRUB menu entries.
201 '';
202 };
203···276 example = "1024x768";
277 type = types.str;
278 description = ''
279+ The gfxmode to pass to GRUB when loading a graphical boot interface under EFI.
280 '';
281 };
282···285 example = "auto";
286 type = types.str;
287 description = ''
288+ The gfxmode to pass to GRUB when loading a graphical boot interface under BIOS.
289 '';
290 };
291···330 type = types.addCheck types.str
331 (type: type == "uuid" || type == "label" || type == "provided");
332 description = ''
333+ Determines how GRUB will identify devices when generating the
334 configuration file. A value of uuid / label signifies that grub
335 will always resolve the uuid or label of the device before using
336+ it in the configuration. A value of provided means that GRUB will
337 use the device name as show in <command>df</command> or
338 <command>mount</command>. Note, zfs zpools / datasets are ignored
339 and will always be mounted using their labels.
···344 default = false;
345 type = types.bool;
346 description = ''
347+ Whether GRUB should be build against libzfs.
348 ZFS support is only available for GRUB v2.
349 This option is ignored for GRUB v1.
350 '';
···354 default = false;
355 type = types.bool;
356 description = ''
357+ Whether GRUB should be build with EFI support.
358 EFI support is only available for GRUB v2.
359 This option is ignored for GRUB v1.
360 '';
···364 default = false;
365 type = types.bool;
366 description = ''
367+ Enable support for encrypted partitions. GRUB should automatically
368 unlock the correct encrypted partition and look for filesystems.
369 '';
370 };
371372+ enableTrustedBoot = mkOption {
373 default = false;
374 type = types.bool;
375 description = ''
376+ Enable trusted boot. GRUB will measure all critical components during
377 the boot process to offer TCG (TPM) support.
378 '';
379 };
···429 assertions = [
430 {
431 assertion = !cfg.zfsSupport || cfg.version == 2;
432+ message = "Only GRUB version 2 provides ZFS support";
433 }
434 {
435 assertion = cfg.mirroredBoots != [ ];
···441 message = "You cannot have duplicated devices in mirroredBoots";
442 }
443 {
444+ assertion = !cfg.enableTrustedBoot || cfg.version == 2;
445 message = "Trusted GRUB is only available for GRUB 2";
446 }
447 {
448+ assertion = !cfg.efiSupport || !cfg.enableTrustedBoot;
449 message = "Trusted GRUB does not have EFI support";
450 }
451 {
452+ assertion = !cfg.zfsSupport || !cfg.enableTrustedBoot;
453 message = "Trusted GRUB does not have ZFS support";
454 }
455 {
456+ assertion = !cfg.enableTrustedBoot;
457 message = "Trusted GRUB can break your system. Remove assertion if you want to test trustedGRUB nevertheless.";
458 }
459 ] ++ flip concatMap cfg.mirroredBoots (args: [
···471 }
472 ] ++ flip map args.devices (device: {
473 assertion = device == "nodev" || hasPrefix "/" device;
474+ message = "GRUB devices must be absolute paths, not ${dev} in ${args.path}";
475 }));
476 })
477
···1-{ stdenv, fetchurl, perl, perlPackages }:
23-stdenv.mkDerivation rec {
4- version = "1.9";
5 name = "remotebox-${version}";
67 src = fetchurl {
8- url = "${meta.homepage}/downloads/RemoteBox-${version}.tar.bz2";
9- sha256 = "0vsfz2qmha9nz60fyksgqqyrw4lz9z2d5isnwqc6afn8z3i1qmkp";
10 };
1112- buildInputs = [ perl perlPackages.Gtk2 perlPackages.SOAPLite ];
01314 installPhase = ''
15- mkdir -p $out/bin
16- cp -a docs/ share/ $out
1718 substituteInPlace remotebox --replace "\$Bin/" "\$Bin/../"
19- install -t $out/bin remotebox
02021- mkdir -p $out/share/applications
22- cp -p packagers-readme/*.desktop $out/share/applications
0023 '';
2425 meta = with stdenv.lib; {
026 description = "VirtualBox client with remote management";
27 homepage = http://remotebox.knobgoblin.org.uk/;
28 license = licenses.gpl2Plus;
29 longDescription = ''
30 VirtualBox is traditionally considered to be a virtualization solution
31- aimed at the desktop. While it is certainly possible to install
32 VirtualBox on a server, it offers few remote management features beyond
33 using the vboxmanage command line.
34 RemoteBox aims to fill this gap by providing a graphical VirtualBox
35 client which is able to manage a VirtualBox server installation.
36 '';
37 maintainers = with maintainers; [ nckx ];
38- platforms = with platforms; all;
39 };
40}
···1+{ stdenv, fetchurl, makeWrapper, perl, perlPackages }:
23+let version = "2.0"; in
4+stdenv.mkDerivation {
5 name = "remotebox-${version}";
67 src = fetchurl {
8+ url = "http://remotebox.knobgoblin.org.uk/downloads/RemoteBox-${version}.tar.bz2";
9+ sha256 = "0c73i53wdjd2m2sdgq3r3xp30irxh5z5rak2rk79yb686s6bv759";
10 };
1112+ buildInputs = with perlPackages; [ perl Glib Gtk2 Pango SOAPLite ];
13+ nativeBuildInputs = [ makeWrapper ];
1415 installPhase = ''
16+ mkdir -pv $out/bin
01718 substituteInPlace remotebox --replace "\$Bin/" "\$Bin/../"
19+ install -v -t $out/bin remotebox
20+ wrapProgram $out/bin/remotebox --prefix PERL5LIB : $PERL5LIB
2122+ cp -av docs/ share/ $out
23+24+ mkdir -pv $out/share/applications
25+ cp -pv packagers-readme/*.desktop $out/share/applications
26 '';
2728 meta = with stdenv.lib; {
29+ inherit version;
30 description = "VirtualBox client with remote management";
31 homepage = http://remotebox.knobgoblin.org.uk/;
32 license = licenses.gpl2Plus;
33 longDescription = ''
34 VirtualBox is traditionally considered to be a virtualization solution
35+ aimed at the desktop. While it is certainly possible to install
36 VirtualBox on a server, it offers few remote management features beyond
37 using the vboxmanage command line.
38 RemoteBox aims to fill this gap by providing a graphical VirtualBox
39 client which is able to manage a VirtualBox server installation.
40 '';
41 maintainers = with maintainers; [ nckx ];
42+ platforms = platforms.all;
43 };
44}
···61 # Whether building a cross-compiler for GNU/Hurd.
62 crossGNU = cross != null && cross.config == "i586-pc-gnu";
6364+ # Builds of gfortran have failed with strange errors that we cannot reproduce
65+ # (http://hydra.nixos.org/build/23951123). Our best guess is that the build
66+ # system has bugs that are exposed by compiling with multiple threads.
67+ enableParallelBuilding = !langFortran;
6869 patches = [ ]
70 ++ optional enableParallelBuilding ../parallel-bconfig.patch
···1--- a/src/zc/buildout/easy_install.py 2013-08-27 22:28:40.233718116 +0200
2+++ b/src/zc/buildout/easy_install.py 2013-10-07 00:29:31.077413935 +0200
3-@@ -508,16 +508,31 @@
4- self._dest, os.path.basename(dist.location))
56- if os.path.isdir(dist.location):
7-- # we got a directory. It must have been
8-- # obtained locally. Just copy it.
9-- shutil.copytree(dist.location, newloc)
10-+ # Replace links to garbage collected eggs in
11-+ # /nix/store
12-+ if os.path.islink(newloc):
13-+ # It seems necessary to jump through these
14-+ # hoops, otherwise we end up in an
15-+ # infinite loop because
16-+ # self._env.best_match fails to find the dist
17-+ os.remove(newloc)
18-+ dist = self._fetch(avail, tmp, self._download_cache)
19-+ os.symlink(dist.location, newloc)
20-+ newdist = pkg_resources.Distribution.from_filename(
21-+ newloc)
22-+ self._env.add(newdist)
23-+ logger.info("Updated link to %s" %dist.location)
24-+ # Symlink to the egg in /nix/store
25-+ elif not os.path.exists(newloc):
26-+ os.symlink(dist.location, newloc)
27-+ logger.info("Created link to %s" %dist.location)
28- else:
29-30-31- setuptools.archive_util.unpack_archive(
32- dist.location, newloc)
33-34-- redo_pyc(newloc)
35-+ redo_pyc(newloc)
36-37- # Getting the dist from the environment causes the
38- # distribution meta data to be read. Cloning isn't
···1--- a/src/zc/buildout/easy_install.py 2013-08-27 22:28:40.233718116 +0200
2+++ b/src/zc/buildout/easy_install.py 2013-10-07 00:29:31.077413935 +0200
3+@@ -227,6 +227,12 @@
045+ def _satisfied(self, req, source=None):
6+ dists = [dist for dist in self._env[req.project_name] if dist in req]
7++ try:
8++ dists = ([dist for dist in dists
9++ if dist.precedence == pkg_resources.DEVELOP_DIST]
10++ + [pkg_resources.get_distribution(req.project_name)])
11++ except pkg_resources.DistributionNotFound:
12++ pass
13+ if not dists:
14+ logger.debug('We have no distributions for %s that satisfies %r.',
15+ req.project_name, str(req))
0000000000000000000000
···1+{ stdenv, fetchurl, pkgconfig, libusb1 }:
2+3+stdenv.mkDerivation rec {
4+ name="dfu-util-${version}";
5+ version = "0.8";
6+7+ nativeBuildInputs = [ pkgconfig ];
8+ buildInputs = [ libusb1 ];
9+10+ src = fetchurl {
11+ url = "mirror://debian/pool/main/d/dfu-util/dfu-util_0.8.orig.tar.gz";
12+ sha256 = "0n7h08avlzin04j93m6hkq9id6hxjiiix7ff9gc2n89aw6dxxjsm";
13+ };
14+15+ meta = with stdenv.lib; {
16+ description = "Device firmware update (DFU) USB programmer";
17+ longDescription = ''
18+ dfu-util is a program that implements the host (PC) side of the USB
19+ DFU 1.0 and 1.1 (Universal Serial Bus Device Firmware Upgrade) protocol.
20+21+ DFU is intended to download and upload firmware to devices connected over
22+ USB. It ranges from small devices like micro-controller boards up to mobile
23+ phones. With dfu-util you are able to download firmware to your device or
24+ upload firmware from it.
25+ '';
26+ homepage = http://dfu-util.gnumonks.org/;
27+ license = licenses.gpl2Plus;
28+ platforms = platforms.unix;
29+ maintainers = [ maintainers.fpletz ];
30+ };
31+}
+2-4
pkgs/development/tools/misc/gdb/default.nix
···89let
1011- basename = "gdb-7.9";
1213 # Whether (cross-)building for GNU/Hurd. This is an approximation since
14 # having `stdenv ? cross' doesn't tell us if we're building `crossDrv' and
···2728 src = fetchurl {
29 url = "mirror://gnu/gdb/${basename}.tar.xz";
30- sha256 = "14l3hhsy7fmpn2dk7ivc67gnbjdhkxlq90kxijpzfa35l58mcccv";
31 };
32-33- # patches = [ ./edit-signals.patch ];
3435 # I think python is not a native input, but I leave it
36 # here while I will not need it cross building
···89let
1011+ basename = "gdb-7.9.1";
1213 # Whether (cross-)building for GNU/Hurd. This is an approximation since
14 # having `stdenv ? cross' doesn't tell us if we're building `crossDrv' and
···2728 src = fetchurl {
29 url = "mirror://gnu/gdb/${basename}.tar.xz";
30+ sha256 = "0h5sfg4ndhb8q4fxbq0hdxfjp35n6ih96f6x8yvb418s84x5976d";
31 };
003233 # I think python is not a native input, but I leave it
34 # here while I will not need it cross building
+22
pkgs/development/tools/omniorb/default.nix
···0000000000000000000000
···1+{ stdenv, fetchurl, python }:
2+stdenv.mkDerivation rec {
3+4+ name = "omniorb-${version}";
5+6+ version = "4.2.0";
7+8+ src = fetchurl rec {
9+ url = "http://sourceforge.net/projects/omniorb/files/omniORB/omniORB-${version}/omniORB-${version}.tar.bz2";
10+ sha256 = "1g58xcw4641wyisp9wscrkzaqrz0vf123dgy52qq2a3wk7y77hkl";
11+ };
12+13+ buildInputs = [ python ];
14+15+ meta = with stdenv.lib; {
16+ description = "omniORB is a robust high performance CORBA ORB for C++ and Python. It is freely available under the terms of the GNU Lesser General Public License (for the libraries), and GNU General Public License (for the tools). omniORB is largely CORBA 2.6 compliant.";
17+ homepage = "http://omniorb.sourceforge.net/";
18+ license = licenses.gpl2Plus;
19+ maintainers = with maintainers; [ smironov ];
20+ platforms = platforms.unix;
21+ };
22+}
···1+{ stdenv, fetchFromGitHub }:
23stdenv.mkDerivation rec {
4 name = "firmware-linux-nonfree-${version}";
5+ version = "2015-07-23";
67+ # This repo is built by merging the latest versions of
8+ # http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/
9+ # and
10+ # http://git.kernel.org/cgit/linux/kernel/git/iwlwifi/linux-firmware.git/
11+ # for any given date. This gives us up to date iwlwifi firmware as well as
12+ # the usual set of firmware. firmware/linux-firmware usually lags kernel releases
13+ # so iwlwifi cards will fail to load on newly released kernels.
14+ src = fetchFromGitHub {
15+ owner = "wkennington";
16+ repo = "linux-firmware";
17+ rev = "854b7f33e839ceea41034b45d6f755ea70c85486";
18+ sha256 = "1hhqvb96adk64ljf6hp5qss8fhpic28y985gbggh5p2w9bsgs5zq";
19 };
2021 preInstall = ''
···29 docdir=$out/share/doc/nixops mandir=$out/share/man
3031 mkdir -p $out/share/nix/nixops
32- cp -av nix/* $out/share/nix/nixops
3334 # Add openssh to nixops' PATH. On some platforms, e.g. CentOS and RHEL
35 # the version of openssh is causing errors when have big networks (40+)
···29 docdir=$out/share/doc/nixops mandir=$out/share/man
3031 mkdir -p $out/share/nix/nixops
32+ cp -av "nix/"* $out/share/nix/nixops
3334 # Add openssh to nixops' PATH. On some platforms, e.g. CentOS and RHEL
35 # the version of openssh is causing errors when have big networks (40+)
+5-4
pkgs/tools/package-management/nixops/unstable.nix
···26 sha256 = "01n2ykszrnqr3kqqdg1n2l8wm38yhri7r3d7b0abklsslz9dlvmy";
27 };
2829- buildInputs = [ pythonPackages.nose pythonPackages.coverage ];
3031 propagatedBuildInputs =
32 [ pythonPackages.prettytable
···43 # Backward compatibility symlink.
44 ln -s nixops $out/bin/charon
4546- make -C doc/manual install \
047 docdir=$out/share/doc/nixops mandir=$out/share/man
4849 mkdir -p $out/share/nix/nixops
50- cp -av nix/* $out/share/nix/nixops
5152 # Add openssh to nixops' PATH. On some platforms, e.g. CentOS and RHEL
53 # the version of openssh is causing errors when have big networks (40+)
54 wrapProgram $out/bin/nixops --prefix PATH : "${openssh}/bin"
55- ''; # */
5657 meta = {
58 homepage = https://github.com/NixOS/nixops;
···26 sha256 = "01n2ykszrnqr3kqqdg1n2l8wm38yhri7r3d7b0abklsslz9dlvmy";
27 };
2829+ buildInputs = [ /* libxslt */ pythonPackages.nose pythonPackages.coverage ];
3031 propagatedBuildInputs =
32 [ pythonPackages.prettytable
···43 # Backward compatibility symlink.
44 ln -s nixops $out/bin/charon
4546+ # Documentation build is currently broken. Re-try with newer version.
47+ : make -C doc/manual install nixops.1 docbookxsl=${docbook5_xsl}/xml/xsl/docbook \
48 docdir=$out/share/doc/nixops mandir=$out/share/man
4950 mkdir -p $out/share/nix/nixops
51+ cp -av "nix/"* $out/share/nix/nixops
5253 # Add openssh to nixops' PATH. On some platforms, e.g. CentOS and RHEL
54 # the version of openssh is causing errors when have big networks (40+)
55 wrapProgram $out/bin/nixops --prefix PATH : "${openssh}/bin"
56+ '';
5758 meta = {
59 homepage = https://github.com/NixOS/nixops;