Skip to content
This repository
Browse code

Merge branch 'master' into multiple-outputs

  • Loading branch information...
commit db83d9a35b09a7cc548d9b8b2ad63c1f8ca8ba28 2 parents 1a55c4b + b6519f0
Mathijs Kwik authored November 01, 2013

Showing 313 changed files with 30,561 additions and 93 deletions. Show diff stats Hide diff stats

  1. 1  .gitignore
  2. 1  .version
  3. 1  VERSION
  4. 2  doc/manual.xml
  5. 0  {maintainers/docs → doc/old}/cross.txt
  6. 0  {maintainers/docs → doc/old}/update-upstream-data.txt
  7. 29  doc/package-notes.xml
  8. 6  doc/quick-start.xml
  9. 9  {pkgs → }/lib/attrsets.nix
  10. 0  {pkgs → }/lib/composable-derivation.nix
  11. 0  {pkgs → }/lib/customisation.nix
  12. 0  {pkgs → }/lib/debug.nix
  13. 7  {pkgs → }/lib/default.nix
  14. 22  {pkgs → }/lib/licenses.nix
  15. 14  {pkgs → }/lib/lists.nix
  16. 5  {pkgs → }/lib/maintainers.nix
  17. 0  {pkgs → }/lib/meta.nix
  18. 4  {pkgs → }/lib/misc.nix
  19. 312  lib/modules.nix
  20. 120  lib/options.nix
  21. 0  {pkgs → }/lib/platforms.nix
  22. 0  {pkgs → }/lib/sources.nix
  23. 0  {pkgs → }/lib/strings-with-deps.nix
  24. 0  {pkgs → }/lib/strings.nix
  25. 4  {pkgs → }/lib/systems.nix
  26. 0  {pkgs → }/lib/tests.nix
  27. 0  {pkgs → }/lib/trivial.nix
  28. 210  lib/types.nix
  29. 27  maintainers/docs/uclibc-cross.txt
  30. 17  maintainers/scripts/eval-release.nix
  31. 1  nixos/.topmsg
  32. 18  nixos/COPYING
  33. 5  nixos/README
  34. 43  nixos/default.nix
  35. 21  nixos/doc/config-examples/basic.nix
  36. 32  nixos/doc/config-examples/closed-install-configuration.nix
  37. 27  nixos/doc/config-examples/root-on-lvm.nix
  38. 36  nixos/doc/config-examples/svn-server.nix
  39. 20  nixos/doc/config-examples/x86_64-usbstick.nix
  40. 1,515  nixos/doc/manual/configuration.xml
  41. 118  nixos/doc/manual/default.nix
  42. 853  nixos/doc/manual/development.xml
  43. 469  nixos/doc/manual/installation.xml
  44. 38  nixos/doc/manual/man-configuration.xml
  45. 110  nixos/doc/manual/man-nixos-build-vms.xml
  46. 208  nixos/doc/manual/man-nixos-generate-config.xml
  47. 78  nixos/doc/manual/man-nixos-install.xml
  48. 138  nixos/doc/manual/man-nixos-option.xml
  49. 335  nixos/doc/manual/man-nixos-rebuild.xml
  50. 31  nixos/doc/manual/man-pages.xml
  51. 62  nixos/doc/manual/manual.xml
  52. 207  nixos/doc/manual/options-to-docbook.xsl
  53. 369  nixos/doc/manual/running.xml
  54. 268  nixos/doc/manual/style.css
  55. 198  nixos/doc/manual/troubleshooting.xml
  56. 16  nixos/gui/README
  57. 36  nixos/gui/application.ini
  58. 1  nixos/gui/chrome.manifest
  59. 1  nixos/gui/chrome/chrome.manifest
  60. 137  nixos/gui/chrome/content/io.js
  61. 70  nixos/gui/chrome/content/main.js
  62. 63  nixos/gui/chrome/content/myviewer.xul
  63. 255  nixos/gui/chrome/content/nixos.js
  64. 242  nixos/gui/chrome/content/optionView.js
  65. 154  nixos/gui/components/clh.js
  66. 11  nixos/gui/defaults/preferences/myviewer-prefs.js
  67. 87  nixos/lib/build-vms.nix
  68. 6  nixos/lib/channel-expr.nix
  69. 64  nixos/lib/eval-config.nix
  70. 4  nixos/lib/from-env.nix
  71. 60  nixos/lib/make-iso9660-image.nix
  72. 91  nixos/lib/make-iso9660-image.sh
  73. 30  nixos/lib/make-squashfs.nix
  74. 38  nixos/lib/make-system-tarball.nix
  75. 58  nixos/lib/make-system-tarball.sh
  76. 8  nixos/lib/nixpkgs.nix
  77. 10  nixos/lib/qemu-flags.nix
  78. 70  nixos/lib/test-driver/Logger.pm
  79. 568  nixos/lib/test-driver/Machine.pm
  80. 135  nixos/lib/test-driver/log2html.xsl
  81. 129  nixos/lib/test-driver/logfile.css
  82. 178  nixos/lib/test-driver/test-driver.pl
  83. 30  nixos/lib/test-driver/treebits.js
  84. 249  nixos/lib/testing.nix
  85. 10  nixos/lib/utils.nix
  86. 99  nixos/maintainers/option-usages.nix
  87. 220  nixos/maintainers/scripts/ec2/create-ebs-amis.py
  88. 49  nixos/maintainers/scripts/ec2/create-s3-amis.sh
  89. 13  nixos/maintainers/scripts/ec2/ebs-creator.nix
  90. 32  nixos/modules/config/fonts/corefonts.nix
  91. 59  nixos/modules/config/fonts/fontconfig.nix
  92. 75  nixos/modules/config/fonts/fontdir.nix
  93. 49  nixos/modules/config/fonts/fonts.nix
  94. 32  nixos/modules/config/fonts/ghostscript.nix
  95. 46  nixos/modules/config/gnu.nix
  96. 87  nixos/modules/config/i18n.nix
  97. 204  nixos/modules/config/krb5.nix
  98. 246  nixos/modules/config/ldap.nix
  99. 90  nixos/modules/config/networking.nix
  100. 25  nixos/modules/config/no-x-libs.nix
  101. 63  nixos/modules/config/nsswitch.nix
  102. 112  nixos/modules/config/power-management.nix
  103. 150  nixos/modules/config/pulseaudio.nix
  104. 184  nixos/modules/config/shells-environment.nix
  105. 121  nixos/modules/config/swap.nix
  106. 69  nixos/modules/config/sysctl.nix
  107. 141  nixos/modules/config/system-path.nix
  108. 36  nixos/modules/config/timezone.nix
  109. 34  nixos/modules/config/unix-odbc-drivers.nix
  110. 325  nixos/modules/config/users-groups.nix
  111. 28  nixos/modules/hardware/all-firmware.nix
  112. 29  nixos/modules/hardware/cpu/amd-microcode.nix
  113. 29  nixos/modules/hardware/cpu/intel-microcode.nix
  114. 32  nixos/modules/hardware/network/b43.nix
  115. 3  nixos/modules/hardware/network/broadcom-43xx.nix
  116. 3  nixos/modules/hardware/network/intel-2030.nix
  117. 30  nixos/modules/hardware/network/intel-2100bg.nix
  118. 30  nixos/modules/hardware/network/intel-2200bg.nix
  119. 29  nixos/modules/hardware/network/intel-3945abg.nix
  120. 3  nixos/modules/hardware/network/intel-4965agn.nix
  121. 3  nixos/modules/hardware/network/intel-5000.nix
  122. 3  nixos/modules/hardware/network/intel-5150.nix
  123. 3  nixos/modules/hardware/network/intel-6000.nix
  124. 3  nixos/modules/hardware/network/intel-6000g2a.nix
  125. 3  nixos/modules/hardware/network/intel-6000g2b.nix
  126. 26  nixos/modules/hardware/network/ralink.nix
  127. 26  nixos/modules/hardware/network/rtl8192c.nix
  128. 9  nixos/modules/hardware/network/smc-2632w/default.nix
  129. 8  nixos/modules/hardware/network/smc-2632w/firmware/cis/SMC2632W-v1.02.cis
  130. 5  nixos/modules/hardware/network/zydas-zd1211.nix
  131. 59  nixos/modules/hardware/pcmcia.nix
  132. 15  nixos/modules/hardware/video/encoder/wis-go7007.nix
  133. 3  nixos/modules/hardware/video/radeon.nix
  134. 44  nixos/modules/installer/cd-dvd/channel.nix
  135. 37  nixos/modules/installer/cd-dvd/installation-cd-base.nix
  136. 14  nixos/modules/installer/cd-dvd/installation-cd-efi.nix
  137. 30  nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
  138. 8  nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix
  139. 11  nixos/modules/installer/cd-dvd/installation-cd-minimal.nix
  140. 8  nixos/modules/installer/cd-dvd/installation-cd-new-kernel.nix
  141. 315  nixos/modules/installer/cd-dvd/iso-image.nix
  142. 164  nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
  143. 89  nixos/modules/installer/cd-dvd/system-tarball-pc-readme.txt
  144. 164  nixos/modules/installer/cd-dvd/system-tarball-pc.nix
  145. 176  nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
  146. 92  nixos/modules/installer/cd-dvd/system-tarball.nix
  147. 13  nixos/modules/installer/scan/detected.nix
  148. 9  nixos/modules/installer/scan/not-detected.nix
  149. 22  nixos/modules/installer/tools/get-version-suffix
  150. 9  nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
  151. 57  nixos/modules/installer/tools/nixos-build-vms/nixos-build-vms.sh
  152. 49  nixos/modules/installer/tools/nixos-checkout.nix
  153. 450  nixos/modules/installer/tools/nixos-generate-config.pl
  154. 240  nixos/modules/installer/tools/nixos-install.sh
  155. 234  nixos/modules/installer/tools/nixos-option.sh
  156. 185  nixos/modules/installer/tools/nixos-rebuild.sh
  157. 2  nixos/modules/installer/tools/nixos-version.sh
  158. 109  nixos/modules/installer/tools/tools.nix
  159. 19  nixos/modules/installer/virtualbox-demo.nix
  160. 52  nixos/modules/misc/assertions.nix
  161. 15  nixos/modules/misc/check-config.nix
  162. 78  nixos/modules/misc/crashdump.nix
  163. 206  nixos/modules/misc/ids.nix
  164. 15  nixos/modules/misc/lib.nix
  165. 63  nixos/modules/misc/locate.nix
  166. 77  nixos/modules/misc/nixpkgs.nix
  167. 16  nixos/modules/misc/passthru.nix
  168. 73  nixos/modules/misc/version.nix
  169. 282  nixos/modules/module-list.nix
  170. 55  nixos/modules/profiles/all-hardware.nix
  171. 55  nixos/modules/profiles/base.nix
  172. 101  nixos/modules/profiles/clone-config.nix
  173. 16  nixos/modules/profiles/demo.nix
  174. 14  nixos/modules/profiles/graphical.nix
  175. 21  nixos/modules/profiles/headless.nix
  176. 56  nixos/modules/profiles/installation-device.nix
  177. 11  nixos/modules/profiles/minimal.nix
  178. 9  nixos/modules/profiles/qemu-guest.nix
  179. 36  nixos/modules/programs/atop.nix
  180. 217  nixos/modules/programs/bash/bash.nix
  181. 51  nixos/modules/programs/bash/command-not-found.nix
  182. 48  nixos/modules/programs/bash/command-not-found.pl
  183. 36  nixos/modules/programs/bash/inputrc
  184. 27  nixos/modules/programs/blcr.nix
  185. 77  nixos/modules/programs/environment.nix
  186. 43  nixos/modules/programs/gurobi.nix
  187. 36  nixos/modules/programs/info.nix
  188. 103  nixos/modules/programs/shadow.nix
  189. 64  nixos/modules/programs/shell.nix
  190. 75  nixos/modules/programs/ssh.nix
  191. 111  nixos/modules/programs/ssmtp.nix
  192. 174  nixos/modules/programs/venus.nix
  193. 47  nixos/modules/programs/virtualbox.nix
  194. 71  nixos/modules/programs/wvdial.nix
  195. 42  nixos/modules/programs/zsh/zinputrc
  196. 180  nixos/modules/programs/zsh/zsh.nix
  197. 120  nixos/modules/rename.nix
  198. 46  nixos/modules/security/apparmor-suid.nix
  199. 69  nixos/modules/security/apparmor.nix
  200. 26  nixos/modules/security/ca.nix
  201. 353  nixos/modules/security/pam.nix
  202. 42  nixos/modules/security/pam_usb.nix
  203. 124  nixos/modules/security/polkit.nix
  204. 42  nixos/modules/security/prey.nix
  205. 38  nixos/modules/security/rngd.nix
  206. 40  nixos/modules/security/rtkit.nix
  207. 81  nixos/modules/security/setuid-wrapper.c
  208. 126  nixos/modules/security/setuid-wrappers.nix
  209. 93  nixos/modules/security/sudo.nix
  210. 19  nixos/modules/services/amqp/activemq/ActiveMQBroker.java
  211. 131  nixos/modules/services/amqp/activemq/default.nix
  212. 94  nixos/modules/services/amqp/rabbitmq.nix
  213. 68  nixos/modules/services/audio/alsa.nix
  214. 115  nixos/modules/services/audio/fuppes.nix
  215. 155  nixos/modules/services/audio/fuppes/vfolder.cfg
  216. 92  nixos/modules/services/audio/mpd.nix
  217. 171  nixos/modules/services/backup/almir.nix
  218. 408  nixos/modules/services/backup/bacula.nix
  219. 81  nixos/modules/services/backup/mysql-backup.nix
  220. 66  nixos/modules/services/backup/postgresql-backup.nix
  221. 65  nixos/modules/services/backup/rsnapshot.nix
  222. 104  nixos/modules/services/backup/sitecopy-backup.nix
  223. 75  nixos/modules/services/databases/4store-endpoint.nix
  224. 74  nixos/modules/services/databases/4store.nix
  225. 162  nixos/modules/services/databases/firebird.nix
  226. 97  nixos/modules/services/databases/memcached.nix
  227. 130  nixos/modules/services/databases/mongodb.nix
  228. 245  nixos/modules/services/databases/mysql.nix
  229. 248  nixos/modules/services/databases/mysql55.nix
  230. 58  nixos/modules/services/databases/openldap.nix
  231. 233  nixos/modules/services/databases/postgresql.nix
  232. 224  nixos/modules/services/databases/redis.nix
  233. 98  nixos/modules/services/databases/virtuoso.nix
  234. 106  nixos/modules/services/games/ghost-one.nix
  235. 118  nixos/modules/services/hardware/acpid.nix
  236. 42  nixos/modules/services/hardware/bluetooth.nix
  237. 43  nixos/modules/services/hardware/nvidia-optimus.nix
  238. 46  nixos/modules/services/hardware/pcscd.nix
  239. 49  nixos/modules/services/hardware/pommed.nix
  240. 43  nixos/modules/services/hardware/sane.nix
  241. 95  nixos/modules/services/hardware/thinkfan.nix
  242. 240  nixos/modules/services/hardware/udev.nix
  243. 45  nixos/modules/services/hardware/udisks.nix
  244. 54  nixos/modules/services/hardware/udisks2.nix
  245. 65  nixos/modules/services/hardware/upower.nix
  246. 42  nixos/modules/services/logging/klogd.nix
  247. 231  nixos/modules/services/logging/logcheck.nix
  248. 38  nixos/modules/services/logging/logrotate.nix
  249. 161  nixos/modules/services/logging/logstash.nix
  250. 105  nixos/modules/services/logging/rsyslogd.nix
  251. 124  nixos/modules/services/logging/syslogd.nix
  252. 168  nixos/modules/services/mail/dovecot.nix
  253. 87  nixos/modules/services/mail/freepops.nix
  254. 33  nixos/modules/services/mail/mail.nix
  255. 83  nixos/modules/services/mail/opensmtpd.nix
  256. 405  nixos/modules/services/mail/postfix.nix
  257. 64  nixos/modules/services/mail/spamassassin.nix
  258. 120  nixos/modules/services/misc/autofs.nix
  259. 140  nixos/modules/services/misc/cgminer.nix
  260. 164  nixos/modules/services/misc/disnix.nix
  261. 110  nixos/modules/services/misc/felix.nix
  262. 74  nixos/modules/services/misc/folding-at-home.nix
  263. 104  nixos/modules/services/misc/gpsd.nix
  264. 41  nixos/modules/services/misc/gurobi.nix
  265. 367  nixos/modules/services/misc/nix-daemon.nix
  266. 61  nixos/modules/services/misc/nix-gc.nix
  267. 119  nixos/modules/services/misc/nixos-manual.nix
  268. 61  nixos/modules/services/misc/rogue.nix
  269. 46  nixos/modules/services/misc/svnserve.nix
  270. 129  nixos/modules/services/misc/synergy.nix
  271. 190  nixos/modules/services/monitoring/apcupsd.nix
  272. 83  nixos/modules/services/monitoring/dd-agent.nix
  273. 265  nixos/modules/services/monitoring/graphite.nix
  274. 52  nixos/modules/services/monitoring/monit.nix
  275. 215  nixos/modules/services/monitoring/munin.nix
  276. 34  nixos/modules/services/monitoring/nagios/commands.cfg
  277. 186  nixos/modules/services/monitoring/nagios/default.nix
  278. 27  nixos/modules/services/monitoring/nagios/host-templates.cfg
  279. 32  nixos/modules/services/monitoring/nagios/service-templates.cfg
  280. 11  nixos/modules/services/monitoring/nagios/timeperiods.cfg
  281. 116  nixos/modules/services/monitoring/smartd.nix
  282. 108  nixos/modules/services/monitoring/statsd.nix
  283. 133  nixos/modules/services/monitoring/systemhealth.nix
  284. 275  nixos/modules/services/monitoring/ups.nix
  285. 95  nixos/modules/services/monitoring/uptime.nix
  286. 100  nixos/modules/services/monitoring/zabbix-agent.nix
  287. 113  nixos/modules/services/monitoring/zabbix-server.nix
  288. 77  nixos/modules/services/network-filesystems/drbd.nix
  289. 147  nixos/modules/services/network-filesystems/nfsd.nix
  290. 90  nixos/modules/services/network-filesystems/openafs-client/default.nix
  291. 237  nixos/modules/services/network-filesystems/samba.nix
  292. 78  nixos/modules/services/networking/amuled.nix
  293. 144  nixos/modules/services/networking/avahi-daemon.nix
  294. 152  nixos/modules/services/networking/bind.nix
  295. 123  nixos/modules/services/networking/bitlbee.nix
  296. 118  nixos/modules/services/networking/chrony.nix
  297. 115  nixos/modules/services/networking/cntlm.nix
  298. 127  nixos/modules/services/networking/ddclient.nix
  299. 143  nixos/modules/services/networking/dhcpcd.nix
  300. 131  nixos/modules/services/networking/dhcpd.nix
  301. 70  nixos/modules/services/networking/dnsmasq.nix
  302. 137  nixos/modules/services/networking/ejabberd.nix
  303. 371  nixos/modules/services/networking/firewall.nix
  304. 84  nixos/modules/services/networking/flashpolicyd.nix
  305. 64  nixos/modules/services/networking/freenet.nix
  306. 112  nixos/modules/services/networking/git-daemon.nix
  307. 148  nixos/modules/services/networking/gnunet.nix
  308. 85  nixos/modules/services/networking/gogoclient.nix
  309. 144  nixos/modules/services/networking/gvpe.nix
  310. 87  nixos/modules/services/networking/haproxy.nix
  311. 163  nixos/modules/services/networking/hostapd.nix
  312. 88  nixos/modules/services/networking/ifplugd.nix
1  .gitignore
@@ -7,3 +7,4 @@ doc/NEWS.html
7 7
 doc/NEWS.txt
8 8
 doc/manual.html
9 9
 doc/manual.pdf
  10
+.version-suffix
1  .version
... ...
@@ -0,0 +1 @@
  1
+13.10
1  VERSION
... ...
@@ -1 +0,0 @@
1  
-1.0
2  doc/manual.xml
@@ -5,7 +5,7 @@
5 5
 
6 6
     <title>Nixpkgs Manual</title>
7 7
 
8  
-    <subtitle>Draft (Version <xi:include href="../VERSION"
  8
+    <subtitle>Draft (Version <xi:include href="../.version"
9 9
     parse="text" />)</subtitle>
10 10
 
11 11
     <author>
0  maintainers/docs/cross.txt → doc/old/cross.txt
File renamed without changes
0  maintainers/docs/update-upstream-data.txt → doc/old/update-upstream-data.txt
File renamed without changes
29  doc/package-notes.xml
@@ -106,16 +106,6 @@ $ make menuconfig ARCH=<replaceable>arch</replaceable></screen>
106 106
         </listitem>
107 107
 
108 108
         <listitem>
109  
-          <para>Make sure that
110  
-          <literal>CONFIG_FB_TILEBLITTING</literal> is <emphasis>not
111  
-          set</emphasis> (otherwise <command>fbsplash</command> won't
112  
-          work).  This option has a tendency to be enabled as a
113  
-          side-effect of other options.  If it is, investigate why
114  
-          (there's probably another option that forces it to be on)
115  
-          and fix it.</para>
116  
-        </listitem>
117  
-
118  
-        <listitem>
119 109
           <para>Copy <filename>.config</filename> over the new config
120 110
           file (e.g. <filename>config-2.6.22-i686-smp</filename>).</para>
121 111
         </listitem>
@@ -137,22 +127,9 @@ $ make menuconfig ARCH=<replaceable>arch</replaceable></screen>
137 127
     kernel modules and kernel-dependent packages listed in the
138 128
     <varname>kernelPackagesFor</varname> function in
139 129
     <filename>all-packages.nix</filename> (such as the NVIDIA drivers,
140  
-    AUFS, splashutils, etc.).  If the updated packages aren’t
141  
-    backwards compatible with older kernels, you need to keep the
142  
-    older versions and use some conditionals.  For example, new
143  
-    kernels require splashutils 1.5 while old kernel require 1.3, so
144  
-    <varname>kernelPackagesFor</varname> says:
145  
-
146  
-      <programlisting>
147  
-splashutils =
148  
-  if kernel.features ? fbSplash then splashutils_13 else
149  
-  if kernel.features ? fbConDecor then splashutils_15 else
150  
-  null;
151  
-
152  
-splashutils_13 = ...;
153  
-splashutils_15 = ...;</programlisting>
154  
-
155  
-    </para>
  130
+    AUFS, etc.).  If the updated packages aren’t backwards compatible
  131
+    with older kernels, you may need to keep the older versions
  132
+    around.</para>
156 133
   </listitem>
157 134
 
158 135
 </orderedlist>
6  doc/quick-start.xml
@@ -71,7 +71,7 @@ $ git add pkgs/development/libraries/libfoo/default.nix</screen>
71 71
 
72 72
         <listitem>
73 73
           <para>GNU Multiple Precision arithmetic library (GMP): <link
74  
-          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/default.nix"><filename>pkgs/development/libraries/gmp/default.nix</filename></link>.
  74
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/5.1.1.nix"><filename>pkgs/development/libraries/gmp/5.1.1.nix</filename></link>.
75 75
           Also done by the generic builder, but has a dependency on
76 76
           <varname>m4</varname>.</para>
77 77
         </listitem>
@@ -86,7 +86,7 @@ $ git add pkgs/development/libraries/libfoo/default.nix</screen>
86 86
 
87 87
         <listitem>
88 88
           <para>Apache HTTPD: <link
89  
-          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/http/apache-httpd/default.nix"><filename>pkgs/servers/http/apache-httpd/default.nix</filename></link>.
  89
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/http/apache-httpd/2.4.nix"><filename>pkgs/servers/http/apache-httpd/2.4.nix</filename></link>.
90 90
           A bunch of optional features, variable substitutions in the
91 91
           configure flags, a post-install hook, and miscellaneous
92 92
           hackery.</para>
@@ -105,7 +105,7 @@ $ git add pkgs/development/libraries/libfoo/default.nix</screen>
105 105
 
106 106
         <listitem>
107 107
           <para>Thunderbird: <link
108  
-          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/mailreaders/thunderbird/3.x.nix"><filename>pkgs/applications/networking/mailreaders/thunderbird/3.x.nix</filename></link>.
  108
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/mailreaders/thunderbird/default.nix"><filename>pkgs/applications/networking/mailreaders/thunderbird/default.nix</filename></link>.
109 109
           Lots of dependencies.</para>
110 110
         </listitem>
111 111
 
9  pkgs/lib/attrsets.nix → lib/attrsets.nix
@@ -29,9 +29,8 @@ rec {
29 29
      ["x" "y"] applied with some value v returns `x.y = v;' */
30 30
   setAttrByPath = attrPath: value:
31 31
     if attrPath == [] then value
32  
-    else listToAttrs [(
33  
-      nameValuePair (head attrPath) (setAttrByPath (tail attrPath) value)
34  
-    )];
  32
+    else listToAttrs
  33
+      [ { name = head attrPath; value = setAttrByPath (tail attrPath) value; } ];
35 34
 
36 35
 
37 36
   getAttrFromPath = attrPath: set:
@@ -133,7 +132,7 @@ rec {
133 132
        => { x = "x-foo"; y = "y-bar"; }
134 133
   */
135 134
   mapAttrs = f: set:
136  
-    listToAttrs (map (attr: nameValuePair attr (f attr (getAttr attr set))) (attrNames set));
  135
+    listToAttrs (map (attr: { name = attr; value = f attr (getAttr attr set); }) (attrNames set));
137 136
 
138 137
 
139 138
   /* Like `mapAttrs', but allows the name of each attribute to be
@@ -240,7 +239,7 @@ rec {
240 239
   # names, hopefully this does not affect the system because the maximal
241 240
   # laziness avoid computing twice the same expression and listToAttrs does
242 241
   # not care about duplicated attribute names.
243  
-  zipAttrsWith = f: sets: zipWithNames (concatMap attrNames sets) f sets;
  242
+  zipAttrsWith = f: sets: zipAttrsWithNames (concatMap attrNames sets) f sets;
244 243
 
245 244
   zipAttrs = zipAttrsWith (name: values: values);
246 245
 
0  pkgs/lib/composable-derivation.nix → lib/composable-derivation.nix
File renamed without changes
0  pkgs/lib/customisation.nix → lib/customisation.nix
File renamed without changes
0  pkgs/lib/debug.nix → lib/debug.nix
File renamed without changes
7  pkgs/lib/default.nix → lib/default.nix
@@ -8,7 +8,6 @@ let
8 8
   sources = import ./sources.nix;
9 9
   modules = import ./modules.nix;
10 10
   options = import ./options.nix;
11  
-  properties = import ./properties.nix;
12 11
   types = import ./types.nix;
13 12
   meta = import ./meta.nix;
14 13
   debug = import ./debug.nix;
@@ -21,11 +20,13 @@ let
21 20
 
22 21
 in
23 22
   { inherit trivial lists strings stringsWithDeps attrsets sources options
24  
-      properties modules types meta debug maintainers licenses platforms systems;
  23
+      modules types meta debug maintainers licenses platforms systems;
  24
+    # Pull in some builtins not included elsewhere.
  25
+    inherit (builtins) pathExists readFile;
25 26
   }
26 27
   # !!! don't include everything at top-level; perhaps only the most
27 28
   # commonly used functions.
28 29
   // trivial // lists // strings // stringsWithDeps // attrsets // sources
29  
-  // properties // options // types // meta // debug // misc // modules
  30
+  // options // types // meta // debug // misc // modules
30 31
   // systems
31 32
   // customisation
22  pkgs/lib/licenses.nix → lib/licenses.nix
@@ -34,11 +34,9 @@
34 34
     url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/licenses/AMD-ADL?revision=1.1";
35 35
   };
36 36
 
37  
-  apsl20 = {
38  
-    shortName = "APSL 2.0";
39  
-    fullName = "Apple Public Source License 2.0";
40  
-    url = http://opensource.org/licenses/APSL-2.0;
41  
-  };
  37
+  # Apple Public Source License 2.0;
  38
+  # http://opensource.org/licenses/APSL-2.0
  39
+  apsl20 = "APSL 2.0";
42 40
 
43 41
   asl20 = {
44 42
     shortName = "ASL2.0";
@@ -96,11 +94,9 @@
96 94
     url = http://www.mysql.com/about/legal/licensing/foss-exception;
97 95
   };
98 96
 
99  
-  gpl2Plus = {
100  
-    shortName = "GPLv2+";
101  
-    fullName = "GNU General Public License version 2 or later";
102  
-    url = http://www.gnu.org/licenses/old-licenses/gpl-2.0.html;
103  
-  };
  97
+  # GNU General Public License version 2 or later;
  98
+  # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  99
+  gpl2Plus = "GPLv2+";
104 100
 
105 101
   gpl3 = {
106 102
     shortName = "GPLv3";
@@ -190,6 +186,12 @@
190 186
     url = http://www.mozilla.org/MPL/MPL-1.1.html;
191 187
   };
192 188
 
  189
+  mpl20 = {
  190
+    shortName = "MPL2.0";
  191
+    fullName = "Mozilla Public License version 2.0";
  192
+    url = https://www.mozilla.org/MPL/2.0;
  193
+  };
  194
+
193 195
   openssl = {
194 196
     shortName = "openssl";
195 197
     fullName = "OpenSSL license";
14  pkgs/lib/lists.nix → lib/lists.nix
... ...
@@ -1,14 +1,14 @@
1 1
 # General list operations.
2 2
 let
  3
+
3 4
   inherit (import ./trivial.nix) deepSeq;
4 5
 
5 6
   inc = builtins.add 1;
6 7
 
7 8
   dec = n: builtins.sub n 1;
8 9
 
9  
-  inherit (builtins) elemAt;
10 10
 in rec {
11  
-  inherit (builtins) head tail length isList add sub lessThan;
  11
+  inherit (builtins) head tail length isList add sub lessThan elemAt;
12 12
 
13 13
 
14 14
   # Create a list consisting of a single element.  `singleton x' is
@@ -118,6 +118,11 @@ in rec {
118 118
   all = pred: fold (x: y: if pred x then y else false) true;
119 119
 
120 120
 
  121
+  # Count how many times function `pred' returns true for the elements
  122
+  # of `list'.
  123
+  count = pred: fold (x: c: if pred x then inc c else c) 0;
  124
+
  125
+
121 126
   # Return a singleton list or an empty list, depending on a boolean
122 127
   # value.  Useful when building lists with optional elements
123 128
   # (e.g. `++ optional (system == "i686-linux") flashplayer').
@@ -165,10 +170,11 @@ in rec {
165 170
 
166 171
   zipLists = zipListsWith (fst: snd: { inherit fst snd; });
167 172
 
168  
-  
169  
-  # Reverse the order of the elements of a list.
  173
+
  174
+  # Reverse the order of the elements of a list.  FIXME: O(n^2)!
170 175
   reverseList = fold (e: acc: acc ++ [ e ]) [];
171 176
 
  177
+
172 178
   # Sort a list based on a comparator function which compares two
173 179
   # elements and returns true if the first argument is strictly below
174 180
   # the second argument.  The returned list is sorted in an increasing
5  pkgs/lib/maintainers.nix → lib/maintainers.nix
@@ -5,6 +5,7 @@
5 5
      alphabetically sorted.  */
6 6
 
7 7
   aforemny = "Alexander Foremny <alexanderforemny@googlemail.com>";
  8
+  algorith = "Dries Van Daele <dries_van_daele@telenet.be>";
8 9
   all = "Nix Committers <nix-commits@lists.science.uu.nl>";
9 10
   amiddelk = "Arie Middelkoop <amiddelk@gmail.com>";
10 11
   amorsillo = "Andrew Morsillo <andrew.morsillo@gmail.com>";
@@ -19,6 +20,7 @@
19 20
   bodil = "Bodil Stokke <nix@bodil.org>";
20 21
   chaoflow = "Florian Friesdorf <flo@chaoflow.net>";
21 22
   coconnor = "Corey O'Connor <coreyoconnor@gmail.com>";
  23
+  coroa = "Jonas Hörsch <jonas@chaoflow.net>";
22 24
   edwtjo = "Edward Tjörnhammar <ed@cflags.cc>";
23 25
   eelco = "Eelco Dolstra <eelco.dolstra@logicblox.com>";
24 26
   ertes = "Ertugrul Söylemez <es@ertes.de>";
@@ -41,6 +43,7 @@
41 43
   phreedom = "Evgeny Egorochkin <phreedom@yandex.ru>";
42 44
   pierron = "Nicolas B. Pierron <nixos@nbp.name>";
43 45
   piotr = "Piotr Pietraszkiewicz <ppietrasa@gmail.com>";
  46
+  pSub = "Pascal Wittmann <mail@pascal-wittmann.de>";
44 47
   qknight = "Joachim Schiele <js@lastlog.de>";
45 48
   raskin = "Michael Raskin <7c6f434c@mail.ru>";
46 49
   rickynils = "Rickard Nilsson <rickynils@gmail.com>";
@@ -56,6 +59,8 @@
56 59
   vcunat = "Vladimír Čunát <vcunat@gmail.com>";
57 60
   viric = "Lluís Batlle i Rossell <viric@viric.name>";
58 61
   vizanto = "Danny Wilson <danny@prime.vc>";
  62
+  vlstill = "Vladimír Štill <xstill@fi.muni.cz>";
59 63
   winden = "Antonio Vargas Gonzalez <windenntw@gmail.com>";
60 64
   z77z = "Marco Maggesi <maggesi@math.unifi.it>";
  65
+  zef = "Zef Hemel <zef@zef.me>";
61 66
 }
0  pkgs/lib/meta.nix → lib/meta.nix
File renamed without changes
4  pkgs/lib/misc.nix → lib/misc.nix
@@ -206,9 +206,7 @@ rec {
206 206
     in
207 207
       work startSet [] [];
208 208
 
209  
-  genericClosure =
210  
-    if builtins ? genericClosure then builtins.genericClosure
211  
-    else lazyGenericClosure;
  209
+  genericClosure = builtins.genericClosure or lazyGenericClosure;
212 210
 
213 211
   innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else 
214 212
         innerModifySumArgs f x (a // b);
312  lib/modules.nix
... ...
@@ -0,0 +1,312 @@
  1
+with import ./lists.nix;
  2
+with import ./trivial.nix;
  3
+with import ./attrsets.nix;
  4
+with import ./options.nix;
  5
+with import ./debug.nix;
  6
+with import ./types.nix;
  7
+
  8
+rec {
  9
+
  10
+  /* Evaluate a set of modules.  The result is a set of two
  11
+     attributes: ‘options’: the nested set of all option declarations,
  12
+     and ‘config’: the nested set of all option values. */
  13
+  evalModules = { modules, prefix ? [], args ? {}, check ? true }:
  14
+    let
  15
+      args' = args // result;
  16
+      closed = closeModules modules args';
  17
+      # Note: the list of modules is reversed to maintain backward
  18
+      # compatibility with the old module system.  Not sure if this is
  19
+      # the most sensible policy.
  20
+      options = mergeModules prefix (reverseList closed);
  21
+      # Traverse options and extract the option values into the final
  22
+      # config set.  At the same time, check whether all option
  23
+      # definitions have matching declarations.
  24
+      config = yieldConfig prefix options;
  25
+      yieldConfig = prefix: set:
  26
+        let res = removeAttrs (mapAttrs (n: v:
  27
+          if isOption v then v.value
  28
+          else yieldConfig (prefix ++ [n]) v) set) ["_definedNames"];
  29
+        in
  30
+        if check && set ? _definedNames then
  31
+          fold (m: res:
  32
+            fold (name: res:
  33
+              if hasAttr name set then res else throw "The option `${showOption (prefix ++ [name])}' defined in `${m.file}' does not exist.")
  34
+              res m.names)
  35
+            res set._definedNames
  36
+        else
  37
+          res;
  38
+      result = { inherit options config; };
  39
+    in result;
  40
+
  41
+  /* Close a set of modules under the ‘imports’ relation. */
  42
+  closeModules = modules: args:
  43
+    let
  44
+      toClosureList = file: parentKey: imap (n: x:
  45
+        if isAttrs x || builtins.isFunction x then
  46
+          unifyModuleSyntax file "${parentKey}:anon-${toString n}" (applyIfFunction x args)
  47
+        else
  48
+          unifyModuleSyntax (toString x) (toString x) (applyIfFunction (import x) args));
  49
+    in
  50
+      builtins.genericClosure {
  51
+        startSet = toClosureList unknownModule "" modules;
  52
+        operator = m: toClosureList m.file m.key m.imports;
  53
+      };
  54
+
  55
+  /* Massage a module into canonical form, that is, a set consisting
  56
+     of ‘options’, ‘config’ and ‘imports’ attributes. */
  57
+  unifyModuleSyntax = file: key: m:
  58
+    if m ? config || m ? options then
  59
+      let badAttrs = removeAttrs m ["imports" "options" "config" "key" "_file"]; in
  60
+      if badAttrs != {} then
  61
+        throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'."
  62
+      else
  63
+        { file = m._file or file;
  64
+          key = toString m.key or key;
  65
+          imports = m.imports or [];
  66
+          options = m.options or {};
  67
+          config = m.config or {};
  68
+        }
  69
+    else
  70
+      { file = m._file or file;
  71
+        key = toString m.key or key;
  72
+        imports = m.require or [] ++ m.imports or [];
  73
+        options = {};
  74
+        config = removeAttrs m ["key" "_file" "require" "imports"];
  75
+      };
  76
+
  77
+  applyIfFunction = f: arg: if builtins.isFunction f then f arg else f;
  78
+
  79
+  /* Merge a list of modules.  This will recurse over the option
  80
+     declarations in all modules, combining them into a single set.
  81
+     At the same time, for each option declaration, it will merge the
  82
+     corresponding option definitions in all machines, returning them
  83
+     in the ‘value’ attribute of each option. */
  84
+  mergeModules = prefix: modules:
  85
+    mergeModules' prefix modules
  86
+      (concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules);
  87
+
  88
+  mergeModules' = prefix: options: configs:
  89
+    listToAttrs (map (name: {
  90
+      # We're descending into attribute ‘name’.
  91
+      inherit name;
  92
+      value =
  93
+        let
  94
+          loc = prefix ++ [name];
  95
+          # Get all submodules that declare ‘name’.
  96
+          decls = concatLists (map (m:
  97
+            if hasAttr name m.options
  98
+              then [ { inherit (m) file; options = getAttr name m.options; } ]
  99
+              else []
  100
+            ) options);
  101
+          # Get all submodules that define ‘name’.
  102
+          defns = concatLists (map (m:
  103
+            if hasAttr name m.config
  104
+              then map (config: { inherit (m) file; inherit config; })
  105
+                (pushDownProperties (getAttr name m.config))
  106
+              else []
  107
+            ) configs);
  108
+          nrOptions = count (m: isOption m.options) decls;
  109
+          # Process mkMerge and mkIf properties.
  110
+          defns' = concatMap (m:
  111
+            if hasAttr name m.config
  112
+              then map (m': { inherit (m) file; value = m'; }) (dischargeProperties (getAttr name m.config))
  113
+              else []
  114
+            ) configs;
  115
+        in
  116
+          if nrOptions == length decls then
  117
+            let opt = fixupOptionType loc (mergeOptionDecls loc decls);
  118
+            in evalOptionValue loc opt defns'
  119
+          else if nrOptions != 0 then
  120
+            let
  121
+              firstOption = findFirst (m: isOption m.options) "" decls;
  122
+              firstNonOption = findFirst (m: !isOption m.options) "" decls;
  123
+            in
  124
+              throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'."
  125
+          else
  126
+            mergeModules' loc decls defns;
  127
+    }) (concatMap (m: attrNames m.options) options))
  128
+    // { _definedNames = map (m: { inherit (m) file; names = attrNames m.config; }) configs; };
  129
+
  130
+  /* Merge multiple option declarations into a single declaration.  In
  131
+     general, there should be only one declaration of each option.
  132
+     The exception is the ‘options’ attribute, which specifies
  133
+     sub-options.  These can be specified multiple times to allow one
  134
+     module to add sub-options to an option declared somewhere else
  135
+     (e.g. multiple modules define sub-options for ‘fileSystems’). */
  136
+  mergeOptionDecls = loc: opts:
  137
+    fold (opt: res:
  138
+      if opt.options ? default && res ? default ||
  139
+         opt.options ? example && res ? example ||
  140
+         opt.options ? description && res ? description ||
  141
+         opt.options ? apply && res ? apply ||
  142
+         opt.options ? type && res ? type
  143
+      then
  144
+        throw "The option `${showOption loc}' in `${opt.file}' is already declared in ${showFiles res.declarations}."
  145
+      else
  146
+        opt.options // res //
  147
+          { declarations = [opt.file] ++ res.declarations;
  148
+            options = if opt.options ? options then [(toList opt.options.options ++ res.options)] else [];
  149
+          }
  150
+    ) { inherit loc; declarations = []; options = []; } opts;
  151
+
  152
+  /* Merge all the definitions of an option to produce the final
  153
+     config value. */
  154
+  evalOptionValue = loc: opt: defs:
  155
+    let
  156
+      # Process mkOverride properties, adding in the default
  157
+      # value specified in the option declaration (if any).
  158
+      defsFinal = filterOverrides
  159
+        ((if opt ? default then [{ file = head opt.declarations; value = mkOptionDefault opt.default; }] else []) ++ defs);
  160
+      files = map (def: def.file) defsFinal;
  161
+      # Type-check the remaining definitions, and merge them if
  162
+      # possible.
  163
+      merged =
  164
+        if defsFinal == [] then
  165
+          throw "The option `${showOption loc}' is used but not defined."
  166
+        else
  167
+          fold (def: res:
  168
+            if opt.type.check def.value then res
  169
+            else throw "The option value `${showOption loc}' in `${def.file}' is not a ${opt.type.name}.")
  170
+            (opt.type.merge loc defsFinal) defsFinal;
  171
+      # Finally, apply the ‘apply’ function to the merged
  172
+      # value.  This allows options to yield a value computed
  173
+      # from the definitions.
  174
+      value = (opt.apply or id) merged;
  175
+    in opt //
  176
+      { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
  177
+        definitions = map (def: def.value) defsFinal;
  178
+        isDefined = defsFinal != [];
  179
+        inherit files;
  180
+      };
  181
+
  182
+  /* Given a config set, expand mkMerge properties, and push down the
  183
+     mkIf properties into the children.  The result is a list of
  184
+     config sets that do not have properties at top-level.  For
  185
+     example,
  186
+
  187
+       mkMerge [ { boot = set1; } (mkIf cond { boot = set2; services = set3; }) ]
  188
+
  189
+     is transformed into
  190
+
  191
+       [ { boot = set1; } { boot = mkIf cond set2; services mkIf cond set3; } ].
  192
+
  193
+     This transform is the critical step that allows mkIf conditions
  194
+     to refer to the full configuration without creating an infinite
  195
+     recursion.
  196
+  */
  197
+  pushDownProperties = cfg:
  198
+    if cfg._type or "" == "merge" then
  199
+      concatMap pushDownProperties cfg.contents
  200
+    else if cfg._type or "" == "if" then
  201
+      map (mapAttrs (n: v: mkIf cfg.condition v)) (pushDownProperties cfg.content)
  202
+    else if cfg._type or "" == "override" then
  203
+      map (mapAttrs (n: v: mkOverride cfg.priority v)) (pushDownProperties cfg.content)
  204
+    else
  205
+      [ cfg ];
  206
+
  207
+  /* Given a config value, expand mkMerge properties, and discharge
  208
+     any mkIf conditions.  That is, this is the place where mkIf
  209
+     conditions are actually evaluated.  The result is a list of
  210
+     config values.  For example, ‘mkIf false x’ yields ‘[]’,
  211
+     ‘mkIf true x’ yields ‘[x]’, and
  212
+
  213
+       mkMerge [ 1 (mkIf true 2) (mkIf true (mkIf false 3)) ]
  214
+
  215
+     yields ‘[ 1 2 ]’.
  216
+  */
  217
+  dischargeProperties = def:
  218
+    if def._type or "" == "merge" then
  219
+      concatMap dischargeProperties def.contents
  220
+    else if def._type or "" == "if" then
  221
+      if def.condition then
  222
+        dischargeProperties def.content
  223
+      else
  224
+        [ ]
  225
+    else
  226
+      [ def ];
  227
+
  228
+  /* Given a list of config values, process the mkOverride properties,
  229
+     that is, return the values that have the highest (that is,
  230
+     numerically lowest) priority, and strip the mkOverride
  231
+     properties.  For example,
  232
+
  233
+       [ { file = "/1"; value = mkOverride 10 "a"; }
  234
+         { file = "/2"; value = mkOverride 20 "b"; }
  235
+         { file = "/3"; value = "z"; }
  236
+         { file = "/4"; value = mkOverride 10 "d"; }
  237
+       ]
  238
+
  239
+     yields
  240
+
  241
+       [ { file = "/1"; value = "a"; }
  242
+         { file = "/4"; value = "d"; }
  243
+       ]
  244
+
  245
+     Note that "z" has the default priority 100.
  246
+  */
  247
+  filterOverrides = defs:
  248
+    let
  249
+      defaultPrio = 100;
  250
+      getPrio = def: if def.value._type or "" == "override" then def.value.priority else defaultPrio;
  251
+      min = x: y: if builtins.lessThan x y then x else y;
  252
+      highestPrio = fold (def: prio: min (getPrio def) prio) 9999 defs;
  253
+      strip = def: if def.value._type or "" == "override" then def // { value = def.value.content; } else def;
  254
+    in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
  255
+
  256
+  /* Hack for backward compatibility: convert options of type
  257
+     optionSet to configOf.  FIXME: remove eventually. */
  258
+  fixupOptionType = loc: opt:
  259
+    let
  260
+      options' = opt.options or
  261
+        (throw "Option `${showOption loc'}' has type optionSet but has no option attribute.");
  262
+      coerce = x:
  263
+        if builtins.isFunction x then x
  264
+        else { config, ... }: { options = x; };
  265
+      options = map coerce (flatten options');
  266
+      f = tp:
  267
+        if tp.name == "option set" then types.submodule options
  268
+        else if tp.name == "attribute set of option sets" then types.attrsOf (types.submodule options)
  269
+        else if tp.name == "list or attribute set of option sets" then types.loaOf (types.submodule options)
  270
+        else if tp.name == "list of option sets" then types.listOf (types.submodule options)
  271
+        else if tp.name == "null or option set" then types.nullOr (types.submodule options)
  272
+        else tp;
  273
+    in opt // { type = f (opt.type or types.unspecified); };
  274
+
  275
+
  276
+  /* Properties. */
  277
+
  278
+  mkIf = condition: content:
  279
+    { _type = "if";
  280
+      inherit condition content;
  281
+    };
  282
+
  283
+  mkAssert = assertion: message: content:
  284
+    mkIf
  285
+      (if assertion then true else throw "\nFailed assertion: ${message}")
  286
+      content;
  287
+
  288
+  mkMerge = contents:
  289
+    { _type = "merge";
  290
+      inherit contents;
  291
+    };
  292
+
  293
+  mkOverride = priority: content:
  294
+    { _type = "override";
  295
+      inherit priority content;
  296
+    };
  297
+
  298
+  mkOptionDefault = mkOverride 1001; # priority of option defaults
  299
+  mkDefault = mkOverride 1000; # used in config sections of non-user modules to set a default
  300
+  mkForce = mkOverride 50;
  301
+  mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’
  302
+
  303
+  mkFixStrictness = id; # obsolete, no-op
  304
+
  305
+  # FIXME: Add mkOrder back in. It's not currently used anywhere in
  306
+  # NixOS, but it should be useful.
  307
+
  308
+
  309
+  /* Compatibility. */
  310
+  fixMergeModules = modules: args: evalModules { inherit modules args; check = false; };
  311
+
  312
+}
120  lib/options.nix
... ...
@@ -0,0 +1,120 @@
  1
+# Nixpkgs/NixOS option handling.
  2
+
  3
+let lib = import ./default.nix; in
  4
+
  5
+with import ./trivial.nix;
  6
+with import ./lists.nix;
  7
+with import ./misc.nix;
  8
+with import ./attrsets.nix;
  9
+with import ./strings.nix;
  10
+
  11
+rec {
  12
+
  13
+  isOption = lib.isType "option";
  14
+  mkOption =
  15
+    { default ? null # Default value used when no definition is given in the configuration.
  16
+    , defaultText ? null # Textual representation of the default, for in the manual.
  17
+    , example ? null # Example value used in the manual.
  18
+    , description ? null # String describing the option.
  19
+    , type ? null # Option type, providing type-checking and value merging.
  20
+    , apply ? null # Function that converts the option value to something else.
  21
+    , internal ? null # Whether the option is for NixOS developers only.
  22
+    , visible ? null # Whether the option shows up in the manual.
  23
+    , options ? null # Obsolete, used by types.optionSet.
  24
+    } @ attrs:
  25
+    attrs // { _type = "option"; };
  26
+
  27
+  mkEnableOption = name: mkOption {
  28
+    default = false;
  29
+    example = true;
  30
+    description = "Whether to enable ${name}.";
  31
+    type = lib.types.bool;
  32
+  };
  33
+
  34
+  mergeDefaultOption = loc: defs:
  35
+    let list = getValues defs; in
  36
+    if length list == 1 then head list
  37
+    else if all builtins.isFunction list then x: mergeDefaultOption loc (map (f: f x) list)
  38
+    else if all isList list then concatLists list
  39
+    else if all isAttrs list then fold lib.mergeAttrs {} list
  40
+    else if all builtins.isBool list then fold lib.or false list
  41
+    else if all builtins.isString list then lib.concatStrings list
  42
+    else if all builtins.isInt list && all (x: x == head list) list then head list
  43
+    else throw "Cannot merge definitions of `${showOption loc}' given in ${showFiles (getFiles defs)}.";
  44
+
  45
+  /* Obsolete, will remove soon.  Specify an option type or apply
  46
+     function instead.  */
  47
+  mergeTypedOption = typeName: predicate: merge: loc: list:
  48
+    let list' = map (x: x.value) list; in
  49
+    if all predicate list then merge list'
  50
+    else throw "Expected a ${typeName}.";
  51
+
  52
+  mergeEnableOption = mergeTypedOption "boolean"
  53
+    (x: true == x || false == x) (fold lib.or false);
  54
+
  55
+  mergeListOption = mergeTypedOption "list" isList concatLists;
  56
+
  57
+  mergeStringOption = mergeTypedOption "string" builtins.isString lib.concatStrings;
  58
+
  59
+  mergeOneOption = loc: defs:
  60
+    if defs == [] then abort "This case should never happen."
  61
+    else if length defs != 1 then
  62
+      throw "The unique option `${showOption loc}' is defined multiple times, in ${showFiles (getFiles defs)}."
  63
+    else (head defs).value;
  64
+
  65
+  getValues = map (x: x.value);
  66
+  getFiles = map (x: x.file);
  67
+
  68
+
  69
+  # Generate documentation template from the list of option declaration like
  70
+  # the set generated with filterOptionSets.
  71
+  optionAttrSetToDocList = optionAttrSetToDocList' [];
  72
+
  73
+  optionAttrSetToDocList' = prefix: options:
  74
+    fold (opt: rest:
  75
+      let
  76
+        docOption = rec {
  77
+          name = showOption opt.loc;
  78
+          description = opt.description or (throw "Option `${name}' has no description.");
  79
+          declarations = filter (x: x != unknownModule) opt.declarations;
  80
+          internal = opt.internal or false;
  81
+          visible = opt.visible or true;
  82
+        }
  83
+        // optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; }
  84
+        // optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; }
  85
+        // optionalAttrs (opt ? defaultText) { default = opt.defaultText; };
  86
+
  87
+        subOptions =
  88
+          let ss = opt.type.getSubOptions opt.loc;
  89
+          in if ss != {} then optionAttrSetToDocList' opt.loc ss else [];
  90
+      in
  91
+        # FIXME: expensive, O(n^2)
  92
+        [ docOption ] ++ subOptions ++ rest) [] (collect isOption options);
  93
+
  94
+
  95
+  /* This function recursively removes all derivation attributes from
  96
+     `x' except for the `name' attribute.  This is to make the
  97
+     generation of `options.xml' much more efficient: the XML
  98
+     representation of derivations is very large (on the order of
  99
+     megabytes) and is not actually used by the manual generator. */
  100
+  scrubOptionValue = x:
  101
+    if isDerivation x then
  102
+      { type = "derivation"; drvPath = x.name; outPath = x.name; name = x.name; }
  103
+    else if isList x then map scrubOptionValue x
  104
+    else if isAttrs x then mapAttrs (n: v: scrubOptionValue v) (removeAttrs x ["_args"])
  105
+    else x;
  106
+
  107
+
  108
+  /* For use in the ‘example’ option attribute.  It causes the given
  109
+     text to be included verbatim in documentation.  This is necessary
  110
+     for example values that are not simple values, e.g.,
  111
+     functions. */
  112
+  literalExample = text: { _type = "literalExample"; inherit text; };
  113
+
  114
+
  115
+  /* Helper functions. */
  116
+  showOption = concatStringsSep ".";
  117
+  showFiles = files: concatStringsSep " and " (map (f: "`${f}'") files);
  118
+  unknownModule = "<unknown-file>";
  119
+
  120
+}
0  pkgs/lib/platforms.nix → lib/platforms.nix
File renamed without changes
0  pkgs/lib/sources.nix → lib/sources.nix
File renamed without changes
0  pkgs/lib/strings-with-deps.nix → lib/strings-with-deps.nix
File renamed without changes
0  pkgs/lib/strings.nix → lib/strings.nix
File renamed without changes
4  pkgs/lib/systems.nix → lib/systems.nix
@@ -22,7 +22,7 @@ rec {
22 22
   };
23 23
 
24 24
 
25  
-  isCpuType = x: typeOf x == "cpu-type"
  25
+  isCpuType = x: isType "cpu-type" x
26 26
     && elem x.bits [8 16 32 64 128]
27 27
     && (builtins.lessThan 8 x.bits -> isSignificantByte x.significantByte);
28 28
 
@@ -69,7 +69,7 @@ rec {
69 69
   };
70 70
 
71 71
 
72  
-  isSystem = x: typeOf x == "system"
  72
+  isSystem = x: isType "system" x
73 73
     && isCpuType x.cpu
74 74
     && isArchitecture x.arch
75 75
     && isKernel x.kernel;
0  pkgs/lib/tests.nix → lib/tests.nix
File renamed without changes
0  pkgs/lib/trivial.nix → lib/trivial.nix
File renamed without changes
210  lib/types.nix
... ...
@@ -0,0 +1,210 @@
  1
+# Definitions related to run-time type checking.  Used in particular
  2
+# to type-check NixOS configurations.
  3
+
  4
+with import ./lists.nix;
  5
+with import ./attrsets.nix;
  6
+with import ./options.nix;
  7
+with import ./trivial.nix;
  8
+with import ./strings.nix;
  9
+
  10
+rec {
  11
+
  12
+  isType = type: x: (x._type or "") == type;
  13
+  typeOf = x: x._type or "";
  14
+
  15
+  setType = typeName: value: value // {
  16
+    _type = typeName;
  17
+  };
  18
+
  19
+
  20
+  isOptionType = isType "option-type";
  21
+  mkOptionType =
  22
+    { # Human-readable representation of the type.
  23
+      name
  24
+    , # Function applied to each definition that should return true if
  25
+      # its type-correct, false otherwise.
  26
+      check ? (x: true)
  27
+    , # Merge a list of definitions together into a single value.
  28
+      # This function is called with two arguments: the location of
  29
+      # the option in the configuration as a list of strings
  30
+      # (e.g. ["boot" "loader "grub" "enable"]), and a list of
  31
+      # definition values and locations (e.g. [ { file = "/foo.nix";
  32
+      # value = 1; } { file = "/bar.nix"; value = 2 } ]).
  33
+      merge ? mergeDefaultOption
  34
+    , # Return a flat list of sub-options.  Used to generate
  35
+      # documentation.
  36
+      getSubOptions ? prefix: {}
  37
+    }:
  38
+    { _type = "option-type";
  39
+      inherit name check merge getSubOptions;
  40
+    };
  41
+
  42
+
  43
+  types = rec {
  44
+
  45
+    unspecified = mkOptionType {
  46
+      name = "unspecified";
  47
+    };
  48
+
  49
+    bool = mkOptionType {
  50
+      name = "boolean";
  51
+      check = builtins.isBool;
  52
+      merge = loc: fold (x: y: x.value || y) false;
  53
+    };
  54
+
  55
+    int = mkOptionType {
  56
+      name = "integer";
  57
+      check = builtins.isInt;
  58
+      merge = mergeOneOption;
  59
+    };
  60
+
  61
+    str = mkOptionType {
  62
+      name = "string";
  63
+      check = builtins.isString;
  64
+      merge = mergeOneOption;
  65
+    };
  66
+
  67
+    # Merge multiple definitions by concatenating them (with the given
  68
+    # separator between the values).
  69
+    separatedString = sep: mkOptionType {
  70
+      name = "string";
  71
+      check = builtins.isString;
  72
+      merge = loc: defs: concatStringsSep sep (getValues defs);
  73
+    };
  74
+
  75
+    lines = separatedString "\n";
  76
+    commas = separatedString ",";
  77
+    envVar = separatedString ":";
  78
+
  79
+    # Deprecated; should not be used because it quietly concatenates
  80
+    # strings, which is usually not what you want.
  81
+    string = separatedString "";
  82
+
  83
+    attrs = mkOptionType {
  84
+      name = "attribute set";
  85
+      check = isAttrs;
  86
+      merge = loc: fold (def: mergeAttrs def.value) {};
  87
+    };
  88
+
  89
+    # derivation is a reserved keyword.
  90
+    package = mkOptionType {
  91
+      name = "derivation";
  92
+      check = isDerivation;
  93
+      merge = mergeOneOption;
  94
+    };
  95
+
  96
+    path = mkOptionType {
  97
+      name = "path";
  98
+      # Hacky: there is no ‘isPath’ primop.
  99
+      check = x: builtins.unsafeDiscardStringContext (builtins.substring 0 1 (toString x)) == "/";
  100
+      merge = mergeOneOption;
  101
+    };
  102
+
  103
+    # drop this in the future:
  104
+    list = builtins.trace "`types.list' is deprecated; use `types.listOf' instead" types.listOf;
  105
+
  106
+    listOf = elemType: mkOptionType {
  107
+      name = "list of ${elemType.name}s";
  108
+      check = value: isList value && all elemType.check value;
  109
+      merge = loc: defs:
  110
+        concatLists (imap (n: def: imap (m: def':
  111
+          elemType.merge (loc ++ ["[${toString n}-${toString m}]"])
  112
+            [{ inherit (def) file; value = def'; }]) def.value) defs);
  113
+      getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]);
  114
+    };
  115
+
  116
+    attrsOf = elemType: mkOptionType {
  117
+      name = "attribute set of ${elemType.name}s";
  118
+      check = x: isAttrs x && all elemType.check (attrValues x);
  119
+      merge = loc: defs:
  120
+        zipAttrsWith (name: elemType.merge (loc ++ [name]))
  121
+          # Push down position info.
  122
+          (map (def: listToAttrs (mapAttrsToList (n: def':
  123
+            { name = n; value = { inherit (def) file; value = def'; }; }) def.value)) defs);
  124
+      getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name>"]);
  125
+    };
  126
+
  127
+    # List or attribute set of ...
  128
+    loaOf = elemType:
  129
+      let
  130
+        convertIfList = defIdx: def:
  131
+          if isList def.value then
  132
+            { inherit (def) file;
  133
+              value = listToAttrs (
  134
+                imap (elemIdx: elem:
  135
+                  { name = "unnamed-${toString defIdx}.${toString elemIdx}";
  136
+                    value = elem;
  137
+                  }) def.value);
  138
+            }
  139
+          else
  140
+            def;
  141
+        listOnly = listOf elemType;
  142
+        attrOnly = attrsOf elemType;
  143
+      in mkOptionType {
  144
+        name = "list or attribute set of ${elemType.name}s";
  145
+        check = x:
  146
+          if isList x       then listOnly.check x
  147
+          else if isAttrs x then attrOnly.check x
  148
+          else false;
  149
+        merge = loc: defs: attrOnly.merge loc (imap convertIfList defs);
  150
+        getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name?>"]);
  151
+      };
  152
+
  153
+    uniq = elemType: mkOptionType {
  154
+      inherit (elemType) name check;
  155
+      merge = mergeOneOption;
  156
+      getSubOptions = elemType.getSubOptions;
  157
+    };
  158
+
  159
+    nullOr = elemType: mkOptionType {
  160
+      name = "null or ${elemType.name}";
  161
+      check = x: builtins.isNull x || elemType.check x;
  162
+      merge = loc: defs:
  163
+        let nrNulls = count (def: isNull def.value) defs; in
  164
+        if nrNulls == length defs then null
  165
+        else if nrNulls != 0 then
  166
+          throw "The option `${showOption loc}' is defined both null and not null, in ${showFiles (getFiles defs)}."
  167
+        else elemType.merge loc defs;
  168
+      getSubOptions = elemType.getSubOptions;
  169
+    };
  170
+
  171
+    functionTo = elemType: mkOptionType {
  172
+      name = "function that evaluates to a(n) ${elemType.name}";
  173
+      check = builtins.isFunction;
  174
+      merge = loc: defs:
  175
+        fnArgs: elemType.merge loc (map (fn: { inherit (fn) file; value = fn.value fnArgs; }) defs);
  176
+      getSubOptions = elemType.getSubOptions;
  177
+    };
  178
+
  179
+    submodule = opts:
  180
+      let
  181
+        opts' = toList opts;
  182
+        inherit (import ./modules.nix) evalModules;
  183
+      in
  184
+      mkOptionType rec {
  185
+        name = "submodule";
  186
+        check = x: isAttrs x || builtins.isFunction x;
  187
+        merge = loc: defs:
  188
+          let
  189
+            coerce = def: if builtins.isFunction def then def else { config = def; };
  190
+            modules = opts' ++ map (def: { _file = def.file; imports = [(coerce def.value)]; }) defs;
  191
+          in (evalModules { inherit modules; args.name = last loc; prefix = loc; }).config;
  192
+        getSubOptions = prefix: (evalModules
  193
+          { modules = opts'; inherit prefix;
  194
+            # FIXME: hack to get shit to evaluate.
  195
+            args = { name = ""; }; }).options;
  196
+      };
  197
+
  198
+    # Obsolete alternative to configOf.  It takes its option
  199
+    # declarations from the ‘options’ attribute of containing option
  200
+    # declaration.
  201
+    optionSet = mkOptionType {
  202
+      name = /* builtins.trace "types.optionSet is deprecated; use types.submodule instead" */ "option set";
  203
+    };
  204
+
  205
+    # Augment the given type with an additional type check function.
  206
+    addCheck = elemType: check: elemType // { check = x: elemType.check x && check x; };
  207
+
  208
+  };
  209
+
  210
+}
27  maintainers/docs/uclibc-cross.txt
... ...
@@ -1,27 +0,0 @@
1  
-Adding uClibc support for a new platform
2  
-
3  
-Sometimes you want to cross-compile to another architecture, for example an
4  
-embedded devices. For embedded devices the uClibc C library is popular.
5  
-In Nixpkgs there is support for uClibc for several architectures but not
6  
-everything is supported.
7  
-
8  
-Adding support is not very difficult, 
9  
-
10  
-* Add your architecture to the buildfiles in
11  
-$nixpkgs/development/tools/misc/binutils-cross
12  
-
13  
-* Add your architecture to the buildfiles in
14  
-$nixpkgs/development/compilers/gcc-4.0-cross
15  
-
16  
-* Add your architecture to the buildfiles in
17  
-$nixpkgs/os-specific/linux/kernel-headers-cross
18  
-
19  
-* Add your architecture to the buildfiles in
20  
-$nixpkgs/development/uclibc
21  
-
22  
-In the latter directory you will also need a configuration file for uClibc.
23  
-You can make these by unpacking the uClibc sources and run a "make menuconfig".
24  
-In the configuration a few things need to be adapted:
25  
-
26  
-- kernel sources -> need to point at our own kernel headers
27  
-- install -> needs to point at $out
17  maintainers/scripts/eval-release.nix
... ...
@@ -1,7 +1,7 @@
1 1
 # Evaluate `release.nix' like Hydra would.  Too bad nix-instantiate
2 2
 # can't to do this.
3 3
 
4  
-with import ../../pkgs/lib;
  4
+with import ../../lib;
5 5
 
6 6
 let
7 7
   trace = if builtins.getEnv "VERBOSE" == "1" then builtins.trace else (x: y: y);
@@ -10,14 +10,15 @@ let
10 10
 
11 11
   # Add the ‘recurseForDerivations’ attribute to ensure that
12 12
   # nix-instantiate recurses into nested attribute sets.
13  
-  recurse = attrs:
  13
+  recurse = path: attrs:
14 14
     if (builtins.tryEval attrs).success then
15  
-      if isDerivation attrs 
  15
+      if isDerivation attrs
16 16
       then
17  
-        if (builtins.tryEval attrs.outPath).success
18  
-        then attrs
19  
-        else { }
20  
-      else { recurseForDerivations = true; } // mapAttrs (n: v: recurse v) attrs
  17
+        if (builtins.tryEval attrs.drvPath).success
  18
+        then { inherit (attrs) name drvPath; }
  19
+        else { failed = true; }
  20
+      else { recurseForDerivations = true; } //
  21
+           mapAttrs (n: v: let path' = path ++ [n]; in trace path' (recurse path' v)) attrs
21 22
     else { };
22 23