forked from mirrors/nixpkgs
* Sync with the trunk.
svn path=/nixpkgs/branches/stdenv-updates/; revision=14057
This commit is contained in:
commit
390695e73f
|
@ -31,6 +31,7 @@
|
|||
<xi:include href="introduction.xml" />
|
||||
<xi:include href="quick-start.xml" />
|
||||
<xi:include href="stdenv.xml" />
|
||||
<xi:include href="meta.xml" />
|
||||
|
||||
|
||||
<!-- outline -->
|
||||
|
|
200
doc/meta.xml
Normal file
200
doc/meta.xml
Normal file
|
@ -0,0 +1,200 @@
|
|||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="chap-meta">
|
||||
|
||||
<title>Meta-attributes</title>
|
||||
|
||||
<para>Nix packages can declare <emphasis>meta-attributes</emphasis>
|
||||
that contain information about a package such as a description, its
|
||||
homepage, its license, and so on. For instance, the GNU Hello package
|
||||
has a <varname>meta</varname> declaration like this:
|
||||
|
||||
<programlisting>
|
||||
meta = {
|
||||
description = "A program that produces a familiar, friendly greeting";
|
||||
longDescription = ''
|
||||
GNU Hello is a program that prints "Hello, world!" when you run it.
|
||||
It is fully customizable.
|
||||
'';
|
||||
homepage = http://www.gnu.org/software/hello/manual/;
|
||||
license = "GPLv3+";
|
||||
};
|
||||
</programlisting>
|
||||
|
||||
</para>
|
||||
|
||||
<para>Meta-attributes are not passed to the builder of the package.
|
||||
Thus, a change to a meta-attribute doesn’t trigger a recompilation of
|
||||
the package. The value of a meta-attribute must a string.</para>
|
||||
|
||||
<para>The meta-attributes of a package can be queried from the
|
||||
command-line using <command>nix-env</command>:
|
||||
|
||||
<screen>
|
||||
$ nix-env -qa hello --meta --xml
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<items>
|
||||
<item attrPath="hello" name="hello-2.3" system="i686-linux">
|
||||
<meta name="description" value="A program that produces a familiar, friendly greeting" />
|
||||
<meta name="homepage" value="http://www.gnu.org/software/hello/manual/" />
|
||||
<meta name="license" value="GPLv3+" />
|
||||
<meta name="longDescription" value="GNU Hello is a program that prints &quot;Hello, world!&quot; when you run it.&#xA;It is fully customizable.&#xA;" />
|
||||
</item>
|
||||
</items>
|
||||
</screen>
|
||||
|
||||
<command>nix-env</command> knows about the
|
||||
<varname>description</varname> field specifically:
|
||||
|
||||
<screen>
|
||||
$ nix-env -qa hello --description
|
||||
hello-2.3 A program that produces a familiar, friendly greeting
|
||||
</screen>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<section><title>Standard meta-attributes</title>
|
||||
|
||||
<para>The following meta-attributes have a standard
|
||||
interpretation:</para>
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>description</varname></term>
|
||||
<listitem><para>A short (one-line) description of the package.
|
||||
Don’t include a period at the end. This is shown by
|
||||
<command>nix-env -q --description</command> and also on the
|
||||
Nixpkgs release pages. Example: <literal>"A program that produces
|
||||
a familiar, friendly greeting"</literal></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>longDescription</varname></term>
|
||||
<listitem><para>An arbitrarily long description of the
|
||||
package.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>homepage</varname></term>
|
||||
<listitem><para>The package’s homepage. Example:
|
||||
<literal>http://www.gnu.org/software/hello/manual/</literal></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>license</varname></term>
|
||||
<listitem><para>The license for the package. See below for the
|
||||
allowed values.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>priority</varname></term>
|
||||
<listitem><para>The <emphasis>priority</emphasis> of the package,
|
||||
used by <command>nix-env</command> to resolve file name conflicts
|
||||
between packages. See the Nix manual page for
|
||||
<command>nix-env</command> for details. Example:
|
||||
<literal>"10"</literal> (a low-priority
|
||||
package).</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<section><title>Licenses</title>
|
||||
|
||||
<note><para>This is just a first attempt at standardising the license
|
||||
attribute.</para></note>
|
||||
|
||||
<para>The <varname>meta.license</varname> attribute must be one of the
|
||||
following:
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>GPL</varname></term>
|
||||
<listitem><para>GNU General Public License; version not
|
||||
specified.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>GPLv2</varname></term>
|
||||
<listitem><para>GNU General Public License, version
|
||||
2.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>GPLv2+</varname></term>
|
||||
<listitem><para>GNU General Public License, version
|
||||
2 or higher.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>GPLv3</varname></term>
|
||||
<listitem><para>GNU General Public License, version
|
||||
3.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>GPLv3+</varname></term>
|
||||
<listitem><para>GNU General Public License, version
|
||||
3 or higher.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>free</varname></term>
|
||||
<listitem><para>Catch-all for free software licenses not listed
|
||||
above.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>free-copyleft</varname></term>
|
||||
<listitem><para>Catch-all for free, copyleft software licenses not
|
||||
listed above.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>unfree-redistributable</varname></term>
|
||||
<listitem><para>Unfree package that can be redistributed in binary
|
||||
form. That is, it’s legal to redistribute the
|
||||
<emphasis>output</emphasis> of the derivation. This means that
|
||||
the package can be included in the Nixpkgs
|
||||
channel.</para>
|
||||
|
||||
<para>Sometimes proprietary software can only be redistributed
|
||||
unmodified. Make sure the builder doesn’t actually modify the
|
||||
original binaries; otherwise we’re breaking the license. For
|
||||
instance, the NVIDIA X11 drivers can be redistributed unmodified,
|
||||
but our builder applies <command>patchelf</command> to make them
|
||||
work. Thus, its license is <varname>unfree</varname> and it
|
||||
cannot be included in the Nixpkgs channel.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>unfree</varname></term>
|
||||
<listitem><para>Unfree package that cannot be redistributed. You
|
||||
can build it yourself, but you cannot redistribute the output of
|
||||
the derivation. Thus it cannot be included in the Nixpkgs
|
||||
channel.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>unfree-redistributable-firmware</varname></term>
|
||||
<listitem><para>This package supplies unfree, redistributable
|
||||
firmware. This is a separate value from
|
||||
<varname>unfree-redistributable</varname> because not everybody
|
||||
cares whether firmware is free.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
</chapter>
|
|
@ -1,19 +1,16 @@
|
|||
args: with args;
|
||||
let
|
||||
flacFun = version: hash:
|
||||
stdenv.mkDerivation rec {
|
||||
name = "flac-${version}";
|
||||
src = fetchurl ({
|
||||
url = "http://downloads.xiph.org/releases/flac/${name}.tar.gz";
|
||||
} // hash);
|
||||
buildInputs = [libogg];
|
||||
meta = {
|
||||
homepage = http://flac.sourceforge.net;
|
||||
};
|
||||
};
|
||||
in
|
||||
stdenv.lib.listOfListsToAttrs [
|
||||
[ "default" (flacFun "1.2.1" { sha256 = "1pry5lgzfg57pga1zbazzdd55fkgk3v5qy4axvrbny5lrr5s8dcn"; }) ]
|
||||
[ "1.2.1" (flacFun "1.2.1" { sha256 = "1pry5lgzfg57pga1zbazzdd55fkgk3v5qy4axvrbny5lrr5s8dcn"; }) ]
|
||||
[ "1.1.2" (flacFun "1.1.2" { md5 = "2bfc127cdda02834d0491ab531a20960"; }) ]
|
||||
]
|
||||
{stdenv, fetchurl, libogg}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "flac-1.2.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = mirror://sourceforge/flac/flac-1.2.1.tar.gz;
|
||||
sha256 = "1pry5lgzfg57pga1zbazzdd55fkgk3v5qy4axvrbny5lrr5s8dcn";
|
||||
};
|
||||
|
||||
buildInputs = [libogg];
|
||||
|
||||
meta = {
|
||||
homepage = http://flac.sourceforge.net;
|
||||
};
|
||||
}
|
||||
|
|
38
pkgs/applications/editors/emacs-modes/eieio/default.nix
Normal file
38
pkgs/applications/editors/emacs-modes/eieio/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ fetchurl, stdenv, emacs }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "eieio-0.17";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/cedet/${name}.tar.gz";
|
||||
sha256 = "0n31z9d47ar10g9xrnzz3nl4pmixw1nkk0kpxaillls7xvjd1zy2";
|
||||
};
|
||||
|
||||
buildInputs = [ emacs ];
|
||||
|
||||
doCheck = false;
|
||||
checkPhase = "make test";
|
||||
|
||||
installPhase = ''
|
||||
ensureDir "$out/share/emacs/site-lisp"
|
||||
cp -v *.el *.elc "$out/share/emacs/site-lisp"
|
||||
chmod a-x "$out/share/emacs/site-lisp/"*
|
||||
|
||||
ensureDir "$out/share/info"
|
||||
cp -v *.info* "$out/share/info"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "EIEIO: Enhanced Implementation of Emacs Interpreted Objects";
|
||||
|
||||
longDescription = ''
|
||||
EIEIO is a package which implements a CLOS subset for Emacs. It
|
||||
includes examples which can draw simple tree graphs, and bar
|
||||
charts.
|
||||
'';
|
||||
|
||||
license = "GPLv2+";
|
||||
|
||||
homepage = http://cedet.sourceforge.net/;
|
||||
};
|
||||
}
|
50
pkgs/applications/editors/emacs-modes/semantic/default.nix
Normal file
50
pkgs/applications/editors/emacs-modes/semantic/default.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ fetchurl, stdenv, emacs, eieio }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "semantic-1.4.4";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/cedet/${name}.tar.gz";
|
||||
sha256 = "0j50dqdy5bl35vqfbgxp93grs11llg9i4398044br73lvvif9n5f";
|
||||
};
|
||||
|
||||
buildInputs = [ emacs eieio ];
|
||||
|
||||
doCheck = true;
|
||||
checkPhase = "make Tests";
|
||||
|
||||
preConfigure = ''
|
||||
sed -i "Makefile" -es'|^LOADPATH[[:blank:]]*=.*$|LOADPATH = ${eieio}/share/emacs/site-lisp|g'
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
ensureDir "$out/share/emacs/site-lisp"
|
||||
cp -v *.el *.elc "$out/share/emacs/site-lisp"
|
||||
chmod a-x "$out/share/emacs/site-lisp/"*
|
||||
|
||||
ensureDir "$out/share/info"
|
||||
cp -v *.info* "$out/share/info"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Semantic, infrastructure for parser based text analysis in Emacs";
|
||||
|
||||
longDescription = ''
|
||||
Semantic is an infrastructure for parser based text analysis in
|
||||
Emacs. It is a lexer, parser-generator, and parser. It is
|
||||
written in Emacs Lisp and is customized to the way Emacs thinks
|
||||
about language files, and is optimized to use Emacs' parsing
|
||||
capabilities.
|
||||
|
||||
Semantic's goal is to provide an intermediate API for authors of
|
||||
language agnostic tools who want to deal with languages in a
|
||||
generic way. It also provides a simple way for Mode Authors who
|
||||
are experts in their language, to provide a parser for those
|
||||
tool authors, without knowing anything about those tools.
|
||||
'';
|
||||
|
||||
license = "GPLv2+";
|
||||
|
||||
homepage = http://cedet.sourceforge.net/;
|
||||
};
|
||||
}
|
|
@ -12,7 +12,7 @@ preConfigure() {
|
|||
--replace /usr/lib/crtn.o $libc/lib/crtn.o
|
||||
done
|
||||
|
||||
for i in Makefile.in ./src/Makefile.in ./lib-src/Makefile.in ./leim/Makefile.in ./admin/unidata/Makefile; do
|
||||
for i in Makefile.in ./src/Makefile.in ./lib-src/Makefile.in ./leim/Makefile.in; do
|
||||
substituteInPlace $i --replace /bin/pwd pwd
|
||||
done
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
, xftSupport ? false
|
||||
, stdenv, fetchurl, ncurses, x11, libXaw ? null, libXpm ? null, Xaw3d ? null
|
||||
, pkgconfig ? null, gtk ? null, libXft ? null
|
||||
, libpng, libjpeg, libungif, libtiff
|
||||
, libpng, libjpeg, libungif, libtiff, texinfo
|
||||
}:
|
||||
|
||||
assert xawSupport -> libXaw != null;
|
||||
|
@ -14,14 +14,15 @@ assert xaw3dSupport -> Xaw3d != null;
|
|||
assert gtkGUI -> pkgconfig != null && gtk != null;
|
||||
assert xftSupport -> libXft != null && libpng != null; # libpng = probably a bug
|
||||
|
||||
let date = "20080228"; in
|
||||
stdenv.mkDerivation {
|
||||
name = "emacs-snapshot-23.0.0.1-pre20070705";
|
||||
name = "emacs-snapshot-23-${date}";
|
||||
|
||||
builder = ./builder.sh;
|
||||
|
||||
src = fetchurl {
|
||||
url = http://debs.peadrop.com/pool/edgy/backports/emacs-snapshot_20070705.orig.tar.gz;
|
||||
sha256 = "1blybacpsxha2v24kj482wl3g1z93rwddfc8rsqsk6dr6f5kdj5q";
|
||||
url = "http://ppa.launchpad.net/avassalotti/ubuntu/pool/main/e/emacs-snapshot/emacs-snapshot_${date}.orig.tar.gz";
|
||||
sha256 = "1cix1qjrynidvdyww3g8fm1wyggc82qjxbfbv3rx630szm1v6bm7";
|
||||
};
|
||||
|
||||
# patches = [
|
||||
|
@ -29,7 +30,7 @@ stdenv.mkDerivation {
|
|||
# ];
|
||||
|
||||
buildInputs = [
|
||||
ncurses x11
|
||||
ncurses x11 texinfo
|
||||
(if xawSupport then libXaw else null)
|
||||
(if xpmSupport then libXpm else null)
|
||||
(if xaw3dSupport then Xaw3d else null)
|
||||
|
@ -39,12 +40,12 @@ stdenv.mkDerivation {
|
|||
++ (if xftSupport then [libXft] else []);
|
||||
|
||||
configureFlags = "
|
||||
${if gtkGUI then "--with-gtk --enable-font-backend --with-xft" else ""}
|
||||
${if gtkGUI then "--with-x-toolkit=gtk --enable-font-backend --with-xft" else ""}
|
||||
";
|
||||
|
||||
meta = {
|
||||
description = "Emacs with Unicode, GTK and Xft support (23.x alpha)";
|
||||
homepage = http://www.emacswiki.org/cgi-bin/wiki/XftGnuEmacs;
|
||||
license = "GPL";
|
||||
license = "GPLv3+";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ composableDerivation {
|
|||
sha256 = "11hxkb6r2550c4n13nwr0d8afvh30qjyr5c2hw16zgay43rb0kci";
|
||||
};
|
||||
|
||||
cfgOption = "--enable-gui=auto --with-features=${args.features}";
|
||||
configureFlags = ["--enable-gui=auto" "--with-features=${args.features}"];
|
||||
|
||||
buildInputs = [ncurses pkgconfig]
|
||||
++ [ libX11 libXext libSM libXpm libXt libXaw libXau libXmu ];
|
||||
++ [ gtk libX11 libXext libSM libXpm libXt libXaw libXau libXmu ];
|
||||
|
||||
# most interpreters aren't tested yet.. (see python for example how to do it)
|
||||
flags = {}
|
||||
|
@ -23,10 +23,10 @@ composableDerivation {
|
|||
// edf { name = "xsmp"; } #Disable XSMP session management
|
||||
// edf { name = "xsmp_interact"; } #Disable XSMP interaction
|
||||
// edf { name = "mzscheme"; } #Include MzScheme interpreter.
|
||||
// edf { name = "perl"; } #Include Perl interpreter.
|
||||
// edf { name = "perl"; feat = "perlinterp"; enable = { buildInputs = [perl]; };} #Include Perl interpreter.
|
||||
// edf { name = "python"; feat = "pythoninterp"; enable = { buildInputs = [python]; }; } #Include Python interpreter.
|
||||
// edf { name = "tcl"; } #Include Tcl interpreter.
|
||||
// edf { name = "ruby"; } #Include Ruby interpreter.
|
||||
// edf { name = "tcl"; enable = { buildInputs = [tcl]; }; } #Include Tcl interpreter.
|
||||
// edf { name = "ruby"; feat = "rubyinterp"; enable = { buildInputs = [ruby]; };} #Include Ruby interpreter.
|
||||
// edf { name = "cscope"; } #Include cscope interface.
|
||||
// edf { name = "workshop"; } #Include Sun Visual Workshop support.
|
||||
// edf { name = "netbeans"; } #Disable NetBeans integration support.
|
||||
|
|
23
pkgs/applications/graphics/comical/default.nix
Normal file
23
pkgs/applications/graphics/comical/default.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{stdenv, fetchurl, wxGTK, utillinux, zlib }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "comical-0.8";
|
||||
src = fetchurl {
|
||||
url = mirror://sourceforge/comical/comical-0.8.tar.gz;
|
||||
sha256 = "0b6527cc06b25a937041f1eb248d0fd881cf055362097036b939817f785ab85e";
|
||||
};
|
||||
buildInputs = [ wxGTK utillinux zlib ];
|
||||
patchPhase = ''
|
||||
sed -i -e 's@"zlib\\.h"@<zlib.h>@' unzip/unzip.h
|
||||
sed -i -e 's@/usr/local@'$out@ \
|
||||
-e 's@-lminiunzip@-lminiunzip -lz@' Makefile
|
||||
'';
|
||||
|
||||
installPhase = "mkdir -p $out/bin ; make install";
|
||||
|
||||
meta = {
|
||||
description = "Viewer of CBR and CBZ files, often used to store scanned comics";
|
||||
homepage = http://comical.sourceforge.net/;
|
||||
license = "GPLv2+";
|
||||
};
|
||||
}
|
|
@ -4,11 +4,11 @@
|
|||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "gimp-2.6.3";
|
||||
name = "gimp-2.6.4";
|
||||
|
||||
src = fetchurl {
|
||||
url = ftp://ftp.gtk.org/pub/gimp/v2.6/gimp-2.6.3.tar.bz2;
|
||||
sha256 = "1vvixi4336pjwjfx1p803jb3c12lk84adinaqvbpqdqx8xrd5r08";
|
||||
url = ftp://ftp.gtk.org/pub/gimp/v2.6/gimp-2.6.4.tar.bz2;
|
||||
sha256 = "1qlpszdaskh575xjibkxvvqxmgp8j7v1i1z2dnzz6gazni2pmll6";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
|
|
32
pkgs/applications/graphics/xaos/default.nix
Normal file
32
pkgs/applications/graphics/xaos/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
a :
|
||||
let
|
||||
fetchurl = a.fetchurl;
|
||||
|
||||
version = a.lib.getAttr ["version"] "3.4" a;
|
||||
buildInputs = with a; [
|
||||
aalib gsl libpng libX11 xproto libXext xextproto
|
||||
libXt zlib gettext intltool perl
|
||||
];
|
||||
in
|
||||
rec {
|
||||
src = fetchurl {
|
||||
url = "http://prdownloads.sourceforge.net/xaos/XaoS-${version}.tar.gz";
|
||||
sha256 = "004cdb0xv14shyixs79bf95s52s7aidr5bqfn9wb49gpasrsknrc";
|
||||
};
|
||||
|
||||
inherit buildInputs;
|
||||
configureFlags = [];
|
||||
|
||||
/* doConfigure should be removed if not needed */
|
||||
phaseNames = ["preConfigure" "doConfigure" "doMakeInstall"];
|
||||
|
||||
preConfigure = a.FullDepEntry (''
|
||||
sed -e s@/usr/@"$out/"@g -i configure $(find . -name 'Makefile*')
|
||||
ensureDir $out/share/locale
|
||||
'') ["doUnpack" "minInit" "defEnsureDir"];
|
||||
|
||||
name = "xaos-" + version;
|
||||
meta = {
|
||||
description = "XaoS - fractal viewer";
|
||||
};
|
||||
}
|
38
pkgs/applications/misc/thinking-rock/default.nix
Normal file
38
pkgs/applications/misc/thinking-rock/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
args:
|
||||
args.stdenv.mkDerivation {
|
||||
name = "thinkingrock-2.0.1-binary";
|
||||
|
||||
src = args.fetchurl {
|
||||
url = mirror://sourceforge.net/thinkingrock/tr-2.0.1.tar.gz;
|
||||
sha256 = "1fsanxh0li8yqsspagx1w1ykmvfnm6h44i6gd02v05abx8q25jk1";
|
||||
};
|
||||
|
||||
/* it would be a really bad idea to put thinkingrock tr executable in PATH!
|
||||
the tr.sh script does use the coreutils tr itself
|
||||
That's why I've renamed the wrapper and called it thinkingrock
|
||||
However you may not rename the bin/tr script cause it will notice and throw an
|
||||
"java.lang.IllegalArgumentException: Malformed branding token: thinkingrock"
|
||||
exception. I hope that's fine
|
||||
*/
|
||||
|
||||
buildPhase = ''
|
||||
# only keep /bin/tr
|
||||
ls -1 bin/* | grep -ve 'bin/tr''$' | xargs rm
|
||||
# don't keep the other .exe file either
|
||||
find . -iname "*.exe" | xargs -n1 rm
|
||||
ensureDir $out/{nix-support/tr-files,bin}
|
||||
cp -r . $out/nix-support/tr-files
|
||||
cat >> $out/bin/thinkingrock << EOF
|
||||
#!/bin/sh
|
||||
exec $out/nix-support/tr-files/bin/tr "$@"
|
||||
EOF
|
||||
chmod +x $out/bin/thinkingrock
|
||||
'';
|
||||
installPhase = ":";
|
||||
|
||||
meta = {
|
||||
description = "task managing system";
|
||||
homepage = http://www.thinkingrock.com.au/;
|
||||
license = "CDDL"; # Common Development and Distribution License
|
||||
};
|
||||
}
|
|
@ -11,12 +11,12 @@
|
|||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "firefox-3.0.5";
|
||||
name = "firefox-3.0.6";
|
||||
|
||||
src = fetchurl {
|
||||
# Don't forget to update xulrunner.nix as well!
|
||||
url = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.5/source/firefox-3.0.5-source.tar.bz2;
|
||||
sha1 = "f934e073efaad3d4dde847c8491fa9529564d5d2";
|
||||
url = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.6/source/firefox-3.0.6-source.tar.bz2;
|
||||
sha1 = "e2845c07b507308664f6f39086a050b2773382fb";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
let
|
||||
|
||||
version = "1.9.0.5"; # this attribute is used by other packages
|
||||
version = "1.9.0.6"; # this attribute is used by other packages
|
||||
|
||||
in
|
||||
|
||||
|
@ -19,8 +19,8 @@ stdenv.mkDerivation {
|
|||
name = "xulrunner-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.5/source/firefox-3.0.5-source.tar.bz2;
|
||||
sha1 = "f934e073efaad3d4dde847c8491fa9529564d5d2";
|
||||
url = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.6/source/firefox-3.0.6-source.tar.bz2;
|
||||
sha1 = "e2845c07b507308664f6f39086a050b2773382fb";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
|
|
|
@ -1,28 +1,25 @@
|
|||
{ stdenv, fetchurl, lzma, pkgconfig, gtk, pango, perl, python, zip, libIDL
|
||||
{ stdenv, fetchurl, pkgconfig, gtk, pango, perl, python, zip, libIDL
|
||||
, libjpeg, libpng, zlib, cairo, dbus, dbus_glib, bzip2, xlibs
|
||||
, gnomevfs, libgnomeui
|
||||
, freetype, fontconfig
|
||||
, application ? "browser" }:
|
||||
|
||||
let version = "3.0.5-g1"; in
|
||||
let version = "3.0.6-g1"; in
|
||||
stdenv.mkDerivation {
|
||||
name = "icecat-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/gnuzilla/${version}/icecat-${version}.tar.lzma";
|
||||
sha256 = "15s71zjwiqpaqsmjzk5kxwamxzkb3p7172dbazqyxmgvca9yw8bs";
|
||||
url = "mirror://gnu/gnuzilla/${version}/icecat-${version}.tar.bz2";
|
||||
sha256 = "0lcxvlviwgaj9w6ywn0656a2y3qdxdlw0mf5f9ljdd9jpw4fxjih";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
lzma
|
||||
libgnomeui gnomevfs
|
||||
pkgconfig gtk perl zip libIDL libjpeg libpng zlib cairo bzip2
|
||||
python dbus dbus_glib pango freetype fontconfig
|
||||
xlibs.libXi xlibs.libX11 xlibs.libXrender xlibs.libXft xlibs.libXt
|
||||
];
|
||||
|
||||
unpackCmd = "lzma -d < $src | tar xv";
|
||||
|
||||
patches = [ ./skip-gre-registration.patch ];
|
||||
|
||||
configureFlags = [
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
a :
|
||||
let
|
||||
fetchurl = a.fetchurl;
|
||||
|
||||
version = a.lib.getAttr ["version"] "1.12.0" a;
|
||||
buildInputs = with a; [
|
||||
firefox libX11 xproto
|
||||
];
|
||||
in
|
||||
rec {
|
||||
src = fetchurl {
|
||||
url = "http://mozplugger.mozdev.org/files/mozplugger-${version}.tar.gz";
|
||||
sha256 = "1vpggfmbv4h3srk80rgidd020i03hrkpb7cfxkwagkcd0zcal4hk";
|
||||
};
|
||||
|
||||
inherit buildInputs;
|
||||
configureFlags = [];
|
||||
makeFlags = ["linux" "prefix=" "root=$out"];
|
||||
|
||||
preBuild = a.FullDepEntry(''
|
||||
sed -e s@/usr/@"$out/"@g -i mozplugger.c
|
||||
'') ["doUnpack" "minInit"];
|
||||
|
||||
postInstall = a.FullDepEntry(''
|
||||
ensureDir $out/share/${name}/plugin
|
||||
ln -s $out/lib/mozilla/plugins/mozplugger.so $out/share/${name}/plugin
|
||||
'') ["doMakeInstall" "minInit" "defEnsureDir"];
|
||||
|
||||
/* doConfigure should be removed if not needed */
|
||||
phaseNames = ["preBuild" "doMakeInstall" "postInstall"];
|
||||
|
||||
name = "mozplugger-" + version;
|
||||
meta = {
|
||||
description = "Mozilla plugin for launching external program for handling in-page objects";
|
||||
};
|
||||
}
|
|
@ -1,17 +1,30 @@
|
|||
args: with args;
|
||||
{ fetchurl, stdenv, gnutls, glib, pkgconfig }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "bitlbee-1.2.1";
|
||||
name = "bitlbee-1.2.3";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://bitlbee/src/" + name + ".tar.gz";
|
||||
sha256 = "01ld349f5k89lk6j7xn4sdbbf1577kp845vmnj3sfaza9s1fhm26";
|
||||
sha256 = "1qj5cx0lqhg6dy2gdjb05ap963r84rv1b96iz23c97c2ihc31fqc";
|
||||
};
|
||||
|
||||
buildInputs = [ gnutls glib pkgconfig ];
|
||||
|
||||
meta = {
|
||||
description = ''BitlBee, an IRC to other chat networks gateway.'';
|
||||
description = "BitlBee, an IRC to other chat networks gateway";
|
||||
|
||||
longDescription = ''
|
||||
BitlBee brings IM (instant messaging) to IRC clients. It's a
|
||||
great solution for people who have an IRC client running all the
|
||||
time and don't want to run an additional MSN/AIM/whatever
|
||||
client.
|
||||
|
||||
BitlBee currently supports the following IM networks/protocols:
|
||||
XMPP/Jabber (including Google Talk), MSN Messenger, Yahoo!
|
||||
Messenger, AIM and ICQ.
|
||||
'';
|
||||
|
||||
homepage = http://www.bitlbee.org/;
|
||||
license = "GPL";
|
||||
license = "GPLv2+";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
args : with args;
|
||||
/*
|
||||
arguments: all buildInputs
|
||||
optional: purple2Source: purple-2 source - place to copy libpurple from
|
||||
(to use a fresher pidgin build)
|
||||
*/
|
||||
let
|
||||
externalPurple2 = (lib.getAttr ["purple2Source"] null args) != null;
|
||||
in
|
||||
rec {
|
||||
src = fetchurl {
|
||||
url = http://downloads.sourceforge.net/funpidgin/carrier-2.5.0.tar.bz2;
|
||||
sha256 = "0m80s7hnvz5vc2dy3xiy1zfb6incmb7p28zahzxdif2vz44riz28";
|
||||
};
|
||||
|
||||
buildInputs = [gtkspell aspell
|
||||
GStreamer startupnotification
|
||||
libxml2 openssl nss
|
||||
libXScrnSaver ncurses scrnsaverproto
|
||||
libX11 xproto kbproto GConf avahi
|
||||
dbus dbus_glib glib python
|
||||
autoconf libtool automake];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pkgconfig gtk perl perlXMLParser gettext
|
||||
];
|
||||
|
||||
configureFlags="--with-nspr-includes=${nss}/include/nspr"
|
||||
+ " --with-nspr-libs=${nss}/lib --with-nss-includes=${nss}/include/nss"
|
||||
+ " --with-nss-libs=${nss}/lib --with-ncurses-headers=${ncurses}/include"
|
||||
+ " --enable-screensaver --disable-meanwhile --disable-nm --disable-tcl";
|
||||
|
||||
preBuild = FullDepEntry (''
|
||||
export echo=echo
|
||||
'') [];
|
||||
|
||||
/* doConfigure should be specified separately */
|
||||
phaseNames = ["doConfigure" "preBuild" "doMakeInstall"]
|
||||
++ (lib.optional externalPurple2 "postInstall")
|
||||
;
|
||||
|
||||
name = "carrier-" + version;
|
||||
meta = {
|
||||
description = "Carrier - PidginIM GUI fork with user-friendly development model";
|
||||
homepage = http://funpidgin.sf.net;
|
||||
};
|
||||
} // (if externalPurple2 then {
|
||||
postInstall = FullDepEntry (''
|
||||
ensureDir $out/lib/purple-2
|
||||
cp ${args.purple2Source}/lib/purple-2/* $out/lib/purple-2/
|
||||
'') ["minInit" "defEnsureDir"]; }
|
||||
else {})
|
||||
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
{stdenv, fetchurl, perl, pkgconfig, gtk, libpcap, flex, bison}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "wireshark-1.0.3";
|
||||
name = "wireshark-1.1.2";
|
||||
src = fetchurl {
|
||||
url = http://www.wireshark.org/download/src/wireshark-1.0.3.tar.bz2;
|
||||
sha256 = "1wmkbq0rgy7rz8mqggyay98z4qd3s9bnv5lmvx1r55sndcq6z2bp";
|
||||
url = http://www.wireshark.org/download/src/wireshark-1.1.2.tar.gz;
|
||||
sha256 = "0fsf84czzxg0gpyf525lx2c9i8la26fkhqv4visz5bz2r0911yd4";
|
||||
};
|
||||
configureFlags = "--with-pcap=${libpcap}";
|
||||
buildInputs = [perl pkgconfig gtk libpcap flex bison];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
{stdenv, fetchurl}:
|
||||
{ stdenv, fetchurl
|
||||
, enableACLs ? true, acl ? null
|
||||
}:
|
||||
|
||||
assert enableACLs -> acl != null;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "rsync-3.0.5";
|
||||
|
||||
src = fetchurl {
|
||||
url = http://rsync.samba.org/ftp/rsync/src/rsync-3.0.5.tar.gz;
|
||||
sha256 = "1js36yv5s9dic524s7jczqk5myzp67bp24rqhbnikg6lh6pj1b20";
|
||||
};
|
||||
|
||||
buildInputs = stdenv.lib.optional enableACLs acl;
|
||||
|
||||
meta = {
|
||||
homepage = http://samba.anu.edu.au/rsync/;
|
||||
description = "A fast incremental file transfer utility";
|
||||
};
|
||||
}
|
||||
|
|
23
pkgs/applications/science/electronics/alliance/default.nix
Normal file
23
pkgs/applications/science/electronics/alliance/default.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{stdenv, fetchurl, xproto, motif, libX11, libXt, libXpm, bison, flex}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "alliance-5.0-20070718";
|
||||
|
||||
src = fetchurl {
|
||||
url = http://www-asim.lip6.fr/pub/alliance/distribution/5.0/alliance-5.0-20070718.tar.gz;
|
||||
sha256 = "4e17c8f9f4d344061166856d47e58527c6ae870fda0c73b5ba0200967d23af9f";
|
||||
};
|
||||
|
||||
buildInputs = [ xproto motif xproto libX11 libXt libXpm bison flex];
|
||||
|
||||
patchPhase = ''
|
||||
sed -i -e \
|
||||
"s/private: static void operator delete/public: static void operator delete/" \
|
||||
nero/src/ADefs.h
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Complete set of free CAD tools and portable libraries for VLSI design.";
|
||||
homepage = http://www-asim.lip6.fr/recherche/alliance/;
|
||||
};
|
||||
}
|
36
pkgs/desktops/kde-4.2/default.nix
Normal file
36
pkgs/desktops/kde-4.2/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{stdenv, fetchurl, cmake, qt4, xlibs, bzip2, libxml2, libxslt, perl, exiv2, aspell,
|
||||
pthread_stubs, gst_all, xineLib, fam, log4cxx, cluceneCore, redland, avahi, jdk,
|
||||
pcre, jasper, openexr, shared_mime_info, giflib}:
|
||||
|
||||
rec {
|
||||
### SUPPORT
|
||||
automoc4 = import ./support/automoc4 {
|
||||
inherit stdenv fetchurl cmake;
|
||||
inherit qt4;
|
||||
};
|
||||
|
||||
phonon = import ./support/phonon {
|
||||
inherit stdenv fetchurl cmake;
|
||||
inherit qt4 pthread_stubs gst_all xineLib;
|
||||
inherit (xlibs) libXau libXdmcp;
|
||||
inherit automoc4;
|
||||
};
|
||||
|
||||
strigi = import ./support/strigi {
|
||||
inherit stdenv fetchurl cmake perl;
|
||||
inherit bzip2 qt4 libxml2 exiv2 fam log4cxx cluceneCore;
|
||||
};
|
||||
|
||||
soprano = import ./support/soprano {
|
||||
inherit stdenv fetchurl cmake;
|
||||
inherit qt4 jdk cluceneCore redland;
|
||||
};
|
||||
|
||||
### LIBS
|
||||
kdelibs = import ./libs {
|
||||
inherit stdenv fetchurl cmake perl;
|
||||
inherit qt4 bzip2 pcre fam libxml2 libxslt shared_mime_info giflib jasper;
|
||||
inherit openexr aspell avahi;
|
||||
inherit automoc4 phonon strigi soprano;
|
||||
};
|
||||
}
|
15
pkgs/desktops/kde-4.2/libs/default.nix
Normal file
15
pkgs/desktops/kde-4.2/libs/default.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{stdenv, fetchurl, cmake, perl,
|
||||
qt4, bzip2, pcre, fam, libxml2, libxslt, shared_mime_info, giflib, jasper,
|
||||
openexr, aspell, avahi,
|
||||
automoc4, phonon, strigi, soprano}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "kdelibs-4.2.0";
|
||||
src = fetchurl {
|
||||
url = mirror://kde/stable/4.2.0/src/kdelibs-4.2.0.tar.bz2;
|
||||
md5 = "2d830a922195fefe6e073111850247ac";
|
||||
};
|
||||
buildInputs = [ cmake perl qt4 stdenv.gcc.libc bzip2 pcre fam libxml2 libxslt
|
||||
shared_mime_info giflib jasper openexr aspell avahi
|
||||
automoc4 phonon strigi soprano ];
|
||||
}
|
11
pkgs/desktops/kde-4.2/support/automoc4/default.nix
Normal file
11
pkgs/desktops/kde-4.2/support/automoc4/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{stdenv, fetchurl, cmake,
|
||||
qt4}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "automoc4-0.9.88";
|
||||
src = fetchurl {
|
||||
url = mirror://kde/stable/automoc4/0.9.88/automoc4-0.9.88.tar.bz2;
|
||||
md5 = "91bf517cb940109180ecd07bc90c69ec";
|
||||
};
|
||||
buildInputs = [ cmake qt4 ];
|
||||
}
|
17
pkgs/desktops/kde-4.2/support/phonon/default.nix
Normal file
17
pkgs/desktops/kde-4.2/support/phonon/default.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{stdenv, fetchurl, cmake,
|
||||
libXau, libXdmcp,
|
||||
qt4, pthread_stubs,
|
||||
gst_all, xineLib,
|
||||
automoc4}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "phonon-4.3.0";
|
||||
src = fetchurl {
|
||||
url = mirror://kde/stable/phonon/4.3.0/phonon-4.3.0.tar.bz2;
|
||||
md5 = "f851219ec1fb4eadc7904f053b6b498d";
|
||||
};
|
||||
buildInputs = [ cmake
|
||||
libXau libXdmcp
|
||||
qt4 pthread_stubs gst_all.gstreamer gst_all.gstPluginsBase xineLib
|
||||
automoc4 ];
|
||||
}
|
11
pkgs/desktops/kde-4.2/support/soprano/default.nix
Normal file
11
pkgs/desktops/kde-4.2/support/soprano/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{stdenv, fetchurl, cmake, qt4, jdk, cluceneCore, redland}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "soprano-2.2.1";
|
||||
src = fetchurl {
|
||||
url = mirror://sourceforge/soprano/soprano-2.2.1.tar.bz2;
|
||||
md5 = "69688a71273e1e9389fc60e3085c695f";
|
||||
};
|
||||
JAVA_HOME=jdk;
|
||||
buildInputs = [ cmake qt4 jdk cluceneCore redland ];
|
||||
}
|
13
pkgs/desktops/kde-4.2/support/strigi/default.nix
Normal file
13
pkgs/desktops/kde-4.2/support/strigi/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{stdenv, fetchurl, cmake, perl,
|
||||
bzip2, qt4, libxml2, exiv2, fam, log4cxx, cluceneCore}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "strigi-0.6.4";
|
||||
src = fetchurl {
|
||||
url = mirror://sourceforge/strigi/strigi-0.6.4.tar.bz2;
|
||||
md5 = "324fd9606ac77765501717ff92c04f9a";
|
||||
};
|
||||
CLUCENE_HOME=cluceneCore;
|
||||
buildInputs = [ cmake perl
|
||||
bzip2 stdenv.gcc.libc qt4 libxml2 exiv2 fam log4cxx cluceneCore ];
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
args:
|
||||
args.stdenv.lib.listOfListsToAttrs [
|
||||
[ "3.08.0" (import ./3.08.0.nix args) ]
|
||||
[ "3.09.1" (import ./3.09.1.nix args) ]
|
||||
[ "3.10.0" (import ./3.10.0.nix args) ]
|
||||
[ "default" (import ./3.09.1.nix args) ]
|
||||
|
||||
builtins.listToAttrs [
|
||||
{ name = "3.08.0"; value = import ./3.08.0.nix args; }
|
||||
{ name = "3.09.1"; value = import ./3.09.1.nix args; }
|
||||
{ name = "3.10.0"; value = import ./3.10.0.nix args; }
|
||||
{ name = "default"; value = import ./3.09.1.nix args; }
|
||||
]
|
||||
|
|
|
@ -124,7 +124,7 @@ in
|
|||
buildPhase = ''python setup.py $setupFlags build'';
|
||||
installPhase = ''python setup.py $setupFlags install --prefix=$out'';
|
||||
mergeAttrBy = {
|
||||
setupFlags = lib.concatList;
|
||||
setupFlags = lib.concat;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -219,8 +219,8 @@ in
|
|||
done
|
||||
'';
|
||||
mergeAttrBy = {
|
||||
phases = lib.concatList;
|
||||
pySrcs = lib.concatList;
|
||||
phases = lib.concat;
|
||||
pySrcs = lib.concat;
|
||||
pyCheck = x : y : "${x}\n${y}";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ stdenv.mkDerivation {
|
|||
name = "acl-2.2.47";
|
||||
|
||||
src = fetchurl {
|
||||
url = ftp://oss.sgi.com/projects/xfs/cmd_tars/acl_2.2.47-1.tar.gz;
|
||||
# The file cannot be downloaded from sgi.com.
|
||||
#url = ftp://oss.sgi.com/projects/xfs/cmd_tars/acl_2.2.47-1.tar.gz;
|
||||
url = "http://gentoo.chem.wisc.edu/gentoo/distfiles/acl_2.2.47-1.tar.gz";
|
||||
sha256 = "1j39g62fki0iyji9s62slgwdfskpkqy7rmjlqcnmsvsnxbxhc294";
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@ stdenv.mkDerivation {
|
|||
name = "attr-2.4.41";
|
||||
|
||||
src = fetchurl {
|
||||
url = ftp://oss.sgi.com/projects/xfs/cmd_tars/attr_2.4.41-1.tar.gz;
|
||||
# The file cannot be downloaded from sgi.com.
|
||||
#url = ftp://oss.sgi.com/projects/xfs/cmd_tars/attr_2.4.41-1.tar.gz;
|
||||
url = "http://gentoo.chem.wisc.edu/gentoo/distfiles/attr_2.4.41-1.tar.gz";
|
||||
sha256 = "0dc286g8vr402aca6wg945sdm92bys8a142vrkwx6bkjz4bwz6gp";
|
||||
};
|
||||
|
||||
|
|
20
pkgs/development/libraries/boost/1.38.0.nix
Normal file
20
pkgs/development/libraries/boost/1.38.0.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, version }:
|
||||
|
||||
assert version == "1.38.0";
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "boost-1.38.0";
|
||||
meta = {
|
||||
homepage = "http://boost.org/";
|
||||
description = "Boost C++ Library Collection";
|
||||
license = "boost-license";
|
||||
};
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/boost/boost_1_38_0.tar.bz2";
|
||||
sha256 = "0rk044s4m7l4sma6anml34vxcd9w0fzcy1cy7csbzynjyida9qry";
|
||||
};
|
||||
buildInputs = [icu expat zlib bzip2 python];
|
||||
preConfigure =
|
||||
"sed -e 's@^BJAM_CONFIG=\"\"@BJAM_CONFIG=\"-sEXPAT_INCLUDE=${expat}/include -sEXPAT_LIBPATH=${expat}/lib --layout=system variant=debug,release threading=single,multi link=shared,static\"@g' -i configure";
|
||||
configureFlags = "--with-icu=${icu} --with-python=${python}";
|
||||
}
|
15
pkgs/development/libraries/eventlog/default.nix
Normal file
15
pkgs/development/libraries/eventlog/default.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ stdenv, fetchurl }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "eventlog-0.2.9";
|
||||
src = fetchurl {
|
||||
url = "http://www.balabit.com/downloads/files/eventlog/0.2/eventlog_0.2.9.tar.gz";
|
||||
sha256 = "1cairmv47b66blrxwrgf4qwabfflak9b1dwkiyxnc9rj5svnq50m";
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "A new API to format and send structured log messages.";
|
||||
homepage = "http://www.balabit.com/support/community/products/";
|
||||
license = "BSD";
|
||||
};
|
||||
}
|
|
@ -1,16 +1,23 @@
|
|||
{stdenv, fetchurl, flex, bison}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "libpcap-0.9.4";
|
||||
name = "libpcap-1.0.0";
|
||||
src = fetchurl {
|
||||
url = [
|
||||
"mirror://tcpdump/release/${name}.tar.gz"
|
||||
"http://www.sfr-fresh.com/unix/misc/${name}.tar.gz"
|
||||
];
|
||||
sha256 = "0q0cnn607kfa4y4rbz3glg5lfr8r08s8l08w8fwrr3d6njjzd71p";
|
||||
sha256 = "1h3kmj485qz1i08xs4sc3a0bmhs1rvq0h7gycs7paap2szhw8552";
|
||||
};
|
||||
buildInputs = [flex bison];
|
||||
configureFlags = "
|
||||
${if stdenv.system == "i686-linux" then "--with-pcap=linux" else ""}
|
||||
";
|
||||
configureFlags = [
|
||||
"${if stdenv.system == "i686-linux" then "--with-pcap=linux" else ""}"
|
||||
"--with-pcap=linux"
|
||||
];
|
||||
|
||||
preInstall = ''ensureDir $out/bin'';
|
||||
patches = if stdenv.system == "i686-linux"
|
||||
then []
|
||||
else [ ./libpcap_amd64.patch ];
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
args: with args;
|
||||
{stdenv, fetchurl, autoconf, automake, libtool, libxml2, cppunit, boost,
|
||||
apr, aprutil, db45, expat}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "log4cxx-0.9.7";
|
||||
src = fetchurl {
|
||||
url = http://archive.apache.org/dist/logging/log4cxx/log4cxx-0.9.7.tar.gz;
|
||||
sha256 = "1ikyxd8jgf7b2cqjk5lidl7cffs114iiblaczaqbv5bm4vyb4hav";
|
||||
};
|
||||
buildInputs = [ autoconf automake libtool libxml2 cppunit boost ];
|
||||
patchPhase = "sh autogen.sh; sed -e 's/DOMConfigurator::subst/subst/' -i include/log4cxx/xml/domconfigurator.h";
|
||||
name = "log4cxx-0.10.0";
|
||||
src = fetchurl {
|
||||
url = http://apache.mirrors.hoobly.com/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz;
|
||||
sha256 = "130cjafck1jlqv92mxbn47yhxd2ccwwnprk605c6lmm941i3kq0d";
|
||||
};
|
||||
buildInputs = [ autoconf automake libtool libxml2 cppunit boost apr aprutil db45 expat];
|
||||
}
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
args: with args;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "qt-4.4.0";
|
||||
name = "qt-4.4.3";
|
||||
|
||||
src = fetchurl {
|
||||
url = ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.4.0.tar.bz2;
|
||||
sha256 = "871dc71c6c905212f2fea7e6598362114a3b6097c220b0b251f8d159ee7d706e";
|
||||
url = ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.4.3.tar.bz2;
|
||||
sha256 = "1nfdf1aj6vb7qyacsnjyjxrnaf44hz7vzykf6zra2znd87pglz51";
|
||||
};
|
||||
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
propagatedBuildInputs = [
|
||||
libXft
|
||||
libXrender
|
||||
|
@ -37,14 +39,32 @@ stdenv.mkDerivation {
|
|||
glib
|
||||
libtiff
|
||||
];
|
||||
|
||||
prefixKey = "-prefix ";
|
||||
configureFlags = "
|
||||
|
||||
configureFlags = ''
|
||||
-v -no-separate-debug-info -release
|
||||
-system-zlib -system-libpng -system-libjpeg -fast
|
||||
-qt-gif -confirm-license
|
||||
-opengl -xrender -xrandr -xinerama -xcursor -qt-sql-mysql
|
||||
-qdbus -cups -glib -xfixes
|
||||
-fontconfig -I${freetype}/include/freetype2";
|
||||
-fontconfig -I${freetype}/include/freetype2
|
||||
'';
|
||||
|
||||
patchPhase = "sed -e 's@/bin/pwd@pwd@' -i configure; sed -e 's@/usr@/FOO@' -i config.tests/*/*.test -i mkspecs/*/*.conf";
|
||||
patchPhase = ''
|
||||
substituteInPlace configure --replace /bin/pwd pwd
|
||||
sed -e 's@/usr@/FOO@' -i config.tests/*/*.test -i mkspecs/*/*.conf
|
||||
'';
|
||||
|
||||
# Remove the documentation: it takes up >= 130 MB, which is more
|
||||
# than half of the installed size. Ideally we should put this in a
|
||||
# separate package (as well as the Qt Designer).
|
||||
postInstall = ''
|
||||
rm -rf $out/share/doc
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = http://www.qtsoftware.com/downloads/opensource/appdev/linux-x11-cpp;
|
||||
description = "A cross-platform application framework for C++";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
export QTDIR=@out@
|
||||
|
||||
if [ -n $qt4BadIncludes ]; then
|
||||
for d in @out@/include/*; do
|
||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$d";
|
||||
done;
|
||||
for d in @out@/include/*; do
|
||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$d";
|
||||
done;
|
||||
fi
|
||||
|
|
16
pkgs/development/libraries/vtk/default.nix
Normal file
16
pkgs/development/libraries/vtk/default.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{stdenv, fetchurl, cmake, mesa, libX11, xproto, libXt }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "vtk-5.2.1";
|
||||
src = fetchurl {
|
||||
url = http://www.vtk.org/files/release/5.2/vtk-5.2.1.tar.gz;
|
||||
sha256 = "c81521b3767a044745336212cbde500d6e97a1f8ba647bc590857e36f57003bb";
|
||||
};
|
||||
buildInputs = [ cmake mesa libX11 xproto libXt ];
|
||||
|
||||
meta = {
|
||||
description = "Open source libraries for 3D computer graphics, image processing and visualization";
|
||||
homepage = http://www.vtk.org/;
|
||||
license = "BSD";
|
||||
};
|
||||
}
|
20
pkgs/development/perl-modules/Compress-Raw-Zlib/default.nix
Normal file
20
pkgs/development/perl-modules/Compress-Raw-Zlib/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{fetchurl, buildPerlPackage, zlib}:
|
||||
|
||||
buildPerlPackage rec {
|
||||
name = "Compress-Raw-Zlib-2.015";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://cpan/authors/id/P/PM/PMQS/${name}.tar.gz";
|
||||
sha256 = "0g6kz73jxqjfln2pi500y7rr96mhad16hrp5wy6542fapamv4xcd";
|
||||
};
|
||||
|
||||
preConfigure = ''
|
||||
cat > config.in <<EOF
|
||||
BUILD_ZLIB = False
|
||||
INCLUDE = ${zlib}/include
|
||||
LIB = ${zlib}/lib
|
||||
OLD_ZLIB = False
|
||||
GZIP_OS_CODE = AUTO_DETECT
|
||||
EOF
|
||||
'';
|
||||
}
|
|
@ -2,14 +2,10 @@ source $stdenv/setup
|
|||
|
||||
PERL5LIB="$PERL5LIB${PERL5LIB:+:}$out/lib/site_perl"
|
||||
|
||||
oldIFS=$IFS
|
||||
IFS=:
|
||||
perlFlags=
|
||||
for i in $PERL5LIB; do
|
||||
for i in $(IFS=:; echo $PERL5LIB); do
|
||||
perlFlags="$perlFlags -I$i"
|
||||
done
|
||||
IFS=$oldIFS
|
||||
echo "Perl flags: $perlFlags"
|
||||
|
||||
oldPreConfigure="$preConfigure"
|
||||
preConfigure=preConfigure
|
||||
|
@ -42,6 +38,15 @@ postFixup() {
|
|||
if test -e $out/nix-support/propagated-build-inputs; then
|
||||
ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
|
||||
fi
|
||||
|
||||
# Some (broken?) packages install in $out/lib/${perlVersion}
|
||||
# instead of $out/lib/site_perl/${perlVersion}. Try to fix that
|
||||
# automatically.
|
||||
if ! test -e $out/lib/site_perl; then
|
||||
echo "fixing wrong Perl installation path..."
|
||||
ensureDir $out/lib/site_perl
|
||||
mv $out/lib/5.* $out/lib/site_perl
|
||||
fi
|
||||
}
|
||||
|
||||
if test -n "$perlPreHook"; then
|
||||
|
|
|
@ -2,8 +2,17 @@ perl:
|
|||
|
||||
attrs:
|
||||
|
||||
perl.stdenv.mkDerivation (attrs // {
|
||||
name = "perl-" + attrs.name;
|
||||
builder = ./builder.sh;
|
||||
buildInputs = [(if attrs ? buildInputs then attrs.buildInputs else []) perl];
|
||||
})
|
||||
perl.stdenv.mkDerivation (
|
||||
{
|
||||
doCheck = true;
|
||||
checkTarget = "test";
|
||||
}
|
||||
//
|
||||
attrs
|
||||
//
|
||||
{
|
||||
name = "perl-" + attrs.name;
|
||||
builder = ./builder.sh;
|
||||
buildInputs = [(if attrs ? buildInputs then attrs.buildInputs else []) perl];
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
{stdenv, fetchurl}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "lsof-4.80";
|
||||
name = "lsof-4.81";
|
||||
|
||||
src = fetchurl {
|
||||
urls = [
|
||||
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_4.80.tar.bz2
|
||||
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/lsof_4.80.tar.bz2
|
||||
http://ftp.uni-bayreuth.de/packages/tools/lsof/lsof_4.81.tar.bz2
|
||||
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_4.81.tar.bz2
|
||||
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/lsof_4.81.tar.bz2
|
||||
];
|
||||
sha256 = "1q0k3c9ajpdxkhqq793pl4fdfnrwl5hgwk9556gvcj96hllssgbr";
|
||||
sha256 = "1fcamd8qpczgb3kz9b2rhflbq6lyd3lic4i7xl7n99fx76ha1n19";
|
||||
};
|
||||
|
||||
unpackPhase = "tar xvjf $src; cd lsof_*; tar xvf lsof_*.tar; sourceRoot=$( echo lsof_*/); ";
|
||||
|
|
23
pkgs/games/gav/default.nix
Normal file
23
pkgs/games/gav/default.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{stdenv, fetchurl, SDL, SDL_image, SDL_mixer, SDL_net} :
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "gav-0.9.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/gav/gav-0.9.0.tar.gz";
|
||||
sha256 = "8f0deb8b2cd775b339229054f4f282583a4cfbcba9d27a6213cf910bab944f3e";
|
||||
};
|
||||
|
||||
patchPhase = ''
|
||||
mkdir -p $out/bin
|
||||
sed -e "s@/usr@$out@" -i Makefile
|
||||
sed -e "s@/usr@$out@" -i Theme.h
|
||||
'';
|
||||
buildInputs = [SDL SDL_image SDL_mixer SDL_net];
|
||||
|
||||
meta = {
|
||||
description = "Remake of AV Arcade Volleyball";
|
||||
homepage = http://gav.sourceforge.net/;
|
||||
license = "GPLv2+";
|
||||
};
|
||||
}
|
22
pkgs/lib/attrsets.nix
Normal file
22
pkgs/lib/attrsets.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Operations on attribute sets.
|
||||
|
||||
with { inherit (builtins) head tail; };
|
||||
|
||||
rec {
|
||||
inherit (builtins) attrNames listToAttrs hasAttr isAttrs;
|
||||
|
||||
|
||||
# Return an attribute from nested attribute sets. For instance ["x"
|
||||
# "y"] applied to some set e returns e.x.y, if it exists. The
|
||||
# default value is returned otherwise. !!! there is also
|
||||
# builtins.getAttr (is there a better name for this function?)
|
||||
getAttr = attrPath: default: e:
|
||||
let attr = head attrPath;
|
||||
in
|
||||
if attrPath == [] then e
|
||||
else if builtins ? hasAttr && hasAttr attr e
|
||||
then getAttr (tail attrPath) default (builtins.getAttr attr e)
|
||||
else default;
|
||||
|
||||
|
||||
}
|
15
pkgs/lib/debug.nix
Normal file
15
pkgs/lib/debug.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
rec {
|
||||
|
||||
|
||||
# Wrapper aroung the primop `addErrorContext', which shouldn't used
|
||||
# directly. It evaluates and returns `val', but if an evaluation
|
||||
# error occurs, the text in `msg' is added to the error context
|
||||
# (stack trace) printed by Nix.
|
||||
addErrorContext =
|
||||
if builtins ? addErrorContext
|
||||
then builtins.addErrorContext
|
||||
else msg: val: val;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,871 +1,17 @@
|
|||
# Utility functions.
|
||||
|
||||
let
|
||||
|
||||
inherit (builtins)
|
||||
head tail isList stringLength substring lessThan sub
|
||||
listToAttrs attrNames hasAttr;
|
||||
trivial = import ./trivial.nix;
|
||||
lists = import ./lists.nix;
|
||||
strings = import ./strings.nix;
|
||||
attrsets = import ./attrsets.nix;
|
||||
sources = import ./sources.nix;
|
||||
options = import ./options.nix;
|
||||
debug = import ./debug.nix;
|
||||
misc = import ./misc.nix;
|
||||
|
||||
in
|
||||
|
||||
rec {
|
||||
listOfListsToAttrs = ll : builtins.listToAttrs (map (l : { name = (head l); value = (head (tail l)); }) ll);
|
||||
|
||||
|
||||
# Identity function.
|
||||
id = x: x;
|
||||
|
||||
|
||||
# accumulates / merges all attr sets until null is fed.
|
||||
# example: sumArgs id { a = 'a'; x = 'x'; } { y = 'y'; x = 'X'; } null
|
||||
# result : { a = 'a'; x = 'X'; y = 'Y'; }
|
||||
innerSumArgs = f : x : y : (if y == null then (f x)
|
||||
else (innerSumArgs f (x // y)));
|
||||
sumArgs = f : innerSumArgs f {};
|
||||
|
||||
# Advanced sumArgs version. Hm, twice as slow, I'm afraid.
|
||||
# composedArgs id (x:x//{a="b";}) (x:x//{b=x.a + "c";}) null;
|
||||
# {a="b" ; b="bc";};
|
||||
innerComposedArgs = f : x : y : (if y==null then (f x)
|
||||
else (if (builtins.isAttrs y) then
|
||||
(innerComposedArgs f (x//y))
|
||||
else (innerComposedArgs f (y x))));
|
||||
composedArgs = f: innerComposedArgs f {};
|
||||
|
||||
defaultMergeArg = x : y: if builtins.isAttrs y then
|
||||
y
|
||||
else
|
||||
(y x);
|
||||
defaultMerge = x: y: x // (defaultMergeArg x y);
|
||||
sumTwoArgs = f: x: y:
|
||||
f (defaultMerge x y);
|
||||
foldArgs = merger: f: init: x:
|
||||
let arg=(merger init (defaultMergeArg init x)); in
|
||||
# now add the function with composed args already applied to the final attrs
|
||||
setAttrMerge "passthru" {} (f arg) ( x : x // { function = foldArgs merger f arg; } );
|
||||
|
||||
# returns f x // { passthru.fun = y : f (merge x y); } while preserving other passthru names.
|
||||
# example: let ex = applyAndFun (x : removeAttrs x ["fixed"]) (mergeOrApply mergeAttr) {name = 6;};
|
||||
# usage1 = ex.passthru.fun { name = 7; }; # result: { name = 7;}
|
||||
# usage2 = ex.passthru.fun (a: a // {name = __add a.name 1; }); # result: { a = 7; }
|
||||
# fix usage:
|
||||
# usage3a = ex.passthru.fun (a: a // {name2 = a.fixed.toBePassed; }); # usage3a will fail because toBePassed is not yet given
|
||||
# usage3b usage3a.passthru.fun { toBePassed = "foo";}; # result { name = 7; name2 = "foo"; toBePassed = "foo"; fixed = <this attrs>; }
|
||||
applyAndFun = f : merge : x : assert (__isAttrs x || __isFunction x);
|
||||
let takeFix = if (__isFunction x) then x else (attr: merge attr x); in
|
||||
setAttrMerge "passthru" {} (fix (fixed : f (takeFix {inherit fixed;})))
|
||||
( y : y //
|
||||
{
|
||||
fun = z : applyAndFun f merge (fixed: merge (takeFix fixed) z);
|
||||
funMerge = z : applyAndFun f merge (fixed: let e = takeFix fixed; in merge e (merge e z));
|
||||
} );
|
||||
mergeOrApply = merge : x : y : if (__isFunction y) then y x else merge x y;
|
||||
|
||||
# rec { # an example of how composedArgsAndFun can be used
|
||||
# a = composedArgsAndFun (x : x) { a = ["2"]; meta = { d = "bar";}; };
|
||||
# # meta.d will be lost ! It's your task to preserve it (eg using a merge function)
|
||||
# b = a.passthru.function { a = [ "3" ]; meta = { d2 = "bar2";}; };
|
||||
# # instead of passing/ overriding values you can use a merge function:
|
||||
# c = b.passthru.function ( x: { a = x.a ++ ["4"]; }); # consider using (maybeAttr "a" [] x)
|
||||
# }
|
||||
# result:
|
||||
# {
|
||||
# a = { a = ["2"]; meta = { d = "bar"; }; passthru = { function = .. }; };
|
||||
# b = { a = ["3"]; meta = { d2 = "bar2"; }; passthru = { function = .. }; };
|
||||
# c = { a = ["3" "4"]; meta = { d2 = "bar2"; }; passthru = { function = .. }; };
|
||||
# # c2 is equal to c
|
||||
# }
|
||||
composedArgsAndFun = f: foldArgs defaultMerge f {};
|
||||
|
||||
# example a = pairMap (x : y : x + y) ["a" "b" "c" "d"];
|
||||
# result: ["ab" "cd"]
|
||||
innerPairMap = acc: f: l:
|
||||
if l == [] then acc else
|
||||
innerPairMap (acc ++ [(f (head l)(head (tail l)))])
|
||||
f (tail (tail l));
|
||||
pairMap = innerPairMap [];
|
||||
|
||||
|
||||
|
||||
# "Fold" a binary function `op' between successive elements of
|
||||
# `list' with `nul' as the starting value, i.e., `fold op nul [x_1
|
||||
# x_2 ... x_n] == op x_1 (op x_2 ... (op x_n nul))'. (This is
|
||||
# Haskell's foldr).
|
||||
fold = op: nul: list:
|
||||
if list == []
|
||||
then nul
|
||||
else op (head list) (fold op nul (tail list));
|
||||
|
||||
# Haskell's fold
|
||||
foldl = op: nul: list:
|
||||
if list == []
|
||||
then nul
|
||||
else fold op (op nul (head list)) (tail list);
|
||||
|
||||
|
||||
# Concatenate a list of lists.
|
||||
concatList = x : y : x ++ y;
|
||||
concatLists = fold concatList [];
|
||||
|
||||
|
||||
# Concatenate a list of strings.
|
||||
concatStrings =
|
||||
fold (x: y: x + y) "";
|
||||
|
||||
|
||||
# Map and concatenate the result.
|
||||
concatMap = f: list: concatLists (map f list);
|
||||
|
||||
concatMapStrings = f: list: concatStrings (map f list);
|
||||
|
||||
|
||||
# Place an element between each element of a list, e.g.,
|
||||
# `intersperse "," ["a" "b" "c"]' returns ["a" "," "b" "," "c"].
|
||||
intersperse = separator: list:
|
||||
if list == [] || tail list == []
|
||||
then list
|
||||
else [(head list) separator]
|
||||
++ (intersperse separator (tail list));
|
||||
|
||||
toList = x : if (__isList x) then x else [x];
|
||||
|
||||
concatStringsSep = separator: list:
|
||||
concatStrings (intersperse separator list);
|
||||
|
||||
makeLibraryPath = paths: concatStringsSep ":" (map (path: path + "/lib") paths);
|
||||
|
||||
|
||||
# Flatten the argument into a single list; that is, nested lists are
|
||||
# spliced into the top-level lists. E.g., `flatten [1 [2 [3] 4] 5]
|
||||
# == [1 2 3 4 5]' and `flatten 1 == [1]'.
|
||||
flatten = x:
|
||||
if isList x
|
||||
then fold (x: y: (flatten x) ++ y) [] x
|
||||
else [x];
|
||||
|
||||
|
||||
# Return an attribute from nested attribute sets. For instance ["x"
|
||||
# "y"] applied to some set e returns e.x.y, if it exists. The
|
||||
# default value is returned otherwise.
|
||||
# comment: there is also builtins.getAttr ? (is there a better name for this function?)
|
||||
getAttr = attrPath: default: e:
|
||||
let attr = head attrPath;
|
||||
in
|
||||
if attrPath == [] then e
|
||||
else if builtins ? hasAttr && builtins.hasAttr attr e
|
||||
then getAttr (tail attrPath) default (builtins.getAttr attr e)
|
||||
else default;
|
||||
|
||||
# shortcut for getAttr ["name"] default attrs
|
||||
maybeAttr = name: default: attrs:
|
||||
if (__hasAttr name attrs) then (__getAttr name attrs) else default;
|
||||
|
||||
|
||||
# Filter a list using a predicate; that is, return a list containing
|
||||
# every element from `list' for which `pred' returns true.
|
||||
filter = pred: list:
|
||||
fold (x: y: if pred x then [x] ++ y else y) [] list;
|
||||
|
||||
|
||||
# Return true if `list' has an element `x':
|
||||
elem = x: list: fold (a: bs: x == a || bs) false list;
|
||||
|
||||
|
||||
# Find the sole element in the list matching the specified
|
||||
# predicate, returns `default' if no such element exists, or
|
||||
# `multiple' if there are multiple matching elements.
|
||||
findSingle = pred: default: multiple: list:
|
||||
let found = filter pred list;
|
||||
in if found == [] then default
|
||||
else if tail found != [] then multiple
|
||||
else head found;
|
||||
|
||||
|
||||
# Return true iff function `pred' returns true for at least element
|
||||
# of `list'.
|
||||
any = pred: list:
|
||||
if list == [] then false
|
||||
else if pred (head list) then true
|
||||
else any pred (tail list);
|
||||
|
||||
|
||||
# Return true iff function `pred' returns true for all elements of
|
||||
# `list'.
|
||||
all = pred: list:
|
||||
if list == [] then true
|
||||
else if pred (head list) then all pred (tail list)
|
||||
else false;
|
||||
|
||||
# much shorter implementations using map and fold (are lazy as well)
|
||||
# which ones are better?
|
||||
# true if all/ at least one element(s) satisfy f
|
||||
# all = f : l : fold logicalAND true (map f l);
|
||||
# any = f : l : fold logicalOR false (map f l);
|
||||
|
||||
|
||||
# Return true if each element of a list is equal, false otherwise.
|
||||
eqLists = xs: ys:
|
||||
if xs == [] && ys == [] then true
|
||||
else if xs == [] || ys == [] then false
|
||||
else head xs == head ys && eqLists (tail xs) (tail ys);
|
||||
|
||||
|
||||
# Workaround, but works in stable Nix now.
|
||||
eqStrings = a: b: (a+(substring 0 0 b)) == ((substring 0 0 a)+b);
|
||||
|
||||
|
||||
# Determine whether a filename ends in the given suffix.
|
||||
hasSuffix = ext: fileName:
|
||||
let lenFileName = stringLength fileName;
|
||||
lenExt = stringLength ext;
|
||||
in !(lessThan lenFileName lenExt) &&
|
||||
substring (sub lenFileName lenExt) lenFileName fileName == ext;
|
||||
|
||||
hasSuffixHack = a: b: hasSuffix (a+(substring 0 0 b)) ((substring 0 0 a)+b);
|
||||
|
||||
|
||||
# Bring in a path as a source, filtering out all Subversion and CVS
|
||||
# directories, as well as backup files (*~).
|
||||
cleanSource =
|
||||
let filter = name: type: let baseName = baseNameOf (toString name); in ! (
|
||||
# Filter out Subversion and CVS directories.
|
||||
(type == "directory" && (baseName == ".svn" || baseName == "CVS")) ||
|
||||
# Filter out backup files.
|
||||
(hasSuffix "~" baseName)
|
||||
);
|
||||
in src: builtins.filterSource filter src;
|
||||
|
||||
|
||||
# Get all files ending with the specified suffices from the given
|
||||
# directory. E.g. `sourceFilesBySuffices ./dir [".xml" ".c"]'.
|
||||
sourceFilesBySuffices = path: exts:
|
||||
let filter = name: type:
|
||||
let base = baseNameOf (toString name);
|
||||
in type != "directory" && any (ext: hasSuffix ext base) exts;
|
||||
in builtins.filterSource filter path;
|
||||
|
||||
|
||||
# Return a singleton list or an empty list, depending on a boolean
|
||||
# value. Useful when building lists with optional elements
|
||||
# (e.g. `++ optional (system == "i686-linux") flashplayer').
|
||||
optional = cond: elem: if cond then [elem] else [];
|
||||
|
||||
|
||||
# Return a list or an empty list, dependening on a boolean value.
|
||||
optionals = cond: elems: if cond then elems else [];
|
||||
|
||||
optionalString = cond: string: if cond then string else "";
|
||||
|
||||
# Return the second argument if the first one is true or the empty version
|
||||
# of the second argument.
|
||||
ifEnable = cond: val:
|
||||
if cond then val
|
||||
else if builtins.isList val then []
|
||||
else if builtins.isAttrs val then {}
|
||||
# else if builtins.isString val then ""
|
||||
else if (val == true || val == false) then false
|
||||
else null;
|
||||
|
||||
# Return a list of integers from `first' up to and including `last'.
|
||||
range = first: last:
|
||||
if builtins.lessThan last first
|
||||
then []
|
||||
else [first] ++ range (builtins.add first 1) last;
|
||||
|
||||
|
||||
# Return true only if there is an attribute and it is true.
|
||||
checkFlag = attrSet: name:
|
||||
if (name == "true") then true else
|
||||
if (name == "false") then false else
|
||||
if (isInList (getAttr ["flags"] [] attrSet) name) then true else
|
||||
getAttr [name] false attrSet ;
|
||||
|
||||
|
||||
logicalOR = x: y: x || y;
|
||||
logicalAND = x: y: x && y;
|
||||
|
||||
|
||||
# Input : attrSet, [ [name default] ... ], name
|
||||
# Output : its value or default.
|
||||
getValue = attrSet: argList: name:
|
||||
( getAttr [name] (if checkFlag attrSet name then true else
|
||||
if argList == [] then null else
|
||||
let x = builtins.head argList; in
|
||||
if (head x) == name then
|
||||
(head (tail x))
|
||||
else (getValue attrSet
|
||||
(tail argList) name)) attrSet );
|
||||
|
||||
|
||||
# Input : attrSet, [[name default] ...], [ [flagname reqs..] ... ]
|
||||
# Output : are reqs satisfied? It's asserted.
|
||||
checkReqs = attrSet : argList : condList :
|
||||
(
|
||||
fold logicalAND true
|
||||
(map (x: let name = (head x) ; in
|
||||
|
||||
((checkFlag attrSet name) ->
|
||||
(fold logicalAND true
|
||||
(map (y: let val=(getValue attrSet argList y); in
|
||||
(val!=null) && (val!=false))
|
||||
(tail x))))) condList)) ;
|
||||
|
||||
|
||||
isInList = list: x:
|
||||
if (list == []) then false else
|
||||
if (x == (head list)) then true else
|
||||
isInList (tail list) x;
|
||||
|
||||
|
||||
uniqList = {inputList, outputList ? []}:
|
||||
if (inputList == []) then outputList else
|
||||
let x=head inputList;
|
||||
newOutputList = outputList ++
|
||||
(if (isInList outputList x) then [] else [x]);
|
||||
in uniqList {outputList=newOutputList;
|
||||
inputList = (tail inputList);};
|
||||
|
||||
uniqListExt = {inputList, outputList ? [],
|
||||
getter ? (x : x), compare ? (x: y: x==y)}:
|
||||
if (inputList == []) then outputList else
|
||||
let x=head inputList;
|
||||
isX = y: (compare (getter y) (getter x));
|
||||
newOutputList = outputList ++
|
||||
(if any isX outputList then [] else [x]);
|
||||
in uniqListExt {outputList=newOutputList;
|
||||
inputList = (tail inputList);
|
||||
inherit getter compare;
|
||||
};
|
||||
|
||||
|
||||
|
||||
condConcat = name: list: checker:
|
||||
if list == [] then name else
|
||||
if checker (head list) then
|
||||
condConcat
|
||||
(name + (head (tail list)))
|
||||
(tail (tail list))
|
||||
checker
|
||||
else condConcat
|
||||
name (tail (tail list)) checker;
|
||||
|
||||
# Merge sets of attributes and use the function f to merge
|
||||
# attributes values.
|
||||
zip = f: sets:
|
||||
builtins.listToAttrs (map (name: {
|
||||
inherit name;
|
||||
value =
|
||||
f name
|
||||
(map (__getAttr name)
|
||||
(filter (__hasAttr name) sets));
|
||||
}) (concatMap builtins.attrNames sets));
|
||||
|
||||
# divide a list in two depending on the evaluation of a predicate.
|
||||
partition = pred:
|
||||
fold (h: t:
|
||||
if pred h
|
||||
then { right = [h] ++ t.right; wrong = t.wrong; }
|
||||
else { right = t.right; wrong = [h] ++ t.wrong; }
|
||||
) { right = []; wrong = []; };
|
||||
|
||||
# Take a function and evaluate it with its own returned value.
|
||||
fix = f:
|
||||
(rec { result = f result; }).result;
|
||||
|
||||
# flatten a list of elements by following the properties of the elements.
|
||||
# next : return the list of following elements.
|
||||
# seen : lists of elements already visited.
|
||||
# default: result if 'x' is empty.
|
||||
# x : list of values that have to be processed.
|
||||
uniqFlatten = next: seen: default: x:
|
||||
if x == []
|
||||
then default
|
||||
else
|
||||
let h = head x; t = tail x; n = next h; in
|
||||
if elem h seen
|
||||
then uniqFlatten next seen default t
|
||||
else uniqFlatten next (seen ++ [h]) (default ++ [h]) (n ++ t)
|
||||
;
|
||||
|
||||
/* If. ThenElse. Always. */
|
||||
|
||||
# create "if" statement that can be dealyed on sets until a "then-else" or
|
||||
# "always" set is reached. When an always set is reached the condition
|
||||
# is ignore.
|
||||
|
||||
isIf = attrs: (typeOf attrs) == "if";
|
||||
mkIf = condition: thenelse:
|
||||
if isIf thenelse then
|
||||
mkIf (condition && thenelse.condition) thenelse.thenelse
|
||||
else {
|
||||
_type = "if";
|
||||
inherit condition thenelse;
|
||||
};
|
||||
|
||||
|
||||
isNotdef = attrs: (typeOf attrs) == "notdef";
|
||||
mkNotdef = {_type = "notdef";};
|
||||
|
||||
|
||||
isThenElse = attrs: (typeOf attrs) == "then-else";
|
||||
mkThenElse = attrs:
|
||||
assert attrs ? thenPart && attrs ? elsePart;
|
||||
attrs // { _type = "then-else"; };
|
||||
|
||||
|
||||
isAlways = attrs: (typeOf attrs) == "always";
|
||||
mkAlways = value: { inherit value; _type = "always"; };
|
||||
|
||||
pushIf = f: attrs:
|
||||
if isIf attrs then pushIf f (
|
||||
let val = attrs.thenelse; in
|
||||
# evaluate the condition.
|
||||
if isThenElse val then
|
||||
if attrs.condition then
|
||||
val.thenPart
|
||||
else
|
||||
val.elsePart
|
||||
# ignore the condition.
|
||||
else if isAlways val then
|
||||
val.value
|
||||
# otherwise
|
||||
else
|
||||
f attrs.condition val)
|
||||
else
|
||||
attrs;
|
||||
|
||||
# take care otherwise you will have to handle this by hand.
|
||||
rmIf = pushIf (condition: val: val);
|
||||
|
||||
evalIf = pushIf (condition: val:
|
||||
if condition then val else mkNotdef
|
||||
);
|
||||
|
||||
delayIf = pushIf (condition: val:
|
||||
# rewrite the condition on sub-attributes.
|
||||
mapAttrs (name: mkIf condition) val
|
||||
);
|
||||
|
||||
/* Options. */
|
||||
|
||||
mkOption = attrs: attrs // {_type = "option";};
|
||||
|
||||
typeOf = x: if (__isAttrs x && x ? _type) then x._type else "";
|
||||
|
||||
isOption = attrs: (typeOf attrs) == "option";
|
||||
|
||||
addDefaultOptionValues = defs: opts: opts //
|
||||
builtins.listToAttrs (map (defName:
|
||||
{ name = defName;
|
||||
value =
|
||||
let
|
||||
defValue = builtins.getAttr defName defs;
|
||||
optValue = builtins.getAttr defName opts;
|
||||
in
|
||||
if typeOf defValue == "option"
|
||||
then
|
||||
# `defValue' is an option.
|
||||
if builtins.hasAttr defName opts
|
||||
then builtins.getAttr defName opts
|
||||
else defValue.default
|
||||
else
|
||||
# `defValue' is an attribute set containing options.
|
||||
# So recurse.
|
||||
if builtins.hasAttr defName opts && builtins.isAttrs optValue
|
||||
then addDefaultOptionValues defValue optValue
|
||||
else addDefaultOptionValues defValue {};
|
||||
}
|
||||
) (builtins.attrNames defs));
|
||||
|
||||
mergeDefaultOption = list:
|
||||
if list != [] && tail list == [] then head list
|
||||
else if all __isFunction list then x: mergeDefaultOption (map (f: f x) list)
|
||||
else if all __isList list then concatLists list
|
||||
else if all __isAttrs list then mergeAttrs list
|
||||
else if all (x: true == x || false == x) list then fold logicalOR false list
|
||||
else if all (x: x == toString x) list then concatStrings list
|
||||
else throw "Cannot merge values.";
|
||||
|
||||
mergeTypedOption = typeName: predicate: merge: list:
|
||||
if all predicate list then merge list
|
||||
else throw "Expect a ${typeName}.";
|
||||
|
||||
mergeEnableOption = mergeTypedOption "boolean"
|
||||
(x: true == x || false == x) (fold logicalOR false);
|
||||
|
||||
mergeListOption = mergeTypedOption "list"
|
||||
__isList concatLists;
|
||||
|
||||
mergeStringOption = mergeTypedOption "string"
|
||||
(x: if builtins ? isString then builtins.isString x else x + "")
|
||||
concatStrings;
|
||||
|
||||
mergeOneOption = list:
|
||||
if list == [] then abort "This case should never happens."
|
||||
else if tail list != [] then throw "Multiple definitions. Only one is allowed for this option."
|
||||
else head list;
|
||||
|
||||
|
||||
# Handle the traversal of option sets. All sets inside 'opts' are zipped
|
||||
# and options declaration and definition are separated. If no option are
|
||||
# declared at a specific depth, then the function recurse into the values.
|
||||
# Other cases are handled by the optionHandler which contains two
|
||||
# functions that are used to defined your goal.
|
||||
# - export is a function which takes two arguments which are the option
|
||||
# and the list of values.
|
||||
# - notHandle is a function which takes the list of values are not handle
|
||||
# by this function.
|
||||
handleOptionSets = optionHandler@{export, notHandle, ...}: path: opts:
|
||||
if all __isAttrs opts then
|
||||
zip (attr: opts:
|
||||
let
|
||||
# Compute the path to reach the attribute.
|
||||
name = if path == "" then attr else path + "." + attr;
|
||||
|
||||
# Divide the definitions of the attribute "attr" between
|
||||
# declaration (isOption) and definitions (!isOption).
|
||||
test = partition isOption opts;
|
||||
decls = test.right; defs = test.wrong;
|
||||
|
||||
# Return the option declaration and add missing default
|
||||
# attributes.
|
||||
opt = {
|
||||
inherit name;
|
||||
merge = mergeDefaultOption;
|
||||
apply = id;
|
||||
} // (head decls);
|
||||
|
||||
# Return the list of option sets.
|
||||
optAttrs = map delayIf defs;
|
||||
|
||||
# return the list of option values.
|
||||
# Remove undefined values that are coming from evalIf.
|
||||
optValues = filter (x: !isNotdef x) (map evalIf defs);
|
||||
in
|
||||
if decls == [] then handleOptionSets optionHandler name optAttrs
|
||||
else addErrorContext "while evaluating the option ${name}:" (
|
||||
if tail decls != [] then throw "Multiple options."
|
||||
else export opt optValues
|
||||
)
|
||||
) opts
|
||||
else addErrorContext "while evaluating ${path}:" (notHandle opts);
|
||||
|
||||
# Merge option sets and produce a set of values which is the merging of
|
||||
# all options declare and defined. If no values are defined for an
|
||||
# option, then the default value is used otherwise it use the merge
|
||||
# function of each option to get the result.
|
||||
mergeOptionSets = noOption: newMergeOptionSets; # ignore argument
|
||||
newMergeOptionSets =
|
||||
handleOptionSets {
|
||||
export = opt: values:
|
||||
opt.apply (
|
||||
if values == [] then
|
||||
if opt ? default then opt.default
|
||||
else throw "Not defined."
|
||||
else opt.merge values
|
||||
);
|
||||
notHandle = opts: throw "Used without option declaration.";
|
||||
};
|
||||
|
||||
# Keep all option declarations.
|
||||
filterOptionSets =
|
||||
handleOptionSets {
|
||||
export = opt: values: opt;
|
||||
notHandle = opts: {};
|
||||
};
|
||||
|
||||
# Evaluate a list of option sets that would be merged with the
|
||||
# function "merge" which expects two arguments. The attribute named
|
||||
# "require" is used to imports option declarations and bindings.
|
||||
#
|
||||
# * cfg[0-9]: configuration
|
||||
# * cfgSet[0-9]: configuration set
|
||||
#
|
||||
# merge: the function used to merge options sets.
|
||||
# pkgs: is the set of packages available. (nixpkgs)
|
||||
# opts: list of option sets or option set functions.
|
||||
# config: result of this evaluation.
|
||||
fixOptionSetsFun = merge: pkgs: opts: config:
|
||||
let
|
||||
# remove possible mkIf to access the require attribute.
|
||||
noImportConditions = cfgSet0:
|
||||
let cfgSet1 = delayIf cfgSet0; in
|
||||
if cfgSet1 ? require then
|
||||
cfgSet1 // { require = rmIf cfgSet1.require; }
|
||||
else
|
||||
cfgSet1;
|
||||
|
||||
# call configuration "files" with one of the existing convention.
|
||||
argumentHandler = cfg:
|
||||
let
|
||||
# {..}
|
||||
cfg0 = cfg;
|
||||
# {pkgs, config, ...}: {..}
|
||||
cfg1 = cfg { inherit pkgs config merge; };
|
||||
# pkgs: config: {..}
|
||||
cfg2 = cfg {} {};
|
||||
in
|
||||
if __isFunction cfg0 then
|
||||
if builtins.isAttrs cfg1 then cfg1
|
||||
else builtins.trace "Use '{pkgs, config, ...}:'." cfg2
|
||||
else cfg0;
|
||||
|
||||
preprocess = cfg0:
|
||||
let cfg1 = argumentHandler cfg0;
|
||||
cfg2 = noImportConditions cfg1;
|
||||
in cfg2;
|
||||
|
||||
getRequire = x: toList (getAttr ["require"] [] (preprocess x));
|
||||
rmRequire = x: removeAttrs (preprocess x) ["require"];
|
||||
in
|
||||
merge "" (
|
||||
map rmRequire (
|
||||
uniqFlatten getRequire [] [] (toList opts)
|
||||
)
|
||||
);
|
||||
|
||||
fixOptionSets = merge: pkgs: opts:
|
||||
fix (fixOptionSetsFun merge pkgs opts);
|
||||
|
||||
optionAttrSetToDocList = (l: attrs:
|
||||
(if (getAttr ["_type"] "" attrs) == "option" then
|
||||
[({
|
||||
#inherit (attrs) description;
|
||||
description = if attrs ? description then attrs.description else
|
||||
throw ("No description ${toString l} : ${whatis attrs}");
|
||||
}
|
||||
//(if attrs ? example then {inherit(attrs) example;} else {} )
|
||||
//(if attrs ? default then {inherit(attrs) default;} else {} )
|
||||
//{name = l;}
|
||||
)]
|
||||
else (concatLists (map (s: (optionAttrSetToDocList
|
||||
(l + (if l=="" then "" else ".") + s) (builtins.getAttr s attrs)))
|
||||
(builtins.attrNames attrs)))));
|
||||
|
||||
innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else
|
||||
innerModifySumArgs f x (a // b);
|
||||
modifySumArgs = f: x: innerModifySumArgs f x {};
|
||||
|
||||
# Wrapper aroung addErrorContext. The builtin should not be used
|
||||
# directly.
|
||||
addErrorContext =
|
||||
if builtins ? addErrorContext
|
||||
then builtins.addErrorContext
|
||||
else msg: val: val;
|
||||
|
||||
debugVal = if builtins ? trace then x: (builtins.trace x x) else x: x;
|
||||
debugXMLVal = if builtins ? trace then x: (builtins.trace (builtins.toXML x) x) else x: x;
|
||||
|
||||
# this can help debug your code as well - designed to not produce thousands of lines
|
||||
traceWhatis = x : __trace (whatis x) x;
|
||||
traceMarked = str: x: __trace (str + (whatis x)) x;
|
||||
attrNamesToStr = a : concatStringsSep "; " (map (x : "${x}=") (__attrNames a));
|
||||
whatis = x :
|
||||
if (__isAttrs x) then
|
||||
if (x ? outPath) then "x is a derivation, name ${if x ? name then x.name else "<no name>"}, { ${attrNamesToStr x} }"
|
||||
else "x is attr set { ${attrNamesToStr x} }"
|
||||
else if (__isFunction x) then "x is a function"
|
||||
else if (x == []) then "x is an empty list"
|
||||
else if (__isList x) then "x is a list, first item is : ${whatis (__head x)}"
|
||||
else if (x == true) then "x is boolean true"
|
||||
else if (x == false) then "x is boolean false"
|
||||
else if (x == null) then "x is null"
|
||||
else "x is probably a string starting, starting characters: ${__substring 0 50 x}..";
|
||||
# trace the arguments passed to function and its result
|
||||
traceCall = n : f : a : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));
|
||||
traceCall2 = n : f : a : b : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b));
|
||||
traceCall3 = n : f : a : b : c : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b) (t "arg 3" c));
|
||||
|
||||
|
||||
|
||||
innerClosePropagation = ready: list: if list == [] then ready else
|
||||
if (head list) ? propagatedBuildInputs then
|
||||
innerClosePropagation (ready ++ [(head list)])
|
||||
((head list).propagatedBuildInputs ++ (tail list)) else
|
||||
innerClosePropagation (ready ++ [(head list)]) (tail list);
|
||||
|
||||
closePropagation = list: (uniqList {inputList = (innerClosePropagation [] list);});
|
||||
|
||||
stringToCharacters = s : let l = __stringLength s; in
|
||||
if (__lessThan l 1) then [""] else [(__substring 0 1 s)] ++ stringToCharacters (__substring 1 (__sub l 1) s);
|
||||
|
||||
# should this be implemented as primop ? Yes it should..
|
||||
escapeShellArg = s :
|
||||
let escapeChar = x : if ( x == "'" ) then "'\"'\"'" else x;
|
||||
in "'" + concatStrings (map escapeChar (stringToCharacters s) ) +"'";
|
||||
|
||||
defineShList = name : list : "\n${name}=(${concatStringsSep " " (map escapeShellArg list)})\n";
|
||||
|
||||
# this as well :-) arg: http://foo/bar/bz.ext returns bz.ext
|
||||
dropPath = s :
|
||||
if s == "" then "" else
|
||||
let takeTillSlash = left : c : s :
|
||||
if left == 0 then s
|
||||
else if (__substring left 1 s == "/") then
|
||||
(__substring (__add left 1) (__sub c 1) s)
|
||||
else takeTillSlash (__sub left 1) (__add c 1) s; in
|
||||
takeTillSlash (__sub (__stringLength s) 1) 1 s;
|
||||
|
||||
# calls a function (f attr value ) for each record item. returns a list
|
||||
# should be renamed to mapAttrsFlatten
|
||||
mapRecordFlatten = f : r : map (attr: f attr (builtins.getAttr attr r) ) (attrNames r);
|
||||
|
||||
# maps a function on each attr value
|
||||
# f = attr : value : ..
|
||||
mapAttrs = f : r : listToAttrs ( mapRecordFlatten (a : v : nv a ( f a v ) ) r);
|
||||
|
||||
# to be used with listToAttrs (_a_ttribute _v_alue)
|
||||
nv = name : value : { inherit name value; };
|
||||
# attribute set containing one attribute
|
||||
nvs = name : value : listToAttrs [ (nv name value) ];
|
||||
# adds / replaces an attribute of an attribute set
|
||||
setAttr = set : name : v : set // (nvs name v);
|
||||
|
||||
# setAttrMerge (similar to mergeAttrsWithFunc but only merges the values of a particular name)
|
||||
# setAttrMerge "a" [] { a = [2];} (x : x ++ [3]) -> { a = [2 3]; }
|
||||
# setAttrMerge "a" [] { } (x : x ++ [3]) -> { a = [ 3]; }
|
||||
setAttrMerge = name : default : attrs : f :
|
||||
setAttr attrs name (f (maybeAttr name default attrs));
|
||||
|
||||
# iterates over a list of attributes collecting the attribute attr if it exists
|
||||
catAttrs = attr : l : fold ( s : l : if (hasAttr attr s) then [(builtins.getAttr attr s)] ++ l else l) [] l;
|
||||
|
||||
mergeAttr = x : y : x // y;
|
||||
mergeAttrs = fold mergeAttr {};
|
||||
|
||||
attrVals = nameList : attrSet :
|
||||
map (x: builtins.getAttr x attrSet) nameList;
|
||||
|
||||
# Using f = a : b = b the result is similar to //
|
||||
# merge attributes with custom function handling the case that the attribute
|
||||
# exists in both sets
|
||||
mergeAttrsWithFunc = f : set1 : set2 :
|
||||
fold (n: set : if (__hasAttr n set)
|
||||
then setAttr set n (f (__getAttr n set) (__getAttr n set2))
|
||||
else set )
|
||||
set1 (__attrNames set2);
|
||||
|
||||
# merging two attribute set concatenating the values of same attribute names
|
||||
# eg { a = 7; } { a = [ 2 3 ]; } becomes { a = [ 7 2 3 ]; }
|
||||
mergeAttrsConcatenateValues = mergeAttrsWithFunc ( a : b : (toList a) ++ (toList b) );
|
||||
|
||||
# merges attributes using //, if a name exisits in both attributes
|
||||
# an error will be triggered unless its listed in mergeLists
|
||||
# so you can mergeAttrsNoOverride { buildInputs = [a]; } { buildInputs = [a]; } {} to get
|
||||
# { buildInputs = [a b]; }
|
||||
# merging buildPhase does'nt really make sense. The cases will be rare where appending /prefixing will fit your needs?
|
||||
# in these cases the first buildPhase will override the second one
|
||||
# ! depreceated, use mergeAttrByFunc instead
|
||||
mergeAttrsNoOverride = { mergeLists ? ["buildInputs" "propagatedBuildInputs"],
|
||||
overrideSnd ? [ "buildPhase" ]
|
||||
} : attrs1 : attrs2 :
|
||||
fold (n: set :
|
||||
setAttr set n ( if (__hasAttr n set)
|
||||
then # merge
|
||||
if elem n mergeLists # attribute contains list, merge them by concatenating
|
||||
then (__getAttr n attrs2) ++ (__getAttr n attrs1)
|
||||
else if elem n overrideSnd
|
||||
then __getAttr n attrs1
|
||||
else throw "error mergeAttrsNoOverride, attribute ${n} given in both attributes - no merge func defined"
|
||||
else __getAttr n attrs2 # add attribute not existing in attr1
|
||||
)) attrs1 (__attrNames attrs2);
|
||||
|
||||
|
||||
# example usage:
|
||||
# mergeAttrByFunc {
|
||||
# inherit mergeAttrBy; # defined below
|
||||
# buildInputs = [ a b ];
|
||||
# } {
|
||||
# buildInputs = [ c d ];
|
||||
# };
|
||||
# will result in
|
||||
# { mergeAttrsBy = [...]; buildInputs = [ a b c d ]; }
|
||||
# is used by prepareDerivationArgs and can be used when composing using
|
||||
# foldArgs, composedArgsAndFun or applyAndFun. Example: composableDerivation in all-packages.nix
|
||||
mergeAttrByFunc = x : y :
|
||||
let
|
||||
mergeAttrBy2 = { mergeAttrBy=mergeAttr; }
|
||||
// (maybeAttr "mergeAttrBy" {} x)
|
||||
// (maybeAttr "mergeAttrBy" {} y); in
|
||||
mergeAttrs [
|
||||
x y
|
||||
(mapAttrs ( a : v : # merge special names using given functions
|
||||
if (__hasAttr a x)
|
||||
then if (__hasAttr a y)
|
||||
then v (__getAttr a x) (__getAttr a y) # both have attr, use merge func
|
||||
else (__getAttr a x) # only x has attr
|
||||
else (__getAttr a y) # only y has attr)
|
||||
) (removeAttrs mergeAttrBy2
|
||||
# don't merge attrs which are neither in x nor y
|
||||
(filter (a : (! __hasAttr a x) && (! __hasAttr a y) )
|
||||
(__attrNames mergeAttrBy2))
|
||||
)
|
||||
)
|
||||
];
|
||||
mergeAttrsByFuncDefaults = foldl mergeAttrByFunc { inherit mergeAttrBy; };
|
||||
# sane defaults (same name as attr name so that inherit can be used)
|
||||
mergeAttrBy = # { buildInputs = concatList; [...]; passthru = mergeAttr; [..]; }
|
||||
listToAttrs (map (n : nv n concatList) [ "buildInputs" "propagatedBuildInputs" "configureFlags" "prePhases" "postAll" ])
|
||||
// listToAttrs (map (n : nv n mergeAttr) [ "passthru" "meta" "cfg" "flags" ]);
|
||||
|
||||
# returns atribute values as a list
|
||||
flattenAttrs = set : map ( attr : builtins.getAttr attr set) (attrNames set);
|
||||
mapIf = cond : f : fold ( x : l : if (cond x) then [(f x)] ++ l else l) [];
|
||||
|
||||
# pick attrs subset_attr_names and apply f
|
||||
subsetmap = f : attrs : subset_attr_names :
|
||||
listToAttrs (fold ( attr : r : if __hasAttr attr attrs
|
||||
then r ++ [ ( nv attr ( f (__getAttr attr attrs) ) ) ] else r ) []
|
||||
subset_attr_names );
|
||||
|
||||
# prepareDerivationArgs tries to make writing configurable derivations easier
|
||||
# example:
|
||||
# prepareDerivationArgs {
|
||||
# mergeAttrBy = {
|
||||
# myScript = x : y : x ++ "\n" ++ y;
|
||||
# };
|
||||
# cfg = {
|
||||
# readlineSupport = true;
|
||||
# };
|
||||
# flags = {
|
||||
# readline = {
|
||||
# set = {
|
||||
# configureFlags = [ "--with-compiler=${compiler}" ];
|
||||
# buildInputs = [ compiler ];
|
||||
# pass = { inherit compiler; READLINE=1; };
|
||||
# assertion = compiler.dllSupport;
|
||||
# myScript = "foo";
|
||||
# };
|
||||
# unset = { configureFlags = ["--without-compiler"]; };
|
||||
# };
|
||||
# };
|
||||
# src = ...
|
||||
# buildPhase = '' ... '';
|
||||
# name = ...
|
||||
# myScript = "bar";
|
||||
# };
|
||||
# if you don't have need for unset you can omit the surrounding set = { .. } attr
|
||||
# all attrs except flags cfg and mergeAttrBy will be merged with the
|
||||
# additional data from flags depending on config settings
|
||||
# It's used in composableDerivation in all-packages.nix. It's also used
|
||||
# heavily in the new python and libs implementation
|
||||
#
|
||||
# should we check for misspelled cfg options?
|
||||
prepareDerivationArgs = args:
|
||||
let args2 = { cfg = {}; flags = {}; } // args;
|
||||
flagName = name : "${name}Support";
|
||||
cfgWithDefaults = (listToAttrs (map (n : nv (flagName n) false) (attrNames args2.flags)))
|
||||
// args2.cfg;
|
||||
opts = flattenAttrs (mapAttrs (a : v :
|
||||
let v2 = if (v ? set || v ? unset) then v else { set = v; };
|
||||
n = if (__getAttr (flagName a) cfgWithDefaults) then "set" else "unset";
|
||||
attr = maybeAttr n {} v2; in
|
||||
if (maybeAttr "assertion" true attr)
|
||||
then attr
|
||||
else throw "assertion of flag ${a} of derivation ${args.name} failed"
|
||||
) args2.flags );
|
||||
in removeAttrs
|
||||
(mergeAttrsByFuncDefaults ([args] ++ opts ++ [{ passthru = cfgWithDefaults; }]))
|
||||
["flags" "cfg" "mergeAttrBy" "fixed" ]; # fixed may be passed as fix argument or such
|
||||
|
||||
}
|
||||
{ inherit trivial lists strings attrsets sources options debug; }
|
||||
# !!! don't include everything at top-level; perhaps only the most
|
||||
# commonly used functions.
|
||||
// trivial // lists // strings // attrsets // sources // options
|
||||
// debug // misc
|
||||
|
|
118
pkgs/lib/lists.nix
Normal file
118
pkgs/lib/lists.nix
Normal file
|
@ -0,0 +1,118 @@
|
|||
# General list operations.
|
||||
|
||||
rec {
|
||||
inherit (builtins) head tail isList;
|
||||
|
||||
|
||||
# "Fold" a binary function `op' between successive elements of
|
||||
# `list' with `nul' as the starting value, i.e., `fold op nul [x_1
|
||||
# x_2 ... x_n] == op x_1 (op x_2 ... (op x_n nul))'. (This is
|
||||
# Haskell's foldr).
|
||||
fold = op: nul: list:
|
||||
if list == []
|
||||
then nul
|
||||
else op (head list) (fold op nul (tail list));
|
||||
|
||||
|
||||
# Left fold: `fold op nul [x_1 x_2 ... x_n] == op (... (op (op nul
|
||||
# x_1) x_2) ... x_n)'.
|
||||
foldl = op: nul: list:
|
||||
if list == []
|
||||
then nul
|
||||
else foldl op (op nul (head list)) (tail list);
|
||||
|
||||
|
||||
# Concatenate a list of lists.
|
||||
concatLists = fold (x: y: x ++ y) [];
|
||||
|
||||
|
||||
# Map and concatenate the result.
|
||||
concatMap = f: list: concatLists (map f list);
|
||||
|
||||
|
||||
# Flatten the argument into a single list; that is, nested lists are
|
||||
# spliced into the top-level lists. E.g., `flatten [1 [2 [3] 4] 5]
|
||||
# == [1 2 3 4 5]' and `flatten 1 == [1]'.
|
||||
flatten = x:
|
||||
if isList x
|
||||
then fold (x: y: (flatten x) ++ y) [] x
|
||||
else [x];
|
||||
|
||||
|
||||
# Filter a list using a predicate; that is, return a list containing
|
||||
# every element from `list' for which `pred' returns true.
|
||||
filter = pred: list:
|
||||
fold (x: y: if pred x then [x] ++ y else y) [] list;
|
||||
|
||||
|
||||
# Return true if `list' has an element `x':
|
||||
elem = x: list: fold (a: bs: x == a || bs) false list;
|
||||
|
||||
|
||||
# Find the sole element in the list matching the specified
|
||||
# predicate, returns `default' if no such element exists, or
|
||||
# `multiple' if there are multiple matching elements.
|
||||
findSingle = pred: default: multiple: list:
|
||||
let found = filter pred list;
|
||||
in if found == [] then default
|
||||
else if tail found != [] then multiple
|
||||
else head found;
|
||||
|
||||
|
||||
# Return true iff function `pred' returns true for at least element
|
||||
# of `list'.
|
||||
any = pred: list:
|
||||
if list == [] then false
|
||||
else if pred (head list) then true
|
||||
else any pred (tail list);
|
||||
|
||||
|
||||
# Return true iff function `pred' returns true for all elements of
|
||||
# `list'.
|
||||
all = pred: list:
|
||||
if list == [] then true
|
||||
else if pred (head list) then all pred (tail list)
|
||||
else false;
|
||||
|
||||
|
||||
# Return true if each element of a list is equal, false otherwise.
|
||||
eqLists = xs: ys:
|
||||
if xs == [] && ys == [] then true
|
||||
else if xs == [] || ys == [] then false
|
||||
else head xs == head ys && eqLists (tail xs) (tail ys);
|
||||
|
||||
|
||||
# Return a singleton list or an empty list, depending on a boolean
|
||||
# value. Useful when building lists with optional elements
|
||||
# (e.g. `++ optional (system == "i686-linux") flashplayer').
|
||||
optional = cond: elem: if cond then [elem] else [];
|
||||
|
||||
|
||||
# Return a list or an empty list, dependening on a boolean value.
|
||||
optionals = cond: elems: if cond then elems else [];
|
||||
|
||||
|
||||
# If argument is a list, return it; else, wrap it in a singleton
|
||||
# list. If you're using this, you should almost certainly
|
||||
# reconsider if there isn't a more "well-typed" approach.
|
||||
toList = x: if builtins.isList x then x else [x];
|
||||
|
||||
|
||||
# Return a list of integers from `first' up to and including `last'.
|
||||
range = first: last:
|
||||
if builtins.lessThan last first
|
||||
then []
|
||||
else [first] ++ range (builtins.add first 1) last;
|
||||
|
||||
|
||||
# Partition the elements of a list in two lists, `right' and
|
||||
# `wrong', depending on the evaluation of a predicate.
|
||||
partition = pred:
|
||||
fold (h: t:
|
||||
if pred h
|
||||
then { right = [h] ++ t.right; wrong = t.wrong; }
|
||||
else { right = t.right; wrong = [h] ++ t.wrong; }
|
||||
) { right = []; wrong = []; };
|
||||
|
||||
|
||||
}
|
385
pkgs/lib/misc.nix
Normal file
385
pkgs/lib/misc.nix
Normal file
|
@ -0,0 +1,385 @@
|
|||
let lib = import ./default.nix; in
|
||||
|
||||
with import ./lists.nix;
|
||||
with import ./attrsets.nix;
|
||||
with import ./strings.nix;
|
||||
|
||||
rec {
|
||||
|
||||
|
||||
# accumulates / merges all attr sets until null is fed.
|
||||
# example: sumArgs id { a = 'a'; x = 'x'; } { y = 'y'; x = 'X'; } null
|
||||
# result : { a = 'a'; x = 'X'; y = 'Y'; }
|
||||
innerSumArgs = f : x : y : (if y == null then (f x)
|
||||
else (innerSumArgs f (x // y)));
|
||||
sumArgs = f : innerSumArgs f {};
|
||||
|
||||
# Advanced sumArgs version. Hm, twice as slow, I'm afraid.
|
||||
# composedArgs id (x:x//{a="b";}) (x:x//{b=x.a + "c";}) null;
|
||||
# {a="b" ; b="bc";};
|
||||
innerComposedArgs = f : x : y : (if y==null then (f x)
|
||||
else (if (builtins.isAttrs y) then
|
||||
(innerComposedArgs f (x//y))
|
||||
else (innerComposedArgs f (y x))));
|
||||
composedArgs = f: innerComposedArgs f {};
|
||||
|
||||
defaultMergeArg = x : y: if builtins.isAttrs y then
|
||||
y
|
||||
else
|
||||
(y x);
|
||||
defaultMerge = x: y: x // (defaultMergeArg x y);
|
||||
sumTwoArgs = f: x: y:
|
||||
f (defaultMerge x y);
|
||||
foldArgs = merger: f: init: x:
|
||||
let arg=(merger init (defaultMergeArg init x)); in
|
||||
# now add the function with composed args already applied to the final attrs
|
||||
setAttrMerge "passthru" {} (f arg) ( x : x // { function = foldArgs merger f arg; } );
|
||||
|
||||
# returns f x // { passthru.fun = y : f (merge x y); } while preserving other passthru names.
|
||||
# example: let ex = applyAndFun (x : removeAttrs x ["fixed"]) (mergeOrApply mergeAttr) {name = 6;};
|
||||
# usage1 = ex.passthru.fun { name = 7; }; # result: { name = 7;}
|
||||
# usage2 = ex.passthru.fun (a: a // {name = __add a.name 1; }); # result: { a = 7; }
|
||||
# fix usage:
|
||||
# usage3a = ex.passthru.fun (a: a // {name2 = a.fixed.toBePassed; }); # usage3a will fail because toBePassed is not yet given
|
||||
# usage3b usage3a.passthru.fun { toBePassed = "foo";}; # result { name = 7; name2 = "foo"; toBePassed = "foo"; fixed = <this attrs>; }
|
||||
applyAndFun = f : merge : x : assert (__isAttrs x || __isFunction x);
|
||||
let takeFix = if (__isFunction x) then x else (attr: merge attr x); in
|
||||
setAttrMerge "passthru" {} (lib.fix (fixed : f (takeFix {inherit fixed;})))
|
||||
( y : y //
|
||||
{
|
||||
fun = z : applyAndFun f merge (fixed: merge (takeFix fixed) z);
|
||||
funMerge = z : applyAndFun f merge (fixed: let e = takeFix fixed; in merge e (merge e z));
|
||||
} );
|
||||
mergeOrApply = merge : x : y : if (__isFunction y) then y x else merge x y;
|
||||
|
||||
# rec { # an example of how composedArgsAndFun can be used
|
||||
# a = composedArgsAndFun (x : x) { a = ["2"]; meta = { d = "bar";}; };
|
||||
# # meta.d will be lost ! It's your task to preserve it (eg using a merge function)
|
||||
# b = a.passthru.function { a = [ "3" ]; meta = { d2 = "bar2";}; };
|
||||
# # instead of passing/ overriding values you can use a merge function:
|
||||
# c = b.passthru.function ( x: { a = x.a ++ ["4"]; }); # consider using (maybeAttr "a" [] x)
|
||||
# }
|
||||
# result:
|
||||
# {
|
||||
# a = { a = ["2"]; meta = { d = "bar"; }; passthru = { function = .. }; };
|
||||
# b = { a = ["3"]; meta = { d2 = "bar2"; }; passthru = { function = .. }; };
|
||||
# c = { a = ["3" "4"]; meta = { d2 = "bar2"; }; passthru = { function = .. }; };
|
||||
# # c2 is equal to c
|
||||
# }
|
||||
composedArgsAndFun = f: foldArgs defaultMerge f {};
|
||||
|
||||
# example a = pairMap (x : y : x + y) ["a" "b" "c" "d"];
|
||||
# result: ["ab" "cd"]
|
||||
innerPairMap = acc: f: l:
|
||||
if l == [] then acc else
|
||||
innerPairMap (acc ++ [(f (head l)(head (tail l)))])
|
||||
f (tail (tail l));
|
||||
pairMap = innerPairMap [];
|
||||
|
||||
|
||||
# shortcut for getAttr ["name"] default attrs
|
||||
maybeAttr = name: default: attrs:
|
||||
if (__hasAttr name attrs) then (__getAttr name attrs) else default;
|
||||
|
||||
|
||||
# Return the second argument if the first one is true or the empty version
|
||||
# of the second argument.
|
||||
ifEnable = cond: val:
|
||||
if cond then val
|
||||
else if builtins.isList val then []
|
||||
else if builtins.isAttrs val then {}
|
||||
# else if builtins.isString val then ""
|
||||
else if (val == true || val == false) then false
|
||||
else null;
|
||||
|
||||
|
||||
# Return true only if there is an attribute and it is true.
|
||||
checkFlag = attrSet: name:
|
||||
if (name == "true") then true else
|
||||
if (name == "false") then false else
|
||||
if (elem name (getAttr ["flags"] [] attrSet)) then true else
|
||||
getAttr [name] false attrSet ;
|
||||
|
||||
|
||||
# Input : attrSet, [ [name default] ... ], name
|
||||
# Output : its value or default.
|
||||
getValue = attrSet: argList: name:
|
||||
( getAttr [name] (if checkFlag attrSet name then true else
|
||||
if argList == [] then null else
|
||||
let x = builtins.head argList; in
|
||||
if (head x) == name then
|
||||
(head (tail x))
|
||||
else (getValue attrSet
|
||||
(tail argList) name)) attrSet );
|
||||
|
||||
|
||||
# Input : attrSet, [[name default] ...], [ [flagname reqs..] ... ]
|
||||
# Output : are reqs satisfied? It's asserted.
|
||||
checkReqs = attrSet : argList : condList :
|
||||
(
|
||||
fold lib.and true
|
||||
(map (x: let name = (head x) ; in
|
||||
|
||||
((checkFlag attrSet name) ->
|
||||
(fold lib.and true
|
||||
(map (y: let val=(getValue attrSet argList y); in
|
||||
(val!=null) && (val!=false))
|
||||
(tail x))))) condList)) ;
|
||||
|
||||
|
||||
uniqList = {inputList, outputList ? []}:
|
||||
if (inputList == []) then outputList else
|
||||
let x=head inputList;
|
||||
newOutputList = outputList ++
|
||||
(if elem x outputList then [] else [x]);
|
||||
in uniqList {outputList=newOutputList;
|
||||
inputList = (tail inputList);};
|
||||
|
||||
uniqListExt = {inputList, outputList ? [],
|
||||
getter ? (x : x), compare ? (x: y: x==y)}:
|
||||
if (inputList == []) then outputList else
|
||||
let x=head inputList;
|
||||
isX = y: (compare (getter y) (getter x));
|
||||
newOutputList = outputList ++
|
||||
(if any isX outputList then [] else [x]);
|
||||
in uniqListExt {outputList=newOutputList;
|
||||
inputList = (tail inputList);
|
||||
inherit getter compare;
|
||||
};
|
||||
|
||||
|
||||
|
||||
condConcat = name: list: checker:
|
||||
if list == [] then name else
|
||||
if checker (head list) then
|
||||
condConcat
|
||||
(name + (head (tail list)))
|
||||
(tail (tail list))
|
||||
checker
|
||||
else condConcat
|
||||
name (tail (tail list)) checker;
|
||||
|
||||
# Merge sets of attributes and use the function f to merge
|
||||
# attributes values.
|
||||
zip = f: sets:
|
||||
builtins.listToAttrs (map (name: {
|
||||
inherit name;
|
||||
value =
|
||||
f name
|
||||
(map (__getAttr name)
|
||||
(filter (__hasAttr name) sets));
|
||||
}) (concatMap builtins.attrNames sets));
|
||||
|
||||
# flatten a list of elements by following the properties of the elements.
|
||||
# next : return the list of following elements.
|
||||
# seen : lists of elements already visited.
|
||||
# default: result if 'x' is empty.
|
||||
# x : list of values that have to be processed.
|
||||
uniqFlatten = next: seen: default: x:
|
||||
if x == []
|
||||
then default
|
||||
else
|
||||
let h = head x; t = tail x; n = next h; in
|
||||
if elem h seen
|
||||
then uniqFlatten next seen default t
|
||||
else uniqFlatten next (seen ++ [h]) (default ++ [h]) (n ++ t)
|
||||
;
|
||||
|
||||
innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else
|
||||
innerModifySumArgs f x (a // b);
|
||||
modifySumArgs = f: x: innerModifySumArgs f x {};
|
||||
|
||||
debugVal = if builtins ? trace then x: (builtins.trace x x) else x: x;
|
||||
debugXMLVal = if builtins ? trace then x: (builtins.trace (builtins.toXML x) x) else x: x;
|
||||
|
||||
# this can help debug your code as well - designed to not produce thousands of lines
|
||||
traceWhatis = x : __trace (whatis x) x;
|
||||
traceMarked = str: x: __trace (str + (whatis x)) x;
|
||||
attrNamesToStr = a : concatStringsSep "; " (map (x : "${x}=") (__attrNames a));
|
||||
whatis = x :
|
||||
if (__isAttrs x) then
|
||||
if (x ? outPath) then "x is a derivation, name ${if x ? name then x.name else "<no name>"}, { ${attrNamesToStr x} }"
|
||||
else "x is attr set { ${attrNamesToStr x} }"
|
||||
else if (__isFunction x) then "x is a function"
|
||||
else if (x == []) then "x is an empty list"
|
||||
else if (__isList x) then "x is a list, first item is : ${whatis (__head x)}"
|
||||
else if (x == true) then "x is boolean true"
|
||||
else if (x == false) then "x is boolean false"
|
||||
else if (x == null) then "x is null"
|
||||
else "x is probably a string starting, starting characters: ${__substring 0 50 x}..";
|
||||
# trace the arguments passed to function and its result
|
||||
traceCall = n : f : a : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));
|
||||
traceCall2 = n : f : a : b : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b));
|
||||
traceCall3 = n : f : a : b : c : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b) (t "arg 3" c));
|
||||
|
||||
|
||||
|
||||
innerClosePropagation = ready: list: if list == [] then ready else
|
||||
if (head list) ? propagatedBuildInputs then
|
||||
innerClosePropagation (ready ++ [(head list)])
|
||||
((head list).propagatedBuildInputs ++ (tail list)) else
|
||||
innerClosePropagation (ready ++ [(head list)]) (tail list);
|
||||
|
||||
closePropagation = list: (uniqList {inputList = (innerClosePropagation [] list);});
|
||||
|
||||
# calls a function (f attr value ) for each record item. returns a list
|
||||
# should be renamed to mapAttrsFlatten
|
||||
mapRecordFlatten = f : r : map (attr: f attr (builtins.getAttr attr r) ) (attrNames r);
|
||||
|
||||
# maps a function on each attr value
|
||||
# f = attr : value : ..
|
||||
mapAttrs = f : r : listToAttrs ( mapRecordFlatten (a : v : nv a ( f a v ) ) r);
|
||||
|
||||
# to be used with listToAttrs (_a_ttribute _v_alue)
|
||||
nv = name : value : { inherit name value; };
|
||||
# attribute set containing one attribute
|
||||
nvs = name : value : listToAttrs [ (nv name value) ];
|
||||
# adds / replaces an attribute of an attribute set
|
||||
setAttr = set : name : v : set // (nvs name v);
|
||||
|
||||
# setAttrMerge (similar to mergeAttrsWithFunc but only merges the values of a particular name)
|
||||
# setAttrMerge "a" [] { a = [2];} (x : x ++ [3]) -> { a = [2 3]; }
|
||||
# setAttrMerge "a" [] { } (x : x ++ [3]) -> { a = [ 3]; }
|
||||
setAttrMerge = name : default : attrs : f :
|
||||
setAttr attrs name (f (maybeAttr name default attrs));
|
||||
|
||||
# iterates over a list of attributes collecting the attribute attr if it exists
|
||||
catAttrs = attr : l : fold ( s : l : if (hasAttr attr s) then [(builtins.getAttr attr s)] ++ l else l) [] l;
|
||||
|
||||
attrVals = nameList : attrSet :
|
||||
map (x: builtins.getAttr x attrSet) nameList;
|
||||
|
||||
# Using f = a : b = b the result is similar to //
|
||||
# merge attributes with custom function handling the case that the attribute
|
||||
# exists in both sets
|
||||
mergeAttrsWithFunc = f : set1 : set2 :
|
||||
fold (n: set : if (__hasAttr n set)
|
||||
then setAttr set n (f (__getAttr n set) (__getAttr n set2))
|
||||
else set )
|
||||
set1 (__attrNames set2);
|
||||
|
||||
# merging two attribute set concatenating the values of same attribute names
|
||||
# eg { a = 7; } { a = [ 2 3 ]; } becomes { a = [ 7 2 3 ]; }
|
||||
mergeAttrsConcatenateValues = mergeAttrsWithFunc ( a : b : (toList a) ++ (toList b) );
|
||||
|
||||
# merges attributes using //, if a name exisits in both attributes
|
||||
# an error will be triggered unless its listed in mergeLists
|
||||
# so you can mergeAttrsNoOverride { buildInputs = [a]; } { buildInputs = [a]; } {} to get
|
||||
# { buildInputs = [a b]; }
|
||||
# merging buildPhase does'nt really make sense. The cases will be rare where appending /prefixing will fit your needs?
|
||||
# in these cases the first buildPhase will override the second one
|
||||
# ! depreceated, use mergeAttrByFunc instead
|
||||
mergeAttrsNoOverride = { mergeLists ? ["buildInputs" "propagatedBuildInputs"],
|
||||
overrideSnd ? [ "buildPhase" ]
|
||||
} : attrs1 : attrs2 :
|
||||
fold (n: set :
|
||||
setAttr set n ( if (__hasAttr n set)
|
||||
then # merge
|
||||
if elem n mergeLists # attribute contains list, merge them by concatenating
|
||||
then (__getAttr n attrs2) ++ (__getAttr n attrs1)
|
||||
else if elem n overrideSnd
|
||||
then __getAttr n attrs1
|
||||
else throw "error mergeAttrsNoOverride, attribute ${n} given in both attributes - no merge func defined"
|
||||
else __getAttr n attrs2 # add attribute not existing in attr1
|
||||
)) attrs1 (__attrNames attrs2);
|
||||
|
||||
|
||||
# example usage:
|
||||
# mergeAttrByFunc {
|
||||
# inherit mergeAttrBy; # defined below
|
||||
# buildInputs = [ a b ];
|
||||
# } {
|
||||
# buildInputs = [ c d ];
|
||||
# };
|
||||
# will result in
|
||||
# { mergeAttrsBy = [...]; buildInputs = [ a b c d ]; }
|
||||
# is used by prepareDerivationArgs and can be used when composing using
|
||||
# foldArgs, composedArgsAndFun or applyAndFun. Example: composableDerivation in all-packages.nix
|
||||
mergeAttrByFunc = x : y :
|
||||
let
|
||||
mergeAttrBy2 = { mergeAttrBy=lib.mergeAttrs; }
|
||||
// (maybeAttr "mergeAttrBy" {} x)
|
||||
// (maybeAttr "mergeAttrBy" {} y); in
|
||||
fold lib.mergeAttrs {} [
|
||||
x y
|
||||
(mapAttrs ( a : v : # merge special names using given functions
|
||||
if (__hasAttr a x)
|
||||
then if (__hasAttr a y)
|
||||
then v (__getAttr a x) (__getAttr a y) # both have attr, use merge func
|
||||
else (__getAttr a x) # only x has attr
|
||||
else (__getAttr a y) # only y has attr)
|
||||
) (removeAttrs mergeAttrBy2
|
||||
# don't merge attrs which are neither in x nor y
|
||||
(filter (a : (! __hasAttr a x) && (! __hasAttr a y) )
|
||||
(__attrNames mergeAttrBy2))
|
||||
)
|
||||
)
|
||||
];
|
||||
mergeAttrsByFuncDefaults = foldl mergeAttrByFunc { inherit mergeAttrBy; };
|
||||
# sane defaults (same name as attr name so that inherit can be used)
|
||||
mergeAttrBy = # { buildInputs = concatList; [...]; passthru = mergeAttr; [..]; }
|
||||
listToAttrs (map (n : nv n lib.concat) [ "buildInputs" "propagatedBuildInputs" "configureFlags" "prePhases" "postAll" ])
|
||||
// listToAttrs (map (n : nv n lib.mergeAttrs) [ "passthru" "meta" "cfg" "flags" ]);
|
||||
|
||||
# returns atribute values as a list
|
||||
flattenAttrs = set : map ( attr : builtins.getAttr attr set) (attrNames set);
|
||||
mapIf = cond : f : fold ( x : l : if (cond x) then [(f x)] ++ l else l) [];
|
||||
|
||||
# pick attrs subset_attr_names and apply f
|
||||
subsetmap = f : attrs : subset_attr_names :
|
||||
listToAttrs (fold ( attr : r : if __hasAttr attr attrs
|
||||
then r ++ [ ( nv attr ( f (__getAttr attr attrs) ) ) ] else r ) []
|
||||
subset_attr_names );
|
||||
|
||||
# prepareDerivationArgs tries to make writing configurable derivations easier
|
||||
# example:
|
||||
# prepareDerivationArgs {
|
||||
# mergeAttrBy = {
|
||||
# myScript = x : y : x ++ "\n" ++ y;
|
||||
# };
|
||||
# cfg = {
|
||||
# readlineSupport = true;
|
||||
# };
|
||||
# flags = {
|
||||
# readline = {
|
||||
# set = {
|
||||
# configureFlags = [ "--with-compiler=${compiler}" ];
|
||||
# buildInputs = [ compiler ];
|
||||
# pass = { inherit compiler; READLINE=1; };
|
||||
# assertion = compiler.dllSupport;
|
||||
# myScript = "foo";
|
||||
# };
|
||||
# unset = { configureFlags = ["--without-compiler"]; };
|
||||
# };
|
||||
# };
|
||||
# src = ...
|
||||
# buildPhase = '' ... '';
|
||||
# name = ...
|
||||
# myScript = "bar";
|
||||
# };
|
||||
# if you don't have need for unset you can omit the surrounding set = { .. } attr
|
||||
# all attrs except flags cfg and mergeAttrBy will be merged with the
|
||||
# additional data from flags depending on config settings
|
||||
# It's used in composableDerivation in all-packages.nix. It's also used
|
||||
# heavily in the new python and libs implementation
|
||||
#
|
||||
# should we check for misspelled cfg options?
|
||||
prepareDerivationArgs = args:
|
||||
let args2 = { cfg = {}; flags = {}; } // args;
|
||||
flagName = name : "${name}Support";
|
||||
cfgWithDefaults = (listToAttrs (map (n : nv (flagName n) false) (attrNames args2.flags)))
|
||||
// args2.cfg;
|
||||
opts = flattenAttrs (mapAttrs (a : v :
|
||||
let v2 = if (v ? set || v ? unset) then v else { set = v; };
|
||||
n = if (__getAttr (flagName a) cfgWithDefaults) then "set" else "unset";
|
||||
attr = maybeAttr n {} v2; in
|
||||
if (maybeAttr "assertion" true attr)
|
||||
then attr
|
||||
else throw "assertion of flag ${a} of derivation ${args.name} failed"
|
||||
) args2.flags );
|
||||
in removeAttrs
|
||||
(mergeAttrsByFuncDefaults ([args] ++ opts ++ [{ passthru = cfgWithDefaults; }]))
|
||||
["flags" "cfg" "mergeAttrBy" "fixed" ]; # fixed may be passed as fix argument or such
|
||||
|
||||
|
||||
}
|
267
pkgs/lib/options.nix
Normal file
267
pkgs/lib/options.nix
Normal file
|
@ -0,0 +1,267 @@
|
|||
# Nixpkgs/NixOS option handling.
|
||||
|
||||
let lib = import ./default.nix; in
|
||||
|
||||
with { inherit (builtins) head tail; };
|
||||
with import ./lists.nix;
|
||||
with import ./attrsets.nix;
|
||||
|
||||
rec {
|
||||
|
||||
|
||||
mkOption = attrs: attrs // {_type = "option";};
|
||||
|
||||
typeOf = x: if (__isAttrs x && x ? _type) then x._type else "";
|
||||
|
||||
isOption = attrs: (typeOf attrs) == "option";
|
||||
|
||||
addDefaultOptionValues = defs: opts: opts //
|
||||
builtins.listToAttrs (map (defName:
|
||||
{ name = defName;
|
||||
value =
|
||||
let
|
||||
defValue = builtins.getAttr defName defs;
|
||||
optValue = builtins.getAttr defName opts;
|
||||
in
|
||||
if typeOf defValue == "option"
|
||||
then
|
||||
# `defValue' is an option.
|
||||
if builtins.hasAttr defName opts
|
||||
then builtins.getAttr defName opts
|
||||
else defValue.default
|
||||
else
|
||||
# `defValue' is an attribute set containing options.
|
||||
# So recurse.
|
||||
if builtins.hasAttr defName opts && builtins.isAttrs optValue
|
||||
then addDefaultOptionValues defValue optValue
|
||||
else addDefaultOptionValues defValue {};
|
||||
}
|
||||
) (builtins.attrNames defs));
|
||||
|
||||
mergeDefaultOption = list:
|
||||
if list != [] && tail list == [] then head list
|
||||
else if all __isFunction list then x: mergeDefaultOption (map (f: f x) list)
|
||||
else if all __isList list then concatLists list
|
||||
else if all __isAttrs list then fold lib.mergeAttrs {} list
|
||||
else if all (x: true == x || false == x) list then fold lib.or false list
|
||||
else if all (x: x == toString x) list then lib.concatStrings list
|
||||
else throw "Cannot merge values.";
|
||||
|
||||
mergeTypedOption = typeName: predicate: merge: list:
|
||||
if all predicate list then merge list
|
||||
else throw "Expect a ${typeName}.";
|
||||
|
||||
mergeEnableOption = mergeTypedOption "boolean"
|
||||
(x: true == x || false == x) (fold lib.or false);
|
||||
|
||||
mergeListOption = mergeTypedOption "list"
|
||||
__isList concatLists;
|
||||
|
||||
mergeStringOption = mergeTypedOption "string"
|
||||
(x: if builtins ? isString then builtins.isString x else x + "")
|
||||
lib.concatStrings;
|
||||
|
||||
mergeOneOption = list:
|
||||
if list == [] then abort "This case should never happens."
|
||||
else if tail list != [] then throw "Multiple definitions. Only one is allowed for this option."
|
||||
else head list;
|
||||
|
||||
|
||||
# Handle the traversal of option sets. All sets inside 'opts' are zipped
|
||||
# and options declaration and definition are separated. If no option are
|
||||
# declared at a specific depth, then the function recurse into the values.
|
||||
# Other cases are handled by the optionHandler which contains two
|
||||
# functions that are used to defined your goal.
|
||||
# - export is a function which takes two arguments which are the option
|
||||
# and the list of values.
|
||||
# - notHandle is a function which takes the list of values are not handle
|
||||
# by this function.
|
||||
handleOptionSets = optionHandler@{export, notHandle, ...}: path: opts:
|
||||
if all __isAttrs opts then
|
||||
lib.zip (attr: opts:
|
||||
let
|
||||
# Compute the path to reach the attribute.
|
||||
name = if path == "" then attr else path + "." + attr;
|
||||
|
||||
# Divide the definitions of the attribute "attr" between
|
||||
# declaration (isOption) and definitions (!isOption).
|
||||
test = partition isOption opts;
|
||||
decls = test.right; defs = test.wrong;
|
||||
|
||||
# Return the option declaration and add missing default
|
||||
# attributes.
|
||||
opt = {
|
||||
inherit name;
|
||||
merge = mergeDefaultOption;
|
||||
apply = lib.id;
|
||||
} // (head decls);
|
||||
|
||||
# Return the list of option sets.
|
||||
optAttrs = map delayIf defs;
|
||||
|
||||
# return the list of option values.
|
||||
# Remove undefined values that are coming from evalIf.
|
||||
optValues = filter (x: !isNotdef x) (map evalIf defs);
|
||||
in
|
||||
if decls == [] then handleOptionSets optionHandler name optAttrs
|
||||
else lib.addErrorContext "while evaluating the option ${name}:" (
|
||||
if tail decls != [] then throw "Multiple options."
|
||||
else export opt optValues
|
||||
)
|
||||
) opts
|
||||
else lib.addErrorContext "while evaluating ${path}:" (notHandle opts);
|
||||
|
||||
# Merge option sets and produce a set of values which is the merging of
|
||||
# all options declare and defined. If no values are defined for an
|
||||
# option, then the default value is used otherwise it use the merge
|
||||
# function of each option to get the result.
|
||||
mergeOptionSets = noOption: newMergeOptionSets; # ignore argument
|
||||
newMergeOptionSets =
|
||||
handleOptionSets {
|
||||
export = opt: values:
|
||||
opt.apply (
|
||||
if values == [] then
|
||||
if opt ? default then opt.default
|
||||
else throw "Not defined."
|
||||
else opt.merge values
|
||||
);
|
||||
notHandle = opts: throw "Used without option declaration.";
|
||||
};
|
||||
|
||||
# Keep all option declarations.
|
||||
filterOptionSets =
|
||||
handleOptionSets {
|
||||
export = opt: values: opt;
|
||||
notHandle = opts: {};
|
||||
};
|
||||
|
||||
# Evaluate a list of option sets that would be merged with the
|
||||
# function "merge" which expects two arguments. The attribute named
|
||||
# "require" is used to imports option declarations and bindings.
|
||||
#
|
||||
# * cfg[0-9]: configuration
|
||||
# * cfgSet[0-9]: configuration set
|
||||
#
|
||||
# merge: the function used to merge options sets.
|
||||
# pkgs: is the set of packages available. (nixpkgs)
|
||||
# opts: list of option sets or option set functions.
|
||||
# config: result of this evaluation.
|
||||
fixOptionSetsFun = merge: pkgs: opts: config:
|
||||
let
|
||||
# remove possible mkIf to access the require attribute.
|
||||
noImportConditions = cfgSet0:
|
||||
let cfgSet1 = delayIf cfgSet0; in
|
||||
if cfgSet1 ? require then
|
||||
cfgSet1 // { require = rmIf cfgSet1.require; }
|
||||
else
|
||||
cfgSet1;
|
||||
|
||||
# call configuration "files" with one of the existing convention.
|
||||
argumentHandler = cfg:
|
||||
let
|
||||
# {..}
|
||||
cfg0 = cfg;
|
||||
# {pkgs, config, ...}: {..}
|
||||
cfg1 = cfg { inherit pkgs config merge; };
|
||||
# pkgs: config: {..}
|
||||
cfg2 = cfg {} {};
|
||||
in
|
||||
if __isFunction cfg0 then
|
||||
if builtins.isAttrs cfg1 then cfg1
|
||||
else builtins.trace "Use '{pkgs, config, ...}:'." cfg2
|
||||
else cfg0;
|
||||
|
||||
preprocess = cfg0:
|
||||
let cfg1 = argumentHandler cfg0;
|
||||
cfg2 = noImportConditions cfg1;
|
||||
in cfg2;
|
||||
|
||||
getRequire = x: toList (getAttr ["require"] [] (preprocess x));
|
||||
rmRequire = x: removeAttrs (preprocess x) ["require"];
|
||||
in
|
||||
merge "" (
|
||||
map rmRequire (
|
||||
lib.uniqFlatten getRequire [] [] (toList opts)
|
||||
)
|
||||
);
|
||||
|
||||
fixOptionSets = merge: pkgs: opts:
|
||||
lib.fix (fixOptionSetsFun merge pkgs opts);
|
||||
|
||||
optionAttrSetToDocList = l: attrs:
|
||||
if (getAttr ["_type"] "" attrs) == "option" then
|
||||
[({
|
||||
#inherit (attrs) description;
|
||||
description = if attrs ? description then attrs.description else
|
||||
throw ("No description ${toString l} : ${lib.whatis attrs}");
|
||||
}
|
||||
// (if attrs ? example then {inherit(attrs) example;} else {} )
|
||||
// (if attrs ? default then {inherit(attrs) default;} else {} )
|
||||
// {name = l;}
|
||||
)]
|
||||
else (concatLists (map (s: (optionAttrSetToDocList
|
||||
(l + (if l=="" then "" else ".") + s) (builtins.getAttr s attrs)))
|
||||
(builtins.attrNames attrs)));
|
||||
|
||||
|
||||
/* If. ThenElse. Always. */
|
||||
# !!! cleanup needed
|
||||
|
||||
# create "if" statement that can be dealyed on sets until a "then-else" or
|
||||
# "always" set is reached. When an always set is reached the condition
|
||||
# is ignore.
|
||||
|
||||
isIf = attrs: (typeOf attrs) == "if";
|
||||
mkIf = condition: thenelse:
|
||||
if isIf thenelse then
|
||||
mkIf (condition && thenelse.condition) thenelse.thenelse
|
||||
else {
|
||||
_type = "if";
|
||||
inherit condition thenelse;
|
||||
};
|
||||
|
||||
|
||||
isNotdef = attrs: (typeOf attrs) == "notdef";
|
||||
mkNotdef = {_type = "notdef";};
|
||||
|
||||
|
||||
isThenElse = attrs: (typeOf attrs) == "then-else";
|
||||
mkThenElse = attrs:
|
||||
assert attrs ? thenPart && attrs ? elsePart;
|
||||
attrs // { _type = "then-else"; };
|
||||
|
||||
|
||||
isAlways = attrs: (typeOf attrs) == "always";
|
||||
mkAlways = value: { inherit value; _type = "always"; };
|
||||
|
||||
pushIf = f: attrs:
|
||||
if isIf attrs then pushIf f (
|
||||
let val = attrs.thenelse; in
|
||||
# evaluate the condition.
|
||||
if isThenElse val then
|
||||
if attrs.condition then
|
||||
val.thenPart
|
||||
else
|
||||
val.elsePart
|
||||
# ignore the condition.
|
||||
else if isAlways val then
|
||||
val.value
|
||||
# otherwise
|
||||
else
|
||||
f attrs.condition val)
|
||||
else
|
||||
attrs;
|
||||
|
||||
# take care otherwise you will have to handle this by hand.
|
||||
rmIf = pushIf (condition: val: val);
|
||||
|
||||
evalIf = pushIf (condition: val:
|
||||
if condition then val else mkNotdef
|
||||
);
|
||||
|
||||
delayIf = pushIf (condition: val:
|
||||
# rewrite the condition on sub-attributes.
|
||||
lib.mapAttrs (name: mkIf condition) val
|
||||
);
|
||||
|
||||
}
|
29
pkgs/lib/sources.nix
Normal file
29
pkgs/lib/sources.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
# Functions for copying sources to the Nix store.
|
||||
|
||||
let lib = import ./default.nix; in
|
||||
|
||||
rec {
|
||||
|
||||
|
||||
# Bring in a path as a source, filtering out all Subversion and CVS
|
||||
# directories, as well as backup files (*~).
|
||||
cleanSource =
|
||||
let filter = name: type: let baseName = baseNameOf (toString name); in ! (
|
||||
# Filter out Subversion and CVS directories.
|
||||
(type == "directory" && (baseName == ".svn" || baseName == "CVS")) ||
|
||||
# Filter out backup files.
|
||||
(lib.hasSuffix "~" baseName)
|
||||
);
|
||||
in src: builtins.filterSource filter src;
|
||||
|
||||
|
||||
# Get all files ending with the specified suffices from the given
|
||||
# directory. E.g. `sourceFilesBySuffices ./dir [".xml" ".c"]'.
|
||||
sourceFilesBySuffices = path: exts:
|
||||
let filter = name: type:
|
||||
let base = baseNameOf (toString name);
|
||||
in type != "directory" && lib.any (ext: lib.hasSuffix ext base) exts;
|
||||
in builtins.filterSource filter path;
|
||||
|
||||
|
||||
}
|
85
pkgs/lib/strings.nix
Normal file
85
pkgs/lib/strings.nix
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* String manipulation functions. */
|
||||
|
||||
let lib = import ./default.nix; in
|
||||
|
||||
rec {
|
||||
inherit (builtins) stringLength substring head tail lessThan sub;
|
||||
|
||||
|
||||
# Concatenate a list of strings.
|
||||
concatStrings = lib.fold (x: y: x + y) "";
|
||||
|
||||
|
||||
# Map a function over a list and concatenate the resulting strings.
|
||||
concatMapStrings = f: list: concatStrings (map f list);
|
||||
|
||||
|
||||
# Place an element between each element of a list, e.g.,
|
||||
# `intersperse "," ["a" "b" "c"]' returns ["a" "," "b" "," "c"].
|
||||
intersperse = separator: list:
|
||||
if list == [] || tail list == []
|
||||
then list
|
||||
else [(head list) separator]
|
||||
++ (intersperse separator (tail list));
|
||||
|
||||
|
||||
# Concatenate a list of strings with a separator between each element, e.g.
|
||||
# concatStringsSep " " ["foo" "bar" "xyzzy"] == "foo bar xyzzy"
|
||||
concatStringsSep = separator: list:
|
||||
concatStrings (intersperse separator list);
|
||||
|
||||
|
||||
# Construct an RPATH containing the libraries for a set of packages,
|
||||
# e.g. "${pkg1}/lib:${pkg2}/lib:...".
|
||||
makeLibraryPath = paths: concatStringsSep ":" (map (path: path + "/lib") paths);
|
||||
|
||||
|
||||
# Dependening on the boolean `cond', return either the given string
|
||||
# or the empty string.
|
||||
optionalString = cond: string: if cond then string else "";
|
||||
|
||||
|
||||
# Determine whether a filename ends in the given suffix.
|
||||
hasSuffix = ext: fileName:
|
||||
let lenFileName = stringLength fileName;
|
||||
lenExt = stringLength ext;
|
||||
in !(lessThan lenFileName lenExt) &&
|
||||
substring (sub lenFileName lenExt) lenFileName fileName == ext;
|
||||
|
||||
|
||||
# Convert a string to a list of characters (i.e. singleton strings).
|
||||
# For instance, "abc" becomes ["a" "b" "c"]. This allows you to,
|
||||
# e.g., map a function over each character. However, note that this
|
||||
# will likely be horribly inefficient; Nix is not a general purpose
|
||||
# programming language. Complex string manipulations should, if
|
||||
# appropriate, be done in a derivation.
|
||||
stringToCharacters = s: let l = stringLength s; in
|
||||
if l == 0
|
||||
then []
|
||||
else [(substring 0 1 s)] ++ stringToCharacters (substring 1 (builtins.sub l 1) s);
|
||||
|
||||
|
||||
# !!! this function seems broken - it doesn't escape all special
|
||||
# characters, and in any case this should be done in a builder.
|
||||
escapeShellArg = s:
|
||||
let escapeChar = x: if x == "'" then "'\"'\"'" else x;
|
||||
in "'" + concatStrings (map escapeChar (stringToCharacters s)) + "'";
|
||||
|
||||
|
||||
# !!! what is this for?
|
||||
defineShList = name: list: "\n${name}=(${concatStringsSep " " (map escapeShellArg list)})\n";
|
||||
|
||||
|
||||
# arg: http://foo/bar/bz.ext returns bz.ext
|
||||
# !!! isn't this what the `baseNameOf' primop does?
|
||||
dropPath = s :
|
||||
if s == "" then "" else
|
||||
let takeTillSlash = left : c : s :
|
||||
if left == 0 then s
|
||||
else if (__substring left 1 s == "/") then
|
||||
(__substring (__add left 1) (__sub c 1) s)
|
||||
else takeTillSlash (__sub left 1) (__add c 1) s; in
|
||||
takeTillSlash (__sub (__stringLength s) 1) 1 s;
|
||||
|
||||
|
||||
}
|
18
pkgs/lib/trivial.nix
Normal file
18
pkgs/lib/trivial.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
rec {
|
||||
|
||||
# Identity function.
|
||||
id = x: x;
|
||||
|
||||
# Constant function.
|
||||
const = x: y: x;
|
||||
|
||||
# Named versions corresponding to some builtin operators.
|
||||
concat = x: y: x ++ y;
|
||||
or = x: y: x || y;
|
||||
and = x: y: x && y;
|
||||
mergeAttrs = x : y : x // y;
|
||||
|
||||
# Take a function and evaluate it with its own returned value.
|
||||
fix = f: let result = f result; in result;
|
||||
|
||||
}
|
|
@ -24,9 +24,6 @@ stdenv.mkDerivation {
|
|||
installFlagsArray=(BUILDROOT=$out/destdir)
|
||||
'';
|
||||
|
||||
# !!! Ideally, we wouldn't have Samba as a dependency of CUPS.
|
||||
# Rather, the backend directory should be treated as configuration
|
||||
# data generated in some other Nix expression in NixOS.
|
||||
postInstall = ''
|
||||
mv $out/destdir/$out/* $out
|
||||
rm -rf $out/destdir
|
||||
|
|
|
@ -69,7 +69,40 @@ mkDerivation {
|
|||
phases=
|
||||
# only do all the setup stuff in nix-support/*
|
||||
set +e
|
||||
source "$s"
|
||||
if [[ -z "\$ZSH_VERSION" ]]; then
|
||||
source "$s"
|
||||
else
|
||||
setopt interactivecomments
|
||||
# fix bash indirection
|
||||
# let's hope the bash arrays aren't used
|
||||
# substitute is using bash array, so skip it
|
||||
echo '
|
||||
setopt NO_BAD_PATTERN
|
||||
setopt NO_BANG_HIST
|
||||
setopt NO_BG_NICE
|
||||
setopt NO_EQUALS
|
||||
setopt NO_FUNCTION_ARGZERO
|
||||
setopt GLOB_SUBST
|
||||
setopt NO_HUP
|
||||
setopt INTERACTIVE_COMMENTS
|
||||
setopt KSH_ARRAYS
|
||||
setopt NO_MULTIOS
|
||||
setopt NO_NOMATCH
|
||||
setopt RM_STAR_SILENT
|
||||
setopt POSIX_BUILTINS
|
||||
setopt SH_FILE_EXPANSION
|
||||
setopt SH_GLOB
|
||||
setopt SH_OPTION_LETTERS
|
||||
setopt SH_WORD_SPLIT
|
||||
' >> "\$tmp/script"
|
||||
sed -e 's/\''${!\([^}]*\)}/\''${(P)\1}/g' \
|
||||
-e 's/[[]\*\]//' \
|
||||
-e 's/substitute() {/ substitute() { return; /' \
|
||||
-e 's@PATH=\$@PATH=${pkgs.coreutils}/bin@' \
|
||||
"$s" >> "\$tmp/script"
|
||||
echo "\$tmp/script";
|
||||
source "\$tmp/script";
|
||||
fi
|
||||
rm -fr "\$tmp"
|
||||
${extraCmds}
|
||||
export PATH
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "ntfs-3g";
|
||||
version = "1.5012";
|
||||
version = "2009.1.1";
|
||||
name = "${pname}-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "${meta.homepage}/${name}.tgz";
|
||||
sha256 = "e79102fdb5948f209d25432f8f5127965877fe47bed68b9270b23fc1d187735a";
|
||||
sha256 = "0e02ff891645658c1801ba7d665c0ff3a4231e5570b974a803ffc2974ef68e45";
|
||||
};
|
||||
|
||||
preConfigure = ''
|
||||
|
|
|
@ -82,7 +82,7 @@ while (scalar @workset > 0) {
|
|||
} elsif (/\\includegraphics(\[.*\])?\{(.*)\}/) {
|
||||
my $fn2 = $2;
|
||||
die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
|
||||
addToWorkSetExts("$path/$fn2", ".pdf", ".png", ".ps");
|
||||
addToWorkSetExts("$path/$fn2", ".pdf", ".png", ".ps", ".jpg");
|
||||
} elsif (/\\pgfdeclareimage(\[.*\])?\{.*\}\{(.*)\}/) {
|
||||
my $fn2 = $2;
|
||||
die "absolute path! $fn2" if substr($fn2, 0, 1) eq "/";
|
||||
|
|
20
pkgs/os-specific/linux/acpid/default.nix
Normal file
20
pkgs/os-specific/linux/acpid/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{stdenv, fetchurl}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "acpid-1.0.8";
|
||||
|
||||
src = fetchurl {
|
||||
url = mirror://sourceforge/acpid/acpid-1.0.8.tar.gz;
|
||||
sha256 = "1cdp4vql8ya073b42mjpzpzzn1py00baazq91837vhrq5hqfaynm";
|
||||
};
|
||||
|
||||
preBuild = ''
|
||||
makeFlagsArray=(BINDIR=$out/bin SBINDIR=$out/sbin MAN8DIR=$out/share/man/man8)
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = http://acpid.sourceforge.net/;
|
||||
description = "A daemon for delivering ACPI events to userspace programs";
|
||||
license = "GPLv2+";
|
||||
};
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
{stdenv, fetchurl}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "e2fsprogs-1.41.3";
|
||||
name = "e2fsprogs-1.41.4";
|
||||
|
||||
src = fetchurl {
|
||||
url = mirror://sourceforge/e2fsprogs/e2fsprogs-1.41.3.tar.gz;
|
||||
sha256 = "0yldax5z1d1gfxpvzmr8y2z5zg5xhbi9pjjy4yw0q28dd2pfsxyf";
|
||||
url = mirror://sourceforge/e2fsprogs/e2fsprogs-1.41.4.tar.gz;
|
||||
sha256 = "1p10j04gwr286qc2pjpp72k38nqk2d2n7sslwhvxgb995gp0zh9c";
|
||||
};
|
||||
|
||||
configureFlags =
|
||||
|
|
|
@ -5,11 +5,11 @@ assert !userModeLinux;
|
|||
import ./generic.nix (
|
||||
|
||||
rec {
|
||||
version = "2.6.27.13";
|
||||
version = "2.6.27.15";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
|
||||
sha256 = "1zxyid70nlzxmx08mrg6a2vafqvs6q1szlcix417d1qq52c88l9i";
|
||||
sha256 = "17n8q425q5xix2fd1ig5gbpfjhy18wggd27pyaxi7vvxa9ihm969";
|
||||
};
|
||||
|
||||
features = {
|
||||
|
|
|
@ -5,11 +5,11 @@ assert !userModeLinux;
|
|||
import ./generic.nix (
|
||||
|
||||
rec {
|
||||
version = "2.6.28.2";
|
||||
version = "2.6.28.4";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
|
||||
sha256 = "0fw4wv9xnajsw3prp2p79470wsflpnigflyyg21s2lfy0xn66ay8";
|
||||
sha256 = "1k45azdjv4i9hh76nbi442vsfpwz31736aq3la2pn5avmkwiz2mm";
|
||||
};
|
||||
|
||||
features = {
|
||||
|
|
|
@ -16,6 +16,7 @@ rec {
|
|||
sed -e '/kernel_path=/akernel_path=$out$kernel_path' -i install.sh
|
||||
sed -e '/depmod/d' -i install.sh
|
||||
cat install.sh
|
||||
sed -e '/linux\/ioctl.h/a#include <linux\/sched.h>' -i kqemu-linux.c
|
||||
'') ["minInit" "doUnpack"];
|
||||
|
||||
phaseNames = ["preConfigure" "doConfigure" "debugStep" "doMakeInstall"];
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
let
|
||||
|
||||
versionNumber = "180.22";
|
||||
versionNumber = "180.29";
|
||||
|
||||
in
|
||||
|
||||
|
@ -14,13 +14,13 @@ stdenv.mkDerivation {
|
|||
src =
|
||||
if stdenv.system == "i686-linux" then
|
||||
fetchurl {
|
||||
url = "http://us.download.nvidia.com/XFree86/Linux-x86/${versionNumber}/NVIDIA-Linux-x86-${versionNumber}-pkg1.run";
|
||||
sha256 = "0cp6ii14pm8kzy1fy1qx2id2fp0lmb02akddid8wwdca7xpczqg7";
|
||||
url = "ftp://download.nvidia.com/XFree86/Linux-x86/${versionNumber}/NVIDIA-Linux-x86-${versionNumber}-pkg0.run";
|
||||
sha256 = "17wgg5rf5384bxng9ygwarf4imvvg069zihfvvvmahg1b0fsipvq";
|
||||
}
|
||||
else if stdenv.system == "x86_64-linux" then
|
||||
fetchurl {
|
||||
url = "http://us.download.nvidia.com/XFree86/Linux-x86_64/${versionNumber}/NVIDIA-Linux-x86_64-${versionNumber}-pkg2.run";
|
||||
sha256 = "0yycsr8i5cc8bnqwvfrk0v9d7gxxv42zqdpz9ki8vxil7lvjfdxv";
|
||||
url = "ftp://download.nvidia.com/XFree86/Linux-x86_64/${versionNumber}/NVIDIA-Linux-x86_64-${versionNumber}-pkg0.run";
|
||||
sha256 = "1w7a67s5df8i5lbr2r980l674wvrqzzys1zdwcla267zy109rp5d";
|
||||
}
|
||||
else throw "nvidia-x11 does not support platform ${stdenv.system}";
|
||||
|
||||
|
|
111
pkgs/stdenv/adapters.nix
Normal file
111
pkgs/stdenv/adapters.nix
Normal file
|
@ -0,0 +1,111 @@
|
|||
/* This file contains various functions that take a stdenv and return
|
||||
a new stdenv with different behaviour, e.g. using a different C
|
||||
compiler. */
|
||||
|
||||
{dietlibc, fetchurl, runCommand}:
|
||||
|
||||
|
||||
rec {
|
||||
|
||||
|
||||
# Override the compiler in stdenv for specific packages.
|
||||
overrideGCC = stdenv: gcc: stdenv //
|
||||
{ mkDerivation = args: stdenv.mkDerivation (args // { NIX_GCC = gcc; });
|
||||
};
|
||||
|
||||
|
||||
# Add some arbitrary packages to buildInputs for specific packages.
|
||||
# Used to override packages in stenv like Make. Should not be used
|
||||
# for other dependencies.
|
||||
overrideInStdenv = stdenv: pkgs: stdenv //
|
||||
{ mkDerivation = args: stdenv.mkDerivation (args //
|
||||
{ buildInputs = (if args ? buildInputs then args.buildInputs else []) ++ pkgs; }
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
# Override the setup script of stdenv. Useful for testing new
|
||||
# versions of the setup script without causing a rebuild of
|
||||
# everything.
|
||||
#
|
||||
# Example:
|
||||
# randomPkg = import ../bla { ...
|
||||
# stdenv = overrideSetup stdenv ../stdenv/generic/setup-latest.sh;
|
||||
# };
|
||||
overrideSetup = stdenv: setup: stdenv.regenerate setup;
|
||||
|
||||
|
||||
# Return a modified stdenv that uses dietlibc to create small
|
||||
# statically linked binaries.
|
||||
useDietLibC = stdenv: stdenv //
|
||||
{ mkDerivation = args: stdenv.mkDerivation (args // {
|
||||
NIX_CFLAGS_LINK = "-static";
|
||||
|
||||
# libcompat.a contains some commonly used functions.
|
||||
NIX_LDFLAGS = "-lcompat";
|
||||
|
||||
# These are added *after* the command-line flags, so we'll
|
||||
# always optimise for size.
|
||||
NIX_CFLAGS_COMPILE =
|
||||
(if args ? NIX_CFLAGS_COMPILE then args.NIX_CFLAGS_COMPILE else "")
|
||||
+ " -Os -s -D_BSD_SOURCE=1";
|
||||
|
||||
configureFlags =
|
||||
(if args ? configureFlags then args.configureFlags else "")
|
||||
+ " --disable-shared"; # brrr...
|
||||
|
||||
NIX_GCC = import ../build-support/gcc-wrapper {
|
||||
inherit stdenv;
|
||||
libc = dietlibc;
|
||||
inherit (stdenv.gcc) gcc binutils name nativeTools nativePrefix;
|
||||
nativeLibc = false;
|
||||
};
|
||||
});
|
||||
isDietLibC = true;
|
||||
} // {inherit fetchurl;};
|
||||
|
||||
|
||||
# Return a modified stdenv that uses klibc to create small
|
||||
# statically linked binaries.
|
||||
useKlibc = stdenv: klibc: stdenv //
|
||||
{ mkDerivation = args: stdenv.mkDerivation (args // {
|
||||
NIX_CFLAGS_LINK = "-static";
|
||||
|
||||
# These are added *after* the command-line flags, so we'll
|
||||
# always optimise for size.
|
||||
NIX_CFLAGS_COMPILE =
|
||||
(if args ? NIX_CFLAGS_COMPILE then args.NIX_CFLAGS_COMPILE else "")
|
||||
+ " -Os -s";
|
||||
|
||||
configureFlags =
|
||||
(if args ? configureFlags then args.configureFlags else "")
|
||||
+ " --disable-shared"; # brrr...
|
||||
|
||||
NIX_GCC = runCommand "klibc-wrapper" {} ''
|
||||
ensureDir $out/bin
|
||||
ln -s ${klibc}/bin/klcc $out/bin/gcc
|
||||
ln -s ${klibc}/bin/klcc $out/bin/cc
|
||||
ensureDir $out/nix-support
|
||||
echo 'PATH=$PATH:${stdenv.gcc.binutils}/bin' > $out/nix-support/setup-hook
|
||||
'';
|
||||
});
|
||||
isKlibc = true;
|
||||
isStatic = true;
|
||||
} // {inherit fetchurl;};
|
||||
|
||||
|
||||
# Return a modified stdenv that tries to build statically linked
|
||||
# binaries.
|
||||
makeStaticBinaries = stdenv: stdenv //
|
||||
{ mkDerivation = args: stdenv.mkDerivation (args // {
|
||||
NIX_CFLAGS_LINK = "-static";
|
||||
|
||||
configureFlags =
|
||||
(if args ? configureFlags then args.configureFlags else "")
|
||||
+ " --disable-shared"; # brrr...
|
||||
});
|
||||
isStatic = true;
|
||||
} // {inherit fetchurl;};
|
||||
|
||||
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
{stdenv, fetchurl, pkgconfig, fuse, perl}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "cromfs-1.5.6.2";
|
||||
name = "cromfs-1.5.7";
|
||||
src = fetchurl {
|
||||
url = http://bisqwit.iki.fi/src/arch/cromfs-1.5.6.2.tar.bz2;
|
||||
sha256 = "bbe5db623d3c0d2b92fe877d8c8e22a8f8d84210739313bf691d42c05406464d";
|
||||
url = http://bisqwit.iki.fi/src/arch/cromfs-1.5.7.tar.bz2;
|
||||
sha256 = "7df900cd5d2656e0d2a9cdfb6da7dd194eef2e2a34537f7f69a56dc08a0c0deb";
|
||||
};
|
||||
|
||||
patchPhase = ''sed -i 's@/bin/bash@/bin/sh@g' configure; set -x'';
|
||||
|
|
39
pkgs/tools/graphics/cuneiform/default.nix
Normal file
39
pkgs/tools/graphics/cuneiform/default.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
a :
|
||||
let
|
||||
fetchurl = a.fetchurl;
|
||||
|
||||
version = a.lib.getAttr ["version"] "0.6" a;
|
||||
buildInputs = with a; [
|
||||
cmake imagemagick patchelf
|
||||
];
|
||||
in
|
||||
rec {
|
||||
src = fetchurl {
|
||||
url = "http://launchpad.net/cuneiform-linux/${version}/${version}/+download/cuneiform-${version}.tar.bz2";
|
||||
sha256 = "0jgiccimwv1aqp9gzl9937gdlh9zl5qpaygf0n1xcbfd5aqz14ig";
|
||||
};
|
||||
|
||||
inherit buildInputs;
|
||||
configureFlags = [];
|
||||
|
||||
/* doConfigure should be removed if not needed */
|
||||
phaseNames = ["doCmake" "doMakeInstall" "postInstall"];
|
||||
|
||||
libc = if a.stdenv ? glibc then a.stdenv.glibc else "";
|
||||
|
||||
doCmake = a.FullDepEntry(''
|
||||
ensureDir $PWD/builddir
|
||||
cd builddir
|
||||
export NIX_LDFLAGS="$NIX_LDFLAGS -ldl -L$out/lib"
|
||||
cmake .. -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=$out -DDL_LIB=${libc}/lib
|
||||
'') ["minInit" "addInputs" "doUnpack" "defEnsureDir"];
|
||||
|
||||
postInstall = a.FullDepEntry(''
|
||||
patchelf --set-rpath $out/lib${if a.stdenv.gcc.gcc != null then ":${a.stdenv.gcc.gcc}/lib" else ""} $out/bin/cuneiform
|
||||
'') ["minInit" "addInputs" "doMakeInstall"];
|
||||
|
||||
name = "cuneiform-" + version;
|
||||
meta = {
|
||||
description = "Cuneiform OCR";
|
||||
};
|
||||
}
|
17
pkgs/tools/misc/cgdb/default.nix
Normal file
17
pkgs/tools/misc/cgdb/default.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
args:
|
||||
args.stdenv.mkDerivation {
|
||||
name = "cgdb-0.6.4";
|
||||
|
||||
src = args.fetchurl {
|
||||
url = http://prdownloads.sourceforge.net/cgdb/cgdb-0.6.4.tar.gz;
|
||||
sha256 = "10c03p3bbr1glyw7j2i2sv97riiksw972pdamcqdqrzzfdcly54w";
|
||||
};
|
||||
|
||||
buildInputs =(with args; [readline ncurses]);
|
||||
|
||||
meta = {
|
||||
description = "curses interface to gdb";
|
||||
homepage = http://cgdb.sourceforge.net/;
|
||||
license ="GPLv2";
|
||||
};
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
args : with args; with builderDefs;
|
||||
let patch =
|
||||
fetchurl {
|
||||
url = http://ftp.de.debian.org/debian/pool/main/d/dosfstools/dosfstools_3.0.0-1.diff.gz;
|
||||
sha256 = "5ecab7e9cf213b0cc7406649ca59edb9ec6daad2fa454bce423ccb1744fc1336";
|
||||
};
|
||||
localDefs = builderDefs.passthru.function (rec {
|
||||
src = /* put a fetchurl here */
|
||||
fetchurl {
|
||||
url = http://ftp.de.debian.org/debian/pool/main/d/dosfstools/dosfstools_3.0.0.orig.tar.gz;
|
||||
sha256 = "46125aafff40e8215e6aa30087c6c72a82654c8f5fca4878adc1fa26342eab58";
|
||||
};
|
||||
preBuild = FullDepEntry (''
|
||||
gunzip < ${patch} | patch -Np1
|
||||
'')["minInit" "doUnpack"];
|
||||
|
||||
buildInputs = [];
|
||||
configureFlags = [];
|
||||
makeFlags = " PREFIX=$out ";
|
||||
});
|
||||
in with localDefs;
|
||||
stdenv.mkDerivation rec {
|
||||
name = "dosfstools-"+version;
|
||||
builder = writeScript (name + "-builder")
|
||||
(textClosure localDefs
|
||||
[preBuild "doMakeInstall" doForceShare doPropagate]);
|
||||
meta = {
|
||||
description = "
|
||||
Dosfstools - utilities for vfat file system.
|
||||
";
|
||||
homepage = "http://sixpak.org/dosfstools/dosfstools-2.8vb2.tar.gz";
|
||||
inherit src;
|
||||
};
|
||||
}
|
24
pkgs/tools/misc/dosfstools/default.nix
Normal file
24
pkgs/tools/misc/dosfstools/default.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
args : with args; with builderDefs;
|
||||
let localDefs = builderDefs.passthru.function (rec {
|
||||
src = /* put a fetchurl here */
|
||||
fetchurl {
|
||||
url = http://www.daniel-baumann.ch/software/dosfstools/dosfstools-3.0.1.tar.bz2;
|
||||
sha256 = "7fab0de42391277028071d01ff4da83ff9a399408ccf29958cdee62ffe746d45";
|
||||
};
|
||||
|
||||
buildInputs = [];
|
||||
configureFlags = [];
|
||||
makeFlags = " PREFIX=$out ";
|
||||
});
|
||||
in with localDefs;
|
||||
stdenv.mkDerivation rec {
|
||||
name = "dosfstools-3.01";
|
||||
builder = writeScript (name + "-builder")
|
||||
(textClosure localDefs
|
||||
["doMakeInstall" doForceShare doPropagate]);
|
||||
meta = {
|
||||
description = "Dosfstools - utilities for vfat file system.";
|
||||
homepage = "http://www.daniel-baumann.ch/software/dosfstools/";
|
||||
inherit src;
|
||||
};
|
||||
}
|
16
pkgs/tools/misc/syslog-ng/default.nix
Normal file
16
pkgs/tools/misc/syslog-ng/default.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{stdenv, fetchurl, eventlog, pkgconfig, glib}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "syslog-ng-2.1.3";
|
||||
meta = {
|
||||
homepage = "http://www.balabit.com/network-security/syslog-ng/";
|
||||
description = "Next-generation syslogd with advanced networking and filtering capabilities.";
|
||||
license = "GPLv2";
|
||||
};
|
||||
src = fetchurl {
|
||||
url = "http://www.balabit.com/downloads/files/syslog-ng/sources/2.1/src/${name}.tar.gz";
|
||||
sha256 = "1m6djxhmihmg09a90gg6mp1ghgk2zm8rcp04shh458433rbzfjb0";
|
||||
};
|
||||
buildInputs = [eventlog pkgconfig glib];
|
||||
configureFlags = "--enable-dynamic-linking";
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
diff --git a/src/osdep/linux.c b/src/osdep/linux.c
|
||||
index 9f3b1ef..ba7e584 100644
|
||||
--- a/src/osdep/linux.c
|
||||
+++ b/src/osdep/linux.c
|
||||
@@ -235,7 +235,11 @@ static char * wiToolsPath(const char * tool)
|
||||
"/bin",
|
||||
"/usr/bin",
|
||||
"/usr/local/bin",
|
||||
- "/tmp"
|
||||
+ "/tmp",
|
||||
+ "/var/run/current-system/sw/bin",
|
||||
+ "/var/run/current-system/sw/sbin",
|
||||
+ "/root/.nix-profile/bin",
|
||||
+ "/root/.nix-profile/sbin"
|
||||
};
|
||||
|
||||
nbelems = sizeof(paths) / sizeof(char *);
|
|
@ -1,4 +1,4 @@
|
|||
{stdenv, fetchurl, libpcap, openssl, zlib}:
|
||||
{stdenv, fetchurl, libpcap, openssl, zlib, wirelesstools}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "aircrack-ng-1.0-rc2";
|
||||
|
@ -10,9 +10,10 @@ stdenv.mkDerivation {
|
|||
|
||||
buildInputs = [libpcap openssl zlib];
|
||||
|
||||
patches = [ ./add-paths.patch ];
|
||||
|
||||
postPatch = "sed -e 's@^prefix.*@prefix = '$out@ -i common.mak";
|
||||
patchPhase = ''
|
||||
sed -e 's@^prefix.*@prefix = '$out@ -i common.mak
|
||||
sed -e 's@/usr/local/bin@'${wirelesstools}@ -i src/osdep/linux.c
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Wireless encryption crackign tools";
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
{stdenv, fetchurl, readline}: stdenv.mkDerivation {
|
||||
{stdenv, fetchurl, readline}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "which-2.20";
|
||||
|
||||
src = fetchurl {
|
||||
url = mirror://gnu/which/which-2.20.tar.gz;
|
||||
sha256 = "1y2p50zadb36izzh2zw4dm5hvdiydqf3qa88l8kav20dcmfbc5yl";
|
||||
};
|
||||
|
||||
buildInputs = [readline];
|
||||
|
||||
meta = {
|
||||
homepage = http://ftp.gnu.org/gnu/which/;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -12,6 +12,8 @@ args: with args; with stringsWithDeps; with lib;
|
|||
"README" "AUTHORS" "ChangeLog" "CHANGES" "LICENCE" "COPYRIGHT"] ++
|
||||
(optional (getAttr ["forceCopyDoc"] true args) "doc");
|
||||
|
||||
hasSuffixHack = a: b: hasSuffix (a+(substring 0 0 b)) ((substring 0 0 a)+b);
|
||||
|
||||
archiveType = s:
|
||||
(if hasSuffixHack ".tar" s then "tar"
|
||||
else if (hasSuffixHack ".tar.gz" s) || (hasSuffixHack ".tgz" s) then "tgz"
|
||||
|
|
Loading…
Reference in a new issue