···108file used by <filename>Makefile.PL</filename>:
109110<programlisting>
111-{buildPerlPackage, fetchurl, db}:
112113buildPerlPackage rec {
114 name = "BerkeleyDB-0.36";
···191</section>
192193194-<section><title>Python</title>
000000000000000000000000000000195196<para>
197 Python packages that
198- use <link xlink:href="http://pypi.python.org/pypi/setuptools/"><literal>setuptools</literal></link>,
199- which many Python packages do nowadays, can be built very simply using
200- the <varname>buildPythonPackage</varname> function. This function is
201- implemented
202- in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/generic/default.nix"><filename>pkgs/development/python-modules/generic/default.nix</filename></link>
203- and works similarly to <varname>buildPerlPackage</varname>. (See
204- <xref linkend="ssec-language-perl"/> for details.)
205</para>
206207<para>
208- Python packages that use <varname>buildPythonPackage</varname> are
209- defined
210- in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/python-packages.nix"><filename>pkgs/top-level/python-packages.nix</filename></link>.
211- Most of them are simple. For example:
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000212213- <programlisting>
214-twisted = buildPythonPackage {
215- name = "twisted-8.1.0";
216217- src = fetchurl {
218- url = http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2;
219- sha256 = "0q25zbr4xzknaghha72mq57kh53qw1bf8csgp63pm9sfi72qhirl";
220- };
221222- propagatedBuildInputs = [ pkgs.ZopeInterface ];
223224- meta = {
225- homepage = http://twistedmatrix.com/;
226- description = "Twisted, an event-driven networking engine written in Python";
227- license = "MIT";
228- };
229-};
230- </programlisting>
0000000000000000000000000000000000231</para>
00000000000000000000232233</section>
234
···108file used by <filename>Makefile.PL</filename>:
109110<programlisting>
111+{ buildPerlPackage, fetchurl, db }:
112113buildPerlPackage rec {
114 name = "BerkeleyDB-0.36";
···191</section>
192193194+<section xml:id="python"><title>Python</title>
195+196+<para>
197+ Currently supported interpreters are <varname>python26</varname>, <varname>python27</varname>,
198+ <varname>python32</varname>, <varname>python33</varname>, <varname>python34</varname>
199+ and <varname>pypy</varname>.
200+</para>
201+202+<para>
203+ <varname>python</varname> is an alias of <varname>python27</varname> and <varname>python3</varname> is an alias of <varname>python34</varname>.
204+</para>
205+206+<para>
207+ <varname>python26</varname> and <varname>python27</varname> do not include modules that require
208+ external dependencies (to reduce dependency bloat). Following modules need to be added as
209+ <varname>buildInput</varname> explicitly:
210+</para>
211+212+<itemizedlist>
213+ <listitem><para><varname>python.modules.bsddb</varname></para></listitem>
214+ <listitem><para><varname>python.modules.curses</varname></para></listitem>
215+ <listitem><para><varname>python.modules.curses_panel</varname></para></listitem>
216+ <listitem><para><varname>python.modules.crypt</varname></para></listitem>
217+ <listitem><para><varname>python.modules.gdbm</varname></para></listitem>
218+ <listitem><para><varname>python.modules.sqlite3</varname></para></listitem>
219+ <listitem><para><varname>python.modules.tkinter</varname></para></listitem>
220+ <listitem><para><varname>python.modules.readline</varname></para></listitem>
221+</itemizedlist>
222+223+<para>For convenience <varname>python27Full</varname> and <varname>python26Full</varname>
224+are provided with all modules included.</para>
225226<para>
227 Python packages that
228+ use <link xlink:href="http://pypi.python.org/pypi/setuptools/"><literal>setuptools</literal></link> or <literal>distutils</literal>,
229+ can be built using the <varname>buildPythonPackage</varname> function as documented below.
00000230</para>
231232<para>
233+ All packages depending on any Python interpreter get appended <varname>$out/${python.libPrefix}/site-packages</varname>
234+ to <literal>$PYTHONPATH</literal> if such directory exists.
235+</para>
236+237+<variablelist>
238+ <title>
239+ Useful attributes on interpreters packages:
240+ </title>
241+242+ <varlistentry>
243+ <term><varname>libPrefix</varname></term>
244+ <listitem><para>
245+ Name of the folder in <literal>${python}/lib/</literal> for corresponding interpreter.
246+ </para></listitem>
247+ </varlistentry>
248+249+ <varlistentry>
250+ <term><varname>interpreter</varname></term>
251+ <listitem><para>
252+ Alias for <literal>${python}/bin/${executable}.</literal>
253+ </para></listitem>
254+ </varlistentry>
255+256+ <varlistentry>
257+ <term><varname>buildEnv</varname></term>
258+ <listitem><para>
259+ Function to build python interpreter environments with extra packages bundled together.
260+ See <xref linkend="python-build-env" /> for usage and documentation.
261+ </para></listitem>
262+ </varlistentry>
263+264+ <varlistentry>
265+ <term><varname>sitePackages</varname></term>
266+ <listitem><para>
267+ Alias for <literal>lib/${libPrefix}/site-packages</literal>.
268+ </para></listitem>
269+ </varlistentry>
270+271+ <varlistentry>
272+ <term><varname>executable</varname></term>
273+ <listitem><para>
274+ Name of the interpreter executable, ie <literal>python3.4</literal>.
275+ </para></listitem>
276+ </varlistentry>
277+278+</variablelist>
279+<section xml:id="build-python-package"><title><varname>buildPythonPackage</varname> function</title>
280+281+ <para>
282+ The function is implemented in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/generic/default.nix">
283+ <filename>pkgs/development/python-modules/generic/default.nix</filename></link>.
284+ Example usage:
285+286+ <programlisting language="nix">
287+ twisted = buildPythonPackage {
288+ name = "twisted-8.1.0";
289+290+ src = pkgs.fetchurl {
291+ url = http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2;
292+ sha256 = "0q25zbr4xzknaghha72mq57kh53qw1bf8csgp63pm9sfi72qhirl";
293+ };
294+295+ propagatedBuildInputs = [ self.ZopeInterface ];
296+297+ meta = {
298+ homepage = http://twistedmatrix.com/;
299+ description = "Twisted, an event-driven networking engine written in Python";
300+ license = stdenv.lib.licenses.mit;
301+ };
302+ };
303+ </programlisting>
304+305+ Most of Python packages that use <varname>buildPythonPackage</varname> are defined
306+ in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/python-packages.nix"><filename>pkgs/top-level/python-packages.nix</filename></link>
307+ and generated for each python interpreter separately into attribute sets <varname>python26Packages</varname>,
308+ <varname>python27Packages</varname>, <varname>python32Packages</varname>, <varname>python33Packages</varname>,
309+ <varname>python34Packages</varname> and <varname>pypyPackages</varname>.
310+ </para>
311+312+ <para>
313+ <function>buildPythonPackage</function> mainly does four things:
314+315+ <orderedlist>
316+ <listitem><para>
317+ In the <varname>configurePhase</varname>, it patches
318+ <literal>setup.py</literal> to always include setuptools before
319+ distutils for monkeypatching machinery to take place.
320+ </para></listitem>
321+322+ <listitem><para>
323+ In the <varname>buildPhase</varname>, it calls
324+ <literal>${python.interpreter} setup.py build ...</literal>
325+ </para></listitem>
326+327+ <listitem><para>
328+ In the <varname>installPhase</varname>, it calls
329+ <literal>${python.interpreter} setup.py install ...</literal>
330+ </para></listitem>
331+332+ <listitem><para>
333+ In the <varname>postFixup</varname> phase, <literal>wrapPythonPrograms</literal>
334+ bash function is called to wrap all programs in <filename>$out/bin/*</filename>
335+ directory to include <literal>$PYTHONPATH</literal> and <literal>$PATH</literal>
336+ environment variables.
337+ </para></listitem>
338+ </orderedlist>
339+ </para>
340+341+ <para>By default <varname>doCheck = true</varname> is set and tests are run with
342+ <literal>${python.interpreter} setup.py test</literal> command in <varname>checkPhase</varname>.</para>
343+344+ <para><varname>propagatedBuildInputs</varname> packages are propagated to user environment.</para>
345+346+ <para>
347+ By default <varname>meta.platforms</varname> is set to the same value
348+ as the interpreter unless overriden otherwise.
349+ </para>
350+351+ <variablelist>
352+ <title>
353+ <varname>buildPythonPackage</varname> parameters
354+ (all parameters from <varname>mkDerivation</varname> function are still supported)
355+ </title>
356+357+ <varlistentry>
358+ <term><varname>namePrefix</varname></term>
359+ <listitem><para>
360+ Prepended text to <varname>${name}</varname> parameter.
361+ Defaults to <literal>"python3.3-"</literal> for Python 3.3, etc. Set it to
362+ <literal>""</literal>
363+ if you're packaging an application or a command line tool.
364+ </para></listitem>
365+ </varlistentry>
366+367+ <varlistentry>
368+ <term><varname>disabled</varname></term>
369+ <listitem><para>
370+ If <varname>true</varname>, package is not build for
371+ particular python interpreter version. Grep around
372+ <filename>pkgs/top-level/python-packages.nix</filename>
373+ for examples.
374+ </para></listitem>
375+ </varlistentry>
376+377+ <varlistentry>
378+ <term><varname>setupPyInstallFlags</varname></term>
379+ <listitem><para>
380+ List of flags passed to <command>setup.py install</command> command.
381+ </para></listitem>
382+ </varlistentry>
383+384+ <varlistentry>
385+ <term><varname>setupPyBuildFlags</varname></term>
386+ <listitem><para>
387+ List of flags passed to <command>setup.py build</command> command.
388+ </para></listitem>
389+ </varlistentry>
390+391+ <varlistentry>
392+ <term><varname>pythonPath</varname></term>
393+ <listitem><para>
394+ List of packages to be added into <literal>$PYTHONPATH</literal>.
395+ Packages in <varname>pythonPath</varname> are not propagated into user environment
396+ (contrary to <varname>propagatedBuildInputs</varname>).
397+ </para></listitem>
398+ </varlistentry>
399+400+ <varlistentry>
401+ <term><varname>preShellHook</varname></term>
402+ <listitem><para>
403+ Hook to execute commands before <varname>shellHook</varname>.
404+ </para></listitem>
405+ </varlistentry>
406+407+ <varlistentry>
408+ <term><varname>postShellHook</varname></term>
409+ <listitem><para>
410+ Hook to execute commands after <varname>shellHook</varname>.
411+ </para></listitem>
412+ </varlistentry>
413+414+ <varlistentry>
415+ <term><varname>distutilsExtraCfg</varname></term>
416+ <listitem><para>
417+ Extra lines passed to <varname>[easy_install]</varname> section of
418+ <filename>distutils.cfg</filename> (acts as global setup.cfg
419+ configuration).
420+ </para></listitem>
421+ </varlistentry>
422+423+ </variablelist>
424+425+</section>
426+427+<section xml:id="python-build-env"><title><function>python.buildEnv</function> function</title>
428+ <para>
429+ Create Python envorinments using low-level <function>pkgs.buildEnv</function> function. Example <filename>default.nix</filename>:
430+431+ <programlisting language="nix">
432+ <![CDATA[
433+ with import <nixpkgs> {};
434+435+ python.buildEnv.override {
436+ extraLibs = [ pkgs.pythonPackages.pyramid ];
437+ ignoreCollisions = true;
438+ }
439+ ]]>
440+ </programlisting>
441+442+ Running <command>nix-build</command> will create
443+ <filename>/nix/store/cf1xhjwzmdki7fasgr4kz6di72ykicl5-python-2.7.8-env</filename>
444+ with wrapped binaries in <filename>bin/</filename>.
445+ </para>
446+447+ <variablelist>
448+ <title>
449+ <function>python.buildEnv</function> arguments
450+ </title>
451+452+ <varlistentry>
453+ <term><varname>extraLibs</varname></term>
454+ <listitem><para>
455+ List of packages installed inside the environment.
456+ </para></listitem>
457+ </varlistentry>
458+459+ <varlistentry>
460+ <term><varname>postBuild</varname></term>
461+ <listitem><para>
462+ Shell command executed after the build of environment.
463+ </para></listitem>
464+ </varlistentry>
465+466+ <varlistentry>
467+ <term><varname>ignoreCollisions</varname></term>
468+ <listitem><para>
469+ Ignore file collisions inside the environment (default is <varname>false</varname>).
470+ </para></listitem>
471+ </varlistentry>
472+ </variablelist>
473+</section>
474+475+<section xml:id="python-tools"><title>Tools</title>
476+477+<para>Packages inside nixpkgs are written by hand. However many tools
478+exist in community to help save time. No tool is prefered at the moment.
479+</para>
480+481+<itemizedlist>
482+483+ <listitem><para>
484+ <link xlink:href="https://github.com/proger/python2nix">python2nix</link>
485+ by Vladimir Kirillov
486+ </para></listitem>
487+488+ <listitem><para>
489+ <link xlink:href="https://github.com/garbas/pypi2nix">pypi2nix</link>
490+ by Rok Garbas
491+ </para></listitem>
492+493+ <listitem><para>
494+ <link xlink:href="https://github.com/offlinehacker/pypi2nix">pypi2nix</link>
495+ by Jaka Hudoklin
496+ </para></listitem>
497+498+</itemizedlist>
499+500+</section>
501+502+<section xml:id="python-development"><title>Development</title>
503+504+ <para>
505+ To develop Python packages <function>bulidPythonPackage</function> has
506+ additional logic inside <varname>shellPhase</varname> to run
507+ <command>${python.interpreter} setup.py develop</command> for the package.
508+ </para>
509+510+ <para>
511+ Given a <filename>default.nix</filename>:
512+513+ <programlisting language="nix">
514+ <![CDATA[
515+ with import <nixpkgs> {};
516+517+ buildPythonPackage {
518+ name = "myproject";
519+520+ buildInputs = with pkgs.pythonPackages; [ pyramid ];
521+522+ src = ./.;
523+ }
524+ ]]>
525+ </programlisting>
526+527+ Running <command>nix-shell</command> with no arguments should give you
528+ the environment in which the package would be build with
529+ <command>nix-build</command>.
530+ </para>
531+532+ <para>
533+ Shortcut to setup environments with C headers/libraries and python packages:
534+535+ <programlisting language="bash">$ nix-shell -p pythonPackages.pyramid zlib libjpeg git</programlisting>
536+ </para>
537+538+ <para>
539+ Note: there is a boolean value <varname>lib.inNixShell</varname> set to
540+ <varname>true</varname> if nix-shell is invoked.
541+ </para>
542543+</section>
00544545+<section xml:id="python-faq"><title>FAQ</title>
000546547+<variablelist>
548549+ <varlistentry>
550+ <term>How to solve circular dependencies?</term>
551+ <listitem><para>
552+ If you have packages <varname>A</varname> and <varname>B</varname> that
553+ depend on each other, when packaging <varname>B</varname> override package
554+ <varname>A</varname> not to depend on <varname>B</varname> as input
555+ (and also the other way around).
556+ </para></listitem>
557+ </varlistentry>
558+559+ <varlistentry>
560+ <term><varname>install_data / data_files</varname> problems resulting into <literal>error: could not create '/nix/store/6l1bvljpy8gazlsw2aw9skwwp4pmvyxw-python-2.7.8/etc': Permission denied</literal></term>
561+ <listitem><para>
562+ <link xlink:href="https://bitbucket.org/pypa/setuptools/issue/130/install_data-doesnt-respect-prefix">
563+ Known bug in setuptools <varname>install_data</varname> does not respect --prefix</link>. Example of
564+ such package using the feature is <filename>pkgs/tools/X11/xpra/default.nix</filename>. As workaround
565+ install it as an extra <varname>preInstall</varname> step:
566+567+ <programlisting>${python.interpreter} setup.py install_data --install-dir=$out --root=$out
568+sed -i '/ = data_files/d' setup.py</programlisting>
569+ </para></listitem>
570+ </varlistentry>
571+572+ <varlistentry>
573+ <term>Rationale of non-existent global site-packages</term>
574+ <listitem><para>
575+ There is no need to have global site-packages in Nix. Each package has isolated
576+ dependency tree and installing any python package will only populate <varname>$PATH</varname>
577+ inside user environment. See <xref linkend="python-build-env" /> to create self-contained
578+ interpreter with a set of packages.
579+ </para></listitem>
580+ </varlistentry>
581+582+</variablelist>
583+584+</section>
585+586+587+<section xml:id="python-contrib"><title>Contributing guidelines</title>
588+<para>
589+ Following rules are desired to be respected:
590</para>
591+592+<itemizedlist>
593+594+ <listitem><para>
595+ Make sure package builds for all python interpreters. Use <varname>disabled</varname> argument to
596+ <function>buildPythonPackage</function> to set unsupported interpreters.
597+ </para></listitem>
598+599+ <listitem><para>
600+ If tests need to be disabled for a package, make sure you leave a comment about reasoning.
601+ </para></listitem>
602+603+ <listitem><para>
604+ Packages in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/python-packages.nix"><filename>pkgs/top-level/python-packages.nix</filename></link>
605+ are sorted quasi-alphabetically to avoid merge conflicts.
606+ </para></listitem>
607+608+</itemizedlist>
609+610+</section>
611612</section>
613
+2-5
doc/stdenv.xml
···1120 <varlistentry>
1121 <term>Python</term>
1122 <listitem><para>Adds the
1123- <filename>lib/python2.5/site-packages</filename> subdirectory of
1124 each build input to the <envar>PYTHONPATH</envar> environment
1125- variable.</para>
1126-1127- <note><para>This should be generalised: the Python version
1128- shouldn’t be hard-coded.</para></note></listitem>
1129 </varlistentry>
11301131 <varlistentry>
···1120 <varlistentry>
1121 <term>Python</term>
1122 <listitem><para>Adds the
1123+ <filename>lib/${python.libPrefix}/site-packages</filename> subdirectory of
1124 each build input to the <envar>PYTHONPATH</envar> environment
1125+ variable.</para></listitem>
0001126 </varlistentry>
11271128 <varlistentry>
···223224 crossLists = f: foldl (fs: args: concatMap (f: map f args) fs) [f];
225226+ # Remove duplicate elements from the list
227+ unique = list:
228+ if list == [] then
229+ []
230+ else
231+ let
232+ x = head list;
233+ xs = unique (drop 1 list);
234+ in [x] ++ remove x xs;
235+236}
···45 # Add support for cow filesystems and their utilities
46 boot.supportedFilesystems = [ "zfs" "btrfs" ];
4700048 # Allow the user to log in as root without a password.
49 users.extraUsers.root.initialHashedPassword = "";
50}
···45 # Add support for cow filesystems and their utilities
46 boot.supportedFilesystems = [ "zfs" "btrfs" ];
4748+ # Configure host id for ZFS to work
49+ networking.hostId = "8425e349";
50+51 # Allow the user to log in as root without a password.
52 users.extraUsers.root.initialHashedPassword = "";
53}
···476EOF
477 }
47800000000479 write_file($fn, <<EOF);
480# Edit this configuration file to define what should be installed on
481# your system. Help is available in the configuration.nix(5) man page
···491492$bootLoaderConfig
493 # networking.hostName = "nixos"; # Define your hostname.
0494 # networking.wireless.enable = true; # Enables wireless.
495496 # Select internationalisation properties.
···476EOF
477 }
478479+ # Generate a random 32-bit value to use as the host id
480+ open my $rnd, "<", "/dev/urandom" or die $!;
481+ read $rnd, $hostIdBin, 4;
482+ close $rnd;
483+484+ # Convert the 32-bit value to a hex string
485+ my $hostIdHex = unpack("H*", $hostIdBin);
486+487 write_file($fn, <<EOF);
488# Edit this configuration file to define what should be installed on
489# your system. Help is available in the configuration.nix(5) man page
···499500$bootLoaderConfig
501 # networking.hostName = "nixos"; # Define your hostname.
502+ networking.hostId = "$hostIdHex";
503 # networking.wireless.enable = true; # Enables wireless.
504505 # Select internationalisation properties.
+1
nixos/modules/misc/ids.nix
···158 seeks = 148;
159 prosody = 149;
160 i2pd = 150;
0161162 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
163
···158 seeks = 148;
159 prosody = 149;
160 i2pd = 150;
161+ dnscrypt-proxy = 151;
162163 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
164
···98 # Authorization: is the user allowed access?
99 "authz_user" "authz_groupfile" "authz_host"
100000101 # Other modules.
102 "ext_filter" "include" "log_config" "env" "mime_magic"
103 "cern_meta" "expires" "headers" "usertrack" /* "unique_id" */ "setenvif"
···98 # Authorization: is the user allowed access?
99 "authz_user" "authz_groupfile" "authz_host"
100101+ # For compatibility with old configurations, the new module mod_access_compat is provided.
102+ (if version24 then "access_compat" else "")
103+104 # Other modules.
105 "ext_filter" "include" "log_config" "env" "mime_magic"
106 "cern_meta" "expires" "headers" "usertrack" /* "unique_id" */ "setenvif"
+4-1
nixos/modules/system/boot/stage-1-init.sh
···122 esac
123done
124000125126# Load the required kernel modules.
127mkdir -p /lib
···398# Start stage 2. `switch_root' deletes all files in the ramfs on the
399# current root. Note that $stage2Init might be an absolute symlink,
400# in which case "-e" won't work because we're not in the chroot yet.
401-if ! test -e "$targetRoot/$stage2Init" -o -L "$targetRoot/$stage2Init"; then
402 echo "stage 2 init script ($targetRoot/$stage2Init) not found"
403 fail
404fi
···122 esac
123done
124125+# Set hostid before modules are loaded.
126+# This is needed by the spl/zfs modules.
127+@setHostId@
128129# Load the required kernel modules.
130mkdir -p /lib
···401# Start stage 2. `switch_root' deletes all files in the ramfs on the
402# current root. Note that $stage2Init might be an absolute symlink,
403# in which case "-e" won't work because we're not in the chroot yet.
404+if ! test -e "$targetRoot/$stage2Init" -o ! -L "$targetRoot/$stage2Init"; then
405 echo "stage 2 init script ($targetRoot/$stage2Init) not found"
406 fail
407fi
+9
nixos/modules/system/boot/stage-1.nix
···190 fsInfo =
191 let f = fs: [ fs.mountPoint (if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}") fs.fsType fs.options ];
192 in pkgs.writeText "initrd-fsinfo" (concatStringsSep "\n" (concatMap f fileSystems));
000000000193 };
194195
···1-{ config, lib, pkgs, ... }:
2#
3# todo:
4# - crontab for scrubs, etc
5# - zfs tunables
6-# - /etc/zfs/zpool.cache handling
78-9with lib;
1011let
···3132 zfsAutoSnap = "${autosnapPkg}/bin/zfs-auto-snapshot";
330000000000000034in
3536{
···38 ###### interface
3940 options = {
41- boot.spl.hostid = mkOption {
42- default = "";
43- example = "0xdeadbeef";
44- description = ''
45- ZFS uses a system's hostid to determine if a storage pool (zpool) is
46- native to this system, and should thus be imported automatically.
47- Unfortunately, this hostid can change under linux from boot to boot (by
48- changing network adapters, for instance). Specify a unique 32 bit hostid in
49- hex here for zfs to prevent getting a random hostid between boots and having to
50- manually import pools.
51- '';
52- };
5354- boot.zfs.useGit = mkOption {
55- type = types.bool;
56- default = false;
57- example = true;
58- description = ''
59- Use the git version of the SPL and ZFS packages.
60- Note that these are unreleased versions, with less testing, and therefore
61- may be more unstable.
62- '';
000000000000000000000000000000000000000000000063 };
6465 services.zfs.autoSnapshot = {
···124125 config = mkMerge [
126 (mkIf enableZfs {
00000000000127 boot = {
128 kernelModules = [ "spl" "zfs" ] ;
129 extraModulePackages = [ splPkg zfsPkg ];
130- extraModprobeConfig = mkIf (cfgSpl.hostid != "") ''
131- options spl spl_hostid=${cfgSpl.hostid}
132- '';
133 };
134135 boot.initrd = mkIf inInitrd {
···142 cp -pdv ${zfsPkg}/lib/lib*.so* $out/lib
143 cp -pdv ${pkgs.zlib}/lib/lib*.so* $out/lib
144 '';
145- postDeviceCommands =
146- ''
147- zpool import -f -a
148- '';
0000000000149 };
150151 boot.loader.grub = mkIf inInitrd {
152 zfsSupport = true;
153 };
154155- systemd.services."zpool-import" = {
156- description = "Import zpools";
157- after = [ "systemd-udev-settle.service" ];
158- wantedBy = [ "local-fs.target" ];
159- serviceConfig = {
160- Type = "oneshot";
161- RemainAfterExit = true;
162- ExecStart = "${zfsPkg}/sbin/zpool import -f -a";
163- };
164- restartIfChanged = false;
165- };
166-167- systemd.services."zfs-mount" = {
168- description = "Mount ZFS Volumes";
169- after = [ "zpool-import.service" ];
170- wantedBy = [ "local-fs.target" ];
171- serviceConfig = {
172- Type = "oneshot";
173- RemainAfterExit = true;
174- ExecStart = "${zfsPkg}/sbin/zfs mount -a";
175- ExecStop = "${zfsPkg}/sbin/zfs umount -a";
176- };
177- restartIfChanged = false;
178- };
179180 system.fsPackages = [ zfsPkg ]; # XXX: needed? zfs doesn't have (need) a fsck
181 environment.systemPackages = [ zfsPkg ];
182 services.udev.packages = [ zfsPkg ]; # to hook zvol naming, etc.
00000000000000000000000000000000000000000000000183 })
184185 (mkIf enableAutoSnapshots {
186 systemd.services."zfs-snapshot-frequent" = {
187 description = "ZFS auto-snapshotting every 15 mins";
188- after = [ "zpool-import.service" ];
189 serviceConfig = {
190 Type = "oneshot";
191 ExecStart = "${zfsAutoSnap} frequent ${toString cfgSnapshots.frequent}";
···196197 systemd.services."zfs-snapshot-hourly" = {
198 description = "ZFS auto-snapshotting every hour";
199- after = [ "zpool-import.service" ];
200 serviceConfig = {
201 Type = "oneshot";
202 ExecStart = "${zfsAutoSnap} hourly ${toString cfgSnapshots.hourly}";
···207208 systemd.services."zfs-snapshot-daily" = {
209 description = "ZFS auto-snapshotting every day";
210- after = [ "zpool-import.service" ];
211 serviceConfig = {
212 Type = "oneshot";
213 ExecStart = "${zfsAutoSnap} daily ${toString cfgSnapshots.daily}";
···218219 systemd.services."zfs-snapshot-weekly" = {
220 description = "ZFS auto-snapshotting every week";
221- after = [ "zpool-import.service" ];
222 serviceConfig = {
223 Type = "oneshot";
224 ExecStart = "${zfsAutoSnap} weekly ${toString cfgSnapshots.weekly}";
···229230 systemd.services."zfs-snapshot-monthly" = {
231 description = "ZFS auto-snapshotting every month";
232- after = [ "zpool-import.service" ];
233 serviceConfig = {
234 Type = "oneshot";
235 ExecStart = "${zfsAutoSnap} monthly ${toString cfgSnapshots.monthly}";
···1+{ config, lib, pkgs, utils, ... }:
2#
3# todo:
4# - crontab for scrubs, etc
5# - zfs tunables
067+with utils;
8with lib;
910let
···3031 zfsAutoSnap = "${autosnapPkg}/bin/zfs-auto-snapshot";
3233+ datasetToPool = x: elemAt (splitString "/" x) 0;
34+35+ fsToPool = fs: datasetToPool fs.device;
36+37+ zfsFilesystems = filter (x: x.fsType == "zfs") (attrValues config.fileSystems);
38+39+ isRoot = fs: fs.neededForBoot || elem fs.mountPoint [ "/" "/nix" "/nix/store" "/var" "/var/log" "/var/lib" "/etc" ];
40+41+ allPools = unique ((map fsToPool zfsFilesystems) ++ cfgZfs.extraPools);
42+43+ rootPools = unique (map fsToPool (filter isRoot zfsFilesystems));
44+45+ dataPools = unique (filter (pool: !(elem pool rootPools)) allPools);
46+47in
4849{
···51 ###### interface
5253 options = {
54+ boot.zfs = {
55+ useGit = mkOption {
56+ type = types.bool;
57+ default = false;
58+ example = true;
59+ description = ''
60+ Use the git version of the SPL and ZFS packages.
61+ Note that these are unreleased versions, with less testing, and therefore
62+ may be more unstable.
63+ '';
64+ };
06566+ extraPools = mkOption {
67+ type = types.listOf types.str;
68+ default = [];
69+ example = [ "tank" "data" ];
70+ description = ''
71+ Name or GUID of extra ZFS pools that you wish to import during boot.
72+73+ Usually this is not necessary. Instead, you should set the mountpoint property
74+ of ZFS filesystems to <literal>legacy</literal> and add the ZFS filesystems to
75+ NixOS's <option>fileSystems</option> option, which makes NixOS automatically
76+ import the associated pool.
77+78+ However, in some cases (e.g. if you have many filesystems) it may be preferable
79+ to exclusively use ZFS commands to manage filesystems. If so, since NixOS/systemd
80+ will not be managing those filesystems, you will need to specify the ZFS pool here
81+ so that NixOS automatically imports it on every boot.
82+ '';
83+ };
84+85+ forceImportRoot = mkOption {
86+ type = types.bool;
87+ default = true;
88+ example = false;
89+ description = ''
90+ Forcibly import the ZFS root pool(s) during early boot.
91+92+ This is enabled by default for backwards compatibility purposes, but it is highly
93+ recommended to disable this option, as it bypasses some of the safeguards ZFS uses
94+ to protect your ZFS pools.
95+96+ If you set this option to <literal>false</literal> and NixOS subsequently fails to
97+ boot because it cannot import the root pool, you should boot with the
98+ <literal>zfs_force=1</literal> option as a kernel parameter (e.g. by manually
99+ editing the kernel params in grub during boot). You should only need to do this
100+ once.
101+ '';
102+ };
103+104+ forceImportAll = mkOption {
105+ type = types.bool;
106+ default = true;
107+ example = false;
108+ description = ''
109+ Forcibly import all ZFS pool(s).
110+111+ This is enabled by default for backwards compatibility purposes, but it is highly
112+ recommended to disable this option, as it bypasses some of the safeguards ZFS uses
113+ to protect your ZFS pools.
114+115+ If you set this option to <literal>false</literal> and NixOS subsequently fails to
116+ import your non-root ZFS pool(s), you should manually import each pool with
117+ "zpool import -f <pool-name>", and then reboot. You should only need to do
118+ this once.
119+ '';
120+ };
121 };
122123 services.zfs.autoSnapshot = {
···182183 config = mkMerge [
184 (mkIf enableZfs {
185+ assertions = [
186+ {
187+ assertion = config.networking.hostId != null;
188+ message = "ZFS requires config.networking.hostId to be set";
189+ }
190+ {
191+ assertion = !cfgZfs.forceImportAll || cfgZfs.forceImportRoot;
192+ message = "If you enable boot.zfs.forceImportAll, you must also enable boot.zfs.forceImportRoot";
193+ }
194+ ];
195+196 boot = {
197 kernelModules = [ "spl" "zfs" ] ;
198 extraModulePackages = [ splPkg zfsPkg ];
000199 };
200201 boot.initrd = mkIf inInitrd {
···208 cp -pdv ${zfsPkg}/lib/lib*.so* $out/lib
209 cp -pdv ${pkgs.zlib}/lib/lib*.so* $out/lib
210 '';
211+ postDeviceCommands = concatStringsSep "\n" ([''
212+ ZFS_FORCE="${optionalString cfgZfs.forceImportRoot "-f"}"
213+214+ for o in $(cat /proc/cmdline); do
215+ case $o in
216+ zfs_force|zfs_force=1)
217+ ZFS_FORCE="-f"
218+ ;;
219+ esac
220+ done
221+ ''] ++ (map (pool: ''
222+ echo "importing root ZFS pool \"${pool}\"..."
223+ zpool import -N $ZFS_FORCE "${pool}"
224+ '') rootPools));
225 };
226227 boot.loader.grub = mkIf inInitrd {
228 zfsSupport = true;
229 };
230231+ environment.etc."zfs/zed.d".source = "${zfsPkg}/etc/zfs/zed.d/*";
00000000000000000000000232233 system.fsPackages = [ zfsPkg ]; # XXX: needed? zfs doesn't have (need) a fsck
234 environment.systemPackages = [ zfsPkg ];
235 services.udev.packages = [ zfsPkg ]; # to hook zvol naming, etc.
236+ systemd.packages = [ zfsPkg ];
237+238+ systemd.services = let
239+ getPoolFilesystems = pool:
240+ filter (x: x.fsType == "zfs" && (fsToPool x) == pool) (attrValues config.fileSystems);
241+242+ getPoolMounts = pool:
243+ let
244+ mountPoint = fs: escapeSystemdPath fs.mountPoint;
245+ in
246+ map (x: "${mountPoint x}.mount") (getPoolFilesystems pool);
247+248+ createImportService = pool:
249+ nameValuePair "zfs-import-${pool}" {
250+ description = "Import ZFS pool \"${pool}\"";
251+ requires = [ "systemd-udev-settle.service" ];
252+ after = [ "systemd-udev-settle.service" "systemd-modules-load.service" ];
253+ wantedBy = (getPoolMounts pool) ++ [ "local-fs.target" ];
254+ before = (getPoolMounts pool) ++ [ "local-fs.target" ];
255+ unitConfig = {
256+ DefaultDependencies = "no";
257+ };
258+ serviceConfig = {
259+ Type = "oneshot";
260+ RemainAfterExit = true;
261+ };
262+ script = ''
263+ zpool_cmd="${zfsPkg}/sbin/zpool"
264+ ("$zpool_cmd" list "${pool}" >/dev/null) || "$zpool_cmd" import -N ${optionalString cfgZfs.forceImportAll "-f"} "${pool}"
265+ '';
266+ };
267+ in listToAttrs (map createImportService dataPools) // {
268+ "zfs-mount" = { after = [ "systemd-modules-load.service" ]; };
269+ "zfs-share" = { after = [ "systemd-modules-load.service" ]; };
270+ "zed" = { after = [ "systemd-modules-load.service" ]; };
271+ };
272+273+ systemd.targets."zfs-import" =
274+ let
275+ services = map (pool: "zfs-import-${pool}.service") dataPools;
276+ in
277+ {
278+ requires = services;
279+ after = services;
280+ };
281+282+ systemd.targets."zfs".wantedBy = [ "multi-user.target" ];
283 })
284285 (mkIf enableAutoSnapshots {
286 systemd.services."zfs-snapshot-frequent" = {
287 description = "ZFS auto-snapshotting every 15 mins";
288+ after = [ "zfs-import.target" ];
289 serviceConfig = {
290 Type = "oneshot";
291 ExecStart = "${zfsAutoSnap} frequent ${toString cfgSnapshots.frequent}";
···296297 systemd.services."zfs-snapshot-hourly" = {
298 description = "ZFS auto-snapshotting every hour";
299+ after = [ "zfs-import.target" ];
300 serviceConfig = {
301 Type = "oneshot";
302 ExecStart = "${zfsAutoSnap} hourly ${toString cfgSnapshots.hourly}";
···307308 systemd.services."zfs-snapshot-daily" = {
309 description = "ZFS auto-snapshotting every day";
310+ after = [ "zfs-import.target" ];
311 serviceConfig = {
312 Type = "oneshot";
313 ExecStart = "${zfsAutoSnap} daily ${toString cfgSnapshots.daily}";
···318319 systemd.services."zfs-snapshot-weekly" = {
320 description = "ZFS auto-snapshotting every week";
321+ after = [ "zfs-import.target" ];
322 serviceConfig = {
323 Type = "oneshot";
324 ExecStart = "${zfsAutoSnap} weekly ${toString cfgSnapshots.weekly}";
···329330 systemd.services."zfs-snapshot-monthly" = {
331 description = "ZFS auto-snapshotting every month";
332+ after = [ "zfs-import.target" ];
333 serviceConfig = {
334 Type = "oneshot";
335 ExecStart = "${zfsAutoSnap} monthly ${toString cfgSnapshots.monthly}";
+44-6
nixos/modules/tasks/network-interfaces.nix
···189190 };
1910000192in
193194{
···202 description = ''
203 The name of the machine. Leave it empty if you want to obtain
204 it from a DHCP server (if using DHCP).
00000000000000205 '';
206 };
207···513 config = {
514515 assertions =
516- flip map interfaces (i: {
517 assertion = i.subnetMask == null;
518 message = "The networking.interfaces.${i.name}.subnetMask option is defunct. Use prefixLength instead.";
519- });
00000520521 boot.kernelModules = [ ]
522 ++ optional cfg.enableIPv6 "ipv6"
···872 # clear it if it's not configured in the NixOS configuration,
873 # since it may have been set by dhcpcd in the meantime.
874 system.activationScripts.hostname =
875- optionalString (config.networking.hostName != "") ''
876- hostname "${config.networking.hostName}"
877 '';
878 system.activationScripts.domain =
879- optionalString (config.networking.domain != "") ''
880- domainname "${config.networking.domain}"
881 '';
000000000000000882883 services.udev.extraRules =
884 ''
···189190 };
191192+ hexChars = stringToCharacters "0123456789abcdef";
193+194+ isHexString = s: all (c: elem c hexChars) (stringToCharacters (toLower s));
195+196in
197198{
···206 description = ''
207 The name of the machine. Leave it empty if you want to obtain
208 it from a DHCP server (if using DHCP).
209+ '';
210+ };
211+212+ networking.hostId = mkOption {
213+ default = null;
214+ example = "4e98920d";
215+ type = types.nullOr types.str;
216+ description = ''
217+ The 32-bit host ID of the machine, formatted as 8 hexadecimal characters.
218+219+ You should try to make this ID unique among your machines. You can
220+ generate a random 32-bit ID using the following command:
221+222+ <literal>head -c4 /dev/urandom | od -A none -t x4</literal>
223 '';
224 };
225···531 config = {
532533 assertions =
534+ (flip map interfaces (i: {
535 assertion = i.subnetMask == null;
536 message = "The networking.interfaces.${i.name}.subnetMask option is defunct. Use prefixLength instead.";
537+ })) ++ [
538+ {
539+ assertion = cfg.hostId == null || (stringLength cfg.hostId == 8 && isHexString cfg.hostId);
540+ message = "Invalid value given to the networking.hostId option.";
541+ }
542+ ];
543544 boot.kernelModules = [ ]
545 ++ optional cfg.enableIPv6 "ipv6"
···895 # clear it if it's not configured in the NixOS configuration,
896 # since it may have been set by dhcpcd in the meantime.
897 system.activationScripts.hostname =
898+ optionalString (cfg.hostName != "") ''
899+ hostname "${cfg.hostName}"
900 '';
901 system.activationScripts.domain =
902+ optionalString (cfg.domain != "") ''
903+ domainname "${cfg.domain}"
904 '';
905+906+ environment.etc = mkIf (cfg.hostId != null)
907+ [
908+ {
909+ target = "hostid";
910+ source = pkgs.runCommand "gen-hostid" {} ''
911+ hi="${cfg.hostId}"
912+ ${if pkgs.stdenv.isBigEndian then ''
913+ echo -ne "\x''${hi:0:2}\x''${hi:2:2}\x''${hi:4:2}\x''${hi:6:2}" > $out
914+ '' else ''
915+ echo -ne "\x''${hi:6:2}\x''${hi:4:2}\x''${hi:2:2}\x''${hi:0:2}" > $out
916+ ''}
917+ '';
918+ }
919+ ];
920921 services.udev.extraRules =
922 ''
···139 nlsSupport = config.vim.nls or false;
140 tclSupport = config.vim.tcl or false;
141 multibyteSupport = config.vim.multibyte or false;
142- cscopeSupport = config.vim.cscope or false;
143 netbeansSupport = config.netbeans or true; # eg envim is using it
144145 # by default, compile with darwin support if we're compiling on darwin, but
···139 nlsSupport = config.vim.nls or false;
140 tclSupport = config.vim.tcl or false;
141 multibyteSupport = config.vim.multibyte or false;
142+ cscopeSupport = config.vim.cscope or true;
143 netbeansSupport = config.netbeans or true; # eg envim is using it
144145 # by default, compile with darwin support if we're compiling on darwin, but
···1-{ stdenv, fetchurl, gcc, unzip, curl }:
23stdenv.mkDerivation {
4- name = "dmd-2.064.2";
56 src = fetchurl {
7- url = http://downloads.dlang.org/releases/2013/dmd.2.064.2.zip;
8- sha256 = "1i0jdybigffwyb7c43j0c4aayxx3b93zzqrjxyw6zgp06yhi06pm";
9 };
1011- buildInputs = [ gcc unzip curl ];
1213- configurePhase = "";
14- patchPhase = ''
15- cp src/VERSION src/dmd/
16- cp license.txt src/phobos/LICENSE_1_0.txt
17- '';
18 buildPhase = ''
19 cd src/dmd
20 make -f posix.mak INSTALL_DIR=$out
21 export DMD=$PWD/dmd
22- cd ../druntime
23 make -f posix.mak INSTALL_DIR=$out DMD=$DMD
24 cd ../phobos
25 make -f posix.mak INSTALL_DIR=$out DMD=$DMD
···2829 installPhase = ''
30 cd src/dmd
31- tee dmd.conf.default << EOF
32- [Environment]
33- DFLAGS=-I$out/import -L-L$out/lib
34- EOF
3536- make -f posix.mak INSTALL_DIR=$out install
37- export DMD=$PWD/dmd
38- cd ../druntime
39- make -f posix.mak INSTALL_DIR=$out install
040 cd ../phobos
41- make -f posix.mak INSTALL_DIR=$out install
42- cd ../..
0000000000043 '';
4445- meta = {
46 description = "D language compiler";
47 homepage = http://dlang.org/;
48- license = "open source, see included files";
49- maintainers = with stdenv.lib.maintainers; [ vlstill ];
50- platforms = stdenv.lib.platforms.unix;
51 };
52}
0
···1+{ stdenv, fetchurl, unzip, curl }:
23stdenv.mkDerivation {
4+ name = "dmd-2.066.1";
56 src = fetchurl {
7+ url = http://downloads.dlang.org/releases/2014/dmd.2.066.1.zip;
8+ sha256 = "1qifwgrl6h232zsnvcx3kmb5d0fsy7j9zv17r3b4vln7x5rvzc66";
9 };
1011+ buildInputs = [ unzip curl ];
120000013 buildPhase = ''
14 cd src/dmd
15 make -f posix.mak INSTALL_DIR=$out
16 export DMD=$PWD/dmd
17+ cd ../druntime
18 make -f posix.mak INSTALL_DIR=$out DMD=$DMD
19 cd ../phobos
20 make -f posix.mak INSTALL_DIR=$out DMD=$DMD
···2324 installPhase = ''
25 cd src/dmd
26+ mkdir $out
27+ mkdir $out/bin
28+ cp dmd $out/bin
02930+ cd ../druntime
31+ mkdir $out/include
32+ mkdir $out/include/d2
33+ cp -r import/* $out/include/d2
34+35 cd ../phobos
36+ mkdir $out/lib
37+ ${let bits = if stdenv.is64bit then "64" else "32"; in
38+ "cp generated/linux/release/${bits}/libphobos2.a $out/lib"
39+ }
40+41+ cp -r std $out/include/d2
42+ cp -r etc $out/include/d2
43+44+ cd $out/bin
45+ tee dmd.conf << EOF
46+ [Environment]
47+ DFLAGS=-I$out/include/d2 -L-L$out/lib -L--no-warn-search-mismatch -L--export-dynamic
48+ EOF
49 '';
5051+ meta = with stdenv.lib; {
52 description = "D language compiler";
53 homepage = http://dlang.org/;
54+ license = licenses.free; # parts under different licenses
55+ platforms = platforms.unix;
056 };
57}
58+
+9-3
pkgs/development/compilers/mozart/binary.nix
···2223 meta = with stdenv.lib; {
24 homepage = "http://www.mozart-oz.org/";
25- description = "The Mozart Programming System combines ongoing research in programming language design and implementation, constraint logic programming, distributed computing, and human-computer interfaces. Mozart implements the Oz language and provides both expressive power and advanced functionality.";
26-00000027 license = licenses.mit;
28- platforms = ["x86_64-linux"];
29 };
30}
···2223 meta = with stdenv.lib; {
24 homepage = "http://www.mozart-oz.org/";
25+ description = "Multiplatform implementation of the Oz programming language";
26+ longDescription = ''
27+ The Mozart Programming System combines ongoing research in
28+ programming language design and implementation, constraint logic
29+ programming, distributed computing, and human-computer
30+ interfaces. Mozart implements the Oz language and provides both
31+ expressive power and advanced functionality.
32+ '';
33 license = licenses.mit;
34+ platforms = [ "x86_64-linux" ];
35 };
36}
···1-{stdenv, fetchurl, pkgconfig, libusb, libtool, libexif, libjpeg, gettext}:
23stdenv.mkDerivation rec {
4 name = "libgphoto2-${meta.version}";
···7 url = "mirror://sourceforge/gphoto/${name}.tar.bz2";
8 sha256 = "0ij80nixichihv3iic7cgdq3irssk8waz1c25m6yypjl4kg6n3k0";
9 };
10-11 nativeBuildInputs = [ pkgconfig gettext ];
12- buildInputs = [ libtool libjpeg ];
1314 # These are mentioned in the Requires line of libgphoto's pkg-config file.
15- propagatedBuildInputs = [ libusb libexif ];
1617 meta = {
18 homepage = http://www.gphoto.org/proj/libgphoto2/;
···20 longDescription = ''
21 This is the library backend for gphoto2. It contains the code for PTP,
22 MTP, and other vendor specific protocols for controlling and transferring data
23- from digital cameras.
24 '';
25 version = "2.5.5.1";
26 # XXX: the homepage claims LGPL, but several src files are lgpl21Plus
27- license = stdenv.lib.licenses.lgpl21Plus;
28 platforms = with stdenv.lib.platforms; unix;
29 maintainers = with stdenv.lib.maintainers; [ jcumming ];
30 };
31}
0
···1+{ stdenv, fetchurl, pkgconfig, libusb1, libtool, libexif, libjpeg, gettext }:
23stdenv.mkDerivation rec {
4 name = "libgphoto2-${meta.version}";
···7 url = "mirror://sourceforge/gphoto/${name}.tar.bz2";
8 sha256 = "0ij80nixichihv3iic7cgdq3irssk8waz1c25m6yypjl4kg6n3k0";
9 };
10+11 nativeBuildInputs = [ pkgconfig gettext ];
12+ buildInputs = [ libtool libjpeg libusb1 ];
1314 # These are mentioned in the Requires line of libgphoto's pkg-config file.
15+ propagatedBuildInputs = [ libexif ];
1617 meta = {
18 homepage = http://www.gphoto.org/proj/libgphoto2/;
···20 longDescription = ''
21 This is the library backend for gphoto2. It contains the code for PTP,
22 MTP, and other vendor specific protocols for controlling and transferring data
23+ from digital cameras.
24 '';
25 version = "2.5.5.1";
26 # XXX: the homepage claims LGPL, but several src files are lgpl21Plus
27+ license = stdenv.lib.licenses.lgpl21Plus;
28 platforms = with stdenv.lib.platforms; unix;
29 maintainers = with stdenv.lib.maintainers; [ jcumming ];
30 };
31}
32+
+5-9
pkgs/development/libraries/libusb/default.nix
···1-{stdenv, fetchurl}:
23stdenv.mkDerivation {
4- name = "libusb-0.1.12";
56- # On non-linux, we get warnings compiling, and we don't want the
7- # build to break.
8- patchPhase = ''
9- sed -i s/-Werror// Makefile.in
10- '';
1112 src = fetchurl {
13- url = mirror://sourceforge/libusb/libusb-0.1.12.tar.gz;
14- sha256 = "0i4bacxkyr7xyqxbmb00ypkrv4swkgm0mghbzjsnw6blvvczgxip";
15 };
16}
···1+2+Context:
3+4+[make the #L reader macro standard conformant by not assuming anything about the representation of quasiquoted forms.
5+Douglas Katzman <dougk@google.com>**20140423044759
6+ Ignore-this: ccdda48acdf7b2033ac0f51ed48582fc
7+]
8+9+[fix for test for.previous.var-with-type-declaration
10+Jan Moringen <jmoringe@techfak.uni-bielefeld.de>**20140129144214
11+ Ignore-this: a617d046d90816827d370d3bbf38d2df
12+]
13+14+[housekeeping
15+attila.lendvai@gmail.com**20140129143709
16+ Ignore-this: a05c5fbace98b282a464b829711e064f
17+]
18+19+[added test for.previous.var-with-type-declaration
20+attila.lendvai@gmail.com**20140129143435
21+ Ignore-this: 6e9f419e118724c660d519c3fa9f8dd2
22+]
23+24+[added a restart to remove conflicting clauses
25+Russ Tyndall <russ@acceleration.net>**20120508185107
26+ Ignore-this: b7c4c6eec565dd435b8e9e5403fcb0a8
27+]
28+29+[added new failing test bug/collect-at-beginning, as reported by Paul Sexton
30+attila.lendvai@gmail.com**20121218144220
31+ Ignore-this: d55e7c22deeaf89b90d03d7ef01179d6
32+]
33+34+[Fix: If both AT BEGINNING and RESULT-TYPE are specified, RESULT-TYPE was ignored.
35+attila.lendvai@gmail.com**20120509225435
36+ Ignore-this: 20cf116df585ffedfbe63ce7a4092249
37+38+ Patched by Ilya Perminov
39+]
40+41+[fix package nickname in case sensitive mode
42+attila.lendvai@gmail.com**20110927152614
43+ Ignore-this: fb1ba1d418b4a20a0cd4e697d943a0e6
44+]
45+46+[move list-of-forms? out of the #L eval-when, because it's also used by other parts of iterate
47+attila.lendvai@gmail.com**20110119161133
48+ Ignore-this: 97545988c4a3eab02434f222120b1a1
49+]
50+51+[added bug/walk.2
52+attila.lendvai@gmail.com**20100603093335
53+ Ignore-this: faa1bd48d0450e76652552bb47bcff02
54+]
55+56+[first-time-p bugfix: return-code :body must return list of forms
57+Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20070525141533
58+ if-first-time not declared obsolete
59+ documentation strings for (iter:display-iterate-clauses) complete
60+]
61+62+[fix defmacro-driver example in manual
63+Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20070525081443]
64+65+[Use @:, @. and two spaces between sentences
66+Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20070525080932
67+ Move section on predicate (first-time-p) outside of gathering clauses
68+ Various typos and some clarifications
69+]
70+71+[document *list-end-test* removal in FOR...IN+ON
72+Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20070525074338]
73+74+[Renamed back to sharpL-reader
75+attila.lendvai@gmail.com**20070506100744]
76+77+[Fix sharpL reader, add :execute to the eval-when to make (load "iterate" :compiling t) work on clisp
78+attila.lendvai@gmail.com**20070506100704]
79+80+[Convert manual to Texinfo.
81+Luis Oliveira <loliveira@common-lisp.net>**20060713142915]
82+83+[make FOR...IN/ON with dotted lists work like LOOP
84+hoehle@users.sourceforge.net**20070503130604
85+ More precisely, FOR ON accepts dotted lists, FOR IN errors out.
86+ As a result, iterate::*list-end-test* was eliminated.
87+ Behaviour is now constant and does not depend on some special variable.
88+ Note: Documentation not yet updated, pending move to Texinfo.
89+]
90+91+[walk-tagbody: more testcases
92+Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20070503095309]
93+94+[walk-tagbody must not macroexpand symbol/tags among its statements
95+Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20070404124132]
96+97+[add ELSE test cases, remove GNU Arch tag
98+Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20070503093008]
99+100+[Clean up #L stuff, do not leave #L enabled after loading iterate
101+attila.lendvai@gmail.com**20070426153431]
102+103+[Set *list-end-test* to 'endp instead of 'atom, so (iter (for foo :in something-non-list)) fails instead of silently exists
104+attila.lendvai@gmail.com**20070215151652]
105+106+[wrap code in progns, to avoid possiblity of multiple nil tags in tagbody
107+ Henrik Hjelte <henrik@evahjelte.com>**20061025145324]
108+109+[test to detect bug, more than one nil tag in tagbody
110+ Henrik Hjelte <henrik@evahjelte.com>**20061025145128]
111+112+[Added release.sh
113+attila.lendvai@gmail.com**20060506155953]
114+115+[TAG 1.4.3
116+attila.lendvai@gmail.com**20060505134701]
···1+{stdenv, vimPlugins, vim_configurable, buildEnv, writeText, writeScriptBin}:
2+3+ /* usage example::
4+ let vimrcConfig = {
5+6+ # If you like pathogen use such
7+ pathogen.knownPlugins = vimPlugins; # optional
8+ pathogen.pluginNames = ["vim-addon-nix"];
9+10+ # If you like VAM use such:
11+ vam.knownPlugins = vimPlugins; # optional
12+ vam.pluginDictionaries = [
13+ # load always
14+ { name = "youcompleteme"; }
15+ { names = ["youcompleteme" "foo"]; }
16+ # only load when opening a .php file
17+ { name = "phpCompletion"; ft_regex = "^php\$"; }
18+ { name = "phpCompletion"; filename_regex = "^.php\$"; }
19+20+ # provide plugin which can be loaded manually:
21+ { name = "phpCompletion"; tag = "lazy"; }
22+ ];
23+24+ # if you like NeoBundle or Vundle provide an implementation
25+26+ # add custom .vimrc lines like this:
27+ customRC = ''
28+ set hidden
29+ '';
30+ };
31+ in vim_configurable.customize { name = "vim-with-plugins"; inherit vimrcConfig; };
32+33+ */
34+35+let
36+ inherit (stdenv) lib;
37+38+ findDependenciesRecursively = {knownPlugins, names}:
39+40+ let depsOf = name: (builtins.getAttr name knownPlugins).dependencies or [];
41+42+ recurseNames = path: names: lib.concatMap (name: recurse ([name]++path)) names;
43+44+ recurse = path:
45+ let name = builtins.head path;
46+ in if builtins.elem name (builtins.tail path)
47+ then throw "recursive vim dependencies"
48+ else [name] ++ recurseNames path (depsOf name);
49+50+ in lib.uniqList { inputList = recurseNames [] names; };
51+52+ vimrcFile = {
53+ vam ? null,
54+ pathogen ? null,
55+ customRC ? ""
56+ }:
57+58+ let
59+ /* pathogen mostly can set &rtp at startup time. Its used very commonly.
60+ */
61+ pathogenImpl = lib.optionalString (pathogen != null)
62+ (let
63+ knownPlugins = pathogen.knownPlugins or vimPlugins;
64+65+ plugins = map (name: knownPlugins.${name}) (findDependenciesRecursively { inherit knownPlugins; names = pathogen.pluginNames; });
66+67+ pluginsEnv = buildEnv {
68+ name = "pathogen-plugin-env";
69+ paths = map (x: "${x}/${vimPlugins.rtpPath}") plugins;
70+ };
71+ in
72+ ''
73+ let &rtp.=(empty(&rtp)?"":',')."${vimPlugins.pathogen.rtp}"
74+ execute pathogen#infect('${pluginsEnv}/{}')
75+ '');
76+77+ /*
78+ vim-addon-manager = VAM
79+80+ * maps names to plugin location
81+82+ * manipulates &rtp at startup time
83+ or when Vim has been running for a while
84+85+ * can activate plugins laziy (eg when loading a specific filetype)
86+87+ * knows about vim plugin dependencies (addon-info.json files)
88+89+ * still is minimalistic (only loads one file), the "check out" code it also
90+ has only gets loaded when a plugin is requested which is not found on disk
91+ yet
92+93+ */
94+ vamImpl = lib.optionalString (vam != null)
95+ (let
96+ knownPlugins = vam.knownPlugins or vimPlugins;
97+98+ toNames = x:
99+ if builtins.isString x then [x]
100+ else (lib.optional (x ? name) x.name)
101+ ++ (x.names or []);
102+103+ names = findDependenciesRecursively { inherit knownPlugins; names = lib.concatMap toNames vam.pluginDictionaries; };
104+105+ # Vim almost reads JSON, so eventually JSON support should be added to Nix
106+ # TODO: proper quoting
107+ toNix = x:
108+ if (builtins.isString x) then "'${x}'"
109+ else if builtins.isAttrs x && builtins ? out then toNix "${x}" # a derivation
110+ else if builtins.isAttrs x then "{${lib.concatStringsSep ", " (lib.mapAttrsToList (n: v: "${toNix n}: ${toNix v}") x)}}"
111+ else if builtins.isList x then "[${lib.concatMapStringsSep ", " toNix x}]"
112+ else throw "turning ${lib.showVal x} into a VimL thing not implemented yet";
113+114+ in assert builtins.hasAttr "vim-addon-manager" knownPlugins;
115+ ''
116+ let g:nix_plugin_locations = {}
117+ ${lib.concatMapStrings (name: ''
118+ let g:nix_plugin_locations['${name}'] = "${knownPlugins.${name}.rtp}"
119+ '') names}
120+ let g:nix_plugin_locations['vim-addon-manager'] = "${vimPlugins."vim-addon-manager".rtp}"
121+122+ let g:vim_addon_manager = {}
123+124+ if exists('g:nix_plugin_locations')
125+ " nix managed config
126+127+ " override default function making VAM aware of plugin locations:
128+ fun! NixPluginLocation(name)
129+ let path = get(g:nix_plugin_locations, a:name, "")
130+ return path == "" ? vam#DefaultPluginDirFromName(a:name) : path
131+ endfun
132+ let g:vim_addon_manager.plugin_dir_by_name = 'NixPluginLocation'
133+ " tell Vim about VAM:
134+ let &rtp.=(empty(&rtp)?"":','). g:nix_plugin_locations['vim-addon-manager']
135+ else
136+ " standalone config
137+138+ let &rtp.=(empty(&rtp)?"":',').c.plugin_root_dir.'/vim-addon-manager'
139+ if !isdirectory(c.plugin_root_dir.'/vim-addon-manager/autoload')
140+ " checkout VAM
141+ execute '!git clone --depth=1 git://github.com/MarcWeber/vim-addon-manager '
142+ \ shellescape(c.plugin_root_dir.'/vim-addon-manager', 1)
143+ endif
144+ endif
145+146+ " tell vam about which plugins to load when:
147+ let l = []
148+ ${lib.concatMapStrings (p: "call add(l, ${toNix p})\n") vam.pluginDictionaries}
149+ call vam#Scripts(l, {})
150+ '');
151+152+ # somebody else could provide these implementations
153+ vundleImpl = "";
154+155+ neobundleImpl = "";
156+157+158+ in writeText "vimrc" ''
159+ " minimal setup, generated by NIX
160+ set nocompatible
161+ filetype indent plugin on | syn on
162+163+ ${vamImpl}
164+ ${pathogenImpl}
165+ ${vundleImpl}
166+ ${neobundleImpl}
167+168+ ${customRC}
169+ '';
170+171+in
172+173+rec {
174+ inherit vimrcFile;
175+176+ # shell script with custom name passing [-u vimrc] [-U gvimrc] to vim
177+ vimWithRC = {vimExecutable, name ? null, vimrcFile ? null, gvimrcFile ? null}:
178+ let rcOption = o: file: stdenv.lib.optionalString (file != null) "-${o} ${file}";
179+ in writeScriptBin (if name == null then "vim" else name) ''
180+ #!/bin/sh
181+ exec ${vimExecutable} ${rcOption "u" vimrcFile} ${rcOption "U" gvimrcFile} "$@"
182+ '';
183+184+ # add a customize option to a vim derivation
185+ makeCustomizable = vim: vim // {
186+ customize = {name, vimrcConfig}: vimWithRC {
187+ vimExecutable = "${vim}/bin/vim";
188+ inherit name;
189+ vimrcFile = vimrcFile vimrcConfig;
190+ };
191+ };
192+193+ # test cases:
194+ test_vim_with_vim_addon_nix_using_vam = vim_configurable.customize {
195+ name = "vim-with-vim-addon-nix-using-vam";
196+ vimrcConfig.vam.pluginDictionaries = [{name = "vim-addon-nix"; }];
197+ };
198+199+ test_vim_with_vim_addon_nix_using_pathogen = vim_configurable.customize {
200+ name = "vim-with-vim-addon-nix-using-pathogen";
201+ vimrcConfig.pathogen.pluginNames = [ "vim-addon-nix" ];
202+ };
203+}
-3
pkgs/os-specific/linux/kernel/common-config.nix
···318 ${optionalString (!stdenv.is64bit) ''
319 HIGHMEM64G? y # We need 64 GB (PAE) support for Xen guest support.
320 ''}
321- ${optionalString stdenv.is64bit ''
322- INTEL_IOMMU_DEFAULT_ON y
323- ''}
324 ${optionalString (versionAtLeast version "3.9" && stdenv.is64bit) ''
325 VFIO_PCI_VGA y
326 ''}
···318 ${optionalString (!stdenv.is64bit) ''
319 HIGHMEM64G? y # We need 64 GB (PAE) support for Xen guest support.
320 ''}
000321 ${optionalString (versionAtLeast version "3.9" && stdenv.is64bit) ''
322 VFIO_PCI_VGA y
323 ''}
···1+diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
2+index 33f9e0e..2f55e56 100644
3+--- a/module/zfs/zfs_vnops.c
4++++ b/module/zfs/zfs_vnops.c
5+@@ -474,15 +474,6 @@ zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
6+ }
7+8+ /*
9+- * Check for mandatory locks
10+- */
11+- if (mandatory_lock(ip) &&
12+- !lock_may_read(ip, uio->uio_loffset, uio->uio_resid)) {
13+- ZFS_EXIT(zsb);
14+- return (SET_ERROR(EAGAIN));
15+- }
16+-
17+- /*
18+ * If we're in FRSYNC mode, sync out this znode before reading it.
19+ */
20+ if (ioflag & FRSYNC || zsb->z_os->os_sync == ZFS_SYNC_ALWAYS)
21+@@ -651,15 +642,6 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
22+ }
23+24+ /*
25+- * Check for mandatory locks before calling zfs_range_lock()
26+- * in order to prevent a deadlock with locks set via fcntl().
27+- */
28+- if (mandatory_lock(ip) && !lock_may_write(ip, woff, n)) {
29+- ZFS_EXIT(zsb);
30+- return (SET_ERROR(EAGAIN));
31+- }
32+-
33+- /*
34+ * Pre-fault the pages to ensure slow (eg NFS) pages
35+ * don't hold up txg.
36+ * Skip this if uio contains loaned arc_buf.
37+diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c
38+index 90dbfd3..f02c021 100644
39+--- a/module/zfs/zfs_znode.c
40++++ b/module/zfs/zfs_znode.c
41+@@ -1546,7 +1546,6 @@ zfs_trunc(znode_t *zp, uint64_t end)
42+ int
43+ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
44+ {
45+- struct inode *ip = ZTOI(zp);
46+ dmu_tx_t *tx;
47+ zfs_sb_t *zsb = ZTOZSB(zp);
48+ zilog_t *zilog = zsb->z_log;
49+@@ -1567,15 +1566,6 @@ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
50+ goto out;
51+ }
52+53+- /*
54+- * Check for any locks in the region to be freed.
55+- */
56+- if (ip->i_flock && mandatory_lock(ip)) {
57+- uint64_t length = (len ? len : zp->z_size - off);
58+- if (!lock_may_write(ip, off, length))
59+- return (SET_ERROR(EAGAIN));
60+- }
61+-
62+ if (len == 0) {
63+ error = zfs_trunc(zp, off);
64+ } else {
+29
pkgs/servers/zeromq/default.nix
···00000000000000000000000000000
···1+{ stdenv, fetchurl }:
2+3+stdenv.mkDerivation rec {
4+ name = "zeromq";
5+ version = "4.1.0-rc1";
6+7+ src = fetchurl {
8+ url = "http://download.zeromq.org/${name}-${version}.tar.gz";
9+ sha256 = "e8e6325abe2ede0a9fb3d1abbe425d8a7911f6ac283652ee49b36afbb0164d60";
10+ };
11+12+ doCheck = true;
13+14+ meta = {
15+ description = "0MQ is a lightweight messaging kernel";
16+ longDescription = ''
17+ The 0MQ lightweight messaging kernel is a library which extends
18+ the standard socket interfaces with features traditionally provided
19+ by specialised messaging middleware products. 0MQ sockets provide
20+ an abstraction of asynchronous message queues, multiple messaging patterns,
21+ message filtering (subscriptions), seamless access to multiple transport protocols
22+ and more.
23+ '';
24+ homepage = http://zeromq.org/;
25+ license = stdenv.lib.licenses.gpl3;
26+ maintainers = [ stdenv.lib.maintainers.gavin ];
27+ platforms = stdenv.lib.platforms.all;
28+ };
29+}
+1
pkgs/stdenv/generic/default.nix
···183 isArm = system == "armv5tel-linux"
184 || system == "armv6l-linux"
185 || system == "armv7l-linux";
0186187 # Whether we should run paxctl to pax-mark binaries.
188 needsPax = isLinux;
···183 isArm = system == "armv5tel-linux"
184 || system == "armv6l-linux"
185 || system == "armv7l-linux";
186+ isBigEndian = system == "powerpc-linux";
187188 # Whether we should run paxctl to pax-mark binaries.
189 needsPax = isLinux;