diff --git a/.gitignore b/.gitignore
index 105e621d702..16aaf68b70b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,8 +3,11 @@
.*.swp
.*.swo
result
-doc/NEWS.html
-doc/NEWS.txt
-doc/manual.html
-doc/manual.pdf
+result-*
+/doc/NEWS.html
+/doc/NEWS.txt
+/doc/manual.html
+/doc/manual.pdf
.version-suffix
+
+.DS_Store
\ No newline at end of file
diff --git a/.version b/.version
index 381796ec8b7..d3a61dbd830 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-13.10
\ No newline at end of file
+14.10
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 00000000000..e59b15425e9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,10 @@
+Nixpkgs is a collection of packages for [Nix](http://nixos.org/nix/) package
+manager. Nixpkgs also includes [NixOS](http://nixos.org/nixos/) linux distribution source code.
+
+* [NixOS installation instructions](http://nixos.org/nixos/manual/#ch-installation)
+* [Manual (How to write packages for Nix)](http://nixos.org/nixpkgs/manual/)
+* [Manual (NixOS)](http://nixos.org/nixos/manual/)
+* [Continuous build](http://hydra.nixos.org/jobset/nixos/trunk-combined)
+* [Tests](http://hydra.nixos.org/job/nixos/trunk-combined/tested#tabs-constituents)
+* [Mailing list](http://lists.science.uu.nl/mailman/listinfo/nix-dev)
+* [IRC - #nixos on freenode.net](irc://irc.freenode.net/#nixos)
diff --git a/default.nix b/default.nix
index 9d5764a6307..c1b9bfd39f9 100644
--- a/default.nix
+++ b/default.nix
@@ -1 +1,7 @@
-import ./pkgs/top-level/all-packages.nix
+if ! builtins ? nixVersion || builtins.compareVersions "1.6" builtins.nixVersion == 1 then
+
+ abort "This version of Nixpkgs requires Nix >= 1.6, please upgrade!"
+
+else
+
+ import ./pkgs/top-level/all-packages.nix
diff --git a/doc/Makefile b/doc/Makefile
index 3c2e8cb21b0..39988cdd414 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -21,18 +21,18 @@ all: NEWS.html NEWS.txt manual.html manual.pdf
NEWS.html: release-notes.xml
$(XSLTPROC) --nonet --xinclude --output $@ $(NEWS_OPTS) \
- $(docbookxsl)/html/docbook.xsl release-notes.xml
+ $(docbookxsl)/xhtml/docbook.xsl release-notes.xml
NEWS.txt: release-notes.xml
$(XSLTPROC) --nonet --xinclude quote-literals.xsl release-notes.xml | \
$(XSLTPROC) --nonet --output $@.tmp.html $(NEWS_OPTS) \
- $(docbookxsl)/html/docbook.xsl -
+ $(docbookxsl)/xhtml/docbook.xsl -
LANG=en_US w3m -dump $@.tmp.html > $@
rm $@.tmp.html
manual.html: *.xml
$(XSLTPROC) --nonet --xinclude --output manual.html \
- $(docbookxsl)/html/docbook.xsl manual.xml
+ $(docbookxsl)/xhtml/docbook.xsl manual.xml
manual.pdf: *.xml
$(dblatex) \
diff --git a/doc/coding-conventions.xml b/doc/coding-conventions.xml
index e55f86ae3d3..61d373738f9 100644
--- a/doc/coding-conventions.xml
+++ b/doc/coding-conventions.xml
@@ -235,12 +235,7 @@ Most of the time, these are the same. For instance, the package
bound to the variable name e2fsprogs in
all-packages.nix, and the Nix expression is in
pkgs/os-specific/linux/e2fsprogs/default.nix.
-However, identifiers in the Nix language don’t allow certain
-characters (e.g. dashes), so sometimes a different variable name
-should be used. For instance, the
-module-init-tools package is bound to the
-module_init_tools variable in
-all-packages.nix.
+
There are a few naming guidelines:
@@ -261,17 +256,20 @@ should be used. For instance, the
a package named hello-svn by
nix-env.
- Dashes in the package name should be changed to
- underscores in variable names, rather than to camel case — e.g.,
- module_init_tools instead of
- moduleInitTools.
+ Dashes in the package name should be preserved
+ in new variable names, rather than converted to underscores
+ (which was convention up to around 2013 and most names
+ still have underscores instead of dashes) — e.g.,
+ http-parser instead of
+ http_parser.
If there are multiple versions of a package, this
should be reflected in the variable names in
all-packages.nix,
- e.g. hello_0_3 and hello_0_4.
+ e.g. json-c-0-9 and json-c-0-11.
If there is an obvious “default” version, make an attribute like
- hello = hello_0_4;.
+ json-c = json-c-0-9;.
+ See also
@@ -288,7 +286,7 @@ dashes between words — not in camel case. For instance, it should be
allPackages.nix or
AllPackages.nix.
-Hierachy
+Hierarchy
Each package should be stored in its own directory somewhere in
the pkgs/ tree, i.e. in
@@ -567,7 +565,7 @@ splitting up an existing category.
-Versioning
+Versioning
Because every version of a package in Nixpkgs creates a
potential maintenance burden, old versions of a package should not be
diff --git a/doc/contributing.xml b/doc/contributing.xml
new file mode 100644
index 00000000000..bcea404baee
--- /dev/null
+++ b/doc/contributing.xml
@@ -0,0 +1,21 @@
+
+
+Contributing
+
+If you make modifications to the manual, it's important to build the manual before contributing:
+
+
+
+ $ git clone git://github.com/NixOS/nixpkgs.git
+
+ $ cd nixpkgs/pkgs/top-level
+
+ $ nix-build -A tarball release.nix
+
+ Inside the built derivation you shall see manual/index.html file.
+
+
+
+
diff --git a/doc/language-support.xml b/doc/language-support.xml
index cb40be4bf57..f5e89df57fc 100644
--- a/doc/language-support.xml
+++ b/doc/language-support.xml
@@ -108,22 +108,22 @@ a preConfigure hook to generate a configuration
file used by Makefile.PL:
-{buildPerlPackage, fetchurl, db4}:
+{buildPerlPackage, fetchurl, db}:
buildPerlPackage rec {
name = "BerkeleyDB-0.36";
-
+
src = fetchurl {
url = "mirror://cpan/authors/id/P/PM/PMQS/${name}.tar.gz";
sha256 = "07xf50riarb60l1h6m2dqmql8q5dij619712fsgw7ach04d8g3z1";
};
preConfigure = ''
- echo "LIB = ${db4}/lib" > config.in
- echo "INCLUDE = ${db4}/include" >> config.in
+ echo "LIB = ${db}/lib" > config.in
+ echo "INCLUDE = ${db}/include" >> config.in
'';
}
-
+
@@ -233,10 +233,83 @@ twisted = buildPythonPackage {
-Java
+Java
-Java packages should install JAR files in
-$out/lib/java.
+Ant-based Java packages are typically built from source as follows:
+
+
+stdenv.mkDerivation {
+ name = "...";
+ src = fetchurl { ... };
+
+ buildInputs = [ jdk ant ];
+
+ buildPhase = "ant";
+}
+
+
+Note that jdk is an alias for the OpenJDK.
+
+JAR files that are intended to be used by other packages should
+be installed in $out/share/java. The OpenJDK has
+a stdenv setup hook that adds any JARs in the
+share/java directories of the build inputs to the
+CLASSPATH environment variable. For instance, if the
+package libfoo installs a JAR named
+foo.jar in its share/java
+directory, and another package declares the attribute
+
+
+buildInputs = [ jdk libfoo ];
+
+
+then CLASSPATH will be set to
+/nix/store/...-libfoo/share/java/foo.jar.
+
+Private JARs
+should be installed in a location like
+$out/share/package-name.
+
+If your Java package provides a program, you need to generate a
+wrapper script to run it using the OpenJRE. You can use
+makeWrapper for this:
+
+
+buildInputs = [ makeWrapper ];
+
+installPhase =
+ ''
+ mkdir -p $out/bin
+ makeWrapper ${jre}/bin/java $out/bin/foo \
+ --add-flags "-cp $out/share/java/foo.jar org.foo.Main"
+ '';
+
+
+Note the use of jre, which is the part of the
+OpenJDK package that contains the Java Runtime Environment. By using
+${jre}/bin/java instead of
+${jdk}/bin/java, you prevent your package from
+depending on the JDK at runtime.
+
+It is possible to use a different Java compiler than
+javac from the OpenJDK. For instance, to use the
+Eclipse Java Compiler:
+
+
+buildInputs = [ jre ant ecj ];
+
+
+(Note that here you don’t need the full JDK as an input, but just the
+JRE.) The ECJ has a stdenv setup hook that sets some environment
+variables to cause Ant to use ECJ, but this doesn’t work with all Ant
+files. Similarly, you can use the GNU Java Compiler:
+
+
+buildInputs = [ gcj ant ];
+
+
+Here, Ant will automatically use gij (the GNU Java
+Runtime) instead of the OpenJRE.
diff --git a/doc/manual.xml b/doc/manual.xml
index d2c07859b28..145e3e12dd9 100644
--- a/doc/manual.xml
+++ b/doc/manual.xml
@@ -32,6 +32,7 @@
+
diff --git a/doc/meta.xml b/doc/meta.xml
index 09252410d80..eb644b3b0ee 100644
--- a/doc/meta.xml
+++ b/doc/meta.xml
@@ -17,7 +17,9 @@ meta = {
It is fully customizable.
'';
homepage = http://www.gnu.org/software/hello/manual/;
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
+ maintainers = [ stdenv.lib.maintainers.eelco ];
+ platforms = stdenv.lib.platforms.all;
};
@@ -31,16 +33,42 @@ the package. The value of a meta-attribute must a string.
command-line using nix-env:
-$ 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 "Hello, world!" when you run it.
It is fully customizable.
" />
- </item>
-</items>
+$ nix-env -qa hello --meta --json
+{
+ "hello": {
+ "meta": {
+ "description": "A program that produces a familiar, friendly greeting",
+ "homepage": "http://www.gnu.org/software/hello/manual/",
+ "license": {
+ "fullName": "GNU General Public License version 3 or later",
+ "shortName": "GPLv3+",
+ "url": "http://www.fsf.org/licensing/licenses/gpl.html"
+ },
+ "longDescription": "GNU Hello is a program that prints \"Hello, world!\" when you run it.\nIt is fully customizable.\n",
+ "maintainers": [
+ "Ludovic Court\u00e8s <ludo@gnu.org>"
+ ],
+ "platforms": [
+ "i686-linux",
+ "x86_64-linux",
+ "armv5tel-linux",
+ "armv7l-linux",
+ "mips64el-linux",
+ "x86_64-darwin",
+ "i686-cygwin",
+ "i686-freebsd",
+ "x86_64-freebsd",
+ "i686-openbsd",
+ "x86_64-openbsd"
+ ],
+ "position": "/home/user/dev/nixpkgs/pkgs/applications/misc/hello/ex-2/default.nix:14"
+ },
+ "name": "hello-2.9",
+ "system": "x86_64-linux"
+ }
+}
+
+
nix-env knows about the
@@ -92,20 +120,23 @@ interpretation:
license
- The license for the package. See below for the
- allowed values.
+ The license for the package. One from attribute set defined in
+
+ nixpkgs/lib/licenses.nix.
+ Example:
+ stdenv.lib.licenses.gpl3.
+ See details in ,
maintainers
A list of names and e-mail addresses of the
- maintainers of this Nix expression, e.g. ["Alice
- <alice@example.org>" "Bob <bob@example.com>"]. If
- you are the maintainer of multiple packages, you may want to add
+ maintainers of this Nix expression. If
+ you would like to be a maintainer of a package, you may want to add
yourself to pkgs/lib/maintainers.nix
- and write something like [stdenv.lib.maintainers.alice
- stdenv.lib.maintainers.bob].
+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/lib/maintainers.nix">nixpkgs/lib/maintainers.nix
+ and write something like [ stdenv.lib.maintainers.alice
+ stdenv.lib.maintainers.bob ].
@@ -118,6 +149,52 @@ interpretation:
package).
+
+ platforms
+ The list of Nix platform types on which the
+ package is supported. Hydra builds packages according to the
+ platform specified. If no platform is specified, the package does
+ not have prebuilt binaries. An example is:
+
+
+meta.platforms = stdenv.lib.platforms.linux;
+
+
+ Attribute Set stdenv.lib.platforms in
+
+ nixpkgs/lib/platforms.nix defines various common
+ lists of platforms types.
+
+
+
+
+ hydraPlatforms
+ The list of Nix platform types for which the Hydra
+ instance at hydra.nixos.org will build the
+ package. (Hydra is the Nix-based continuous build system.) It
+ defaults to the value of meta.platforms. Thus,
+ the only reason to set meta.hydraPlatforms is
+ if you want hydra.nixos.org to build the
+ package on a subset of meta.platforms, or not
+ at all, e.g.
+
+
+meta.platforms = stdenv.lib.platforms.linux;
+meta.hydraPlatforms = [];
+
+
+
+
+
+
+ broken
+ If set to true, the package is
+ marked as “broken”, meaning that it won’t show up in
+ nix-env -qa, and cannot be built or installed.
+ Such packages should be removed from Nixpkgs eventually unless
+ they are fixed.
+
+
@@ -126,80 +203,23 @@ interpretation:
Licenses
-This is just a first attempt at standardising the license
-attribute.
-
-The meta.license attribute must be one of the
-following:
+The meta.license attribute should preferrably contain
+a value from stdenv.lib.licenses defined in
+
+nixpkgs/lib/licenses.nix,
+or in-place license description of the same format if the license is
+unlikely to be useful in another expression.
+A few generic options are available, although it's typically better
+to indicate the specific license:
-
- GPL
- GNU General Public License; version not
- specified.
-
-
-
- GPLv2
- GNU General Public License, version
- 2.
-
-
-
- GPLv2+
- GNU General Public License, version
- 2 or higher.
-
-
-
- GPLv3
- GNU General Public License, version
- 3.
-
-
-
- GPLv3+
- GNU General Public License, version
- 3 or higher.
-
-
-
- bsd
- Catch-all for licenses that are essentially
- similar to the
- original BSD license with the advertising clause removed,
- i.e. permissive non-copyleft free software licenses. This
- includes the X11
- (“MIT”) License.
-
-
-
- perl5
- The Perl 5 license (Artistic License, version 1
- and GPL, version 1 or later).
-
-
free
Catch-all for free software licenses not listed
above.
-
- free-copyleft
- Catch-all for free, copyleft software licenses not
- listed above.
-
-
-
- free-non-copyleft
- Catch-all for free, non-copyleft software licenses
- not listed above.
-
-
unfree-redistributable
Unfree package that can be redistributed in binary
diff --git a/doc/outline.txt b/doc/outline.txt
deleted file mode 100644
index 816cdbdc3ed..00000000000
--- a/doc/outline.txt
+++ /dev/null
@@ -1,158 +0,0 @@
-- The standard environment
-
- (Some of this can be moved from the Nix manual)
-
- - Special attributes
-
- - Generic builder
-
- - Helper functions
-
- - GCC / ld wrapper (+ env vars)
-
- - Phases (+ how to add phases) and hooks
-
- - Override functions for stdenv
-
- - Overriding GCC
-
- - Overriding the setup script
-
- - Predefined override functions in all-packages.nix: static binary
- stdenv, dietlibc stdenv
-
- - Stdenv bootstrap; how to update the Linux bootstrap binaries
-
- - Specific platform notes (Linux, Native, Cygwin, Mingw)
-
-
-- Support for specific languages
-
- - Perl
-
- - Generic Perl builder
-
- - Python
-
- - Wrapper generation
-
- - Haskell
-
- - TODO
-
- - Java
-
- - TODO; Java needs lots of improvement
-
- - TeX/LaTeX
-
- - Special support for building TeX documents
-
-
-- Special kinds of applications
-
- - OpenGL apps
-
- - Binary-only apps
-
- - Linux kernel modules
-
- - Mozilla plugins/extensions
-
- - X apps
-
- - KDE apps
-
- - GConf-based apps
-
- - Programs that need wrappers
-
- - makeWrapper etc.
-
- - Initial ramdisks
-
-
-- Library functions
-
- - i.e. in lib/default.nix
-
-
-- Specific package notes
-
- - Linux kernel; how to update; feature tests
-
- - X.org; how to update
-
- - Gnome; how to update
-
- - GCC?
-
- - GHC?
-
- - ...
-
-
-- Meta attributes
-
- - License attr; possible values
-
-
-- Virtual machine support (for the build farm)
-
- - vmtools
-
- - KVM notes
-
- - Performing a build in a VM
-
- - In the host FS
-
- - In a disk image
-
- - RPM builds
-
- - RPM image creation
-
- - Deb builds
-
- - Deb image creation
-
- - Debugging VM builds
-
-
-- Guidelines for Nixpkgs contributions
-
- - File naming conventions
-
- - Versioning of packages
-
- - Tree organisation
-
- - Variable naming
-
- - Layout / indentations style
-
- - Output FS hierarchy (e.g. $out/share/man instead of $out/man)
-
-
-- Misc
-
- - Building outside of the Nixpkgs tree
-
- - Config options
-
- - Downloading stuff
-
- - fetchurl
-
- - mirror:// scheme
-
- - fetchsvn
-
- - fetchcvs
-
- - fetchdarcs
-
-
-- Appendix: Nixpkgs config options
-
diff --git a/doc/quick-start.xml b/doc/quick-start.xml
index 46578619e1f..0f11a906d77 100644
--- a/doc/quick-start.xml
+++ b/doc/quick-start.xml
@@ -71,7 +71,7 @@ $ git add pkgs/development/libraries/libfoo/default.nix
GNU Multiple Precision arithmetic library (GMP): pkgs/development/libraries/gmp/5.1.1.nix.
+ xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/5.1.x.nix">pkgs/development/libraries/gmp/5.1.x.nix.
Also done by the generic builder, but has a dependency on
m4.
@@ -155,9 +155,10 @@ $ git add pkgs/development/libraries/libfoo/default.nix
- You can use nix-prefetch-url
+ You can use nix-prefetch-url (or similar nix-prefetch-git, etc)
url to get the SHA-256 hash of
- source distributions.
+ source distributions. There are similar commands as nix-prefetch-git and
+ nix-prefetch-hg available in nix-prefetch-scripts package.
@@ -196,7 +197,8 @@ $ emacs pkgs/top-level/all-packages.nix
- Test whether the package builds:
+ To test whether the package builds, run the following command
+ from the root of the nixpkgs source tree:
$ nix-build -A libfoo
@@ -220,17 +222,10 @@ $ nix-env -f . -iA libfoo
- Optionally commit the new package, or send a patch to
+ Optionally commit the new package and open a pull request, or send a patch to
nix-dev@cs.uu.nl.
-
- If you want the TU Delft build farm to build binaries of the
- package and make them available in the nixpkgs
- channel, add it to pkgs/top-level/release.nix.
-
diff --git a/doc/release-notes.xml b/doc/release-notes.xml
index 2a1fb9f3109..a50ee877acd 100644
--- a/doc/release-notes.xml
+++ b/doc/release-notes.xml
@@ -446,7 +446,7 @@ xlink:href='http://nixos.org/releases/nix/nix-0.10/'>Nix
stdenv; the formed changes the C compiler, and
the latter adds additional packages to the front of
stdenv’s initial PATH, allowing
- tools to be overriden.
+ tools to be overridden.
For instance, the package strategoxt
doesn’t build with the GNU Make in stdenv
diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index f0cabe425a3..28e7b7d89f4 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -56,7 +56,7 @@ details.)
Often it is necessary to override or modify some aspect of the
build. To make this easier, the standard environment breaks the
package build into a number of phases, all of
-which can be overriden or modified individually: unpacking the
+which can be overridden or modified individually: unpacking the
sources, applying patches, configuring, building, and installing.
(There are some others; see .)
For instance, a package that doesn’t supply a makefile but instead has
@@ -233,7 +233,7 @@ specific parts of the build (e.g., unpacking the sources or installing
the binaries). Furthermore, it allows a nicer presentation of build
logs in the Nix build farm.
-Each phase can be overriden in its entirety either by setting
+Each phase can be overridden in its entirety either by setting
the environment variable
namePhase to a string
containing some shell commands to be executed, or by redefining the
@@ -298,6 +298,13 @@ executed and in what order:
+
+ preFixupPhases
+
+ Additional phases executed just before the fixup phase.
+
+
+
preDistPhases
@@ -1156,12 +1163,27 @@ echo @foo@
to Qt’s path.
+
+ gdk-pixbuf
+ Exports GDK_PIXBUF_MODULE_FILE
+ environment variable the the builder. Add librsvg package
+ to buildInputs to get svg support.
+
+
GHC
Creates a temporary package database and registers
every Haskell build input in it (TODO: how?).
+
+ GStreamer
+ Adds the
+ GStreamer plugins subdirectory of
+ each build input to the GST_PLUGIN_SYSTEM_PATH_1_0 or
+ GST_PLUGIN_SYSTEM_PATH environment variable.
+
+
diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index 7c93d8698de..da735d71b25 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -1,7 +1,7 @@
# Operations on attribute sets.
with {
- inherit (builtins) head tail isString;
+ inherit (builtins) head tail;
inherit (import ./trivial.nix) or;
inherit (import ./default.nix) fold;
inherit (import ./strings.nix) concatStringsSep;
@@ -20,7 +20,7 @@ rec {
let attr = head attrPath;
in
if attrPath == [] then e
- else if builtins ? hasAttr && hasAttr attr e
+ else if hasAttr attr e
then attrByPath (tail attrPath) default (getAttr attr e)
else default;
@@ -100,7 +100,7 @@ rec {
(AttrSet -> Bool) -> AttrSet -> AttrSet
Example:
- collect builtins.isList { a = { b = ["b"]; }; c = [1]; }
+ collect isList { a = { b = ["b"]; }; c = [1]; }
=> [["b"] [1]]
collect (x: x ? outPath)
@@ -110,7 +110,7 @@ rec {
collect = pred: attrs:
if pred attrs then
[ attrs ]
- else if builtins.isAttrs attrs then
+ else if isAttrs attrs then
concatMap (collect pred) (attrValues attrs)
else
[];
diff --git a/lib/composable-derivation.nix b/lib/composable-derivation.nix
index 1099bd152bf..8e8faae3982 100644
--- a/lib/composable-derivation.nix
+++ b/lib/composable-derivation.nix
@@ -1,15 +1,74 @@
{lib, pkgs} :
let inherit (lib) nv nvs; in
{
- # see for example:
- # - development/interpreters/php_configurable/default.nix
- # - .. search composableDerivation in all-packages.nix ..
+
+ # composableDerivation basically mixes these features:
+ # - fix function
+ # - mergeAttrBy
+ # - provides shortcuts for "options" such as "--enable-foo" and adding
+ # buildInputs, see php example
#
- # You should be able to override anything you like easily
- # grep the mailinglist by title "python proposal" (dec 08)
- # -> http://mail.cs.uu.nl/pipermail/nix-dev/2008-December/001571.html
- # to see why this got complicated when using all its features
- # TODO add newer example using new syntax (kernel derivation proposal -> mailinglist)
+ # It predates styles which are common today, such as
+ # * the config attr
+ # * mkDerivation.override feature
+ # * overrideDerivation (lib/customization.nix)
+ #
+ # Some of the most more important usage examples (which could be rewritten if it was important):
+ # * php
+ # * postgis
+ # * vim_configurable
+ #
+ # A minimal example illustrating most features would look like this:
+ # let base = composableDerivation { (fixed : let inherit (fixed.fixed) name in {
+ # src = fetchurl {
+ # }
+ # buildInputs = [A];
+ # preConfigre = "echo ${name}";
+ # # attention, "name" attr is missing, thus you cannot instantiate "base".
+ # }
+ # in {
+ # # These all add name attribute, thus you can instantiate those:
+ # v1 = base.merge ({ name = "foo-add-B"; buildInputs = [B]; }); // B gets merged into buildInputs
+ # v2 = base.merge ({ name = "mix-in-pre-configure-lines" preConfigre = ""; });
+ # v3 = base.replace ({ name = "foo-no-A-only-B;" buildInputs = [B]; });
+ # }
+ #
+ # So yes, you can think about it being something like nixos modules, and
+ # you'd be merging "features" in one at a time using .merge or .replace
+ # Thanks Shea for telling me that I rethink the documentation ..
+ #
+ # issues:
+ # * its complicated to understand
+ # * some "features" such as exact merge behaviour are burried in mergeAttrBy
+ # and defaultOverridableDelayableArgs assuming the default behaviour does
+ # the right thing in the common case
+ # * Eelco once said using such fix style functions are slow to evaluate
+ # * Too quick & dirty. Hard to understand for others. The benefit was that
+ # you were able to create a kernel builder like base derivation and replace
+ # / add patches the way you want without having to declare function arguments
+ #
+ # nice features:
+ # declaring "optional featuers" is modular. For instance:
+ # flags.curl = {
+ # configureFlags = ["--with-curl=${curl}" "--with-curlwrappers"];
+ # buildInputs = [curl openssl];
+ # };
+ # flags.other = { .. }
+ # (Example taken from PHP)
+ #
+ # alternative styles / related features:
+ # * Eg see function supporting building the kernel
+ # * versionedDerivation (discussion about this is still going on - or ended)
+ # * composedArgsAndFun
+ # * mkDerivation.override
+ # * overrideDerivation
+ # * using { .., *Support ? false }: like configurable options.
+ # To find those examples use grep
+ #
+ # To sum up: It exists for historical reasons - and for most commonly used
+ # tasks the alternatives should be used
+ #
+ # If you have questions about this code ping Marc Weber.
composableDerivation = {
mkDerivation ? pkgs.stdenv.mkDerivation,
diff --git a/lib/default.nix b/lib/default.nix
index fc92e04503b..4b6027c437b 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -21,8 +21,6 @@ let
in
{ inherit trivial lists strings stringsWithDeps attrsets sources options
modules types meta debug maintainers licenses platforms systems;
- # Pull in some builtins not included elsewhere.
- inherit (builtins) pathExists readFile;
}
# !!! don't include everything at top-level; perhaps only the most
# commonly used functions.
diff --git a/lib/licenses.nix b/lib/licenses.nix
index b13a72f3f64..02618f1c6ca 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -1,137 +1,175 @@
-{
- /* License identifiers loosely based on: http://fedoraproject.org/wiki/Licensing
+let
+ spdx = lic: lic // {
+ url = "http://spdx.org/licenses/${lic.shortName}";
+ };
+in
+
+rec {
+ /* License identifiers from spdx.org where possible.
* If you cannot find your license here, then look for a similar license or
* add it to this list. The URL mentioned above is a good source for inspiration.
*/
- artistic2 = {
- shortName = "Artistic 2.0";
- fullName = "Artistic 2.0";
- url = "http://opensource.org/licenses/artistic-license-2.0.php";
- };
-
- agpl3 = {
- shortName = "AGPLv3";
- fullName = "GNU Affero General Public License version 3 only";
- url = https://www.gnu.org/licenses/agpl.html;
+ agpl3 = spdx {
+ shortName = "AGPL-3.0";
+ fullName = "GNU Affero General Public License v3.0";
};
agpl3Plus = {
- shortName = "AGPLv3+";
- fullName = "GNU Affero General Public License version 3 or later";
- url = https://www.gnu.org/licenses/agpl.html;
+ shortName = "AGPL-3.0+";
+ fullName = "GNU Affero General Public License v3.0 or later";
+ inherit (agpl3) url;
};
amd = {
shortName = "amd";
fullName = "AMD License Agreement";
- url = "http://developer.amd.com/amd-license-agreement/";
+ url = http://developer.amd.com/amd-license-agreement/;
+ };#
+
+ apsl20 = spdx {
+ shortName = "APSL-2.0";
+ fullName = "Apple Public Source License 2.0";
};
- amdadl = {
- shortName = "amd-adl";
- fullName = "amd-adl license";
- url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/licenses/AMD-ADL?revision=1.1";
+ artistic2 = spdx {
+ shortName = "Artistic-2.0";
+ fullName = "Artistic License 2.0";
};
- # Apple Public Source License 2.0;
- # http://opensource.org/licenses/APSL-2.0
- apsl20 = "APSL 2.0";
-
- asl20 = {
- shortName = "ASL2.0";
- fullName = "Apache Software License 2.0";
- url = http://www.apache.org/licenses/LICENSE-2.0;
+ asl20 = spdx {
+ shortName = "Apache-2.0";
+ fullName = "Apache License 2.0";
};
- boost = {
- shortName = "boost";
- fullName = "Boost Software License";
- url = http://www.boost.org/LICENSE_1_0.txt;
+ boost = spdx {
+ shortName = "BSL-1.0";
+ fullName = "Boost Software License 1.0";
};
- bsd2 = {
- shortName = "BSD-2";
- fullName = "BSD license (2 clause)";
- url = http://opensource.org/licenses/BSD-2-Clause;
+ bsd2 = spdx {
+ shortName = "BSD-2-Clause";
+ fullName = ''BSD 2-clause "Simplified" License'';
};
- bsd3 = {
- shortName = "BSD-3";
- fullName = "BSD license (3 clause)";
- url = http://opensource.org/licenses/BSD-3-Clause;
+ bsd3 = spdx {
+ shortName = "BSD-3-Clause";
+ fullName = ''BSD 3-clause "New" or "Revised" License'';
};
- bsdOriginal = {
- shortName = "BSD-original";
- fullName = "Original BSD license with advertising clause";
- url = https://fedoraproject.org/wiki/Licensing/BSD;
+ bsdOriginal = spdx {
+ shortName = "BSD-4-Clause";
+ fullName = ''BSD 4-clause "Original" or "Old" License'';
};
- cddl = {
- shortName = "CDDL";
- fullName = "Common Development Distribution License ";
- url = http://www.opensolaris.org/os/licensing/cddllicense.txt;
+ cc-by-30 = spdx {
+ shortName = "CC-BY-3.0";
+ fullName = "Creative Commons Attribution 3.0";
};
- cpl10 = {
- shortName = "CPL 1.0";
- fullName = "Common Public License version 1.0";
- url = http://www.eclipse.org/legal/cpl-v10.html;
+ cddl = spdx {
+ shortName = "CDDL-1.0";
+ fullName = "Common Development and Distribution License 1.0";
};
- epl10 = {
- shortName = "EPL 1.0";
- fullName = "Eclipse Public License version 1.0";
- url = http://www.eclipse.org/legal/epl-v10.html;
+ cecill-c = spdx {
+ shortName = "CECILL-C";
+ fullName = "CeCILL-C Free Software License Agreement";
};
- gpl2 = "GPLv2";
+ cpl10 = spdx {
+ shortName = "CPL-1.0";
+ fullName = "Common Public License 1.0";
+ };
+
+ epl10 = spdx {
+ shortName = "EPL-1.0";
+ fullName = "Eclipse Public License 1.0";
+ };
+
+ free = "free";
+
+ gpl2 = spdx {
+ shortName = "GPL-2.0";
+ fullName = "GNU General Public License v2.0 only";
+ };
gpl2Oss = {
- shortName = "GPLv2+OSS";
+ shortName = "GPL-2.0-with-OSS";
fullName = "GNU General Public License version 2 only (with OSI approved licenses linking exception)";
url = http://www.mysql.com/about/legal/licensing/foss-exception;
};
- # GNU General Public License version 2 or later;
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
- gpl2Plus = "GPLv2+";
-
- gpl3 = {
- shortName = "GPLv3";
- fullName = "GNU General Public License version 3 only";
- url = http://www.fsf.org/licensing/licenses/gpl.html;
+ gpl2Plus = spdx {
+ shortName = "GPL-2.0+";
+ fullName = "GNU General Public License v2.0 or later";
};
- gpl3Plus = {
- shortName = "GPLv3+";
- fullName = "GNU General Public License version 3 or later";
- url = http://www.fsf.org/licensing/licenses/gpl.html;
+ gpl3 = spdx {
+ shortName = "GPL-3.0";
+ fullName = "GNU General Public License v3.0 only";
+ };
+
+ gpl3Plus = spdx {
+ shortName = "GPL-3.0+";
+ fullName = "GNU General Public License v3.0 or later";
};
gpl3ClasspathPlus = {
- shortName = "GPLv3+classpath+";
- fullName = "GNU General Public License version 3 or later (with Classpath exception)";
+ shortName = "GPL-3.0+-with-classpath-exception";
+ fullName = "GNU General Public License v3.0 or later (with Classpath exception)";
url = https://fedoraproject.org/wiki/Licensing/GPL_Classpath_Exception;
};
- isc = {
+ inria = {
+ shortName = "INRIA-NCLA";
+ fullName = "INRIA Non-Commercial License Agreement";
+ url = "http://compcert.inria.fr/doc/LICENSE";
+ };
+
+ ipa = spdx {
+ shortName = "IPA";
+ fullName = "IPA Font License";
+ };
+
+ ipl10 = spdx {
+ shortName = "IPL-1.0";
+ fullName = "IBM Public License v1.0";
+ };
+
+ isc = spdx {
shortName = "ISC";
- fullName = "Internet Systems Consortium License";
- url = http://www.opensource.org/licenses/ISC;
+ fullName = "ISC License";
};
- ipl10 = {
- shortName = "IPL 1.0";
- fullName = "IBM Public License Version 1.0";
- url = http://www.ibm.com/developerworks/opensource/library/os-i18n2/os-ipl.html;
+ lgpl2 = spdx {
+ shortName = "LGPL-2.0";
+ fullName = "GNU Library General Public License v2 only";
};
- ijg = {
- shortName = "IJG";
- fullName = "Independent JPEG Group License";
- url = https://fedoraproject.org/wiki/Licensing/IJG;
+ lgpl2Plus = spdx {
+ shortName = "LGPL-2.0+";
+ fullName = "GNU Library General Public License v2 or later";
+ };
+
+ lgpl21 = spdx {
+ shortName = "LGPL-2.1";
+ fullName = "GNU Library General Public License v2.1 only";
+ };
+
+ lgpl21Plus = spdx {
+ shortName = "LGPL-2.1+";
+ fullName = "GNU Library General Public License v2.1 or later";
+ };
+
+ lgpl3 = spdx {
+ shortName = "LGPL-3.0";
+ fullName = "GNU Lesser General Public License v3.0 only";
+ };
+
+ lgpl3Plus = spdx {
+ shortName = "LGPL-3.0+";
+ fullName = "GNU Lesser General Public License v3.0 or later";
};
libtiff = {
@@ -140,62 +178,52 @@
url = https://fedoraproject.org/wiki/Licensing/libtiff;
};
- lgpl2 = "LGPLv2";
-
- lgpl2Plus = {
- shortName = "LGPLv2+";
- fullName = "GNU Library General Public License version 2 or later";
- url = http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html;
- };
-
- lgpl21 = "LGPLv2.1";
-
- lgpl21Plus = {
- shortName = "LGPLv2.1+";
- fullName = "GNU Lesser General Public License version 2.1 or later";
- url = http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html;
- };
-
llgpl21 = {
- shortName = "LLGPLv2.1";
+ shortName = "LLGPL-2.1";
fullName = "Lisp LGPL; GNU Lesser General Public License version 2.1 with Franz Inc. preamble for clarification of LGPL terms in context of Lisp";
url = http://opensource.franz.com/preamble.html;
};
- lgpl3 = {
- shortName = "LGPLv3";
- fullName = "GNU Lesser General Public License version 3 only";
- url = http://www.fsf.org/licensing/licenses/lgpl.html;
+ lpl-102 = spdx {
+ shortName = "LPL-1.02";
+ fullName = "Lucent Public License v1.02";
};
- lgpl3Plus = {
- shortName = "LGPLv3+";
- fullName = "GNU Lesser General Public License version 3 or later";
- url = http://www.fsf.org/licensing/licenses/lgpl.html;
- };
-
- mit = {
+ mit = spdx {
shortName = "MIT";
- fullName = "MIT/X11 license";
- url = http://www.opensource.org/licenses/mit-license.php;
+ fullName = "MIT License";
};
- mpl11 = {
- shortName = "MPL1.1";
- fullName = "Mozilla Public License version 1.1";
- url = http://www.mozilla.org/MPL/MPL-1.1.html;
+ mpl11 = spdx {
+ shortName = "MPL-1.1";
+ fullName = "Mozilla Public License 1.1";
};
- mpl20 = {
- shortName = "MPL2.0";
- fullName = "Mozilla Public License version 2.0";
- url = https://www.mozilla.org/MPL/2.0;
+ mpl20 = spdx {
+ shortName = "MPL-2.0";
+ fullName = "Mozilla Public License 2.0";
};
- openssl = {
- shortName = "openssl";
- fullName = "OpenSSL license";
- url = http://www.openssl.org/source/license.html;
+ msrla = {
+ shortName = "MSR-LA";
+ fullName = "Microsoft Research License Agreement";
+ url = "http://research.microsoft.com/en-us/projects/pex/msr-la.txt";
+ };
+
+ ofl = spdx {
+ shortName = "OFL-1.1";
+ fullName = "SIL Open Font License 1.1";
+ };
+
+ openssl = spdx {
+ shortName = "OpenSSL";
+ fullName = "OpenSSL License";
+ };
+
+ psfl = spdx {
+ shortName = "Python-2.0";
+ fullName = "Python Software Foundation License version 2";
+ #url = http://docs.python.org/license.html;
};
publicDomain = {
@@ -203,10 +231,9 @@
fullname = "Public Domain";
};
- psfl = {
- shortName = "PSFL";
- fullName = "Python Software Foundation License";
- url = http://docs.python.org/license.html;
+ sleepycat = spdx {
+ shortName = "Sleepycat";
+ fullName = "Sleepycat License";
};
tcltk = {
@@ -221,21 +248,26 @@
unfreeRedistributableFirmware = "unfree-redistributable-firmware";
- zlib = {
- shortName = "zlib";
- fullName = "zlib license";
- url = http://www.gzip.org/zlib/zlib_license.html;
+ wadalab = {
+ shortName = "wadalab";
+ fullName = "Wadalab Font License";
+ url = https://fedoraproject.org/wiki/Licensing:Wadalab?rd=Licensing/Wadalab;
};
- zpt20 = {
- shortName = "ZPT2.0";
+ zlib = spdx {
+ shortName = "Zlib";
+ fullName = "zlib License";
+ };
+
+ zpt20 = spdx { # FIXME: why zpt* instead of zpl*
+ shortName = "ZPL-2.0";
fullName = "Zope Public License 2.0";
- url = "http://old.zope.org/Resources/License/ZPL-2.0";
};
- zpt21 = {
- shortName = "ZPT2.1";
+ zpt21 = spdx {
+ shortName = "ZPL-2.1";
fullName = "Zope Public License 2.1";
- url = "http://old.zope.org/Resources/License/ZPL-2.1";
};
+
}
+
diff --git a/lib/lists.nix b/lib/lists.nix
index d0b09539bf6..4b5f04a6758 100644
--- a/lib/lists.nix
+++ b/lib/lists.nix
@@ -1,14 +1,16 @@
# General list operations.
-let
- inherit (import ./trivial.nix) deepSeq;
+with import ./trivial.nix;
+
+let
inc = builtins.add 1;
dec = n: builtins.sub n 1;
in rec {
- inherit (builtins) head tail length isList add sub lessThan elemAt;
+
+ inherit (builtins) head tail length isList elemAt concatLists filter elem;
# Create a list consisting of a single element. `singleton x' is
@@ -55,10 +57,6 @@ in rec {
else [ (f (inc n) (elemAt list n)) ] ++ imap' (inc n);
in imap' 0;
-
- # Concatenate a list of lists.
- concatLists = builtins.concatLists or (fold (x: y: x ++ y) []);
-
# Map and concatenate the result.
concatMap = f: list: concatLists (map f list);
@@ -72,24 +70,10 @@ in rec {
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 =
- builtins.filter or
- (pred: list:
- fold (x: y: if pred x then [x] ++ y else y) [] list);
-
# Remove elements equal to 'e' from a list. Useful for buildInputs.
remove = e: filter (x: x != e);
-
- # Return true if `list' has an element `x'.
- elem =
- builtins.elem or
- (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
@@ -106,7 +90,7 @@ in rec {
findFirst = pred: default: list:
let found = filter pred list;
in if found == [] then default else head found;
-
+
# Return true iff function `pred' returns true for at least element
# of `list'.
@@ -136,16 +120,16 @@ in rec {
# 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];
+ toList = x: if 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
+ if lessThan last first
then []
- else [first] ++ range (builtins.add first 1) last;
+ else [first] ++ range (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:
@@ -160,7 +144,7 @@ in rec {
let
len1 = length fst;
len2 = length snd;
- len = if builtins.lessThan len1 len2 then len1 else len2;
+ len = if lessThan len1 len2 then len1 else len2;
zipListsWith' = n:
if n != len then
[ (f (elemAt fst n) (elemAt snd n)) ]
@@ -207,7 +191,7 @@ in rec {
[ (elemAt list n) ] ++ take' (inc n);
in take' 0;
-
+
# Remove the first (at most) N elements of a list.
drop = count: list:
let
@@ -219,7 +203,8 @@ in rec {
drop' (dec n) ++ [ (elemAt list n) ];
in drop' (dec len);
-
+
+ # Return the last element of a list.
last = list:
assert list != []; elemAt list (dec (length list));
@@ -237,5 +222,9 @@ in rec {
else [];
in zipTwoLists' 0;
+
deepSeqList = xs: y: if any (x: deepSeq x false) xs then y else y;
+
+ crossLists = f: foldl (fs: args: concatMap (f: map f args) fs) [f];
+
}
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 7f84e11e561..184fd7036a0 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -4,38 +4,72 @@
/* Add your name and email address here. Keep the list
alphabetically sorted. */
+ _1126 = "Christian Lask ";
aforemny = "Alexander Foremny ";
+ ak = "Alexander Kjeldaas ";
+ akc = "Anders Claesson ";
algorith = "Dries Van Daele ";
all = "Nix Committers ";
amiddelk = "Arie Middelkoop ";
amorsillo = "Andrew Morsillo ";
+ AndersonTorres = "Anderson Torres ";
andres = "Andres Loeh ";
antono = "Antono Vasiljev ";
+ arobyn = "Alexei Robyn ";
astsmtl = "Alexander Tsamutali ";
aszlig = "aszlig ";
+ auntie = "Jonathan Glines ";
bbenoist = "Baptist BENOIST ";
+ bennofs = "Benno Fünfstück ";
+ berdario = "Dario Bertini ";
bjg = "Brian Gough ";
bjornfor = "Bjørn Forsman ";
bluescreen303 = "Mathijs Kwik ";
bodil = "Bodil Stokke ";
+ bosu = "Boris Sukholitko ";
+ calrama = "Moritz Maxeiner ";
+ cfouche = "Chaddaï Fouché ";
chaoflow = "Florian Friesdorf ";
coconnor = "Corey O'Connor ";
coroa = "Jonas Hörsch ";
+ cstrahan = "Charles Strahan ";
+ DamienCassou = "Damien Cassou ";
+ ederoyd46 = "Matthew Brown ";
edwtjo = "Edward Tjörnhammar ";
eelco = "Eelco Dolstra ";
- ertes = "Ertugrul Söylemez ";
+ emery = "Emery Hemingway ";
+ ertes = "Ertugrul Söylemez ";
+ falsifian = "James Cook ";
+ flosse = "Markus Kohlhase ";
+ fuuzetsu = "Mateusz Kowalczyk ";
garbas = "Rok Garbas ";
goibhniu = "Cillian de Róiste ";
guibert = "David Guibert ";
+ hinton = "Tom Hinton ";
+ hrdinka = "Christoph Hrdinka ";
+ ianwookim = "Ian-Woo Kim ";
iElectric = "Domen Kozar ";
iyzsong = "Song Wenwu ";
jcumming = "Jack Cummings ";
+ jgeerds = "Jascha Geerds ";
+ joamaki = "Jussi Maki ";
+ joelteon = "Joel Taylor ";
+ jwiegley = "John Wiegley ";
kkallio = "Karn Kallio ";
+ ktosiek = "Tomasz Kontusz ";
+ lethalman = "Luca Bruno ";
+ linquize = "Linquize ";
lovek323 = "Jason O'Conal ";
ludo = "Ludovic Courtès ";
+ madjar = "Georges Dubus ";
marcweber = "Marc Weber ";
+ matejc = "Matej Cotman ";
+ meisternu = "Matt Miemiec ";
modulistic = "Pablo Costa ";
mornfall = "Petr Ročkai ";
+ msackman = "Matthew Sackman ";
+ nathan-gs = "Nathan Bijnens ";
+ notthemessiah = "Brian Cohen ";
ocharles = "Oliver Charles ";
offline = "Jaka Hudoklin ";
orbitz = "Malcolm Matalka ";
@@ -43,24 +77,46 @@
phreedom = "Evgeny Egorochkin ";
pierron = "Nicolas B. Pierron ";
piotr = "Piotr Pietraszkiewicz ";
+ pkmx = "Chih-Mao Chen ";
+ plcplc = "Philip Lykke Carlsen ";
pSub = "Pascal Wittmann ";
qknight = "Joachim Schiele ";
raskin = "Michael Raskin <7c6f434c@mail.ru>";
+ redbaron = "Maxim Ivanov ";
+ refnil = "Martin Lavoie ";
+ relrod = "Ricky Elrod ";
rickynils = "Rickard Nilsson ";
rob = "Rob Vermaas ";
roconnor = "Russell O'Connor ";
+ roelof = "Roelof Wobben ";
+ romildo = "José Romildo Malaquias ";
+ rszibele = "Richard Szibele ";
sander = "Sander van der Burg ";
shlevy = "Shea Levy ";
simons = "Peter Simons ";
+ skeidel = "Sven Keidel ";
smironov = "Sergey Mironov ";
+ sprock = "Roger Mason ";
+ tailhook = "Paul Colomiets ";
thammers = "Tobias Hammerschmidt ";
the-kenny = "Moritz Ulrich ";
+ thoughtpolice = "Austin Seipp ";
+ tomberek = "Thomas Bereknyei ";
+ ttuegel = "Thomas Tuegel ";
+ tv = "Tomislav Viljetić ";
urkud = "Yury G. Kudryashov ";
+ vbmithr = "Vincent Bernardoff ";
vcunat = "Vladimír Čunát ";
viric = "Lluís Batlle i Rossell ";
vizanto = "Danny Wilson ";
vlstill = "Vladimír Štill ";
winden = "Antonio Vargas Gonzalez ";
+ wizeman = "Ricardo M. Correia ";
+ wjlroe = "William Roe ";
+ wkennington = "William A. Kennington III ";
+ wmertens = "Wout Mertens ";
z77z = "Marco Maggesi ";
zef = "Zef Hemel ";
+ zimbatm = "zimbatm ";
+ zoomulator = "Kim Simmons ";
}
diff --git a/lib/meta.nix b/lib/meta.nix
index a5afce9e0cb..44e3cc011f1 100644
--- a/lib/meta.nix
+++ b/lib/meta.nix
@@ -1,6 +1,9 @@
/* Some functions for manipulating meta attributes, as well as the
name attribute. */
+let lib = import ./default.nix;
+in
+
rec {
@@ -11,7 +14,7 @@ rec {
addMetaAttrs {description = "Bla blah";} somePkg
*/
addMetaAttrs = newAttrs: drv:
- drv // { meta = (if drv ? meta then drv.meta else {}) // newAttrs; };
+ drv // { meta = (drv.meta or {}) // newAttrs; };
/* Change the symbolic name of a package for presentation purposes
@@ -28,11 +31,15 @@ rec {
updateName = updater: drv: drv // {name = updater (drv.name);};
- /* Append a suffix to the name of a package. !!! the suffix should
- really be appended *before* the version, at least most of the
- time.
+ /* Append a suffix to the name of a package (before the version
+ part). */
+ appendToName = suffix: updateName (name:
+ let x = builtins.parseDrvName name; in "${x.name}-${suffix}-${x.version}");
+
+
+ /* Apply a function to each derivation and only to derivations in an attrset
*/
- appendToName = suffix: updateName (name: "${name}-${suffix}");
+ mapDerivationAttrset = f: set: lib.mapAttrs (name: pkg: if lib.isDerivation pkg then (f pkg) else pkg) set;
/* Decrease the nix-env priority of the package, i.e., other
@@ -40,9 +47,20 @@ rec {
*/
lowPrio = drv: addMetaAttrs { priority = "10"; } drv;
+
+ /* Apply lowPrio to an attrset with derivations
+ */
+ lowPrioSet = set: mapDerivationAttrset lowPrio set;
+
+
/* Increase the nix-env priority of the package, i.e., this
version/variant of the package will be preferred.
*/
hiPrio = drv: addMetaAttrs { priority = "-10"; } drv;
-
+
+
+ /* Apply hiPrio to an attrset with derivations
+ */
+ hiPrioSet = set: mapDerivationAttrset hiPrio set;
+
}
diff --git a/lib/modules.nix b/lib/modules.nix
index 071809daa58..bcaadc7fd97 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -12,7 +12,7 @@ rec {
and ‘config’: the nested set of all option values. */
evalModules = { modules, prefix ? [], args ? {}, check ? true }:
let
- args' = args // result;
+ args' = args // { lib = import ./.; } // result;
closed = closeModules modules args';
# Note: the list of modules is reversed to maintain backward
# compatibility with the old module system. Not sure if this is
@@ -42,7 +42,7 @@ rec {
closeModules = modules: args:
let
toClosureList = file: parentKey: imap (n: x:
- if isAttrs x || builtins.isFunction x then
+ if isAttrs x || isFunction x then
unifyModuleSyntax file "${parentKey}:anon-${toString n}" (applyIfFunction x args)
else
unifyModuleSyntax (toString x) (toString x) (applyIfFunction (import x) args));
@@ -74,7 +74,7 @@ rec {
config = removeAttrs m ["key" "_file" "require" "imports"];
};
- applyIfFunction = f: arg: if builtins.isFunction f then f arg else f;
+ applyIfFunction = f: arg: if isFunction f then f arg else f;
/* Merge a list of modules. This will recurse over the option
declarations in all modules, combining them into a single set.
@@ -155,8 +155,14 @@ rec {
let
# Process mkOverride properties, adding in the default
# value specified in the option declaration (if any).
- defsFinal = filterOverrides
+ defsFinal' = filterOverrides
((if opt ? default then [{ file = head opt.declarations; value = mkOptionDefault opt.default; }] else []) ++ defs);
+ # Sort mkOrder properties.
+ defsFinal =
+ # Avoid sorting if we don't have to.
+ if any (def: def.value._type or "" == "order") defsFinal'
+ then sortProperties defsFinal'
+ else defsFinal';
files = map (def: def.file) defsFinal;
# Type-check the remaining definitions, and merge them if
# possible.
@@ -180,7 +186,7 @@ rec {
};
/* Given a config set, expand mkMerge properties, and push down the
- mkIf properties into the children. The result is a list of
+ other properties into the children. The result is a list of
config sets that do not have properties at top-level. For
example,
@@ -188,7 +194,7 @@ rec {
is transformed into
- [ { boot = set1; } { boot = mkIf cond set2; services mkIf cond set3; } ].
+ [ { boot = set1; } { boot = mkIf cond set2; services = mkIf cond set3; } ].
This transform is the critical step that allows mkIf conditions
to refer to the full configuration without creating an infinite
@@ -201,7 +207,7 @@ rec {
map (mapAttrs (n: v: mkIf cfg.condition v)) (pushDownProperties cfg.content)
else if cfg._type or "" == "override" then
map (mapAttrs (n: v: mkOverride cfg.priority v)) (pushDownProperties cfg.content)
- else
+ else # FIXME: handle mkOrder?
[ cfg ];
/* Given a config value, expand mkMerge properties, and discharge
@@ -253,6 +259,19 @@ rec {
strip = def: if def.value._type or "" == "override" then def // { value = def.value.content; } else def;
in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
+ /* Sort a list of properties. The sort priority of a property is
+ 1000 by default, but can be overriden by wrapping the property
+ using mkOrder. */
+ sortProperties = defs:
+ let
+ strip = def:
+ if def.value._type or "" == "order"
+ then def // { value = def.value.content; inherit (def.value) priority; }
+ else def;
+ defs' = map strip defs;
+ compare = a: b: (a.priority or 1000) < (b.priority or 1000);
+ in sort compare defs';
+
/* Hack for backward compatibility: convert options of type
optionSet to configOf. FIXME: remove eventually. */
fixupOptionType = loc: opt:
@@ -260,7 +279,7 @@ rec {
options' = opt.options or
(throw "Option `${showOption loc'}' has type optionSet but has no option attribute.");
coerce = x:
- if builtins.isFunction x then x
+ if isFunction x then x
else { config, ... }: { options = x; };
options = map coerce (flatten options');
f = tp:
@@ -300,10 +319,17 @@ rec {
mkForce = mkOverride 50;
mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’
+ mkStrict = builtins.trace "`mkStrict' is obsolete; use `mkOverride 0' instead." (mkOverride 0);
+
mkFixStrictness = id; # obsolete, no-op
- # FIXME: Add mkOrder back in. It's not currently used anywhere in
- # NixOS, but it should be useful.
+ mkOrder = priority: content:
+ { _type = "order";
+ inherit priority content;
+ };
+
+ mkBefore = mkOrder 500;
+ mkAfter = mkOrder 1500;
/* Compatibility. */
diff --git a/lib/options.nix b/lib/options.nix
index 63798c4faa3..71e02db58f6 100644
--- a/lib/options.nix
+++ b/lib/options.nix
@@ -34,12 +34,12 @@ rec {
mergeDefaultOption = loc: defs:
let list = getValues defs; in
if length list == 1 then head list
- else if all builtins.isFunction list then x: mergeDefaultOption loc (map (f: f x) list)
+ else if all isFunction list then x: mergeDefaultOption loc (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 builtins.isBool list then fold lib.or false list
- else if all builtins.isString list then lib.concatStrings list
- else if all builtins.isInt list && all (x: x == head list) list then head list
+ else if all isBool list then fold lib.or false list
+ else if all isString list then lib.concatStrings list
+ else if all isInt list && all (x: x == head list) list then head list
else throw "Cannot merge definitions of `${showOption loc}' given in ${showFiles (getFiles defs)}.";
/* Obsolete, will remove soon. Specify an option type or apply
@@ -54,7 +54,7 @@ rec {
mergeListOption = mergeTypedOption "list" isList concatLists;
- mergeStringOption = mergeTypedOption "string" builtins.isString lib.concatStrings;
+ mergeStringOption = mergeTypedOption "string" isString lib.concatStrings;
mergeOneOption = loc: defs:
if defs == [] then abort "This case should never happen."
diff --git a/lib/platforms.nix b/lib/platforms.nix
index 8be37d7ed1e..067670c6b3e 100644
--- a/lib/platforms.nix
+++ b/lib/platforms.nix
@@ -2,15 +2,15 @@ let lists = import ./lists.nix; in
rec {
gnu = linux; /* ++ hurd ++ kfreebsd ++ ... */
- linux = ["i686-linux" "x86_64-linux" "powerpc-linux" "armv5tel-linux" "armv7l-linux" "mips64el-linux"];
+ linux = ["i686-linux" "x86_64-linux" "armv5tel-linux" "armv7l-linux" "mips64el-linux"];
darwin = ["x86_64-darwin"];
- freebsd = ["i686-freebsd" "x86_64-freebsd" "powerpc-freebsd"];
+ freebsd = ["i686-freebsd" "x86_64-freebsd"];
openbsd = ["i686-openbsd" "x86_64-openbsd"];
netbsd = ["i686-netbsd" "x86_64-netbsd"];
- cygwin = ["i686-cygwin"];
+ cygwin = ["i686-cygwin" "x86_64-cygwin"];
unix = linux ++ darwin ++ freebsd ++ openbsd;
all = linux ++ darwin ++ cygwin ++ freebsd ++ openbsd;
none = [];
- allBut = platform: lists.filter (x: platform != x) all;
+ allBut = platforms: lists.filter (x: !(builtins.elem x platforms)) all;
mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux"];
}
diff --git a/lib/sources.nix b/lib/sources.nix
index 6f8554d340b..a80e4397d6a 100644
--- a/lib/sources.nix
+++ b/lib/sources.nix
@@ -10,9 +10,12 @@ rec {
cleanSource =
let filter = name: type: let baseName = baseNameOf (toString name); in ! (
# Filter out Subversion and CVS directories.
- (type == "directory" && (baseName == ".git" || baseName == ".svn" || baseName == "CVS")) ||
+ (type == "directory" && (baseName == ".git" || baseName == ".svn" || baseName == "CVS" || baseName == ".hg")) ||
# Filter out backup files.
- (lib.hasSuffix "~" baseName)
+ lib.hasSuffix "~" baseName ||
+ # Filter out generates files.
+ lib.hasSuffix ".o" baseName ||
+ lib.hasSuffix ".so" baseName
);
in src: builtins.filterSource filter src;
diff --git a/lib/strings.nix b/lib/strings.nix
index 024a9ac7d7a..efdc265465f 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -7,7 +7,8 @@ inherit (builtins) add sub lessThan length;
in
rec {
- inherit (builtins) stringLength substring head tail;
+
+ inherit (builtins) stringLength substring head tail isString;
# Concatenate a list of strings.
@@ -55,12 +56,15 @@ rec {
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;
+ # Determine whether a string has given prefix/suffix.
+ hasPrefix = pref: str:
+ eqStrings (substring 0 (stringLength pref) str) pref;
+ hasSuffix = suff: str:
+ let
+ lenStr = stringLength str;
+ lenSuff = stringLength suff;
+ in lenStr >= lenSuff &&
+ eqStrings (substring (lenStr - lenSuff) lenStr str) suff;
# Convert a string to a list of characters (i.e. singleton strings).
@@ -115,17 +119,21 @@ rec {
toLower = replaceChars upperChars lowerChars;
toUpper = replaceChars lowerChars upperChars;
+ # Appends string context from another string
+ addContextFrom = a: b: (substring 0 0 a)+b;
# Compares strings not requiring context equality
# Obviously, a workaround but works on all Nix versions
- eqStrings = a: b: (a+(substring 0 0 b)) == ((substring 0 0 a)+b);
+ eqStrings = a: b: addContextFrom b a == addContextFrom a b;
# Cut a string with a separator and produces a list of strings which were
# separated by this separator. e.g.,
# `splitString "." "foo.bar.baz"' returns ["foo" "bar" "baz"].
- splitString = sep: s:
+ splitString = _sep: _s:
let
+ sep = addContextFrom _s _sep;
+ s = addContextFrom _sep _s;
sepLen = stringLength sep;
sLen = stringLength s;
lastSearch = sub sLen sepLen;
@@ -154,8 +162,18 @@ rec {
preLen = stringLength pre;
sLen = stringLength s;
in
- if pre == substring 0 preLen s then
- substring preLen (sub sLen preLen) s
+ if hasPrefix pre s then
+ substring preLen (sLen - preLen) s
+ else
+ s;
+
+ removeSuffix = suf: s:
+ let
+ sufLen = stringLength suf;
+ sLen = stringLength s;
+ in
+ if sufLen <= sLen && eqStrings suf (substring (sLen - sufLen) sufLen s) then
+ substring 0 (sLen - sufLen) s
else
s;
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 8af3474f2a6..e073da4900c 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -16,7 +16,7 @@ rec {
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;
@@ -26,7 +26,7 @@ rec {
# `seq x y' evaluates x, then returns y. That is, it forces strict
# evaluation of its first argument.
seq = x: y: if x == null then y else y;
-
+
# Like `seq', but recurses into lists and attribute sets to force evaluation
# of all list elements/attributes.
deepSeq = x: y:
@@ -35,4 +35,19 @@ rec {
else if builtins.isAttrs x
then deepSeqAttrs x y
else seq x y;
+
+ # Pull in some builtins not included elsewhere.
+ inherit (builtins)
+ pathExists readFile isBool isFunction
+ isInt add sub lessThan;
+
+ # Return the Nixpkgs version number.
+ nixpkgsVersion =
+ let suffixFile = ../.version-suffix; in
+ readFile ../.version
+ + (if pathExists suffixFile then readFile suffixFile else "pre-git");
+
+ # Whether we're being called by nix-shell. This is useful to
+ inNixShell = builtins.getEnv "IN_NIX_SHELL" == "1";
+
}
diff --git a/lib/types.nix b/lib/types.nix
index 09b29a762e1..0e2b6515e16 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -10,7 +10,6 @@ with import ./strings.nix;
rec {
isType = type: x: (x._type or "") == type;
- typeOf = x: x._type or "";
setType = typeName: value: value // {
_type = typeName;
@@ -48,19 +47,19 @@ rec {
bool = mkOptionType {
name = "boolean";
- check = builtins.isBool;
+ check = isBool;
merge = loc: fold (x: y: x.value || y) false;
};
int = mkOptionType {
name = "integer";
- check = builtins.isInt;
+ check = isInt;
merge = mergeOneOption;
};
str = mkOptionType {
name = "string";
- check = builtins.isString;
+ check = isString;
merge = mergeOneOption;
};
@@ -68,7 +67,7 @@ rec {
# separator between the values).
separatedString = sep: mkOptionType {
name = "string";
- check = builtins.isString;
+ check = isString;
merge = loc: defs: concatStringsSep sep (getValues defs);
};
@@ -132,7 +131,7 @@ rec {
{ inherit (def) file;
value = listToAttrs (
imap (elemIdx: elem:
- { name = "unnamed-${toString defIdx}.${toString elemIdx}";
+ { name = elem.name or "unnamed-${toString defIdx}.${toString elemIdx}";
value = elem;
}) def.value);
}
@@ -170,7 +169,7 @@ rec {
functionTo = elemType: mkOptionType {
name = "function that evaluates to a(n) ${elemType.name}";
- check = builtins.isFunction;
+ check = isFunction;
merge = loc: defs:
fnArgs: elemType.merge loc (map (fn: { inherit (fn) file; value = fn.value fnArgs; }) defs);
getSubOptions = elemType.getSubOptions;
@@ -183,10 +182,10 @@ rec {
in
mkOptionType rec {
name = "submodule";
- check = x: isAttrs x || builtins.isFunction x;
+ check = x: isAttrs x || isFunction x;
merge = loc: defs:
let
- coerce = def: if builtins.isFunction def then def else { config = def; };
+ coerce = def: if isFunction def then def else { config = def; };
modules = opts' ++ map (def: { _file = def.file; imports = [(coerce def.value)]; }) defs;
in (evalModules { inherit modules; args.name = last loc; prefix = loc; }).config;
getSubOptions = prefix: (evalModules
@@ -195,6 +194,18 @@ rec {
args = { name = ""; }; }).options;
};
+ enum = values: mkOptionType {
+ name = "one of ${concatStringsSep ", " values}";
+ check = flip elem values;
+ merge = mergeOneOption;
+ };
+
+ either = t1: t2: mkOptionType {
+ name = "${t1.name} or ${t2.name}";
+ check = x: t1.check x || t2.check x;
+ merge = mergeOneOption;
+ };
+
# Obsolete alternative to configOf. It takes its option
# declarations from the ‘options’ attribute of containing option
# declaration.
diff --git a/maintainers/scripts/copy-tarball.sh b/maintainers/scripts/copy-tarball.sh
deleted file mode 100755
index 792071c129b..00000000000
--- a/maintainers/scripts/copy-tarball.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /bin/sh -e
-
-distDir=${NIX_TARBALLS_CACHE:-/tarballs}
-
-url="$1"
-file="$2"
-if [ -z "$url" ]; then echo "syntax: $0 URL"; exit 0; fi
-
-base="$(basename "$url")"
-if [ -z "$base" ]; then echo "bad URL"; exit 1; fi
-dstPath="$distDir/$base"
-
-if [ -e "$dstPath" ]; then if [ -n "$VERBOSE" ]; then echo "$dstPath already exists"; fi; exit 0; fi
-
-if [ -z "$file" ]; then
-
- echo "downloading $url to $dstPath"
-
- if [ -n "$DRY_RUN" ]; then exit 0; fi
-
- declare -a res
- if ! res=($(PRINT_PATH=1 nix-prefetch-url "$url")); then
- exit
- fi
-
- storePath=${res[1]}
-
-else
- storePath="$file"
-fi
-
-cp $storePath "$dstPath.tmp.$$"
-mv -f "$dstPath.tmp.$$" "$dstPath"
-
-echo "hashing $dstPath"
-
-md5=$(nix-hash --flat --type md5 "$dstPath")
-ln -sfn "../$base" $distDir/md5/$md5
-
-sha1=$(nix-hash --flat --type sha1 "$dstPath")
-ln -sfn "../$base" $distDir/sha1/$sha1
-
-sha256=$(nix-hash --flat --type sha256 "$dstPath")
-ln -sfn "../$base" $distDir/sha256/$sha256
-ln -sfn "../$base" $distDir/sha256/$(nix-hash --type sha256 --to-base32 "$sha256")
diff --git a/maintainers/scripts/copy-tarballs.pl b/maintainers/scripts/copy-tarballs.pl
new file mode 100755
index 00000000000..c6d77529dd4
--- /dev/null
+++ b/maintainers/scripts/copy-tarballs.pl
@@ -0,0 +1,97 @@
+#! /run/current-system/sw/bin/perl -w
+
+use strict;
+use XML::Simple;
+use File::Basename;
+use File::Path;
+use File::Copy 'cp';
+use IPC::Open2;
+use Nix::Store;
+
+my $myDir = dirname($0);
+
+my $tarballsCache = $ENV{'NIX_TARBALLS_CACHE'} // "/tarballs";
+
+my $xml = `nix-instantiate --eval-only --xml --strict ''`;
+die "$0: evaluation failed\n" if $? != 0;
+
+my $data = XMLin($xml) or die;
+
+mkpath($tarballsCache);
+mkpath("$tarballsCache/md5");
+mkpath("$tarballsCache/sha1");
+mkpath("$tarballsCache/sha256");
+
+foreach my $file (@{$data->{list}->{attrs}}) {
+ my $url = $file->{attr}->{url}->{string}->{value};
+ my $algo = $file->{attr}->{type}->{string}->{value};
+ my $hash = $file->{attr}->{hash}->{string}->{value};
+
+ if ($url !~ /^http:/ && $url !~ /^https:/ && $url !~ /^ftp:/ && $url !~ /^mirror:/) {
+ print STDERR "skipping $url (unsupported scheme)\n";
+ next;
+ }
+
+ $url =~ /([^\/]+)$/;
+ my $fn = $1;
+
+ if (!defined $fn) {
+ print STDERR "skipping $url (no file name)\n";
+ next;
+ }
+
+ if ($fn =~ /[&?=%]/ || $fn =~ /^\./) {
+ print STDERR "skipping $url (bad character in file name)\n";
+ next;
+ }
+
+ if ($fn !~ /[a-zA-Z]/) {
+ print STDERR "skipping $url (no letter in file name)\n";
+ next;
+ }
+
+ if ($fn !~ /[0-9]/) {
+ print STDERR "skipping $url (no digit in file name)\n";
+ next;
+ }
+
+ if ($fn !~ /[-_\.]/) {
+ print STDERR "skipping $url (no dash/dot/underscore in file name)\n";
+ next;
+ }
+
+ my $dstPath = "$tarballsCache/$fn";
+
+ next if -e $dstPath;
+
+ print "downloading $url to $dstPath...\n";
+
+ next if $ENV{DRY_RUN};
+
+ $ENV{QUIET} = 1;
+ $ENV{PRINT_PATH} = 1;
+ my $fh;
+ my $pid = open($fh, "-|", "nix-prefetch-url", "--type", $algo, $url, $hash) or die;
+ waitpid($pid, 0) or die;
+ if ($? != 0) {
+ print STDERR "failed to fetch $url: $?\n";
+ next;
+ }
+ <$fh>; my $storePath = <$fh>; chomp $storePath;
+
+ die unless -e $storePath;
+
+ cp($storePath, $dstPath) or die;
+
+ my $md5 = hashFile("md5", 0, $storePath) or die;
+ symlink("../$fn", "$tarballsCache/md5/$md5");
+
+ my $sha1 = hashFile("sha1", 0, $storePath) or die;
+ symlink("../$fn", "$tarballsCache/sha1/$sha1");
+
+ my $sha256 = hashFile("sha256", 0, $storePath) or die;
+ symlink("../$fn", "$tarballsCache/sha256/$sha256");
+
+ $sha256 = hashFile("sha256", 1, $storePath) or die;
+ symlink("../$fn", "$tarballsCache/sha256/$sha256");
+}
diff --git a/maintainers/scripts/copy-tarballs.sh b/maintainers/scripts/copy-tarballs.sh
deleted file mode 100755
index a261f817585..00000000000
--- a/maintainers/scripts/copy-tarballs.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /bin/sh -e
-
-urls=$(nix-instantiate --eval-only --xml --strict '' \
- | grep -A2 'name="urls"' \
- | grep ' \$filter,
"maintainer|m=s" => \$maintainer,
"file|f=s" => \$path,
"help" => sub { showHelp() }
- )
- or die("syntax: $0 ...\n");
+ ) or exit 1;
# Evaluate Nixpkgs into an XML representation.
my $xml = `nix-env -f '$path' -qa '$filter' --xml --meta --drv-path`;
diff --git a/maintainers/scripts/sort-attrs.str b/maintainers/scripts/sort-attrs.str
deleted file mode 100644
index b67b6ee2a57..00000000000
--- a/maintainers/scripts/sort-attrs.str
+++ /dev/null
@@ -1,146 +0,0 @@
-/* Tool to sort attribute sets. Primarily useful for keeping
- all-packages.nix tidy.
-
- To compile:
-
- $ strc -i ../../maintainers/scripts/sort-attrs.str -la stratego-lib
-
- Typical invocation:
-
- $ sglr -m -p ~/Dev/nix/src/libexpr/nix.tbl -i all-packages.nix \
- | implode-asfix --lex \
- | ../../maintainers/scripts/sort-attrs \
- | asfix-yield
-*/
-
-module sort-attrs
-
-imports
- libstratego-lib
- libstratego-sglr
-
-
-strategies
-
- no-wsp = !appl(prod([], cf(opt(layout())), no-attrs()), [])
-
-
-rules
-
- list-sep(s): [] -> []
- list-sep(s): [x | xs] -> [[x | before] | [split | after]]
- where
- xs => (before, split, after)
- list-sep(s): [x | xs] -> [[x | xs]]
- where
- xs
-
- list-sep-end(s): xs -> [ (before, [split]) | after]
- where
- xs => (before, split, after)
- list-sep-end(s): xs -> [xs]
- where
- xs
-
-
- sort-attrs:
- appl(p@prod(_, _, attrs([term(cons("Attrs"))])),
- [ lit("{")
- , ws1
- , appl(p2@list(cf(iter-star(sort("Bind")))), attrs)
- , ws2
- , lit("}")
- ]
- ) ->
- appl(p, [lit("{"), , appl(p2, attrs'), ws2, lit("}")])
- where
- "found it";
- [ws1 | attrs] => withWSP;
- withWSP => groups;
- groups;
-
-Abstractions
+Abstractions
If you find yourself repeating yourself over and over, it’s time
to abstract. Take, for instance, this Apache HTTP Server configuration:
@@ -399,7 +399,7 @@ of an expression to be spliced into a string.
-Modularity
+Modularity
The NixOS configuration mechanism is modular. If your
configuration.nix becomes too big, you can split
@@ -443,8 +443,20 @@ Note that both configuration.nix and
define an option, NixOS will try to merge the
definitions. In the case of
, that’s easy: the lists of
-packages can simply be concatenated. For other types of options, a
-merge may not be possible: for instance, if two modules define
+packages can simply be concatenated. The value in
+configuration.nix is merged last, so for
+list-type options, it will appear at the end of the merged list. If
+you want it to appear first, you can use mkBefore:
+
+
+boot.kernelModules = mkBefore [ "kvm-intel" ];
+
+
+This causes the kvm-intel kernel module to be
+loaded before any other kernel modules.
+
+For other types of options, a merge may not be possible. For
+instance, if two modules define
,
nixos-rebuild will give an error:
@@ -526,7 +538,7 @@ nix-repl> map (x: x.hostName) config.services.httpd.virtualHosts
-Syntax summary
+Syntax summary
Below is a summary of the most important syntactic constructs in
the Nix expression language. It’s not complete. In particular, there
@@ -718,7 +730,7 @@ manual for the rest.
-Package management
+Package management
This section describes how to add additional packages to your
system. NixOS has two distinct styles of package management:
@@ -861,7 +873,7 @@ Any package in Nixpkgs that depends on emacs will
be passed your customised instance. (However, the value
pkgs.emacs in
nixpkgs.config.packageOverrides refers to the
-original rather than overriden instance, to prevent an infinite
+original rather than overridden instance, to prevent an infinite
recursion.)
@@ -923,7 +935,7 @@ environment.systemPackages = [ (import ./my-hello.nix) ];
where my-hello.nix contains:
-with <nixpkgs> {}; # bring all of Nixpkgs into scope
+with import <nixpkgs> {}; # bring all of Nixpkgs into scope
stdenv.mkDerivation rec {
name = "hello-2.8";
@@ -1021,25 +1033,23 @@ states that a user account named alice shall exist:
users.extraUsers.alice =
- { createHome = true;
- home = "/home/alice";
+ { isNormalUser = true;
description = "Alice Foobar";
- extraGroups = [ "wheel" ];
- isSystemUser = false;
- useDefaultShell = true;
+ extraGroups = [ "wheel" "networkmanager" ];
openssh.authorizedKeys.keys = [ "ssh-dss AAAAB3Nza... alice@foobar" ];
};
Note that alice is a member of the
-wheel group, which allows her to use
-sudo to execute commands as
-root. Also note the SSH public key that allows
-remote logins with the corresponding private key. Users created in
-this way do not have a password by default, so they cannot log in via
-mechanisms that require a password. However, you can use the
-passwd program to set a password, which is retained
-across invocations of nixos-rebuild.
+wheel and networkmanager groups,
+which allows her to use sudo to execute commands as
+root and to configure the network, respectively.
+Also note the SSH public key that allows remote logins with the
+corresponding private key. Users created in this way do not have a
+password by default, so they cannot log in via mechanisms that require
+a password. However, you can use the passwd program
+to set a password, which is retained across invocations of
+nixos-rebuild.
A user ID (uid) is assigned automatically. You can also specify
a uid manually by adding
@@ -1060,11 +1070,6 @@ users.extraGroups.students.gid = 1000;
As with users, the group ID (gid) is optional and will be assigned
automatically if it’s missing.
-Currently declarative user management is not perfect:
-nixos-rebuild does not know how to realise certain
-configuration changes. This includes removing a user or group, and
-removing group membership from a user.
-
In the imperative style, users and groups are managed by
commands such as useradd,
groupmod and so on. For instance, to create a user
@@ -1172,7 +1177,7 @@ fileSystems."/".device = "/dev/mapper/crypted";
-X Window System
+X Window System
The X Window System (X11) provides the basis of NixOS’ graphical
user interface. It can be enabled as follows:
@@ -1235,7 +1240,7 @@ with other kernel modules.
On 64-bit systems, if you want full acceleration for 32-bit
programs such as Wine, you should also set the following:
-service.xserver.driSupport32Bit = true;
+services.xserver.driSupport32Bit = true;
@@ -1264,9 +1269,31 @@ services.xserver.synaptics.twoFingerScroll = true;
-Networking
+Networking
-Secure shell access
+NetworkManager
+
+To facilitate network configuration, some desktop environments
+use NetworkManager. You can enable NetworkManager by setting:
+
+
+services.networkmanager.enable = true;
+
+
+Some desktop managers (e.g., GNOME) enable NetworkManager
+automatically for you.
+
+All users that should have permission to change network settings
+must belong to the networkmanager
group.
+
+services.networkmanager
and
+services.wireless
can not be enabled at the same time:
+you can still connect to the wireless networks using
+NetworkManager.
+
+
+
+Secure shell access
Secure shell (SSH) access to your machine can be enabled by
setting:
@@ -1294,7 +1321,7 @@ users.extraUsers.alice.openssh.authorizedKeys.keys =
-IPv4 configuration
+IPv4 configuration
By default, NixOS uses DHCP (specifically,
dhcpcd) to automatically configure network
@@ -1337,7 +1364,7 @@ provide the host name.
-IPv6 configuration
+IPv6 configuration
IPv6 is enabled by default. Stateless address autoconfiguration
is used to automatically assign IPv6 addresses to all interfaces. You
@@ -1352,17 +1379,19 @@ networking.enableIPv6 = false;
-Firewall
+Firewall
NixOS has a simple stateful firewall that blocks incoming
connections and other unexpected packets. The firewall applies to
-both IPv4 and IPv6 traffic. It can be enabled as follows:
+both IPv4 and IPv6 traffic. It is enabled by default. It can be
+disabled as follows:
-networking.firewall.enable = true;
+networking.firewall.enable = false;
-You can open specific TCP ports to the outside world:
+If the firewall is enabled, you can open specific TCP ports to the
+outside world:
networking.firewall.allowedTCPPorts = [ 80 443 ];
@@ -1384,7 +1413,12 @@ always allowed.)
-Wireless networks
+Wireless networks
+
+For a desktop installation using NetworkManager (e.g., GNOME),
+you just have to make sure the user is in the
+networkmanager
group and you can skip the rest of this
+section on wireless networks.
NixOS will start wpa_supplicant for you if you enable this setting:
@@ -1445,7 +1479,7 @@ networking.localCommands =
-Linux kernel
+Linux kernel
You can override the Linux kernel and associated packages using
the option . For instance, this
@@ -1458,10 +1492,11 @@ are specific to the kernel version, such as the NVIDIA video drivers.
This ensures that driver packages are consistent with the
kernel.
-The default Linux kernel configuration should be fine for most
-users. You can see the configuration of your current kernel in
-/run/booted-system/kernel-modules/config. If you
-want to change the kernel configuration, you can use the
+The default Linux kernel configuration should be fine for most users. You can see the configuration of your current kernel with the following command:
+
+cat /proc/config.gz | gunzip
+
+If you want to change the kernel configuration, you can use the
feature (see ). For instance, to enable
support for the kernel debugger KGDB:
diff --git a/nixos/doc/manual/containers.xml b/nixos/doc/manual/containers.xml
new file mode 100644
index 00000000000..2530d519521
--- /dev/null
+++ b/nixos/doc/manual/containers.xml
@@ -0,0 +1,242 @@
+
+
+Containers
+
+NixOS allows you to easily run other NixOS instances as
+containers. Containers are a light-weight
+approach to virtualisation that runs software in the container at the
+same speed as in the host system. NixOS containers share the Nix store
+of the host, making container creation very efficient.
+
+Currently, NixOS containers are not perfectly isolated
+from the host system. This means that a user with root access to the
+container can do things that affect the host. So you should not give
+container root access to untrusted users.
+
+NixOS containers can be created in two ways: imperatively, using
+the command nixos-container, and declaratively, by
+specifying them in your configuration.nix. The
+declarative approach implies that containers get upgraded along with
+your host system when you run nixos-rebuild, which
+is often not what you want. By contrast, in the imperative approach,
+containers are configured and updated independently from the host
+system.
+
+
+Imperative container management
+
+We’ll cover imperative container management using
+nixos-container first. You create a container with
+identifier foo as follows:
+
+
+$ nixos-container create foo
+
+
+This creates the container’s root directory in
+/var/lib/containers/foo and a small configuration
+file in /etc/containers/foo.conf. It also builds
+the container’s initial system configuration and stores it in
+/nix/var/nix/profiles/per-container/foo/system. You
+can modify the initial configuration of the container on the command
+line. For instance, to create a container that has
+sshd running, with the given public key for
+root:
+
+
+$ nixos-container create foo --config 'services.openssh.enable = true; \
+ users.extraUsers.root.openssh.authorizedKeys.keys = ["ssh-dss AAAAB3N…"];'
+
+
+
+
+Creating a container does not start it. To start the container,
+run:
+
+
+$ nixos-container start foo
+
+
+This command will return as soon as the container has booted and has
+reached multi-user.target. On the host, the
+container runs within a systemd unit called
+container@container-name.service.
+Thus, if something went wrong, you can get status info using
+systemctl:
+
+
+$ systemctl status container@foo
+
+
+
+
+If the container has started succesfully, you can log in as
+root using the root-login operation:
+
+
+$ nixos-container root-login foo
+[root@foo:~]#
+
+
+Note that only root on the host can do this (since there is no
+authentication). You can also get a regular login prompt using the
+login operation, which is available to all users on
+the host:
+
+
+$ nixos-container login foo
+foo login: alice
+Password: ***
+
+
+With nixos-container run, you can execute arbitrary
+commands in the container:
+
+
+$ nixos-container run foo -- uname -a
+Linux foo 3.4.82 #1-NixOS SMP Thu Mar 20 14:44:05 UTC 2014 x86_64 GNU/Linux
+
+
+
+
+There are several ways to change the configuration of the
+container. First, on the host, you can edit
+/var/lib/container/name/etc/nixos/configuration.nix,
+and run
+
+
+$ nixos-container update foo
+
+
+This will build and activate the new configuration. You can also
+specify a new configuration on the command line:
+
+
+$ nixos-container update foo --config 'services.httpd.enable = true; \
+ services.httpd.adminAddr = "foo@example.org";'
+
+$ curl http://$(nixos-container show-ip foo)/
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">…
+
+
+However, note that this will overwrite the container’s
+/etc/nixos/configuration.nix.
+
+Alternatively, you can change the configuration from within the
+container itself by running nixos-rebuild switch
+inside the container. Note that the container by default does not have
+a copy of the NixOS channel, so you should run nix-channel
+--update first.
+
+Containers can be stopped and started using
+nixos-container stop and nixos-container
+start, respectively, or by using
+systemctl on the container’s service unit. To
+destroy a container, including its file system, do
+
+
+$ nixos-container destroy foo
+
+
+
+
+
+
+
+Declarative container specification
+
+You can also specify containers and their configuration in the
+host’s configuration.nix. For example, the
+following specifies that there shall be a container named
+database running PostgreSQL:
+
+
+containers.database =
+ { config =
+ { config, pkgs, ... }:
+ { services.postgresql.enable = true;
+ services.postgresql.package = pkgs.postgresql92;
+ };
+ };
+
+
+If you run nixos-rebuild switch, the container will
+be built and started. If the container was already running, it will be
+updated in place, without rebooting.
+
+By default, declarative containers share the network namespace
+of the host, meaning that they can listen on (privileged)
+ports. However, they cannot change the network configuration. You can
+give a container its own network as follows:
+
+
+containers.database =
+ { privateNetwork = true;
+ hostAddress = "192.168.100.10";
+ localAddress = "192.168.100.11";
+ };
+
+
+This gives the container a private virtual Ethernet interface with IP
+address 192.168.100.11, which is hooked up to a
+virtual Ethernet interface on the host with IP address
+192.168.100.10. (See the next section for details
+on container networking.)
+
+To disable the container, just remove it from
+configuration.nix and run nixos-rebuild
+switch. Note that this will not delete the root directory of
+the container in /var/lib/containers.
+
+
+
+
+Networking
+
+When you create a container using nixos-container
+create, it gets it own private IPv4 address in the range
+10.233.0.0/16. You can get the container’s IPv4
+address as follows:
+
+
+$ nixos-container show-ip foo
+10.233.4.2
+
+$ ping -c1 10.233.4.2
+64 bytes from 10.233.4.2: icmp_seq=1 ttl=64 time=0.106 ms
+
+
+
+
+Networking is implemented using a pair of virtual Ethernet
+devices. The network interface in the container is called
+eth0, while the matching interface in the host is
+called ve-container-name
+(e.g., ve-foo). The container has its own network
+namespace and the CAP_NET_ADMIN capability, so it
+can perform arbitrary network configuration such as setting up
+firewall rules, without affecting or having access to the host’s
+network.
+
+By default, containers cannot talk to the outside network. If
+you want that, you should set up Network Address Translation (NAT)
+rules on the host to rewrite container traffic to use your external
+IP address. This can be accomplished using the following configuration
+on the host:
+
+
+networking.nat.enable = true;
+networking.nat.internalInterfaces = ["ve-+"];
+networking.nat.externalInterface = "eth0";
+
+where eth0 should be replaced with the desired
+external interface. Note that ve-+ is a wildcard
+that matches all container interfaces.
+
+
+
+
+
+
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix
index db3245fcc07..55533a05b06 100644
--- a/nixos/doc/manual/default.nix
+++ b/nixos/doc/manual/default.nix
@@ -1,7 +1,6 @@
-{ pkgs, options
-, revision ? "master"
-}:
+{ pkgs, options, version, revision }:
+with pkgs;
with pkgs.lib;
let
@@ -14,17 +13,17 @@ let
declarations = map (fn: stripPrefix fn) opt.declarations;
});
- prefix = toString pkgs.path;
+ prefix = toString ../../..;
stripPrefix = fn:
if substring 0 (stringLength prefix) fn == prefix then
- substring (add (stringLength prefix) 1) 1000 fn
+ substring (stringLength prefix + 1) 1000 fn
else
fn;
optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML options''));
- optionsDocBook = pkgs.runCommand "options-db.xml" {} ''
+ optionsDocBook = runCommand "options-db.xml" {} ''
if grep /nixpkgs/nixos/modules ${optionsXML}; then
echo "The manual appears to depend on the location of Nixpkgs, which is bad"
echo "since this prevents sharing via the NixOS channel. This is typically"
@@ -32,7 +31,7 @@ let
echo "for hints about the offending path)."
exit 1
fi
- ${pkgs.libxslt}/bin/xsltproc \
+ ${libxslt}/bin/xsltproc \
--stringparam revision '${revision}' \
-o $out ${./options-to-docbook.xsl} ${optionsXML}
'';
@@ -40,12 +39,12 @@ let
in rec {
# Generate the NixOS manual.
- manual = pkgs.stdenv.mkDerivation {
+ manual = stdenv.mkDerivation {
name = "nixos-manual";
sources = sourceFilesBySuffices ./. [".xml"];
- buildInputs = [ pkgs.libxml2 pkgs.libxslt ];
+ buildInputs = [ libxml2 libxslt ];
xsltFlags = ''
--param section.autolabel 1
@@ -60,22 +59,23 @@ in rec {
buildCommand = ''
ln -s $sources/*.xml . # */
ln -s ${optionsDocBook} options-db.xml
+ echo "${version}" > version
# Check the validity of the manual sources.
xmllint --noout --nonet --xinclude --noxincludenode \
- --relaxng ${pkgs.docbook5}/xml/rng/docbook/docbook.rng \
+ --relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
manual.xml
# Generate the HTML manual.
dst=$out/share/doc/nixos
- ensureDir $dst
+ mkdir -p $dst
xsltproc $xsltFlags --nonet --xinclude \
--output $dst/manual.html \
- ${pkgs.docbook5_xsl}/xml/xsl/docbook/xhtml/docbook.xsl \
+ ${docbook5_xsl}/xml/xsl/docbook/xhtml/docbook.xsl \
./manual.xml
mkdir -p $dst/images/callouts
- cp ${pkgs.docbook5_xsl}/xml/xsl/docbook/images/callouts/*.gif $dst/images/callouts/
+ cp ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.gif $dst/images/callouts/
cp ${./style.css} $dst/style.css
@@ -87,13 +87,39 @@ in rec {
meta.description = "The NixOS manual in HTML format";
};
+ manualPDF = stdenv.mkDerivation {
+ name = "nixos-manual-pdf";
+
+ sources = sourceFilesBySuffices ./. [".xml"];
+
+ buildInputs = [ libxml2 libxslt dblatex tetex ];
+
+ buildCommand = ''
+ # TeX needs a writable font cache.
+ export VARTEXFONTS=$TMPDIR/texfonts
+
+ ln -s $sources/*.xml . # */
+ ln -s ${optionsDocBook} options-db.xml
+ echo "${version}" > version
+
+ dst=$out/share/doc/nixos
+ mkdir -p $dst
+ xmllint --xinclude manual.xml | dblatex -o $dst/manual.pdf - \
+ -P doc.collab.show=0 \
+ -P latex.output.revhistory=0
+
+ mkdir -p $out/nix-support
+ echo "doc-pdf manual $dst/manual.pdf" >> $out/nix-support/hydra-build-products
+ ''; # */
+ };
+
# Generate the NixOS manpages.
- manpages = pkgs.stdenv.mkDerivation {
+ manpages = stdenv.mkDerivation {
name = "nixos-manpages";
sources = sourceFilesBySuffices ./. [".xml"];
- buildInputs = [ pkgs.libxml2 pkgs.libxslt ];
+ buildInputs = [ libxml2 libxslt ];
buildCommand = ''
ln -s $sources/*.xml . # */
@@ -101,7 +127,7 @@ in rec {
# Check the validity of the manual sources.
xmllint --noout --nonet --xinclude --noxincludenode \
- --relaxng ${pkgs.docbook5}/xml/rng/docbook/docbook.rng \
+ --relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
./man-pages.xml
# Generate manpages.
@@ -110,7 +136,7 @@ in rec {
--param man.output.in.separate.dir 1 \
--param man.output.base.dir "'$out/share/man/'" \
--param man.endnotes.are.numbered 0 \
- ${pkgs.docbook5_xsl}/xml/xsl/docbook/manpages/docbook.xsl \
+ ${docbook5_xsl}/xml/xsl/docbook/manpages/docbook.xsl \
./man-pages.xml
'';
};
diff --git a/nixos/doc/manual/development.xml b/nixos/doc/manual/development.xml
index 6bbccac6e5c..2f0c2a7aa8d 100644
--- a/nixos/doc/manual/development.xml
+++ b/nixos/doc/manual/development.xml
@@ -1,5 +1,6 @@
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xml:id="ch-development">
Development
@@ -9,7 +10,7 @@ NixOS.
-
+
Getting the sources
@@ -38,7 +39,37 @@ This will check out the latest NixOS sources to
and the Nixpkgs sources to
/my/sources/nixpkgs.
(The NixOS source tree lives in a subdirectory of the Nixpkgs
-repository.) If you want to rebuild your system using your (modified)
+repository.)
+
+It’s often inconvenient to develop directly on the master
+branch, since if somebody has just committed (say) a change to GCC,
+then the binary cache may not have caught up yet and you’ll have to
+rebuild everything from source. So you may want to create a local
+branch based on your current NixOS version:
+
+
+$ nixos-version
+14.04.273.ea1952b (Baboon)
+
+$ git checkout -b local ea1952b
+
+
+Or, to base your local branch on the latest version available in the
+NixOS channel:
+
+
+$ curl -sI http://nixos.org/channels/nixos-unstable/ | grep Location
+Location: http://releases.nixos.org/nixos/unstable/nixos-14.10pre43986.acaf4a6/
+
+$ git checkout -b local acaf4a6
+
+
+You can then use git rebase to sync your local
+branch with the upstream branch, and use git
+cherry-pick to copy commits from your local branch to the
+upstream branch.
+
+If you want to rebuild your system using your (modified)
sources, you need to tell nixos-rebuild about them
using the flag:
@@ -74,7 +105,7 @@ in nixos/ as packages.
-
+
Writing NixOS modules
@@ -188,9 +219,9 @@ commands to be executed periodically by cron).
NixOS module for the “locate” service
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let locatedb = "/var/cache/locatedb"; in
@@ -494,7 +525,7 @@ module writers.
-
+
This set defines files in /etc. A
typical use is:
@@ -579,7 +610,7 @@ systemd.services.dhcpcd =
-
+
Building specific parts of NixOS
@@ -652,6 +683,37 @@ $ qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/
+
+ systemd.units.unit-name.unit
+
+ This builds the unit with the specified name. Note that
+ since unit names contain dots
+ (e.g. httpd.service), you need to put them
+ between quotes, like this:
+
+
+$ nix-build -A 'config.systemd.units."httpd.service".unit'
+
+
+ You can also test individual units, without rebuilding the whole
+ system, by putting them in
+ /run/systemd/system:
+
+
+$ cp $(nix-build -A 'config.systemd.units."httpd.service".unit')/httpd.service \
+ /run/systemd/system/tmp-httpd.service
+$ systemctl daemon-reload
+$ systemctl start tmp-httpd.service
+
+
+ Note that the unit must not have the same name as any unit in
+ /etc/systemd/system since those take
+ precedence over /run/systemd/system.
+ That’s why the unit is installed as
+ tmp-httpd.service here.
+
+
+
@@ -661,7 +723,7 @@ $ qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/
-
+
Building your own NixOS CD
@@ -697,18 +759,22 @@ $ mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso
Testing the installer
-Building, burning, and
-booting from an installation CD is rather
+Building, burning, and booting from an installation CD is rather
tedious, so here is a quick way to see if the installer works
properly:
$ nix-build -A config.system.build.nixos-install
-$ dd if=/dev/zero of=diskimage seek=2G count=0 bs=1
-$ yes | mke2fs -j diskimage
-$ mount -o loop diskimage /mnt
+$ mount -t tmpfs none /mnt
$ ./result/bin/nixos-install
+To start a login shell in the new NixOS installation in
+/mnt:
+
+
+$ ./result/bin/nixos-install --chroot
+
+
@@ -717,57 +783,310 @@ $ ./result/bin/nixos-install
-Whole-system testing using virtual machines
+
-Complete NixOS GNU/Linux systems can be tested in virtual
-machines (VMs). This makes it possible to test a system upgrade or
-configuration change before rebooting into it, using the
-nixos-rebuild build-vm or nixos-rebuild
-build-vm-with-bootloader command.
+NixOS tests
-
-The tests/ directory in the NixOS source
-tree contains several whole-system unit tests.
-These tests can be runNixOS tests can be run both from
-NixOS and from a non-NixOS GNU/Linux distribution, provided the Nix
-package manager is installed. from the NixOS source
-tree as follows:
+When you add some feature to NixOS, you should write a test for
+it. NixOS tests are kept in the directory nixos/tests,
+and are executed (using Nix) by a testing framework that automatically
+starts one or more virtual machines containing the NixOS system(s)
+required for the test.
+
+Writing tests
+
+A NixOS test is a Nix expression that has the following structure:
+
+
+import ./make-test.nix {
+
+ # Either the configuration of a single machine:
+ machine =
+ { config, pkgs, ... }:
+ { configuration…
+ };
+
+ # Or a set of machines:
+ nodes =
+ { machine1 =
+ { config, pkgs, ... }: { … };
+ machine2 =
+ { config, pkgs, ... }: { … };
+ …
+ };
+
+ testScript =
+ ''
+ Perl code…
+ '';
+}
+
+
+The attribute testScript is a bit of Perl code that
+executes the test (described below). During the test, it will start
+one or more virtual machines, the configuration of which is described
+by the attribute machine (if you need only one
+machine in your test) or by the attribute nodes (if
+you need multiple machines). For instance, login.nix
+only needs a single machine to test whether users can log in on the
+virtual console, whether device ownership is correctly maintained when
+switching between consoles, and so on. On the other hand, nfs.nix,
+which tests NFS client and server functionality in the Linux kernel
+(including whether locks are maintained across server crashes),
+requires three machines: a server and two clients.
+
+There are a few special NixOS configuration options for test
+VMs:
+
+
+
+
+
+
+
+ The memory of the VM in
+ megabytes.
+
+
+
+
+ The virtual networks to which the VM is
+ connected. See nat.nix
+ for an example.
+
+
+
+
+ By default, the Nix store in the VM is not
+ writable. If you enable this option, a writable union file system
+ is mounted on top of the Nix store to make it appear
+ writable. This is necessary for tests that run Nix operations that
+ modify the store.
+
+
+
+
+For more options, see the module qemu-vm.nix.
+
+The test script is a sequence of Perl statements that perform
+various actions, such as starting VMs, executing commands in the VMs,
+and so on. Each virtual machine is represented as an object stored in
+the variable $name,
+where name is the identifier of the machine
+(which is just machine if you didn’t specify
+multiple machines using the nodes attribute). For
+instance, the following starts the machine, waits until it has
+finished booting, then executes a command and checks that the output
+is more-or-less correct:
+
+
+$machine->start;
+$machine->waitForUnit("default.target");
+$machine->succeed("uname") =~ /Linux/;
+
+
+The first line is actually unnecessary; machines are implicitly
+started when you first execute an action on them (such as
+waitForUnit or succeed). If you
+have multiple machines, you can speed up the test by starting them in
+parallel:
+
+
+startAll;
+
+
+
+
+The following methods are available on machine objects:
+
+
+
+
+ start
+ Start the virtual machine. This method is
+ asynchronous — it does not wait for the machine to finish
+ booting.
+
+
+
+ shutdown
+ Shut down the machine, waiting for the VM to
+ exit.
+
+
+
+ crash
+ Simulate a sudden power failure, by telling the VM
+ to exit immediately.
+
+
+
+ block
+ Simulate unplugging the Ethernet cable that
+ connects the machine to the other machines.
+
+
+
+ unblock
+ Undo the effect of
+ block.
+
+
+
+ screenshot
+ Take a picture of the display of the virtual
+ machine, in PNG format. The screenshot is linked from the HTML
+ log.
+
+
+
+ sendMonitorCommand
+ Send a command to the QEMU monitor. This is rarely
+ used, but allows doing stuff such as attaching virtual USB disks
+ to a running machine.
+
+
+
+ sendKeys
+ Simulate pressing keys on the virtual keyboard,
+ e.g., sendKeys("ctrl-alt-delete").
+
+
+
+ sendChars
+ Simulate typing a sequence of characters on the
+ virtual keyboard, e.g., sendKeys("foobar\n")
+ will type the string foobar followed by the
+ Enter key.
+
+
+
+ execute
+ Execute a shell command, returning a list
+ (status,
+ stdout).
+
+
+
+ succeed
+ Execute a shell command, raising an exception if
+ the exit status is not zero, otherwise returning the standard
+ output.
+
+
+
+ fail
+ Like succeed, but raising
+ an exception if the command returns a zero status.
+
+
+
+ waitUntilSucceeds
+ Repeat a shell command with 1-second intervals
+ until it succeeds.
+
+
+
+ waitUntilFails
+ Repeat a shell command with 1-second intervals
+ until it fails.
+
+
+
+ waitForUnit
+ Wait until the specified systemd unit has reached
+ the “active” state.
+
+
+
+ waitForFile
+ Wait until the specified file
+ exists.
+
+
+
+ waitForOpenPort
+ Wait until a process is listening on the given TCP
+ port (on localhost, at least).
+
+
+
+ waitForClosedPort
+ Wait until nobody is listening on the given TCP
+ port.
+
+
+
+ waitForX
+ Wait until the X11 server is accepting
+ connections.
+
+
+
+ waitForWindow
+ Wait until an X11 window has appeared whose name
+ matches the given regular expression, e.g.,
+ waitForWindow(qr/Terminal/).
+
+
+
+
+
+
+
+
+
+Running tests
+
+You can run tests using nix-build. For
+example, to run the test login.nix,
+you just do:
-$ nix-build tests/ -A nfs.test
+$ nix-build '<nixpkgs/nixos/tests/login.nix>'
-This performs an automated test of the NFS client and server
-functionality in the Linux kernel, including file locking semantics
-(e.g., whether locks are maintained across server crashes). It will
-first build or download all the dependencies of the test (e.g., all
-packages needed to run a NixOS VM). The test is defined in
-tests/nfs.nix. If the test succeeds,
-nix-build will place a symlink
-./result in the current directory pointing at the
-location in the Nix store of the test results (e.g., screenshots, test
-reports, and so on). In particular, a pretty-printed log of the test
-is written to log.html, which can be viewed using
-a web browser like this:
+or, if you don’t want to rely on NIX_PATH:
+
+
+$ cd /my/nixpkgs/nixos/tests
+$ nix-build login.nix
+…
+running the VM test script
+machine: QEMU running (pid 8841)
+…
+6 out of 6 tests succeeded
+
+
+After building/downloading all required dependencies, this will
+perform a build that starts a QEMU/KVM virtual machine containing a
+NixOS system. The virtual machine mounts the Nix store of the host;
+this makes VM creation very fast, as no disk image needs to be
+created. Afterwards, you can view a pretty-printed log of the test:
$ firefox result/log.html
+
It is also possible to run the test environment interactively,
allowing you to experiment with the VMs. For example:
-$ nix-build tests/ -A nfs.driver
+$ nix-build login.nix -A driver
$ ./result/bin/nixos-run-vms
-The script nixos-run-vms starts the three virtual
-machines defined in the NFS test using QEMU/KVM. The root file system
-of the VMs is created on the fly and kept across VM restarts in
+The script nixos-run-vms starts the virtual
+machines defined by test. The root file system of the VMs is created
+on the fly and kept across VM restarts in
./hostname.qcow2.
Finally, the test itself can be run interactively. This is
@@ -780,17 +1099,11 @@ starting VDE switch for network 1
>
-Perl statements can now be typed in to start or manipulate the VMs:
+You can then take any Perl statement, e.g.
-> startAll;
-(the VMs start booting)
-> $server->waitForJob("nfs-kernel-nfsd");
-> $client1->succeed("flock -x /data/lock -c 'sleep 100000' &");
-> $client2->fail("flock -n -s /data/lock true");
-> $client1->shutdown;
-(this releases client1's lock)
-> $client2->succeed("flock -n -s /data/lock true");
+> startAll
+> $machine->succeed("touch /tmp/foo")
The function testScript executes the entire test
@@ -798,54 +1111,7 @@ script and drops you back into the test driver command line upon its
completion. This allows you to inspect the state of the VMs after the
test (e.g. to debug the test script).
-This and other tests are continuously run on the Hydra
-instance at nixos.org, which allows
-developers to be notified of any regressions introduced by a NixOS or
-Nixpkgs change.
-
-The actual Nix programming interface to VM testing is in NixOS,
-under
-lib/testing.nix. This file defines a
-function which takes an attribute set containing a
-nixpkgs attribute (the path to a Nixpkgs checkout),
-and a system attribute (the system type). It
-returns an attribute set containing several utility functions, among
-which the main entry point is makeTest.
-
-
-The makeTest function takes a function
-similar to that found in
-tests/nfs.nix (discussed above). It
-returns an attribute set containing (among others):
-
-
-
-
- test
- A derivation containing the test log as an HTML
- file, as seen above, suitable for presentation in the Hydra
- continuous build system.
-
-
-
- report
- A derivation containing a code coverage report, with
- meta-data suitable for Hydra.
-
-
-
- driver
- A derivation containing scripts to run the VM test or
- interact with the VM network interactively, as seen above.
-
-
-
-
-
-
+
diff --git a/nixos/doc/manual/installation.xml b/nixos/doc/manual/installation.xml
index 88ef589dd06..4cbfcc229fa 100644
--- a/nixos/doc/manual/installation.xml
+++ b/nixos/doc/manual/installation.xml
@@ -1,12 +1,13 @@
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xml:id="ch-installation">
Installing NixOS
-
+
Obtaining NixOS
@@ -50,7 +51,7 @@ running NixOS system through several other means:
-
+
Installation
@@ -208,7 +209,20 @@ $ nixos-install
a network issue while downloading binaries from the NixOS binary
cache), you can just re-run nixos-install.
Otherwise, fix your configuration.nix and
- then re-run nixos-install.
+ then re-run nixos-install.
+
+ As the last step, nixos-install will ask
+ you to set the password for the root user, e.g.
+
+
+setting root password...
+Enter new UNIX password: ***
+Retype new UNIX password: ***
+
+
+
+
+
If everything went well:
@@ -295,8 +309,81 @@ $ reboot
}
+
+
+UEFI Installation
+
+NixOS can also be installed on UEFI systems. The procedure
+is by and large the same as a BIOS installation, with the following
+changes:
+
+
+
+ You should boot the live CD in UEFI mode (consult your
+ specific hardware's documentation for instructions). You may find
+ the rEFInd
+ boot manager useful.
+
+
+ Instead of fdisk, you should use
+ gdisk to partition your disks. You will need to
+ have a separate partition for /boot with
+ partition code EF00, and it should be formatted as a
+ vfat filesystem.
+
+
+ You must set to
+ true. nixos-generate-config
+ should do this automatically for new configurations when booted in
+ UEFI mode.
+
+
+ After having mounted your installation partition to
+ /mnt
, you must mount the boot
partition
+ to /mnt/boot
.
+
+
+ You may want to look at the options starting with
+ and
+ as well.
+
+
+ To see console messages during early boot, add "fbcon"
+ to your .
+
+
+
+
+
+
+Booting from a USB stick
+
+For systems without CD drive, the NixOS livecd can be booted from
+a usb stick. For non-UEFI installations,
+unetbootin
+will work. For UEFI installations, you should mount the ISO, copy its contents
+verbatim to your drive, then either:
+
+
+
+ Change the label of the disk partition to the label of the ISO
+ (visible with the blkid command), or
+
+
+ Edit loader/entries/nixos-livecd.conf on the drive
+ and change the root= field in the options
+ line to point to your drive (see the documentation on root=
+ in
+ the kernel documentation for more details).
+
+
+
+
+
+
@@ -369,9 +456,23 @@ $ nixos-rebuild build-vm
$ ./result/bin/run-*-vm
-The VM does not have use any data from your host system, so your
-existing user accounts and home directories will not be
-available.
+The VM does not have any data from your host system, so your existing
+user accounts and home directories will not be available. You can
+forward ports on the host to the guest. For instance, the following
+will forward host port 2222 to guest port 22 (SSH):
+
+
+$ QEMU_NET_OPTS="hostfwd=tcp::2222-:22" ./result/bin/run-*-vm
+
+
+allowing you to log in via SSH (assuming you have set the appropriate
+passwords or SSH authorized keys):
+
+
+$ ssh -p 2222 localhost
+
+
+
@@ -392,7 +493,7 @@ been built. These channels are:
Stable channels, such as nixos-13.10.
+ xlink:href="http://nixos.org/channels/nixos-14.04">nixos-14.04.
These only get conservative bug fixes and package upgrades. For
instance, a channel update may cause the Linux kernel on your
system to be upgraded from 3.4.66 to 3.4.67 (a minor bug fix), but
@@ -418,8 +519,8 @@ appliances.)
When you first install NixOS, you’re automatically subscribed to
the NixOS channel that corresponds to your installation source. For
-instance, if you installed from a 13.10 ISO, you will be subscribed to
-the nixos-13.10 channel. To see which NixOS
+instance, if you installed from a 14.04 ISO, you will be subscribed to
+the nixos-14.04 channel. To see which NixOS
channel you’re subscribed to, run the following as root:
@@ -434,10 +535,10 @@ $ nix-channel --add http://nixos.org/channels/channel-name
(Be sure to include the nixos parameter at the
-end.) For instance, to use the NixOS 13.10 stable channel:
+end.) For instance, to use the NixOS 14.04 stable channel:
-$ nix-channel --add http://nixos.org/channels/nixos-13.10 nixos
+$ nix-channel --add http://nixos.org/channels/nixos-14.04 nixos
But it you want to live on the bleeding edge:
diff --git a/nixos/doc/manual/man-nixos-install.xml b/nixos/doc/manual/man-nixos-install.xml
index d5157859857..0ebee7d23f9 100644
--- a/nixos/doc/manual/man-nixos-install.xml
+++ b/nixos/doc/manual/man-nixos-install.xml
@@ -42,6 +42,9 @@ the following steps:
and generates a GRUB configuration file that boots into the NixOS
configuration just installed.
+ It prompts you for a password for the root
+ account.
+
diff --git a/nixos/doc/manual/manual.xml b/nixos/doc/manual/manual.xml
index dfbd865b505..f51a04cdf25 100644
--- a/nixos/doc/manual/manual.xml
+++ b/nixos/doc/manual/manual.xml
@@ -5,25 +5,7 @@
NixOS Manual
-
-
-
- Eelco
- Dolstra
-
-
-
-
-
- Nicolas
- Pierron
-
-
-
-
- 2007-2013
- Eelco Dolstra
-
+ Version
@@ -53,10 +35,14 @@
+
-
- List of options
+
+
+
+
+ Configuration options
-
+
diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl
index 6d11ad7a6c4..e81a1dc356e 100644
--- a/nixos/doc/manual/options-to-docbook.xsl
+++ b/nixos/doc/manual/options-to-docbook.xsl
@@ -18,15 +18,13 @@
-
+
-
-
+
+
+
@@ -204,4 +202,10 @@
+
+
+ λ
+
+
+
diff --git a/nixos/doc/manual/release-notes.xml b/nixos/doc/manual/release-notes.xml
new file mode 100644
index 00000000000..52e88bb4c86
--- /dev/null
+++ b/nixos/doc/manual/release-notes.xml
@@ -0,0 +1,198 @@
+
+
+Release notes
+
+
+
+
+
+Release 14.10 (“Caterpillar”, 2014/10/??)
+
+When upgrading from a previous release, please be aware of the
+following incompatible changes:
+
+
+
+ The host side of a container virtual Ethernet pair
+ is now called ve-container-name
+ rather than c-container-name.
+
+
+
+
+
+
+
+
+
+
+
+
+Release 14.04 (“Baboon”, 2014/04/30)
+
+This is the second stable release branch of NixOS. In addition
+to numerous new and upgraded packages and modules, this release has
+the following highlights:
+
+
+
+ Installation on UEFI systems is now supported. See
+ for
+ details.
+
+ Systemd has been updated to version 212, which has
+ numerous
+ improvements. NixOS now automatically starts systemd user
+ instances when you log in. You can define global user units through
+ the options.
+
+ NixOS is now based on Glibc 2.19 and GCC
+ 4.8.
+
+ The default Linux kernel has been updated to
+ 3.12.
+
+ KDE has been updated to 4.12.
+
+ GNOME 3.10 experimental support has been added.
+
+ Nix has been updated to 1.7 (details).
+
+ NixOS now supports fully declarative management of
+ users and groups. If you set to
+ false, then the contents of
+ /etc/passwd and /etc/group
+ will be congruent
+ to your NixOS configuration. For instance, if you remove a user from
+ and run
+ nixos-rebuild, the user account will cease to
+ exist. Also, imperative commands for managing users and groups, such
+ as useradd, are no longer available. If
+ is true (the
+ default), then behaviour is unchanged from NixOS
+ 13.10.
+
+ NixOS now has basic container support, meaning you
+ can easily run a NixOS instance as a container in a NixOS host
+ system. These containers are suitable for testing and
+ experimentation but not production use, since they’re not fully
+ isolated from the host. See for
+ details.
+
+ Systemd units provided by packages can now be
+ overridden from the NixOS configuration. For instance, if a package
+ foo provides systemd units, you can say:
+
+
+systemd.packages = [ pkgs.foo ];
+
+
+ to enable those units. You can then set or override unit options in
+ the usual way, e.g.
+
+
+systemd.services.foo.wantedBy = [ "multi-user.target" ];
+systemd.services.foo.serviceConfig.MemoryLimit = "512M";
+
+
+
+
+
+
+
+
+When upgrading from a previous release, please be aware of the
+following incompatible changes:
+
+
+
+ Nixpkgs no longer exposes unfree packages by
+ default. If your NixOS configuration requires unfree packages from
+ Nixpkgs, you need to enable support for them explicitly by setting:
+
+
+nixpkgs.config.allowUnfree = true;
+
+
+ Otherwise, you get an error message such as:
+
+
+error: package ‘nvidia-x11-331.49-3.12.17’ in ‘…/nvidia-x11/default.nix:56’
+ has an unfree license, refusing to evaluate
+
+
+
+
+ The Adobe Flash player is no longer enabled by
+ default in the Firefox and Chromium wrappers. To enable it, you must
+ set:
+
+
+nixpkgs.config.allowUnfree = true;
+nixpkgs.config.firefox.enableAdobeFlash = true; # for Firefox
+nixpkgs.config.chromium.enableAdobeFlash = true; # for Chromium
+
+
+
+
+ The firewall is now enabled by default. If you don’t
+ want this, you need to disable it explicitly:
+
+
+networking.firewall.enable = false;
+
+
+
+
+ The option
+ has been renamed to
+ .
+
+ The mysql55 service has been
+ merged into the mysql service, which no longer
+ sets a default for the option
+ .
+
+ Package variants are now differentiated by suffixing
+ the name, rather than the version. For instance,
+ sqlite-3.8.4.3-interactive is now called
+ sqlite-interactive-3.8.4.3. This ensures that
+ nix-env -i sqlite is unambiguous, and that
+ nix-env -u won’t “upgrade”
+ sqlite to sqlite-interactive
+ or vice versa. Notably, this change affects the Firefox wrapper
+ (which provides plugins), as it is now called
+ firefox-wrapper. So when using
+ nix-env, you should do nix-env -e
+ firefox; nix-env -i firefox-wrapper if you want to keep
+ using the wrapper. This change does not affect declarative package
+ management, since attribute names like
+ pkgs.firefoxWrapper were already
+ unambiguous.
+
+ The symlink /etc/ca-bundle.crt
+ is gone. Programs should instead use the environment variable
+ OPENSSL_X509_CERT_FILE (which points to
+ /etc/ssl/certs/ca-bundle.crt).
+
+
+
+
+
+
+
+
+
+
+
+Release 13.10 (“Aardvark”, 2013/10/31)
+
+This is the first stable release branch of NixOS.
+
+
+
+
diff --git a/nixos/doc/manual/running.xml b/nixos/doc/manual/running.xml
index e50099707cc..e1a358df2aa 100644
--- a/nixos/doc/manual/running.xml
+++ b/nixos/doc/manual/running.xml
@@ -11,7 +11,7 @@ service manager.
-Service management
+Service management
In NixOS, all system services are started and monitored using
the systemd program. Systemd is the “init” process of the system
@@ -92,7 +92,7 @@ necessary).
-Rebooting and shutting down
+Rebooting and shutting down
The system can be shut down (and automatically powered off) by
doing:
@@ -134,7 +134,7 @@ authentication.
-User sessions
+User sessions
Systemd keeps track of all users who are logged into the system
(e.g. on a virtual console or remotely via SSH). The command
@@ -185,7 +185,7 @@ $ loginctl terminate-session c3
-Control groups
+Control groups
To keep track of the processes in a running system, systemd uses
control groups (cgroups). A control group is a
@@ -258,7 +258,7 @@ usage.
-Logging
+Logging
System-wide logging is provided by systemd’s
journal, which subsumes traditional logging
@@ -308,7 +308,7 @@ groups. All users have a private journal that can be read using
-Cleaning up the Nix store
+Cleaning up the Nix store
Nix has a purely functional model, meaning that packages are
never upgraded in place. Instead new versions of packages end up in a
diff --git a/nixos/doc/manual/troubleshooting.xml b/nixos/doc/manual/troubleshooting.xml
index c6e0a3a7888..c7d65112b64 100644
--- a/nixos/doc/manual/troubleshooting.xml
+++ b/nixos/doc/manual/troubleshooting.xml
@@ -1,12 +1,13 @@
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xml:id="ch-troubleshooting">
Troubleshooting
-Boot problems
+Boot problems
If NixOS fails to boot, there are a number of kernel command
line parameters that may help you to identify or fix the issue. You
@@ -69,7 +70,7 @@ unless something is very wrong.)
-Maintenance mode
+Maintenance mode
You can enter rescue mode by running:
@@ -85,7 +86,7 @@ just exit from the rescue shell.
-Rolling back configuration changes
+Rolling back configuration changes
After running nixos-rebuild to switch to a
new configuration, you may find that the new configuration doesn’t
@@ -131,7 +132,7 @@ lrwxrwxrwx 1 root root 78 Aug 12 13:54 /nix/var/nix/profiles/system-268-link ->
-Nix store corruption
+Nix store corruption
After a system crash, it’s possible for files in the Nix store
to become corrupted. (For instance, the Ext4 file system has the
@@ -166,7 +167,7 @@ binary cache; otherwise, they cannot be repaired.
-Nix network issues
+Nix network issues
Nix uses a so-called binary cache to
optimise building a package from source into downloading it as a
diff --git a/nixos/lib/build-vms.nix b/nixos/lib/build-vms.nix
index d20fbc1cc66..498c0a37783 100644
--- a/nixos/lib/build-vms.nix
+++ b/nixos/lib/build-vms.nix
@@ -68,8 +68,8 @@ rec {
# the first interface (i.e. the first network in its
# virtualisation.vlans option).
networking.extraHosts = flip concatMapStrings machines
- (m: let config = (getAttr m nodes).config; in
- optionalString (config.networking.primaryIPAddress != "")
+ (m': let config = (getAttr m' nodes).config; in
+ optionalString (m.first != m' && config.networking.primaryIPAddress != "")
("${config.networking.primaryIPAddress} " +
"${config.networking.hostName}\n"));
diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix
index 5e1ce69158f..0fa00637a93 100644
--- a/nixos/lib/eval-config.nix
+++ b/nixos/lib/eval-config.nix
@@ -8,6 +8,7 @@
, extraArgs ? {}
, modules
, check ? true
+, prefix ? []
}:
let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in
@@ -17,6 +18,7 @@ rec {
# Merge the option definitions in all modules, forming the full
# system configuration.
inherit (pkgs.lib.evalModules {
+ inherit prefix;
modules = modules ++ baseModules;
args = extraArgs;
check = check && options.environment.checkConfigurationOptions.value;
@@ -24,10 +26,15 @@ rec {
# These are the extra arguments passed to every module. In
# particular, Nixpkgs is passed through the "pkgs" argument.
+ # FIXME: we enable config.allowUnfree to make packages like
+ # nvidia-x11 available. This isn't a problem because if the user has
+ # ‘nixpkgs.config.allowUnfree = false’, then evaluation will fail on
+ # the 64-bit package anyway. However, it would be cleaner to respect
+ # nixpkgs.config here.
extraArgs = extraArgs_ // {
inherit pkgs modules baseModules;
modulesPath = ../modules;
- pkgs_i686 = import ./nixpkgs.nix { system = "i686-linux"; };
+ pkgs_i686 = import ./nixpkgs.nix { system = "i686-linux"; config.allowUnfree = true; };
utils = import ./utils.nix pkgs;
};
@@ -48,10 +55,10 @@ rec {
let
system = if nixpkgsOptions.system != "" then nixpkgsOptions.system else system_;
nixpkgsOptions = (import ./eval-config.nix {
- inherit system extraArgs modules;
+ inherit system extraArgs modules prefix;
# For efficiency, leave out most NixOS modules; they don't
# define nixpkgs.config, so it's pointless to evaluate them.
- baseModules = [ ../modules/misc/nixpkgs.nix ];
+ baseModules = [ ../modules/misc/nixpkgs.nix ../modules/config/no-x-libs.nix ];
pkgs = import ./nixpkgs.nix { system = system_; config = {}; };
check = false;
}).config.nixpkgs;
diff --git a/nixos/lib/make-iso9660-image.sh b/nixos/lib/make-iso9660-image.sh
index 89b681ed2cd..675b5bb3514 100644
--- a/nixos/lib/make-iso9660-image.sh
+++ b/nixos/lib/make-iso9660-image.sh
@@ -78,7 +78,7 @@ done
cat pathlist | sed -e 's/=\(.*\)=\(.*\)=/\\=\1=\2\\=/' | tee pathlist.safer
-ensureDir $out/iso
+mkdir -p $out/iso
genCommand="genisoimage -iso-level 4 -r -J $bootFlags -hide-rr-moved -graft-points -path-list pathlist.safer ${volumeID:+-V $volumeID}"
if test -z "$compressImage"; then
$genCommand -o $out/iso/$isoName
@@ -87,5 +87,5 @@ else
fi
-ensureDir $out/nix-support
+mkdir -p $out/nix-support
echo $system > $out/nix-support/system
diff --git a/nixos/lib/make-system-tarball.sh b/nixos/lib/make-system-tarball.sh
index aadd0f6428c..096d96ac1c8 100644
--- a/nixos/lib/make-system-tarball.sh
+++ b/nixos/lib/make-system-tarball.sh
@@ -48,11 +48,11 @@ for ((n = 0; n < ${#objects[*]}; n++)); do
fi
done
-ensureDir $out/tarball
+mkdir -p $out/tarball
tar cvJf $out/tarball/$fileName.tar.xz *
-ensureDir $out/nix-support
+mkdir -p $out/nix-support
echo $system > $out/nix-support/system
echo "file system-tarball $out/tarball/$fileName.tar.xz" > $out/nix-support/hydra-build-products
diff --git a/nixos/lib/test-driver/Machine.pm b/nixos/lib/test-driver/Machine.pm
index a28214ea934..e2bd3393d87 100644
--- a/nixos/lib/test-driver/Machine.pm
+++ b/nixos/lib/test-driver/Machine.pm
@@ -495,7 +495,9 @@ sub waitForX {
my ($self, $regexp) = @_;
$self->nest("waiting for the X11 server", sub {
retry sub {
- my ($status, $out) = $self->execute("xwininfo -root > /dev/null 2>&1");
+ my ($status, $out) = $self->execute("journalctl -b SYSLOG_IDENTIFIER=systemd | grep 'session opened'");
+ return 0 if $status != 0;
+ ($status, $out) = $self->execute("xwininfo -root > /dev/null 2>&1");
return 1 if $status == 0;
}
});
diff --git a/nixos/lib/test-driver/log2html.xsl b/nixos/lib/test-driver/log2html.xsl
index 8e907d85ffa..ce8a9c6de2b 100644
--- a/nixos/lib/test-driver/log2html.xsl
+++ b/nixos/lib/test-driver/log2html.xsl
@@ -9,8 +9,8 @@
-
-
+
+
Log File
diff --git a/nixos/lib/test-driver/test-driver.pl b/nixos/lib/test-driver/test-driver.pl
index c6a707cdf6b..8ad0d67f68c 100644
--- a/nixos/lib/test-driver/test-driver.pl
+++ b/nixos/lib/test-driver/test-driver.pl
@@ -52,12 +52,12 @@ sub createMachine {
my ($args) = @_;
my $vm = Machine->new({%{$args}, log => $log, redirectSerial => ($ENV{USE_SERIAL} // "0") ne "1"});
$vms{$vm->name} = $vm;
+ $context .= "my \$" . $vm->name . " = \$vms{'" . $vm->name . "'}; ";
return $vm;
}
foreach my $vmScript (@ARGV) {
my $vm = createMachine({startCommand => $vmScript});
- $context .= "my \$" . $vm->name . " = \$vms{'" . $vm->name . "'}; ";
}
@@ -144,6 +144,13 @@ sub runTests {
}
});
+ $log->nest("syncing", sub {
+ foreach my $vm (values %vms) {
+ next unless $vm->isUp();
+ $vm->execute("sync");
+ }
+ });
+
if ($nrTests != 0) {
$log->log("$nrSucceeded out of $nrTests tests succeeded",
($nrSucceeded < $nrTests ? { error => 1 } : { }));
diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix
index 3407229e921..0e23fc5d187 100644
--- a/nixos/lib/testing.nix
+++ b/nixos/lib/testing.nix
@@ -37,7 +37,7 @@ rec {
# `driver' is the script that runs the network.
runTests = driver:
stdenv.mkDerivation {
- name = "vm-test-run";
+ name = "vm-test-run-${driver.testName}";
requiredSystemFeatures = [ "kvm" "nixos-test" ];
@@ -67,103 +67,57 @@ rec {
};
- # Generate a coverage report from the coverage data produced by
- # runTests.
- makeReport = x: runCommand "report" { buildInputs = [rsync]; }
- ''
- mkdir -p $TMPDIR/gcov/
+ makeTest =
+ { testScript, makeCoverageReport ? false, name ? "unnamed", ... } @ t:
- for d in ${x}/coverage-data/*; do
- echo "doing $d"
- [ -n "$(ls -A "$d")" ] || continue
+ let
+ testDriverName = "nixos-test-driver-${name}";
- for i in $(cd $d/nix/store && ls); do
- if ! test -e $TMPDIR/gcov/nix/store/$i; then
- echo "copying $i"
- mkdir -p $TMPDIR/gcov/$(echo $i | cut -c34-)
- rsync -rv /nix/store/$i/.build/* $TMPDIR/gcov/
- fi
- done
+ nodes = buildVirtualNetwork (
+ t.nodes or (if t ? machine then { machine = t.machine; } else { }));
- chmod -R u+w $TMPDIR/gcov
+ testScript' =
+ # Call the test script with the computed nodes.
+ if builtins.isFunction testScript
+ then testScript { inherit nodes; }
+ else testScript;
- find $TMPDIR/gcov -name "*.gcda" -exec rm {} \;
+ vlans = map (m: m.config.virtualisation.vlans) (lib.attrValues nodes);
- for i in $(cd $d/nix/store && ls); do
- rsync -rv $d/nix/store/$i/.build/* $TMPDIR/gcov/
- done
+ vms = map (m: m.config.system.build.vm) (lib.attrValues nodes);
- find $TMPDIR/gcov -name "*.gcda" -exec chmod 644 {} \;
+ # Generate onvenience wrappers for running the test driver
+ # interactively with the specified network, and for starting the
+ # VMs from the command line.
+ driver = runCommand testDriverName
+ { buildInputs = [ makeWrapper];
+ testScript = testScript';
+ preferLocalBuild = true;
+ testName = name;
+ }
+ ''
+ mkdir -p $out/bin
+ echo "$testScript" > $out/test-script
+ ln -s ${testDriver}/bin/nixos-test-driver $out/bin/
+ vms="$(for i in ${toString vms}; do echo $i/bin/run-*-vm; done)"
+ wrapProgram $out/bin/nixos-test-driver \
+ --add-flags "$vms" \
+ --run "testScript=\"\$(cat $out/test-script)\"" \
+ --set testScript '"$testScript"' \
+ --set VLANS '"${toString vlans}"'
+ ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms
+ wrapProgram $out/bin/nixos-run-vms \
+ --add-flags "$vms" \
+ --set tests '"startAll; joinAll;"' \
+ --set VLANS '"${toString vlans}"' \
+ ${lib.optionalString (builtins.length vms == 1) "--set USE_SERIAL 1"}
+ ''; # "
- echo "producing info..."
- ${pkgs.lcov}/bin/geninfo --ignore-errors source,gcov $TMPDIR/gcov --output-file $TMPDIR/app.info
- cat $TMPDIR/app.info >> $TMPDIR/full.info
- done
+ test = runTests driver;
- echo "making report..."
- mkdir -p $out/coverage
- ${pkgs.lcov}/bin/genhtml --show-details $TMPDIR/full.info -o $out/coverage
- cp $TMPDIR/full.info $out/coverage/
+ report = releaseTools.gcovReport { coverageRuns = [ test ]; };
- mkdir -p $out/nix-support
- cat ${x}/nix-support/hydra-build-products >> $out/nix-support/hydra-build-products
- echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products
- [ ! -e ${x}/nix-support/failed ] || touch $out/nix-support/failed
- ''; # */
-
-
- makeTest = testFun: complete (call testFun);
- makeTests = testsFun: lib.mapAttrs (name: complete) (call testsFun);
-
- apply = makeTest; # compatibility
- call = f: f { inherit pkgs system; };
-
- complete = t: t // rec {
- nodes = buildVirtualNetwork (
- if t ? nodes then t.nodes else
- if t ? machine then { machine = t.machine; }
- else { } );
-
- testScript =
- # Call the test script with the computed nodes.
- if builtins.isFunction t.testScript
- then t.testScript { inherit nodes; }
- else t.testScript;
-
- vlans = map (m: m.config.virtualisation.vlans) (lib.attrValues nodes);
-
- vms = map (m: m.config.system.build.vm) (lib.attrValues nodes);
-
- # Generate onvenience wrappers for running the test driver
- # interactively with the specified network, and for starting the
- # VMs from the command line.
- driver = runCommand "nixos-test-driver"
- { buildInputs = [ makeWrapper];
- inherit testScript;
- preferLocalBuild = true;
- }
- ''
- mkdir -p $out/bin
- echo "$testScript" > $out/test-script
- ln -s ${testDriver}/bin/nixos-test-driver $out/bin/
- vms="$(for i in ${toString vms}; do echo $i/bin/run-*-vm; done)"
- wrapProgram $out/bin/nixos-test-driver \
- --add-flags "$vms" \
- --run "testScript=\"\$(cat $out/test-script)\"" \
- --set testScript '"$testScript"' \
- --set VLANS '"${toString vlans}"'
- ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms
- wrapProgram $out/bin/nixos-run-vms \
- --add-flags "$vms" \
- --set tests '"startAll; joinAll;"' \
- --set VLANS '"${toString vlans}"' \
- ${lib.optionalString (builtins.length vms == 1) "--set USE_SERIAL 1"}
- ''; # "
-
- test = runTests driver;
-
- report = makeReport test;
- };
+ in (if makeCoverageReport then report else test) // { inherit nodes driver test; };
runInMachine =
@@ -193,7 +147,7 @@ rec {
exit $?
'';
- testscript = ''
+ testScript = ''
startAll;
$client->waitForUnit("multi-user.target");
${preBuild}
@@ -206,7 +160,7 @@ rec {
${coreutils}/bin/mkdir $out
${coreutils}/bin/mkdir -p vm-state-client/xchg
export > vm-state-client/xchg/saved-env
- export tests='${testscript}'
+ export tests='${testScript}'
${testDriver}/bin/nixos-test-driver ${vm.config.system.build.vm}/bin/run-*-vm
''; # */
@@ -244,6 +198,6 @@ rec {
} // args);
- simpleTest = as: (makeTest ({ ... }: as)).test;
+ simpleTest = as: (makeTest as).test;
}
diff --git a/nixos/maintainers/scripts/ec2/amazon-base-config.nix b/nixos/maintainers/scripts/ec2/amazon-base-config.nix
new file mode 100644
index 00000000000..d23f15e828b
--- /dev/null
+++ b/nixos/maintainers/scripts/ec2/amazon-base-config.nix
@@ -0,0 +1,5 @@
+{ modulesPath, ...}:
+{
+ imports = [ "${modulesPath}/virtualisation/amazon-config.nix" ];
+ services.journald.rateLimitBurst = 0;
+}
diff --git a/nixos/maintainers/scripts/ec2/amazon-hvm-config.nix b/nixos/maintainers/scripts/ec2/amazon-hvm-config.nix
new file mode 100644
index 00000000000..d0c7f3a6a6c
--- /dev/null
+++ b/nixos/maintainers/scripts/ec2/amazon-hvm-config.nix
@@ -0,0 +1,5 @@
+{ config, pkgs, ...}:
+{
+ imports = [ ./amazon-base-config.nix ];
+ ec2.hvm = true;
+}
diff --git a/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix b/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix
new file mode 100644
index 00000000000..d9feba164a7
--- /dev/null
+++ b/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix
@@ -0,0 +1,33 @@
+{ config, pkgs, lib, ...}:
+let
+ cloudUtils = pkgs.fetchurl {
+ url = "https://launchpad.net/cloud-utils/trunk/0.27/+download/cloud-utils-0.27.tar.gz";
+ sha256 = "16shlmg36lidp614km41y6qk3xccil02f5n3r4wf6d1zr5n4v8vd";
+ };
+ growpart = pkgs.stdenv.mkDerivation {
+ name = "growpart";
+ src = cloudUtils;
+ buildPhase = ''
+ cp bin/growpart $out
+ sed -i 's|awk|gawk|' $out
+ sed -i 's|sed|gnused|' $out
+ '';
+ dontInstall = true;
+ dontPatchShebangs = true;
+ };
+in
+{
+ imports = [ ./amazon-base-config.nix ];
+ ec2.hvm = true;
+ boot.loader.grub.device = lib.mkOverride 0 "nodev";
+
+ boot.initrd.extraUtilsCommands = ''
+ cp -v ${pkgs.gawk}/bin/gawk $out/bin/gawk
+ cp -v ${pkgs.gnused}/bin/sed $out/bin/gnused
+ cp -v ${pkgs.utillinux}/sbin/sfdisk $out/bin/sfdisk
+ cp -v ${growpart} $out/bin/growpart
+ '';
+ boot.initrd.postDeviceCommands = ''
+ [ -e /dev/xvda ] && [ -e /dev/xvda1 ] && TMPDIR=/run sh $(type -P growpart) /dev/xvda 1
+ '';
+}
diff --git a/nixos/maintainers/scripts/ec2/create-ebs-amis.py b/nixos/maintainers/scripts/ec2/create-ebs-amis.py
index 93971ac9504..14607b9a367 100755
--- a/nixos/maintainers/scripts/ec2/create-ebs-amis.py
+++ b/nixos/maintainers/scripts/ec2/create-ebs-amis.py
@@ -8,15 +8,17 @@ import nixops.util
from nixops import deployment
from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType
import boto.ec2
+from nixops.statefile import StateFile, get_default_state_file
parser = argparse.ArgumentParser(description='Create an EBS-backed NixOS AMI')
parser.add_argument('--region', dest='region', required=True, help='EC2 region to create the image in')
+parser.add_argument('--channel', dest='channel', default="13.10", help='Channel to use')
parser.add_argument('--keep', dest='keep', action='store_true', help='Keep NixOps machine after use')
parser.add_argument('--hvm', dest='hvm', action='store_true', help='Create HVM image')
parser.add_argument('--key', dest='key_name', action='store_true', help='Keypair used for HVM instance creation', default="rob")
args = parser.parse_args()
-instance_type = "cc1.4xlarge" if args.hvm else "m1.small"
+instance_type = "m3.medium" if args.hvm else "m1.small"
ebs_size = 8 if args.hvm else 20
@@ -37,11 +39,11 @@ f.write('''{{
'''.format(args.region, ebs_size))
f.close()
-db = deployment.open_database(deployment.get_default_state_file())
+db = StateFile(get_default_state_file())
try:
- depl = deployment.open_deployment(db, "ebs-creator")
+ depl = db.open_deployment("ebs-creator")
except Exception:
- depl = deployment.create_deployment(db)
+ depl = db.create_deployment()
depl.name = "ebs-creator"
depl.auto_response = "y"
depl.nix_exprs = [os.path.abspath("./ebs-creator.nix"), os.path.abspath("./ebs-creator-config.nix")]
@@ -50,7 +52,6 @@ depl.deploy(allow_reboot=True)
m = depl.machines['machine']
-
# Do the installation.
device="/dev/xvdg"
if args.hvm:
@@ -64,23 +65,27 @@ m.run_command("mkdir -p /mnt")
m.run_command("mount {0} /mnt".format(device))
m.run_command("touch /mnt/.ebs")
m.run_command("mkdir -p /mnt/etc/nixos")
-m.run_command("nix-channel --add http://nixos.org/channels/nixos-unstable")
+
+m.run_command("nix-channel --add http://nixos.org/channels/nixos-{} nixos".format(args.channel))
m.run_command("nix-channel --update")
-m.run_command("nixos-rebuild switch")
-version = m.run_command("nixos-version", capture_stdout=True).replace('"', '').rstrip()
+
+version = m.run_command("nix-instantiate --eval-only -A lib.nixpkgsVersion ''", capture_stdout=True).split(' ')[0].replace('"','').strip()
print >> sys.stderr, "NixOS version is {0}".format(version)
-m.upload_file("./amazon-base-config.nix", "/mnt/etc/nixos/configuration.nix")
-m.run_command("nixos-install")
if args.hvm:
- m.run_command('cp /mnt/nix/store/*-grub-0.97*/lib/grub/i386-pc/* /mnt/boot/grub')
- m.run_command('sed -i "s|hd0|hd0,0|" /mnt/boot/grub/menu.lst')
+ m.upload_file("./amazon-base-config.nix", "/mnt/etc/nixos/amazon-base-config.nix")
+ m.upload_file("./amazon-hvm-config.nix", "/mnt/etc/nixos/configuration.nix")
+ m.upload_file("./amazon-hvm-install-config.nix", "/mnt/etc/nixos/amazon-hvm-install-config.nix")
+ m.run_command("NIXOS_CONFIG=/etc/nixos/amazon-hvm-install-config.nix nixos-install")
+ m.run_command('nix-env -iA nixos.pkgs.grub')
+ m.run_command('cp /nix/store/*-grub-0.97*/lib/grub/i386-pc/* /mnt/boot/grub')
m.run_command('echo "(hd1) /dev/xvdg" > device.map')
m.run_command('echo -e "root (hd1,0)\nsetup (hd1)" | grub --device-map=device.map --batch')
-
+else:
+ m.upload_file("./amazon-base-config.nix", "/mnt/etc/nixos/configuration.nix")
+ m.run_command("nixos-install")
m.run_command("umount /mnt")
-
if args.hvm:
ami_name = "nixos-{0}-x86_64-ebs-hvm".format(version)
description = "NixOS {0} (x86_64; EBS root; hvm)".format(version)
@@ -98,7 +103,7 @@ def check():
m.connect()
volume = m._conn.get_all_volumes([], filters={'attachment.instance-id': m.resource_id, 'attachment.device': "/dev/sdg"})[0]
if args.hvm:
- instance = m._conn.run_instances( image_id="ami-6a9e4503"
+ instance = m._conn.run_instances( image_id="ami-5f491f36"
, instance_type=instance_type
, key_name=args.key_name
, placement=m.zone
@@ -185,7 +190,7 @@ f.write(
'''.format(args.region, ami_id, instance_type))
f.close()
-test_depl = deployment.create_deployment(db)
+test_depl = db.create_deployment()
test_depl.auto_response = "y"
test_depl.name = "ebs-creator-test"
test_depl.nix_exprs = [os.path.abspath("./ebs-test.nix")]
@@ -202,7 +207,7 @@ f = open("{0}.{1}.ami-id".format(args.region, image_type), "w")
f.write("{0}".format(ami_id))
f.close()
-for dest in [ 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1']:
+for dest in [ 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', 'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'sa-east-1']:
if args.region != dest:
print >> sys.stderr, "copying image from region {0} to {1}".format(args.region, dest)
conn = boto.ec2.connect_to_region(dest)
diff --git a/nixos/maintainers/scripts/ec2/create-s3-amis.sh b/nixos/maintainers/scripts/ec2/create-s3-amis.sh
index 1aaac283239..140b4fcbddb 100755
--- a/nixos/maintainers/scripts/ec2/create-s3-amis.sh
+++ b/nixos/maintainers/scripts/ec2/create-s3-amis.sh
@@ -1,9 +1,8 @@
#! /bin/sh -e
-nixos=$(nix-instantiate --find-file nixos)
export NIXOS_CONFIG=$(dirname $(readlink -f $0))/amazon-base-config.nix
-version=$(nix-instantiate --eval-only '' -A config.system.nixosVersion | sed s/'"'//g)
+version=$(nix-instantiate --eval-only '' -A config.system.nixosVersion | sed s/'"'//g)
echo "NixOS version is $version"
buildAndUploadFor() {
@@ -11,13 +10,13 @@ buildAndUploadFor() {
arch="$2"
echo "building $system image..."
- nix-build '' \
+ nix-build '' \
-A config.system.build.amazonImage --argstr system "$system" -o ec2-ami
ec2-bundle-image -i ./ec2-ami/nixos.img --user "$AWS_ACCOUNT" --arch "$arch" \
-c "$EC2_CERT" -k "$EC2_PRIVATE_KEY"
- for region in eu-west-1 us-east-1 us-west-1 us-west-2; do
+ for region in eu-west-1; do
echo "uploading $system image for $region..."
name=nixos-$version-$arch-s3
diff --git a/nixos/maintainers/scripts/ec2/ebs-creator.nix b/nixos/maintainers/scripts/ec2/ebs-creator.nix
index 43dbd86f675..37795d5d5b4 100644
--- a/nixos/maintainers/scripts/ec2/ebs-creator.nix
+++ b/nixos/maintainers/scripts/ec2/ebs-creator.nix
@@ -4,10 +4,11 @@
machine =
{ config, pkgs, resources, ... }:
{ deployment.targetEnv = "ec2";
- deployment.ec2.instanceType = "m1.large";
+ deployment.ec2.instanceType = "c3.large";
deployment.ec2.securityGroups = [ "admin" ];
deployment.ec2.ebsBoot = false;
deployment.ec2.keyPair = resources.ec2KeyPairs.keypair.name;
+ deployment.ec2.zone = "us-east-1e";
environment.systemPackages = [ pkgs.parted ];
};
}
diff --git a/nixos/maintainers/scripts/gce/create-gce.sh b/nixos/maintainers/scripts/gce/create-gce.sh
new file mode 100755
index 00000000000..8bf36f33c7d
--- /dev/null
+++ b/nixos/maintainers/scripts/gce/create-gce.sh
@@ -0,0 +1,14 @@
+#! /bin/sh -e
+
+export NIX_PATH=nixpkgs=../../../..
+export NIXOS_CONFIG=$(dirname $(readlink -f $0))/../../../modules/virtualisation/google-compute-image.nix
+export TIMESTAMP=$(date +%Y%m%d%H%M)
+
+nix-build '' \
+ -A config.system.build.googleComputeImage --argstr system x86_64-linux -o gce --option extra-binary-caches http://hydra.nixos.org -j 10
+
+img=$(echo gce/*.tar.gz)
+if ! gsutil ls gs://nixos/$(basename $img); then
+ gsutil cp $img gs://nixos/$(basename $img)
+fi
+gcutil addimage $(basename $img .raw.tar.gz | sed 's|\.|-|' | sed 's|_|-|') gs://nixos/$(basename $img)
diff --git a/nixos/modules/config/fonts/corefonts.nix b/nixos/modules/config/fonts/corefonts.nix
index 7de95200cfa..ad797087932 100644
--- a/nixos/modules/config/fonts/corefonts.nix
+++ b/nixos/modules/config/fonts/corefonts.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -25,7 +25,7 @@ with pkgs.lib;
config = mkIf config.fonts.enableCoreFonts {
- fonts.extraFonts = [ pkgs.corefonts ];
+ fonts.fonts = [ pkgs.corefonts ];
};
diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix
index 987bb1088c0..cf70ca264d6 100644
--- a/nixos/modules/config/fonts/fontconfig.nix
+++ b/nixos/modules/config/fonts/fontconfig.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/config/fonts/fontdir.nix b/nixos/modules/config/fonts/fontdir.nix
index a4f69809b2a..c78b52fe29e 100644
--- a/nixos/modules/config/fonts/fontdir.nix
+++ b/nixos/modules/config/fonts/fontdir.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/config/fonts/fonts.nix b/nixos/modules/config/fonts/fonts.nix
index f43784f6d03..49b1e1d42a3 100644
--- a/nixos/modules/config/fonts/fonts.nix
+++ b/nixos/modules/config/fonts/fonts.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -10,40 +10,37 @@ with pkgs.lib;
# TODO: find another name for it.
fonts = mkOption {
- default = [
- # - the user's .fonts directory
- "~/.fonts"
- # - the user's current profile
- "~/.nix-profile/lib/X11/fonts"
- "~/.nix-profile/share/fonts"
- # - the default profile
- "/nix/var/nix/profiles/default/lib/X11/fonts"
- "/nix/var/nix/profiles/default/share/fonts"
- ];
- description = "List of primary font paths.";
- apply = list: list ++ [
- # - a few statically built locations
- pkgs.xorg.fontbhttf
- pkgs.xorg.fontbhlucidatypewriter100dpi
- pkgs.xorg.fontbhlucidatypewriter75dpi
- pkgs.ttf_bitstream_vera
- pkgs.freefont_ttf
- pkgs.liberation_ttf
- pkgs.xorg.fontbh100dpi
- pkgs.xorg.fontmiscmisc
- pkgs.xorg.fontcursormisc
- ]
- ++ config.fonts.extraFonts;
- };
-
- extraFonts = mkOption {
- default = [];
+ type = types.listOf types.path;
example = [ pkgs.dejavu_fonts ];
- description = "List of packages with additional fonts.";
+ description = "List of primary font paths.";
+ apply = list: list ++
+ [ # - the user's current profile
+ "~/.nix-profile/lib/X11/fonts"
+ "~/.nix-profile/share/fonts"
+ # - the default profile
+ "/nix/var/nix/profiles/default/lib/X11/fonts"
+ "/nix/var/nix/profiles/default/share/fonts"
+ ];
};
};
};
+ config = {
+
+ fonts.fonts =
+ [ pkgs.xorg.fontbhttf
+ pkgs.xorg.fontbhlucidatypewriter100dpi
+ pkgs.xorg.fontbhlucidatypewriter75dpi
+ pkgs.ttf_bitstream_vera
+ pkgs.freefont_ttf
+ pkgs.liberation_ttf
+ pkgs.xorg.fontbh100dpi
+ pkgs.xorg.fontmiscmisc
+ pkgs.xorg.fontcursormisc
+ ];
+
+ };
+
}
diff --git a/nixos/modules/config/fonts/ghostscript.nix b/nixos/modules/config/fonts/ghostscript.nix
index 9ef00396808..1c62a525de9 100644
--- a/nixos/modules/config/fonts/ghostscript.nix
+++ b/nixos/modules/config/fonts/ghostscript.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -25,7 +25,7 @@ with pkgs.lib;
config = mkIf config.fonts.enableGhostscriptFonts {
- fonts.extraFonts = [ "${pkgs.ghostscript}/share/ghostscript/fonts" ];
+ fonts.fonts = [ "${pkgs.ghostscript}/share/ghostscript/fonts" ];
};
diff --git a/nixos/modules/config/gnu.nix b/nixos/modules/config/gnu.nix
index 6f5d2950463..f8c35b440d1 100644
--- a/nixos/modules/config/gnu.nix
+++ b/nixos/modules/config/gnu.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
options = {
@@ -36,7 +36,7 @@ with pkgs.lib;
# GNU lsh.
services.openssh.enable = false;
services.lshd.enable = true;
- services.xserver.startOpenSSHAgent = false;
+ programs.ssh.startAgent = false;
services.xserver.startGnuPGAgent = true;
# TODO: GNU dico.
diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix
index 56d541cb9b3..d3f24e280c7 100644
--- a/nixos/modules/config/i18n.nix
+++ b/nixos/modules/config/i18n.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -53,7 +53,11 @@ in
};
consoleKeyMap = mkOption {
- type = types.str;
+ type = mkOptionType {
+ name = "string or path";
+ check = t: (isString t || types.path.check t);
+ };
+
default = "us";
example = "fr";
description = ''
@@ -72,7 +76,12 @@ in
environment.systemPackages = [ glibcLocales ];
- environment.variables.LANG = config.i18n.defaultLocale;
+ environment.sessionVariables =
+ { LANG = config.i18n.defaultLocale;
+ LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
+ };
+
+ systemd.globalEnvironment.LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive";
# ‘/etc/locale.conf’ is used by systemd.
environment.etc = singleton
diff --git a/nixos/modules/config/krb5.nix b/nixos/modules/config/krb5.nix
index 3323046ac5b..991b5b16cc6 100644
--- a/nixos/modules/config/krb5.nix
+++ b/nixos/modules/config/krb5.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -32,12 +32,12 @@ in
kdc = mkOption {
default = "kerberos.mit.edu";
- description = "Kerberos Domain Controller";
+ description = "Kerberos Domain Controller.";
};
kerberosAdminServer = mkOption {
default = "kerberos.mit.edu";
- description = "Kerberos Admin Server";
+ description = "Kerberos Admin Server.";
};
};
diff --git a/nixos/modules/config/ldap.nix b/nixos/modules/config/ldap.nix
index 113f5d8bcbd..1a01533c585 100644
--- a/nixos/modules/config/ldap.nix
+++ b/nixos/modules/config/ldap.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
with pkgs;
+with lib;
let
@@ -217,9 +217,7 @@ in
systemd.services = mkIf cfg.daemon.enable {
nslcd = {
- wantedBy = [ "nss-user-lookup.target" ];
- before = [ "nss-user-lookup.target" ];
- after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
preStart = ''
mkdir -p /run/nslcd
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix
index 9ac68b42819..fd1e55f673a 100644
--- a/nixos/modules/config/networking.nix
+++ b/nixos/modules/config/networking.nix
@@ -1,8 +1,8 @@
# /etc files related to networking, such as /etc/services.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -14,7 +14,7 @@ in
options = {
- networking.extraHosts = pkgs.lib.mkOption {
+ networking.extraHosts = lib.mkOption {
type = types.lines;
default = "";
example = "192.168.0.1 lanlocalhost";
@@ -23,7 +23,7 @@ in
'';
};
- networking.dnsSingleRequest = pkgs.lib.mkOption {
+ networking.dnsSingleRequest = lib.mkOption {
type = types.bool;
default = false;
description = ''
diff --git a/nixos/modules/config/no-x-libs.nix b/nixos/modules/config/no-x-libs.nix
index ec7bf3fea7b..f91dbb4cc28 100644
--- a/nixos/modules/config/no-x-libs.nix
+++ b/nixos/modules/config/no-x-libs.nix
@@ -1,6 +1,9 @@
-{ config, pkgs, ... }:
+# This module gets rid of all dependencies on X11 client libraries
+# (including fontconfig).
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+
+with lib;
{
options = {
@@ -8,18 +11,22 @@ with pkgs.lib;
type = types.bool;
default = false;
description = ''
- Switch off the options in the default configuration that require X libraries.
- Currently this includes: ssh X11 forwarding, dbus, fonts.enableCoreFonts,
- fonts.enableFontConfig
+ Switch off the options in the default configuration that
+ require X11 libraries. This includes client-side font
+ configuration and SSH forwarding of X11 authentication
+ in. Thus, you probably do not want to enable this option if
+ you want to run X11 programs on this machine via SSH.
'';
};
};
config = mkIf config.environment.noXlibs {
programs.ssh.setXAuthLocation = false;
- fonts = {
- enableCoreFonts = false;
- enableFontConfig = false;
- };
+ security.pam.services.su.forwardXAuth = lib.mkForce false;
+
+ fonts.enableFontConfig = false;
+
+ nixpkgs.config.packageOverrides = pkgs:
+ { dbus = pkgs.dbus.override { useX11 = false; }; };
};
}
diff --git a/nixos/modules/config/nsswitch.nix b/nixos/modules/config/nsswitch.nix
index 2e2125d44f7..45695d9cb89 100644
--- a/nixos/modules/config/nsswitch.nix
+++ b/nixos/modules/config/nsswitch.nix
@@ -1,8 +1,8 @@
# Configuration for the Name Service Switch (/etc/nsswitch.conf).
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/config/power-management.nix b/nixos/modules/config/power-management.nix
index 7299136235e..17f3ed00b9b 100644
--- a/nixos/modules/config/power-management.nix
+++ b/nixos/modules/config/power-management.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -65,14 +65,7 @@ in
config = mkIf cfg.enable {
- # Enable the ACPI daemon. Not sure whether this is essential.
- services.acpid.enable = true;
-
- boot.kernelModules =
- [ "acpi_cpufreq" "powernow-k8" "cpufreq_performance" "cpufreq_powersave" "cpufreq_ondemand"
- "cpufreq_conservative"
- ];
-
+ # FIXME: Implement powersave governor for sandy bridge or later Intel CPUs
powerManagement.cpuFreqGovernor = mkDefault "ondemand";
powerManagement.scsiLinkPolicy = mkDefault "min_power";
diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix
index 7a6cc542273..96593885e5b 100644
--- a/nixos/modules/config/pulseaudio.nix
+++ b/nixos/modules/config/pulseaudio.nix
@@ -1,24 +1,26 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
with pkgs;
+with lib;
let
cfg = config.hardware.pulseaudio;
+ systemWide = cfg.enable && cfg.systemWide;
+ nonSystemWide = cfg.enable && !cfg.systemWide;
+
uid = config.ids.uids.pulseaudio;
gid = config.ids.gids.pulseaudio;
- pulseRuntimePath = "/var/run/pulse";
+ stateDir = "/run/pulse";
# Create pulse/client.conf even if PulseAudio is disabled so
# that we can disable the autospawn feature in programs that
# are built with PulseAudio support (like KDE).
clientConf = writeText "client.conf" ''
- autospawn=${if (cfg.enable && !cfg.systemWide) then "yes" else "no"}
- ${optionalString (cfg.enable && !cfg.systemWide)
- "daemon-binary=${cfg.package}/bin/pulseaudio"}
+ autospawn=${if nonSystemWide then "yes" else "no"}
+ ${optionalString nonSystemWide "daemon-binary=${cfg.package}/bin/pulseaudio"}
'';
# Write an /etc/asound.conf that causes all ALSA applications to
@@ -68,7 +70,7 @@ in {
configFile = mkOption {
type = types.uniq types.path;
- default = "${pulseaudio}/etc/pulse/default.pa";
+ default = "${cfg.package}/etc/pulse/default.pa";
description = ''
The path to the configuration the PulseAudio server
should use. By default, the "default.pa" configuration
@@ -77,15 +79,26 @@ in {
};
package = mkOption {
- type = types.path;
- default = pulseaudio;
- example = literalExample "pulseaudio.override { jackaudioSupport = true; }";
+ type = types.package;
+ default = pulseaudioFull;
+ example = literalExample "pulseaudioFull";
description = ''
- The PulseAudio derivation to use. This can be used to enable
- features (such as JACK support) that are not enabled in the
- default PulseAudio in Nixpkgs.
+ The PulseAudio derivation to use. This can be used to disable
+ features (such as JACK support, Bluetooth) that are enabled in the
+ pulseaudioFull package in Nixpkgs.
'';
};
+
+ daemon = {
+ logLevel = mkOption {
+ type = types.str;
+ default = "notice";
+ description = ''
+ The log level that the system-wide pulseaudio daemon should use,
+ if activated.
+ '';
+ };
+ };
};
};
@@ -111,38 +124,37 @@ in {
security.rtkit.enable = true;
})
- (mkIf (cfg.enable && !cfg.systemWide) {
+ (mkIf nonSystemWide {
environment.etc = singleton {
target = "pulse/default.pa";
source = cfg.configFile;
};
})
- (mkIf (cfg.enable && cfg.systemWide) {
+ (mkIf systemWide {
users.extraUsers.pulse = {
# For some reason, PulseAudio wants UID == GID.
uid = assert uid == gid; uid;
group = "pulse";
extraGroups = [ "audio" ];
description = "PulseAudio system service user";
- home = pulseRuntimePath;
};
users.extraGroups.pulse.gid = gid;
systemd.services.pulseaudio = {
- description = "PulseAudio system-wide server";
+ description = "PulseAudio System-Wide Server";
wantedBy = [ "sound.target" ];
before = [ "sound.target" ];
- path = [ cfg.package ];
- environment.PULSE_RUNTIME_PATH = pulseRuntimePath;
+ environment.PULSE_RUNTIME_PATH = stateDir;
preStart = ''
- mkdir -p --mode 755 ${pulseRuntimePath}
- chown -R pulse:pulse ${pulseRuntimePath}
- '';
- script = ''
- exec pulseaudio --system -n --file="${cfg.configFile}"
+ mkdir -p --mode 755 ${stateDir}
+ chown -R pulse:pulse ${stateDir}
'';
+ serviceConfig = {
+ ExecStart = "${cfg.package}/bin/pulseaudio -D --log-level=${cfg.daemon.logLevel} --system --use-pid-file -n --file=${cfg.configFile}";
+ PIDFile = "${stateDir}/pid";
+ };
};
})
];
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index e3fbdd7aaec..cc079cdc585 100644
--- a/nixos/modules/config/shells-environment.nix
+++ b/nixos/modules/config/shells-environment.nix
@@ -1,9 +1,9 @@
# This module defines a global environment configuration and
# a common configuration for all shells.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -19,6 +19,7 @@ in
default = {};
description = ''
A set of environment variables used in the global environment.
+ These variables will be set on shell initialisation.
The value of each variable can be either a string or a list of
strings. The latter is concatenated, interspersed with colon
characters.
@@ -31,9 +32,9 @@ in
res = (head defs').value;
in
if isList res then concatLists (getValues defs')
- else if builtins.lessThan 1 (length defs') then
+ else if lessThan 1 (length defs') then
throw "The option `${showOption loc}' is defined multiple times, in ${showFiles (getFiles defs)}."
- else if !builtins.isString res then
+ else if !isString res then
throw "The option `${showOption loc}' does not have a string value, in ${showFiles (getFiles defs)}."
else res;
});
@@ -148,6 +149,12 @@ in
system.build.binsh = pkgs.bashInteractive;
+ # Set session variables in the shell as well. This is usually
+ # unnecessary, but it allows changes to session variables to take
+ # effect without restarting the session (e.g. by opening a new
+ # terminal instead of logging out of X11).
+ environment.variables = config.environment.sessionVariables;
+
environment.etc."shells".text =
''
${concatStringsSep "\n" cfg.shells}
diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix
index 65d7722abfa..1dc7ebb96af 100644
--- a/nixos/modules/config/swap.nix
+++ b/nixos/modules/config/swap.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, utils, ... }:
+{ config, lib, pkgs, utils, ... }:
-with pkgs.lib;
with utils;
+with lib;
{
@@ -106,6 +106,7 @@ with utils;
if [ ! -e "${sw.device}" ]; then
fallocate -l ${toString sw.size}M "${sw.device}" ||
dd if=/dev/zero of="${sw.device}" bs=1M count=${toString sw.size}
+ chmod 0600 ${sw.device}
mkswap ${sw.device}
fi
'';
diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix
index 31441bad615..3b6ccd380c7 100644
--- a/nixos/modules/config/sysctl.nix
+++ b/nixos/modules/config/sysctl.nix
@@ -1,13 +1,17 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
sysctlOption = mkOptionType {
name = "sysctl option value";
- check = x: builtins.isBool x || builtins.isString x || builtins.isInt x;
- merge = args: defs: (last defs).value; # FIXME: hacky way to allow overriding in configuration.nix.
+ check = val:
+ let
+ checkType = x: isBool x || isString x || isInt x || isNull x;
+ in
+ checkType val || (val._type or "" == "override" && checkType val.content);
+ merge = loc: defs: mergeOneOption loc (filterOverrides defs);
};
in
@@ -29,8 +33,9 @@ in
8. Note that sysctl
parameters names must be enclosed in quotes
(e.g. "vm.swappiness" instead of
- vm.swappiness). The value of each parameter
- may be a string, integer or Boolean.
+ vm.swappiness). The value of each
+ parameter may be a string, integer, boolean, or null
+ (signifying the option will not appear at all).
'';
};
@@ -39,19 +44,13 @@ in
config = {
environment.etc."sysctl.d/nixos.conf".text =
- concatStrings (mapAttrsToList (n: v: "${n}=${if v == false then "0" else toString v}\n") config.boot.kernel.sysctl);
+ concatStrings (mapAttrsToList (n: v:
+ optionalString (v != null) "${n}=${if v == false then "0" else toString v}\n"
+ ) config.boot.kernel.sysctl);
systemd.services.systemd-sysctl =
- { description = "Apply Kernel Variables";
- before = [ "sysinit.target" "shutdown.target" ];
- wantedBy = [ "sysinit.target" "multi-user.target" ];
+ { wantedBy = [ "multi-user.target" ];
restartTriggers = [ config.environment.etc."sysctl.d/nixos.conf".source ];
- unitConfig.DefaultDependencies = false; # needed to prevent a cycle
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = true;
- ExecStart = "${config.systemd.package}/lib/systemd/systemd-sysctl";
- };
};
# Enable hardlink and symlink restrictions. See
@@ -62,8 +61,9 @@ in
# Hide kernel pointers (e.g. in /proc/modules) for unprivileged
# users as these make it easier to exploit kernel vulnerabilities.
- boot.kernel.sysctl."kernel.kptr_restrict" = 1;
-
+ #
+ # Removed under grsecurity.
+ boot.kernel.sysctl."kernel.kptr_restrict" =
+ if config.security.grsecurity.enable then null else 1;
};
-
}
diff --git a/nixos/modules/config/system-environment.nix b/nixos/modules/config/system-environment.nix
new file mode 100644
index 00000000000..3ab32f00fd1
--- /dev/null
+++ b/nixos/modules/config/system-environment.nix
@@ -0,0 +1,56 @@
+# This module defines a system-wide environment that will be
+# initialised by pam_env (that is, not only in shells).
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.environment;
+
+in
+
+{
+
+ options = {
+
+ environment.sessionVariables = mkOption {
+ default = {};
+ description = ''
+ A set of environment variables used in the global environment.
+ These variables will be set by PAM.
+ The value of each variable can be either a string or a list of
+ strings. The latter is concatenated, interspersed with colon
+ characters.
+ '';
+ type = types.attrsOf (mkOptionType {
+ name = "a string or a list of strings";
+ merge = loc: defs:
+ let
+ defs' = filterOverrides defs;
+ res = (head defs').value;
+ in
+ if isList res then concatLists (getValues defs')
+ else if lessThan 1 (length defs') then
+ throw "The option `${showOption loc}' is defined multiple times, in ${showFiles (getFiles defs)}."
+ else if !isString res then
+ throw "The option `${showOption loc}' does not have a string value, in ${showFiles (getFiles defs)}."
+ else res;
+ });
+ apply = mapAttrs (n: v: if isList v then concatStringsSep ":" v else v);
+ };
+
+ };
+
+ config = {
+
+ system.build.pamEnvironment = pkgs.writeText "pam-environment"
+ ''
+ ${concatStringsSep "\n" (
+ (mapAttrsToList (n: v: ''${n}="${concatStringsSep ":" v}"'')
+ (zipAttrsWith (const concatLists) ([ (mapAttrs (n: v: [ v ]) cfg.sessionVariables) ]))))}
+ '';
+
+ };
+
+}
diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix
index 2f61947c3bc..6b4c38172e9 100644
--- a/nixos/modules/config/system-path.nix
+++ b/nixos/modules/config/system-path.nix
@@ -1,9 +1,9 @@
# This module defines the packages that appear in
# /run/current-system/sw.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -46,6 +46,7 @@ let
pkgs.rsync
pkgs.strace
pkgs.sysvtools
+ pkgs.su
pkgs.time
pkgs.usbutils
pkgs.utillinux
@@ -109,6 +110,7 @@ in
"/man"
"/sbin"
"/share/emacs"
+ "/share/vim-plugins"
"/share/org"
"/share/info"
"/share/terminfo"
@@ -134,6 +136,10 @@ in
if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
$out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
fi
+
+ if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then
+ $out/bin/update-desktop-database $out/share/applications
+ fi
'';
};
diff --git a/nixos/modules/config/timezone.nix b/nixos/modules/config/timezone.nix
index 07a76d9ad1f..c8592284077 100644
--- a/nixos/modules/config/timezone.nix
+++ b/nixos/modules/config/timezone.nix
@@ -1,6 +1,12 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
+
+let
+
+ tzdir = "${pkgs.tzdata}/share/zoneinfo";
+
+in
{
options = {
@@ -24,10 +30,14 @@ with pkgs.lib;
config = {
- environment.variables.TZDIR = "/etc/zoneinfo";
- environment.variables.TZ = config.time.timeZone;
+ environment.sessionVariables.TZDIR = "/etc/zoneinfo";
- environment.etc.localtime.source = "${pkgs.tzdata}/share/zoneinfo/${config.time.timeZone}";
+ systemd.globalEnvironment.TZDIR = tzdir;
+
+ environment.etc.localtime =
+ { source = "${tzdir}/${config.time.timeZone}";
+ mode = "direct-symlink";
+ };
environment.etc.zoneinfo.source = "${pkgs.tzdata}/share/zoneinfo";
diff --git a/nixos/modules/config/unix-odbc-drivers.nix b/nixos/modules/config/unix-odbc-drivers.nix
index 0f608469058..98929392ace 100644
--- a/nixos/modules/config/unix-odbc-drivers.nix
+++ b/nixos/modules/config/unix-odbc-drivers.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
# unixODBC drivers (this solution is not perfect.. Because the user has to
# ask the admin to add a driver.. but it's simple and works
@@ -27,7 +27,7 @@ with pkgs.lib;
environment.etc."odbcinst.ini".text =
let inis = config.environment.unixODBCDrivers;
- in pkgs.lib.concatStringsSep "\n" inis;
+ in lib.concatStringsSep "\n" inis;
};
diff --git a/nixos/modules/config/update-users-groups.pl b/nixos/modules/config/update-users-groups.pl
new file mode 100644
index 00000000000..197b65e27c4
--- /dev/null
+++ b/nixos/modules/config/update-users-groups.pl
@@ -0,0 +1,239 @@
+use strict;
+use File::Path qw(make_path);
+use File::Slurp;
+use JSON;
+
+make_path("/var/lib/nixos", { mode => 0755 });
+
+
+# Functions for allocating free GIDs/UIDs. FIXME: respect ID ranges in
+# /etc/login.defs.
+sub allocId {
+ my ($used, $idMin, $idMax, $up, $getid) = @_;
+ my $id = $up ? $idMin : $idMax;
+ while ($id >= $idMin && $id <= $idMax) {
+ if (!$used->{$id} && !defined &$getid($id)) {
+ $used->{$id} = 1;
+ return $id;
+ }
+ $used->{$id} = 1;
+ if ($up) { $id++; } else { $id--; }
+ }
+ die "$0: out of free UIDs or GIDs\n";
+}
+
+my (%gidsUsed, %uidsUsed);
+
+sub allocGid {
+ return allocId(\%gidsUsed, 400, 499, 0, sub { my ($gid) = @_; getgrgid($gid) });
+}
+
+sub allocUid {
+ my ($isSystemUser) = @_;
+ my ($min, $max, $up) = $isSystemUser ? (400, 499, 0) : (1000, 29999, 1);
+ return allocId(\%uidsUsed, $min, $max, $up, sub { my ($uid) = @_; getpwuid($uid) });
+}
+
+
+# Read the declared users/groups.
+my $spec = decode_json(read_file($ARGV[0]));
+
+# Don't allocate UIDs/GIDs that are already in use.
+foreach my $g (@{$spec->{groups}}) {
+ $gidsUsed{$g->{gid}} = 1 if defined $g->{gid};
+}
+
+foreach my $u (@{$spec->{groups}}) {
+ $uidsUsed{$u->{u}} = 1 if defined $u->{uid};
+}
+
+# Read the current /etc/group.
+sub parseGroup {
+ chomp;
+ my @f = split(':', $_, -4);
+ my $gid = $f[2] eq "" ? undef : int($f[2]);
+ $gidsUsed{$gid} = 1 if defined $gid;
+ return ($f[0], { name => $f[0], password => $f[1], gid => $gid, members => $f[3] });
+}
+
+my %groupsCur = -f "/etc/group" ? map { parseGroup } read_file("/etc/group") : ();
+
+# Read the current /etc/passwd.
+sub parseUser {
+ chomp;
+ my @f = split(':', $_, -7);
+ my $uid = $f[2] eq "" ? undef : int($f[2]);
+ $uidsUsed{$uid} = 1 if defined $uid;
+ return ($f[0], { name => $f[0], fakePassword => $f[1], uid => $uid,
+ gid => $f[3], description => $f[4], home => $f[5], shell => $f[6] });
+}
+
+my %usersCur = -f "/etc/passwd" ? map { parseUser } read_file("/etc/passwd") : ();
+
+# Read the groups that were created declaratively (i.e. not by groups)
+# in the past. These must be removed if they are no longer in the
+# current spec.
+my $declGroupsFile = "/var/lib/nixos/declarative-groups";
+my %declGroups;
+$declGroups{$_} = 1 foreach split / /, -e $declGroupsFile ? read_file($declGroupsFile) : "";
+
+# Idem for the users.
+my $declUsersFile = "/var/lib/nixos/declarative-users";
+my %declUsers;
+$declUsers{$_} = 1 foreach split / /, -e $declUsersFile ? read_file($declUsersFile) : "";
+
+
+# Generate a new /etc/group containing the declared groups.
+my %groupsOut;
+foreach my $g (@{$spec->{groups}}) {
+ my $name = $g->{name};
+ my $existing = $groupsCur{$name};
+
+ my %members = map { ($_, 1) } @{$g->{members}};
+
+ if (defined $existing) {
+ $g->{gid} = $existing->{gid} if !defined $g->{gid};
+ if ($g->{gid} != $existing->{gid}) {
+ warn "warning: not applying GID change of group ‘$name’\n";
+ $g->{gid} = $existing->{gid};
+ }
+ $g->{password} = $existing->{password}; # do we want this?
+ if ($spec->{mutableUsers}) {
+ # Merge in non-declarative group members.
+ foreach my $uname (split /,/, $existing->{members} // "") {
+ $members{$uname} = 1 if !defined $declUsers{$uname};
+ }
+ }
+ } else {
+ $g->{gid} = allocGid if !defined $g->{gid};
+ $g->{password} = "x";
+ }
+
+ $g->{members} = join ",", sort(keys(%members));
+ $groupsOut{$name} = $g;
+}
+
+# Update the persistent list of declarative groups.
+write_file($declGroupsFile, join(" ", sort(keys %groupsOut)));
+
+# Merge in the existing /etc/group.
+foreach my $name (keys %groupsCur) {
+ my $g = $groupsCur{$name};
+ next if defined $groupsOut{$name};
+ if (!$spec->{mutableUsers} || defined $declGroups{$name}) {
+ print STDERR "removing group ‘$name’\n";
+ } else {
+ $groupsOut{$name} = $g;
+ }
+}
+
+
+# Rewrite /etc/group. FIXME: acquire lock.
+my @lines = map { join(":", $_->{name}, $_->{password}, $_->{gid}, $_->{members}) . "\n" }
+ (sort { $a->{gid} <=> $b->{gid} } values(%groupsOut));
+write_file("/etc/group.tmp", @lines);
+rename("/etc/group.tmp", "/etc/group") or die;
+system("nscd --invalidate group");
+
+# Generate a new /etc/passwd containing the declared users.
+my %usersOut;
+foreach my $u (@{$spec->{users}}) {
+ my $name = $u->{name};
+
+ # Resolve the gid of the user.
+ if ($u->{group} =~ /^[0-9]$/) {
+ $u->{gid} = $u->{group};
+ } elsif (defined $groupsOut{$u->{group}}) {
+ $u->{gid} = $groupsOut{$u->{group}}->{gid} // die;
+ } else {
+ warn "warning: user ‘$name’ has unknown group ‘$u->{group}’\n";
+ $u->{gid} = 65534;
+ }
+
+ my $existing = $usersCur{$name};
+ if (defined $existing) {
+ $u->{uid} = $existing->{uid} if !defined $u->{uid};
+ if ($u->{uid} != $existing->{uid}) {
+ warn "warning: not applying UID change of user ‘$name’\n";
+ $u->{uid} = $existing->{uid};
+ }
+ } else {
+ $u->{uid} = allocUid($u->{isSystemUser}) if !defined $u->{uid};
+
+ # Create a home directory.
+ if ($u->{createHome}) {
+ make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home};
+ chown $u->{uid}, $u->{gid}, $u->{home};
+ }
+ }
+
+ if (defined $u->{passwordFile}) {
+ if (-e $u->{passwordFile}) {
+ $u->{hashedPassword} = read_file($u->{passwordFile});
+ chomp $u->{hashedPassword};
+ } else {
+ warn "warning: password file ‘$u->{passwordFile}’ does not exist\n";
+ }
+ }
+
+ $u->{fakePassword} = $existing->{fakePassword} // "x";
+ $usersOut{$name} = $u;
+}
+
+# Update the persistent list of declarative users.
+write_file($declUsersFile, join(" ", sort(keys %usersOut)));
+
+# Merge in the existing /etc/passwd.
+foreach my $name (keys %usersCur) {
+ my $u = $usersCur{$name};
+ next if defined $usersOut{$name};
+ if (!$spec->{mutableUsers} || defined $declUsers{$name}) {
+ print STDERR "removing user ‘$name’\n";
+ } else {
+ $usersOut{$name} = $u;
+ }
+}
+
+# Rewrite /etc/passwd. FIXME: acquire lock.
+@lines = map { join(":", $_->{name}, $_->{fakePassword}, $_->{uid}, $_->{gid}, $_->{description}, $_->{home}, $_->{shell}) . "\n" }
+ (sort { $a->{uid} <=> $b->{uid} } (values %usersOut));
+write_file("/etc/passwd.tmp", @lines);
+rename("/etc/passwd.tmp", "/etc/passwd") or die;
+system("nscd --invalidate passwd");
+
+
+# Rewrite /etc/shadow to add new accounts or remove dead ones.
+my @shadowNew;
+my %shadowSeen;
+
+foreach my $line (-f "/etc/shadow" ? read_file("/etc/shadow") : ()) {
+ chomp $line;
+ my ($name, $password, @rest) = split(':', $line, -9);
+ my $u = $usersOut{$name};;
+ next if !defined $u;
+ $password = $u->{hashedPassword} if defined $u->{hashedPassword} && !$spec->{mutableUsers}; # FIXME
+ push @shadowNew, join(":", $name, $password, @rest) . "\n";
+ $shadowSeen{$name} = 1;
+}
+
+foreach my $u (values %usersOut) {
+ next if defined $shadowSeen{$u->{name}};
+ my $password = "!";
+ $password = $u->{hashedPassword} if defined $u->{hashedPassword};
+ # FIXME: set correct value for sp_lstchg.
+ push @shadowNew, join(":", $u->{name}, $password, "1::::::") . "\n";
+}
+
+write_file("/etc/shadow.tmp", { perms => 0600 }, @shadowNew);
+rename("/etc/shadow.tmp", "/etc/shadow") or die;
+
+
+# Call chpasswd to apply password. FIXME: generate the hashes directly
+# and merge into the /etc/shadow updating above.
+foreach my $u (@{$spec->{users}}) {
+ if (defined $u->{password}) {
+ my $pid = open(PW, "| chpasswd") or die;
+ print PW "$u->{name}:$u->{password}\n";
+ close PW or die "unable to change password of user ‘$u->{name}’: $?\n";
+ }
+}
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix
index fb8b0229c1d..afedc8e382e 100644
--- a/nixos/modules/config/users-groups.nix
+++ b/nixos/modules/config/users-groups.nix
@@ -1,11 +1,29 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
ids = config.ids;
- users = config.users;
+ cfg = config.users;
+
+ passwordDescription = ''
+ The options hashedPassword,
+ password and passwordFile
+ controls what password is set for the user.
+ hashedPassword overrides both
+ password and passwordFile.
+ password overrides passwordFile.
+ If none of these three options are set, no password is assigned to
+ the user, and the user will not be able to do password logins.
+ If the option users.mutableUsers is true, the
+ password defined in one of the three options will only be set when
+ the user is created for the first time. After that, you are free to
+ change the password with the ordinary user management commands. If
+ users.mutableUsers is false, you cannot change
+ user passwords, they will always be set according to the password
+ options.
+ '';
userOpts = { name, config, ... }: {
@@ -13,7 +31,10 @@ let
name = mkOption {
type = types.str;
- description = "The name of the user account. If undefined, the name of the attribute set will be used.";
+ description = ''
+ The name of the user account. If undefined, the name of the
+ attribute set will be used.
+ '';
};
description = mkOption {
@@ -28,9 +49,40 @@ let
};
uid = mkOption {
- type = with types; uniq (nullOr int);
+ type = with types; nullOr int;
default = null;
- description = "The account UID. If undefined, NixOS will select a free UID.";
+ description = ''
+ The account UID. If the UID is null, a free UID is picked on
+ activation.
+ '';
+ };
+
+ isSystemUser = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Indicates if the user is a system user or not. This option
+ only has an effect if is
+ , in which case it determines whether
+ the user's UID is allocated in the range for system users
+ (below 500) or in the range for normal users (starting at
+ 1000).
+ '';
+ };
+
+ isNormalUser = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Indicates whether this is an account for a “real” user. This
+ automatically sets to
+ users, to
+ true, to
+ /home/username,
+ to true,
+ and to
+ false.
+ '';
};
group = mkOption {
@@ -60,56 +112,69 @@ let
createHome = mkOption {
type = types.bool;
default = false;
- description = "If true, the home directory will be created automatically.";
+ description = ''
+ If true, the home directory will be created automatically. If this
+ option is true and the home directory already exists but is not
+ owned by the user, directory owner and group will be changed to
+ match the user.
+ '';
};
useDefaultShell = mkOption {
type = types.bool;
default = false;
- description = "If true, the user's shell will be set to users.defaultUserShell.";
+ description = ''
+ If true, the user's shell will be set to
+ cfg.defaultUserShell.
+ '';
+ };
+
+ hashedPassword = mkOption {
+ type = with types; uniq (nullOr str);
+ default = null;
+ description = ''
+ Specifies the (hashed) password for the user.
+ ${passwordDescription}
+ '';
};
password = mkOption {
type = with types; uniq (nullOr str);
default = null;
description = ''
- The user's password. If undefined, no password is set for
- the user. Warning: do not set confidential information here
- because it is world-readable in the Nix store. This option
- should only be used for public accounts such as
- guest.
+ Specifies the (clear text) password for the user.
+ Warning: do not set confidential information here
+ because it is world-readable in the Nix store. This option
+ should only be used for public accounts.
+ ${passwordDescription}
'';
};
- isSystemUser = mkOption {
- type = types.bool;
- default = true;
- description = "Indicates if the user is a system user or not.";
- };
-
- createUser = mkOption {
- type = types.bool;
- default = true;
+ passwordFile = mkOption {
+ type = with types; uniq (nullOr string);
+ default = null;
description = ''
- Indicates if the user should be created automatically as a local user.
- Set this to false if the user for instance is an LDAP user. NixOS will
- then not modify any of the basic properties for the user account.
+ The path to a file that contains the user's password. The password
+ file is read on each system activation. The file should contain
+ exactly one line, which should be the password in an encrypted form
+ that is suitable for the chpasswd -e command.
+ ${passwordDescription}
'';
};
-
- isAlias = mkOption {
- type = types.bool;
- default = false;
- description = "If true, the UID of this user is not required to be unique and can thus alias another user.";
- };
-
};
- config = {
- name = mkDefault name;
- uid = mkDefault (attrByPath [name] null ids.uids);
- shell = mkIf config.useDefaultShell (mkDefault users.defaultUserShell);
- };
+ config = mkMerge
+ [ { name = mkDefault name;
+ shell = mkIf config.useDefaultShell (mkDefault cfg.defaultUserShell);
+ }
+ (mkIf config.isNormalUser {
+ group = mkDefault "users";
+ createHome = mkDefault true;
+ home = mkDefault "/home/${name}";
+ useDefaultShell = mkDefault true;
+ isSystemUser = mkDefault false;
+ })
+ ];
};
@@ -119,41 +184,102 @@ let
name = mkOption {
type = types.str;
- description = "The name of the group. If undefined, the name of the attribute set will be used.";
+ description = ''
+ The name of the group. If undefined, the name of the attribute set
+ will be used.
+ '';
};
gid = mkOption {
- type = with types; uniq (nullOr int);
+ type = with types; nullOr int;
default = null;
- description = "The GID of the group. If undefined, NixOS will select a free GID.";
+ description = ''
+ The group GID. If the GID is null, a free GID is picked on
+ activation.
+ '';
+ };
+
+ members = mkOption {
+ type = with types; listOf string;
+ default = [];
+ description = ''
+ The user names of the group members, added to the
+ /etc/group file.
+ '';
};
};
config = {
name = mkDefault name;
- gid = mkDefault (attrByPath [name] null ids.gids);
};
};
- # Note: the 'X' in front of the password is to distinguish between
- # having an empty password, and not having a password.
- serializedUser = u: "${u.name}\n${u.description}\n${if u.uid != null then toString u.uid else ""}\n${u.group}\n${toString (concatStringsSep "," u.extraGroups)}\n${u.home}\n${u.shell}\n${toString u.createHome}\n${if u.password != null then "X" + u.password else ""}\n${toString u.isSystemUser}\n${toString u.createUser}\n${toString u.isAlias}\n";
-
- usersFile = pkgs.writeText "users" (
+ idsAreUnique = set: idAttr: !(fold (name: args@{ dup, acc }:
let
- p = partition (u: u.isAlias) (attrValues config.users.extraUsers);
- in concatStrings (map serializedUser p.wrong ++ map serializedUser p.right));
+ id = builtins.toString (builtins.getAttr idAttr (builtins.getAttr name set));
+ exists = builtins.hasAttr id acc;
+ newAcc = acc // (builtins.listToAttrs [ { name = id; value = true; } ]);
+ in if dup then args else if exists
+ then builtins.trace "Duplicate ${idAttr} ${id}" { dup = true; acc = null; }
+ else { dup = false; acc = newAcc; }
+ ) { dup = false; acc = {}; } (builtins.attrNames set)).dup;
-in
+ uidsAreUnique = idsAreUnique (filterAttrs (n: u: u.uid != null) cfg.extraUsers) "uid";
+ gidsAreUnique = idsAreUnique (filterAttrs (n: g: g.gid != null) cfg.extraGroups) "gid";
-{
+ spec = builtins.toFile "users-groups.json" (builtins.toJSON {
+ inherit (cfg) mutableUsers;
+ users = mapAttrsToList (n: u:
+ { inherit (u)
+ name uid group description home shell createHome isSystemUser
+ password passwordFile hashedPassword;
+ }) cfg.extraUsers;
+ groups = mapAttrsToList (n: g:
+ { inherit (g) name gid;
+ members = mapAttrsToList (n: u: u.name) (
+ filterAttrs (n: u: elem g.name u.extraGroups) cfg.extraUsers
+ );
+ }) cfg.extraGroups;
+ });
+
+in {
###### interface
options = {
+ users.mutableUsers = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ If true, you are free to add new users and groups to the system
+ with the ordinary useradd and
+ groupadd commands. On system activation, the
+ existing contents of the /etc/passwd and
+ /etc/group files will be merged with the
+ contents generated from the users.extraUsers and
+ users.extraGroups options. If
+ mutableUsers is false, the contents of the user and
+ group files will simply be replaced on system activation. This also
+ holds for the user passwords; if this option is false, all changed
+ passwords will be reset according to the
+ users.extraUsers configuration on activation. If
+ this option is true, the initial password for a user will be set
+ according to users.extraUsers, but existing passwords
+ will not be changed.
+ '';
+ };
+
+ users.enforceIdUniqueness = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Whether to require that no two users/groups share the same uid/gid.
+ '';
+ };
+
users.extraUsers = mkOption {
default = {};
type = types.loaOf types.optionSet;
@@ -188,6 +314,26 @@ in
options = [ groupOpts ];
};
+ security.initialRootPassword = mkOption {
+ type = types.str;
+ default = "!";
+ example = "";
+ description = ''
+ The (hashed) password for the root account set on initial
+ installation. The empty string denotes that root can login
+ locally without a password (but not via remote services such
+ as SSH, or indirectly via su or
+ sudo). The string !
+ prevents root from logging in using a password.
+ Note that setting this option sets
+ users.extraUsers.root.hashedPassword.
+ Also, if users.mutableUsers is false
+ you cannot change the root password manually, so in that case
+ the name of this option is a bit misleading, since it will define
+ the root password beyond the user initialisation phase.
+ '';
+ };
+
};
@@ -197,128 +343,59 @@ in
users.extraUsers = {
root = {
+ uid = ids.uids.root;
description = "System administrator";
home = "/root";
- shell = config.users.defaultUserShell;
+ shell = mkDefault cfg.defaultUserShell;
group = "root";
+ extraGroups = [ "grsecurity" ];
+ hashedPassword = mkDefault config.security.initialRootPassword;
};
nobody = {
+ uid = ids.uids.nobody;
description = "Unprivileged account (don't use!)";
+ group = "nogroup";
};
};
users.extraGroups = {
- root = { };
- wheel = { };
- disk = { };
- kmem = { };
- tty = { };
- floppy = { };
- uucp = { };
- lp = { };
- cdrom = { };
- tape = { };
- audio = { };
- video = { };
- dialout = { };
- nogroup = { };
- users = { };
- nixbld = { };
- utmp = { };
- adm = { }; # expected by journald
+ root.gid = ids.gids.root;
+ wheel.gid = ids.gids.wheel;
+ disk.gid = ids.gids.disk;
+ kmem.gid = ids.gids.kmem;
+ tty.gid = ids.gids.tty;
+ floppy.gid = ids.gids.floppy;
+ uucp.gid = ids.gids.uucp;
+ lp.gid = ids.gids.lp;
+ cdrom.gid = ids.gids.cdrom;
+ tape.gid = ids.gids.tape;
+ audio.gid = ids.gids.audio;
+ video.gid = ids.gids.video;
+ dialout.gid = ids.gids.dialout;
+ nogroup.gid = ids.gids.nogroup;
+ users.gid = ids.gids.users;
+ nixbld.gid = ids.gids.nixbld;
+ utmp.gid = ids.gids.utmp;
+ adm.gid = ids.gids.adm;
+ grsecurity.gid = ids.gids.grsecurity;
};
- system.activationScripts.rootPasswd = stringAfter [ "etc" ]
+ system.activationScripts.users = stringAfter [ "etc" ]
''
- # If there is no password file yet, create a root account with an
- # empty password.
- if ! test -e /etc/passwd; then
- rootHome=/root
- touch /etc/passwd; chmod 0644 /etc/passwd
- touch /etc/group; chmod 0644 /etc/group
- touch /etc/shadow; chmod 0600 /etc/shadow
- # Can't use useradd, since it complains that it doesn't know us
- # (bootstrap problem!).
- echo "root:x:0:0:System administrator:$rootHome:${config.users.defaultUserShell}" >> /etc/passwd
- echo "root::::::::" >> /etc/shadow
- fi
+ ${pkgs.perl}/bin/perl -w \
+ -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl \
+ -I${pkgs.perlPackages.JSON}/lib/perl5/site_perl \
+ ${./update-users-groups.pl} ${spec}
'';
- system.activationScripts.users = stringAfter [ "groups" ]
- ''
- echo "updating users..."
+ # for backwards compatibility
+ system.activationScripts.groups = stringAfter [ "users" ] "";
- cat ${usersFile} | while true; do
- read name || break
- read description
- read uid
- read group
- read extraGroups
- read home
- read shell
- read createHome
- read password
- read isSystemUser
- read createUser
- read isAlias
-
- if [ -z "$createUser" ]; then
- continue
- fi
-
- if ! curEnt=$(getent passwd "$name"); then
- useradd ''${isSystemUser:+--system} \
- --comment "$description" \
- ''${uid:+--uid $uid} \
- --gid "$group" \
- --groups "$extraGroups" \
- --home "$home" \
- --shell "$shell" \
- ''${createHome:+--create-home} \
- ''${isAlias:+--non-unique} \
- "$name"
- if test "''${password:0:1}" = 'X'; then
- (echo "''${password:1}"; echo "''${password:1}") | ${pkgs.shadow}/bin/passwd "$name"
- fi
- else
- #echo "updating user $name..."
- oldIFS="$IFS"; IFS=:; set -- $curEnt; IFS="$oldIFS"
- prevUid=$3
- prevHome=$6
- # Don't change the home directory if it's the same to prevent
- # unnecessary warnings about logged in users.
- if test "$prevHome" = "$home"; then unset home; fi
- usermod \
- --comment "$description" \
- --gid "$group" \
- --groups "$extraGroups" \
- ''${home:+--home "$home"} \
- --shell "$shell" \
- "$name"
- fi
-
- done
- '';
-
- system.activationScripts.groups = stringAfter [ "rootPasswd" "binsh" "etc" "var" ]
- ''
- echo "updating groups..."
-
- createGroup() {
- name="$1"
- gid="$2"
-
- if ! curEnt=$(getent group "$name"); then
- groupadd --system \
- ''${gid:+--gid $gid} \
- "$name"
- fi
- }
-
- ${flip concatMapStrings (attrValues config.users.extraGroups) (g: ''
- createGroup '${g.name}' '${toString g.gid}'
- '')}
- '';
+ assertions = [
+ { assertion = !cfg.enforceIdUniqueness || (uidsAreUnique && gidsAreUnique);
+ message = "UIDs and GIDs must be unique!";
+ }
+ ];
};
diff --git a/nixos/modules/config/zram.nix b/nixos/modules/config/zram.nix
new file mode 100644
index 00000000000..22b74847f87
--- /dev/null
+++ b/nixos/modules/config/zram.nix
@@ -0,0 +1,138 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.zramSwap;
+
+ devices = map (nr: "zram${toString nr}") (range 0 (cfg.numDevices - 1));
+
+ modprobe = "${config.system.sbin.modprobe}/sbin/modprobe";
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ zramSwap = {
+
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Enable in-memory compressed swap space provided by the zram kernel
+ module. It is recommended to enable only for kernel 3.14 or higher.
+ '';
+ };
+
+ numDevices = mkOption {
+ default = 4;
+ type = types.int;
+ description = ''
+ Number of zram swap devices to create. It should be equal to the
+ number of CPU cores your system has.
+ '';
+ };
+
+ memoryPercent = mkOption {
+ default = 50;
+ type = types.int;
+ description = ''
+ Maximum amount of memory that can be used by the zram swap devices
+ (as a percentage of your total memory). Defaults to 1/2 of your total
+ RAM.
+ '';
+ };
+
+ priority = mkOption {
+ default = 5;
+ type = types.int;
+ description = ''
+ Priority of the zram swap devices. It should be a number higher than
+ the priority of your disk-based swap devices (so that the system will
+ fill the zram swap devices before falling back to disk swap).
+ '';
+ };
+
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ system.requiredKernelConfig = with config.lib.kernelConfig; [
+ (isModule "ZRAM")
+ ];
+
+ # Disabling this for the moment, as it would create and mkswap devices twice,
+ # once in stage 2 boot, and again when the zram-reloader service starts.
+ # boot.kernelModules = [ "zram" ];
+
+ boot.extraModprobeConfig = ''
+ options zram num_devices=${toString cfg.numDevices}
+ '';
+
+ services.udev.extraRules = ''
+ KERNEL=="zram[0-9]*", ENV{SYSTEMD_WANTS}="zram-init-%k.service", TAG+="systemd"
+ '';
+
+ systemd.services =
+ let
+ createZramInitService = dev:
+ nameValuePair "zram-init-${dev}" {
+ description = "Init swap on zram-based device ${dev}";
+ bindsTo = [ "dev-${dev}.swap" ];
+ after = [ "dev-${dev}.device" "zram-reloader.service" ];
+ requires = [ "dev-${dev}.device" "zram-reloader.service" ];
+ before = [ "dev-${dev}.swap" ];
+ requiredBy = [ "dev-${dev}.swap" ];
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ ExecStop = "${pkgs.stdenv.shell} -c 'echo 1 > /sys/class/block/${dev}/reset'";
+ };
+ script = ''
+ set -u
+ set -o pipefail
+
+ PATH=${pkgs.procps}/bin:${pkgs.gnugrep}/bin:${pkgs.gnused}/bin
+
+ # Calculate memory to use for zram
+ totalmem=$(free | grep -e "^Mem:" | sed -e 's/^Mem: *//' -e 's/ *.*//')
+ mem=$(((totalmem * ${toString cfg.memoryPercent} / 100 / ${toString cfg.numDevices}) * 1024))
+
+ echo $mem > /sys/class/block/${dev}/disksize
+ ${pkgs.utillinux}/sbin/mkswap /dev/${dev}
+ '';
+ restartIfChanged = false;
+ };
+ in listToAttrs ((map createZramInitService devices) ++ [(nameValuePair "zram-reloader"
+ {
+ description = "Reload zram kernel module when number of devices changes";
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ ExecStartPre = "${modprobe} -r zram";
+ ExecStart = "${modprobe} zram";
+ ExecStop = "${modprobe} -r zram";
+ };
+ restartTriggers = [ cfg.numDevices ];
+ restartIfChanged = true;
+ })]);
+
+ swapDevices =
+ let
+ useZramSwap = dev:
+ {
+ device = "/dev/${dev}";
+ priority = cfg.priority;
+ };
+ in map useZramSwap devices;
+
+ };
+
+}
diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix
index 027dd827b4d..3820a95b12e 100644
--- a/nixos/modules/hardware/all-firmware.nix
+++ b/nixos/modules/hardware/all-firmware.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/hardware/cpu/amd-microcode.nix b/nixos/modules/hardware/cpu/amd-microcode.nix
index 5720a63834f..86a3df5da21 100644
--- a/nixos/modules/hardware/cpu/amd-microcode.nix
+++ b/nixos/modules/hardware/cpu/amd-microcode.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/hardware/cpu/intel-microcode.nix b/nixos/modules/hardware/cpu/intel-microcode.nix
index 9046ddf83bb..800c391b293 100644
--- a/nixos/modules/hardware/cpu/intel-microcode.nix
+++ b/nixos/modules/hardware/cpu/intel-microcode.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/hardware/network/b43.nix b/nixos/modules/hardware/network/b43.nix
index 8f45bd4d3f1..e63f2d04d1a 100644
--- a/nixos/modules/hardware/network/b43.nix
+++ b/nixos/modules/hardware/network/b43.nix
@@ -1,4 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
+
+with lib;
let kernelVersion = config.boot.kernelPackages.kernel.version; in
@@ -8,9 +10,9 @@ let kernelVersion = config.boot.kernelPackages.kernel.version; in
options = {
- networking.enableB43Firmware = pkgs.lib.mkOption {
+ networking.enableB43Firmware = mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = types.bool;
description = ''
Turn on this option if you want firmware for the NICs supported by the b43 module.
'';
@@ -21,11 +23,11 @@ let kernelVersion = config.boot.kernelPackages.kernel.version; in
###### implementation
- config = pkgs.lib.mkIf config.networking.enableB43Firmware {
- assertions = [ {
- assertion = builtins.lessThan 0 (builtins.compareVersions kernelVersion "3.2");
- message = "b43 firmware for kernels older than 3.2 not packaged yet!";
- } ];
+ config = mkIf config.networking.enableB43Firmware {
+ assertions = singleton
+ { assertion = lessThan 0 (builtins.compareVersions kernelVersion "3.2");
+ message = "b43 firmware for kernels older than 3.2 not packaged yet!";
+ };
hardware.firmware = [ pkgs.b43Firmware_5_1_138 ];
};
diff --git a/nixos/modules/hardware/network/intel-2100bg.nix b/nixos/modules/hardware/network/intel-2100bg.nix
index 1e0033eb414..89fdce415dd 100644
--- a/nixos/modules/hardware/network/intel-2100bg.nix
+++ b/nixos/modules/hardware/network/intel-2100bg.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
@@ -6,9 +6,9 @@
options = {
- networking.enableIntel2100BGFirmware = pkgs.lib.mkOption {
+ networking.enableIntel2100BGFirmware = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Turn on this option if you want firmware for the Intel
PRO/Wireless 2100BG to be loaded automatically. This is
@@ -21,7 +21,7 @@
###### implementation
- config = pkgs.lib.mkIf config.networking.enableIntel2100BGFirmware {
+ config = lib.mkIf config.networking.enableIntel2100BGFirmware {
hardware.enableAllFirmware = true;
diff --git a/nixos/modules/hardware/network/intel-2200bg.nix b/nixos/modules/hardware/network/intel-2200bg.nix
index ae5b69b7981..1b70057d135 100644
--- a/nixos/modules/hardware/network/intel-2200bg.nix
+++ b/nixos/modules/hardware/network/intel-2200bg.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
@@ -6,9 +6,9 @@
options = {
- networking.enableIntel2200BGFirmware = pkgs.lib.mkOption {
+ networking.enableIntel2200BGFirmware = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Turn on this option if you want firmware for the Intel
PRO/Wireless 2200BG to be loaded automatically. This is
@@ -21,7 +21,7 @@
###### implementation
- config = pkgs.lib.mkIf config.networking.enableIntel2200BGFirmware {
+ config = lib.mkIf config.networking.enableIntel2200BGFirmware {
hardware.enableAllFirmware = true;
diff --git a/nixos/modules/hardware/network/intel-3945abg.nix b/nixos/modules/hardware/network/intel-3945abg.nix
index 80baf260ab9..f4f19d20834 100644
--- a/nixos/modules/hardware/network/intel-3945abg.nix
+++ b/nixos/modules/hardware/network/intel-3945abg.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
@@ -6,9 +6,9 @@
options = {
- networking.enableIntel3945ABGFirmware = pkgs.lib.mkOption {
+ networking.enableIntel3945ABGFirmware = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
This option enables automatic loading of the firmware for the Intel
PRO/Wireless 3945ABG.
@@ -20,7 +20,7 @@
###### implementation
- config = pkgs.lib.mkIf config.networking.enableIntel3945ABGFirmware {
+ config = lib.mkIf config.networking.enableIntel3945ABGFirmware {
hardware.enableAllFirmware = true;
diff --git a/nixos/modules/hardware/network/ralink.nix b/nixos/modules/hardware/network/ralink.nix
index 92f34d8643b..0469ae3a1fb 100644
--- a/nixos/modules/hardware/network/ralink.nix
+++ b/nixos/modules/hardware/network/ralink.nix
@@ -1,4 +1,4 @@
-{pkgs, config, ...}:
+{pkgs, config, lib, ...}:
{
@@ -6,9 +6,9 @@
options = {
- networking.enableRalinkFirmware = pkgs.lib.mkOption {
+ networking.enableRalinkFirmware = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Turn on this option if you want firmware for the RT73 NIC.
'';
@@ -19,7 +19,7 @@
###### implementation
- config = pkgs.lib.mkIf config.networking.enableRalinkFirmware {
+ config = lib.mkIf config.networking.enableRalinkFirmware {
hardware.enableAllFirmware = true;
};
diff --git a/nixos/modules/hardware/network/rtl8192c.nix b/nixos/modules/hardware/network/rtl8192c.nix
index 3aefb7bdd60..deae6355492 100644
--- a/nixos/modules/hardware/network/rtl8192c.nix
+++ b/nixos/modules/hardware/network/rtl8192c.nix
@@ -1,4 +1,4 @@
-{pkgs, config, ...}:
+{pkgs, config, lib, ...}:
{
@@ -6,9 +6,9 @@
options = {
- networking.enableRTL8192cFirmware = pkgs.lib.mkOption {
+ networking.enableRTL8192cFirmware = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Turn on this option if you want firmware for the RTL8192c (and related) NICs.
'';
@@ -19,7 +19,7 @@
###### implementation
- config = pkgs.lib.mkIf config.networking.enableRTL8192cFirmware {
+ config = lib.mkIf config.networking.enableRTL8192cFirmware {
hardware.enableAllFirmware = true;
};
diff --git a/nixos/modules/hardware/network/smc-2632w/default.nix b/nixos/modules/hardware/network/smc-2632w/default.nix
index 318131be749..650011aca81 100644
--- a/nixos/modules/hardware/network/smc-2632w/default.nix
+++ b/nixos/modules/hardware/network/smc-2632w/default.nix
@@ -1,9 +1,9 @@
-{pkgs, config, ...}:
+{lib, config, ...}:
{
hardware = {
pcmcia = {
- firmware = [ (pkgs.lib.cleanSource ./firmware) ];
+ firmware = [ (lib.cleanSource ./firmware) ];
};
};
}
diff --git a/nixos/modules/hardware/opengl.nix b/nixos/modules/hardware/opengl.nix
new file mode 100644
index 00000000000..f894c830eb6
--- /dev/null
+++ b/nixos/modules/hardware/opengl.nix
@@ -0,0 +1,125 @@
+{ config, lib, pkgs, pkgs_i686, ... }:
+
+with lib;
+
+let
+
+ cfg = config.hardware.opengl;
+
+ kernelPackages = config.boot.kernelPackages;
+
+ videoDrivers = config.services.xserver.videoDrivers;
+
+ makePackage = p: p.buildEnv {
+ name = "mesa-drivers+txc-${p.mesa_drivers.version}";
+ paths =
+ [ p.mesa_drivers
+ p.mesa_noglu # mainly for libGL
+ (if cfg.s3tcSupport then p.libtxc_dxtn else p.libtxc_dxtn_s2tc)
+ p.udev
+ ];
+ };
+
+in
+
+{
+ options = {
+ hardware.opengl.enable = mkOption {
+ description = "Whether this configuration requires OpenGL.";
+ type = types.bool;
+ default = false;
+ internal = true;
+ };
+
+ hardware.opengl.driSupport = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Whether to enable accelerated OpenGL rendering through the
+ Direct Rendering Interface (DRI).
+ '';
+ };
+
+ hardware.opengl.driSupport32Bit = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ On 64-bit systems, whether to support Direct Rendering for
+ 32-bit applications (such as Wine). This is currently only
+ supported for the nvidia driver and for
+ Mesa.
+ '';
+ };
+
+ hardware.opengl.s3tcSupport = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Make S3TC(S3 Texture Compression) via libtxc_dxtn available
+ to OpenGL drivers instead of the patent-free S2TC replacement.
+
+ Using this library may require a patent license depending on your location.
+ '';
+ };
+
+ hardware.opengl.package = mkOption {
+ type = types.package;
+ internal = true;
+ description = ''
+ The package that provides the OpenGL implementation.
+ '';
+ };
+
+ hardware.opengl.package32 = mkOption {
+ type = types.package;
+ internal = true;
+ description = ''
+ The package that provides the 32-bit OpenGL implementation on
+ 64-bit systems. Used when is
+ set.
+ '';
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ assertions = lib.singleton {
+ assertion = cfg.driSupport32Bit -> pkgs.stdenv.isx86_64;
+ message = "Option driSupport32Bit only makes sense on a 64-bit system.";
+ };
+
+ system.activationScripts.setup-opengl =
+ ''
+ ln -sfn ${cfg.package} /run/opengl-driver
+ ${if pkgs.stdenv.isi686 then ''
+ ln -sfn opengl-driver /run/opengl-driver-32
+ '' else if cfg.driSupport32Bit then ''
+ ln -sfn ${cfg.package32} /run/opengl-driver-32
+ '' else ''
+ rm -f /run/opengl-driver-32
+ ''}
+ '';
+
+ environment.sessionVariables.LD_LIBRARY_PATH =
+ [ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ];
+
+ # FIXME: move this into card-specific modules.
+ hardware.opengl.package = mkDefault
+ (if elem "ati_unfree" videoDrivers then
+ kernelPackages.ati_drivers_x11
+ else
+ makePackage pkgs);
+
+ hardware.opengl.package32 = mkDefault (makePackage pkgs_i686);
+
+ boot.extraModulePackages =
+ optional (elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions ++
+ optional (elem "ati_unfree" videoDrivers) kernelPackages.ati_drivers_x11;
+
+ environment.etc =
+ optionalAttrs (elem "ati_unfree" videoDrivers) {
+ "ati".source = "${kernelPackages.ati_drivers_x11}/etc/ati";
+ };
+ };
+}
diff --git a/nixos/modules/hardware/pcmcia.nix b/nixos/modules/hardware/pcmcia.nix
index 20684656750..d7d002ae6c8 100644
--- a/nixos/modules/hardware/pcmcia.nix
+++ b/nixos/modules/hardware/pcmcia.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/hardware/video/bumblebee.nix b/nixos/modules/hardware/video/bumblebee.nix
new file mode 100644
index 00000000000..52dea798f87
--- /dev/null
+++ b/nixos/modules/hardware/video/bumblebee.nix
@@ -0,0 +1,49 @@
+{ config, lib, pkgs, ... }:
+
+let kernel = config.boot.kernelPackages; in
+with lib;
+
+{
+
+ options = {
+ hardware.bumblebee.enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Enable the bumblebee daemon to manage Optimus hybrid video cards.
+ This should power off secondary GPU until its use is requested
+ by running an application with optirun.
+
+ Only nvidia driver is supported so far.
+ '';
+ };
+ hardware.bumblebee.group = mkOption {
+ default = "wheel";
+ example = "video";
+ type = types.uniq types.str;
+ description = ''Group for bumblebee socket'';
+ };
+ };
+
+ config = mkIf config.hardware.bumblebee.enable {
+ boot.blacklistedKernelModules = [ "nouveau" "nvidia" ];
+ boot.kernelModules = [ "bbswitch" ];
+ boot.extraModulePackages = [ kernel.bbswitch kernel.nvidia_x11 ];
+
+ environment.systemPackages = [ pkgs.bumblebee ];
+
+ systemd.services.bumblebeed = {
+ description = "Bumblebee Hybrid Graphics Switcher";
+ wantedBy = [ "display-manager.service" ];
+ script = "bumblebeed --use-syslog -g ${config.hardware.bumblebee.group}";
+ path = [ kernel.bbswitch pkgs.bumblebee ];
+ serviceConfig = {
+ Restart = "always";
+ RestartSec = 60;
+ CPUSchedulingPolicy = "idle";
+ };
+ environment.LD_LIBRARY_PATH="/run/opengl-driver/lib/";
+ environment.MODULE_DIR="/run/current-system/kernel-modules/lib/modules/";
+ };
+ };
+}
diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix
new file mode 100644
index 00000000000..2b9221ec5d7
--- /dev/null
+++ b/nixos/modules/hardware/video/nvidia.nix
@@ -0,0 +1,54 @@
+# This module provides the proprietary NVIDIA X11 / OpenGL drivers.
+
+{ config, lib, pkgs, pkgs_i686, ... }:
+
+with lib;
+
+let
+
+ drivers = config.services.xserver.videoDrivers;
+
+ # FIXME: should introduce an option like
+ # ‘hardware.video.nvidia.package’ for overriding the default NVIDIA
+ # driver.
+ enabled = elem "nvidia" drivers || elem "nvidiaLegacy173" drivers || elem "nvidiaLegacy304" drivers;
+
+ nvidia_x11 =
+ if elem "nvidia" drivers then
+ config.boot.kernelPackages.nvidia_x11
+ else if elem "nvidiaLegacy173" drivers then
+ config.boot.kernelPackages.nvidia_x11_legacy173
+ else if elem "nvidiaLegacy304" drivers then
+ config.boot.kernelPackages.nvidia_x11_legacy304
+ else throw "impossible";
+
+in
+
+{
+
+ config = mkIf enabled {
+
+ services.xserver.drivers = singleton
+ { name = "nvidia"; modules = [ nvidia_x11 ]; libPath = [ nvidia_x11 ]; };
+
+ services.xserver.screenSection =
+ ''
+ Option "RandRRotation" "on"
+ '';
+
+ hardware.opengl.package = nvidia_x11;
+ hardware.opengl.package32 = pkgs_i686.linuxPackages.nvidia_x11.override { libsOnly = true; kernel = null; };
+
+ environment.systemPackages = [ nvidia_x11 ];
+
+ boot.extraModulePackages = [ nvidia_x11 ];
+
+ boot.blacklistedKernelModules = [ "nouveau" "nvidiafb" ];
+
+ services.acpid.enable = true;
+
+ environment.etc."OpenCL/vendors/nvidia.icd".source = "${nvidia_x11}/lib/vendors/nvidia.icd";
+
+ };
+
+}
diff --git a/nixos/modules/installer/cd-dvd/channel.nix b/nixos/modules/installer/cd-dvd/channel.nix
index bcf3dbb3f73..ca0e233f9e3 100644
--- a/nixos/modules/installer/cd-dvd/channel.nix
+++ b/nixos/modules/installer/cd-dvd/channel.nix
@@ -1,9 +1,9 @@
# Provide an initial copy of the NixOS channel so that the user
# doesn't need to run "nix-channel --update" first.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -11,7 +11,7 @@ let
# CD. These are installed into the "nixos" channel of the root
# user, as expected by nixos-rebuild/nixos-install.
channelSources = pkgs.runCommand "nixos-${config.system.nixosVersion}"
- { expr = builtins.readFile ../../../lib/channel-expr.nix; }
+ { expr = readFile ../../../lib/channel-expr.nix; }
''
mkdir -p $out/nixos
cp -prd ${pkgs.path} $out/nixos/nixpkgs
@@ -28,7 +28,7 @@ in
{
# Provide the NixOS/Nixpkgs sources in /etc/nixos. This is required
# for nixos-install.
- boot.postBootCommands =
+ boot.postBootCommands = mkAfter
''
if ! [ -e /var/lib/nixos/did-channel-init ]; then
echo "unpacking the NixOS/Nixpkgs sources..."
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-base.nix
index 999871ab074..4d87c20559d 100644
--- a/nixos/modules/installer/cd-dvd/installation-cd-base.nix
+++ b/nixos/modules/installer/cd-dvd/installation-cd-base.nix
@@ -1,9 +1,9 @@
# This module contains the basic configuration for building a NixOS
# installation CD.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
imports =
@@ -19,7 +19,7 @@ with pkgs.lib;
# ISO naming.
isoImage.isoName = "${config.isoImage.isoBaseName}-${config.system.nixosVersion}-${pkgs.stdenv.system}.iso";
- isoImage.volumeID = substring 0 32 "NIXOS_${config.system.nixosVersion}";
+ isoImage.volumeID = substring 0 11 "NIXOS_ISO";
# Make the installer more likely to succeed in low memory
# environments. The kernel's overcommit heustistics bite us
@@ -29,9 +29,19 @@ with pkgs.lib;
boot.kernel.sysctl."vm.overcommit_memory" = "1";
# To speed up installation a little bit, include the complete stdenv
- # in the Nix store on the CD.
- isoImage.storeContents = [ pkgs.stdenv pkgs.busybox ];
+ # in the Nix store on the CD. Archive::Cpio is needed for the
+ # initrd builder.
+ isoImage.storeContents = [ pkgs.stdenv pkgs.busybox pkgs.perlPackages.ArchiveCpio ];
+
+ # EFI booting
+ isoImage.makeEfiBootable = true;
# Add Memtest86+ to the CD.
- boot.loader.grub.memtest86 = true;
+ boot.loader.grub.memtest86.enable = true;
+
+ # Get a console as soon as the initrd loads fbcon on EFI boot.
+ boot.initrd.kernelModules = [ "fbcon" ];
+
+ # Allow the user to log in as root without a password.
+ security.initialRootPassword = "";
}
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-efi.nix b/nixos/modules/installer/cd-dvd/installation-cd-efi.nix
deleted file mode 100644
index 4aa788feeae..00000000000
--- a/nixos/modules/installer/cd-dvd/installation-cd-efi.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-{ config, pkgs, ... }:
-
-{
- # Move into base image once using 3.10 or later
-
- require = [ ./installation-cd-minimal.nix ];
-
- boot.kernelPackages = pkgs.linuxPackages_3_10;
-
- # Get a console as soon as the initrd loads fbcon on EFI boot
- boot.initrd.kernelModules = [ "fbcon" ];
-
- isoImage.makeEfiBootable = true;
-}
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix
new file mode 100644
index 00000000000..506b9292b01
--- /dev/null
+++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix
@@ -0,0 +1,7 @@
+{ config, pkgs, ... }:
+
+{
+ imports = [ ./installation-cd-graphical.nix ];
+
+ boot.kernelPackages = pkgs.linuxPackages_latest;
+}
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
index debf3e7db90..65aa1167089 100644
--- a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
+++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
@@ -1,9 +1,9 @@
# This module defines a NixOS installation CD that contains X11 and
# KDE 4.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
imports = [ ./installation-cd-base.nix ../../profiles/graphical.nix ];
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix b/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix
index 38d02ffd162..4363c8e6c93 100644
--- a/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix
+++ b/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix
@@ -3,6 +3,5 @@
{
imports = [ ./installation-cd-minimal.nix ];
- boot.kernelPackages = pkgs.linuxPackages_3_10;
- boot.vesa = false;
+ boot.kernelPackages = pkgs.linuxPackages_latest;
}
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-new-kernel.nix b/nixos/modules/installer/cd-dvd/installation-cd-new-kernel.nix
deleted file mode 100644
index 93bcbf00b25..00000000000
--- a/nixos/modules/installer/cd-dvd/installation-cd-new-kernel.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{ config, pkgs, ... }:
-
-{
- imports = [ ./installation-cd-graphical.nix ];
-
- boot.kernelPackages = pkgs.linuxPackages_3_10;
- boot.vesa = false;
-}
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix
index b803a3f188b..d43fa220381 100644
--- a/nixos/modules/installer/cd-dvd/iso-image.nix
+++ b/nixos/modules/installer/cd-dvd/iso-image.nix
@@ -2,9 +2,9 @@
# configuration. The derivation for the ISO image will be placed in
# config.system.build.isoImage.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -44,32 +44,30 @@ let
# The efi boot image
+ efiDir = pkgs.runCommand "efi-directory" {} ''
+ mkdir -p $out/efi/boot
+ cp -v ${pkgs.gummiboot}/lib/gummiboot/gummiboot${targetArch}.efi $out/efi/boot/boot${targetArch}.efi
+ mkdir -p $out/loader/entries
+ echo "title NixOS LiveCD" > $out/loader/entries/nixos-livecd.conf
+ echo "linux /boot/bzImage" >> $out/loader/entries/nixos-livecd.conf
+ echo "initrd /boot/initrd" >> $out/loader/entries/nixos-livecd.conf
+ echo "options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}" >> $out/loader/entries/nixos-livecd.conf
+ echo "default nixos-livecd" > $out/loader/loader.conf
+ echo "timeout 5" >> $out/loader/loader.conf
+ '';
+
efiImg = pkgs.runCommand "efi-image_eltorito" { buildInputs = [ pkgs.mtools ]; }
''
#Let's hope 10M is enough
dd bs=2048 count=5120 if=/dev/zero of="$out"
${pkgs.dosfstools}/sbin/mkfs.vfat "$out"
- mmd -i "$out" efi
- mmd -i "$out" efi/boot
- mmd -i "$out" efi/nixos
- mmd -i "$out" loader
- mmd -i "$out" loader/entries
+ mcopy -svi "$out" ${efiDir}/* ::
+ mmd -i "$out" boot
mcopy -v -i "$out" \
- ${pkgs.gummiboot}/lib/gummiboot/gummiboot${targetArch}.efi \
- ::efi/boot/boot${targetArch}.efi
+ ${config.boot.kernelPackages.kernel}/bzImage ::boot/bzImage
mcopy -v -i "$out" \
- ${config.boot.kernelPackages.kernel}/bzImage ::bzImage
- mcopy -v -i "$out" \
- ${config.system.build.initialRamdisk}/initrd ::efi/nixos/initrd
- echo "title NixOS LiveCD" > boot-params
- echo "linux /bzImage" >> boot-params
- echo "initrd /efi/nixos/initrd" >> boot-params
- echo "options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}" >> boot-params
- mcopy -v -i "$out" boot-params ::loader/entries/nixos-livecd.conf
- echo "default nixos-livecd" > boot-params
- echo "timeout 5" >> boot-params
- mcopy -v -i "$out" boot-params ::loader/loader.conf
- '';
+ ${config.system.build.initialRamdisk}/initrd ::boot/initrd
+ ''; # */
targetArch = if pkgs.stdenv.isi686 then
"ia32"
@@ -179,41 +177,45 @@ in
# recognise that.
boot.kernelParams = [ "root=LABEL=${config.isoImage.volumeID}" ];
+ fileSystems."/" =
+ { fsType = "tmpfs";
+ options = "mode=0755";
+ };
+
# Note that /dev/root is a symlink to the actual root device
- # specified on the kernel command line, created in the stage 1 init
- # script.
- fileSystems."/".device = "/dev/root";
+ # specified on the kernel command line, created in the stage 1
+ # init script.
+ fileSystems."/iso" =
+ { device = "/dev/root";
+ neededForBoot = true;
+ noCheck = true;
+ };
+
+ # In stage 1, mount a tmpfs on top of /nix/store (the squashfs
+ # image) to make this a live CD.
+ fileSystems."/nix/.ro-store" =
+ { fsType = "squashfs";
+ device = "/iso/nix-store.squashfs";
+ options = "loop";
+ neededForBoot = true;
+ };
+
+ fileSystems."/nix/.rw-store" =
+ { fsType = "tmpfs";
+ options = "mode=0755";
+ neededForBoot = true;
+ };
fileSystems."/nix/store" =
- { fsType = "squashfs";
- device = "/nix-store.squashfs";
- options = "loop";
+ { fsType = "unionfs-fuse";
+ device = "unionfs";
+ options = "allow_other,cow,nonempty,chroot=/mnt-root,max_files=32768,hide_meta_files,dirs=/nix/.rw-store=rw:/nix/.ro-store=ro";
};
boot.initrd.availableKernelModules = [ "squashfs" "iso9660" ];
boot.initrd.kernelModules = [ "loop" ];
- # In stage 1, mount a tmpfs on top of / (the ISO image) and
- # /nix/store (the squashfs image) to make this a live CD.
- boot.initrd.postMountCommands =
- ''
- mkdir -p /unionfs-chroot/ro-root
- mount --rbind $targetRoot /unionfs-chroot/ro-root
-
- mkdir /unionfs-chroot/rw-root
- mount -t tmpfs -o "mode=755" none /unionfs-chroot/rw-root
- mkdir /mnt-root-union
- unionfs -o allow_other,cow,chroot=/unionfs-chroot,max_files=32768 /rw-root=RW:/ro-root=RO /mnt-root-union
- oldTargetRoot=$targetRoot
- targetRoot=/mnt-root-union
-
- mkdir /unionfs-chroot/rw-store
- mount -t tmpfs -o "mode=755" none /unionfs-chroot/rw-store
- mkdir -p $oldTargetRoot/nix/store
- unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768 /rw-store=RW:/ro-root/nix/store=RO /mnt-root-union/nix/store
- '';
-
# Closures to be copied to the Nix store on the CD, namely the init
# script and the top-level system configuration directory.
isoImage.storeContents =
@@ -255,14 +257,16 @@ in
{ source = config.system.build.squashfsStore;
target = "/nix-store.squashfs";
}
- { # Quick hack: need a mount point for the store.
- source = pkgs.runCommand "empty" {} "mkdir -p $out";
- target = "/nix/store";
- }
] ++ optionals config.isoImage.makeEfiBootable [
{ source = efiImg;
target = "/boot/efi.img";
}
+ { source = "${efiDir}/efi";
+ target = "/efi";
+ }
+ { source = "${efiDir}/loader";
+ target = "/loader";
+ }
] ++ mapAttrsToList (n: v: { source = v; target = "/boot/${n}"; }) config.boot.loader.grub.extraFiles;
# The Grub menu.
@@ -307,8 +311,8 @@ in
'';
# Add vfat support to the initrd to enable people to copy the
- # contents of the CD to a bootable USB stick. Need unionfs-fuse for union mounts
- boot.initrd.supportedFilesystems = [ "vfat" "unionfs-fuse" ];
+ # contents of the CD to a bootable USB stick.
+ boot.initrd.supportedFilesystems = [ "vfat" ];
};
diff --git a/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix b/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
index 13ed95d4ceb..c2a11a1a8b3 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -152,7 +152,7 @@ in
# default root password is empty.
services.openssh.enable = true;
- jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
+ jobs.openssh.startOn = lib.mkOverride 50 "";
boot.loader.grub.enable = false;
boot.loader.generationsDir.enable = false;
diff --git a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix
index fcb96f7a24f..1156003d3f4 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix
@@ -1,9 +1,9 @@
# This module contains the basic configuration for building a NixOS
# tarball, that can directly boot, maybe using PXE or unpacking on a fs.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -109,7 +109,7 @@ in
# not be started by default on the installation CD because the
# default root password is empty.
services.openssh.enable = true;
- jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
+ jobs.openssh.startOn = lib.mkOverride 50 "";
# To be able to use the systemTarball to catch troubles.
boot.crashDump = {
diff --git a/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix b/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
index 7f253d595dc..2ed70c1daa9 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
@@ -1,9 +1,9 @@
# This module contains the basic configuration for building a NixOS
# tarball for the sheevaplug.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -138,8 +138,8 @@ in
};
# Setting vesa, we don't get the nvidia driver, which can't work in arm.
- services.xserver.videoDriver = "vesa";
- services.xserver.videoDrivers = [];
+ services.xserver.videoDrivers = [ "vesa" ];
+
services.nixosManual.enable = false;
# Include the firmware for various wireless cards.
@@ -165,7 +165,7 @@ in
# not be started by default on the installation CD because the
# default root password is empty.
services.openssh.enable = true;
- jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
+ jobs.openssh.startOn = lib.mkOverride 50 "";
# cpufrequtils fails to build on non-pc
powerManagement.enable = false;
diff --git a/nixos/modules/installer/cd-dvd/system-tarball.nix b/nixos/modules/installer/cd-dvd/system-tarball.nix
index 8d678fba71f..eaecbe1381f 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball.nix
@@ -2,9 +2,9 @@
# configuration. The derivation for the ISO image will be placed in
# config.system.build.tarball.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/installer/scan/detected.nix b/nixos/modules/installer/scan/detected.nix
index 09d04608e68..f350cd986af 100644
--- a/nixos/modules/installer/scan/detected.nix
+++ b/nixos/modules/installer/scan/detected.nix
@@ -1,8 +1,8 @@
# List all devices which are detected by nixos-hardware-scan.
# Common devices are enabled by default.
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
config = mkDefault {
diff --git a/nixos/modules/installer/scan/not-detected.nix b/nixos/modules/installer/scan/not-detected.nix
index 814858fdffd..b30c569ed2a 100644
--- a/nixos/modules/installer/scan/not-detected.nix
+++ b/nixos/modules/installer/scan/not-detected.nix
@@ -1,8 +1,8 @@
# List all devices which are _not_ detected by nixos-hardware-scan.
# Common devices are enabled by default.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
hardware.enableAllFirmware = true;
diff --git a/nixos/modules/installer/tools/get-version-suffix b/nixos/modules/installer/tools/get-version-suffix
index 461fbf4d3d8..b8972cd57d2 100644
--- a/nixos/modules/installer/tools/get-version-suffix
+++ b/nixos/modules/installer/tools/get-version-suffix
@@ -17,6 +17,6 @@ getVersion() {
if nixpkgs=$(nix-instantiate --find-file nixpkgs "$@"); then
getVersion $nixpkgs
if [ -n "$rev" ]; then
- echo "pre-$rev"
+ echo ".git.$rev"
fi
fi
diff --git a/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix b/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
index 5e77b701ff5..4372d196261 100644
--- a/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
+++ b/nixos/modules/installer/tools/nixos-build-vms/build-vms.nix
@@ -6,4 +6,4 @@ let nodes = import networkExpr; in
with import ../../../../lib/testing.nix { inherit system; };
-(complete { inherit nodes; testScript = ""; }).driver
+(makeTest { inherit nodes; testScript = ""; }).driver
diff --git a/nixos/modules/installer/tools/nixos-checkout.nix b/nixos/modules/installer/tools/nixos-checkout.nix
index 41899855686..3338e5119ac 100644
--- a/nixos/modules/installer/tools/nixos-checkout.nix
+++ b/nixos/modules/installer/tools/nixos-checkout.nix
@@ -1,9 +1,9 @@
# This module generates the nixos-checkout script, which replaces the
# Nixpkgs source trees in /etc/nixos/nixpkgs with a Git checkout.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index 0f9142990ec..c507f7f979f 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -1,9 +1,11 @@
#! @perl@
+use Cwd 'abs_path';
use File::Spec;
use File::Path;
use File::Basename;
use File::Slurp;
+use File::stat;
sub uniq {
@@ -61,7 +63,7 @@ my @attrs = ();
my @kernelModules = ();
my @initrdKernelModules = ();
my @modulePackages = ();
-my @imports = ("");
+my @imports = ("");
sub debug {
@@ -96,9 +98,9 @@ my $videoDriver;
sub pciCheck {
my $path = shift;
- my $vendor = read_file "$path/vendor";
- my $device = read_file "$path/device";
- my $class = read_file "$path/class";
+ my $vendor = read_file "$path/vendor"; chomp $vendor;
+ my $device = read_file "$path/device"; chomp $device;
+ my $class = read_file "$path/class"; chomp $class;
my $module;
if (-e "$path/driver/module") {
@@ -135,7 +137,9 @@ sub pciCheck {
$device eq "0x4315" || $device eq "0x4327" || $device eq "0x4328" ||
$device eq "0x4329" || $device eq "0x432a" || $device eq "0x432b" ||
$device eq "0x432c" || $device eq "0x432d" || $device eq "0x4353" ||
- $device eq "0x4357" || $device eq "0x4358" || $device eq "0x4359" ) )
+ $device eq "0x4357" || $device eq "0x4358" || $device eq "0x4359" ||
+ $device eq "0x4331" || $device eq "0x43a0" || $device eq "0x43b1"
+ ) )
{
push @modulePackages, "config.boot.kernelPackages.broadcom_sta";
push @kernelModules, "wl";
@@ -156,7 +160,8 @@ sub pciCheck {
# Assume that all NVIDIA cards are supported by the NVIDIA driver.
# There may be exceptions (e.g. old cards).
- $videoDriver = "nvidia" if $vendor eq "0x10de" && $class =~ /^0x03/;
+ # FIXME: do we want to enable an unfree driver here?
+ #$videoDriver = "nvidia" if $vendor eq "0x10de" && $class =~ /^0x03/;
}
foreach my $path (glob "/sys/bus/pci/devices/*") {
@@ -170,9 +175,9 @@ push @attrs, "services.xserver.videoDrivers = [ \"$videoDriver\" ];" if $videoDr
sub usbCheck {
my $path = shift;
- my $class = read_file "$path/bInterfaceClass";
- my $subclass = read_file "$path/bInterfaceSubClass";
- my $protocol = read_file "$path/bInterfaceProtocol";
+ my $class = read_file "$path/bInterfaceClass"; chomp $class;
+ my $subclass = read_file "$path/bInterfaceSubClass"; chomp $subclass;
+ my $protocol = read_file "$path/bInterfaceProtocol"; chomp $protocol;
my $module;
if (-e "$path/driver/module") {
@@ -216,14 +221,41 @@ foreach my $path (glob "/sys/class/block/*") {
}
+my $virt = `systemd-detect-virt`;
+chomp $virt;
+
+
# Check if we're a VirtualBox guest. If so, enable the guest
# additions.
-my $dmi = `@dmidecode@/sbin/dmidecode`;
-if ($dmi =~ /Manufacturer: innotek/) {
+if ($virt eq "oracle") {
push @attrs, "services.virtualbox.enable = true;"
}
+# Likewise for QEMU.
+if ($virt eq "qemu" || $virt eq "kvm" || $virt eq "bochs") {
+ push @imports, "";
+}
+
+
+# For a device name like /dev/sda1, find a more stable path like
+# /dev/disk/by-uuid/X or /dev/disk/by-label/Y.
+sub findStableDevPath {
+ my ($dev) = @_;
+ return $dev if substr($dev, 0, 1) ne "/";
+ return $dev unless -e $dev;
+
+ my $st = stat($dev) or return $dev;
+
+ foreach my $dev2 (glob("/dev/disk/by-uuid/*"), glob("/dev/mapper/*"), glob("/dev/disk/by-label/*")) {
+ my $st2 = stat($dev2) or next;
+ return $dev2 if $st->rdev == $st2->rdev;
+ }
+
+ return $dev;
+}
+
+
# Generate the swapDevices option from the currently activated swap
# devices.
my @swaps = read_file("/proc/swaps");
@@ -231,7 +263,9 @@ shift @swaps;
my @swapDevices;
foreach my $swap (@swaps) {
$swap =~ /^(\S+)\s/;
- push @swapDevices, "{ device = \"$1\"; }";
+ next unless -e $1;
+ my $dev = findStableDevPath $1;
+ push @swapDevices, "{ device = \"$dev\"; }";
}
@@ -256,7 +290,8 @@ foreach my $fs (read_file("/proc/self/mountinfo")) {
$mountPoint = "/" if $mountPoint eq "";
# Skip special filesystems.
- next if in($mountPoint, "/proc") || in($mountPoint, "/dev") || in($mountPoint, "/sys") || in($mountPoint, "/run");
+ next if in($mountPoint, "/proc") || in($mountPoint, "/dev") || in($mountPoint, "/sys") || in($mountPoint, "/run") || $mountPoint eq "/var/lib/nfs/rpc_pipefs";
+ next if $mountPoint eq "/var/setuid-wrappers";
# Skip the optional fields.
my $n = 6; $n++ while $fields[$n] ne "-"; $n++;
@@ -270,9 +305,11 @@ foreach my $fs (read_file("/proc/self/mountinfo")) {
# Maybe this is a bind-mount of a filesystem we saw earlier?
if (defined $fsByDev{$fields[2]}) {
my $path = $fields[3]; $path = "" if $path eq "/";
+ my $base = $fsByDev{$fields[2]};
+ $base = "" if $base eq "/";
$fileSystems .= < 0) {
+ $fileSystems .= <= 3.10
- boot.kernelPackages = pkgs.linuxPackages_3_10;
EOF
} else {
$bootLoaderConfig = <
-# * run the activation script of the configuration (also installs Grub)
+# * install the boot loader
+
+# Re-exec ourselves in a private mount namespace so that our bind
+# mounts get cleaned up automatically.
+if [ "$(id -u)" = 0 ]; then
+ if [ -z "$NIXOS_INSTALL_REEXEC" ]; then
+ export NIXOS_INSTALL_REEXEC=1
+ exec unshare --mount --uts -- "$0" "$@"
+ else
+ mount --make-rprivate /
+ fi
+fi
# Parse the command line for the -I flag
extraBuildFlags=()
+chrootCommand=(/run/current-system/sw/bin/bash)
while [ "$#" -gt 0 ]; do
i="$1"; shift 1
@@ -19,6 +30,14 @@ while [ "$#" -gt 0 ]; do
absolute_path=$(readlink -m $given_path)
extraBuildFlags+=("$i" "/mnt$absolute_path")
;;
+ --show-trace)
+ extraBuildFlags+=("$i")
+ ;;
+ --chroot)
+ runChroot=1
+ chrootCommand=("$@")
+ break
+ ;;
--help)
exec man nixos-install
exit 1
@@ -37,10 +56,6 @@ if test -z "$mountPoint"; then
mountPoint=/mnt
fi
-if test -z "$NIXOS_CONFIG"; then
- NIXOS_CONFIG=/etc/nixos/configuration.nix
-fi
-
if ! test -e "$mountPoint"; then
echo "mount point $mountPoint doesn't exist"
exit 1
@@ -51,53 +66,45 @@ if ! grep -F -q " $mountPoint " /proc/mounts; then
exit 1
fi
+
+# Mount some stuff in the target root directory.
+mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/etc $mountPoint/run $mountPoint/home
+mkdir -m 01777 -p $mountPoint/tmp
+mkdir -m 0755 -p $mountPoint/tmp/root
+mkdir -m 0755 -p $mountPoint/var/setuid-wrappers
+mount --rbind /dev $mountPoint/dev
+mount --rbind /proc $mountPoint/proc
+mount --rbind /sys $mountPoint/sys
+mount --rbind / $mountPoint/tmp/root
+mount -t tmpfs -o "mode=0755" none $mountPoint/run
+mount -t tmpfs -o "mode=0755" none $mountPoint/var/setuid-wrappers
+rm -rf $mountPoint/var/run
+ln -s /run $mountPoint/var/run
+rm -f $mountPoint/etc/{resolv.conf,hosts}
+cp -Lf /etc/resolv.conf /etc/hosts $mountPoint/etc/
+
+
+if [ -n "$runChroot" ]; then
+ if ! [ -L $mountPoint/nix/var/nix/profiles/system ]; then
+ echo "$0: installation not finished; cannot chroot into installation directory"
+ exit 1
+ fi
+ ln -s /nix/var/nix/profiles/system $mountPoint/run/current-system
+ exec chroot $mountPoint "${chrootCommand[@]}"
+fi
+
+
+# Get the path of the NixOS configuration file.
+if test -z "$NIXOS_CONFIG"; then
+ NIXOS_CONFIG=/etc/nixos/configuration.nix
+fi
+
if ! test -e "$mountPoint/$NIXOS_CONFIG"; then
echo "configuration file $mountPoint/$NIXOS_CONFIG doesn't exist"
exit 1
fi
-
-# Mount some stuff in the target root directory. We bind-mount /etc
-# into the chroot because we need networking and the nixbld user
-# accounts in /etc/passwd. But we do need the target's /etc/nixos.
-mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/mnt $mountPoint/mnt2 $mountPoint/mnt-nixpkgs $mountPoint/etc /etc/nixos
-mount --make-private / # systemd makes / shared, which is annoying
-mount --bind / $mountPoint/mnt
-mount --bind /nix $mountPoint/mnt/nix
-mount --bind /nix/store $mountPoint/mnt/nix/store
-mount --bind /dev $mountPoint/dev
-mount --bind /dev/shm $mountPoint/dev/shm
-mount --bind /proc $mountPoint/proc
-mount --bind /sys $mountPoint/sys
-mount --bind /sys/firmware/efi/efivars $mountPoint/sys/firmware/efi/efivars &>/dev/null || true
-mount --bind $mountPoint/etc/nixos $mountPoint/mnt2
-mount --bind /etc $mountPoint/etc
-mount --bind $mountPoint/mnt2 $mountPoint/etc/nixos
-
-cleanup() {
- set +e
- mountpoint -q $mountPoint/etc/nixos && umount $mountPoint/etc/nixos
- mountpoint -q $mountPoint/etc && umount $mountPoint/etc
- umount $mountPoint/mnt2
- umount $mountPoint/mnt-nixpkgs
- umount $mountPoint/sys/firmware/efi/efivars &>/dev/null || true
- umount $mountPoint/sys
- umount $mountPoint/proc
- umount $mountPoint/dev/shm
- umount $mountPoint/dev
- umount $mountPoint/mnt/nix/store
- umount $mountPoint/mnt/nix
- umount $mountPoint/mnt
- rmdir $mountPoint/mnt $mountPoint/mnt2 $mountPoint/mnt-nixpkgs
-}
-
-trap "cleanup" EXIT
-
-mkdir -m 01777 -p $mountPoint/tmp
-mkdir -m 0755 -p $mountPoint/var
-
-
# Create the necessary Nix directories on the target device, if they
# don't already exist.
mkdir -m 0755 -p \
@@ -110,25 +117,11 @@ mkdir -m 0755 -p \
$mountPoint/nix/var/log/nix/drvs
mkdir -m 1775 -p $mountPoint/nix/store
-build_users_group=$(@perl@/bin/perl -I @nix@/lib/perl5/site_perl/*/* -e 'use Nix::Config; Nix::Config::readConfig; print $Nix::Config::config{"build-users-group"};')
-if test -n "$build_users_group"; then
- chown root:"$build_users_group" $mountPoint/nix/store
-else
- chown root $mountPoint/nix/store
-fi
+chown root:nixbld $mountPoint/nix/store
-# Get the store paths to copy from the references graph.
-storePaths=$(@perl@/bin/perl @pathsFromGraph@ @nixClosure@)
-
-
-# Copy Nix to the Nix store on the target device.
-echo "copying Nix to $mountPoint...."
-for i in $storePaths; do
- echo " $i"
- chattr -R -i $mountPoint/$i 2> /dev/null || true # clear immutable bit
- rsync -a $i $mountPoint/nix/store/
-done
+# There is no daemon in the chroot.
+unset NIX_REMOTE
# We don't have locale-archive in the chroot, so clear $LANG.
@@ -137,28 +130,36 @@ export LC_ALL=
export LC_TIME=
-# There is no daemon in the chroot
-unset NIX_REMOTE
-
-
# Create a temporary Nix config file that causes the nixbld users to
# be used.
-if test -n "$build_users_group"; then
- echo "build-users-group = $build_users_group" > $mountPoint/tmp/nix.conf
-fi
+echo "build-users-group = nixbld" > $mountPoint/tmp/nix.conf # FIXME: remove in Nix 1.8
binary_caches=$(@perl@/bin/perl -I @nix@/lib/perl5/site_perl/*/* -e 'use Nix::Config; Nix::Config::readConfig; print $Nix::Config::config{"binary-caches"};')
if test -n "$binary_caches"; then
echo "binary-caches = $binary_caches" >> $mountPoint/tmp/nix.conf
fi
export NIX_CONF_DIR=/tmp
+touch $mountPoint/etc/passwd $mountPoint/etc/group
+mount --bind -o ro /etc/passwd $mountPoint/etc/passwd
+mount --bind -o ro /etc/group $mountPoint/etc/group
-# Register the paths in the Nix closure as valid. This is necessary
-# to prevent them from being deleted the first time we install
-# something. (I.e., Nix will see that, e.g., the glibc path is not
-# valid, delete it to get it out of the way, but as a result nothing
-# will work anymore.)
-chroot $mountPoint @nix@/bin/nix-store --register-validity < @nixClosure@
+
+# Copy Nix to the Nix store on the target device, unless it's already there.
+if ! NIX_DB_DIR=$mountPoint/nix/var/nix/db nix-store --check-validity @nix@ 2> /dev/null; then
+ echo "copying Nix to $mountPoint...."
+ for i in $(@perl@/bin/perl @pathsFromGraph@ @nixClosure@); do
+ echo " $i"
+ chattr -R -i $mountPoint/$i 2> /dev/null || true # clear immutable bit
+ rsync -a $i $mountPoint/nix/store/
+ done
+
+ # Register the paths in the Nix closure as valid. This is necessary
+ # to prevent them from being deleted the first time we install
+ # something. (I.e., Nix will see that, e.g., the glibc path is not
+ # valid, delete it to get it out of the way, but as a result nothing
+ # will work anymore.)
+ chroot $mountPoint @nix@/bin/nix-store --register-validity < @nixClosure@
+fi
# Create the required /bin/sh symlink; otherwise lots of things
@@ -168,15 +169,9 @@ mkdir -m 0755 -p $mountPoint/bin
ln -sf @shell@ $mountPoint/bin/sh
-if test -n "$NIXOS_PREPARE_CHROOT_ONLY"; then
- echo "User requested only to prepare chroot. Exiting."
- exit 0
-fi
-
-
# Make the build below copy paths from the CD if possible. Note that
-# /mnt in the chroot is the root of the CD.
-export NIX_OTHER_STORES=/mnt/nix:$NIX_OTHER_STORES
+# /tmp/root in the chroot is the root of the CD.
+export NIX_OTHER_STORES=/tmp/root/nix:$NIX_OTHER_STORES
p=@nix@/libexec/nix/substituters
export NIX_SUBSTITUTERS=$p/copy-from-other-stores.pl:$p/download-from-binary-cache.pl
@@ -191,15 +186,15 @@ done
# Get the absolute path to the NixOS/Nixpkgs sources.
-mount --bind $(readlink -f $(nix-instantiate --find-file nixpkgs)) $mountPoint/mnt-nixpkgs
+nixpkgs="$(readlink -f $(nix-instantiate --find-file nixpkgs))"
# Build the specified Nix expression in the target store and install
# it into the system configuration profile.
echo "building the system configuration..."
-NIX_PATH="nixpkgs=/mnt-nixpkgs:nixos=/mnt-nixpkgs/nixos:nixos-config=$NIXOS_CONFIG" NIXOS_CONFIG= \
+NIX_PATH="nixpkgs=/tmp/root/$nixpkgs:nixos-config=$NIXOS_CONFIG" NIXOS_CONFIG= \
chroot $mountPoint @nix@/bin/nix-env \
- "${extraBuildFlags[@]}" -p /nix/var/nix/profiles/system -f '' --set -A system --show-trace
+ "${extraBuildFlags[@]}" -p /nix/var/nix/profiles/system -f '' --set -A system
# Copy the NixOS/Nixpkgs sources to the target as the initial contents
@@ -217,10 +212,8 @@ mkdir -m 0700 -p $mountPoint/root/.nix-defexpr
ln -sfn /nix/var/nix/profiles/per-user/root/channels $mountPoint/root/.nix-defexpr/channels
-# We're done building/downloading, so we don't need the /etc bind
-# mount anymore. In fact, below we want to modify the target's /etc.
-umount $mountPoint/etc/nixos
-umount $mountPoint/etc
+# Get rid of the /etc bind mounts.
+umount $mountPoint/etc/passwd $mountPoint/etc/group
# Grub needs an mtab.
@@ -238,3 +231,17 @@ touch $mountPoint/etc/NIXOS
echo "finalising the installation..."
NIXOS_INSTALL_GRUB=1 chroot $mountPoint \
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
+
+
+# Run the activation script.
+chroot $mountPoint /nix/var/nix/profiles/system/activate
+
+
+# Ask the user to set a root password.
+if [ -t 0 ] ; then
+ echo "setting root password..."
+ chroot $mountPoint passwd
+fi
+
+
+echo "installation finished!"
diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh
index 60cee2519da..edc94d73208 100644
--- a/nixos/modules/installer/tools/nixos-option.sh
+++ b/nixos/modules/installer/tools/nixos-option.sh
@@ -228,7 +228,7 @@ else
escapeQuotes () { eval echo "$1"; }
nixMap escapeQuotes "$names"
else
- echo 1>&2 "An error occured while looking for attribute names."
+ echo 1>&2 "An error occurred while looking for attribute names."
echo $result
fi
fi
diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh
index 5c89394abce..52b64c37578 100644
--- a/nixos/modules/installer/tools/nixos-rebuild.sh
+++ b/nixos/modules/installer/tools/nixos-rebuild.sh
@@ -1,4 +1,8 @@
-#! @shell@ -e
+#! @shell@
+
+if [ -x "@shell@" ]; then export SHELL="@shell@"; fi;
+
+set -e
showSyntax() {
exec man nixos-rebuild
@@ -7,6 +11,7 @@ showSyntax() {
# Parse the command line.
+origArgs=("$@")
extraBuildFlags=()
action=
buildNix=1
@@ -40,7 +45,7 @@ while [ "$#" -gt 0 ]; do
repair=1
extraBuildFlags+=("$i")
;;
- --show-trace|--no-build-hook|--keep-failed|-K|--keep-going|-k|--verbose|-v|-vv|-vvv|-vvvv|-vvvvv|--fallback|--repair)
+ --show-trace|--no-build-hook|--keep-failed|-K|--keep-going|-k|--verbose|-v|-vv|-vvv|-vvvv|-vvvvv|--fallback|--repair|--no-build-output|-Q)
extraBuildFlags+=("$i")
;;
--max-jobs|-j|--cores|-I)
@@ -76,8 +81,40 @@ done
if [ -z "$action" ]; then showSyntax; fi
-if [ -n "$rollback" ]; then
- buildNix=
+# Only run shell scripts from the Nixpkgs tree if the action is
+# "switch", "boot", or "test". With other actions (such as "build"),
+# the user may reasonably expect that no code from the Nixpkgs tree is
+# executed, so it's safe to run nixos-rebuild against a potentially
+# untrusted tree.
+canRun=
+if [ "$action" = switch -o "$action" = boot -o "$action" = test ]; then
+ canRun=1
+fi
+
+
+# If ‘--upgrade’ is given, run ‘nix-channel --update nixos’.
+if [ -n "$upgrade" -a -z "$_NIXOS_REBUILD_REEXEC" ]; then
+ nix-channel --update nixos
+fi
+
+# Make sure that we use the Nix package we depend on, not something
+# else from the PATH for nix-{env,instantiate,build}. This is
+# important, because NixOS defaults the architecture of the rebuilt
+# system to the architecture of the nix-* binaries used. So if on an
+# amd64 system the user has an i686 Nix package in her PATH, then we
+# would silently downgrade the whole system to be i686 NixOS on the
+# next reboot.
+if [ -z "$_NIXOS_REBUILD_REEXEC" ]; then
+ export PATH=@nix@/bin:$PATH
+fi
+
+# Re-execute nixos-rebuild from the Nixpkgs tree.
+if [ -z "$_NIXOS_REBUILD_REEXEC" -a -n "$canRun" ]; then
+ if p=$(nix-instantiate --find-file nixpkgs/nixos/modules/installer/tools/nixos-rebuild.sh "${extraBuildFlags[@]}"); then
+ export _NIXOS_REBUILD_REEXEC=1
+ exec $SHELL -e $p "${origArgs[@]}"
+ exit 1
+ fi
fi
@@ -98,20 +135,33 @@ if [ -z "$repair" ] && systemctl show nix-daemon.socket nix-daemon.service | gre
fi
-# If ‘--upgrade’ is given, run ‘nix-channel --update nixos’.
-if [ -n "$upgrade" ]; then
- nix-channel --update nixos
+# First build Nix, since NixOS may require a newer version than the
+# current one.
+if [ -n "$rollback" -o "$action" = dry-run ]; then
+ buildNix=
fi
-
-# First build Nix, since NixOS may require a newer version than the
-# current one. Of course, the same goes for Nixpkgs, but Nixpkgs is
-# more conservative.
-if [ "$action" != dry-run -a -n "$buildNix" ]; then
+if [ -n "$buildNix" ]; then
echo "building Nix..." >&2
if ! nix-build '' -A config.nix.package -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then
if ! nix-build '' -A nixFallback -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then
- nix-build '' -A nixUnstable -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null
+ if ! nix-build '' -A nix -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then
+ machine="$(uname -m)"
+ if [ "$machine" = x86_64 ]; then
+ nixStorePath=/nix/store/d34q3q2zj9nriq4ifhn3dnnngqvinjb3-nix-1.7
+ elif [[ "$machine" =~ i.86 ]]; then
+ nixStorePath=/nix/store/qlah0darpcn6sf3lr2226rl04l1gn4xz-nix-1.7
+ else
+ echo "$0: unsupported platform"
+ exit 1
+ fi
+ if ! nix-store -r $nixStorePath --add-root $tmpDir/nix --indirect \
+ --option extra-binary-caches http://cache.nixos.org/; then
+ echo "warning: don't know how to get latest Nix" >&2
+ fi
+ # Older version of nix-store -r don't support --add-root.
+ [ -e $tmpDir/nix ] || ln -sf $nixStorePath $tmpDir/nix
+ fi
fi
fi
PATH=$tmpDir/nix/bin:$PATH
@@ -120,10 +170,12 @@ fi
# Update the version suffix if we're building from Git (so that
# nixos-version shows something useful).
-if nixpkgs=$(nix-instantiate --find-file nixpkgs "${extraBuildFlags[@]}"); then
- suffix=$(@shell@ $nixpkgs/nixos/modules/installer/tools/get-version-suffix "${extraBuildFlags[@]}" || true)
- if [ -n "$suffix" ]; then
- echo -n "$suffix" > "$nixpkgs/.version-suffix" || true
+if [ -n "$canRun" ]; then
+ if nixpkgs=$(nix-instantiate --find-file nixpkgs "${extraBuildFlags[@]}"); then
+ suffix=$($SHELL $nixpkgs/nixos/modules/installer/tools/get-version-suffix "${extraBuildFlags[@]}" || true)
+ if [ -n "$suffix" ]; then
+ echo -n "$suffix" > "$nixpkgs/.version-suffix" || true
+ fi
fi
fi
@@ -173,7 +225,10 @@ fi
# If we're not just building, then make the new configuration the boot
# default and/or activate it now.
if [ "$action" = switch -o "$action" = boot -o "$action" = test ]; then
- $pathToConfig/bin/switch-to-configuration "$action"
+ if ! $pathToConfig/bin/switch-to-configuration "$action"; then
+ echo "warning: there were error switching to the new configuration" >&2
+ exit 1
+ fi
fi
diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix
index 652bfa917df..39da2f1f0be 100644
--- a/nixos/modules/installer/tools/tools.nix
+++ b/nixos/modules/installer/tools/tools.nix
@@ -1,7 +1,7 @@
# This module generates nixos-install, nixos-rebuild,
# nixos-generate-config, etc.
-{ config, pkgs, modulesPath, ... }:
+{ config, pkgs, modulesPath, lib, ... }:
let
@@ -32,13 +32,13 @@ let
nixos-rebuild = makeProg {
name = "nixos-rebuild";
src = ./nixos-rebuild.sh;
+ nix = config.nix.package;
};
nixos-generate-config = makeProg {
name = "nixos-generate-config";
src = ./nixos-generate-config.pl;
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
- inherit (pkgs) dmidecode;
};
nixos-option = makeProg {
@@ -65,7 +65,7 @@ let
test -e "$out/chrome/content/jquery-1.5.2.js" ||
cp -f "$jquery" "$out/chrome/content/jquery-1.5.2.js"
'';
- gui = pkgs.lib.cleanSource "${modulesPath}/../gui";
+ gui = lib.cleanSource "${modulesPath}/../gui";
jquery = pkgs.fetchurl {
url = http://code.jquery.com/jquery-1.5.2.min.js;
sha256 = "8f0a19ee8c606b35a10904951e0a27da1896eafe33c6e88cb7bcbe455f05a24a";
@@ -80,9 +80,9 @@ in
/*
options = {
- installer.enableGraphicalTools = pkgs.lib.mkOption {
+ installer.enableGraphicalTools = mkOption {
default = false;
- type = with pkgs.lib.types; bool;
+ type = types.bool;
example = true;
description = ''
Enable the installation of graphical tools.
diff --git a/nixos/modules/installer/virtualbox-demo.nix b/nixos/modules/installer/virtualbox-demo.nix
index 76cc29a1fac..f68f8dc40aa 100644
--- a/nixos/modules/installer/virtualbox-demo.nix
+++ b/nixos/modules/installer/virtualbox-demo.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
imports =
diff --git a/nixos/modules/misc/assertions.nix b/nixos/modules/misc/assertions.nix
index 5fb88308b77..c1be36e98cb 100644
--- a/nixos/modules/misc/assertions.nix
+++ b/nixos/modules/misc/assertions.nix
@@ -1,14 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
-
-let
-
- failed = map (x: x.message) (filter (x: !x.assertion) config.assertions);
-
- showWarnings = res: fold (w: x: builtins.trace "[1;31mwarning: ${w}[0m" x) res config.warnings;
-
-in
+with lib;
{
@@ -38,15 +30,5 @@ in
};
};
-
- config = {
-
- # This option is evaluated always. Thus the assertions are checked
- # as well. Hacky!
- environment.systemPackages = showWarnings (
- if [] == failed then []
- else throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failed)}");
-
- };
-
+ # impl of assertions is in
}
diff --git a/nixos/modules/misc/check-config.nix b/nixos/modules/misc/check-config.nix
index f759c88d3a1..e9803de2196 100644
--- a/nixos/modules/misc/check-config.nix
+++ b/nixos/modules/misc/check-config.nix
@@ -1,6 +1,6 @@
-{ pkgs, ... }:
+{ lib, ... }:
-with pkgs.lib;
+with lib;
{
options = {
diff --git a/nixos/modules/misc/crashdump.nix b/nixos/modules/misc/crashdump.nix
index 6e71baa9a43..d68f38bae2f 100644
--- a/nixos/modules/misc/crashdump.nix
+++ b/nixos/modules/misc/crashdump.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
crashdump = config.boot.crashDump;
diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix
index e3edc9dda6b..fa81ff8a839 100644
--- a/nixos/modules/misc/ids.nix
+++ b/nixos/modules/misc/ids.nix
@@ -1,19 +1,19 @@
# This module defines the global list of uids and gids. We keep a
# central list to prevent id collisions.
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
options = {
- ids.uids = pkgs.lib.mkOption {
+ ids.uids = lib.mkOption {
internal = true;
description = ''
The user IDs used in NixOS.
'';
};
- ids.gids = pkgs.lib.mkOption {
+ ids.gids = lib.mkOption {
internal = true;
description = ''
The group IDs used in NixOS.
@@ -52,13 +52,13 @@
osgi = 34;
tor = 35;
cups = 36;
- foldingAtHome = 37;
+ foldingathome = 37;
sabnzbd = 38;
kdm = 39;
- ghostOne = 40;
+ ghostone = 40;
git = 41;
- fourStore = 42;
- fourStoreEndpoint = 43;
+ fourstore = 42;
+ fourstorehttp = 43;
virtuoso = 44;
rtkit = 45;
dovecot2 = 46;
@@ -84,7 +84,7 @@
postgres = 71;
smbguest = 74;
varnish = 75;
- dd-agent = 76;
+ datadog = 76;
lighttpd = 77;
lightdm = 78;
freenet = 79;
@@ -106,8 +106,43 @@
firebird = 95;
redis = 96;
haproxy = 97;
+ mongodb = 98;
+ openldap = 99;
+ memcached = 100;
+ cgminer = 101;
+ munin = 102;
+ logcheck = 103;
+ nix-ssh = 104;
+ dictd = 105;
+ couchdb = 106;
+ searx = 107;
+ kippo = 108;
+ jenkins = 109;
+ systemd-journal-gateway = 110;
+ notbit = 111;
+ ngircd = 112;
+ btsync = 113;
+ minecraft = 114;
+ monetdb = 115;
+ rippled = 116;
+ murmur = 117;
+ foundationdb = 118;
+ newrelic = 119;
+ starbound = 120;
+ hydra = 122;
+ spiped = 123;
+ teamspeak = 124;
+ influxdb = 125;
+ nsd = 126;
+ gitolite = 127;
+ znc = 128;
+ polipo = 129;
+ mopidy = 130;
+ unifi = 131;
+ gdm = 132;
+ dhcpd = 133;
- # When adding a uid, make sure it doesn't match an existing gid.
+ # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
nixbld = 30000; # start of range of uids
nobody = 65534;
@@ -140,7 +175,7 @@
tape = 25;
video = 26;
dialout = 27;
- polkituser = 28;
+ #polkituser = 28; # currently unused, polkitd doesn't need a group
utmp = 29;
davfs2 = 31;
privoxy = 32;
@@ -148,8 +183,8 @@
osgi = 34;
ghostOne = 40;
git = 41;
- fourStore = 42;
- fourStoreEndpoint = 43;
+ fourstore = 42;
+ fourstorehttpd = 43;
virtuoso = 44;
dovecot2 = 46;
prayer = 49;
@@ -176,7 +211,7 @@
vboxsf = 73;
smbguest = 74;
varnish = 75;
- dd-agent = 76;
+ datadog = 76;
lighttpd = 77;
lightdm = 78;
freenet = 79;
@@ -193,8 +228,36 @@
amule = 90;
minidlna = 91;
haproxy = 92;
+ openldap = 93;
+ connman = 94;
+ munin = 95;
+ keys = 96;
+ dictd = 105;
+ couchdb = 106;
+ searx = 107;
+ kippo = 108;
+ jenkins = 109;
+ systemd-journal-gateway = 110;
+ notbit = 111;
+ monetdb = 115;
+ foundationdb = 118;
+ newrelic = 119;
+ starbound = 120;
+ grsecurity = 121;
+ hydra = 122;
+ spiped = 123;
+ teamspeak = 124;
+ influxdb = 125;
+ nsd = 126;
+ firebird = 127;
+ znc = 128;
+ polipo = 129;
+ mopidy = 130;
+ docker = 131;
+ gdm = 132;
+ tss = 133;
- # When adding a gid, make sure it doesn't match an existing uid.
+ # When adding a gid, make sure it doesn't match an existing uid. And don't use gids above 399!
users = 100;
nixbld = 30000;
diff --git a/nixos/modules/misc/lib.nix b/nixos/modules/misc/lib.nix
index 18fc68a6988..be8000ac029 100644
--- a/nixos/modules/misc/lib.nix
+++ b/nixos/modules/misc/lib.nix
@@ -1,11 +1,11 @@
-{ config, pkgs, ... }:
+{ config, lib, ... }:
{
options = {
- lib = pkgs.lib.mkOption {
+ lib = lib.mkOption {
default = {};
- type = pkgs.lib.types.attrsOf pkgs.lib.types.attrs;
+ type = lib.types.attrsOf lib.types.attrs;
description = ''
This option allows modules to define helper functions, constants, etc.
diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix
index b6408be5844..7de63c60649 100644
--- a/nixos/modules/misc/locate.nix
+++ b/nixos/modules/misc/locate.nix
@@ -1,14 +1,10 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
-
- locatedb = "/var/cache/locatedb";
-
-in
-
-{
+ cfg = config.services.locate;
+in {
###### interface
@@ -35,6 +31,31 @@ in
'';
};
+ extraFlags = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ description = ''
+ Extra flags to append to updatedb.
+ '';
+ };
+
+ output = mkOption {
+ type = types.path;
+ default = /var/cache/locatedb;
+ description = ''
+ The database file to build.
+ '';
+ };
+
+ localuser = mkOption {
+ type = types.str;
+ default = "nobody";
+ description = ''
+ The user to search non-network directories as, using
+ su.
+ '';
+ };
+
};
};
@@ -48,8 +69,10 @@ in
path = [ pkgs.su ];
script =
''
- mkdir -m 0755 -p $(dirname ${locatedb})
- exec updatedb --localuser=nobody --output=${locatedb} --prunepaths='/tmp /var/tmp /media /run'
+ mkdir -m 0755 -p $(dirname ${toString cfg.output})
+ exec updatedb \
+ --localuser=${cfg.localuser} \
+ --output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags}
'';
serviceConfig.Nice = 19;
serviceConfig.IOSchedulingClass = "idle";
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix
index 7433fab168e..f41c8817ba4 100644
--- a/nixos/modules/misc/nixpkgs.nix
+++ b/nixos/modules/misc/nixpkgs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
isConfig = x:
@@ -62,8 +62,7 @@ in
type = types.str;
description = ''
Specifies the Nix platform type for which NixOS should be built.
- If unset, it defaults to the platform type of your host system
- (${builtins.currentSystem}).
+ If unset, it defaults to the platform type of your host system.
Specifying this option is useful when doing distributed
multi-platform deployment, or when building virtual machines.
'';
diff --git a/nixos/modules/misc/passthru.nix b/nixos/modules/misc/passthru.nix
index b65f20d62f2..f3c9f6ba651 100644
--- a/nixos/modules/misc/passthru.nix
+++ b/nixos/modules/misc/passthru.nix
@@ -1,11 +1,11 @@
# This module allows you to export something from configuration
# Use case: export kernel source expression for ease of configuring
-{ config, pkgs, ... }:
+{ config, lib, ... }:
{
options = {
- passthru = pkgs.lib.mkOption {
+ passthru = lib.mkOption {
visible = false;
description = ''
This attribute set will be exported as a system attribute.
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix
index 2fa95563e9a..f4271cea853 100644
--- a/nixos/modules/misc/version.nix
+++ b/nixos/modules/misc/version.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -53,7 +53,7 @@ with pkgs.lib;
mkDefault (if pathExists fn then readFile fn else "master");
# Note: code names must only increase in alphabetical order.
- system.nixosCodeName = "Aardvark";
+ system.nixosCodeName = "Caterpillar";
# Generate /etc/os-release. See
# http://0pointer.de/public/systemd-man/os-release.html for the
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 8b76e1f21cb..453899175e0 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -16,20 +16,25 @@
./config/shells-environment.nix
./config/swap.nix
./config/sysctl.nix
+ ./config/system-environment.nix
./config/system-path.nix
./config/timezone.nix
./config/unix-odbc-drivers.nix
./config/users-groups.nix
+ ./config/zram.nix
./hardware/all-firmware.nix
- ./hardware/cpu/intel-microcode.nix
./hardware/cpu/amd-microcode.nix
+ ./hardware/cpu/intel-microcode.nix
./hardware/network/b43.nix
./hardware/network/intel-2100bg.nix
./hardware/network/intel-2200bg.nix
./hardware/network/intel-3945abg.nix
./hardware/network/ralink.nix
./hardware/network/rtl8192c.nix
+ ./hardware/opengl.nix
./hardware/pcmcia.nix
+ ./hardware/video/bumblebee.nix
+ ./hardware/video/nvidia.nix
./installer/tools/nixos-checkout.nix
./installer/tools/tools.nix
./misc/assertions.nix
@@ -45,9 +50,11 @@
./programs/bash/bash.nix
./programs/bash/command-not-found.nix
./programs/blcr.nix
+ ./programs/dconf.nix
./programs/environment.nix
- ./programs/gurobi.nix
./programs/info.nix
+ ./programs/nano.nix
+ ./programs/screen.nix
./programs/shadow.nix
./programs/shell.nix
./programs/ssh.nix
@@ -59,6 +66,8 @@
./security/apparmor.nix
./security/apparmor-suid.nix
./security/ca.nix
+ ./security/duosec.nix
+ ./security/grsecurity.nix
./security/pam.nix
./security/pam_usb.nix
./security/polkit.nix
@@ -72,57 +81,83 @@
./services/audio/alsa.nix
./services/audio/fuppes.nix
./services/audio/mpd.nix
+ ./services/audio/mopidy.nix
./services/backup/almir.nix
./services/backup/bacula.nix
./services/backup/mysql-backup.nix
./services/backup/postgresql-backup.nix
- ./services/backup/sitecopy-backup.nix
./services/backup/rsnapshot.nix
+ ./services/backup/sitecopy-backup.nix
+ ./services/backup/tarsnap.nix
+ ./services/continuous-integration/jenkins/default.nix
+ ./services/continuous-integration/jenkins/slave.nix
./services/databases/4store-endpoint.nix
./services/databases/4store.nix
+ ./services/databases/couchdb.nix
./services/databases/firebird.nix
+ ./services/databases/influxdb.nix
./services/databases/memcached.nix
+ ./services/databases/monetdb.nix
./services/databases/mongodb.nix
- ./services/databases/redis.nix
./services/databases/mysql.nix
- ./services/databases/mysql55.nix
./services/databases/openldap.nix
./services/databases/postgresql.nix
+ ./services/databases/redis.nix
./services/databases/virtuoso.nix
+ ./services/desktops/accountsservice.nix
+ ./services/desktops/geoclue2.nix
+ ./services/desktops/gnome3/at-spi2-core.nix
+ ./services/desktops/gnome3/evolution-data-server.nix
+ ./services/desktops/gnome3/gnome-documents.nix
+ ./services/desktops/gnome3/gnome-keyring.nix
+ ./services/desktops/gnome3/gnome-online-accounts.nix
+ ./services/desktops/gnome3/gnome-online-miners.nix
+ ./services/desktops/gnome3/gnome-user-share.nix
+ ./services/desktops/gnome3/gvfs.nix
+ ./services/desktops/gnome3/seahorse.nix
+ ./services/desktops/gnome3/sushi.nix
+ ./services/desktops/gnome3/tracker.nix
+ ./services/desktops/telepathy.nix
./services/games/ghost-one.nix
+ ./services/games/minecraft-server.nix
./services/hardware/acpid.nix
+ ./services/hardware/amd-hybrid-graphics.nix
./services/hardware/bluetooth.nix
./services/hardware/nvidia-optimus.nix
./services/hardware/pcscd.nix
./services/hardware/pommed.nix
./services/hardware/sane.nix
+ ./services/hardware/tcsd.nix
+ ./services/hardware/thinkfan.nix
./services/hardware/udev.nix
- ./services/hardware/udisks.nix
./services/hardware/udisks2.nix
./services/hardware/upower.nix
- ./services/hardware/thinkfan.nix
./services/logging/klogd.nix
./services/logging/logcheck.nix
./services/logging/logrotate.nix
./services/logging/logstash.nix
- ./services/logging/syslogd.nix
./services/logging/rsyslogd.nix
+ ./services/logging/syslogd.nix
+ ./services/logging/syslog-ng.nix
./services/mail/dovecot.nix
./services/mail/freepops.nix
./services/mail/mail.nix
./services/mail/opensmtpd.nix
./services/mail/postfix.nix
./services/mail/spamassassin.nix
- ./services/misc/autofs.nix
+ #./services/misc/autofs.nix
./services/misc/cgminer.nix
+ ./services/misc/dictd.nix
./services/misc/disnix.nix
./services/misc/felix.nix
./services/misc/folding-at-home.nix
+ ./services/misc/gitolite.nix
./services/misc/gpsd.nix
- ./services/misc/gurobi.nix
./services/misc/nix-daemon.nix
./services/misc/nix-gc.nix
./services/misc/nixos-manual.nix
+ ./services/misc/nix-ssh-serve.nix
+ ./services/misc/rippled.nix
./services/misc/rogue.nix
./services/misc/svnserve.nix
./services/misc/synergy.nix
@@ -131,7 +166,7 @@
./services/monitoring/graphite.nix
./services/monitoring/monit.nix
./services/monitoring/munin.nix
- ./services/monitoring/nagios/default.nix
+ ./services/monitoring/nagios.nix
./services/monitoring/smartd.nix
./services/monitoring/statsd.nix
./services/monitoring/systemhealth.nix
@@ -142,66 +177,86 @@
./services/network-filesystems/drbd.nix
./services/network-filesystems/nfsd.nix
./services/network-filesystems/openafs-client/default.nix
+ ./services/network-filesystems/rsyncd.nix
./services/network-filesystems/samba.nix
./services/networking/amuled.nix
./services/networking/avahi-daemon.nix
./services/networking/bind.nix
./services/networking/bitlbee.nix
- ./services/networking/cntlm.nix
+ ./services/networking/btsync.nix
./services/networking/chrony.nix
+ ./services/networking/cjdns.nix
+ ./services/networking/cntlm.nix
+ ./services/networking/connman.nix
./services/networking/ddclient.nix
./services/networking/dhcpcd.nix
./services/networking/dhcpd.nix
./services/networking/dnsmasq.nix
./services/networking/ejabberd.nix
./services/networking/firewall.nix
- ./services/networking/haproxy.nix
- ./services/networking/tcpcrypt.nix
./services/networking/flashpolicyd.nix
./services/networking/freenet.nix
./services/networking/git-daemon.nix
./services/networking/gnunet.nix
./services/networking/gogoclient.nix
./services/networking/gvpe.nix
+ ./services/networking/haproxy.nix
./services/networking/hostapd.nix
./services/networking/ifplugd.nix
./services/networking/iodined.nix
./services/networking/ircd-hybrid/default.nix
+ ./services/networking/kippo.nix
./services/networking/minidlna.nix
+ ./services/networking/murmur.nix
./services/networking/nat.nix
./services/networking/networkmanager.nix
+ ./services/networking/ngircd.nix
+ ./services/networking/notbit.nix
+ ./services/networking/nsd.nix
+ ./services/networking/ntopng.nix
./services/networking/ntpd.nix
./services/networking/oidentd.nix
./services/networking/openfire.nix
./services/networking/openvpn.nix
+ ./services/networking/polipo.nix
./services/networking/prayer.nix
./services/networking/privoxy.nix
./services/networking/quassel.nix
+ ./services/networking/radicale.nix
./services/networking/radvd.nix
./services/networking/rdnssd.nix
./services/networking/rpcbind.nix
./services/networking/sabnzbd.nix
- ./services/networking/supybot.nix
+ ./services/networking/searx.nix
+ ./services/networking/spiped.nix
./services/networking/ssh/lshd.nix
./services/networking/ssh/sshd.nix
+ ./services/networking/supybot.nix
+ ./services/networking/syncthing.nix
+ ./services/networking/tcpcrypt.nix
+ ./services/networking/teamspeak3.nix
./services/networking/tftpd.nix
./services/networking/unbound.nix
+ ./services/networking/unifi.nix
./services/networking/vsftpd.nix
./services/networking/wakeonlan.nix
./services/networking/websockify.nix
./services/networking/wicd.nix
./services/networking/wpa_supplicant.nix
./services/networking/xinetd.nix
+ ./services/networking/znc.nix
./services/printing/cupsd.nix
./services/scheduling/atd.nix
./services/scheduling/cron.nix
./services/scheduling/fcron.nix
./services/search/elasticsearch.nix
+ ./services/search/solr.nix
./services/security/clamav.nix
./services/security/fprot.nix
./services/security/frandom.nix
- ./services/security/tor.nix
+ ./services/security/haveged.nix
./services/security/torify.nix
+ ./services/security/tor.nix
./services/security/torsocks.nix
./services/system/dbus.nix
./services/system/kerberos.nix
@@ -209,61 +264,72 @@
./services/system/uptimed.nix
./services/torrent/deluge.nix
./services/torrent/transmission.nix
- ./services/ttys/gpm.nix
./services/ttys/agetty.nix
+ ./services/ttys/gpm.nix
+ ./services/ttys/kmscon.nix
./services/web-servers/apache-httpd/default.nix
+ ./services/web-servers/fcgiwrap.nix
./services/web-servers/jboss/default.nix
- ./services/web-servers/lighttpd/default.nix
./services/web-servers/lighttpd/cgit.nix
+ ./services/web-servers/lighttpd/default.nix
./services/web-servers/lighttpd/gitweb.nix
./services/web-servers/nginx/default.nix
+ ./services/web-servers/phpfpm.nix
./services/web-servers/tomcat.nix
./services/web-servers/varnish/default.nix
+ ./services/web-servers/winstone.nix
./services/web-servers/zope2.nix
./services/x11/desktop-managers/default.nix
./services/x11/display-managers/auto.nix
./services/x11/display-managers/default.nix
+ ./services/x11/display-managers/gdm.nix
./services/x11/display-managers/kdm.nix
- ./services/x11/display-managers/slim.nix
./services/x11/display-managers/lightdm.nix
+ ./services/x11/display-managers/slim.nix
./services/x11/hardware/multitouch.nix
./services/x11/hardware/synaptics.nix
./services/x11/hardware/wacom.nix
+ ./services/x11/redshift.nix
./services/x11/window-managers/awesome.nix
#./services/x11/window-managers/compiz.nix
./services/x11/window-managers/default.nix
./services/x11/window-managers/icewm.nix
+ ./services/x11/window-managers/bspwm.nix
./services/x11/window-managers/metacity.nix
./services/x11/window-managers/none.nix
./services/x11/window-managers/twm.nix
./services/x11/window-managers/wmii.nix
./services/x11/window-managers/xmonad.nix
- ./services/x11/redshift.nix
./services/x11/xfs.nix
./services/x11/xserver.nix
./system/activation/activation-script.nix
./system/activation/top-level.nix
+ ./system/boot/emergency-mode.nix
./system/boot/kernel.nix
./system/boot/kexec.nix
./system/boot/loader/efi.nix
./system/boot/loader/generations-dir/generations-dir.nix
- ./system/boot/loader/gummiboot/gummiboot.nix
- ./system/boot/loader/raspberrypi/raspberrypi.nix
./system/boot/loader/grub/grub.nix
./system/boot/loader/grub/memtest.nix
+ ./system/boot/loader/gummiboot/gummiboot.nix
./system/boot/loader/init-script/init-script.nix
+ ./system/boot/loader/raspberrypi/raspberrypi.nix
./system/boot/luksroot.nix
./system/boot/modprobe.nix
./system/boot/shutdown.nix
./system/boot/stage-1.nix
./system/boot/stage-2.nix
./system/boot/systemd.nix
+ ./system/boot/tmp.nix
./system/etc/etc.nix
./system/upstart/upstart.nix
./tasks/cpu-freq.nix
+ ./tasks/encrypted-devices.nix
./tasks/filesystems.nix
./tasks/filesystems/btrfs.nix
+ ./tasks/filesystems/cifs.nix
./tasks/filesystems/ext.nix
+ ./tasks/filesystems/f2fs.nix
./tasks/filesystems/nfs.nix
./tasks/filesystems/reiserfs.nix
./tasks/filesystems/unionfs-fuse.nix
@@ -275,8 +341,13 @@
./tasks/network-interfaces.nix
./tasks/scsi-link-power-management.nix
./tasks/swraid.nix
+ ./tasks/trackpoint.nix
+ ./testing/service-runner.nix
+ ./virtualisation/container-config.nix
+ ./virtualisation/containers.nix
+ ./virtualisation/docker.nix
./virtualisation/libvirtd.nix
#./virtualisation/nova.nix
./virtualisation/virtualbox-guest.nix
- ./virtualisation/xen-dom0.nix
+ #./virtualisation/xen-dom0.nix
]
diff --git a/nixos/modules/profiles/base.nix b/nixos/modules/profiles/base.nix
index 20b808c29e0..6f9e3002f29 100644
--- a/nixos/modules/profiles/base.nix
+++ b/nixos/modules/profiles/base.nix
@@ -7,7 +7,6 @@
# Include some utilities that are useful for installing or repairing
# the system.
environment.systemPackages = [
- pkgs.subversion # for nixos-checkout
pkgs.w3m # needed for the manual anyway
pkgs.testdisk # useful for repairing boot problems
pkgs.mssys # for writing Microsoft boot sectors / MBRs
@@ -34,6 +33,7 @@
pkgs.dosfstools
pkgs.xfsprogs
pkgs.jfsutils
+ pkgs.f2fs-tools
#pkgs.jfsrec # disabled because of Boost dependency
# Some compression/archiver tools.
@@ -50,6 +50,6 @@
];
# Include support for various filesystems.
- boot.supportedFilesystems = [ "btrfs" "reiserfs" "vfat" ];
+ boot.supportedFilesystems = [ "btrfs" "reiserfs" "vfat" "f2fs" ];
}
diff --git a/nixos/modules/profiles/clone-config.nix b/nixos/modules/profiles/clone-config.nix
index 04ee76d8d3e..f0d60bb6c42 100644
--- a/nixos/modules/profiles/clone-config.nix
+++ b/nixos/modules/profiles/clone-config.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, modules, ... }:
+{ config, lib, pkgs, modules, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/profiles/demo.nix b/nixos/modules/profiles/demo.nix
index 396dcf6c5d3..ef6fd77b5f8 100644
--- a/nixos/modules/profiles/demo.nix
+++ b/nixos/modules/profiles/demo.nix
@@ -4,13 +4,10 @@
imports = [ ./graphical.nix ];
users.extraUsers.demo =
- { description = "Demo user account";
- group = "users";
+ { isNormalUser = true;
+ description = "Demo user account";
extraGroups = [ "wheel" ];
- home = "/home/demo";
- createHome = true;
- useDefaultShell = true;
password = "demo";
- isSystemUser = false;
+ uid = 1000;
};
}
diff --git a/nixos/modules/profiles/headless.nix b/nixos/modules/profiles/headless.nix
index 541c46ca50c..4be0fb44216 100644
--- a/nixos/modules/profiles/headless.nix
+++ b/nixos/modules/profiles/headless.nix
@@ -1,9 +1,9 @@
# Common configuration for headless machines (e.g., Amazon EC2
# instances).
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
sound.enable = false;
@@ -12,6 +12,8 @@ with pkgs.lib;
# Don't start a tty on the serial consoles.
systemd.services."serial-getty@ttyS0".enable = false;
systemd.services."serial-getty@hvc0".enable = false;
+ systemd.services."getty@tty1".enable = false;
+ systemd.services."autovt@".enable = false;
# Since we can't manually respond to a panic, just reboot.
boot.kernelParams = [ "panic=1" "boot.panic_on_fail" ];
diff --git a/nixos/modules/profiles/installation-device.nix b/nixos/modules/profiles/installation-device.nix
index 3b058c6e971..5aab2a2954e 100644
--- a/nixos/modules/profiles/installation-device.nix
+++ b/nixos/modules/profiles/installation-device.nix
@@ -1,7 +1,7 @@
# Provide a basic configuration for installation devices like CDs.
-{ config, pkgs, modules, ... }:
+{ config, lib, ... }:
-with pkgs.lib;
+with lib;
{
imports =
@@ -45,7 +45,7 @@ with pkgs.lib;
# Enable wpa_supplicant, but don't start it by default.
networking.wireless.enable = true;
- jobs.wpa_supplicant.startOn = pkgs.lib.mkOverride 50 "";
+ jobs.wpa_supplicant.startOn = mkOverride 50 "";
# Tell the Nix evaluator to garbage collect more aggressively.
# This is desirable in memory-constrained environments that don't
diff --git a/nixos/modules/profiles/minimal.nix b/nixos/modules/profiles/minimal.nix
index 821b9f93465..5067622aaf1 100644
--- a/nixos/modules/profiles/minimal.nix
+++ b/nixos/modules/profiles/minimal.nix
@@ -1,11 +1,8 @@
# This module defines a small NixOS configuration. It does not
# contain any graphical stuff.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
{
- # Don't include X libraries.
- programs.ssh.setXAuthLocation = false;
- fonts.enableFontConfig = false;
- fonts.enableCoreFonts = false;
+ environment.noXlibs = true;
}
diff --git a/nixos/modules/profiles/qemu-guest.nix b/nixos/modules/profiles/qemu-guest.nix
index c8e6fd4aa76..79890aa7f17 100644
--- a/nixos/modules/profiles/qemu-guest.nix
+++ b/nixos/modules/profiles/qemu-guest.nix
@@ -5,5 +5,13 @@
{
boot.initrd.availableKernelModules = [ "virtio_net" "virtio_pci" "virtio_blk" "9p" "9pnet_virtio" ];
- boot.kernelModules = [ "virtio_balloon" "virtio_console" ];
+ boot.initrd.kernelModules = [ "virtio_balloon" "virtio_console" "virtio_rng" ];
+
+ boot.initrd.postDeviceCommands =
+ ''
+ # Set the system time from the hardware clock to work around a
+ # bug in qemu-kvm > 1.5.2 (where the VM clock is initialised
+ # to the *boot time* of the host).
+ hwclock -s
+ '';
}
diff --git a/nixos/modules/programs/atop.nix b/nixos/modules/programs/atop.nix
index 7fdaab9d67d..b91bd98047e 100644
--- a/nixos/modules/programs/atop.nix
+++ b/nixos/modules/programs/atop.nix
@@ -1,8 +1,8 @@
# Global configuration for atop.
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.programs.atop;
@@ -22,7 +22,7 @@ in
interval = 5;
};
description = ''
- Parameters to be written to /etc/atoprc
+ Parameters to be written to /etc/atoprc.
'';
};
diff --git a/nixos/modules/programs/bash/bash.nix b/nixos/modules/programs/bash/bash.nix
index 9d33e26c495..c5c0f9d0121 100644
--- a/nixos/modules/programs/bash/bash.nix
+++ b/nixos/modules/programs/bash/bash.nix
@@ -1,9 +1,9 @@
# This module defines global configuration for the Bash shell, in
# particular /etc/bashrc and /etc/profile.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -40,6 +40,7 @@ in
programs.bash = {
+ /*
enable = mkOption {
default = true;
description = ''
@@ -52,6 +53,7 @@ in
'';
type = types.bool;
};
+ */
shellAliases = mkOption {
default = config.environment.shellAliases // { which = "type -P"; };
@@ -114,7 +116,7 @@ in
};
- config = mkIf cfg.enable {
+ config = /* mkIf cfg.enable */ {
programs.bash = {
diff --git a/nixos/modules/programs/bash/command-not-found.nix b/nixos/modules/programs/bash/command-not-found.nix
index 502320446a3..8c86d48b080 100644
--- a/nixos/modules/programs/bash/command-not-found.nix
+++ b/nixos/modules/programs/bash/command-not-found.nix
@@ -3,9 +3,9 @@
# SQLite database that maps program names to Nix package names (e.g.,
# "pdflatex" is mapped to "tetex").
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/programs/blcr.nix b/nixos/modules/programs/blcr.nix
index e1e31b4a56a..804e1d01f12 100644
--- a/nixos/modules/programs/blcr.nix
+++ b/nixos/modules/programs/blcr.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, lib, ... }:
let
- inherit (pkgs.lib) mkOption mkIf;
+ inherit (lib) mkOption mkIf;
cfg = config.environment.blcr;
blcrPkg = config.boot.kernelPackages.blcr;
in
diff --git a/nixos/modules/programs/dconf.nix b/nixos/modules/programs/dconf.nix
new file mode 100644
index 00000000000..1b7e2079981
--- /dev/null
+++ b/nixos/modules/programs/dconf.nix
@@ -0,0 +1,34 @@
+{ config, lib, ... }:
+
+let
+ inherit (lib) mkOption mkIf types mapAttrsToList;
+ cfg = config.programs.dconf;
+
+ mkDconfProfile = name: path:
+ { source = path; target = "dconf/profile/${name}"; };
+
+in
+{
+ ###### interface
+
+ options = {
+ programs.dconf = {
+
+ profiles = mkOption {
+ type = types.attrsOf types.path;
+ default = {};
+ description = "Set of dconf profile files.";
+ internal = true;
+ };
+
+ };
+ };
+
+ ###### implementation
+
+ config = mkIf (cfg.profiles != {}) {
+ environment.etc =
+ (mapAttrsToList mkDconfProfile cfg.profiles);
+ };
+
+}
diff --git a/nixos/modules/programs/environment.nix b/nixos/modules/programs/environment.nix
index 7c1922cdfd8..80c3e83fe81 100644
--- a/nixos/modules/programs/environment.nix
+++ b/nixos/modules/programs/environment.nix
@@ -2,9 +2,9 @@
# Most of the stuff here should probably be moved elsewhere sometime.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -17,16 +17,18 @@ in
config = {
environment.variables =
- { LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
- LOCATE_PATH = "/var/cache/locatedb";
+ { LOCATE_PATH = "/var/cache/locatedb";
NIXPKGS_CONFIG = "/etc/nix/nixpkgs-config.nix";
- NIX_PATH =
+ PAGER = mkDefault "less -R";
+ EDITOR = mkDefault "nano";
+ };
+
+ environment.sessionVariables =
+ { NIX_PATH =
[ "/nix/var/nix/profiles/per-user/root/channels/nixos"
"nixpkgs=/etc/nixos/nixpkgs"
"nixos-config=/etc/nixos/configuration.nix"
];
- PAGER = "less -R";
- EDITOR = "nano";
};
environment.profiles =
@@ -45,7 +47,7 @@ in
TERMINFO_DIRS = [ "${i}/share/terminfo" ];
PERL5LIB = [ "${i}/lib/perl5/site_perl" ];
ALSA_PLUGIN_DIRS = [ "${i}/lib/alsa-lib" ];
- GST_PLUGIN_PATH = [ "${i}/lib/gstreamer-0.10" ];
+ GST_PLUGIN_SYSTEM_PATH = [ "${i}/lib/gstreamer-0.10" ];
KDEDIRS = [ "${i}" ];
STRIGI_PLUGIN_PATH = [ "${i}/lib/strigi/" ];
QT_PLUGIN_PATH = [ "${i}/lib/qt4/plugins" "${i}/lib/kde4/plugins" ];
diff --git a/nixos/modules/programs/gurobi.nix b/nixos/modules/programs/gurobi.nix
deleted file mode 100644
index 7fa099b0884..00000000000
--- a/nixos/modules/programs/gurobi.nix
+++ /dev/null
@@ -1,43 +0,0 @@
-{ config, pkgs, ... }:
-
-with pkgs.lib;
-
-let
- cfg = config.programs.gurobi;
-in {
- options = {
- programs.gurobi = {
- license = mkOption {
- default = null;
-
- description = "Path to the Gurobi license file if not using a token server";
-
- type = types.nullOr types.path;
- };
-
- tokenServerAddress = mkOption {
- default = null;
-
- description = "Address of the token server";
-
- type = types.nullOr types.string;
- };
- };
- };
-
- config = mkIf (cfg.license != null || cfg.tokenServerAddress != null) {
- assertions = [ {
- assertion = cfg.license == null || cfg.tokenServerAddress == null;
- message = "Please only set one of a gurobi license file and a gurobi token server address";
- } ];
-
- environment.variables.GRB_LICENSE_FILE = if cfg.license != null
- then cfg.license
- else pkgs.writeTextFile {
- name = "gurobi-generated-license";
- text = "TOKENSERVER=${cfg.tokenServerAddress}";
- };
-
- environment.systemPackages = [ pkgs.gurobi ];
- };
-}
diff --git a/nixos/modules/programs/info.nix b/nixos/modules/programs/info.nix
index 30c25cf3420..253f9e87769 100644
--- a/nixos/modules/programs/info.nix
+++ b/nixos/modules/programs/info.nix
@@ -2,6 +2,8 @@
let
+ texinfo = pkgs.texinfoInteractive;
+
# Quick hack to make the `info' command work properly. `info' needs
# a "dir" file containing all the installed Info files, which we
# don't have (it would be impure to have a package installation
@@ -22,15 +24,15 @@ let
for i in $(IFS=:; echo $INFOPATH); do
for j in $i/*.info; do
- ${pkgs.texinfo}/bin/install-info --quiet $j $dir/dir
+ ${texinfo}/bin/install-info --quiet $j $dir/dir
done
done
- INFOPATH=$dir:$INFOPATH ${pkgs.texinfo}/bin/info "$@"
+ INFOPATH=$dir:$INFOPATH ${texinfo}/bin/info "$@"
''; # */
in
{
- environment.systemPackages = [ infoWrapper pkgs.texinfo ];
+ environment.systemPackages = [ infoWrapper texinfo ];
}
diff --git a/nixos/modules/programs/nano.nix b/nixos/modules/programs/nano.nix
new file mode 100644
index 00000000000..b8803eec7be
--- /dev/null
+++ b/nixos/modules/programs/nano.nix
@@ -0,0 +1,35 @@
+{ config, lib, ... }:
+
+let
+ cfg = config.programs.nano;
+in
+
+{
+ ###### interface
+
+ options = {
+ programs.nano = {
+
+ nanorc = lib.mkOption {
+ type = lib.types.lines;
+ default = "";
+ description = ''
+ The system-wide nano configuration.
+ See nanorc5.
+ '';
+ example = ''
+ set nowrap
+ set tabstospaces
+ set tabsize 4
+ '';
+ };
+ };
+ };
+
+ ###### implementation
+
+ config = lib.mkIf (cfg.nanorc != "") {
+ environment.etc."nanorc".text = cfg.nanorc;
+ };
+
+}
diff --git a/nixos/modules/programs/screen.nix b/nixos/modules/programs/screen.nix
new file mode 100644
index 00000000000..f82338a69d2
--- /dev/null
+++ b/nixos/modules/programs/screen.nix
@@ -0,0 +1,30 @@
+{ config, lib, ... }:
+
+let
+ inherit (lib) mkOption mkIf types;
+ cfg = config.programs.screen;
+in
+
+{
+ ###### interface
+
+ options = {
+ programs.screen = {
+
+ screenrc = mkOption {
+ default = "";
+ description = ''
+ The contents of /etc/screenrc file.
+ '';
+ type = types.lines;
+ };
+ };
+ };
+
+ ###### implementation
+
+ config = mkIf (cfg.screenrc != "") {
+ environment.etc."screenrc".text = cfg.screenrc;
+ };
+
+}
diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix
index 9e46ab8b298..658b08b3d87 100644
--- a/nixos/modules/programs/shadow.nix
+++ b/nixos/modules/programs/shadow.nix
@@ -1,8 +1,8 @@
# Configuration for the pwdutils suite of tools: passwd, useradd, etc.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -10,12 +10,12 @@ let
''
DEFAULT_HOME yes
- SYS_UID_MIN 100
+ SYS_UID_MIN 400
SYS_UID_MAX 499
UID_MIN 1000
UID_MAX 29999
- SYS_GID_MIN 100
+ SYS_GID_MIN 400
SYS_GID_MAX 499
GID_MIN 1000
GID_MAX 29999
@@ -40,7 +40,7 @@ in
options = {
- users.defaultUserShell = pkgs.lib.mkOption {
+ users.defaultUserShell = lib.mkOption {
description = ''
This option defines the default shell assigned to user
accounts. This must not be a store path, since the path is
@@ -48,6 +48,7 @@ in
Rather, it should be the path of a symlink that points to the
actual shell in the Nix store.
'';
+ example = "/run/current-system/sw/bin/zsh";
type = types.path;
};
@@ -58,7 +59,8 @@ in
config = {
- environment.systemPackages = [ pkgs.shadow ];
+ environment.systemPackages =
+ lib.optional config.users.mutableUsers pkgs.shadow;
environment.etc =
[ { # /etc/login.defs: global configuration for pwdutils. You
@@ -94,6 +96,8 @@ in
groupmems = { rootOK = true; };
groupdel = { rootOK = true; };
login = { startSession = true; allowNullPassword = true; showMotd = true; updateWtmp = true; };
+ chpasswd = { rootOK = true; };
+ chgpasswd = { rootOK = true; };
};
security.setuidPrograms = [ "passwd" "chfn" "su" "newgrp" ];
diff --git a/nixos/modules/programs/shell.nix b/nixos/modules/programs/shell.nix
index 8052502c21e..80d40a7c708 100644
--- a/nixos/modules/programs/shell.nix
+++ b/nixos/modules/programs/shell.nix
@@ -1,8 +1,8 @@
# This module defines a standard configuration for NixOS shells.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -28,34 +28,36 @@ in
echo "WARNING: bad ownership on $NIX_USER_PROFILE_DIR" >&2
fi
- if ! test -L $HOME/.nix-profile; then
- if test "$USER" != root; then
- ln -s $NIX_USER_PROFILE_DIR/profile $HOME/.nix-profile
- else
- # Root installs in the system-wide profile by default.
- ln -s /nix/var/nix/profiles/default $HOME/.nix-profile
- fi
- fi
+ if test -w $HOME; then
+ if ! test -L $HOME/.nix-profile; then
+ if test "$USER" != root; then
+ ln -s $NIX_USER_PROFILE_DIR/profile $HOME/.nix-profile
+ else
+ # Root installs in the system-wide profile by default.
+ ln -s /nix/var/nix/profiles/default $HOME/.nix-profile
+ fi
+ fi
- # Subscribe the root user to the NixOS channel by default.
- if [ "$USER" = root -a ! -e $HOME/.nix-channels ]; then
- echo "${config.system.defaultChannel} nixos" > $HOME/.nix-channels
- fi
+ # Subscribe the root user to the NixOS channel by default.
+ if [ "$USER" = root -a ! -e $HOME/.nix-channels ]; then
+ echo "${config.system.defaultChannel} nixos" > $HOME/.nix-channels
+ fi
- # Create the per-user garbage collector roots directory.
- NIX_USER_GCROOTS_DIR=/nix/var/nix/gcroots/per-user/$USER
- mkdir -m 0755 -p $NIX_USER_GCROOTS_DIR
- if test "$(stat --printf '%u' $NIX_USER_GCROOTS_DIR)" != "$(id -u)"; then
- echo "WARNING: bad ownership on $NIX_USER_GCROOTS_DIR" >&2
- fi
+ # Create the per-user garbage collector roots directory.
+ NIX_USER_GCROOTS_DIR=/nix/var/nix/gcroots/per-user/$USER
+ mkdir -m 0755 -p $NIX_USER_GCROOTS_DIR
+ if test "$(stat --printf '%u' $NIX_USER_GCROOTS_DIR)" != "$(id -u)"; then
+ echo "WARNING: bad ownership on $NIX_USER_GCROOTS_DIR" >&2
+ fi
- # Set up a default Nix expression from which to install stuff.
- if [ ! -e $HOME/.nix-defexpr -o -L $HOME/.nix-defexpr ]; then
- rm -f $HOME/.nix-defexpr
- mkdir $HOME/.nix-defexpr
- if [ "$USER" != root ]; then
- ln -s /nix/var/nix/profiles/per-user/root/channels $HOME/.nix-defexpr/channels_root
- fi
+ # Set up a default Nix expression from which to install stuff.
+ if [ ! -e $HOME/.nix-defexpr -o -L $HOME/.nix-defexpr ]; then
+ rm -f $HOME/.nix-defexpr
+ mkdir $HOME/.nix-defexpr
+ if [ "$USER" != root ]; then
+ ln -s /nix/var/nix/profiles/per-user/root/channels $HOME/.nix-defexpr/channels_root
+ fi
+ fi
fi
'';
diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix
index a66679dff90..fdb9dfd4b8c 100644
--- a/nixos/modules/programs/ssh.nix
+++ b/nixos/modules/programs/ssh.nix
@@ -1,8 +1,8 @@
# Global configuration for the SSH client.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.programs.ssh;
cfgd = config.services.openssh;
@@ -31,7 +31,7 @@ in
setXAuthLocation = mkOption {
type = types.bool;
- default = true;
+ default = config.services.xserver.enable;
description = ''
Whether to set the path to xauth for X11-forwarded connections.
This causes a dependency on X11 packages.
@@ -47,7 +47,20 @@ in
for help.
'';
};
+
+ startAgent = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Whether to start the OpenSSH agent when you log in. The OpenSSH agent
+ remembers private keys for you so that you don't have to type in
+ passphrases every time you make an SSH connection. Use
+ ssh-add to add a key to the agent.
+ '';
+ };
+
};
+
};
config = {
@@ -71,5 +84,28 @@ in
target = "ssh/ssh_config";
}
];
+
+ # FIXME: this should really be socket-activated for über-awesomeness.
+ systemd.user.services.ssh-agent =
+ { enable = cfg.startAgent;
+ description = "SSH Agent";
+ wantedBy = [ "default.target" ];
+ serviceConfig =
+ { ExecStartPre = "${pkgs.coreutils}/bin/rm -f %t/ssh-agent";
+ ExecStart = "${pkgs.openssh}/bin/ssh-agent -a %t/ssh-agent";
+ StandardOutput = "null";
+ Type = "forking";
+ Restart = "on-failure";
+ SuccessExitStatus = "0 2";
+ };
+ };
+
+ environment.extraInit = optionalString cfg.startAgent
+ ''
+ if [ -z "$SSH_AUTH_SOCK" -a -n "$XDG_RUNTIME_DIR" ]; then
+ export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent"
+ fi
+ '';
+
};
}
diff --git a/nixos/modules/programs/ssmtp.nix b/nixos/modules/programs/ssmtp.nix
index 904989d57a0..34eafd4fa84 100644
--- a/nixos/modules/programs/ssmtp.nix
+++ b/nixos/modules/programs/ssmtp.nix
@@ -3,9 +3,9 @@
# directly to an SMTP server defined in its configuration file, wihout
# queueing mail locally.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/programs/venus.nix b/nixos/modules/programs/venus.nix
index 2b3bfbc6c18..2b70a795f4f 100644
--- a/nixos/modules/programs/venus.nix
+++ b/nixos/modules/programs/venus.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.venus;
@@ -40,7 +40,7 @@ in
};
dates = mkOption {
- default = "*:0,15,30,45";
+ default = "*:0/15";
type = types.string;
description = ''
Specification (in the format described by
@@ -161,13 +161,13 @@ in
'';
systemd.services.venus =
- { description = "Planet Venus, an awesome ‘river of news’ feed reader";
+ { description = "Planet Venus Feed Reader";
path = [ pkgs.venus ];
script = "exec venus-planet ${configFile}";
serviceConfig.User = "${cfg.user}";
serviceConfig.Group = "${cfg.group}";
environment.OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
- startOn = cfg.dates;
+ startAt = cfg.dates;
};
};
diff --git a/nixos/modules/programs/virtualbox.nix b/nixos/modules/programs/virtualbox.nix
index 340fec0496a..e2dd76219eb 100644
--- a/nixos/modules/programs/virtualbox.nix
+++ b/nixos/modules/programs/virtualbox.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let virtualbox = config.boot.kernelPackages.virtualbox; in
@@ -14,6 +14,7 @@ let virtualbox = config.boot.kernelPackages.virtualbox; in
services.udev.extraRules =
''
KERNEL=="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660", TAG+="systemd"
+ KERNEL=="vboxdrvu", OWNER="root", GROUP="root", MODE="0666", TAG+="systemd"
KERNEL=="vboxnetctl", OWNER="root", GROUP="root", MODE="0600", TAG+="systemd"
SUBSYSTEM=="usb_device", ACTION=="add", RUN+="${virtualbox}/libexec/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN+="${virtualbox}/libexec/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
diff --git a/nixos/modules/programs/wvdial.nix b/nixos/modules/programs/wvdial.nix
index da3f7dce98a..8e7d0e51a4e 100644
--- a/nixos/modules/programs/wvdial.nix
+++ b/nixos/modules/programs/wvdial.nix
@@ -1,8 +1,8 @@
# Global configuration for wvdial.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix
index cff751934d7..1857371ebe8 100644
--- a/nixos/modules/programs/zsh/zsh.nix
+++ b/nixos/modules/programs/zsh/zsh.nix
@@ -1,8 +1,8 @@
# This module defines global configuration for the zshell.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -26,11 +26,6 @@ in
default = false;
description = ''
Whenever to configure Zsh as an interactive shell.
- Note that this tries to make Zsh the default
- ,
- which in turn means that you might need to explicitly
- set this variable if you have another shell configured
- with NixOS.
'';
type = types.bool;
};
@@ -116,8 +111,9 @@ in
# This file is read for all shells.
# Only execute this file once per shell.
+ # But don't clobber the environment of interactive non-login children!
if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi
- __ETC_ZSHENV_SOURCED=1
+ export __ETC_ZSHENV_SOURCED=1
${cfg.shellInit}
@@ -167,7 +163,7 @@ in
environment.systemPackages = [ pkgs.zsh ];
- users.defaultUserShell = mkDefault "/run/current-system/sw/bin/zsh";
+ #users.defaultUserShell = mkDefault "/run/current-system/sw/bin/zsh";
environment.shells =
[ "/run/current-system/sw/bin/zsh"
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index ae3c9faeea6..0ee2caa28ea 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, options, ... }:
+{ config, lib, options, ... }:
-with pkgs.lib;
+with lib;
let
@@ -12,18 +12,20 @@ let
visible = true;
};
+ # warn option was renamed
obsolete = from: to: rename {
inherit from to;
name = "Obsolete name";
- use = x: builtins.trace "Obsolete option `${showOption from}' is used instead of `${showOption to}'." x;
- define = x: builtins.trace "Obsolete option `${showOption from}' is defined instead of `${showOption to}'." x;
+ use = x: builtins.trace "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'." x;
+ define = x: builtins.trace "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'." x;
};
+ # abort if deprecated option is used
deprecated = from: to: rename {
inherit from to;
name = "Deprecated name";
- use = x: abort "Deprecated option `${showOption from}' is used instead of `${showOption to}'.";
- define = x: abort "Deprecated option `${showOption from}' is defined instead of `${showOption to}'.";
+ use = x: abort "Deprecated option `${showOption from}' is used. It was renamed to `${showOption to}'.";
+ define = x: abort "Deprecated option `${showOption from}' is used. It was renamed to `${showOption to}'.";
};
showOption = concatStringsSep ".";
@@ -54,7 +56,7 @@ let
inherit visible;
});
}
- { config = setTo (mkIf (fromOf options).isDefined (define (mkMerge (fromOf options).definitions)));
+ { config = setTo (mkMerge (if (fromOf options).isDefined then [ (define (mkMerge (fromOf options).definitions)) ] else []));
}
];
@@ -72,6 +74,7 @@ in zipModules ([]
++ obsolete [ "environment" "x11Packages" ] [ "environment" "systemPackages" ]
++ obsolete [ "environment" "enableBashCompletion" ] [ "programs" "bash" "enableCompletion" ]
++ obsolete [ "environment" "nix" ] [ "nix" "package" ]
+++ obsolete [ "fonts" "extraFonts" ] [ "fonts" "fonts" ]
++ obsolete [ "security" "extraSetuidPrograms" ] [ "security" "setuidPrograms" ]
++ obsolete [ "networking" "enableWLAN" ] [ "networking" "wireless" "enable" ]
@@ -101,6 +104,8 @@ in zipModules ([]
++ obsolete [ "services" "sshd" "gatewayPorts" ] [ "services" "openssh" "gatewayPorts" ]
++ obsolete [ "services" "sshd" "permitRootLogin" ] [ "services" "openssh" "permitRootLogin" ]
++ obsolete [ "services" "xserver" "startSSHAgent" ] [ "services" "xserver" "startOpenSSHAgent" ]
+++ obsolete [ "services" "xserver" "startOpenSSHAgent" ] [ "programs" "ssh" "startAgent" ]
+++ obsolete [ "services" "xserver" "windowManager" "xbmc" ] [ "services" "xserver" "desktopManager" "xbmc" ]
# KDE
++ deprecated [ "kde" "extraPackages" ] [ "environment" "kdePackages" ]
@@ -113,8 +118,16 @@ in zipModules ([]
# !!! this hardcodes bash, could we detect from config which shell is actually used?
++ obsolete [ "environment" "promptInit" ] [ "programs" "bash" "promptInit" ]
+++ obsolete [ "services" "xserver" "driSupport" ] [ "hardware" "opengl" "driSupport" ]
+++ obsolete [ "services" "xserver" "driSupport32Bit" ] [ "hardware" "opengl" "driSupport32Bit" ]
+++ obsolete [ "services" "xserver" "s3tcSupport" ] [ "hardware" "opengl" "s3tcSupport" ]
+++ obsolete [ "hardware" "opengl" "videoDrivers" ] [ "services" "xserver" "videoDrivers" ]
+
+++ obsolete [ "services" "mysql55" ] [ "services" "mysql" ]
+
# Options that are obsolete and have no replacement.
++ obsolete' [ "boot" "loader" "grub" "bootDevice" ]
++ obsolete' [ "boot" "initrd" "luks" "enable" ]
+++ obsolete' [ "programs" "bash" "enable" ]
)
diff --git a/nixos/modules/security/apparmor-suid.nix b/nixos/modules/security/apparmor-suid.nix
index bc661164fdc..b89b379ae66 100644
--- a/nixos/modules/security/apparmor-suid.nix
+++ b/nixos/modules/security/apparmor-suid.nix
@@ -1,8 +1,8 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
let
cfg = config.security.apparmor;
in
-with pkgs.lib;
+with lib;
{
options.security.apparmor.confineSUIDApplications = mkOption {
diff --git a/nixos/modules/security/apparmor.nix b/nixos/modules/security/apparmor.nix
index b9f15159002..f29e7a5ad81 100644
--- a/nixos/modules/security/apparmor.nix
+++ b/nixos/modules/security/apparmor.nix
@@ -1,55 +1,32 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
+
+with lib;
let
cfg = config.security.apparmor;
in
-
-with pkgs.lib;
-
{
-
- ###### interface
-
options = {
-
security.apparmor = {
-
enable = mkOption {
type = types.bool;
default = false;
- description = ''
- Enable AppArmor application security system. Enable only if
- you want to further improve AppArmor.
- '';
+ description = "Enable the AppArmor Mandatory Access Control system.";
};
profiles = mkOption {
type = types.listOf types.path;
default = [];
- description = ''
- List of file names of AppArmor profiles.
- '';
+ description = "List of files containing AppArmor profiles.";
};
-
};
};
-
- ###### implementation
-
- config = mkIf (cfg.enable) {
-
- assertions = [ { assertion = config.boot.kernelPackages.kernel.features ? apparmor
- && config.boot.kernelPackages.kernel.features.apparmor;
- message = "AppArmor is enabled, but the kernel doesn't have AppArmor support"; }
- ];
-
+ config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.apparmor ];
-
systemd.services.apparmor = {
- #wantedBy = [ "basic.target" ];
wantedBy = [ "local-fs.target" ];
- path = [ pkgs.apparmor ];
+ path = [ pkgs.apparmor ];
serviceConfig = {
Type = "oneshot";
@@ -61,9 +38,6 @@ with pkgs.lib;
''${pkgs.apparmor}/sbin/apparmor_parser -Rv -I ${pkgs.apparmor}/etc/apparmor.d/ "${profile}" ; ''
) cfg.profiles;
};
-
};
-
};
-
}
diff --git a/nixos/modules/security/ca.nix b/nixos/modules/security/ca.nix
index 2e93fb36b45..8e653cd4284 100644
--- a/nixos/modules/security/ca.nix
+++ b/nixos/modules/security/ca.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -10,16 +10,14 @@ with pkgs.lib;
[ { source = "${pkgs.cacert}/etc/ca-bundle.crt";
target = "ssl/certs/ca-bundle.crt";
}
-
- # Backward compatibility; may remove at some point.
- { source = "${pkgs.cacert}/etc/ca-bundle.crt";
- target = "ca-bundle.crt";
- }
];
- environment.variables.OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
- environment.variables.CURL_CA_BUNDLE = "/etc/ssl/certs/ca-bundle.crt";
- environment.variables.GIT_SSL_CAINFO = "/etc/ssl/certs/ca-bundle.crt";
+ environment.sessionVariables =
+ { SSL_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
+ # FIXME: unneeded - remove eventually.
+ OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
+ GIT_SSL_CAINFO = "/etc/ssl/certs/ca-bundle.crt";
+ };
};
diff --git a/nixos/modules/security/duosec.nix b/nixos/modules/security/duosec.nix
new file mode 100644
index 00000000000..9893e63fb24
--- /dev/null
+++ b/nixos/modules/security/duosec.nix
@@ -0,0 +1,211 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.security.duosec;
+
+ boolToStr = b: if b then "yes" else "no";
+
+ configFile = ''
+ [duo]
+ ikey=${cfg.ikey}
+ skey=${cfg.skey}
+ host=${cfg.host}
+ ${optionalString (cfg.group != "") ("group="+cfg.group)}
+ failmode=${cfg.failmode}
+ pushinfo=${boolToStr cfg.pushinfo}
+ autopush=${boolToStr cfg.autopush}
+ motd=${boolToStr cfg.motd}
+ prompts=${toString cfg.prompts}
+ accept_env_factor=${boolToStr cfg.acceptEnvFactor}
+ fallback_local_ip=${boolToStr cfg.fallbackLocalIP}
+ '';
+
+ loginCfgFile = optional cfg.ssh.enable
+ { source = pkgs.writeText "login_duo.conf" configFile;
+ mode = "0600";
+ uid = config.ids.uids.sshd;
+ target = "duo/login_duo.conf";
+ };
+
+ pamCfgFile = optional cfg.pam.enable
+ { source = pkgs.writeText "pam_duo.conf" configFile;
+ mode = "0600";
+ uid = config.ids.uids.sshd;
+ target = "duo/pam_duo.conf";
+ };
+in
+{
+ options = {
+ security.duosec = {
+ ssh.enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "If enabled, protect SSH logins with Duo Security.";
+ };
+
+ pam.enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "If enabled, protect logins with Duo Security using PAM support.";
+ };
+
+ ikey = mkOption {
+ type = types.str;
+ description = "Integration key.";
+ };
+
+ skey = mkOption {
+ type = types.str;
+ description = "Secret key.";
+ };
+
+ host = mkOption {
+ type = types.str;
+ description = "Duo API hostname.";
+ };
+
+ group = mkOption {
+ type = types.str;
+ default = "";
+ description = "Use Duo authentication for users only in this group.";
+ };
+
+ failmode = mkOption {
+ type = types.str;
+ default = "safe";
+ description = ''
+ On service or configuration errors that prevent Duo
+ authentication, fail "safe" (allow access) or "secure" (deny
+ access). The default is "safe".
+ '';
+ };
+
+ pushinfo = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Include information such as the command to be executed in
+ the Duo Push message.
+ '';
+ };
+
+ autopush = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If true, Duo Unix will automatically send
+ a push login request to the user’s phone, falling back on a
+ phone call if push is unavailable. If
+ false, the user will be prompted to
+ choose an authentication method. When configured with
+ autopush = yes, we recommend setting
+ prompts = 1.
+ '';
+ };
+
+ motd = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Print the contents of /etc/motd to screen
+ after a succesful login.
+ '';
+ };
+
+ prompts = mkOption {
+ type = types.int;
+ default = 3;
+ description = ''
+ If a user fails to authenticate with a second factor, Duo
+ Unix will prompt the user to authenticate again. This option
+ sets the maximum number of prompts that Duo Unix will
+ display before denying access. Must be 1, 2, or 3. Default
+ is 3.
+
+ For example, when prompts = 1, the user
+ will have to successfully authenticate on the first prompt,
+ whereas if prompts = 2, if the user
+ enters incorrect information at the initial prompt, he/she
+ will be prompted to authenticate again.
+
+ When configured with autopush = true, we
+ recommend setting prompts = 1.
+ '';
+ };
+
+ acceptEnvFactor = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Look for factor selection or passcode in the
+ $DUO_PASSCODE environment variable before
+ prompting the user for input.
+
+ When $DUO_PASSCODE is non-empty, it will override
+ autopush. The SSH client will need SendEnv DUO_PASSCODE in
+ its configuration, and the SSH server will similarily need
+ AcceptEnv DUO_PASSCODE.
+ '';
+ };
+
+ fallbackLocalIP = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Duo Unix reports the IP address of the authorizing user, for
+ the purposes of authorization and whitelisting. If Duo Unix
+ cannot detect the IP address of the client, setting
+ fallbackLocalIP = yes will cause Duo Unix
+ to send the IP address of the server it is running on.
+
+ If you are using IP whitelisting, enabling this option could
+ cause unauthorized logins if the local IP is listed in the
+ whitelist.
+ '';
+ };
+
+ allowTcpForwarding = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ By default, when SSH forwarding, enabling Duo Security will
+ disable TCP forwarding. By enabling this, you potentially
+ undermine some of the SSH based login security. Note this is
+ not needed if you use PAM.
+ '';
+ };
+ };
+ };
+
+ config = mkIf (cfg.ssh.enable || cfg.pam.enable) {
+ assertions =
+ [ { assertion = cfg.failmode == "safe" || cfg.failmode == "secure";
+ message = "Invalid value for failmode (must be safe or secure).";
+ }
+ { assertion = cfg.prompts == 1 || cfg.prompts == 2 || cfg.prompts == 3;
+ message = "Invalid value for prompts (must be 1, 2, or 3).";
+ }
+ { assertion = !cfg.pam.enable;
+ message = "PAM support is currently not implemented.";
+ }
+ ];
+
+ environment.systemPackages = [ pkgs.duo-unix ];
+ security.setuidPrograms = [ "login_duo" ];
+ environment.etc = loginCfgFile ++ pamCfgFile;
+
+ /* If PAM *and* SSH are enabled, then don't do anything special.
+ If PAM isn't used, set the default SSH-only options. */
+ services.openssh.extraConfig = mkIf (cfg.ssh.enable || cfg.pam.enable) (
+ if cfg.pam.enable then "UseDNS no" else ''
+ # Duo Security configuration
+ ForceCommand ${config.security.wrapperDir}/login_duo
+ PermitTunnel no
+ ${optionalString (!cfg.allowTcpForwarding) ''
+ AllowTcpForwarding no
+ ''}
+ '');
+ };
+}
diff --git a/nixos/modules/security/grsecurity.nix b/nixos/modules/security/grsecurity.nix
new file mode 100644
index 00000000000..9e598369137
--- /dev/null
+++ b/nixos/modules/security/grsecurity.nix
@@ -0,0 +1,315 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.security.grsecurity;
+
+ customGrsecPkg =
+ (import ../../../pkgs/build-support/grsecurity {
+ grsecOptions = cfg;
+ inherit pkgs lib;
+ }).grsecPackage;
+in
+{
+ options = {
+ security.grsecurity = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable grsecurity support. This enables advanced exploit
+ hardening for the Linux kernel, and adds support for
+ administrative Role-Based Acess Control (RBAC) via
+ gradm. It also includes traditional
+ utilities for PaX.
+ '';
+ };
+
+ stable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable the stable grsecurity patch, based on Linux 3.2.
+ '';
+ };
+
+ testing = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable the testing grsecurity patch, based on Linux 3.13.
+ '';
+ };
+
+ config = {
+ mode = mkOption {
+ type = types.str;
+ default = "auto";
+ example = "custom";
+ description = ''
+ grsecurity configuration mode. This specifies whether
+ grsecurity is auto-configured or otherwise completely
+ manually configured. Can either be
+ custom or auto.
+
+ auto is recommended.
+ '';
+ };
+
+ priority = mkOption {
+ type = types.str;
+ default = "security";
+ example = "performance";
+ description = ''
+ grsecurity configuration priority. This specifies whether
+ the kernel configuration should emphasize speed or
+ security. Can either be security or
+ performance.
+ '';
+ };
+
+ system = mkOption {
+ type = types.str;
+ default = "";
+ example = "desktop";
+ description = ''
+ grsecurity system configuration. This specifies whether
+ the kernel configuration should be suitable for a Desktop
+ or a Server. Can either be server or
+ desktop.
+ '';
+ };
+
+ virtualisationConfig = mkOption {
+ type = types.str;
+ default = "none";
+ example = "host";
+ description = ''
+ grsecurity virtualisation configuration. This specifies
+ the virtualisation role of the machine - that is, whether
+ it will be a virtual machine guest, a virtual machine
+ host, or neither. Can be one of none,
+ host, or guest.
+ '';
+ };
+
+ hardwareVirtualisation = mkOption {
+ type = types.nullOr types.bool;
+ default = null;
+ example = true;
+ description = ''
+ grsecurity hardware virtualisation configuration. Set to
+ true if your machine supports hardware
+ accelerated virtualisation.
+ '';
+ };
+
+ virtualisationSoftware = mkOption {
+ type = types.str;
+ default = "";
+ example = "kvm";
+ description = ''
+ grsecurity virtualisation software. Set this to the
+ specified virtual machine technology if the machine is
+ running as a guest, or a host.
+
+ Can be one of kvm,
+ xen, vmware or
+ virtualbox.
+ '';
+ };
+
+ sysctl = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If true, then set GRKERN_SYSCTL y. If
+ enabled then grsecurity can be controlled using sysctl
+ (and turned off). You are advised to *never* enable this,
+ but if you do, make sure to always set the sysctl
+ kernel.grsecurity.grsec_lock to
+ non-zero as soon as all sysctl options are set. *THIS IS
+ EXTREMELY IMPORTANT*!
+
+ If disabled, this also turns off the
+ systemd-sysctl service.
+ '';
+ };
+
+ denyChrootChmod = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If true, then set GRKERN_CHROOT_CHMOD
+ y. If enabled, this denies processes inside a
+ chroot from setting the suid or sgid bits using
+ chmod or fchmod.
+
+ By default this protection is disabled - it makes it
+ impossible to use Nix to build software on your system,
+ which is what most users want.
+
+ If you are using NixOps to deploy your software to a
+ remote machine, you're encouraged to enable this as you
+ won't need to compile code.
+ '';
+ };
+
+ restrictProc = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If true, then set GRKERN_PROC_USER
+ y. This restricts non-root users to only viewing
+ their own processes and restricts network-related
+ information, kernel symbols, and module information.
+ '';
+ };
+
+ restrictProcWithGroup = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ If true, then set GRKERN_PROC_USERGROUP
+ y. This is similar to
+ restrictProc except it allows a special
+ group (specified by unrestrictProcGid)
+ to still access otherwise classified information in
+ /proc.
+ '';
+ };
+
+ unrestrictProcGid = mkOption {
+ type = types.int;
+ default = config.ids.gids.grsecurity;
+ description = ''
+ If set, specifies a GID which is exempt from
+ /proc restrictions (set by
+ GRKERN_PROC_USERGROUP). By default,
+ this is set to the GID for grsecurity,
+ a predefined NixOS group, which the
+ root account is a member of. You may
+ conveniently add other users to this group if you need
+ access to /proc
+ '';
+ };
+
+ disableRBAC = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If true, then set GRKERN_NO_RBAC
+ y. This disables the
+ /dev/grsec device, which in turn
+ disables the RBAC system (and gradm).
+ '';
+ };
+
+ verboseVersion = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Use verbose version in kernel localversion.";
+ };
+
+ kernelExtraConfig = mkOption {
+ type = types.str;
+ default = "";
+ description = "Extra kernel configuration parameters.";
+ };
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions =
+ [ { assertion = cfg.stable || cfg.testing;
+ message = ''
+ If grsecurity is enabled, you must select either the
+ stable patch (with kernel 3.2), or the testing patch (with
+ kernel 3.13) to continue.
+ '';
+ }
+ { assertion = (cfg.stable -> !cfg.testing) || (cfg.testing -> !cfg.stable);
+ message = ''
+ You must select either the stable or testing patch, not
+ both.
+ '';
+ }
+ { assertion = (cfg.config.restrictProc -> !cfg.config.restrictProcWithGroup) ||
+ (cfg.config.restrictProcWithGroup -> !cfg.config.restrictProc);
+ message = "You cannot enable both restrictProc and restrictProcWithGroup";
+ }
+ { assertion = config.boot.kernelPackages.kernel.features ? grsecurity
+ && config.boot.kernelPackages.kernel.features.grsecurity;
+ message = "grsecurity enabled, but kernel doesn't have grsec support";
+ }
+ { assertion = elem cfg.config.mode [ "auto" "custom" ];
+ message = "grsecurity mode must either be 'auto' or 'custom'.";
+ }
+ { assertion = cfg.config.mode == "auto" -> elem cfg.config.system [ "desktop" "server" ];
+ message = "when using auto grsec mode, system must be either 'desktop' or 'server'";
+ }
+ { assertion = cfg.config.mode == "auto" -> elem cfg.config.priority [ "performance" "security" ];
+ message = "when using auto grsec mode, priority must be 'performance' or 'security'.";
+ }
+ { assertion = cfg.config.mode == "auto" -> elem cfg.config.virtualisationConfig [ "host" "guest" "none" ];
+ message = "when using auto grsec mode, 'virt' must be 'host', 'guest' or 'none'.";
+ }
+ { assertion = (cfg.config.mode == "auto" && (elem cfg.config.virtualisationConfig [ "host" "guest" ])) ->
+ cfg.config.hardwareVirtualisation != null;
+ message = "when using auto grsec mode with virtualisation, you must specify if your hardware has virtualisation extensions";
+ }
+ { assertion = (cfg.config.mode == "auto" && (elem cfg.config.virtualisationConfig [ "host" "guest" ])) ->
+ elem cfg.config.virtualisationSoftware [ "kvm" "xen" "virtualbox" "vmware" ];
+ message = "virtualisation software must be 'kvm', 'xen', 'vmware' or 'virtualbox'";
+ }
+ ];
+
+ systemd.services.grsec-lock = mkIf cfg.config.sysctl {
+ description = "grsecurity sysctl-lock Service";
+ requires = [ "sysctl.service" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig.Type = "oneshot";
+ serviceConfig.RemainAfterExit = "yes";
+ script = ''
+ locked=`cat /proc/sys/kernel/grsecurity/grsec_lock`
+ if [ "$locked" == "0" ]; then
+ echo 1 > /proc/sys/kernel/grsecurity/grsec_lock
+ echo grsecurity sysctl lock - enabled
+ else
+ echo grsecurity sysctl lock already enabled - doing nothing
+ fi
+ '';
+ };
+
+# systemd.services.grsec-learn = {
+# description = "grsecurity learning Service";
+# wantedBy = [ "local-fs.target" ];
+# serviceConfig = {
+# Type = "oneshot";
+# RemainAfterExit = "yes";
+# ExecStart = "${pkgs.gradm}/sbin/gradm -VFL /etc/grsec/learning.logs";
+# ExecStop = "${pkgs.gradm}/sbin/gradm -D";
+# };
+# };
+
+ system.activationScripts.grsec =
+ ''
+ mkdir -p /etc/grsec
+ if [ ! -f /etc/grsec/learn_config ]; then
+ cp ${pkgs.gradm}/etc/grsec/learn_config /etc/grsec
+ fi
+ if [ ! -f /etc/grsec/policy ]; then
+ cp ${pkgs.gradm}/etc/grsec/policy /etc/grsec
+ fi
+ chmod -R 0600 /etc/grsec
+ '';
+
+ # Enable AppArmor, gradm udev rules, and utilities
+ security.apparmor.enable = true;
+ boot.kernelPackages = customGrsecPkg;
+ services.udev.packages = [ pkgs.gradm ];
+ environment.systemPackages = [ pkgs.gradm pkgs.paxctl pkgs.pax-utils ];
+ };
+}
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index 93d12d292e4..b1b75a0068d 100644
--- a/nixos/modules/security/pam.nix
+++ b/nixos/modules/security/pam.nix
@@ -1,9 +1,9 @@
# This module provides configuration for the PAM (Pluggable
# Authentication Modules) system.
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -186,7 +186,12 @@ let
"password optional ${pkgs.samba}/lib/security/pam_smbpass.so nullok use_authtok try_first_pass"}
# Session management.
+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
session required pam_unix.so
+ ${optionalString cfg.setLoginUid
+ "session ${
+ if config.boot.isContainer then "optional" else "required"
+ } pam_loginuid.so"}
${optionalString cfg.updateWtmp
"session required ${pkgs.pam}/lib/security/pam_lastlog.so silent"}
${optionalString config.users.ldap.enable
@@ -197,8 +202,6 @@ let
"session optional ${pkgs.otpw}/lib/security/pam_otpw.so"}
${optionalString cfg.startSession
"session optional ${pkgs.systemd}/lib/security/pam_systemd.so"}
- ${optionalString cfg.setLoginUid
- "session required pam_loginuid.so"}
${optionalString cfg.forwardXAuth
"session optional pam_xauth.so xauthpath=${pkgs.xorg.xauth}/bin/xauth systemuser=99"}
${optionalString (cfg.limits != [])
diff --git a/nixos/modules/security/pam_usb.nix b/nixos/modules/security/pam_usb.nix
index 4cc99995fbc..11708a1f016 100644
--- a/nixos/modules/security/pam_usb.nix
+++ b/nixos/modules/security/pam_usb.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/security/polkit.nix b/nixos/modules/security/polkit.nix
index cafa9f82d5e..95b659d96f0 100644
--- a/nixos/modules/security/polkit.nix
+++ b/nixos/modules/security/polkit.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -18,42 +18,32 @@ in
description = "Whether to enable PolKit.";
};
- security.polkit.permissions = mkOption {
+ security.polkit.extraConfig = mkOption {
type = types.lines;
default = "";
example =
''
- [Disallow Users To Suspend]
- Identity=unix-group:users
- Action=org.freedesktop.upower.*
- ResultAny=no
- ResultInactive=no
- ResultActive=no
+ /* Log authorization checks. */
+ polkit.addRule(function(action, subject) {
+ polkit.log("user " + subject.user + " is attempting action " + action.id + " from PID " + subject.pid);
+ });
- [Allow Anybody To Eject Disks]
- Identity=unix-user:*
- Action=org.freedesktop.udisks.drive-eject
- ResultAny=yes
- ResultInactive=yes
- ResultActive=yes
-
- [Allow Alice To Mount Filesystems After Admin Authentication]
- Identity=unix-user:alice
- Action=org.freedesktop.udisks.filesystem-mount
- ResultAny=auth_admin
- ResultInactive=auth_admin
- ResultActive=auth_admin
+ /* Allow any local user to do anything (dangerous!). */
+ polkit.addRule(function(action, subject) {
+ if (subject.local) return "yes";
+ });
'';
description =
''
- Allows the default permissions of privileged actions to be overridden.
+ Any polkit rules to be added to config (in JavaScript ;-). See:
+ http://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html#polkit-rules
'';
};
security.polkit.adminIdentities = mkOption {
- type = types.str;
- default = "unix-user:0;unix-group:wheel";
- example = "";
+ type = types.listOf types.str;
+ default = [ "unix-user:0" "unix-group:wheel" ];
+ example = [ "unix-user:alice" "unix-group:admin" ];
description =
''
Specifies which users are considered “administrators”, for those
@@ -71,29 +61,23 @@ in
environment.systemPackages = [ pkgs.polkit ];
- # The polkit daemon reads action files
- environment.pathsToLink = [ "/share/polkit-1/actions" ];
+ systemd.packages = [ pkgs.polkit ];
- environment.etc =
- [ # No idea what the "null backend" is, but it seems to need this.
- { source = "${pkgs.polkit}/etc/polkit-1/nullbackend.conf.d";
- target = "polkit-1/nullbackend.conf.d";
- }
+ systemd.services.polkit.restartTriggers = [ config.system.path ];
+ systemd.services.polkit.unitConfig.X-StopIfChanged = false;
- # This file determines what users are considered
- # "administrators".
- { source = pkgs.writeText "10-nixos.conf"
- ''
- [Configuration]
- AdminIdentities=${cfg.adminIdentities}
- '';
- target = "polkit-1/localauthority.conf.d/10-nixos.conf";
- }
+ # The polkit daemon reads action/rule files
+ environment.pathsToLink = [ "/share/polkit-1" ];
- { source = pkgs.writeText "org.nixos.pkla" cfg.permissions;
- target = "polkit-1/localauthority/10-vendor.d/org.nixos.pkla";
- }
- ];
+ # PolKit rules for NixOS.
+ environment.etc."polkit-1/rules.d/10-nixos.rules".text =
+ ''
+ polkit.addAdminRule(function(action, subject) {
+ return [${concatStringsSep ", " (map (i: "\"${i}\"") cfg.adminIdentities)}];
+ });
+
+ ${cfg.extraConfig}
+ ''; #TODO: validation on compilation (at least against typos)
services.dbus.packages = [ pkgs.polkit ];
@@ -101,24 +85,27 @@ in
security.setuidPrograms = [ "pkexec" ];
- security.setuidOwners = singleton
+ security.setuidOwners = [
{ program = "polkit-agent-helper-1";
owner = "root";
group = "root";
setuid = true;
- source = "${pkgs.polkit}/libexec/polkit-1/polkit-agent-helper-1";
- };
+ source = "${pkgs.polkit}/lib/polkit-1/polkit-agent-helper-1";
+ }
+ ];
system.activationScripts.polkit =
''
- mkdir -p /var/lib/polkit-1/localauthority
- chmod 700 /var/lib/polkit-1{/localauthority,}
-
- # Force polkitd to be restarted so that it reloads its
- # configuration.
- ${pkgs.procps}/bin/pkill -INT -u root -x polkitd
+ # Probably no more needed, clean up
+ rm -rf /var/lib/{polkit-1,PolicyKit}
'';
+ users.extraUsers.polkituser = {
+ description = "PolKit daemon";
+ uid = config.ids.uids.polkituser;
+ };
+
};
}
+
diff --git a/nixos/modules/security/prey.nix b/nixos/modules/security/prey.nix
index 75b95d5fbb0..e29fa5395a1 100644
--- a/nixos/modules/security/prey.nix
+++ b/nixos/modules/security/prey.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.prey;
diff --git a/nixos/modules/security/rngd.nix b/nixos/modules/security/rngd.nix
index 720ac02f2e8..4d8fabc7696 100644
--- a/nixos/modules/security/rngd.nix
+++ b/nixos/modules/security/rngd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
options = {
@@ -30,7 +30,8 @@ with pkgs.lib;
description = "Hardware RNG Entropy Gatherer Daemon";
- serviceConfig.ExecStart = "${pkgs.rng_tools}/sbin/rngd -f";
+ serviceConfig.ExecStart = "${pkgs.rng_tools}/sbin/rngd -f -v" +
+ (if config.services.tcsd.enable then " --no-tpm=1" else "");
restartTriggers = [ pkgs.rng_tools ];
};
diff --git a/nixos/modules/security/rtkit.nix b/nixos/modules/security/rtkit.nix
index 164ad9b3aa7..afe93f24273 100644
--- a/nixos/modules/security/rtkit.nix
+++ b/nixos/modules/security/rtkit.nix
@@ -1,9 +1,9 @@
# A module for ‘rtkit’, a DBus system service that hands out realtime
# scheduling priority to processes that ask for it.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -25,8 +25,13 @@ with pkgs.lib;
config = mkIf config.security.rtkit.enable {
+ security.polkit.enable = true;
+
+ # To make polkit pickup rtkit policies
environment.systemPackages = [ pkgs.rtkit ];
+ systemd.packages = [ pkgs.rtkit ];
+
services.dbus.packages = [ pkgs.rtkit ];
users.extraUsers = singleton
diff --git a/nixos/modules/security/setuid-wrapper.c b/nixos/modules/security/setuid-wrapper.c
index 007ffbc34fe..ffd0b65b762 100644
--- a/nixos/modules/security/setuid-wrapper.c
+++ b/nixos/modules/security/setuid-wrapper.c
@@ -30,8 +30,8 @@ int main(int argc, char * * argv)
creating hard link `X' from some other location, along with a
false `X.real' file, to allow arbitrary programs from being
executed setuid. */
- assert ((strncmp(self, wrapperDir, sizeof(wrapperDir)) == 0) &&
- (self[strlen(wrapperDir)] == '/'));
+ assert ((strncmp(self, wrapperDir, strlen(wrapperDir)) == 0) &&
+ (self[strlen(wrapperDir)] == '/'));
/* Make *really* *really* sure that we were executed as `self',
and not, say, as some other setuid program. That is, our
@@ -42,12 +42,12 @@ int main(int argc, char * * argv)
assert (lstat(self, &st) != -1);
//printf("%d %d\n", st.st_uid, st.st_gid);
-
+
assert ((st.st_mode & S_ISUID) == 0 ||
- (st.st_uid == geteuid()));
+ (st.st_uid == geteuid()));
assert ((st.st_mode & S_ISGID) == 0 ||
- st.st_gid == getegid());
+ st.st_gid == getegid());
/* And, of course, we shouldn't be writable. */
assert (!(st.st_mode & (S_IWGRP | S_IWOTH)));
@@ -69,13 +69,13 @@ int main(int argc, char * * argv)
real[len] = 0;
close(fdSelf);
-
+
//printf("real = %s, len = %d\n", real, len);
execve(real, argv, environ);
fprintf(stderr, "%s: cannot run `%s': %s\n",
argv[0], real, strerror(errno));
-
+
exit(1);
}
diff --git a/nixos/modules/security/setuid-wrappers.nix b/nixos/modules/security/setuid-wrappers.nix
index 62df85816e5..373afffd3fb 100644
--- a/nixos/modules/security/setuid-wrappers.nix
+++ b/nixos/modules/security/setuid-wrappers.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -9,10 +9,11 @@ let
setuidWrapper = pkgs.stdenv.mkDerivation {
name = "setuid-wrapper";
buildCommand = ''
- ensureDir $out/bin
+ mkdir -p $out/bin
+ cp ${./setuid-wrapper.c} setuid-wrapper.c
gcc -Wall -O2 -DWRAPPER_DIR=\"${wrapperDir}\" \
- ${./setuid-wrapper.c} -o $out/bin/setuid-wrapper
- strip -s $out/bin/setuid-wrapper
+ setuid-wrapper.c -o $out/bin/setuid-wrapper
+ strip -S $out/bin/setuid-wrapper
'';
};
@@ -46,6 +47,7 @@ in
group = "postdrop";
setuid = false;
setgid = true;
+ permissions = "u+rx,g+x,o+x";
}
];
description = ''
@@ -95,8 +97,7 @@ in
}:
''
- source=${if source != "" then source else "$(PATH=$SETUID_PATH type -tP ${program})"}
- if test -z "$source"; then
+ if ! source=${if source != "" then source else "$(PATH=$SETUID_PATH type -tP ${program})"}; then
# If we can't find the program, fall back to the
# system profile.
source=/nix/var/nix/profiles/default/bin/${program}
@@ -115,8 +116,7 @@ in
# programs to be wrapped.
SETUID_PATH=${config.system.path}/bin:${config.system.path}/sbin
- if test -d ${wrapperDir}; then rm -f ${wrapperDir}/*; fi # */
- mkdir -p ${wrapperDir}
+ rm -f ${wrapperDir}/* # */
${concatMapStrings makeSetuidWrapper setuidPrograms}
'';
diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix
index 215a8ecd601..cbd1628caae 100644
--- a/nixos/modules/security/sudo.nix
+++ b/nixos/modules/security/sudo.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -58,10 +58,8 @@ in
# Don't edit this file. Set the NixOS option ‘security.sudo.configFile’ instead.
# Environment variables to keep for root and %wheel.
- Defaults:root,%wheel env_keep+=LOCALE_ARCHIVE
- Defaults:root,%wheel env_keep+=NIX_CONF_DIR
- Defaults:root,%wheel env_keep+=NIX_PATH
Defaults:root,%wheel env_keep+=TERMINFO_DIRS
+ Defaults:root,%wheel env_keep+=TERMINFO
# Keep SSH_AUTH_SOCK so that pam_ssh_agent_auth.so can do its magic.
Defaults env_keep+=SSH_AUTH_SOCK
@@ -80,10 +78,13 @@ in
security.pam.services.sudo = { sshAgentAuth = true; };
environment.etc = singleton
- { source = pkgs.writeText "sudoers-in" cfg.configFile;
+ { source =
+ pkgs.runCommand "sudoers"
+ {src = pkgs.writeText "sudoers-in" cfg.configFile; }
# Make sure that the sudoers file is syntactically valid.
# (currently disabled - NIXOS-66)
- #"${pkgs.sudo}/sbin/visudo -f $src -c && cp $src $out";
+ "${pkgs.sudo}/sbin/visudo -f $src -c &&
+ cp $src $out";
target = "sudoers";
mode = "0440";
};
diff --git a/nixos/modules/services/amqp/activemq/default.nix b/nixos/modules/services/amqp/activemq/default.nix
index 915d179e699..261f9761766 100644
--- a/nixos/modules/services/amqp/activemq/default.nix
+++ b/nixos/modules/services/amqp/activemq/default.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
with pkgs;
+with lib;
let
@@ -12,7 +12,7 @@ let
phases = [ "installPhase" ];
buildInputs = [ jdk ];
installPhase = ''
- ensureDir $out/lib
+ mkdir -p $out/lib
source ${activemq}/lib/classpath.env
export CLASSPATH
ln -s "${./ActiveMQBroker.java}" ActiveMQBroker.java
diff --git a/nixos/modules/services/amqp/rabbitmq.nix b/nixos/modules/services/amqp/rabbitmq.nix
index 696b5ad4379..a930098bfee 100644
--- a/nixos/modules/services/amqp/rabbitmq.nix
+++ b/nixos/modules/services/amqp/rabbitmq.nix
@@ -1,22 +1,15 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
-
cfg = config.services.rabbitmq;
+ config_file = pkgs.writeText "rabbitmq.config" cfg.config;
+ config_file_wo_suffix = builtins.substring 0 ((builtins.stringLength config_file) - 7) config_file;
- run = cmd: "${pkgs.sudo}/bin/sudo -E -u rabbitmq ${cmd}";
-
-in
-
-{
-
-
+in {
###### interface
-
options = {
-
services.rabbitmq = {
enable = mkOption {
@@ -40,55 +33,94 @@ in
'';
};
- };
+ dataDir = mkOption {
+ type = types.path;
+ default = "/var/lib/rabbitmq";
+ description = ''
+ Data directory for rabbitmq.
+ '';
+ };
+ cookie = mkOption {
+ default = "";
+ type = types.str;
+ description = ''
+ Erlang cookie is a string of arbitrary length which must
+ be the same for several nodes to be allowed to communicate.
+ Leave empty to generate automatically.
+ '';
+ };
+
+ config = mkOption {
+ default = "";
+ type = types.str;
+ description = ''
+ Verbatim configuration file contents.
+ See http://www.rabbitmq.com/configure.htm
+ '';
+ };
+
+ plugins = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = "The names of plugins to enable";
+ };
+ };
};
###### implementation
-
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.rabbitmq_server ];
users.extraUsers.rabbitmq = {
description = "RabbitMQ server user";
- home = "/var/empty";
+ home = "${cfg.dataDir}";
group = "rabbitmq";
uid = config.ids.uids.rabbitmq;
};
users.extraGroups.rabbitmq.gid = config.ids.gids.rabbitmq;
- jobs.rabbitmq = {
- description = "RabbitMQ server";
+ systemd.services.rabbitmq = {
+ description = "RabbitMQ Server";
- startOn = "started network-interfaces";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
- preStart =
- ''
- mkdir -m 0700 -p /var/lib/rabbitmq
- chown rabbitmq /var/lib/rabbitmq
+ environment = {
+ RABBITMQ_MNESIA_BASE = "${cfg.dataDir}/mnesia";
+ RABBITMQ_NODE_IP_ADDRESS = cfg.listenAddress;
+ RABBITMQ_SERVER_START_ARGS = "-rabbit error_logger tty -rabbit sasl_error_logger false";
+ SYS_PREFIX = "";
+ RABBITMQ_ENABLED_PLUGINS_FILE = pkgs.writeText "enabled_plugins" ''
+ [ ${concatStringsSep "," cfg.plugins} ].
+ '';
+ } // optionalAttrs (cfg.config != "") { RABBITMQ_CONFIG_FILE = config_file_wo_suffix; };
- mkdir -m 0700 -p /var/log/rabbitmq
- chown rabbitmq /var/log/rabbitmq
- '';
-
- environment.HOME = "/var/lib/rabbitmq";
- environment.RABBITMQ_NODE_IP_ADDRESS = cfg.listenAddress;
- environment.SYS_PREFIX = "";
-
- exec =
- ''
- ${run "${pkgs.rabbitmq_server}/sbin/rabbitmq-server"}
- '';
-
- preStop =
- ''
- ${run "${pkgs.rabbitmq_server}/sbin/rabbitmqctl stop"}
- '';
+ serviceConfig = {
+ ExecStart = "${pkgs.rabbitmq_server}/sbin/rabbitmq-server";
+ User = "rabbitmq";
+ Group = "rabbitmq";
+ PermissionsStartOnly = true;
};
+ preStart = ''
+ mkdir -p ${cfg.dataDir} && chmod 0700 ${cfg.dataDir}
+ if [ "$(id -u)" = 0 ]; then chown rabbitmq:rabbitmq ${cfg.dataDir}; fi
+
+ ${optionalString (cfg.cookie != "") ''
+ echo -n ${cfg.cookie} > ${cfg.dataDir}/.erlang.cookie
+ chmod 400 ${cfg.dataDir}/.erlang.cookie
+ chown rabbitmq:rabbitmq ${cfg.dataDir}/.erlang.cookie
+ ''}
+
+ mkdir -p /var/log/rabbitmq && chmod 0700 /var/log/rabbitmq
+ chown rabbitmq:rabbitmq /var/log/rabbitmq
+ '';
+ };
+
};
}
diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix
index d021b8bd3ba..653c0ed5d70 100644
--- a/nixos/modules/services/audio/alsa.nix
+++ b/nixos/modules/services/audio/alsa.nix
@@ -1,14 +1,12 @@
# ALSA sound support.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
inherit (pkgs) alsaUtils;
- soundState = "/var/lib/alsa/asound.state";
-
in
{
@@ -35,6 +33,17 @@ in
'';
};
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ example = ''
+ defaults.pcm.!card 3
+ '';
+ description = ''
+ Set addition configuration for system-wide alsa.
+ '';
+ };
+
};
};
@@ -46,6 +55,13 @@ in
environment.systemPackages = [ alsaUtils ];
+ environment.etc = mkIf (config.sound.extraConfig != "")
+ [
+ { source = pkgs.writeText "asound.conf" config.sound.extraConfig;
+ target = "asound.conf";
+ }
+ ];
+
# ALSA provides a udev rule for restoring volume settings.
services.udev.packages = [ alsaUtils ];
@@ -55,6 +71,7 @@ in
{ description = "Store Sound Card State";
wantedBy = [ "multi-user.target" ];
unitConfig.RequiresMountsFor = "/var/lib/alsa";
+ unitConfig.ConditionVirtualization = "!systemd-nspawn";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
diff --git a/nixos/modules/services/audio/fuppes.nix b/nixos/modules/services/audio/fuppes.nix
index 3eb0732bae2..4a975ed5f53 100644
--- a/nixos/modules/services/audio/fuppes.nix
+++ b/nixos/modules/services/audio/fuppes.nix
@@ -1,10 +1,10 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.fuppesd;
in
-with pkgs.lib;
+with lib;
{
options = {
diff --git a/nixos/modules/services/audio/mopidy.nix b/nixos/modules/services/audio/mopidy.nix
new file mode 100644
index 00000000000..5b865cf4c1b
--- /dev/null
+++ b/nixos/modules/services/audio/mopidy.nix
@@ -0,0 +1,118 @@
+{ config, lib, pkgs, ... }:
+
+with pkgs;
+with lib;
+
+let
+
+ uid = config.ids.uids.mopidy;
+ gid = config.ids.gids.mopidy;
+ cfg = config.services.mopidy;
+
+ mopidyConf = writeText "mopidy.conf" cfg.configuration;
+
+ mopidyLauncher = stdenv.mkDerivation {
+ name = "mopidy-launcher";
+ phases = [ "installPhase" ];
+ buildInputs = [ makeWrapper python ];
+ installPhase = ''
+ mkdir -p $out/bin
+ ln -s ${mopidy}/bin/mopidy $out/bin/mopidy
+ wrapProgram $out/bin/mopidy \
+ --prefix PYTHONPATH : \
+ "${concatStringsSep ":" (map (p: "$(toPythonPath ${p})") cfg.extensionPackages)}"
+ '';
+ };
+
+in {
+
+ options = {
+
+ services.mopidy = {
+
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Whether to enable Mopidy, a music player daemon.
+ '';
+ };
+
+ dataDir = mkOption {
+ default = "/var/lib/mopidy";
+ type = types.str;
+ description = ''
+ The directory where Mopidy stores its state.
+ '';
+ };
+
+ extensionPackages = mkOption {
+ default = [];
+ type = types.listOf types.package;
+ example = [ mopidy-spotify ];
+ description = ''
+ Mopidy extensions that should be loaded by the service.
+ '';
+ };
+
+ configuration = mkOption {
+ type = types.lines;
+ description = ''
+ The configuration that Mopidy should use.
+ '';
+ };
+
+ extraConfigFiles = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = ''
+ Extra config file read by Mopidy when the service starts.
+ Later files in the list overrides earlier configuration.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ systemd.services.mopidy = {
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" "sound.target" ];
+ description = "mopidy music player daemon";
+ preStart = "mkdir -p ${cfg.dataDir} && chown -R mopidy:mopidy ${cfg.dataDir}";
+ serviceConfig = {
+ ExecStart = "${mopidyLauncher}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)}";
+ User = "mopidy";
+ PermissionsStartOnly = true;
+ };
+ };
+
+ systemd.services.mopidy-scan = {
+ description = "mopidy local files scanner";
+ preStart = "mkdir -p ${cfg.dataDir} && chown -R mopidy:mopidy ${cfg.dataDir}";
+ serviceConfig = {
+ ExecStart = "${mopidyLauncher}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)} local scan";
+ User = "mopidy";
+ PermissionsStartOnly = true;
+ Type = "oneshot";
+ };
+ };
+
+ users.extraUsers.mopidy = {
+ inherit uid;
+ group = "mopidy";
+ extraGroups = [ "audio" ];
+ description = "Mopidy daemon user";
+ home = "${cfg.dataDir}";
+ };
+
+ users.extraGroups.mopidy.gid = gid;
+
+ };
+
+}
diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix
index a9880dee20c..53542e34b14 100644
--- a/nixos/modules/services/audio/mpd.nix
+++ b/nixos/modules/services/audio/mpd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -52,7 +52,7 @@ in {
};
dataDir = mkOption {
- default = "/var/lib/mpd/";
+ default = "/var/lib/mpd";
description = ''
The directory where MPD stores its state, tag cache,
playlists etc.
diff --git a/nixos/modules/services/backup/almir.nix b/nixos/modules/services/backup/almir.nix
index d5bc932c6b9..5ce215c5c4b 100644
--- a/nixos/modules/services/backup/almir.nix
+++ b/nixos/modules/services/backup/almir.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.almir;
@@ -154,7 +154,8 @@ in {
description = "Almir web app";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.pythonPackages.almir ];
- serviceConfig.ExecStart = "${pkgs.pythonPackages.almir}/bin/pserve ${productionini}";
+ environment.PYTHONPATH = "${pkgs.pythonPackages.almir}/lib/${pkgs.pythonPackages.python.libPrefix}/site-packages";
+ serviceConfig.ExecStart = "${pkgs.pythonPackages.pyramid}/bin/pserve ${productionini}";
};
environment.systemPackages = [ pkgs.pythonPackages.almir ];
diff --git a/nixos/modules/services/backup/bacula.nix b/nixos/modules/services/backup/bacula.nix
index 272903c99e3..c2255f68818 100644
--- a/nixos/modules/services/backup/bacula.nix
+++ b/nixos/modules/services/backup/bacula.nix
@@ -1,9 +1,9 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
# TODO: test configuration when building nixexpr (use -t parameter)
# TODO: support sqlite3 (it's deprecate?) and mysql
-with pkgs.lib;
+with lib;
let
libDir = "/var/lib/bacula";
diff --git a/nixos/modules/services/backup/mysql-backup.nix b/nixos/modules/services/backup/mysql-backup.nix
index 3ff9978fbb9..28f607861f7 100644
--- a/nixos/modules/services/backup/mysql-backup.nix
+++ b/nixos/modules/services/backup/mysql-backup.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/backup/postgresql-backup.nix b/nixos/modules/services/backup/postgresql-backup.nix
index e68ad794a96..1f7b123eca3 100644
--- a/nixos/modules/services/backup/postgresql-backup.nix
+++ b/nixos/modules/services/backup/postgresql-backup.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
inherit (pkgs) postgresql gzip;
diff --git a/nixos/modules/services/backup/rsnapshot.nix b/nixos/modules/services/backup/rsnapshot.nix
index 178ba3ec720..48ad7582b7e 100644
--- a/nixos/modules/services/backup/rsnapshot.nix
+++ b/nixos/modules/services/backup/rsnapshot.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.rsnapshot;
in
diff --git a/nixos/modules/services/backup/sitecopy-backup.nix b/nixos/modules/services/backup/sitecopy-backup.nix
index 5c7f7ffae5b..5f2b4e76aee 100644
--- a/nixos/modules/services/backup/sitecopy-backup.nix
+++ b/nixos/modules/services/backup/sitecopy-backup.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
inherit (pkgs) sitecopy;
@@ -73,7 +73,7 @@ in
touch ${stateDir}/sitecopy.secrets
chown root ${stateDir}/sitecopy.secrets
- ${pkgs.lib.concatStrings (map ( b: ''
+ ${lib.concatStrings (map ( b: ''
unset secrets
unset secret
secrets=`grep '^${b.server}' ${stateDir}/sitecopy.secrets | head -1`
diff --git a/nixos/modules/services/backup/tarsnap.nix b/nixos/modules/services/backup/tarsnap.nix
new file mode 100644
index 00000000000..1b0bcadca15
--- /dev/null
+++ b/nixos/modules/services/backup/tarsnap.nix
@@ -0,0 +1,254 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.tarsnap;
+
+ optionalNullStr = e: v: if e == null then "" else v;
+
+ configFile = cfg: ''
+ cachedir ${config.services.tarsnap.cachedir}
+ keyfile ${config.services.tarsnap.keyfile}
+ ${optionalString cfg.nodump "nodump"}
+ ${optionalString cfg.printStats "print-stats"}
+ ${optionalNullStr cfg.checkpointBytes "checkpoint-bytes "+cfg.checkpointBytes}
+ ${optionalString cfg.aggressiveNetworking "aggressive-networking"}
+ ${concatStringsSep "\n" (map (v: "exclude "+v) cfg.excludes)}
+ ${concatStringsSep "\n" (map (v: "include "+v) cfg.includes)}
+ ${optionalString cfg.lowmem "lowmem"}
+ ${optionalString cfg.verylowmem "verylowmem"}
+ '';
+in
+{
+ options = {
+ services.tarsnap = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If enabled, NixOS will periodically create backups of the
+ specified directories using the tarsnap
+ backup service. This installs a systemd
+ service called tarsnap-backup which is
+ periodically run by cron, or you may run it on-demand.
+
+ See the Tarsnap Getting
+ Started page.
+ '';
+ };
+
+ keyfile = mkOption {
+ type = types.path;
+ default = "/root/tarsnap.key";
+ description = ''
+ Path to the keyfile which identifies the machine
+ associated with your Tarsnap account. This file can
+ be created using the
+ tarsnap-keygen utility, and
+ providing your Tarsnap login credentials.
+ '';
+ };
+
+ cachedir = mkOption {
+ type = types.path;
+ default = "/var/cache/tarsnap";
+ description = ''
+ Tarsnap operations use a "cache directory" which
+ allows Tarsnap to identify which blocks of data have
+ been previously stored; this directory is specified
+ via the cachedir option. If the
+ cache directory is lost or out of date, tarsnap
+ creation/deletion operations will exit with an error
+ message instructing you to run tarsnap
+ --fsck to regenerate the cache directory.
+ '';
+ };
+
+ config = mkOption {
+ type = types.attrsOf (types.submodule (
+ {
+ options = {
+ nodump = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ If set to true, then don't
+ archive files which have the
+ nodump flag set.
+ '';
+ };
+
+ printStats = mkOption {
+ type = types.bool;
+ default = true;
+ description = "Print statistics when creating archives.";
+ };
+
+ checkpointBytes = mkOption {
+ type = types.nullOr types.str;
+ default = "1G";
+ description = ''
+ Create a checkpoint per a particular amount of
+ uploaded data. By default, Tarsnap will create
+ checkpoints once per GB of data uploaded. At
+ minimum, checkpointBytes must be
+ 1GB.
+
+ Can also be set to null to
+ disable checkpointing.
+ '';
+ };
+
+ period = mkOption {
+ type = types.str;
+ default = "15 01 * * *";
+ description = ''
+ This option defines (in the format used by cron)
+ when tarsnap is run for backups. The default is to
+ backup the specified paths at 01:15 at night every
+ day.
+ '';
+ };
+
+ aggressiveNetworking = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Aggressive network behaviour: Use multiple TCP
+ connections when writing archives. Use of this
+ option is recommended only in cases where TCP
+ congestion control is known to be the limiting
+ factor in upload performance.
+ '';
+ };
+
+ directories = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = "List of filesystem paths to archive.";
+ };
+
+ excludes = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Exclude files and directories matching the specified
+ patterns.
+ '';
+ };
+
+ includes = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Include only files and directories matching the
+ specified patterns.
+
+ Note that exclusions specified via
+ excludes take precedence over
+ inclusions.
+ '';
+ };
+
+ lowmem = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Attempt to reduce tarsnap memory consumption. This
+ option will slow down the process of creating
+ archives, but may help on systems where the average
+ size of files being backed up is less than 1 MB.
+ '';
+ };
+
+ verylowmem = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Try even harder to reduce tarsnap memory
+ consumption. This can significantly slow down
+ tarsnap, but reduces its memory usage by an
+ additional factor of 2 beyond what the
+ lowmem option does.
+ '';
+ };
+ };
+ }
+ ));
+
+ default = {};
+
+ example = literalExample ''
+ {
+ nixos =
+ { directories = [ "/home" "/root/ssl" ];
+ };
+
+ gamedata =
+ { directories = [ "/var/lib/minecraft "];
+ period = "*/30 * * * *";
+ };
+ }
+ '';
+
+ description = ''
+ Configuration of a Tarsnap archive. In the example, your
+ machine will have two tarsnap archives:
+ gamedata (backed up every 30 minutes) and
+ nixos (backed up at 1:15 AM every night by
+ default). You can control individual archive backups using
+ systemctl, using the
+ tarsnap@nixos or
+ tarsnap@gamedata units. For example,
+ systemctl start tarsnap@nixos will
+ immediately create a new NixOS archive. By default, archives
+ are suffixed with the timestamp of when they were started,
+ down to second resolution. This means you can use GNU
+ sort to sort output easily.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions =
+ (mapAttrsToList (name: cfg:
+ { assertion = cfg.directories != [];
+ message = "Must specify directories for Tarsnap to back up";
+ }) cfg.config) ++
+ (mapAttrsToList (name: cfg:
+ { assertion = cfg.lowmem -> !cfg.verylowmem && (cfg.verylowmem -> !cfg.lowmem);
+ message = "You cannot set both lowmem and verylowmem";
+ }) cfg.config);
+
+ systemd.services."tarsnap@" = {
+ description = "Tarsnap Backup of '%i'";
+ requires = [ "network.target" ];
+
+ path = [ pkgs.tarsnap pkgs.coreutils ];
+ scriptArgs = "%i";
+ script = ''
+ mkdir -p -m 0755 $(dirname ${cfg.cachedir})
+ mkdir -p -m 0600 ${cfg.cachedir}
+ DIRS=`cat /etc/tarsnap/$1.dirs`
+ exec tarsnap --configfile /etc/tarsnap/$1.conf -c -f $1-$(date +"%Y%m%d%H%M%S") $DIRS
+ '';
+ };
+
+ services.cron.systemCronJobs = mapAttrsToList (name: cfg:
+ "${cfg.period} root ${config.systemd.package}/bin/systemctl start tarsnap@${name}"
+ ) cfg.config;
+
+ environment.etc =
+ (mapAttrs' (name: cfg: nameValuePair "tarsnap/${name}.conf"
+ { text = configFile cfg;
+ }) cfg.config) //
+ (mapAttrs' (name: cfg: nameValuePair "tarsnap/${name}.dirs"
+ { text = concatStringsSep " " cfg.directories;
+ }) cfg.config);
+
+ environment.systemPackages = [ pkgs.tarsnap ];
+ };
+}
diff --git a/nixos/modules/services/continuous-integration/jenkins/default.nix b/nixos/modules/services/continuous-integration/jenkins/default.nix
new file mode 100644
index 00000000000..b01b5c3245a
--- /dev/null
+++ b/nixos/modules/services/continuous-integration/jenkins/default.nix
@@ -0,0 +1,119 @@
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ cfg = config.services.jenkins;
+in {
+ options = {
+ services.jenkins = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable the jenkins continuous integration server.
+ '';
+ };
+
+ user = mkOption {
+ default = "jenkins";
+ type = with types; string;
+ description = ''
+ User the jenkins server should execute under.
+ '';
+ };
+
+ group = mkOption {
+ default = "jenkins";
+ type = with types; string;
+ description = ''
+ If the default user "jenkins" is configured then this is the primary
+ group of that user.
+ '';
+ };
+
+ home = mkOption {
+ default = "/var/lib/jenkins";
+ type = with types; string;
+ description = ''
+ The path to use as JENKINS_HOME. If the default user "jenkins" is configured then
+ this is the home of the "jenkins" user.
+ '';
+ };
+
+ port = mkOption {
+ default = 8080;
+ type = types.uniq types.int;
+ description = ''
+ Specifies port number on which the jenkins HTTP interface listens. The default is 8080.
+ '';
+ };
+
+ packages = mkOption {
+ default = [ pkgs.stdenv pkgs.git pkgs.jdk pkgs.openssh pkgs.nix ];
+ type = types.listOf types.package;
+ description = ''
+ Packages to add to PATH for the jenkins process.
+ '';
+ };
+
+ environment = mkOption {
+ default = { NIX_REMOTE = "daemon"; };
+ type = with types; attrsOf string;
+ description = ''
+ Additional environment variables to be passed to the jenkins process.
+ The environment will always include JENKINS_HOME.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ users.extraGroups = optional (cfg.group == "jenkins") {
+ name = "jenkins";
+ gid = config.ids.gids.jenkins;
+ };
+
+ users.extraUsers = optional (cfg.user == "jenkins") {
+ name = "jenkins";
+ description = "jenkins user";
+ createHome = true;
+ home = cfg.home;
+ group = cfg.group;
+ useDefaultShell = true;
+ uid = config.ids.uids.jenkins;
+ };
+
+ systemd.services.jenkins = {
+ description = "Jenkins Continuous Integration Server";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ environment = {
+ JENKINS_HOME = cfg.home;
+ } // cfg.environment;
+
+ path = cfg.packages;
+
+ script = ''
+ ${pkgs.jdk}/bin/java -jar ${pkgs.jenkins} --httpPort=${toString cfg.port}
+ '';
+
+ postStart = ''
+ until ${pkgs.curl}/bin/curl -s -L localhost:${toString cfg.port} ; do
+ sleep 10
+ done
+ while true ; do
+ index=`${pkgs.curl}/bin/curl -s -L localhost:${toString cfg.port}`
+ if [[ !("$index" =~ 'Please wait while Jenkins is restarting' ||
+ "$index" =~ 'Please wait while Jenkins is getting ready to work') ]]; then
+ exit 0
+ fi
+ sleep 30
+ done
+ '';
+
+ serviceConfig = {
+ User = cfg.user;
+ };
+ };
+ };
+}
diff --git a/nixos/modules/services/continuous-integration/jenkins/slave.nix b/nixos/modules/services/continuous-integration/jenkins/slave.nix
new file mode 100644
index 00000000000..5836d92a4fc
--- /dev/null
+++ b/nixos/modules/services/continuous-integration/jenkins/slave.nix
@@ -0,0 +1,68 @@
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ cfg = config.services.jenkinsSlave;
+ masterCfg = config.services.jenkins;
+in {
+ options = {
+ services.jenkinsSlave = {
+ # todo:
+ # * assure the profile of the jenkins user has a JRE and any specified packages. This would
+ # enable ssh slaves.
+ # * Optionally configure the node as a jenkins ad-hoc slave. This would imply configuration
+ # properties for the master node.
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If true the system will be configured to work as a jenkins slave.
+ If the system is also configured to work as a jenkins master then this has no effect.
+ In progress: Currently only assures the jenkins user is configured.
+ '';
+ };
+
+ user = mkOption {
+ default = "jenkins";
+ type = with types; string;
+ description = ''
+ User the jenkins slave agent should execute under.
+ '';
+ };
+
+ group = mkOption {
+ default = "jenkins";
+ type = with types; string;
+ description = ''
+ If the default slave agent user "jenkins" is configured then this is
+ the primary group of that user.
+ '';
+ };
+
+ home = mkOption {
+ default = "/var/lib/jenkins";
+ type = with types; string;
+ description = ''
+ The path to use as JENKINS_HOME. If the default user "jenkins" is configured then
+ this is the home of the "jenkins" user.
+ '';
+ };
+ };
+ };
+
+ config = mkIf (cfg.enable && !masterCfg.enable) {
+ users.extraGroups = optional (cfg.group == "jenkins") {
+ name = "jenkins";
+ gid = config.ids.gids.jenkins;
+ };
+
+ users.extraUsers = optional (cfg.user == "jenkins") {
+ name = "jenkins";
+ description = "jenkins user";
+ createHome = true;
+ home = cfg.home;
+ group = cfg.group;
+ useDefaultShell = true;
+ uid = config.ids.uids.jenkins;
+ };
+ };
+}
diff --git a/nixos/modules/services/databases/4store-endpoint.nix b/nixos/modules/services/databases/4store-endpoint.nix
index 7872ea2dc6a..f2d64b6891d 100644
--- a/nixos/modules/services/databases/4store-endpoint.nix
+++ b/nixos/modules/services/databases/4store-endpoint.nix
@@ -1,10 +1,10 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.fourStoreEndpoint;
endpointUser = "fourstorehttp";
run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${endpointUser} -c";
in
-with pkgs.lib;
+with lib;
{
###### interface
@@ -54,7 +54,7 @@ with pkgs.lib;
users.extraUsers = singleton
{ name = endpointUser;
- uid = config.ids.uids.fourStoreEndpoint;
+ uid = config.ids.uids.fourstorehttp;
description = "4Store SPARQL endpoint user";
# home = stateDir;
};
diff --git a/nixos/modules/services/databases/4store.nix b/nixos/modules/services/databases/4store.nix
index 412d14b050c..469fef69c95 100644
--- a/nixos/modules/services/databases/4store.nix
+++ b/nixos/modules/services/databases/4store.nix
@@ -1,11 +1,11 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.fourStore;
stateDir = "/var/lib/4store";
fourStoreUser = "fourstore";
run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fourStoreUser}";
in
-with pkgs.lib;
+with lib;
{
###### interface
@@ -45,7 +45,7 @@ with pkgs.lib;
users.extraUsers = singleton
{ name = fourStoreUser;
- uid = config.ids.uids.fourStore;
+ uid = config.ids.uids.fourstore;
description = "4Store database user";
home = stateDir;
};
diff --git a/nixos/modules/services/databases/couchdb.nix b/nixos/modules/services/databases/couchdb.nix
new file mode 100644
index 00000000000..e1fe6be6f6a
--- /dev/null
+++ b/nixos/modules/services/databases/couchdb.nix
@@ -0,0 +1,186 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.couchdb;
+ configFile = pkgs.writeText "couchdb.ini"
+ ''
+ [couchdb]
+ database_dir = ${cfg.databaseDir}
+ uri_file = ${cfg.uriFile}
+ view_index_dir = ${cfg.viewIndexDir}
+
+ [httpd]
+ port = ${toString cfg.port}
+ bind_address = ${cfg.bindAddress}
+
+ [log]
+ file = ${cfg.logFile}
+ '';
+
+in {
+
+ ###### interface
+
+ options = {
+
+ services.couchdb = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to run CouchDB Server.
+ '';
+ };
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.couchdb;
+ example = literalExample "pkgs.couchdb";
+ description = ''
+ CouchDB package to use.
+ '';
+ };
+
+
+ user = mkOption {
+ type = types.string;
+ default = "couchdb";
+ description = ''
+ User account under which couchdb runs.
+ '';
+ };
+
+ group = mkOption {
+ type = types.string;
+ default = "couchdb";
+ description = ''
+ Group account under which couchdb runs.
+ '';
+ };
+
+ # couchdb options: http://docs.couchdb.org/en/latest/config/index.html
+
+ databaseDir = mkOption {
+ type = types.path;
+ default = "/var/lib/couchdb";
+ description = ''
+ Specifies location of CouchDB database files (*.couch named). This
+ location should be writable and readable for the user the CouchDB
+ service runs as (couchdb by default).
+ '';
+ };
+
+ uriFile = mkOption {
+ type = types.path;
+ default = "/var/run/couchdb/couchdb.uri";
+ description = ''
+ This file contains the full URI that can be used to access this
+ instance of CouchDB. It is used to help discover the port CouchDB is
+ running on (if it was set to 0 (e.g. automatically assigned any free
+ one). This file should be writable and readable for the user that
+ runs the CouchDB service (couchdb by default).
+ '';
+ };
+
+ viewIndexDir = mkOption {
+ type = types.path;
+ default = "/var/lib/couchdb";
+ description = ''
+ Specifies location of CouchDB view index files. This location should
+ be writable and readable for the user that runs the CouchDB service
+ (couchdb by default).
+ '';
+ };
+
+ bindAddress = mkOption {
+ type = types.string;
+ default = "127.0.0.1";
+ description = ''
+ Defines the IP address by which CouchDB will be accessible.
+ '';
+ };
+
+ port = mkOption {
+ type = types.int;
+ default = 5984;
+ description = ''
+ Defined the port number to listen.
+ '';
+ };
+
+ logFile = mkOption {
+ type = types.path;
+ default = "/var/log/couchdb.log";
+ description = ''
+ Specifies the location of file for logging output.
+ '';
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Extra configuration. Overrides any other cofiguration.
+ '';
+ };
+
+ configFile = mkOption {
+ type = types.string;
+ default = "/var/lib/couchdb/couchdb.ini";
+ description = ''
+ Custom configuration file. File needs to be readable and writable
+ from couchdb user/group.
+ '';
+ };
+
+ };
+
+ };
+
+ ###### implementation
+
+ config = mkIf config.services.couchdb.enable {
+
+ environment.systemPackages = [ cfg.package ];
+
+ systemd.services.couchdb = {
+ description = "CouchDB Server";
+ wantedBy = [ "multi-user.target" ];
+
+ preStart =
+ ''
+ mkdir -p `dirname ${cfg.uriFile}`;
+ mkdir -p `dirname ${cfg.logFile}`;
+ mkdir -p ${cfg.databaseDir};
+ mkdir -p ${cfg.viewIndexDir};
+ touch ${cfg.configFile}
+
+ if [ "$(id -u)" = 0 ]; then
+ chown ${cfg.user}:${cfg.group} ${cfg.uriFile}
+ chown ${cfg.user}:${cfg.group} ${cfg.databaseDir}
+ chown ${cfg.user}:${cfg.group} ${cfg.viewIndexDir}
+ chown ${cfg.user}:${cfg.group} ${cfg.configFile}
+ fi
+ '';
+
+ serviceConfig = {
+ PermissionsStartOnly = true;
+ User = cfg.user;
+ Group = cfg.group;
+ ExecStart = "${cfg.package}/bin/couchdb -a ${configFile} -a ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig} -a ${cfg.configFile}";
+ };
+ };
+
+ users.extraUsers.couchdb = {
+ description = "CouchDB Server user";
+ group = "couchdb";
+ uid = config.ids.uids.couchdb;
+ };
+
+ users.extraGroups.couchdb.gid = config.ids.gids.couchdb;
+
+ };
+}
diff --git a/nixos/modules/services/databases/firebird.nix b/nixos/modules/services/databases/firebird.nix
index 75c225bdb67..c874b218a5e 100644
--- a/nixos/modules/services/databases/firebird.nix
+++ b/nixos/modules/services/databases/firebird.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
# TODO: This may file may need additional review, eg which configuartions to
# expose to the user.
@@ -19,7 +19,7 @@
# Eg superserver is said to be most efficiently using resources according to
# http://www.firebirdsql.org/manual/qsg25-classic-or-super.html
-with pkgs.lib;
+with lib;
let
@@ -49,6 +49,7 @@ in
package = mkOption {
default = pkgs.firebirdSuper;
+ type = types.package;
/*
Example: package = pkgs.firebirdSuper.override { icu =
pkgs.icu; };
which is not recommended for compatibility
@@ -158,5 +159,7 @@ in
uid = config.ids.uids.firebird;
};
+ users.extraGroups.firebird.gid = config.ids.gids.firebird;
+
};
}
diff --git a/nixos/modules/services/databases/influxdb.nix b/nixos/modules/services/databases/influxdb.nix
new file mode 100644
index 00000000000..61fe96d5d64
--- /dev/null
+++ b/nixos/modules/services/databases/influxdb.nix
@@ -0,0 +1,241 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.influxdb;
+
+ influxdbConfig = pkgs.writeText "config.toml" ''
+ bind-address = "${cfg.bindAddress}"
+
+ [logging]
+ level = "info"
+ file = "stdout"
+
+ [admin]
+ port = ${toString cfg.adminPort}
+ assets = "${pkgs.influxdb}/share/influxdb/admin"
+
+ [api]
+ port = ${toString cfg.apiPort}
+ ${cfg.apiExtraConfig}
+
+ [input_plugins]
+ ${cfg.inputPluginsConfig}
+
+ [raft]
+ dir = "${cfg.dataDir}/raft"
+ ${cfg.raftConfig}
+
+ [storage]
+ dir = "${cfg.dataDir}/db"
+ ${cfg.storageConfig}
+
+ [cluster]
+ ${cfg.clusterConfig}
+
+ [sharding]
+ ${cfg.shardingConfig}
+
+ [wal]
+ dir = "${cfg.dataDir}/wal"
+ ${cfg.walConfig}
+
+ ${cfg.extraConfig}
+ '';
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.influxdb = {
+
+ enable = mkOption {
+ default = false;
+ description = "Whether to enable the influxdb server";
+ type = types.uniq types.bool;
+ };
+
+ package = mkOption {
+ default = pkgs.influxdb;
+ description = "Which influxdb derivation to use";
+ type = types.package;
+ };
+
+ user = mkOption {
+ default = "influxdb";
+ description = "User account under which influxdb runs";
+ type = types.string;
+ };
+
+ group = mkOption {
+ default = "influxdb";
+ description = "Group under which influxdb runs";
+ type = types.string;
+ };
+
+ dataDir = mkOption {
+ default = "/var/db/influxdb";
+ description = "Data directory for influxd data files.";
+ type = types.path;
+ };
+
+ bindAddress = mkOption {
+ default = "127.0.0.1";
+ description = "Address where influxdb listens";
+ type = types.str;
+ };
+
+ adminPort = mkOption {
+ default = 8083;
+ description = "The port where influxdb admin listens";
+ type = types.int;
+ };
+
+ apiPort = mkOption {
+ default = 8086;
+ description = "The port where influxdb api listens";
+ type = types.int;
+ };
+
+ apiExtraConfig = mkOption {
+ default = ''
+ read-timeout = "5s"
+ '';
+ description = "Extra influxdb api configuration";
+ example = ''
+ ssl-port = 8084
+ ssl-cert = /path/to/cert.pem
+ read-timeout = "5s"
+ '';
+ type = types.lines;
+ };
+
+ inputPluginsConfig = mkOption {
+ default = "";
+ description = "Configuration of influxdb extra plugins";
+ example = ''
+ [input_plugins.graphite]
+ enabled = true
+ port = 2003
+ database = "graphite"
+ '';
+ };
+
+ raftConfig = mkOption {
+ default = ''
+ port = 8090
+ '';
+ description = "Influxdb raft configuration";
+ type = types.lines;
+ };
+
+ storageConfig = mkOption {
+ default = ''
+ write-buffer-size = 10000
+ '';
+ description = "Influxdb raft configuration";
+ type = types.lines;
+ };
+
+ clusterConfig = mkOption {
+ default = ''
+ protobuf_port = 8099
+ protobuf_timeout = "2s"
+ protobuf_heartbeat = "200ms"
+ protobuf_min_backoff = "1s"
+ protobuf_max_backoff = "10s"
+
+ write-buffer-size = 10000
+ max-response-buffer-size = 100
+
+ concurrent-shard-query-limit = 10
+ '';
+ description = "Influxdb cluster configuration";
+ type = types.lines;
+ };
+
+ leveldbConfig = mkOption {
+ default = ''
+ max-open-files = 40
+ lru-cache-size = "200m"
+ max-open-shards = 0
+ point-batch-size = 100
+ write-batch-size = 5000000
+ '';
+ description = "Influxdb leveldb configuration";
+ type = types.lines;
+ };
+
+ shardingConfig = mkOption {
+ default = ''
+ replication-factor = 1
+
+ [sharding.short-term]
+ duration = "7d"
+ split = 1
+
+ [sharding.long-term]
+ duration = "30d"
+ split = 1
+ '';
+ description = "Influxdb sharding configuration";
+ type = types.lines;
+ };
+
+ walConfig = mkOption {
+ default = ''
+ flush-after = 1000
+ bookmark-after = 1000
+ index-after = 1000
+ requests-per-logfile = 10000
+ '';
+ description = "Influxdb write-ahead log configuration";
+ type = types.lines;
+ };
+
+ extraConfig = mkOption {
+ default = "";
+ description = "Extra configuration options for influxdb";
+ type = types.string;
+ };
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.influxdb.enable {
+
+ systemd.services.influxdb = {
+ description = "InfluxDB Server";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+ serviceConfig = {
+ ExecStart = ''${cfg.package}/bin/influxdb -config "${influxdbConfig}"'';
+ User = "${cfg.user}";
+ Group = "${cfg.group}";
+ PermissionsStartOnly = true;
+ };
+ preStart = ''
+ mkdir -m 0770 -p ${cfg.dataDir}
+ if [ "$(id -u)" = 0 ]; then chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}; fi
+ '';
+ };
+
+ users.extraUsers = optional (cfg.user == "influxdb") {
+ name = "influxdb";
+ uid = config.ids.uids.influxdb;
+ description = "Influxdb daemon user";
+ };
+
+ users.extraGroups = optional (cfg.group == "influxdb") {
+ name = "influxdb";
+ gid = config.ids.gids.influxdb;
+ };
+ };
+
+}
diff --git a/nixos/modules/services/databases/memcached.nix b/nixos/modules/services/databases/memcached.nix
index a0e264f2299..c6875af506d 100644
--- a/nixos/modules/services/databases/memcached.nix
+++ b/nixos/modules/services/databases/memcached.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -68,8 +68,9 @@ in
config = mkIf config.services.memcached.enable {
- users.extraUsers = singleton
+ users.extraUsers.memcached =
{ name = cfg.user;
+ uid = config.ids.uids.memcached;
description = "Memcached server user";
};
diff --git a/nixos/modules/services/databases/monetdb.nix b/nixos/modules/services/databases/monetdb.nix
new file mode 100644
index 00000000000..9f09c71e005
--- /dev/null
+++ b/nixos/modules/services/databases/monetdb.nix
@@ -0,0 +1,88 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.services.monetdb;
+ monetdbUser = "monetdb";
+in
+with lib;
+{
+
+ ###### interface
+
+ options = {
+
+ services.monetdb = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable MonetDB database server.";
+ };
+
+ package = mkOption {
+ type = types.path;
+ description = "MonetDB package to use.";
+ };
+
+ dbfarmDir = mkOption {
+ type = types.path;
+ default = "/var/lib/monetdb";
+ description = ''
+ Specifies location of Monetdb dbfarm (keeps database and auxiliary files).
+ '';
+ };
+
+ port = mkOption {
+ default = "50000";
+ example = "50000";
+ description = "Port to listen on.";
+ };
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers.monetdb =
+ { name = monetdbUser;
+ uid = config.ids.uids.monetdb;
+ description = "monetdb user";
+ home = cfg.dbfarmDir;
+ };
+
+ users.extraGroups.monetdb.gid = config.ids.gids.monetdb;
+
+ environment.systemPackages = [ cfg.package ];
+
+ systemd.services.monetdb =
+ { description = "MonetDB Server";
+
+ wantedBy = [ "multi-user.target" ];
+
+ after = [ "network.target" ];
+
+ path = [ cfg.package ];
+
+ preStart =
+ ''
+ # Initialise the database.
+ if ! test -e ${cfg.dbfarmDir}/.merovingian_properties; then
+ mkdir -m 0700 -p ${cfg.dbfarmDir}
+ chown -R ${monetdbUser} ${cfg.dbfarmDir}
+ ${cfg.package}/bin/monetdbd create ${cfg.dbfarmDir}
+ ${cfg.package}/bin/monetdbd set port=${cfg.port} ${cfg.dbfarmDir}
+ fi
+ '';
+
+ serviceConfig.ExecStart = "${cfg.package}/bin/monetdbd start -n ${cfg.dbfarmDir}";
+
+ serviceConfig.ExecStop = "${cfg.package}/bin/monetdbd stop ${cfg.dbfarmDir}";
+
+ unitConfig.RequiresMountsFor = "${cfg.dbfarmDir}";
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/databases/mongodb.nix b/nixos/modules/services/databases/mongodb.nix
index d6299415893..fe82ca430e1 100644
--- a/nixos/modules/services/databases/mongodb.nix
+++ b/nixos/modules/services/databases/mongodb.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -39,6 +39,7 @@ in
package = mkOption {
default = pkgs.mongodb;
+ type = types.package;
description = "
Which MongoDB derivation to use.
";
@@ -90,8 +91,9 @@ in
config = mkIf config.services.mongodb.enable {
- users.extraUsers = singleton
- { name = cfg.user;
+ users.extraUsers.mongodb = mkIf (cfg.user == "mongodb")
+ { name = "mongodb";
+ uid = config.ids.uids.mongodb;
description = "MongoDB server user";
};
diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix
index 8be05a27cdc..b94a3fbf3de 100644
--- a/nixos/modules/services/databases/mysql.nix
+++ b/nixos/modules/services/databases/mysql.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -8,18 +8,23 @@ let
mysql = cfg.package;
+ is55 = mysql.mysqlVersion == "5.5";
+
+ mysqldDir = if is55 then "${mysql}/bin" else "${mysql}/libexec";
+
pidFile = "${cfg.pidDir}/mysqld.pid";
mysqldOptions =
- "--user=${cfg.user} --datadir=${cfg.dataDir} " +
+ "--user=${cfg.user} --datadir=${cfg.dataDir} --basedir=${mysql} " +
"--pid-file=${pidFile}";
myCnf = pkgs.writeText "my.cnf"
''
[mysqld]
+ port = ${toString cfg.port}
${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "log-bin=mysql-bin"}
${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "server-id = ${toString cfg.replication.serverId}"}
- ${optionalString (cfg.replication.role == "slave")
+ ${optionalString (cfg.replication.role == "slave" && !is55)
''
master-host = ${cfg.replication.masterHost}
master-user = ${cfg.replication.masterUser}
@@ -47,7 +52,8 @@ in
};
package = mkOption {
- default = pkgs.mysql;
+ type = types.package;
+ example = literalExample "pkgs.mysql";
description = "
Which MySQL derivation to use.
";
@@ -176,7 +182,7 @@ in
chown -R ${cfg.user} ${cfg.pidDir}
'';
- serviceConfig.ExecStart = "${mysql}/libexec/mysqld --defaults-extra-file=${myCnf} ${mysqldOptions}";
+ serviceConfig.ExecStart = "${mysqldDir}/mysqld --defaults-extra-file=${myCnf} ${mysqldOptions}";
postStart =
''
@@ -216,6 +222,16 @@ in
fi
'') cfg.initialDatabases}
+ ${optionalString (cfg.replication.role == "slave" && is55)
+ ''
+ # Set up the replication master
+
+ ( echo "stop slave;"
+ echo "change master to master_host='${cfg.replication.masterHost}', master_user='${cfg.replication.masterUser}', master_password='${cfg.replication.masterPassword}';"
+ echo "start slave;"
+ ) | ${mysql}/bin/mysql -u root -N
+ ''}
+
${optionalString (cfg.initialScript != null)
''
# Execute initial script
@@ -235,9 +251,6 @@ in
rm /tmp/mysql_init
fi
''; # */
-
- serviceConfig.ExecStop =
- "${mysql}/bin/mysqladmin ${optionalString (cfg.rootPassword != null) "--user=root --password=\"$(cat ${cfg.rootPassword})\""} shutdown";
};
};
diff --git a/nixos/modules/services/databases/mysql55.nix b/nixos/modules/services/databases/mysql55.nix
deleted file mode 100644
index fe8b29e3c6b..00000000000
--- a/nixos/modules/services/databases/mysql55.nix
+++ /dev/null
@@ -1,248 +0,0 @@
-{ config, pkgs, ... }:
-
-with pkgs.lib;
-
-let
-
- cfg = config.services.mysql55;
-
- mysql = cfg.package;
-
- pidFile = "${cfg.pidDir}/mysqld.pid";
-
- mysqldOptions =
- "--user=${cfg.user} --datadir=${cfg.dataDir} " +
- "--pid-file=${pidFile}";
-
- myCnf = pkgs.writeText "my.cnf"
- ''
- [mysqld]
- ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "log-bin=mysql-bin"}
- ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "server-id = ${toString cfg.replication.serverId}"}
- ${cfg.extraOptions}
- '';
-
-in
-
-{
-
- ###### interface
-
- options = {
-
- services.mysql55 = {
-
- enable = mkOption {
- default = false;
- description = "
- Whether to enable the MySQL server.
- ";
- };
-
- package = mkOption {
- default = pkgs.mysql55;
- description = "
- Which MySQL derivation to use.
- ";
- };
-
- port = mkOption {
- default = "3306";
- description = "Port of MySQL";
- };
-
- user = mkOption {
- default = "mysql";
- description = "User account under which MySQL runs";
- };
-
- dataDir = mkOption {
- default = "/var/mysql"; # !!! should be /var/db/mysql
- description = "Location where MySQL stores its table files";
- };
-
- pidDir = mkOption {
- default = "/var/run/mysql";
- description = "Location of the file which stores the PID of the MySQL server";
- };
-
- extraOptions = mkOption {
- default = "";
- example = ''
- key_buffer_size = 6G
- table_cache = 1600
- log-error = /var/log/mysql_err.log
- '';
- description = ''
- Provide extra options to the MySQL configuration file.
-
- Please note, that these options are added to the
- [mysqld] section so you don't need to explicitly
- state it again.
- '';
- };
-
- initialDatabases = mkOption {
- default = [];
- description = "List of database names and their initial schemas that should be used to create databases on the first startup of MySQL";
- example = [
- { name = "foodatabase"; schema = literalExample "./foodatabase.sql"; }
- { name = "bardatabase"; schema = literalExample "./bardatabase.sql"; }
- ];
- };
-
- initialScript = mkOption {
- default = null;
- description = "A file containing SQL statements to be executed on the first startup. Can be used for granting certain permissions on the database";
- };
-
- # FIXME: remove this option; it's a really bad idea.
- rootPassword = mkOption {
- default = null;
- description = "Path to a file containing the root password, modified on the first startup. Not specifying a root password will leave the root password empty.";
- };
-
- replication = {
- role = mkOption {
- default = "none";
- description = "Role of the MySQL server instance. Can be either: master, slave or none";
- };
-
- serverId = mkOption {
- default = 1;
- description = "Id of the MySQL server instance. This number must be unique for each instance";
- };
-
- masterHost = mkOption {
- description = "Hostname of the MySQL master server";
- };
-
- masterUser = mkOption {
- description = "Username of the MySQL replication user";
- };
-
- masterPassword = mkOption {
- description = "Password of the MySQL replication user";
- };
-
- masterPort = mkOption {
- default = 3306;
- description = "Port number on which the MySQL master server runs";
- };
- };
- };
-
- };
-
-
- ###### implementation
-
- config = mkIf config.services.mysql55.enable {
-
- users.extraUsers.mysql = {
- description = "MySQL server user";
- group = "mysql";
- uid = config.ids.uids.mysql;
- };
-
- users.extraGroups.mysql.gid = config.ids.gids.mysql;
-
- environment.systemPackages = [mysql];
-
- systemd.services.mysql =
- { description = "MySQL Server";
-
- wantedBy = [ "multi-user.target" ];
-
- unitConfig.RequiresMountsFor = "${cfg.dataDir}";
-
- preStart =
- ''
- if ! test -e ${cfg.dataDir}/mysql; then
- mkdir -m 0700 -p ${cfg.dataDir}
- chown -R ${cfg.user} ${cfg.dataDir}
- ${mysql}/bin/mysql_install_db ${mysqldOptions}
- touch /tmp/mysql_init
- fi
-
- mkdir -m 0700 -p ${cfg.pidDir}
- chown -R ${cfg.user} ${cfg.pidDir}
- '';
-
- serviceConfig.ExecStart = "${mysql}/bin/mysqld --defaults-extra-file=${myCnf} ${mysqldOptions}";
-
- postStart =
- ''
- # Wait until the MySQL server is available for use
- count=0
- while [ ! -e /tmp/mysql.sock ]
- do
- if [ $count -eq 30 ]
- then
- echo "Tried 30 times, giving up..."
- exit 1
- fi
-
- echo "MySQL daemon not yet started. Waiting for 1 second..."
- count=$((count++))
- sleep 1
- done
-
- if [ -f /tmp/mysql_init ]
- then
- ${concatMapStrings (database:
- ''
- # Create initial databases
- if ! test -e "${cfg.dataDir}/${database.name}"; then
- echo "Creating initial database: ${database.name}"
- ( echo "create database ${database.name};"
- echo "use ${database.name};"
-
- if [ -f "${database.schema}" ]
- then
- cat ${database.schema}
- elif [ -d "${database.schema}" ]
- then
- cat ${database.schema}/mysql-databases/*.sql
- fi
- ) | ${mysql}/bin/mysql -u root -N
- fi
- '') cfg.initialDatabases}
-
- ${optionalString (cfg.replication.role == "slave")
- ''
- # Set up the replication master
-
- ( echo "stop slave;"
- echo "change master to master_host='${cfg.replication.masterHost}', master_user='${cfg.replication.masterUser}', master_password='${cfg.replication.masterPassword}';"
- echo "start slave;"
- ) | ${mysql}/bin/mysql -u root -N
- ''}
-
- ${optionalString (cfg.initialScript != null)
- ''
- # Execute initial script
- cat ${cfg.initialScript} | ${mysql}/bin/mysql -u root -N
- ''}
-
- ${optionalString (cfg.rootPassword != null)
- ''
- # Change root password
-
- ( echo "use mysql;"
- echo "update user set Password=password('$(cat ${cfg.rootPassword})') where User='root';"
- echo "flush privileges;"
- ) | ${mysql}/bin/mysql -u root -N
- ''}
-
- rm /tmp/mysql_init
- fi
- ''; # */
-
- serviceConfig.ExecStop =
- "${mysql}/bin/mysqladmin ${optionalString (cfg.rootPassword != null) "--user=root --password=\"$(cat ${cfg.rootPassword})\""} shutdown";
- };
-
- };
-
-}
diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix
index a4dd30be1fb..eae4c114fc1 100644
--- a/nixos/modules/services/databases/openldap.nix
+++ b/nixos/modules/services/databases/openldap.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -26,6 +26,16 @@ in
";
};
+ user = mkOption {
+ default = "openldap";
+ description = "User account under which slapd runs.";
+ };
+
+ group = mkOption {
+ default = "openldap";
+ description = "Group account under which slapd runs.";
+ };
+
extraConfig = mkOption {
default = "";
description = "
@@ -49,10 +59,23 @@ in
after = [ "network.target" ];
preStart = ''
mkdir -p /var/run/slapd
+ chown -R ${cfg.user}:${cfg.group} /var/run/slapd
+ mkdir -p /var/db/openldap
+ chown -R ${cfg.user}:${cfg.group} /var/db/openldap
'';
- serviceConfig.ExecStart = "${openldap}/libexec/slapd -d 0 -f ${configFile}";
+ serviceConfig.ExecStart = "${openldap}/libexec/slapd -u openldap -g openldap -d 0 -f ${configFile}";
};
- };
+ users.extraUsers = optionalAttrs (cfg.user == "openldap") (singleton
+ { name = "openldap";
+ group = cfg.group;
+ uid = config.ids.uids.openldap;
+ });
+ users.extraGroups = optionalAttrs (cfg.group == "openldap") (singleton
+ { name = "openldap";
+ gid = config.ids.gids.openldap;
+ });
+
+ };
}
diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix
index 73447e3cf0d..01c55479b2b 100644
--- a/nixos/modules/services/databases/postgresql.nix
+++ b/nixos/modules/services/databases/postgresql.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -30,6 +30,7 @@ let
hba_file = '${pkgs.writeText "pg_hba.conf" cfg.authentication}'
ident_file = '${pkgs.writeText "pg_ident.conf" cfg.identMap}'
log_destination = 'stderr'
+ port = ${toString cfg.port}
${cfg.extraConfig}
'';
@@ -54,7 +55,7 @@ in
};
package = mkOption {
- type = types.path;
+ type = types.package;
example = literalExample "pkgs.postgresql92";
description = ''
PostgreSQL package to use.
@@ -63,9 +64,9 @@ in
port = mkOption {
type = types.int;
- default = "5432";
+ default = 5432;
description = ''
- Port for PostgreSQL.
+ The port on which PostgreSQL listens.
'';
};
@@ -81,7 +82,11 @@ in
type = types.lines;
default = "";
description = ''
- Defines how users authenticate themselves to the server.
+ Defines how users authenticate themselves to the server. By
+ default, "trust" access to local users will always be granted
+ along with any other custom options. If you do not want this,
+ set this option using "lib.mkForce" to override this
+ behaviour.
'';
};
@@ -105,7 +110,9 @@ in
type = types.bool;
default = false;
description = ''
- Whether to run PostgreSQL with -i flag to enable TCP/IP connections.
+ Whether PostgreSQL should listen on all network interfaces.
+ If disabled, the database can only be accessed via its Unix
+ domain socket or via TCP connections to localhost.
'';
};
@@ -181,8 +188,13 @@ in
# Initialise the database.
if ! test -e ${cfg.dataDir}; then
mkdir -m 0700 -p ${cfg.dataDir}
- chown -R postgres ${cfg.dataDir}
- su -s ${pkgs.stdenv.shell} postgres -c 'initdb -U root'
+ if [ "$(id -u)" = 0 ]; then
+ chown -R postgres ${cfg.dataDir}
+ su -s ${pkgs.stdenv.shell} postgres -c 'initdb -U root'
+ else
+ # For non-root operation.
+ initdb
+ fi
rm -f ${cfg.dataDir}/*.conf
touch "${cfg.dataDir}/.first_startup"
fi
@@ -203,6 +215,7 @@ in
# Shut down Postgres using SIGINT ("Fast Shutdown mode"). See
# http://www.postgresql.org/docs/current/static/server-shutdown.html
KillSignal = "SIGINT";
+ KillMode = "mixed";
# Give Postgres a decent amount of time to clean up after
# receiving systemd's SIGINT.
diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix
index ea6399ba4f4..b91c389e90a 100644
--- a/nixos/modules/services/databases/redis.nix
+++ b/nixos/modules/services/databases/redis.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.redis;
@@ -38,90 +38,97 @@ in
services.redis = {
enable = mkOption {
+ type = types.bool;
default = false;
description = "Whether to enable the Redis server.";
};
package = mkOption {
+ type = types.package;
default = pkgs.redis;
description = "Which Redis derivation to use.";
};
user = mkOption {
+ type = types.str;
default = "redis";
- description = "User account under which Redis runs";
+ description = "User account under which Redis runs.";
};
pidFile = mkOption {
+ type = types.path;
default = "/var/lib/redis/redis.pid";
description = "";
};
port = mkOption {
+ type = types.int;
default = 6379;
- description = "The port for Redis to listen to";
- type = with types; int;
+ description = "The port for Redis to listen to.";
};
bind = mkOption {
+ type = with types; nullOr str;
default = null; # All interfaces
- description = "The IP interface to bind to";
+ description = "The IP interface to bind to.";
example = "127.0.0.1";
};
unixSocket = mkOption {
+ type = with types; nullOr path;
default = null;
- description = "The path to the socket to bind to";
+ description = "The path to the socket to bind to.";
example = "/var/run/redis.sock";
};
logLevel = mkOption {
+ type = types.str;
default = "notice"; # debug, verbose, notice, warning
example = "debug";
- description = "Specify the server verbosity level, options: debug, verbose, notice, warning";
- type = with types; string;
+ description = "Specify the server verbosity level, options: debug, verbose, notice, warning.";
};
logfile = mkOption {
+ type = types.str;
default = "/dev/null";
description = "Specify the log file name. Also 'stdout' can be used to force Redis to log on the standard output.";
example = "/var/log/redis.log";
- type = with types; string;
};
syslog = mkOption {
+ type = types.bool;
default = true;
description = "Enable logging to the system logger.";
- type = with types; bool;
};
databases = mkOption {
+ type = types.int;
default = 16;
description = "Set the number of databases.";
- type = with types; int;
};
save = mkOption {
+ type = with types; listOf (listOf int);
default = [ [900 1] [300 10] [60 10000] ];
description = "The schedule in which data is persisted to disk, represented as a list of lists where the first element represent the amount of seconds and the second the number of changes.";
example = [ [900 1] [300 10] [60 10000] ];
};
dbFilename = mkOption {
+ type = types.str;
default = "dump.rdb";
- description = "The filename where to dump the DB";
- type = with types; string;
+ description = "The filename where to dump the DB.";
};
dbpath = mkOption {
+ type = types.path;
default = "/var/lib/redis";
- description = "The DB will be written inside this directory, with the filename specified using the 'dbFilename' configuration";
- type = with types; string;
+ description = "The DB will be written inside this directory, with the filename specified using the 'dbFilename' configuration.";
};
slaveOf = mkOption {
default = null; # { ip, port }
- description = "An attribute set with two attributes: ip and port to which this redis instance acts as a slave";
+ description = "An attribute set with two attributes: ip and port to which this redis instance acts as a slave.";
example = { ip = "192.168.1.100"; port = 6379; };
};
@@ -134,46 +141,47 @@ in
};
requirePass = mkOption {
+ type = with types; nullOr str;
default = null;
description = "Password for database (STORED PLAIN TEXT, WORLD-READABLE IN NIX STORE)";
example = "letmein!";
};
appendOnly = mkOption {
+ type = types.bool;
default = false;
description = "By default data is only periodically persisted to disk, enable this option to use an append-only file for improved persistence.";
- type = with types; bool;
};
appendOnlyFilename = mkOption {
+ type = types.str;
default = "appendonly.aof";
description = "Filename for the append-only file (stored inside of dbpath)";
- type = with types; string;
};
appendFsync = mkOption {
+ type = types.str;
default = "everysec"; # no, always, everysec
- description = "How often to fsync the append-only log, options: no, always, everysec";
- type = with types; string;
+ description = "How often to fsync the append-only log, options: no, always, everysec.";
};
slowLogLogSlowerThan = mkOption {
+ type = types.int;
default = 10000;
- description = "Log queries whose execution take longer than X in milliseconds";
+ description = "Log queries whose execution take longer than X in milliseconds.";
example = 1000;
- type = with types; int;
};
slowLogMaxLen = mkOption {
+ type = types.int;
default = 128;
- description = "Maximum number of items to keep in slow log";
- type = with types; int;
+ description = "Maximum number of items to keep in slow log.";
};
extraConfig = mkOption {
+ type = types.lines;
default = "";
- description = "Extra configuration options for redis.conf";
- type = with types; string;
+ description = "Extra configuration options for redis.conf.";
};
};
diff --git a/nixos/modules/services/databases/virtuoso.nix b/nixos/modules/services/databases/virtuoso.nix
index 6a29fc13211..f955cb74b6b 100644
--- a/nixos/modules/services/databases/virtuoso.nix
+++ b/nixos/modules/services/databases/virtuoso.nix
@@ -1,10 +1,10 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.virtuoso;
virtuosoUser = "virtuoso";
stateDir = "/var/lib/virtuoso";
in
-with pkgs.lib;
+with lib;
{
###### interface
diff --git a/nixos/modules/services/desktops/accountsservice.nix b/nixos/modules/services/desktops/accountsservice.nix
new file mode 100644
index 00000000000..c28c2729576
--- /dev/null
+++ b/nixos/modules/services/desktops/accountsservice.nix
@@ -0,0 +1,40 @@
+# AccountsService daemon.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.accounts-daemon = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable AccountsService, a DBus service for accessing
+ the list of user accounts and information attached to those accounts.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.accounts-daemon.enable {
+
+ environment.systemPackages = [ pkgs.accountsservice ];
+
+ services.dbus.packages = [ pkgs.accountsservice ];
+
+ systemd.packages = [ pkgs.accountsservice ];
+ };
+
+}
diff --git a/nixos/modules/services/desktops/geoclue2.nix b/nixos/modules/services/desktops/geoclue2.nix
new file mode 100644
index 00000000000..6bdd5edff1f
--- /dev/null
+++ b/nixos/modules/services/desktops/geoclue2.nix
@@ -0,0 +1,39 @@
+# GeoClue 2 daemon.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.geoclue2 = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GeoClue 2 daemon, a DBus service
+ that provides location informationfor accessing.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.geoclue2.enable {
+
+ environment.systemPackages = [ pkgs.geoclue2 ];
+
+ services.dbus.packages = [ pkgs.geoclue2 ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/at-spi2-core.nix b/nixos/modules/services/desktops/gnome3/at-spi2-core.nix
new file mode 100644
index 00000000000..6e4c59f4bb3
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/at-spi2-core.nix
@@ -0,0 +1,39 @@
+# at-spi2-core daemon.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.at-spi2-core = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable at-spi2-core, a service for the Assistive Technologies
+ available on the GNOME platform.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.at-spi2-core.enable {
+
+ environment.systemPackages = [ pkgs.at_spi2_core ];
+
+ services.dbus.packages = [ pkgs.at_spi2_core ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/evolution-data-server.nix b/nixos/modules/services/desktops/gnome3/evolution-data-server.nix
new file mode 100644
index 00000000000..a8f8da0eed5
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/evolution-data-server.nix
@@ -0,0 +1,42 @@
+# Evolution Data Server daemon.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.evolution-data-server = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable Evolution Data Server, a collection of services for
+ storing addressbooks and calendars.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.evolution-data-server.enable {
+
+ environment.systemPackages = [ gnome3.evolution_data_server ];
+
+ services.dbus.packages = [ gnome3.evolution_data_server ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gnome-documents.nix b/nixos/modules/services/desktops/gnome3/gnome-documents.nix
new file mode 100644
index 00000000000..88bbdadfcbd
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-documents.nix
@@ -0,0 +1,46 @@
+# GNOME Documents daemon.
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gnome-documents = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GNOME Documents services, a document
+ manager application for GNOME.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gnome-documents.enable {
+
+ environment.systemPackages = [ gnome3.gnome-documents ];
+
+ services.dbus.packages = [ gnome3.gnome-documents ];
+
+ services.gnome3.gnome-online-accounts.enable = true;
+
+ services.gnome3.gnome-online-miners.enable = true;
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gnome-keyring.nix b/nixos/modules/services/desktops/gnome3/gnome-keyring.nix
new file mode 100644
index 00000000000..566c8a50e26
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-keyring.nix
@@ -0,0 +1,43 @@
+# GNOME Keyring daemon.
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gnome-keyring = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GNOME Keyring daemon, a service designed to
+ take care of the user's security credentials,
+ such as user names and passwordsa search engine.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gnome-keyring.enable {
+
+ environment.systemPackages = [ gnome3.gnome_keyring ];
+
+ services.dbus.packages = [ gnome3.gnome_keyring ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix b/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix
new file mode 100644
index 00000000000..82d04c62c70
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix
@@ -0,0 +1,42 @@
+# GNOME Online Accounts daemon.
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gnome-online-accounts = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GNOME Online Accounts daemon, a service that provides
+ a single sign-on framework for the GNOME desktop.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gnome-online-accounts.enable {
+
+ environment.systemPackages = [ gnome3.gnome_online_accounts ];
+
+ services.dbus.packages = [ gnome3.gnome_online_accounts ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gnome-online-miners.nix b/nixos/modules/services/desktops/gnome3/gnome-online-miners.nix
new file mode 100644
index 00000000000..6acd633b62c
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-online-miners.nix
@@ -0,0 +1,42 @@
+# GNOME Online Miners daemon.
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gnome-online-miners = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GNOME Online Miners, a service that
+ crawls through your online content.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gnome-online-miners.enable {
+
+ environment.systemPackages = [ gnome3.gnome-online-miners ];
+
+ services.dbus.packages = [ gnome3.gnome-online-miners ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gnome-user-share.nix b/nixos/modules/services/desktops/gnome3/gnome-user-share.nix
new file mode 100644
index 00000000000..e5c94cff7c8
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-user-share.nix
@@ -0,0 +1,45 @@
+# GNOME User Share daemon.
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gnome-user-share = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GNOME User Share, a service that exports the
+ contents of the Public folder in your home directory on the local network.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gnome-user-share.enable {
+
+ environment.systemPackages = [ gnome3.gnome-user-share ];
+
+ services.xserver.displayManager.sessionCommands = with gnome3; ''
+ # Don't let gnome-control-center depend upon gnome-user-share
+ export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${gnome-user-share}/share/gsettings-schemas/${gnome-user-share.name}
+ '';
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gvfs.nix b/nixos/modules/services/desktops/gnome3/gvfs.nix
new file mode 100644
index 00000000000..7e1382b161e
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gvfs.nix
@@ -0,0 +1,42 @@
+# gvfs backends
+
+{ config, lib, ... }:
+
+with lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gvfs = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable gvfs backends, userspace virtual filesystem used
+ by GNOME components via D-Bus.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gvfs.enable {
+
+ environment.systemPackages = [ gnome3.gvfs ];
+
+ services.dbus.packages = [ gnome3.gvfs ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/seahorse.nix b/nixos/modules/services/desktops/gnome3/seahorse.nix
new file mode 100644
index 00000000000..45925aaca9b
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/seahorse.nix
@@ -0,0 +1,41 @@
+# Seahorse daemon.
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.seahorse = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable Seahorse search provider for the GNOME Shell activity search.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.seahorse.enable {
+
+ environment.systemPackages = [ gnome3.seahorse ];
+
+ services.dbus.packages = [ gnome3.seahorse ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/sushi.nix b/nixos/modules/services/desktops/gnome3/sushi.nix
new file mode 100644
index 00000000000..ff7f484602c
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/sushi.nix
@@ -0,0 +1,41 @@
+# GNOME Sushi daemon.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.sushi = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable Sushi, a quick previewer for nautilus.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.sushi.enable {
+
+ environment.systemPackages = [ gnome3.sushi ];
+
+ services.dbus.packages = [ gnome3.sushi ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/tracker.nix b/nixos/modules/services/desktops/gnome3/tracker.nix
new file mode 100644
index 00000000000..8c5935a5ee3
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/tracker.nix
@@ -0,0 +1,42 @@
+# Tracker daemon.
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.tracker = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable Tracker services, a search engine,
+ search tool and metadata storage system.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.tracker.enable {
+
+ environment.systemPackages = [ gnome3.tracker ];
+
+ services.dbus.packages = [ gnome3.tracker ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/telepathy.nix b/nixos/modules/services/desktops/telepathy.nix
new file mode 100644
index 00000000000..2554f3a1666
--- /dev/null
+++ b/nixos/modules/services/desktops/telepathy.nix
@@ -0,0 +1,39 @@
+# Telepathy daemon.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.telepathy = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable Telepathy service, a communications framework
+ that enables real-time communication via pluggable protocol backends.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.telepathy.enable {
+
+ environment.systemPackages = [ pkgs.telepathy_mission_control ];
+
+ services.dbus.packages = [ pkgs.telepathy_mission_control ];
+
+ };
+
+}
diff --git a/nixos/modules/services/games/ghost-one.nix b/nixos/modules/services/games/ghost-one.nix
index 92c9112eeb6..07d7287ed88 100644
--- a/nixos/modules/services/games/ghost-one.nix
+++ b/nixos/modules/services/games/ghost-one.nix
@@ -1,5 +1,5 @@
-{pkgs, config, ...}:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.ghostOne;
@@ -57,14 +57,14 @@ in
users.extraUsers = singleton
{ name = ghostUser;
- uid = config.ids.uids.ghostOne;
+ uid = config.ids.uids.ghostone;
description = "Ghost One game server user";
home = stateDir;
};
users.extraGroups = singleton
{ name = ghostUser;
- gid = config.ids.gids.ghostOne;
+ gid = config.ids.gids.ghostone;
};
services.ghostOne.config = ''
diff --git a/nixos/modules/services/games/minecraft-server.nix b/nixos/modules/services/games/minecraft-server.nix
new file mode 100644
index 00000000000..4c734aefa46
--- /dev/null
+++ b/nixos/modules/services/games/minecraft-server.nix
@@ -0,0 +1,51 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.minecraft-server;
+in
+{
+ options = {
+ services.minecraft-server = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If enabled, start a Minecraft Server. The listening port for
+ the server is always 25565. The server
+ data will be loaded from and saved to
+ /var/lib/minecraft.
+ '';
+ };
+
+ jvmOpts = mkOption {
+ type = types.str;
+ default = "-Xmx2048M -Xms2048M";
+ description = "JVM options for the Minecraft Service.";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ users.extraUsers.minecraft = {
+ description = "Minecraft Server Service user";
+ home = "/var/lib/minecraft";
+ createHome = true;
+ uid = config.ids.uids.minecraft;
+ };
+
+ systemd.services.minecraft-server = {
+ description = "Minecraft Server Service";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+
+ serviceConfig.Restart = "always";
+ serviceConfig.User = "minecraft";
+ script = ''
+ cd /var/lib/minecraft
+ exec ${pkgs.minecraft-server}/bin/minecraft-server ${cfg.jvmOpts}
+ '';
+ };
+ };
+}
diff --git a/nixos/modules/services/hardware/80-net-name-slot.rules b/nixos/modules/services/hardware/80-net-name-slot.rules
new file mode 100644
index 00000000000..18547f170a3
--- /dev/null
+++ b/nixos/modules/services/hardware/80-net-name-slot.rules
@@ -0,0 +1,13 @@
+# Copied from systemd 203.
+ACTION=="remove", GOTO="net_name_slot_end"
+SUBSYSTEM!="net", GOTO="net_name_slot_end"
+NAME!="", GOTO="net_name_slot_end"
+
+IMPORT{cmdline}="net.ifnames"
+ENV{net.ifnames}=="0", GOTO="net_name_slot_end"
+
+NAME=="", ENV{ID_NET_NAME_ONBOARD}!="", NAME="$env{ID_NET_NAME_ONBOARD}"
+NAME=="", ENV{ID_NET_NAME_SLOT}!="", NAME="$env{ID_NET_NAME_SLOT}"
+NAME=="", ENV{ID_NET_NAME_PATH}!="", NAME="$env{ID_NET_NAME_PATH}"
+
+LABEL="net_name_slot_end"
diff --git a/nixos/modules/services/hardware/acpid.nix b/nixos/modules/services/hardware/acpid.nix
index adba6394dcf..a20b1a1ee3a 100644
--- a/nixos/modules/services/hardware/acpid.nix
+++ b/nixos/modules/services/hardware/acpid.nix
@@ -1,12 +1,12 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
acpiConfDir = pkgs.runCommand "acpi-events" {}
''
- ensureDir $out
+ mkdir -p $out
${
# Generate a configuration file for each event. (You can't have
# multiple events in one config file...)
@@ -16,7 +16,7 @@ let
echo "event=${event.event}" > $fn
echo "action=${pkgs.writeScript "${event.name}.sh" event.action}" >> $fn
'';
- in pkgs.lib.concatMapStrings f events
+ in lib.concatMapStrings f events
}
'';
@@ -110,6 +110,7 @@ in
exec = "acpid --confdir ${acpiConfDir}";
+ unitConfig.ConditionVirtualization = "!systemd-nspawn";
unitConfig.ConditionPathExists = [ "/proc/acpi" ];
};
diff --git a/nixos/modules/services/hardware/amd-hybrid-graphics.nix b/nixos/modules/services/hardware/amd-hybrid-graphics.nix
new file mode 100644
index 00000000000..087bd0e0409
--- /dev/null
+++ b/nixos/modules/services/hardware/amd-hybrid-graphics.nix
@@ -0,0 +1,39 @@
+{ config, pkgs, lib, ... }:
+
+{
+
+ ###### interface
+
+ options = {
+
+ hardware.amdHybridGraphics.disable = lib.mkOption {
+ default = false;
+ type = lib.types.bool;
+ description = ''
+ Completely disable the AMD graphics card and use the
+ integrated graphics processor instead.
+ '';
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = lib.mkIf config.hardware.amdHybridGraphics.disable {
+ systemd.services."amd-hybrid-graphics" = {
+ path = [ pkgs.bash ];
+ description = "Disable AMD Card";
+ after = [ "sys-kernel-debug.mount" ];
+ requires = [ "sys-kernel-debug.mount" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ ExecStart = "${pkgs.bash}/bin/sh -c 'echo -e \"IGD\\nOFF\" > /sys/kernel/debug/vgaswitcheroo/switch; exit 0'";
+ ExecStop = "${pkgs.bash}/bin/sh -c 'echo ON >/sys/kernel/debug/vgaswitcheroo/switch; exit 0'";
+ };
+ };
+ };
+
+}
diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix
index b0714a3ce80..68d0406e63b 100644
--- a/nixos/modules/services/hardware/bluetooth.nix
+++ b/nixos/modules/services/hardware/bluetooth.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -28,7 +28,7 @@ with pkgs.lib;
services.dbus.packages = [ pkgs.bluez ];
systemd.services."dbus-org.bluez" = {
- description = "Bluetooth service";
+ description = "Bluetooth Service";
serviceConfig = {
Type = "dbus";
BusName = "org.bluez";
diff --git a/nixos/modules/services/hardware/nvidia-optimus.nix b/nixos/modules/services/hardware/nvidia-optimus.nix
index 4c0ce794d4f..9fe4021c424 100644
--- a/nixos/modules/services/hardware/nvidia-optimus.nix
+++ b/nixos/modules/services/hardware/nvidia-optimus.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let kernel = config.boot.kernelPackages; in
@@ -8,9 +8,9 @@ let kernel = config.boot.kernelPackages; in
options = {
- hardware.nvidiaOptimus.disable = pkgs.lib.mkOption {
+ hardware.nvidiaOptimus.disable = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Completely disable the NVIDIA graphics card and use the
integrated graphics processor instead.
@@ -22,7 +22,7 @@ let kernel = config.boot.kernelPackages; in
###### implementation
- config = pkgs.lib.mkIf config.hardware.nvidiaOptimus.disable {
+ config = lib.mkIf config.hardware.nvidiaOptimus.disable {
boot.blacklistedKernelModules = ["nouveau" "nvidia" "nvidiafb"];
boot.kernelModules = [ "bbswitch" ];
boot.extraModulePackages = [ kernel.bbswitch ];
diff --git a/nixos/modules/services/hardware/pcscd.nix b/nixos/modules/services/hardware/pcscd.nix
index 9f389efc06d..6e30dfb752d 100644
--- a/nixos/modules/services/hardware/pcscd.nix
+++ b/nixos/modules/services/hardware/pcscd.nix
@@ -1,6 +1,10 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+let
+ cfgFile = pkgs.writeText "reader.conf" "";
+in
+
+with lib;
{
@@ -24,22 +28,26 @@ with pkgs.lib;
config = mkIf config.services.pcscd.enable {
- jobs.pcscd =
- { description = "PCSC-Lite daemon";
+ systemd.sockets.pcscd = {
+ description = "PCSC-Lite Socket";
+ wantedBy = [ "sockets.target" ];
+ before = [ "multi-user.target" ];
+ socketConfig.ListenStream = "/run/pcscd/pcscd.comm";
+ };
- startOn = "started udev";
-
- daemonType = "fork";
-
- # Add to the drivers directory the only drivers we have by now: ccid
- preStart = ''
- mkdir -p /var/lib/pcsc
- rm -Rf /var/lib/pcsc/drivers
- ln -s ${pkgs.ccid}/pcsc/drivers /var/lib/pcsc/
- '';
-
- exec = "${pkgs.pcsclite}/sbin/pcscd";
+ systemd.services.pcscd = {
+ description = "PCSC-Lite daemon";
+ preStart = ''
+ mkdir -p /var/lib/pcsc
+ rm -Rf /var/lib/pcsc/drivers
+ ln -s ${pkgs.ccid}/pcsc/drivers /var/lib/pcsc/
+ '';
+ serviceConfig = {
+ Type = "forking";
+ ExecStart = "${pkgs.pcsclite}/sbin/pcscd --auto-exit -c ${cfgFile}";
+ ExecReload = "${pkgs.pcsclite}/sbin/pcscd --hotplug";
};
+ };
};
diff --git a/nixos/modules/services/hardware/pommed.nix b/nixos/modules/services/hardware/pommed.nix
index 32599554fc1..04db46999b0 100644
--- a/nixos/modules/services/hardware/pommed.nix
+++ b/nixos/modules/services/hardware/pommed.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix
index 5979feb8240..3bf765c6f99 100644
--- a/nixos/modules/services/hardware/sane.nix
+++ b/nixos/modules/services/hardware/sane.nix
@@ -1,10 +1,12 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends;
+ backends = [ pkg ] ++ config.hardware.sane.extraBackends;
+ saneConfig = pkgs.mkSaneConfig { paths = backends; };
in
@@ -26,6 +28,18 @@ in
description = "Use a development snapshot of SANE scanner drivers.";
};
+ hardware.sane.extraBackends = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = "Packages providing extra SANE backends to enable.";
+ };
+
+ hardware.sane.configDir = mkOption {
+ type = types.string;
+ default = "${saneConfig}/etc/sane.d";
+ description = "The value of SANE_CONFIG_DIR.";
+ };
+
};
@@ -33,8 +47,12 @@ in
config = mkIf config.hardware.sane.enable {
- environment.systemPackages = [ pkg ];
- services.udev.packages = [ pkg ];
+ environment.systemPackages = backends;
+ environment.sessionVariables = {
+ SANE_CONFIG_DIR = config.hardware.sane.configDir;
+ LD_LIBRARY_PATH = [ "${saneConfig}/lib/sane" ];
+ };
+ services.udev.packages = backends;
users.extraGroups."scanner".gid = config.ids.gids.scanner;
diff --git a/nixos/modules/services/hardware/tcsd.nix b/nixos/modules/services/hardware/tcsd.nix
new file mode 100644
index 00000000000..26b2c884b8f
--- /dev/null
+++ b/nixos/modules/services/hardware/tcsd.nix
@@ -0,0 +1,139 @@
+# tcsd daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+let
+
+ cfg = config.services.tcsd;
+
+ tcsdConf = pkgs.writeText "tcsd.conf" ''
+ port = 30003
+ num_threads = 10
+ system_ps_file = ${cfg.stateDir}/system.data
+ # This is the log of each individual measurement done by the system.
+ # By re-calculating the PCR registers based on this information, even
+ # finer details about the measured environment can be inferred than
+ # what is available directly from the PCR registers.
+ firmware_log_file = /sys/kernel/security/tpm0/binary_bios_measurements
+ kernel_log_file = /sys/kernel/security/ima/binary_runtime_measurements
+ #firmware_pcrs = 0,1,2,3,4,5,6,7
+ #kernel_pcrs = 10,11
+ platform_cred = ${cfg.platformCred}
+ conformance_cred = ${cfg.conformanceCred}
+ endorsement_cred = ${cfg.endorsementCred}
+ #remote_ops = create_key,random
+ #host_platform_class = server_12
+ #all_platform_classes = pc_11,pc_12,mobile_12
+ '';
+
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.tcsd = {
+
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Whether to enable tcsd, a Trusted Computing management service
+ that provides TCG Software Stack (TSS). The tcsd daemon is
+ the only portal to the Trusted Platform Module (TPM), a hardware
+ chip on the motherboard.
+ '';
+ };
+
+ user = mkOption {
+ default = "tss";
+ type = types.string;
+ description = "User account under which tcsd runs.";
+ };
+
+ group = mkOption {
+ default = "tss";
+ type = types.string;
+ description = "Group account under which tcsd runs.";
+ };
+
+ stateDir = mkOption {
+ default = "/var/lib/tpm";
+ type = types.path;
+ description = ''
+ The location of the system persistent storage file.
+ The system persistent storage file holds keys and data across
+ restarts of the TCSD and system reboots.
+ '';
+ };
+
+ platformCred = mkOption {
+ default = "${cfg.stateDir}/platform.cert";
+ type = types.path;
+ description = ''
+ Path to the platform credential for your TPM. Your TPM
+ manufacturer may have provided you with a set of credentials
+ (certificates) that should be used when creating identities
+ using your TPM. When a user of your TPM makes an identity,
+ this credential will be encrypted as part of that process.
+ See the 1.1b TPM Main specification section 9.3 for information
+ on this process. '';
+ };
+
+ conformanceCred = mkOption {
+ default = "${cfg.stateDir}/conformance.cert";
+ type = types.path;
+ description = ''
+ Path to the conformance credential for your TPM.
+ See also the platformCred option'';
+ };
+
+ endorsementCred = mkOption {
+ default = "${cfg.stateDir}/endorsement.cert";
+ type = types.path;
+ description = ''
+ Path to the endorsement credential for your TPM.
+ See also the platformCred option'';
+ };
+ };
+
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ environment.systemPackages = [ pkgs.trousers ];
+
+# system.activationScripts.tcsd =
+# ''
+# chown ${cfg.user}:${cfg.group} ${tcsdConf}
+# '';
+
+ systemd.services.tcsd = {
+ description = "TCSD";
+ after = [ "systemd-udev-settle.service" ];
+ wantedBy = [ "multi-user.target" ];
+ path = [ pkgs.trousers ];
+ preStart =
+ ''
+ mkdir -m 0700 -p ${cfg.stateDir}
+ chown -R ${cfg.user}:${cfg.group} ${cfg.stateDir}
+ '';
+ serviceConfig.ExecStart = "${pkgs.trousers}/sbin/tcsd -f -c ${tcsdConf}";
+ };
+
+ users.extraUsers = optionalAttrs (cfg.user == "tss") (singleton
+ { name = "tss";
+ group = "tss";
+ uid = config.ids.uids.nginx;
+ });
+
+ users.extraGroups = optionalAttrs (cfg.group == "tss") (singleton
+ { name = "tss";
+ gid = config.ids.gids.nginx;
+ });
+ };
+}
diff --git a/nixos/modules/services/hardware/thinkfan.nix b/nixos/modules/services/hardware/thinkfan.nix
index b39c9cb1d9b..16c31aab2d5 100644
--- a/nixos/modules/services/hardware/thinkfan.nix
+++ b/nixos/modules/services/hardware/thinkfan.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix
index 516569c0280..068d14217a2 100644
--- a/nixos/modules/services/hardware/udev.nix
+++ b/nixos/modules/services/hardware/udev.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -20,6 +20,9 @@ let
# Miscellaneous devices.
KERNEL=="kvm", MODE="0666"
KERNEL=="kqemu", MODE="0666"
+
+ # Needed for gpm.
+ SUBSYSTEM=="input", KERNEL=="mice", TAG+="systemd"
'';
# Perform substitutions in all udev rules files.
@@ -83,8 +86,8 @@ let
grep -l '\(RUN+\|IMPORT{program}\)="\(/usr\)\?/s\?bin' $i/*/udev/rules.d/* || true
done
- ${optionalString (!config.networking.usePredictableInterfaceNames) ''
- ln -s /dev/null $out/80-net-name-slot.rules
+ ${optionalString config.networking.usePredictableInterfaceNames ''
+ cp ${./80-net-name-slot.rules} $out/80-net-name-slot.rules
''}
# If auto-configuration is disabled, then remove
@@ -209,7 +212,7 @@ in
###### implementation
- config = {
+ config = mkIf (!config.boot.isContainer) {
services.udev.extraRules = nixosRules;
@@ -231,10 +234,21 @@ in
boot.extraModprobeConfig = "options firmware_class path=${config.hardware.firmware}";
- system.activationScripts.clearHotplug =
+ system.activationScripts.udevd =
''
echo "" > /proc/sys/kernel/hotplug
+
+ # Regenerate the hardware database /var/lib/udev/hwdb.bin
+ # whenever systemd changes.
+ if [ ! -e /var/lib/udev/prev-systemd -o "$(readlink /var/lib/udev/prev-systemd)" != ${config.systemd.package} ]; then
+ echo "regenerating udev hardware database..."
+ ${config.systemd.package}/bin/udevadm hwdb --update && ln -sfn ${config.systemd.package} /var/lib/udev/prev-systemd
+ fi
'';
+ systemd.services.systemd-udevd =
+ { environment.MODULE_DIR = "/run/booted-system/kernel-modules/lib/modules";
+ };
+
};
}
diff --git a/nixos/modules/services/hardware/udisks.nix b/nixos/modules/services/hardware/udisks.nix
deleted file mode 100644
index 531ee192573..00000000000
--- a/nixos/modules/services/hardware/udisks.nix
+++ /dev/null
@@ -1,45 +0,0 @@
-# Udisks daemon.
-
-{ config, pkgs, ... }:
-
-with pkgs.lib;
-
-{
-
- ###### interface
-
- options = {
-
- services.udisks = {
-
- enable = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Whether to enable Udisks, a DBus service that allows
- applications to query and manipulate storage devices.
- '';
- };
-
- };
-
- };
-
-
- ###### implementation
-
- config = mkIf config.services.udisks.enable {
-
- environment.systemPackages = [ pkgs.udisks ];
-
- services.dbus.packages = [ pkgs.udisks ];
-
- system.activationScripts.udisks =
- ''
- mkdir -m 0755 -p /var/lib/udisks
- '';
-
- services.udev.packages = [ pkgs.udisks ];
- };
-
-}
diff --git a/nixos/modules/services/hardware/udisks2.nix b/nixos/modules/services/hardware/udisks2.nix
index 178ec379ff1..f5b641c7378 100644
--- a/nixos/modules/services/hardware/udisks2.nix
+++ b/nixos/modules/services/hardware/udisks2.nix
@@ -1,8 +1,8 @@
# Udisks daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -14,7 +14,7 @@ with pkgs.lib;
enable = mkOption {
type = types.bool;
- default = false;
+ default = true;
description = ''
Whether to enable Udisks, a DBus service that allows
applications to query and manipulate storage devices.
diff --git a/nixos/modules/services/hardware/upower.nix b/nixos/modules/services/hardware/upower.nix
index 4a9b13d4aa0..0b6a101efa0 100644
--- a/nixos/modules/services/hardware/upower.nix
+++ b/nixos/modules/services/hardware/upower.nix
@@ -1,9 +1,12 @@
# Upower daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
+let
+ cfg = config.services.upower;
+in
{
###### interface
@@ -21,6 +24,15 @@ with pkgs.lib;
'';
};
+ package = mkOption {
+ type = types.package;
+ default = pkgs.upower;
+ example = lib.literalExample "pkgs.upower";
+ description = ''
+ Which upower package to use.
+ '';
+ };
+
};
};
@@ -28,13 +40,13 @@ with pkgs.lib;
###### implementation
- config = mkIf config.services.upower.enable {
+ config = mkIf cfg.enable {
- environment.systemPackages = [ pkgs.upower ];
+ environment.systemPackages = [ cfg.package ];
- services.dbus.packages = [ pkgs.upower ];
+ services.dbus.packages = [ cfg.package ];
- services.udev.packages = [ pkgs.upower ];
+ services.udev.packages = [ cfg.package ];
systemd.services.upower =
{ description = "Power Management Daemon";
@@ -42,7 +54,7 @@ with pkgs.lib;
serviceConfig =
{ Type = "dbus";
BusName = "org.freedesktop.UPower";
- ExecStart = "@${pkgs.upower}/libexec/upowerd upowerd";
+ ExecStart = "@${cfg.package}/libexec/upowerd upowerd";
};
};
diff --git a/nixos/modules/services/logging/klogd.nix b/nixos/modules/services/logging/klogd.nix
index d7d0bbf89a5..f69e08152b5 100644
--- a/nixos/modules/services/logging/klogd.nix
+++ b/nixos/modules/services/logging/klogd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
###### interface
@@ -32,6 +32,8 @@ with pkgs.lib;
path = [ pkgs.sysklogd ];
+ unitConfig.ConditionVirtualization = "!systemd-nspawn";
+
exec =
"klogd -c 1 -2 -n " +
"-k $(dirname $(readlink -f /run/booted-system/kernel))/System.map";
diff --git a/nixos/modules/services/logging/logcheck.nix b/nixos/modules/services/logging/logcheck.nix
index 2a6a6516f48..1cd032ffa76 100644
--- a/nixos/modules/services/logging/logcheck.nix
+++ b/nixos/modules/services/logging/logcheck.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.logcheck;
@@ -208,12 +208,13 @@ in
mapAttrsToList writeIgnoreRule cfg.ignore
++ mapAttrsToList writeIgnoreCronRule cfg.ignoreCron;
- users.extraUsers = singleton
- { name = cfg.user;
+ users.extraUsers = optionalAttrs (cfg.user == "logcheck") (singleton
+ { name = "logcheck";
+ uid = config.ids.uids.logcheck;
shell = "/bin/sh";
description = "Logcheck user account";
extraGroups = cfg.extraGroups;
- };
+ });
system.activationScripts.logcheck = ''
mkdir -m 700 -p /var/{lib,lock}/logcheck
diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix
index c6c0d2ea238..6887ab1e805 100644
--- a/nixos/modules/services/logging/logrotate.nix
+++ b/nixos/modules/services/logging/logrotate.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.logrotate;
@@ -8,10 +8,6 @@ let
configFile = pkgs.writeText "logrotate.conf"
cfg.config;
- cronJob = ''
- 5 * * * * root ${pkgs.logrotate}/sbin/logrotate ${configFile}
- '';
-
in
{
options = {
@@ -33,6 +29,16 @@ in
};
config = mkIf cfg.enable {
- services.cron.systemCronJobs = [ cronJob ];
+ systemd.services.logrotate = {
+ description = "Logrotate Service";
+ wantedBy = [ "multi-user.target" ];
+ startAt = "*-*-* *:05:00";
+
+ serviceConfig.Restart = "no";
+ serviceConfig.User = "root";
+ script = ''
+ exec ${pkgs.logrotate}/sbin/logrotate ${configFile}
+ '';
+ };
};
}
diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix
index 79bdf4f7bbc..802dd454878 100644
--- a/nixos/modules/services/logging/logstash.nix
+++ b/nixos/modules/services/logging/logstash.nix
@@ -1,74 +1,10 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
-
cfg = config.services.logstash;
- listToConfig = list: "[ " + (concatStringsSep ", " (map exprToConfig list)) + " ]";
-
- hashToConfig = attrs:
- let
- attrNameToConfigList = name:
- [ (exprToConfig name) (exprToConfig (getAttr name attrs)) ];
- in
- "[ " +
- (concatStringsSep ", " (map attrNameToConfigList (attrNames attrs))) +
- " ]";
-
- valueToConfig = nvpair: let name = nvpair.name; value = nvpair.value; in
- if (isAttrs value) && ((!(value ? __type)) || value.__type == "repeated")
- then ''
- ${name} {
- ${exprToConfig value}
- }
- ''
- else "${name} => ${exprToConfig value}";
-
- repeatedAttrsToConfig = values:
- concatStringsSep "\n" (map valueToConfig values);
-
- attrsToConfig = attrs:
- let
- attrToConfig = name: valueToConfig {
- inherit name;
- value = (getAttr name attrs);
- };
- in
- concatStringsSep "\n" (map attrToConfig (attrNames attrs));
-
- exprToConfig = expr:
- let
- isCustomType = expr: (isAttrs expr) && (expr ? __type);
-
- isFloat = expr: (isCustomType expr) && (expr.__type == "float");
-
- isHash = expr: (isCustomType expr) && (expr.__type == "hash");
-
- isRepeatedAttrs = expr: (isCustomType expr) && (expr.__type == "repeated");
- in
- if builtins.isBool expr then (if expr then "true" else "false") else
- if builtins.isString expr then ''"${expr}"'' else
- if builtins.isInt expr then toString expr else
- if isFloat expr then expr.value else
- if isList expr then listToConfig expr else
- if isHash expr then hashToConfig expr.value else
- if isRepeatedAttrs expr then repeatedAttrsToConfig expr.values
- else attrsToConfig expr;
-
- mergeConfigs = configs:
- let
- op = attrs: newAttrs:
- let
- isRepeated = newAttrs ? __type && newAttrs.__type == "repeated";
- in {
- values = attrs.values ++ (if isRepeated then newAttrs.values else
- map (name: { inherit name; value = getAttr name newAttrs; })
- (attrNames newAttrs));
- };
- in (foldl op { values = []; } configs) // { __type = "repeated"; };
-
in
{
@@ -78,48 +14,50 @@ in
services.logstash = {
enable = mkOption {
default = false;
- description = ''
- Enable logstash.
- '';
+ description = "Enable logstash";
+ };
+
+ enableWeb = mkOption {
+ default = false;
+ description = "Enable logstash web interface";
};
inputConfig = mkOption {
- default = {};
- description = ''
- An attribute set (or an expression generated by mkNameValuePairs)
- representing a logstash configuration's input section.
- Logstash configs are name-value pairs, where values can be bools,
- strings, numbers, arrays, hashes, or other name-value pairs,
- and names are strings that can be repeated. Name-value pairs with no
- repeats are represented by attr sets. Bools, strings, ints, and
- arrays are mapped directly. Name-value pairs with repeats can be
- generated by the config.lib.logstash.mkNameValuePairs function, which
- takes a list of attrsets and combines them while preserving attribute
- name duplicates if they occur. Similarly, there are the mkFloat and
- mkHash functions, which take a string representation of a float and an
- attrset, respectively.
+ default = ''stdin { type => "example" }'';
+ description = "Logstash input configuration";
+ example = ''
+ # Read from journal
+ pipe {
+ command => "${pkgs.systemd}/bin/journalctl -f -o json"
+ type => "syslog" codec => json {}
+ }
'';
- apply = mergeConfigs;
};
filterConfig = mkOption {
- default = {};
- description = ''
- An attribute set (or an expression generated by mkNameValuePairs)
- representing a logstash configuration's filter section.
- See inputConfig description for details.
+ default = ''noop {}'';
+ description = "logstash filter configuration";
+ example = ''
+ if [type] == "syslog" {
+ # Keep only relevant systemd fields
+ # http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html
+ prune {
+ whitelist_names => [
+ "type", "@timestamp", "@version",
+ "MESSAGE", "PRIORITY", "SYSLOG_FACILITY",
+ ]
+ }
+ }
'';
- apply = mergeConfigs;
};
outputConfig = mkOption {
- default = {};
- description = ''
- An attribute set (or an expression generated by mkNameValuePairs)
- representing a logstash configuration's output section.
- See inputConfig description for details.
+ default = ''stdout { debug => true debug_format => "json"}'';
+ description = "Logstash output configuration";
+ example = ''
+ redis { host => "localhost" data_type => "list" key => "logstash" codec => json }
+ elasticsearch { embedded => true }
'';
- apply = mergeConfigs;
};
};
};
@@ -127,35 +65,26 @@ in
###### implementation
- config = mkMerge [ {
- lib.logstash = {
- mkFloat = stringRep: { __type = "float"; value = stringRep; };
-
- mkHash = attrs: { __type = "hash"; value = attrs; };
-
- mkNameValuePairs = mergeConfigs;
- };
- } ( mkIf cfg.enable {
+ config = mkIf cfg.enable {
systemd.services.logstash = with pkgs; {
- description = "Logstash daemon";
-
+ description = "Logstash Daemon";
wantedBy = [ "multi-user.target" ];
+ environment = { JAVA_HOME = jre; };
+ serviceConfig = {
+ ExecStart = "${logstash}/bin/logstash agent -f ${writeText "logstash.conf" ''
+ input {
+ ${cfg.inputConfig}
+ }
- path = [ jre ];
+ filter {
+ ${cfg.filterConfig}
+ }
- script = "cd /tmp && exec java -jar ${logstash} agent -f ${writeText "logstash.conf" ''
- input {
- ${exprToConfig cfg.inputConfig}
- }
-
- filter {
- ${exprToConfig cfg.filterConfig}
- }
-
- output {
- ${exprToConfig cfg.outputConfig}
- }
- ''} &> /var/log/logstash.log";
+ output {
+ ${cfg.outputConfig}
+ }
+ ''} ${optionalString cfg.enableWeb "-- web"}";
+ };
};
- })];
+ };
}
diff --git a/nixos/modules/services/logging/rsyslogd.nix b/nixos/modules/services/logging/rsyslogd.nix
index 680c7a912c1..d4b7aa809f0 100644
--- a/nixos/modules/services/logging/rsyslogd.nix
+++ b/nixos/modules/services/logging/rsyslogd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/logging/syslog-ng.nix b/nixos/modules/services/logging/syslog-ng.nix
new file mode 100644
index 00000000000..8b892a33bb7
--- /dev/null
+++ b/nixos/modules/services/logging/syslog-ng.nix
@@ -0,0 +1,83 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.syslog-ng;
+
+ syslogngConfig = pkgs.writeText "syslog-ng.conf" ''
+ @version: 3.5
+ @include "scl.conf"
+ ${cfg.extraConfig}
+ '';
+
+ ctrlSocket = "/run/syslog-ng/syslog-ng.ctl";
+ pidFile = "/run/syslog-ng/syslog-ng.pid";
+ persistFile = "/var/syslog-ng/syslog-ng.persist";
+
+ syslogngOptions = [
+ "--foreground"
+ "--module-path=${concatStringsSep ":" (["${pkgs.syslogng}/lib/syslog-ng"] ++ cfg.extraModulePaths)}"
+ "--cfgfile=${syslogngConfig}"
+ "--control=${ctrlSocket}"
+ "--persist-file=${persistFile}"
+ "--pidfile=${pidFile}"
+ ];
+
+in {
+
+ options = {
+
+ services.syslog-ng = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable the syslog-ng daemon.
+ '';
+ };
+ serviceName = mkOption {
+ type = types.str;
+ default = "syslog-ng";
+ description = ''
+ The name of the systemd service that runs syslog-ng. Set this to
+ syslog if you want journald to automatically
+ forward all logs to syslog-ng.
+ '';
+ };
+ extraModulePaths = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "${pkgs.syslogng_incubator}/lib/syslog-ng" ];
+ description = ''
+ A list of paths that should be included in syslog-ng's
+ --module-path option. They should usually
+ end in /lib/syslog-ng
+ '';
+ };
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Configuration added to the end of syslog-ng.conf.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ systemd.services."${cfg.serviceName}" = {
+ wantedBy = [ "multi-user.target" ];
+ preStart = "mkdir -p /{var,run}/syslog-ng";
+ serviceConfig = {
+ Type = "notify";
+ Sockets = "syslog.socket";
+ StandardOutput = "null";
+ Restart = "on-failure";
+ ExecStart = "${pkgs.syslogng}/sbin/syslog-ng ${concatStringsSep " " syslogngOptions}";
+ };
+ };
+ };
+
+}
diff --git a/nixos/modules/services/logging/syslogd.nix b/nixos/modules/services/logging/syslogd.nix
index 36a0ace927a..325868079e2 100644
--- a/nixos/modules/services/logging/syslogd.nix
+++ b/nixos/modules/services/logging/syslogd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix
index 92682d644f4..1fb7102e7f3 100644
--- a/nixos/modules/services/mail/dovecot.nix
+++ b/nixos/modules/services/mail/dovecot.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/mail/freepops.nix b/nixos/modules/services/mail/freepops.nix
index 79f211ad86e..2dd27a2033a 100644
--- a/nixos/modules/services/mail/freepops.nix
+++ b/nixos/modules/services/mail/freepops.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.mail.freepopsd;
diff --git a/nixos/modules/services/mail/mail.nix b/nixos/modules/services/mail/mail.nix
index bad0b22625d..b7e1d295f2c 100644
--- a/nixos/modules/services/mail/mail.nix
+++ b/nixos/modules/services/mail/mail.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/mail/opensmtpd.nix b/nixos/modules/services/mail/opensmtpd.nix
index 2732fd60200..fbc4b1d7d8a 100644
--- a/nixos/modules/services/mail/opensmtpd.nix
+++ b/nixos/modules/services/mail/opensmtpd.nix
@@ -1,7 +1,7 @@
-{ pkgs, config, ... }:
+{ config, lib, pkgs, ... }:
with pkgs;
-with pkgs.lib;
+with lib;
let
@@ -79,5 +79,10 @@ in {
preStart = "mkdir -p /var/spool";
serviceConfig.ExecStart = "${opensmtpd}/sbin/smtpd -d -f ${conf} ${args}";
};
+
+ environment.systemPackages = [ (pkgs.runCommand "opensmtpd-sendmail" {} ''
+ mkdir -p $out/bin
+ ln -s ${opensmtpd}/sbin/smtpctl $out/bin/sendmail
+ '') ];
};
}
diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix
index 2633289b46d..8f75bd8ab5d 100644
--- a/nixos/modules/services/mail/postfix.nix
+++ b/nixos/modules/services/mail/postfix.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/mail/spamassassin.nix b/nixos/modules/services/mail/spamassassin.nix
index aaf1dfcc210..a3ac9e37242 100644
--- a/nixos/modules/services/mail/spamassassin.nix
+++ b/nixos/modules/services/mail/spamassassin.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/autofs.nix b/nixos/modules/services/misc/autofs.nix
index 50491c556e8..e645bd25a66 100644
--- a/nixos/modules/services/misc/autofs.nix
+++ b/nixos/modules/services/misc/autofs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/cgminer.nix b/nixos/modules/services/misc/cgminer.nix
index 890d7a4020b..8f25df809cd 100644
--- a/nixos/modules/services/misc/cgminer.nix
+++ b/nixos/modules/services/misc/cgminer.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.cgminer;
@@ -42,6 +42,7 @@ in
package = mkOption {
default = pkgs.cgminer;
description = "Which cgminer derivation to use.";
+ type = types.package;
};
user = mkOption {
@@ -108,20 +109,21 @@ in
config = mkIf config.services.cgminer.enable {
- users.extraUsers = singleton
- { name = cfg.user;
+ users.extraUsers = optionalAttrs (cfg.user == "cgminer") (singleton
+ { name = "cgminer";
+ uid = config.ids.uids.cgminer;
description = "Cgminer user";
- };
+ });
environment.systemPackages = [ cfg.package ];
systemd.services.cgminer = {
path = [ pkgs.cgminer ];
- after = [ "display-manager.target" "network.target" ];
+ after = [ "network.target" "display-manager.service" ];
wantedBy = [ "multi-user.target" ];
- environment = {
+ environment = {
LD_LIBRARY_PATH = ''/run/opengl-driver/lib:/run/opengl-driver-32/lib'';
DISPLAY = ":0";
GPU_MAX_ALLOC_PERCENT = "100";
@@ -129,9 +131,11 @@ in
};
serviceConfig = {
- ExecStart = "${pkgs.cgminer}/bin/cgminer -T -c ${cgminerConfig}";
+ ExecStart = "${pkgs.cgminer}/bin/cgminer --syslog --text-only --config ${cgminerConfig}";
User = cfg.user;
- RestartSec = 10;
+ RestartSec = "30s";
+ Restart = "always";
+ StartLimitInterval = "1m";
};
};
diff --git a/nixos/modules/services/misc/dictd.nix b/nixos/modules/services/misc/dictd.nix
new file mode 100644
index 00000000000..552e0a435ef
--- /dev/null
+++ b/nixos/modules/services/misc/dictd.nix
@@ -0,0 +1,63 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.dictd = {
+
+ enable = mkOption {
+ default = false;
+ description = ''
+ Whether to enable the DICT.org dictionary server.
+ '';
+ };
+
+ DBs = mkOption {
+ default = [];
+ # example = [ pkgs.dictDBs.nld2eng ];
+ description = ''List of databases to make available.'';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = let dictdb = pkgs.dictDBCollector { dictlist = map (x: {
+ name = x.name;
+ filename = x; } ) config.services.dictd.DBs; };
+ in mkIf config.services.dictd.enable {
+
+ # get the command line client on system path to make some use of the service
+ environment.systemPackages = [ pkgs.dict ];
+
+ users.extraUsers = singleton
+ { name = "dictd";
+ group = "dictd";
+ description = "DICT.org dictd server";
+ home = "${dictdb}/share/dictd";
+ uid = config.ids.uids.dictd;
+ };
+
+ users.extraGroups = singleton
+ { name = "dictd";
+ gid = config.ids.gids.dictd;
+ };
+
+ jobs.dictd =
+ { description = "DICT.org Dictionary Server";
+ startOn = "startup";
+ environment = { LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive"; };
+ daemonType = "fork";
+ exec = "${pkgs.dict}/sbin/dictd -s -c ${dictdb}/share/dictd/dictd.conf --locale en_US.UTF-8";
+ };
+ };
+
+}
diff --git a/nixos/modules/services/misc/disnix.nix b/nixos/modules/services/misc/disnix.nix
index 6419e6f8fc7..219c7ed9587 100644
--- a/nixos/modules/services/misc/disnix.nix
+++ b/nixos/modules/services/misc/disnix.nix
@@ -1,7 +1,7 @@
# Disnix server
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -15,6 +15,7 @@ let
enablePostgreSQLDatabase = config.services.postgresql.enable;
enableSubversionRepository = config.services.svnserve.enable;
enableTomcatWebApplication = config.services.tomcat.enable;
+ enableMongoDatabase = config.services.mongodb.enable;
});
in
@@ -110,7 +111,7 @@ in
// optionalAttrs (config.services.tomcat.enable) { tomcatPort = 8080; }
// optionalAttrs (config.services.svnserve.enable) { svnBaseDir = config.services.svnserve.svnBaseDir; }
// optionalAttrs (cfg.publishInfrastructure.enableAuthentication) (
- optionalAttrs (config.services.mysql.enable) { mysqlUsername = "root"; mysqlPassword = builtins.readFile config.services.mysql.rootPassword; })
+ optionalAttrs (config.services.mysql.enable) { mysqlUsername = "root"; mysqlPassword = readFile config.services.mysql.rootPassword; })
)
;
@@ -124,18 +125,20 @@ in
after = [ "dbus.service" ]
++ optional config.services.httpd.enable "httpd.service"
++ optional config.services.mysql.enable "mysql.service"
+ ++ optional config.services.postgresql.enable "postgresql.service"
++ optional config.services.tomcat.enable "tomcat.service"
- ++ optional config.services.svnserve.enable "svnserve.service";
+ ++ optional config.services.svnserve.enable "svnserve.service"
+ ++ optional config.services.mongodb.enable "mongodb.service";
restartIfChanged = false;
- path = [ pkgs.nix pkgs.disnix ];
-
- script =
- ''
- export HOME=/root
- disnix-service --dysnomia-modules-dir=${dysnomia}/libexec/dysnomia
- '';
+ path = [ pkgs.nix pkgs.disnix dysnomia ];
+
+ environment = {
+ HOME = "/root";
+ };
+
+ exec = "disnix-service";
};
} // optionalAttrs cfg.publishAvahi {
disnixAvahi =
@@ -150,7 +153,7 @@ in
${concatMapStrings (infrastructureAttrName:
let infrastructureAttrValue = getAttr infrastructureAttrName (cfg.infrastructure);
in
- if builtins.isInt infrastructureAttrValue then
+ if isInt infrastructureAttrValue then
''${infrastructureAttrName}=${toString infrastructureAttrValue} \
''
else
diff --git a/nixos/modules/services/misc/felix.nix b/nixos/modules/services/misc/felix.nix
index 2da50fc8595..a01c7f08b91 100644
--- a/nixos/modules/services/misc/felix.nix
+++ b/nixos/modules/services/misc/felix.nix
@@ -1,7 +1,7 @@
# Felix server
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/folding-at-home.nix b/nixos/modules/services/misc/folding-at-home.nix
index 9f4c4645279..392d2d1f002 100644
--- a/nixos/modules/services/misc/folding-at-home.nix
+++ b/nixos/modules/services/misc/folding-at-home.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
stateDir = "/var/lib/foldingathome";
cfg = config.services.foldingAtHome;
@@ -44,7 +44,7 @@ in {
users.extraUsers = singleton
{ name = fahUser;
- uid = config.ids.uids.foldingAtHome;
+ uid = config.ids.uids.foldingathome;
description = "Folding@Home user";
home = stateDir;
};
diff --git a/nixos/modules/services/misc/gitolite.nix b/nixos/modules/services/misc/gitolite.nix
new file mode 100644
index 00000000000..84435f92c11
--- /dev/null
+++ b/nixos/modules/services/misc/gitolite.nix
@@ -0,0 +1,66 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.gitolite;
+ pubkeyFile = pkgs.writeText "gitolite-admin.pub" cfg.adminPubkey;
+in
+{
+ options = {
+ services.gitolite = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable gitolite management under the
+ gitolite user. The Gitolite home
+ directory is /var/lib/gitolite. After
+ switching to a configuration with Gitolite enabled, you can
+ then run git clone
+ gitolite@host:gitolite-admin.git to manage it further.
+ '';
+ };
+
+ adminPubkey = mkOption {
+ type = types.str;
+ description = ''
+ Initial administrative public key for Gitolite. This should
+ be an SSH Public Key. Note that this key will only be used
+ once, upon the first initialization of the Gitolite user.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ users.extraUsers.gitolite = {
+ description = "Gitolite user";
+ home = "/var/lib/gitolite";
+ createHome = true;
+ uid = config.ids.uids.gitolite;
+ useDefaultShell = true;
+ };
+
+ systemd.services."gitolite-init" = {
+ description = "Gitolite initialization";
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig.User = "gitolite";
+ serviceConfig.Type = "oneshot";
+ serviceConfig.RemainAfterExit = true;
+
+ path = [ pkgs.gitolite pkgs.git pkgs.perl pkgs.bash pkgs.openssh ];
+ script = ''
+ cd /var/lib/gitolite
+ mkdir -p .gitolite/logs
+ if [ ! -d repositories ]; then
+ gitolite setup -pk ${pubkeyFile}
+ fi
+ gitolite setup # Upgrade if needed
+ '';
+ };
+
+ environment.systemPackages = [ pkgs.gitolite pkgs.git ];
+ };
+}
diff --git a/nixos/modules/services/misc/gpsd.nix b/nixos/modules/services/misc/gpsd.nix
index bc1d1f4575a..4a677f33fa0 100644
--- a/nixos/modules/services/misc/gpsd.nix
+++ b/nixos/modules/services/misc/gpsd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -19,6 +19,7 @@ in
services.gpsd = {
enable = mkOption {
+ type = types.bool;
default = false;
description = ''
Whether to enable `gpsd', a GPS service daemon.
@@ -26,6 +27,7 @@ in
};
device = mkOption {
+ type = types.str;
default = "/dev/ttyUSB0";
description = ''
A device may be a local serial device for GPS input, or a URL of the form:
@@ -35,6 +37,7 @@ in
};
readonly = mkOption {
+ type = types.bool;
default = true;
description = ''
Whether to enable the broken-device-safety, otherwise
@@ -51,6 +54,7 @@ in
};
port = mkOption {
+ type = types.uniq types.int;
default = 2947;
description = ''
The port where to listen for TCP connections.
@@ -58,6 +62,7 @@ in
};
debugLevel = mkOption {
+ type = types.uniq types.int;
default = 0;
description = ''
The debugging level.
@@ -85,19 +90,20 @@ in
inherit gid;
};
- jobs.gpsd =
- { description = "GPSD daemon";
-
- startOn = "ip-up";
-
- exec =
- ''
- ${pkgs.gpsd}/sbin/gpsd -D "${toString cfg.debugLevel}" \
- -S "${toString cfg.port}" \
- ${if cfg.readonly then "-b" else ""} \
- "${cfg.device}"
- '';
+ systemd.services.gpsd = {
+ description = "GPSD daemon";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ serviceConfig = {
+ Type = "forking";
+ ExecStart = ''
+ ${pkgs.gpsd}/sbin/gpsd -D "${toString cfg.debugLevel}" \
+ -S "${toString cfg.port}" \
+ ${if cfg.readonly then "-b" else ""} \
+ "${cfg.device}"
+ '';
};
+ };
};
diff --git a/nixos/modules/services/misc/gurobi.nix b/nixos/modules/services/misc/gurobi.nix
deleted file mode 100644
index 9cd76a1e78f..00000000000
--- a/nixos/modules/services/misc/gurobi.nix
+++ /dev/null
@@ -1,41 +0,0 @@
-{ config, pkgs, ... }:
-
-with pkgs.lib;
-
-let
- cfg = config.services.gurobi.tokenServer;
-in {
- options = {
- services.gurobi.tokenServer = {
- enable = mkOption {
- default = false;
-
- description = "Whether to enable the Gurobi token server";
-
- type = types.bool;
- };
-
- license = mkOption {
- description = "Path to the Gurobi license file";
-
- type = types.path;
- };
- };
- };
-
- config = mkIf cfg.enable {
- systemd.services.gurobi-token-server = {
- description = "Gurobi token server";
-
- wantedBy = [ "multi-user.target" ];
-
- environment.GRB_LICENSE_FILE = cfg.license;
-
- serviceConfig = {
- ExecStart = "${pkgs.gurobi}/bin/grb_ts";
-
- Type = "forking";
- };
- };
- };
-}
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index 1707828d0db..c98c0511b56 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -22,14 +22,11 @@ let
nixConf =
let
- # Tricky: if we're using a chroot for builds, then we need
- # /bin/sh in the chroot (our own compromise to purity).
- # However, since /bin/sh is a symlink to some path in the
- # Nix store, which furthermore has runtime dependencies on
- # other paths in the store, we need the closure of /bin/sh
- # in `build-chroot-dirs' - otherwise any builder that uses
- # /bin/sh won't work.
- binshDeps = pkgs.writeReferencesToFile config.system.build.binsh;
+ # If we're using a chroot for builds, then provide /bin/sh in
+ # the chroot as a bind-mount to bash. This means we also need to
+ # include the entire closure of bash.
+ sh = pkgs.stdenv.shell;
+ binshDeps = pkgs.writeReferencesToFile sh;
in
pkgs.runCommand "nix.conf" {extraOptions = cfg.extraOptions; } ''
extraPaths=$(for i in $(cat ${binshDeps}); do if test -d $i; then echo $i; fi; done)
@@ -40,7 +37,7 @@ let
build-users-group = nixbld
build-max-jobs = ${toString (cfg.maxJobs)}
build-use-chroot = ${if cfg.useChroot then "true" else "false"}
- build-chroot-dirs = ${toString cfg.chrootDirs} $(echo $extraPaths)
+ build-chroot-dirs = ${toString cfg.chrootDirs} /bin/sh=${sh} $(echo $extraPaths)
binary-caches = ${toString cfg.binaryCaches}
trusted-binary-caches = ${toString cfg.trustedBinaryCaches}
$extraOptions
@@ -58,7 +55,7 @@ in
nix = {
package = mkOption {
- type = types.path;
+ type = types.package;
default = pkgs.nix;
description = ''
This option specifies the Nix package instance to use throughout the system.
@@ -253,8 +250,6 @@ in
config = {
- nix.chrootDirs = [ "/dev" "/dev/pts" "/proc" "/bin" ];
-
environment.etc."nix/nix.conf".source = nixConf;
# List of machines for distributed Nix builds in the format
@@ -275,25 +270,18 @@ in
) cfg.buildMachines;
};
- systemd.sockets."nix-daemon" =
- { description = "Nix Daemon Socket";
- wantedBy = [ "sockets.target" ];
- before = [ "multi-user.target" ];
- socketConfig.ListenStream = "/nix/var/nix/daemon-socket/socket";
- };
+ systemd.packages = [ nix ];
- systemd.services."nix-daemon" =
- { description = "Nix Daemon";
+ systemd.sockets.nix-daemon.wantedBy = [ "sockets.target" ];
- path = [ nix pkgs.openssl pkgs.utillinux ]
- ++ optionals cfg.distributedBuilds [ pkgs.openssh pkgs.gzip ];
+ systemd.services.nix-daemon =
+ { path = [ nix pkgs.openssl pkgs.utillinux pkgs.openssh ]
+ ++ optionals cfg.distributedBuilds [ pkgs.gzip ];
environment = cfg.envVars // { CURL_CA_BUNDLE = "/etc/ssl/certs/ca-bundle.crt"; };
serviceConfig =
- { ExecStart = "@${nix}/bin/nix-daemon nix-daemon --daemon";
- KillMode = "process";
- Nice = cfg.daemonNiceLevel;
+ { Nice = cfg.daemonNiceLevel;
IOSchedulingPriority = cfg.daemonIONiceLevel;
LimitNOFILE = 4096;
};
@@ -325,16 +313,14 @@ in
};
# Set up the environment variables for running Nix.
- environment.variables = cfg.envVars;
+ environment.sessionVariables = cfg.envVars;
environment.extraInit =
''
# Set up secure multi-user builds: non-root users build through the
# Nix daemon.
- if test "$USER" != root; then
+ if [ "$USER" != root -o ! -w /nix/var/nix/db ]; then
export NIX_REMOTE=daemon
- else
- export NIX_REMOTE=
fi
'';
@@ -351,8 +337,7 @@ in
/nix/var/nix/profiles \
/nix/var/nix/db \
/nix/var/log/nix/drvs \
- /nix/var/nix/channel-cache \
- /nix/var/nix/chroots
+ /nix/var/nix/channel-cache
mkdir -m 1777 -p \
/nix/var/nix/gcroots/per-user \
/nix/var/nix/profiles/per-user \
diff --git a/nixos/modules/services/misc/nix-gc.nix b/nixos/modules/services/misc/nix-gc.nix
index fa20e0956f5..6a7a7f4cee7 100644
--- a/nixos/modules/services/misc/nix-gc.nix
+++ b/nixos/modules/services/misc/nix-gc.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.nix.gc;
diff --git a/nixos/modules/services/misc/nix-ssh-serve.nix b/nixos/modules/services/misc/nix-ssh-serve.nix
new file mode 100644
index 00000000000..d70bd855c7f
--- /dev/null
+++ b/nixos/modules/services/misc/nix-ssh-serve.nix
@@ -0,0 +1,51 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+ options = {
+
+ nix.sshServe = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable serving the Nix store as a binary cache via SSH.";
+ };
+
+ keys = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "ssh-dss AAAAB3NzaC1k... alice@example.org" ];
+ description = "A list of SSH public keys allowed to access the binary cache via SSH.";
+ };
+
+ };
+
+ };
+
+ config = mkIf config.nix.sshServe.enable {
+
+ users.extraUsers.nix-ssh = {
+ description = "Nix SSH substituter user";
+ uid = config.ids.uids.nix-ssh;
+ useDefaultShell = true;
+ };
+
+ services.openssh.enable = true;
+
+ services.openssh.extraConfig = ''
+ Match User nix-ssh
+ AllowAgentForwarding no
+ AllowTcpForwarding no
+ PermitTTY no
+ PermitTunnel no
+ X11Forwarding no
+ ForceCommand ${config.nix.package}/bin/nix-store --serve
+ Match All
+ '';
+
+ users.extraUsers.nix-ssh.openssh.authorizedKeys.keys = config.nix.sshServe.keys;
+
+ };
+}
diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix
index 885b8fa2d0c..808c5dcbdc6 100644
--- a/nixos/modules/services/misc/nixos-manual.nix
+++ b/nixos/modules/services/misc/nixos-manual.nix
@@ -3,9 +3,9 @@
# of the virtual consoles. The latter is useful for the installation
# CD.
-{ config, pkgs, baseModules, ... } @ extraArgs:
+{ config, lib, pkgs, baseModules, ... } @ extraArgs:
-with pkgs.lib;
+with lib;
let
@@ -23,6 +23,7 @@ let
manual = import ../../../doc/manual {
inherit pkgs;
+ version = config.system.nixosVersion;
revision = config.system.nixosRevision;
options = eval.options;
};
diff --git a/nixos/modules/services/misc/rippled.nix b/nixos/modules/services/misc/rippled.nix
new file mode 100644
index 00000000000..2c1fec9f6d7
--- /dev/null
+++ b/nixos/modules/services/misc/rippled.nix
@@ -0,0 +1,314 @@
+# configuration building is commented out until better tested.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.rippled;
+
+ rippledStateCfgFile = "/var/lib/rippled/rippled.cfg";
+
+ rippledCfg = ''
+ [node_db]
+ type=HyperLevelDB
+ path=/var/lib/rippled/db/hyperldb
+
+ [debug_logfile]
+ /var/log/rippled/debug.log
+
+ ''
+ + optionalString (cfg.peerIp != null) ''
+ [peer_ip]
+ ${cfg.peerIp}
+
+ [peer_port]
+ ${toString cfg.peerPort}
+
+ ''
+ + cfg.extraConfig;
+
+ rippledCfgFile = pkgs.writeText "rippled.cfg" rippledCfg;
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.rippled = {
+
+ enable = mkOption {
+ default = false;
+ description = "Whether to enable rippled";
+ };
+
+ #
+ # Rippled has a simple configuration file layout that is easy to
+ # build with nix. Many of the options are defined here but are
+ # commented out until the code to append them to the config above
+ # is written and they are tested.
+ #
+ # If you find a yourself implementing more options, please submit a
+ # pull request.
+ #
+
+ /*
+ ips = mkOption {
+ default = [ "r.ripple.com 51235" ];
+ example = [ "192.168.0.1" "192.168.0.1 3939" "r.ripple.com 51235" ];
+ description = ''
+ List of hostnames or ips where the Ripple protocol is served.
+ For a starter list, you can either copy entries from:
+ https://ripple.com/ripple.txt or if you prefer you can let it
+ default to r.ripple.com 51235
+
+ A port may optionally be specified after adding a space to the
+ address. By convention, if known, IPs are listed in from most
+ to least trusted.
+ '';
+ };
+
+ ipsFixed = mkOption {
+ default = null;
+ example = [ "192.168.0.1" "192.168.0.1 3939" "r.ripple.com 51235" ];
+ description = ''
+ List of IP addresses or hostnames to which rippled should always
+ attempt to maintain peer connections with. This is useful for
+ manually forming private networks, for example to configure a
+ validation server that connects to the Ripple network through a
+ public-facing server, or for building a set of cluster peers.
+
+ A port may optionally be specified after adding a space to the address
+ '';
+ };
+ */
+
+ peerIp = mkOption {
+ default = null;
+ example = "0.0.0.0";
+ description = ''
+ IP address or domain to bind to allow external connections from peers.
+ Defaults to not binding, which disallows external connections from peers.
+ '';
+ };
+
+ peerPort = mkOption {
+ default = 51235;
+ description = ''
+ If peerIp is supplied, corresponding port to bind to for peer connections.
+ '';
+ };
+
+ /*
+ peerPortProxy = mkOption {
+ type = types.int;
+ example = 51236;
+ description = ''
+ An optional, additional listening port number for peers. Incoming
+ connections on this port will be required to provide a PROXY Protocol
+ handshake, described in this document (external link):
+
+ http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt
+
+ The PROXY Protocol is a popular method used by elastic load balancing
+ service providers such as Amazon, to identify the true IP address and
+ port number of external incoming connections.
+
+ In addition to enabling this setting, it will also be required to
+ use your provider-specific control panel or administrative web page
+ to configure your server instance to receive PROXY Protocol handshakes,
+ and also to restrict access to your instance to the Elastic Load Balancer.
+ '';
+ };
+
+ peerPrivate = mkOption {
+ default = null;
+ example = 0;
+ description = ''
+ 0: Request peers to broadcast your address. Normal outbound peer connections [default]
+ 1: Request peers not broadcast your address. Only connect to configured peers.
+ '';
+ };
+
+ peerSslCipherList = mkOption {
+ default = null;
+ example = "ALL:!LOW:!EXP:!MD5:@STRENGTH";
+ description = ''
+ A colon delimited string with the allowed SSL cipher modes for peer. The
+ choices for for ciphers are defined by the OpenSSL API function
+ SSL_CTX_set_cipher_list, documented here (external link):
+
+ http://pic.dhe.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=%2Fcom.ibm.ztpf-ztpfdf.doc_put.cur%2Fgtpc2%2Fcpp_ssl_ctx_set_cipher_list.html
+
+ The default setting of "ALL:!LOW:!EXP:!MD5:@STRENGTH", which allows
+ non-authenticated peer connections (they are, however, secure).
+ '';
+ };
+
+ nodeSeed = mkOption {
+ default = null;
+ example = "RASH BUSH MILK LOOK BAD BRIM AVID GAFF BAIT ROT POD LOVE";
+ description = ''
+ This is used for clustering. To force a particular node seed or key, the
+ key can be set here. The format is the same as the validation_seed field.
+ To obtain a validation seed, use the rippled validation_create command.
+ '';
+ };
+
+ clusterNodes = mkOption {
+ default = null;
+ example = [ "n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5" ];
+ description = ''
+ To extend full trust to other nodes, place their node public keys here.
+ Generally, you should only do this for nodes under common administration.
+ Node public keys start with an 'n'. To give a node a name for identification
+ place a space after the public key and then the name.
+ '';
+ };
+
+ sntpServers = mkOption {
+ default = null;
+ example = [ "time.nist.gov" "pool.ntp.org" ];
+ description = ''
+ IP address or domain of NTP servers to use for time synchronization.
+ '';
+ };
+
+ # TODO: websocket options
+
+ rpcAllowRemote = mkOption {
+ default = false;
+ description = ''
+ false: Allow RPC connections only from 127.0.0.1. [default]
+ true: Allow RPC connections from any IP.
+ '';
+ };
+
+ rpcAdminAllow = mkOption {
+ example = [ "10.0.0.4" ];
+ description = ''
+ List of IP addresses allowed to have admin access.
+ '';
+ };
+
+ rpcAdminUser = mkOption {
+ type = types.str;
+ description = ''
+ As a server, require this as the admin user to be specified. Also, require
+ rpc_admin_user and rpc_admin_password to be checked for RPC admin functions.
+ The request must specify these as the admin_user and admin_password in the
+ request object.
+ '';
+ };
+
+ rpcAdminPassword = mkOption {
+ type = types.str;
+ description = ''
+ As a server, require this as the admin pasword to be specified. Also,
+ require rpc_admin_user and rpc_admin_password to be checked for RPC admin
+ functions. The request must specify these as the admin_user and
+ admin_password in the request object.
+ '';
+ };
+
+ rpcIp = mkOption {
+ type = types.str;
+ description = ''
+ IP address or domain to bind to allow insecure RPC connections.
+ Defaults to not binding, which disallows RPC connections.
+ '';
+ };
+
+ rpcPort = mkOption {
+ type = types.int;
+ description = ''
+ If rpcIp is supplied, corresponding port to bind to for peer connections.
+ '';
+ };
+
+ rpcUser = mkOption {
+ type = types.str;
+ description = ''
+ Require a this user to specified and require rpcPassword to
+ be checked for RPC access via the rpcIp and rpcPort. The user and password
+ must be specified via HTTP's basic authentication method.
+ As a client, supply this to the server via HTTP's basic authentication
+ method.
+ '';
+ };
+
+ rpcPassword = mkOption {
+ type = types.str;
+ description = ''
+ Require a this password to specified and require rpc_user to
+ be checked for RPC access via the rpcIp and rpcPort. The user and password
+ must be specified via HTTP's basic authentication method.
+ As a client, supply this to the server via HTTP's basic authentication
+ method.
+ '';
+ };
+
+ rpcStartup = mkOption {
+ example = [ ''"command" : "log_level"'' ''"partition" : "ripplecalc"'' ''"severity" : "trace"'' ];
+ description = "List of RPC commands to run at startup.";
+ };
+
+ rpcSecure = mkOption {
+ default = false;
+ description = ''
+ false: Server certificates are not provided for RPC clients using SSL [default]
+ true: Client RPC connections wil be provided with SSL certificates.
+
+ Note that if rpc_secure is enabled, it will also be necessasry to configure the
+ certificate file settings located in rpcSslCert, rpcSslChain, and rpcSslKey
+ '';
+ };
+ */
+
+ extraConfig = mkOption {
+ default = "";
+ description = ''
+ Extra lines to be added verbatim to the rippled.cfg configuration file.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers = singleton
+ { name = "rippled";
+ description = "Ripple server user";
+ uid = config.ids.uids.rippled;
+ home = "/var/lib/rippled";
+ };
+
+ systemd.services.rippled = {
+ path = [ pkgs.rippled ];
+
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig = {
+ ExecStart = "${pkgs.rippled}/bin/rippled --fg -q --conf ${rippledStateCfgFile}";
+ WorkingDirectory = "/var/lib/rippled";
+ };
+ };
+
+ networking.firewall.allowedTCPPorts = mkIf (cfg.peerIp != null) [ cfg.peerPort ];
+
+ system.activationScripts.rippled = ''
+ mkdir -p /var/{lib,log}/rippled
+ chown -R rippled /var/{lib,log}/rippled
+ ln -sf ${rippledCfgFile} ${rippledStateCfgFile}
+ '';
+ };
+}
diff --git a/nixos/modules/services/misc/rogue.nix b/nixos/modules/services/misc/rogue.nix
index de25cc0fb98..ed8da8a518f 100644
--- a/nixos/modules/services/misc/rogue.nix
+++ b/nixos/modules/services/misc/rogue.nix
@@ -1,9 +1,9 @@
# Execute the game `rogue' on tty 9. Mostly used by the NixOS
# installation CD.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/svnserve.nix b/nixos/modules/services/misc/svnserve.nix
index b0806d14738..848905ca457 100644
--- a/nixos/modules/services/misc/svnserve.nix
+++ b/nixos/modules/services/misc/svnserve.nix
@@ -1,7 +1,7 @@
# SVN server
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/synergy.nix b/nixos/modules/services/misc/synergy.nix
index 63e7c7667e5..5338b25715c 100644
--- a/nixos/modules/services/misc/synergy.nix
+++ b/nixos/modules/services/misc/synergy.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -83,7 +83,8 @@ in
config = {
- systemd.services."synergy-client" = mkIf cfgC.enable {
+ systemd.services."synergy-client" = {
+ enable = cfgC.enable;
after = [ "network.target" ];
description = "Synergy client";
wantedBy = optional cfgC.autoStart "multi-user.target";
@@ -91,7 +92,8 @@ in
serviceConfig.ExecStart = ''${pkgs.synergy}/bin/synergyc -f ${optionalString (cfgC.screenName != "") "-n ${cfgC.screenName}"} ${cfgC.serverAddress}'';
};
- systemd.services."synergy-server" = mkIf cfgS.enable {
+ systemd.services."synergy-server" = {
+ enable = cfgS.enable;
after = [ "network.target" ];
description = "Synergy server";
wantedBy = optional cfgS.autoStart "multi-user.target";
diff --git a/nixos/modules/services/monitoring/apcupsd.nix b/nixos/modules/services/monitoring/apcupsd.nix
index 114bad5c947..6cc0c122ec6 100644
--- a/nixos/modules/services/monitoring/apcupsd.nix
+++ b/nixos/modules/services/monitoring/apcupsd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.apcupsd;
@@ -148,7 +148,7 @@ in
# wall: cannot get tty name: Inappropriate ioctl for device
# The message still gets through.
systemd.services.apcupsd = {
- description = "APC UPS daemon";
+ description = "APC UPS Daemon";
wantedBy = [ "multi-user.target" ];
preStart = "mkdir -p /run/apcupsd/";
serviceConfig = {
@@ -168,11 +168,11 @@ in
# shuts off power.) Copied from here:
# http://forums.opensuse.org/english/get-technical-help-here/applications/479499-apcupsd-systemd-killpower-issues.html
systemd.services.apcupsd-killpower = {
+ description = "APC UPS Kill Power";
after = [ "shutdown.target" ]; # append umount.target?
before = [ "final.target" ];
wantedBy = [ "shutdown.target" ];
unitConfig = {
- Description = "APC UPS killpower";
ConditionPathExists = "/run/apcupsd/powerfail";
DefaultDependencies = "no";
};
diff --git a/nixos/modules/services/monitoring/dd-agent.nix b/nixos/modules/services/monitoring/dd-agent.nix
index f99114ac9ad..deef64d6998 100644
--- a/nixos/modules/services/monitoring/dd-agent.nix
+++ b/nixos/modules/services/monitoring/dd-agent.nix
@@ -1,58 +1,117 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.dd-agent;
- datadog_conf = pkgs.runCommand "datadog.conf" {} ''
- sed -e 's|^api_key:|api_key: ${cfg.api_key}|' ${optionalString (cfg.hostname != null)
- "-e 's|^#hostname: mymachine.mydomain|hostname: ${cfg.hostname}|'"
- } ${pkgs.dd-agent}/etc/dd-agent/datadog.conf.example > $out
+ ddConf = pkgs.writeText "datadog.conf" ''
+ [Main]
+ dd_url: https://app.datadoghq.com
+ skip_ssl_validation: no
+ api_key: ${cfg.api_key}
+ ${optionalString (cfg.hostname != null) "hostname: ${cfg.hostname}"}
+
+ collector_log_file: /var/log/datadog/collector.log
+ forwarder_log_file: /var/log/datadog/forwarder.log
+ dogstatsd_log_file: /var/log/datadog/dogstatsd.log
+ pup_log_file: /var/log/datadog/pup.log
+
+ # proxy_host: my-proxy.com
+ # proxy_port: 3128
+ # proxy_user: user
+ # proxy_password: password
+
+ # tags: mytag0, mytag1
+
+ # collect_ec2_tags: no
+ # recent_point_threshold: 30
+ # use_mount: no
+ # listen_port: 17123
+ # graphite_listen_port: 17124
+ # non_local_traffic: no
+ # use_curl_http_client: False
+ # bind_host: localhost
+
+ # use_pup: no
+ # pup_port: 17125
+ # pup_interface: localhost
+ # pup_url: http://localhost:17125
+
+ # dogstatsd_port : 8125
+ # dogstatsd_interval : 10
+ # dogstatsd_normalize : yes
+ # statsd_forward_host: address_of_own_statsd_server
+ # statsd_forward_port: 8125
+
+ # device_blacklist_re: .*\/dev\/mapper\/lxc-box.*
+
+ # ganglia_host: localhost
+ # ganglia_port: 8651
'';
+
+ postgresqlConfig = pkgs.writeText "postgres.yaml" cfg.postgresqlConfig;
+ nginxConfig = pkgs.writeText "nginx.yaml" cfg.nginxConfig;
+
+ etcfiles =
+ [ { source = ddConf;
+ target = "dd-agent/datadog.conf";
+ } ] ++
+ (optional (cfg.postgresqlConfig != null)
+ { source = postgresqlConfig;
+ target = "dd-agent/conf.d/postgres.yaml";
+ }) ++
+ (optional (cfg.nginxConfig != null)
+ { source = nginxConfig;
+ target = "dd-agent/conf.d/nginx.yaml";
+ });
+
in {
options.services.dd-agent = {
enable = mkOption {
description = "Whether to enable the dd-agent montioring service";
-
default = false;
-
type = types.bool;
};
- # !!! This gets stored in the store (world-readable), wish we had https://github.com/NixOS/nix/issues/8
api_key = mkOption {
description = "The Datadog API key to associate the agent with your account";
-
example = "ae0aa6a8f08efa988ba0a17578f009ab";
-
type = types.str;
};
hostname = mkOption {
description = "The hostname to show in the Datadog dashboard (optional)";
-
default = null;
-
example = "mymachine.mydomain";
+ type = types.uniq (types.nullOr types.string);
+ };
+ postgresqlConfig = mkOption {
+ description = "Datadog PostgreSQL integration configuration";
+ default = null;
+ type = types.uniq (types.nullOr types.string);
+ };
+
+ nginxConfig = mkOption {
+ description = "Datadog nginx integration configuration";
+ default = null;
type = types.uniq (types.nullOr types.string);
};
};
config = mkIf cfg.enable {
- environment.etc = [ { source = datadog_conf; target = "dd-agent/datadog.conf"; } ];
environment.systemPackages = [ pkgs."dd-agent" pkgs.sysstat pkgs.procps ];
- users.extraUsers."dd-agent" = {
+ users.extraUsers.datadog = {
description = "Datadog Agent User";
- uid = config.ids.uids.dd-agent;
- group = "dd-agent";
+ uid = config.ids.uids.datadog;
+ group = "datadog";
home = "/var/log/datadog/";
createHome = true;
};
- users.extraGroups.dd-agent.gid = config.ids.gids.dd-agent;
+ users.extraGroups.datadog.gid = config.ids.gids.datadog;
systemd.services.dd-agent = {
description = "Datadog agent monitor";
@@ -60,24 +119,30 @@ in {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.dd-agent}/bin/dd-agent foreground";
- User = "dd-agent";
- Group = "dd-agent";
+ User = "datadog";
+ Group = "datadog";
+ Restart = "always";
+ RestartSec = 2;
};
- restartTriggers = [ pkgs.dd-agent datadog_conf ];
+ restartTriggers = [ pkgs.dd-agent ddConf postgresqlConfig nginxConfig ];
};
systemd.services.dogstatsd = {
description = "Datadog statsd";
- path = [ pkgs."dd-agent" pkgs.python ];
+ path = [ pkgs."dd-agent" pkgs.python pkgs.procps ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.dd-agent}/bin/dogstatsd start";
- User = "dd-agent";
- Group = "dd-agent";
+ User = "datadog";
+ Group = "datadog";
Type = "forking";
PIDFile = "/tmp/dogstatsd.pid";
+ Restart = "always";
+ RestartSec = 2;
};
- restartTriggers = [ pkgs.dd-agent datadog_conf ];
+ restartTriggers = [ pkgs.dd-agent ddConf postgresqlConfig nginxConfig ];
};
+
+ environment.etc = etcfiles;
};
}
diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix
index 08e6ef662cc..dbfe0ee182a 100644
--- a/nixos/modules/services/monitoring/graphite.nix
+++ b/nixos/modules/services/monitoring/graphite.nix
@@ -1,20 +1,35 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.graphite;
- writeTextOrNull = f: t: if t == null then null else pkgs.writeText f t;
+ writeTextOrNull = f: t: if t == null then null else pkgs.writeTextDir f t;
+
+ dataDir = cfg.dataDir;
+
+ configDir = pkgs.buildEnv {
+ name = "graphite-config";
+ paths = lists.filter (el: el != null) [
+ (writeTextOrNull "carbon.conf" cfg.carbon.config)
+ (writeTextOrNull "storage-aggregation.conf" cfg.carbon.storageAggregation)
+ (writeTextOrNull "storage-schemas.conf" cfg.carbon.storageSchemas)
+ (writeTextOrNull "blacklist.conf" cfg.carbon.blacklist)
+ (writeTextOrNull "whitelist.conf" cfg.carbon.whitelist)
+ (writeTextOrNull "rewrite-rules.conf" cfg.carbon.rewriteRules)
+ (writeTextOrNull "relay-rules.conf" cfg.carbon.relayRules)
+ (writeTextOrNull "aggregation-rules.conf" cfg.carbon.aggregationRules)
+ ];
+ };
- dataDir = "/var/db/graphite";
carbonOpts = name: with config.ids; ''
- --nodaemon --syslog --prefix=${name} --pidfile /var/run/${name}.pid \
- --uid ${toString uids.graphite} --gid ${toString uids.graphite} ${name}
+ --nodaemon --syslog --prefix=${name} --pidfile ${dataDir}/${name}.pid ${name}
'';
carbonEnv = {
PYTHONPATH = "${pkgs.python27Packages.carbon}/lib/python2.7/site-packages";
GRAPHITE_ROOT = dataDir;
- GRAPHITE_CONF_DIR = "/etc/graphite/";
+ GRAPHITE_CONF_DIR = configDir;
+ GRAPHITE_STORAGE_DIR = dataDir;
};
in {
@@ -22,29 +37,37 @@ in {
###### interface
options.services.graphite = {
+ dataDir = mkOption {
+ type = types.path;
+ default = "/var/db/graphite";
+ description = ''
+ Data directory for graphite.
+ '';
+ };
+
web = {
enable = mkOption {
- description = "Whether to enable graphite web frontend";
+ description = "Whether to enable graphite web frontend.";
default = false;
type = types.uniq types.bool;
};
host = mkOption {
- description = "Graphite web frontend listen address";
+ description = "Graphite web frontend listen address.";
default = "127.0.0.1";
type = types.str;
};
port = mkOption {
- description = "Graphite web frontend port";
- default = "8080";
- type = types.str;
+ description = "Graphite web frontend port.";
+ default = 8080;
+ type = types.int;
};
};
carbon = {
config = mkOption {
- description = "Content of carbon configuration file";
+ description = "Content of carbon configuration file.";
default = ''
[cache]
# Listen on localhost by default for security reasons
@@ -60,13 +83,13 @@ in {
};
enableCache = mkOption {
- description = "Whether to enable carbon cache, the graphite storage daemon";
+ description = "Whether to enable carbon cache, the graphite storage daemon.";
default = false;
type = types.uniq types.bool;
};
storageAggregation = mkOption {
- description = "Defines how to aggregate data to lower-precision retentions";
+ description = "Defines how to aggregate data to lower-precision retentions.";
default = null;
type = types.uniq (types.nullOr types.string);
example = ''
@@ -78,7 +101,7 @@ in {
};
storageSchemas = mkOption {
- description = "Defines retention rates for storing metrics";
+ description = "Defines retention rates for storing metrics.";
default = "";
type = types.uniq (types.nullOr types.string);
example = ''
@@ -89,21 +112,24 @@ in {
};
blacklist = mkOption {
- description = "Any metrics received which match one of the experssions will be dropped";
+ description = "Any metrics received which match one of the experssions will be dropped.";
default = null;
type = types.uniq (types.nullOr types.string);
example = "^some\.noisy\.metric\.prefix\..*";
};
whitelist = mkOption {
- description = "Only metrics received which match one of the experssions will be persisted";
+ description = "Only metrics received which match one of the experssions will be persisted.";
default = null;
type = types.uniq (types.nullOr types.string);
example = ".*";
};
rewriteRules = mkOption {
- description = "Regular expression patterns that can be used to rewrite metric names in a search and replace fashion";
+ description = ''
+ Regular expression patterns that can be used to rewrite metric names
+ in a search and replace fashion.
+ '';
default = null;
type = types.uniq (types.nullOr types.string);
example = ''
@@ -114,7 +140,7 @@ in {
};
enableRelay = mkOption {
- description = "Whether to enable carbon relay, the carbon replication and sharding service";
+ description = "Whether to enable carbon relay, the carbon replication and sharding service.";
default = false;
type = types.uniq types.bool;
};
@@ -131,13 +157,13 @@ in {
};
enableAggregator = mkOption {
- description = "Whether to enable carbon agregator, the carbon buffering service";
+ description = "Whether to enable carbon agregator, the carbon buffering service.";
default = false;
type = types.uniq types.bool;
};
aggregationRules = mkOption {
- description = "Defines if and how received metrics will be agregated";
+ description = "Defines if and how received metrics will be agregated.";
default = null;
type = types.uniq (types.nullOr types.string);
example = ''
@@ -151,69 +177,69 @@ in {
###### implementation
config = mkIf (cfg.carbon.enableAggregator || cfg.carbon.enableCache || cfg.carbon.enableRelay || cfg.web.enable) {
- environment.etc = lists.filter (el: el.source != null) [
- { source = writeTextOrNull "carbon.conf" cfg.carbon.config;
- target = "graphite/carbon.conf"; }
- { source = writeTextOrNull "storage-agregation.conf" cfg.carbon.storageAggregation;
- target = "graphite/storage-agregation.conf"; }
- { source = writeTextOrNull "storage-schemas.conf" cfg.carbon.storageSchemas;
- target = "graphite/storage-schemas.conf"; }
- { source = writeTextOrNull "blacklist.conf" cfg.carbon.blacklist;
- target = "graphite/blacklist.conf"; }
- { source = writeTextOrNull "whitelist.conf" cfg.carbon.whitelist;
- target = "graphite/whitelist.conf"; }
- { source = writeTextOrNull "rewrite-rules.conf" cfg.carbon.rewriteRules;
- target = "graphite/rewrite-rules.conf"; }
- { source = writeTextOrNull "relay-rules.conf" cfg.carbon.relayRules;
- target = "graphite/relay-rules.conf"; }
- { source = writeTextOrNull "aggregation-rules.conf" cfg.carbon.aggregationRules;
- target = "graphite/aggregation-rules.conf"; }
- ];
-
- systemd.services.carbonCache = mkIf cfg.carbon.enableCache {
- description = "Graphite data storage backend";
+ systemd.services.carbonCache = {
+ enable = cfg.carbon.enableCache;
+ description = "Graphite Data Storage Backend";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
environment = carbonEnv;
- serviceConfig.ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-cache"}";
+ serviceConfig = {
+ ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-cache"}";
+ User = "graphite";
+ Group = "graphite";
+ PermissionsStartOnly = true;
+ };
restartTriggers = [
pkgs.pythonPackages.carbon
- cfg.carbon.config
- cfg.carbon.storageAggregation
- cfg.carbon.storageSchemas
- cfg.carbon.rewriteRules
+ configDir
];
preStart = ''
- mkdir -p ${dataDir}/whisper
+ mkdir -p ${cfg.dataDir}/whisper
+ chmod 0700 ${cfg.dataDir}/whisper
+ chown -R graphite:graphite ${cfg.dataDir}
'';
};
- systemd.services.carbonAggregator = mkIf cfg.carbon.enableAggregator {
- description = "Carbon data aggregator";
+ systemd.services.carbonAggregator = {
+ enable = cfg.carbon.enableAggregator;
+ description = "Carbon Data Aggregator";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
environment = carbonEnv;
- serviceConfig.ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-aggregator"}";
+ serviceConfig = {
+ ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-aggregator"}";
+ User = "graphite";
+ Group = "graphite";
+ };
restartTriggers = [
- pkgs.pythonPackages.carbon cfg.carbon.config cfg.carbon.aggregationRules
+ pkgs.pythonPackages.carbon
+ configDir
];
};
- systemd.services.carbonRelay = mkIf cfg.carbon.enableRelay {
- description = "Carbon data relay";
+ systemd.services.carbonRelay = {
+ enable = cfg.carbon.enableRelay;
+ description = "Carbon Data Relay";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
environment = carbonEnv;
- serviceConfig.ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-relay"}";
+ serviceConfig = {
+ ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-relay"}";
+ User = "graphite";
+ Group = "graphite";
+ };
restartTriggers = [
- pkgs.pythonPackages.carbon cfg.carbon.config cfg.carbon.relayRules
+ pkgs.pythonPackages.carbon
+ configDir
];
};
- systemd.services.graphiteWeb = mkIf cfg.web.enable {
- description = "Graphite web interface";
+ systemd.services.graphiteWeb = {
+ enable = cfg.web.enable;
+ description = "Graphite Web Interface";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
+ path = [ pkgs.perl ];
environment = {
PYTHONPATH = "${pkgs.python27Packages.graphite_web}/lib/python2.7/site-packages";
DJANGO_SETTINGS_MODULE = "graphite.settings";
@@ -223,14 +249,16 @@ in {
serviceConfig = {
ExecStart = ''
${pkgs.python27Packages.waitress}/bin/waitress-serve \
- --host=${cfg.web.host} --port=${cfg.web.port} \
+ --host=${cfg.web.host} --port=${toString cfg.web.port} \
--call django.core.handlers.wsgi:WSGIHandler'';
User = "graphite";
Group = "graphite";
+ PermissionsStartOnly = true;
};
preStart = ''
if ! test -e ${dataDir}/db-created; then
mkdir -p ${dataDir}/{whisper/,log/webapp/}
+ chmod 0700 ${dataDir}/{whisper/,log/webapp/}
# populate database
${pkgs.python27Packages.graphite_web}/bin/manage-graphite.py syncdb --noinput
@@ -239,11 +267,12 @@ in {
${pkgs.python27Packages.graphite_web}/bin/build-index.sh
touch ${dataDir}/db-created
+
+ chown -R graphite:graphite ${cfg.dataDir}
fi
'';
restartTriggers = [
pkgs.python27Packages.graphite_web
- pkgs.python27Packages.waitress
];
};
@@ -258,7 +287,6 @@ in {
uid = config.ids.uids.graphite;
description = "Graphite daemon user";
home = dataDir;
- createHome = true;
};
users.extraGroups.graphite.gid = config.ids.gids.graphite;
};
diff --git a/nixos/modules/services/monitoring/monit.nix b/nixos/modules/services/monitoring/monit.nix
index 2acc51c64a6..642fac3b3a0 100644
--- a/nixos/modules/services/monitoring/monit.nix
+++ b/nixos/modules/services/monitoring/monit.nix
@@ -1,9 +1,9 @@
# Monit system watcher
# http://mmonit.org/monit/
-{config, pkgs, ...}:
+{config, pkgs, lib, ...}:
-let inherit (pkgs.lib) mkOption mkIf;
+let inherit (lib) mkOption mkIf;
in
{
diff --git a/nixos/modules/services/monitoring/munin.nix b/nixos/modules/services/monitoring/munin.nix
index 42d5f61af30..21840bc67e8 100644
--- a/nixos/modules/services/monitoring/munin.nix
+++ b/nixos/modules/services/monitoring/munin.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
# TODO: support munin-async
# TODO: LWP/Pg perl libs aren't recognized
@@ -11,7 +11,7 @@
# nginx http://munin.readthedocs.org/en/latest/example/webserver/nginx.html
-with pkgs.lib;
+with lib;
let
nodeCfg = config.services.munin-node;
@@ -173,33 +173,34 @@ in
name = "munin";
description = "Munin monitoring user";
group = "munin";
+ uid = config.ids.uids.munin;
}];
users.extraGroups = [{
name = "munin";
+ gid = config.ids.gids.munin;
}];
}) (mkIf nodeCfg.enable {
systemd.services.munin-node = {
- description = "Munin node, the agent process";
+ description = "Munin Node";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
path = [ pkgs.munin ];
environment.MUNIN_PLUGSTATE = "/var/run/munin";
+ preStart = ''
+ echo "updating munin plugins..."
+
+ mkdir -p /etc/munin/plugins
+ rm -rf /etc/munin/plugins/*
+ PATH="/run/current-system/sw/bin:/run/current-system/sw/sbin" ${pkgs.munin}/sbin/munin-node-configure --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${muninPlugins} --servicedir=/etc/munin/plugins 2>/dev/null | ${pkgs.bash}/bin/bash
+ '';
serviceConfig = {
ExecStart = "${pkgs.munin}/sbin/munin-node --config ${nodeConf} --servicedir /etc/munin/plugins/";
};
};
- system.activationScripts.munin-node = ''
- echo "updating munin plugins..."
-
- mkdir -p /etc/munin/plugins
- rm -rf /etc/munin/plugins/*
- PATH="/run/current-system/sw/bin:/run/current-system/sw/sbin" ${pkgs.munin}/sbin/munin-node-configure --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${muninPlugins} --servicedir=/etc/munin/plugins 2>/dev/null | ${pkgs.bash}/bin/bash
- '';
-
}) (mkIf cronCfg.enable {
services.cron.systemCronJobs = [
diff --git a/nixos/modules/services/monitoring/nagios.nix b/nixos/modules/services/monitoring/nagios.nix
new file mode 100644
index 00000000000..c1f7ba0eca7
--- /dev/null
+++ b/nixos/modules/services/monitoring/nagios.nix
@@ -0,0 +1,184 @@
+# Nagios system/network monitoring daemon.
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.nagios;
+
+ nagiosState = "/var/lib/nagios";
+ nagiosLogDir = "/var/log/nagios";
+
+ nagiosObjectDefs = cfg.objectDefs;
+
+ nagiosObjectDefsDir = pkgs.runCommand "nagios-objects" {inherit nagiosObjectDefs;}
+ "mkdir -p $out; ln -s $nagiosObjectDefs $out/";
+
+ nagiosCfgFile = pkgs.writeText "nagios.cfg"
+ ''
+ # Paths for state and logs.
+ log_file=${nagiosLogDir}/current
+ log_archive_path=${nagiosLogDir}/archive
+ status_file=${nagiosState}/status.dat
+ object_cache_file=${nagiosState}/objects.cache
+ temp_file=${nagiosState}/nagios.tmp
+ lock_file=/var/run/nagios.lock # Not used I think.
+ state_retention_file=${nagiosState}/retention.dat
+ query_socket=${nagiosState}/nagios.qh
+ check_result_path=${nagiosState}
+ command_file=${nagiosState}/nagios.cmd
+
+ # Configuration files.
+ #resource_file=resource.cfg
+ cfg_dir=${nagiosObjectDefsDir}
+
+ # Uid/gid that the daemon runs under.
+ nagios_user=nagios
+ nagios_group=nogroup
+
+ # Misc. options.
+ illegal_macro_output_chars=`~$&|'"<>
+ retain_state_information=1
+ ''; # "
+
+ # Plain configuration for the Nagios web-interface with no
+ # authentication.
+ nagiosCGICfgFile = pkgs.writeText "nagios.cgi.conf"
+ ''
+ main_config_file=${cfg.mainConfigFile}
+ use_authentication=0
+ url_html_path=${cfg.urlPath}
+ '';
+
+ extraHttpdConfig =
+ ''
+ ScriptAlias ${cfg.urlPath}/cgi-bin ${pkgs.nagios}/sbin
+
+
+ Options ExecCGI
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+ SetEnv NAGIOS_CGI_CONFIG ${cfg.cgiConfigFile}
+
+
+ Alias ${cfg.urlPath} ${pkgs.nagios}/share
+
+
+ Options None
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+
+ '';
+
+in
+{
+ options = {
+ services.nagios = {
+ enable = mkOption {
+ default = false;
+ description = "
+ Whether to use Nagios to monitor
+ your system or network.
+ ";
+ };
+
+ objectDefs = mkOption {
+ description = "
+ A list of Nagios object configuration files that must define
+ the hosts, host groups, services and contacts for the
+ network that you want Nagios to monitor.
+ ";
+ };
+
+ plugins = mkOption {
+ default = [pkgs.nagiosPluginsOfficial pkgs.ssmtp];
+ description = "
+ Packages to be added to the Nagios PATH.
+ Typically used to add plugins, but can be anything.
+ ";
+ };
+
+ mainConfigFile = mkOption {
+ default = nagiosCfgFile;
+ description = "
+ Derivation for the main configuration file of Nagios.
+ ";
+ };
+
+ cgiConfigFile = mkOption {
+ default = nagiosCGICfgFile;
+ description = "
+ Derivation for the configuration file of Nagios CGI scripts
+ that can be used in web servers for running the Nagios web interface.
+ ";
+ };
+
+ enableWebInterface = mkOption {
+ default = false;
+ description = "
+ Whether to enable the Nagios web interface. You should also
+ enable Apache ().
+ ";
+ };
+
+ urlPath = mkOption {
+ default = "/nagios";
+ description = "
+ The URL path under which the Nagios web interface appears.
+ That is, you can access the Nagios web interface through
+ http://server/urlPath.
+ ";
+ };
+ };
+ };
+
+
+ config = mkIf cfg.enable {
+ users.extraUsers.nagios = {
+ description = "Nagios user ";
+ uid = config.ids.uids.nagios;
+ home = nagiosState;
+ createHome = true;
+ };
+
+ # This isn't needed, it's just so that the user can type "nagiostats
+ # -c /etc/nagios.cfg".
+ environment.etc = [
+ { source = cfg.mainConfigFile;
+ target = "nagios.cfg";
+ }
+ ];
+
+ environment.systemPackages = [ pkgs.nagios ];
+ systemd.services.nagios = {
+ description = "Nagios monitoring daemon";
+ path = [ pkgs.nagios ];
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+
+ serviceConfig = {
+ User = "nagios";
+ Restart = "always";
+ RestartSec = 2;
+ PermissionsStartOnly = true;
+ };
+
+ preStart = ''
+ mkdir -m 0755 -p ${nagiosState} ${nagiosLogDir}
+ chown nagios ${nagiosState} ${nagiosLogDir}
+ '';
+
+ script = ''
+ for i in ${toString cfg.plugins}; do
+ export PATH=$i/bin:$i/sbin:$i/libexec:$PATH
+ done
+ exec ${pkgs.nagios}/bin/nagios ${cfg.mainConfigFile}
+ '';
+ };
+
+ services.httpd.extraConfig = optionalString cfg.enableWebInterface extraHttpdConfig;
+ };
+}
diff --git a/nixos/modules/services/monitoring/nagios/commands.cfg b/nixos/modules/services/monitoring/nagios/commands.cfg
deleted file mode 100644
index 6efdefcd37d..00000000000
--- a/nixos/modules/services/monitoring/nagios/commands.cfg
+++ /dev/null
@@ -1,34 +0,0 @@
-define command {
- command_name host-notify-by-email
- command_line printf "%b" "To: $CONTACTEMAIL$\nSubject: [Nagios] Host $HOSTSTATE$ alert for $HOSTNAME$\n\n***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | sendmail $CONTACTEMAIL$
-}
-
-
-define command {
- command_name notify-by-email
- command_line printf "%b" "To: $CONTACTEMAIL$\nSubject: [Nagios] $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$\n\n***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | sendmail $CONTACTEMAIL$
-}
-
-
-define command {
- command_name dummy-ok
- command_line true
-}
-
-
-define command {
- command_name check-host-alive
- command_line check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 1
-}
-
-
-define command {
- command_name check_local_disk
- command_line check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
-}
-
-
-define command {
- command_name check_ssh
- command_line check_ssh $HOSTADDRESS$
-}
diff --git a/nixos/modules/services/monitoring/nagios/default.nix b/nixos/modules/services/monitoring/nagios/default.nix
deleted file mode 100644
index c809a3b8457..00000000000
--- a/nixos/modules/services/monitoring/nagios/default.nix
+++ /dev/null
@@ -1,186 +0,0 @@
-# Nagios system/network monitoring daemon.
-{ config, pkgs, ... }:
-
-with pkgs.lib;
-
-let
-
- cfg = config.services.nagios;
-
- nagiosUser = "nagios";
- nagiosGroup = "nogroup";
-
- nagiosState = "/var/lib/nagios";
- nagiosLogDir = "/var/log/nagios";
-
- nagiosObjectDefs =
- [ ./timeperiods.cfg
- ./host-templates.cfg
- ./service-templates.cfg
- ./commands.cfg
- ] ++ cfg.objectDefs;
-
- nagiosObjectDefsDir = pkgs.runCommand "nagios-objects" {inherit nagiosObjectDefs;}
- "ensureDir $out; ln -s $nagiosObjectDefs $out/";
-
- nagiosCfgFile = pkgs.writeText "nagios.cfg"
- ''
- # Paths for state and logs.
- log_file=${nagiosLogDir}/current
- log_archive_path=${nagiosLogDir}/archive
- status_file=${nagiosState}/status.dat
- object_cache_file=${nagiosState}/objects.cache
- comment_file=${nagiosState}/comment.dat
- downtime_file=${nagiosState}/downtime.dat
- temp_file=${nagiosState}/nagios.tmp
- lock_file=/var/run/nagios.lock # Not used I think.
- state_retention_file=${nagiosState}/retention.dat
-
- # Configuration files.
- #resource_file=resource.cfg
- cfg_dir=${nagiosObjectDefsDir}
-
- # Uid/gid that the daemon runs under.
- nagios_user=${nagiosUser}
- nagios_group=${nagiosGroup}
-
- # Misc. options.
- illegal_macro_output_chars=`~$&|'"<>
- retain_state_information=1
- ''; # "
-
- # Plain configuration for the Nagios web-interface with no
- # authentication.
- nagiosCGICfgFile = pkgs.writeText "nagios.cgi.conf"
- ''
- main_config_file=${nagiosCfgFile}
- use_authentication=0
- url_html_path=/nagios
- '';
-
- urlPath = cfg.urlPath;
-
- extraHttpdConfig =
- ''
- ScriptAlias ${urlPath}/cgi-bin ${pkgs.nagios}/sbin
-
-
- Options ExecCGI
- AllowOverride None
- Order allow,deny
- Allow from all
- SetEnv NAGIOS_CGI_CONFIG ${nagiosCGICfgFile}
-
-
- Alias ${urlPath} ${pkgs.nagios}/share
-
-
- Options None
- AllowOverride None
- Order allow,deny
- Allow from all
-
- '';
-
-in
-
-{
- ###### interface
-
- options = {
-
- services.nagios = {
-
- enable = mkOption {
- default = false;
- description = "
- Whether to use Nagios to monitor
- your system or network.
- ";
- };
-
- objectDefs = mkOption {
- description = "
- A list of Nagios object configuration files that must define
- the hosts, host groups, services and contacts for the
- network that you want Nagios to monitor.
- ";
- };
-
- plugins = mkOption {
- default = [pkgs.nagiosPluginsOfficial pkgs.ssmtp];
- description = "
- Packages to be added to the Nagios PATH.
- Typically used to add plugins, but can be anything.
- ";
- };
-
- enableWebInterface = mkOption {
- default = false;
- description = "
- Whether to enable the Nagios web interface. You should also
- enable Apache ().
- ";
- };
-
- urlPath = mkOption {
- default = "/nagios";
- description = "
- The URL path under which the Nagios web interface appears.
- That is, you can access the Nagios web interface through
- http://server/urlPath.
- ";
- };
-
- };
-
- };
-
-
- ###### implementation
-
- config = mkIf cfg.enable {
-
- users.extraUsers = singleton
- { name = nagiosUser;
- uid = config.ids.uids.nagios;
- description = "Nagios monitoring daemon";
- home = nagiosState;
- };
-
- # This isn't needed, it's just so that the user can type "nagiostats
- # -c /etc/nagios.cfg".
- environment.etc = singleton
- { source = nagiosCfgFile;
- target = "nagios.cfg";
- };
-
- environment.systemPackages = [ pkgs.nagios ];
-
- jobs.nagios =
- { description = "Nagios monitoring daemon";
-
- startOn = "started network-interfaces";
- stopOn = "stopping network-interfaces";
-
- preStart =
- ''
- mkdir -m 0755 -p ${nagiosState} ${nagiosLogDir}
- chown ${nagiosUser} ${nagiosState} ${nagiosLogDir}
- '';
-
- script =
- ''
- for i in ${toString config.services.nagios.plugins}; do
- export PATH=$i/bin:$i/sbin:$i/libexec:$PATH
- done
- exec ${pkgs.nagios}/bin/nagios ${nagiosCfgFile}
- '';
- };
-
- services.httpd.extraConfig = optionalString cfg.enableWebInterface extraHttpdConfig;
-
- };
-
-}
diff --git a/nixos/modules/services/monitoring/nagios/host-templates.cfg b/nixos/modules/services/monitoring/nagios/host-templates.cfg
deleted file mode 100644
index 3a4c269e257..00000000000
--- a/nixos/modules/services/monitoring/nagios/host-templates.cfg
+++ /dev/null
@@ -1,27 +0,0 @@
-define host {
- name generic-host
- notifications_enabled 1
- event_handler_enabled 1
- flap_detection_enabled 1
- failure_prediction_enabled 1
- process_perf_data 1
- retain_status_information 1
- retain_nonstatus_information 1
- notification_period 24x7
- register 0
-}
-
-
-define host {
- name generic-server
- use generic-host
- check_period 24x7
- max_check_attempts 10
- check_command check-host-alive
- notification_period 24x7
- notification_interval 120
- notification_options d,u,r
- contact_groups admins
- register 0
- #check_interval 1
-}
diff --git a/nixos/modules/services/monitoring/nagios/service-templates.cfg b/nixos/modules/services/monitoring/nagios/service-templates.cfg
deleted file mode 100644
index e729ea77675..00000000000
--- a/nixos/modules/services/monitoring/nagios/service-templates.cfg
+++ /dev/null
@@ -1,32 +0,0 @@
-define service {
- name generic-service
- active_checks_enabled 1
- passive_checks_enabled 1
- parallelize_check 1
- obsess_over_service 1
- check_freshness 0
- notifications_enabled 1
- event_handler_enabled 1
- flap_detection_enabled 1
- failure_prediction_enabled 1
- process_perf_data 1
- retain_status_information 1
- retain_nonstatus_information 1
- is_volatile 0
- register 0
-}
-
-
-define service {
- name local-service
- use generic-service
- check_period 24x7
- max_check_attempts 4
- normal_check_interval 5
- retry_check_interval 1
- contact_groups admins
- notification_options w,u,c,r
- notification_interval 0 # notify only once
- notification_period 24x7
- register 0
-}
diff --git a/nixos/modules/services/monitoring/nagios/timeperiods.cfg b/nixos/modules/services/monitoring/nagios/timeperiods.cfg
deleted file mode 100644
index 2669be54d3d..00000000000
--- a/nixos/modules/services/monitoring/nagios/timeperiods.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-define timeperiod {
- timeperiod_name 24x7
- alias 24 Hours A Day, 7 Days A Week
- sunday 00:00-24:00
- monday 00:00-24:00
- tuesday 00:00-24:00
- wednesday 00:00-24:00
- thursday 00:00-24:00
- friday 00:00-24:00
- saturday 00:00-24:00
-}
diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix
index 512e639721e..250035fe447 100644
--- a/nixos/modules/services/monitoring/smartd.nix
+++ b/nixos/modules/services/monitoring/smartd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/monitoring/statsd.nix b/nixos/modules/services/monitoring/statsd.nix
index 979debefdd9..74f3deb4c29 100644
--- a/nixos/modules/services/monitoring/statsd.nix
+++ b/nixos/modules/services/monitoring/statsd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -64,12 +64,12 @@ in
graphiteHost = mkOption {
description = "Hostname or IP of Graphite server";
- default = "127.0.0.1";
+ default = config.services.graphite.web.host;
type = types.str;
};
graphitePort = mkOption {
- description = "Port of Graphite server";
+ description = "Port of Graphite server (i.e. carbon-cache).";
default = 2003;
type = types.uniq types.int;
};
diff --git a/nixos/modules/services/monitoring/systemhealth.nix b/nixos/modules/services/monitoring/systemhealth.nix
index 0a3e666ad4e..20d1dadd3bf 100644
--- a/nixos/modules/services/monitoring/systemhealth.nix
+++ b/nixos/modules/services/monitoring/systemhealth.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.systemhealth;
@@ -13,7 +13,7 @@ let
};
buildInputs = [ python ];
installPhase = ''
- ensureDir $out/bin
+ mkdir -p $out/bin
# Make it work for kernels 3.x, not so different than 2.6
sed -i 's/2\.6/4.0/' system_health.py
cp system_health.py $out/bin
diff --git a/nixos/modules/services/monitoring/ups.nix b/nixos/modules/services/monitoring/ups.nix
index c00f4bad935..cc9026f768a 100644
--- a/nixos/modules/services/monitoring/ups.nix
+++ b/nixos/modules/services/monitoring/ups.nix
@@ -1,8 +1,8 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
# TODO: This is not secure, have a look at the file docs/security.txt inside
# the project sources.
-with pkgs.lib;
+with lib;
let
cfg = config.power.ups;
diff --git a/nixos/modules/services/monitoring/uptime.nix b/nixos/modules/services/monitoring/uptime.nix
index 553110d7b80..29616a085c8 100644
--- a/nixos/modules/services/monitoring/uptime.nix
+++ b/nixos/modules/services/monitoring/uptime.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let
- inherit (pkgs.lib) mkOption mkEnableOption mkIf mkMerge types optionalAttrs optional;
+ inherit (lib) mkOption mkEnableOption mkIf mkMerge types optionalAttrs optional;
cfg = config.services.uptime;
diff --git a/nixos/modules/services/monitoring/zabbix-agent.nix b/nixos/modules/services/monitoring/zabbix-agent.nix
index 229236c1bbd..a943075be0c 100644
--- a/nixos/modules/services/monitoring/zabbix-agent.nix
+++ b/nixos/modules/services/monitoring/zabbix-agent.nix
@@ -1,7 +1,7 @@
# Zabbix agent daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -67,11 +67,11 @@ in
config = mkIf cfg.enable {
- users.extraUsers = singleton
+ users.extraUsers = mkIf (!config.services.zabbixServer.enable) (singleton
{ name = "zabbix";
uid = config.ids.uids.zabbix;
description = "Zabbix daemon user";
- };
+ });
systemd.services."zabbix-agent" =
{ description = "Zabbix Agent";
diff --git a/nixos/modules/services/monitoring/zabbix-server.nix b/nixos/modules/services/monitoring/zabbix-server.nix
index 6735b4ca327..ca283ea2a99 100644
--- a/nixos/modules/services/monitoring/zabbix-server.nix
+++ b/nixos/modules/services/monitoring/zabbix-server.nix
@@ -1,7 +1,7 @@
# Zabbix server daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/network-filesystems/drbd.nix b/nixos/modules/services/network-filesystems/drbd.nix
index 1a00ccab0a6..b914724abfe 100644
--- a/nixos/modules/services/network-filesystems/drbd.nix
+++ b/nixos/modules/services/network-filesystems/drbd.nix
@@ -1,8 +1,8 @@
# Support for DRBD, the Distributed Replicated Block Device.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.drbd; in
diff --git a/nixos/modules/services/network-filesystems/nfsd.nix b/nixos/modules/services/network-filesystems/nfsd.nix
index 4daa5e9d063..2217fec3b0f 100644
--- a/nixos/modules/services/network-filesystems/nfsd.nix
+++ b/nixos/modules/services/network-filesystems/nfsd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/network-filesystems/openafs-client/default.nix b/nixos/modules/services/network-filesystems/openafs-client/default.nix
index 4a888b64bd3..0297da9e865 100644
--- a/nixos/modules/services/network-filesystems/openafs-client/default.nix
+++ b/nixos/modules/services/network-filesystems/openafs-client/default.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let
- inherit (pkgs.lib) mkOption mkIf;
+ inherit (lib) mkOption mkIf;
cfg = config.services.openafsClient;
@@ -11,7 +11,7 @@ let
};
afsConfig = pkgs.runCommand "afsconfig" {} ''
- ensureDir $out
+ mkdir -p $out
echo ${cfg.cellName} > $out/ThisCell
cp ${cellServDB} $out/CellServDB
echo "/afs:${cfg.cacheDirectory}:${cfg.cacheSize}" > $out/cacheinfo
@@ -46,6 +46,16 @@ in
description = "Cache directory.";
};
+ crypt = mkOption {
+ default = false;
+ description = "Whether to enable (weak) protocol encryption.";
+ };
+
+ sparse = mkOption {
+ default = false;
+ description = "Minimal cell list in /afs.";
+ };
+
};
};
@@ -70,18 +80,23 @@ in
startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
- preStart = ''
- mkdir -m 0755 /afs || true
- mkdir -m 0755 -p ${cfg.cacheDirectory} || true
+ preStart = ''
+ mkdir -p -m 0755 /afs
+ mkdir -m 0700 -p ${cfg.cacheDirectory}
${pkgs.module_init_tools}/sbin/insmod ${openafsPkgs}/lib/openafs/libafs-*.ko || true
- ${openafsPkgs}/sbin/afsd -confdir ${afsConfig} -cachedir ${cfg.cacheDirectory} -dynroot -fakestat
- '';
+ ${openafsPkgs}/sbin/afsd -confdir ${afsConfig} -cachedir ${cfg.cacheDirectory} ${if cfg.sparse then "-dynroot-sparse" else "-dynroot"} -fakestat -afsdb
+ ${openafsPkgs}/bin/fs setcrypt ${if cfg.crypt then "on" else "off"}
+ '';
- postStop = ''
- umount /afs
+ # Doing this in preStop, because after these commands AFS is basically
+ # stopped, so systemd has nothing to do, just noticing it. If done in
+ # postStop, then we get a hang + kernel oops, because AFS can't be
+ # stopped simply by sending signals to processes.
+ preStop = ''
+ ${pkgs.utillinux}/bin/umount /afs
${openafsPkgs}/sbin/afsd -shutdown
- rmmod libafs
- '';
+ ${pkgs.module_init_tools}/sbin/rmmod libafs
+ '';
};
diff --git a/nixos/modules/services/network-filesystems/rsyncd.nix b/nixos/modules/services/network-filesystems/rsyncd.nix
new file mode 100644
index 00000000000..19aa7efd2ff
--- /dev/null
+++ b/nixos/modules/services/network-filesystems/rsyncd.nix
@@ -0,0 +1,139 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.rsyncd;
+
+ motdFile = pkgs.writeText "rsyncd-motd" cfg.motd;
+
+ rsyncdCfg = ""
+ + optionalString (cfg.motd != "") "motd file = ${motdFile}\n"
+ + optionalString (cfg.address != "") "address = ${cfg.address}\n"
+ + optionalString (cfg.port != 873) "port = ${toString cfg.port}\n"
+ + cfg.extraConfig
+ + "\n"
+ + flip concatMapStrings cfg.modules (m: "[${m.name}]\n\tpath = ${m.path}\n"
+ + optionalString (m.comment != "") "\tcomment = ${m.comment}\n"
+ + m.extraConfig
+ + "\n"
+ );
+
+ rsyncdCfgFile = pkgs.writeText "rsyncd.conf" rsyncdCfg;
+
+in
+
+{
+ options = {
+
+ services.rsyncd = {
+
+ enable = mkOption {
+ default = false;
+ description = "Whether to enable the rsync daemon.";
+ };
+
+ motd = mkOption {
+ type = types.string;
+ default = "";
+ description = ''
+ Message of the day to display to clients on each connect.
+ This usually contains site information and any legal notices.
+ '';
+ };
+
+ port = mkOption {
+ default = 873;
+ type = types.int;
+ description = "TCP port the daemon will listen on.";
+ };
+
+ address = mkOption {
+ default = "";
+ example = "192.168.1.2";
+ description = ''
+ IP address the daemon will listen on; rsyncd will listen on
+ all addresses if this is not specified.
+ '';
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Lines of configuration to add to rsyncd globally.
+ See man rsyncd.conf for more options.
+ '';
+ };
+
+ modules = mkOption {
+ default = [ ];
+ example = [
+ { name = "ftp";
+ path = "/home/ftp";
+ comment = "ftp export area";
+ extraConfig = ''
+ secrets file = /etc/rsyncd.secrets
+ '';
+ }
+ ];
+ description = "The list of file paths to export.";
+ type = types.listOf types.optionSet;
+
+ options = {
+
+ name = mkOption {
+ example = "ftp";
+ type = types.string;
+ description = "Name of export module.";
+ };
+
+ comment = mkOption {
+ default = "";
+ description = ''
+ Description string that is displayed next to the module name
+ when clients obtain a list of available modules.
+ '';
+ };
+
+ path = mkOption {
+ example = "/home/ftp";
+ type = types.string;
+ description = "Directory to make available in this module.";
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Lines of configuration to add to this module.
+ See man rsyncd.conf for more options.
+ '';
+ };
+ };
+ };
+ };
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ environment.etc = singleton
+ { source = rsyncdCfgFile;
+ target = "rsyncd.conf";
+ };
+
+ systemd.services.rsyncd = {
+ description = "Rsync daemon";
+ wantedBy = [ "multi-user.target" ];
+
+ path = [ pkgs.rsync ];
+
+ serviceConfig.ExecStart = "${pkgs.rsync}/bin/rsync --daemon --no-detach";
+ };
+
+ networking.firewall.allowedTCPPorts = [ cfg.port ];
+ };
+}
diff --git a/nixos/modules/services/network-filesystems/samba.nix b/nixos/modules/services/network-filesystems/samba.nix
index e18d9d7b67b..4218b965cd9 100644
--- a/nixos/modules/services/network-filesystems/samba.nix
+++ b/nixos/modules/services/network-filesystems/samba.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -57,9 +57,9 @@ let
nssModulesPath = config.system.nssModules.path;
daemonService = appName: args:
- { description = "Samba Service daemon ${appName}";
+ { description = "Samba Service Daemon ${appName}";
- wantedBy = [ "samba.target" ];
+ requiredBy = [ "samba.target" ];
partOf = [ "samba.target" ];
environment = {
@@ -211,7 +211,7 @@ in
systemd = {
targets.samba = {
- description = "Samba server";
+ description = "Samba Server";
requires = [ "samba-setup.service" ];
after = [ "samba-setup.service" "network.target" ];
wantedBy = [ "multi-user.target" ];
@@ -222,7 +222,7 @@ in
"samba-smbd" = daemonService "smbd" "-F";
"samba-winbindd" = daemonService "winbindd" "-F";
"samba-setup" = {
- description = "Samba setup task";
+ description = "Samba Setup Task";
script = setupScript;
unitConfig.RequiresMountsFor = "/home/smbd /var/samba /var/log/samba";
};
diff --git a/nixos/modules/services/networking/amuled.nix b/nixos/modules/services/networking/amuled.nix
index 8652d0daf4c..516238fdddf 100644
--- a/nixos/modules/services/networking/amuled.nix
+++ b/nixos/modules/services/networking/amuled.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.amule;
diff --git a/nixos/modules/services/networking/avahi-daemon.nix b/nixos/modules/services/networking/avahi-daemon.nix
index effd1a62bd9..284b2b84e6c 100644
--- a/nixos/modules/services/networking/avahi-daemon.nix
+++ b/nixos/modules/services/networking/avahi-daemon.nix
@@ -1,7 +1,7 @@
# Avahi daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -51,7 +51,10 @@ in
hostName = mkOption {
type = types.str;
- description = ''Host name advertised on the LAN.'';
+ description = ''
+ Host name advertised on the LAN. If not set, avahi will use the value
+ of config.networking.hostName.
+ '';
};
browseDomains = mkOption {
@@ -139,6 +142,10 @@ in
services.dbus.enable = true;
services.dbus.packages = [avahi];
+ # Enabling Avahi without exposing it in the firewall doesn't make
+ # sense.
+ networking.firewall.allowedUDPPorts = [ 5353 ];
+
};
}
diff --git a/nixos/modules/services/networking/bind.nix b/nixos/modules/services/networking/bind.nix
index 765dc014dcb..57547da1006 100644
--- a/nixos/modules/services/networking/bind.nix
+++ b/nixos/modules/services/networking/bind.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/bitlbee.nix b/nixos/modules/services/networking/bitlbee.nix
index fe37e8ea012..7276603da16 100644
--- a/nixos/modules/services/networking/bitlbee.nix
+++ b/nixos/modules/services/networking/bitlbee.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/btsync.nix b/nixos/modules/services/networking/btsync.nix
new file mode 100644
index 00000000000..5d0e17c293e
--- /dev/null
+++ b/nixos/modules/services/networking/btsync.nix
@@ -0,0 +1,276 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.btsync;
+ listenAddr = cfg.httpListenAddr + ":" + (toString cfg.httpListenPort);
+
+ boolStr = x: if x then "true" else "false";
+ optionalEmptyStr = b: v: optionalString (b != "") v;
+
+ webUIConfig = optionalString cfg.enableWebUI
+ ''
+ "webui":
+ {
+ ${optionalEmptyStr cfg.httpLogin "\"login\": \"${cfg.httpLogin}\","}
+ ${optionalEmptyStr cfg.httpPass "\"password\": \"${cfg.httpPass}\","}
+ ${optionalEmptyStr cfg.apiKey "\"api_key\": \"${cfg.apiKey}\","}
+ "listen": "${listenAddr}"
+ }
+ '';
+
+ knownHosts = e:
+ optionalString (e ? "knownHosts")
+ (concatStringsSep "," (map (v: "\"${v}\"") e."knownHosts"));
+
+ sharedFoldersRecord =
+ concatStringsSep "," (map (entry:
+ let helper = attr: v:
+ if (entry ? attr) then boolStr entry.attr else boolStr v;
+ in
+ ''
+ {
+ "secret": "${entry.secret}",
+ "dir": "${entry.directory}",
+
+ "use_relay_server": ${helper "useRelayServer" true},
+ "use_tracker": ${helper "useTracker" true},
+ "use_dht": ${helper "useDHT" false},
+
+ "search_lan": ${helper "searchLAN" true},
+ "use_sync_trash": ${helper "useSyncTrash" true},
+
+ "known_hosts": [${knownHosts entry}]
+ }
+ '') cfg.sharedFolders);
+
+ sharedFoldersConfig = optionalString (cfg.sharedFolders != [])
+ ''
+ "shared_folders":
+ [
+ ${sharedFoldersRecord}
+ ]
+ '';
+
+ configFile = pkgs.writeText "btsync.config"
+ ''
+ {
+ "device_name": "${cfg.deviceName}",
+ "storage_path": "/var/lib/btsync",
+ "listening_port": ${toString cfg.listeningPort},
+ "use_gui": false,
+
+ "check_for_updates": ${boolStr cfg.checkForUpdates},
+ "use_upnp": ${boolStr cfg.useUpnp},
+ "download_limit": ${toString cfg.downloadLimit},
+ "upload_limit": ${toString cfg.uploadLimit},
+ "lan_encrypt_data": ${boolStr cfg.encryptLAN},
+
+ ${webUIConfig}
+ ${sharedFoldersConfig}
+ }
+ '';
+in
+{
+ options = {
+ services.btsync = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If enabled, start the Bittorrent Sync daemon. Once enabled,
+ you can interact with the service through the Web UI, or
+ configure it in your NixOS configuration. Enabling the
+ btsync service also installs a
+ multi-instance systemd unit which can be used to start
+ user-specific copies of the daemon. Once installed, you can
+ use systemctl start btsync@user to start
+ the daemon only for user user, using the
+ configuration file located at
+ $HOME/.config/btsync.conf
+ '';
+ };
+
+ deviceName = mkOption {
+ type = types.str;
+ example = "Voltron";
+ description = ''
+ Name of the Bittorrent Sync device.
+ '';
+ };
+
+ listeningPort = mkOption {
+ type = types.int;
+ default = 0;
+ example = 44444;
+ description = ''
+ Listening port. Defaults to 0 which randomizes the port.
+ '';
+ };
+
+ checkForUpdates = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Determines whether to check for updates and alert the user
+ about them in the UI.
+ '';
+ };
+
+ useUpnp = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Use Universal Plug-n-Play (UPnP)
+ '';
+ };
+
+ downloadLimit = mkOption {
+ type = types.int;
+ default = 0;
+ example = 1024;
+ description = ''
+ Download speed limit. 0 is unlimited (default).
+ '';
+ };
+
+ uploadLimit = mkOption {
+ type = types.int;
+ default = 0;
+ example = 1024;
+ description = ''
+ Upload speed limit. 0 is unlimited (default).
+ '';
+ };
+
+ httpListenAddr = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ example = "1.2.3.4";
+ description = ''
+ HTTP address to bind to.
+ '';
+ };
+
+ httpListenPort = mkOption {
+ type = types.int;
+ default = 9000;
+ description = ''
+ HTTP port to bind on.
+ '';
+ };
+
+ httpLogin = mkOption {
+ type = types.str;
+ example = "allyourbase";
+ default = "";
+ description = ''
+ HTTP web login username.
+ '';
+ };
+
+ httpPass = mkOption {
+ type = types.str;
+ example = "arebelongtous";
+ default = "";
+ description = ''
+ HTTP web login password.
+ '';
+ };
+
+ encryptLAN = mkOption {
+ type = types.bool;
+ default = true;
+ description = "Encrypt LAN data.";
+ };
+
+ enableWebUI = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable Web UI for administration. Bound to the specified
+ httpListenAddress and
+ httpListenPort.
+ '';
+ };
+
+ apiKey = mkOption {
+ type = types.str;
+ default = "";
+ description = "API key, which enables the developer API.";
+ };
+
+ sharedFolders = mkOption {
+ default = [];
+ example =
+ [ { secret = "AHMYFPCQAHBM7LQPFXQ7WV6Y42IGUXJ5Y";
+ directory = "/home/user/sync_test";
+ useRelayServer = true;
+ useTracker = true;
+ useDHT = false;
+ searchLAN = true;
+ useSyncTrash = true;
+ knownHosts =
+ [ "192.168.1.2:4444"
+ "192.168.1.3:4444"
+ ];
+ }
+ ];
+ description = ''
+ Shared folder list. If enabled, web UI must be
+ disabled. Secrets can be generated using btsync
+ --generate-secret. Note that this secret will be
+ put inside the Nix store, so it is realistically not very
+ secret.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions =
+ [ { assertion = cfg.deviceName != "";
+ message = "Device name cannot be empty.";
+ }
+ { assertion = cfg.enableWebUI -> cfg.sharedFolders == [];
+ message = "If using shared folders, the web UI cannot be enabled.";
+ }
+ { assertion = cfg.apiKey != "" -> cfg.enableWebUI;
+ message = "If you're using an API key, you must enable the web server.";
+ }
+ ];
+
+ users.extraUsers.btsync = {
+ description = "Bittorrent Sync Service user";
+ home = "/var/lib/btsync";
+ createHome = true;
+ uid = config.ids.uids.btsync;
+ };
+
+ systemd.services.btsync = with pkgs; {
+ description = "Bittorrent Sync Service";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ serviceConfig = {
+ Restart = "on-abort";
+ User = "btsync";
+ ExecStart =
+ "${bittorrentSync}/bin/btsync --nodaemon --config ${configFile}";
+ };
+ };
+
+ systemd.services."btsync@" = with pkgs; {
+ description = "Bittorrent Sync Service for %i";
+ after = [ "network.target" ];
+ serviceConfig = {
+ Restart = "on-abort";
+ User = "%i";
+ ExecStart =
+ "${bittorrentSync}/bin/btsync --nodaemon --config %h/.config/btsync.conf";
+ };
+ };
+
+ environment.systemPackages = [ pkgs.bittorrentSync ];
+ };
+}
diff --git a/nixos/modules/services/networking/chrony.nix b/nixos/modules/services/networking/chrony.nix
index 5e9818858e0..d1684dd9f05 100644
--- a/nixos/modules/services/networking/chrony.nix
+++ b/nixos/modules/services/networking/chrony.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/cjdns.nix b/nixos/modules/services/networking/cjdns.nix
new file mode 100644
index 00000000000..9306ffd5a18
--- /dev/null
+++ b/nixos/modules/services/networking/cjdns.nix
@@ -0,0 +1,207 @@
+# You may notice the commented out sections in this file,
+# it would be great to configure cjdns from nix, but cjdns
+# reads its configuration from stdin, including the private
+# key and admin password, all nested in a JSON structure.
+#
+# Until a good method of storing the keys outside the nix
+# store and mixing them back into a string is devised
+# (without too much shell hackery), a skeleton of the
+# configuration building lies commented out.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.cjdns;
+
+ /*
+ # can't keep keys and passwords in the nix store,
+ # but don't want to deal with this stdin quagmire.
+
+ cjdrouteConf = '' {
+ "admin": {"bind": "${cfg.admin.bind}", "password": "\${CJDNS_ADMIN}" },
+ "privateKey": "\${CJDNS_KEY}",
+
+ "interfaces": {
+ ''
+
+ + optionalString (cfg.interfaces.udp.bind.address != null) ''
+ "UDPInterface": [ {
+ "bind": "${cfg.interfaces.udp.bind.address}:"''
+ ${if cfg.interfaces.upd.bind.port != null
+ then ${toString cfg.interfaces.udp.bind.port}
+ else ${RANDOM}
+ fi)
+ + '' } ]''
+
+ + (if cfg.interfaces.eth.bind != null then ''
+ "ETHInterface": [ {
+ "bind": "${cfg.interfaces.eth.bind}",
+ "beacon": ${toString cfg.interfaces.eth.beacon}
+ } ]
+ '' fi )
+ + ''
+ },
+ "router": { "interface": { "type": "TUNInterface" }, },
+ "security": [ { "setuser": "nobody" } ]
+ }
+ '';
+
+ cjdrouteConfFile = pkgs.writeText "cjdroute.conf" cjdrouteConf
+ */
+in
+
+{
+ options = {
+
+ services.cjdns = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable this option to start a instance of the
+ cjdns network encryption and and routing engine.
+ Configuration will be read from confFile.
+ '';
+ };
+
+ confFile = mkOption {
+ default = "/etc/cjdroute.conf";
+ description = ''
+ Configuration file to pipe to cjdroute.
+ '';
+ };
+
+ /*
+ admin = {
+ bind = mkOption {
+ default = "127.0.0.1:11234";
+ description = ''
+ Bind the administration port to this address and port.
+ '';
+ };
+
+ passwordFile = mkOption {
+ example = "/root/cjdns.adminPassword";
+ description = ''
+ File containing a password to the administration port.
+ '';
+ };
+ };
+
+ keyFile = mkOption {
+ type = types.str;
+ example = "/root/cjdns.key";
+ description = ''
+ Path to a file containing a cjdns private key on a single line.
+ '';
+ };
+
+ passwordsFile = mkOption {
+ type = types.str;
+ default = null;
+ example = "/root/cjdns.authorizedPasswords";
+ description = ''
+ A file containing a list of json dictionaries with passwords.
+ For example:
+ {"password": "s8xf5z7znl4jt05g922n3wpk75wkypk"},
+ { "name": "nice guy",
+ "password": "xhthk1mglz8tpjrbbvdlhyc092rhpx5"},
+ {"password": "3qfxyhmrht7uwzq29pmhbdm9w4bnc8w"}
+ '';
+ };
+
+ interfaces = {
+ udp = {
+ bind = {
+ address = mkOption {
+ default = "0.0.0.0";
+ description = ''
+ Address to bind UDP tunnels to; disable by setting to null;
+ '';
+ };
+ port = mkOption {
+ type = types.int;
+ default = null;
+ description = ''
+ Port to bind UDP tunnels to.
+ A port will be choosen at random if this is not set.
+ This option is required to act as the server end of
+ a tunnel.
+ '';
+ };
+ };
+ };
+
+ eth = {
+ bind = mkOption {
+ default = null;
+ example = "eth0";
+ description = ''
+ Bind to this device and operate with native wire format.
+ '';
+ };
+
+ beacon = mkOption {
+ default = 2;
+ description = ''
+ Auto-connect to other cjdns nodes on the same network.
+ Options:
+ 0 -- Disabled.
+
+ 1 -- Accept beacons, this will cause cjdns to accept incoming
+ beacon messages and try connecting to the sender.
+
+ 2 -- Accept and send beacons, this will cause cjdns to broadcast
+ messages on the local network which contain a randomly
+ generated per-session password, other nodes which have this
+ set to 1 or 2 will hear the beacon messages and connect
+ automatically.
+ '';
+ };
+
+ connectTo = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Credentials for connecting look similar to UDP credientials
+ except they begin with the mac address, for example:
+ "01:02:03:04:05:06":{"password":"a","publicKey":"b"}
+ '';
+ };
+ };
+ };
+ */
+ };
+ };
+
+ config = mkIf config.services.cjdns.enable {
+
+ boot.kernelModules = [ "tun" ];
+
+ /*
+ networking.firewall.allowedUDPPorts = mkIf (cfg.udp.bind.port != null) [
+ cfg.udp.bind.port
+ ];
+ */
+
+ systemd.services.cjdns = {
+ description = "encrypted networking for everybody";
+ wantedBy = [ "multi-user.target" ];
+ wants = [ "network.target" ];
+ before = [ "network.target" ];
+ path = [ pkgs.cjdns ];
+
+ serviceConfig = {
+ Type = "forking";
+ ExecStart = ''
+ ${pkgs.stdenv.shell} -c "${pkgs.cjdns}/sbin/cjdroute < ${cfg.confFile}"
+ '';
+ Restart = "on-failure";
+ };
+ };
+ };
+}
diff --git a/nixos/modules/services/networking/cntlm.nix b/nixos/modules/services/networking/cntlm.nix
index 96396878afc..a50aa4d0636 100644
--- a/nixos/modules/services/networking/cntlm.nix
+++ b/nixos/modules/services/networking/cntlm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -34,7 +34,7 @@ in
password = mkOption {
default = "/etc/cntlm.password";
- type = with pkgs.lib.types; string;
+ type = types.str;
description = ''Proxy account password. Note: use chmod 0600 on /etc/cntlm.password for security.'';
};
diff --git a/nixos/modules/services/networking/connman.nix b/nixos/modules/services/networking/connman.nix
new file mode 100644
index 00000000000..482b61997ae
--- /dev/null
+++ b/nixos/modules/services/networking/connman.nix
@@ -0,0 +1,94 @@
+{ config, lib, pkgs, ... }:
+
+with pkgs;
+with lib;
+
+let
+ cfg = config.networking.connman;
+
+in {
+
+ ###### interface
+
+ options = {
+
+ networking.connman = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to use ConnMan for managing your network connections.
+ '';
+ };
+
+ };
+
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ assertions = [{
+ assertion = config.networking.useDHCP == false;
+ message = "You can not use services.networking.connman with services.networking.useDHCP";
+ }{
+ assertion = config.networking.wireless.enable == true;
+ message = "You must use services.networking.connman with services.networking.wireless";
+ }{
+ assertion = config.networking.networkmanager.enable == false;
+ message = "You can not use services.networking.connman with services.networking.networkmanager";
+ }];
+
+ environment.systemPackages = [ connman ];
+
+ systemd.services."connman" = {
+ description = "Connection service";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "syslog.target" ];
+ serviceConfig = {
+ Type = "dbus";
+ BusName = "net.connman";
+ Restart = "on-failure";
+ ExecStart = "${pkgs.connman}/sbin/connmand --nodaemon";
+ StandardOutput = "null";
+ };
+ };
+
+ systemd.services."connman-vpn" = {
+ description = "ConnMan VPN service";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "syslog.target" ];
+ before = [ "connman" ];
+ serviceConfig = {
+ Type = "dbus";
+ BusName = "net.connman.vpn";
+ ExecStart = "${pkgs.connman}/sbin/connman-vpnd -n";
+ StandardOutput = "null";
+ };
+ };
+
+ systemd.services."net-connman-vpn" = {
+ description = "D-BUS Service";
+ serviceConfig = {
+ Name = "net.connman.vpn";
+ before = [ "connman" ];
+ ExecStart = "${pkgs.connman}/sbin/connman-vpnd -n";
+ User = "root";
+ SystemdService = "connman-vpn.service";
+ };
+ };
+
+ networking = {
+ useDHCP = false;
+ wireless.enable = true;
+ networkmanager.enable = false;
+ };
+
+ powerManagement.resumeCommands = ''
+ systemctl restart connman
+ '';
+
+ };
+}
diff --git a/nixos/modules/services/networking/ddclient.nix b/nixos/modules/services/networking/ddclient.nix
index 62709a040a1..bb94a8dacfa 100644
--- a/nixos/modules/services/networking/ddclient.nix
+++ b/nixos/modules/services/networking/ddclient.nix
@@ -1,8 +1,8 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let
- inherit (pkgs.lib) mkOption mkIf singleton;
+ inherit (lib) mkOption mkIf singleton;
inherit (pkgs) ddclient;
@@ -86,7 +86,7 @@ in
};
web = mkOption {
- default = "web, web=checkip.dyndns.com/, web-skip='IP Address'" ;
+ default = "web, web=checkip.dyndns.com/, web-skip='Current IP Address: '" ;
description = "";
};
diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix
index 07b5606eaca..5a353fc0942 100644
--- a/nixos/modules/services/networking/dhcpcd.nix
+++ b/nixos/modules/services/networking/dhcpcd.nix
@@ -1,16 +1,17 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
- inherit (pkgs) dhcpcd;
+ dhcpcd = if !config.boot.isContainer then pkgs.dhcpcd else pkgs.dhcpcd.override { udev = null; };
# Don't start dhcpcd on explicitly configured interfaces or on
# interfaces that are part of a bridge.
ignoredInterfaces =
map (i: i.name) (filter (i: i.ipAddress != null) (attrValues config.networking.interfaces))
++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bridges))
+ ++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bonds))
++ config.networking.dhcpcd.denyInterfaces;
# Config file adapted from the one that ships with dhcpcd.
@@ -34,7 +35,7 @@ let
# Ignore peth* devices; on Xen, they're renamed physical
# Ethernet cards used for bridging. Likewise for vif* and tap*
# (Xen) and virbr* and vnet* (libvirt).
- denyinterfaces ${toString ignoredInterfaces} peth* vif* tap* tun* virbr* vnet* vboxnet*
+ denyinterfaces ${toString ignoredInterfaces} lo peth* vif* tap* tun* virbr* vnet* vboxnet*
${config.networking.dhcpcd.extraConfig}
'';
@@ -42,17 +43,6 @@ let
# Hook for emitting ip-up/ip-down events.
exitHook = pkgs.writeText "dhcpcd.exit-hook"
''
- #exec >> /var/log/dhcpcd 2>&1
- #set -x
-
- params="IFACE=$interface REASON=$reason"
-
- # only works when interface is wireless and wpa_supplicant has a control socket
- # but we allow it to fail silently
- ${optionalString config.networking.wireless.enable ''
- params+=" $(${pkgs.wpa_supplicant}/sbin/wpa_cli -i$interface status 2>/dev/null | grep ssid | sed 's|^b|B|;s|ssid|SSID|' | xargs)"
- ''}
-
if [ "$reason" = BOUND -o "$reason" = REBOOT ]; then
# Restart ntpd. We need to restart it to make sure that it
# will actually do something: if ntpd cannot resolve the
@@ -67,6 +57,8 @@ let
#if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then
# ${config.systemd.package}/bin/systemctl start ip-down.target
#fi
+
+ ${config.networking.dhcpcd.runHook}
'';
in
@@ -78,6 +70,7 @@ in
options = {
networking.dhcpcd.denyInterfaces = mkOption {
+ type = types.listOf types.str;
default = [];
description = ''
Disable the DHCP client for any interface whose name matches
@@ -88,12 +81,23 @@ in
};
networking.dhcpcd.extraConfig = mkOption {
+ type = types.lines;
default = "";
description = ''
Literal string to append to the config file generated for dhcpcd.
'';
};
+ networking.dhcpcd.runHook = mkOption {
+ type = types.lines;
+ default = "";
+ example = "if [[ $reason =~ BOUND ]]; then echo $interface: Routers are $new_routers - were $old_routers; fi";
+ description = ''
+ Shell code that will be run after all other hooks. See
+ `man dhcpcd-run-hooks` for details on what is possible.
+ '';
+ };
+
};
@@ -105,7 +109,6 @@ in
{ description = "DHCP Client";
wantedBy = [ "network.target" ];
- after = [ "systemd-udev-settle.service" ];
# Stopping dhcpcd during a reconfiguration is undesirable
# because it brings down the network interfaces configured by
@@ -114,12 +117,13 @@ in
path = [ dhcpcd pkgs.nettools pkgs.openresolv ];
+ unitConfig.ConditionCapability = "CAP_NET_ADMIN";
+
serviceConfig =
{ Type = "forking";
PIDFile = "/run/dhcpcd.pid";
- ExecStart = "@${dhcpcd}/sbin/dhcpcd dhcpcd --config ${dhcpcdConf}";
+ ExecStart = "@${dhcpcd}/sbin/dhcpcd dhcpcd --quiet --config ${dhcpcdConf}";
ExecReload = "${dhcpcd}/sbin/dhcpcd --rebind";
- StandardError = "null";
Restart = "always";
};
};
diff --git a/nixos/modules/services/networking/dhcpd.nix b/nixos/modules/services/networking/dhcpd.nix
index 5b2058e4e12..900df67b53a 100644
--- a/nixos/modules/services/networking/dhcpd.nix
+++ b/nixos/modules/services/networking/dhcpd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -13,12 +13,12 @@ let
default-lease-time 600;
max-lease-time 7200;
authoritative;
- ddns-update-style ad-hoc;
+ ddns-update-style interim;
log-facility local1; # see dhcpd.nix
${cfg.extraConfig}
- ${pkgs.lib.concatMapStrings
+ ${lib.concatMapStrings
(machine: ''
host ${machine.hostName} {
hardware ethernet ${machine.ethernetAddress};
@@ -108,22 +108,41 @@ in
config = mkIf config.services.dhcpd.enable {
- jobs.dhcpd =
+ users = {
+ extraUsers.dhcpd = {
+ uid = config.ids.uids.dhcpd;
+ description = "DHCP daemon user";
+ };
+ };
+
+ systemd.services.dhcpd =
{ description = "DHCP server";
- startOn = "started network-interfaces";
- stopOn = "stopping network-interfaces";
+ wantedBy = [ "multi-user.target" ];
- script =
+ after = [ "network.target" ];
+
+ path = [ pkgs.dhcp ];
+
+ preStart =
''
mkdir -m 755 -p ${stateDir}
touch ${stateDir}/dhcpd.leases
- exec ${pkgs.dhcp}/sbin/dhcpd -f -cf ${configFile} \
- -lf ${stateDir}/dhcpd.leases \
- ${toString cfg.interfaces}
+ mkdir -m 755 -p /run/dhcpd
+ chown dhcpd /run/dhcpd
'';
+
+ serviceConfig =
+ { ExecStart = "@${pkgs.dhcp}/sbin/dhcpd dhcpd"
+ + " -pf /run/dhcpd/dhcpd.pid -cf ${configFile}"
+ + " -lf ${stateDir}/dhcpd.leases -user dhcpd -group nogroup"
+ + " ${toString cfg.interfaces}";
+ Restart = "always";
+ Type = "forking";
+ PIDFile = "/run/dhcpd/dhcpd.pid";
+ };
};
};
diff --git a/nixos/modules/services/networking/dnsmasq.nix b/nixos/modules/services/networking/dnsmasq.nix
index b726493d421..8e38b9d017a 100644
--- a/nixos/modules/services/networking/dnsmasq.nix
+++ b/nixos/modules/services/networking/dnsmasq.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.dnsmasq;
diff --git a/nixos/modules/services/networking/ejabberd.nix b/nixos/modules/services/networking/ejabberd.nix
index 75950f55a27..28b8e234a5c 100644
--- a/nixos/modules/services/networking/ejabberd.nix
+++ b/nixos/modules/services/networking/ejabberd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -68,6 +68,8 @@ in
preStart =
''
+ PATH="$PATH:${pkgs.ejabberd}/sbin:${pkgs.ejabberd}/bin:${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.gnused}/bin";
+
# Initialise state data
mkdir -p ${cfg.logsDir}
diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix
index 3c0c51e6ec8..42914bfe5d6 100644
--- a/nixos/modules/services/networking/firewall.nix
+++ b/nixos/modules/services/networking/firewall.nix
@@ -18,11 +18,9 @@
*/
+{ config, lib, pkgs, ... }:
-
-{ config, pkgs, ... }:
-
-with pkgs.lib;
+with lib;
let
@@ -32,9 +30,9 @@ let
''
# Helper command to manipulate both the IPv4 and IPv6 tables.
ip46tables() {
- iptables "$@"
+ iptables -w "$@"
${optionalString config.networking.enableIPv6 ''
- ip6tables "$@"
+ ip6tables -w "$@"
''}
}
'';
@@ -54,7 +52,7 @@ in
networking.firewall.enable = mkOption {
type = types.bool;
- default = false;
+ default = true;
description =
''
Whether to enable the firewall. This is a simple stateful
@@ -128,6 +126,17 @@ in
'';
};
+ networking.firewall.allowedTCPPortRanges = mkOption {
+ default = [];
+ example = [ { from = 8999; to = 9003; } ];
+ type = types.listOf (types.attrsOf types.int);
+ description =
+ ''
+ A range of TCP ports on which incoming connections are
+ accepted.
+ '';
+ };
+
networking.firewall.allowedUDPPorts = mkOption {
default = [];
example = [ 53 ];
@@ -138,6 +147,16 @@ in
'';
};
+ networking.firewall.allowedUDPPortRanges = mkOption {
+ default = [];
+ example = [ { from = 60000; to = 61000; } ];
+ type = types.listOf (types.attrsOf types.int);
+ description =
+ ''
+ Range of open UDP ports.
+ '';
+ };
+
networking.firewall.allowPing = mkOption {
default = false;
type = types.bool;
@@ -150,6 +169,17 @@ in
'';
};
+ networking.firewall.pingLimit = mkOption {
+ default = null;
+ type = types.nullOr (types.separatedString " ");
+ description =
+ ''
+ If pings are allowed, this allows setting rate limits
+ on them. If non-null, this option should be in the form
+ of flags like "-limit 1/minute -limit-burst 5"
+ '';
+ };
+
networking.firewall.checkReversePath = mkOption {
default = kernelHasRPFilter;
type = types.bool;
@@ -234,14 +264,23 @@ in
message = "This kernel does not support disabling conntrack helpers"; }
];
- jobs.firewall =
+ systemd.services.firewall =
{ description = "Firewall";
- startOn = "started network-interfaces";
+ wantedBy = [ "network.target" ];
+ after = [ "network-interfaces.target" "systemd-modules-load.service" ];
path = [ pkgs.iptables ];
- preStart =
+ # FIXME: this module may also try to load kernel modules, but
+ # containers don't have CAP_SYS_MODULE. So the host system had
+ # better have all necessary modules already loaded.
+ unitConfig.ConditionCapability = "CAP_NET_ADMIN";
+
+ serviceConfig.Type = "oneshot";
+ serviceConfig.RemainAfterExit = true;
+
+ script =
''
${helpers}
@@ -322,6 +361,15 @@ in
) cfg.allowedTCPPorts
}
+ # Accept connections to the allowed TCP port ranges.
+ ${concatMapStrings (rangeAttr:
+ let range = toString rangeAttr.from + ":" + toString rangeAttr.to; in
+ ''
+ ip46tables -A nixos-fw -p tcp --dport ${range} -j nixos-fw-accept
+ ''
+ ) cfg.allowedTCPPortRanges
+ }
+
# Accept packets on the allowed UDP ports.
${concatMapStrings (port:
''
@@ -330,13 +378,24 @@ in
) cfg.allowedUDPPorts
}
+ # Accept packets on the allowed UDP port ranges.
+ ${concatMapStrings (rangeAttr:
+ let range = toString rangeAttr.from + ":" + toString rangeAttr.to; in
+ ''
+ ip46tables -A nixos-fw -p udp --dport ${range} -j nixos-fw-accept
+ ''
+ ) cfg.allowedUDPPortRanges
+ }
+
# Accept IPv4 multicast. Not a big security risk since
# probably nobody is listening anyway.
#iptables -A nixos-fw -d 224.0.0.0/4 -j nixos-fw-accept
# Optionally respond to ICMPv4 pings.
${optionalString cfg.allowPing ''
- iptables -A nixos-fw -p icmp --icmp-type echo-request -j nixos-fw-accept
+ iptables -w -A nixos-fw -p icmp --icmp-type echo-request ${optionalString (cfg.pingLimit != null)
+ "-m limit ${cfg.pingLimit} "
+ }-j nixos-fw-accept
''}
# Accept all ICMPv6 messages except redirects and node
diff --git a/nixos/modules/services/networking/flashpolicyd.nix b/nixos/modules/services/networking/flashpolicyd.nix
index f5bc550ab5f..5ba85178179 100644
--- a/nixos/modules/services/networking/flashpolicyd.nix
+++ b/nixos/modules/services/networking/flashpolicyd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/freenet.nix b/nixos/modules/services/networking/freenet.nix
index a4bd2098986..e9cacf4a16e 100644
--- a/nixos/modules/services/networking/freenet.nix
+++ b/nixos/modules/services/networking/freenet.nix
@@ -1,8 +1,8 @@
# NixOS module for Freenet daemon
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/git-daemon.nix b/nixos/modules/services/networking/git-daemon.nix
index a7c7c206198..5864efaca51 100644
--- a/nixos/modules/services/networking/git-daemon.nix
+++ b/nixos/modules/services/networking/git-daemon.nix
@@ -1,5 +1,5 @@
-{pkgs, config, ...}:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.gitDaemon;
@@ -101,7 +101,7 @@ in
name = "git-daemon";
startOn = "ip-up";
exec = "${pkgs.git}/bin/git daemon --reuseaddr "
- + (optionalString (cfg.basePath != "") "--basepath=${cfg.basePath} ")
+ + (optionalString (cfg.basePath != "") "--base-path=${cfg.basePath} ")
+ (optionalString (cfg.listenAddress != "") "--listen=${cfg.listenAddress} ")
+ "--port=${toString cfg.port} --user=${gitUser} --group=${gitUser} ${cfg.options} "
+ "--verbose " + (optionalString cfg.exportAll "--export-all") + concatStringsSep " " cfg.repositories;
diff --git a/nixos/modules/services/networking/gnunet.nix b/nixos/modules/services/networking/gnunet.nix
index 421c0d9bb69..03ee54af433 100644
--- a/nixos/modules/services/networking/gnunet.nix
+++ b/nixos/modules/services/networking/gnunet.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/gogoclient.nix b/nixos/modules/services/networking/gogoclient.nix
index 3b92eb8b06b..41600794197 100644
--- a/nixos/modules/services/networking/gogoclient.nix
+++ b/nixos/modules/services/networking/gogoclient.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.gogoclient;
in
diff --git a/nixos/modules/services/networking/gvpe.nix b/nixos/modules/services/networking/gvpe.nix
index 594a2e80f34..c633ffedef4 100644
--- a/nixos/modules/services/networking/gvpe.nix
+++ b/nixos/modules/services/networking/gvpe.nix
@@ -1,9 +1,9 @@
# GNU Virtual Private Ethernet
-{config, pkgs, ...}:
+{config, pkgs, lib, ...}:
let
- inherit (pkgs.lib) mkOption mkIf;
+ inherit (lib) mkOption mkIf;
cfg = config.services.gvpe;
diff --git a/nixos/modules/services/networking/haproxy.nix b/nixos/modules/services/networking/haproxy.nix
index c8345a528a7..c2e2c2d7a41 100644
--- a/nixos/modules/services/networking/haproxy.nix
+++ b/nixos/modules/services/networking/haproxy.nix
@@ -1,9 +1,9 @@
-{ config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.haproxy;
haproxyCfg = pkgs.writeText "haproxy.conf" cfg.config;
in
-with pkgs.lib;
+with lib;
{
options = {
services.haproxy = {
diff --git a/nixos/modules/services/networking/hostapd.nix b/nixos/modules/services/networking/hostapd.nix
index 4edea12b6be..2adbb0a5c4e 100644
--- a/nixos/modules/services/networking/hostapd.nix
+++ b/nixos/modules/services/networking/hostapd.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
# TODO:
#
@@ -9,7 +9,7 @@
# wpa_supplicant and hostapd on the same wireless interface doesn't make any sense
# perhaps an assertion that there is a dhcp server and a dns server on the IP address serviced by the hostapd?
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/ifplugd.nix b/nixos/modules/services/networking/ifplugd.nix
index 4e939d60354..20bfca8f872 100644
--- a/nixos/modules/services/networking/ifplugd.nix
+++ b/nixos/modules/services/networking/ifplugd.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/iodined.nix b/nixos/modules/services/networking/iodined.nix
index cd150fe63fd..bc0fbb42c99 100644
--- a/nixos/modules/services/networking/iodined.nix
+++ b/nixos/modules/services/networking/iodined.nix
@@ -1,8 +1,8 @@
# NixOS module for iodine, ip over dns daemon
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.iodined;
diff --git a/nixos/modules/services/networking/ircd-hybrid/builder.sh b/nixos/modules/services/networking/ircd-hybrid/builder.sh
index b8cb836db95..f2c92878a4d 100644
--- a/nixos/modules/services/networking/ircd-hybrid/builder.sh
+++ b/nixos/modules/services/networking/ircd-hybrid/builder.sh
@@ -3,7 +3,7 @@ source $stdenv/setup
doSub() {
local src=$1
local dst=$2
- ensureDir $(dirname $dst)
+ mkdir -p $(dirname $dst)
substituteAll $src $dst
}
@@ -28,4 +28,4 @@ for i in $substFiles; do
fi
done
-ensureDir $out/bin
+mkdir -p $out/bin
diff --git a/nixos/modules/services/networking/ircd-hybrid/default.nix b/nixos/modules/services/networking/ircd-hybrid/default.nix
index cd82a41ef7a..a3d5b71740f 100644
--- a/nixos/modules/services/networking/ircd-hybrid/default.nix
+++ b/nixos/modules/services/networking/ircd-hybrid/default.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/kippo.nix b/nixos/modules/services/networking/kippo.nix
new file mode 100644
index 00000000000..d2045c9efc5
--- /dev/null
+++ b/nixos/modules/services/networking/kippo.nix
@@ -0,0 +1,116 @@
+# NixOS module for kippo honeypot ssh server
+# See all the options for configuration details.
+#
+# Default port is 2222. Recommend using something like this for port redirection to default SSH port:
+# networking.firewall.extraCommands = ''
+# iptables -t nat -A PREROUTING -i IN_IFACE -p tcp --dport 22 -j REDIRECT --to-port 2222'';
+#
+# Lastly: use this service at your own risk. I am working on a way to run this inside a VM.
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ cfg = config.services.kippo;
+in
+rec {
+ options = {
+ services.kippo = {
+ enable = mkOption {
+ default = false;
+ type = types.uniq types.bool;
+ description = ''Enable the kippo honeypot ssh server.'';
+ };
+ port = mkOption {
+ default = 2222;
+ type = types.uniq types.int;
+ description = ''TCP port number for kippo to bind to.'';
+ };
+ hostname = mkOption {
+ default = "nas3";
+ type = types.string;
+ description = ''Hostname for kippo to present to SSH login'';
+ };
+ varPath = mkOption {
+ default = "/var/lib/kippo";
+ type = types.string;
+ description = ''Path of read/write files needed for operation and configuration.'';
+ };
+ logPath = mkOption {
+ default = "/var/log/kippo";
+ type = types.string;
+ description = ''Path of log files needed for operation and configuration.'';
+ };
+ pidPath = mkOption {
+ default = "/run/kippo";
+ type = types.string;
+ description = ''Path of pid files needed for operation.'';
+ };
+ extraConfig = mkOption {
+ default = "";
+ type = types.string;
+ description = ''Extra verbatim configuration added to the end of kippo.cfg.'';
+ };
+ };
+
+ };
+ config = mkIf cfg.enable {
+ environment.systemPackages = with pkgs.pythonPackages; [
+ python twisted pycrypto pyasn1 ];
+
+ environment.etc."kippo.cfg".text = ''
+ # Automatically generated by NixOS.
+ # See ${pkgs.kippo}/src/kippo.cfg for details.
+ [honeypot]
+ log_path = ${cfg.logPath}
+ download_path = ${cfg.logPath}/dl
+ filesystem_file = ${cfg.varPath}/honeyfs
+ filesystem_file = ${cfg.varPath}/fs.pickle
+ data_path = ${cfg.varPath}/data
+ txtcmds_path = ${cfg.varPath}/txtcmds
+ public_key = ${cfg.varPath}/keys/public.key
+ private_key = ${cfg.varPath}/keys/private.key
+ ssh_port = ${toString cfg.port}
+ hostname = ${cfg.hostname}
+ ${cfg.extraConfig}
+ '';
+
+ users.extraUsers = singleton {
+ name = "kippo";
+ description = "kippo web server privilege separation user";
+ uid = 108; # why does config.ids.uids.kippo give an error?
+ };
+ users.extraGroups = singleton { name = "kippo";gid=108; };
+
+ systemd.services.kippo = with pkgs; {
+ description = "Kippo Web Server";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ environment.PYTHONPATH = "${pkgs.kippo}/src/:${pkgs.pythonPackages.pycrypto}/lib/python2.7/site-packages/:${pkgs.pythonPackages.pyasn1}/lib/python2.7/site-packages/:${pkgs.pythonPackages.python}/lib/python2.7/site-packages/:${pkgs.pythonPackages.twisted}/lib/python2.7/site-packages/:.";
+ preStart = ''
+ if [ ! -d ${cfg.varPath}/ ] ; then
+ mkdir -p ${cfg.pidPath}
+ mkdir -p ${cfg.logPath}/tty
+ mkdir -p ${cfg.logPath}/dl
+ mkdir -p ${cfg.varPath}/keys
+ cp ${pkgs.kippo}/src/honeyfs ${cfg.varPath} -r
+ cp ${pkgs.kippo}/src/fs.pickle ${cfg.varPath}/fs.pickle
+ cp ${pkgs.kippo}/src/data ${cfg.varPath} -r
+ cp ${pkgs.kippo}/src/txtcmds ${cfg.varPath} -r
+
+ chmod u+rw ${cfg.varPath} -R
+ chmod u+rw ${cfg.pidPath}
+ chown kippo.kippo ${cfg.varPath} -R
+ chown kippo.kippo ${cfg.pidPath}
+ chown kippo.kippo ${cfg.logPath} -R
+ chmod u+rw ${cfg.logPath} -R
+ fi
+ '';
+
+ serviceConfig.ExecStart = "${pkgs.pythonPackages.twisted}/bin/twistd -y ${pkgs.kippo}/src/kippo.tac --syslog --rundir=${cfg.varPath}/ --pidfile=${cfg.pidPath}/kippo.pid --prefix=kippo -n";
+ serviceConfig.PermissionsStartOnly = true;
+ serviceConfig.User = "kippo";
+ serviceConfig.Group = "kippo";
+ };
+};
+}
+
+
diff --git a/nixos/modules/services/networking/minidlna.nix b/nixos/modules/services/networking/minidlna.nix
index e31d77f13fe..a519857d6a0 100644
--- a/nixos/modules/services/networking/minidlna.nix
+++ b/nixos/modules/services/networking/minidlna.nix
@@ -1,8 +1,8 @@
# Module for MiniDLNA, a simple DLNA server.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -55,11 +55,6 @@ in
config = mkIf cfg.enable {
- # Running minidlna only makes sense for serving files to the
- # outside, so open up the required ports by default.
- networking.firewall.allowedTCPPorts = [ port ];
- networking.firewall.allowedUDPPorts = [ 1900 ]; # SSDP
-
services.minidlna.config =
''
port=${toString port}
diff --git a/nixos/modules/services/networking/murmur.nix b/nixos/modules/services/networking/murmur.nix
new file mode 100644
index 00000000000..4f91a494747
--- /dev/null
+++ b/nixos/modules/services/networking/murmur.nix
@@ -0,0 +1,253 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.murmur;
+ configFile = pkgs.writeText "murmurd.ini" ''
+ database=/var/lib/murmur/murmur.sqlite
+ dbDriver=QSQLITE
+
+ autobanAttempts=${toString cfg.autobanAttempts}
+ autobanTimeframe=${toString cfg.autobanTimeframe}
+ autobanTime=${toString cfg.autobanTime}
+
+ logfile=/var/log/murmur/murmurd.log
+ pidfile=${cfg.pidfile}
+
+ welcome="${cfg.welcome}"
+ port=${toString cfg.port}
+
+ ${if cfg.hostName == "" then "" else "host="+cfg.hostName}
+ ${if cfg.password == "" then "" else "serverpassword="+cfg.password}
+
+ bandwidth=${toString cfg.bandwidth}
+ users=${toString cfg.users}
+
+ textmessagelength=${toString cfg.textMsgLength}
+ imagemessagelength=${toString cfg.imgMsgLength}
+ allowhtml=${if cfg.allowHtml then "true" else "false"}
+ logdays=${toString cfg.logDays}
+ bonjour=${if cfg.bonjour then "true" else "false"}
+ sendversion=${if cfg.sendVersion then "true" else "false"}
+
+ ${if cfg.registerName == "" then "" else "registerName="+cfg.registerName}
+ ${if cfg.registerPassword == "" then "" else "registerPassword="+cfg.registerPassword}
+ ${if cfg.registerUrl == "" then "" else "registerUrl="+cfg.registerUrl}
+ ${if cfg.registerHostname == "" then "" else "registerHostname="+cfg.registerHostname}
+
+ certrequired=${if cfg.clientCertRequired then "true" else "false"}
+ ${if cfg.sslCert == "" then "" else "sslCert="+cfg.sslCert}
+ ${if cfg.sslKey == "" then "" else "sslKey="+cfg.sslKey}
+ '';
+in
+{
+ options = {
+ services.murmur = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "If enabled, start the Murmur Service.";
+ };
+
+ autobanAttempts = mkOption {
+ type = types.int;
+ default = 10;
+ description = ''
+ Number of attempts a client is allowed to make in
+ autobanTimeframe seconds, before being
+ banned for autobanTime.
+ '';
+ };
+
+ autobanTimeframe = mkOption {
+ type = types.int;
+ default = 120;
+ description = ''
+ Timeframe in which a client can connect without being banned
+ for repeated attempts (in seconds).
+ '';
+ };
+
+ autobanTime = mkOption {
+ type = types.int;
+ default = 300;
+ description = "The amount of time an IP ban lasts (in seconds).";
+ };
+
+ pidfile = mkOption {
+ type = types.path;
+ default = "/tmp/murmurd.pid";
+ description = "Path to PID file for Murmur daemon.";
+ };
+
+ welcome = mkOption {
+ type = types.str;
+ default = "";
+ description = "Welcome message for connected clients.";
+ };
+
+ port = mkOption {
+ type = types.int;
+ default = 64738;
+ description = "Ports to bind to (UDP and TCP).";
+ };
+
+ hostName = mkOption {
+ type = types.str;
+ default = "";
+ description = "Host to bind to. Defaults binding on all addresses.";
+ };
+
+ password = mkOption {
+ type = types.str;
+ default = "";
+ description = "Required password to join server, if specified.";
+ };
+
+ bandwidth = mkOption {
+ type = types.int;
+ default = 72000;
+ description = ''
+ Maximum bandwidth (in bits per second) that clients may send
+ speech at.
+ '';
+ };
+
+ users = mkOption {
+ type = types.int;
+ default = 100;
+ description = "Maximum number of concurrent clients allowed.";
+ };
+
+ textMsgLength = mkOption {
+ type = types.int;
+ default = 5000;
+ description = "Max length of text messages. Set 0 for no limit.";
+ };
+
+ imgMsgLength = mkOption {
+ type = types.int;
+ default = 131072;
+ description = "Max length of image messages. Set 0 for no limit.";
+ };
+
+ allowHtml = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Allow HTML in client messages, comments, and channel
+ descriptions.
+ '';
+ };
+
+ logDays = mkOption {
+ type = types.int;
+ default = 31;
+ description = ''
+ How long to store RPC logs for in the database. Set 0 to
+ keep logs forever, or -1 to disable DB logging.
+ '';
+ };
+
+ bonjour = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable Bonjour auto-discovery, which allows clients over
+ your LAN to automatically discover Murmur servers.
+ '';
+ };
+
+ sendVersion = mkOption {
+ type = types.bool;
+ default = true;
+ description = "Send Murmur version in UDP response.";
+ };
+
+ registerName = mkOption {
+ type = types.str;
+ default = "";
+ description = ''
+ Public server registration name, and also the name of the
+ Root channel. Even if you don't publicly register your
+ server, you probably still want to set this.
+ '';
+ };
+
+ registerPassword = mkOption {
+ type = types.str;
+ default = "";
+ description = ''
+ Public server registry password, used authenticate your
+ server to the registry to prevent impersonation; required for
+ subsequent registry updates.
+ '';
+ };
+
+ registerUrl = mkOption {
+ type = types.str;
+ default = "";
+ description = "URL website for your server.";
+ };
+
+ registerHostname = mkOption {
+ type = types.str;
+ default = "";
+ description = ''
+ DNS hostname where your server can be reached. This is only
+ needed if you want your server to be accessed by its
+ hostname and not IP - but the name *must* resolve on the
+ internet properly.
+ '';
+ };
+
+ clientCertRequired = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Require clients to authenticate via certificates.";
+ };
+
+ sslCert = mkOption {
+ type = types.str;
+ default = "";
+ description = "Path to your SSL certificate.";
+ };
+
+ sslKey = mkOption {
+ type = types.str;
+ default = "";
+ description = "Path to your SSL key.";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ users.extraUsers.murmur = {
+ description = "Murmur Service user";
+ home = "/var/lib/murmur";
+ createHome = true;
+ uid = config.ids.uids.murmur;
+ };
+
+ systemd.services.murmur = {
+ description = "Murmur Chat Service";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target "];
+
+ serviceConfig = {
+ Type = "forking";
+ PIDFile = cfg.pidfile;
+ Restart = "always";
+ User = "murmur";
+ ExecStart = "${pkgs.murmur}/bin/murmurd -ini ${configFile}";
+ PermissionsStartOnly = true;
+ };
+
+ preStart = ''
+ mkdir -p /var/log/murmur
+ chown -R murmur /var/log/murmur
+ '';
+ };
+ };
+}
diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix
index ce28f018828..e8d9d00cc0a 100644
--- a/nixos/modules/services/networking/nat.nix
+++ b/nixos/modules/services/networking/nat.nix
@@ -2,14 +2,16 @@
# XXX: todo: support multiple upstream links
# see http://yesican.chsoft.biz/lartc/MultihomedLinuxNetworking.html
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.networking.nat;
+ dest = if cfg.externalIP == null then "-j MASQUERADE" else "-j SNAT --to-source ${cfg.externalIP}";
+
in
{
@@ -27,14 +29,27 @@ in
'';
};
+ networking.nat.internalInterfaces = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "eth0" ];
+ description =
+ ''
+ The interfaces for which to perform NAT. Packets coming from
+ these interface and destined for the external interface will
+ be rewritten.
+ '';
+ };
+
networking.nat.internalIPs = mkOption {
type = types.listOf types.str;
- example = [ "192.168.1.0/24" ] ;
+ default = [];
+ example = [ "192.168.1.0/24" ];
description =
''
The IP address ranges for which to perform NAT. Packets
- coming from these networks and destined for the external
- interface will be rewritten.
+ coming from these addresses (on any interface) and destined
+ for the external interface will be rewritten.
'';
};
@@ -80,25 +95,37 @@ in
preStart =
''
- iptables -t nat -F POSTROUTING
- iptables -t nat -X
- ''
- + (concatMapStrings (network:
- ''
- iptables -t nat -A POSTROUTING \
- -s ${network} -o ${cfg.externalInterface} \
- ${if cfg.externalIP == null
- then "-j MASQUERADE"
- else "-j SNAT --to-source ${cfg.externalIP}"}
- ''
- ) cfg.internalIPs) +
- ''
+ iptables -w -t nat -F PREROUTING
+ iptables -w -t nat -F POSTROUTING
+ iptables -w -t nat -X
+
+ # We can't match on incoming interface in POSTROUTING, so
+ # mark packets coming from the external interfaces.
+ ${concatMapStrings (iface: ''
+ iptables -w -t nat -A PREROUTING \
+ -i '${iface}' -j MARK --set-mark 1
+ '') cfg.internalInterfaces}
+
+ # NAT the marked packets.
+ ${optionalString (cfg.internalInterfaces != []) ''
+ iptables -w -t nat -A POSTROUTING -m mark --mark 1 \
+ -o ${cfg.externalInterface} ${dest}
+ ''}
+
+ # NAT packets coming from the internal IPs.
+ ${concatMapStrings (range: ''
+ iptables -w -t nat -A POSTROUTING \
+ -s '${range}' -o ${cfg.externalInterface} ${dest}
+ '') cfg.internalIPs}
+
echo 1 > /proc/sys/net/ipv4/ip_forward
'';
postStop =
''
- iptables -t nat -F POSTROUTING
+ iptables -w -t nat -F PREROUTING
+ iptables -w -t nat -F POSTROUTING
+ iptables -w -t nat -X
'';
};
};
diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index ad6f9858aaf..bc1c95d3fd3 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
with pkgs;
+with lib;
let
cfg = config.networking.networkmanager;
@@ -21,7 +21,7 @@ let
level=WARN
'';
- polkitConf = ''
+ /*
[network-manager]
Identity=unix-group:networkmanager
Action=org.freedesktop.NetworkManager.*
@@ -31,10 +31,21 @@ let
[modem-manager]
Identity=unix-group:networkmanager
- Action=org.freedesktop.ModemManager.*
+ Action=org.freedesktop.ModemManager*
ResultAny=yes
ResultInactive=no
ResultActive=yes
+ */
+ polkitConf = ''
+ polkit.addRule(function(action, subject) {
+ if (
+ subject.isInGroup("networkmanager")
+ && subject.active
+ && (action.id.indexOf("org.freedesktop.NetworkManager.") == 0
+ || action.id.indexOf("org.freedesktop.ModemManager") == 0
+ ))
+ { return polkit.Result.YES; }
+ });
'';
ipUpScript = writeScript "01nixos-ip-up" ''
@@ -44,15 +55,19 @@ let
fi
'';
+ ns = xs: writeText "nameservers" (
+ concatStrings (map (s: "nameserver ${s}\n") xs)
+ );
+
overrideNameserversScript = writeScript "02overridedns" ''
#!/bin/sh
- ${optionalString cfg.overrideNameservers "${gnused}/bin/sed -i '/nameserver /d' /etc/resolv.conf"}
- ${concatStrings (map (s: ''
- ${optionalString cfg.appendNameservers
- "${gnused}/bin/sed -i '/nameserver ${s}/d' /etc/resolv.conf"
- }
- echo 'nameserver ${s}' >> /etc/resolv.conf
- '') config.networking.nameservers)}
+ tmp=`${coreutils}/bin/mktemp`
+ ${gnused}/bin/sed '/nameserver /d' /etc/resolv.conf > $tmp
+ ${gnugrep}/bin/grep 'nameserver ' /etc/resolv.conf | \
+ ${gnugrep}/bin/grep -vf ${ns (cfg.appendNameservers ++ cfg.insertNameservers)} > $tmp.ns
+ ${optionalString (cfg.appendNameservers != []) "${coreutils}/bin/cat $tmp $tmp.ns ${ns cfg.appendNameservers} > /etc/resolv.conf"}
+ ${optionalString (cfg.insertNameservers != []) "${coreutils}/bin/cat $tmp ${ns cfg.insertNameservers} $tmp.ns > /etc/resolv.conf"}
+ ${coreutils}/bin/rm -f $tmp $tmp.ns
'';
in {
@@ -74,7 +89,7 @@ in {
to change network settings to this group.
'';
};
-
+
packages = mkOption {
type = types.listOf types.path;
default = [ ];
@@ -84,23 +99,21 @@ in {
apply = list: [ networkmanager modemmanager wpa_supplicant ] ++ list;
};
- overrideNameservers = mkOption {
- default = false;
+ appendNameservers = mkOption {
+ type = types.listOf types.string;
+ default = [];
description = ''
- If enabled, any nameservers received by DHCP or configured in
- NetworkManager will be replaced by the nameservers configured
- in the networking.nameservers option. This
- option overrides the appendNameservers option
- if both are enabled.
+ A list of name servers that should be appended
+ to the ones configured in NetworkManager or received by DHCP.
'';
};
- appendNameservers = mkOption {
- default = false;
+ insertNameservers = mkOption {
+ type = types.listOf types.string;
+ default = [];
description = ''
- If enabled, the name servers configured in the
- networking.nameservers option will be appended
- to the ones configured in NetworkManager or received by DHCP.
+ A list of name servers that should be inserted before
+ the ones configured in NetworkManager or received by DHCP.
'';
};
@@ -117,6 +130,8 @@ in {
message = "You can not use networking.networkmanager with services.networking.wireless";
}];
+ boot.kernelModules = [ "ppp_mppe" ]; # Needed for most (all?) PPTP VPN connections.
+
environment.etc = [
{ source = ipUpScript;
target = "NetworkManager/dispatcher.d/01nixos-ip-up";
@@ -133,7 +148,10 @@ in {
{ source = "${networkmanager_openconnect}/etc/NetworkManager/VPN/nm-openconnect-service.name";
target = "NetworkManager/VPN/nm-openconnect-service.name";
}
- ] ++ pkgs.lib.optional (cfg.overrideNameservers || cfg.appendNameservers)
+ { source = "${networkmanager_pptp}/etc/NetworkManager/VPN/nm-pptp-service.name";
+ target = "NetworkManager/VPN/nm-pptp-service.name";
+ }
+ ] ++ optional (cfg.appendNameservers == [] || cfg.insertNameservers == [])
{ source = overrideNameserversScript;
target = "NetworkManager/dispatcher.d/02overridedns";
};
@@ -142,6 +160,8 @@ in {
networkmanager_openvpn
networkmanager_vpnc
networkmanager_openconnect
+ networkmanager_pptp
+ modemmanager
];
users.extraGroups = singleton {
@@ -157,16 +177,13 @@ in {
systemd.services."networkmanager-init" = {
description = "NetworkManager initialisation";
wantedBy = [ "network.target" ];
- partOf = [ "NetworkManager.service" ];
wants = [ "NetworkManager.service" ];
before = [ "NetworkManager.service" ];
script = ''
mkdir -m 700 -p /etc/NetworkManager/system-connections
mkdir -m 755 -p ${stateDirs}
'';
- serviceConfig = {
- Type = "oneshot";
- };
+ serviceConfig.Type = "oneshot";
};
# Turn off NixOS' network management
@@ -179,13 +196,15 @@ in {
systemctl restart NetworkManager
'';
- security.polkit.permissions = polkitConf;
+ security.polkit.extraConfig = polkitConf;
# openvpn plugin has only dbus interface
services.dbus.packages = cfg.packages ++ [
networkmanager_openvpn
networkmanager_vpnc
networkmanager_openconnect
+ networkmanager_pptp
+ modemmanager
];
services.udev.packages = cfg.packages;
diff --git a/nixos/modules/services/networking/ngircd.nix b/nixos/modules/services/networking/ngircd.nix
new file mode 100644
index 00000000000..49e5f355980
--- /dev/null
+++ b/nixos/modules/services/networking/ngircd.nix
@@ -0,0 +1,58 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.ngircd;
+
+ configFile = pkgs.stdenv.mkDerivation {
+ name = "ngircd.conf";
+
+ text = cfg.config;
+
+ preferLocalBuild = true;
+
+ buildCommand = ''
+ echo -n "$text" > $out
+ ${cfg.package}/sbin/ngircd --config $out --configtest
+ '';
+ };
+in {
+ options = {
+ services.ngircd = {
+ enable = mkEnableOption "the ngircd IRC server";
+
+ config = mkOption {
+ description = "The ngircd configuration (see ngircd.conf(5)).";
+
+ type = types.lines;
+ };
+
+ package = mkOption {
+ description = "The ngircd package.";
+
+ type = types.package;
+
+ default = pkgs.ngircd;
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ #!!! TODO: Use ExecReload (see https://github.com/NixOS/nixpkgs/issues/1988)
+ systemd.services.ngircd = {
+ description = "The ngircd IRC server";
+
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig.ExecStart = "${cfg.package}/sbin/ngircd --config ${configFile} --nodaemon";
+
+ serviceConfig.User = "ngircd";
+ };
+
+ users.extraUsers.ngircd = {
+ uid = config.ids.uids.ngircd;
+ description = "ngircd user.";
+ };
+ };
+}
diff --git a/nixos/modules/services/networking/notbit.nix b/nixos/modules/services/networking/notbit.nix
new file mode 100644
index 00000000000..2e1412ff7c8
--- /dev/null
+++ b/nixos/modules/services/networking/notbit.nix
@@ -0,0 +1,130 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ cfg = config.services.notbit;
+ varDir = "/var/lib/notbit";
+
+ sendmail = pkgs.stdenv.mkDerivation {
+ name = "notbit-wrapper";
+ buildInputs = [ pkgs.makeWrapper ];
+ propagatedBuildInputs = [ pkgs.notbit ];
+ buildCommand = ''
+ mkdir -p $out/bin
+ makeWrapper ${pkgs.notbit}/bin/notbit-sendmail $out/bin/notbit-system-sendmail \
+ --set XDG_RUNTIME_DIR ${varDir}
+ '';
+ };
+ opts = "${optionalString cfg.allowPrivateAddresses "-L"} ${optionalString cfg.noBootstrap "-b"} ${optionalString cfg.specifiedPeersOnly "-e"}";
+ peers = concatStringsSep " " (map (str: "-P \"${str}\"") cfg.peers);
+ listen = if cfg.listenAddress == [] then "-p ${toString cfg.port}" else
+ concatStringsSep " " (map (addr: "-a \"${addr}:${toString cfg.port}\"") cfg.listenAddress);
+in
+
+with lib;
+{
+
+ ### configuration
+
+ options = {
+
+ services.notbit = {
+
+ enable = mkOption {
+ type = types.uniq types.bool;
+ default = false;
+ description = ''
+ Enables the notbit daemon and provides a sendmail binary named `notbit-system-sendmail` for sending mail over the system instance of notbit. Users must be in the notbit group in order to send mail over the system notbit instance. Currently mail recipt is not supported.
+ '';
+ };
+
+ port = mkOption {
+ type = types.uniq types.int;
+ default = 8444;
+ description = "The port which the daemon listens for other bitmessage clients";
+ };
+
+ nice = mkOption {
+ type = types.uniq types.int;
+ default = 10;
+ description = "Set the nice level for the notbit daemon";
+ };
+
+ listenAddress = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "localhost" "myhostname" ];
+ description = "The addresses which notbit will use to listen for incoming connections. These addresses are advertised to connecting clients.";
+ };
+
+ peers = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "bitmessage.org:8877" ];
+ description = "The initial set of peers notbit will connect to.";
+ };
+
+ specifiedPeersOnly = mkOption {
+ type = types.uniq types.bool;
+ default = false;
+ description = "If true, notbit will only connect to peers specified by the peers option.";
+ };
+
+ allowPrivateAddresses = mkOption {
+ type = types.uniq types.bool;
+ default = false;
+ description = "If true, notbit will allow connections to to RFC 1918 addresses.";
+ };
+
+ noBootstrap = mkOption {
+ type = types.uniq types.bool;
+ default = false;
+ description = "If true, notbit will not bootstrap an initial peerlist from bitmessage.org servers";
+ };
+
+ };
+
+ };
+
+ ### implementation
+
+ config = mkIf cfg.enable {
+
+ environment.systemPackages = [ sendmail ];
+
+ systemd.services.notbit = {
+ description = "Notbit daemon";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ path = [ pkgs.notbit ];
+ environment = { XDG_RUNTIME_DIR = varDir; };
+
+ postStart = ''
+ [ ! -f "${varDir}/addr" ] && notbit-keygen > ${varDir}/addr
+ chmod 0640 ${varDir}/{addr,notbit/notbit-ipc.lock}
+ chmod 0750 ${varDir}/notbit/{,notbit-ipc}
+ '';
+
+ serviceConfig = {
+ Type = "forking";
+ ExecStart = "${pkgs.notbit}/bin/notbit -d ${listen} ${peers} ${opts}";
+ User = "notbit";
+ Group = "notbit";
+ UMask = "0077";
+ WorkingDirectory = varDir;
+ Nice = cfg.nice;
+ };
+ };
+
+ users.extraUsers.notbit = {
+ group = "notbit";
+ description = "Notbit daemon user";
+ home = varDir;
+ createHome = true;
+ uid = config.ids.uids.notbit;
+ };
+
+ users.extraGroups.notbit.gid = config.ids.gids.notbit;
+ };
+
+}
diff --git a/nixos/modules/services/networking/nsd.nix b/nixos/modules/services/networking/nsd.nix
new file mode 100644
index 00000000000..db8cb122871
--- /dev/null
+++ b/nixos/modules/services/networking/nsd.nix
@@ -0,0 +1,751 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ cfg = config.services.nsd;
+
+ username = "nsd";
+ stateDir = "/var/lib/nsd";
+ pidFile = stateDir + "/var/nsd.pid";
+
+ zoneFiles = pkgs.stdenv.mkDerivation {
+ preferLocalBuild = true;
+ name = "nsd-env";
+ buildCommand = concatStringsSep "\n"
+ [ "mkdir -p $out"
+ (concatStrings (mapAttrsToList (zoneName: zoneOptions: ''
+ cat > "$out/${zoneName}" <<_EOF_
+ ${zoneOptions.data}
+ _EOF_
+ '') zoneConfigs))
+ ];
+ };
+
+ configFile = pkgs.writeText "nsd.conf" ''
+ server:
+ username: ${username}
+ chroot: "${stateDir}"
+
+ # The directory for zonefile: files. The daemon chdirs here.
+ zonesdir: "${stateDir}"
+
+ # the list of dynamically added zones.
+ zonelistfile: "${stateDir}/var/zone.list"
+ database: "${stateDir}/var/nsd.db"
+ logfile: "${stateDir}/var/nsd.log"
+ pidfile: "${pidFile}"
+ xfrdfile: "${stateDir}/var/xfrd.state"
+ xfrdir: "${stateDir}/tmp"
+
+ # interfaces
+ ${forEach " ip-address: " cfg.interfaces}
+
+ server-count: ${toString cfg.serverCount}
+ ip-transparent: ${yesOrNo cfg.ipTransparent}
+ do-ip4: ${yesOrNo cfg.ipv4}
+ do-ip6: ${yesOrNo cfg.ipv6}
+ port: ${toString cfg.port}
+ verbosity: ${toString cfg.verbosity}
+ hide-version: ${yesOrNo cfg.hideVersion}
+ identity: "${cfg.identity}"
+ ${maybeString "nsid: " cfg.nsid}
+ tcp-count: ${toString cfg.tcpCount}
+ tcp-query-count: ${toString cfg.tcpQueryCount}
+ tcp-timeout: ${toString cfg.tcpTimeout}
+ ipv4-edns-size: ${toString cfg.ipv4EDNSSize}
+ ipv6-edns-size: ${toString cfg.ipv6EDNSSize}
+ ${if cfg.statistics == null then "" else "statistics: ${toString cfg.statistics}"}
+ xfrd-reload-timeout: ${toString cfg.xfrdReloadTimeout}
+ zonefiles-check: ${yesOrNo cfg.zonefilesCheck}
+
+ rrl-size: ${toString cfg.ratelimit.size}
+ rrl-ratelimit: ${toString cfg.ratelimit.ratelimit}
+ rrl-whitelist-ratelimit: ${toString cfg.ratelimit.whitelistRatelimit}
+ ${maybeString "rrl-slip: " cfg.ratelimit.slip}
+ ${maybeString "rrl-ipv4-prefix-length: " cfg.ratelimit.ipv4PrefixLength}
+ ${maybeString "rrl-ipv6-prefix-length: " cfg.ratelimit.ipv6PrefixLength}
+
+ ${keyConfigFile}
+
+ remote-control:
+ control-enable: ${yesOrNo cfg.remoteControl.enable}
+ ${forEach " control-interface: " cfg.remoteControl.interfaces}
+ control-port: ${toString cfg.port}
+ server-key-file: "${cfg.remoteControl.serverKeyFile}"
+ server-cert-file: "${cfg.remoteControl.serverCertFile}"
+ control-key-file: "${cfg.remoteControl.controlKeyFile}"
+ control-cert-file: "${cfg.remoteControl.controlCertFile}"
+
+ # zone files reside in "${zoneFiles}" linked to "${stateDir}/zones"
+ ${concatStrings (mapAttrsToList zoneConfigFile zoneConfigs)}
+
+ ${cfg.extraConfig}
+ '';
+
+ yesOrNo = b: if b then "yes" else "no";
+ maybeString = pre: s: if s == null then "" else ''${pre} "${s}"'';
+ forEach = pre: l: concatMapStrings (x: pre + x + "\n") l;
+
+
+ keyConfigFile = concatStrings (mapAttrsToList (keyName: keyOptions: ''
+ key:
+ name: "${keyName}"
+ algorithm: "${keyOptions.algorithm}"
+ include: "${stateDir}/private/${keyName}"
+ '') cfg.keys);
+
+ copyKeys = concatStrings (mapAttrsToList (keyName: keyOptions: ''
+ secret=$(cat "${keyOptions.keyFile}")
+ dest="${stateDir}/private/${keyName}"
+ echo " secret: \"$secret\"" > "$dest"
+ ${pkgs.coreutils}/bin/chown ${username}:${username} "$dest"
+ ${pkgs.coreutils}/bin/chmod 0400 "$dest"
+ '') cfg.keys);
+
+
+ zoneConfigFile = name: zone: ''
+ zone:
+ name: "${name}"
+ zonefile: "${stateDir}/zones/${name}"
+ ${maybeString "outgoing-interface: " zone.outgoingInterface}
+ ${forEach " rrl-whitelist: " zone.rrlWhitelist}
+
+ ${forEach " allow-notify: " zone.allowNotify}
+ ${forEach " request-xfr: " zone.requestXFR}
+ allow-axfr-fallback: ${yesOrNo zone.allowAXFRFallback}
+
+ ${forEach " notify: " zone.notify}
+ notify-retry: ${toString zone.notifyRetry}
+ ${forEach " provide-xfr: " zone.provideXFR}
+
+ '';
+
+ zoneConfigs = zoneConfigs' {} "" { children = cfg.zones; };
+
+ zoneConfigs' = parent: name: zone:
+ if !(zone ? children) || zone.children == null || zone.children == { }
+ # leaf -> actual zone
+ then listToAttrs [ (nameValuePair name (parent // zone)) ]
+
+ # fork -> pattern
+ else zipAttrsWith (name: head) (
+ mapAttrsToList (name: child: zoneConfigs' (parent // zone // { children = {}; }) name child)
+ zone.children
+ );
+
+ # fighting infinite recursion
+ zoneOptions = zoneOptionsRaw // childConfig zoneOptions1 true;
+ zoneOptions1 = zoneOptionsRaw // childConfig zoneOptions2 false;
+ zoneOptions2 = zoneOptionsRaw // childConfig zoneOptions3 false;
+ zoneOptions3 = zoneOptionsRaw // childConfig zoneOptions4 false;
+ zoneOptions4 = zoneOptionsRaw // childConfig zoneOptions5 false;
+ zoneOptions5 = zoneOptionsRaw // childConfig zoneOptions6 false;
+ zoneOptions6 = zoneOptionsRaw // childConfig null false;
+
+ childConfig = x: v: { options.children = { type = types.attrsOf x; visible = v; }; };
+
+ zoneOptionsRaw = types.submodule (
+ { options, ... }:
+ { options = {
+ children = mkOption {
+ default = {};
+ description = ''
+ Children zones inherit all options of their parents. Attributes
+ defined in a child will overwrite the ones of its parent. Only
+ leaf zones will be actually served. This way it's possible to
+ define maybe zones which share most attributes without
+ duplicating everything. This mechanism replaces nsd's patterns
+ in a save and functional way.
+ '';
+ };
+
+ allowNotify = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "192.0.2.0/24 NOKEY" "10.0.0.1-10.0.0.5 my_tsig_key_name"
+ "10.0.3.4&255.255.0.0 BLOCKED"
+ ];
+ description = ''
+ Listed primary servers are allowed to notify this secondary server.
+
+
+ either a plain IPv4/IPv6 address or range. Valid patters for ranges:
+ * 10.0.0.0/24 # via subnet size
+ * 10.0.0.0&255.255.255.0 # via subnet mask
+ * 10.0.0.1-10.0.0.254 # via range
+
+ A optional port number could be added with a '@':
+ * 2001:1234::1@1234
+
+
+ * will use the specified TSIG key
+ * NOKEY no TSIG signature is required
+ * BLOCKED notifies from non-listed or blocked IPs will be ignored
+ * ]]>
+ '';
+ };
+
+ requestXFR = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [];
+ description = ''
+ Format: [AXFR|UDP] <ip-address> <key-name | NOKEY>
+ '';
+ };
+
+ allowAXFRFallback = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ If NSD as secondary server should be allowed to AXFR if the primary
+ server does not allow IXFR.
+ '';
+ };
+
+ notify = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "10.0.0.1@3721 my_key" "::5 NOKEY" ];
+ description = ''
+ This primary server will notify all given secondary servers about
+ zone changes.
+
+
+ a plain IPv4/IPv6 address with on optional port number (ip@port)
+
+
+ * sign notifies with the specified key
+ * NOKEY don't sign notifies
+ ]]>
+ '';
+ };
+
+ notifyRetry = mkOption {
+ type = types.int;
+ default = 5;
+ description = ''
+ Specifies the number of retries for failed notifies. Set this along with notify.
+ '';
+ };
+
+ provideXFR = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "192.0.2.0/24 NOKEY" "192.0.2.0/24 my_tsig_key_name" ];
+ description = ''
+ Allow these IPs and TSIG to transfer zones, addr TSIG|NOKEY|BLOCKED
+ address range 192.0.2.0/24, 1.2.3.4&255.255.0.0, 3.0.2.20-3.0.2.40
+ '';
+ };
+
+ outgoingInterface = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "2000::1@1234";
+ description = ''
+ This address will be used for zone-transfere requests if configured
+ as a secondary server or notifications in case of a primary server.
+ Supply either a plain IPv4 or IPv6 address with an optional port
+ number (ip@port).
+ '';
+ };
+
+ rrlWhitelist = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Whitelists the given rrl-types.
+ The RRL classification types are: nxdomain, error, referral, any,
+ rrsig, wildcard, nodata, dnskey, positive, all
+ '';
+ };
+
+ data = mkOption {
+ type = types.str;
+ default = "";
+ example = "";
+ description = ''
+ The actual zone data. This is the content of your zone file.
+ Use imports or pkgs.lib.readFile if you don't want this data in your config file.
+ '';
+ };
+
+ };
+ }
+ );
+
+in
+{
+ options = {
+ services.nsd = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable the NSD authoritative domain name server.
+ '';
+ };
+
+ rootServer = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Wheter if this server will be a root server (a DNS root server, you
+ usually don't want that).
+ '';
+ };
+
+ interfaces = mkOption {
+ type = types.listOf types.str;
+ default = [ "127.0.0.0" "::1" ];
+ description = ''
+ What addresses the server should listen to.
+ '';
+ };
+
+ serverCount = mkOption {
+ type = types.int;
+ default = 1;
+ description = ''
+ Number of NSD servers to fork. Put the number of CPUs to use here.
+ '';
+ };
+
+ ipTransparent = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Allow binding to non local addresses.
+ '';
+ };
+
+ ipv4 = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Wheter to listen on IPv4 connections.
+ '';
+ };
+
+ ipv6 = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Wheter to listen on IPv6 connections.
+ '';
+ };
+
+ port = mkOption {
+ type = types.int;
+ default = 53;
+ description = ''
+ Port the service should bind do.
+ '';
+ };
+
+ verbosity = mkOption {
+ type = types.int;
+ default = 0;
+ description = ''
+ Verbosity level.
+ '';
+ };
+
+ hideVersion = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Wheter NSD should answer VERSION.BIND and VERSION.SERVER CHAOS class queries.
+ '';
+ };
+
+ identity = mkOption {
+ type = types.str;
+ default = "unidentified server";
+ description = ''
+ Identify the server (CH TXT ID.SERVER entry).
+ '';
+ };
+
+ nsid = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = ''
+ NSID identity (hex string, or "ascii_somestring").
+ '';
+ };
+
+ tcpCount = mkOption {
+ type = types.int;
+ default = 100;
+ description = ''
+ Maximum number of concurrent TCP connections per server.
+ '';
+ };
+
+ tcpQueryCount = mkOption {
+ type = types.int;
+ default = 0;
+ description = ''
+ Maximum number of queries served on a single TCP connection.
+ 0 means no maximum.
+ '';
+ };
+
+ tcpTimeout = mkOption {
+ type = types.int;
+ default = 120;
+ description = ''
+ TCP timeout in seconds.
+ '';
+ };
+
+ ipv4EDNSSize = mkOption {
+ type = types.int;
+ default = 4096;
+ description = ''
+ Preferred EDNS buffer size for IPv4.
+ '';
+ };
+
+ ipv6EDNSSize = mkOption {
+ type = types.int;
+ default = 4096;
+ description = ''
+ Preferred EDNS buffer size for IPv6.
+ '';
+ };
+
+ statistics = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ Statistics are produced every number of seconds. Prints to log.
+ If null no statistics are logged.
+ '';
+ };
+
+ xfrdReloadTimeout = mkOption {
+ type = types.int;
+ default = 1;
+ description = ''
+ Number of seconds between reloads triggered by xfrd.
+ '';
+ };
+
+ zonefilesCheck = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Wheter to check mtime of all zone files on start and sighup.
+ '';
+ };
+
+
+ extraConfig = mkOption {
+ type = types.str;
+ default = "";
+ description = ''
+ Extra nsd config.
+ '';
+ };
+
+
+ ratelimit = mkOption {
+ type = types.submodule (
+ { options, ... }:
+ { options = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable ratelimit capabilities.
+ '';
+ };
+
+ size = mkOption {
+ type = types.int;
+ default = 1000000;
+ description = ''
+ Size of the hashtable. More buckets use more memory but lower
+ the chance of hash hash collisions.
+ '';
+ };
+
+ ratelimit = mkOption {
+ type = types.int;
+ default = 200;
+ description = ''
+ Max qps allowed from any query source.
+ 0 means unlimited. With an verbosity of 2 blocked and
+ unblocked subnets will be logged.
+ '';
+ };
+
+ whitelistRatelimit = mkOption {
+ type = types.int;
+ default = 2000;
+ description = ''
+ Max qps allowed from whitelisted sources.
+ 0 means unlimited. Set the rrl-whitelist option for specific
+ queries to apply this limit instead of the default to them.
+ '';
+ };
+
+ slip = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ Number of packets that get discarded before replying a SLIP response.
+ 0 disables SLIP responses. 1 will make every response a SLIP response.
+ '';
+ };
+
+ ipv4PrefixLength = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ IPv4 prefix length. Addresses are grouped by netblock.
+ '';
+ };
+
+ ipv6PrefixLength = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ IPv6 prefix length. Addresses are grouped by netblock.
+ '';
+ };
+
+ };
+ });
+ default = {
+ };
+ example = {};
+ description = ''
+ '';
+ };
+
+
+ remoteControl = mkOption {
+ type = types.submodule (
+ { config, options, ... }:
+ { options = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Wheter to enable remote control via nsd-control(8).
+ '';
+ };
+
+ interfaces = mkOption {
+ type = types.listOf types.str;
+ default = [ "127.0.0.1" "::1" ];
+ description = ''
+ Which interfaces NSD should bind to for remote control.
+ '';
+ };
+
+ port = mkOption {
+ type = types.int;
+ default = 8952;
+ description = ''
+ Port number for remote control operations (uses TLS over TCP).
+ '';
+ };
+
+ serverKeyFile = mkOption {
+ type = types.path;
+ default = "/etc/nsd/nsd_server.key";
+ description = ''
+ Path to the server private key, which is used by the server
+ but not by nsd-control. This file is generated by nsd-control-setup.
+ '';
+ };
+
+ serverCertFile = mkOption {
+ type = types.path;
+ default = "/etc/nsd/nsd_server.pem";
+ description = ''
+ Path to the server self signed certificate, which is used by the server
+ but and by nsd-control. This file is generated by nsd-control-setup.
+ '';
+ };
+
+ controlKeyFile = mkOption {
+ type = types.path;
+ default = "/etc/nsd/nsd_control.key";
+ description = ''
+ Path to the client private key, which is used by nsd-control
+ but not by the server. This file is generated by nsd-control-setup.
+ '';
+ };
+
+ controlCertFile = mkOption {
+ type = types.path;
+ default = "/etc/nsd/nsd_control.pem";
+ description = ''
+ Path to the client certificate signed with the server certificate.
+ This file is used by nsd-control and generated by nsd-control-setup.
+ '';
+ };
+
+ };
+
+ });
+ default = {
+ };
+ example = {};
+ description = ''
+ '';
+ };
+
+
+ keys = mkOption {
+ type = types.attrsOf (types.submodule (
+ { options, ... }:
+ { options = {
+
+ algorithm = mkOption {
+ type = types.str;
+ default = "hmac-sha256";
+ description = ''
+ Authentication algorithm for this key.
+ '';
+ };
+
+ keyFile = mkOption {
+ type = types.path;
+ description = ''
+ Path to the file which contains the actual base64 encoded
+ key. The key will be copied into "${stateDir}/private" before
+ NSD starts. The copied file is only accessibly by the NSD
+ user.
+ '';
+ };
+
+ };
+ }));
+ default = {
+ };
+ example = {
+ "tsig.example.org" = {
+ algorithm = "hmac-md5";
+ secret = "aaaaaabbbbbbccccccdddddd";
+ };
+ };
+ description = ''
+ Define your TSIG keys here.
+ '';
+ };
+
+ zones = mkOption {
+ type = types.attrsOf zoneOptions;
+ default = {};
+ example = {
+ "serverGroup1" = {
+ provideXFR = [ "10.1.2.3 NOKEY" ];
+ children = {
+ "example.com." = {
+ data = ''
+ $ORIGIN example.com.
+ $TTL 86400
+ @ IN SOA a.ns.example.com. admin.example.com. (
+ ...
+ '';
+ };
+ "example.org." = {
+ data = ''
+ $ORIGIN example.org.
+ $TTL 86400
+ @ IN SOA a.ns.example.com. admin.example.com. (
+ ...
+ '';
+ };
+ };
+ };
+
+ "example.net." = {
+ provideXFR = [ "10.3.2.1 NOKEY" ];
+ data = ''...'';
+ };
+ };
+ description = ''
+ Define your zones here. Zones can cascade other zones and therefore
+ inherit settings from parent zones. Look at the definition of
+ children to learn about inheritance and child zones.
+ The given example will define 3 zones (example.(com|org|net).). Both
+ example.com. and example.org. inherit their configuration from
+ serverGroup1.
+ '';
+ };
+
+ };
+ };
+
+ config = mkIf cfg.enable {
+
+ # this is not working :(
+ nixpkgs.config.nsd = {
+ ipv6 = cfg.ipv6;
+ ratelimit = cfg.ratelimit.enable;
+ rootServer = cfg.rootServer;
+ };
+
+ users.extraGroups = singleton {
+ name = username;
+ gid = config.ids.gids.nsd;
+ };
+
+ users.extraUsers = singleton {
+ name = username;
+ description = "NSD service user";
+ home = stateDir;
+ createHome = true;
+ uid = config.ids.uids.nsd;
+ group = username;
+ };
+
+ systemd.services.nsd = {
+ description = "NSD authoritative only domain name service";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+
+ serviceConfig = {
+ Type = "forking";
+ PIDFile = pidFile;
+ Restart = "always";
+ ExecStart = "${pkgs.nsd}/sbin/nsd -c ${configFile}";
+ };
+
+ preStart = ''
+ ${pkgs.coreutils}/bin/mkdir -m 0700 -p "${stateDir}/private"
+ ${pkgs.coreutils}/bin/mkdir -m 0700 -p "${stateDir}/tmp"
+ ${pkgs.coreutils}/bin/mkdir -m 0700 -p "${stateDir}/var"
+
+ ${pkgs.coreutils}/bin/touch "${stateDir}/don't touch anything in here"
+
+ ${pkgs.coreutils}/bin/rm -f "${stateDir}/private/"*
+ ${pkgs.coreutils}/bin/rm -f "${stateDir}/tmp/"*
+
+ ${pkgs.coreutils}/bin/chown nsd:nsd -R "${stateDir}/private"
+ ${pkgs.coreutils}/bin/chown nsd:nsd -R "${stateDir}/tmp"
+ ${pkgs.coreutils}/bin/chown nsd:nsd -R "${stateDir}/var"
+
+ ${pkgs.coreutils}/bin/rm -rf "${stateDir}/zones"
+ ${pkgs.coreutils}/bin/cp -r "${zoneFiles}" "${stateDir}/zones"
+
+ ${copyKeys}
+ '';
+ };
+
+ };
+}
diff --git a/nixos/modules/services/networking/ntopng.nix b/nixos/modules/services/networking/ntopng.nix
new file mode 100644
index 00000000000..ab86f1a5b2b
--- /dev/null
+++ b/nixos/modules/services/networking/ntopng.nix
@@ -0,0 +1,116 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.ntopng;
+ redisCfg = config.services.redis;
+
+ configFile = if cfg.configText != "" then
+ pkgs.writeText "ntopng.conf" ''
+ ${cfg.configText}
+ ''
+ else
+ pkgs.writeText "ntopng.conf" ''
+ ${concatStringsSep " " (map (e: "--interface=" + e) cfg.interfaces)}
+ --http-port=${toString cfg.http-port}
+ --redis=localhost:${toString redisCfg.port}
+ ${cfg.extraConfig}
+ '';
+
+in
+
+{
+
+ options = {
+
+ services.ntopng = {
+
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Enable ntopng, a high-speed web-based traffic analysis and flow
+ collection tool.
+
+ With the default configuration, ntopng monitors all network
+ interfaces and displays its findings at http://localhost:${toString
+ cfg.http-port}. Default username and password is admin/admin.
+
+ See the ntopng(8) manual page and http://www.ntop.org/products/ntop/
+ for more info.
+
+ Note that enabling ntopng will also enable redis (key-value
+ database server) for persistent data storage.
+ '';
+ };
+
+ interfaces = mkOption {
+ default = [ "any" ];
+ example = [ "eth0" "wlan0" ];
+ type = types.listOf types.str;
+ description = ''
+ List of interfaces to monitor. Use "any" to monitor all interfaces.
+ '';
+ };
+
+ http-port = mkOption {
+ default = 3000;
+ type = types.uniq types.int;
+ description = ''
+ Sets the HTTP port of the embedded web server.
+ '';
+ };
+
+ configText = mkOption {
+ default = "";
+ example = ''
+ --interface=any
+ --http-port=3000
+ --disable-login
+ '';
+ type = types.lines;
+ description = ''
+ Overridable configuration file contents to use for ntopng. By
+ default, use the contents automatically generated by NixOS.
+ '';
+ };
+
+ extraConfig = mkOption {
+ default = "";
+ type = types.lines;
+ description = ''
+ Configuration lines that will be appended to the generated ntopng
+ configuration file. Note that this mechanism does not work when the
+ manual option is used.
+ '';
+ };
+
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ # ntopng uses redis for data storage
+ services.redis.enable = true;
+
+ # nice to have manual page and ntopng command in PATH
+ environment.systemPackages = [ pkgs.ntopng ];
+
+ systemd.services.ntopng = {
+ description = "Ntopng Network Monitor";
+ requires = [ "redis.service" ];
+ after = [ "network.target" "redis.service" ];
+ wantedBy = [ "multi-user.target" ];
+ preStart = "mkdir -p /var/lib/ntopng/";
+ serviceConfig.ExecStart = "${pkgs.ntopng}/bin/ntopng ${configFile}";
+ unitConfig.Documentation = "man:ntopng(8)";
+ };
+
+ # ntopng drops priveleges to user "nobody" and that user is already defined
+ # in users-groups.nix.
+ };
+
+}
diff --git a/nixos/modules/services/networking/ntpd.nix b/nixos/modules/services/networking/ntpd.nix
index e5e164021d3..2f638904406 100644
--- a/nixos/modules/services/networking/ntpd.nix
+++ b/nixos/modules/services/networking/ntpd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -15,6 +15,11 @@ let
# chroot to ${stateDir}, we have to specify it as /ntp.drift.
driftfile /ntp.drift
+ restrict default kod nomodify notrap nopeer noquery
+ restrict -6 default kod nomodify notrap nopeer noquery
+ restrict 127.0.0.1
+ restrict -6 ::1
+
${toString (map (server: "server " + server + " iburst\n") config.services.ntp.servers)}
'';
@@ -31,7 +36,7 @@ in
services.ntp = {
enable = mkOption {
- default = true;
+ default = !config.boot.isContainer;
description = ''
Whether to synchronise your machine's time using the NTP
protocol.
diff --git a/nixos/modules/services/networking/oidentd.nix b/nixos/modules/services/networking/oidentd.nix
index a2a555a8ad1..923e7cd0986 100644
--- a/nixos/modules/services/networking/oidentd.nix
+++ b/nixos/modules/services/networking/oidentd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/networking/openfire.nix b/nixos/modules/services/networking/openfire.nix
index b2efb5e9c12..c3b4ba90b4e 100644
--- a/nixos/modules/services/networking/openfire.nix
+++ b/nixos/modules/services/networking/openfire.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/openvpn.nix b/nixos/modules/services/networking/openvpn.nix
index 292d45f4347..9dc88e61865 100644
--- a/nixos/modules/services/networking/openvpn.nix
+++ b/nixos/modules/services/networking/openvpn.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -56,6 +56,7 @@ let
serviceConfig.ExecStart = "@${openvpn}/sbin/openvpn openvpn --config ${configFile}";
serviceConfig.Restart = "always";
+ serviceConfig.Type = "notify";
};
in
diff --git a/nixos/modules/services/networking/polipo.nix b/nixos/modules/services/networking/polipo.nix
new file mode 100644
index 00000000000..05ded84625d
--- /dev/null
+++ b/nixos/modules/services/networking/polipo.nix
@@ -0,0 +1,118 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.polipo;
+
+ polipoConfig = pkgs.writeText "polipo.conf" ''
+ proxyAddress = ${cfg.proxyAddress}
+ proxyPort = ${toString cfg.proxyPort}
+ allowedClients = ${concatStringsSep ", " cfg.allowedClients}
+ ${optionalString (cfg.parentProxy != "") "parentProxy = ${cfg.parentProxy}" }
+ ${optionalString (cfg.socksParentProxy != "") "socksParentProxy = ${cfg.socksParentProxy}" }
+ ${config.services.polipo.extraConfig}
+ '';
+
+in
+
+{
+
+ options = {
+
+ services.polipo = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to run the polipo caching web proxy.";
+ };
+
+ proxyAddress = mkOption {
+ type = types.string;
+ default = "127.0.0.1";
+ description = "IP address on which Polipo will listen.";
+ };
+
+ proxyPort = mkOption {
+ type = types.int;
+ default = 8123;
+ description = "TCP port on which Polipo will listen.";
+ };
+
+ allowedClients = mkOption {
+ type = types.listOf types.string;
+ default = [ "127.0.0.1" "::1" ];
+ example = [ "127.0.0.1" "::1" "134.157.168.0/24" "2001:660:116::/48" ];
+ description = ''
+ List of IP addresses or network addresses that may connect to Polipo.
+ '';
+ };
+
+ parentProxy = mkOption {
+ type = types.string;
+ default = "";
+ example = "localhost:8124";
+ description = ''
+ Hostname and port number of an HTTP parent proxy;
+ it should have the form ‘host:port’.
+ '';
+ };
+
+ socksParentProxy = mkOption {
+ type = types.string;
+ default = "";
+ example = "localhost:9050";
+ description = ''
+ Hostname and port number of an SOCKS parent proxy;
+ it should have the form ‘host:port’.
+ '';
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Polio configuration. Contents will be added
+ verbatim to the configuration file.
+ '';
+ };
+
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers = singleton
+ { name = "polipo";
+ uid = config.ids.uids.polipo;
+ description = "Polipo caching proxy user";
+ home = "/var/cache/polipo";
+ createHome = true;
+ };
+
+ users.extraGroups = singleton
+ { name = "polipo";
+ gid = config.ids.gids.polipo;
+ members = [ "polipo" ];
+ };
+
+ systemd.services.polipo = {
+ description = "caching web proxy";
+ after = [ "network.target" "nss-lookup.target" ];
+ wantedBy = [ "multi-user.target"];
+ preStart = ''
+ ${pkgs.coreutils}/bin/chown polipo:polipo /var/cache/polipo -R
+ '';
+ serviceConfig = {
+ ExecStart = "${pkgs.polipo}/bin/polipo -c ${polipoConfig}";
+ ExecReload = "${pkgs.coreutils}/bin/kill -USR1 $MAINPID";
+ User = "polipo";
+ };
+ };
+
+ };
+
+}
\ No newline at end of file
diff --git a/nixos/modules/services/networking/prayer.nix b/nixos/modules/services/networking/prayer.nix
index fb541bf101a..ad0fb0af01c 100644
--- a/nixos/modules/services/networking/prayer.nix
+++ b/nixos/modules/services/networking/prayer.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/privoxy.nix b/nixos/modules/services/networking/privoxy.nix
index 89c40c53157..950112b2dab 100644
--- a/nixos/modules/services/networking/privoxy.nix
+++ b/nixos/modules/services/networking/privoxy.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/quassel.nix b/nixos/modules/services/networking/quassel.nix
index f3a4e457ec8..749e5dcebb6 100644
--- a/nixos/modules/services/networking/quassel.nix
+++ b/nixos/modules/services/networking/quassel.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
quassel = pkgs.kde4.quasselDaemon;
diff --git a/nixos/modules/services/networking/radicale.nix b/nixos/modules/services/networking/radicale.nix
new file mode 100644
index 00000000000..fc9afc70aca
--- /dev/null
+++ b/nixos/modules/services/networking/radicale.nix
@@ -0,0 +1,48 @@
+{config, lib, pkgs, ...}:
+
+with lib;
+
+let
+
+ cfg = config.services.radicale;
+
+ confFile = pkgs.writeText "radicale.conf" cfg.config;
+
+in
+
+{
+
+ options = {
+
+ services.radicale.enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable Radicale CalDAV and CardDAV server
+ '';
+ };
+
+ services.radicale.config = mkOption {
+ type = types.string;
+ default = "";
+ description = ''
+ Radicale configuration, this will set the service
+ configuration file
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+
+ environment.systemPackages = [ pkgs.pythonPackages.radicale ];
+
+ jobs.radicale = {
+ description = "A Simple Calendar and Contact Server";
+ startOn = "started network-interfaces";
+ exec = "${pkgs.pythonPackages.radicale}/bin/radicale -C ${confFile} -d";
+ daemonType = "fork";
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/radvd.nix b/nixos/modules/services/networking/radvd.nix
index 8d586ce6e46..08762c9c837 100644
--- a/nixos/modules/services/networking/radvd.nix
+++ b/nixos/modules/services/networking/radvd.nix
@@ -1,8 +1,8 @@
# Module for the IPv6 Router Advertisement Daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/rdnssd.nix b/nixos/modules/services/networking/rdnssd.nix
index f797206ad5c..4c1891816e3 100644
--- a/nixos/modules/services/networking/rdnssd.nix
+++ b/nixos/modules/services/networking/rdnssd.nix
@@ -1,9 +1,9 @@
# Module for rdnssd, a daemon that configures DNS servers in
# /etc/resolv/conf from IPv6 RDNSS advertisements.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/networking/rpcbind.nix b/nixos/modules/services/networking/rpcbind.nix
index c966f85e260..eef1e8e8cd8 100644
--- a/nixos/modules/services/networking/rpcbind.nix
+++ b/nixos/modules/services/networking/rpcbind.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/sabnzbd.nix b/nixos/modules/services/networking/sabnzbd.nix
index 8816ac0d2f8..83db0841b34 100644
--- a/nixos/modules/services/networking/sabnzbd.nix
+++ b/nixos/modules/services/networking/sabnzbd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/searx.nix b/nixos/modules/services/networking/searx.nix
new file mode 100644
index 00000000000..b29db58af99
--- /dev/null
+++ b/nixos/modules/services/networking/searx.nix
@@ -0,0 +1,75 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.searx;
+
+ configFile = cfg.configFile;
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.searx = {
+
+ enable = mkOption {
+ default = false;
+ description = "
+ Whether to enable the Searx server. See https://github.com/asciimoo/searx
+ ";
+ };
+
+ configFile = mkOption {
+ default = "";
+ description = "
+ The path of the Searx server configuration file. If no file
+ is specified, a default file is used (default config file has
+ debug mode enabled).
+ ";
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.searx.enable {
+
+ users.extraUsers.searx =
+ { uid = config.ids.uids.searx;
+ description = "Searx user";
+ createHome = true;
+ home = "/var/lib/searx";
+ };
+
+ users.extraGroups.searx =
+ { gid = config.ids.gids.searx;
+ };
+
+ systemd.services.searx =
+ {
+ description = "Searx server, the meta search engine.";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ User = "searx";
+ ExecStart = "${pkgs.pythonPackages.searx}/bin/searx-run";
+ };
+ } // (optionalAttrs (configFile != "") {
+ environment.SEARX_SETTINGS_PATH = configFile;
+ });
+
+
+ environment.systemPackages = [ pkgs.pythonPackages.searx ];
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/spiped.nix b/nixos/modules/services/networking/spiped.nix
new file mode 100644
index 00000000000..005d7182351
--- /dev/null
+++ b/nixos/modules/services/networking/spiped.nix
@@ -0,0 +1,220 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.spiped;
+in
+{
+ options = {
+ services.spiped = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Enable the spiped service module.";
+ };
+
+ config = mkOption {
+ type = types.attrsOf (types.submodule (
+ {
+ options = {
+ encrypt = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Take unencrypted connections from the
+ source socket and send encrypted
+ connections to the target socket.
+ '';
+ };
+
+ decrypt = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Take encrypted connections from the
+ source socket and send unencrypted
+ connections to the target socket.
+ '';
+ };
+
+ source = mkOption {
+ type = types.str;
+ description = ''
+ Address on which spiped should listen for incoming
+ connections. Must be in one of the following formats:
+ /absolute/path/to/unix/socket,
+ host.name:port,
+ [ip.v4.ad.dr]:port or
+ [ipv6::addr]:port - note that
+ hostnames are resolved when spiped is launched and are
+ not re-resolved later; thus if DNS entries change
+ spiped will continue to connect to the expired
+ address.
+ '';
+ };
+
+ target = mkOption {
+ type = types.str;
+ description = "Address to which spiped should connect.";
+ };
+
+ keyfile = mkOption {
+ type = types.path;
+ description = ''
+ Name of a file containing the spiped key. As the
+ daemon runs as the spiped user, the
+ key file must be somewhere owned by that user. By
+ default, we recommend putting the keys for any spipe
+ services in /var/lib/spiped.
+ '';
+ };
+
+ timeout = mkOption {
+ type = types.int;
+ default = 5;
+ description = ''
+ Timeout, in seconds, after which an attempt to connect to
+ the target or a protocol handshake will be aborted (and the
+ connection dropped) if not completed
+ '';
+ };
+
+ maxConns = mkOption {
+ type = types.int;
+ default = 100;
+ description = ''
+ Limit on the number of simultaneous connections allowed.
+ '';
+ };
+
+ waitForDNS = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Wait for DNS. Normally when spiped is
+ launched it resolves addresses and binds to its source
+ socket before the parent process returns; with this option
+ it will daemonize first and retry failed DNS lookups until
+ they succeed. This allows spiped to
+ launch even if DNS isn't set up yet, but at the expense of
+ losing the guarantee that once spiped has
+ finished launching it will be ready to create pipes.
+ '';
+ };
+
+ disableKeepalives = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Disable transport layer keep-alives.";
+ };
+
+ weakHandshake = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Use fast/weak handshaking: This reduces the CPU time spent
+ in the initial connection setup, at the expense of losing
+ perfect forward secrecy.
+ '';
+ };
+
+ resolveRefresh = mkOption {
+ type = types.int;
+ default = 60;
+ description = ''
+ Resolution refresh time for the target socket, in seconds.
+ '';
+ };
+
+ disableReresolution = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Disable target address re-resolution.";
+ };
+ };
+ }
+ ));
+
+ default = {};
+
+ example = literalExample ''
+ {
+ pipe1 =
+ { keyfile = "/var/lib/spiped/pipe1.key";
+ encrypt = true;
+ source = "localhost:6000";
+ target = "endpoint.example.com:7000";
+ };
+ pipe2 =
+ { keyfile = "/var/lib/spiped/pipe2.key";
+ decrypt = true;
+ source = "0.0.0.0:7000";
+ target = "localhost:3000";
+ };
+ }
+ '';
+
+ description = ''
+ Configuration for a secure pipe daemon. The daemon can be
+ started, stopped, or examined using
+ systemctl, under the name
+ spiped@foo.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions = mapAttrsToList (name: c: {
+ assertion = (c.encrypt -> !c.decrypt) || (c.decrypt -> c.encrypt);
+ message = "A pipe must either encrypt or decrypt";
+ }) cfg.config;
+
+ users.extraGroups.spiped.gid = config.ids.gids.spiped;
+ users.extraUsers.spiped = {
+ description = "Secure Pipe Service user";
+ group = "spiped";
+ uid = config.ids.uids.spiped;
+ };
+
+ systemd.services."spiped@" = {
+ description = "Secure pipe '%i'";
+ after = [ "network.target" ];
+
+ serviceConfig = {
+ Restart = "always";
+ User = "spiped";
+ PermissionsStartOnly = true;
+ };
+
+ preStart = ''
+ cd /var/lib/spiped
+ chmod -R 0660 *
+ chown -R spiped:spiped *
+ '';
+ scriptArgs = "%i";
+ script = "exec ${pkgs.spiped}/bin/spiped -F `cat /etc/spiped/$1.spec`";
+ };
+
+ system.activationScripts.spiped = optionalString (cfg.config != {})
+ "mkdir -p /var/lib/spiped";
+
+ # Setup spiped config files
+ environment.etc = mapAttrs' (name: cfg: nameValuePair "spiped/${name}.spec"
+ { text = concatStringsSep " "
+ [ (if cfg.encrypt then "-e" else "-d") # Mode
+ "-s ${cfg.source}" # Source
+ "-t ${cfg.target}" # Target
+ "-k ${cfg.keyfile}" # Keyfile
+ "-n ${toString cfg.maxConns}" # Max number of conns
+ "-o ${toString cfg.timeout}" # Timeout
+ (optionalString cfg.waitForDNS "-D") # Wait for DNS
+ (optionalString cfg.weakHandshake "-f") # No PFS
+ (optionalString cfg.disableKeepalives "-j") # Keepalives
+ (if cfg.disableReresolution then "-R"
+ else "-r ${toString cfg.resolveRefresh}")
+ ];
+ }) cfg.config;
+ };
+}
diff --git a/nixos/modules/services/networking/ssh/lshd.nix b/nixos/modules/services/networking/ssh/lshd.nix
index 04ef76f1e4d..81e523fd2a5 100644
--- a/nixos/modules/services/networking/ssh/lshd.nix
+++ b/nixos/modules/services/networking/ssh/lshd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -99,7 +99,6 @@ in
};
subsystems = mkOption {
- default = [ ["sftp" "${pkgs.lsh}/sbin/sftp-server"] ];
description = ''
List of subsystem-path pairs, where the head of the pair
denotes the subsystem name, and the tail denotes the path to
@@ -116,6 +115,8 @@ in
config = mkIf cfg.enable {
+ services.lshd.subsystems = [ ["sftp" "${pkgs.lsh}/sbin/sftp-server"] ];
+
jobs.lshd =
{ description = "GNU lshd SSH2 daemon";
diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix
index 7a2335847e3..e4b29a0b909 100644
--- a/nixos/modules/services/networking/ssh/sshd.nix
+++ b/nixos/modules/services/networking/ssh/sshd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -18,9 +18,9 @@ let
knownHosts = map (h: getAttr h cfg.knownHosts) (attrNames cfg.knownHosts);
knownHostsFile = pkgs.writeText "ssh_known_hosts" (
- flip concatMapStrings knownHosts (h:
- "${concatStringsSep "," h.hostNames} ${builtins.readFile h.publicKeyFile}"
- )
+ flip concatMapStrings knownHosts (h: ''
+ ${concatStringsSep "," h.hostNames} ${if h.publicKey != null then h.publicKey else readFile h.publicKeyFile}
+ '')
);
userOptions = {
@@ -39,7 +39,7 @@ let
};
keyFiles = mkOption {
- type = types.listOf types.unspecified;
+ type = types.listOf types.path;
default = [];
description = ''
A list of files each containing one OpenSSH public key that should be
@@ -59,7 +59,7 @@ let
mode = "0444";
source = pkgs.writeText "${u.name}-authorized_keys" ''
${concatStringsSep "\n" u.openssh.authorizedKeys.keys}
- ${concatMapStrings (f: builtins.readFile f + "\n") u.openssh.authorizedKeys.keyFiles}
+ ${concatMapStrings (f: readFile f + "\n") u.openssh.authorizedKeys.keyFiles}
'';
};
usersWithKeys = attrValues (flip filterAttrs config.users.extraUsers (n: u:
@@ -86,6 +86,16 @@ in
'';
};
+ startWhenNeeded = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If set, sshd is socket-activated; that
+ is, instead of having it permanently running as a daemon,
+ systemd will start an instance for each incoming connection.
+ '';
+ };
+
forwardX11 = mkOption {
type = types.bool;
default = cfgc.setXAuthLocation;
@@ -172,7 +182,7 @@ in
};
authorizedKeysFiles = mkOption {
- type = types.listOf types.unspecified;
+ type = types.listOf types.str;
default = [];
description = "Files from with authorized keys are read.";
};
@@ -208,7 +218,18 @@ in
the host's ssh service.
'';
};
+ publicKey = mkOption {
+ default = null;
+ type = types.nullOr types.str;
+ description = ''
+ The public key data for the host. You can fetch a public key
+ from a running SSH server with the ssh-keyscan
+ command.
+ '';
+ };
publicKeyFile = mkOption {
+ default = null;
+ type = types.nullOr types.path;
description = ''
The path to the public key file for the host. The public
key file is read at build time and saved in the Nix store.
@@ -248,38 +269,60 @@ in
}
];
- systemd.services.sshd =
- { description = "SSH Daemon";
+ systemd =
+ let
+ service =
+ { description = "SSH Daemon";
- wantedBy = [ "multi-user.target" ];
+ wantedBy = optional (!cfg.startWhenNeeded) "multi-user.target";
- stopIfChanged = false;
+ stopIfChanged = false;
- path = [ pkgs.openssh pkgs.gawk ];
+ path = [ pkgs.openssh pkgs.gawk ];
- environment.LD_LIBRARY_PATH = nssModulesPath;
- environment.LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
+ environment.LD_LIBRARY_PATH = nssModulesPath;
- preStart =
- ''
- mkdir -m 0755 -p /etc/ssh
+ preStart =
+ ''
+ mkdir -m 0755 -p /etc/ssh
- ${flip concatMapStrings cfg.hostKeys (k: ''
- if ! [ -f "${k.path}" ]; then
- ssh-keygen -t "${k.type}" -b "${toString k.bits}" -f "${k.path}" -N ""
- fi
- '')}
- '';
+ ${flip concatMapStrings cfg.hostKeys (k: ''
+ if ! [ -f "${k.path}" ]; then
+ ssh-keygen -t "${k.type}" -b "${toString k.bits}" -f "${k.path}" -N ""
+ fi
+ '')}
+ '';
- serviceConfig =
- { ExecStart =
- "${pkgs.openssh}/sbin/sshd " +
- "-f ${pkgs.writeText "sshd_config" cfg.extraConfig}";
- Restart = "always";
- Type = "forking";
- KillMode = "process";
- PIDFile = "/run/sshd.pid";
+ serviceConfig =
+ { ExecStart =
+ "${pkgs.openssh}/sbin/sshd " + (optionalString cfg.startWhenNeeded "-i ") +
+ "-f ${pkgs.writeText "sshd_config" cfg.extraConfig}";
+ KillMode = "process";
+ } // (if cfg.startWhenNeeded then {
+ StandardInput = "socket";
+ } else {
+ Restart = "always";
+ Type = "forking";
+ PIDFile = "/run/sshd.pid";
+ });
};
+ in
+
+ if cfg.startWhenNeeded then {
+
+ sockets.sshd =
+ { description = "SSH Socket";
+ wantedBy = [ "sockets.target" ];
+ socketConfig.ListenStream = cfg.ports;
+ socketConfig.Accept = true;
+ };
+
+ services."sshd@" = service;
+
+ } else {
+
+ services.sshd = service;
+
};
networking.firewall.allowedTCPPorts = cfg.ports;
@@ -335,7 +378,12 @@ in
'';
assertions = [{ assertion = if cfg.forwardX11 then cfgc.setXAuthLocation else true;
- message = "cannot enable X11 forwarding without setting xauth location";}];
+ message = "cannot enable X11 forwarding without setting xauth location";}]
+ ++ flip mapAttrsToList cfg.knownHosts (name: data: {
+ assertion = (data.publicKey == null && data.publicKeyFile != null) ||
+ (data.publicKey != null && data.publicKeyFile == null);
+ message = "knownHost ${name} must contain either a publicKey or publicKeyFile";
+ });
};
diff --git a/nixos/modules/services/networking/supybot.nix b/nixos/modules/services/networking/supybot.nix
index fa8b7556de5..2cfb9fc9b92 100644
--- a/nixos/modules/services/networking/supybot.nix
+++ b/nixos/modules/services/networking/supybot.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix
new file mode 100644
index 00000000000..02572c1e27d
--- /dev/null
+++ b/nixos/modules/services/networking/syncthing.nix
@@ -0,0 +1,78 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.syncthing;
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.syncthing = {
+
+ enable = mkOption {
+ default = false;
+ description = ''
+ Whether to enable the Syncthing, self-hosted open-source alternative
+ to Dropbox and BittorrentSync. Initial interface will be
+ available on http://127.0.0.1:8080/.
+ '';
+ };
+
+ user = mkOption {
+ default = "syncthing";
+ description = ''
+ Syncthing will be run under this user (user must exist,
+ this can be your user name).
+ '';
+ };
+
+ dataDir = mkOption {
+ default = "/var/lib/syncthing";
+ description = ''
+ Path where the `.syncthing` (settings and keys) and `Sync`
+ (your synced files) directories will exist. This can be your home
+ directory.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ systemd.services.syncthing =
+ {
+ description = "Syncthing service";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ environment.STNORESTART = "placeholder"; # do not self-restart
+ environment.HOME = "${cfg.dataDir}";
+ serviceConfig = {
+ User = "${cfg.user}";
+ PermissionsStartOnly = true;
+ Restart = "always";
+ ExecStart = "${pkgs.syncthing}/bin/syncthing -home=${cfg.dataDir}/.syncthing";
+ };
+ preStart = ''
+ mkdir -p ${cfg.dataDir}
+ chown ${cfg.user} ${cfg.dataDir}
+ '';
+
+ };
+
+ environment.systemPackages = [ pkgs.syncthing ];
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/tcpcrypt.nix b/nixos/modules/services/networking/tcpcrypt.nix
index 48cb884f246..1359006aef4 100644
--- a/nixos/modules/services/networking/tcpcrypt.nix
+++ b/nixos/modules/services/networking/tcpcrypt.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/teamspeak3.nix b/nixos/modules/services/networking/teamspeak3.nix
new file mode 100644
index 00000000000..b3656d73dec
--- /dev/null
+++ b/nixos/modules/services/networking/teamspeak3.nix
@@ -0,0 +1,142 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ ts3 = pkgs.teamspeak_server;
+ cfg = config.services.teamspeak3;
+ user = "teamspeak";
+ group = "teamspeak";
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.teamspeak3 = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to run the Teamspeak3 voice communication server daemon.
+ '';
+ };
+
+ dataDir = mkOption {
+ type = types.path;
+ default = "/var/lib/teamspeak3-server";
+ description = ''
+ Directory to store TS3 database and other state/data files.
+ '';
+ };
+
+ logPath = mkOption {
+ type = types.path;
+ default = "/var/log/teamspeak3-server/";
+ description = ''
+ Directory to store log files in.
+ '';
+ };
+
+ voiceIP = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ description = ''
+ IP on which the server instance will listen for incoming voice connections. Defaults to any IP.
+ '';
+ };
+
+ defaultVoicePort = mkOption {
+ type = types.int;
+ default = 9987;
+ description = ''
+ Default UDP port for clients to connect to virtual servers - used for first virtual server, subsequent ones will open on incrementing port numbers by default.
+ '';
+ };
+
+ fileTransferIP = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ description = ''
+ IP on which the server instance will listen for incoming file transfer connections. Defaults to any IP.
+ '';
+ };
+
+ fileTransferPort = mkOption {
+ type = types.int;
+ default = 30033;
+ description = ''
+ TCP port opened for file transfers.
+ '';
+ };
+
+ queryIP = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ description = ''
+ IP on which the server instance will listen for incoming ServerQuery connections. Defaults to any IP.
+ '';
+ };
+
+ queryPort = mkOption {
+ type = types.int;
+ default = 10011;
+ description = ''
+ TCP port opened for ServerQuery connections.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers.teamspeak =
+ { name = "teamspeak";
+ description = "Teamspeak3 voice communication server daemon";
+ group = group;
+ uid = config.ids.uids.teamspeak;
+ };
+
+ users.extraGroups.teamspeak =
+ { name = "teamspeak";
+ gid = config.ids.gids.teamspeak;
+ };
+
+ systemd.services.teamspeak3-server = {
+ description = "Teamspeak3 voice communication server daemon";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ preStart = ''
+ mkdir -p ${cfg.dataDir}
+ mkdir -p ${cfg.logPath}
+ chown ${user}:${group} ${cfg.dataDir}
+ chown ${user}:${group} ${cfg.logPath}
+ '';
+
+ serviceConfig =
+ { ExecStart = ''
+ ${ts3}/bin/ts3server \
+ dbsqlpath=${ts3}/lib/teamspeak/sql/ logpath=${cfg.logPath} \
+ voice_ip=${cfg.voiceIP} default_voice_port=${toString cfg.defaultVoicePort} \
+ filetransfer_ip=${cfg.fileTransferIP} filetransfer_port=${toString cfg.fileTransferPort} \
+ query_ip=${cfg.queryIP} query_port=${toString cfg.queryPort}
+ '';
+ WorkingDirectory = cfg.dataDir;
+ User = user;
+ Group = group;
+ PermissionsStartOnly = true; # preStart needs to run with root permissions
+ };
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/tftpd.nix b/nixos/modules/services/networking/tftpd.nix
index 37935496c59..a2f7ff06ea6 100644
--- a/nixos/modules/services/networking/tftpd.nix
+++ b/nixos/modules/services/networking/tftpd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/networking/unbound.nix b/nixos/modules/services/networking/unbound.nix
index fb75b4ed069..415ff13bdda 100644
--- a/nixos/modules/services/networking/unbound.nix
+++ b/nixos/modules/services/networking/unbound.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -18,25 +18,25 @@ let
"forward-zone:\n name: .\n" +
concatMapStrings (x: " forward-addr: ${x}\n") cfg.forwardAddresses;
- confFile = pkgs.writeText "unbound.conf"
- ''
- server:
- directory: "${stateDir}"
- username: ${username}
- # make sure unbound can access entropy from inside the chroot.
- # e.g. on linux the use these commands (on BSD, devfs(8) is used):
- # mount --bind -n /dev/random /etc/unbound/dev/random
- # and mount --bind -n /dev/log /etc/unbound/dev/log
- chroot: "${stateDir}"
- # logfile: "${stateDir}/unbound.log" #uncomment to use logfile.
- pidfile: "${stateDir}/unbound.pid"
- verbosity: 1 # uncomment and increase to get more logging.
- # listen on all interfaces, answer queries from the local subnet.
+ confFile = pkgs.writeText "unbound.conf" ''
+ server:
+ directory: "${stateDir}"
+ username: ${username}
+ # make sure unbound can access entropy from inside the chroot.
+ # e.g. on linux the use these commands (on BSD, devfs(8) is used):
+ # mount --bind -n /dev/random /etc/unbound/dev/random
+ # and mount --bind -n /dev/log /etc/unbound/dev/log
+ chroot: "${stateDir}"
+ # logfile: "${stateDir}/unbound.log" #uncomment to use logfile.
+ pidfile: "${stateDir}/unbound.pid"
+ verbosity: 1 # uncomment and increase to get more logging.
${interfaces}
${access}
- ${forward}
- ${cfg.extraConfig}
- '';
+
+ ${forward}
+
+ ${cfg.extraConfig}
+ '';
in
@@ -45,74 +45,61 @@ in
###### interface
options = {
-
services.unbound = {
enable = mkOption {
- default = false;
- description = "
- Whether to enable the Unbound domain name server.
- ";
+ default = false;
+ description = "Whether to enable the Unbound domain name server.";
};
allowedAccess = mkOption {
- default = ["127.0.0.0/24"];
- description = "
- What networks are allowed to use us as a resolver.
- ";
+ default = ["127.0.0.0/24"];
+ description = "What networks are allowed to use unbound as a resolver.";
};
interfaces = mkOption {
- default = [ "127.0.0.0" "::1" ];
- description = "
- What addresses the server should listen to.
- ";
+ default = [ "127.0.0.1" "::1" ];
+ description = "What addresses the server should listen on.";
};
forwardAddresses = mkOption {
- default = [ ];
- description = "
- What servers to forward the queries to.
- ";
+ default = [ ];
+ description = "What servers to forward queries to.";
};
extraConfig = mkOption {
- default = "";
- description = "
- Extra unbound config
- ";
+ default = "";
+ description = "Extra lines of unbound config.";
};
};
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ environment.systemPackages = [ pkgs.unbound ];
+
+ users.extraUsers = singleton {
+ name = username;
+ uid = config.ids.uids.unbound;
+ description = "unbound daemon user";
+ home = stateDir;
+ createHome = true;
+ };
+
+ systemd.services.unbound = {
+ description="Unbound recursive Domain Name Server";
+ after = [ "network.target" ];
+ before = [ "nss-lookup.target" ];
+ wants = [" nss-lookup.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ path = [ pkgs.unbound ];
+ serviceConfig.ExecStart = "${pkgs.unbound}/sbin/unbound -d -c ${confFile}";
+ };
};
-
- ###### implementation
-
- config = mkIf config.services.unbound.enable {
- environment.systemPackages = [ pkgs.unbound ];
-
- users.extraUsers = singleton
- { name = username;
- uid = config.ids.uids.unbound;
- description = "unbound daemon user";
- home = "/tmp";
- };
-
- jobs.unbound =
- { description = "Unbound name server job";
-
- preStart =
- ''
- ${pkgs.coreutils}/bin/mkdir -p ${stateDir}
- '';
-
- daemonType = "fork";
-
- exec = "${pkgs.unbound}/sbin/unbound -c ${confFile}";
- };
-
- };
-
}
diff --git a/nixos/modules/services/networking/unifi.nix b/nixos/modules/services/networking/unifi.nix
new file mode 100644
index 00000000000..634f760328f
--- /dev/null
+++ b/nixos/modules/services/networking/unifi.nix
@@ -0,0 +1,88 @@
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ cfg = config.services.unifi;
+ stateDir = "/var/lib/unifi";
+ cmd = "@${pkgs.icedtea7_jre}/bin/java java -jar ${stateDir}/lib/ace.jar";
+in
+{
+
+ options = {
+
+ services.unifi.enable = mkOption {
+ type = types.uniq types.bool;
+ default = false;
+ description = ''
+ Whether or not to enable the unifi controller service.
+ '';
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers.unifi = {
+ uid = config.ids.uids.unifi;
+ description = "UniFi controller daemon user";
+ home = "${stateDir}";
+ };
+
+ # We must create the binary directories as bind mounts instead of symlinks
+ # This is because the controller resolves all symlinks to absolute paths
+ # to be used as the working directory.
+ systemd.mounts = map ({ what, where }: {
+ bindsTo = [ "unifi.service" ];
+ requiredBy = [ "unifi.service" ];
+ before = [ "unifi.service" ];
+ options = "bind";
+ what = what;
+ where = where;
+ }) [
+ {
+ what = "${pkgs.unifi}/dl";
+ where = "${stateDir}/dl";
+ }
+ {
+ what = "${pkgs.unifi}/lib";
+ where = "${stateDir}/lib";
+ }
+ {
+ what = "${pkgs.mongodb}/bin";
+ where = "${stateDir}/bin";
+ }
+ ];
+
+ systemd.services.unifi = {
+ description = "UniFi controller daemon";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+
+ preStart = ''
+ # Ensure privacy of state
+ chown unifi "${stateDir}"
+ chmod 0700 "${stateDir}"
+
+ # Create the volatile webapps
+ mkdir -p "${stateDir}/webapps"
+ chown unifi "${stateDir}/webapps"
+ ln -s "${pkgs.unifi}/webapps/ROOT.war" "${stateDir}/webapps/ROOT.war"
+ '';
+
+ postStop = ''
+ rm "${stateDir}/webapps/ROOT.war"
+ '';
+
+ serviceConfig = {
+ Type = "simple";
+ ExecStart = "${cmd} start";
+ ExecStop = "${cmd} stop";
+ User = "unifi";
+ PermissionsStartOnly = true;
+ UMask = "0077";
+ WorkingDirectory = "${stateDir}";
+ };
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/vsftpd.nix b/nixos/modules/services/networking/vsftpd.nix
index 0a6355e6ff1..62b6027c012 100644
--- a/nixos/modules/services/networking/vsftpd.nix
+++ b/nixos/modules/services/networking/vsftpd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -24,6 +24,7 @@ let
cfgText = "${vsftpdName}=${if getAttr nixosName cfg then "YES" else "NO"}";
nixosOption = {
+ type = types.bool;
name = nixosName;
value = mkOption {
inherit description default;
@@ -33,27 +34,26 @@ let
};
optionDescription = [
-
(yesNoOption "anonymousUser" "anonymous_enable" false ''
- Whether to enable the anonymous FTP user.
+ Whether to enable the anonymous FTP user.
'')
(yesNoOption "localUsers" "local_enable" false ''
- Whether to enable FTP for local users.
+ Whether to enable FTP for local users.
'')
(yesNoOption "writeEnable" "write_enable" false ''
- Whether any write activity is permitted to users.
+ Whether any write activity is permitted to users.
'')
(yesNoOption "anonymousUploadEnable" "anon_upload_enable" false ''
- Whether any uploads are permitted to anonymous users.
+ Whether any uploads are permitted to anonymous users.
'')
(yesNoOption "anonymousMkdirEnable" "anon_mkdir_write_enable" false ''
- Whether any uploads are permitted to anonymous users.
+ Whether any uploads are permitted to anonymous users.
'')
(yesNoOption "chrootlocalUser" "chroot_local_user" false ''
- Whether local users are confined to their home directory.
+ Whether local users are confined to their home directory.
'')
(yesNoOption "userlistEnable" "userlist_enable" false ''
- Whether users are included.
+ Whether users are included.
'')
(yesNoOption "userlistDeny" "userlist_deny" false ''
Specifies whether is a list of user
@@ -61,35 +61,38 @@ let
The default false means whitelist/allow.
'')
(yesNoOption "forceLocalLoginsSSL" "force_local_logins_ssl" false ''
- Only applies if is true. Non anonymous (local) users
- must use a secure SSL connection to send a password.
+ Only applies if is true. Non anonymous (local) users
+ must use a secure SSL connection to send a password.
'')
(yesNoOption "forceLocalDataSSL" "force_local_data_ssl" false ''
- Only applies if is true. Non anonymous (local) users
- must use a secure SSL connection for sending/receiving data on data connection.
+ Only applies if is true. Non anonymous (local) users
+ must use a secure SSL connection for sending/receiving data on data connection.
'')
(yesNoOption "ssl_tlsv1" "ssl_tlsv1" true '' '')
(yesNoOption "ssl_sslv2" "ssl_sslv2" false '' '')
(yesNoOption "ssl_sslv3" "ssl_sslv3" false '' '')
+ ];
- {
- cfgText = if cfg.rsaCertFile == null then ""
- else ''
+ configFile = pkgs.writeText "vsftpd.conf"
+ ''
+ ${concatMapStrings (x: "${x.cfgText}\n") optionDescription}
+ ${optionalString (cfg.rsaCertFile != null) ''
ssl_enable=YES
rsa_cert_file=${cfg.rsaCertFile}
- '';
-
- nixosOption = {
- name = "rsaCertFile";
- value = mkOption {
- default = null;
- description = ''
- rsa certificate file.
- '';
- };
- };
- }
- ];
+ ''}
+ ${optionalString (cfg.userlistFile != null) ''
+ userlist_file=${cfg.userlistFile}
+ ''}
+ background=YES
+ listen=YES
+ nopriv_user=vsftpd
+ secure_chroot_dir=/var/empty
+ syslog_enable=YES
+ ${optionalString (pkgs.stdenv.system == "x86_64-linux") ''
+ seccomp_sandbox=NO
+ ''}
+ anon_umask=${cfg.anonymousUmask}
+ '';
in
@@ -108,10 +111,7 @@ in
userlist = mkOption {
default = [];
-
- description = ''
- See .
- '';
+ description = "See .";
};
userlistFile = mkOption {
@@ -127,13 +127,27 @@ in
};
anonymousUserHome = mkOption {
+ type = types.path;
default = "/home/ftp/";
- description = ''
- Directory to consider the HOME of the anonymous user.
- '';
+ description = ''
+ Directory to consider the HOME of the anonymous user.
+ '';
};
- } // (listToAttrs (catAttrs "nixosOption" optionDescription)) ;
+ rsaCertFile = mkOption {
+ type = types.nullOr types.path;
+ default = null;
+ description = "RSA certificate file.";
+ };
+
+ anonymousUmask = mkOption {
+ type = types.string;
+ default = "077";
+ example = "002";
+ description = "Anonymous write umask.";
+ };
+
+ } // (listToAttrs (catAttrs "nixosOption" optionDescription));
};
@@ -142,14 +156,12 @@ in
config = mkIf cfg.enable {
- assertions = [
- {
- assertion =
+ assertions = singleton
+ { assertion =
(cfg.forceLocalLoginsSSL -> cfg.rsaCertFile != null)
&& (cfg.forceLocalDataSSL -> cfg.rsaCertFile != null);
message = "vsftpd: If forceLocalLoginsSSL or forceLocalDataSSL is true then a rsaCertFile must be provided!";
- }
- ];
+ };
users.extraUsers =
[ { name = "vsftpd";
@@ -157,7 +169,7 @@ in
description = "VSFTPD user";
home = "/homeless-shelter";
}
- ] ++ pkgs.lib.optional cfg.anonymousUser
+ ] ++ optional cfg.anonymousUser
{ name = "ftp";
uid = config.ids.uids.ftp;
group = "ftp";
@@ -165,41 +177,27 @@ in
home = cfg.anonymousUserHome;
};
- users.extraGroups = singleton
- { name = "ftp";
- gid = config.ids.gids.ftp;
- };
+ users.extraGroups.ftp.gid = config.ids.gids.ftp;
# If you really have to access root via FTP use mkOverride or userlistDeny
# = false and whitelist root
services.vsftpd.userlist = if cfg.userlistDeny then ["root"] else [];
- environment.etc."vsftpd.conf".text =
- concatMapStrings (x: "${x.cfgText}\n") optionDescription
- + ''
- ${if cfg.userlistFile == null then ""
- else "userlist_file=${cfg.userlistFile}"}
- background=NO
- listen=YES
- nopriv_user=vsftpd
- secure_chroot_dir=/var/empty
- '';
+ systemd.services.vsftpd =
+ { description = "Vsftpd Server";
- jobs.vsftpd =
- { description = "vsftpd server";
-
- startOn = "started network-interfaces";
- stopOn = "stopping network-interfaces";
+ wantedBy = [ "multi-user.target" ];
preStart =
- ''
- ${if cfg.anonymousUser then ''
+ optionalString cfg.anonymousUser
+ ''
mkdir -p -m 555 ${cfg.anonymousUserHome}
chown -R ftp:ftp ${cfg.anonymousUserHome}
- '' else ""}
- '';
+ '';
- exec = "${vsftpd}/sbin/vsftpd /etc/vsftpd.conf";
+ serviceConfig.ExecStart = "@${vsftpd}/sbin/vsftpd vsftpd ${configFile}";
+ serviceConfig.Restart = "always";
+ serviceConfig.Type = "forking";
};
};
diff --git a/nixos/modules/services/networking/wakeonlan.nix b/nixos/modules/services/networking/wakeonlan.nix
index 1fc54986b16..11bb7e92525 100644
--- a/nixos/modules/services/networking/wakeonlan.nix
+++ b/nixos/modules/services/networking/wakeonlan.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
interfaces = config.services.wakeonlan.interfaces;
diff --git a/nixos/modules/services/networking/websockify.nix b/nixos/modules/services/networking/websockify.nix
index 12042bbad6c..4b76350ecf8 100644
--- a/nixos/modules/services/networking/websockify.nix
+++ b/nixos/modules/services/networking/websockify.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.networking.websockify; in {
options = {
diff --git a/nixos/modules/services/networking/wicd.nix b/nixos/modules/services/networking/wicd.nix
index 8e012273216..18258084fc2 100644
--- a/nixos/modules/services/networking/wicd.nix
+++ b/nixos/modules/services/networking/wicd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix
index 5e5f81ed5a0..771eeecd772 100644
--- a/nixos/modules/services/networking/wpa_supplicant.nix
+++ b/nixos/modules/services/networking/wpa_supplicant.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -46,9 +46,7 @@ in
example = [ "wlan0" "wlan1" ];
description = ''
The interfaces wpa_supplicant will use. If empty, it will
- automatically use all wireless interfaces. (Note that auto-detection is currently
- broken on Linux 3.4.x kernels. See http://github.com/NixOS/nixos/issues/10 for
- further details.)
+ automatically use all wireless interfaces.
'';
};
@@ -92,11 +90,11 @@ in
services.dbus.packages = [ pkgs.wpa_supplicant ];
+ # FIXME: start a separate wpa_supplicant instance per interface.
jobs.wpa_supplicant =
{ description = "WPA Supplicant";
wantedBy = [ "network.target" ];
- after = [ "systemd-udev-settle.service" ];
path = [ pkgs.wpa_supplicant ];
@@ -135,6 +133,12 @@ in
assertions = [{ assertion = !cfg.userControlled.enable || cfg.interfaces != [];
message = "user controlled wpa_supplicant needs explicit networking.wireless.interfaces";}];
+ # Restart wpa_supplicant when a wlan device appears or disappears.
+ services.udev.extraRules =
+ ''
+ ACTION=="add|remove", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", RUN+="${config.systemd.package}/bin/systemctl try-restart wpa_supplicant.service"
+ '';
+
};
}
diff --git a/nixos/modules/services/networking/xinetd.nix b/nixos/modules/services/networking/xinetd.nix
index 626183b810f..14ee52ae52e 100644
--- a/nixos/modules/services/networking/xinetd.nix
+++ b/nixos/modules/services/networking/xinetd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/znc.nix b/nixos/modules/services/networking/znc.nix
new file mode 100644
index 00000000000..4d53cd0750f
--- /dev/null
+++ b/nixos/modules/services/networking/znc.nix
@@ -0,0 +1,328 @@
+{ config, lib, pkgs, ...}:
+
+with lib;
+
+let
+ cfg = config.services.znc;
+
+ defaultUser = "znc"; # Default user to own process.
+
+ # Default user and pass:
+ # un=znc
+ # pw=nixospass
+
+ defaultUserName = "znc";
+ defaultPassBlock = "
+
+ Method = sha256
+ Hash = e2ce303c7ea75c571d80d8540a8699b46535be6a085be3414947d638e48d9e93
+ Salt = l5Xryew4g*!oa(ECfX2o
+
+ ";
+
+ modules = pkgs.buildEnv {
+ name = "znc-modules";
+ paths = cfg.modulePackages;
+ };
+
+ confOptions = { ... }: {
+ options = {
+ modules = mkOption {
+ type = types.listOf types.string;
+ default = [ "partyline" "webadmin" "adminlog" "log" ];
+ example = [ "partyline" "webadmin" "adminlog" "log" ];
+ description = ''
+ A list of modules to include in the `znc.conf` file.
+ '';
+ };
+
+ userModules = mkOption {
+ type = types.listOf types.string;
+ default = [ ];
+ example = [ "fish" "push" ];
+ description = ''
+ A list of user modules to include in the `znc.conf` file.
+ '';
+ };
+
+ userName = mkOption {
+ default = defaultUserName;
+ example = "johntron";
+ type = types.string;
+ description = ''
+ The user name to use when generating the `znc.conf` file.
+ This is the user name used by the user logging into the ZNC web admin.
+ '';
+ };
+
+ nick = mkOption {
+ default = "znc-user";
+ example = "john";
+ type = types.string;
+ description = ''
+ The IRC nick to use when generating the `znc.conf` file.
+ '';
+ };
+
+ passBlock = mkOption {
+ default = defaultPassBlock;
+ example = "Must be the block generated by the `znc --makepass` command.";
+ type = types.string;
+ description = ''
+ The pass block to use when generating the `znc.conf` file.
+ This is the password used by the user logging into the ZNC web admin.
+ This is the block generated by the `znc --makepass` command.
+ !!! If not specified, please change this after starting the service. !!!
+ '';
+ };
+
+ port = mkOption {
+ default = 5000;
+ example = 5000;
+ type = types.int;
+ description = ''
+ Specifies the port on which to listen.
+ '';
+ };
+
+ useSSL = mkOption {
+ default = true;
+ example = true;
+ type = types.bool;
+ description = ''
+ Indicates whether the ZNC server should use SSL when listening on the specified port.
+ '';
+ };
+
+ extraZncConf = mkOption {
+ default = "";
+ type = types.lines;
+ description = ''
+ Extra config to `znc.conf` file
+ '';
+ };
+ };
+ };
+
+ # Keep znc.conf in nix store, then symlink or copy into `dataDir`, depending on `mutable`.
+ mkZncConf = confOpts: ''
+ // Also check http://en.znc.in/wiki/Configuration
+
+ AnonIPLimit = 10
+ ConnectDelay = 5
+ # Add `LoadModule = x` for each module...
+ ${concatMapStrings (n: "LoadModule = ${n}\n") confOpts.modules}
+ MaxBufferSize = 500
+ ProtectWebSessions = true
+ SSLCertFile = ${cfg.dataDir}/znc.pem
+ ServerThrottle = 30
+ Skin = dark-clouds
+ StatusPrefix = *
+ Version = 1.2
+
+
+ AllowIRC = true
+ AllowWeb = true
+ IPv4 = true
+ IPv6 = false
+ Port = ${if confOpts.useSSL then "+" else ""}${toString confOpts.port}
+ SSL = ${if confOpts.useSSL then "true" else "false"}
+
+
+
+ Admin = true
+ Allow = *
+ AltNick = ${confOpts.nick}_
+ AppendTimestamp = false
+ AutoClearChanBuffer = false
+ Buffer = 150
+ ChanModes = +stn
+ DenyLoadMod = false
+ DenySetBindHost = false
+ Ident = ident
+ JoinTries = 10
+ MaxJoins = 0
+ MaxNetworks = 1
+ MultiClients = true
+ Nick = ${confOpts.nick}
+ PrependTimestamp = true
+ QuitMsg = Quit
+ RealName = ${confOpts.nick}
+ TimestampFormat = [%H:%M:%S]
+ ${concatMapStrings (n: "LoadModule = ${n}\n") confOpts.userModules}
+
+ ${confOpts.passBlock}
+
+ ${confOpts.extraZncConf}
+ '';
+
+ zncConfFile = pkgs.writeTextFile {
+ name = "znc.conf";
+ text = if cfg.zncConf != ""
+ then cfg.zncConf
+ else mkZncConf cfg.confOptions;
+ };
+
+in
+
+{
+
+ ###### Interface
+
+ options = {
+ services.znc = {
+ enable = mkOption {
+ default = false;
+ example = true;
+ type = types.bool;
+ description = ''
+ Enable a ZNC service for a user.
+ '';
+ };
+
+ user = mkOption {
+ default = "znc";
+ example = "john";
+ type = types.string;
+ description = ''
+ The name of an existing user account to use to own the ZNC server process.
+ If not specified, a default user will be created to own the process.
+ '';
+ };
+
+ dataDir = mkOption {
+ default = "/var/lib/znc/";
+ example = "/home/john/.znc/";
+ type = types.path;
+ description = ''
+ The data directory. Used for configuration files and modules.
+ '';
+ };
+
+ zncConf = mkOption {
+ default = "";
+ example = "See: http://wiki.znc.in/Configuration";
+ type = types.lines;
+ description = ''
+ The contents of the `znc.conf` file to use when creating it.
+ If specified, `confOptions` will be ignored, and this value, as-is, will be used.
+ If left empty, a conf file with default values will be used.
+ Recommended to generate with `znc --makeconf` command.
+ '';
+ };
+
+ confOptions = mkOption {
+ default = {};
+ example = {
+ modules = [ "log" ];
+ userName = "john";
+ nick = "johntron";
+ };
+ type = types.optionSet;
+ description = ''
+ Values to use when creating a `znc.conf` file.
+ '';
+ options = confOptions;
+ };
+
+ modulePackages = mkOption {
+ type = types.listOf types.package;
+ default = [ ];
+ example = [ pkgs.zncModules.fish pkgs.zncModules.push ];
+ description = ''
+ A list of global znc module packages to add to znc.
+ '';
+ };
+
+ mutable = mkOption {
+ default = false;
+ example = true;
+ type = types.bool;
+ description = ''
+ Indicates whether to allow the contents of the `dataDir` directory to be changed
+ by the user at run-time.
+ If true, modifications to the ZNC configuration after its initial creation are not
+ overwritten by a NixOS system rebuild.
+ If false, the ZNC configuration is rebuilt by every system rebuild.
+ If the user wants to manage the ZNC service using the web admin interface, this value
+ should be set to true.
+ '';
+ };
+
+ extraFlags = mkOption {
+ default = [ ];
+ example = [ "--debug" ];
+ type = types.listOf types.str;
+ description = ''
+ Extra flags to use when executing znc command.
+ '';
+ };
+ };
+ };
+
+
+ ###### Implementation
+
+ config = mkIf cfg.enable {
+
+ systemd.services.znc = {
+ description = "ZNC Server";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.service" ];
+ serviceConfig = {
+ User = cfg.user;
+ Restart = "always";
+ ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
+ ExecStop = "${pkgs.coreutils}/bin/kill -INT $MAINPID";
+ };
+ preStart = ''
+ ${pkgs.coreutils}/bin/mkdir -p ${cfg.dataDir}/configs
+
+ # If mutable, regenerate conf file every time.
+ ${optionalString (!cfg.mutable) ''
+ ${pkgs.coreutils}/echo "znc is set to be system-managed. Now deleting old znc.conf file to be regenerated."
+ ${pkgs.coreutils}/rm -f ${cfg.dataDir}/configs/znc.conf
+ ''}
+
+ # Ensure essential files exist.
+ if [[ ! -f ${cfg.dataDir}/configs/znc.conf ]]; then
+ ${pkgs.coreutils}/bin/echo "No znc.conf file found in ${cfg.dataDir}. Creating one now."
+ ${if (!cfg.mutable)
+ then "${pkgs.coreutils}/bin/ln --force -s ${zncConfFile} ${cfg.dataDir}/.znc/configs/znc.conf"
+ else ''
+ ${pkgs.coreutils}/bin/cp --no-clobber ${zncConfFile} ${cfg.dataDir}/configs/znc.conf
+ ${pkgs.coreutils}/bin/chmod u+rw ${cfg.dataDir}/configs/znc.conf
+ ${pkgs.coreutils}/bin/chown ${cfg.user} ${cfg.dataDir}/configs/znc.conf
+ ''}
+ fi
+
+ if [[ ! -f ${cfg.dataDir}/znc.pem ]]; then
+ ${pkgs.coreutils}/bin/echo "No znc.pem file found in ${cfg.dataDir}. Creating one now."
+ ${pkgs.znc}/bin/znc --makepem --datadir ${cfg.dataDir}
+ fi
+
+ # Symlink modules
+ rm ${cfg.dataDir}/modules || true
+ ln -fs ${modules}/lib/znc ${cfg.dataDir}/modules
+ '';
+ script = "${pkgs.znc}/bin/znc --foreground --datadir ${cfg.dataDir} ${toString cfg.extraFlags}";
+ };
+
+ users.extraUsers = optional (cfg.user == defaultUser)
+ { name = defaultUser;
+ description = "ZNC server daemon owner";
+ group = defaultUser;
+ uid = config.ids.uids.znc;
+ home = cfg.dataDir;
+ createHome = true;
+ createUser = true;
+ };
+
+ users.extraGroups = optional (cfg.user == defaultUser)
+ { name = defaultUser;
+ gid = config.ids.gids.znc;
+ members = [ defaultUser ];
+ };
+
+ };
+}
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index 951cef3eac0..d229c610669 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -56,6 +56,15 @@ in
'';
};
+ listenAddresses = mkOption {
+ type = types.listOf types.str;
+ default = [ "127.0.0.1:631" ];
+ example = [ "*:631" ];
+ description = ''
+ A list of addresses and ports on which to listen.
+ '';
+ };
+
bindirCmds = mkOption {
type = types.lines;
internal = true;
@@ -126,7 +135,8 @@ in
{ description = "CUPS Printing Daemon";
wantedBy = [ "multi-user.target" ];
- after = [ "network-interfaces.target" ];
+ wants = [ "network.target" ];
+ after = [ "network.target" ];
path = [ cups ];
@@ -143,15 +153,19 @@ in
};
services.printing.drivers =
- [ pkgs.cups pkgs.cups_pdf_filter pkgs.ghostscript additionalBackends pkgs.perl pkgs.coreutils pkgs.gnused ];
+ [ pkgs.cups pkgs.cups_pdf_filter pkgs.ghostscript additionalBackends
+ pkgs.perl pkgs.coreutils pkgs.gnused pkgs.bc pkgs.gawk pkgs.gnugrep
+ ];
services.printing.cupsdConf =
''
LogLevel info
- SystemGroup root
+ SystemGroup root wheel
- Listen localhost:631
+ ${concatMapStrings (addr: ''
+ Listen ${addr}
+ '') cfg.listenAddresses}
Listen /var/run/cups/cups.sock
# Note: we can't use ${cups}/etc/cups as the ServerRoot, since
@@ -223,9 +237,6 @@ in
'';
- # Allow CUPS to receive IPP printer announcements via UDP.
- networking.firewall.allowedUDPPorts = [ 631 ];
-
security.pam.services.cups = {};
};
diff --git a/nixos/modules/services/scheduling/atd.nix b/nixos/modules/services/scheduling/atd.nix
index c516c5889f1..c6f128ec402 100644
--- a/nixos/modules/services/scheduling/atd.nix
+++ b/nixos/modules/services/scheduling/atd.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/scheduling/cron.nix b/nixos/modules/services/scheduling/cron.nix
index 44ed1ba5a07..9ce0bcbec7e 100644
--- a/nixos/modules/services/scheduling/cron.nix
+++ b/nixos/modules/services/scheduling/cron.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -15,7 +15,7 @@ let
MAILTO="${config.services.cron.mailto}"
''}
NIX_CONF_DIR=/etc/nix
- ${pkgs.lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)}
+ ${lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)}
'';
# Vixie cron requires build-time configuration for the sendmail path.
diff --git a/nixos/modules/services/scheduling/fcron.nix b/nixos/modules/services/scheduling/fcron.nix
index 0c0811ca6e0..ade8c19329c 100644
--- a/nixos/modules/services/scheduling/fcron.nix
+++ b/nixos/modules/services/scheduling/fcron.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -8,13 +8,16 @@ let
queuelen = if cfg.queuelen == null then "" else "-q ${toString cfg.queuelen}";
+ # Duplicate code, also found in cron.nix. Needs deduplication.
systemCronJobs =
''
SHELL=${pkgs.bash}/bin/bash
PATH=${config.system.path}/bin:${config.system.path}/sbin
- MAILTO="${config.services.cron.mailto}"
+ ${optionalString (config.services.cron.mailto != null) ''
+ MAILTO="${config.services.cron.mailto}"
+ ''}
NIX_CONF_DIR=/etc/nix
- ${pkgs.lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)}
+ ${lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)}
'';
allowdeny = target: users:
diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix
index 9d345e30361..b74ef4370d7 100644
--- a/nixos/modules/services/search/elasticsearch.nix
+++ b/nixos/modules/services/search/elasticsearch.nix
@@ -1,57 +1,68 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.elasticsearch;
- es_home = "/var/lib/elasticsearch";
-
- configFile = pkgs.writeText "elasticsearch.yml" ''
+ esConfig = ''
network.host: ${cfg.host}
- network.port: ${cfg.port}
- network.tcp.port: ${cfg.tcp_port}
+ network.port: ${toString cfg.port}
+ network.tcp.port: ${toString cfg.tcp_port}
cluster.name: ${cfg.cluster_name}
${cfg.extraConf}
'';
+ configDir = pkgs.buildEnv {
+ name = "elasticsearch-config";
+ paths = [
+ (pkgs.writeTextDir "elasticsearch.yml" esConfig)
+ (pkgs.writeTextDir "logging.yml" cfg.logging)
+ ];
+ };
+
+ esPlugins = pkgs.buildEnv {
+ name = "elasticsearch-plugins";
+ paths = cfg.plugins;
+ };
+
in {
###### interface
options.services.elasticsearch = {
enable = mkOption {
- description = "Whether to enable elasticsearch";
+ description = "Whether to enable elasticsearch.";
default = false;
type = types.uniq types.bool;
};
host = mkOption {
- description = "Elasticsearch listen address";
+ description = "Elasticsearch listen address.";
default = "127.0.0.1";
type = types.str;
};
port = mkOption {
- description = "Elasticsearch port to listen for HTTP traffic";
- default = "9200";
- type = types.str;
+ description = "Elasticsearch port to listen for HTTP traffic.";
+ default = 9200;
+ type = types.int;
};
tcp_port = mkOption {
- description = "Elasticsearch port for the node to node communication";
- default = "9300";
- type = types.str;
+ description = "Elasticsearch port for the node to node communication.";
+ default = 9300;
+ type = types.int;
};
cluster_name = mkOption {
- description = "Elasticsearch name that identifies your cluster for auto-discovery";
+ description = "Elasticsearch name that identifies your cluster for auto-discovery.";
default = "elasticsearch";
type = types.str;
};
extraConf = mkOption {
- description = "Extra configuration for elasticsearch";
+ description = "Extra configuration for elasticsearch.";
default = "";
type = types.str;
example = ''
@@ -64,7 +75,7 @@ in {
};
logging = mkOption {
- description = "Elasticsearch logging configuration";
+ description = "Elasticsearch logging configuration.";
default = ''
rootLogger: INFO, console
logger:
@@ -79,27 +90,51 @@ in {
'';
type = types.str;
};
+
+ dataDir = mkOption {
+ type = types.path;
+ default = "/var/lib/elasticsearch";
+ description = ''
+ Data directory for elasticsearch.
+ '';
+ };
+
+ extraCmdLineOptions = mkOption {
+ description = "Extra command line options for the elasticsearch launcher.";
+ default = [];
+ type = types.listOf types.string;
+ example = [ "-Djava.net.preferIPv4Stack=true" ];
+ };
+
+ plugins = mkOption {
+ description = "Extra elasticsearch plugins";
+ default = [];
+ type = types.listOf types.package;
+ };
+
};
###### implementation
config = mkIf cfg.enable {
- environment.etc = [
- { source = configFile;
- target = "elasticsearch/elasticsearch.yml"; }
- { source = pkgs.writeText "logging.yml" cfg.logging;
- target = "elasticsearch/logging.yml"; }
- ];
-
- systemd.services.elasticsearch = mkIf cfg.enable {
- description = "Elasticsearch daemon";
+ systemd.services.elasticsearch = {
+ description = "Elasticsearch Daemon";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
- environment = { ES_HOME = es_home; };
+ environment = { ES_HOME = cfg.dataDir; };
serviceConfig = {
- ExecStart = "${pkgs.elasticsearch}/bin/elasticsearch -f -Des.path.conf=/etc/elasticsearch";
+ ExecStart = "${pkgs.elasticsearch}/bin/elasticsearch -Des.path.conf=${configDir} ${toString cfg.extraCmdLineOptions}";
User = "elasticsearch";
+ PermissionsStartOnly = true;
};
+ preStart = ''
+ mkdir -m 0700 -p ${cfg.dataDir}
+ if [ "$(id -u)" = 0 ]; then chown -R elasticsearch ${cfg.dataDir}; fi
+
+ # Install plugins
+ rm ${cfg.dataDir}/plugins || true
+ ln -s ${esPlugins}/plugins ${cfg.dataDir}/plugins
+ '';
};
environment.systemPackages = [ pkgs.elasticsearch ];
@@ -108,8 +143,7 @@ in {
name = "elasticsearch";
uid = config.ids.uids.elasticsearch;
description = "Elasticsearch daemon user";
- home = es_home;
- createHome = true;
+ home = cfg.dataDir;
};
};
}
diff --git a/nixos/modules/services/search/solr.nix b/nixos/modules/services/search/solr.nix
new file mode 100644
index 00000000000..38d9dedbe3c
--- /dev/null
+++ b/nixos/modules/services/search/solr.nix
@@ -0,0 +1,147 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.solr;
+
+ # Assemble all jars needed for solr
+ solrJars = pkgs.stdenv.mkDerivation {
+ name = "solr-jars";
+
+ src = pkgs.fetchurl {
+ url = http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.36/bin/apache-tomcat-5.5.36.tar.gz;
+ sha256 = "01mzvh53wrs1p2ym765jwd00gl6kn8f9k3nhdrnhdqr8dhimfb2p";
+ };
+
+ buildPhases = [ "unpackPhase" "installPhase" ];
+
+ installPhase = ''
+ mkdir -p $out/lib
+ cp common/lib/*.jar $out/lib/
+ ln -s ${pkgs.ant}/lib/ant/lib/ant.jar $out/lib/
+ ln -s ${cfg.solrPackage}/lib/ext/* $out/lib/
+ ln -s ${pkgs.openjdk}/lib/openjdk/lib/tools.jar $out/lib/
+ '' + optionalString (cfg.extraJars != []) ''
+ for f in ${concatStringsSep " " cfg.extraJars}; do
+ cp $f $out/lib
+ done
+ '';
+ };
+
+in {
+
+ options = {
+ services.solr = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enables the solr service.
+ '';
+ };
+
+ javaPackage = mkOption {
+ type = types.package;
+ default = pkgs.openjre;
+ description = ''
+ Which Java derivation to use for running solr.
+ '';
+ };
+
+ solrPackage = mkOption {
+ type = types.package;
+ default = pkgs.solr;
+ description = ''
+ Which solr derivation to use for running solr.
+ '';
+ };
+
+ extraJars = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = ''
+ List of paths pointing to jars. Jars are copied to commonLibFolder to be available to java/solr.
+ '';
+ };
+
+ log4jConfiguration = mkOption {
+ type = types.lines;
+ default = ''
+ log4j.rootLogger=INFO, stdout
+ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+ log4j.appender.stdout.Target=System.out
+ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+ log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+ '';
+ description = ''
+ Contents of the log4j.properties used. By default,
+ everything is logged to stdout (picked up by systemd) with level INFO.
+ '';
+ };
+
+ user = mkOption {
+ type = types.str;
+ description = ''
+ The user that should run the solr process and.
+ the working directories.
+ '';
+ };
+
+ group = mkOption {
+ type = types.str;
+ description = ''
+ The group that will own the working directory.
+ '';
+ };
+
+ solrHome = mkOption {
+ type = types.str;
+ description = ''
+ The solr home directory. It is your own responsibility to
+ make sure this directory contains a working solr configuration,
+ and is writeable by the the user running the solr service.
+ Failing to do so, the solr will not start properly.
+ '';
+ };
+
+ extraJavaOptions = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Extra command line options given to the java process running
+ solr.
+ '';
+ };
+
+ extraWinstoneOptions = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Extra command line options given to the Winstone, which is
+ the servlet container hosting solr.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+
+ services.winstone.solr = {
+ serviceName = "solr";
+ inherit (cfg) user group javaPackage;
+ warFile = "${cfg.solrPackage}/lib/solr.war";
+ extraOptions = [
+ "--commonLibFolder=${solrJars}/lib"
+ "--useJasper"
+ ] ++ cfg.extraWinstoneOptions;
+ extraJavaOptions = [
+ "-Dsolr.solr.home=${cfg.solrHome}"
+ "-Dlog4j.configuration=file://${pkgs.writeText "log4j.properties" cfg.log4jConfiguration}"
+ ] ++ cfg.extraJavaOptions;
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/security/clamav.nix b/nixos/modules/services/security/clamav.nix
index 5ccb4927fcb..057891a6047 100644
--- a/nixos/modules/services/security/clamav.nix
+++ b/nixos/modules/services/security/clamav.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
clamavUser = "clamav";
stateDir = "/var/lib/clamav";
diff --git a/nixos/modules/services/security/fail2ban.nix b/nixos/modules/services/security/fail2ban.nix
index 395a5df8af0..3758652ebdd 100644
--- a/nixos/modules/services/security/fail2ban.nix
+++ b/nixos/modules/services/security/fail2ban.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -25,12 +25,17 @@ in
options = {
services.fail2ban = {
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = "Whether to enable the fail2ban service.";
+ };
daemonConfig = mkOption {
default =
''
[Definition]
- loglevel = 3
+ loglevel = INFO
logtarget = SYSLOG
socket = /run/fail2ban/fail2ban.sock
pidfile = /run/fail2ban/fail2ban.pid
@@ -80,7 +85,7 @@ in
###### implementation
- config = {
+ config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.fail2ban ];
@@ -101,12 +106,13 @@ in
preStart =
''
mkdir -p /run/fail2ban -m 0755
+ mkdir -p /var/lib/fail2ban
'';
serviceConfig =
{ ExecStart = "${pkgs.fail2ban}/bin/fail2ban-server -f";
ReadOnlyDirectories = "/";
- ReadWriteDirectories = "/run/fail2ban /var/tmp";
+ ReadWriteDirectories = "/run /var/tmp /var/lib";
CapabilityBoundingSet = "CAP_DAC_READ_SEARCH CAP_NET_ADMIN CAP_NET_RAW";
};
@@ -131,15 +137,14 @@ in
bantime = 600
findtime = 600
maxretry = 3
- backend = auto
- '';
+ backend = systemd
+ '';
# Block SSH if there are too many failing connection attempts.
services.fail2ban.jails.ssh-iptables =
''
filter = sshd
action = iptables[name=SSH, port=ssh, protocol=tcp]
- logpath = /var/log/warn
maxretry = 5
'';
diff --git a/nixos/modules/services/security/fprot.nix b/nixos/modules/services/security/fprot.nix
index 9f1fc4ed6d8..7270a9f9814 100644
--- a/nixos/modules/services/security/fprot.nix
+++ b/nixos/modules/services/security/fprot.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
fprotUser = "fprot";
stateDir = "/var/lib/fprot";
@@ -10,33 +10,31 @@ in {
services.fprot = {
updater = {
- enable = mkOption {
- default = false;
- description = ''
- Whether to enable automatic F-Prot virus definitions database updates.
- '';
- };
+ enable = mkOption {
+ default = false;
+ description = ''
+ Whether to enable automatic F-Prot virus definitions database updates.
+ '';
+ };
- productData = mkOption {
- default = "${pkgs.fprot}/opt/f-prot/product.data";
- description = ''
- product.data file. Defaults to the one supplied with installation package.
- '';
- };
+ productData = mkOption {
+ description = ''
+ product.data file. Defaults to the one supplied with installation package.
+ '';
+ };
- frequency = mkOption {
- default = 30;
- description = ''
- Update virus definitions every X minutes.
- '';
- };
+ frequency = mkOption {
+ default = 30;
+ description = ''
+ Update virus definitions every X minutes.
+ '';
+ };
- licenseKeyfile = mkOption {
- default = "${pkgs.fprot}/opt/f-prot/license.key";
- description = ''
- License keyfile. Defaults to the one supplied with installation package.
- '';
- };
+ licenseKeyfile = mkOption {
+ description = ''
+ License keyfile. Defaults to the one supplied with installation package.
+ '';
+ };
};
};
@@ -45,6 +43,10 @@ in {
###### implementation
config = mkIf cfg.updater.enable {
+
+ services.fprot.updater.productData = mkDefault "${pkgs.fprot}/opt/f-prot/product.data";
+ services.fprot.updater.licenseKeyfile = mkDefault "${pkgs.fprot}/opt/f-prot/license.key";
+
environment.systemPackages = [ pkgs.fprot ];
environment.etc = singleton {
source = "${pkgs.fprot}/opt/f-prot/f-prot.conf";
@@ -67,22 +69,22 @@ in {
jobs = {
fprot_updater = {
- name = "fprot-updater";
- task = true;
+ name = "fprot-updater";
+ task = true;
- # have to copy fpupdate executable because it insists on storing the virus database in the same dir
+ # have to copy fpupdate executable because it insists on storing the virus database in the same dir
preStart = ''
mkdir -m 0755 -p ${stateDir}
chown ${fprotUser}:${fprotGroup} ${stateDir}
- cp ${pkgs.fprot}/opt/f-prot/fpupdate ${stateDir}
- ln -sf ${cfg.updater.productData} ${stateDir}/product.data
+ cp ${pkgs.fprot}/opt/f-prot/fpupdate ${stateDir}
+ ln -sf ${cfg.updater.productData} ${stateDir}/product.data
'';
- #setuid = fprotUser;
- #setgid = fprotGroup;
+ #setuid = fprotUser;
+ #setgid = fprotGroup;
exec = "/var/lib/fprot/fpupdate --keyfile ${cfg.updater.licenseKeyfile}";
- };
+ };
};
};
-}
\ No newline at end of file
+}
diff --git a/nixos/modules/services/security/frandom.nix b/nixos/modules/services/security/frandom.nix
index 9aae7b33a43..2d43d12e541 100644
--- a/nixos/modules/services/security/frandom.nix
+++ b/nixos/modules/services/security/frandom.nix
@@ -1,4 +1,4 @@
-{pkgs, config, ...}:
+{lib, config, ...}:
let kernel = config.boot.kernelPackages;
in
@@ -9,9 +9,9 @@ in
options = {
- services.frandom.enable = pkgs.lib.mkOption {
+ services.frandom.enable = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
enable the /dev/frandom device (a very fast random number generator)
'';
@@ -22,7 +22,7 @@ in
###### implementation
- config = pkgs.lib.mkIf config.services.frandom.enable {
+ config = lib.mkIf config.services.frandom.enable {
boot.kernelModules = [ "frandom" ];
boot.extraModulePackages = [ kernel.frandom ];
services.udev.packages = [ kernel.frandom ];
diff --git a/nixos/modules/services/security/haveged.nix b/nixos/modules/services/security/haveged.nix
new file mode 100644
index 00000000000..1d52ed55dbd
--- /dev/null
+++ b/nixos/modules/services/security/haveged.nix
@@ -0,0 +1,63 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.haveged;
+
+in
+
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.haveged = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable to haveged entropy daemon, which refills
+ /dev/random when low.
+ '';
+ };
+
+ refill_threshold = mkOption {
+ type = types.int;
+ default = 1024;
+ description = ''
+ The number of bits of available entropy beneath which
+ haveged should refill the entropy pool.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ systemd.services.haveged =
+ { description = "Entropy Harvesting Daemon";
+ unitConfig.documentation = "man:haveged(8)";
+ wantedBy = [ "multi-user.target" ];
+
+ path = [ pkgs.haveged ];
+
+ serviceConfig =
+ { Type = "forking";
+ ExecStart = "${pkgs.haveged}/sbin/haveged -w ${toString cfg.refill_threshold} -v 1";
+ PIDFile = "/run/haveged.pid";
+ };
+ };
+
+ };
+
+}
\ No newline at end of file
diff --git a/nixos/modules/services/security/tor.nix b/nixos/modules/services/security/tor.nix
index e70eb8511a6..582dd124c29 100644
--- a/nixos/modules/services/security/tor.nix
+++ b/nixos/modules/services/security/tor.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/security/torify.nix b/nixos/modules/services/security/torify.nix
index 1c158906a91..53f48a714b4 100644
--- a/nixos/modules/services/security/torify.nix
+++ b/nixos/modules/services/security/torify.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.tor;
diff --git a/nixos/modules/services/security/torsocks.nix b/nixos/modules/services/security/torsocks.nix
index d6974282a6b..ede6c983677 100644
--- a/nixos/modules/services/security/torsocks.nix
+++ b/nixos/modules/services/security/torsocks.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.tor;
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index cb5110f6feb..928f16c9448 100644
--- a/nixos/modules/services/system/dbus.nix
+++ b/nixos/modules/services/system/dbus.nix
@@ -1,8 +1,8 @@
# D-Bus configuration and system bus daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -14,9 +14,9 @@ let
name = "dbus-conf";
preferLocalBuild = true;
buildCommand = ''
- ensureDir $out
+ mkdir -p $out
- cp -v ${pkgs.dbus_daemon}/etc/dbus-1/system.conf $out/system.conf
+ cp -v ${pkgs.dbus.daemon}/etc/dbus-1/system.conf $out/system.conf
# !!! Hm, these `sed' calls are rather error-prone...
@@ -31,7 +31,7 @@ let
-e 's||${systemServiceDirs}|' \
-e 's|system.d|${systemIncludeDirs}|'
- cp ${pkgs.dbus_daemon}/etc/dbus-1/session.conf $out/session.conf
+ cp ${pkgs.dbus.daemon}/etc/dbus-1/session.conf $out/session.conf
# Add the services and session.d directories to the session bus
# search path.
@@ -97,7 +97,7 @@ in
config = mkIf cfg.enable {
- environment.systemPackages = [ pkgs.dbus_daemon pkgs.dbus_tools ];
+ environment.systemPackages = [ pkgs.dbus.daemon pkgs.dbus_tools ];
environment.etc = singleton
{ source = configDir;
@@ -113,30 +113,7 @@ in
users.extraGroups.messagebus.gid = config.ids.gids.messagebus;
- # FIXME: these are copied verbatim from the dbus source tree. We
- # should install and use the originals.
- systemd.units."dbus.socket".text =
- ''
- [Unit]
- Description=D-Bus System Message Bus Socket
-
- [Socket]
- ListenStream=/var/run/dbus/system_bus_socket
- '';
-
- systemd.units."dbus.service".text =
- ''
- [Unit]
- Description=D-Bus System Message Bus
- Requires=dbus.socket
-
- [Service]
- ExecStartPre=${pkgs.dbus_tools}/bin/dbus-uuidgen --ensure
- ExecStartPre=-${pkgs.coreutils}/bin/rm -f /var/run/dbus/pid
- ExecStart=${pkgs.dbus_daemon}/bin/dbus-daemon --system --address=systemd: --nofork --systemd-activation
- ExecReload=${pkgs.dbus_tools}/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
- OOMScoreAdjust=-900
- '';
+ systemd.packages = [ pkgs.dbus.daemon ];
security.setuidOwners = singleton
{ program = "dbus-daemon-launch-helper";
diff --git a/nixos/modules/services/system/kerberos.nix b/nixos/modules/services/system/kerberos.nix
index 8fb5debd20e..3a0171ca1b9 100644
--- a/nixos/modules/services/system/kerberos.nix
+++ b/nixos/modules/services/system/kerberos.nix
@@ -1,8 +1,8 @@
-{pkgs, config, ...}:
+{pkgs, config, lib, ...}:
let
- inherit (pkgs.lib) mkOption mkIf singleton;
+ inherit (lib) mkOption mkIf singleton;
inherit (pkgs) heimdal;
@@ -36,7 +36,7 @@ in
environment.systemPackages = [ heimdal ];
services.xinetd.enable = true;
- services.xinetd.services = pkgs.lib.singleton
+ services.xinetd.services = lib.singleton
{ name = "kerberos-adm";
flags = "REUSE NAMEINARGS";
protocol = "tcp";
diff --git a/nixos/modules/services/system/nscd.nix b/nixos/modules/services/system/nscd.nix
index b817b1df779..5460e962ea2 100644
--- a/nixos/modules/services/system/nscd.nix
+++ b/nixos/modules/services/system/nscd.nix
@@ -1,12 +1,15 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
nssModulesPath = config.system.nssModules.path;
+ cfg = config.services.nscd;
- inherit (pkgs.lib) singleton;
+ inherit (lib) singleton;
+
+ cfgFile = pkgs.writeText "nscd.conf" cfg.config;
in
@@ -24,6 +27,12 @@ in
description = "Whether to enable the Name Service Cache Daemon.";
};
+ config = mkOption {
+ type = types.lines;
+ default = builtins.readFile ./nscd.conf;
+ description = "Configuration to use for Name Service Cache Daemon.";
+ };
+
};
};
@@ -31,7 +40,7 @@ in
###### implementation
- config = mkIf config.services.nscd.enable {
+ config = mkIf cfg.enable {
users.extraUsers = singleton
{ name = "nscd";
@@ -56,7 +65,7 @@ in
restartTriggers = [ config.environment.etc.hosts.source ];
serviceConfig =
- { ExecStart = "@${pkgs.glibc}/sbin/nscd nscd -f ${./nscd.conf}";
+ { ExecStart = "@${pkgs.glibc}/sbin/nscd nscd -f ${cfgFile}";
Type = "forking";
PIDFile = "/run/nscd/nscd.pid";
Restart = "always";
@@ -66,6 +75,15 @@ in
"${pkgs.glibc}/sbin/nscd --invalidate hosts"
];
};
+
+ # Urgggggh... Nscd forks before opening its socket and writing
+ # its pid. So wait until it's ready.
+ postStart =
+ ''
+ while ! ${pkgs.glibc}/sbin/nscd -g -f ${cfgFile} > /dev/null; do
+ sleep 0.2
+ done
+ '';
};
};
diff --git a/nixos/modules/services/system/uptimed.nix b/nixos/modules/services/system/uptimed.nix
index 61eecd5c9ba..ab46c508914 100644
--- a/nixos/modules/services/system/uptimed.nix
+++ b/nixos/modules/services/system/uptimed.nix
@@ -1,8 +1,8 @@
-{pkgs, config, ...}:
+{pkgs, config, lib, ...}:
let
- inherit (pkgs.lib) mkOption mkIf singleton;
+ inherit (lib) mkOption mkIf singleton;
inherit (pkgs) uptimed;
diff --git a/nixos/modules/services/torrent/deluge.nix b/nixos/modules/services/torrent/deluge.nix
index e0c212e5661..00df4042d89 100644
--- a/nixos/modules/services/torrent/deluge.nix
+++ b/nixos/modules/services/torrent/deluge.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.deluge;
diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix
index 063332d4862..02db4a7a5b2 100644
--- a/nixos/modules/services/torrent/transmission.nix
+++ b/nixos/modules/services/torrent/transmission.nix
@@ -1,13 +1,14 @@
-# NixOS module for Transmission BitTorrent daemon
+{ config, lib, pkgs, ... }:
-{ config, pkgs, ... }:
-
-with pkgs.lib;
+with lib;
let
-
cfg = config.services.transmission;
+ apparmor = config.security.apparmor.enable;
+
homeDir = "/var/lib/transmission";
+ downloadDir = "${homeDir}/Downloads";
+ incompleteDir = "${homeDir}/.incomplete";
settingsDir = "${homeDir}/.config/transmission-daemon";
settingsFile = "${settingsDir}/settings.json";
@@ -15,7 +16,7 @@ let
toOption = x:
if x == true then "true"
else if x == false then "false"
- else if builtins.isInt x then toString x
+ else if isInt x then toString x
else toString ''\"${x}\"'';
# All lines in settings.json end with a ',' (comma), except for the last
@@ -31,16 +32,12 @@ let
(if isList value then value else [value]))
as));
+ # for users in group "transmission" to have access to torrents
+ fullSettings = cfg.settings // { umask = 2; };
in
-
{
-
- ### configuration
-
options = {
-
services.transmission = {
-
enable = mkOption {
type = types.uniq types.bool;
default = false;
@@ -59,65 +56,48 @@ in
type = types.attrs;
default =
{
- # for users in group "transmission" to have access to torrents
- umask = 2;
- }
- ;
+ download-dir = downloadDir;
+ incomplete-dir = incompleteDir;
+ incomplete-dir-enabled = true;
+ };
example =
{
download-dir = "/srv/torrents/";
incomplete-dir = "/srv/torrents/.incomplete/";
incomplete-dir-enabled = true;
rpc-whitelist = "127.0.0.1,192.168.*.*";
- # for users in group "transmission" to have access to torrents
- umask = 2;
- }
- ;
+ };
description = ''
Attribute set whos fields overwrites fields in settings.json (each
time the service starts). String values must be quoted, integer and
boolean values must not.
- See https://trac.transmissionbt.com/wiki/EditConfigFiles for documentation
- and/or look at ${settingsFile}."
+ See https://trac.transmissionbt.com/wiki/EditConfigFiles for
+ documentation and/or look at ${settingsFile}.
'';
};
- rpc_port = mkOption {
+ port = mkOption {
type = types.uniq types.int;
default = 9091;
description = "TCP port number to run the RPC/web interface.";
};
-
- apparmor = mkOption {
- type = types.uniq types.bool;
- default = true;
- description = "Generate apparmor profile for transmission-daemon.";
- };
};
-
};
- ### implementation
-
config = mkIf cfg.enable {
-
systemd.services.transmission = {
- description = "Transmission BitTorrent Daemon";
- after = [ "network.target" ] ++ optional (config.security.apparmor.enable && cfg.apparmor) "apparmor.service";
- requires = mkIf (config.security.apparmor.enable && cfg.apparmor) [ "apparmor.service" ];
+ description = "Transmission BitTorrent Service";
+ after = [ "network.target" ] ++ optional apparmor "apparmor.service";
+ requires = mkIf apparmor [ "apparmor.service" ];
wantedBy = [ "multi-user.target" ];
# 1) Only the "transmission" user and group have access to torrents.
# 2) Optionally update/force specific fields into the configuration file.
- serviceConfig.ExecStartPre =
- if cfg.settings != {} then ''
- ${pkgs.stdenv.shell} -c "chmod 770 ${homeDir} && mkdir -p ${settingsDir} && ${pkgs.transmission}/bin/transmission-daemon -d |& sed ${attrsToSedArgs cfg.settings} > ${settingsFile}.tmp && mv ${settingsFile}.tmp ${settingsFile}"
- ''
- else ''
- ${pkgs.stdenv.shell} -c "chmod 770 ${homeDir}"
- '';
- serviceConfig.ExecStart = "${pkgs.transmission}/bin/transmission-daemon -f --port ${toString config.services.transmission.rpc_port}";
+ serviceConfig.ExecStartPre = ''
+ ${pkgs.stdenv.shell} -c "chmod 770 ${homeDir} && mkdir -p ${settingsDir} ${downloadDir} ${incompleteDir} && ${pkgs.transmission}/bin/transmission-daemon -d |& sed ${attrsToSedArgs fullSettings} > ${settingsFile}.tmp && mv ${settingsFile}.tmp ${settingsFile}"
+ '';
+ serviceConfig.ExecStart = "${pkgs.transmission}/bin/transmission-daemon -f --port ${toString config.services.transmission.port}";
serviceConfig.ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
serviceConfig.User = "transmission";
# NOTE: transmission has an internal umask that also must be set (in settings.json)
@@ -127,6 +107,7 @@ in
# It's useful to have transmission in path, e.g. for remote control
environment.systemPackages = [ pkgs.transmission ];
+ users.extraGroups.transmission.gid = config.ids.gids.transmission;
users.extraUsers.transmission = {
group = "transmission";
uid = config.ids.uids.transmission;
@@ -135,10 +116,8 @@ in
createHome = true;
};
- users.extraGroups.transmission.gid = config.ids.gids.transmission;
-
# AppArmor profile
- security.apparmor.profiles = mkIf (config.security.apparmor.enable && cfg.apparmor) [
+ security.apparmor.profiles = mkIf apparmor [
(pkgs.writeText "apparmor-transmission-daemon" ''
#include
@@ -146,13 +125,17 @@ in
#include
#include
- ${pkgs.glibc}/lib/*.so mr,
- ${pkgs.libevent}/lib/libevent*.so* mr,
- ${pkgs.curl}/lib/libcurl*.so* mr,
- ${pkgs.openssl}/lib/libssl*.so* mr,
- ${pkgs.openssl}/lib/libcrypto*.so* mr,
- ${pkgs.zlib}/lib/libz*.so* mr,
- ${pkgs.libssh2}/lib/libssh2*.so* mr,
+ ${pkgs.glibc}/lib/*.so mr,
+ ${pkgs.libevent}/lib/libevent*.so* mr,
+ ${pkgs.curl}/lib/libcurl*.so* mr,
+ ${pkgs.openssl}/lib/libssl*.so* mr,
+ ${pkgs.openssl}/lib/libcrypto*.so* mr,
+ ${pkgs.zlib}/lib/libz*.so* mr,
+ ${pkgs.libssh2}/lib/libssh2*.so* mr,
+ ${pkgs.systemd}/lib/libsystemd*.so* mr,
+ ${pkgs.xz}/lib/liblzma*.so* mr,
+ ${pkgs.libgcrypt}/lib/libgcrypt*.so* mr,
+ ${pkgs.libgpgerror}/lib/libgpg-error*.so* mr,
@{PROC}/sys/kernel/random/uuid r,
@{PROC}/sys/vm/overcommit_memory r,
@@ -161,9 +144,9 @@ in
owner ${settingsDir}/** rw,
- ${cfg.settings.download-dir}/** rw,
- ${optionalString cfg.settings.incomplete-dir-enabled ''
- ${cfg.settings.incomplete-dir}/** rw,
+ ${fullSettings.download-dir}/** rw,
+ ${optionalString fullSettings.incomplete-dir-enabled ''
+ ${fullSettings.incomplete-dir}/** rw,
''}
}
'')
diff --git a/nixos/modules/services/ttys/agetty.nix b/nixos/modules/services/ttys/agetty.nix
index ae4fa87d4b7..df21ebbd974 100644
--- a/nixos/modules/services/ttys/agetty.nix
+++ b/nixos/modules/services/ttys/agetty.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -28,6 +28,17 @@ with pkgs.lib;
'';
};
+ serialSpeed = mkOption {
+ type = types.listOf types.int;
+ default = [ 115200 57600 38400 9600 ];
+ example = [ 38400 9600 ];
+ description = ''
+ Bitrates to allow for agetty's listening on serial ports. Listing more
+ bitrates gives more interoperability but at the cost of long delays
+ for getting a sync on the line.
+ '';
+ };
+
};
};
@@ -37,81 +48,23 @@ with pkgs.lib;
config = {
- # FIXME: these are mostly copy/pasted from the systemd sources,
- # which some small modifications, which is annoying.
+ systemd.services."getty@" =
+ { serviceConfig.ExecStart = "@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login --keep-baud %I 115200,38400,9600 $TERM";
+ restartIfChanged = false;
+ };
- # Generate a separate job for each tty.
- systemd.units."getty@.service".text =
- ''
- [Unit]
- Description=Getty on %I
- Documentation=man:agetty(8)
- After=systemd-user-sessions.service plymouth-quit-wait.service
+ systemd.services."serial-getty@" =
+ { serviceConfig.ExecStart =
+ let speeds = concatStringsSep "," (map toString config.services.mingetty.serialSpeed);
+ in "@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I ${speeds} $TERM";
+ restartIfChanged = false;
+ };
- # If additional gettys are spawned during boot then we should make
- # sure that this is synchronized before getty.target, even though
- # getty.target didn't actually pull it in.
- Before=getty.target
- IgnoreOnIsolate=yes
-
- ConditionPathExists=/dev/tty0
-
- [Service]
- Environment=TERM=linux
- Environment=LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
- ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login %I 38400
- Type=idle
- Restart=always
- RestartSec=0
- UtmpIdentifier=%I
- TTYPath=/dev/%I
- TTYReset=yes
- TTYVHangup=yes
- TTYVTDisallocate=yes # set to no to prevent clearing the screen
- KillMode=process
- IgnoreSIGPIPE=no
-
- # Some login implementations ignore SIGTERM, so we send SIGHUP
- # instead, to ensure that login terminates cleanly.
- KillSignal=SIGHUP
-
- X-RestartIfChanged=false
- '';
-
- systemd.units."serial-getty@.service".text =
- ''
- [Unit]
- Description=Serial Getty on %I
- Documentation=man:agetty(8) man:systemd-getty-generator(8)
- BindsTo=dev-%i.device
- After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
-
- # If additional gettys are spawned during boot then we should make
- # sure that this is synchronized before getty.target, even though
- # getty.target didn't actually pull it in.
- Before=getty.target
- IgnoreOnIsolate=yes
-
- [Service]
- Environment=TERM=linux
- Environment=LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
- ExecStart=@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I 115200,57600,38400,9600
- Type=idle
- Restart=always
- RestartSec=0
- UtmpIdentifier=%I
- TTYPath=/dev/%I
- TTYReset=yes
- TTYVHangup=yes
- KillMode=process
- IgnoreSIGPIPE=no
-
- # Some login implementations ignore SIGTERM, so we send SIGHUP
- # instead, to ensure that login terminates cleanly.
- KillSignal=SIGHUP
-
- X-RestartIfChanged=false
- '';
+ systemd.services."container-getty@" =
+ { unitConfig.ConditionPathExists = "/dev/pts/%I"; # Work around being respawned when "machinectl login" exits.
+ serviceConfig.ExecStart = "@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login --keep-baud pts/%I 115200,38400,9600 $TERM";
+ restartIfChanged = false;
+ };
environment.etc = singleton
{ # Friendly greeting on the virtual consoles.
diff --git a/nixos/modules/services/ttys/gpm.nix b/nixos/modules/services/ttys/gpm.nix
index 74cee67aeae..308a6d3643a 100644
--- a/nixos/modules/services/ttys/gpm.nix
+++ b/nixos/modules/services/ttys/gpm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -40,12 +40,16 @@ in
config = mkIf cfg.enable {
- jobs.gpm =
- { description = "General purpose mouse";
+ systemd.services.gpm =
+ { description = "Console Mouse Daemon";
- startOn = "started udev";
+ wantedBy = [ "multi-user.target" ];
+ requires = [ "dev-input-mice.device" ];
+ after = [ "dev-input-mice.device" ];
- exec = "${pkgs.gpm}/sbin/gpm -m /dev/input/mice -t ${cfg.protocol} -D &>/dev/null";
+ serviceConfig.ExecStart = "@${pkgs.gpm}/sbin/gpm gpm -m /dev/input/mice -t ${cfg.protocol}";
+ serviceConfig.Type = "forking";
+ serviceConfig.PIDFile = "/run/gpm.pid";
};
};
diff --git a/nixos/modules/services/ttys/kmscon.nix b/nixos/modules/services/ttys/kmscon.nix
new file mode 100644
index 00000000000..7783a1ada71
--- /dev/null
+++ b/nixos/modules/services/ttys/kmscon.nix
@@ -0,0 +1,81 @@
+{ config, pkgs, lib, ... }:
+let
+ inherit (lib) mkOption types mkIf optionalString;
+
+ cfg = config.services.kmscon;
+
+ configDir = pkgs.writeTextFile { name = "kmscon-config"; destination = "/kmscon.conf"; text = cfg.extraConfig; };
+in {
+ options = {
+ services.kmscon = {
+ enable = mkOption {
+ description = ''
+ Use kmscon as the virtual console instead of gettys.
+ kmscon is a kms/dri-based userspace virtual terminal implementation.
+ It supports a richer feature set than the standard linux console VT,
+ including full unicode support, and when the video card supports drm
+ should be much faster.
+ '';
+ type = types.bool;
+ default = false;
+ };
+
+ hwRender = mkOption {
+ description = "Whether to use 3D hardware acceleration to render the console.";
+ type = types.bool;
+ default = false;
+ };
+
+ extraConfig = mkOption {
+ description = "Extra contents of the kmscon.conf file.";
+ type = types.lines;
+ default = "";
+ example = "font-size=14";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ # Largely copied from unit provided with kmscon source
+ systemd.units."kmsconvt@.service".text = ''
+ [Unit]
+ Description=KMS System Console on %I
+ Documentation=man:kmscon(1)
+ After=systemd-user-sessions.service
+ After=plymouth-quit-wait.service
+ After=systemd-logind.service
+ After=systemd-vconsole-setup.service
+ Requires=systemd-logind.service
+ Before=getty.target
+ Conflicts=getty@%i.service
+ OnFailure=getty@%i.service
+ IgnoreOnIsolate=yes
+ ConditionPathExists=/dev/tty0
+
+ [Service]
+ ExecStart=${pkgs.kmscon}/bin/kmscon "--vt=%I" --seats=seat0 --no-switchvt --configdir ${configDir} --login -- ${pkgs.shadow}/bin/login -p
+ UtmpIdentifier=%I
+ TTYPath=/dev/%I
+ TTYReset=yes
+ TTYVHangup=yes
+ TTYVTDisallocate=yes
+
+ X-RestartIfChanged=false
+ '';
+
+ systemd.units."autovt@.service".unit = pkgs.runCommand "unit" { }
+ ''
+ mkdir -p $out
+ ln -s ${config.systemd.units."kmsconvt@.service".unit}/kmsconvt@.service $out/autovt@.service
+ '';
+
+ systemd.services.systemd-vconsole-setup.restartIfChanged = false;
+
+ services.kmscon.extraConfig = mkIf cfg.hwRender ''
+ drm
+ hwaccel
+ '';
+
+ hardware.opengl.enable = mkIf cfg.hwRender true;
+ };
+}
diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index d21b6da0e77..78f3cf2b7e4 100644
--- a/nixos/modules/services/web-servers/apache-httpd/default.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/default.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -17,8 +17,8 @@ let
getPort = cfg: if cfg.port != 0 then cfg.port else if cfg.enableSSL then 443 else 80;
extraModules = attrByPath ["extraModules"] [] mainCfg;
- extraForeignModules = filter builtins.isAttrs extraModules;
- extraApacheModules = filter (x: !(builtins.isAttrs x)) extraModules; # I'd prefer using builtins.isString here, but doesn't exist yet
+ extraForeignModules = filter isAttrs extraModules;
+ extraApacheModules = filter isString extraModules;
makeServerInfo = cfg: {
@@ -63,8 +63,9 @@ let
enablePHP = false;
phpOptions = "";
options = {};
+ documentRoot = null;
};
- res = defaults // svcFunction { inherit config pkgs serverInfo php; };
+ res = defaults // svcFunction { inherit config lib pkgs serverInfo php; };
in res;
in map f defs;
@@ -79,7 +80,7 @@ let
# !!! should be in lib
writeTextInDir = name: text:
- pkgs.runCommand name {inherit text;} "ensureDir $out; echo -n \"$text\" > $out/$name";
+ pkgs.runCommand name {inherit text;} "mkdir -p $out; echo -n \"$text\" > $out/$name";
enableSSL = any (vhost: vhost.enableSSL) allHosts;
@@ -188,8 +189,12 @@ let
subservices = callSubservices serverInfo cfg.extraSubservices;
- documentRoot = if cfg.documentRoot != null then cfg.documentRoot else
- pkgs.runCommand "empty" {} "ensureDir $out";
+ maybeDocumentRoot = fold (svc: acc:
+ if acc == null then svc.documentRoot else assert svc.documentRoot == null; acc
+ ) null ([ cfg ] ++ subservices);
+
+ documentRoot = if maybeDocumentRoot != null then maybeDocumentRoot else
+ pkgs.runCommand "empty" {} "mkdir -p $out";
documentRootConf = ''
DocumentRoot "${documentRoot}"
@@ -240,7 +245,7 @@ let
${robotsConf}
- ${if isMainServer || cfg.documentRoot != null then documentRootConf else ""}
+ ${if isMainServer || maybeDocumentRoot != null then documentRootConf else ""}
${if cfg.enableUserDir then ''
@@ -260,7 +265,7 @@ let
'' else ""}
- ${if cfg.globalRedirect != null then ''
+ ${if cfg.globalRedirect != null && cfg.globalRedirect != "" then ''
RedirectPermanent / ${cfg.globalRedirect}
'' else ""}
@@ -382,7 +387,7 @@ let
'';
- enablePHP = any (svc: svc.enablePHP) allSubservices;
+ enablePHP = mainCfg.enablePHP || any (svc: svc.enablePHP) allSubservices;
# Generate the PHP configuration file. Should probably be factored
@@ -414,7 +419,7 @@ in
};
package = mkOption {
- type = types.path;
+ type = types.package;
default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; };
example = "pkgs.apacheHttpd_2_4";
description = ''
@@ -445,7 +450,7 @@ in
extraModules = mkOption {
type = types.listOf types.unspecified;
default = [];
- example = literalExample ''[ "proxy_connect" { name = "php5"; path = "''${php}/modules/libphp5.so"; } ]'';
+ example = literalExample ''[ "proxy_connect" { name = "php5"; path = "''${pkgs.php}/modules/libphp5.so"; } ]'';
description = ''
Additional Apache modules to be used. These can be
specified as a string in the case of modules distributed
@@ -505,7 +510,7 @@ in
virtualHosts = mkOption {
type = types.listOf (types.submodule (
{ options = import ./per-server-options.nix {
- inherit pkgs;
+ inherit lib;
forMainServer = false;
};
}));
@@ -526,6 +531,12 @@ in
'';
};
+ enablePHP = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the PHP module.";
+ };
+
phpOptions = mkOption {
type = types.lines;
default = "";
@@ -572,7 +583,7 @@ in
# Include the options shared between the main server and virtual hosts.
// (import ./per-server-options.nix {
- inherit pkgs;
+ inherit lib;
forMainServer = true;
});
@@ -582,18 +593,24 @@ in
###### implementation
config = mkIf config.services.httpd.enable {
+
+ assertions = [ { assertion = mainCfg.enableSSL == true
+ -> mainCfg.sslServerCert != null
+ && mainCfg.sslServerKey != null;
+ message = "SSL is enabled for HTTPD, but sslServerCert and/or sslServerKey haven't been specified."; }
+ ];
- users.extraUsers = optionalAttrs (mainCfg.user == "wwwrun") singleton
+ users.extraUsers = optionalAttrs (mainCfg.user == "wwwrun") (singleton
{ name = "wwwrun";
- group = "wwwrun";
+ group = mainCfg.group;
description = "Apache httpd user";
uid = config.ids.uids.wwwrun;
- };
+ });
- users.extraGroups = optionalAttrs (mainCfg.group == "wwwrun") singleton
+ users.extraGroups = optionalAttrs (mainCfg.group == "wwwrun") (singleton
{ name = "wwwrun";
gid = config.ids.gids.wwwrun;
- };
+ });
environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices;
@@ -610,7 +627,7 @@ in
{ description = "Apache HTTPD";
wantedBy = [ "multi-user.target" ];
- requires = [ "keys.target" ];
+ wants = [ "keys.target" ];
after = [ "network.target" "fs.target" "postgresql.service" "keys.target" ];
path =
@@ -622,16 +639,16 @@ in
++ concatMap (svc: svc.extraServerPath) allSubservices;
environment =
- { PHPRC = if enablePHP then phpIni else "";
- } // (listToAttrs (concatMap (svc: svc.globalEnvVars) allSubservices));
+ optionalAttrs enablePHP { PHPRC = phpIni; }
+ // (listToAttrs (concatMap (svc: svc.globalEnvVars) allSubservices));
preStart =
''
mkdir -m 0750 -p ${mainCfg.stateDir}
- chown root.${mainCfg.group} ${mainCfg.stateDir}
+ [ $(id -u) != 0 ] || chown root.${mainCfg.group} ${mainCfg.stateDir}
${optionalString version24 ''
mkdir -m 0750 -p "${mainCfg.stateDir}/runtime"
- chown root.${mainCfg.group} "${mainCfg.stateDir}/runtime"
+ [ $(id -u) != 0 ] || chown root.${mainCfg.group} "${mainCfg.stateDir}/runtime"
''}
mkdir -m 0700 -p ${mainCfg.logDir}
@@ -659,6 +676,7 @@ in
serviceConfig.ExecStart = "@${httpd}/bin/httpd httpd -f ${httpdConf}";
serviceConfig.ExecStop = "${httpd}/bin/httpd -f ${httpdConf} -k graceful-stop";
serviceConfig.Type = "forking";
+ serviceConfig.PIDFile = "${mainCfg.stateDir}/httpd.pid";
serviceConfig.Restart = "always";
};
diff --git a/nixos/modules/services/web-servers/apache-httpd/mediawiki-postgresql-fixes.patch b/nixos/modules/services/web-servers/apache-httpd/mediawiki-postgresql-fixes.patch
new file mode 100644
index 00000000000..c46d492dc7a
--- /dev/null
+++ b/nixos/modules/services/web-servers/apache-httpd/mediawiki-postgresql-fixes.patch
@@ -0,0 +1,22 @@
+diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php
+index f739d3b..fdd8db3 100644
+--- a/includes/specials/SpecialActiveusers.php
++++ b/includes/specials/SpecialActiveusers.php
+@@ -112,7 +112,7 @@ class ActiveUsersPager extends UsersPager {
+ return array(
+ 'tables' => array( 'querycachetwo', 'user', 'recentchanges' ),
+ 'fields' => array( 'user_name', 'user_id', 'recentedits' => 'COUNT(*)', 'qcc_title' ),
+- 'options' => array( 'GROUP BY' => array( 'qcc_title' ) ),
++ 'options' => array( 'GROUP BY' => array( 'qcc_title', 'user_name', 'user_id' ) ),
+ 'conds' => $conds
+ );
+ }
+@@ -349,7 +349,7 @@ class SpecialActiveUsers extends SpecialPage {
+ __METHOD__,
+ array(
+ 'GROUP BY' => array( 'rc_user_text' ),
+- 'ORDER BY' => 'NULL' // avoid filesort
++ 'ORDER BY' => 'lastedittime DESC'
+ )
+ );
+ $names = array();
diff --git a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix
index dcc05b03891..aa9aec87f0c 100644
--- a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, serverInfo, php, ... }:
+{ config, lib, pkgs, serverInfo, php, ... }:
-with pkgs.lib;
+with lib;
let
@@ -72,13 +72,15 @@ let
# Unpack Mediawiki and put the config file in its root directory.
mediawikiRoot = pkgs.stdenv.mkDerivation rec {
- name= "mediawiki-1.20.5";
+ name= "mediawiki-1.23.1";
src = pkgs.fetchurl {
- url = "http://download.wikimedia.org/mediawiki/1.20/${name}.tar.gz";
- sha256 = "0ix6khrilfdncjqnh41xjs0bd49i1q0rywycjaixjfpwj6vjbqbl";
+ url = "http://download.wikimedia.org/mediawiki/1.23/${name}.tar.gz";
+ sha256 = "07z5j8d988cdg4ml4n0vs9fwmj0p594ibbqdid16faxwqm52dkhl";
};
+ patches = [ ./mediawiki-postgresql-fixes.patch ];
+
skins = config.skins;
buildPhase =
@@ -90,16 +92,21 @@ let
installPhase =
''
- ensureDir $out
+ mkdir -p $out
cp -r * $out
cp ${mediawikiConfig} $out/LocalSettings.php
+ sed -i \
+ -e 's|/bin/bash|${pkgs.bash}/bin/bash|g' \
+ -e 's|/usr/bin/timeout|${pkgs.coreutils}/bin/timeout|g' \
+ $out/includes/limit.sh \
+ $out/includes/GlobalFunctions.php
'';
};
mediawikiScripts = pkgs.runCommand "mediawiki-${config.id}-scripts"
{ buildInputs = [ pkgs.makeWrapper ]; }
''
- ensureDir $out/bin
+ mkdir -p $out/bin
for i in changePassword.php createAndPromote.php userOptions.php edit.php nukePage.php update.php; do
makeWrapper ${php}/bin/php $out/bin/mediawiki-${config.id}-$(basename $i .php) \
--add-flags ${mediawikiRoot}/maintenance/$i
@@ -122,7 +129,18 @@ in
''}
- Alias ${config.urlPrefix} ${mediawikiRoot}
+ ${if config.urlPrefix != "" then "Alias ${config.urlPrefix} ${mediawikiRoot}" else ''
+ RewriteEngine On
+ RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
+ RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
+ RewriteRule ${if config.enableUploads
+ then "!^/images"
+ else "^.*\$"
+ } %{DOCUMENT_ROOT}/${if config.articleUrlPrefix == ""
+ then ""
+ else "${config.articleUrlPrefix}/"
+ }index.php [L]
+ ''}
Order allow,deny
@@ -135,6 +153,8 @@ in
''}
'';
+ documentRoot = if config.urlPrefix == "" then mediawikiRoot else null;
+
enablePHP = true;
options = {
@@ -290,6 +310,7 @@ in
echo COMMIT
) | ${pkgs.postgresql}/bin/psql -U "${config.dbUser}" "${config.dbName}"
fi
+ ${php}/bin/php ${mediawikiRoot}/maintenance/update.php
'');
robotsEntries = optionalString (config.articleUrlPrefix != "")
diff --git a/nixos/modules/services/web-servers/apache-httpd/mercurial.nix b/nixos/modules/services/web-servers/apache-httpd/mercurial.nix
index 755b595c783..6dd91be00a7 100644
--- a/nixos/modules/services/web-servers/apache-httpd/mercurial.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/mercurial.nix
@@ -1,15 +1,15 @@
-{ config, pkgs, serverInfo, ... }:
+{ config, pkgs, serverInfo, lib, ... }:
let
inherit (pkgs) mercurial;
- inherit (pkgs.lib) mkOption;
+ inherit (lib) mkOption;
urlPrefix = config.urlPrefix;
cgi = pkgs.stdenv.mkDerivation {
name = "mercurial-cgi";
buildCommand = ''
- ensureDir $out
+ mkdir -p $out
cp -v ${mercurial}/share/cgi-bin/hgweb.cgi $out
sed -i "s|/path/to/repo/or/config|$out/hgweb.config|" $out/hgweb.cgi
echo "
diff --git a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
index 53f34e28c27..b8e86334539 100644
--- a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
@@ -3,9 +3,9 @@
# has additional options that affect the web server as a whole, like
# the user/group to run under.)
-{ forMainServer, pkgs }:
+{ forMainServer, lib }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/web-servers/apache-httpd/phabricator.nix b/nixos/modules/services/web-servers/apache-httpd/phabricator.nix
new file mode 100644
index 00000000000..c7a9bdf68c5
--- /dev/null
+++ b/nixos/modules/services/web-servers/apache-httpd/phabricator.nix
@@ -0,0 +1,41 @@
+{ config, lib, pkgs, ... }:
+let
+ phabricatorRoot = pkgs.stdenv.mkDerivation rec {
+ version = "2014-05-12";
+ name = "phabricator-${version}";
+ srcLibphutil = pkgs.fetchgit {
+ url = git://github.com/facebook/libphutil.git;
+ rev = "2f3b5a1cf6ea464a0250d4b1c653a795a90d2716";
+ sha256 = "9598cec400984dc149162f1e648814a54ea0cd34fcd529973dc83f5486fdd9fd";
+ };
+ srcArcanist = pkgs.fetchgit {
+ url = git://github.com/facebook/arcanist.git;
+ rev = "54c377448db8dbc40f0ca86d43c837d30e493485";
+ sha256 = "086db3c0d1154fbad23e7c6def31fd913384ee20247b329515838b669c3028e0";
+ };
+ srcPhabricator = pkgs.fetchgit {
+ url = git://github.com/facebook/phabricator.git;
+ rev = "1644ef185ecf1e9fca3eb6b16351ef46b19d110f";
+ sha256 = "e1135e4ba76d53f48aad4161563035414ed7e878f39a8a34a875a01b41b2a084";
+ };
+
+ buildCommand = ''
+ mkdir -p $out
+ cp -R ${srcLibphutil} $out/libphutil
+ cp -R ${srcArcanist} $out/arcanist
+ cp -R ${srcPhabricator} $out/phabricator
+ '';
+ };
+in {
+ enablePHP = true;
+ extraApacheModules = [ "mod_rewrite" ];
+ DocumentRoot = "${phabricatorRoot}/phabricator/webroot";
+ extraConfig = ''
+ DocumentRoot ${phabricatorRoot}/phabricator/webroot
+
+ RewriteEngine on
+ RewriteRule ^/rsrc/(.*) - [L,QSA]
+ RewriteRule ^/favicon.ico - [L,QSA]
+ RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
+ '';
+}
diff --git a/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix b/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix
index 1b754cf025e..a883bb2b343 100644
--- a/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, serverInfo, ... }:
+{ config, pkgs, serverInfo, lib, ... }:
let
- extraWorkersProperties = pkgs.lib.optionalString (config ? extraWorkersProperties) config.extraWorkersProperties;
+ extraWorkersProperties = lib.optionalString (config ? extraWorkersProperties) config.extraWorkersProperties;
workersProperties = pkgs.writeText "workers.properties" ''
# Define list of workers that will be used
@@ -29,6 +29,14 @@ ${extraWorkersProperties}
'';
in
{
+
+ options = {
+ extraWorkersProperties = lib.mkOption {
+ default = "";
+ description = "Additional configuration for the workers.properties file.";
+ };
+ };
+
extraModules = [
{ name = "jk"; path = "${pkgs.tomcat_connectors}/modules/mod_jk.so"; }
];
diff --git a/nixos/modules/services/web-servers/apache-httpd/trac.nix b/nixos/modules/services/web-servers/apache-httpd/trac.nix
index dc82fd34f2f..8fe8b90d823 100644
--- a/nixos/modules/services/web-servers/apache-httpd/trac.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/trac.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, serverInfo, ... }:
+{ config, lib, pkgs, serverInfo, ... }:
-with pkgs.lib;
+with lib;
let
@@ -8,8 +8,6 @@ let
subversion = pkgs.subversion.override (origArgs: {
bdbSupport = true;
httpServer = true;
- sslSupport = true;
- compressionSupport = true;
pythonBindings = true;
});
diff --git a/nixos/modules/services/web-servers/apache-httpd/zabbix.nix b/nixos/modules/services/web-servers/apache-httpd/zabbix.nix
index a6e6042fdf6..cab16593bcb 100644
--- a/nixos/modules/services/web-servers/apache-httpd/zabbix.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/zabbix.nix
@@ -1,4 +1,6 @@
-{ config, pkgs, serverInfo, ... }:
+{ config, lib, pkgs, serverInfo, ... }:
+
+with lib;
let
@@ -51,7 +53,7 @@ in
options = {
- urlPrefix = pkgs.lib.mkOption {
+ urlPrefix = mkOption {
default = "/zabbix";
description = "
The URL prefix under which the Zabbix service appears.
@@ -59,9 +61,9 @@ in
";
};
- configFile = pkgs.lib.mkOption {
+ configFile = mkOption {
default = null;
- type = with pkgs.lib.types; nullOr path;
+ type = types.nullOr types.path;
description = ''
The configuration file (zabbix.conf.php) which contains the database
connection settings. If not set, the configuration settings will created
@@ -69,7 +71,7 @@ in
'';
};
- stateDir = pkgs.lib.mkOption {
+ stateDir = mkOption {
default = "/var/lib/zabbix/frontend";
description = "
Directory where the dynamically generated configuration data
diff --git a/nixos/modules/services/web-servers/fcgiwrap.nix b/nixos/modules/services/web-servers/fcgiwrap.nix
new file mode 100644
index 00000000000..7e91e7b60ee
--- /dev/null
+++ b/nixos/modules/services/web-servers/fcgiwrap.nix
@@ -0,0 +1,49 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.fcgiwrap;
+
+in {
+
+ options = {
+ services.fcgiwrap = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable fcgiwrap, a server for running CGI applications over FastCGI.";
+ };
+
+ preforkProcesses = mkOption {
+ type = types.int;
+ default = 1;
+ description = "Number of processes to prefork.";
+ };
+
+ bindSocket = mkOption {
+ type = types.string;
+ default = "unix:/run/fcgiwrap.sock";
+ description = ''
+ Socket to bind to. Valid socket URLs are:
+ unix:/path/to/socket for Unix sockets
+ tcp:dot.ted.qu.ad:port for IPv4 sockets
+ tcp6:[ipv6_addr]:port for IPv6 sockets
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+
+ systemd.services.fcgiwrap = {
+ after = [ "nss-user-lookup.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig = {
+ ExecStart = "${pkgs.fcgiwrap}/sbin/fcgiwrap -c ${builtins.toString cfg.preforkProcesses} -s ${cfg.bindSocket}";
+ };
+ };
+
+ };
+}
diff --git a/nixos/modules/services/web-servers/jboss/default.nix b/nixos/modules/services/web-servers/jboss/default.nix
index e1bcede6563..8a292ad6791 100644
--- a/nixos/modules/services/web-servers/jboss/default.nix
+++ b/nixos/modules/services/web-servers/jboss/default.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/web-servers/lighttpd/cgit.nix b/nixos/modules/services/web-servers/lighttpd/cgit.nix
index 62264f1db45..d4663781fd8 100644
--- a/nixos/modules/services/web-servers/lighttpd/cgit.nix
+++ b/nixos/modules/services/web-servers/lighttpd/cgit.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.lighttpd.cgit;
@@ -29,7 +29,7 @@ in
cache-size=1000
scan-path=/srv/git
'';
- type = types.string;
+ type = types.lines;
description = ''
Verbatim contents of the cgit runtime configuration file. Documentation
(with cgitrc example file) is available in "man cgitrc". Or online:
diff --git a/nixos/modules/services/web-servers/lighttpd/default.nix b/nixos/modules/services/web-servers/lighttpd/default.nix
index 4cc34c65d84..fc9487ab485 100644
--- a/nixos/modules/services/web-servers/lighttpd/default.nix
+++ b/nixos/modules/services/web-servers/lighttpd/default.nix
@@ -1,17 +1,17 @@
# NixOS module for lighttpd web server
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.lighttpd;
needModRedirect = cfg.gitweb.enable;
- needModAlias = cfg.cgit.enable or cfg.gitweb.enable;
- needModSetenv = cfg.cgit.enable or cfg.gitweb.enable;
- needModCgi = cfg.cgit.enable or cfg.gitweb.enable;
+ needModAlias = cfg.cgit.enable || cfg.gitweb.enable;
+ needModSetenv = cfg.cgit.enable || cfg.gitweb.enable;
+ needModCgi = cfg.cgit.enable || cfg.gitweb.enable;
needModStatus = cfg.mod_status;
needModUserdir = cfg.mod_userdir;
@@ -102,7 +102,7 @@ in
document-root = mkOption {
default = "/srv/www";
- type = types.str;
+ type = types.path;
description = ''
Document-root of the web server. Must be readable by the "lighttpd" user.
'';
@@ -128,7 +128,7 @@ in
configText = mkOption {
default = "";
- type = types.string;
+ type = types.lines;
example = ''...verbatim config file contents...'';
description = ''
Overridable config file contents to use for lighttpd. By default, use
@@ -138,7 +138,7 @@ in
extraConfig = mkOption {
default = "";
- type = types.string;
+ type = types.lines;
description = ''
These configuration lines will be appended to the generated lighttpd
config file. Note that this mechanism does not work when the manual
diff --git a/nixos/modules/services/web-servers/lighttpd/gitweb.nix b/nixos/modules/services/web-servers/lighttpd/gitweb.nix
index f02bd4db264..c407a1d8977 100644
--- a/nixos/modules/services/web-servers/lighttpd/gitweb.nix
+++ b/nixos/modules/services/web-servers/lighttpd/gitweb.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.lighttpd.gitweb;
@@ -25,7 +25,7 @@ in
projectroot = mkOption {
default = "/srv/git";
- type = types.str;
+ type = types.path;
description = ''
Path to git projects (bare repositories) that should be served by
gitweb. Must not end with a slash.
@@ -34,7 +34,7 @@ in
extraConfig = mkOption {
default = "";
- type = types.str;
+ type = types.lines;
description = ''
Verbatim configuration text appended to the generated gitweb.conf file.
'';
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix
index b26af1aa744..7c2d3a42973 100644
--- a/nixos/modules/services/web-servers/nginx/default.nix
+++ b/nixos/modules/services/web-servers/nginx/default.nix
@@ -1,14 +1,20 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.nginx;
- nginx = pkgs.nginx.override { fullWebDAV = cfg.fullWebDAV; };
+ nginx = cfg.package;
configFile = pkgs.writeText "nginx.conf" ''
user ${cfg.user} ${cfg.group};
daemon off;
${cfg.config}
+ ${optionalString (cfg.httpConfig != "") ''
+ http {
+ ${cfg.httpConfig}
+ }
+ ''}
+ ${cfg.appendConfig}
'';
in
@@ -22,6 +28,14 @@ in
";
};
+ package = mkOption {
+ default = pkgs.nginx;
+ type = types.package;
+ description = "
+ Nginx package to use.
+ ";
+ };
+
config = mkOption {
default = "events {}";
description = "
@@ -29,6 +43,25 @@ in
";
};
+ appendConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Configuration lines appended to the generated Nginx
+ configuration file. Commonly used by different modules
+ providing http snippets.
+ can be specified more than once and it's value will be
+ concatenated (contrary to which
+ can be set only once).
+ '';
+ };
+
+ httpConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Configuration lines to be appended inside of the http {} block.";
+ };
+
stateDir = mkOption {
default = "/var/spool/nginx";
description = "
@@ -46,17 +79,11 @@ in
description = "Group account under which nginx runs.";
};
- fullWebDAV = mkOption {
- default = false;
- description = "Compile in a third party module providing full WebDAV support";
- };
};
};
config = mkIf cfg.enable {
- environment.systemPackages = [ nginx ];
-
# TODO: test user supplied config file pases syntax test
systemd.services.nginx = {
@@ -67,6 +94,7 @@ in
preStart =
''
mkdir -p ${cfg.stateDir}/logs
+ chmod 700 ${cfg.stateDir}
chown -R ${cfg.user}:${cfg.group} ${cfg.stateDir}
'';
serviceConfig = {
@@ -76,7 +104,7 @@ in
users.extraUsers = optionalAttrs (cfg.user == "nginx") (singleton
{ name = "nginx";
- group = "nginx";
+ group = cfg.group;
uid = config.ids.uids.nginx;
});
diff --git a/nixos/modules/services/web-servers/phpfpm.nix b/nixos/modules/services/web-servers/phpfpm.nix
new file mode 100644
index 00000000000..8551e3ccdeb
--- /dev/null
+++ b/nixos/modules/services/web-servers/phpfpm.nix
@@ -0,0 +1,90 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.phpfpm;
+
+ stateDir = "/run/phpfpm";
+
+ pidFile = "${stateDir}/phpfpm.pid";
+
+ cfgFile = pkgs.writeText "phpfpm.conf" ''
+ [global]
+ pid = ${pidFile}
+ error_log = syslog
+ daemonize = yes
+ ${cfg.extraConfig}
+
+ ${concatStringsSep "\n" (mapAttrsToList (n: v: "[${n}]\n${v}") cfg.poolConfigs)}
+ '';
+
+in {
+
+ options = {
+ services.phpfpm = {
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Extra configuration that should be put in the global section of
+ the PHP FPM configuration file. Do not specify the options
+ pid, error_log or
+ daemonize here, since they are generated by
+ NixOS.
+ '';
+ };
+
+ phpPackage = mkOption {
+ default = pkgs.php54;
+ description = ''
+ The PHP package to use for running the FPM service.
+ '';
+ };
+
+ phpIni = mkOption {
+ type = types.path;
+ default = "${cfg.phpPackage}/etc/php-recommended.ini";
+ description = "php.ini file to use.";
+ };
+
+ poolConfigs = mkOption {
+ type = types.attrsOf types.lines;
+ default = {};
+ example = {
+ mypool = ''
+ listen = /run/phpfpm/mypool
+ user = nobody
+ pm = dynamic
+ pm.max_children = 75
+ pm.start_servers = 10
+ pm.min_spare_servers = 5
+ pm.max_spare_servers = 20
+ pm.max_requests = 500
+ '';
+ };
+ description = ''
+ A mapping between PHP FPM pool names and their configurations.
+ See the documentation on php-fpm.conf for
+ details on configuration directives. If no pools are defined,
+ the phpfpm service is disabled.
+ '';
+ };
+ };
+ };
+
+ config = mkIf (cfg.poolConfigs != {}) {
+
+ systemd.services.phpfpm = {
+ wantedBy = [ "multi-user.target" ];
+ preStart = ''
+ mkdir -p "${stateDir}"
+ '';
+ serviceConfig = {
+ ExecStart = "${cfg.phpPackage}/sbin/php-fpm -y ${cfgFile} -c ${cfg.phpIni}";
+ PIDFile = pidFile;
+ };
+ };
+
+ };
+}
diff --git a/nixos/modules/services/web-servers/tomcat.nix b/nixos/modules/services/web-servers/tomcat.nix
index a68828de5d8..c2f464014ae 100644
--- a/nixos/modules/services/web-servers/tomcat.nix
+++ b/nixos/modules/services/web-servers/tomcat.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -77,6 +77,11 @@ in
description = "Whether to enable logging per virtual host.";
};
+ jdk = mkOption {
+ default = pkgs.jdk;
+ description = "Which JDK to use.";
+ };
+
axis2 = {
enable = mkOption {
@@ -119,6 +124,8 @@ in
startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
+ daemonType = "daemon";
+
preStart =
''
# Create the base directory
@@ -327,14 +334,16 @@ in
done
''
else ""}
-
- ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c 'CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} JAVA_OPTS="${cfg.javaOpts}" CATALINA_OPTS="${cfg.catalinaOpts}" ${tomcat}/bin/startup.sh'
'';
+ script = ''
+ ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c 'CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${cfg.jdk} JAVA_OPTS="${cfg.javaOpts}" CATALINA_OPTS="${cfg.catalinaOpts}" ${tomcat}/bin/startup.sh'
+ '';
+
postStop =
''
echo "Stopping tomcat..."
- CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${tomcat}/bin/shutdown.sh
+ CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${cfg.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${tomcat}/bin/shutdown.sh
'';
};
diff --git a/nixos/modules/services/web-servers/varnish/default.nix b/nixos/modules/services/web-servers/varnish/default.nix
index 7e327120c3d..364f6c68fac 100644
--- a/nixos/modules/services/web-servers/varnish/default.nix
+++ b/nixos/modules/services/web-servers/varnish/default.nix
@@ -1,9 +1,9 @@
-{ config, pkgs, ...}:
+{ config, lib, pkgs, ...}:
let
cfg = config.services.varnish;
in
-with pkgs.lib;
+with lib;
{
options = {
services.varnish = {
diff --git a/nixos/modules/services/web-servers/winstone.nix b/nixos/modules/services/web-servers/winstone.nix
new file mode 100644
index 00000000000..7f48012f158
--- /dev/null
+++ b/nixos/modules/services/web-servers/winstone.nix
@@ -0,0 +1,129 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.winstone;
+
+ winstoneOpts = { name, ... }: {
+ options = {
+ name = mkOption {
+ default = name;
+ internal = true;
+ };
+
+ serviceName = mkOption {
+ type = types.str;
+ description = ''
+ The name of the systemd service. By default, it is
+ derived from the winstone instance name.
+ '';
+ };
+
+ warFile = mkOption {
+ type = types.str;
+ description = ''
+ The WAR file that Winstone should serve.
+ '';
+ };
+
+ javaPackage = mkOption {
+ type = types.package;
+ default = pkgs.openjre;
+ description = ''
+ Which Java derivation to use for running Winstone.
+ '';
+ };
+
+ user = mkOption {
+ type = types.str;
+ description = ''
+ The user that should run this Winstone process and
+ own the working directory.
+ '';
+ };
+
+ group = mkOption {
+ type = types.str;
+ description = ''
+ The group that will own the working directory.
+ '';
+ };
+
+ workDir = mkOption {
+ type = types.str;
+ description = ''
+ The working directory for this Winstone instance. Will
+ contain extracted webapps etc. The directory will be
+ created if it doesn't exist.
+ '';
+ };
+
+ extraJavaOptions = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Extra command line options given to the java process running
+ Winstone.
+ '';
+ };
+
+ extraOptions = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Extra command line options given to the Winstone process.
+ '';
+ };
+ };
+
+ config = {
+ workDir = mkDefault "/run/winstone/${name}";
+ serviceName = mkDefault "winstone-${name}";
+ };
+ };
+
+ mkService = cfg: let
+ opts = concatStringsSep " " (cfg.extraOptions ++ [
+ "--warfile ${cfg.warFile}"
+ ]);
+
+ javaOpts = concatStringsSep " " (cfg.extraJavaOptions ++ [
+ "-Djava.io.tmpdir=${cfg.workDir}"
+ "-jar ${pkgs.winstone}/lib/winstone.jar"
+ ]);
+ in {
+ wantedBy = [ "multi-user.target" ];
+ description = "winstone service for ${cfg.name}";
+ preStart = ''
+ mkdir -p "${cfg.workDir}"
+ chown ${cfg.user}:${cfg.group} "${cfg.workDir}"
+ '';
+ serviceConfig = {
+ ExecStart = "${cfg.javaPackage}/bin/java ${javaOpts} ${opts}";
+ User = cfg.user;
+ PermissionsStartOnly = true;
+ };
+ };
+
+in {
+
+ options = {
+ services.winstone = mkOption {
+ default = {};
+ type = types.attrsOf types.optionSet;
+ options = [ winstoneOpts ];
+ description = ''
+ Defines independent Winstone services, each serving one WAR-file.
+ '';
+ };
+ };
+
+ config = mkIf (cfg != {}) {
+
+ systemd.services = mapAttrs' (n: c: nameValuePair c.serviceName (mkService c)) cfg;
+
+ };
+
+}
diff --git a/nixos/modules/services/web-servers/zope2.nix b/nixos/modules/services/web-servers/zope2.nix
index 576f4b08fb9..21117118457 100644
--- a/nixos/modules/services/web-servers/zope2.nix
+++ b/nixos/modules/services/web-servers/zope2.nix
@@ -1,6 +1,6 @@
-{ pkgs, config, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix
index ab3ced4c9e2..c62beca60d8 100644
--- a/nixos/modules/services/x11/desktop-managers/default.nix
+++ b/nixos/modules/services/x11/desktop-managers/default.nix
@@ -1,15 +1,15 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
xcfg = config.services.xserver;
cfg = xcfg.desktopManager;
- # Whether desktop manager `d' is capable of setting a background.
- # If it isn't, the `feh' program is used as a fallback.
- needBGCond = d: ! (d ? bgSupport && d.bgSupport);
+ # If desktop manager `d' isn't capable of setting a background and
+ # the xserver is enabled, the `feh' program is used as a fallback.
+ needBGCond = d: ! (d ? bgSupport && d.bgSupport) && xcfg.enable;
in
@@ -17,7 +17,10 @@ in
# Note: the order in which desktop manager modules are imported here
# determines the default: later modules (if enabled) are preferred.
# E.g., if KDE is enabled, it supersedes xterm.
- imports = [ ./none.nix ./xterm.nix ./xfce.nix ./gnome.nix ./kde4.nix ./e17.nix ];
+ imports = [
+ ./none.nix ./xterm.nix ./xfce.nix ./kde4.nix
+ ./e17.nix ./e18.nix ./gnome3.nix ./xbmc.nix
+ ];
options = {
diff --git a/nixos/modules/services/x11/desktop-managers/e17.nix b/nixos/modules/services/x11/desktop-managers/e17.nix
index 3d91617c62a..4cac53c9c75 100644
--- a/nixos/modules/services/x11/desktop-managers/e17.nix
+++ b/nixos/modules/services/x11/desktop-managers/e17.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/desktop-managers/e18.nix b/nixos/modules/services/x11/desktop-managers/e18.nix
new file mode 100644
index 00000000000..faafd21b07d
--- /dev/null
+++ b/nixos/modules/services/x11/desktop-managers/e18.nix
@@ -0,0 +1,43 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+
+ xcfg = config.services.xserver;
+ cfg = xcfg.desktopManager.e18;
+ e18_enlightenment = pkgs.e18.enlightenment.override { set_freqset_setuid = true; };
+
+in
+
+{
+ options = {
+
+ services.xserver.desktopManager.e18.enable = mkOption {
+ default = false;
+ example = true;
+ description = "Enable the E18 desktop environment.";
+ };
+
+ };
+
+ config = mkIf (xcfg.enable && cfg.enable) {
+
+ environment.systemPackages = [
+ pkgs.e18.efl pkgs.e18.evas pkgs.e18.emotion pkgs.e18.elementary e18_enlightenment
+ pkgs.e18.terminology pkgs.e18.econnman
+ ];
+
+ services.xserver.desktopManager.session = [
+ { name = "E18";
+ start = ''
+ ${e18_enlightenment}/bin/enlightenment_start
+ waitPID=$!
+ '';
+ }];
+
+ security.setuidPrograms = [ "e18_freqset" ];
+
+ };
+
+}
diff --git a/nixos/modules/services/x11/desktop-managers/gnome.nix b/nixos/modules/services/x11/desktop-managers/gnome.nix
deleted file mode 100644
index b0212446ad3..00000000000
--- a/nixos/modules/services/x11/desktop-managers/gnome.nix
+++ /dev/null
@@ -1,42 +0,0 @@
-{ config, pkgs, ... }:
-
-with pkgs.lib;
-
-let
-
- cfg = config.services.xserver.desktopManager.gnome;
- gnome = pkgs.gnome;
-
-in
-
-{
-
- options = {
-
- services.xserver.desktopManager.gnome.enable = mkOption {
- default = false;
- example = true;
- description = "Enable a gnome terminal as a desktop manager.";
- };
-
- };
-
- config = mkIf cfg.enable {
-
- services.xserver.desktopManager.session = singleton
- { name = "gnome";
- start = ''
- ${gnome.gnometerminal}/bin/gnome-terminal -ls &
- waitPID=$!
- '';
- };
-
- environment.systemPackages =
- [ gnome.gnometerminal
- gnome.GConf
- gnome.gconfeditor
- ];
-
- };
-
-}
diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix
new file mode 100644
index 00000000000..06bcb6dbb8b
--- /dev/null
+++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix
@@ -0,0 +1,181 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.desktopManager.gnome3;
+ gnome3 = config.environment.gnome3.packageSet;
+
+ # Remove packages of ys from xs, based on their names
+ removePackagesByName = xs: ys:
+ let
+ pkgName = drv: (builtins.parseDrvName drv.name).name;
+ ysNames = map pkgName ys;
+ res = (filter (x: !(builtins.elem (pkgName x) ysNames)) xs);
+ in
+ filter (x: !(builtins.elem (pkgName x) ysNames)) xs;
+
+ # Prioritize nautilus by default when opening directories
+ mimeAppsList = pkgs.writeTextFile {
+ name = "gnome-mimeapps";
+ destination = "/share/applications/mimeapps.list";
+ text = ''
+ [Default Applications]
+ inode/directory=nautilus.desktop
+ '';
+ };
+
+in {
+
+ options = {
+
+ services.xserver.desktopManager.gnome3.enable = mkOption {
+ default = false;
+ example = true;
+ description = "Enable Gnome 3 desktop manager.";
+ };
+
+ services.xserver.desktopManager.gnome3.sessionPath = mkOption {
+ default = [];
+ example = "[ pkgs.gnome3.gpaste ]";
+ description = "Additional list of packages to be added to the session search path.
+ Useful for gnome shell extensions or gsettings-conditionated autostart.";
+ apply = list: list ++ [ gnome3.gnome_shell ];
+ };
+
+ environment.gnome3.packageSet = mkOption {
+ default = pkgs.gnome3;
+ example = literalExample "pkgs.gnome3_12";
+ description = "Which Gnome 3 package set to use.";
+ };
+
+ environment.gnome3.excludePackages = mkOption {
+ default = [];
+ example = "[ pkgs.gnome3.totem ]";
+ type = types.listOf types.package;
+ description = "Which packages gnome should exclude from the default environment";
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ # Enable helpful DBus services.
+ security.polkit.enable = true;
+ services.udisks2.enable = true;
+ services.accounts-daemon.enable = true;
+ services.geoclue2.enable = mkDefault true;
+ services.gnome3.at-spi2-core.enable = true;
+ services.gnome3.evolution-data-server.enable = true;
+ services.gnome3.gnome-documents.enable = mkDefault true;
+ services.gnome3.gnome-keyring.enable = true;
+ services.gnome3.gnome-online-accounts.enable = mkDefault true;
+ services.gnome3.gnome-user-share.enable = mkDefault true;
+ services.gnome3.gvfs.enable = true;
+ services.gnome3.seahorse.enable = mkDefault true;
+ services.gnome3.sushi.enable = mkDefault true;
+ services.gnome3.tracker.enable = mkDefault true;
+ hardware.pulseaudio.enable = mkDefault true;
+ services.telepathy.enable = mkDefault true;
+ networking.networkmanager.enable = true;
+ services.upower.enable = config.powerManagement.enable;
+ services.upower.package = gnome3.upower;
+
+ fonts.fonts = [ pkgs.dejavu_fonts ];
+
+ services.xserver.desktopManager.session = singleton
+ { name = "gnome3";
+ start = ''
+ # Set GTK_DATA_PREFIX so that GTK+ can find the themes
+ export GTK_DATA_PREFIX=${config.system.path}
+
+ # find theme engines
+ export GTK_PATH=${config.system.path}/lib/gtk-3.0:${config.system.path}/lib/gtk-2.0
+
+ export XDG_MENU_PREFIX=gnome
+
+ ${concatMapStrings (p: ''
+ if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
+ export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
+ fi
+
+ if [ -d "${p}/lib/girepository-1.0" ]; then
+ export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
+ fi
+ '') cfg.sessionPath}
+
+ # Override default mimeapps
+ export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${mimeAppsList}/share
+
+ # Let gnome-control-center find gnome-shell search providers
+ export GNOME_SEARCH_PROVIDERS_DIR=${config.system.path}/share/gnome-shell/search-providers/
+
+ # Let nautilus find extensions
+ export NAUTILUS_EXTENSION_DIR=${config.system.path}/lib/nautilus/extensions-3.0/
+
+ # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
+ ${pkgs.xdg-user-dirs}/bin/xdg-user-dirs-update
+
+ ${gnome3.gnome_session}/bin/gnome-session&
+ waitPID=$!
+ '';
+ };
+
+ environment.variables.GIO_EXTRA_MODULES = [ "${gnome3.dconf}/lib/gio/modules"
+ "${gnome3.glib_networking}/lib/gio/modules"
+ "${gnome3.gvfs}/lib/gio/modules" ];
+ environment.systemPackages =
+ [ pkgs.desktop_file_utils
+ gnome3.glib_networking
+ gnome3.gtk3 # for gtk-update-icon-cache
+ pkgs.ibus
+ pkgs.shared_mime_info # for update-mime-database
+ gnome3.gvfs
+ gnome3.dconf
+ gnome3.gnome-backgrounds
+ gnome3.gnome_control_center
+ gnome3.gnome_icon_theme
+ gnome3.gnome-menus
+ gnome3.gnome_settings_daemon
+ gnome3.gnome_shell
+ gnome3.gnome_themes_standard
+ ] ++ cfg.sessionPath ++ (removePackagesByName [
+ gnome3.baobab
+ gnome3.empathy
+ gnome3.eog
+ gnome3.epiphany
+ gnome3.evince
+ gnome3.gucharmap
+ gnome3.nautilus
+ gnome3.totem
+ gnome3.vino
+ gnome3.yelp
+ gnome3.gnome-calculator
+ gnome3.gnome-contacts
+ gnome3.gnome-font-viewer
+ gnome3.gnome-screenshot
+ gnome3.gnome-shell-extensions
+ gnome3.gnome-system-log
+ gnome3.gnome-system-monitor
+ gnome3.gnome_terminal
+ gnome3.gnome-user-docs
+
+ gnome3.bijiben
+ gnome3.evolution
+ gnome3.file-roller
+ gnome3.gedit
+ gnome3.gnome-clocks
+ gnome3.gnome-music
+ gnome3.gnome-tweak-tool
+ gnome3.gnome-photos
+ gnome3.nautilus-sendto
+ ] config.environment.gnome3.excludePackages);
+
+ # Needed for themes and backgrounds
+ environment.pathsToLink = [ "/share" ];
+
+ };
+
+
+}
diff --git a/nixos/modules/services/x11/desktop-managers/kde4.nix b/nixos/modules/services/x11/desktop-managers/kde4.nix
index 108b52bb951..f74dd7e0444 100644
--- a/nixos/modules/services/x11/desktop-managers/kde4.nix
+++ b/nixos/modules/services/x11/desktop-managers/kde4.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -43,7 +43,6 @@ let
phononBackendPackages = flip concatMap cfg.phononBackends
(name: attrByPath [name] (throw "unknown phonon backend `${name}'") phononBackends);
- wantsUdisks2 = pkgs.kde4.kdelibs.wantsUdisks2 or false;
in
{
@@ -158,8 +157,7 @@ in
};
# Enable helpful DBus services.
- services.udisks.enable = ! wantsUdisks2;
- services.udisks2.enable = wantsUdisks2;
+ services.udisks2.enable = true;
services.upower.enable = config.powerManagement.enable;
security.pam.services.kde = { allowNullPassword = true; };
diff --git a/nixos/modules/services/x11/desktop-managers/xbmc.nix b/nixos/modules/services/x11/desktop-managers/xbmc.nix
new file mode 100644
index 00000000000..97e966ca019
--- /dev/null
+++ b/nixos/modules/services/x11/desktop-managers/xbmc.nix
@@ -0,0 +1,31 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.desktopManager.xbmc;
+in
+
+{
+ options = {
+ services.xserver.desktopManager.xbmc = {
+ enable = mkOption {
+ default = false;
+ example = true;
+ description = "Enable the xbmc multimedia center.";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ services.xserver.desktopManager.session = [{
+ name = "xbmc";
+ start = ''
+ ${pkgs.xbmc}/bin/xbmc --lircdev /var/run/lirc/lircd --standalone &
+ waitPID=$!
+ '';
+ }];
+
+ environment.systemPackages = [ pkgs.xbmc ];
+ };
+}
\ No newline at end of file
diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix
index 8199829ef90..a72eea76239 100644
--- a/nixos/modules/services/x11/desktop-managers/xfce.nix
+++ b/nixos/modules/services/x11/desktop-managers/xfce.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -29,7 +29,7 @@ in
start =
''
# Set GTK_PATH so that GTK+ can find the theme engines.
- export GTK_PATH=${config.system.path}/lib/gtk-2.0
+ export GTK_PATH="${config.system.path}/lib/gtk-2.0:${config.system.path}/lib/gtk-3.0"
# Set GTK_DATA_PREFIX so that GTK+ can find the Xfce themes.
export GTK_DATA_PREFIX=${config.system.path}
@@ -60,6 +60,7 @@ in
pkgs.xfce.xfce4session
pkgs.xfce.xfce4settings
pkgs.xfce.xfce4mixer
+ pkgs.xfce.xfce4screenshooter
pkgs.xfce.xfconf
pkgs.xfce.xfdesktop
pkgs.xfce.xfwm4
@@ -72,13 +73,15 @@ in
pkgs.xfce.thunar_volman
pkgs.xfce.gvfs
pkgs.xfce.xfce4_appfinder
+ pkgs.xfce.tumbler # found via dbus
+ pkgs.xfce.xfce4notifyd # found via dbus
]
++ optional config.powerManagement.enable pkgs.xfce.xfce4_power_manager;
environment.pathsToLink =
[ "/share/xfce4" "/share/themes" "/share/mime" "/share/desktop-directories" "/share/gtksourceview-2.0" ];
- environment.variables.GIO_EXTRA_MODULES = "${pkgs.xfce.gvfs}/lib/gio/modules";
+ environment.variables.GIO_EXTRA_MODULES = [ "${pkgs.xfce.gvfs}/lib/gio/modules" ];
# Enable helpful DBus services.
services.udisks2.enable = true;
diff --git a/nixos/modules/services/x11/desktop-managers/xterm.nix b/nixos/modules/services/x11/desktop-managers/xterm.nix
index edc61c103ea..eab91407141 100644
--- a/nixos/modules/services/x11/desktop-managers/xterm.nix
+++ b/nixos/modules/services/x11/desktop-managers/xterm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -19,7 +19,7 @@ in
};
- config = mkIf cfg.enable {
+ config = mkIf (config.services.xserver.enable && cfg.enable) {
services.xserver.desktopManager.session = singleton
{ name = "xterm";
diff --git a/nixos/modules/services/x11/display-managers/auto.nix b/nixos/modules/services/x11/display-managers/auto.nix
index 33d97e0e07a..c02ccdf12b6 100644
--- a/nixos/modules/services/x11/display-managers/auto.nix
+++ b/nixos/modules/services/x11/display-managers/auto.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix
index c4fce3706dc..3bf18bd58c8 100644
--- a/nixos/modules/services/x11/display-managers/default.nix
+++ b/nixos/modules/services/x11/display-managers/default.nix
@@ -7,9 +7,9 @@
# (e.g., KDE, Gnome or a plain xterm), and optionally the *window
# manager* (e.g. kwin or twm).
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -44,22 +44,13 @@ let
# since presumably the desktop environment will handle these.
if [ -z "$_INHIBITION_LOCK_TAKEN" ]; then
export _INHIBITION_LOCK_TAKEN=1
- exec ${config.systemd.package}/bin/systemd-inhibit --what=handle-lid-switch:handle-power-key "$0" "$sessionType"
+ if ! ${config.systemd.package}/bin/loginctl show-session $XDG_SESSION_ID | grep -q '^RemoteHost='; then
+ exec ${config.systemd.package}/bin/systemd-inhibit --what=handle-lid-switch:handle-power-key "$0" "$sessionType"
+ fi
fi
''}
- ${optionalString cfg.startOpenSSHAgent ''
- if test -z "$SSH_AUTH_SOCK"; then
- # Restart this script as a child of the SSH agent. (It is
- # also possible to start the agent as a child that prints
- # the required environment variabled on stdout, but in
- # that mode ssh-agent is not terminated when we log out.)
- export SSH_ASKPASS=${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass
- exec ${pkgs.openssh}/bin/ssh-agent "$0" "$sessionType"
- fi
- ''}
-
${optionalString cfg.startGnuPGAgent ''
if test -z "$SSH_AUTH_SOCK"; then
# Restart this script as a child of the GnuPG agent.
@@ -101,6 +92,11 @@ let
${cfg.displayManager.sessionCommands}
+ # Allow the user to execute commands at the beginning of the X session.
+ if test -f ~/.xprofile; then
+ source ~/.xprofile
+ fi
+
# Allow the user to setup a custom session type.
if test -x ~/.xsession; then
exec ~/.xsession
diff --git a/nixos/modules/services/x11/display-managers/gdm.nix b/nixos/modules/services/x11/display-managers/gdm.nix
new file mode 100644
index 00000000000..9d14fc2e137
--- /dev/null
+++ b/nixos/modules/services/x11/display-managers/gdm.nix
@@ -0,0 +1,151 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.xserver.displayManager;
+ gdm = pkgs.gnome3_12.gdm; # gdm 3.10 not supported
+ gnome3 = config.environment.gnome3.packageSet;
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.xserver.displayManager.gdm = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ example = true;
+ description = ''
+ Whether to enable GDM as the display manager.
+ GDM is very experimental and may render system unusable.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.gdm.enable {
+
+ services.xserver.displayManager.slim.enable = false;
+
+ users.extraUsers.gdm =
+ { name = "gdm";
+ uid = config.ids.uids.gdm;
+ group = "gdm";
+ home = "/run/gdm";
+ description = "GDM user";
+ };
+
+ users.extraGroups.gdm.gid = config.ids.gids.gdm;
+
+ services.xserver.displayManager.job =
+ {
+ environment = {
+ GDM_X_SERVER = "${cfg.xserverBin} ${cfg.xserverArgs}";
+ GDM_SESSIONS_DIR = "${cfg.session.desktops}";
+ XDG_CONFIG_DIRS = "${gnome3.gnome_settings_daemon}/etc/xdg";
+ };
+ execCmd = "exec ${gdm}/sbin/gdm";
+ };
+
+ # Because sd_login_monitor_new requires /run/systemd/machines
+ systemd.services.display-manager.wants = [ "systemd-machined.service" ];
+ systemd.services.display-manager.after = [ "systemd-machined.service" ];
+
+ systemd.services.display-manager.path = [ gnome3.gnome_shell gnome3.caribou ];
+
+ services.dbus.packages = [ gdm ];
+
+ programs.dconf.profiles.gdm = "${gdm}/share/dconf/profile/gdm";
+
+ # GDM LFS PAM modules, adapted somehow to NixOS
+ security.pam.services = {
+ gdm-launch-environment.text = ''
+ auth required pam_succeed_if.so audit quiet_success user = gdm
+ auth optional pam_permit.so
+
+ account required pam_succeed_if.so audit quiet_success user = gdm
+ account sufficient pam_unix.so
+
+ password required pam_deny.so
+
+ session required pam_succeed_if.so audit quiet_success user = gdm
+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
+ session optional ${pkgs.systemd}/lib/security/pam_systemd.so
+ session optional pam_keyinit.so force revoke
+ session optional pam_permit.so
+ '';
+
+ gdm.text = ''
+ auth requisite pam_nologin.so
+ auth required pam_env.so
+
+ auth required pam_succeed_if.so uid >= 1000 quiet
+ auth optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so
+ auth sufficient pam_unix.so nullok likeauth
+ auth required pam_deny.so
+
+ account sufficient pam_unix.so
+
+ password requisite pam_unix.so nullok sha512
+
+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
+ session required pam_unix.so
+ session required pam_loginuid.so
+ session optional ${pkgs.systemd}/lib/security/pam_systemd.so
+ session optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so auto_start
+ '';
+
+ gdm-password.text = ''
+ auth requisite pam_nologin.so
+ auth required pam_env.so envfile=${config.system.build.pamEnvironment}
+
+ auth required pam_succeed_if.so uid >= 1000 quiet
+ auth optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so
+ auth sufficient pam_unix.so nullok likeauth
+ auth required pam_deny.so
+
+ account sufficient pam_unix.so
+
+ password requisite pam_unix.so nullok sha512
+
+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
+ session required pam_unix.so
+ session required pam_loginuid.so
+ session optional ${pkgs.systemd}/lib/security/pam_systemd.so
+ session optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so auto_start
+ '';
+
+ gdm-autologin.text = ''
+ auth requisite pam_nologin.so
+
+ auth required pam_succeed_if.so uid >= 1000 quiet
+ auth required pam_permit.so
+
+ account sufficient pam_unix.so
+
+ password requisite pam_unix.so nullok sha512
+
+ session optional pam_keyinit.so revoke
+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
+ session required pam_unix.so
+ session required pam_loginuid.so
+ session optional ${pkgs.systemd}/lib/security/pam_systemd.so
+ '';
+
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/x11/display-managers/kdm.nix b/nixos/modules/services/x11/display-managers/kdm.nix
index c51e7edfddf..7ec489ae3e7 100644
--- a/nixos/modules/services/x11/display-managers/kdm.nix
+++ b/nixos/modules/services/x11/display-managers/kdm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix
index e4125891e6c..f8ce06738fe 100644
--- a/nixos/modules/services/x11/display-managers/lightdm.nix
+++ b/nixos/modules/services/x11/display-managers/lightdm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -26,7 +26,7 @@ let
buildInputs = [ pkgs.makeWrapper ];
buildCommand = ''
- ensureDir $out/gtk-3.0/
+ mkdir -p $out/gtk-3.0/
# This wrapper ensures that we actually get fonts
makeWrapper ${pkgs.lightdm_gtk_greeter}/sbin/lightdm-gtk-greeter \
@@ -55,8 +55,8 @@ let
''
[LightDM]
greeter-user = ${config.users.extraUsers.lightdm.name}
- xgreeters-directory = ${cfg.greeter.package}
- xsessions-directory = ${dmcfg.session.desktops}
+ greeters-directory = ${cfg.greeter.package}
+ sessions-directory = ${dmcfg.session.desktops}
[SeatDefaults]
xserver-command = ${xserverWrapper}
diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix
index 35834ef3764..9ee4e0dc7cb 100644
--- a/nixos/modules/services/x11/display-managers/slim.nix
+++ b/nixos/modules/services/x11/display-managers/slim.nix
@@ -1,10 +1,11 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
dmcfg = config.services.xserver.displayManager;
+
cfg = dmcfg.slim;
slimConfig = pkgs.writeText "slim.cfg"
@@ -26,7 +27,7 @@ let
unpackedTheme = pkgs.stdenv.mkDerivation {
name = "slim-theme";
buildCommand = ''
- ensureDir $out
+ mkdir -p $out
cd $out
unpackFile ${cfg.theme}
ln -s * default
@@ -57,7 +58,7 @@ in
default = null;
example = literalExample ''
pkgs.fetchurl {
- url = http://download.berlios.de/slim/slim-wave.tar.gz;
+ url = "mirror://sourceforge/slim.berlios/slim-wave.tar.gz";
sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy";
}
'';
@@ -65,7 +66,7 @@ in
The theme for the SLiM login manager. If not specified, SLiM's
default theme is used. See for a
- collection of themes.
+ collection of themes. TODO: berlios shut down.
'';
};
@@ -109,6 +110,12 @@ in
execCmd = "exec ${pkgs.slim}/bin/slim";
};
+ services.xserver.displayManager.sessionCommands =
+ ''
+ # Export the config/themes for slimlock.
+ export SLIM_THEMESDIR=${slimThemesDir}
+ '';
+
# Allow null passwords so that the user can login as root on the
# installation CD.
security.pam.services.slim = { allowNullPassword = true; startSession = true; };
diff --git a/nixos/modules/services/x11/hardware/multitouch.nix b/nixos/modules/services/x11/hardware/multitouch.nix
index 4f9048bfd91..6e6e88e6721 100644
--- a/nixos/modules/services/x11/hardware/multitouch.nix
+++ b/nixos/modules/services/x11/hardware/multitouch.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.xserver.multitouch; in
diff --git a/nixos/modules/services/x11/hardware/synaptics.nix b/nixos/modules/services/x11/hardware/synaptics.nix
index 5884e9aa31c..f5b394b6d98 100644
--- a/nixos/modules/services/x11/hardware/synaptics.nix
+++ b/nixos/modules/services/x11/hardware/synaptics.nix
@@ -1,10 +1,24 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
-let cfg = config.services.xserver.synaptics; in
-
-{
+let cfg = config.services.xserver.synaptics;
+ tapConfig = if cfg.tapButtons then enabledTapConfig else disabledTapConfig;
+ enabledTapConfig = ''
+ Option "MaxTapTime" "180"
+ Option "MaxTapMove" "220"
+ Option "TapButton1" "${builtins.elemAt cfg.buttonsMap 0}"
+ Option "TapButton2" "${builtins.elemAt cfg.buttonsMap 1}"
+ Option "TapButton3" "${builtins.elemAt cfg.buttonsMap 2}"
+ '';
+ disabledTapConfig = ''
+ Option "MaxTapTime" "0"
+ Option "MaxTapMove" "0"
+ Option "TapButton1" "0"
+ Option "TapButton2" "0"
+ Option "TapButton3" "0"
+ '';
+in {
options = {
@@ -27,16 +41,19 @@ let cfg = config.services.xserver.synaptics; in
};
accelFactor = mkOption {
+ type = types.nullOr types.string;
default = "0.001";
description = "Cursor acceleration (how fast speed increases from minSpeed to maxSpeed).";
};
minSpeed = mkOption {
+ type = types.nullOr types.string;
default = "0.6";
description = "Cursor speed factor for precision finger motion.";
};
maxSpeed = mkOption {
+ type = types.nullOr types.string;
default = "1.0";
description = "Cursor speed factor for highest-speed finger motion.";
};
@@ -57,6 +74,13 @@ let cfg = config.services.xserver.synaptics; in
description = "Whether to enable tap buttons.";
};
+ buttonsMap = mkOption {
+ default = [1 2 3];
+ example = [1 3 2];
+ description = "Remap touchpad buttons.";
+ apply = map toString;
+ };
+
palmDetect = mkOption {
default = false;
example = true;
@@ -99,15 +123,13 @@ let cfg = config.services.xserver.synaptics; in
MatchIsTouchpad "on"
${optionalString (cfg.dev != null) ''MatchDevicePath "${cfg.dev}"''}
Driver "synaptics"
- Option "MaxTapTime" "180"
- Option "MaxTapMove" "220"
- Option "MinSpeed" "${cfg.minSpeed}"
- Option "MaxSpeed" "${cfg.maxSpeed}"
- Option "AccelFactor" "${cfg.accelFactor}"
- Option "TapButton1" "${if cfg.tapButtons then "1" else "0"}"
- Option "TapButton2" "${if cfg.tapButtons then "2" else "0"}"
- Option "TapButton3" "${if cfg.tapButtons then "3" else "0"}"
- ${if cfg.tapButtons then "" else ''Option "MaxTapTime" "0"''}
+ ${optionalString (cfg.minSpeed != null) ''Option "MinSpeed" "${cfg.minSpeed}"''}
+ ${optionalString (cfg.maxSpeed != null) ''Option "MaxSpeed" "${cfg.maxSpeed}"''}
+ ${optionalString (cfg.accelFactor != null) ''Option "AccelFactor" "${cfg.accelFactor}"''}
+ ${optionalString cfg.tapButtons tapConfig}
+ Option "ClickFinger1" "${builtins.elemAt cfg.buttonsMap 0}"
+ Option "ClickFinger2" "${builtins.elemAt cfg.buttonsMap 1}"
+ Option "ClickFinger3" "${builtins.elemAt cfg.buttonsMap 2}"
Option "VertTwoFingerScroll" "${if cfg.twoFingerScroll then "1" else "0"}"
Option "HorizTwoFingerScroll" "${if cfg.twoFingerScroll then "1" else "0"}"
Option "VertEdgeScroll" "${if cfg.vertEdgeScroll then "1" else "0"}"
diff --git a/nixos/modules/services/x11/hardware/wacom.nix b/nixos/modules/services/x11/hardware/wacom.nix
index dfc588cd213..540ed168b48 100644
--- a/nixos/modules/services/x11/hardware/wacom.nix
+++ b/nixos/modules/services/x11/hardware/wacom.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix
index bf7f974edc7..d73b58de6c0 100644
--- a/nixos/modules/services/x11/redshift.nix
+++ b/nixos/modules/services/x11/redshift.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.redshift;
@@ -14,24 +14,37 @@ in {
services.redshift.latitude = mkOption {
description = "Your current latitude";
- type = types.string;
+ type = types.uniq types.string;
};
services.redshift.longitude = mkOption {
description = "Your current longitude";
- type = types.string;
+ type = types.uniq types.string;
};
services.redshift.temperature = {
day = mkOption {
description = "Colour temperature to use during day time";
default = 5500;
- type = types.int;
+ type = types.uniq types.int;
};
night = mkOption {
description = "Colour temperature to use during night time";
default = 3700;
- type = types.int;
+ type = types.uniq types.int;
+ };
+ };
+
+ services.redshift.brightness = {
+ day = mkOption {
+ description = "Screen brightness to apply during the day (between 0.1 and 1.0)";
+ default = "1";
+ type = types.uniq types.string;
+ };
+ night = mkOption {
+ description = "Screen brightness to apply during the night (between 0.1 and 1.0)";
+ default = "1";
+ type = types.uniq types.string;
};
};
};
@@ -40,12 +53,16 @@ in {
systemd.services.redshift = {
description = "Redshift colour temperature adjuster";
requires = [ "display-manager.service" ];
- script = ''
+ after = [ "display-manager.service" ];
+ wantedBy = [ "graphical.target" ];
+ serviceConfig.ExecStart = ''
${pkgs.redshift}/bin/redshift \
-l ${cfg.latitude}:${cfg.longitude} \
- -t ${toString cfg.temperature.day}:${toString cfg.temperature.night}
+ -t ${toString cfg.temperature.day}:${toString cfg.temperature.night} \
+ -b ${toString cfg.brightness.day}:${toString cfg.brightness.night}
'';
environment = { DISPLAY = ":0"; };
+ serviceConfig.Restart = "always";
};
};
}
diff --git a/nixos/modules/services/x11/terminal-server.nix b/nixos/modules/services/x11/terminal-server.nix
index ab05639aeca..a036e085b0b 100644
--- a/nixos/modules/services/x11/terminal-server.nix
+++ b/nixos/modules/services/x11/terminal-server.nix
@@ -5,9 +5,9 @@
# not, a X server (Xvfb) is started for that user. The Xvfb instances
# persist across VNC sessions.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -17,27 +17,17 @@ let
#! ${pkgs.stdenv.shell}
export XKB_BINDIR=${pkgs.xorg.xkbcomp}/bin
export XORG_DRI_DRIVER_PATH=${pkgs.mesa}/lib/dri
- exec ${pkgs.xorg.xorgserver}/bin/Xvfb "$@" -xkbdir "${pkgs.xkeyboard_config}/etc/X11/xkb"
+ exec ${pkgs.xorg.xorgserver}/bin/Xvfb "$@" -xkbdir ${pkgs.xkeyboard_config}/etc/X11/xkb
'';
- # ‘xinetd’ is insanely braindamaged in that it sends stderr to
- # stdout. Thus requires just about any xinetd program to be
- # wrapped to redirect its stderr. Sigh.
- x11vncWrapper = pkgs.writeScriptBin "x11vnc-wrapper"
- ''
- #! ${pkgs.stdenv.shell}
- export PATH=${makeSearchPath "bin" [ xvfbWrapper pkgs.gawk pkgs.which pkgs.openssl pkgs.xorg.xauth pkgs.nettools pkgs.shadow pkgs.procps pkgs.utillinux pkgs.bash ]}:$PATH
- export FD_GEOM=1024x786x24
- exec ${pkgs.x11vnc}/bin/x11vnc -inetd -display WAIT:1024x786:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp -unixpw -ssl SAVE 2> /var/log/x11vnc.log
- '';
-
-in
+in
{
config = {
-
+
services.xserver.enable = true;
+ services.xserver.videoDrivers = [];
# Enable KDM. Any display manager will do as long as it supports XDMCP.
services.xserver.displayManager.kdm.enable = true;
@@ -52,13 +42,36 @@ in
Xaccess=${pkgs.writeText "Xaccess" "localhost"}
'';
- services.xinetd.enable = true;
- services.xinetd.services = singleton
- { name = "x11vnc";
- port = 5900;
- unlisted = true;
- user = "root";
- server = "${x11vncWrapper}/bin/x11vnc-wrapper";
+ systemd.sockets.terminal-server =
+ { description = "Terminal Server Socket";
+ wantedBy = [ "sockets.target" ];
+ before = [ "multi-user.target" ];
+ socketConfig.Accept = true;
+ socketConfig.ListenStream = 5900;
+ };
+
+ systemd.services."terminal-server@" =
+ { description = "Terminal Server";
+
+ path =
+ [ xvfbWrapper pkgs.gawk pkgs.which pkgs.openssl pkgs.xorg.xauth
+ pkgs.nettools pkgs.shadow pkgs.procps pkgs.utillinux pkgs.bash
+ ];
+
+ environment.FD_GEOM = "1024x786x24";
+ environment.FD_XDMCP_IF = "127.0.0.1";
+ #environment.FIND_DISPLAY_OUTPUT = "/tmp/foo"; # to debug the "find display" script
+
+ serviceConfig =
+ { StandardInput = "socket";
+ StandardOutput = "socket";
+ StandardError = "journal";
+ ExecStart = "@${pkgs.x11vnc}/bin/x11vnc x11vnc -inetd -display WAIT:1024x786:cmd=FINDCREATEDISPLAY-Xvfb.xdmcp -unixpw -ssl SAVE";
+ # Don't kill the X server when the user quits the VNC
+ # connection. FIXME: the X server should run in a
+ # separate systemd session.
+ KillMode = "process";
+ };
};
};
diff --git a/nixos/modules/services/x11/window-managers/awesome.nix b/nixos/modules/services/x11/window-managers/awesome.nix
index 1c61419a44c..9b2f042a87a 100644
--- a/nixos/modules/services/x11/window-managers/awesome.nix
+++ b/nixos/modules/services/x11/window-managers/awesome.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/bspwm.nix b/nixos/modules/services/x11/window-managers/bspwm.nix
new file mode 100644
index 00000000000..d234a432e9a
--- /dev/null
+++ b/nixos/modules/services/x11/window-managers/bspwm.nix
@@ -0,0 +1,29 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.windowManager.bspwm;
+in
+
+{
+ options = {
+ services.xserver.windowManager.bspwm.enable = mkOption {
+ type = types.bool;
+ default = false;
+ example = true;
+ description = "Enable the bspwm window manager.";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ services.xserver.windowManager.session = singleton {
+ name = "bspwm";
+ start = "
+ ${pkgs.sxhkd}/bin/sxhkd &
+ ${pkgs.bspwm}/bin/bspwm
+ ";
+ };
+ environment.systemPackages = [ pkgs.bspwm ];
+ };
+}
diff --git a/nixos/modules/services/x11/window-managers/compiz.nix b/nixos/modules/services/x11/window-managers/compiz.nix
index 209401f2646..ffd71e5f91e 100644
--- a/nixos/modules/services/x11/window-managers/compiz.nix
+++ b/nixos/modules/services/x11/window-managers/compiz.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/default.nix b/nixos/modules/services/x11/window-managers/default.nix
index 93e3b6ddf4c..45a4e947e0a 100644
--- a/nixos/modules/services/x11/window-managers/default.nix
+++ b/nixos/modules/services/x11/window-managers/default.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.xserver.windowManager;
@@ -16,7 +16,8 @@ in
./wmii.nix
./xmonad.nix
./i3.nix
- ./xbmc.nix
+ ./herbstluftwm.nix
+ ./bspwm.nix
];
options = {
diff --git a/nixos/modules/services/x11/window-managers/herbstluftwm.nix b/nixos/modules/services/x11/window-managers/herbstluftwm.nix
new file mode 100644
index 00000000000..6cda910b6b3
--- /dev/null
+++ b/nixos/modules/services/x11/window-managers/herbstluftwm.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.windowManager.herbstluftwm;
+in
+
+{
+ options = {
+ services.xserver.windowManager.herbstluftwm.enable = mkOption {
+ type = types.bool;
+ default = false;
+ example = true;
+ description = "Enable the herbstluftwm window manager.";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ services.xserver.windowManager.session = singleton {
+ name = "herbstluftwm";
+ start = "
+ ${pkgs.herbstluftwm}/bin/herbstluftwm
+ ";
+ };
+ environment.systemPackages = [ pkgs.herbstluftwm ];
+ };
+}
diff --git a/nixos/modules/services/x11/window-managers/i3.nix b/nixos/modules/services/x11/window-managers/i3.nix
index e53d86187ae..e85c3bce591 100644
--- a/nixos/modules/services/x11/window-managers/i3.nix
+++ b/nixos/modules/services/x11/window-managers/i3.nix
@@ -1,6 +1,6 @@
-{ pkgs, config, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.xserver.windowManager.i3;
diff --git a/nixos/modules/services/x11/window-managers/icewm.nix b/nixos/modules/services/x11/window-managers/icewm.nix
index b7da4051c14..36028da453a 100644
--- a/nixos/modules/services/x11/window-managers/icewm.nix
+++ b/nixos/modules/services/x11/window-managers/icewm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/metacity.nix b/nixos/modules/services/x11/window-managers/metacity.nix
index 712e2038594..d13cbcfe40e 100644
--- a/nixos/modules/services/x11/window-managers/metacity.nix
+++ b/nixos/modules/services/x11/window-managers/metacity.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/openbox.nix b/nixos/modules/services/x11/window-managers/openbox.nix
index 46b1945d33e..8fc759dda68 100644
--- a/nixos/modules/services/x11/window-managers/openbox.nix
+++ b/nixos/modules/services/x11/window-managers/openbox.nix
@@ -1,7 +1,7 @@
-{pkgs, config, ...}:
+{lib, pkgs, config, ...}:
let
- inherit (pkgs.lib) mkOption mkIf;
+ inherit (lib) mkOption mkIf;
cfg = config.services.xserver.windowManager.openbox;
in
diff --git a/nixos/modules/services/x11/window-managers/twm.nix b/nixos/modules/services/x11/window-managers/twm.nix
index d80ffe4942f..684b34c2f24 100644
--- a/nixos/modules/services/x11/window-managers/twm.nix
+++ b/nixos/modules/services/x11/window-managers/twm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/wmii.nix b/nixos/modules/services/x11/window-managers/wmii.nix
index b61521274fb..75f6fdfe3bc 100644
--- a/nixos/modules/services/x11/window-managers/wmii.nix
+++ b/nixos/modules/services/x11/window-managers/wmii.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/xbmc.nix b/nixos/modules/services/x11/window-managers/xbmc.nix
deleted file mode 100644
index 46494202b40..00000000000
--- a/nixos/modules/services/x11/window-managers/xbmc.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{pkgs, config, ...}:
-
-let
- inherit (pkgs.lib) mkOption mkIf;
- cfg = config.services.xserver.windowManager.xbmc;
-in
-
-{
- options = {
- services.xserver.windowManager.xbmc = {
- enable = mkOption {
- default = false;
- example = true;
- description = "Enable the xbmc multimedia center.";
- };
- };
- };
-
- config = mkIf cfg.enable {
- services.xserver.windowManager = {
- session = [{
- name = "xbmc";
- start = "
- ${pkgs.xbmc}/bin/xbmc --lircdev /var/run/lirc/lircd --standalone &
- waitPID=$!
- ";
- }];
- };
- environment.systemPackages = [ pkgs.xbmc ];
- };
-}
diff --git a/nixos/modules/services/x11/window-managers/xmonad.nix b/nixos/modules/services/x11/window-managers/xmonad.nix
index 2cbb5002d6c..74acfc21975 100644
--- a/nixos/modules/services/x11/window-managers/xmonad.nix
+++ b/nixos/modules/services/x11/window-managers/xmonad.nix
@@ -1,10 +1,14 @@
-{pkgs, config, ...}:
+{pkgs, lib, config, ...}:
let
- inherit (pkgs.lib) mkOption mkIf;
+ inherit (lib) mkOption mkIf optionals literalExample;
cfg = config.services.xserver.windowManager.xmonad;
+ xmonadEnv = cfg.haskellPackages.ghcWithPackages(self: [
+ self.xmonad
+ ] ++ optionals cfg.enableContribAndExtras [ self.xmonadContrib self.xmonadExtras]
+ ++ optionals (cfg.extraPackages != null) (cfg.extraPackages self));
+ xmessage = pkgs.xlibs.xmessage;
in
-
{
options = {
services.xserver.windowManager.xmonad = {
@@ -13,18 +17,53 @@ in
example = true;
description = "Enable the xmonad window manager.";
};
+
+ haskellPackages = mkOption {
+ default = pkgs.haskellPackages;
+ defaultText = "pkgs.haskellPackages";
+ example = literalExample "pkgs.haskellPackages_ghc701";
+ description = ''
+ haskellPackages used to build Xmonad and other packages.
+ This can be used to change the GHC version used to build
+ Xmonad and the packages listed in
+ extraPackages.
+ '';
+ };
+
+ extraPackages = mkOption {
+ default = null;
+ example = literalExample ''
+ haskellPackages: [
+ haskellPackages.xmonadContrib
+ haskellPackages.monadLogger
+ ]
+ '';
+ description = ''
+ Extra packages available to ghc when rebuilding Xmonad. The
+ value must be a function which receives the attrset defined
+ in haskellpackages as the sole argument.
+ '';
+ };
+
+ enableContribAndExtras = mkOption {
+ default = false;
+ example = true;
+ type = lib.types.bool;
+ description = "Enable xmonad-{contrib,extras} in Xmonad.";
+ };
};
};
-
- config = {
+ config = mkIf cfg.enable {
services.xserver.windowManager = {
- session = mkIf cfg.enable [{
+ session = [{
name = "xmonad";
- start = "
- ${pkgs.haskellPackages.xmonad}/bin/xmonad &
+ start = ''
+ XMONAD_GHC=${xmonadEnv}/bin/ghc XMONAD_XMESSAGE=${xmessage}/bin/xmessage xmonad &
waitPID=$!
- ";
+ '';
}];
};
+
+ environment.systemPackages = [ cfg.haskellPackages.xmonad ];
};
}
diff --git a/nixos/modules/services/x11/xfs.nix b/nixos/modules/services/x11/xfs.nix
index 44c1d533c3a..196f3beb41e 100644
--- a/nixos/modules/services/x11/xfs.nix
+++ b/nixos/modules/services/x11/xfs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index da94f7cad53..5f3e8003b45 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, pkgs_i686, ... }:
+{ config, lib, pkgs, pkgs_i686, ... }:
-with pkgs.lib;
+with lib;
let
@@ -11,25 +11,16 @@ let
xorg = pkgs.xorg;
- # Map video driver names to driver packages.
+ # Map video driver names to driver packages. FIXME: move into card-specific modules.
knownVideoDrivers = {
ati_unfree = { modules = [ kernelPackages.ati_drivers_x11 ]; driverName = "fglrx"; };
nouveau = { modules = [ pkgs.xf86_video_nouveau ]; };
- nvidia = { modules = [ kernelPackages.nvidia_x11 ]; };
- nvidiaLegacy96 = { modules = [ kernelPackages.nvidia_x11_legacy96 ]; driverName = "nvidia"; };
- nvidiaLegacy173 = { modules = [ kernelPackages.nvidia_x11_legacy173 ]; driverName = "nvidia"; };
- nvidiaLegacy304 = { modules = [ kernelPackages.nvidia_x11_legacy304 ]; driverName = "nvidia"; };
unichrome = { modules = [ pkgs.xorgVideoUnichrome ]; };
virtualbox = { modules = [ kernelPackages.virtualboxGuestAdditions ]; driverName = "vboxvideo"; };
+ ati = { modules = [ pkgs.xorg.xf86videoati pkgs.xorg.glamoregl ]; };
+ intel-testing = { modules = with pkgs.xorg; [ xf86videointel-testing glamoregl ]; driverName = "intel"; };
};
- driverNames =
- optional (cfg.videoDriver != null) cfg.videoDriver ++ cfg.videoDrivers;
-
- drivers = flip map driverNames
- (name: { inherit name; driverName = name; } //
- attrByPath [name] (if (hasAttr ("xf86video" + name) xorg) then { modules = [(getAttr ("xf86video" + name) xorg) ]; } else throw "unknown video driver `${name}'") knownVideoDrivers);
-
fontsForXServer =
config.fonts.fonts ++
# We don't want these fonts in fonts.conf, because then modern,
@@ -74,7 +65,6 @@ let
monitors = foldl mkMonitor [] xrandrHeads;
in concatMapStrings (getAttr "value") monitors;
-
configFile = pkgs.stdenv.mkDerivation {
name = "xserver.conf";
@@ -176,6 +166,18 @@ in
'';
};
+ videoDrivers = mkOption {
+ type = types.listOf types.str;
+ # !!! We'd like "nv" here, but it segfaults the X server.
+ default = [ "ati" "cirrus" "intel" "vesa" "vmware" "modesetting" ];
+ example = [ "vesa" ];
+ description = ''
+ The names of the video drivers the configuration
+ supports. They will be tried in order until one that
+ supports your card is found.
+ '';
+ };
+
videoDriver = mkOption {
type = types.nullOr types.str;
default = null;
@@ -183,19 +185,16 @@ in
description = ''
The name of the video driver for your graphics card. This
option is obsolete; please set the
- instead.
+ instead.
'';
};
- videoDrivers = mkOption {
- type = types.listOf types.str;
- # !!! We'd like "nv" here, but it segfaults the X server.
- default = [ "ati" "cirrus" "intel" "vesa" "vmware" ];
- example = [ "vesa" ];
+ drivers = mkOption {
+ type = types.listOf types.attrs;
+ internal = true;
description = ''
- The names of the video drivers that the X server should
- support. The X server will try all of the drivers listed
- here until it finds one that supports your video card.
+ A list of attribute sets specifying drivers to be loaded by
+ the X11 server.
'';
};
@@ -208,49 +207,6 @@ in
'';
};
- driSupport = mkOption {
- type = types.bool;
- default = true;
- description = ''
- Whether to enable accelerated OpenGL rendering through the
- Direct Rendering Interface (DRI).
- '';
- };
-
- driSupport32Bit = mkOption {
- type = types.bool;
- default = false;
- description = ''
- On 64-bit systems, whether to support Direct Rendering for
- 32-bit applications (such as Wine). This is currently only
- supported for the nvidia driver and for
- mesa.
- '';
- };
-
- s3tcSupport = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Make S3TC(S3 Texture Compression) via libtxc_dxtn available
- to OpenGL drivers. It is essential for many games to work
- with FOSS GPU drivers.
-
- Using this library may require a patent license depending on your location.
- '';
- };
-
- startOpenSSHAgent = mkOption {
- type = types.bool;
- default = true;
- description = ''
- Whether to start the OpenSSH agent when you log in. The OpenSSH agent
- remembers private keys for you so that you don't have to type in
- passphrases every time you make an SSH connection. Use
- ssh-add to add a key to the agent.
- '';
- };
-
startGnuPGAgent = mkOption {
type = types.bool;
default = false;
@@ -343,6 +299,18 @@ in
'';
};
+ serverFlagsSection = mkOption {
+ default = "";
+ example =
+ ''
+ Option "BlankTime" "0"
+ Option "StandbyTime" "0"
+ Option "SuspendTime" "0"
+ Option "OffTime" "0"
+ '';
+ description = "Contents of the ServerFlags section of the X server configuration file.";
+ };
+
moduleSection = mkOption {
type = types.lines;
default = "";
@@ -406,6 +374,14 @@ in
'';
};
+ useGlamor = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to use the Glamor module for 2D acceleration,
+ if possible.
+ '';
+ };
};
};
@@ -416,12 +392,26 @@ in
config = mkIf cfg.enable {
+ hardware.opengl.enable = mkDefault true;
+
+ services.xserver.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
+
+ # FIXME: somehow check for unknown driver names.
+ services.xserver.drivers = flip concatMap cfg.videoDrivers (name:
+ let driver =
+ attrByPath [name]
+ (if (hasAttr ("xf86video" + name) xorg)
+ then { modules = [(getAttr ("xf86video" + name) xorg) ]; }
+ else null)
+ knownVideoDrivers;
+ in optional (driver != null) ({ inherit name; driverName = name; } // driver));
+
assertions =
- [ { assertion = !(cfg.startOpenSSHAgent && cfg.startGnuPGAgent);
+ [ { assertion = !(config.programs.ssh.startAgent && cfg.startGnuPGAgent);
message =
''
- The OpenSSH agent and GnuPG agent cannot be started both.
- Choose between `startOpenSSHAgent' and `startGnuPGAgent'.
+ The OpenSSH agent and GnuPG agent cannot be started both. Please
+ choose between ‘programs.ssh.startAgent’ and ‘services.xserver.startGnuPGAgent’.
'';
}
{ assertion = config.security.polkit.enable;
@@ -429,22 +419,6 @@ in
}
];
- boot.extraModulePackages =
- optional (elem "nvidia" driverNames) kernelPackages.nvidia_x11 ++
- optional (elem "nvidiaLegacy96" driverNames) kernelPackages.nvidia_x11_legacy96 ++
- optional (elem "nvidiaLegacy173" driverNames) kernelPackages.nvidia_x11_legacy173 ++
- optional (elem "nvidiaLegacy304" driverNames) kernelPackages.nvidia_x11_legacy304 ++
- optional (elem "virtualbox" driverNames) kernelPackages.virtualboxGuestAdditions ++
- optional (elem "ati_unfree" driverNames) kernelPackages.ati_drivers_x11;
-
- boot.blacklistedKernelModules =
- optionals (elem "nvidia" driverNames) [ "nouveau" "nvidiafb" ];
-
- environment.variables.LD_LIBRARY_PATH =
- [ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ]
- ++ pkgs.lib.optional cfg.s3tcSupport "${pkgs.libtxc_dxtn}/lib"
- ++ pkgs.lib.optional (cfg.s3tcSupport && cfg.driSupport32Bit) "${pkgs_i686.libtxc_dxtn}/lib";
-
environment.etc =
(optionals cfg.exportConfiguration
[ { source = "${configFile}";
@@ -454,21 +428,7 @@ in
{ source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
target = "X11/xkb";
}
- ])
- ++ (optionals (elem "ati_unfree" driverNames) [
-
- # according toiive on #ati you don't need the pcs, it is like registry... keeps old stuff to make your
- # life harder ;) Still it seems to be required
- { source = "${kernelPackages.ati_drivers_x11}/etc/ati";
- target = "ati";
- }
- ])
- ++ (optionals (elem "nvidia" driverNames) [
-
- { source = "${kernelPackages.nvidia_x11}/lib/vendors/nvidia.icd";
- target = "OpenCL/vendors/nvidia.icd";
- }
- ]);
+ ]);
environment.systemPackages =
[ xorg.xorgserver
@@ -484,22 +444,18 @@ in
pkgs.xterm
pkgs.xdg_utils
]
- ++ optional (elem "nvidia" driverNames) kernelPackages.nvidia_x11
- ++ optional (elem "nvidiaLegacy96" driverNames) kernelPackages.nvidia_x11_legacy96
- ++ optional (elem "nvidiaLegacy173" driverNames) kernelPackages.nvidia_x11_legacy173
- ++ optional (elem "nvidiaLegacy304" driverNames) kernelPackages.nvidia_x11_legacy304
- ++ optional (elem "virtualbox" driverNames) xorg.xrefresh
- ++ optional (elem "ati_unfree" driverNames) kernelPackages.ati_drivers_x11;
+ ++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh
+ ++ optional (elem "ati_unfree" cfg.videoDrivers) kernelPackages.ati_drivers_x11;
environment.pathsToLink =
[ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ];
systemd.defaultUnit = mkIf cfg.autorun "graphical.target";
- systemd.services."display-manager" =
+ systemd.services.display-manager =
{ description = "X11 Server";
- after = [ "systemd-udev-settle.service" "local-fs.target" ];
+ after = [ "systemd-udev-settle.service" "local-fs.target" "acpid.service" ];
restartIfChanged = false;
@@ -507,51 +463,15 @@ in
{ FONTCONFIG_FILE = "/etc/fonts/fonts.conf"; # !!! cleanup
XKB_BINDIR = "${xorg.xkbcomp}/bin"; # Needed for the Xkb extension.
XORG_DRI_DRIVER_PATH = "/run/opengl-driver/lib/dri"; # !!! Depends on the driver selected at runtime.
- } // optionalAttrs (elem "nvidia" driverNames) {
- LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11}/lib";
- } // optionalAttrs (elem "nvidiaLegacy96" driverNames) {
- LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11_legacy96}/lib";
- } // optionalAttrs (elem "nvidiaLegacy173" driverNames) {
- LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11_legacy173}/lib";
- } // optionalAttrs (elem "nvidiaLegacy304" driverNames) {
- LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11_legacy304}/lib";
- } // optionalAttrs (elem "ati_unfree" driverNames) {
- LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.ati_drivers_x11}/lib:${kernelPackages.ati_drivers_x11}/X11R6/lib64/modules/linux";
- #XORG_DRI_DRIVER_PATH = "${kernelPackages.ati_drivers_x11}/lib/dri"; # is ignored because ati drivers ship their own unpatched libglx.so !
+ LD_LIBRARY_PATH = concatStringsSep ":" (
+ [ "${xorg.libX11}/lib" "${xorg.libXext}/lib" ]
+ ++ optionals (elem "ati_unfree" cfg.videoDrivers)
+ [ "${kernelPackages.ati_drivers_x11}/lib" "${kernelPackages.ati_drivers_x11}/X11R6/lib64/modules/linux" ]
+ ++ concatLists (catAttrs "libPath" cfg.drivers));
} // cfg.displayManager.job.environment;
preStart =
''
- rm -f /run/opengl-driver{,-32}
- ${optionalString (!cfg.driSupport32Bit) "ln -sf opengl-driver /run/opengl-driver-32"}
-
- ${# !!! The OpenGL driver depends on what's detected at runtime.
- if elem "nvidia" driverNames then
- ''
- ln -sf ${kernelPackages.nvidia_x11} /run/opengl-driver
- ${optionalString cfg.driSupport32Bit
- "ln -sf ${pkgs_i686.linuxPackages.nvidia_x11.override { libsOnly = true; kernelDev = null; } } /run/opengl-driver-32"}
- ''
- else if elem "nvidiaLegacy96" driverNames then
- "ln -sf ${kernelPackages.nvidia_x11_legacy96} /run/opengl-driver"
- else if elem "nvidiaLegacy173" driverNames then
- "ln -sf ${kernelPackages.nvidia_x11_legacy173} /run/opengl-driver"
- else if elem "nvidiaLegacy304" driverNames then
- ''
- ln -sf ${kernelPackages.nvidia_x11_legacy304} /run/opengl-driver
- ${optionalString cfg.driSupport32Bit
- "ln -sf ${pkgs_i686.linuxPackages.nvidia_x11_legacy304.override { libsOnly = true; kernelDev = null; } } /run/opengl-driver-32"}
- ''
- else if elem "ati_unfree" driverNames then
- "ln -sf ${kernelPackages.ati_drivers_x11} /run/opengl-driver"
- else
- ''
- ${optionalString cfg.driSupport "ln -sf ${pkgs.mesa_drivers} /run/opengl-driver"}
- ${optionalString cfg.driSupport32Bit
- "ln -sf ${pkgs_i686.mesa_drivers} /run/opengl-driver-32"}
- ''
- }
-
${cfg.displayManager.job.preStart}
rm -f /tmp/.X0-lock
@@ -577,7 +497,7 @@ in
] ++ optional (!cfg.enableTCP) "-nolisten tcp";
services.xserver.modules =
- concatLists (catAttrs "modules" drivers) ++
+ concatLists (catAttrs "modules" cfg.drivers) ++
[ xorg.xorgserver
xorg.xf86inputevdev
];
@@ -586,6 +506,7 @@ in
''
Section "ServerFlags"
Option "AllowMouseOpenFail" "on"
+ ${cfg.serverFlagsSection}
EndSection
Section "Module"
@@ -612,18 +533,26 @@ in
${cfg.serverLayoutSection}
# Reference the Screen sections for each driver. This will
# cause the X server to try each in turn.
- ${flip concatMapStrings drivers (d: ''
+ ${flip concatMapStrings cfg.drivers (d: ''
Screen "Screen-${d.name}[0]"
'')}
EndSection
+ ${if cfg.useGlamor then ''
+ Section "Module"
+ Load "dri2"
+ Load "glamoregl"
+ EndSection
+ '' else ""}
+
# For each supported driver, add a "Device" and "Screen"
# section.
- ${flip concatMapStrings drivers (driver: ''
+ ${flip concatMapStrings cfg.drivers (driver: ''
Section "Device"
Identifier "Device-${driver.name}[0]"
- Driver "${driver.driverName}"
+ Driver "${driver.driverName or driver.name}"
+ ${if cfg.useGlamor then ''Option "AccelMethod" "glamor"'' else ""}
${cfg.deviceSection}
${xrandrDeviceSection}
EndSection
@@ -641,10 +570,6 @@ in
DefaultDepth ${toString cfg.defaultDepth}
''}
- ${optionalString (driver.name == "nvidia") ''
- Option "RandRRotation" "on"
- ''}
-
${optionalString
(driver.name != "virtualbox" &&
(cfg.resolutions != [] ||
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index e012c977164..2e5a70b3aa5 100644
--- a/nixos/modules/system/activation/activation-script.nix
+++ b/nixos/modules/system/activation/activation-script.nix
@@ -1,7 +1,7 @@
# generate the script used to activate the configuration.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -66,12 +66,15 @@ in
PATH=$PATH:$i/bin:$i/sbin
done
+ _status=0
+ trap "_status=1" ERR
+
# Ensure a consistent umask.
umask 0022
${
let
- set' = mapAttrs (n: v: if builtins.isString v then noDepEntry v else v) set;
+ set' = mapAttrs (n: v: if isString v then noDepEntry v else v) set;
withHeadlines = addAttributeName set';
in textClosureMap id (withHeadlines) (attrNames withHeadlines)
}
@@ -84,6 +87,8 @@ in
# Prevent the current configuration from being garbage-collected.
ln -sfn /run/current-system /nix/var/nix/gcroots/current-system
+
+ exit $_status
'';
};
@@ -109,12 +114,12 @@ in
''
# Various log/runtime directories.
- touch /var/run/utmp # must exist
- chgrp ${toString config.ids.gids.utmp} /var/run/utmp
- chmod 664 /var/run/utmp
+ touch /run/utmp # must exist
+ chgrp ${toString config.ids.gids.utmp} /run/utmp
+ chmod 664 /run/utmp
- mkdir -m 0755 -p /var/run/nix/current-load # for distributed builds
- mkdir -m 0700 -p /var/run/nix/remote-stores
+ mkdir -m 0755 -p /run/nix/current-load # for distributed builds
+ mkdir -m 0700 -p /run/nix/remote-stores
mkdir -m 0755 -p /var/log
@@ -127,11 +132,6 @@ in
mkdir -m 0555 -p /var/empty
'';
- system.activationScripts.media =
- ''
- mkdir -m 0755 -p /media
- '';
-
system.activationScripts.usrbinenv =
''
mkdir -m 0755 -p /usr/bin
diff --git a/nixos/modules/system/activation/no-clone.nix b/nixos/modules/system/activation/no-clone.nix
index c9ab691ce47..7f458443526 100644
--- a/nixos/modules/system/activation/no-clone.nix
+++ b/nixos/modules/system/activation/no-clone.nix
@@ -1,6 +1,6 @@
-{pkgs, ...}:
+{ lib, ... }:
-with pkgs.lib;
+with lib;
{
boot.loader.grub.device = mkOverride 0 "nodev";
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index 33ae3aef9fc..12012698efe 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -26,7 +26,10 @@ EOF
exit 1;
}
-die "This is not a NixOS installation (/etc/NIXOS is missing)!\n" unless -f "/etc/NIXOS";
+# This is a NixOS installation if it has /etc/NIXOS or a proper
+# /etc/os-release.
+die "This is not a NixOS installation!\n" unless
+ -f "/etc/NIXOS" || (read_file("/etc/os-release", err_mode => 'quiet') // "") =~ /ID=nixos/s;
openlog("nixos", "", LOG_USER);
@@ -62,7 +65,7 @@ $SIG{PIPE} = "IGNORE";
sub getActiveUnits {
# FIXME: use D-Bus or whatever to query this, since parsing the
# output of list-units is likely to break.
- my $lines = `@systemd@/bin/systemctl list-units --full`;
+ my $lines = `LANG= systemctl list-units --full --no-legend`;
my $res = {};
foreach my $line (split '\n', $lines) {
chomp $line;
@@ -94,12 +97,18 @@ sub parseFstab {
sub parseUnit {
my ($filename) = @_;
my $info = {};
- foreach my $line (read_file($filename)) {
+ parseKeyValues($info, read_file($filename));
+ parseKeyValues($info, read_file("${filename}.d/overrides.conf")) if -f "${filename}.d/overrides.conf";
+ return $info;
+}
+
+sub parseKeyValues {
+ my $info = shift;
+ foreach my $line (@_) {
# FIXME: not quite correct.
$line =~ /^([^=]+)=(.*)$/ or next;
$info->{$1} = $2;
}
- return $info;
}
sub boolIsTrue {
@@ -107,6 +116,14 @@ sub boolIsTrue {
return $s eq "yes" || $s eq "true";
}
+# As a fingerprint for determining whether a unit has changed, we use
+# its absolute path. If it has an override file, we append *its*
+# absolute path as well.
+sub fingerprintUnit {
+ my ($s) = @_;
+ return abs_path($s) . (-f "${s}.d/overrides.conf" ? " " . abs_path "${s}.d/overrides.conf" : "");
+}
+
# Stop all services that no longer exist or have changed in the new
# configuration.
my (@unitsToStop, @unitsToSkip);
@@ -123,7 +140,7 @@ while (my ($unit, $state) = each %{$activePrev}) {
$baseName =~ s/\.[a-z]*$//;
if (-e $prevUnitFile && ($state->{state} eq "active" || $state->{state} eq "activating")) {
- if (! -e $newUnitFile) {
+ if (! -e $newUnitFile || abs_path($newUnitFile) eq "/dev/null") {
push @unitsToStop, $unit;
}
@@ -158,7 +175,7 @@ while (my ($unit, $state) = each %{$activePrev}) {
}
}
- elsif (abs_path($prevUnitFile) ne abs_path($newUnitFile)) {
+ elsif (fingerprintUnit($prevUnitFile) ne fingerprintUnit($newUnitFile)) {
if ($unit eq "sysinit.target" || $unit eq "basic.target" || $unit eq "multi-user.target" || $unit eq "graphical.target") {
# Do nothing. These cannot be restarted directly.
} elsif ($unit =~ /\.mount$/) {
@@ -168,7 +185,10 @@ while (my ($unit, $state) = each %{$activePrev}) {
# FIXME: do something?
} else {
my $unitInfo = parseUnit($newUnitFile);
- if (!boolIsTrue($unitInfo->{'X-RestartIfChanged'} // "yes")) {
+ if (boolIsTrue($unitInfo->{'X-ReloadIfChanged'} // "no")) {
+ write_file($reloadListFile, { append => 1 }, "$unit\n");
+ }
+ elsif (!boolIsTrue($unitInfo->{'X-RestartIfChanged'} // "yes") || boolIsTrue($unitInfo->{'RefuseManualStop'} // "no") ) {
push @unitsToSkip, $unit;
} else {
# If this unit is socket-activated, then stop the
@@ -277,7 +297,7 @@ foreach my $device (keys %$prevSwaps) {
if (scalar @unitsToStop > 0) {
@unitsToStop = unique(@unitsToStop);
print STDERR "stopping the following units: ", join(", ", sort(@unitsToStop)), "\n";
- system("@systemd@/bin/systemctl", "stop", "--", @unitsToStop); # FIXME: ignore errors?
+ system("systemctl", "stop", "--", @unitsToStop); # FIXME: ignore errors?
}
print STDERR "NOT restarting the following units: ", join(", ", sort(@unitsToSkip)), "\n"
@@ -316,7 +336,7 @@ if (scalar @restart > 0) {
# that are symlinks to other units. We shouldn't start both at the
# same time because we'll get a "Failed to add path to set" error from
# systemd.
-my @start = unique("default.target", "timers.target", split('\n', read_file($startListFile, err_mode => 'quiet') // ""));
+my @start = unique("default.target", "timers.target", "sockets.target", split('\n', read_file($startListFile, err_mode => 'quiet') // ""));
print STDERR "starting the following units: ", join(", ", sort(@start)), "\n";
system("@systemd@/bin/systemctl", "start", "--", @start) == 0 or $res = 4;
unlink($startListFile);
@@ -337,8 +357,22 @@ system("@systemd@/bin/systemctl", "reload", "dbus.service");
my (@failed, @new, @restarting);
my $activeNew = getActiveUnits;
while (my ($unit, $state) = each %{$activeNew}) {
- push @failed, $unit if $state->{state} eq "failed" || $state->{substate} eq "auto-restart";
- push @new, $unit if $state->{state} ne "failed" && !defined $activePrev->{$unit};
+ if ($state->{state} eq "failed") {
+ push @failed, $unit;
+ }
+ elsif ($state->{state} eq "auto-restart") {
+ # A unit in auto-restart state is a failure *if* it previously failed to start
+ my $lines = `@systemd@/bin/systemctl show '$unit'`;
+ my $info = {};
+ parseKeyValues($info, split("\n", $lines));
+
+ if ($info->{ExecMainStatus} ne '0') {
+ push @failed, $unit;
+ }
+ }
+ elsif ($state->{state} ne "failed" && !defined $activePrev->{$unit}) {
+ push @new, $unit;
+ }
}
print STDERR "the following new units were started: ", join(", ", sort(@new)), "\n"
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index ada96131675..62999dceee3 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, modules, baseModules, ... }:
+{ config, lib, pkgs, modules, baseModules, ... }:
-with pkgs.lib;
+with lib;
let
@@ -11,7 +11,7 @@ let
# you can provide an easy way to boot the same configuration
# as you use, but with another kernel
# !!! fix this
- cloner = inheritParent: list: with pkgs.lib;
+ cloner = inheritParent: list:
map (childConfig:
(import ../../../lib/eval-config.nix {
inherit baseModules;
@@ -34,16 +34,24 @@ let
in ''
mkdir $out
- if [ ! -f ${kernelPath} ]; then
- echo "The bootloader cannot find the proper kernel image."
- echo "(Expecting ${kernelPath})"
- false
- fi
+ # Containers don't have their own kernel or initrd. They boot
+ # directly into stage 2.
+ ${optionalString (!config.boot.isContainer) ''
+ if [ ! -f ${kernelPath} ]; then
+ echo "The bootloader cannot find the proper kernel image."
+ echo "(Expecting ${kernelPath})"
+ false
+ fi
- ln -s ${kernelPath} $out/kernel
- ln -s ${config.system.modulesTree} $out/kernel-modules
+ ln -s ${kernelPath} $out/kernel
+ ln -s ${config.system.modulesTree} $out/kernel-modules
- ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd
+ echo -n "$kernelParams" > $out/kernel-params
+
+ ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd
+
+ ln -s ${config.hardware.firmware} $out/firmware
+ ''}
echo "$activationScript" > $out/activate
substituteInPlace $out/activate --subst-var out
@@ -56,12 +64,11 @@ let
ln -s ${config.system.build.etc}/etc $out/etc
ln -s ${config.system.path} $out/sw
ln -s "$systemd" $out/systemd
- ln -s ${config.hardware.firmware} $out/firmware
- echo -n "$kernelParams" > $out/kernel-params
echo -n "$configurationName" > $out/configuration-name
echo -n "systemd ${toString config.systemd.package.interfaceVersion}" > $out/init-interface-version
echo -n "$nixosVersion" > $out/nixos-version
+ echo -n "$system" > $out/system
mkdir $out/fine-tune
childCount=0
@@ -77,34 +84,44 @@ let
${config.system.extraSystemBuilderCmds}
'';
+ # Handle assertions
+
+ failed = map (x: x.message) (filter (x: !x.assertion) config.assertions);
+
+ showWarnings = res: fold (w: x: builtins.trace "^[[1;31mwarning: ${w}^[[0m" x) res config.warnings;
# Putting it all together. This builds a store path containing
# symlinks to the various parts of the built configuration (the
# kernel, systemd units, init scripts, etc.) as well as a script
# `switch-to-configuration' that activates the configuration and
# makes it bootable.
- system = pkgs.stdenv.mkDerivation {
- name = "nixos-${config.system.nixosVersion}";
- preferLocalBuild = true;
- buildCommand = systemBuilder;
+ baseSystem = showWarnings (
+ if [] == failed then pkgs.stdenv.mkDerivation {
+ name = "nixos-${config.system.nixosVersion}";
+ preferLocalBuild = true;
+ buildCommand = systemBuilder;
- inherit (pkgs) utillinux coreutils;
- systemd = config.systemd.package;
+ inherit (pkgs) utillinux coreutils;
+ systemd = config.systemd.package;
- inherit children;
- kernelParams = config.boot.kernelParams;
- installBootLoader =
- config.system.build.installBootLoader
- or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
- activationScript = config.system.activationScripts.script;
- nixosVersion = config.system.nixosVersion;
+ inherit children;
+ kernelParams = config.boot.kernelParams;
+ installBootLoader =
+ config.system.build.installBootLoader
+ or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
+ activationScript = config.system.activationScripts.script;
+ nixosVersion = config.system.nixosVersion;
- configurationName = config.boot.loader.grub.configurationName;
+ configurationName = config.boot.loader.grub.configurationName;
- # Needed by switch-to-configuration.
- perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
- };
+ # Needed by switch-to-configuration.
+ perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
+ } else throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failed)}");
+ # Replace runtime dependencies
+ system = fold ({ oldDependency, newDependency }: drv:
+ pkgs.replaceDependency { inherit oldDependency newDependency drv; }
+ ) baseSystem config.system.replaceRuntimeDependencies;
in
@@ -171,6 +188,33 @@ in
'';
};
+ system.replaceRuntimeDependencies = mkOption {
+ default = [];
+ example = lib.literalExample "[ ({ original = pkgs.openssl; replacement = pkgs.callPackage /path/to/openssl { ... }; }) ]";
+ type = types.listOf (types.submodule (
+ { options, ... }: {
+ options.original = mkOption {
+ type = types.package;
+ description = "The original package to override.";
+ };
+
+ options.replacement = mkOption {
+ type = types.package;
+ description = "The replacement package.";
+ };
+ })
+ );
+ apply = map ({ original, replacement, ... }: {
+ oldDependency = original;
+ newDependency = replacement;
+ });
+ description = ''
+ List of packages to override without doing a full rebuild.
+ The original derivation and replacement derivation must have the same
+ name length, and ideally should have close-to-identical directory layout.
+ '';
+ };
+
};
diff --git a/nixos/modules/system/boot/emergency-mode.nix b/nixos/modules/system/boot/emergency-mode.nix
new file mode 100644
index 00000000000..9cdab841619
--- /dev/null
+++ b/nixos/modules/system/boot/emergency-mode.nix
@@ -0,0 +1,37 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ systemd.enableEmergencyMode = mkOption {
+ default = true;
+ type = types.bool;
+ description = ''
+ Whether to enable emergency mode, which is an
+ sulogin shell started on the console if
+ mounting a filesystem fails. Since some machines (like EC2
+ instances) have no console of any kind, emergency mode doesn't
+ make sense, and it's better to continue with the boot insofar
+ as possible.
+ '';
+ };
+
+ };
+
+ ###### implementation
+
+ config = {
+
+ systemd.additionalUpstreamSystemUnits = optionals
+ config.systemd.enableEmergencyMode [
+ "emergency.target" "emergency.service"
+ ];
+
+ };
+
+}
\ No newline at end of file
diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix
index 006909fbd0c..9beb7fabce1 100644
--- a/nixos/modules/system/boot/kernel.nix
+++ b/nixos/modules/system/boot/kernel.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -145,7 +145,7 @@ in
###### implementation
- config = {
+ config = mkIf (!config.boot.isContainer) {
system.build = { inherit kernel; };
@@ -159,7 +159,7 @@ in
boot.kernel.sysctl."kernel.printk" = config.boot.consoleLogLevel;
- boot.kernelModules = [ "loop" ];
+ boot.kernelModules = [ "loop" "configs" ];
boot.initrd.availableKernelModules =
[ # Note: most of these (especially the SATA/PATA modules)
@@ -191,6 +191,7 @@ in
"ehci_hcd"
"ehci_pci"
"ohci_hcd"
+ "ohci_pci"
"xhci_hcd"
"usbhid"
"hid_generic"
@@ -199,10 +200,13 @@ in
"unix"
# Misc. stuff.
- "pcips2" "xtkbd"
+ "pcips2" "atkbd"
# To wait for SCSI devices to appear.
"scsi_wait_scan"
+
+ # Needed by the stage 2 init script.
+ "rtc_cmos"
];
boot.initrd.kernelModules =
@@ -215,36 +219,26 @@ in
# Create /etc/modules-load.d/nixos.conf, which is read by
# systemd-modules-load.service to load required kernel modules.
- # FIXME: ensure that systemd-modules-load.service is restarted if
- # this file changes.
environment.etc = singleton
{ target = "modules-load.d/nixos.conf";
source = kernelModulesConf;
};
- # Sigh. This overrides systemd's systemd-modules-load.service
- # just so we can set a restart trigger. Also make
- # multi-user.target pull it in so that it gets started if it
- # failed earlier.
systemd.services."systemd-modules-load" =
- { description = "Load Kernel Modules";
- wantedBy = [ "sysinit.target" "multi-user.target" ];
- before = [ "sysinit.target" "shutdown.target" ];
- unitConfig =
- { DefaultDependencies = "no";
- Conflicts = "shutdown.target";
- };
+ { wantedBy = [ "multi-user.target" ];
+ restartTriggers = [ kernelModulesConf ];
+ environment.MODULE_DIR = "/run/booted-system/kernel-modules/lib/modules";
serviceConfig =
- { Type = "oneshot";
- RemainAfterExit = true;
- ExecStart = "${config.systemd.package}/lib/systemd/systemd-modules-load";
- # Ignore failed module loads. Typically some of the
+ { # Ignore failed module loads. Typically some of the
# modules in ‘boot.kernelModules’ are "nice to have but
# not required" (e.g. acpi-cpufreq), so we don't want to
# barf on those.
SuccessExitStatus = "0 1";
};
- restartTriggers = [ kernelModulesConf ];
+ };
+
+ systemd.services.kmod-static-nodes =
+ { environment.MODULE_DIR = "/run/booted-system/kernel-modules/lib/modules";
};
lib.kernelConfig = {
diff --git a/nixos/modules/system/boot/loader/efi.nix b/nixos/modules/system/boot/loader/efi.nix
index 7e739173f9a..241cfc7e836 100644
--- a/nixos/modules/system/boot/loader/efi.nix
+++ b/nixos/modules/system/boot/loader/efi.nix
@@ -1,6 +1,6 @@
-{ pkgs, ... }:
+{ lib, ... }:
-with pkgs.lib;
+with lib;
{
options.boot.loader.efi = {
diff --git a/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix b/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix
index 9855c8c19dd..4b5e84f53c1 100644
--- a/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix
+++ b/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index 8b3923e30a0..0cc060db8f9 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -25,7 +25,7 @@ let
inherit (cfg)
version extraConfig extraPerEntryConfig extraEntries
extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
- default devices;
+ default devices explicitBootRoot;
path = (makeSearchPath "bin" [
pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils
]) + ":" + (makeSearchPath "sbin" [
@@ -44,7 +44,7 @@ in
boot.loader.grub = {
enable = mkOption {
- default = true;
+ default = !config.boot.isContainer;
type = types.bool;
description = ''
Whether to enable the GNU GRUB boot loader.
@@ -133,11 +133,8 @@ in
chainloader (hd0,1)+1
# GRUB 2 example
- menuentry "Windows7" {
- title Windows7
- insmod ntfs
- set root='(hd1,1)'
- chainloader +1
+ menuentry "Windows 7" {
+ chainloader (hd0,4)+1
}
'';
description = ''
@@ -212,6 +209,15 @@ in
'';
};
+ explicitBootRoot = mkOption {
+ default = "";
+ type = types.str;
+ description = ''
+ The relative path of /boot within the parent volume. Leave empty
+ if /boot is not a btrfs subvolume.
+ '';
+ };
+
};
};
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index a83733db63b..c3aa8518b8b 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -39,6 +39,7 @@ my $configurationLimit = int(get("configurationLimit"));
my $copyKernels = get("copyKernels") eq "true";
my $timeout = int(get("timeout"));
my $defaultEntry = int(get("default"));
+my $explicitBootRoot = get("explicitBootRoot");
$ENV{'PATH'} = get("path");
die "unsupported GRUB version\n" if $grubVersion != 1 && $grubVersion != 2;
@@ -61,6 +62,10 @@ if (stat("/")->dev != stat("/boot")->dev) {
$copyKernels = 1;
}
+if ($explicitBootRoot ne "") {
+ $bootRoot = $explicitBootRoot;
+}
+
# Generate the header.
my $conf .= "# Automatically generated. DO NOT EDIT THIS FILE!\n";
diff --git a/nixos/modules/system/boot/loader/grub/memtest.nix b/nixos/modules/system/boot/loader/grub/memtest.nix
index 80c1a160cfd..94e5a14174b 100644
--- a/nixos/modules/system/boot/loader/grub/memtest.nix
+++ b/nixos/modules/system/boot/loader/grub/memtest.nix
@@ -1,33 +1,87 @@
# This module adds Memtest86+ to the GRUB boot menu.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
memtest86 = pkgs.memtest86plus;
+ cfg = config.boot.loader.grub.memtest86;
in
{
options = {
- boot.loader.grub.memtest86 = mkOption {
- default = false;
- type = types.bool;
- description = ''
- Make Memtest86+, a memory testing program, available from the
- GRUB boot menu.
- '';
+ boot.loader.grub.memtest86 = {
+
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Make Memtest86+, a memory testing program, available from the
+ GRUB boot menu.
+ '';
+ };
+
+ params = mkOption {
+ default = [];
+ example = [ "console=ttyS0,115200" ];
+ type = types.listOf types.str;
+ description = ''
+ Parameters added to the Memtest86+ command line. As of memtest86+ 5.01
+ the following list of (apparently undocumented) parameters are
+ accepted:
+
+
+
+
+ console=..., set up a serial console.
+ Examples:
+ console=ttyS0,
+ console=ttyS0,9600 or
+ console=ttyS0,115200n8.
+
+
+
+ btrace, enable boot trace.
+
+
+
+ maxcpus=N, limit number of CPUs.
+
+
+
+ onepass, run one pass and exit if there
+ are no errors.
+
+
+
+ tstlist=..., list of tests to run.
+ Example: 0,1,2.
+
+
+
+ cpumask=..., set a CPU mask, to select CPUs
+ to use for testing.
+
+
+
+
+ This list of command line options was obtained by reading the
+ Memtest86+ source code.
+ '';
+ };
+
};
};
- config = mkIf config.boot.loader.grub.memtest86 {
+ config = mkIf cfg.enable {
boot.loader.grub.extraEntries =
if config.boot.loader.grub.version == 2 then
''
menuentry "Memtest86+" {
- linux16 @bootRoot@/memtest.bin
+ linux16 @bootRoot@/memtest.bin ${toString cfg.params}
}
''
else
diff --git a/nixos/modules/system/boot/loader/gummiboot/gummiboot-builder.py b/nixos/modules/system/boot/loader/gummiboot/gummiboot-builder.py
index 9ea224b51f6..db73544181b 100644
--- a/nixos/modules/system/boot/loader/gummiboot/gummiboot-builder.py
+++ b/nixos/modules/system/boot/loader/gummiboot/gummiboot-builder.py
@@ -9,7 +9,6 @@ import tempfile
import errno
def copy_if_not_exists(source, dest):
- known_paths.append(dest)
if not os.path.exists(dest):
shutil.copyfile(source, dest)
@@ -38,12 +37,13 @@ def write_loader_conf(generation):
print >> f, "default nixos-generation-%d" % (generation)
os.rename("@efiSysMountPoint@/loader/loader.conf.tmp", "@efiSysMountPoint@/loader/loader.conf")
-def copy_from_profile(generation, name):
+def copy_from_profile(generation, name, dry_run=False):
store_file_path = os.readlink("%s/%s" % (system_dir(generation), name))
suffix = os.path.basename(store_file_path)
store_dir = os.path.basename(os.path.dirname(store_file_path))
efi_file_path = "/efi/nixos/%s-%s.efi" % (store_dir, suffix)
- copy_if_not_exists(store_file_path, "@efiSysMountPoint@%s" % (efi_file_path))
+ if not dry_run:
+ copy_if_not_exists(store_file_path, "@efiSysMountPoint@%s" % (efi_file_path))
return efi_file_path
def add_entry(generation):
@@ -72,6 +72,10 @@ def get_generations(profile):
def remove_old_entries(gens):
slice_start = len("@efiSysMountPoint@/loader/entries/nixos-generation-")
slice_end = -1 * len(".conf")
+ known_paths = []
+ for gen in gens:
+ known_paths.append(copy_from_profile(gen, "kernel", True))
+ known_paths.append(copy_from_profile(gen, "initrd", True))
for path in glob.iglob("@efiSysMountPoint@/loader/entries/nixos-generation-[1-9]*.conf"):
try:
gen = int(path[slice_start:slice_end])
@@ -94,7 +98,6 @@ if os.getenv("NIXOS_INSTALL_GRUB") == "1":
else:
subprocess.check_call(["@gummiboot@/bin/gummiboot", "--path=@efiSysMountPoint@", "--no-variables", "install"])
-known_paths = []
mkdir_p("@efiSysMountPoint@/efi/nixos")
mkdir_p("@efiSysMountPoint@/loader/entries")
try:
@@ -106,9 +109,8 @@ except IOError as e:
machine_id = None
gens = get_generations("system")
+remove_old_entries(gens)
for gen in gens:
add_entry(gen)
if os.readlink(system_dir(gen)) == args.default_config:
write_loader_conf(gen)
-
-remove_old_entries(gens)
diff --git a/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix b/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix
index 9193cd3bc53..e7a481e90a7 100644
--- a/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix
+++ b/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.boot.loader.gummiboot;
@@ -14,7 +14,7 @@ let
inherit (pkgs) python gummiboot;
- inherit (config.environment) nix;
+ nix = config.nix.package;
inherit (cfg) timeout;
@@ -54,6 +54,8 @@ in {
}
];
+ boot.loader.grub.enable = mkDefault false;
+
system = {
build.installBootLoader = gummibootBuilder;
diff --git a/nixos/modules/system/boot/loader/init-script/init-script.nix b/nixos/modules/system/boot/loader/init-script/init-script.nix
index 4b0fcd85b4b..3b33d42b4ae 100644
--- a/nixos/modules/system/boot/loader/init-script/init-script.nix
+++ b/nixos/modules/system/boot/loader/init-script/init-script.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
index 5bc856c3df0..d3f32418a64 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
+++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/system/boot/luksroot.nix b/nixos/modules/system/boot/luksroot.nix
index ba357f5d2de..c923cc49c44 100644
--- a/nixos/modules/system/boot/luksroot.nix
+++ b/nixos/modules/system/boot/luksroot.nix
@@ -1,11 +1,11 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
luks = config.boot.initrd.luks;
- openCommand = { name, device, keyFile, keyFileSize, allowDiscards, ... }: ''
+ openCommand = { name, device, keyFile, keyFileSize, allowDiscards, yubikey, ... }: ''
# Wait for luksRoot to appear, e.g. if on a usb drive.
# XXX: copied and adapted from stage-1-init.sh - should be
# available as a function.
@@ -31,9 +31,161 @@ let
fi
''}
+ open_normally() {
+ cryptsetup luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} \
+ ${optionalString (keyFile != null) "--key-file=${keyFile} ${optionalString (keyFileSize != null) "--keyfile-size=${toString keyFileSize}"}"}
+ }
+
+ ${optionalString (luks.yubikeySupport && (yubikey != null)) ''
+
+ rbtohex() {
+ ( od -An -vtx1 | tr -d ' \n' )
+ }
+
+ hextorb() {
+ ( tr '[:lower:]' '[:upper:]' | sed -e 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' | xargs printf )
+ }
+
+ open_yubikey() {
+
+ # Make all of these local to this function
+ # to prevent their values being leaked
+ local salt
+ local iterations
+ local k_user
+ local challenge
+ local response
+ local k_luks
+ local opened
+ local new_salt
+ local new_iterations
+ local new_challenge
+ local new_response
+ local new_k_luks
+
+ mkdir -p ${yubikey.storage.mountPoint}
+ mount -t ${yubikey.storage.fsType} ${toString yubikey.storage.device} ${yubikey.storage.mountPoint}
+
+ salt="$(cat ${yubikey.storage.mountPoint}${yubikey.storage.path} | sed -n 1p | tr -d '\n')"
+ iterations="$(cat ${yubikey.storage.mountPoint}${yubikey.storage.path} | sed -n 2p | tr -d '\n')"
+ challenge="$(echo -n $salt | openssl-wrap dgst -binary -sha512 | rbtohex)"
+ response="$(ykchalresp -${toString yubikey.slot} -x $challenge 2>/dev/null)"
+
+ for try in $(seq 3); do
+
+ ${optionalString yubikey.twoFactor ''
+ echo -n "Enter two-factor passphrase: "
+ read -s k_user
+ echo
+ ''}
+
+ if [ ! -z "$k_user" ]; then
+ k_luks="$(echo -n $k_user | pbkdf2-sha512 ${toString yubikey.keyLength} $iterations $response | rbtohex)"
+ else
+ k_luks="$(echo | pbkdf2-sha512 ${toString yubikey.keyLength} $iterations $response | rbtohex)"
+ fi
+
+ echo -n "$k_luks" | hextorb | cryptsetup luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} --key-file=-
+
+ if [ $? == "0" ]; then
+ opened=true
+ break
+ else
+ opened=false
+ echo "Authentication failed!"
+ fi
+ done
+
+ if [ "$opened" == false ]; then
+ umount ${yubikey.storage.mountPoint}
+ echo "Maximum authentication errors reached"
+ exit 1
+ fi
+
+ echo -n "Gathering entropy for new salt (please enter random keys to generate entropy if this blocks for long)..."
+ for i in $(seq ${toString yubikey.saltLength}); do
+ byte="$(dd if=/dev/random bs=1 count=1 2>/dev/null | rbtohex)";
+ new_salt="$new_salt$byte";
+ echo -n .
+ done;
+ echo "ok"
+
+ new_iterations="$iterations"
+ ${optionalString (yubikey.iterationStep > 0) ''
+ new_iterations="$(($new_iterations + ${toString yubikey.iterationStep}))"
+ ''}
+
+ new_challenge="$(echo -n $new_salt | openssl-wrap dgst -binary -sha512 | rbtohex)"
+
+ new_response="$(ykchalresp -${toString yubikey.slot} -x $new_challenge 2>/dev/null)"
+
+ if [ ! -z "$k_user" ]; then
+ new_k_luks="$(echo -n $k_user | pbkdf2-sha512 ${toString yubikey.keyLength} $new_iterations $new_response | rbtohex)"
+ else
+ new_k_luks="$(echo | pbkdf2-sha512 ${toString yubikey.keyLength} $new_iterations $new_response | rbtohex)"
+ fi
+
+ mkdir -p ${yubikey.ramfsMountPoint}
+ # A ramfs is used here to ensure that the file used to update
+ # the key slot with cryptsetup will never get swapped out.
+ # Warning: Do NOT replace with tmpfs!
+ mount -t ramfs none ${yubikey.ramfsMountPoint}
+
+ echo -n "$new_k_luks" | hextorb > ${yubikey.ramfsMountPoint}/new_key
+ echo -n "$k_luks" | hextorb | cryptsetup luksChangeKey ${device} --key-file=- ${yubikey.ramfsMountPoint}/new_key
+
+ if [ $? == "0" ]; then
+ echo -ne "$new_salt\n$new_iterations" > ${yubikey.storage.mountPoint}${yubikey.storage.path}
+ else
+ echo "Warning: Could not update LUKS key, current challenge persists!"
+ fi
+
+ rm -f ${yubikey.ramfsMountPoint}/new_key
+ umount ${yubikey.ramfsMountPoint}
+ rm -rf ${yubikey.ramfsMountPoint}
+
+ umount ${yubikey.storage.mountPoint}
+ }
+
+ ${optionalString (yubikey.gracePeriod > 0) ''
+ echo -n "Waiting ${toString yubikey.gracePeriod} seconds as grace..."
+ for i in $(seq ${toString yubikey.gracePeriod}); do
+ sleep 1
+ echo -n .
+ done
+ echo "ok"
+ ''}
+
+ yubikey_missing=true
+ ykinfo -v 1>/dev/null 2>&1
+ if [ $? != "0" ]; then
+ echo -n "waiting 10 seconds for yubikey to appear..."
+ for try in $(seq 10); do
+ sleep 1
+ ykinfo -v 1>/dev/null 2>&1
+ if [ $? == "0" ]; then
+ yubikey_missing=false
+ break
+ fi
+ echo -n .
+ done
+ echo "ok"
+ else
+ yubikey_missing=false
+ fi
+
+ if [ "$yubikey_missing" == true ]; then
+ echo "no yubikey found, falling back to non-yubikey open procedure"
+ open_normally
+ else
+ open_yubikey
+ fi
+ ''}
+
# open luksRoot and scan for logical volumes
- cryptsetup luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} \
- ${optionalString (keyFile != null) "--key-file=${keyFile} ${optionalString (keyFileSize != null) "--keyfile-size=${toString keyFileSize}"}"}
+ ${optionalString ((!luks.yubikeySupport) || (yubikey == null)) ''
+ open_normally
+ ''}
'';
isPreLVM = f: f.preLVM;
@@ -139,10 +291,108 @@ in
'';
};
- };
+ yubikey = mkOption {
+ default = null;
+ type = types.nullOr types.optionSet;
+ description = ''
+ The options to use for this LUKS device in Yubikey-PBA.
+ If null (the default), Yubikey-PBA will be disabled for this device.
+ '';
+ options = {
+ twoFactor = mkOption {
+ default = true;
+ type = types.bool;
+ description = "Whether to use a passphrase and a Yubikey (true), or only a Yubikey (false)";
+ };
+
+ slot = mkOption {
+ default = 2;
+ type = types.int;
+ description = "Which slot on the Yubikey to challenge";
+ };
+
+ saltLength = mkOption {
+ default = 16;
+ type = types.int;
+ description = "Length of the new salt in byte (64 is the effective maximum)";
+ };
+
+ keyLength = mkOption {
+ default = 64;
+ type = types.int;
+ description = "Length of the LUKS slot key derived with PBKDF2 in byte";
+ };
+
+ iterationStep = mkOption {
+ default = 0;
+ type = types.int;
+ description = "How much the iteration count for PBKDF2 is increased at each successful authentication";
+ };
+
+ gracePeriod = mkOption {
+ default = 2;
+ type = types.int;
+ description = "Time in seconds to wait before attempting to find the Yubikey";
+ };
+
+ ramfsMountPoint = mkOption {
+ default = "/crypt-ramfs";
+ type = types.string;
+ description = "Path where the ramfs used to update the LUKS key will be mounted in stage-1";
+ };
+
+ storage = mkOption {
+ type = types.optionSet;
+ description = "Options related to the storing the salt";
+
+ options = {
+ device = mkOption {
+ default = /dev/sda1;
+ type = types.path;
+ description = ''
+ An unencrypted device that will temporarily be mounted in stage-1.
+ Must contain the current salt to create the challenge for this LUKS device.
+ '';
+ };
+
+ fsType = mkOption {
+ default = "vfat";
+ type = types.string;
+ description = "The filesystem of the unencrypted device";
+ };
+
+ mountPoint = mkOption {
+ default = "/crypt-storage";
+ type = types.string;
+ description = "Path where the unencrypted device will be mounted in stage-1";
+ };
+
+ path = mkOption {
+ default = "/crypt-storage/default";
+ type = types.string;
+ description = ''
+ Absolute path of the salt on the unencrypted device with
+ that device's root directory as "/".
+ '';
+ };
+ };
+ };
+ };
+ };
+
+ };
};
+ boot.initrd.luks.yubikeySupport = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Enables support for authenticating with a Yubikey on LUKS devices.
+ See the NixOS wiki for information on how to properly setup a LUKS device
+ and a Yubikey to work with this feature.
+ '';
+ };
};
config = mkIf (luks.devices != []) {
@@ -157,15 +407,48 @@ in
# copy the cryptsetup binary and it's dependencies
boot.initrd.extraUtilsCommands = ''
cp -pdv ${pkgs.cryptsetup}/sbin/cryptsetup $out/bin
- # XXX: do we have a function that does this?
- for lib in $(ldd $out/bin/cryptsetup |grep '=>' |grep /nix/store/ |cut -d' ' -f3); do
- cp -pdvn $lib $out/lib
- cp -pvn $(readlink -f $lib) $out/lib
- done
+
+ cp -pdv ${pkgs.libgcrypt}/lib/libgcrypt*.so.* $out/lib
+ cp -pdv ${pkgs.libgpgerror}/lib/libgpg-error*.so.* $out/lib
+ cp -pdv ${pkgs.cryptsetup}/lib/libcryptsetup*.so.* $out/lib
+ cp -pdv ${pkgs.popt}/lib/libpopt*.so.* $out/lib
+
+ ${optionalString luks.yubikeySupport ''
+ cp -pdv ${pkgs.ykpers}/bin/ykchalresp $out/bin
+ cp -pdv ${pkgs.ykpers}/bin/ykinfo $out/bin
+ cp -pdv ${pkgs.openssl}/bin/openssl $out/bin
+
+ cc -O3 -I${pkgs.openssl}/include -L${pkgs.openssl}/lib ${./pbkdf2-sha512.c} -o $out/bin/pbkdf2-sha512 -lcrypto
+ strip -s $out/bin/pbkdf2-sha512
+
+ cp -pdv ${pkgs.libusb1}/lib/libusb*.so.* $out/lib
+ cp -pdv ${pkgs.ykpers}/lib/libykpers*.so.* $out/lib
+ cp -pdv ${pkgs.libyubikey}/lib/libyubikey*.so.* $out/lib
+ cp -pdv ${pkgs.openssl}/lib/libssl*.so.* $out/lib
+ cp -pdv ${pkgs.openssl}/lib/libcrypto*.so.* $out/lib
+
+ mkdir -p $out/etc/ssl
+ cp -pdv ${pkgs.openssl}/etc/ssl/openssl.cnf $out/etc/ssl
+
+ cat > $out/bin/openssl-wrap < $out/bin/openssl-wrap <
+#include
+#include
+#include
+
+void hextorb(uint8_t* hex, uint8_t* rb)
+{
+ while(sscanf(hex, "%2x", rb) == 1)
+ {
+ hex += 2;
+ rb += 1;
+ }
+ *rb = '\0';
+}
+
+int main(int argc, char** argv)
+{
+ uint8_t k_user[2048];
+ uint8_t salt[2048];
+ uint8_t key[4096];
+
+ uint32_t key_length = atoi(argv[1]);
+ uint32_t iteration_count = atoi(argv[2]);
+
+ hextorb(argv[3], salt);
+ uint32_t salt_length = strlen(argv[3]) / 2;
+
+ fgets(k_user, 2048, stdin);
+ uint32_t k_user_length = strlen(k_user);
+ if(k_user[k_user_length - 1] == '\n') {
+ k_user[k_user_length - 1] = '\0';
+ }
+
+ PKCS5_PBKDF2_HMAC(k_user, k_user_length, salt, salt_length, iteration_count, EVP_sha512(), key_length, key);
+ fwrite(key, 1, key_length, stdout);
+
+ return 0;
+}
\ No newline at end of file
diff --git a/nixos/modules/system/boot/shutdown.nix b/nixos/modules/system/boot/shutdown.nix
index ad71a2e816e..11041066e07 100644
--- a/nixos/modules/system/boot/shutdown.nix
+++ b/nixos/modules/system/boot/shutdown.nix
@@ -1,25 +1,25 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
# This unit saves the value of the system clock to the hardware
# clock on shutdown.
- systemd.units."save-hwclock.service" =
- { wantedBy = [ "shutdown.target" ];
+ systemd.services.save-hwclock =
+ { description = "Save Hardware Clock";
- text =
- ''
- [Unit]
- Description=Save Hardware Clock
- DefaultDependencies=no
- Before=shutdown.target
+ wantedBy = [ "shutdown.target" ];
- [Service]
- Type=oneshot
- ExecStart=${pkgs.utillinux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"}
- '';
+ unitConfig = {
+ DefaultDependencies = false;
+ ConditionPathExists = "/dev/rtc";
+ };
+
+ serviceConfig = {
+ Type = "oneshot";
+ ExecStart = "${pkgs.utillinux}/sbin/hwclock --systohc ${if config.time.hardwareClockInLocalTime then "--localtime" else "--utc"}";
+ };
};
boot.kernel.sysctl."kernel.poweroff_cmd" = "${config.systemd.package}/sbin/poweroff";
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index 1f65026b5de..73fc6ce543c 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -4,7 +4,8 @@ targetRoot=/mnt-root
console=tty1
export LD_LIBRARY_PATH=@extraUtils@/lib
-export PATH=@extraUtils@/bin:@extraUtils@/sbin
+export PATH=@extraUtils@/bin
+ln -s @extraUtils@/bin /bin
fail() {
@@ -14,7 +15,7 @@ fail() {
# in an interactive shell.
cat <&-
udevadm control --exit || true
# Kill any remaining processes, just to be sure we're not taking any
-# with us into stage 2. unionfs-fuse mounts require the unionfs process.
-pkill -9 -v '(1|unionfs)'
+# with us into stage 2. But keep storage daemons like unionfs-fuse.
+pkill -9 -v -f '@'
if test -n "$debug1mounts"; then fail; fi
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index b2b66280372..6a069c5d054 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -3,9 +3,9 @@
# the modules necessary to mount the root file system, then calls the
# init in the root file system to start the second boot stage.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -23,22 +23,6 @@ let
};
- needsCifsUtils = kernelPackages.kernel ? features
- && kernelPackages.kernel.features ? needsCifsUtils
- && kernelPackages.kernel.features.needsCifsUtils
- && any (fs: fs.fsType == "cifs") fileSystems;
-
- busybox =
- if needsCifsUtils
- then pkgs.busybox.override {
- extraConfig = ''
- CONFIG_FEATURE_MOUNT_CIFS n
- CONFIG_FEATURE_MOUNT_HELPERS y
- '';
- }
- else pkgs.busybox;
-
-
# Some additional utilities needed in stage 1, like mount, lvm, fsck
# etc. We don't want to bring in all of those packages, so we just
# copy what we need. Instead of using statically linked binaries,
@@ -51,6 +35,7 @@ let
}
''
mkdir -p $out/bin $out/lib
+ ln -s $out/bin $out/sbin
# Copy what we need from Glibc.
cp -pv ${pkgs.glibc}/lib/ld*.so.? $out/lib
@@ -62,11 +47,10 @@ let
cp -pv ${pkgs.gcc.gcc}/lib*/libgcc_s.so.* $out/lib
# Copy BusyBox.
- cp -rvd ${busybox}/{bin,sbin} $out/
- chmod -R u+w $out
+ cp -pvd ${pkgs.busybox}/bin/* ${pkgs.busybox}/sbin/* $out/bin/
# Copy some utillinux stuff.
- cp -v ${pkgs.utillinux}/sbin/blkid $out/bin
+ cp -vf ${pkgs.utillinux}/sbin/blkid $out/bin
cp -pdv ${pkgs.utillinux}/lib/libblkid*.so.* $out/lib
cp -pdv ${pkgs.utillinux}/lib/libuuid*.so.* $out/lib
@@ -74,7 +58,7 @@ let
cp -v ${pkgs.lvm2}/sbin/dmsetup $out/bin/dmsetup
cp -v ${pkgs.lvm2}/sbin/lvm $out/bin/lvm
cp -v ${pkgs.lvm2}/lib/libdevmapper.so.*.* $out/lib
- cp -v ${pkgs.systemd}/lib/libsystemd-daemon.so.* $out/lib
+ cp -v ${pkgs.systemd}/lib/libsystemd.so.* $out/lib
# Add RAID mdadm tool.
cp -v ${pkgs.mdadm}/sbin/mdadm $out/bin/mdadm
@@ -89,12 +73,7 @@ let
# Copy modprobe.
cp -v ${pkgs.kmod}/bin/kmod $out/bin/
- ln -s kmod $out/bin/modprobe
-
- # Maybe copy cifs utils
- ${optionalString needsCifsUtils ''
- cp -v ${pkgs.cifs_utils}/sbin/mount.cifs $out/bin
- ''}
+ ln -sf kmod $out/bin/modprobe
${config.boot.initrd.extraUtilsCommands}
@@ -140,7 +119,7 @@ let
udevRules = pkgs.stdenv.mkDerivation {
name = "udev-rules";
buildCommand = ''
- ensureDir $out
+ mkdir -p $out
echo 'ENV{LD_LIBRARY_PATH}="${extraUtils}/lib"' > $out/00-env.rules
@@ -313,6 +292,13 @@ in
example = "xz";
};
+ boot.initrd.supportedFilesystems = mkOption {
+ default = [ ];
+ example = [ "btrfs" ];
+ type = types.listOf types.string;
+ description = "Names of supported filesystem types in the initial ramdisk.";
+ };
+
fileSystems = mkOption {
options.neededForBoot = mkOption {
default = false;
@@ -328,7 +314,12 @@ in
};
- config = {
+ config = mkIf (!config.boot.isContainer) {
+
+ assertions = singleton
+ { assertion = any (fs: fs.mountPoint == "/") (attrValues config.fileSystems);
+ message = "The ‘fileSystems’ option does not specify your root file system.";
+ };
system.build.bootStage1 = bootStage1;
system.build.initialRamdisk = initialRamdisk;
@@ -339,5 +330,10 @@ in
(isYes "BLK_DEV_INITRD")
];
+ # Prevent systemd from waiting for the /dev/root symlink.
+ systemd.units."dev-root.device".text = "";
+
+ boot.initrd.supportedFilesystems = map (fs: fs.fsType) fileSystems;
+
};
}
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index 2fadd3de1f0..6fff776f858 100644
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -29,16 +29,18 @@ setPath "@path@"
# Normally, stage 1 mounts the root filesystem read/writable.
# However, in some environments, stage 2 is executed directly, and the
# root is read-only. So make it writable here.
-mount -n -o remount,rw /
+if [ "$container" != systemd-nspawn ]; then
+ mount -n -o remount,rw none /
+fi
# Likewise, stage 1 mounts /proc, /dev and /sys, so if we don't have a
# stage 1, we need to do that here.
if [ ! -e /proc/1 ]; then
mkdir -m 0755 -p /proc
- mount -n -t proc none /proc
+ mount -n -t proc proc /proc
mkdir -m 0755 -p /dev
- mount -t devtmpfs none /dev
+ mount -t devtmpfs devtmpfs /dev
fi
@@ -84,7 +86,7 @@ done
mkdir -m 0755 /dev/shm
mount -t tmpfs -o "rw,nosuid,nodev,size=@devShmSize@" tmpfs /dev/shm
mkdir -m 0755 -p /dev/pts
-[ -e /proc/bus/usb ] && mount -t usbfs none /proc/bus/usb # UML doesn't have USB by default
+[ -e /proc/bus/usb ] && mount -t usbfs usbfs /proc/bus/usb # UML doesn't have USB by default
mkdir -m 01777 -p /tmp
mkdir -m 0755 -p /var /var/log /var/lib /var/db
mkdir -m 0755 -p /nix/var
@@ -96,28 +98,8 @@ mkdir -m 0755 -p /etc/nixos
# Miscellaneous boot time cleanup.
rm -rf /var/run /var/lock
-rm -f /etc/resolv.conf
-touch /etc/resolv.conf
rm -f /etc/{group,passwd,shadow}.lock
-if test -n "@cleanTmpDir@"; then
- echo -n "cleaning \`/tmp'..."
- find /tmp -maxdepth 1 -mindepth 1 -print0 | xargs -0r rm -rf --one-file-system
- echo " done"
-else
- # Get rid of ICE locks...
- rm -rf /tmp/.ICE-unix
-fi
-
-# ... and ensure that it's owned by root.
-mkdir -m 1777 /tmp/.ICE-unix
-
-# This is a good time to clean up /nix/var/nix/chroots. Doing an `rm
-# -rf' on it isn't safe in general because it can contain bind mounts
-# to /nix/store and other places. But after rebooting these are all
-# gone, of course.
-rm -rf /nix/var/nix/chroots # recreated in activate-configuration.sh
-
# Also get rid of temporary GC roots.
rm -rf /nix/var/nix/gcroots/tmp /nix/var/nix/temproots
@@ -128,7 +110,17 @@ rm -rf /nix/var/nix/gcroots/tmp /nix/var/nix/temproots
if ! mountpoint -q /run; then
rm -rf /run
mkdir -m 0755 -p /run
- mount -t tmpfs -o "mode=0755,size=@runSize@" none /run
+ mount -t tmpfs -o "mode=0755,size=@runSize@" tmpfs /run
+fi
+
+# Create a ramfs on /run/keys to hold secrets that shouldn't be
+# written to disk (generally used for NixOps, harmless elsewhere).
+if ! mountpoint -q /run/keys; then
+ rm -rf /run/keys
+ mkdir /run/keys
+ mount -t ramfs ramfs /run/keys
+ chown 0:96 /run/keys
+ chmod 0750 /run/keys
fi
mkdir -m 0755 -p /run/lock
@@ -146,12 +138,32 @@ if test -n "$resumeDevice"; then
fi
+# Use /etc/resolv.conf supplied by systemd-nspawn, if applicable.
+if [ -n "@useHostResolvConf@" -a -e /etc/resolv.conf ]; then
+ cat /etc/resolv.conf | resolvconf -m 1000 -a host
+else
+ touch /etc/resolv.conf
+fi
+
+
+# Create /var/setuid-wrappers as a tmpfs.
+rm -rf /var/setuid-wrappers
+mkdir -m 0755 -p /var/setuid-wrappers
+mount -t tmpfs -o "mode=0755" tmpfs /var/setuid-wrappers
+
+
# Run the script that performs all configuration activation that does
# not have to be done at boot time.
echo "running activation script..."
$systemConfig/activate
+# Restore the system time from the hardware clock. We do this after
+# running the activation script to be sure that /etc/localtime points
+# at the current time zone.
+hwclock --hctosys
+
+
# Record the boot configuration.
ln -sfn "$systemConfig" /run/booted-system
@@ -170,4 +182,4 @@ echo "starting systemd..."
PATH=/run/current-system/systemd/lib/systemd \
MODULE_DIR=/run/booted-system/kernel-modules/lib/modules \
LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive \
- exec systemd --log-target=journal # --log-level=debug --log-target=console --crash-shell
+ exec systemd
diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix
index aa0d7e0c138..6155bb37cc5 100644
--- a/nixos/modules/system/boot/stage-2.nix
+++ b/nixos/modules/system/boot/stage-2.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -17,15 +17,16 @@ let
src = ./stage-2-init.sh;
shellDebug = "${pkgs.bashInteractive}/bin/bash";
isExecutable = true;
- inherit (config.boot) devShmSize runSize cleanTmpDir;
+ inherit (config.boot) devShmSize runSize;
inherit (config.nix) readOnlyStore;
+ inherit (config.networking) useHostResolvConf;
ttyGid = config.ids.gids.tty;
path =
[ pkgs.coreutils
pkgs.utillinux
pkgs.sysvtools
- ] ++ (optional config.boot.cleanTmpDir pkgs.findutils)
- ++ optional config.nix.readOnlyStore readonlyMountpoint;
+ pkgs.openresolv
+ ] ++ optional config.nix.readOnlyStore readonlyMountpoint;
postBootCommands = pkgs.writeText "local-cmds"
''
${config.boot.postBootCommands}
@@ -79,14 +80,6 @@ in
'';
};
- cleanTmpDir = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Whether to delete all files in /tmp during boot.
- '';
- };
-
};
};
diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix
index a1faea886f9..a6183c47eb1 100644
--- a/nixos/modules/system/boot/systemd-unit-options.nix
+++ b/nixos/modules/system/boot/systemd-unit-options.nix
@@ -1,6 +1,6 @@
-{ config, pkgs }:
+{ config, lib }:
-with pkgs.lib;
+with lib;
let
@@ -14,9 +14,21 @@ let
in if errors == [] then true
else builtins.trace (concatStringsSep "\n" errors) false;
+ unitOption = mkOptionType {
+ name = "systemd option";
+ merge = loc: defs:
+ let
+ defs' = filterOverrides defs;
+ defs'' = getValues defs';
+ in
+ if isList (head defs'')
+ then concatLists defs''
+ else mergeOneOption loc defs';
+ };
+
in rec {
- unitOptions = {
+ sharedOptions = {
enable = mkOption {
default = true;
@@ -29,74 +41,6 @@ in rec {
'';
};
- description = mkOption {
- default = "";
- type = types.str;
- description = "Description of this unit used in systemd messages and progress indicators.";
- };
-
- requires = mkOption {
- default = [];
- type = types.listOf types.string;
- description = ''
- Start the specified units when this unit is started, and stop
- this unit when the specified units are stopped or fail.
- '';
- };
-
- wants = mkOption {
- default = [];
- type = types.listOf types.string;
- description = ''
- Start the specified units when this unit is started.
- '';
- };
-
- after = mkOption {
- default = [];
- type = types.listOf types.string;
- description = ''
- If the specified units are started at the same time as
- this unit, delay this unit until they have started.
- '';
- };
-
- before = mkOption {
- default = [];
- type = types.listOf types.string;
- description = ''
- If the specified units are started at the same time as
- this unit, delay them until this unit has started.
- '';
- };
-
- bindsTo = mkOption {
- default = [];
- type = types.listOf types.string;
- description = ''
- Like ‘requires’, but in addition, if the specified units
- unexpectedly disappear, this unit will be stopped as well.
- '';
- };
-
- partOf = mkOption {
- default = [];
- type = types.listOf types.string;
- description = ''
- If the specified units are stopped or restarted, then this
- unit is stopped or restarted as well.
- '';
- };
-
- conflicts = mkOption {
- default = [];
- type = types.listOf types.string;
- description = ''
- If the specified units are started, then this unit is stopped
- and vice versa.
- '';
- };
-
requiredBy = mkOption {
default = [];
type = types.listOf types.string;
@@ -109,10 +53,97 @@ in rec {
description = "Units that want (i.e. depend on) this unit.";
};
+ };
+
+ concreteUnitOptions = sharedOptions // {
+
+ text = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = "Text of this systemd unit.";
+ };
+
+ unit = mkOption {
+ internal = true;
+ description = "The generated unit.";
+ };
+
+ };
+
+ commonUnitOptions = sharedOptions // {
+
+ description = mkOption {
+ default = "";
+ type = types.str;
+ description = "Description of this unit used in systemd messages and progress indicators.";
+ };
+
+ requires = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = ''
+ Start the specified units when this unit is started, and stop
+ this unit when the specified units are stopped or fail.
+ '';
+ };
+
+ wants = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = ''
+ Start the specified units when this unit is started.
+ '';
+ };
+
+ after = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = ''
+ If the specified units are started at the same time as
+ this unit, delay this unit until they have started.
+ '';
+ };
+
+ before = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = ''
+ If the specified units are started at the same time as
+ this unit, delay them until this unit has started.
+ '';
+ };
+
+ bindsTo = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = ''
+ Like ‘requires’, but in addition, if the specified units
+ unexpectedly disappear, this unit will be stopped as well.
+ '';
+ };
+
+ partOf = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = ''
+ If the specified units are stopped or restarted, then this
+ unit is stopped or restarted as well.
+ '';
+ };
+
+ conflicts = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = ''
+ If the specified units are started, then this unit is stopped
+ and vice versa.
+ '';
+ };
+
unitConfig = mkOption {
default = {};
example = { RequiresMountsFor = "/data"; };
- type = types.attrs;
+ type = types.attrsOf unitOption;
description = ''
Each attribute in this set specifies an option in the
[Unit] section of the unit. See
@@ -123,6 +154,7 @@ in rec {
restartTriggers = mkOption {
default = [];
+ type = types.listOf types.unspecified;
description = ''
An arbitrary list of items such as derivations. If any item
in the list changes between reconfigurations, the service will
@@ -133,11 +165,11 @@ in rec {
};
- serviceOptions = unitOptions // {
+ serviceOptions = commonUnitOptions // {
environment = mkOption {
default = {};
- type = types.attrs;
+ type = types.attrs; # FIXME
example = { PATH = "/foo/bar/bin"; LANG = "nl_NL.UTF-8"; };
description = "Environment variables passed to the service's processes.";
};
@@ -159,7 +191,7 @@ in rec {
{ StartLimitInterval = 10;
RestartSec = 5;
};
- type = types.addCheck types.attrs checkService;
+ type = types.addCheck (types.attrsOf unitOption) checkService;
description = ''
Each attribute in this set specifies an option in the
[Service] section of the unit. See
@@ -169,7 +201,7 @@ in rec {
};
script = mkOption {
- type = types.str;
+ type = types.lines;
default = "";
description = "Shell commands executed as the service's main process.";
};
@@ -181,7 +213,7 @@ in rec {
};
preStart = mkOption {
- type = types.string;
+ type = types.lines;
default = "";
description = ''
Shell commands executed before the service's main process
@@ -190,7 +222,7 @@ in rec {
};
postStart = mkOption {
- type = types.string;
+ type = types.lines;
default = "";
description = ''
Shell commands executed after the service's main process
@@ -198,8 +230,16 @@ in rec {
'';
};
+ preStop = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Shell commands executed to stop the service.
+ '';
+ };
+
postStop = mkOption {
- type = types.string;
+ type = types.lines;
default = "";
description = ''
Shell commands executed after the service's main process
@@ -216,6 +256,17 @@ in rec {
'';
};
+ reloadIfChanged = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether the service should be reloaded during a NixOS
+ configuration switch if its definition has changed. If
+ enabled, the value of is
+ ignored.
+ '';
+ };
+
stopIfChanged = mkOption {
type = types.bool;
default = true;
@@ -248,11 +299,11 @@ in rec {
};
- socketOptions = unitOptions // {
+ socketOptions = commonUnitOptions // {
listenStreams = mkOption {
default = [];
- type = types.listOf types.string;
+ type = types.listOf types.str;
example = [ "0.0.0.0:993" "/run/my-socket" ];
description = ''
For each item in this list, a ListenStream
@@ -263,7 +314,7 @@ in rec {
socketConfig = mkOption {
default = {};
example = { ListenStream = "/run/my-socket"; };
- type = types.attrs;
+ type = types.attrsOf unitOption;
description = ''
Each attribute in this set specifies an option in the
[Socket] section of the unit. See
@@ -275,12 +326,12 @@ in rec {
};
- timerOptions = unitOptions // {
+ timerOptions = commonUnitOptions // {
timerConfig = mkOption {
default = {};
example = { OnCalendar = "Sun 14:00:00"; Unit = "foo.service"; };
- type = types.attrs;
+ type = types.attrsOf unitOption;
description = ''
Each attribute in this set specifies an option in the
[Timer] section of the unit. See
@@ -294,7 +345,24 @@ in rec {
};
- mountOptions = unitOptions // {
+ pathOptions = commonUnitOptions // {
+
+ pathConfig = mkOption {
+ default = {};
+ example = { PathChanged = "/some/path"; Unit = "changedpath.service"; };
+ type = types.attrsOf unitOption;
+ description = ''
+ Each attribute in this set specifies an option in the
+ [Path] section of the unit. See
+ systemd.path
+ 5 for details.
+ '';
+ };
+
+ };
+
+
+ mountOptions = commonUnitOptions // {
what = mkOption {
example = "/dev/sda1";
@@ -328,7 +396,7 @@ in rec {
mountConfig = mkOption {
default = {};
example = { DirectoryMode = "0775"; };
- type = types.attrs;
+ type = types.attrsOf unitOption;
description = ''
Each attribute in this set specifies an option in the
[Mount] section of the unit. See
@@ -338,7 +406,7 @@ in rec {
};
};
- automountOptions = unitOptions // {
+ automountOptions = commonUnitOptions // {
where = mkOption {
example = "/mnt";
@@ -352,7 +420,7 @@ in rec {
automountConfig = mkOption {
default = {};
example = { DirectoryMode = "0775"; };
- type = types.attrs;
+ type = types.attrsOf unitOption;
description = ''
Each attribute in this set specifies an option in the
[Automount] section of the unit. See
@@ -362,4 +430,6 @@ in rec {
};
};
+ targetOptions = commonUnitOptions;
+
}
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index c1fb2c45165..e353e9246b0 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -1,8 +1,8 @@
-{ config, pkgs, utils, ... }:
+{ config, lib, pkgs, utils, ... }:
-with pkgs.lib;
+with lib;
with utils;
-with import ./systemd-unit-options.nix { inherit config pkgs; };
+with import ./systemd-unit-options.nix { inherit config lib; };
let
@@ -11,23 +11,26 @@ let
systemd = cfg.package;
makeUnit = name: unit:
- pkgs.runCommand "unit" { inherit (unit) text; preferLocalBuild = true; }
- (if unit.enable then ''
- mkdir -p $out
- echo -n "$text" > $out/${name}
- '' else ''
- mkdir -p $out
- ln -s /dev/null $out/${name}
- '');
+ if unit.enable then
+ pkgs.runCommand "unit" { preferLocalBuild = true; inherit (unit) text; }
+ ''
+ mkdir -p $out
+ echo -n "$text" > $out/${shellEscape name}
+ ''
+ else
+ pkgs.runCommand "unit" { preferLocalBuild = true; }
+ ''
+ mkdir -p $out
+ ln -s /dev/null $out/${shellEscape name}
+ '';
- upstreamUnits =
+ upstreamSystemUnits =
[ # Targets.
"basic.target"
"sysinit.target"
"sockets.target"
"graphical.target"
"multi-user.target"
- "getty.target"
"network.target"
"network-online.target"
"nss-lookup.target"
@@ -37,6 +40,7 @@ let
"sigpwr.target"
"timers.target"
"paths.target"
+ "rpcbind.target"
# Rescue mode.
"rescue.target"
@@ -49,6 +53,13 @@ let
"systemd-udev-settle.service"
"systemd-udev-trigger.service"
+ # Consoles.
+ "getty.target"
+ "getty@.service"
+ "serial-getty@.service"
+ "container-getty@.service"
+ "systemd-vconsole-setup.service"
+
# Hardware (started by udev when a relevant device is plugged in).
"sound.target"
"bluetooth.target"
@@ -61,12 +72,15 @@ let
#"systemd-vconsole-setup.service"
"systemd-user-sessions.service"
"dbus-org.freedesktop.login1.service"
+ "dbus-org.freedesktop.machine1.service"
"user@.service"
# Journal.
"systemd-journald.socket"
"systemd-journald.service"
"systemd-journal-flush.service"
+ "systemd-journal-gatewayd.socket"
+ "systemd-journal-gatewayd.service"
"syslog.socket"
# SysV init compatibility.
@@ -74,7 +88,8 @@ let
"systemd-initctl.service"
# Kernel module loading.
- #"systemd-modules-load.service"
+ "systemd-modules-load.service"
+ "kmod-static-nodes.service"
# Filesystems.
"systemd-fsck@.service"
@@ -87,10 +102,16 @@ let
"swap.target"
"dev-hugepages.mount"
"dev-mqueue.mount"
+ "proc-sys-fs-binfmt_misc.mount"
"sys-fs-fuse-connections.mount"
"sys-kernel-config.mount"
"sys-kernel-debug.mount"
+ # Maintaining state across reboots.
+ "systemd-random-seed.service"
+ "systemd-backlight@.service"
+ "systemd-rfkill@.service"
+
# Hibernate / suspend.
"hibernate.target"
"suspend.target"
@@ -115,61 +136,128 @@ let
"final.target"
"kexec.target"
"systemd-kexec.service"
+ "systemd-update-utmp.service"
# Password entry.
"systemd-ask-password-console.path"
"systemd-ask-password-console.service"
"systemd-ask-password-wall.path"
"systemd-ask-password-wall.service"
+
+ # Slices / containers.
+ "slices.target"
+ "-.slice"
+ "system.slice"
+ "user.slice"
+ "machine.slice"
+ "systemd-machined.service"
+
+ # Temporary file creation / cleanup.
+ "systemd-tmpfiles-clean.service"
+ "systemd-tmpfiles-clean.timer"
+ "systemd-tmpfiles-setup.service"
+ "systemd-tmpfiles-setup-dev.service"
+
+ # Misc.
+ "systemd-sysctl.service"
]
- ++ optionals cfg.enableEmergencyMode [
- "emergency.target"
- "emergency.service"
- ];
+ ++ cfg.additionalUpstreamSystemUnits;
- upstreamWants =
+ upstreamSystemWants =
[ #"basic.target.wants"
"sysinit.target.wants"
"sockets.target.wants"
"local-fs.target.wants"
"multi-user.target.wants"
- "shutdown.target.wants"
"timers.target.wants"
];
+ upstreamUserUnits =
+ [ "basic.target"
+ "default.target"
+ "exit.target"
+ "paths.target"
+ "shutdown.target"
+ "sockets.target"
+ "systemd-exit.service"
+ "timers.target"
+ ];
+
+ shellEscape = s: (replaceChars [ "\\" ] [ "\\\\" ] s);
+
makeJobScript = name: text:
- let x = pkgs.writeTextFile { name = "unit-script"; executable = true; destination = "/bin/${name}"; inherit text; };
- in "${x}/bin/${name}";
+ let x = pkgs.writeTextFile { name = "unit-script"; executable = true; destination = "/bin/${shellEscape name}"; inherit text; };
+ in "${x}/bin/${shellEscape name}";
unitConfig = { name, config, ... }: {
config = {
unitConfig =
- { Requires = concatStringsSep " " config.requires;
- Wants = concatStringsSep " " config.wants;
- After = concatStringsSep " " config.after;
- Before = concatStringsSep " " config.before;
- BindsTo = concatStringsSep " " config.bindsTo;
- PartOf = concatStringsSep " " config.partOf;
- Conflicts = concatStringsSep " " config.conflicts;
- "X-Restart-Triggers" = toString config.restartTriggers;
- } // optionalAttrs (config.description != "") {
+ optionalAttrs (config.requires != [])
+ { Requires = toString config.requires; }
+ // optionalAttrs (config.wants != [])
+ { Wants = toString config.wants; }
+ // optionalAttrs (config.after != [])
+ { After = toString config.after; }
+ // optionalAttrs (config.before != [])
+ { Before = toString config.before; }
+ // optionalAttrs (config.bindsTo != [])
+ { BindsTo = toString config.bindsTo; }
+ // optionalAttrs (config.partOf != [])
+ { PartOf = toString config.partOf; }
+ // optionalAttrs (config.conflicts != [])
+ { Conflicts = toString config.conflicts; }
+ // optionalAttrs (config.restartTriggers != [])
+ { X-Restart-Triggers = toString config.restartTriggers; }
+ // optionalAttrs (config.description != "") {
Description = config.description;
};
};
};
serviceConfig = { name, config, ... }: {
- config = {
- # Default path for systemd services. Should be quite minimal.
- path =
- [ pkgs.coreutils
- pkgs.findutils
- pkgs.gnugrep
- pkgs.gnused
- systemd
- ];
- };
+ config = mkMerge
+ [ { # Default path for systemd services. Should be quite minimal.
+ path =
+ [ pkgs.coreutils
+ pkgs.findutils
+ pkgs.gnugrep
+ pkgs.gnused
+ systemd
+ ];
+ environment.PATH = config.path;
+ }
+ (mkIf (config.preStart != "")
+ { serviceConfig.ExecStartPre = makeJobScript "${name}-pre-start" ''
+ #! ${pkgs.stdenv.shell} -e
+ ${config.preStart}
+ '';
+ })
+ (mkIf (config.script != "")
+ { serviceConfig.ExecStart = makeJobScript "${name}-start" ''
+ #! ${pkgs.stdenv.shell} -e
+ ${config.script}
+ '' + " " + config.scriptArgs;
+ })
+ (mkIf (config.postStart != "")
+ { serviceConfig.ExecStartPost = makeJobScript "${name}-post-start" ''
+ #! ${pkgs.stdenv.shell} -e
+ ${config.postStart}
+ '';
+ })
+ (mkIf (config.preStop != "")
+ { serviceConfig.ExecStop = makeJobScript "${name}-pre-stop" ''
+ #! ${pkgs.stdenv.shell} -e
+ ${config.preStop}
+ '';
+ })
+ (mkIf (config.postStop != "")
+ { serviceConfig.ExecStopPost = makeJobScript "${name}-post-stop" ''
+ #! ${pkgs.stdenv.shell} -e
+ ${config.postStop}
+ '';
+ })
+ ];
};
mountConfig = { name, config, ... }: {
@@ -206,6 +294,11 @@ let
(if isList value then value else [value]))
as));
+ commonUnitText = def: ''
+ [Unit]
+ ${attrsToSection def.unitConfig}
+ '';
+
targetToUnit = name: def:
{ inherit (def) wantedBy requiredBy enable;
text =
@@ -217,58 +310,27 @@ let
serviceToUnit = name: def:
{ inherit (def) wantedBy requiredBy enable;
- text =
+ text = commonUnitText def +
''
- [Unit]
- ${attrsToSection def.unitConfig}
-
[Service]
- Environment=PATH=${def.path}
- Environment=LD_LIBRARY_PATH=
${let env = cfg.globalEnvironment // def.environment;
- in concatMapStrings (n: "Environment=\"${n}=${getAttr n env}\"\n") (attrNames env)}
- ${optionalString (!def.restartIfChanged) "X-RestartIfChanged=false"}
+ in concatMapStrings (n:
+ let s = "Environment=\"${n}=${getAttr n env}\"\n";
+ in if stringLength s >= 2048 then throw "The value of the environment variable ‘${n}’ in systemd service ‘${name}.service’ is too long." else s) (attrNames env)}
+ ${if def.reloadIfChanged then ''
+ X-ReloadIfChanged=true
+ '' else if !def.restartIfChanged then ''
+ X-RestartIfChanged=false
+ '' else ""}
${optionalString (!def.stopIfChanged) "X-StopIfChanged=false"}
-
- ${optionalString (def.preStart != "") ''
- ExecStartPre=${makeJobScript "${name}-pre-start" ''
- #! ${pkgs.stdenv.shell} -e
- ${def.preStart}
- ''}
- ''}
-
- ${optionalString (def.script != "") ''
- ExecStart=${makeJobScript "${name}-start" ''
- #! ${pkgs.stdenv.shell} -e
- ${def.script}
- ''} ${def.scriptArgs}
- ''}
-
- ${optionalString (def.postStart != "") ''
- ExecStartPost=${makeJobScript "${name}-post-start" ''
- #! ${pkgs.stdenv.shell} -e
- ${def.postStart}
- ''}
- ''}
-
- ${optionalString (def.postStop != "") ''
- ExecStopPost=${makeJobScript "${name}-post-stop" ''
- #! ${pkgs.stdenv.shell} -e
- ${def.postStop}
- ''}
- ''}
-
${attrsToSection def.serviceConfig}
'';
};
socketToUnit = name: def:
{ inherit (def) wantedBy requiredBy enable;
- text =
+ text = commonUnitText def +
''
- [Unit]
- ${attrsToSection def.unitConfig}
-
[Socket]
${attrsToSection def.socketConfig}
${concatStringsSep "\n" (map (s: "ListenStream=${s}") def.listenStreams)}
@@ -277,23 +339,26 @@ let
timerToUnit = name: def:
{ inherit (def) wantedBy requiredBy enable;
- text =
+ text = commonUnitText def +
''
- [Unit]
- ${attrsToSection def.unitConfig}
-
[Timer]
${attrsToSection def.timerConfig}
'';
};
+ pathToUnit = name: def:
+ { inherit (def) wantedBy requiredBy enable;
+ text = commonUnitText def +
+ ''
+ [Path]
+ ${attrsToSection def.pathConfig}
+ '';
+ };
+
mountToUnit = name: def:
{ inherit (def) wantedBy requiredBy enable;
- text =
+ text = commonUnitText def +
''
- [Unit]
- ${attrsToSection def.unitConfig}
-
[Mount]
${attrsToSection def.mountConfig}
'';
@@ -301,72 +366,100 @@ let
automountToUnit = name: def:
{ inherit (def) wantedBy requiredBy enable;
- text =
+ text = commonUnitText def +
''
- [Unit]
- ${attrsToSection def.unitConfig}
-
[Automount]
${attrsToSection def.automountConfig}
'';
};
- nixosUnits = mapAttrsToList makeUnit cfg.units;
-
- units = pkgs.runCommand "units" { preferLocalBuild = true; }
- ''
+ generateUnits = type: units: upstreamUnits: upstreamWants:
+ pkgs.runCommand "${type}-units" { preferLocalBuild = true; } ''
mkdir -p $out
+
+ # Copy the upstream systemd units we're interested in.
for i in ${toString upstreamUnits}; do
- fn=${systemd}/example/systemd/system/$i
+ fn=${systemd}/example/systemd/${type}/$i
if ! [ -e $fn ]; then echo "missing $fn"; false; fi
if [ -L $fn ]; then
- cp -pd $fn $out/
+ target="$(readlink "$fn")"
+ if [ ''${target:0:3} = ../ ]; then
+ ln -s "$(readlink -f "$fn")" $out/
+ else
+ cp -pd $fn $out/
+ fi
else
ln -s $fn $out/
fi
done
+ # Copy .wants links, but only those that point to units that
+ # we're interested in.
for i in ${toString upstreamWants}; do
- fn=${systemd}/example/systemd/system/$i
+ fn=${systemd}/example/systemd/${type}/$i
if ! [ -e $fn ]; then echo "missing $fn"; false; fi
x=$out/$(basename $fn)
mkdir $x
for i in $fn/*; do
y=$x/$(basename $i)
cp -pd $i $y
- if ! [ -e $y ]; then rm -v $y; fi
+ if ! [ -e $y ]; then rm $y; fi
done
done
- for i in ${toString nixosUnits}; do
- ln -s $i/* $out/
- done
-
+ # Symlink all units provided listed in systemd.packages.
for i in ${toString cfg.packages}; do
- ln -s $i/etc/systemd/system/* $out/
+ for fn in $i/etc/systemd/${type}/* $i/lib/systemd/${type}/*; do
+ if ! [[ "$fn" =~ .wants$ ]]; then
+ ln -s $fn $out/
+ fi
+ done
done
+ # Symlink all units defined by systemd.units. If these are also
+ # provided by systemd or systemd.packages, then add them as
+ # .d/overrides.conf, which makes them extend the
+ # upstream unit.
+ for i in ${toString (mapAttrsToList (n: v: v.unit) units)}; do
+ fn=$(basename $i/*)
+ if [ -e $out/$fn ]; then
+ if [ "$(readlink -f $i/$fn)" = /dev/null ]; then
+ ln -sfn /dev/null $out/$fn
+ else
+ mkdir $out/$fn.d
+ ln -s $i/$fn $out/$fn.d/overrides.conf
+ fi
+ else
+ ln -fs $i/$fn $out/
+ fi
+ done
+
+ # Created .wants and .requires symlinks from the wantedBy and
+ # requiredBy options.
${concatStrings (mapAttrsToList (name: unit:
concatMapStrings (name2: ''
- mkdir -p $out/${name2}.wants
- ln -sfn ../${name} $out/${name2}.wants/
- '') unit.wantedBy) cfg.units)}
+ mkdir -p $out/'${name2}.wants'
+ ln -sfn '../${name}' $out/'${name2}.wants'/
+ '') unit.wantedBy) units)}
${concatStrings (mapAttrsToList (name: unit:
concatMapStrings (name2: ''
- mkdir -p $out/${name2}.requires
- ln -sfn ../${name} $out/${name2}.requires/
- '') unit.requiredBy) cfg.units)}
+ mkdir -p $out/'${name2}.requires'
+ ln -sfn '../${name}' $out/'${name2}.requires'/
+ '') unit.requiredBy) units)}
- ln -s ${cfg.defaultUnit} $out/default.target
+ ${optionalString (type == "system") ''
+ # Stupid misc. symlinks.
+ ln -s ${cfg.defaultUnit} $out/default.target
- ln -s rescue.target $out/kbrequest.target
+ ln -s rescue.target $out/kbrequest.target
- mkdir -p $out/getty.target.wants/
- ln -s ../getty@tty1.service $out/getty.target.wants/
+ mkdir -p $out/getty.target.wants/
+ ln -s ../autovt@tty1.service $out/getty.target.wants/
- ln -s ../local-fs.target ../remote-fs.target ../network.target ../nss-lookup.target \
- ../nss-user-lookup.target ../swap.target $out/multi-user.target.wants/
+ ln -s ../local-fs.target ../remote-fs.target ../network.target ../nss-lookup.target \
+ ../nss-user-lookup.target ../swap.target $out/multi-user.target.wants/
+ ''}
''; # */
in
@@ -387,32 +480,12 @@ in
description = "Definition of systemd units.";
default = {};
type = types.attrsOf types.optionSet;
- options = {
- text = mkOption {
- type = types.str;
- description = "Text of this systemd unit.";
+ options = { name, config, ... }:
+ { options = concreteUnitOptions;
+ config = {
+ unit = mkDefault (makeUnit name config);
+ };
};
- enable = mkOption {
- default = true;
- type = types.bool;
- description = ''
- If set to false, this unit will be a symlink to
- /dev/null. This is primarily useful to prevent specific
- template instances (e.g. serial-getty@ttyS0)
- from being started.
- '';
- };
- requiredBy = mkOption {
- default = [];
- type = types.listOf types.string;
- description = "Units that require (i.e. depend on and need to go down with) this unit.";
- };
- wantedBy = mkOption {
- default = [];
- type = types.listOf types.string;
- description = "Units that want (i.e. depend on) this unit.";
- };
- };
};
systemd.packages = mkOption {
@@ -424,7 +497,7 @@ in
systemd.targets = mkOption {
default = {};
type = types.attrsOf types.optionSet;
- options = [ unitOptions unitConfig ];
+ options = [ targetOptions unitConfig ];
description = "Definition of systemd target units.";
};
@@ -449,6 +522,13 @@ in
description = "Definition of systemd timer units.";
};
+ systemd.paths = mkOption {
+ default = {};
+ type = types.attrsOf types.optionSet;
+ options = [ pathOptions unitConfig ];
+ description = "Definition of systemd path units.";
+ };
+
systemd.mounts = mkOption {
default = [];
type = types.listOf types.optionSet;
@@ -486,6 +566,16 @@ in
'';
};
+ systemd.extraConfig = mkOption {
+ default = "";
+ type = types.lines;
+ example = "DefaultLimitCORE=infinity";
+ description = ''
+ Extra config options for systemd. See man systemd-system.conf for
+ available options.
+ '';
+ };
+
services.journald.console = mkOption {
default = "";
type = types.str;
@@ -516,9 +606,27 @@ in
'';
};
+ services.journald.extraConfig = mkOption {
+ default = "";
+ type = types.lines;
+ example = "Storage=volatile";
+ description = ''
+ Extra config options for systemd-journald. See man journald.conf
+ for available options.
+ '';
+ };
+
+ services.journald.enableHttpGateway = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Whether to enable the HTTP gateway to the journal.
+ '';
+ };
+
services.logind.extraConfig = mkOption {
default = "";
- type = types.str;
+ type = types.lines;
example = "HandleLidSwitch=ignore";
description = ''
Extra config options for systemd-logind. See man logind.conf for
@@ -526,16 +634,54 @@ in
'';
};
- systemd.enableEmergencyMode = mkOption {
- default = true;
- type = types.bool;
+ systemd.tmpfiles.rules = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "d /tmp 1777 root root 10d" ];
description = ''
- Whether to enable emergency mode, which is an
- sulogin shell started on the console if
- mounting a filesystem fails. Since some machines (like EC2
- instances) have no console of any kind, emergency mode doesn't
- make sense, and it's better to continue with the boot insofar
- as possible.
+ Rules for creating and cleaning up temporary files
+ automatically. See
+ tmpfiles.d5
+ for the exact format. You should not use this option to create
+ files required by systemd services, since there is no
+ guarantee that systemd-tmpfiles runs when
+ the system is reconfigured using
+ nixos-rebuild.
+ '';
+ };
+
+ systemd.user.units = mkOption {
+ description = "Definition of systemd per-user units.";
+ default = {};
+ type = types.attrsOf types.optionSet;
+ options = { name, config, ... }:
+ { options = concreteUnitOptions;
+ config = {
+ unit = mkDefault (makeUnit name config);
+ };
+ };
+ };
+
+ systemd.user.services = mkOption {
+ default = {};
+ type = types.attrsOf types.optionSet;
+ options = [ serviceOptions unitConfig serviceConfig ];
+ description = "Definition of systemd per-user service units.";
+ };
+
+ systemd.user.sockets = mkOption {
+ default = {};
+ type = types.attrsOf types.optionSet;
+ options = [ socketOptions unitConfig ];
+ description = "Definition of systemd per-user socket units.";
+ };
+
+ systemd.additionalUpstreamSystemUnits = mkOption {
+ default = [ ];
+ type = types.listOf types.str;
+ example = [ "debug-shell.service" "systemd-quotacheck.service" ];
+ description = ''
+ Additional units shipped with systemd that shall be enabled.
'';
};
@@ -546,15 +692,24 @@ in
config = {
- system.build.units = units;
+ warnings = concatLists (mapAttrsToList (name: service:
+ optional (service.serviceConfig.Type or "" == "oneshot" && service.serviceConfig.Restart or "no" != "no")
+ "Service ‘${name}.service’ with ‘Type=oneshot’ must have ‘Restart=no’") cfg.services);
+
+ system.build.units = cfg.units;
environment.systemPackages = [ systemd ];
- environment.etc."systemd/system".source = units;
+ environment.etc."systemd/system".source =
+ generateUnits "system" cfg.units upstreamSystemUnits upstreamSystemWants;
+
+ environment.etc."systemd/user".source =
+ generateUnits "user" cfg.user.units upstreamUserUnits [];
environment.etc."systemd/system.conf".text =
''
[Manager]
+ ${config.systemd.extraConfig}
'';
environment.etc."systemd/journald.conf".text =
@@ -566,6 +721,7 @@ in
ForwardToConsole=yes
TTYPath=${config.services.journald.console}
''}
+ ${config.services.journald.extraConfig}
'';
environment.etc."systemd/logind.conf".text =
@@ -585,22 +741,18 @@ in
mkdir -p /var/log/journal
chmod 0755 /var/log/journal
- # Regenerate the hardware database /var/lib/udev/hwdb.bin
- # whenever systemd changes.
- if [ ! -e /var/lib/udev/prev-systemd -o "$(readlink /var/lib/udev/prev-systemd)" != ${systemd} ]; then
- echo "regenerating udev hardware database..."
- ${systemd}/bin/udevadm hwdb --update && ln -sfn ${systemd} /var/lib/udev/prev-systemd
- fi
-
# Make all journals readable to users in the wheel and adm
# groups, in addition to those in the systemd-journal group.
# Users can always read their own journals.
- ${pkgs.acl}/bin/setfacl -nm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal
+ ${pkgs.acl}/bin/setfacl -nm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal || true
'';
# Target for ‘charon send-keys’ to hook into.
+ users.extraGroups.keys.gid = config.ids.gids.keys;
+
systemd.targets.keys =
{ description = "Security Keys";
+ unitConfig.X-StopOnReconfiguration = true;
};
systemd.units =
@@ -608,6 +760,7 @@ in
// mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.services
// mapAttrs' (n: v: nameValuePair "${n}.socket" (socketToUnit n v)) cfg.sockets
// mapAttrs' (n: v: nameValuePair "${n}.timer" (timerToUnit n v)) cfg.timers
+ // mapAttrs' (n: v: nameValuePair "${n}.path" (pathToUnit n v)) cfg.paths
// listToAttrs (map
(v: let n = escapeSystemdPath v.where;
in nameValuePair "${n}.mount" (mountToUnit n v)) cfg.mounts)
@@ -615,9 +768,15 @@ in
(v: let n = escapeSystemdPath v.where;
in nameValuePair "${n}.automount" (automountToUnit n v)) cfg.automounts);
- system.requiredKernelConfig = map config.lib.kernelConfig.isEnabled [
- "CGROUPS" "AUTOFS4_FS" "DEVTMPFS"
- ];
+ systemd.user.units =
+ mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.user.services
+ // mapAttrs' (n: v: nameValuePair "${n}.socket" (socketToUnit n v)) cfg.user.sockets;
+
+ system.requiredKernelConfig = map config.lib.kernelConfig.isEnabled
+ [ "DEVTMPFS" "CGROUPS" "INOTIFY_USER" "SIGNALFD" "TIMERFD" "EPOLL" "NET"
+ "SYSFS" "PROC_FS" "FHANDLE" "DMIID" "AUTOFS4_FS" "TMPFS_POSIX_ACL"
+ "TMPFS_XATTR" "SECCOMP"
+ ];
environment.shellAliases =
{ start = "systemctl start";
@@ -627,6 +786,8 @@ in
};
users.extraGroups.systemd-journal.gid = config.ids.gids.systemd-journal;
+ users.extraUsers.systemd-journal-gateway.uid = config.ids.uids.systemd-journal-gateway;
+ users.extraGroups.systemd-journal-gateway.gid = config.ids.gids.systemd-journal-gateway;
# Generate timer units for all services that have a ‘startAt’ value.
systemd.timers =
@@ -636,43 +797,30 @@ in
})
(filterAttrs (name: service: service.startAt != "") cfg.services);
- # FIXME: These are borrowed from upstream systemd.
- systemd.services."systemd-update-utmp" =
- { description = "Update UTMP about System Reboot/Shutdown";
- wantedBy = [ "sysinit.target" ];
- after = [ "systemd-remount-fs.service" ];
- before = [ "sysinit.target" "shutdown.target" ];
- conflicts = [ "shutdown.target" ];
- unitConfig = {
- DefaultDependencies = false;
- RequiresMountsFor = "/var/log";
- };
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = true;
- ExecStart = "${systemd}/lib/systemd/systemd-update-utmp reboot";
- ExecStop = "${systemd}/lib/systemd/systemd-update-utmp shutdown";
- };
- restartIfChanged = false;
+ systemd.sockets.systemd-journal-gatewayd.wantedBy =
+ optional config.services.journald.enableHttpGateway "sockets.target";
+
+ # Provide the systemd-user PAM service, required to run systemd
+ # user instances.
+ security.pam.services.systemd-user =
+ { # Ensure that pam_systemd gets included. This is special-cased
+ # in systemd to provide XDG_RUNTIME_DIR.
+ startSession = true;
};
- systemd.services."systemd-random-seed" =
- { description = "Load/Save Random Seed";
- wantedBy = [ "sysinit.target" "multi-user.target" ];
- after = [ "systemd-remount-fs.service" ];
- before = [ "sysinit.target" "shutdown.target" ];
- conflicts = [ "shutdown.target" ];
- unitConfig = {
- DefaultDependencies = false;
- RequiresMountsFor = "/var/lib";
- };
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = true;
- ExecStart = "${systemd}/lib/systemd/systemd-random-seed load";
- ExecStop = "${systemd}/lib/systemd/systemd-random-seed save";
- };
- };
+ environment.etc."tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf";
+
+ environment.etc."tmpfiles.d/nixos.conf".text =
+ ''
+ # This file is created automatically and should not be modified.
+ # Please change the option ‘systemd.tmpfiles.rules’ instead.
+ ${concatStringsSep "\n" cfg.tmpfiles.rules}
+ '';
+
+ systemd.services."user@".restartIfChanged = false;
+
+ systemd.services.systemd-remount-fs.restartIfChanged = false;
+ systemd.services.systemd-journal-flush.restartIfChanged = false;
};
}
diff --git a/nixos/modules/system/boot/tmp.nix b/nixos/modules/system/boot/tmp.nix
new file mode 100644
index 00000000000..5bf5e2eb2ec
--- /dev/null
+++ b/nixos/modules/system/boot/tmp.nix
@@ -0,0 +1,39 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ boot.cleanTmpDir = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to delete all files in /tmp during boot.
+ '';
+ };
+
+ boot.tmpOnTmpfs = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to mount a tmpfs on /tmp during boot.
+ '';
+ };
+
+ };
+
+ ###### implementation
+
+ config = {
+
+ systemd.additionalUpstreamSystemUnits = optional config.boot.tmpOnTmpfs "tmp.mount";
+
+ systemd.tmpfiles.rules = optional config.boot.cleanTmpDir "D! /tmp 1777 root root";
+
+ };
+
+}
\ No newline at end of file
diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix
index a8f0a59b6fa..b57b03bcf96 100644
--- a/nixos/modules/system/etc/etc.nix
+++ b/nixos/modules/system/etc/etc.nix
@@ -1,8 +1,8 @@
# Management of static files in /etc.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -19,6 +19,8 @@ let
sources = map (x: x.source) etc';
targets = map (x: x.target) etc';
modes = map (x: x.mode) etc';
+ uids = map (x: x.uid) etc';
+ gids = map (x: x.gid) etc';
};
in
@@ -87,6 +89,24 @@ in
'';
};
+ uid = mkOption {
+ default = 0;
+ type = types.int;
+ description = ''
+ UID of created file. Only takes affect when the file is
+ copied (that is, the mode is not 'symlink').
+ '';
+ };
+
+ gid = mkOption {
+ default = 0;
+ type = types.int;
+ description = ''
+ GID of created file. Only takes affect when the file is
+ copied (that is, the mode is not 'symlink').
+ '';
+ };
+
};
config = {
@@ -112,7 +132,7 @@ in
''
# Set up the statically computed bits of /etc.
echo "setting up /etc..."
- ${pkgs.perl}/bin/perl ${./setup-etc.pl} ${etc}/etc
+ ${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl ${./setup-etc.pl} ${etc}/etc
'';
};
diff --git a/nixos/modules/system/etc/make-etc.sh b/nixos/modules/system/etc/make-etc.sh
index 7cf68db9ddc..60d4ba1301a 100644
--- a/nixos/modules/system/etc/make-etc.sh
+++ b/nixos/modules/system/etc/make-etc.sh
@@ -6,6 +6,8 @@ set -f
sources_=($sources)
targets_=($targets)
modes_=($modes)
+uids_=($uids)
+gids_=($gids)
set +f
for ((i = 0; i < ${#targets_[@]}; i++)); do
@@ -35,6 +37,8 @@ for ((i = 0; i < ${#targets_[@]}; i++)); do
if test "${modes_[$i]}" != symlink; then
echo "${modes_[$i]}" > $out/etc/$target.mode
+ echo "${uids_[$i]}" > $out/etc/$target.uid
+ echo "${gids_[$i]}" > $out/etc/$target.gid
fi
fi
diff --git a/nixos/modules/system/etc/setup-etc.pl b/nixos/modules/system/etc/setup-etc.pl
index 7cb6d2a6a45..d7e15eccefc 100644
--- a/nixos/modules/system/etc/setup-etc.pl
+++ b/nixos/modules/system/etc/setup-etc.pl
@@ -3,6 +3,7 @@ use File::Find;
use File::Copy;
use File::Path;
use File::Basename;
+use File::Slurp;
my $etc = $ARGV[0] or die;
my $static = "/etc/static";
@@ -46,23 +47,55 @@ sub cleanup {
find(\&cleanup, "/etc");
+# Use /etc/.clean to keep track of copied files.
+my @oldCopied = read_file("/etc/.clean", chomp => 1, err_mode => 'quiet');
+open CLEAN, ">>/etc/.clean";
+
+
# For every file in the etc tree, create a corresponding symlink in
# /etc to /etc/static. The indirection through /etc/static is to make
# switching to a new configuration somewhat more atomic.
+my %created;
+my @copied;
+
sub link {
my $fn = substr $File::Find::name, length($etc) + 1 or next;
my $target = "/etc/$fn";
File::Path::make_path(dirname $target);
+ $created{$fn} = 1;
if (-e "$_.mode") {
- open MODE, "<$_.mode";
- my $mode = ; chomp $mode;
- close MODE;
- copy "$static/$fn", "$target.tmp" or warn;
- chmod oct($mode), "$target.tmp" or warn;
- rename "$target.tmp", $target or warn;
+ my $mode = read_file("$_.mode"); chomp $mode;
+ if ($mode eq "direct-symlink") {
+ atomicSymlink readlink("$static/$fn"), $target or warn;
+ } else {
+ my $uid = read_file("$_.uid"); chomp $uid;
+ my $gid = read_file("$_.gid"); chomp $gid;
+ copy "$static/$fn", "$target.tmp" or warn;
+ chown int($uid), int($gid), "$target.tmp" or warn;
+ chmod oct($mode), "$target.tmp" or warn;
+ rename "$target.tmp", $target or warn;
+ }
+ push @copied, $fn;
+ print CLEAN "$fn\n";
} elsif (-l "$_") {
atomicSymlink "$static/$fn", $target or warn;
}
}
find(\&link, $etc);
+
+
+# Delete files that were copied in a previous version but not in the
+# current.
+foreach my $fn (@oldCopied) {
+ if (!defined $created{$fn}) {
+ $fn = "/etc/$fn";
+ print STDERR "removing obsolete file ‘$fn’...\n";
+ unlink "$fn";
+ }
+}
+
+
+# Rewrite /etc/.clean.
+close CLEAN;
+write_file("/etc/.clean", map { "$_\n" } @copied);
diff --git a/nixos/modules/system/upstart/upstart.nix b/nixos/modules/system/upstart/upstart.nix
index aa5c8dfe64b..5c046130407 100644
--- a/nixos/modules/system/upstart/upstart.nix
+++ b/nixos/modules/system/upstart/upstart.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
-with import ../boot/systemd-unit-options.nix { inherit config pkgs; };
+with lib;
+with import ../boot/systemd-unit-options.nix { inherit config lib; };
let
@@ -93,7 +93,7 @@ let
if job.daemonType == "fork" || job.daemonType == "daemon" then { Type = "forking"; GuessMainPID = true; } else
if job.daemonType == "none" then { } else
throw "invalid daemon type `${job.daemonType}'")
- // optionalAttrs (!job.task && job.respawn)
+ // optionalAttrs (!job.task && !(job.script == "" && job.exec == "") && job.respawn)
{ Restart = "always"; }
// optionalAttrs job.task
{ Type = "oneshot"; RemainAfterExit = false; };
diff --git a/nixos/modules/tasks/cpu-freq.nix b/nixos/modules/tasks/cpu-freq.nix
index ce36a8bab09..a8c63c13428 100644
--- a/nixos/modules/tasks/cpu-freq.nix
+++ b/nixos/modules/tasks/cpu-freq.nix
@@ -1,6 +1,11 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
+
+let
+ cpupower = config.boot.kernelPackages.cpupower;
+ cfg = config.powerManagement;
+in
{
###### interface
@@ -23,29 +28,27 @@ with pkgs.lib;
###### implementation
- config = mkIf (config.powerManagement.cpuFreqGovernor != null) {
+ config = mkIf (!config.boot.isContainer && config.powerManagement.cpuFreqGovernor != null) {
- environment.systemPackages = [ pkgs.cpufrequtils ];
+ boot.kernelModules = [ "acpi-cpufreq" "speedstep-lib" "pcc-cpufreq"
+ "cpufreq_${cfg.cpuFreqGovernor}"
+ ];
- jobs.cpufreq =
- { description = "CPU Frequency Governor Setup";
+ environment.systemPackages = [ cpupower ];
- after = [ "systemd-modules-load.service" ];
- wantedBy = [ "multi-user.target" ];
-
- path = [ pkgs.cpufrequtils ];
-
- preStart = ''
- for i in $(seq 0 $(($(nproc) - 1))); do
- for gov in $(cpufreq-info -c $i -g); do
- if [ "$gov" = ${config.powerManagement.cpuFreqGovernor} ]; then
- echo "<6>setting governor on CPU $i to ‘$gov’"
- cpufreq-set -c $i -g $gov
- fi
- done
- done
- '';
+ systemd.services.cpufreq = {
+ description = "CPU Frequency Governor Setup";
+ after = [ "systemd-modules-load.service" ];
+ wantedBy = [ "multi-user.target" ];
+ path = [ cpupower ];
+ unitConfig.ConditionVirtualization = false;
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = "yes";
+ ExecStart = "${cpupower}/bin/cpupower frequency-set -g ${cfg.cpuFreqGovernor}";
+ SuccessExitStatus = "0 237";
};
- };
+ };
+ };
}
diff --git a/nixos/modules/tasks/encrypted-devices.nix b/nixos/modules/tasks/encrypted-devices.nix
new file mode 100644
index 00000000000..0370e36fbec
--- /dev/null
+++ b/nixos/modules/tasks/encrypted-devices.nix
@@ -0,0 +1,69 @@
+{ config, lib, ... }:
+
+with lib;
+
+let
+ fileSystems = attrValues config.fileSystems ++ config.swapDevices;
+ encDevs = filter (dev: dev.encrypted.enable) fileSystems;
+ keyedEncDevs = filter (dev: dev.encrypted.keyFile != null) encDevs;
+ isIn = needle: haystack: filter (p: p == needle) haystack != [];
+ anyEncrypted =
+ fold (j: v: v || j.encrypted.enable) false encDevs;
+
+ encryptedFSOptions = {
+
+ encrypted = {
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = "The block device is backed by an encrypted one, adds this device as a initrd luks entry.";
+ };
+
+ blkDev = mkOption {
+ default = null;
+ example = "/dev/sda1";
+ type = types.uniq (types.nullOr types.string);
+ description = "Location of the backing encrypted device.";
+ };
+
+ label = mkOption {
+ default = null;
+ example = "rootfs";
+ type = types.uniq (types.nullOr types.string);
+ description = "Label of the backing encrypted device.";
+ };
+
+ keyFile = mkOption {
+ default = null;
+ example = "/root/.swapkey";
+ type = types.uniq (types.nullOr types.string);
+ description = "File system location of keyfile.";
+ };
+ };
+ };
+in
+
+{
+
+ options = {
+ fileSystems = mkOption {
+ options = [encryptedFSOptions];
+ };
+ swapDevices = mkOption {
+ options = [encryptedFSOptions];
+ };
+ };
+
+ config = mkIf anyEncrypted {
+ boot.initrd = {
+ luks = {
+ devices =
+ map (dev: { name = dev.encrypted.label; device = dev.encrypted.blkDev; } ) encDevs;
+ cryptoModules = [ "aes" "sha256" "sha1" "xts" ];
+ };
+ postMountCommands =
+ concatMapStrings (dev: "cryptsetup luksOpen --key-file ${dev.encrypted.keyFile} ${dev.encrypted.label};\n") keyedEncDevs;
+ };
+ };
+}
+
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index 3f484045ed4..64a20034f3c 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, utils, ... }:
+{ config, lib, pkgs, utils, ... }:
-with pkgs.lib;
+with lib;
with utils;
let
@@ -9,7 +9,7 @@ let
prioOption = prio: optionalString (prio !=null) " pri=${toString prio}";
- fileSystemOpts = { name, ... }: {
+ fileSystemOpts = { name, config, ... }: {
options = {
@@ -68,6 +68,7 @@ let
config = {
mountPoint = mkDefault name;
+ device = mkIf (config.fsType == "tmpfs") (mkDefault config.fsType);
};
};
@@ -81,6 +82,7 @@ in
options = {
fileSystems = mkOption {
+ default = {};
example = {
"/".device = "/dev/hda1";
"/data" = {
@@ -123,13 +125,6 @@ in
description = "Names of supported filesystem types.";
};
- boot.initrd.supportedFilesystems = mkOption {
- default = [ ];
- example = [ "btrfs" ];
- type = types.listOf types.string;
- description = "Names of supported filesystem types in the initial ramdisk.";
- };
-
};
@@ -139,15 +134,11 @@ in
boot.supportedFilesystems = map (fs: fs.fsType) fileSystems;
- boot.initrd.supportedFilesystems =
- map (fs: fs.fsType)
- (filter (fs: fs.mountPoint == "/" || fs.neededForBoot) fileSystems);
-
# Add the mount helpers to the system path so that `mount' can find them.
system.fsPackages = [ pkgs.dosfstools ];
environment.systemPackages =
- [ pkgs.ntfs3g pkgs.cifs_utils ]
+ [ pkgs.ntfs3g pkgs.fuse ]
++ config.system.fsPackages;
environment.etc.fstab.text =
@@ -156,7 +147,9 @@ in
# Filesystems.
${flip concatMapStrings fileSystems (fs:
- (if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}")
+ (if fs.device != null then fs.device
+ else if fs.label != null then "/dev/disk/by-label/${fs.label}"
+ else throw "No device specified for mount point ‘${fs.mountPoint}’.")
+ " " + fs.mountPoint
+ " " + fs.fsType
+ " " + fs.options
@@ -186,6 +179,8 @@ in
let
mountPoint' = escapeSystemdPath fs.mountPoint;
device' = escapeSystemdPath fs.device;
+ # -F needed to allow bare block device without partitions
+ mkfsOpts = optional ((builtins.substring 0 3 fs.fsType) == "ext") "-F";
in nameValuePair "mkfs-${device'}"
{ description = "Initialisation of Filesystem ${fs.device}";
wantedBy = [ "${mountPoint'}.mount" ];
@@ -200,7 +195,7 @@ in
type=$(blkid -p -s TYPE -o value "${fs.device}" || true)
if [ -z "$type" ]; then
echo "creating ${fs.fsType} filesystem on ${fs.device}..."
- mkfs.${fs.fsType} "${fs.device}"
+ mkfs.${fs.fsType} ${concatStringsSep " " mkfsOpts} "${fs.device}"
fi
'';
unitConfig.RequiresMountsFor = [ "${dirOf fs.device}" ];
diff --git a/nixos/modules/tasks/filesystems/btrfs.nix b/nixos/modules/tasks/filesystems/btrfs.nix
index d95a32e2e3f..d0a2ac645e0 100644
--- a/nixos/modules/tasks/filesystems/btrfs.nix
+++ b/nixos/modules/tasks/filesystems/btrfs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/tasks/filesystems/cifs.nix b/nixos/modules/tasks/filesystems/cifs.nix
new file mode 100644
index 00000000000..c60f175db84
--- /dev/null
+++ b/nixos/modules/tasks/filesystems/cifs.nix
@@ -0,0 +1,25 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ inInitrd = any (fs: fs == "cifs") config.boot.initrd.supportedFilesystems;
+
+in
+
+{
+ config = {
+
+ system.fsPackages = [ pkgs.cifs_utils ];
+
+ boot.initrd.availableKernelModules = mkIf inInitrd
+ [ "cifs" "nls_utf8" "hmac" "md4" "ecb" "des_generic" "sha256" ];
+
+ boot.initrd.extraUtilsCommands = mkIf inInitrd
+ ''
+ cp -v ${pkgs.cifs_utils}/sbin/mount.cifs $out/bin
+ '';
+
+ };
+}
diff --git a/nixos/modules/tasks/filesystems/f2fs.nix b/nixos/modules/tasks/filesystems/f2fs.nix
new file mode 100644
index 00000000000..1ed7b1b6a62
--- /dev/null
+++ b/nixos/modules/tasks/filesystems/f2fs.nix
@@ -0,0 +1,21 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ inInitrd = any (fs: fs == "f2fs") config.boot.initrd.supportedFilesystems;
+in
+{
+ config = mkIf (any (fs: fs == "f2fs") config.boot.supportedFilesystems) {
+
+ system.fsPackages = [ pkgs.f2fs-tools ];
+
+ boot.initrd.availableKernelModules = mkIf inInitrd [ "f2fs" ];
+
+ boot.initrd.extraUtilsCommands = mkIf inInitrd ''
+ mkdir -p $out/bin $out/lib
+ cp -v ${pkgs.f2fs-tools}/sbin/fsck.f2fs $out/bin
+ cp -pdv ${pkgs.f2fs-tools}/lib/lib*.so.* $out/lib
+ '';
+ };
+}
diff --git a/nixos/modules/tasks/filesystems/nfs.nix b/nixos/modules/tasks/filesystems/nfs.nix
index 2b720a93b89..e8c3d8ab56d 100644
--- a/nixos/modules/tasks/filesystems/nfs.nix
+++ b/nixos/modules/tasks/filesystems/nfs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/tasks/filesystems/reiserfs.nix b/nixos/modules/tasks/filesystems/reiserfs.nix
index f8c6a700004..a3bfb3fed8e 100644
--- a/nixos/modules/tasks/filesystems/reiserfs.nix
+++ b/nixos/modules/tasks/filesystems/reiserfs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/tasks/filesystems/unionfs-fuse.nix b/nixos/modules/tasks/filesystems/unionfs-fuse.nix
index 177c97f85c7..fe195e0db0b 100644
--- a/nixos/modules/tasks/filesystems/unionfs-fuse.nix
+++ b/nixos/modules/tasks/filesystems/unionfs-fuse.nix
@@ -1,15 +1,22 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
- config = pkgs.lib.mkMerge [
- (pkgs.lib.mkIf (pkgs.lib.any (fs: fs == "unionfs-fuse") config.boot.initrd.supportedFilesystems) {
+ config = lib.mkMerge [
+
+ (lib.mkIf (lib.any (fs: fs == "unionfs-fuse") config.boot.initrd.supportedFilesystems) {
boot.initrd.kernelModules = [ "fuse" ];
-
+
boot.initrd.extraUtilsCommands = ''
cp -v ${pkgs.fuse}/lib/libfuse* $out/lib
+ cp -v ${pkgs.fuse}/sbin/mount.fuse $out/bin
cp -v ${pkgs.unionfs-fuse}/bin/unionfs $out/bin
+ substitute ${pkgs.unionfs-fuse}/sbin/mount.unionfs-fuse $out/bin/mount.unionfs-fuse \
+ --replace '${pkgs.bash}/bin/bash' /bin/sh \
+ --replace '${pkgs.fuse}/sbin' /bin \
+ --replace '${pkgs.unionfs-fuse}/bin' /bin
+ chmod +x $out/bin/mount.unionfs-fuse
'';
-
+
boot.initrd.postDeviceCommands = ''
# Hacky!!! fuse hard-codes the path to mount
mkdir -p /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.utillinux.name}/bin
@@ -17,8 +24,10 @@
ln -s $(which umount) /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.utillinux.name}/bin
'';
})
- (pkgs.lib.mkIf (pkgs.lib.any (fs: fs == "unionfs-fuse") config.boot.supportedFilesystems) {
+
+ (lib.mkIf (lib.any (fs: fs == "unionfs-fuse") config.boot.supportedFilesystems) {
system.fsPackages = [ pkgs.unionfs-fuse ];
})
+
];
}
diff --git a/nixos/modules/tasks/filesystems/vfat.nix b/nixos/modules/tasks/filesystems/vfat.nix
index 5ca72f142b7..4cfe6e208f7 100644
--- a/nixos/modules/tasks/filesystems/vfat.nix
+++ b/nixos/modules/tasks/filesystems/vfat.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/tasks/filesystems/xfs.nix b/nixos/modules/tasks/filesystems/xfs.nix
index 6800696a05a..5225b62a88c 100644
--- a/nixos/modules/tasks/filesystems/xfs.nix
+++ b/nixos/modules/tasks/filesystems/xfs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index efd546f3baa..d7deb44c407 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
#
# todo:
# - crontab for scrubs, etc
@@ -6,23 +6,39 @@
# - /etc/zfs/zpool.cache handling
-with pkgs.lib;
+with lib;
let
cfgSpl = config.boot.spl;
+ cfgZfs = config.boot.zfs;
+ cfgSnapshots = config.services.zfs.autoSnapshot;
+
inInitrd = any (fs: fs == "zfs") config.boot.initrd.supportedFilesystems;
inSystem = any (fs: fs == "zfs") config.boot.supportedFilesystems;
+
+ enableAutoSnapshots = cfgSnapshots.enable;
+ enableZfs = inInitrd || inSystem || enableAutoSnapshots;
+
kernel = config.boot.kernelPackages;
+ splPkg = if cfgZfs.useGit then kernel.spl_git else kernel.spl;
+ zfsPkg = if cfgZfs.useGit then kernel.zfs_git else kernel.zfs;
+
+ autosnapPkg = pkgs.zfstools.override {
+ zfs = zfsPkg;
+ };
+
+ zfsAutoSnap = "${autosnapPkg}/bin/zfs-auto-snapshot";
+
in
{
###### interface
-
- options = {
- boot.spl.hostid = mkOption {
+
+ options = {
+ boot.spl.hostid = mkOption {
default = "";
example = "0xdeadbeef";
description = ''
@@ -34,62 +50,188 @@ in
manually import pools.
'';
};
+
+ boot.zfs.useGit = mkOption {
+ type = types.bool;
+ default = false;
+ example = true;
+ description = ''
+ Use the git version of the SPL and ZFS packages.
+ Note that these are unreleased versions, with less testing, and therefore
+ may be more unstable.
+ '';
+ };
+
+ services.zfs.autoSnapshot = {
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Enable the (OpenSolaris-compatible) ZFS auto-snapshotting service.
+ Note that you must set the com.sun:auto-snapshot
+ property to true on all datasets which you wish
+ to auto-snapshot.
+
+ You can override a child dataset to use, or not use auto-snapshotting
+ by setting its flag with the given interval:
+ zfs set com.sun:auto-snapshot:weekly=false DATASET
+ '';
+ };
+
+ frequent = mkOption {
+ default = 4;
+ type = types.int;
+ description = ''
+ Number of frequent (15-minute) auto-snapshots that you wish to keep.
+ '';
+ };
+
+ hourly = mkOption {
+ default = 24;
+ type = types.int;
+ description = ''
+ Number of hourly auto-snapshots that you wish to keep.
+ '';
+ };
+
+ daily = mkOption {
+ default = 7;
+ type = types.int;
+ description = ''
+ Number of daily auto-snapshots that you wish to keep.
+ '';
+ };
+
+ weekly = mkOption {
+ default = 4;
+ type = types.int;
+ description = ''
+ Number of weekly auto-snapshots that you wish to keep.
+ '';
+ };
+
+ monthly = mkOption {
+ default = 12;
+ type = types.int;
+ description = ''
+ Number of monthly auto-snapshots that you wish to keep.
+ '';
+ };
+ };
};
###### implementation
- config = mkIf ( inInitrd || inSystem ) {
-
- boot = {
- kernelModules = [ "spl" "zfs" ] ;
- extraModulePackages = [ kernel.zfs kernel.spl ];
- extraModprobeConfig = mkIf (cfgSpl.hostid != "") ''
- options spl spl_hostid=${cfgSpl.hostid}
- '';
- };
-
- boot.initrd = mkIf inInitrd {
- kernelModules = [ "spl" "zfs" ] ;
- extraUtilsCommands =
- ''
- cp -v ${kernel.zfs}/sbin/zfs $out/bin
- cp -v ${kernel.zfs}/sbin/zdb $out/bin
- cp -v ${kernel.zfs}/sbin/zpool $out/bin
- cp -pdv ${kernel.zfs}/lib/lib*.so* $out/lib
- cp -pdv ${pkgs.zlib}/lib/lib*.so* $out/lib
+ config = mkMerge [
+ (mkIf enableZfs {
+ boot = {
+ kernelModules = [ "spl" "zfs" ] ;
+ extraModulePackages = [ splPkg zfsPkg ];
+ extraModprobeConfig = mkIf (cfgSpl.hostid != "") ''
+ options spl spl_hostid=${cfgSpl.hostid}
'';
- postDeviceCommands =
- ''
- zpool import -f -a -d /dev
- '';
- };
-
- systemd.services."zpool-import" = {
- description = "Import zpools";
- after = [ "systemd-udev-settle.service" ];
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = true;
- restartIfChanged = false;
- ExecStart = "${kernel.zfs}/sbin/zpool import -f -a -d /dev";
};
- };
- systemd.services."zfs-mount" = {
- description = "Mount zfs volumes";
- after = [ "zpool-import.service" ];
- wantedBy = [ "local-fs.target" ];
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = true;
- restartIfChanged = false;
- ExecStart = "${kernel.zfs}/sbin/zfs mount -a";
- ExecStop = "${kernel.zfs}/sbin/zfs umount -a";
+ boot.initrd = mkIf inInitrd {
+ kernelModules = [ "spl" "zfs" ] ;
+ extraUtilsCommands =
+ ''
+ cp -v ${zfsPkg}/sbin/zfs $out/bin
+ cp -v ${zfsPkg}/sbin/zdb $out/bin
+ cp -v ${zfsPkg}/sbin/zpool $out/bin
+ cp -pdv ${zfsPkg}/lib/lib*.so* $out/lib
+ cp -pdv ${pkgs.zlib}/lib/lib*.so* $out/lib
+ '';
+ postDeviceCommands =
+ ''
+ zpool import -f -a
+ '';
};
- };
- system.fsPackages = [ kernel.zfs ]; # XXX: needed? zfs doesn't have (need) a fsck
- environment.systemPackages = [ kernel.zfs ];
- services.udev.packages = [ kernel.zfs ]; # to hook zvol naming, etc.
- };
+ systemd.services."zpool-import" = {
+ description = "Import zpools";
+ after = [ "systemd-udev-settle.service" ];
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ ExecStart = "${zfsPkg}/sbin/zpool import -f -a";
+ };
+ restartIfChanged = false;
+ };
+
+ systemd.services."zfs-mount" = {
+ description = "Mount ZFS Volumes";
+ after = [ "zpool-import.service" ];
+ wantedBy = [ "local-fs.target" ];
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ ExecStart = "${zfsPkg}/sbin/zfs mount -a";
+ ExecStop = "${zfsPkg}/sbin/zfs umount -a";
+ };
+ restartIfChanged = false;
+ };
+
+ system.fsPackages = [ zfsPkg ]; # XXX: needed? zfs doesn't have (need) a fsck
+ environment.systemPackages = [ zfsPkg ];
+ services.udev.packages = [ zfsPkg ]; # to hook zvol naming, etc.
+ })
+
+ (mkIf enableAutoSnapshots {
+ systemd.services."zfs-snapshot-frequent" = {
+ description = "ZFS auto-snapshotting every 15 mins";
+ after = [ "zpool-import.service" ];
+ serviceConfig = {
+ Type = "oneshot";
+ ExecStart = "${zfsAutoSnap} frequent ${toString cfgSnapshots.frequent}";
+ };
+ restartIfChanged = false;
+ startAt = "*:15,30,45";
+ };
+
+ systemd.services."zfs-snapshot-hourly" = {
+ description = "ZFS auto-snapshotting every hour";
+ after = [ "zpool-import.service" ];
+ serviceConfig = {
+ Type = "oneshot";
+ ExecStart = "${zfsAutoSnap} hourly ${toString cfgSnapshots.hourly}";
+ };
+ restartIfChanged = false;
+ startAt = "hourly";
+ };
+
+ systemd.services."zfs-snapshot-daily" = {
+ description = "ZFS auto-snapshotting every day";
+ after = [ "zpool-import.service" ];
+ serviceConfig = {
+ Type = "oneshot";
+ ExecStart = "${zfsAutoSnap} daily ${toString cfgSnapshots.daily}";
+ };
+ restartIfChanged = false;
+ startAt = "daily";
+ };
+
+ systemd.services."zfs-snapshot-weekly" = {
+ description = "ZFS auto-snapshotting every week";
+ after = [ "zpool-import.service" ];
+ serviceConfig = {
+ Type = "oneshot";
+ ExecStart = "${zfsAutoSnap} weekly ${toString cfgSnapshots.weekly}";
+ };
+ restartIfChanged = false;
+ startAt = "weekly";
+ };
+
+ systemd.services."zfs-snapshot-monthly" = {
+ description = "ZFS auto-snapshotting every month";
+ after = [ "zpool-import.service" ];
+ serviceConfig = {
+ Type = "oneshot";
+ ExecStart = "${zfsAutoSnap} monthly ${toString cfgSnapshots.monthly}";
+ };
+ restartIfChanged = false;
+ startAt = "monthly";
+ };
+ })
+ ];
}
diff --git a/nixos/modules/tasks/kbd.nix b/nixos/modules/tasks/kbd.nix
index 9f294a5f93e..03c42404e5d 100644
--- a/nixos/modules/tasks/kbd.nix
+++ b/nixos/modules/tasks/kbd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -52,19 +52,7 @@ in
# /dev/tty0 to prevent putting the X server in non-raw mode, and
# it has a restart trigger.
systemd.services."systemd-vconsole-setup" =
- { description = "Setup Virtual Console";
- wantedBy = [ "sysinit.target" "multi-user.target" ];
- before = [ "sysinit.target" "shutdown.target" ];
- unitConfig =
- { DefaultDependencies = "no";
- Conflicts = "shutdown.target";
- ConditionPathExists = "/dev/tty1";
- };
- serviceConfig =
- { Type = "oneshot";
- RemainAfterExit = true;
- ExecStart = "${config.systemd.package}/lib/systemd/systemd-vconsole-setup /dev/tty1";
- };
+ { wantedBy = [ "multi-user.target" ];
restartTriggers = [ vconsoleConf ];
};
diff --git a/nixos/modules/tasks/lvm.nix b/nixos/modules/tasks/lvm.nix
index 0e0272388c7..d56a8a2f63a 100644
--- a/nixos/modules/tasks/lvm.nix
+++ b/nixos/modules/tasks/lvm.nix
@@ -1,10 +1,12 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
+
+with lib;
{
###### implementation
- config = {
+ config = mkIf (!config.boot.isContainer) {
environment.systemPackages = [ pkgs.lvm2 ];
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index d8522b6abba..991f9f26145 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -1,12 +1,13 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.networking;
interfaces = attrValues cfg.interfaces;
hasVirtuals = any (i: i.virtual) interfaces;
+ hasBonds = cfg.bonds != { };
interfaceOpts = { name, ... }: {
@@ -49,6 +50,26 @@ let
'';
};
+ ipv6Address = mkOption {
+ default = null;
+ example = "2001:1470:fffd:2098::e006";
+ type = types.nullOr types.string;
+ description = ''
+ IPv6 address of the interface. Leave empty to configure the
+ interface using NDP.
+ '';
+ };
+
+ ipv6prefixLength = mkOption {
+ default = 64;
+ example = 64;
+ type = types.int;
+ description = ''
+ Subnet mask of the interface, specified as the number of
+ bits in the prefix (64).
+ '';
+ };
+
macAddress = mkOption {
default = null;
example = "00:11:22:33:44:55";
@@ -58,6 +79,15 @@ let
'';
};
+ mtu = mkOption {
+ default = null;
+ example = 9000;
+ type = types.nullOr types.int;
+ description = ''
+ MTU size for packets leaving the interface. Leave empty to use the default.
+ '';
+ };
+
virtual = mkOption {
default = false;
type = types.bool;
@@ -153,6 +183,15 @@ in
'';
};
+ networking.search = mkOption {
+ default = [];
+ example = [ "example.com" "local.domain" ];
+ type = types.listOf types.str;
+ description = ''
+ The list of search paths used when resolving domain names.
+ '';
+ };
+
networking.domain = mkOption {
default = "";
example = "home";
@@ -161,6 +200,15 @@ in
'';
};
+ networking.useHostResolvConf = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ In containers, whether to use the
+ resolv.conf supplied by the host.
+ '';
+ };
+
networking.localCommands = mkOption {
default = "";
example = "text=anything; echo You can put $text here.";
@@ -219,6 +267,99 @@ in
};
+ networking.bonds = mkOption {
+ default = { };
+ example = {
+ bond0 = {
+ interfaces = [ "eth0" "wlan0" ];
+ miimon = 100;
+ mode = "active-backup";
+ };
+ fatpipe.interfaces = [ "enp4s0f0" "enp4s0f1" "enp5s0f0" "enp5s0f1" ];
+ };
+ description = ''
+ This option allows you to define bond devices that aggregate multiple,
+ underlying networking interfaces together. The value of this option is
+ an attribute set. Each attribute specifies a bond, with the attribute
+ name specifying the name of the bond's network interface
+ '';
+
+ type = types.attrsOf types.optionSet;
+
+ options = {
+
+ interfaces = mkOption {
+ example = [ "enp4s0f0" "enp4s0f1" "wlan0" ];
+ type = types.listOf types.string;
+ description = "The interfaces to bond together";
+ };
+
+ miimon = mkOption {
+ default = null;
+ example = 100;
+ type = types.nullOr types.int;
+ description = ''
+ Miimon is the number of millisecond in between each round of polling
+ by the device driver for failed links. By default polling is not
+ enabled and the driver is trusted to properly detect and handle
+ failure scenarios.
+ '';
+ };
+
+ mode = mkOption {
+ default = null;
+ example = "active-backup";
+ type = types.nullOr types.string;
+ description = ''
+ The mode which the bond will be running. The default mode for
+ the bonding driver is balance-rr, optimizing for throughput.
+ More information about valid modes can be found at
+ https://www.kernel.org/doc/Documentation/networking/bonding.txt
+ '';
+ };
+
+ };
+ };
+
+ networking.vlans = mkOption {
+ default = { };
+ example = {
+ vlan0 = {
+ id = 3;
+ interface = "enp3s0";
+ };
+ vlan1 = {
+ id = 1;
+ interface = "wlan0";
+ };
+ };
+ description =
+ ''
+ This option allows you to define vlan devices that tag packets
+ on top of a physical interface. The value of this option is an
+ attribute set. Each attribute specifies a vlan, with the name
+ specifying the name of the vlan interface.
+ '';
+
+ type = types.attrsOf types.optionSet;
+
+ options = {
+
+ id = mkOption {
+ example = 1;
+ type = types.int;
+ description = "The vlan identifier";
+ };
+
+ interface = mkOption {
+ example = "enp4s0";
+ type = types.string;
+ description = "The interface the vlan will transmit packets through.";
+ };
+
+ };
+ };
+
networking.useDHCP = mkOption {
type = types.bool;
default = true;
@@ -236,7 +377,15 @@ in
config = {
- boot.kernelModules = optional cfg.enableIPv6 "ipv6" ++ optional hasVirtuals "tun";
+ boot.kernelModules = [ ]
+ ++ optional cfg.enableIPv6 "ipv6"
+ ++ optional hasVirtuals "tun"
+ ++ optional hasBonds "bonding";
+
+ boot.extraModprobeConfig =
+ # This setting is intentional as it prevents default bond devices
+ # from being created.
+ optionalString hasBonds "options bonding max_bonds=0";
environment.systemPackages =
[ pkgs.host
@@ -270,6 +419,8 @@ in
before = [ "network.target" ];
wantedBy = [ "network.target" ];
+ unitConfig.ConditionCapability = "CAP_NET_ADMIN";
+
path = [ pkgs.iproute ];
serviceConfig.Type = "oneshot";
@@ -282,15 +433,18 @@ in
${optionalString (cfg.nameservers != [] && cfg.domain != "") ''
domain ${cfg.domain}
''}
+ ${optionalString (cfg.search != []) ("search " + concatStringsSep " " cfg.search)}
${flip concatMapStrings cfg.nameservers (ns: ''
nameserver ${ns}
'')}
EOF
# Disable or enable IPv6.
- if [ -e /proc/sys/net/ipv6/conf/all/disable_ipv6 ]; then
- echo ${if cfg.enableIPv6 then "0" else "1"} > /proc/sys/net/ipv6/conf/all/disable_ipv6
- fi
+ ${optionalString (!config.boot.isContainer) ''
+ if [ -e /proc/sys/net/ipv6/conf/all/disable_ipv6 ]; then
+ echo ${if cfg.enableIPv6 then "0" else "1"} > /proc/sys/net/ipv6/conf/all/disable_ipv6
+ fi
+ ''}
# Set the default gateway.
${optionalString (cfg.defaultGateway != "") ''
@@ -322,6 +476,7 @@ in
(let mask =
if i.prefixLength != null then toString i.prefixLength else
if i.subnetMask != "" then i.subnetMask else "32";
+ staticIPv6 = cfg.enableIPv6 && i.ipv6Address != null;
in
{ description = "Configuration of ${i.name}";
wantedBy = [ "network-interfaces.target" ];
@@ -340,6 +495,11 @@ in
echo "setting MAC address to ${i.macAddress}..."
ip link set "${i.name}" address "${i.macAddress}"
''
+ + optionalString (i.mtu != null)
+ ''
+ echo "setting MTU to ${toString i.mtu}..."
+ ip link set "${i.name}" mtu "${toString i.mtu}"
+ ''
+ optionalString (i.ipAddress != null)
''
cur=$(ip -4 -o a show dev "${i.name}" | awk '{print $4}')
@@ -350,11 +510,31 @@ in
echo "configuring interface..."
ip -4 addr flush dev "${i.name}"
ip -4 addr add "${i.ipAddress}/${mask}" dev "${i.name}"
+ restart_network_setup=true
+ else
+ echo "skipping configuring interface"
+ fi
+ ''
+ + optionalString (staticIPv6)
+ ''
+ # Only do a flush/add if it's necessary. This is
+ # useful when the Nix store is accessed via this
+ # interface (e.g. in a QEMU VM test).
+ if ! ip -6 -o a show dev "${i.name}" | grep "${i.ipv6Address}/${toString i.ipv6prefixLength}"; then
+ echo "configuring interface..."
+ ip -6 addr flush dev "${i.name}"
+ ip -6 addr add "${i.ipv6Address}/${toString i.ipv6prefixLength}" dev "${i.name}"
+ restart_network_setup=true
+ else
+ echo "skipping configuring interface"
+ fi
+ ''
+ + optionalString (i.ipAddress != null || staticIPv6)
+ ''
+ if [ restart_network_setup = true ]; then
# Ensure that the default gateway remains set.
# (Flushing this interface may have removed it.)
${config.systemd.package}/bin/systemctl try-restart --no-block network-setup.service
- else
- echo "skipping configuring interface"
fi
${config.systemd.package}/bin/systemctl start ip-up.target
''
@@ -395,6 +575,9 @@ in
path = [ pkgs.bridge_utils pkgs.iproute ];
script =
''
+ # Remove Dead Interfaces
+ ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}"
+
brctl addbr "${n}"
# Set bridge's hello time to 0 to avoid startup delays.
@@ -419,10 +602,73 @@ in
'';
};
+ createBondDevice = n: v:
+ let
+ deps = map (i: "sys-subsystem-net-devices-${i}.device") v.interfaces;
+ in
+ { description = "Bond Interface ${n}";
+ wantedBy = [ "network.target" "sys-subsystem-net-devices-${n}.device" ];
+ bindsTo = deps;
+ after = deps;
+ serviceConfig.Type = "oneshot";
+ serviceConfig.RemainAfterExit = true;
+ path = [ pkgs.ifenslave pkgs.iproute ];
+ script = ''
+ # Remove Dead Interfaces
+ ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}"
+
+ ip link add "${n}" type bond
+
+ # !!! There must be a better way to wait for the interface
+ while [ ! -d /sys/class/net/${n} ]; do sleep 0.1; done;
+
+ # Set the miimon and mode options
+ ${optionalString (v.miimon != null)
+ "echo ${toString v.miimon} > /sys/class/net/${n}/bonding/miimon"}
+ ${optionalString (v.mode != null)
+ "echo \"${v.mode}\" > /sys/class/net/${n}/bonding/mode"}
+
+ # Bring up the bridge and enslave the specified interfaces
+ ip link set "${n}" up
+ ${flip concatMapStrings v.interfaces (i: ''
+ ifenslave "${n}" "${i}"
+ '')}
+ '';
+ postStop = ''
+ ip link set "${n}" down
+ ifenslave -d "${n}"
+ ip link delete "${n}"
+ '';
+ };
+
+ createVlanDevice = n: v:
+ let
+ deps = [ "sys-subsystem-net-devices-${v.interface}.device" ];
+ in
+ { description = "Vlan Interface ${n}";
+ wantedBy = [ "network.target" "sys-subsystem-net-devices-${n}.device" ];
+ bindsTo = deps;
+ after = deps;
+ serviceConfig.Type = "oneshot";
+ serviceConfig.RemainAfterExit = true;
+ path = [ pkgs.iproute ];
+ script = ''
+ # Remove Dead Interfaces
+ ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}"
+ ip link add link "${v.interface}" "${n}" type vlan id "${toString v.id}"
+ ip link set "${n}" up
+ '';
+ postStop = ''
+ ip link delete "${n}"
+ '';
+ };
+
in listToAttrs (
map configureInterface interfaces ++
map createTunDevice (filter (i: i.virtual) interfaces))
// mapAttrs createBridgeDevice cfg.bridges
+ // mapAttrs createBondDevice cfg.bonds
+ // mapAttrs createVlanDevice cfg.vlans
// { "network-setup" = networkSetup; };
# Set the host and domain names in the activation script. Don't
diff --git a/nixos/modules/tasks/scsi-link-power-management.nix b/nixos/modules/tasks/scsi-link-power-management.nix
index 4927952080f..a74023dec21 100644
--- a/nixos/modules/tasks/scsi-link-power-management.nix
+++ b/nixos/modules/tasks/scsi-link-power-management.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
###### interface
@@ -31,6 +31,8 @@ with pkgs.lib;
task = true;
+ unitConfig.ConditionPathIsReadWrite = "/sys/class/scsi_host";
+
script = ''
shopt -s nullglob
for x in /sys/class/scsi_host/host*/link_power_management_policy; do
diff --git a/nixos/modules/tasks/trackpoint.nix b/nixos/modules/tasks/trackpoint.nix
new file mode 100644
index 00000000000..d1c6f8ac156
--- /dev/null
+++ b/nixos/modules/tasks/trackpoint.nix
@@ -0,0 +1,60 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+ ###### interface
+
+ options = {
+
+ hardware.trackpoint = {
+
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Enable sensitivity and speed configuration for trackpoints.
+ '';
+ };
+
+ sensitivity = mkOption {
+ default = 128;
+ example = 255;
+ type = types.int;
+ description = ''
+ Configure the trackpoint sensitivity. By default, the kernel
+ configures 128.
+ '';
+ };
+
+ speed = mkOption {
+ default = 97;
+ example = 255;
+ type = types.int;
+ description = ''
+ Configure the trackpoint sensitivity. By default, the kernel
+ configures 97.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.hardware.trackpoint.enable {
+
+ services.udev.extraRules =
+ ''
+ ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString config.hardware.trackpoint.speed}", ATTR{device/sensitivity}="${toString config.hardware.trackpoint.sensitivity}"
+ '';
+
+ system.activationScripts.trackpoint =
+ ''
+ ${config.systemd.package}/bin/udevadm trigger --attr-match=name="TPPS/2 IBM TrackPoint"
+ '';
+ };
+
+}
diff --git a/nixos/modules/tasks/tty-backgrounds-combine.sh b/nixos/modules/tasks/tty-backgrounds-combine.sh
index 1e0d8758a6e..55c3a1ebfa8 100644
--- a/nixos/modules/tasks/tty-backgrounds-combine.sh
+++ b/nixos/modules/tasks/tty-backgrounds-combine.sh
@@ -3,7 +3,7 @@ source $stdenv/setup
ttys=($ttys)
themes=($themes)
-ensureDir $out
+mkdir -p $out
defaultName=$(cd $default && ls | grep -v default)
echo $defaultName
diff --git a/nixos/modules/testing/minimal-kernel.nix b/nixos/modules/testing/minimal-kernel.nix
index 0418de800c8..a463cb803ad 100644
--- a/nixos/modules/testing/minimal-kernel.nix
+++ b/nixos/modules/testing/minimal-kernel.nix
@@ -1,11 +1,11 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let
- configfile = builtins.storePath (builtins.toFile "config" (pkgs.lib.concatStringsSep "\n"
+ configfile = builtins.storePath (builtins.toFile "config" (lib.concatStringsSep "\n"
(map (builtins.getAttr "configLine") config.system.requiredKernelConfig))
);
- origKernel = pkgs.linuxManualConfig {
+ origKernel = pkgs.buildLinux {
inherit (pkgs.linux) src version;
inherit configfile;
allowImportFromDerivation = true;
diff --git a/nixos/modules/testing/service-runner.nix b/nixos/modules/testing/service-runner.nix
new file mode 100644
index 00000000000..dfe8b430e04
--- /dev/null
+++ b/nixos/modules/testing/service-runner.nix
@@ -0,0 +1,114 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ makeScript = name: service: pkgs.writeScript "${name}-runner"
+ ''
+ #! ${pkgs.perl}/bin/perl -w -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl
+
+ use File::Slurp;
+
+ sub run {
+ my ($cmd) = @_;
+ my @args = split " ", $cmd;
+ my $prog;
+ if (substr($args[0], 0, 1) eq "@") {
+ $prog = substr($args[0], 1);
+ shift @args;
+ } else {
+ $prog = $args[0];
+ }
+ my $pid = fork;
+ if ($pid == 0) {
+ setpgrp; # don't receive SIGINT etc. from terminal
+ exec { $prog } @args;
+ die "failed to exec $prog\n";
+ } elsif (!defined $pid) {
+ die "failed to fork: $!\n";
+ }
+ return $pid;
+ };
+
+ sub run_wait {
+ my ($cmd) = @_;
+ my $pid = run $cmd;
+ die if waitpid($pid, 0) != $pid;
+ return $?;
+ };
+
+ # Set the environment. FIXME: escaping.
+ foreach my $key (keys %ENV) {
+ next if $key eq 'LOCALE_ARCHIVE';
+ delete $ENV{$key};
+ }
+ ${concatStrings (mapAttrsToList (n: v: ''
+ $ENV{'${n}'} = '${v}';
+ '') service.environment)}
+
+ # Run the ExecStartPre program. FIXME: this could be a list.
+ my $preStart = '${service.serviceConfig.ExecStartPre or ""}';
+ if ($preStart ne "") {
+ print STDERR "running ExecStartPre: $preStart\n";
+ my $res = run_wait $preStart;
+ die "$0: ExecStartPre failed with status $res\n" if $res;
+ };
+
+ # Run the ExecStart program.
+ my $cmd = '${service.serviceConfig.ExecStart}';
+ print STDERR "running ExecStart: $cmd\n";
+ my $mainPid = run $cmd;
+ $ENV{'MAINPID'} = $mainPid;
+
+ # Catch SIGINT, propagate to the main program.
+ sub intHandler {
+ print STDERR "got SIGINT, stopping service...\n";
+ kill 'INT', $mainPid;
+ };
+ $SIG{'INT'} = \&intHandler;
+ $SIG{'QUIT'} = \&intHandler;
+
+ # Run the ExecStartPost program.
+ my $postStart = '${service.serviceConfig.ExecStartPost or ""}';
+ if ($postStart ne "") {
+ print STDERR "running ExecStartPost: $postStart\n";
+ my $res = run_wait $postStart;
+ die "$0: ExecStartPost failed with status $res\n" if $res;
+ }
+
+ # Wait for the main program to exit.
+ die if waitpid($mainPid, 0) != $mainPid;
+ my $mainRes = $?;
+
+ # Run the ExecStopPost program.
+ my $postStop = '${service.serviceConfig.ExecStopPost or ""}';
+ if ($postStop ne "") {
+ print STDERR "running ExecStopPost: $postStop\n";
+ my $res = run_wait $postStop;
+ die "$0: ExecStopPost failed with status $res\n" if $res;
+ }
+
+ exit($mainRes & 127 ? 255 : $mainRes << 8);
+ '';
+
+in
+
+{
+ options = {
+ systemd.services = mkOption {
+ options =
+ { config, name, ... }:
+ { options.runner = mkOption {
+ internal = true;
+ description = ''
+ A script that runs the service outside of systemd,
+ useful for testing or for using NixOS services outside
+ of NixOS.
+ '';
+ };
+ config.runner = makeScript name config;
+ };
+ };
+ };
+}
diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix
index 28494e1c7b2..54a376c9560 100644
--- a/nixos/modules/testing/test-instrumentation.nix
+++ b/nixos/modules/testing/test-instrumentation.nix
@@ -1,9 +1,9 @@
# This module allows the test driver to connect to the virtual machine
# via a root shell attached to port 514.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let kernel = config.boot.kernelPackages.kernel; in
@@ -66,13 +66,22 @@ let kernel = config.boot.kernelPackages.kernel; in
# Panic if an error occurs in stage 1 (rather than waiting for
# user intervention).
boot.kernelParams =
- [ "console=tty1" "console=ttyS0" "panic=1" "boot.panic_on_fail" ];
+ [ "console=ttyS0" "panic=1" "boot.panic_on_fail" ];
# `xwininfo' is used by the test driver to query open windows.
environment.systemPackages = [ pkgs.xorg.xwininfo ];
# Log everything to the serial console.
- services.journald.console = "/dev/console";
+ services.journald.extraConfig =
+ ''
+ ForwardToConsole=yes
+ MaxLevelConsole=debug
+ '';
+
+ # Don't clobber the console with duplicate systemd messages.
+ systemd.extraConfig = "ShowStatus=no";
+
+ boot.consoleLogLevel = 7;
# Prevent tests from accessing the Internet.
networking.defaultGateway = mkOverride 150 "";
@@ -86,6 +95,11 @@ let kernel = config.boot.kernelPackages.kernel; in
(isEnabled "VIRTIO_CONSOLE")
];
+ networking.usePredictableInterfaceNames = false;
+
+ # Make it easy to log in as root when running the test interactively.
+ security.initialRootPassword = mkDefault "";
+
};
}
diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix
index cfc582170e6..e129e496fe3 100644
--- a/nixos/modules/virtualisation/amazon-image.nix
+++ b/nixos/modules/virtualisation/amazon-image.nix
@@ -1,163 +1,200 @@
-{ config, pkgs, ... }:
-
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ cfg = config.ec2;
+in
{
imports = [ ../profiles/headless.nix ./ec2-data.nix ];
- system.build.amazonImage =
- pkgs.vmTools.runInLinuxVM (
- pkgs.runCommand "amazon-image"
- { preVM =
- ''
- mkdir $out
- diskImage=$out/nixos.img
- ${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "4G"
- mv closure xchg/
- '';
- buildInputs = [ pkgs.utillinux pkgs.perl ];
- exportReferencesGraph =
- [ "closure" config.system.build.toplevel ];
- }
- ''
- # Create an empty filesystem and mount it.
- ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda
- ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda
- mkdir /mnt
- mount /dev/vda /mnt
+ options = {
+ ec2 = {
+ hvm = mkOption {
+ default = false;
+ description = ''
+ Whether the EC2 instance is a HVM instance.
+ '';
+ };
+ };
+ };
- # The initrd expects these directories to exist.
- mkdir /mnt/dev /mnt/proc /mnt/sys
+ config = {
+ system.build.amazonImage =
+ pkgs.vmTools.runInLinuxVM (
+ pkgs.runCommand "amazon-image"
+ { preVM =
+ ''
+ mkdir $out
+ diskImage=$out/nixos.img
+ ${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "8G"
+ mv closure xchg/
+ '';
+ buildInputs = [ pkgs.utillinux pkgs.perl ];
+ exportReferencesGraph =
+ [ "closure" config.system.build.toplevel ];
+ }
+ ''
+ ${if cfg.hvm then ''
+ # Create a single / partition.
+ ${pkgs.parted}/sbin/parted /dev/vda mklabel msdos
+ ${pkgs.parted}/sbin/parted /dev/vda -- mkpart primary ext2 1M -1s
+ . /sys/class/block/vda1/uevent
+ mknod /dev/vda1 b $MAJOR $MINOR
- mount -o bind /proc /mnt/proc
+ # Create an empty filesystem and mount it.
+ ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda1
+ ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1
+ mkdir /mnt
+ mount /dev/vda1 /mnt
+ '' else ''
+ # Create an empty filesystem and mount it.
+ ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda
+ ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda
+ mkdir /mnt
+ mount /dev/vda /mnt
+ ''}
- # Copy all paths in the closure to the filesystem.
- storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
+ # The initrd expects these directories to exist.
+ mkdir /mnt/dev /mnt/proc /mnt/sys
- mkdir -p /mnt/nix/store
- echo "copying everything (will take a while)..."
- cp -prd $storePaths /mnt/nix/store/
+ mount -o bind /proc /mnt/proc
+ mount -o bind /dev /mnt/dev
+ mount -o bind /sys /mnt/sys
- # Register the paths in the Nix database.
- printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
- chroot /mnt ${config.nix.package}/bin/nix-store --load-db
+ # Copy all paths in the closure to the filesystem.
+ storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
- # Create the system profile to allow nixos-rebuild to work.
- chroot /mnt ${config.nix.package}/bin/nix-env \
- -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
+ mkdir -p /mnt/nix/store
+ echo "copying everything (will take a while)..."
+ cp -prd $storePaths /mnt/nix/store/
- # `nixos-rebuild' requires an /etc/NIXOS.
- mkdir -p /mnt/etc
- touch /mnt/etc/NIXOS
+ # Register the paths in the Nix database.
+ printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
+ chroot /mnt ${config.nix.package}/bin/nix-store --load-db
- # `switch-to-configuration' requires a /bin/sh
- mkdir -p /mnt/bin
- ln -s ${config.system.build.binsh}/bin/sh /mnt/bin/sh
+ # Create the system profile to allow nixos-rebuild to work.
+ chroot /mnt ${config.nix.package}/bin/nix-env \
+ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
- # Install a configuration.nix.
- mkdir -p /mnt/etc/nixos
- cp ${./amazon-config.nix} /mnt/etc/nixos/configuration.nix
+ # `nixos-rebuild' requires an /etc/NIXOS.
+ mkdir -p /mnt/etc
+ touch /mnt/etc/NIXOS
- # Generate the GRUB menu.
- chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
+ # `switch-to-configuration' requires a /bin/sh
+ mkdir -p /mnt/bin
+ ln -s ${config.system.build.binsh}/bin/sh /mnt/bin/sh
- umount /mnt/proc
- umount /mnt
- ''
- );
+ # Install a configuration.nix.
+ mkdir -p /mnt/etc/nixos
+ cp ${./amazon-config.nix} /mnt/etc/nixos/configuration.nix
- fileSystems."/".device = "/dev/disk/by-label/nixos";
+ # Generate the GRUB menu.
+ ln -s vda /dev/xvda
+ chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
- boot.initrd.kernelModules = [ "xen-blkfront" ];
- boot.kernelModules = [ "xen-netfront" ];
+ umount /mnt/proc /mnt/dev /mnt/sys
+ umount /mnt
+ ''
+ );
- # Generate a GRUB menu. Amazon's pv-grub uses this to boot our kernel/initrd.
- boot.loader.grub.version = 1;
- boot.loader.grub.device = "nodev";
- boot.loader.grub.timeout = 0;
- boot.loader.grub.extraPerEntryConfig = "root (hd0)";
+ fileSystems."/".device = "/dev/disk/by-label/nixos";
- boot.initrd.postDeviceCommands =
- ''
- # Force udev to exit to prevent random "Device or resource busy
- # while trying to open /dev/xvda" errors from fsck.
- udevadm control --exit || true
- kill -9 -1
- '';
+ boot.initrd.kernelModules = [ "xen-blkfront" ];
+ boot.kernelModules = [ "xen-netfront" ];
- # Mount all formatted ephemeral disks and activate all swap devices.
- # We cannot do this with the ‘fileSystems’ and ‘swapDevices’ options
- # because the set of devices is dependent on the instance type
- # (e.g. "m1.large" has one ephemeral filesystem and one swap device,
- # while "m1.large" has two ephemeral filesystems and no swap
- # devices). Also, put /tmp and /var on /disk0, since it has a lot
- # more space than the root device. Similarly, "move" /nix to /disk0
- # by layering a unionfs-fuse mount on top of it so we have a lot more space for
- # Nix operations.
- boot.initrd.postMountCommands =
- ''
- diskNr=0
- diskForUnionfs=
- for device in /dev/xvd[abcde]*; do
- if [ "$device" = /dev/xvda -o "$device" = /dev/xvda1 ]; then continue; fi
- fsType=$(blkid -o value -s TYPE "$device" || true)
- if [ "$fsType" = swap ]; then
- echo "activating swap device $device..."
- swapon "$device" || true
- elif [ "$fsType" = ext3 ]; then
- mp="/disk$diskNr"
- diskNr=$((diskNr + 1))
- echo "mounting $device on $mp..."
- if mountFS "$device" "$mp" "" ext3; then
- if [ -z "$diskForUnionfs" ]; then diskForUnionfs="$mp"; fi
- fi
- else
- echo "skipping unknown device type $device"
- fi
- done
+ # Generate a GRUB menu. Amazon's pv-grub uses this to boot our kernel/initrd.
+ boot.loader.grub.version = if cfg.hvm then 2 else 1;
+ boot.loader.grub.device = if cfg.hvm then "/dev/xvda" else "nodev";
+ boot.loader.grub.timeout = 0;
+ boot.loader.grub.extraPerEntryConfig = "root (hd0${lib.optionalString cfg.hvm ",0"})";
- if [ -n "$diskForUnionfs" ]; then
- mkdir -m 755 -p $targetRoot/$diskForUnionfs/root
+ boot.initrd.postDeviceCommands =
+ ''
+ # Force udev to exit to prevent random "Device or resource busy
+ # while trying to open /dev/xvda" errors from fsck.
+ udevadm control --exit || true
+ kill -9 -1
+ '';
- mkdir -m 1777 -p $targetRoot/$diskForUnionfs/root/tmp $targetRoot/tmp
- mount --bind $targetRoot/$diskForUnionfs/root/tmp $targetRoot/tmp
+ # Mount all formatted ephemeral disks and activate all swap devices.
+ # We cannot do this with the ‘fileSystems’ and ‘swapDevices’ options
+ # because the set of devices is dependent on the instance type
+ # (e.g. "m1.large" has one ephemeral filesystem and one swap device,
+ # while "m1.large" has two ephemeral filesystems and no swap
+ # devices). Also, put /tmp and /var on /disk0, since it has a lot
+ # more space than the root device. Similarly, "move" /nix to /disk0
+ # by layering a unionfs-fuse mount on top of it so we have a lot more space for
+ # Nix operations.
+ boot.initrd.postMountCommands =
+ ''
+ diskNr=0
+ diskForUnionfs=
+ for device in /dev/xvd[abcde]*; do
+ if [ "$device" = /dev/xvda -o "$device" = /dev/xvda1 ]; then continue; fi
+ fsType=$(blkid -o value -s TYPE "$device" || true)
+ if [ "$fsType" = swap ]; then
+ echo "activating swap device $device..."
+ swapon "$device" || true
+ elif [ "$fsType" = ext3 ]; then
+ mp="/disk$diskNr"
+ diskNr=$((diskNr + 1))
+ echo "mounting $device on $mp..."
+ if mountFS "$device" "$mp" "" ext3; then
+ if [ -z "$diskForUnionfs" ]; then diskForUnionfs="$mp"; fi
+ fi
+ else
+ echo "skipping unknown device type $device"
+ fi
+ done
- if [ ! -e $targetRoot/.ebs ]; then
- mkdir -m 755 -p $targetRoot/$diskForUnionfs/root/var $targetRoot/var
- mount --bind $targetRoot/$diskForUnionfs/root/var $targetRoot/var
+ if [ -n "$diskForUnionfs" ]; then
+ mkdir -m 755 -p $targetRoot/$diskForUnionfs/root
- mkdir -p /unionfs-chroot/ro-nix
- mount --rbind $targetRoot/nix /unionfs-chroot/ro-nix
+ mkdir -m 1777 -p $targetRoot/$diskForUnionfs/root/tmp $targetRoot/tmp
+ mount --bind $targetRoot/$diskForUnionfs/root/tmp $targetRoot/tmp
- mkdir -m 755 -p $targetRoot/$diskForUnionfs/root/nix
- mkdir -p /unionfs-chroot/rw-nix
- mount --rbind $targetRoot/$diskForUnionfs/root/nix /unionfs-chroot/rw-nix
+ if [ ! -e $targetRoot/.ebs ]; then
+ mkdir -m 755 -p $targetRoot/$diskForUnionfs/root/var $targetRoot/var
+ mount --bind $targetRoot/$diskForUnionfs/root/var $targetRoot/var
- unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768 /rw-nix=RW:/ro-nix=RO $targetRoot/nix
- fi
- fi
- '';
+ mkdir -p /unionfs-chroot/ro-nix
+ mount --rbind $targetRoot/nix /unionfs-chroot/ro-nix
- boot.initrd.extraUtilsCommands =
- ''
- # We need swapon in the initrd.
- cp ${pkgs.utillinux}/sbin/swapon $out/bin
- '';
+ mkdir -m 755 -p $targetRoot/$diskForUnionfs/root/nix
+ mkdir -p /unionfs-chroot/rw-nix
+ mount --rbind $targetRoot/$diskForUnionfs/root/nix /unionfs-chroot/rw-nix
- # Don't put old configurations in the GRUB menu. The user has no
- # way to select them anyway.
- boot.loader.grub.configurationLimit = 0;
+ unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768 /rw-nix=RW:/ro-nix=RO $targetRoot/nix
+ fi
+ fi
+ '';
- # Allow root logins only using the SSH key that the user specified
- # at instance creation time.
- services.openssh.enable = true;
- services.openssh.permitRootLogin = "without-password";
+ boot.initrd.extraUtilsCommands =
+ ''
+ # We need swapon in the initrd.
+ cp --remove-destination ${pkgs.utillinux}/sbin/swapon $out/bin
+ '';
- # Force getting the hostname from EC2.
- networking.hostName = mkDefault "";
+ # Don't put old configurations in the GRUB menu. The user has no
+ # way to select them anyway.
+ boot.loader.grub.configurationLimit = 0;
- # Always include cryptsetup so that Charon can use it.
- environment.systemPackages = [ pkgs.cryptsetup ];
+ # Allow root logins only using the SSH key that the user specified
+ # at instance creation time.
+ services.openssh.enable = true;
+ services.openssh.permitRootLogin = "without-password";
- boot.initrd.supportedFilesystems = [ "unionfs-fuse" ];
+ # Force getting the hostname from EC2.
+ networking.hostName = mkDefault "";
+
+ # Always include cryptsetup so that Charon can use it.
+ environment.systemPackages = [ pkgs.cryptsetup ];
+
+ boot.initrd.supportedFilesystems = [ "unionfs-fuse" ];
+
+ # Prevent logging in as root without a password. This doesn't really matter,
+ # since the only PAM services that allow logging in with a null
+ # password are local ones that are inaccessible on EC2 machines.
+ security.initialRootPassword = mkDefault "!";
+ };
}
diff --git a/nixos/modules/virtualisation/container-config.nix b/nixos/modules/virtualisation/container-config.nix
new file mode 100644
index 00000000000..84e3aa28352
--- /dev/null
+++ b/nixos/modules/virtualisation/container-config.nix
@@ -0,0 +1,96 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+{
+
+ config = mkIf config.boot.isContainer {
+
+ # Disable some features that are not useful in a container.
+ sound.enable = mkDefault false;
+ services.udisks2.enable = mkDefault false;
+
+ networking.useHostResolvConf = true;
+
+ # Containers should be light-weight, so start sshd on demand.
+ services.openssh.startWhenNeeded = mkDefault true;
+
+ # Shut up warnings about not having a boot loader.
+ system.build.installBootLoader = "${pkgs.coreutils}/bin/true";
+
+ # Provide a root login prompt on /var/lib/root-login.socket that
+ # doesn't ask for a password. This socket can only be used by root
+ # on the host.
+ systemd.sockets.root-login =
+ { description = "Root Login Socket";
+ wantedBy = [ "sockets.target" ];
+ socketConfig =
+ { ListenStream = "/var/lib/root-login.socket";
+ SocketMode = "0600";
+ Accept = true;
+ };
+ };
+
+ systemd.services."root-login@" =
+ { description = "Root Login %i";
+ environment.TERM = "linux";
+ serviceConfig =
+ { Type = "simple";
+ StandardInput = "socket";
+ ExecStart = "${pkgs.socat}/bin/socat -t0 - \"exec:${pkgs.shadow}/bin/login -f root,pty,setsid,setpgid,stderr,ctty\"";
+ TimeoutStopSec = 1; # FIXME
+ };
+ restartIfChanged = false;
+ };
+
+ # Provide a daemon on /var/lib/run-command.socket that reads a
+ # command from stdin and executes it.
+ systemd.sockets.run-command =
+ { description = "Run Command Socket";
+ wantedBy = [ "sockets.target" ];
+ socketConfig =
+ { ListenStream = "/var/lib/run-command.socket";
+ SocketMode = "0600"; # only root can connect
+ Accept = true;
+ };
+ };
+
+ systemd.services."run-command@" =
+ { description = "Run Command %i";
+ environment.TERM = "linux";
+ serviceConfig =
+ { Type = "simple";
+ StandardInput = "socket";
+ TimeoutStopSec = 1; # FIXME
+ };
+ script =
+ ''
+ #! ${pkgs.stdenv.shell} -e
+ source /etc/bashrc
+ read c
+ eval "command=($c)"
+ exec "''${command[@]}"
+ '';
+ restartIfChanged = false;
+ };
+
+ systemd.services.container-startup-done =
+ { description = "Container Startup Notification";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "multi-user.target" ];
+ script =
+ ''
+ if [ -p /var/lib/startup-done ]; then
+ echo done > /var/lib/startup-done
+ fi
+ '';
+ serviceConfig.Type = "oneshot";
+ serviceConfig.RemainAfterExit = true;
+ restartIfChanged = false;
+ };
+
+ systemd.services.systemd-remount-fs.enable = false;
+
+ };
+
+}
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
new file mode 100644
index 00000000000..3942c41553c
--- /dev/null
+++ b/nixos/modules/virtualisation/containers.nix
@@ -0,0 +1,353 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ nixos-container = pkgs.substituteAll {
+ name = "nixos-container";
+ dir = "bin";
+ isExecutable = true;
+ src = ./nixos-container.pl;
+ perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
+ inherit (pkgs) socat;
+ };
+
+ # The container's init script, a small wrapper around the regular
+ # NixOS stage-2 init script.
+ containerInit = pkgs.writeScript "container-init"
+ ''
+ #! ${pkgs.stdenv.shell} -e
+
+ # Initialise the container side of the veth pair.
+ if [ "$PRIVATE_NETWORK" = 1 ]; then
+ ip link set host0 name eth0
+ ip link set dev eth0 up
+ if [ -n "$HOST_ADDRESS" ]; then
+ ip route add $HOST_ADDRESS dev eth0
+ ip route add default via $HOST_ADDRESS
+ fi
+ if [ -n "$LOCAL_ADDRESS" ]; then
+ ip addr add $LOCAL_ADDRESS dev eth0
+ fi
+ fi
+
+ # Start the regular stage 1 script, passing the bind-mounted
+ # notification socket from the host to allow the container
+ # systemd to signal readiness to the host systemd.
+ NOTIFY_SOCKET=/var/lib/private/host-notify exec "$1"
+ '';
+
+ system = config.nixpkgs.system;
+
+in
+
+{
+ options = {
+
+ boot.isContainer = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether this NixOS machine is a lightweight container running
+ in another NixOS system.
+ '';
+ };
+
+ containers = mkOption {
+ type = types.attrsOf (types.submodule (
+ { config, options, name, ... }:
+ {
+ options = {
+
+ config = mkOption {
+ description = ''
+ A specification of the desired configuration of this
+ container, as a NixOS module.
+ '';
+ };
+
+ path = mkOption {
+ type = types.path;
+ example = "/nix/var/nix/profiles/containers/webserver";
+ description = ''
+ As an alternative to specifying
+ , you can specify the path to
+ the evaluated NixOS system configuration, typically a
+ symlink to a system profile.
+ '';
+ };
+
+ privateNetwork = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to give the container its own private virtual
+ Ethernet interface. The interface is called
+ eth0, and is hooked up to the interface
+ ve-container-name
+ on the host. If this option is not set, then the
+ container shares the network interfaces of the host,
+ and can bind to any port on any interface.
+ '';
+ };
+
+ hostAddress = mkOption {
+ type = types.nullOr types.string;
+ default = null;
+ example = "10.231.136.1";
+ description = ''
+ The IPv4 address assigned to the host interface.
+ '';
+ };
+
+ localAddress = mkOption {
+ type = types.nullOr types.string;
+ default = null;
+ example = "10.231.136.2";
+ description = ''
+ The IPv4 address assigned to eth0
+ in the container.
+ '';
+ };
+
+ };
+
+ config = mkMerge
+ [ (mkIf options.config.isDefined {
+ path = (import ../../lib/eval-config.nix {
+ inherit system;
+ modules =
+ let extraConfig =
+ { boot.isContainer = true;
+ networking.hostName = mkDefault name;
+ networking.useDHCP = false;
+ };
+ in [ extraConfig config.config ];
+ prefix = [ "containers" name ];
+ }).config.system.build.toplevel;
+ })
+ ];
+ }));
+
+ default = {};
+ example = literalExample
+ ''
+ { webserver =
+ { path = "/nix/var/nix/profiles/webserver";
+ };
+ database =
+ { config =
+ { config, pkgs, ... }:
+ { services.postgresql.enable = true;
+ services.postgresql.package = pkgs.postgresql92;
+ };
+ };
+ }
+ '';
+ description = ''
+ A set of NixOS system configurations to be run as lightweight
+ containers. Each container appears as a service
+ container-name
+ on the host system, allowing it to be started and stopped via
+ systemctl .
+ '';
+ };
+
+ };
+
+
+ config = mkIf (!config.boot.isContainer) {
+
+ systemd.services."container@" =
+ { description = "Container '%i'";
+
+ unitConfig.RequiresMountsFor = [ "/var/lib/containers/%i" ];
+
+ path = [ pkgs.iproute ];
+
+ environment.INSTANCE = "%i";
+ environment.root = "/var/lib/containers/%i";
+
+ preStart =
+ ''
+ # Clean up existing machined registration and interfaces.
+ machinectl terminate "$INSTANCE" 2> /dev/null || true
+
+ if [ "$PRIVATE_NETWORK" = 1 ]; then
+ ip link del dev "ve-$INSTANCE" 2> /dev/null || true
+ fi
+
+
+ if [ "$PRIVATE_NETWORK" = 1 ]; then
+ ip link del dev "ve-$INSTANCE" 2> /dev/null || true
+ fi
+ '';
+
+ script =
+ ''
+ mkdir -p -m 0755 "$root/etc" "$root/var/lib"
+ mkdir -p -m 0700 "$root/var/lib/private"
+ if ! [ -e "$root/etc/os-release" ]; then
+ touch "$root/etc/os-release"
+ fi
+
+ mkdir -p -m 0755 \
+ "/nix/var/nix/profiles/per-container/$INSTANCE" \
+ "/nix/var/nix/gcroots/per-container/$INSTANCE"
+
+ cp -f /etc/resolv.conf "$root/etc/resolv.conf"
+
+ if [ "$PRIVATE_NETWORK" = 1 ]; then
+ extraFlags+=" --network-veth"
+ fi
+
+ for iface in $MACVLANS; do
+ extraFlags+=" --network-macvlan=$iface"
+ done
+
+ # If the host is 64-bit and the container is 32-bit, add a
+ # --personality flag.
+ ${optionalString (config.nixpkgs.system == "x86_64-linux") ''
+ if [ "$(< ''${SYSTEM_PATH:-/nix/var/nix/profiles/per-container/$INSTANCE/system}/system)" = i686-linux ]; then
+ extraFlags+=" --personality=x86"
+ fi
+ ''}
+
+ # Run systemd-nspawn without startup notification (we'll
+ # wait for the container systemd to signal readiness).
+ EXIT_ON_REBOOT=1 NOTIFY_SOCKET= \
+ exec ${config.systemd.package}/bin/systemd-nspawn \
+ --keep-unit \
+ -M "$INSTANCE" -D "$root" $extraFlags \
+ --bind-ro=/nix/store \
+ --bind-ro=/nix/var/nix/db \
+ --bind-ro=/nix/var/nix/daemon-socket \
+ --bind=/run/systemd/notify:/var/lib/private/host-notify \
+ --bind="/nix/var/nix/profiles/per-container/$INSTANCE:/nix/var/nix/profiles" \
+ --bind="/nix/var/nix/gcroots/per-container/$INSTANCE:/nix/var/nix/gcroots" \
+ --setenv PRIVATE_NETWORK="$PRIVATE_NETWORK" \
+ --setenv HOST_ADDRESS="$HOST_ADDRESS" \
+ --setenv LOCAL_ADDRESS="$LOCAL_ADDRESS" \
+ --setenv PATH="$PATH" \
+ ${containerInit} "''${SYSTEM_PATH:-/nix/var/nix/profiles/system}/init"
+ '';
+
+ postStart =
+ ''
+ if [ "$PRIVATE_NETWORK" = 1 ]; then
+ ifaceHost=ve-$INSTANCE
+ ip link set dev $ifaceHost up
+ if [ -n "$HOST_ADDRESS" ]; then
+ ip addr add $HOST_ADDRESS dev $ifaceHost
+ fi
+ if [ -n "$LOCAL_ADDRESS" ]; then
+ ip route add $LOCAL_ADDRESS dev $ifaceHost
+ fi
+ fi
+
+ # This blocks until the container-startup-done service
+ # writes something to this pipe. FIXME: it also hangs
+ # until the start timeout expires if systemd-nspawn exits.
+ read x < $root/var/lib/startup-done
+ rm -f $root/var/lib/startup-done
+ '';
+
+ preStop =
+ ''
+ machinectl poweroff "$INSTANCE" || true
+ '';
+
+ restartIfChanged = false;
+ #reloadIfChanged = true; # FIXME
+
+ serviceConfig = {
+ ExecReload = pkgs.writeScript "reload-container"
+ ''
+ #! ${pkgs.stdenv.shell} -e
+ SYSTEM_PATH=/nix/var/nix/profiles/system
+ echo $SYSTEM_PATH/bin/switch-to-configuration test | \
+ ${pkgs.socat}/bin/socat unix:$root/var/lib/run-command.socket -
+ '';
+
+ SyslogIdentifier = "container %i";
+
+ EnvironmentFile = "-/etc/containers/%i.conf";
+
+ Type = "notify";
+
+ NotifyAccess = "all";
+
+ # Note that on reboot, systemd-nspawn returns 10, so this
+ # unit will be restarted. On poweroff, it returns 0, so the
+ # unit won't be restarted.
+ Restart = "on-failure";
+
+ # Hack: we don't want to kill systemd-nspawn, since we call
+ # "machinectl poweroff" in preStop to shut down the
+ # container cleanly. But systemd requires sending a signal
+ # (at least if we want remaining processes to be killed
+ # after the timeout). So send an ignored signal.
+ KillMode = "mixed";
+ KillSignal = "WINCH";
+ };
+ };
+
+ # Generate a configuration file in /etc/containers for each
+ # container so that container@.target can get the container
+ # configuration.
+ environment.etc = mapAttrs' (name: cfg: nameValuePair "containers/${name}.conf"
+ { text =
+ ''
+ SYSTEM_PATH=${cfg.path}
+ ${optionalString cfg.privateNetwork ''
+ PRIVATE_NETWORK=1
+ ${optionalString (cfg.hostAddress != null) ''
+ HOST_ADDRESS=${cfg.hostAddress}
+ ''}
+ ${optionalString (cfg.localAddress != null) ''
+ LOCAL_ADDRESS=${cfg.localAddress}
+ ''}
+ ''}
+ '';
+ }) config.containers;
+
+ # FIXME: auto-start containers.
+
+ # Generate /etc/hosts entries for the containers.
+ networking.extraHosts = concatStrings (mapAttrsToList (name: cfg: optionalString (cfg.localAddress != null)
+ ''
+ ${cfg.localAddress} ${name}.containers
+ '') config.containers);
+
+ networking.dhcpcd.denyInterfaces = [ "ve-*" ];
+
+ environment.systemPackages = [ nixos-container ];
+
+ # Start containers at boot time.
+ systemd.services.all-containers =
+ { description = "All Containers";
+
+ wantedBy = [ "multi-user.target" ];
+
+ unitConfig.ConditionDirectoryNotEmpty = "/etc/containers";
+
+ serviceConfig.Type = "oneshot";
+
+ script =
+ ''
+ res=0
+ shopt -s nullglob
+ for i in /etc/containers/*.conf; do
+ AUTO_START=
+ source "$i"
+ if [ "$AUTO_START" = 1 ]; then
+ systemctl start "container@$(basename "$i" .conf).service" || res=1
+ fi
+ done
+ exit $res
+ ''; # */
+ };
+
+ };
+}
diff --git a/nixos/modules/virtualisation/docker.nix b/nixos/modules/virtualisation/docker.nix
new file mode 100644
index 00000000000..a0aa6135326
--- /dev/null
+++ b/nixos/modules/virtualisation/docker.nix
@@ -0,0 +1,109 @@
+# Systemd services for docker.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.virtualisation.docker;
+
+in
+
+{
+ ###### interface
+
+ options.virtualisation.docker = {
+ enable =
+ mkOption {
+ type = types.bool;
+ default = false;
+ description =
+ ''
+ This option enables docker, a daemon that manages
+ linux containers. Users in the "docker" group can interact with
+ the daemon (e.g. to start or stop containers) using the
+ docker command line tool.
+ '';
+ };
+ socketActivation =
+ mkOption {
+ type = types.bool;
+ default = false;
+ description =
+ ''
+ This option enables docker with socket activation. I.e. docker will
+ start when first called by client.
+
+ Note: This is false by default because systemd lower than 214 that
+ nixos uses so far, doesn't support SocketGroup option, so socket
+ created by docker has root group now. This will likely be changed
+ in future. So set this option explicitly to false if you wish.
+ '';
+ };
+ extraOptions =
+ mkOption {
+ type = types.str;
+ default = "";
+ description =
+ ''
+ The extra command-line options to pass to
+ docker daemon.
+ '';
+ };
+
+
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable (mkMerge [
+ { environment.systemPackages = [ pkgs.docker ];
+ }
+ (mkIf cfg.socketActivation {
+
+ systemd.services.docker = {
+ description = "Docker Application Container Engine";
+ after = [ "network.target" "docker.socket" ];
+ requires = [ "docker.socket" ];
+ serviceConfig = {
+ ExecStart = "${pkgs.docker}/bin/docker --daemon=true --host=fd:// --group=docker ${cfg.extraOptions}";
+ # I'm not sure if that limits aren't too high, but it's what
+ # goes in config bundled with docker itself
+ LimitNOFILE = 1048576;
+ LimitNPROC = 1048576;
+ };
+ };
+
+ systemd.sockets.docker = {
+ description = "Docker Socket for the API";
+ wantedBy = [ "sockets.target" ];
+ socketConfig = {
+ ListenStream = "/var/run/docker.sock";
+ SocketMode = "0660";
+ SocketUser = "root";
+ SocketGroup = "docker";
+ };
+ };
+ })
+ (mkIf (!cfg.socketActivation) {
+
+ systemd.services.docker = {
+ description = "Docker Application Container Engine";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ serviceConfig = {
+ ExecStart = "${pkgs.docker}/bin/docker --daemon=true --group=docker ${cfg.extraOptions}";
+ # I'm not sure if that limits aren't too high, but it's what
+ # goes in config bundled with docker itself
+ LimitNOFILE = 1048576;
+ LimitNPROC = 1048576;
+ };
+
+ # Presumably some containers are running we don't want to interrupt
+ restartIfChanged = false;
+ };
+ })
+ ]);
+
+}
diff --git a/nixos/modules/virtualisation/ec2-data.nix b/nixos/modules/virtualisation/ec2-data.nix
index 5133a98cd96..93a83a3e42a 100644
--- a/nixos/modules/virtualisation/ec2-data.nix
+++ b/nixos/modules/virtualisation/ec2-data.nix
@@ -2,9 +2,9 @@
# host name of virtual machines running on Amazon EC2, Eucalyptus and
# OpenStack Compute (Nova).
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
options = {
@@ -22,21 +22,22 @@ with pkgs.lib;
systemd.services."fetch-ec2-data" =
{ description = "Fetch EC2 Data";
- wantedBy = [ "multi-user.target" ];
+ wantedBy = [ "multi-user.target" "sshd.service" ];
before = [ "sshd.service" ];
- after = [ "network.target" ];
+ wants = [ "ip-up.target" ];
+ after = [ "ip-up.target" ];
- path = [ pkgs.curl pkgs.iproute ];
+ path = [ pkgs.wget pkgs.iproute ];
script =
''
ip route del blackhole 169.254.169.254/32 || true
- curl="curl --retry 3 --retry-delay 0 --fail"
+ wget="wget -q --retry-connrefused -O -"
echo "setting host name..."
${optionalString (config.networking.hostName == "") ''
- ${pkgs.nettools}/bin/hostname $($curl http://169.254.169.254/1.0/meta-data/hostname)
+ ${pkgs.nettools}/bin/hostname $($wget http://169.254.169.254/1.0/meta-data/hostname)
''}
# Don't download the SSH key if it has already been injected
@@ -44,7 +45,7 @@ with pkgs.lib;
if ! [ -e /root/.ssh/authorized_keys ]; then
echo "obtaining SSH key..."
mkdir -p /root/.ssh
- $curl -o /root/key.pub http://169.254.169.254/1.0/meta-data/public-keys/0/openssh-key
+ $wget http://169.254.169.254/1.0/meta-data/public-keys/0/openssh-key > /root/key.pub
if [ $? -eq 0 -a -e /root/key.pub ]; then
if ! grep -q -f /root/key.pub /root/.ssh/authorized_keys; then
cat /root/key.pub >> /root/.ssh/authorized_keys
@@ -58,7 +59,7 @@ with pkgs.lib;
# Extract the intended SSH host key for this machine from
# the supplied user data, if available. Otherwise sshd will
# generate one normally.
- $curl http://169.254.169.254/2011-01-01/user-data > /root/user-data || true
+ $wget http://169.254.169.254/2011-01-01/user-data > /root/user-data || true
key="$(sed 's/|/\n/g; s/SSH_HOST_DSA_KEY://; t; d' /root/user-data)"
key_pub="$(sed 's/SSH_HOST_DSA_KEY_PUB://; t; d' /root/user-data)"
if [ -n "$key" -a -n "$key_pub" -a ! -e /etc/ssh/ssh_host_dsa_key ]; then
diff --git a/nixos/modules/virtualisation/google-compute-config.nix b/nixos/modules/virtualisation/google-compute-config.nix
new file mode 100644
index 00000000000..9e6be93b6d9
--- /dev/null
+++ b/nixos/modules/virtualisation/google-compute-config.nix
@@ -0,0 +1,5 @@
+{ config, pkgs, modulesPath, ... }:
+
+{
+ imports = [ "${modulesPath}/virtualisation/google-compute-image.nix" ];
+}
diff --git a/nixos/modules/virtualisation/google-compute-image.nix b/nixos/modules/virtualisation/google-compute-image.nix
new file mode 100644
index 00000000000..697423ac60b
--- /dev/null
+++ b/nixos/modules/virtualisation/google-compute-image.nix
@@ -0,0 +1,173 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ diskSize = "100G";
+in
+{
+ imports = [ ../profiles/headless.nix ../profiles/qemu-guest.nix ];
+
+ system.build.googleComputeImage =
+ pkgs.vmTools.runInLinuxVM (
+ pkgs.runCommand "google-compute-image"
+ { preVM =
+ ''
+ mkdir $out
+ diskImage=$out/$diskImageBase
+ truncate $diskImage --size ${diskSize}
+ mv closure xchg/
+ '';
+
+ postVM =
+ ''
+ PATH=$PATH:${pkgs.gnutar}/bin:${pkgs.gzip}/bin
+ pushd $out
+ mv $diskImageBase disk.raw
+ tar -Szcf $diskImageBase.tar.gz disk.raw
+ rm $out/disk.raw
+ popd
+ '';
+ diskImageBase = "nixos-${config.system.nixosVersion}-${pkgs.stdenv.system}.raw";
+ buildInputs = [ pkgs.utillinux pkgs.perl ];
+ exportReferencesGraph =
+ [ "closure" config.system.build.toplevel ];
+ }
+ ''
+ # Create partition table
+ ${pkgs.parted}/sbin/parted /dev/vda mklabel msdos
+ ${pkgs.parted}/sbin/parted /dev/vda mkpart primary ext4 1 ${diskSize}
+ ${pkgs.parted}/sbin/parted /dev/vda print
+ . /sys/class/block/vda1/uevent
+ mknod /dev/vda1 b $MAJOR $MINOR
+
+ # Create an empty filesystem and mount it.
+ ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda1
+ ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1
+
+ mkdir /mnt
+ mount /dev/vda1 /mnt
+
+ # The initrd expects these directories to exist.
+ mkdir /mnt/dev /mnt/proc /mnt/sys
+
+ mount --bind /proc /mnt/proc
+ mount --bind /dev /mnt/dev
+ mount --bind /sys /mnt/sys
+
+ # Copy all paths in the closure to the filesystem.
+ storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
+
+ mkdir -p /mnt/nix/store
+ echo "copying everything (will take a while)..."
+ cp -prd $storePaths /mnt/nix/store/
+
+ # Register the paths in the Nix database.
+ printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
+ chroot /mnt ${config.nix.package}/bin/nix-store --load-db
+
+ # Create the system profile to allow nixos-rebuild to work.
+ chroot /mnt ${config.nix.package}/bin/nix-env \
+ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
+
+ # `nixos-rebuild' requires an /etc/NIXOS.
+ mkdir -p /mnt/etc
+ touch /mnt/etc/NIXOS
+
+ # `switch-to-configuration' requires a /bin/sh
+ mkdir -p /mnt/bin
+ ln -s ${config.system.build.binsh}/bin/sh /mnt/bin/sh
+
+ # Install a configuration.nix.
+ mkdir -p /mnt/etc/nixos /mnt/boot/grub
+ cp ${./google-compute-config.nix} /mnt/etc/nixos/configuration.nix
+
+ # Generate the GRUB menu.
+ ln -s vda /dev/sda
+ chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
+
+ umount /mnt/proc /mnt/dev /mnt/sys
+ umount /mnt
+ ''
+ );
+
+ fileSystems."/".label = "nixos";
+
+ boot.kernelParams = [ "console=ttyS0" "panic=1" "boot.panic_on_fail" ];
+ boot.initrd.kernelModules = [ "virtio_scsi" ];
+
+ # Generate a GRUB menu. Amazon's pv-grub uses this to boot our kernel/initrd.
+ boot.loader.grub.device = "/dev/sda";
+ boot.loader.grub.timeout = 0;
+
+ # Don't put old configurations in the GRUB menu. The user has no
+ # way to select them anyway.
+ boot.loader.grub.configurationLimit = 0;
+
+ # Allow root logins only using the SSH key that the user specified
+ # at instance creation time.
+ services.openssh.enable = true;
+ services.openssh.permitRootLogin = "without-password";
+
+ # Force getting the hostname from Google Compute.
+ networking.hostName = mkDefault "";
+
+ # Always include cryptsetup so that NixOps can use it.
+ environment.systemPackages = [ pkgs.cryptsetup ];
+
+ # Configure default metadata hostnames
+ networking.extraHosts = ''
+ 169.254.169.254 metadata.google.internal metadata
+ '';
+
+ networking.usePredictableInterfaceNames = false;
+
+ systemd.services.fetch-ssh-keys =
+ { description = "Fetch host keys and authorized_keys for root user";
+
+ wantedBy = [ "sshd.service" ];
+ before = [ "sshd.service" ];
+ after = [ "network-online.target" ];
+ wants = [ "network-online.target" ];
+
+ path = [ pkgs.wget ];
+ script =
+ ''
+ wget="wget --retry-connrefused -t 6 --waitretry=10"
+ # Don't download the SSH key if it has already been downloaded
+ if ! [ -e /root/.ssh/authorized_keys ]; then
+ echo "obtaining SSH key..."
+ mkdir -p /root/.ssh
+ $wget -O /root/authorized-keys-metadata http://metadata/0.1/meta-data/authorized-keys
+ if [ $? -eq 0 -a -e /root/authorized-keys-metadata ]; then
+ cat /root/authorized-keys-metadata | cut -d: -f2- > /root/key.pub
+ if ! grep -q -f /root/key.pub /root/.ssh/authorized_keys; then
+ cat /root/key.pub >> /root/.ssh/authorized_keys
+ echo "new key added to authorized_keys"
+ fi
+ chmod 600 /root/.ssh/authorized_keys
+ rm -f /root/key.pub /root/authorized-keys-metadata
+ fi
+ fi
+
+ echo "obtaining SSH private host key..."
+ $wget -O /root/ssh_host_ecdsa_key http://metadata/0.1/meta-data/attributes/ssh_host_ecdsa_key
+ if [ $? -eq 0 -a -e /root/ssh_host_ecdsa_key ]; then
+ mv -f /root/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key
+ echo "downloaded ssh_host_ecdsa_key"
+ chmod 600 /etc/ssh/ssh_host_ecdsa_key
+ fi
+
+ echo "obtaining SSH public host key..."
+ $wget -O /root/ssh_host_ecdsa_key.pub http://metadata/0.1/meta-data/attributes/ssh_host_ecdsa_key_pub
+ if [ $? -eq 0 -a -e /root/ssh_host_ecdsa_key.pub ]; then
+ mv -f /root/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
+ echo "downloaded ssh_host_ecdsa_key.pub"
+ chmod 644 /etc/ssh/ssh_host_ecdsa_key.pub
+ fi
+ '';
+ serviceConfig.Type = "oneshot";
+ serviceConfig.RemainAfterExit = true;
+ serviceConfig.StandardError = "journal+console";
+ serviceConfig.StandardOutput = "journal+console";
+ };
+}
diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix
index d3884a503bc..d7d700d8841 100644
--- a/nixos/modules/virtualisation/libvirtd.nix
+++ b/nixos/modules/virtualisation/libvirtd.nix
@@ -1,8 +1,8 @@
# Systemd services for libvirtd.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -24,6 +24,7 @@ in
virtualisation.libvirtd.enable =
mkOption {
+ type = types.bool;
default = false;
description =
''
@@ -36,6 +37,7 @@ in
virtualisation.libvirtd.enableKVM =
mkOption {
+ type = types.bool;
default = true;
description =
''
@@ -45,6 +47,7 @@ in
virtualisation.libvirtd.extraConfig =
mkOption {
+ type = types.lines;
default = "";
description =
''
@@ -82,8 +85,11 @@ in
mkdir -p /var/log/libvirt/qemu -m 755
rm -f /var/run/libvirtd.pid
- mkdir -p /var/lib/libvirt -m 700
- mkdir -p /var/lib/libvirt/dnsmasq -m 700
+ mkdir -p /var/lib/libvirt
+ mkdir -p /var/lib/libvirt/dnsmasq
+
+ chmod 755 /var/lib/libvirt
+ chmod 755 /var/lib/libvirt/dnsmasq
# Libvirt unfortunately writes mutable state (such as
# runtime changes to VM, network or filter configurations)
@@ -98,6 +104,20 @@ in
mkdir -p /etc/$(dirname $i) -m 755
cp -fpd ${pkgs.libvirt}/etc/$i /etc/$i
done
+
+ # libvirtd puts the full path of the emulator binary in the machine
+ # config file. But this path can unfortunately be garbage collected
+ # while still being used by the virtual machine. So update the
+ # emulator path on each startup to something valid (re-scan $PATH).
+ for file in /etc/libvirt/qemu/*.xml; do
+ test -f "$file" || continue
+ # get (old) emulator path from config file
+ emulator=$(grep "^[[:space:]]*" "$file" | sed 's,^[[:space:]]*\(.*\).*,\1,')
+ # get a (definitely) working emulator path by re-scanning $PATH
+ new_emulator=$(command -v $(basename "$emulator"))
+ # write back
+ sed -i "s,^[[:space:]]*.*, $new_emulator ," "$file"
+ done
''; # */
serviceConfig.ExecStart = ''@${pkgs.libvirt}/sbin/libvirtd libvirtd --config "${configFile}" --daemon --verbose'';
diff --git a/nixos/modules/virtualisation/nixos-container.pl b/nixos/modules/virtualisation/nixos-container.pl
new file mode 100644
index 00000000000..bf6f16fc6c7
--- /dev/null
+++ b/nixos/modules/virtualisation/nixos-container.pl
@@ -0,0 +1,276 @@
+#! @perl@
+
+use strict;
+use POSIX;
+use File::Path;
+use File::Slurp;
+use Fcntl ':flock';
+use Getopt::Long qw(:config gnu_getopt);
+
+my $socat = '@socat@/bin/socat';
+
+# Ensure a consistent umask.
+umask 0022;
+
+# Parse the command line.
+
+sub showHelp {
+ print < [--system-path ] [--config ] [--ensure-unique-name] [--auto-start]
+ nixos-container destroy
+ nixos-container start
+ nixos-container stop
+ nixos-container status
+ nixos-container login
+ nixos-container root-login
+ nixos-container run -- args...
+ nixos-container set-root-password
+ nixos-container show-ip
+ nixos-container show-host-key
+EOF
+ exit 0;
+}
+
+my $systemPath;
+my $ensureUniqueName = 0;
+my $autoStart = 0;
+my $extraConfig;
+
+GetOptions(
+ "help" => sub { showHelp() },
+ "ensure-unique-name" => \$ensureUniqueName,
+ "auto-start" => \$autoStart,
+ "system-path=s" => \$systemPath,
+ "config=s" => \$extraConfig
+ ) or exit 1;
+
+my $action = $ARGV[0] or die "$0: no action specified\n";
+
+
+# Execute the selected action.
+
+mkpath("/etc/containers", 0, 0755);
+mkpath("/var/lib/containers", 0, 0700);
+
+if ($action eq "list") {
+ foreach my $confFile (glob "/etc/containers/*.conf") {
+ $confFile =~ /\/([^\/]+).conf$/ or next;
+ print "$1\n";
+ }
+ exit 0;
+}
+
+my $containerName = $ARGV[1] or die "$0: no container name specified\n";
+$containerName =~ /^[a-zA-Z0-9\-]+$/ or die "$0: invalid container name\n";
+
+sub writeNixOSConfig {
+ my ($nixosConfigFile) = @_;
+
+ my $nixosConfig = <>', $lockFN) or die "$0: opening $lockFN: $!";
+ flock($lock, LOCK_EX) or die "$0: could not lock $lockFN: $!";
+
+ my $confFile = "/etc/containers/$containerName.conf";
+ my $root = "/var/lib/containers/$containerName";
+
+ # Maybe generate a unique name.
+ if ($ensureUniqueName) {
+ my $base = $containerName;
+ for (my $nr = 0; ; $nr++) {
+ $containerName = "$base-$nr";
+ $confFile = "/etc/containers/$containerName.conf";
+ $root = "/var/lib/containers/$containerName";
+ last unless -e $confFile || -e $root;
+ }
+ }
+
+ die "$0: container ‘$containerName’ already exists\n" if -e $confFile;
+
+ # Get an unused IP address.
+ my %usedIPs;
+ foreach my $confFile2 (glob "/etc/containers/*.conf") {
+ my $s = read_file($confFile2) or die;
+ $usedIPs{$1} = 1 if $s =~ /^HOST_ADDRESS=([0-9\.]+)$/m;
+ $usedIPs{$1} = 1 if $s =~ /^LOCAL_ADDRESS=([0-9\.]+)$/m;
+ }
+
+ my ($ipPrefix, $hostAddress, $localAddress);
+ for (my $nr = 1; $nr < 255; $nr++) {
+ $ipPrefix = "10.233.$nr";
+ $hostAddress = "$ipPrefix.1";
+ $localAddress = "$ipPrefix.2";
+ last unless $usedIPs{$hostAddress} || $usedIPs{$localAddress};
+ $ipPrefix = undef;
+ }
+
+ die "$0: out of IP addresses\n" unless defined $ipPrefix;
+
+ my @conf;
+ push @conf, "PRIVATE_NETWORK=1\n";
+ push @conf, "HOST_ADDRESS=$hostAddress\n";
+ push @conf, "LOCAL_ADDRESS=$localAddress\n";
+ push @conf, "AUTO_START=$autoStart\n";
+ write_file($confFile, \@conf);
+
+ close($lock);
+
+ print STDERR "host IP is $hostAddress, container IP is $localAddress\n";
+
+ # The per-container directory is restricted to prevent users on
+ # the host from messing with guest users who happen to have the
+ # same uid.
+ my $profileDir = "/nix/var/nix/profiles/per-container";
+ mkpath($profileDir, 0, 0700);
+ $profileDir = "$profileDir/$containerName";
+ mkpath($profileDir, 0, 0755);
+
+ # Build/set the initial configuration.
+ if (defined $systemPath) {
+ system("nix-env", "-p", "$profileDir/system", "--set", $systemPath) == 0
+ or die "$0: failed to set initial container configuration\n";
+ } else {
+ mkpath("$root/etc/nixos", 0, 0755);
+
+ my $nixosConfigFile = "$root/etc/nixos/configuration.nix";
+ writeNixOSConfig $nixosConfigFile;
+
+ system("nix-env", "-p", "$profileDir/system",
+ "-I", "nixos-config=$nixosConfigFile", "-f", "",
+ "--set", "-A", "system") == 0
+ or die "$0: failed to build initial container configuration\n";
+ }
+
+ print "$containerName\n" if $ensureUniqueName;
+ exit 0;
+}
+
+my $root = "/var/lib/containers/$containerName";
+my $profileDir = "/nix/var/nix/profiles/per-container/$containerName";
+my $gcRootsDir = "/nix/var/nix/gcroots/per-container/$containerName";
+my $confFile = "/etc/containers/$containerName.conf";
+if (!-e $confFile) {
+ if ($action eq "destroy") {
+ exit 0;
+ } elsif ($action eq "status") {
+ print "gone\n";
+ }
+ die "$0: container ‘$containerName’ does not exist\n" ;
+}
+
+sub isContainerRunning {
+ my $status = `systemctl show 'container\@$containerName'`;
+ return $status =~ /ActiveState=active/;
+}
+
+sub stopContainer {
+ system("systemctl", "stop", "container\@$containerName") == 0
+ or die "$0: failed to stop container\n";
+}
+
+if ($action eq "destroy") {
+ die "$0: cannot destroy declarative container (remove it from your configuration.nix instead)\n"
+ unless POSIX::access($confFile, &POSIX::W_OK);
+
+ stopContainer if isContainerRunning;
+
+ rmtree($profileDir) if -e $profileDir;
+ rmtree($gcRootsDir) if -e $gcRootsDir;
+ rmtree($root) if -e $root;
+ unlink($confFile) or die;
+}
+
+elsif ($action eq "start") {
+ system("systemctl", "start", "container\@$containerName") == 0
+ or die "$0: failed to start container\n";
+}
+
+elsif ($action eq "stop") {
+ stopContainer;
+}
+
+elsif ($action eq "status") {
+ print isContainerRunning() ? "up" : "down", "\n";
+}
+
+elsif ($action eq "update") {
+ my $nixosConfigFile = "$root/etc/nixos/configuration.nix";
+
+ # FIXME: may want to be more careful about clobbering the existing
+ # configuration.nix.
+ writeNixOSConfig $nixosConfigFile if (defined $extraConfig && $extraConfig ne "");
+
+ system("nix-env", "-p", "$profileDir/system",
+ "-I", "nixos-config=$nixosConfigFile", "-f", "",
+ "--set", "-A", "system") == 0
+ or die "$0: failed to build container configuration\n";
+
+ if (isContainerRunning) {
+ print STDERR "reloading container...\n";
+ system("systemctl", "reload", "container\@$containerName") == 0
+ or die "$0: failed to reload container\n";
+ }
+}
+
+elsif ($action eq "login") {
+ exec("machinectl", "login", "--", $containerName);
+}
+
+elsif ($action eq "root-login") {
+ exec($socat, "unix:$root/var/lib/root-login.socket", "-,echo=0,raw");
+}
+
+elsif ($action eq "run") {
+ shift @ARGV; shift @ARGV;
+ my $pid = open(SOCAT, "|-", $socat, "-t0", "-", "unix:$root/var/lib/run-command.socket") or die "$0: cannot start $socat: $!\n";
+ print SOCAT join(' ', map { "'$_'" } @ARGV), "\n";
+ flush SOCAT;
+ waitpid($pid, 0);
+ close(SOCAT);
+}
+
+elsif ($action eq "set-root-password") {
+ # FIXME: don't get password from the command line.
+ my $password = $ARGV[2] or die "$0: no password given\n";
+ my $pid = open(SOCAT, "|-", $socat, "-t0", "-", "unix:$root/var/lib/run-command.socket") or die "$0: cannot start $socat: $!\n";
+ print SOCAT "passwd\n";
+ print SOCAT "$password\n";
+ print SOCAT "$password\n";
+ flush SOCAT;
+ waitpid($pid, 0);
+ close(SOCAT);
+}
+
+elsif ($action eq "show-ip") {
+ my $s = read_file($confFile) or die;
+ $s =~ /^LOCAL_ADDRESS=([0-9\.]+)$/m or die "$0: cannot get IP address\n";
+ print "$1\n";
+}
+
+elsif ($action eq "show-host-key") {
+ my $fn = "$root/etc/ssh/ssh_host_ecdsa_key.pub";
+ exit 1 if ! -f $fn;
+ print read_file($fn);
+}
+
+else {
+ die "$0: unknown action ‘$action’\n";
+}
diff --git a/nixos/modules/virtualisation/nova-image.nix b/nixos/modules/virtualisation/nova-image.nix
index 5c9481b7127..2523dacc0b5 100644
--- a/nixos/modules/virtualisation/nova-image.nix
+++ b/nixos/modules/virtualisation/nova-image.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
imports = [ ../profiles/qemu-guest.nix ../profiles/headless.nix ./ec2-data.nix ];
diff --git a/nixos/modules/virtualisation/nova.nix b/nixos/modules/virtualisation/nova.nix
index 05c68e2bbff..8795b5b52d5 100644
--- a/nixos/modules/virtualisation/nova.nix
+++ b/nixos/modules/virtualisation/nova.nix
@@ -1,8 +1,8 @@
# Module for Nova, a.k.a. OpenStack Compute.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -113,7 +113,7 @@ in
jobs.nova_objectstore =
{ name = "nova-objectstore";
- description = "Nova simple object store service";
+ description = "Nova Simple Object Store Service";
startOn = "ip-up";
@@ -129,7 +129,7 @@ in
jobs.nova_scheduler =
{ name = "nova-scheduler";
- description = "Nova scheduler service";
+ description = "Nova Scheduler Service";
startOn = "ip-up";
@@ -140,7 +140,7 @@ in
jobs.nova_compute =
{ name = "nova-compute";
- description = "Nova compute service";
+ description = "Nova Compute Service";
startOn = "ip-up";
@@ -157,7 +157,7 @@ in
jobs.nova_network =
{ name = "nova-network";
- description = "Nova network service";
+ description = "Nova Network Service";
startOn = "ip-up";
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index 2218e1045eb..58386ce5cf5 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -7,9 +7,9 @@
# the VM in the host. On the other hand, the root filesystem is a
# read/writable disk image persistent across VM reboots.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -65,7 +65,7 @@ let
${if cfg.useBootLoader then ''
-drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \
-drive index=1,id=drive2,file=${bootDisk}/disk.img,if=virtio,readonly \
- -boot menu=on
+ -boot menu=on \
'' else ''
-drive file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \
-kernel ${config.system.build.toplevel}/kernel \
@@ -275,12 +275,10 @@ in
boot.loader.grub.device = mkVMOverride "/dev/vda";
- boot.initrd.supportedFilesystems = optional cfg.writableStore "unionfs-fuse";
-
boot.initrd.extraUtilsCommands =
''
# We need mke2fs in the initrd.
- cp ${pkgs.e2fsprogs}/sbin/mke2fs $out/bin
+ cp -f ${pkgs.e2fsprogs}/sbin/mke2fs $out/bin
'';
boot.initrd.postDeviceCommands =
@@ -303,20 +301,6 @@ in
chmod 1777 $targetRoot/tmp
mkdir -p $targetRoot/boot
- ${optionalString cfg.writableStore ''
- mkdir -p /unionfs-chroot/ro-store
- mount --rbind $targetRoot/nix/store /unionfs-chroot/ro-store
-
- mkdir /unionfs-chroot/rw-store
- ${if cfg.writableStoreUseTmpfs then ''
- mount -t tmpfs -o "mode=755" none /unionfs-chroot/rw-store
- '' else ''
- mkdir $targetRoot/.nix-rw-store
- mount --bind $targetRoot/.nix-rw-store /unionfs-chroot/rw-store
- ''}
-
- unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768,hide_meta_files /rw-store=RW:/ro-store=RO $targetRoot/nix/store
- ''}
'';
# After booting, register the closure of the paths in
@@ -343,12 +327,13 @@ in
# configuration, where the regular value for the `fileSystems'
# attribute should be disregarded for the purpose of building a VM
# test image (since those filesystems don't exist in the VM).
- fileSystems = mkVMOverride
+ fileSystems = mkVMOverride (
{ "/".device = "/dev/vda";
- "/nix/store" =
+ ${if cfg.writableStore then "/nix/.ro-store" else "/nix/store"} =
{ device = "store";
fsType = "9p";
options = "trans=virtio,version=9p2000.L,msize=1048576,cache=loose";
+ neededForBoot = true;
};
"/tmp/xchg" =
{ device = "xchg";
@@ -362,6 +347,18 @@ in
options = "trans=virtio,version=9p2000.L,msize=1048576";
neededForBoot = true;
};
+ } // optionalAttrs cfg.writableStore
+ { "/nix/store" =
+ { fsType = "unionfs-fuse";
+ device = "unionfs";
+ options = "allow_other,cow,nonempty,chroot=/mnt-root,max_files=32768,hide_meta_files,dirs=/nix/.rw-store=rw:/nix/.ro-store=ro";
+ };
+ } // optionalAttrs (cfg.writableStore && cfg.writableStoreUseTmpfs)
+ { "/nix/.rw-store" =
+ { fsType = "tmpfs";
+ options = "mode=0755";
+ neededForBoot = true;
+ };
} // optionalAttrs cfg.useBootLoader
{ "/boot" =
{ device = "/dev/disk/by-label/boot";
@@ -369,7 +366,7 @@ in
options = "ro";
noCheck = true; # fsck fails on a r/o filesystem
};
- };
+ });
swapDevices = mkVMOverride [ ];
boot.initrd.luks.devices = mkVMOverride [];
@@ -379,14 +376,13 @@ in
system.build.vm = pkgs.runCommand "nixos-vm" { preferLocalBuild = true; }
''
- ensureDir $out/bin
+ mkdir -p $out/bin
ln -s ${config.system.build.toplevel} $out/system
ln -s ${pkgs.writeScript "run-nixos-vm" startVM} $out/bin/run-${vmName}-vm
'';
# When building a regular system configuration, override whatever
# video driver the host uses.
- services.xserver.videoDriver = mkVMOverride null;
services.xserver.videoDrivers = mkVMOverride [ "vesa" ];
services.xserver.defaultDepth = mkVMOverride 0;
services.xserver.resolutions = mkVMOverride [ { x = 1024; y = 768; } ];
@@ -400,6 +396,11 @@ in
# Wireless won't work in the VM.
networking.wireless.enable = mkVMOverride false;
+ # Speed up booting by not waiting for ARP.
+ networking.dhcpcd.extraConfig = "noarp";
+
+ networking.usePredictableInterfaceNames = false;
+
system.requiredKernelConfig = with config.lib.kernelConfig;
[ (isEnabled "VIRTIO_BLK")
(isEnabled "VIRTIO_PCI")
diff --git a/nixos/modules/virtualisation/virtualbox-guest.nix b/nixos/modules/virtualisation/virtualbox-guest.nix
index 664fd21781c..a5a4db79787 100644
--- a/nixos/modules/virtualisation/virtualbox-guest.nix
+++ b/nixos/modules/virtualisation/virtualbox-guest.nix
@@ -1,8 +1,8 @@
# Module for VirtualBox guests.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -11,7 +11,6 @@ let
in
-optionalAttrs (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) # ugly...
{
###### interface
@@ -33,11 +32,17 @@ optionalAttrs (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) # ugly...
###### implementation
config = mkIf cfg.enable {
+ assertions = [ {
+ assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64;
+ message = "Virtualbox not currently supported on ${pkgs.stdenv.system}";
+ } ];
environment.systemPackages = [ kernel.virtualboxGuestAdditions ];
boot.extraModulePackages = [ kernel.virtualboxGuestAdditions ];
+ boot.kernelModules = [ "vboxsf" ];
+
users.extraGroups.vboxsf.gid = config.ids.gids.vboxsf;
systemd.services.virtualbox =
diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix
index beed36b6a51..106b269d9e1 100644
--- a/nixos/modules/virtualisation/virtualbox-image.nix
+++ b/nixos/modules/virtualisation/virtualbox-image.nix
@@ -1,110 +1,133 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
-{
- system.build.virtualBoxImage =
- pkgs.vmTools.runInLinuxVM (
- pkgs.runCommand "virtualbox-image"
- { memSize = 768;
- preVM =
- ''
- mkdir $out
- diskImage=$out/image
- ${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "10G"
- mv closure xchg/
- '';
- postVM =
- ''
- echo "creating VirtualBox disk image..."
- ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -O vdi $diskImage $out/disk.vdi
- rm $diskImage
- '';
- buildInputs = [ pkgs.utillinux pkgs.perl ];
- exportReferencesGraph =
- [ "closure" config.system.build.toplevel ];
- }
- ''
- # Create a single / partition.
- ${pkgs.parted}/sbin/parted /dev/vda mklabel msdos
- ${pkgs.parted}/sbin/parted /dev/vda -- mkpart primary ext2 1M -1s
- . /sys/class/block/vda1/uevent
- mknod /dev/vda1 b $MAJOR $MINOR
+let
- # Create an empty filesystem and mount it.
- ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda1
- ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1
- mkdir /mnt
- mount /dev/vda1 /mnt
+ cfg = config.virtualbox;
- # The initrd expects these directories to exist.
- mkdir /mnt/dev /mnt/proc /mnt/sys
- mount --bind /proc /mnt/proc
- mount --bind /dev /mnt/dev
- mount --bind /sys /mnt/sys
+in {
- # Copy all paths in the closure to the filesystem.
- storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
+ options = {
+ virtualbox = {
+ baseImageSize = mkOption {
+ type = types.str;
+ default = "10G";
+ description = ''
+ The size of the VirtualBox base image. The size string should be on
+ a format the qemu-img command accepts.
+ '';
+ };
+ };
+ };
- echo "filling Nix store..."
- mkdir -p /mnt/nix/store
- set -f
- cp -prd $storePaths /mnt/nix/store/
-
- # Register the paths in the Nix database.
- printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
- chroot /mnt ${config.nix.package}/bin/nix-store --load-db
-
- # Create the system profile to allow nixos-rebuild to work.
- chroot /mnt ${config.nix.package}/bin/nix-env \
- -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
-
- # `nixos-rebuild' requires an /etc/NIXOS.
- mkdir -p /mnt/etc/nixos
- touch /mnt/etc/NIXOS
-
- # `switch-to-configuration' requires a /bin/sh
- mkdir -p /mnt/bin
- ln -s ${config.system.build.binsh}/bin/sh /mnt/bin/sh
-
- # Generate the GRUB menu.
- ln -s vda /dev/sda
- chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
-
- umount /mnt/proc /mnt/dev /mnt/sys
- umount /mnt
- ''
- );
-
- system.build.virtualBoxOVA = pkgs.runCommand "virtualbox-ova"
- { buildInputs = [ pkgs.linuxPackages.virtualbox ];
- vmName = "NixOS ${config.system.nixosVersion} (${pkgs.stdenv.system})";
- fileName = "nixos-${config.system.nixosVersion}-${pkgs.stdenv.system}.ova";
- }
- ''
- echo "creating VirtualBox VM..."
- export HOME=$PWD
- VBoxManage createvm --name "$vmName" --register \
- --ostype ${if pkgs.stdenv.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
- VBoxManage modifyvm "$vmName" \
- --memory 1536 --acpi on --vram 10 \
- --nictype1 virtio --nic1 nat \
- --audiocontroller ac97 --audio alsa \
- --rtcuseutc on \
- --usb on --mouse usbtablet
- VBoxManage storagectl "$vmName" --name SATA --add sata --sataportcount 4 --bootable on --hostiocache on
- VBoxManage storageattach "$vmName" --storagectl SATA --port 0 --device 0 --type hdd \
- --medium ${config.system.build.virtualBoxImage}/disk.vdi
-
- echo "exporting VirtualBox VM..."
- mkdir -p $out
- VBoxManage export "$vmName" --output "$out/$fileName"
- '';
-
- fileSystems."/".device = "/dev/disk/by-label/nixos";
-
- boot.loader.grub.version = 2;
- boot.loader.grub.device = "/dev/sda";
-
- services.virtualbox.enable = true;
+ config = {
+ system.build.virtualBoxImage =
+ pkgs.vmTools.runInLinuxVM (
+ pkgs.runCommand "virtualbox-image"
+ { memSize = 768;
+ preVM =
+ ''
+ mkdir $out
+ diskImage=$out/image
+ ${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "${cfg.baseImageSize}"
+ mv closure xchg/
+ '';
+ postVM =
+ ''
+ echo "creating VirtualBox disk image..."
+ ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -O vdi $diskImage $out/disk.vdi
+ rm $diskImage
+ '';
+ buildInputs = [ pkgs.utillinux pkgs.perl ];
+ exportReferencesGraph =
+ [ "closure" config.system.build.toplevel ];
+ }
+ ''
+ # Create a single / partition.
+ ${pkgs.parted}/sbin/parted /dev/vda mklabel msdos
+ ${pkgs.parted}/sbin/parted /dev/vda -- mkpart primary ext2 1M -1s
+ . /sys/class/block/vda1/uevent
+ mknod /dev/vda1 b $MAJOR $MINOR
+
+ # Create an empty filesystem and mount it.
+ ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda1
+ ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1
+ mkdir /mnt
+ mount /dev/vda1 /mnt
+
+ # The initrd expects these directories to exist.
+ mkdir /mnt/dev /mnt/proc /mnt/sys
+ mount --bind /proc /mnt/proc
+ mount --bind /dev /mnt/dev
+ mount --bind /sys /mnt/sys
+
+ # Copy all paths in the closure to the filesystem.
+ storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
+
+ echo "filling Nix store..."
+ mkdir -p /mnt/nix/store
+ set -f
+ cp -prd $storePaths /mnt/nix/store/
+
+ mkdir -p /mnt/etc/nix
+ echo 'build-users-group = ' > /mnt/etc/nix/nix.conf
+
+ # Register the paths in the Nix database.
+ printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
+ chroot /mnt ${config.nix.package}/bin/nix-store --load-db
+
+ # Create the system profile to allow nixos-rebuild to work.
+ chroot /mnt ${config.nix.package}/bin/nix-env \
+ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
+
+ # `nixos-rebuild' requires an /etc/NIXOS.
+ mkdir -p /mnt/etc/nixos
+ touch /mnt/etc/NIXOS
+
+ # `switch-to-configuration' requires a /bin/sh
+ mkdir -p /mnt/bin
+ ln -s ${config.system.build.binsh}/bin/sh /mnt/bin/sh
+
+ # Generate the GRUB menu.
+ ln -s vda /dev/sda
+ chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
+
+ umount /mnt/proc /mnt/dev /mnt/sys
+ umount /mnt
+ ''
+ );
+
+ system.build.virtualBoxOVA = pkgs.runCommand "virtualbox-ova"
+ { buildInputs = [ pkgs.linuxPackages.virtualbox ];
+ vmName = "NixOS ${config.system.nixosVersion} (${pkgs.stdenv.system})";
+ fileName = "nixos-${config.system.nixosVersion}-${pkgs.stdenv.system}.ova";
+ }
+ ''
+ echo "creating VirtualBox VM..."
+ export HOME=$PWD
+ VBoxManage createvm --name "$vmName" --register \
+ --ostype ${if pkgs.stdenv.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
+ VBoxManage modifyvm "$vmName" \
+ --memory 1536 --acpi on --vram 10 \
+ --nictype1 virtio --nic1 nat \
+ --audiocontroller ac97 --audio alsa \
+ --rtcuseutc on \
+ --usb on --mouse usbtablet
+ VBoxManage storagectl "$vmName" --name SATA --add sata --portcount 4 --bootable on --hostiocache on
+ VBoxManage storageattach "$vmName" --storagectl SATA --port 0 --device 0 --type hdd \
+ --medium ${config.system.build.virtualBoxImage}/disk.vdi
+
+ echo "exporting VirtualBox VM..."
+ mkdir -p $out
+ VBoxManage export "$vmName" --output "$out/$fileName"
+ '';
+
+ fileSystems."/".device = "/dev/disk/by-label/nixos";
+
+ boot.loader.grub.version = 2;
+ boot.loader.grub.device = "/dev/sda";
+
+ services.virtualbox.enable = true;
+ };
}
diff --git a/nixos/modules/virtualisation/xen-dom0.nix b/nixos/modules/virtualisation/xen-dom0.nix
index 4c24c6a7826..566059472c9 100644
--- a/nixos/modules/virtualisation/xen-dom0.nix
+++ b/nixos/modules/virtualisation/xen-dom0.nix
@@ -1,8 +1,8 @@
# Xen hypervisor (Dom0) support.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -107,7 +107,7 @@ in
'';
jobs.xend =
- { description = "Xen control daemon";
+ { description = "Xen Control Daemon";
startOn = "stopped udevtrigger";
diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix
index dccc3acbf46..dae3b9210a8 100644
--- a/nixos/release-combined.nix
+++ b/nixos/release-combined.nix
@@ -1,6 +1,6 @@
-{ nixpkgs ? { outPath = ./..; revCount = 5678; shortRev = "gfedcba"; }
-, officialRelease ? false
+{ nixpkgs ? { outPath = ./..; revCount = 56789; shortRev = "gfedcba"; }
, stableBranch ? false
+, supportedSystems ? [ "x86_64-linux" "i686-linux" ]
}:
let
@@ -18,15 +18,13 @@ let
in rec {
nixos = removeMaintainers (import ./release.nix {
- inherit officialRelease stableBranch;
+ inherit stableBranch;
nixpkgs = nixpkgsSrc;
});
nixpkgs = builtins.removeAttrs (removeMaintainers (import ../pkgs/top-level/release.nix {
- inherit officialRelease;
+ inherit supportedSystems;
nixpkgs = nixpkgsSrc;
- # Only do Linux builds.
- supportedSystems = [ "x86_64-linux" "i686-linux" ];
})) [ "unstable" ];
tested = pkgs.releaseTools.aggregate {
@@ -45,8 +43,11 @@ in rec {
(all nixos.ova)
#(all nixos.tests.efi-installer.simple)
+ #(all nixos.tests.containers)
(all nixos.tests.firefox)
(all nixos.tests.firewall)
+ (all nixos.tests.gnome3)
+ #(all nixos.tests.installer.efi)
(all nixos.tests.installer.grub1)
(all nixos.tests.installer.lvm)
(all nixos.tests.installer.separateBoot)
@@ -60,6 +61,8 @@ in rec {
(all nixos.tests.openssh)
(all nixos.tests.printing)
(all nixos.tests.proxy)
+ (all nixos.tests.simple)
+ (all nixos.tests.udisks2)
(all nixos.tests.xfce)
nixpkgs.tarball
diff --git a/nixos/release.nix b/nixos/release.nix
index 1ffb334d90a..ed413d3e928 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -1,18 +1,17 @@
-{ nixpkgs ? { outPath = ./..; revCount = 5678; shortRev = "gfedcba"; }
-, officialRelease ? false
+{ nixpkgs ? { outPath = ./..; revCount = 56789; shortRev = "gfedcba"; }
, stableBranch ? false
+, supportedSystems ? [ "x86_64-linux" "i686-linux" ]
}:
let
version = builtins.readFile ../.version;
versionSuffix =
- if officialRelease then ""
- else (if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
+ (if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
- systems = [ "x86_64-linux" "i686-linux" ];
+ forAllSystems = pkgs.lib.genAttrs supportedSystems;
- forAllSystems = pkgs.lib.genAttrs systems;
+ callTest = fn: args: forAllSystems (system: import fn ({ inherit system; } // args));
pkgs = import nixpkgs { system = "x86_64-linux"; };
@@ -114,6 +113,7 @@ in rec {
manual = forAllSystems (system: (builtins.getAttr system iso_minimal).config.system.build.manual.manual);
+ manualPDF = iso_minimal.x86_64-linux.config.system.build.manual.manualPDF;
manpages = forAllSystems (system: (builtins.getAttr system iso_minimal).config.system.build.manual.manpages);
@@ -123,12 +123,6 @@ in rec {
inherit system;
});
- iso_minimal_new_kernel = forAllSystems (system: makeIso {
- module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix;
- type = "minimal-new-kernel";
- inherit system;
- });
-
iso_graphical = forAllSystems (system: makeIso {
module = ./modules/installer/cd-dvd/installation-cd-graphical.nix;
type = "graphical";
@@ -137,18 +131,15 @@ in rec {
# A variant with a more recent (but possibly less stable) kernel
# that might support more hardware.
- iso_new_kernel = forAllSystems (system: makeIso {
- module = ./modules/installer/cd-dvd/installation-cd-new-kernel.nix;
- type = "new-kernel";
+ iso_minimal_new_kernel = forAllSystems (system: makeIso {
+ module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix;
+ type = "minimal-new-kernel";
inherit system;
});
- # A variant with efi booting support. Once cd-minimal has a newer kernel,
- # this should be enabled by default.
- iso_efi = forAllSystems (system: makeIso {
- module = ./modules/installer/cd-dvd/installation-cd-efi.nix;
- type = "efi";
- maintainers = [ "shlevy" ];
+ iso_graphical_new_kernel = forAllSystems (system: makeIso {
+ module = ./modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix;
+ type = "graphical-new-kernel";
inherit system;
});
@@ -212,13 +203,43 @@ in rec {
*/
- # Run the tests in ./tests/default.nix for each platform. You can
- # run a test by doing e.g. "nix-build -A tests.login.x86_64-linux".
- tests =
- with lib;
- let
- testsFor = system:
- mapAttrsRecursiveCond (x: !x ? test) (n: v: listToAttrs [(nameValuePair system v.test)])
- (import ./tests { inherit nixpkgs system; });
- in fold recursiveUpdate {} (map testsFor systems);
+ # Run the tests for each platform. You can run a test by doing
+ # e.g. ‘nix-build -A tests.login.x86_64-linux’, or equivalently,
+ # ‘nix-build tests/login.nix -A result’.
+ tests.avahi = callTest tests/avahi.nix {};
+ tests.bittorrent = callTest tests/bittorrent.nix {};
+ tests.containers = callTest tests/containers.nix {};
+ tests.firefox = callTest tests/firefox.nix {};
+ tests.firewall = callTest tests/firewall.nix {};
+ tests.gnome3 = callTest tests/gnome3.nix {};
+ tests.installer.efi = forAllSystems (system: (import tests/installer.nix { inherit system; }).efi.test);
+ tests.installer.grub1 = forAllSystems (system: (import tests/installer.nix { inherit system; }).grub1.test);
+ tests.installer.lvm = forAllSystems (system: (import tests/installer.nix { inherit system; }).lvm.test);
+ tests.installer.rebuildCD = forAllSystems (system: (import tests/installer.nix { inherit system; }).rebuildCD.test);
+ tests.installer.separateBoot = forAllSystems (system: (import tests/installer.nix { inherit system; }).separateBoot.test);
+ tests.installer.simple = forAllSystems (system: (import tests/installer.nix { inherit system; }).simple.test);
+ tests.influxdb = callTest tests/influxdb.nix {};
+ tests.ipv6 = callTest tests/ipv6.nix {};
+ tests.jenkins = callTest tests/jenkins.nix {};
+ tests.kde4 = callTest tests/kde4.nix {};
+ tests.latestKernel.login = callTest tests/login.nix { latestKernel = true; };
+ tests.login = callTest tests/login.nix {};
+ tests.logstash = callTest tests/logstash.nix {};
+ tests.misc = callTest tests/misc.nix {};
+ tests.mumble = callTest tests/mumble.nix {};
+ tests.munin = callTest tests/munin.nix {};
+ tests.mysql = callTest tests/mysql.nix {};
+ tests.mysqlReplication = callTest tests/mysql-replication.nix {};
+ tests.nat = callTest tests/nat.nix {};
+ tests.nfs3 = callTest tests/nfs.nix { version = 3; };
+ tests.openssh = callTest tests/openssh.nix {};
+ tests.printing = callTest tests/printing.nix {};
+ tests.proxy = callTest tests/proxy.nix {};
+ tests.quake3 = callTest tests/quake3.nix {};
+ tests.runInMachine = callTest tests/run-in-machine.nix {};
+ tests.simple = callTest tests/simple.nix {};
+ tests.tomcat = callTest tests/tomcat.nix {};
+ tests.udisks2 = callTest tests/udisks2.nix {};
+ tests.xfce = callTest tests/xfce.nix {};
+
}
diff --git a/nixos/tests/avahi.nix b/nixos/tests/avahi.nix
index d95361dcd83..3898ddb4e8e 100644
--- a/nixos/tests/avahi.nix
+++ b/nixos/tests/avahi.nix
@@ -1,8 +1,8 @@
-{ pkgs, ... }:
+# Test whether `avahi-daemon' and `libnss-mdns' work as expected.
-with pkgs;
+import ./make-test.nix {
+ name = "avahi";
-{
nodes = {
one =
{ config, pkgs, ... }: {
@@ -17,18 +17,18 @@ with pkgs;
};
};
- # Test whether `avahi-daemon' and `libnss-mdns' work as expected.
testScript =
'' startAll;
# mDNS.
$one->waitForUnit("network.target");
+ $two->waitForUnit("network.target");
+
$one->succeed("avahi-resolve-host-name one.local | tee out >&2");
$one->succeed("test \"`cut -f1 < out`\" = one.local");
$one->succeed("avahi-resolve-host-name two.local | tee out >&2");
$one->succeed("test \"`cut -f1 < out`\" = two.local");
- $two->waitForUnit("network.target");
$two->succeed("avahi-resolve-host-name one.local | tee out >&2");
$two->succeed("test \"`cut -f1 < out`\" = one.local");
$two->succeed("avahi-resolve-host-name two.local | tee out >&2");
diff --git a/nixos/tests/bittorrent.nix b/nixos/tests/bittorrent.nix
index 6e67edb0b82..002e012f65f 100644
--- a/nixos/tests/bittorrent.nix
+++ b/nixos/tests/bittorrent.nix
@@ -6,7 +6,7 @@
# which only works if the first client successfully uses the UPnP-IGD
# protocol to poke a hole in the NAT.
-{ pkgs, ... }:
+import ./make-test.nix ({ pkgs, ... }:
let
@@ -23,6 +23,7 @@ let
in
{
+ name = "bittorrent";
nodes =
{ tracker =
@@ -33,6 +34,8 @@ in
services.httpd.enable = true;
services.httpd.adminAddr = "foo@example.org";
services.httpd.documentRoot = "/tmp";
+
+ networking.firewall.enable = false; # FIXME: figure out what ports we actually need
};
router =
@@ -40,8 +43,9 @@ in
{ environment.systemPackages = [ pkgs.miniupnpd ];
virtualisation.vlans = [ 1 2 ];
networking.nat.enable = true;
- networking.nat.internalIPs = [ "192.168.2.0/24" ];
+ networking.nat.internalInterfaces = [ "eth2" ];
networking.nat.externalInterface = "eth1";
+ networking.firewall.enable = false;
};
client1 =
@@ -50,11 +54,13 @@ in
virtualisation.vlans = [ 2 ];
networking.defaultGateway =
nodes.router.config.networking.interfaces.eth2.ipAddress;
+ networking.firewall.enable = false;
};
client2 =
{ config, pkgs, ... }:
{ environment.systemPackages = [ pkgs.transmission ];
+ networking.firewall.enable = false;
};
};
@@ -66,8 +72,8 @@ in
# Enable NAT on the router and start miniupnpd.
$router->waitForUnit("nat");
$router->succeed(
- "iptables -t nat -N MINIUPNPD",
- "iptables -t nat -A PREROUTING -i eth1 -j MINIUPNPD",
+ "iptables -w -t nat -N MINIUPNPD",
+ "iptables -w -t nat -A PREROUTING -i eth1 -j MINIUPNPD",
"echo 1 > /proc/sys/net/ipv4/ip_forward",
"miniupnpd -f ${miniupnpdConf nodes}"
);
@@ -75,7 +81,7 @@ in
# Create the torrent.
$tracker->succeed("mkdir /tmp/data");
$tracker->succeed("cp ${file} /tmp/data/test.tar.bz2");
- $tracker->succeed("transmission-create /tmp/data/test.tar.bz2 -t http://tracker:6969/announce -o /tmp/test.torrent");
+ $tracker->succeed("transmission-create /tmp/data/test.tar.bz2 -t http://${nodes.tracker.config.networking.interfaces.eth1.ipAddress}:6969/announce -o /tmp/test.torrent");
$tracker->succeed("chmod 644 /tmp/test.torrent");
# Start the tracker. !!! use a less crappy tracker
@@ -104,4 +110,4 @@ in
$client2->succeed("cmp /tmp/test.tar.bz2 ${file}");
'';
-}
+})
diff --git a/nixos/tests/check-filesystems.nix b/nixos/tests/check-filesystems.nix
index 09401f9a3f4..71aa9649840 100644
--- a/nixos/tests/check-filesystems.nix
+++ b/nixos/tests/check-filesystems.nix
@@ -6,6 +6,8 @@
with import ../lib/build-vms.nix { inherit nixos nixpkgs system; };
rec {
+ name = "check-filesystems";
+
nodes = {
share = {pkgs, config, ...}: {
services.nfs.server.enable = true;
diff --git a/nixos/tests/common/user-account.nix b/nixos/tests/common/user-account.nix
index 8157cf8d263..aa3a0b82bcd 100644
--- a/nixos/tests/common/user-account.nix
+++ b/nixos/tests/common/user-account.nix
@@ -1,11 +1,10 @@
{ pkgs, ... }:
{ users.extraUsers = pkgs.lib.singleton
- { name = "alice";
+ { isNormalUser = true;
+ name = "alice";
description = "Alice Foobar";
- home = "/home/alice";
- createHome = true;
- useDefaultShell = true;
password = "foobar";
+ uid = 1000;
};
}
diff --git a/nixos/tests/containers.nix b/nixos/tests/containers.nix
new file mode 100644
index 00000000000..a582e23fda0
--- /dev/null
+++ b/nixos/tests/containers.nix
@@ -0,0 +1,80 @@
+# Test for NixOS' container support.
+
+import ./make-test.nix {
+ name = "containers";
+
+ machine =
+ { config, pkgs, ... }:
+ { imports = [ ../modules/installer/cd-dvd/channel.nix ];
+ virtualisation.writableStore = true;
+ virtualisation.memorySize = 768;
+
+ containers.webserver =
+ { privateNetwork = true;
+ hostAddress = "10.231.136.1";
+ localAddress = "10.231.136.2";
+ config =
+ { services.httpd.enable = true;
+ services.httpd.adminAddr = "foo@example.org";
+ networking.firewall.allowedTCPPorts = [ 80 ];
+ networking.firewall.allowPing = true;
+ };
+ };
+
+ virtualisation.pathsInNixDB = [ pkgs.stdenv ];
+ };
+
+ testScript =
+ ''
+ $machine->succeed("nixos-container list") =~ /webserver/ or die;
+
+ # Start the webserver container.
+ $machine->succeed("nixos-container start webserver");
+
+ # Since "start" returns after the container has reached
+ # multi-user.target, we should now be able to access it.
+ my $ip = $machine->succeed("nixos-container show-ip webserver");
+ chomp $ip;
+ #$machine->succeed("ping -c1 $ip"); # FIXME
+ $machine->succeed("curl --fail http://$ip/ > /dev/null");
+
+ # Stop the container.
+ $machine->succeed("nixos-container stop webserver");
+ $machine->fail("curl --fail --connect-timeout 2 http://$ip/ > /dev/null");
+
+ # Make sure we have a NixOS tree (required by ‘nixos-container create’).
+ $machine->succeed("nix-env -qa -A nixos.pkgs.hello >&2");
+
+ # Create some containers imperatively.
+ my $id1 = $machine->succeed("nixos-container create foo --ensure-unique-name");
+ chomp $id1;
+ $machine->log("created container $id1");
+
+ my $id2 = $machine->succeed("nixos-container create foo --ensure-unique-name");
+ chomp $id2;
+ $machine->log("created container $id2");
+
+ die if $id1 eq $id2;
+
+ my $ip1 = $machine->succeed("nixos-container show-ip $id1");
+ chomp $ip1;
+ my $ip2 = $machine->succeed("nixos-container show-ip $id2");
+ chomp $ip2;
+ die if $ip1 eq $ip2;
+
+ # Start one of them.
+ $machine->succeed("nixos-container start $id1");
+
+ # Execute commands via the root shell.
+ $machine->succeed("nixos-container run $id1 -- uname") =~ /Linux/ or die;
+ $machine->succeed("nixos-container set-root-password $id1 foobar");
+
+ # Destroy the containers.
+ $machine->succeed("nixos-container destroy $id1");
+ $machine->succeed("nixos-container destroy $id2");
+
+ # Destroying a declarative container should fail.
+ $machine->fail("nixos-container destroy webserver");
+ '';
+
+}
diff --git a/nixos/tests/default.nix b/nixos/tests/default.nix
deleted file mode 100644
index ce5776c8e46..00000000000
--- a/nixos/tests/default.nix
+++ /dev/null
@@ -1,39 +0,0 @@
-{ nixpkgs ?
-, system ? builtins.currentSystem
-, minimal ? false
-}:
-
-with import ../lib/testing.nix { inherit system minimal; };
-
-{
- avahi = makeTest (import ./avahi.nix);
- bittorrent = makeTest (import ./bittorrent.nix);
- firefox = makeTest (import ./firefox.nix);
- firewall = makeTest (import ./firewall.nix);
- installer = makeTests (import ./installer.nix);
- efi-installer = makeTests (import ./efi-installer.nix);
- ipv6 = makeTest (import ./ipv6.nix);
- kde4 = makeTest (import ./kde4.nix);
- #kexec = makeTest (import ./kexec.nix);
- login = makeTest (import ./login.nix {});
- latestKernel.login = makeTest (import ./login.nix ({ config, pkgs, ... }: { boot.kernelPackages = pkgs.linuxPackages_latest; }));
- misc = makeTest (import ./misc.nix);
- #mpich = makeTest (import ./mpich.nix);
- mysql = makeTest (import ./mysql.nix);
- mysql_replication = makeTest (import ./mysql-replication.nix);
- munin = makeTest (import ./munin.nix);
- nat = makeTest (import ./nat.nix);
- nfs3 = makeTest (import ./nfs.nix { version = 3; });
- #nfs4 = makeTest (import ./nfs.nix { version = 4; });
- openssh = makeTest (import ./openssh.nix);
- #partition = makeTest (import ./partition.nix);
- printing = makeTest (import ./printing.nix);
- proxy = makeTest (import ./proxy.nix);
- quake3 = makeTest (import ./quake3.nix);
- simple = makeTest (import ./simple.nix);
- #subversion = makeTest (import ./subversion.nix);
- tomcat = makeTest (import ./tomcat.nix);
- #trac = makeTest (import ./trac.nix);
- xfce = makeTest (import ./xfce.nix);
- runInMachine.test = import ./run-in-machine.nix { inherit system; };
-}
diff --git a/nixos/tests/efi-installer.nix b/nixos/tests/efi-installer.nix
deleted file mode 100644
index 8a05dbf2a61..00000000000
--- a/nixos/tests/efi-installer.nix
+++ /dev/null
@@ -1,127 +0,0 @@
-# !!! Merge into normal install tests once all livecds are EFIable
-{ pkgs, system, ... }:
-
-with pkgs.lib;
-with import ../lib/qemu-flags.nix;
-
-let
-
- # Build the ISO. This is the regular installation CD but with test
- # instrumentation.
- iso =
- (import ../lib/eval-config.nix {
- inherit system;
- modules =
- [ ../modules/installer/cd-dvd/installation-cd-efi.nix
- ../modules/testing/test-instrumentation.nix
- { key = "serial";
-
- # The test cannot access the network, so any sources we
- # need must be included in the ISO.
- isoImage.storeContents =
- [ pkgs.glibcLocales
- pkgs.sudo
- pkgs.docbook5
- pkgs.docbook5_xsl
- pkgs.grub
- pkgs.perlPackages.XMLLibXML
- pkgs.unionfs-fuse
- pkgs.gummiboot
- pkgs.libxslt
- ];
- }
- ];
- }).config.system.build.isoImage;
-
-
- # The config to install
- config = builtins.toFile "configuration.nix" ''
- { pkgs, ... }: {
- imports = [ ./hardware-configuration.nix ];
- boot.kernelPackages = pkgs.linuxPackages_3_10;
- boot.loader.grub.enable = false;
- boot.loader.efi.canTouchEfiVariables = true;
- boot.loader.gummiboot.enable = true;
- fonts.enableFontConfig = false;
- }
- '';
-
- biosDir = pkgs.runCommand "ovmf-bios" {} ''
- mkdir $out
- ln -s ${pkgs.OVMF}/FV/OVMF.fd $out/bios.bin
- '';
-
-in {
- simple = {
- inherit iso;
- nodes = {};
- testScript = ''
- createDisk("harddisk", 4 * 1024);
-
- my $machine = createMachine({ hda => "harddisk",
- hdaInterface => "scsi",
- cdrom => glob("${iso}/iso/*.iso"),
- qemuFlags => '-L ${biosDir} ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"}'});
- $machine->start;
-
- # Make sure that we get a login prompt etc.
- $machine->succeed("echo hello");
- $machine->waitForUnit("rogue");
- $machine->waitForUnit("nixos-manual");
-
- # Partition the disk.
- $machine->succeed(
- "sgdisk -Z /dev/sda",
- "sgdisk -n 1:0:+256M -N 2 -t 1:ef00 -t 2:8300 -c 1:boot -c 2:root /dev/sda",
- "mkfs.vfat -n BOOT /dev/sda1",
- "mkfs.ext3 -L nixos /dev/sda2",
- "mount LABEL=nixos /mnt",
- "mkdir /mnt/boot",
- "mount LABEL=BOOT /mnt/boot",
- );
-
- # Create the NixOS configuration.
- $machine->succeed(
- "nixos-generate-config --root /mnt",
- );
-
- $machine->succeed("cat /mnt/etc/nixos/hardware-configuration.nix >&2");
-
- $machine->copyFileFromHost(
- "${config}",
- "/mnt/etc/nixos/configuration.nix");
-
- # Perform the installation.
- $machine->succeed("nixos-install >&2");
-
- # Do it again to make sure it's idempotent.
- $machine->succeed("nixos-install >&2");
-
- $machine->shutdown;
-
- # Now see if we can boot the installation.
- my $machine = createMachine({ #hda => "harddisk",
-# hdaInterface => "virtio",
-# !!! OVMF doesn't boot from virtio http://www.mail-archive.com/edk2-devel@lists.sourceforge.net/msg01501.html
- qemuFlags => '-L ${biosDir} ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} -m 512 -hda ' . Cwd::abs_path('harddisk')});
-
- # Did /boot get mounted, if appropriate?
- $machine->waitForUnit("local-fs.target");
- $machine->succeed("test -e /boot/efi");
-
- $machine->succeed("nix-env -i coreutils >&2");
- $machine->succeed("type -tP ls | tee /dev/stderr") =~ /.nix-profile/
- or die "nix-env failed";
-
- $machine->succeed("nixos-rebuild switch >&2");
-
- $machine->shutdown;
-
- my $machine = createMachine({ #hda => "harddisk",
-# hdaInterface => "virtio",
- qemuFlags => '-L ${biosDir} ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} -hda ' . Cwd::abs_path('harddisk')});
- $machine->waitForUnit("network.target");
- $machine->shutdown;
- '';
- };
-}
diff --git a/nixos/tests/firefox.nix b/nixos/tests/firefox.nix
index d6599be13c9..77a6f6ac9e7 100644
--- a/nixos/tests/firefox.nix
+++ b/nixos/tests/firefox.nix
@@ -1,6 +1,5 @@
-{ pkgs, ... }:
-
-{
+import ./make-test.nix ({ pkgs, ... }: {
+ name = "firefox";
machine =
{ config, pkgs, ... }:
@@ -18,4 +17,4 @@
$machine->screenshot("screen");
'';
-}
+})
diff --git a/nixos/tests/firewall.nix b/nixos/tests/firewall.nix
index de32b98e5d2..16922508c7c 100644
--- a/nixos/tests/firewall.nix
+++ b/nixos/tests/firewall.nix
@@ -1,8 +1,7 @@
# Test the firewall module.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
+ name = "firewall";
nodes =
{ walled =
@@ -17,6 +16,7 @@
{ config, pkgs, ... }:
{ services.httpd.enable = true;
services.httpd.adminAddr = "foo@example.org";
+ networking.firewall.enable = false;
};
};
@@ -33,7 +33,7 @@
$walled->succeed("curl -v http://localhost/ >&2");
# Connections to the firewalled machine should fail.
- $attacker->fail("curl -v http://walled/ >&2");
+ $attacker->fail("curl --fail --connect-timeout 2 http://walled/ >&2");
$attacker->fail("ping -c 1 walled >&2");
# Outgoing connections/pings should still work.
diff --git a/nixos/tests/gnome3.nix b/nixos/tests/gnome3.nix
new file mode 100644
index 00000000000..44668f57fc1
--- /dev/null
+++ b/nixos/tests/gnome3.nix
@@ -0,0 +1,30 @@
+import ./make-test.nix {
+ name = "gnome3";
+
+ machine =
+ { config, pkgs, ... }:
+
+ { imports = [ ./common/user-account.nix ];
+
+ services.xserver.enable = true;
+
+ services.xserver.displayManager.auto.enable = true;
+ services.xserver.displayManager.auto.user = "alice";
+ services.xserver.desktopManager.gnome3.enable = true;
+ };
+
+ testScript =
+ ''
+ $machine->waitForX;
+ $machine->sleep(15);
+
+ # Check that logging in has given the user ownership of devices.
+ $machine->succeed("getfacl /dev/snd/timer | grep -q alice");
+
+ $machine->succeed("su - alice -c 'DISPLAY=:0.0 gnome-terminal &'");
+ $machine->waitForWindow(qr/Terminal/);
+ $machine->sleep(10);
+ $machine->screenshot("screen");
+ '';
+
+}
diff --git a/nixos/tests/gnome3_12.nix b/nixos/tests/gnome3_12.nix
new file mode 100644
index 00000000000..439674b69d5
--- /dev/null
+++ b/nixos/tests/gnome3_12.nix
@@ -0,0 +1,31 @@
+import ./make-test.nix {
+ name = "gnome3_12";
+
+ machine =
+ { config, pkgs, ... }:
+
+ { imports = [ ./common/user-account.nix ];
+
+ services.xserver.enable = true;
+
+ services.xserver.displayManager.auto.enable = true;
+ services.xserver.displayManager.auto.user = "alice";
+ services.xserver.desktopManager.gnome3.enable = true;
+ environment.gnome3.packageSet = pkgs.gnome3_12;
+ };
+
+ testScript =
+ ''
+ $machine->waitForX;
+ $machine->sleep(15);
+
+ # Check that logging in has given the user ownership of devices.
+ $machine->succeed("getfacl /dev/snd/timer | grep -q alice");
+
+ $machine->succeed("su - alice -c 'DISPLAY=:0.0 gnome-terminal &'");
+ $machine->waitForWindow(qr/Terminal/);
+ $machine->sleep(10);
+ $machine->screenshot("screen");
+ '';
+
+}
diff --git a/nixos/tests/influxdb.nix b/nixos/tests/influxdb.nix
new file mode 100644
index 00000000000..9f8ea061b96
--- /dev/null
+++ b/nixos/tests/influxdb.nix
@@ -0,0 +1,36 @@
+# This test runs influxdb and checks if influxdb is up and running
+
+import ./make-test.nix {
+ name = "influxdb";
+
+ nodes = {
+ one = { config, pkgs, ... }: {
+ services.influxdb.enable = true;
+ };
+ };
+
+ testScript = ''
+ startAll;
+
+ $one->waitForUnit("influxdb.service");
+
+ # Check if admin interface is avalible
+ $one->waitUntilSucceeds("curl -f 127.0.0.1:8083");
+
+ # create database
+ $one->succeed(q~
+ curl -X POST 'http://localhost:8086/db?u=root&p=root' \
+ -d '{"name": "test"}'
+ ~);
+
+ # write some points and run simple query
+ $one->succeed(q~
+ curl -X POST 'http://localhost:8086/db/test/series?u=root&p=root' \
+ -d '[{"name":"foo","columns":["val"],"points":[[6666]]}]'
+ ~);
+ $one->succeed(q~
+ curl -G 'http://localhost:8086/db/test/series?u=root&p=root' \
+ --data-urlencode 'q=select * from foo limit 1' | grep 6666
+ ~);
+ '';
+}
diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix
index 865b21d2444..d3bbe7a8bd5 100644
--- a/nixos/tests/installer.nix
+++ b/nixos/tests/installer.nix
@@ -1,7 +1,8 @@
-{ pkgs, system, ... }:
+{ system ? builtins.currentSystem }:
-with pkgs.lib;
+with import ../lib/testing.nix { inherit system; };
with import ../lib/qemu-flags.nix;
+with pkgs.lib;
let
@@ -26,6 +27,7 @@ let
pkgs.grub
pkgs.perlPackages.XMLLibXML
pkgs.unionfs-fuse
+ pkgs.gummiboot
];
}
];
@@ -33,37 +35,31 @@ let
# The configuration to install.
- config = { fileSystems, testChannel, grubVersion, grubDevice }: pkgs.writeText "configuration.nix"
+ makeConfig = { testChannel, useEFI, grubVersion, grubDevice }: pkgs.writeText "configuration.nix"
''
{ config, pkgs, modulesPath, ... }:
{ imports =
[ ./hardware-configuration.nix
- "''${modulesPath}/testing/test-instrumentation.nix"
+
];
- boot.loader.grub.version = ${toString grubVersion};
- ${optionalString (grubVersion == 1) ''
- boot.loader.grub.splashImage = null;
+ ${if useEFI then ''
+ boot.loader.efi.canTouchEfiVariables = true;
+ boot.loader.gummiboot.enable = true;
+ '' else ''
+ boot.loader.grub.version = ${toString grubVersion};
+ ${optionalString (grubVersion == 1) ''
+ boot.loader.grub.splashImage = null;
+ ''}
+ boot.loader.grub.device = "${grubDevice}";
+ boot.loader.grub.extraConfig = "serial; terminal_output.serial";
''}
- boot.loader.grub.device = "${grubDevice}";
- boot.loader.grub.extraConfig = "serial; terminal_output.serial";
- boot.initrd.kernelModules = [ "virtio_console" ];
environment.systemPackages = [ ${optionalString testChannel "pkgs.rlwrap"} ];
}
'';
- rootFS =
- ''
- fileSystems."/".device = "/dev/disk/by-label/nixos";
- '';
-
- bootFS =
- ''
- fileSystems."/boot".device = "/dev/disk/by-label/boot";
- '';
-
# Configuration of a web server that simulates the Nixpkgs channel
# distribution server.
@@ -80,25 +76,40 @@ let
virtualisation.writableStore = true;
virtualisation.pathsInNixDB = channelContents ++ [ pkgs.hello.src ];
virtualisation.memorySize = 768;
+
+ networking.firewall.allowedTCPPorts = [ 80 ];
};
channelContents = [ pkgs.rlwrap ];
+ efiBios = pkgs.runCommand "ovmf-bios" {} ''
+ mkdir $out
+ ln -s ${pkgs.OVMF}/FV/OVMF.fd $out/bios.bin
+ '';
+
+
# The test script boots the CD, installs NixOS on an empty hard
# disk, and then reboot from the hard disk. It's parameterized with
# a test script fragment `createPartitions', which must create
- # partitions and filesystems, and a configuration.nix fragment
- # `fileSystems'.
- testScriptFun = { createPartitions, fileSystems, testChannel, grubVersion, grubDevice }:
- let iface = if grubVersion == 1 then "scsi" else "virtio"; in
+ # partitions and filesystems.
+ testScriptFun = { createPartitions, testChannel, useEFI, grubVersion, grubDevice }:
+ let
+ # FIXME: OVMF doesn't boot from virtio http://www.mail-archive.com/edk2-devel@lists.sourceforge.net/msg01501.html
+ iface = if useEFI || grubVersion == 1 then "scsi" else "virtio";
+ qemuFlags =
+ (if iso.system == "x86_64-linux" then "-m 512 " else "-m 384 ") +
+ (optionalString (iso.system == "x86_64-linux") "-cpu kvm64 ") +
+ (optionalString useEFI ''-L ${efiBios} -hda ''${\(Cwd::abs_path('harddisk'))} '');
+ hdFlags = optionalString (!useEFI)
+ ''hda => "harddisk", hdaInterface => "${iface}", '';
+ in
''
createDisk("harddisk", 4 * 1024);
- my $machine = createMachine({ hda => "harddisk",
- hdaInterface => "${iface}",
+ my $machine = createMachine({ ${hdFlags}
cdrom => glob("${iso}/iso/*.iso"),
- qemuFlags => '${optionalString testChannel (toString (qemuNICFlags 1 1 2))} ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"}'});
+ qemuFlags => "${qemuFlags} " . '${optionalString testChannel (toString (qemuNICFlags 1 1 2))}' });
$machine->start;
${optionalString testChannel ''
@@ -118,9 +129,10 @@ let
#$machine->waitForUnit('getty@tty2');
$machine->waitForUnit("rogue");
$machine->waitForUnit("nixos-manual");
- $machine->waitForUnit("dhcpcd");
${optionalString testChannel ''
+ $machine->waitForUnit("dhcpcd");
+
# Allow the machine to talk to the fake nixos.org.
$machine->succeed(
"rm /etc/hosts",
@@ -135,6 +147,9 @@ let
or die "bad `hello' output";
''}
+ # Wait for hard disks to appear in /dev
+ $machine->succeed("udevadm settle");
+
# Partition the disk.
${createPartitions}
@@ -146,54 +161,68 @@ let
$machine->succeed("cat /mnt/etc/nixos/hardware-configuration.nix >&2");
$machine->copyFileFromHost(
- "${ config { inherit fileSystems testChannel grubVersion grubDevice; } }",
+ "${ makeConfig { inherit testChannel useEFI grubVersion grubDevice; } }",
"/mnt/etc/nixos/configuration.nix");
# Perform the installation.
- $machine->succeed("nixos-install >&2");
+ $machine->succeed("nixos-install < /dev/null >&2");
# Do it again to make sure it's idempotent.
- $machine->succeed("nixos-install >&2");
+ $machine->succeed("nixos-install < /dev/null >&2");
+
+ $machine->succeed("umount /mnt/boot || true");
+ $machine->succeed("umount /mnt");
+ $machine->succeed("sync");
$machine->shutdown;
# Now see if we can boot the installation.
- my $machine = createMachine({ hda => "harddisk", hdaInterface => "${iface}" });
+ $machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
- # Did /boot get mounted, if appropriate?
+ # Did /boot get mounted?
$machine->waitForUnit("local-fs.target");
- $machine->succeed("test -e /boot/grub");
+
+ ${if useEFI then ''
+ $machine->succeed("test -e /boot/efi");
+ '' else ''
+ $machine->succeed("test -e /boot/grub");
+ ''}
# Did the swap device get activated?
$machine->waitForUnit("swap.target");
$machine->succeed("cat /proc/swaps | grep -q /dev");
+ # Check whether the channel works.
$machine->succeed("nix-env -i coreutils >&2");
$machine->succeed("type -tP ls | tee /dev/stderr") =~ /.nix-profile/
or die "nix-env failed";
+ # Check whether nixos-rebuild works.
$machine->succeed("nixos-rebuild switch >&2");
# Test nixos-option.
$machine->succeed("nixos-option boot.initrd.kernelModules | grep virtio_console");
$machine->succeed("nixos-option -d boot.initrd.kernelModules | grep 'List of modules'");
- $machine->succeed("nixos-option -l boot.initrd.kernelModules | grep /etc/nixos/configuration.nix");
+ $machine->succeed("nixos-option -l boot.initrd.kernelModules | grep qemu-guest.nix");
$machine->shutdown;
# And just to be sure, check that the machine still boots after
# "nixos-rebuild switch".
- my $machine = createMachine({ hda => "harddisk", hdaInterface => "${iface}" });
+ $machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
$machine->waitForUnit("network.target");
$machine->shutdown;
'';
- makeTest = { createPartitions, fileSystems, testChannel ? false, grubVersion ? 2, grubDevice ? "/dev/vda" }:
- { inherit iso;
+ makeInstallerTest = name:
+ { createPartitions, testChannel ? false, useEFI ? false, grubVersion ? 2, grubDevice ? "/dev/vda" }:
+ makeTest {
+ inherit iso;
+ name = "installer-" + name;
nodes = if testChannel then { inherit webserver; } else { };
testScript = testScriptFun {
- inherit createPartitions fileSystems testChannel grubVersion grubDevice;
+ inherit createPartitions testChannel useEFI grubVersion grubDevice;
};
};
@@ -205,7 +234,7 @@ in {
# The (almost) simplest partitioning scheme: a swap partition and
# one big filesystem partition.
- simple = makeTest
+ simple = makeInstallerTest "simple"
{ createPartitions =
''
$machine->succeed(
@@ -219,12 +248,11 @@ in {
"mount LABEL=nixos /mnt",
);
'';
- fileSystems = rootFS;
testChannel = true;
};
# Same as the previous, but now with a separate /boot partition.
- separateBoot = makeTest
+ separateBoot = makeInstallerTest "separateBoot"
{ createPartitions =
''
$machine->succeed(
@@ -238,23 +266,22 @@ in {
"mkfs.ext3 -L nixos /dev/vda3",
"mount LABEL=nixos /mnt",
"mkfs.ext3 -L boot /dev/vda1",
- "mkdir /mnt/boot",
+ "mkdir -p /mnt/boot",
"mount LABEL=boot /mnt/boot",
);
'';
- fileSystems = rootFS + bootFS;
};
# Create two physical LVM partitions combined into one volume group
# that contains the logical swap and root partitions.
- lvm = makeTest
+ lvm = makeInstallerTest "lvm"
{ createPartitions =
''
$machine->succeed(
"parted /dev/vda mklabel msdos",
- "parted /dev/vda -- mkpart primary 1M 2048M", # first PV
+ "parted /dev/vda -- mkpart primary 1M 2048M", # PV1
"parted /dev/vda -- set 1 lvm on",
- "parted /dev/vda -- mkpart primary 2048M -1s", # second PV
+ "parted /dev/vda -- mkpart primary 2048M -1s", # PV2
"parted /dev/vda -- set 2 lvm on",
"udevadm settle",
"pvcreate /dev/vda1 /dev/vda2",
@@ -267,11 +294,9 @@ in {
"mount LABEL=nixos /mnt",
);
'';
- fileSystems = rootFS;
};
- /*
- swraid = makeTest
+ swraid = makeInstallerTest "swraid"
{ createPartitions =
''
$machine->succeed(
@@ -301,12 +326,10 @@ in {
"mdadm -W /dev/md1",
);
'';
- fileSystems = rootFS + bootFS;
};
- */
# Test a basic install using GRUB 1.
- grub1 = makeTest
+ grub1 = makeInstallerTest "grub1"
{ createPartitions =
''
$machine->succeed(
@@ -319,15 +342,35 @@ in {
"mkfs.ext3 -L nixos /dev/sda2",
"mount LABEL=nixos /mnt",
);
+
'';
- fileSystems = rootFS;
grubVersion = 1;
grubDevice = "/dev/sda";
};
+ # Test an EFI install.
+ efi = makeInstallerTest "efi"
+ { createPartitions =
+ ''
+ $machine->succeed(
+ "sgdisk -Z /dev/sda",
+ "sgdisk -n 1:0:+256M -n 2:0:+1024M -N 3 -t 1:ef00 -t 2:8200 -t 3:8300 -c 1:boot -c 2:swap -c 3:root /dev/sda",
+ "mkfs.vfat -n BOOT /dev/sda1",
+ "mkswap /dev/sda2 -L swap",
+ "swapon -L swap",
+ "mkfs.ext3 -L nixos /dev/sda3",
+ "mount LABEL=nixos /mnt",
+ "mkdir /mnt/boot",
+ "mount LABEL=BOOT /mnt/boot",
+ );
+ '';
+ useEFI = true;
+ };
+
# Rebuild the CD configuration with a little modification.
- rebuildCD =
+ rebuildCD = makeTest
{ inherit iso;
+ name = "rebuild-cd";
nodes = { };
testScript =
''
diff --git a/nixos/tests/ipv6.nix b/nixos/tests/ipv6.nix
index 29d675e180a..017511ea45c 100644
--- a/nixos/tests/ipv6.nix
+++ b/nixos/tests/ipv6.nix
@@ -1,9 +1,8 @@
# Test of IPv6 functionality in NixOS, including whether router
# solicication/advertisement using radvd works.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
+ name = "ipv6";
nodes =
{ client = { config, pkgs, ... }: { };
@@ -12,6 +11,7 @@
{ config, pkgs, ... }:
{ services.httpd.enable = true;
services.httpd.adminAddr = "foo@example.org";
+ networking.firewall.allowedTCPPorts = [ 80 ];
};
router =
@@ -37,6 +37,7 @@
$client->waitForUnit("network.target");
$server->waitForUnit("network.target");
+ $server->waitForUnit("httpd.service");
# Wait until the given interface has a non-tentative address of
# the desired scope (i.e. has completed Duplicate Address
diff --git a/nixos/tests/jenkins.nix b/nixos/tests/jenkins.nix
new file mode 100644
index 00000000000..28027c294bc
--- /dev/null
+++ b/nixos/tests/jenkins.nix
@@ -0,0 +1,42 @@
+# verifies:
+# 1. jenkins service starts on master node
+# 2. jenkins user can be extended on both master and slave
+# 3. jenkins service not started on slave node
+
+import ./make-test.nix {
+ name = "jenkins";
+
+ nodes = {
+
+ master =
+ { config, pkgs, ... }:
+ { services.jenkins.enable = true;
+
+ # should have no effect
+ services.jenkinsSlave.enable = true;
+
+ users.extraUsers.jenkins.extraGroups = [ "users" ];
+ };
+
+ slave =
+ { config, pkgs, ... }:
+ { services.jenkinsSlave.enable = true;
+
+ users.extraUsers.jenkins.extraGroups = [ "users" ];
+ };
+
+ };
+
+ testScript = ''
+ startAll;
+
+ $master->waitForUnit("jenkins");
+ print $master->execute("sudo -u jenkins groups");
+ $master->mustSucceed("sudo -u jenkins groups | grep jenkins | grep users");
+
+ print $slave->execute("sudo -u jenkins groups");
+ $slave->mustSucceed("sudo -u jenkins groups | grep jenkins | grep users");
+
+ $slave->mustFail("systemctl is-enabled jenkins.service");
+ '';
+}
diff --git a/nixos/tests/kde4.nix b/nixos/tests/kde4.nix
index 3fb35bbab09..90c37397821 100644
--- a/nixos/tests/kde4.nix
+++ b/nixos/tests/kde4.nix
@@ -1,13 +1,12 @@
-{ pkgs, ... }:
-
-{
+import ./make-test.nix ({ pkgs, ... }: {
+ name = "kde4";
machine =
{ config, pkgs, ... }:
{ imports = [ ./common/user-account.nix ];
- virtualisation.memorySize = 768;
+ virtualisation.memorySize = 1024;
services.xserver.enable = true;
@@ -64,4 +63,4 @@
$machine->screenshot("screen");
'';
-}
+})
diff --git a/nixos/tests/kexec.nix b/nixos/tests/kexec.nix
index b8da332b919..0f0565a60e9 100644
--- a/nixos/tests/kexec.nix
+++ b/nixos/tests/kexec.nix
@@ -1,8 +1,7 @@
# Test whether fast reboots via kexec work.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
+ name = "kexec";
machine = { config, pkgs, ... }:
{ virtualisation.vlans = [ ]; };
diff --git a/nixos/tests/login.nix b/nixos/tests/login.nix
index ed7d9786717..e8373219ca6 100644
--- a/nixos/tests/login.nix
+++ b/nixos/tests/login.nix
@@ -1,12 +1,17 @@
-config: { pkgs, ... }:
+import ./make-test.nix ({ pkgs, latestKernel ? false, ... }:
{
+ name = "login";
- machine = config;
+ machine =
+ { config, pkgs, lib, ... }:
+ { boot.kernelPackages = lib.mkIf latestKernel pkgs.linuxPackages_latest;
+ };
testScript =
''
- $machine->waitForUnit("default.target");
+ $machine->waitForUnit('multi-user.target');
+ $machine->waitUntilSucceeds("pgrep -f 'agetty.*tty1'");
$machine->screenshot("postboot");
subtest "create user", sub {
@@ -16,9 +21,11 @@ config: { pkgs, ... }:
# Check whether switching VTs works.
subtest "virtual console switching", sub {
+ $machine->fail("pgrep -f 'agetty.*tty2'");
$machine->sendKeys("alt-f2");
$machine->waitUntilSucceeds("[ \$(fgconsole) = 2 ]");
$machine->waitForUnit('getty@tty2.service');
+ $machine->waitUntilSucceeds("pgrep -f 'agetty.*tty2'");
};
# Log in as alice on a virtual console.
@@ -58,4 +65,4 @@ config: { pkgs, ... }:
};
'';
-}
+})
diff --git a/nixos/tests/logstash.nix b/nixos/tests/logstash.nix
new file mode 100644
index 00000000000..7284cde7a33
--- /dev/null
+++ b/nixos/tests/logstash.nix
@@ -0,0 +1,40 @@
+# This test runs logstash and checks if messages flows and
+# elasticsearch is started.
+
+import ./make-test.nix {
+ name = "logstash";
+
+ nodes = {
+ one =
+ { config, pkgs, ... }:
+ {
+ services = {
+ logstash = {
+ enable = true;
+ inputConfig = ''
+ exec { command => "echo flowers" interval => 1 type => "test" }
+ exec { command => "echo dragons" interval => 1 type => "test" }
+ '';
+ filterConfig = ''
+ if [type] == "test" {
+ grep { match => ["message", "flowers"] drop => true }
+ }
+ '';
+ outputConfig = ''
+ stdout { codec => rubydebug }
+ elasticsearch { embedded => true }
+ '';
+ };
+ };
+ };
+ };
+
+ testScript = ''
+ startAll;
+
+ $one->waitForUnit("logstash.service");
+ $one->waitUntilSucceeds("journalctl -n 20 _SYSTEMD_UNIT=logstash.service | grep flowers");
+ $one->fail("journalctl -n 20 _SYSTEMD_UNIT=logstash.service | grep dragons");
+ $one->waitUntilSucceeds("curl -s http://127.0.0.1:9200/_status?pretty=true | grep logstash");
+ '';
+}
diff --git a/nixos/tests/make-test.nix b/nixos/tests/make-test.nix
new file mode 100644
index 00000000000..285ca5b71d6
--- /dev/null
+++ b/nixos/tests/make-test.nix
@@ -0,0 +1,5 @@
+f: { system ? builtins.currentSystem, ... } @ args:
+
+with import ../lib/testing.nix { inherit system; };
+
+makeTest (if builtins.isFunction f then f (args // { inherit pkgs; }) else f)
diff --git a/nixos/tests/misc.nix b/nixos/tests/misc.nix
index 12ac6f6f9a6..e1830d95b41 100644
--- a/nixos/tests/misc.nix
+++ b/nixos/tests/misc.nix
@@ -1,15 +1,25 @@
# Miscellaneous small tests that don't warrant their own VM run.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
+ name = "misc";
machine =
- { config, pkgs, ... }:
- { swapDevices = pkgs.lib.mkOverride 0
+ { config, lib, pkgs, ... }:
+ with lib;
+ { swapDevices = mkOverride 0
[ { device = "/root/swapfile"; size = 128; } ];
- environment.variables.EDITOR = pkgs.lib.mkOverride 0 "emacs";
- services.nixosManual.enable = pkgs.lib.mkOverride 0 true;
+ environment.variables.EDITOR = mkOverride 0 "emacs";
+ services.nixosManual.enable = mkOverride 0 true;
+ systemd.tmpfiles.rules = [ "d /tmp 1777 root root 10d" ];
+ fileSystems = mkVMOverride { "/tmp2" =
+ { fsType = "tmpfs";
+ options = "mode=1777,noauto";
+ };
+ };
+ systemd.automounts = singleton
+ { wantedBy = [ "multi-user.target" ];
+ where = "/tmp2";
+ };
};
testScript =
@@ -59,6 +69,39 @@
subtest "override-env-var", sub {
$machine->succeed('[ "$EDITOR" = emacs ]');
};
+
+ # Test whether hostname (and by extension nss_myhostname) works.
+ subtest "hostname", sub {
+ $machine->succeed('[ "`hostname`" = machine ]');
+ #$machine->succeed('[ "`hostname -s`" = machine ]');
+ };
+
+ # Test whether systemd-udevd automatically loads modules for our hardware.
+ subtest "udev-auto-load", sub {
+ $machine->waitForUnit('systemd-udev-settle.service');
+ $machine->succeed('lsmod | grep psmouse');
+ };
+
+ # Test whether systemd-tmpfiles-clean works.
+ subtest "tmpfiles", sub {
+ $machine->succeed('touch /tmp/foo');
+ $machine->succeed('systemctl start systemd-tmpfiles-clean');
+ $machine->succeed('[ -e /tmp/foo ]');
+ $machine->succeed('date -s "@$(($(date +%s) + 1000000))"'); # move into the future
+ $machine->succeed('systemctl start systemd-tmpfiles-clean');
+ $machine->fail('[ -e /tmp/foo ]');
+ };
+
+ # Test whether automounting works.
+ subtest "automount", sub {
+ $machine->fail("grep '/tmp2 tmpfs' /proc/mounts");
+ $machine->succeed("touch /tmp2/x");
+ $machine->succeed("grep '/tmp2 tmpfs' /proc/mounts");
+ };
+
+ subtest "shell-vars", sub {
+ $machine->succeed('[ -n "$NIX_PATH" ]');
+ };
'';
}
diff --git a/nixos/tests/mpich.nix b/nixos/tests/mpich.nix
index d57512ebdfe..a4ef7b62426 100644
--- a/nixos/tests/mpich.nix
+++ b/nixos/tests/mpich.nix
@@ -1,10 +1,8 @@
# Simple example to showcase distributed tests using NixOS VMs.
-{ pkgs, ... }:
+import ./make-test.nix {
+ name = "mpich";
-with pkgs;
-
-{
nodes = {
master =
{ config, pkgs, ... }: {
diff --git a/nixos/tests/mumble.nix b/nixos/tests/mumble.nix
new file mode 100644
index 00000000000..3759d73355d
--- /dev/null
+++ b/nixos/tests/mumble.nix
@@ -0,0 +1,59 @@
+import ./make-test.nix (
+
+let
+ client = { config, pkgs, ... }: {
+ imports = [ ./common/x11.nix ];
+ environment.systemPackages = [ pkgs.mumble ];
+ };
+in
+{
+ name = "mumble";
+
+ nodes = {
+ server = { config, pkgs, ... }: {
+ services.murmur.enable = true;
+ services.murmur.registerName = "NixOS tests";
+ networking.firewall.allowedTCPPorts = [ config.services.murmur.port ];
+ };
+
+ client1 = client;
+ client2 = client;
+ };
+
+ testScript = ''
+ startAll;
+
+ $server->waitForUnit("murmur.service");
+ $client1->waitForX;
+ $client2->waitForX;
+
+ $client1->execute("mumble mumble://client1\@server/test &");
+ $client2->execute("mumble mumble://client2\@server/test &");
+
+ # cancel client audio configuration
+ $client1->waitForWindow(qr/Audio Tuning Wizard/);
+ $client2->waitForWindow(qr/Audio Tuning Wizard/);
+ $client1->sendKeys("esc");
+ $client2->sendKeys("esc");
+
+ # cancel client cert configuration
+ $client1->waitForWindow(qr/Certificate Management/);
+ $client2->waitForWindow(qr/Certificate Management/);
+ $client1->sendKeys("esc");
+ $client2->sendKeys("esc");
+
+ # accept server certificate
+ $client1->waitForWindow(qr/^Mumble$/);
+ $client2->waitForWindow(qr/^Mumble$/);
+ $client1->sendChars("y");
+ $client2->sendChars("y");
+
+ # Find clients in logs
+ $server->waitUntilSucceeds("grep -q 'client1' /var/log/murmur/murmurd.log");
+ $server->waitUntilSucceeds("grep -q 'client2' /var/log/murmur/murmurd.log");
+
+ $server->sleep(5); # wait to get screenshot
+ $client1->screenshot("screen1");
+ $client2->screenshot("screen2");
+ '';
+})
diff --git a/nixos/tests/munin.nix b/nixos/tests/munin.nix
index 66ae1c0d87f..31676c10df1 100644
--- a/nixos/tests/munin.nix
+++ b/nixos/tests/munin.nix
@@ -1,13 +1,13 @@
-{ pkgs, ... }:
-
# This test runs basic munin setup with node and cron job running on the same
# machine.
-{
- nodes = {
+import ./make-test.nix {
+ name = "munin";
+
+ nodes = {
one =
{ config, pkgs, ... }:
- {
+ {
services = {
munin-node.enable = true;
munin-cron = {
@@ -20,10 +20,10 @@
};
};
};
-
+
testScript = ''
startAll;
-
+
$one->waitForUnit("munin-node.service");
$one->waitForFile("/var/lib/munin/one/one-uptime-uptime-g.rrd");
$one->waitForFile("/var/www/munin/one/index.html");
diff --git a/nixos/tests/mysql-replication.nix b/nixos/tests/mysql-replication.nix
index 28a1187dd18..5786fdbc58c 100644
--- a/nixos/tests/mysql-replication.nix
+++ b/nixos/tests/mysql-replication.nix
@@ -1,23 +1,28 @@
-{ pkgs, ... }:
+import ./make-test.nix (
let
replicateUser = "replicate";
replicatePassword = "secret";
in
+
{
+ name = "mysql-replication";
+
nodes = {
master =
{ pkgs, config, ... }:
{
services.mysql.enable = true;
- services.mysql.replication.role = "master";
- services.mysql.initialDatabases = [ { name = "testdb"; schema = ./testdb.sql; } ];
- services.mysql.initialScript = pkgs.writeText "initmysql"
- ''
- create user '${replicateUser}'@'%' identified by '${replicatePassword}';
- grant replication slave on *.* to '${replicateUser}'@'%';
- '';
+ services.mysql.package = pkgs.mysql;
+ services.mysql.replication.role = "master";
+ services.mysql.initialDatabases = [ { name = "testdb"; schema = ./testdb.sql; } ];
+ services.mysql.initialScript = pkgs.writeText "initmysql"
+ ''
+ create user '${replicateUser}'@'%' identified by '${replicatePassword}';
+ grant replication slave on *.* to '${replicateUser}'@'%';
+ '';
+ networking.firewall.allowedTCPPorts = [ 3306 ];
};
slave1 =
@@ -25,11 +30,12 @@ in
{
services.mysql.enable = true;
- services.mysql.replication.role = "slave";
- services.mysql.replication.serverId = 2;
- services.mysql.replication.masterHost = nodes.master.config.networking.hostName;
- services.mysql.replication.masterUser = replicateUser;
- services.mysql.replication.masterPassword = replicatePassword;
+ services.mysql.package = pkgs.mysql;
+ services.mysql.replication.role = "slave";
+ services.mysql.replication.serverId = 2;
+ services.mysql.replication.masterHost = nodes.master.config.networking.hostName;
+ services.mysql.replication.masterUser = replicateUser;
+ services.mysql.replication.masterPassword = replicatePassword;
};
slave2 =
@@ -37,11 +43,12 @@ in
{
services.mysql.enable = true;
- services.mysql.replication.role = "slave";
- services.mysql.replication.serverId = 3;
- services.mysql.replication.masterHost = nodes.master.config.networking.hostName;
- services.mysql.replication.masterUser = replicateUser;
- services.mysql.replication.masterPassword = replicatePassword;
+ services.mysql.package = pkgs.mysql;
+ services.mysql.replication.role = "slave";
+ services.mysql.replication.serverId = 3;
+ services.mysql.replication.masterHost = nodes.master.config.networking.hostName;
+ services.mysql.replication.masterUser = replicateUser;
+ services.mysql.replication.masterPassword = replicatePassword;
};
};
@@ -54,4 +61,4 @@ in
$slave2->sleep(100); # Hopefully this is long enough!!
$slave2->succeed("echo 'use testdb; select * from tests' | mysql -u root -N | grep 4");
'';
-}
+})
diff --git a/nixos/tests/mysql.nix b/nixos/tests/mysql.nix
index b48850738b7..0a753b9b625 100644
--- a/nixos/tests/mysql.nix
+++ b/nixos/tests/mysql.nix
@@ -1,14 +1,15 @@
-{ pkgs, ... }:
+import ./make-test.nix {
+ name = "mysql";
-{
nodes = {
master =
{ pkgs, config, ... }:
{
services.mysql.enable = true;
- services.mysql.replication.role = "master";
- services.mysql.initialDatabases = [ { name = "testdb"; schema = ./testdb.sql; } ];
+ services.mysql.replication.role = "master";
+ services.mysql.initialDatabases = [ { name = "testdb"; schema = ./testdb.sql; } ];
+ services.mysql.package = pkgs.mysql;
};
};
diff --git a/nixos/tests/nat.nix b/nixos/tests/nat.nix
index a13714d60a9..5fdcc0e97ca 100644
--- a/nixos/tests/nat.nix
+++ b/nixos/tests/nat.nix
@@ -4,14 +4,14 @@
# router connected to both that performs Network Address Translation
# for the client.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
+ name = "nat";
nodes =
{ client =
{ config, pkgs, nodes, ... }:
{ virtualisation.vlans = [ 1 ];
+ networking.firewall.allowPing = true;
networking.defaultGateway =
nodes.router.config.networking.interfaces.eth2.ipAddress;
};
@@ -19,6 +19,7 @@
router =
{ config, pkgs, ... }:
{ virtualisation.vlans = [ 2 1 ];
+ networking.firewall.allowPing = true;
networking.nat.enable = true;
networking.nat.internalIPs = [ "192.168.1.0/24" ];
networking.nat.externalInterface = "eth1";
@@ -27,6 +28,7 @@
server =
{ config, pkgs, ... }:
{ virtualisation.vlans = [ 2 ];
+ networking.firewall.enable = false;
services.httpd.enable = true;
services.httpd.adminAddr = "foo@example.org";
services.vsftpd.enable = true;
diff --git a/nixos/tests/nfs.nix b/nixos/tests/nfs.nix
index 51abf57e1b7..61b2431c04c 100644
--- a/nixos/tests/nfs.nix
+++ b/nixos/tests/nfs.nix
@@ -1,6 +1,4 @@
-{ version }:
-
-{ pkgs, ... }:
+import ./make-test.nix ({ version, ... }:
let
@@ -13,11 +11,13 @@ let
options = "vers=${toString version}";
}
];
+ networking.firewall.enable = false; # FIXME: only open statd
};
in
{
+ name = "nfs";
nodes =
{ client1 = client;
@@ -31,6 +31,7 @@ in
/data 192.168.1.0/255.255.255.0(rw,no_root_squash,no_subtree_check,fsid=0)
'';
services.nfs.server.createMountPoints = true;
+ networking.firewall.enable = false; # FIXME: figure out what ports need to be allowed
};
};
@@ -82,4 +83,4 @@ in
die "shutdown took too long ($duration seconds)" if $duration > 30;
'';
-}
+})
diff --git a/nixos/tests/openssh.nix b/nixos/tests/openssh.nix
index 49d92fbde90..692618c5a84 100644
--- a/nixos/tests/openssh.nix
+++ b/nixos/tests/openssh.nix
@@ -1,6 +1,23 @@
-{ pkgs, ... }:
+import ./make-test.nix ({ pkgs, ... }:
+
+let
+ snakeOilPrivateKey = pkgs.writeText "privkey.snakeoil" ''
+ -----BEGIN EC PRIVATE KEY-----
+ MHcCAQEEIHQf/khLvYrQ8IOika5yqtWvI0oquHlpRLTZiJy5dRJmoAoGCCqGSM49
+ AwEHoUQDQgAEKF0DYGbBwbj06tA3fd/+yP44cvmwmHBWXZCKbS+RQlAKvLXMWkpN
+ r1lwMyJZoSGgBHoUahoYjTh9/sJL7XLJtA==
+ -----END EC PRIVATE KEY-----
+ '';
+
+ snakeOilPublicKey = pkgs.lib.concatStrings [
+ "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHA"
+ "yNTYAAABBBChdA2BmwcG49OrQN33f/sj+OHL5sJhwVl2Qim0vkUJQCry1zFpKTa"
+ "9ZcDMiWaEhoAR6FGoaGI04ff7CS+1yybQ= sakeoil"
+ ];
+
+in {
+ name = "openssh";
-{
nodes = {
server =
@@ -10,6 +27,9 @@
services.openssh.enable = true;
security.pam.services.sshd.limits =
[ { domain = "*"; item = "memlock"; type = "-"; value = 1024; } ];
+ users.extraUsers.root.openssh.authorizedKeys.keys = [
+ snakeOilPublicKey
+ ];
};
client =
@@ -24,15 +44,25 @@
$server->waitForUnit("sshd");
- $server->succeed("mkdir -m 700 /root/.ssh");
- $server->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys");
+ subtest "manual-authkey", sub {
+ $server->succeed("mkdir -m 700 /root/.ssh");
+ $server->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys");
- $client->succeed("mkdir -m 700 /root/.ssh");
- $client->copyFileFromHost("key", "/root/.ssh/id_dsa");
- $client->succeed("chmod 600 /root/.ssh/id_dsa");
+ $client->succeed("mkdir -m 700 /root/.ssh");
+ $client->copyFileFromHost("key", "/root/.ssh/id_dsa");
+ $client->succeed("chmod 600 /root/.ssh/id_dsa");
- $client->waitForUnit("network.target");
- $client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'echo hello world' >&2");
- $client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'ulimit -l' | grep 1024");
+ $client->waitForUnit("network.target");
+ $client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'echo hello world' >&2");
+ $client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'ulimit -l' | grep 1024");
+ };
+
+ subtest "configured-authkey", sub {
+ $client->succeed("cat ${snakeOilPrivateKey} > privkey.snakeoil");
+ $client->succeed("chmod 600 privkey.snakeoil");
+ $client->succeed("ssh -o UserKnownHostsFile=/dev/null" .
+ " -o StrictHostKeyChecking=no -i privkey.snakeoil" .
+ " server true");
+ };
'';
-}
+})
diff --git a/nixos/tests/partition.nix b/nixos/tests/partition.nix
index 7126e7255ef..72fd37e041e 100644
--- a/nixos/tests/partition.nix
+++ b/nixos/tests/partition.nix
@@ -1,4 +1,4 @@
-{ pkgs, system, ... }:
+import ./make-test.nix ({ pkgs, ... }:
with pkgs.lib;
@@ -24,6 +24,14 @@ let
btrfs / --data=0 --metadata=1 --label=root btrfs.1 btrfs.2
'';
+ ksF2fs = pkgs.writeText "ks-f2fs" ''
+ clearpart --all --initlabel --drives=vdb
+
+ part swap --recommended --label=swap --fstype=swap --ondisk=vdb
+ part /boot --recommended --label=boot --fstype=f2fs --ondisk=vdb
+ part / --recommended --label=root --fstype=f2fs --ondisk=vdb
+ '';
+
ksRaid = pkgs.writeText "ks-raid" ''
clearpart --all --initlabel --drives=vdb,vdc
@@ -55,6 +63,8 @@ let
logvol / --size=1000 --grow --fstype=ext4 --name=root --vgname=nixos
'';
in {
+ name = "partitiion";
+
machine = { config, pkgs, ... }: {
environment.systemPackages = [
pkgs.pythonPackages.nixpart
@@ -193,6 +203,16 @@ in {
remountAndCheck;
};
+ parttest "f2fs filesystem", sub {
+ $machine->succeed("modprobe f2fs");
+ kickstart("${ksF2fs}");
+ ensurePartition("swap", "swap");
+ ensurePartition("boot", "f2fs");
+ ensurePartition("root", "f2fs");
+ remoteAndCheck;
+ ensureMountPoint("/mnt/boot", "f2fs");
+ };
+
parttest "RAID1 with XFS", sub {
kickstart("${ksRaid}");
ensurePartition("swap1", "swap");
@@ -224,4 +244,4 @@ in {
ensureMountPoint("/mnt/boot");
};
'';
-}
+})
diff --git a/nixos/tests/phabricator.nix b/nixos/tests/phabricator.nix
new file mode 100644
index 00000000000..53038474c91
--- /dev/null
+++ b/nixos/tests/phabricator.nix
@@ -0,0 +1,67 @@
+import ./make-test.nix ({ pkgs, ... }: {
+ name = "phabricator";
+
+ nodes = {
+ storage =
+ { config, pkgs, ... }:
+ { services.nfs.server.enable = true;
+ services.nfs.server.exports = ''
+ /repos 192.168.1.0/255.255.255.0(rw,no_root_squash)
+ '';
+ services.nfs.server.createMountPoints = true;
+ };
+
+ webserver =
+ { config, pkgs, ... }:
+ { fileSystems = pkgs.lib.mkVMOverride
+ [ { mountPoint = "/repos";
+ device = "storage:/repos";
+ fsType = "nfs";
+ }
+ ];
+ networking.firewall.enable = false;
+ networking.useDHCP = false;
+
+ services = {
+ httpd = {
+ enable = true;
+ adminAddr = "root@localhost";
+ virtualHosts = [{
+ hostName = "phabricator.local";
+ extraSubservices = [{serviceType = "phabricator";}];
+ }];
+ };
+
+ mysql = {
+ enable = true;
+ package = pkgs.mysql;
+ };
+ };
+
+ environment.systemPackages = [ pkgs.php ];
+ };
+
+ client =
+ { config, pkgs, ... }:
+ { imports = [ ./common/x11.nix ];
+ services.xserver.desktopManager.kde4.enable = true;
+ };
+ };
+
+ testScript =
+ ''
+ startAll;
+
+ $client->waitForX;
+
+ $webserver->waitForUnit("mysql");
+ $webserver->waitForUnit("httpd");
+ $webserver->execute("cd /nix/store; less >/repos/log1");
+
+ $client->sleep(30); # loading takes a long time
+ $client->execute("konqueror http://webserver/ &");
+ $client->sleep(90); # loading takes a long time
+
+ $client->screenshot("screen");
+ '';
+})
diff --git a/nixos/tests/printing.nix b/nixos/tests/printing.nix
index 13cc3115d50..a55e077c269 100644
--- a/nixos/tests/printing.nix
+++ b/nixos/tests/printing.nix
@@ -1,22 +1,22 @@
# Test printing via CUPS.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix ({pkgs, ... }: {
+ name = "printing";
nodes = {
server =
{ config, pkgs, ... }:
{ services.printing.enable = true;
+ services.printing.listenAddresses = [ "*:631" ];
services.printing.cupsdConf =
''
- Listen server:631
Order allow,deny
Allow from all
'';
+ networking.firewall.allowedTCPPorts = [ 631 ];
};
client =
@@ -37,7 +37,7 @@
$client->succeed("lpstat -H") =~ "/var/run/cups/cups.sock" or die;
$client->succeed("curl --fail http://localhost:631/");
$client->succeed("curl --fail http://server:631/");
- $server->fail("curl --fail http://client:631/");
+ $server->fail("curl --fail --connect-timeout 2 http://client:631/");
# Add a HP Deskjet printer connected via USB to the server.
$server->succeed("lpadmin -p DeskjetLocal -v usb://HP/Deskjet%205400%20series?serial=TH93I152S123XY -m 'drv:///sample.drv/deskjet.ppd' -E");
@@ -87,4 +87,4 @@
}
'';
-}
+})
diff --git a/nixos/tests/proxy.nix b/nixos/tests/proxy.nix
index 3b79c16ea2c..01f0f3fe17a 100644
--- a/nixos/tests/proxy.nix
+++ b/nixos/tests/proxy.nix
@@ -1,28 +1,26 @@
-{ pkgs, ... }:
+import ./make-test.nix (
let
backend =
{ config, pkgs, ... }:
- {
- services.openssh.enable = true;
-
- services.httpd.enable = true;
+ { services.httpd.enable = true;
services.httpd.adminAddr = "foo@example.org";
services.httpd.documentRoot = "${pkgs.valgrind}/share/doc/valgrind/html";
+ networking.firewall.allowedTCPPorts = [ 80 ];
};
in
{
+ name = "proxy";
nodes =
{ proxy =
{ config, pkgs, nodes, ... }:
- {
- services.httpd.enable = true;
+ { services.httpd.enable = true;
services.httpd.adminAddr = "bar@example.org";
services.httpd.extraModules = ["proxy_balancer"];
@@ -50,6 +48,8 @@ in
# For testing; don't want to wait forever for dead backend servers.
ProxyTimeout 5
'';
+
+ networking.firewall.allowedTCPPorts = [ 80 ];
};
backend1 = backend;
@@ -91,4 +91,4 @@ in
$client->succeed("curl --fail http://proxy/");
'';
-}
+})
diff --git a/nixos/tests/quake3.nix b/nixos/tests/quake3.nix
index 92501107780..b16cb179982 100644
--- a/nixos/tests/quake3.nix
+++ b/nixos/tests/quake3.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+import ./make-test.nix (
let
@@ -13,12 +13,15 @@ let
in
rec {
+ name = "quake3";
+
+ makeCoverageReport = true;
client =
{ config, pkgs, ... }:
{ imports = [ ./common/x11.nix ];
- services.xserver.driSupport = true;
+ hardware.opengl.driSupport = true;
services.xserver.defaultDepth = pkgs.lib.mkOverride 0 16;
environment.systemPackages = [ pkgs.quake3demo ];
nixpkgs.config.packageOverrides = overrides;
@@ -35,6 +38,7 @@ rec {
"'+map q3dm7' '+addbot grunt' '+addbot daemia' 2> /tmp/log";
};
nixpkgs.config.packageOverrides = overrides;
+ networking.firewall.allowedUDPPorts = [ 27960 ];
};
client1 = client;
@@ -76,4 +80,4 @@ rec {
$server->stopJob("quake3-server");
'';
-}
+})
diff --git a/nixos/tests/rabbitmq.nix b/nixos/tests/rabbitmq.nix
new file mode 100644
index 00000000000..3ef3f92764c
--- /dev/null
+++ b/nixos/tests/rabbitmq.nix
@@ -0,0 +1,18 @@
+# This test runs rabbitmq and checks if rabbitmq is up and running.
+
+import ./make-test.nix ({ pkgs, ... }: {
+ name = "rabbitmq";
+
+ nodes = {
+ one = { config, pkgs, ... }: {
+ services.rabbitmq.enable = true;
+ };
+ };
+
+ testScript = ''
+ startAll;
+
+ $one->waitForUnit("rabbitmq.service");
+ $one->waitUntilSucceeds("su -s ${pkgs.stdenv.shell} rabbitmq -c \"rabbitmqctl status\"");
+ '';
+})
diff --git a/nixos/tests/run-in-machine.nix b/nixos/tests/run-in-machine.nix
index 8efe26c1708..7f6e6a6dc57 100644
--- a/nixos/tests/run-in-machine.nix
+++ b/nixos/tests/run-in-machine.nix
@@ -2,7 +2,9 @@
with import ../lib/testing.nix { inherit system; };
-runInMachine {
- drv = pkgs.patchelf;
- machine = { config, pkgs, ... }: { services.sshd.enable = true; };
+{
+ test = runInMachine {
+ drv = pkgs.hello;
+ machine = { config, pkgs, ... }: { /* services.sshd.enable = true; */ };
+ };
}
diff --git a/nixos/tests/simple.nix b/nixos/tests/simple.nix
index eee13a10133..1cd9058f9e5 100644
--- a/nixos/tests/simple.nix
+++ b/nixos/tests/simple.nix
@@ -1,11 +1,12 @@
-{ pkgs, ... }:
+import ./make-test.nix {
+ name = "simple";
-{
machine = { config, pkgs, ... }: { };
testScript =
''
startAll;
+ $machine->waitForUnit("multi-user.target");
$machine->shutdown;
'';
}
diff --git a/nixos/tests/subversion.nix b/nixos/tests/subversion.nix
index 309da90c5df..50277edbdd8 100644
--- a/nixos/tests/subversion.nix
+++ b/nixos/tests/subversion.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+import ./make-test.nix (
let
@@ -20,7 +20,7 @@ let
# To build the kernel with coverage instrumentation, we need a
# special patch to make coverage data available under /proc.
linux = pkgs.linux.override (orig: {
- stdenv = cleanupBuildTree (keepBuildTree orig.stdenv);
+ stdenv = overrideInStdenv pkgs.stdenv [ pkgs.keepBuildTree ];
extraConfig =
''
GCOV_KERNEL y
@@ -32,6 +32,7 @@ let
in
{
+ name = "subversion";
nodes =
{ webserver =
@@ -114,4 +115,4 @@ in
$webserver->stopJob("httpd");
'';
-}
+})
diff --git a/nixos/tests/tomcat.nix b/nixos/tests/tomcat.nix
index 6bc88ec82fa..f3ee3477b5a 100644
--- a/nixos/tests/tomcat.nix
+++ b/nixos/tests/tomcat.nix
@@ -1,17 +1,16 @@
-{ pkgs, ... }:
+import ./make-test.nix {
+ name = "tomcat";
-{
nodes = {
server =
{ pkgs, config, ... }:
- {
- services.tomcat.enable = true;
+ { services.tomcat.enable = true;
services.httpd.enable = true;
services.httpd.adminAddr = "foo@bar.com";
- services.httpd.extraSubservices = [
- { serviceType = "tomcat-connector"; }
- ];
+ services.httpd.extraSubservices =
+ [ { serviceType = "tomcat-connector"; } ];
+ networking.firewall.allowedTCPPorts = [ 80 ];
};
client = { };
@@ -26,4 +25,5 @@
$client->succeed("curl --fail http://server/examples/servlets/servlet/HelloWorldExample");
$client->succeed("curl --fail http://server/examples/jsp/jsp2/simpletag/hello.jsp");
'';
+
}
diff --git a/nixos/tests/trac.nix b/nixos/tests/trac.nix
index e0d256f5701..87a2d328b4a 100644
--- a/nixos/tests/trac.nix
+++ b/nixos/tests/trac.nix
@@ -1,6 +1,6 @@
-{ pkgs, ... }:
+import ./make-test.nix ({ pkgs, ... }: {
+ name = "trac";
-{
nodes = {
storage =
{ config, pkgs, ... }:
@@ -68,4 +68,4 @@
$client->screenshot("screen");
'';
-}
+})
diff --git a/nixos/tests/udisks2.nix b/nixos/tests/udisks2.nix
new file mode 100644
index 00000000000..1d2f79e4f6c
--- /dev/null
+++ b/nixos/tests/udisks2.nix
@@ -0,0 +1,57 @@
+import ./make-test.nix ({ pkgs, ... }:
+
+let
+
+ stick = pkgs.fetchurl {
+ url = http://nixos.org/~eelco/nix/udisks-test.img.xz;
+ sha256 = "0was1xgjkjad91nipzclaz5biv3m4b2nk029ga6nk7iklwi19l8b";
+ };
+
+in
+
+{
+ name = "udisks2";
+
+ machine =
+ { config, pkgs, ... }:
+ { services.udisks2.enable = true;
+ imports = [ ./common/user-account.nix ];
+
+ security.polkit.extraConfig =
+ ''
+ polkit.addRule(function(action, subject) {
+ if (subject.user == "alice") return "yes";
+ });
+ '';
+ };
+
+ testScript =
+ ''
+ my $stick = $machine->stateDir . "/usbstick.img";
+ system("xz -d < ${stick} > $stick") == 0 or die;
+
+ $machine->succeed("udisksctl info -b /dev/vda >&2");
+ $machine->fail("udisksctl info -b /dev/sda1");
+
+ # Attach a USB stick and wait for it to show up.
+ $machine->sendMonitorCommand("usb_add disk:$stick");
+ $machine->waitUntilSucceeds("udisksctl info -b /dev/sda1");
+ $machine->succeed("udisksctl info -b /dev/sda1 | grep 'IdLabel:.*USBSTICK'");
+
+ # Mount the stick as a non-root user and do some stuff with it.
+ $machine->succeed("su - alice -c 'udisksctl info -b /dev/sda1'");
+ $machine->succeed("su - alice -c 'udisksctl mount -b /dev/sda1'");
+ $machine->succeed("su - alice -c 'cat /run/media/alice/USBSTICK/test.txt'") =~ /Hello World/ or die;
+ $machine->succeed("su - alice -c 'echo foo > /run/media/alice/USBSTICK/bar.txt'");
+
+ # Unmounting the stick should make the mountpoint disappear.
+ $machine->succeed("su - alice -c 'udisksctl unmount -b /dev/sda1'");
+ $machine->fail("[ -d /run/media/alice/USBSTICK ]");
+
+ # Remove the USB stick.
+ $machine->sendMonitorCommand("usb_del 0.3"); # FIXME
+ $machine->waitUntilFails("udisksctl info -b /dev/sda1");
+ $machine->fail("[ -e /dev/sda ]");
+ '';
+
+})
diff --git a/nixos/tests/xfce.nix b/nixos/tests/xfce.nix
index 9f9692f8a01..ced0c6b9826 100644
--- a/nixos/tests/xfce.nix
+++ b/nixos/tests/xfce.nix
@@ -1,6 +1,5 @@
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
+ name = "xfce";
machine =
{ config, pkgs, ... }:
@@ -17,6 +16,7 @@
testScript =
''
+ $machine->waitForX;
$machine->waitForWindow(qr/xfce4-panel/);
$machine->sleep(10);
diff --git a/pkgs/applications/audio/a2jmidid/default.nix b/pkgs/applications/audio/a2jmidid/default.nix
index f6c17e6d8ed..38192311ccf 100644
--- a/pkgs/applications/audio/a2jmidid/default.nix
+++ b/pkgs/applications/audio/a2jmidid/default.nix
@@ -1,15 +1,15 @@
-{ stdenv, fetchurl, alsaLib, dbus, jackaudio, pkgconfig, python }:
+{ stdenv, fetchurl, alsaLib, dbus, jack2, pkgconfig, python }:
stdenv.mkDerivation rec {
name = "a2jmidid-${version}";
- version = "7";
+ version = "8";
src = fetchurl {
url = "http://download.gna.org/a2jmidid/${name}.tar.bz2";
- sha256 = "1pl91y7npirhmikzlizpbyx2vkfvdkvc6qvc2lv4capj3cp6ypx7";
+ sha256 = "0pzm0qk5ilqhwz74pydg1jwrds27vm47185dakdrxidb5bv3b5ia";
};
- buildInputs = [ alsaLib dbus jackaudio pkgconfig python ];
+ buildInputs = [ alsaLib dbus jack2 pkgconfig python ];
configurePhase = "python waf configure --prefix=$out";
@@ -22,6 +22,6 @@ stdenv.mkDerivation rec {
description = "Daemon for exposing legacy ALSA sequencer applications in JACK MIDI system";
license = licenses.gpl2;
maintainers = [ maintainers.goibhniu ];
-
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/abcde/default.nix b/pkgs/applications/audio/abcde/default.nix
index 031b0fe93b5..1978fcf1874 100644
--- a/pkgs/applications/audio/abcde/default.nix
+++ b/pkgs/applications/audio/abcde/default.nix
@@ -61,7 +61,7 @@ in
meta = {
homepage = "http://lly.org/~rcw/abcde/page/";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
description = "Command-line audio CD ripper";
longDescription = ''
diff --git a/pkgs/applications/audio/amarok/default.nix b/pkgs/applications/audio/amarok/default.nix
index 1dac3f6b853..b1bcfe869f7 100644
--- a/pkgs/applications/audio/amarok/default.nix
+++ b/pkgs/applications/audio/amarok/default.nix
@@ -22,12 +22,10 @@ stdenv.mkDerivation rec {
cmakeFlags = "-DKDE4_BUILD_TESTS=OFF";
- postInstall = ''
- mkdir -p $out/nix-support
- echo ${qtscriptgenerator} > $out/nix-support/propagated-user-env-packages
- '';
+ propagatedUserEnvPkgs = [ qtscriptgenerator ];
meta = {
+ repositories.git = git://anongit.kde.org/amarok.git;
description = "Popular music player for KDE";
license = "GPL";
homepage = http://amarok.kde.org;
diff --git a/pkgs/applications/audio/ams-lv2/default.nix b/pkgs/applications/audio/ams-lv2/default.nix
new file mode 100644
index 00000000000..dd23504d3fa
--- /dev/null
+++ b/pkgs/applications/audio/ams-lv2/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, cairo, gtk, gtkmm, lv2, lvtk, pkgconfig, python }:
+
+stdenv.mkDerivation rec {
+ name = "ams-lv2-${version}";
+ version = "1.0.2";
+
+ src = fetchurl {
+ url = "https://github.com/blablack/ams-lv2/archive/v${version}.tar.gz";
+ sha256 = "0fa1ghf6qahbhj9j1ciyw0hr6nngwksa37hbs651mlz0fn7lz4xm";
+ };
+
+ buildInputs = [ cairo gtk gtkmm lv2 lvtk pkgconfig python ];
+
+ configurePhase = "python waf configure --prefix=$out";
+
+ buildPhase = "python waf";
+
+ installPhase = "python waf install";
+
+ meta = with stdenv.lib; {
+ description = "An LV2 port of the internal modules found in Alsa Modular Synth";
+ homepage = http://objectivewave.wordpress.com/ams-lv2;
+ license = licenses.gpl3;
+ maintainers = [ maintainers.goibhniu ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/ardour/ardour3.nix b/pkgs/applications/audio/ardour/ardour3.nix
deleted file mode 100644
index bf2ee04cbce..00000000000
--- a/pkgs/applications/audio/ardour/ardour3.nix
+++ /dev/null
@@ -1,60 +0,0 @@
-{ stdenv, fetchgit, alsaLib, aubio, boost, cairomm, curl, fftw
-, fftwSinglePrec, flac, glibc, glibmm, gtk, gtkmm, jackaudio
-, libgnomecanvas, libgnomecanvasmm, liblo, libmad, libogg, librdf
-, librdf_raptor, librdf_rasqal, libsamplerate, libsigcxx, libsndfile
-, libusb, libuuid, libxml2, libxslt, lilv, lv2, makeWrapper, pango
-, perl, pkgconfig, python, serd, sord, sratom, suil }:
-
-let
- # Ardour 3.0 tag
- rev = "79db9422";
-in
-
-stdenv.mkDerivation {
- name = "ardour-3.0";
-
- src = fetchgit {
- url = git://git.ardour.org/ardour/ardour.git;
- inherit rev;
- sha256 = "cdbe4ca6d4b639fcd66a3d1cf9c2816b4755655c9d81bdd2417263f413aa7096";
- };
-
- buildInputs =
- [ alsaLib aubio boost cairomm curl fftw fftwSinglePrec flac glibc
- glibmm gtk gtkmm jackaudio libgnomecanvas libgnomecanvasmm liblo
- libmad libogg librdf librdf_raptor librdf_rasqal libsamplerate
- libsigcxx libsndfile libusb libuuid libxml2 libxslt lilv lv2
- makeWrapper pango perl pkgconfig python serd sord sratom suil
- ];
-
- patchPhase = ''
- printf '#include "ardour/svn_revision.h"\nnamespace ARDOUR { const char* svn_revision = \"${rev}\"; }\n' > libs/ardour/svn_revision.cc
- sed -e 's|^#!/usr/bin/perl.*$|#!${perl}/bin/perl|g' -i tools/fmt-bindings
- sed -e 's|^#!/usr/bin/env.*$|#!${perl}/bin/perl|g' -i tools/*.pl
- sed 's|/usr/include/libintl.h|${glibc}/include/libintl.h|' -i wscript
- '';
-
- configurePhase = "python waf configure --prefix=$out";
-
- buildPhase = "python waf";
-
- # For the custom ardour clearlooks gtk-engine to work, it must be
- # moved to a directory called "engines" and added to GTK_PATH
- installPhase = ''
- python waf install
- mkdir -pv $out/gtk2/engines
- mv $out/lib/ardour3/libclearlooks.so $out/gtk2/engines/
- wrapProgram $out/bin/ardour3 --prefix GTK_PATH : $out/gtk2
- '';
-
- meta = with stdenv.lib; {
- description = "Multi-track hard disk recording software";
- longDescription = ''
- Also read "The importance of Paying Something" on their homepage, please!
- '';
- homepage = http://ardour.org/;
- license = licenses.gpl2;
- platforms = platforms.linux;
- maintainers = [ maintainers.goibhniu ];
- };
-}
diff --git a/pkgs/applications/audio/ardour/default.nix b/pkgs/applications/audio/ardour/default.nix
index 3ed650d4ae7..62b88cbe077 100644
--- a/pkgs/applications/audio/ardour/default.nix
+++ b/pkgs/applications/audio/ardour/default.nix
@@ -1,50 +1,77 @@
-{ stdenv, fetchurl, scons, boost, pkgconfig, fftw, librdf_raptor2
-, librdf_rasqal, jackaudio, flac, libsamplerate, alsaLib, libxml2
-, lilv, lv2, serd, sord, sratom, suil # these are probably optional
-, libxslt, libsndfile, libsigcxx, libusb, cairomm, glib, pango
-, gtk, glibmm, gtkmm, libgnomecanvas, libgnomecanvasmm, liblo, aubio
-, fftwSinglePrec, libmad, automake, autoconf, libtool, liblrdf, curl }:
+{ stdenv, fetchgit, alsaLib, aubio, boost, cairomm, curl, fftw
+, fftwSinglePrec, flac, glibc, glibmm, gtk, gtkmm, jack2
+, libgnomecanvas, libgnomecanvasmm, liblo, libmad, libogg, librdf
+, librdf_raptor, librdf_rasqal, libsamplerate, libsigcxx, libsndfile
+, libusb, libuuid, libxml2, libxslt, lilv, lv2, makeWrapper, pango
+, perl, pkgconfig, python, serd, sord, sratom, suil }:
+
+let
+ tag = "3.5.380";
+in
stdenv.mkDerivation rec {
- name = "ardour-${version}";
- version = "2.8.16";
+ name = "ardour-${tag}";
- src = fetchurl {
- url = "mirror://gentoo/distfiles/${name}.tar.bz2";
- sha256 = "0h2y0x4yznalllja53anjil2gmgcb26f39zshc4gl1d1kc8k5vip";
+ src = fetchgit {
+ url = git://git.ardour.org/ardour/ardour.git;
+ rev = "refs/tags/${tag}";
+ sha256 = "dbcbb2d9143e196d079c27b15266e47d24b81cb7591fe64b717f3485965ded7b";
};
- postPatch = ''
- #sed -e "s#/usr/bin/which#type -P#" -i libs/glibmm2/autogen.sh
- echo '#include "ardour/svn_revision.h"' > libs/ardour/svn_revision.cc
- echo -e 'namespace ARDOUR {\n extern const char* svn_revision = "2.8.12";\n }\n' >> libs/ardour/svn_revision.cc
+ buildInputs =
+ [ alsaLib aubio boost cairomm curl fftw fftwSinglePrec flac glibc
+ glibmm gtk gtkmm jack2 libgnomecanvas libgnomecanvasmm liblo
+ libmad libogg librdf librdf_raptor librdf_rasqal libsamplerate
+ libsigcxx libsndfile libusb libuuid libxml2 libxslt lilv lv2
+ makeWrapper pango perl pkgconfig python serd sord sratom suil
+ ];
+
+ patchPhase = ''
+ # The funny revision number is from `git describe rev`
+ printf '#include "libs/ardour/ardour/revision.h"\nnamespace ARDOUR { const char* revision = \"${tag}-g2f6065b\"; }\n' > libs/ardour/revision.cc
+ # Note the different version number
+ sed -i '33i rev = \"3.5-380-g2f6065b\"' wscript
+ sed 's|/usr/include/libintl.h|${glibc}/include/libintl.h|' -i wscript
+ sed -e 's|^#!/usr/bin/perl.*$|#!${perl}/bin/perl|g' -i tools/fmt-bindings
+ sed -e 's|^#!/usr/bin/env.*$|#!${perl}/bin/perl|g' -i tools/*.pl
'';
- buildInputs = [
- scons boost pkgconfig fftw librdf_raptor2 librdf_rasqal jackaudio
- flac libsamplerate alsaLib libxml2 libxslt libsndfile libsigcxx
- #lilv lv2 serd sord sratom suil
- libusb cairomm glib pango gtk glibmm gtkmm libgnomecanvas libgnomecanvasmm liblrdf
- liblo aubio fftwSinglePrec libmad autoconf automake libtool curl
- ];
+ configurePhase = "python waf configure --optimize --prefix=$out";
- buildPhase = ''
- mkdir -p $out
- export CXX=g++
- scons PREFIX=$out SYSLIBS=1 install
+ buildPhase = "python waf";
+
+ # For the custom ardour clearlooks gtk-engine to work, it must be
+ # moved to a directory called "engines" and added to GTK_PATH
+ installPhase = ''
+ python waf install
+ mkdir -pv $out/gtk2/engines
+ cp build/libs/clearlooks-newer/libclearlooks.so $out/gtk2/engines/
+ wrapProgram $out/bin/ardour3 --prefix GTK_PATH : $out/gtk2
+
+ # Install desktop file
+ mkdir -p "$out/share/applications"
+ cat > "$out/share/applications/ardour.desktop" << EOF
+ [Desktop Entry]
+ Name=Ardour 3
+ GenericName=Digital Audio Workstation
+ Comment=Multitrack harddisk recorder
+ Exec=$out/bin/ardour3
+ Icon=$out/share/ardour3/icons/ardour_icon_256px.png
+ Terminal=false
+ Type=Application
+ X-MultipleArgs=false
+ Categories=GTK;Audio;AudioVideoEditing;AudioVideo;Video;
+ EOF
'';
- installPhase = ":";
-
- meta = {
+ meta = with stdenv.lib; {
description = "Multi-track hard disk recording software";
longDescription = ''
- Broken: use ardour3-svn instead
Also read "The importance of Paying Something" on their homepage, please!
'';
homepage = http://ardour.org/;
- license = "GPLv2";
- maintainers = [ stdenv.lib.maintainers.marcweber ];
- platforms = stdenv.lib.platforms.linux;
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.goibhniu ];
};
}
diff --git a/pkgs/applications/audio/audacious/default.nix b/pkgs/applications/audio/audacious/default.nix
index f9a8d075241..409a831727b 100644
--- a/pkgs/applications/audio/audacious/default.nix
+++ b/pkgs/applications/audio/audacious/default.nix
@@ -4,19 +4,19 @@
}:
let
- version = "3.4.1";
+ version = "3.4.3";
in
stdenv.mkDerivation {
name = "audacious-${version}";
src = fetchurl {
url = "http://distfiles.audacious-media-player.org/audacious-${version}.tar.bz2";
- sha256 = "0wf99b0nrk90fyak4gpwi076qnsrmv1j8958cvi57rxig21lvvap";
+ sha256 = "04lzwdr1lx6ghbfxzygvnbmdl420w6rm453ds5lyb0hlvzs58d0q";
};
pluginsSrc = fetchurl {
url = "http://distfiles.audacious-media-player.org/audacious-plugins-${version}.tar.bz2";
- sha256 = "02ivrxs6109nmmz9pkbf9dkm36s2lyp9vfv59sm0acxxd4db71md";
+ sha256 = "00r88q9fs9a0gicdmk2svcans7igcqgacrw303a5bn44is7pmrmy";
};
buildInputs =
@@ -48,8 +48,8 @@ stdenv.mkDerivation {
(
source $stdenv/setup
# gsettings schemas for file dialogues
- for file in "$out"/bin/*; do
- wrapProgram "$file" --prefix XDG_DATA_DIRS : "$XDG_ADD"
+ for file in "$out/bin/"*; do
+ wrapProgram "$file" --prefix XDG_DATA_DIRS : "$XDG_ADD:$GSETTINGS_SCHEMAS_PATH"
done
)
'';
diff --git a/pkgs/applications/audio/audacity/default.nix b/pkgs/applications/audio/audacity/default.nix
index 4a6797f9010..7308d84e098 100644
--- a/pkgs/applications/audio/audacity/default.nix
+++ b/pkgs/applications/audio/audacity/default.nix
@@ -4,12 +4,12 @@
}:
stdenv.mkDerivation rec {
- version = "2.0.4";
+ version = "2.0.5";
name = "audacity-${version}";
src = fetchurl {
url = "http://audacity.googlecode.com/files/audacity-minsrc-${version}.tar.xz";
- sha256 = "0pl92filykzs4g2pn7i02kdqgja326wjgafzw2vcgwn3dwrs4avp";
+ sha256 = "0y9bvc3a3zxsk31yg7bha029mzkjiw5i9m86kbyj7x8ps0fm91z2";
};
preConfigure = /* we prefer system-wide libs */ ''
@@ -31,7 +31,8 @@ stdenv.mkDerivation rec {
meta = {
description = "Sound editor with graphical UI";
homepage = http://audacity.sourceforge.net;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = with stdenv.lib.platforms; linux;
+ maintainers = with stdenv.lib.maintainers; [ the-kenny ];
};
}
diff --git a/pkgs/applications/audio/aumix/default.nix b/pkgs/applications/audio/aumix/default.nix
index 1e19a3ac5c3..41edd51e5f2 100644
--- a/pkgs/applications/audio/aumix/default.nix
+++ b/pkgs/applications/audio/aumix/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
the command line or a script.
'';
homepage = http://www.jpj.net/~trevor/aumix.html;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/applications/audio/bristol/default.nix b/pkgs/applications/audio/bristol/default.nix
index 0978b15bfaf..b27ac058602 100644
--- a/pkgs/applications/audio/bristol/default.nix
+++ b/pkgs/applications/audio/bristol/default.nix
@@ -1,16 +1,16 @@
-{ stdenv, fetchurl, alsaLib, jackaudio, pkgconfig, pulseaudio, xlibs }:
+{ stdenv, fetchurl, alsaLib, jack2, pkgconfig, pulseaudio, xlibs }:
stdenv.mkDerivation rec {
name = "bristol-${version}";
- version = "0.60.10";
+ version = "0.60.11";
src = fetchurl {
url = "mirror://sourceforge/bristol/${name}.tar.gz";
- sha256 = "070rn5zdx6vrqmq7w1rrpxig3bxlylbsw82nlmkjnhjrgm6yx753";
+ sha256 = "1fi2m4gmvxdi260821y09lxsimq82yv4k5bbgk3kyc3x1nyhn7vx";
};
buildInputs = [
- alsaLib jackaudio pkgconfig pulseaudio xlibs.libX11 xlibs.libXext
+ alsaLib jack2 pkgconfig pulseaudio xlibs.libX11 xlibs.libXext
xlibs.xproto
];
diff --git a/pkgs/applications/audio/calf/default.nix b/pkgs/applications/audio/calf/default.nix
index 6ed4b7cce98..efab9202025 100644
--- a/pkgs/applications/audio/calf/default.nix
+++ b/pkgs/applications/audio/calf/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchurl, cairo, expat, fftwSinglePrec, fluidsynth, glib
-, gtk, jackaudio, ladspaH , libglade, lv2, pkgconfig }:
+, gtk, jack2, ladspaH , libglade, lv2, pkgconfig }:
stdenv.mkDerivation rec {
name = "calf-${version}";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
};
buildInputs = [
- cairo expat fftwSinglePrec fluidsynth glib gtk jackaudio ladspaH
+ cairo expat fftwSinglePrec fluidsynth glib gtk jack2 ladspaH
libglade lv2 pkgconfig
];
diff --git a/pkgs/applications/audio/cantata/default.nix b/pkgs/applications/audio/cantata/default.nix
new file mode 100644
index 00000000000..31d5240529f
--- /dev/null
+++ b/pkgs/applications/audio/cantata/default.nix
@@ -0,0 +1,104 @@
+{ stdenv, fetchurl, cmake
+, withQt4 ? true, qt4
+, withQt5 ? false, qt5
+
+# I'm unable to make KDE work here, crashes at runtime so I simply
+# make Qt4 the default until someone who wants KDE can figure it out.
+, withKDE4 ? false, kde4
+
+# Cantata doesn't build with cdparanoia enabled so we disable that
+# default for now until I (or someone else) figure it out.
+, withCdda ? false, cdparanoia
+, withCddb ? false, libcddb
+, withLame ? false, lame
+, withMusicbrainz ? false, libmusicbrainz5
+
+, withTaglib ? true, taglib, taglib_extras
+, withReplaygain ? true, ffmpeg, speex, mpg123
+, withMtp ? true, libmtp
+, withOnlineServices ? true
+, withDevices ? true, udisks2
+, withDynamic ? true
+, withHttpServer ? true
+, withStreams ? true
+}:
+
+# One and only one front-end.
+assert withQt5 -> withQt4 == false && withKDE4 == false;
+assert withQt4 -> withQt5 == false && withKDE4 == false;
+assert withKDE4 -> withQt4 == false && withQt5 == false;
+assert withQt4 || withQt5 || withKDE4;
+
+# Inter-dependencies.
+assert withCddb -> withCdda && withTaglib;
+assert withCdda -> withCddb && withMusicbrainz;
+assert withLame -> withCdda && withTaglib;
+assert withMtp -> withTaglib;
+assert withMusicbrainz -> withCdda && withTaglib;
+assert withOnlineServices -> withTaglib;
+assert withReplaygain -> withTaglib;
+
+let
+ version = "1.3.4";
+ pname = "cantata";
+ fstat = x: fn: "-DENABLE_" + fn + "=" + (if x then "ON" else "OFF");
+ fstats = x: map (fstat x);
+in
+
+stdenv.mkDerivation rec {
+ name = "${pname}-${version}";
+
+ src = fetchurl {
+ inherit name;
+ url = "https://drive.google.com/uc?export=download&id=0Bzghs6gQWi60WTYtaXk3c1IzNVU";
+ sha256 = "0ris41v44nwd68f3zis9n9lyyc089dyhlxp37rrzflanrc6glpwq";
+ };
+
+ buildInputs =
+ [ cmake ]
+ ++ stdenv.lib.optional withQt4 qt4
+ ++ stdenv.lib.optional withQt5 qt5
+ ++ stdenv.lib.optional withKDE4 kde4.kdelibs
+ ++ stdenv.lib.optionals withTaglib [ taglib taglib_extras ]
+ ++ stdenv.lib.optionals withReplaygain [ ffmpeg speex mpg123 ]
+ ++ stdenv.lib.optional withCdda cdparanoia
+ ++ stdenv.lib.optional withCddb libcddb
+ ++ stdenv.lib.optional withLame lame
+ ++ stdenv.lib.optional withMtp libmtp
+ ++ stdenv.lib.optional withMusicbrainz libmusicbrainz5
+ ++ stdenv.lib.optional (withTaglib && !withKDE4 && withDevices) udisks2;
+
+ unpackPhase = "tar -xvf $src";
+ sourceRoot = "cantata-1.3.4";
+
+ # Qt4 is implicit when KDE is switched off.
+ cmakeFlags = stdenv.lib.flatten [
+ (fstats withKDE4 [ "KDE" "KWALLET" ])
+ (fstat withQt5 "QT5")
+ (fstats withTaglib [ "TAGLIB" "TAGLIB_EXTRAS" ])
+ (fstats withReplaygain [ "FFMPEG" "MPG123" "SPEEXDSP" ])
+ (fstat withCdda "CDPARANOIA")
+ (fstat withCddb "CDDB")
+ (fstat withLame "LAME")
+ (fstat withMtp "MTP")
+ (fstat withMusicbrainz "MUSICBRAINZ")
+ (fstat withOnlineServices "ONLINE_SERVICES")
+ (fstat withDynamic "DYNAMIC")
+ (fstat withDevices "DEVICES_SUPPORT")
+ (fstat withHttpServer "HTTP_SERVER")
+ (fstat withStreams "STREAMS")
+ "-DENABLE_HTTPS_SUPPORT=ON"
+ "-DENABLE_UDISKS2=ON"
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://code.google.com/p/cantata/";
+ description = "A graphical client for MPD.";
+ license = licenses.gpl3;
+
+ # Technically Cantata can run on Windows so if someone wants to
+ # bother figuring that one out, be my guest.
+ platforms = platforms.linux;
+ maintainers = [ maintainers.fuuzetsu ];
+ };
+}
diff --git a/pkgs/applications/audio/caps/default.nix b/pkgs/applications/audio/caps/default.nix
index 81fb77c1c9a..49880f6c0f3 100644
--- a/pkgs/applications/audio/caps/default.nix
+++ b/pkgs/applications/audio/caps/default.nix
@@ -1,10 +1,10 @@
{ stdenv, fetchurl }:
stdenv.mkDerivation rec {
name = "caps-${version}";
- version = "0.9.7";
+ version = "0.9.16";
src = fetchurl {
url = "http://www.quitte.de/dsp/caps_${version}.tar.bz2";
- sha256 = "0ks98r3j404s9h88x50lj5lj4l64ijj29fz5i08iyq8jrb7r0zm0";
+ sha256 = "117l04w2zwqak856lihmaxg6f22vlz71knpxy0axiyri0x82lbwv";
};
configurePhase = ''
echo "PREFIX = $out" > defines.make
diff --git a/pkgs/applications/audio/cd-discid/default.nix b/pkgs/applications/audio/cd-discid/default.nix
index c67830a94e7..1646f944a83 100644
--- a/pkgs/applications/audio/cd-discid/default.nix
+++ b/pkgs/applications/audio/cd-discid/default.nix
@@ -19,7 +19,7 @@ in
meta = {
homepage = http://lly.org/~rcw/cd-discid/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
description = "cd-discid, a command-line utility to retrieve a disc's CDDB ID";
longDescription = ''
diff --git a/pkgs/applications/audio/clementine/clementine-1.2.1-include-paths.patch b/pkgs/applications/audio/clementine/clementine-1.2.1-include-paths.patch
new file mode 100644
index 00000000000..4c17846b99d
--- /dev/null
+++ b/pkgs/applications/audio/clementine/clementine-1.2.1-include-paths.patch
@@ -0,0 +1,14 @@
+diff -ur clementine-1.2.1-a/CMakeLists.txt clementine-1.2.1-b/CMakeLists.txt
+--- clementine-1.2.1-a/CMakeLists.txt 2013-11-25 15:16:24.000000000 -0600
++++ clementine-1.2.1-b/CMakeLists.txt 2013-12-30 17:01:48.470011058 -0600
+@@ -158,6 +158,10 @@
+ include_directories(${TAGLIB_INCLUDE_DIRS})
+ include_directories(${QJSON_INCLUDE_DIRS})
+ include_directories(${GSTREAMER_INCLUDE_DIRS})
++include_directories(${GSTREAMER_APP_INCLUDE_DIRS})
++include_directories(${GSTREAMER_BASE_INCLUDE_DIRS})
++include_directories(${GSTREAMER_CDDA_INCLUDE_DIRS})
++include_directories(${GSTREAMER_TAG_INCLUDE_DIRS})
+ include_directories(${GLIB_INCLUDE_DIRS})
+ include_directories(${GLIBCONFIG_INCLUDE_DIRS})
+ include_directories(${LIBXML_INCLUDE_DIRS})
diff --git a/pkgs/applications/audio/clementine/default.nix b/pkgs/applications/audio/clementine/default.nix
new file mode 100644
index 00000000000..604c35f46ce
--- /dev/null
+++ b/pkgs/applications/audio/clementine/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, boost, cmake, gettext, gstreamer, gst_plugins_base
+, liblastfm, qt4, taglib, fftw, glew, qjson, sqlite, libgpod, libplist
+, usbmuxd, libmtp, gvfs, libcdio, protobuf, libspotify, qca2, pkgconfig
+, sparsehash, config }:
+
+let withSpotify = config.clementine.spotify or false;
+in
+stdenv.mkDerivation {
+ name = "clementine-1.2.3";
+
+ src = fetchurl {
+ url = https://github.com/clementine-player/Clementine/archive/1.2.3.tar.gz;
+ sha256 = "1gx1109i4pylz6x7gvp4rdzc6dvh0w6in6hfbygw01d08l26bxbx";
+ };
+
+ patches = [ ./clementine-1.2.1-include-paths.patch ];
+
+ buildInputs = [
+ boost
+ cmake
+ fftw
+ gettext
+ glew
+ gst_plugins_base
+ gstreamer
+ gvfs
+ libcdio
+ libgpod
+ liblastfm
+ libmtp
+ libplist
+ pkgconfig
+ protobuf
+ qca2
+ qjson
+ qt4
+ sparsehash
+ sqlite
+ taglib
+ usbmuxd
+ ] ++ stdenv.lib.optional withSpotify libspotify;
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ homepage = "http://www.clementine-player.org";
+ description = "A multiplatform music player";
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.ttuegel ];
+ # libspotify is unfree
+ hydraPlatforms = optionals (!withSpotify) platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/csound/default.nix b/pkgs/applications/audio/csound/default.nix
index 34e98ae620d..19c590330f6 100644
--- a/pkgs/applications/audio/csound/default.nix
+++ b/pkgs/applications/audio/csound/default.nix
@@ -12,13 +12,13 @@
}:
stdenv.mkDerivation {
- name = "csound-5.18.02";
+ name = "csound-5.19.01";
enableParallelBuilding = true;
src = fetchurl {
- url = mirror://sourceforge/csound/Csound5.18.02.tar.gz;
- sha256 = "4c461cf3bf60b83671224949dd33805379b7121bf2c0ad6af5e191e7f6f8adc8";
+ url = mirror://sourceforge/csound/Csound5.19.01.tar.gz;
+ sha256 = "078i69jwgadmxwa5ffn8h1py7cmd9asa8swnh38fyp56lzgzn669";
};
buildInputs = [ cmake libsndfile flex bison alsaLib pulseaudio tcltk ];
diff --git a/pkgs/applications/audio/distrho/default.nix b/pkgs/applications/audio/distrho/default.nix
index 809a02e1c7a..aa3a76c3af1 100644
--- a/pkgs/applications/audio/distrho/default.nix
+++ b/pkgs/applications/audio/distrho/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, alsaLib, fftwSinglePrec, freetype, jackaudio
+{ stdenv, fetchgit, alsaLib, fftwSinglePrec, freetype, jack2
, libxslt, lv2, pkgconfig, premake3, xlibs }:
let
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
'';
buildInputs = [
- alsaLib fftwSinglePrec freetype jackaudio pkgconfig premake3
+ alsaLib fftwSinglePrec freetype jack2 pkgconfig premake3
xlibs.libX11 xlibs.libXcomposite xlibs.libXcursor xlibs.libXext
xlibs.libXinerama xlibs.libXrender
];
diff --git a/pkgs/applications/audio/drumkv1/default.nix b/pkgs/applications/audio/drumkv1/default.nix
index 7fdd04ce96b..775cf5ca606 100644
--- a/pkgs/applications/audio/drumkv1/default.nix
+++ b/pkgs/applications/audio/drumkv1/default.nix
@@ -1,15 +1,15 @@
-{ stdenv, fetchurl, jackaudio, libsndfile, lv2, qt4 }:
+{ stdenv, fetchurl, jack2, libsndfile, lv2, qt4 }:
stdenv.mkDerivation rec {
name = "drumkv1-${version}";
- version = "0.3.2";
+ version = "0.5.0";
src = fetchurl {
url = "mirror://sourceforge/drumkv1/${name}.tar.gz";
- sha256 = "0bafg06iavri9dmg7hpz554kpqf1iv9crcdq46y4n4wyyxd7kajl";
+ sha256 = "16bjkp22hfpmzj5di98dddzslavgvhw5z7pgjzmjqz9dxvbqwq1k";
};
- buildInputs = [ jackaudio libsndfile lv2 qt4 ];
+ buildInputs = [ jack2 libsndfile lv2 qt4 ];
meta = with stdenv.lib; {
description = "An old-school drum-kit sampler synthesizer with stereo fx";
diff --git a/pkgs/applications/audio/ekho/default.nix b/pkgs/applications/audio/ekho/default.nix
new file mode 100644
index 00000000000..dd9b830be84
--- /dev/null
+++ b/pkgs/applications/audio/ekho/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, pkgconfig
+, libsndfile, pulseaudio
+}:
+
+let
+ version = "5.8.2";
+in stdenv.mkDerivation rec {
+ name = "ekho-${version}";
+
+ meta = with stdenv.lib; {
+ description = "Chinese text-to-speech software";
+ homepage = "http://www.eguidedog.net/ekho.php";
+ longDescription = ''
+ Ekho (余音) is a free, open source and multilingual text-to-speech (TTS)
+ software. It supports Cantonese (Chinese dialect spoken in Hong Kong and
+ part of Guangdong province), Mandarin (standard Chinese), Zhaoan Hakka
+ (a dialect in Taiwan), Tibetan, Ngangien (an ancient Chinese before
+ Yuan Dynasty) and Korean (in trial).
+ '';
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ hydraPlatforms = [];
+ maintainers = with maintainers; [ iyzsong ];
+ };
+
+ src = fetchurl {
+ url = "mirror://sourceforge/e-guidedog/Ekho/${version}/${name}.tar.xz";
+ sha256 = "0ym6lpcpsvwvsiwlzkl1509a2hljwcw7synngrmqjq1n49ww00nj";
+ };
+
+ preConfigure = with stdenv.lib; ''
+ NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE ${optionalString stdenv.is64bit "-D_x86_64"}"
+ NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DEKHO_DATA_PATH=\"$out/share/ekho-data\""
+ '';
+
+ nativeBuildInputs = [ pkgconfig ];
+
+ buildInputs = [ libsndfile pulseaudio ];
+}
diff --git a/pkgs/applications/audio/espeak/default.nix b/pkgs/applications/audio/espeak/default.nix
index e1cf5fee1cc..0faf4841c71 100644
--- a/pkgs/applications/audio/espeak/default.nix
+++ b/pkgs/applications/audio/espeak/default.nix
@@ -1,10 +1,11 @@
-{stdenv, fetchurl, unzip, portaudio }:
+{ stdenv, fetchurl, unzip, portaudio }:
+
+stdenv.mkDerivation rec {
+ name = "espeak-1.48.04";
-stdenv.mkDerivation {
- name = "espeak-1.46.02";
src = fetchurl {
- url = mirror://sourceforge/espeak/espeak-1.46.02-source.zip;
- sha256 = "1fjlv5fm0gzvr5wzy1dp4nspw04k0bqv3jymha2p2qfjbfifp2zg";
+ url = "mirror://sourceforge/espeak/${name}-source.zip";
+ sha256 = "0n86gwh9pw0jqqpdz7mxggllfr8k0r7pc67ayy7w5z6z79kig6mz";
};
buildInputs = [ unzip portaudio ];
@@ -21,9 +22,10 @@ stdenv.mkDerivation {
makeFlags="PREFIX=$out DATADIR=$out/share/espeak-data"
'';
- meta = {
+ meta = with stdenv.lib; {
description = "Compact open source software speech synthesizer";
homepage = http://espeak.sourceforge.net/;
- license = "GPLv3+";
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/espeak/edit.nix b/pkgs/applications/audio/espeak/edit.nix
index eb34335721f..524a95bcca0 100644
--- a/pkgs/applications/audio/espeak/edit.nix
+++ b/pkgs/applications/audio/espeak/edit.nix
@@ -1,31 +1,57 @@
-{stdenv, fetchurl, unzip, portaudio, wxGTK}:
+{ stdenv, fetchurl, pkgconfig, unzip, portaudio, wxGTK, sox }:
+
+stdenv.mkDerivation rec {
+ name = "espeakedit-1.48.03";
-stdenv.mkDerivation {
- name = "espeakedit-1.46.02";
src = fetchurl {
- url = mirror://sourceforge/espeak/espeakedit-1.46.02.zip;
- sha256 = "1cc5r89sn8zz7b8wj4grx9xb7aqyi0ybj0li9hpy7hd67r56kqkl";
+ url = "mirror://sourceforge/espeak/${name}.zip";
+ sha256 = "0x8s7vpb7rw5x37yjzy1f98m4f2csdg89libb74fm36gn8ly0hli";
};
- buildInputs = [ unzip portaudio wxGTK ];
+ buildInputs = [ pkgconfig unzip portaudio wxGTK ];
- patchPhase = if portaudio.api_version == 19 then ''
+ # TODO:
+ # Uhm, seems like espeakedit still wants espeak-data/ in $HOME, even thought
+ # it should use $espeak/share/espeak-data. Have to contact upstream to get
+ # this fixed.
+ #
+ # Workaround:
+ # cp -r $(nix-build -A espeak)/share/espeak-data ~
+ # chmod +w ~/espeak-data
+
+ patches = [
+ ./espeakedit-fix-makefile.patch
+ ./espeakedit-configurable-sox-path.patch
+ ./espeakedit-configurable-path-espeak-data.patch
+ ];
+
+ postPatch = ''
+ # Disable -Wall flag because it's noisy
+ sed -i "s/-Wall//g" src/Makefile
+
+ # Fixup paths (file names from above espeak-configurable* patches)
+ for file in src/compiledata.cpp src/readclause.cpp src/speech.h; do
+ sed -e "s|@sox@|${sox}/bin/sox|" \
+ -e "s|@prefix@|$out|" \
+ -i "$file"
+ done
+ '' + stdenv.lib.optionalString (portaudio.api_version == 19) ''
cp src/portaudio19.h src/portaudio.h
- '' else "";
+ '';
buildPhase = ''
- cd src
- gcc -o espeakedit *.cpp `wx-config --cxxflags --libs`
+ make -C src
'';
installPhase = ''
- ensureDir $out/bin
- cp espeakedit $out/bin
+ mkdir -p "$out/bin"
+ cp src/espeakedit "$out/bin"
'';
- meta = {
+ meta = with stdenv.lib; {
description = "Phoneme editor for espeak";
homepage = http://espeak.sourceforge.net/;
- license = "GPLv3+";
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/espeak/espeakedit-configurable-path-espeak-data.patch b/pkgs/applications/audio/espeak/espeakedit-configurable-path-espeak-data.patch
new file mode 100644
index 00000000000..e5c761a11b3
--- /dev/null
+++ b/pkgs/applications/audio/espeak/espeakedit-configurable-path-espeak-data.patch
@@ -0,0 +1,15 @@
+Don't hardcode /usr, use @prefix@.
+
+Author: Bjørn Forsman
+diff -uNr espeakedit-1.48.03.orig/src/speech.h espeakedit-1.48.03/src/speech.h
+--- espeakedit-1.48.03.orig/src/speech.h 2014-03-04 17:48:12.000000000 +0100
++++ espeakedit-1.48.03/src/speech.h 2014-07-22 18:21:40.860790719 +0200
+@@ -58,7 +58,7 @@
+
+ // will look for espeak_data directory here, and also in user's home directory
+ #ifndef PATH_ESPEAK_DATA
+- #define PATH_ESPEAK_DATA "/usr/share/espeak-data"
++ #define PATH_ESPEAK_DATA "@prefix@/share/espeak-data"
+ #endif
+
+ typedef unsigned short USHORT;
diff --git a/pkgs/applications/audio/espeak/espeakedit-configurable-sox-path.patch b/pkgs/applications/audio/espeak/espeakedit-configurable-sox-path.patch
new file mode 100644
index 00000000000..1c5dfc21941
--- /dev/null
+++ b/pkgs/applications/audio/espeak/espeakedit-configurable-sox-path.patch
@@ -0,0 +1,27 @@
+Make the path to 'sox' configurable by marking it '@sox@' (easy to match with sed).
+
+Author: Bjørn Forsman
+diff -uNr espeakedit-1.48.03.orig/src/compiledata.cpp espeakedit-1.48.03/src/compiledata.cpp
+--- espeakedit-1.48.03.orig/src/compiledata.cpp 2014-03-04 17:48:11.000000000 +0100
++++ espeakedit-1.48.03/src/compiledata.cpp 2014-07-22 16:38:50.261388452 +0200
+@@ -1884,7 +1884,7 @@
+ fname2 = msg;
+ }
+
+- sprintf(command,"sox \"%s%s.wav\" -r %d -c1 -t wav %s\n",path_source,fname2,samplerate_native, fname_temp);
++ sprintf(command,"@sox@ \"%s%s.wav\" -r %d -c1 -t wav %s\n",path_source,fname2,samplerate_native, fname_temp);
+ if(system(command) != 0)
+ {
+ failed = 1;
+diff -uNr espeakedit-1.48.03.orig/src/readclause.cpp espeakedit-1.48.03/src/readclause.cpp
+--- espeakedit-1.48.03.orig/src/readclause.cpp 2014-03-04 17:48:11.000000000 +0100
++++ espeakedit-1.48.03/src/readclause.cpp 2014-07-22 16:38:37.190440504 +0200
+@@ -892,7 +892,7 @@
+ if((fd_temp = mkstemp(fname_temp)) >= 0)
+ {
+ close(fd_temp);
+- sprintf(command,"sox \"%s\" -r %d -c1 -t wav %s\n", fname, samplerate, fname_temp);
++ sprintf(command,"@sox@ \"%s\" -r %d -c1 -t wav %s\n", fname, samplerate, fname_temp);
+ if(system(command) == 0)
+ {
+ fname = fname_temp;
diff --git a/pkgs/applications/audio/espeak/espeakedit-fix-makefile.patch b/pkgs/applications/audio/espeak/espeakedit-fix-makefile.patch
new file mode 100644
index 00000000000..9f8a65d2b0c
--- /dev/null
+++ b/pkgs/applications/audio/espeak/espeakedit-fix-makefile.patch
@@ -0,0 +1,26 @@
+Fix broken Makefile:
+
+* fix syntax error (missing '\' to continue line):
+ Makefile:19: *** recipe commences before first target. Stop.
+* Get portaudio library flags from pkg-config (to get -Lpath/to/portaudio/lib etc.)
+
+Author: Bjørn Forsman
+diff -uNr espeakedit-1.48.03.orig/src/Makefile espeakedit-1.48.03/src/Makefile
+--- espeakedit-1.48.03.orig/src/Makefile 2013-03-13 15:52:02.000000000 +0100
++++ espeakedit-1.48.03/src/Makefile 2014-07-22 15:34:17.524114822 +0200
+@@ -12,12 +12,11 @@
+
+ WX_LIBS = -pthread `wx-config --libs`
+
+-LIBS=-lstdc++ -lportaudio
++LIBS=-lstdc++ `pkg-config --libs portaudio-2.0`
+ #LIBS=-lstdc++ /usr/lib/x86_64-linux-gnu/libportaudio.so.2
+
+-CPPFLAGS = -Wall -g -fexceptions `wx-config --cflags`
+- -I/usr/include/wx-2.8 \
+- -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
++CPPFLAGS = -Wall -g -fexceptions `wx-config --cflags` \
++ -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES \
+ -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT
+
+ CXXFLAGS = -O2 -Wall -fexceptions `wx-config --cflags` \
diff --git a/pkgs/applications/audio/flac/default.nix b/pkgs/applications/audio/flac/default.nix
index 95ab8244478..0256eacc436 100644
--- a/pkgs/applications/audio/flac/default.nix
+++ b/pkgs/applications/audio/flac/default.nix
@@ -10,15 +10,14 @@ stdenv.mkDerivation rec {
buildInputs = [ libogg ];
- doCheck = true; # takes lots of time but will be run rarely (small build-time closure)
-
- enableParallelBuilding = true;
+ #doCheck = true; # takes lots of time
outputs = [ "dev" "out" "bin" "doc" ];
- meta = {
+ meta = with stdenv.lib; {
homepage = http://xiph.org/flac/;
description = "Library and tools for encoding and decoding the FLAC lossless audio file format";
- platforms = stdenv.lib.platforms.all;
+ platforms = platforms.all;
+ maintainers = maintainers.mornfall;
};
}
diff --git a/pkgs/applications/audio/fldigi/default.nix b/pkgs/applications/audio/fldigi/default.nix
new file mode 100644
index 00000000000..e78095a9c5d
--- /dev/null
+++ b/pkgs/applications/audio/fldigi/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, hamlib, fltk13, libjpeg, libpng, portaudio, libsndfile,
+ libsamplerate, pulseaudio, libXinerama, gettext, pkgconfig, alsaLib }:
+
+stdenv.mkDerivation rec {
+ version = "3.21.82";
+ pname = "fldigi";
+ name = "${pname}-${version}";
+
+ src = fetchurl {
+ url = "http://www.w1hkj.com/downloads/${pname}/${name}.tar.gz";
+ sha256 = "1q2fc1zm9kfsjir4g6fh95vmjdq984iyxfcs6q4gjqy1znhqcyqs";
+ };
+
+ buildInputs = [ libXinerama gettext hamlib fltk13 libjpeg libpng portaudio
+ libsndfile libsamplerate pulseaudio pkgconfig alsaLib ];
+
+ meta = {
+ description = "Digital modem program";
+ homepage = http://www.w1hkj.com/Fldigi.html;
+ license = stdenv.lib.licenses.gpl3Plus;
+ maintainers = with stdenv.lib.maintainers; [ relrod ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/fluidsynth/default.nix b/pkgs/applications/audio/fluidsynth/default.nix
index b0c5a88cb1a..8cba482194e 100644
--- a/pkgs/applications/audio/fluidsynth/default.nix
+++ b/pkgs/applications/audio/fluidsynth/default.nix
@@ -1,13 +1,13 @@
-{ stdenv, fetchurl, alsaLib, glib, jackaudio, libsndfile, pkgconfig
+{ stdenv, fetchurl, alsaLib, glib, jack2, libsndfile, pkgconfig
, pulseaudio }:
stdenv.mkDerivation rec {
name = "fluidsynth-${version}";
- version = "1.1.5";
+ version = "1.1.6";
src = fetchurl {
url = "mirror://sourceforge/fluidsynth/${name}.tar.bz2";
- sha256 = "1x73a5rsyvfmh1j0484kzgnk251q61g1g2jdja673l8fizi0xd24";
+ sha256 = "00gn93bx4cz9bfwf3a8xyj2by7w23nca4zxf09ll53kzpzglg2yj";
};
preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
"-framework CoreAudio";
buildInputs = [ glib libsndfile pkgconfig ]
- ++ stdenv.lib.optionals (!stdenv.isDarwin) [ alsaLib pulseaudio jackaudio ];
+ ++ stdenv.lib.optionals (!stdenv.isDarwin) [ alsaLib pulseaudio jack2 ];
meta = with stdenv.lib; {
description = "Real-time software synthesizer based on the SoundFont 2 specifications";
diff --git a/pkgs/applications/audio/gigedit/default.nix b/pkgs/applications/audio/gigedit/default.nix
index be6970f01e1..269b48aebb8 100644
--- a/pkgs/applications/audio/gigedit/default.nix
+++ b/pkgs/applications/audio/gigedit/default.nix
@@ -26,5 +26,6 @@ stdenv.mkDerivation rec {
description = "Gigasampler file access library";
license = licenses.gpl2;
maintainers = [ maintainers.goibhniu ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/gmpc/default.nix b/pkgs/applications/audio/gmpc/default.nix
index 10a2f0dcee9..728155c02bd 100644
--- a/pkgs/applications/audio/gmpc/default.nix
+++ b/pkgs/applications/audio/gmpc/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchurl, libtool, intltool, pkgconfig, glib
-, gtk, curl, mpd_clientlib, libsoup, gob2, vala
+, gtk, curl, mpd_clientlib, libsoup, gob2, vala, libunique
}:
stdenv.mkDerivation rec {
@@ -15,22 +15,6 @@ stdenv.mkDerivation rec {
buildInputs = [ pkgconfig glib ];
};
- libunique = stdenv.mkDerivation {
- name = "libunique-1.1.6";
- src = fetchurl {
- url = http://ftp.gnome.org/pub/GNOME/sources/libunique/1.1/libunique-1.1.6.tar.gz;
- sha256 = "2cb918dde3554228a211925ba6165a661fd782394bd74dfe15e3853dc9c573ea";
- };
- buildInputs = [ pkgconfig glib gtk ];
-
- patches = [
- (fetchurl {
- url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/remove_G_CONST_RETURN.patch?h=packages/libunique";
- sha256 = "0da2qi7cyyax4rr1p25drlhk360h8d3lapgypi5w95wj9k6bykhr";
- })
- ];
- };
-
src = fetchurl {
url = "http://download.sarine.nl/Programs/gmpc/11.8/gmpc-11.8.16.tar.gz";
sha256 = "0b3bnxf98i5lhjyljvgxgx9xmb6p46cn3a9cccrng14nagri9556";
diff --git a/pkgs/applications/audio/gmu/default.nix b/pkgs/applications/audio/gmu/default.nix
index e75be3e2c2b..f23ba66a3b5 100644
--- a/pkgs/applications/audio/gmu/default.nix
+++ b/pkgs/applications/audio/gmu/default.nix
@@ -30,6 +30,6 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://wejp.k.vu/projects/gmu;
description = "Open source music player for portable gaming consoles and handhelds";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/applications/audio/gpodder/default.nix b/pkgs/applications/audio/gpodder/default.nix
new file mode 100644
index 00000000000..19b61ebc76d
--- /dev/null
+++ b/pkgs/applications/audio/gpodder/default.nix
@@ -0,0 +1,45 @@
+{ pkgs, stdenv, fetchurl, python, buildPythonPackage, pythonPackages, mygpoclient, intltool,
+ ipodSupport ? true, libgpod, gpodderHome ? "", gpodderDownloadDir ? "" }:
+
+with pkgs.lib;
+
+let
+ inherit (pythonPackages) coverage feedparser minimock sqlite3 dbus pygtk eyeD3;
+
+in buildPythonPackage rec {
+ name = "gpodder-3.7.0";
+
+ src = fetchurl {
+ url = "http://gpodder.org/src/${name}.tar.gz";
+ sha256 = "fa90ef4bdd3fd9eef95404f7f43f70912ae3ab4f8d24078484a2f3e11b14dc47";
+ };
+
+ buildInputs = [ coverage feedparser minimock sqlite3 mygpoclient intltool ];
+
+ propagatedBuildInputs = [ feedparser dbus mygpoclient sqlite3 pygtk eyeD3 ]
+ ++ stdenv.lib.optional ipodSupport libgpod;
+
+ postPatch = "sed -ie 's/PYTHONPATH=src/PYTHONPATH=\$(PYTHONPATH):src/' makefile";
+
+ checkPhase = "make unittest";
+
+ preFixup = ''
+ wrapProgram $out/bin/gpodder \
+ ${optionalString (gpodderHome != "") "--set GPODDER_HOME ${gpodderHome}"} \
+ ${optionalString (gpodderDownloadDir != "") "--set GPODDER_DOWNLOAD_DIR ${gpodderDownloadDir}"}
+ '';
+
+ installPhase = "DESTDIR=/ PREFIX=$out make install";
+
+ meta = {
+ description = "A podcatcher written in python";
+ longDescription = ''
+ gPodder downloads and manages free audio and video content (podcasts)
+ for you. Listen directly on your computer or on your mobile devices.
+ '';
+ homepage = "http://gpodder.org/";
+ license = "GPLv3";
+ platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+ maintainers = [ stdenv.lib.maintainers.skeidel ];
+ };
+}
diff --git a/pkgs/applications/audio/gtkpod/default.nix b/pkgs/applications/audio/gtkpod/default.nix
index 90e27c12ce3..80a7cf52cd8 100644
--- a/pkgs/applications/audio/gtkpod/default.nix
+++ b/pkgs/applications/audio/gtkpod/default.nix
@@ -1,25 +1,43 @@
-{ stdenv, fetchurl, pkgconfig, libgpod, gtk, glib, gettext, perl, perlXMLParser
-, libglade, flex, libid3tag, libvorbis, intltool }:
+{ stdenv, fetchurl, pkgconfig, makeWrapper, intltool, libgpod, curl, flac,
+ gnome3_12, gtk3, glib, gettext, perl, perlXMLParser , libglade, flex, libid3tag,
+ libvorbis, hicolor_icon_theme, gdk_pixbuf }:
-stdenv.mkDerivation {
- name = "gtkpod-1.0.0";
+let
+ gnome = gnome3_12;
+
+in stdenv.mkDerivation rec {
+ version = "2.1.4";
+ name = "gtkpod-${version}";
src = fetchurl {
- url = mirror://sourceforge/gtkpod/gtkpod-1.0.0.tar.gz;
- sha256 = "04jzybs55c27kyp7r9c58prcq0q4ssvj5iggva857f49s1ar826q";
+ url = "mirror://sourceforge/gtkpod/${name}.tar.gz";
+ sha256 = "ba12b35f3f24a155b68f0ffdaf4d3c5c7d1b8df04843a53306e1c83fc811dfaa";
};
- buildInputs = [ pkgconfig libgpod gettext perl perlXMLParser gtk libglade flex
- libid3tag libvorbis intltool ];
+ propagatedUserEnvPkgs = [ gnome.gnome_themes_standard ];
+
+ buildInputs = [ pkgconfig makeWrapper intltool curl gettext perl perlXMLParser
+ flex libgpod libid3tag flac libvorbis gtk3 gdk_pixbuf libglade gnome.anjuta
+ gnome.gdl gnome.gnome_icon_theme_symbolic gnome.gnome_icon_theme
+ hicolor_icon_theme ];
patchPhase = ''
sed -i 's/which/type -P/' scripts/*.sh
'';
- meta = {
+ preFixup = ''
+ wrapProgram "$out/bin/gtkpod" \
+ --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
+ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gnome.gnome_themes_standard}/share:$out/share:$GSETTINGS_SCHEMAS_PATH"
+ '';
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
description = "GTK Manager for an Apple ipod";
homepage = http://gtkpod.sourceforge.net;
- license = "GPLv2+";
- platforms = with stdenv.lib.platforms; linux;
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.skeidel ];
};
}
diff --git a/pkgs/applications/audio/guitarix/default.nix b/pkgs/applications/audio/guitarix/default.nix
index 17d53a621ca..777c0ddb2e3 100644
--- a/pkgs/applications/audio/guitarix/default.nix
+++ b/pkgs/applications/audio/guitarix/default.nix
@@ -1,19 +1,20 @@
-{ stdenv, fetchurl, python, gettext, intltool, pkgconfig, jackaudio, libsndfile
-, glib, gtk, glibmm, gtkmm, fftw, librdf, ladspaH, boost }:
+{ stdenv, fetchurl, avahi, boost, fftw, gettext, glib, glibmm, gtk
+, gtkmm, intltool, jack2, ladspaH, librdf, libsndfile, lv2
+, pkgconfig, python }:
stdenv.mkDerivation rec {
name = "guitarix-${version}";
- version = "0.25.2";
+ version = "0.28.3";
src = fetchurl {
url = "mirror://sourceforge/guitarix/guitarix2-${version}.tar.bz2";
- sha256 = "1wcg3yc2iy72hj6z9l88393f00by0iwhhn8xrc3q55p4rj0mnrga";
+ sha256 = "0ks5avylyicqfj9l1wf4gj62i8m6is2jmp0h11h5l2wbg3xiwxjd";
};
- buildInputs =
- [ python gettext intltool pkgconfig jackaudio libsndfile glib gtk glibmm
- gtkmm fftw librdf ladspaH boost
- ];
+ buildInputs = [
+ avahi boost fftw gettext glib glibmm gtk gtkmm intltool jack2
+ ladspaH librdf libsndfile lv2 pkgconfig python
+ ];
configurePhase = "python waf configure --prefix=$out";
@@ -21,7 +22,7 @@ stdenv.mkDerivation rec {
installPhase = "python waf install";
- meta = {
+ meta = with stdenv.lib; {
description = "A virtual guitar amplifier for Linux running with JACK";
longDescription = ''
guitarix is a virtual guitar amplifier for Linux running with
@@ -46,8 +47,8 @@ stdenv.mkDerivation rec {
crazy sounds never heard before.
'';
homepage = http://guitarix.sourceforge.net/;
- license = stdenv.lib.licenses.gpl3Plus;
- maintainers = [ stdenv.lib.maintainers.astsmtl ];
- platforms = stdenv.lib.platforms.linux;
+ license = licenses.gpl3Plus;
+ maintainers = with maintainers; [ astsmtl goibhniu ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/hydrogen/default.nix b/pkgs/applications/audio/hydrogen/default.nix
index bb10f24b90a..10f15f5882c 100644
--- a/pkgs/applications/audio/hydrogen/default.nix
+++ b/pkgs/applications/audio/hydrogen/default.nix
@@ -1,17 +1,17 @@
-{ stdenv, fetchurl, alsaLib, boost, glib, jackaudio, ladspaPlugins
+{ stdenv, fetchurl, alsaLib, boost, glib, jack2, ladspaPlugins
, libarchive, liblrdf , libsndfile, pkgconfig, qt4, scons, subversion }:
stdenv.mkDerivation rec {
- version = "0.9.5";
+ version = "0.9.5.1";
name = "hydrogen-${version}";
src = fetchurl {
url = "mirror://sourceforge/hydrogen/hydrogen-${version}.tar.gz";
- sha256 = "1hyri49va2ss26skd6p9swkx0kbr7ggifbahkrcfgj8yj7pp6g4n";
+ sha256 = "1fvyp6gfzcqcc90dmaqbm11p272zczz5pfz1z4lj33nfr7z0bqgb";
};
buildInputs = [
- alsaLib boost glib jackaudio ladspaPlugins libarchive liblrdf
+ alsaLib boost glib jack2 ladspaPlugins libarchive liblrdf
libsndfile pkgconfig qt4 scons subversion
];
diff --git a/pkgs/applications/audio/id3v2/default.nix b/pkgs/applications/audio/id3v2/default.nix
index a7835f020d1..b96872c7ef0 100644
--- a/pkgs/applications/audio/id3v2/default.nix
+++ b/pkgs/applications/audio/id3v2/default.nix
@@ -23,6 +23,6 @@ stdenv.mkDerivation rec {
meta = {
description = "A command line editor for id3v2 tags";
homepage = http://id3v2.sourceforge.net/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
};
}
diff --git a/pkgs/applications/audio/ingen/default.nix b/pkgs/applications/audio/ingen/default.nix
new file mode 100644
index 00000000000..ac46ff6140c
--- /dev/null
+++ b/pkgs/applications/audio/ingen/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchsvn, boost, ganv, glibmm, gtk, gtkmm, jack2, lilv
+, lv2, pkgconfig, python, raul, serd, sord, sratom, suil
+}:
+
+stdenv.mkDerivation rec {
+ name = "ingen-svn-${rev}";
+ rev = "5317";
+
+ src = fetchsvn {
+ url = "http://svn.drobilla.net/lad/trunk/ingen";
+ rev = rev;
+ sha256 = "0zm3wbv9qsingjyr95nwin3khmnf3wq3fz2xa6p420dpcy6qnl4x";
+ };
+
+ buildInputs = [
+ boost ganv glibmm gtk gtkmm jack2 lilv lv2 pkgconfig python
+ raul serd sord sratom suil
+ ];
+
+ configurePhase = "python waf configure --prefix=$out";
+
+ buildPhase = "python waf";
+
+ installPhase = "python waf install";
+
+ meta = with stdenv.lib; {
+ description = "A modular audio processing system using JACK and LV2 or LADSPA plugins";
+ homepage = http://drobilla.net/software/ingen;
+ license = licenses.gpl3;
+ maintainers = [ maintainers.goibhniu ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/jack-capture/default.nix b/pkgs/applications/audio/jack-capture/default.nix
index 3b8f0f652a8..2e6f6b0dd82 100644
--- a/pkgs/applications/audio/jack-capture/default.nix
+++ b/pkgs/applications/audio/jack-capture/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, jackaudio, libsndfile, pkgconfig }:
+{ stdenv, fetchurl, jack2, libsndfile, pkgconfig }:
stdenv.mkDerivation rec {
name = "jack_capture-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "0sk7b92my1v1g7rhkpl1c608rb0rdb28m9zqfll95kflxajd16zv";
};
- buildInputs = [ jackaudio libsndfile pkgconfig ];
+ buildInputs = [ jack2 libsndfile pkgconfig ];
buildPhase = "PREFIX=$out make jack_capture";
diff --git a/pkgs/applications/audio/jack-oscrolloscope/default.nix b/pkgs/applications/audio/jack-oscrolloscope/default.nix
index dbceb0a336c..7b4d12a5b87 100644
--- a/pkgs/applications/audio/jack-oscrolloscope/default.nix
+++ b/pkgs/applications/audio/jack-oscrolloscope/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL, jackaudio, mesa, pkgconfig }:
+{ stdenv, fetchurl, SDL, jack2, mesa, pkgconfig }:
stdenv.mkDerivation rec {
name = "jack_oscrolloscope-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "1pl55in0sj7h5r06n1v91im7d18pplvhbjhjm1fdl39zwnyxiash";
};
- buildInputs = [ SDL jackaudio mesa pkgconfig ];
+ buildInputs = [ SDL jack2 mesa pkgconfig ];
installPhase = ''
mkdir -p $out/bin
diff --git a/pkgs/applications/audio/jack-rack/default.nix b/pkgs/applications/audio/jack-rack/default.nix
index 1d1128e663d..8ac47c570df 100644
--- a/pkgs/applications/audio/jack-rack/default.nix
+++ b/pkgs/applications/audio/jack-rack/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkgconfig, jackaudio, ladspaH, gtk, alsaLib, libxml2, librdf }:
+{ stdenv, fetchurl, pkgconfig, jack2, ladspaH, gtk, alsaLib, libxml2, librdf }:
stdenv.mkDerivation rec {
name = "jack-rack-1.4.7";
src = fetchurl {
url = "mirror://sourceforge/jack-rack/${name}.tar.bz2";
sha256 = "1lmibx9gicagcpcisacj6qhq6i08lkl5x8szysjqvbgpxl9qg045";
};
- buildInputs = [ pkgconfig jackaudio ladspaH gtk alsaLib libxml2 librdf ];
+ buildInputs = [ pkgconfig jack2 ladspaH gtk alsaLib libxml2 librdf ];
meta = {
description = ''An effects "rack" for the JACK low latency audio API'';
diff --git a/pkgs/applications/audio/jackmeter/default.nix b/pkgs/applications/audio/jackmeter/default.nix
index 97c39982a65..74d98184d9d 100644
--- a/pkgs/applications/audio/jackmeter/default.nix
+++ b/pkgs/applications/audio/jackmeter/default.nix
@@ -1,19 +1,19 @@
-{ stdenv, fetchurl, jackaudio, pkgconfig }:
+{ stdenv, fetchurl, jack2, pkgconfig }:
stdenv.mkDerivation rec {
- name = "jackmeter-0.3";
+ name = "jackmeter-0.4";
src = fetchurl {
url = "http://www.aelius.com/njh/jackmeter/${name}.tar.gz";
- sha256 = "03siznnq3f0nnqyighgw9qdq1y4bfrrxs0mk6394pza3sz4b6sgp";
+ sha256 = "1cnvgx3jv0yvxlqy0l9k285zgvazmh5k8m4l7lxckjfm5bn6hm1r";
};
- buildInputs = [ jackaudio pkgconfig ];
+ buildInputs = [ jack2 pkgconfig ];
meta = {
description = "Console jack loudness meter";
homepage = http://www.aelius.com/njh/jackmeter/;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.marcweber ];
platforms = stdenv.lib.platforms.linux;
};
diff --git a/pkgs/applications/audio/jalv/default.nix b/pkgs/applications/audio/jalv/default.nix
index 5655c7d832b..70ef5bdec5c 100644
--- a/pkgs/applications/audio/jalv/default.nix
+++ b/pkgs/applications/audio/jalv/default.nix
@@ -1,17 +1,17 @@
-{ stdenv, fetchurl, gtk, jackaudio, lilv, lv2, pkgconfig, python
+{ stdenv, fetchurl, gtk, jack2, lilv, lv2, pkgconfig, python
, serd, sord , sratom, suil }:
stdenv.mkDerivation rec {
name = "jalv-${version}";
- version = "1.4.0";
+ version = "1.4.4";
src = fetchurl {
url = "http://download.drobilla.net/${name}.tar.bz2";
- sha256 = "1hq968fhiz86428krqhjl3vlw71bigc9bsfcv97zgvsjh0fh6qa0";
+ sha256 = "1iql1r52rmf87q6jkxhcxa3lpq7idzzg55ma91wphywyvh29q7lf";
};
buildInputs = [
- gtk jackaudio lilv lv2 pkgconfig python serd sord sratom suil
+ gtk jack2 lilv lv2 pkgconfig python serd sord sratom suil
];
configurePhase = "python waf configure --prefix=$out";
@@ -25,5 +25,6 @@ stdenv.mkDerivation rec {
homepage = http://drobilla.net/software/jalv;
license = licenses.isc;
maintainers = [ maintainers.goibhniu ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/ladspa-plugins/ladspah.nix b/pkgs/applications/audio/ladspa-plugins/ladspah.nix
index 30ba34af16c..8c4d8a8c1ed 100644
--- a/pkgs/applications/audio/ladspa-plugins/ladspah.nix
+++ b/pkgs/applications/audio/ladspa-plugins/ladspah.nix
@@ -1,28 +1,17 @@
-{ stdenv, fetchurl, builderDefs }:
+{ runCommand, fetchurl }:
+
+let
-let
src = fetchurl {
url = http://www.ladspa.org/ladspa_sdk/ladspa.h.txt;
sha256 = "1b908csn85ng9sz5s5d1mqk711cmawain2z8px2ajngihdrynb67";
};
+
in
- let localDefs = builderDefs.passthru.function {
- buildInputs = [];
- inherit src;
- };
- in with localDefs;
-let
- copyFile = fullDepEntry ("
- mkdir -p \$out/include
- cp ${src} \$out/include/ladspa.h
- ") [minInit defEnsureDir];
-in
-stdenv.mkDerivation {
- name = "ladspa.h";
- builder = writeScript "ladspa.h-builder"
- (textClosure localDefs [copyFile]);
- meta = {
- description = "LADSPA format audio plugins";
- inherit src;
- };
-}
+
+runCommand "ladspa.h"
+ { meta.description = "LADSPA format audio plugins"; }
+ ''
+ mkdir -p $out/include
+ cp ${src} $out/include/ladspa.h
+ ''
diff --git a/pkgs/applications/audio/lash/default.nix b/pkgs/applications/audio/lash/default.nix
index 72087c76b05..e42babf13ef 100644
--- a/pkgs/applications/audio/lash/default.nix
+++ b/pkgs/applications/audio/lash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, gtk, jackaudio, libuuid, libxml2
+{ stdenv, fetchurl, alsaLib, gtk, jack2, libuuid, libxml2
, makeWrapper, pkgconfig, readline }:
assert libuuid != null;
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
# http://permalink.gmane.org/gmane.linux.redhat.fedora.extras.cvs/822346
patches = [ ./socket.patch ./gcc-47.patch ];
- buildInputs = [ alsaLib gtk jackaudio libuuid libxml2 makeWrapper
+ buildInputs = [ alsaLib gtk jack2 libuuid libxml2 makeWrapper
pkgconfig readline ];
postInstall = ''
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
'';
meta = with stdenv.lib; {
- description = "LASH Audio Session Handler";
+ description = "A Linux Audio Session Handler";
longDescription = ''
Session management system for GNU/Linux audio applications.
'';
diff --git a/pkgs/applications/audio/lastfmsubmitd/default.nix b/pkgs/applications/audio/lastfmsubmitd/default.nix
new file mode 100644
index 00000000000..314361329c7
--- /dev/null
+++ b/pkgs/applications/audio/lastfmsubmitd/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pythonPackages }:
+
+pythonPackages.buildPythonPackage rec {
+ name = "lastfmsubmitd-${version}";
+ namePrefix = "";
+ version = "1.0.6";
+
+ src = fetchurl {
+ url = "http://www.red-bean.com/decklin/lastfmsubmitd/lastfmsubmitd-${version}.tar.gz";
+ sha256 = "c2636d5095a95167366bacd458624d67b046e060244fa54ba2c2e3efb79f9b0e";
+ };
+
+ doCheck = false;
+
+ installCommand = "python setup.py install --prefix=$out";
+
+ meta = {
+ homepage = "http://www.red-bean.com/decklin/lastfmsubmitd/";
+ description = "An last.fm audio scrobbler and daemon";
+ };
+}
diff --git a/pkgs/applications/audio/lastwatch/default.nix b/pkgs/applications/audio/lastwatch/default.nix
index 324a0b0bebc..2cffb0ebacf 100644
--- a/pkgs/applications/audio/lastwatch/default.nix
+++ b/pkgs/applications/audio/lastwatch/default.nix
@@ -19,11 +19,10 @@ pythonPackages.buildPythonPackage rec {
propagatedBuildInputs = pythonPath;
- installCommand = "python setup.py install --prefix=$out";
-
meta = {
homepage = "https://github.com/aszlig/LastWatch";
description = "An inotify-based last.fm audio scrobbler";
license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/audio/lingot/default.nix b/pkgs/applications/audio/lingot/default.nix
index 44d946af2db..4b07c84b0be 100644
--- a/pkgs/applications/audio/lingot/default.nix
+++ b/pkgs/applications/audio/lingot/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, pkgconfig, intltool, gtk, alsaLib, libglade }:
stdenv.mkDerivation {
- name = "lingot-0.9.0";
+ name = "lingot-0.9.1";
src = fetchurl {
- url = mirror://savannah/lingot/lingot-0.9.0.tar.gz;
- sha256 = "07z129lp8m4sz608q409wb11c639w7cbn497r7bscgg08p6c07xb";
+ url = mirror://savannah/lingot/lingot-0.9.1.tar.gz;
+ sha256 = "0ygras6ndw2fylwxx86ac11pcr2y2bcfvvgiwrh92z6zncx254gc";
};
buildInputs = [ pkgconfig intltool gtk alsaLib libglade ];
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
meta = {
description = "Not a Guitar-Only tuner";
homepage = http://www.nongnu.org/lingot/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = with stdenv.lib.platforms; linux;
maintainers = with stdenv.lib.maintainers; [viric];
};
diff --git a/pkgs/applications/audio/linuxsampler/default.nix b/pkgs/applications/audio/linuxsampler/default.nix
index 1408a1775ee..2c4b26543eb 100644
--- a/pkgs/applications/audio/linuxsampler/default.nix
+++ b/pkgs/applications/audio/linuxsampler/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchsvn, alsaLib, asio, autoconf, automake, bison
-, jackaudio, libgig, libsndfile, libtool, lv2, pkgconfig }:
+, jack2, libgig, libsndfile, libtool, lv2, pkgconfig }:
stdenv.mkDerivation rec {
name = "linuxsampler-svn-${version}";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
'';
buildInputs = [
- alsaLib asio autoconf automake bison jackaudio libgig libsndfile
+ alsaLib asio autoconf automake bison jack2 libgig libsndfile
libtool lv2 pkgconfig
];
diff --git a/pkgs/applications/audio/lmms/default.nix b/pkgs/applications/audio/lmms/default.nix
index 8cdb99412f4..dd0649811bb 100644
--- a/pkgs/applications/audio/lmms/default.nix
+++ b/pkgs/applications/audio/lmms/default.nix
@@ -1,17 +1,25 @@
-{ stdenv, fetchurl, SDL, alsaLib, cmake, fftw, jackaudio, libogg,
-libsamplerate, libsndfile, pkgconfig, pulseaudio, qt4 }:
+{ stdenv, fetchurl, SDL, alsaLib, cmake, fftwSinglePrec, jack2, libogg
+, libsamplerate, libsndfile, pkgconfig, pulseaudio, qt4, freetype
+}:
stdenv.mkDerivation rec {
name = "lmms-${version}";
- version = "0.4.10";
+ version = "0.4.15";
src = fetchurl {
url = "mirror://sourceforge/lmms/${name}.tar.bz2";
- sha256 = "035cqmxcbr9ipnicdv5l7h05q2hqbavxkbaxyq06ppnv2y7fxwrb";
+ sha256 = "02q2gbsqwk3hf9kvzz58a5bxmlb4cfr2mzy41wdvbxxdm2pcl101";
};
- buildInputs = [ SDL alsaLib cmake fftw jackaudio libogg
- libsamplerate libsndfile pkgconfig pulseaudio qt4 ];
+ buildInputs = [
+ SDL alsaLib cmake fftwSinglePrec jack2 libogg libsamplerate
+ libsndfile pkgconfig pulseaudio qt4
+ ];
+
+ # work around broken build system of 0.4.*
+ NIX_CFLAGS_COMPILE = "-I${freetype}/include/freetype2";
+
+ enableParallelBuilding = true;
meta = with stdenv.lib; {
description = "Linux MultiMedia Studio";
diff --git a/pkgs/applications/audio/mda-lv2/default.nix b/pkgs/applications/audio/mda-lv2/default.nix
index 8b7d5527372..9d3cdc2eea3 100644
--- a/pkgs/applications/audio/mda-lv2/default.nix
+++ b/pkgs/applications/audio/mda-lv2/default.nix
@@ -2,11 +2,11 @@
stdenv.mkDerivation rec {
name = "mda-lv2-${version}";
- version = "1.0.0";
+ version = "1.2.2";
src = fetchurl {
url = "http://download.drobilla.net/${name}.tar.bz2";
- sha256 = "1dbgvpz9qvlwsfkq9c0dx45bm223wwrzgiddlyln1agpns3qbf0f";
+ sha256 = "0hh40c5d2m0k5gb3vw031l6lqn59dg804an3mkmhkc7qv4gc6xm4";
};
buildInputs = [ fftwSinglePrec lv2 pkgconfig python ];
diff --git a/pkgs/applications/audio/mhwaveedit/default.nix b/pkgs/applications/audio/mhwaveedit/default.nix
index 8f8fadb02e4..a1e81be3cb3 100644
--- a/pkgs/applications/audio/mhwaveedit/default.nix
+++ b/pkgs/applications/audio/mhwaveedit/default.nix
@@ -1,17 +1,17 @@
-{ stdenv, fetchurl, SDL , alsaLib, gtk, jackaudio, ladspaH
+{ stdenv, fetchurl, SDL , alsaLib, gtk, jack2, ladspaH
, ladspaPlugins, libsamplerate, libsndfile, pkgconfig, pulseaudio }:
stdenv.mkDerivation rec {
name = "mhwaveedit-${version}";
- version = "1.4.21";
+ version = "1.4.23";
src = fetchurl {
url = "http://download.gna.org/mhwaveedit/${name}.tar.bz2";
- sha256 = "0jl7gvhwsz4fcn5d146h4m6i3hlxdsw4mmj280cv9g70p6zqi1w7";
+ sha256 = "010rk4mr631s440q9cfgdxx2avgzysr9aq52diwdlbq9cddifli3";
};
buildInputs =
- [ SDL alsaLib gtk jackaudio ladspaH libsamplerate libsndfile
+ [ SDL alsaLib gtk jack2 ladspaH libsamplerate libsndfile
pkgconfig pulseaudio
];
diff --git a/pkgs/applications/audio/mid2key/default.nix b/pkgs/applications/audio/mid2key/default.nix
index 1e163391a39..26ea2c7b0b2 100644
--- a/pkgs/applications/audio/mid2key/default.nix
+++ b/pkgs/applications/audio/mid2key/default.nix
@@ -21,5 +21,6 @@ stdenv.mkDerivation rec {
description = "A simple tool which maps midi notes to simulated keystrokes";
license = licenses.gpl3;
maintainers = [ maintainers.goibhniu ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/mikmod/default.nix b/pkgs/applications/audio/mikmod/default.nix
index a86e09278c3..f38ff469731 100644
--- a/pkgs/applications/audio/mikmod/default.nix
+++ b/pkgs/applications/audio/mikmod/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Tracker music player for the terminal";
homepage = http://mikmod.shlomifish.org/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [ viric ];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/audio/milkytracker/decompressor_gzip.patch b/pkgs/applications/audio/milkytracker/decompressor_gzip.patch
new file mode 100644
index 00000000000..c64421116de
--- /dev/null
+++ b/pkgs/applications/audio/milkytracker/decompressor_gzip.patch
@@ -0,0 +1,20 @@
+https://bugs.archlinux.org/task/31324
+https://410333.bugs.gentoo.org/attachment.cgi?id=322456
+
+diff -ur src.old/compression/DecompressorGZIP.cpp src/compression/DecompressorGZIP.cpp
+--- src.old/compression/DecompressorGZIP.cpp 2012-08-28 17:54:46.000000000 +0200
++++ src/compression/DecompressorGZIP.cpp 2012-08-28 17:55:21.000000000 +0200
+@@ -57,11 +57,11 @@
+
+ bool DecompressorGZIP::decompress(const PPSystemString& outFileName, Hints hint)
+ {
+- gzFile *gz_input_file = NULL;
++ gzFile gz_input_file = NULL;
+ int len = 0;
+ pp_uint8 *buf;
+
+- if ((gz_input_file = (void **)gzopen (fileName.getStrBuffer(), "r")) == NULL)
++ if ((gz_input_file = gzopen (fileName.getStrBuffer(), "r")) == NULL)
+ return false;
+
+ if ((buf = new pp_uint8[0x10000]) == NULL)
diff --git a/pkgs/applications/audio/milkytracker/default.nix b/pkgs/applications/audio/milkytracker/default.nix
new file mode 100644
index 00000000000..eadbaabcf56
--- /dev/null
+++ b/pkgs/applications/audio/milkytracker/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchurl, SDL, alsaLib, autoconf, automake, jack2, perl
+, zlib, zziplib
+}:
+
+stdenv.mkDerivation rec {
+ version = "0.90.85";
+ name = "milkytracker-${version}";
+
+ src = fetchurl {
+ url = "http://milkytracker.org/files/milkytracker-0.90.85.tar.gz";
+ sha256 = "184pk0k9nv461a61sh6lb62wfadjwwk8ri3z5kpdbqnyssz0zfpv";
+ };
+
+ # Get two official patches.
+ no_zzip_patch = fetchurl {
+ url = "http://www.milkytracker.org/files/patches-0.90.85/no_zziplib_dep.patch";
+ sha256 = "1w550q7pxa7w6v2v19ljk03hayacrs6y887izg11a1983wk7qzb3";
+ };
+
+ fix_64bit_patch = fetchurl {
+ url = "http://www.milkytracker.org/files/patches-0.90.85/64bit_freebsd_fix.patch";
+ sha256 = "0gwd4zslbd8kih80k4v7n2c65kvm2cq3kl6d7y33z1l007vzyvf6";
+ };
+
+ patchPhase = ''
+ patch ./src/tracker/sdl/SDL_Main.cpp < ${fix_64bit_patch}
+ patch < ${no_zzip_patch}
+ patch ./src/compression/DecompressorGZIP.cpp < ${./decompressor_gzip.patch}
+ '';
+
+ preBuild=''
+ export CPATH=${zlib}/lib
+ '';
+
+ buildInputs = [ SDL alsaLib autoconf automake jack2 perl zlib zziplib ];
+
+ meta = {
+ description = "Music tracker application, similar to Fasttracker II.";
+ homepage = http://milkytracker.org;
+ license = stdenv.lib.licenses.gpl3Plus;
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ maintainers = [ stdenv.lib.maintainers.zoomulator ];
+ };
+}
diff --git a/pkgs/applications/audio/minimodem/default.nix b/pkgs/applications/audio/minimodem/default.nix
new file mode 100644
index 00000000000..6f2bf8cdb1c
--- /dev/null
+++ b/pkgs/applications/audio/minimodem/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, pkgconfig, fftw, fftwSinglePrec, alsaLib, libsndfile, pulseaudio }:
+
+stdenv.mkDerivation rec {
+ version = "0.19";
+ pname = "minimodem";
+ name = "${pname}-${version}";
+
+ src = fetchurl {
+ url = "http://www.whence.com/${pname}/${name}.tar.gz";
+ sha256 = "003xyqjq59wcjafrdv1b8w34xsn4nvzz51wwd7mqddajh0g4dz4g";
+ };
+
+ buildInputs = [ pkgconfig fftw fftwSinglePrec alsaLib libsndfile pulseaudio ];
+
+ meta = {
+ description = "General-purpose software audio FSK modem";
+ longDescription = ''
+ Minimodem is a command-line program which decodes (or generates) audio
+ modem tones at any specified baud rate, using various framing protocols. It
+ acts a general-purpose software FSK modem, and includes support for various
+ standard FSK protocols such as Bell103, Bell202, RTTY, NOAA SAME, and
+ Caller-ID.
+ '';
+ homepage = http://www.whence.com/minimodem/;
+ license = stdenv.lib.licenses.gpl3Plus;
+ platforms = with stdenv.lib.platforms; linux;
+ maintainers = with stdenv.lib.maintainers; [ relrod ];
+ };
+}
diff --git a/pkgs/applications/audio/mixxx/default.nix b/pkgs/applications/audio/mixxx/default.nix
index b76eecc9e4a..e3422d4ba06 100644
--- a/pkgs/applications/audio/mixxx/default.nix
+++ b/pkgs/applications/audio/mixxx/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
buildPhase = ''
runHook preBuild
- ensureDir "$out"
+ mkdir -p "$out"
scons \
-j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \
$sconsFlags "prefix=$out"
diff --git a/pkgs/applications/audio/moc/default.nix b/pkgs/applications/audio/moc/default.nix
new file mode 100644
index 00000000000..e5264f5c3d2
--- /dev/null
+++ b/pkgs/applications/audio/moc/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, ncurses, pkgconfig, alsaLib, flac, libmad, speex, ffmpeg
+, libvorbis, mpc, libsndfile, jack2, db, libmodplug, timidity, libid3tag
+, libtool
+}:
+
+stdenv.mkDerivation rec {
+ name = "moc-${version}";
+ version = "2.5.0-beta2";
+
+ src = fetchurl {
+ url = "http://ftp.daper.net/pub/soft/moc/unstable/moc-${version}.tar.bz2";
+ sha256 = "486d50584c3fb0067b8c03af54e44351633a7740b18dc3b7358322051467034c";
+ };
+
+ configurePhase = "./configure prefix=$out";
+
+ buildInputs = [
+ ncurses pkgconfig alsaLib flac libmad speex ffmpeg libvorbis
+ mpc libsndfile jack2 db libmodplug timidity libid3tag libtool
+ ];
+
+ meta = {
+ description = "MOC (music on console) is a console audio player for LINUX/UNIX designed to be powerful and easy to use.";
+ homepage = http://moc.daper.net/;
+ license = stdenv.lib.licenses.gpl2;
+ };
+}
diff --git a/pkgs/applications/audio/monkeys-audio/default.nix b/pkgs/applications/audio/monkeys-audio/default.nix
index 48b0b52c5ea..08aa7e017b2 100644
--- a/pkgs/applications/audio/monkeys-audio/default.nix
+++ b/pkgs/applications/audio/monkeys-audio/default.nix
@@ -11,4 +11,9 @@ stdenv.mkDerivation rec {
url = "http://deb-multimedia.org/pool/main/m/${pname}/${pname}_${version}.orig.tar.gz";
sha256 = "0kjfwzfxfx7f958b2b1kf8yj655lp0ppmn0sh57gbkjvj8lml7nz";
};
+
+ meta = with stdenv.lib; {
+ platforms = platforms.linux;
+ maintainers = maintainers.mornfall;
+ };
}
diff --git a/pkgs/applications/audio/mopidy-moped/default.nix b/pkgs/applications/audio/mopidy-moped/default.nix
new file mode 100644
index 00000000000..c50a1798b47
--- /dev/null
+++ b/pkgs/applications/audio/mopidy-moped/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pythonPackages, mopidy }:
+
+pythonPackages.buildPythonPackage rec {
+ name = "mopidy-moped-${version}";
+
+ version = "0.3.3";
+
+ src = fetchurl {
+ url = "https://github.com/martijnboland/moped/archive/v${version}.tar.gz";
+ sha256 = "19f3asqx7wmla53nhrxzdwj6qlkjv2rcwh34jxp27bz7nkhn0ihv";
+ };
+
+ propagatedBuildInputs = [ mopidy ];
+
+ doCheck = false;
+
+ meta = with stdenv.lib; {
+ homepage = https://github.com/martijnboland/moped;
+ description = "A web client for Mopidy";
+ license = licenses.mit;
+ maintainers = [ maintainers.rickynils ];
+ hydraPlatforms = [];
+ };
+}
diff --git a/pkgs/applications/audio/mopidy-spotify/default.nix b/pkgs/applications/audio/mopidy-spotify/default.nix
new file mode 100644
index 00000000000..6223ffb0d81
--- /dev/null
+++ b/pkgs/applications/audio/mopidy-spotify/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pythonPackages, mopidy }:
+
+pythonPackages.buildPythonPackage rec {
+ name = "mopidy-spotify-${version}";
+
+ version = "1.2.0";
+
+ src = fetchurl {
+ url = "https://github.com/mopidy/mopidy-spotify/archive/v${version}.tar.gz";
+ sha256 = "1fgxakylsx0nggis11v6bxfy8h3dl1n1v86liyfcj0xazb1mx69m";
+ };
+
+ propagatedBuildInputs = [ mopidy pythonPackages.pyspotify ];
+
+ doCheck = false;
+
+ meta = with stdenv.lib; {
+ homepage = http://www.mopidy.com/;
+ description = "Mopidy extension for playing music from Spotify.";
+ license = licenses.asl20;
+ maintainers = [ maintainers.rickynils ];
+ hydraPlatforms = [];
+ };
+}
diff --git a/pkgs/applications/audio/mopidy/default.nix b/pkgs/applications/audio/mopidy/default.nix
index 611d9f4226d..bbdd1f05fde 100644
--- a/pkgs/applications/audio/mopidy/default.nix
+++ b/pkgs/applications/audio/mopidy/default.nix
@@ -5,40 +5,33 @@
pythonPackages.buildPythonPackage rec {
name = "mopidy-${version}";
- version = "0.15.0";
+ version = "0.19.3";
src = fetchurl {
url = "https://github.com/mopidy/mopidy/archive/v${version}.tar.gz";
- sha256 = "1fpnddcx6343wgxzh10s035w21g8jmfh2kzgx32w0xsshpra3gn1";
+ sha256 = "0rjq69vqak1d6fhvih259wmwp50xgr6x0x5nd0hl6hlkbbysc8dp";
};
propagatedBuildInputs = with pythonPackages; [
- gst_python pygobject pykka pyspotify pylast cherrypy ws4py
+ gst_python pygobject pykka tornado gst_plugins_base gst_plugins_good
];
- # python zip complains about old timestamps
- preConfigure = ''
- find -print0 | xargs -0 touch
- '';
-
# There are no tests
doCheck = false;
postInstall = ''
- for p in $out/bin/mopidy $out/bin/mopidy-scan; do
- wrapProgram $p \
- --prefix GST_PLUGIN_PATH : ${gst_plugins_good}/lib/gstreamer-0.10 \
- --prefix GST_PLUGIN_PATH : ${gst_plugins_base}/lib/gstreamer-0.10
- done
+ wrapProgram $out/bin/mopidy \
+ --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH"
'';
- meta = {
+ meta = with stdenv.lib; {
homepage = http://www.mopidy.com/;
description = ''
- A music server which can play music from Spotify and from your
- local hard drive.
+ An extensible music server that plays music from local disk, Spotify,
+ SoundCloud, Google Play Music, and more.
'';
- maintainers = [ stdenv.lib.maintainers.rickynils ];
- platforms = [];
+ license = licenses.asl20;
+ maintainers = [ maintainers.rickynils ];
+ hydraPlatforms = [];
};
}
diff --git a/pkgs/applications/audio/mp3info/default.nix b/pkgs/applications/audio/mp3info/default.nix
index d5a8138a500..0f33726eaee 100644
--- a/pkgs/applications/audio/mp3info/default.nix
+++ b/pkgs/applications/audio/mp3info/default.nix
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
homepage = http://www.ibiblio.org/mp3info/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.unix;
diff --git a/pkgs/applications/audio/mp3splt/default.nix b/pkgs/applications/audio/mp3splt/default.nix
new file mode 100644
index 00000000000..b1970a998d5
--- /dev/null
+++ b/pkgs/applications/audio/mp3splt/default.nix
@@ -0,0 +1,20 @@
+{ fetchurl, stdenv, libmp3splt, pkgconfig }:
+
+stdenv.mkDerivation rec {
+ name = "mp3splt-2.6.1";
+
+ src = fetchurl {
+ url = "http://prdownloads.sourceforge.net/mp3splt/${name}.tar.gz";
+ sha256 = "783a903fafbcf47f06673136a78b78d32a8e616a6ae06b79b459a32090dd14f7";
+ };
+
+ buildInputs = [ libmp3splt pkgconfig ];
+
+ meta = {
+ description = "utility to split mp3, ogg vorbis and FLAC files without decoding";
+ homepage = http://sourceforge.net/projects/mp3splt/;
+ license = "GPLv2";
+ maintainers = [ stdenv.lib.maintainers.bosu ];
+ platforms = stdenv.lib.platforms.unix;
+ };
+}
diff --git a/pkgs/applications/audio/mpc/default.nix b/pkgs/applications/audio/mpc/default.nix
index bd21550a64c..54ae5476efd 100755
--- a/pkgs/applications/audio/mpc/default.nix
+++ b/pkgs/applications/audio/mpc/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchurl, mpd_clientlib }:
stdenv.mkDerivation rec {
- version = "0.23";
+ version = "0.25";
name = "mpc-${version}";
src = fetchurl {
- url = "http://www.musicpd.org/download/mpc/0/${name}.tar.bz2";
- sha256 = "1ir96wfgq5qfdd2s06zfycv38g3bhn3bpndwx9hwf1w507rvifi9";
+ url = "http://www.musicpd.org/download/mpc/0/${name}.tar.xz";
+ sha256 = "095gmik5vrnab5a1g92qiznn48w7499fr0gldp3s6xd26kvs9kvh";
};
buildInputs = [ mpd_clientlib ];
@@ -20,8 +20,8 @@ stdenv.mkDerivation rec {
meta = {
description = "A minimalist command line interface to MPD";
homepage = http://www.musicpd.org/clients/mpc/;
- license = "GPL2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.algorith ];
platforms = stdenv.lib.platforms.linux;
};
-}
\ No newline at end of file
+}
diff --git a/pkgs/applications/audio/mpc123/default.nix b/pkgs/applications/audio/mpc123/default.nix
index 2f00638961c..cd4343b1beb 100644
--- a/pkgs/applications/audio/mpc123/default.nix
+++ b/pkgs/applications/audio/mpc123/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
description = "mpc123, a Musepack (.mpc) audio player";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ ];
platforms = stdenv.lib.platforms.gnu; # arbitrary choice
diff --git a/pkgs/applications/audio/mpg123/default.nix b/pkgs/applications/audio/mpg123/default.nix
index 029c2ba4bcd..3edb7ae6793 100644
--- a/pkgs/applications/audio/mpg123/default.nix
+++ b/pkgs/applications/audio/mpg123/default.nix
@@ -1,11 +1,11 @@
{stdenv, fetchurl, alsaLib }:
stdenv.mkDerivation {
- name = "mpg123-1.15.4";
+ name = "mpg123-1.19.0";
src = fetchurl {
- url = mirror://sourceforge/mpg123/mpg123-1.15.4.tar.bz2;
- sha256 = "05aizspky9mp1bq2lfrkjzrsnjykl7gkbrhn93xcarj5b2izv1b8";
+ url = mirror://sourceforge/mpg123/mpg123-1.19.0.tar.bz2;
+ sha256 = "06xhd68mj9yp0r6l771aq0d7xgnl402a3wm2mvhxmd3w3ph29446";
};
buildInputs = stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
diff --git a/pkgs/applications/audio/mpg321/default.nix b/pkgs/applications/audio/mpg321/default.nix
index ffec1a5736c..e58397350cb 100644
--- a/pkgs/applications/audio/mpg321/default.nix
+++ b/pkgs/applications/audio/mpg321/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
meta = {
description = "mpg321, a command-line MP3 player";
homepage = http://mpg321.sourceforge.net/;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [ ];
platforms = stdenv.lib.platforms.gnu;
};
diff --git a/pkgs/applications/audio/ncmpc/default.nix b/pkgs/applications/audio/ncmpc/default.nix
new file mode 100755
index 00000000000..94fa50a8883
--- /dev/null
+++ b/pkgs/applications/audio/ncmpc/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, pkgconfig, glib, ncurses, mpd_clientlib, libintlOrEmpty }:
+
+stdenv.mkDerivation rec {
+ version = "0.23";
+ name = "ncmpc-${version}";
+
+ src = fetchurl {
+ url = "http://www.musicpd.org/download/ncmpc/0/ncmpc-${version}.tar.xz";
+ sha256 = "d7b30cefaf5c74a5d8ab18ab8275e0102ae12e8ee6d6f8144f8e4cc9a97b5de4";
+ };
+
+ buildInputs = [ pkgconfig glib ncurses mpd_clientlib ]
+ ++ libintlOrEmpty;
+
+ NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lintl";
+
+ meta = with stdenv.lib; {
+ description = "Curses-based interface for MPD (music player daemon)";
+ homepage = http://www.musicpd.org/clients/ncmpc/;
+ license = licenses.gpl2Plus;
+ maintainers = with maintainers; [ _1126 ];
+ platforms = platforms.all;
+ };
+}
+
diff --git a/pkgs/applications/audio/opus-tools/default.nix b/pkgs/applications/audio/opus-tools/default.nix
index a543aa32eea..791763ced36 100644
--- a/pkgs/applications/audio/opus-tools/default.nix
+++ b/pkgs/applications/audio/opus-tools/default.nix
@@ -1,13 +1,13 @@
-{stdenv, fetchurl, libogg, libao, pkgconfig, libopus}:
+{stdenv, fetchurl, libogg, libao, pkgconfig, libopus, flac}:
stdenv.mkDerivation rec {
- name = "opus-tools-0.1.6";
+ name = "opus-tools-0.1.8";
src = fetchurl {
url = "http://downloads.xiph.org/releases/opus/${name}.tar.gz";
- sha256 = "1hd2ych34y3qy4rj4hd5cp29ixy891afizlsxphsfvfplk1dp1nc";
+ sha256 = "1xm2lhdz92n9zmk496lyagisyzja46kx8q340vay9i51krbqiqg4";
};
- buildInputs = [ libogg libao pkgconfig libopus ];
+ buildInputs = [ libogg libao pkgconfig libopus flac ];
meta = {
description = "Tools to work with opus encoded audio streams";
diff --git a/pkgs/applications/audio/opusfile/default.nix b/pkgs/applications/audio/opusfile/default.nix
new file mode 100644
index 00000000000..50df35b974f
--- /dev/null
+++ b/pkgs/applications/audio/opusfile/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl, pkgconfig, openssl, libogg, libopus}:
+
+stdenv.mkDerivation rec {
+ name = "opusfile-0.4";
+ src = fetchurl {
+ url = "http://downloads.xiph.org/releases/opus/${name}.tar.gz";
+ sha256 = "0h4iwyqgid0cibqwzckz3r94qfp09099nk1cx5nz6i3cf08yldlq";
+ };
+
+ buildInputs = [ pkgconfig openssl libogg libopus ];
+
+ meta = {
+ description = "High-level API for decoding and seeking in .opus files";
+ homepage = http://www.opus-codec.org/;
+ license = "BSD";
+ };
+}
diff --git a/pkgs/applications/audio/pamixer/default.nix b/pkgs/applications/audio/pamixer/default.nix
new file mode 100644
index 00000000000..acdda1799d0
--- /dev/null
+++ b/pkgs/applications/audio/pamixer/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchgit, pulseaudio, boost }:
+
+let
+ tag = "1.1";
+in
+
+stdenv.mkDerivation rec {
+
+ name = "pamixer-${tag}";
+
+ src = fetchgit {
+ url = git://github.com/cdemoulins/pamixer;
+ rev = "refs/tags/${tag}";
+ sha256 = "03r0sbfj85wp6yxa87pjg69ivmk0mxxa2nykr8gf2c607igmb034";
+ };
+
+ buildInputs = [ pulseaudio boost ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp pamixer $out/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "pamixer is like amixer but for pulseaudio.";
+ longDescription = "Features:
+ - Get the current volume of the default sink, the default source or a selected one by his id
+ - Set the volume for the default sink, the default source or any other device
+ - List the sinks
+ - List the sources
+ - Increase / Decrease the volume for a device
+ - Mute or unmute a device";
+ homepage = https://github.com/cdemoulins/pamixer;
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ maintainers = [ maintainers._1126 ];
+ };
+}
diff --git a/pkgs/applications/audio/pavucontrol/default.nix b/pkgs/applications/audio/pavucontrol/default.nix
index 02a27bedb67..ca08624e98f 100644
--- a/pkgs/applications/audio/pavucontrol/default.nix
+++ b/pkgs/applications/audio/pavucontrol/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
homepage = http://freedesktop.org/software/pulseaudio/pavucontrol/ ;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ ];
platforms = stdenv.lib.platforms.gnu; # arbitrary choice
diff --git a/pkgs/applications/audio/petrifoo/default.nix b/pkgs/applications/audio/petrifoo/default.nix
index 2e53a22bff3..152ee442761 100644
--- a/pkgs/applications/audio/petrifoo/default.nix
+++ b/pkgs/applications/audio/petrifoo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, alsaLib, cmake, gtk, jackaudio, libgnomecanvas
+{ stdenv, fetchgit, alsaLib, cmake, gtk, jack2, libgnomecanvas
, libpthreadstubs, libsamplerate, libsndfile, libtool, libxml2
, pkgconfig }:
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
};
buildInputs =
- [ alsaLib cmake gtk jackaudio libgnomecanvas libpthreadstubs
+ [ alsaLib cmake gtk jack2 libgnomecanvas libpthreadstubs
libsamplerate libsndfile libtool libxml2 pkgconfig
];
diff --git a/pkgs/applications/audio/pianobooster/default.nix b/pkgs/applications/audio/pianobooster/default.nix
index d5cdffbed95..67848cdc804 100644
--- a/pkgs/applications/audio/pianobooster/default.nix
+++ b/pkgs/applications/audio/pianobooster/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, cmake, qt4 }:
+{ stdenv, fetchurl, alsaLib, cmake, mesa, makeWrapper, qt4 }:
stdenv.mkDerivation rec {
name = "pianobooster-${version}";
@@ -9,14 +9,25 @@ stdenv.mkDerivation rec {
sha256 = "1xwyap0288xcl0ihjv52vv4ijsjl0yq67scc509aia4plmlm6l35";
};
+ patches = [
+ ./pianobooster-0.6.4b-cmake.patch
+ ./pianobooster-0.6.4b-cmake-gcc4.7.patch
+ ];
+
preConfigure = "cd src";
- buildInputs = [ alsaLib cmake qt4 ];
+ buildInputs = [ alsaLib cmake makeWrapper mesa qt4 ];
+
+ postInstall = ''
+ wrapProgram $out/bin/pianobooster \
+ --prefix LD_LIBRARY_PATH : ${mesa}/lib
+ '';
meta = with stdenv.lib; {
description = "A MIDI file player that teaches you how to play the piano";
homepage = http://pianobooster.sourceforge.net;
license = licenses.gpl3;
+ platforms = platforms.linux;
maintainers = [ maintainers.goibhniu ];
};
}
diff --git a/pkgs/applications/audio/pianobooster/pianobooster-0.6.4b-cmake-gcc4.7.patch b/pkgs/applications/audio/pianobooster/pianobooster-0.6.4b-cmake-gcc4.7.patch
new file mode 100644
index 00000000000..2b1b28c5a84
--- /dev/null
+++ b/pkgs/applications/audio/pianobooster/pianobooster-0.6.4b-cmake-gcc4.7.patch
@@ -0,0 +1,11 @@
+--- pianobooster-src-0.6.4b/src/CMakeLists.txt.orig 2013-04-06 10:48:02.469532914 -0700
++++ pianobooster-src-0.6.4b/src/CMakeLists.txt 2013-04-06 10:48:12.989532445 -0700
+@@ -203,8 +203,6 @@
+ ${PIANOBOOSTER_UI_HDRS} )
+ ENDIF(WIN32)
+
+-SET_TARGET_PROPERTIES(pianobooster PROPERTIES LINK_FLAGS "-mwindows")
+-
+ IF (USE_PCH)
+ ADD_PRECOMPILED_HEADER( pianobooster ${CMAKE_CURRENT_SOURCE_DIR}/precompile/precompile.h )
+ ENDIF (USE_PCH)
diff --git a/pkgs/applications/audio/pianobooster/pianobooster-0.6.4b-cmake.patch b/pkgs/applications/audio/pianobooster/pianobooster-0.6.4b-cmake.patch
new file mode 100644
index 00000000000..8cdd8738e2b
--- /dev/null
+++ b/pkgs/applications/audio/pianobooster/pianobooster-0.6.4b-cmake.patch
@@ -0,0 +1,44 @@
+--- pianobooster-src-0.6.4b/src/CMakeLists.txt.orig
++++ pianobooster-src-0.6.4b/src/CMakeLists.txt
+@@ -2,12 +2,6 @@
+ # for the debug build type cmake -DCMAKE_BUILD_TYPE=Debug
+ SET(CMAKE_BUILD_TYPE Release)
+ SET(CMAKE_VERBOSE_MAKEFILE OFF)
+-SET(USE_FLUIDSYNTH OFF)
+-
+-# The inplace directory is mainly for windows builds
+-# SET(FLUIDSYNTH_INPLACE_DIR C:/download/misc/ljb/fluidsynth-1.0.9)
+-SET(FLUIDSYNTH_INPLACE_DIR /home/louis/build/fluidsynth-1.0.9)
+-
+
+ # Testing precompiled headers it does not work -- leave as OFF.
+ SET(USE_PCH OFF)
+@@ -78,18 +72,7 @@
+ ADD_DEFINITIONS(-DPB_USE_FLUIDSYNTH)
+ MESSAGE("Building using fluidsynth")
+ SET( PB_BASE_SRCS MidiDeviceFluidSynth.cpp )
+-
+- IF(FLUIDSYNTH_INPLACE_DIR)
+- INCLUDE_DIRECTORIES(${FLUIDSYNTH_INPLACE_DIR}/include/)
+- IF(WIN32)
+- LINK_LIBRARIES( ${FLUIDSYNTH_INPLACE_DIR}/src/.libs/libfluidsynth.dll.a)
+- ENDIF(WIN32)
+- IF(UNIX)
+- LINK_LIBRARIES(${FLUIDSYNTH_INPLACE_DIR}/src/.libs/libfluidsynth.so)
+- ENDIF(UNIX)
+- ELSEIF(FLUIDSYNTH_INPLACE_DIR)
+- LINK_LIBRARIES( fluidsynth)
+- ENDIF(FLUIDSYNTH_INPLACE_DIR)
++ LINK_LIBRARIES(fluidsynth)
+ ENDIF(USE_FLUIDSYNTH)
+
+
+@@ -214,8 +197,6 @@
+ INSTALL(TARGETS pianobooster RUNTIME DESTINATION bin)
+ #INSTALL( index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kmidimon )
+
+-INSTALL( FILES ../README.txt DESTINATION share/doc/pianobooster )
+-
+ INSTALL ( FILES images/pianobooster.png DESTINATION share/pixmaps )
+
+
diff --git a/pkgs/applications/audio/praat/default.nix b/pkgs/applications/audio/praat/default.nix
index f2f196acdd8..86c68d087b7 100644
--- a/pkgs/applications/audio/praat/default.nix
+++ b/pkgs/applications/audio/praat/default.nix
@@ -1,18 +1,19 @@
-{stdenv, fetchurl, alsaLib, gtk, pkgconfig }:
+{ stdenv, fetchurl, alsaLib, gtk, pkgconfig }:
stdenv.mkDerivation {
- name = "praat-5323";
+ name = "praat-5365";
+
src = fetchurl {
- url = http://www.fon.hum.uva.nl/praat/praat5323_sources.tar.gz;
- sha256 = "1m0m5165h74mw5xhmnnyzh5ans3cn78w5rs9572sa1512cams203";
+ url = http://www.fon.hum.uva.nl/praat/praat5365_sources.tar.gz;
+ sha256 = "1w3mcq0mipx88i7ckhvzhmdj0p67nhppnn7kbkp21d01yyyz5rgq";
};
configurePhase = ''
- cp makefiles/makefile.defs.linux makefile.defs
+ cp makefiles/makefile.defs.linux.alsa makefile.defs
'';
installPhase = ''
- ensureDir $out/bin
+ mkdir -p $out/bin
cp praat $out/bin
'';
@@ -21,6 +22,7 @@ stdenv.mkDerivation {
meta = {
description = "Doing phonetics by computer";
homepage = http://www.fon.hum.uva.nl/praat/;
- license = "GPLv2+"; # Has some 3rd-party code in it though
+ license = stdenv.lib.licenses.gpl2Plus; # Has some 3rd-party code in it though
+ platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/audio/projectm/default.nix b/pkgs/applications/audio/projectm/default.nix
new file mode 100644
index 00000000000..508b6743cc3
--- /dev/null
+++ b/pkgs/applications/audio/projectm/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, pkgconfig, cmake
+, glew, ftgl, ttf_bitstream_vera
+, withQt ? true, qt4
+, withLibvisual ? false, libvisual, SDL
+, withJack ? false, jack2
+, withPulseAudio ? true, pulseaudio
+}:
+
+assert withJack -> withQt;
+assert withPulseAudio -> withQt;
+
+stdenv.mkDerivation {
+ name = "projectm-2.1.0";
+
+ meta = {
+ description = "Music Visualizer";
+ homepage = "http://projectm.sourceforge.net/";
+ license = stdenv.lib.licenses.lgpl21Plus;
+ platforms = stdenv.lib.platforms.linux;
+ };
+
+ src = fetchurl {
+ url = "mirror://sourceforge/projectm/2.1.0/projectM-complete-2.1.0-Source.tar.gz";
+ sha256 = "1vh6jk68a0jdb6qwppb6f8cbgmhnv2ba3bcavzfd6sq06gq08cji";
+ };
+
+ patchPhase = ''
+ sed -i 's:''${LIBVISUAL_PLUGINSDIR}:''${CMAKE_INSTALL_PREFIX}/lib/libvisual-0.4:' \
+ src/projectM-libvisual/CMakeLists.txt
+ '';
+
+ nativeBuildInputs = [ pkgconfig cmake ];
+
+ cmakeFlags = ''
+ -DprojectM_FONT_MENU=${ttf_bitstream_vera}/share/fonts/truetype/VeraMono.ttf
+ -DprojectM_FONT_TITLE=${ttf_bitstream_vera}/share/fonts/truetype/Vera.ttf
+ -DINCLUDE-PROJECTM-TEST=OFF
+ -DINCLUDE-PROJECTM-QT=${if withQt then "ON" else "OFF"}
+ -DINCLUDE-PROJECTM-LIBVISUAL=${if withLibvisual then "ON" else "OFF"}
+ -DINCLUDE-PROJECTM-JACK=${if withJack then "ON" else "OFF"}
+ -DINCLUDE-PROJECTM-PULSEAUDIO=${if withPulseAudio then "ON" else "OFF"}
+ '';
+
+ buildInputs = with stdenv.lib;
+ [ glew ftgl ]
+ ++ optional withQt qt4
+ ++ optionals withLibvisual [ libvisual SDL ]
+ ++ optional withJack jack2
+ ++ optional withPulseAudio pulseaudio
+ ;
+}
diff --git a/pkgs/applications/audio/puredata/default.nix b/pkgs/applications/audio/puredata/default.nix
index b1df008398d..9abca0cb014 100644
--- a/pkgs/applications/audio/puredata/default.nix
+++ b/pkgs/applications/audio/puredata/default.nix
@@ -1,23 +1,28 @@
-{ stdenv, fetchurl, alsaLib, autoconf, automake, fftw, gettext, glib
-, jackaudio, libX11, libtool, makeWrapper, pkgconfig, tcl, tk
+{ stdenv, fetchurl, autoreconfHook, gettext, makeWrapper
+, alsaLib, jack2, tk
}:
stdenv.mkDerivation rec {
name = "puredata-${version}";
- version = "0.44-0";
+ version = "0.45-4";
src = fetchurl {
url = "mirror://sourceforge/pure-data/pd-${version}.src.tar.gz";
- sha256 = "031bvqfnlpfx0y5n0l5rmslziqc6jgmk99x1prgh1rmhjhjdnijw";
+ sha256 = "1ls2ap5yi2zxvmr247621g4jx0hhfds4j5704a050bn2n3l0va2p";
};
- buildInputs = [
- alsaLib autoconf automake fftw gettext glib jackaudio libX11
- libtool makeWrapper pkgconfig tcl tk
- ];
+ patchPhase = ''
+ rm portaudio/configure.in
+ '';
- preConfigure = ''
- ./autogen.sh
+ nativeBuildInputs = [ autoreconfHook gettext makeWrapper ];
+
+ buildInputs = [ alsaLib jack2 ];
+
+ configureFlags = ''
+ --enable-alsa
+ --enable-jack
+ --disable-portaudio
'';
postInstall = ''
diff --git a/pkgs/applications/audio/qjackctl/default.nix b/pkgs/applications/audio/qjackctl/default.nix
index e70d51ce857..ba875255d4a 100644
--- a/pkgs/applications/audio/qjackctl/default.nix
+++ b/pkgs/applications/audio/qjackctl/default.nix
@@ -1,17 +1,17 @@
-{ stdenv, fetchurl, qt4, alsaLib, jackaudio, dbus }:
+{ stdenv, fetchurl, qt4, alsaLib, jack2, dbus }:
stdenv.mkDerivation rec {
- version = "0.3.9";
+ version = "0.3.11";
name = "qjackctl-${version}";
# some dependencies such as killall have to be installed additionally
src = fetchurl {
url = "mirror://sourceforge/qjackctl/${name}.tar.gz";
- sha256 = "0a4s7lwd5b67qbwv1yck8bw6zz8ffx1gza5fwflfqrfcfl3dds2y";
+ sha256 = "1wjzrgx3n2asyxk6cnfcm34msaw84qvsqy08bd4qnghrgpl96hwl";
};
- buildInputs = [ qt4 alsaLib jackaudio dbus ];
+ buildInputs = [ qt4 alsaLib jack2 dbus ];
configureFlags = "--enable-jack-version";
@@ -19,5 +19,6 @@ stdenv.mkDerivation rec {
description = "A Qt application to control the JACK sound server daemon";
homepage = http://qjackctl.sourceforge.net/;
license = "GPL";
+ platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/audio/qmmp/default.nix b/pkgs/applications/audio/qmmp/default.nix
index 8b99988f07b..a18ef97dd60 100644
--- a/pkgs/applications/audio/qmmp/default.nix
+++ b/pkgs/applications/audio/qmmp/default.nix
@@ -28,11 +28,11 @@
# handle that.
stdenv.mkDerivation rec {
- name = "qmmp-0.7.0";
+ name = "qmmp-0.7.6";
src = fetchurl {
url = "http://qmmp.ylsoftware.com/files/${name}.tar.bz2";
- sha256 = "0g8qcs82y3dy06lsgam2w6gh2ccx0frlw9fp4xg947vi3a16g6ig";
+ sha256 = "1hq08ii06lyfg516jrvxdfcjj509gvglvdlsr96aqi1fh8v4k5p9";
};
buildInputs =
@@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
homepage = http://qmmp.ylsoftware.com/;
license = licenses.gpl2;
platforms = platforms.linux;
- maintainers = [maintainers.bjornfor];
+ maintainers = [ maintainers.bjornfor ];
+ repositories.svn = http://qmmp.googlecode.com/svn/;
};
}
diff --git a/pkgs/applications/audio/qsampler/default.nix b/pkgs/applications/audio/qsampler/default.nix
index 7cfe73c9c75..b851517b872 100644
--- a/pkgs/applications/audio/qsampler/default.nix
+++ b/pkgs/applications/audio/qsampler/default.nix
@@ -20,5 +20,6 @@ stdenv.mkDerivation rec {
description = "graphical frontend to LinuxSampler";
license = licenses.gpl2;
maintainers = [ maintainers.goibhniu ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/qsynth/default.nix b/pkgs/applications/audio/qsynth/default.nix
index 96221348f88..a5d0e7e621e 100644
--- a/pkgs/applications/audio/qsynth/default.nix
+++ b/pkgs/applications/audio/qsynth/default.nix
@@ -1,20 +1,21 @@
-{ stdenv, fetchurl, alsaLib, fluidsynth, jackaudio, qt4 }:
+{ stdenv, fetchurl, alsaLib, fluidsynth, jack2, qt4 }:
stdenv.mkDerivation rec {
name = "qsynth-${version}";
- version = "0.3.6";
+ version = "0.3.8";
src = fetchurl {
url = "mirror://sourceforge/qsynth/${name}.tar.gz";
- sha256 = "0g7vaffpgs7v2p71ml5p7fzxz50mhlaklgf9zk4wbfk1hslqv5mm";
+ sha256 = "0wmq61cq93x2l00xwr871373mj3dwamz1dg6v62x7s8m1612ndrw";
};
- buildInputs = [ alsaLib fluidsynth jackaudio qt4 ];
+ buildInputs = [ alsaLib fluidsynth jack2 qt4 ];
meta = with stdenv.lib; {
description = "Fluidsynth GUI";
homepage = http://sourceforge.net/projects/qsynth;
license = licenses.gpl2Plus;
+ platforms = platforms.linux;
maintainers = [ maintainers.goibhniu ];
};
}
diff --git a/pkgs/applications/audio/qtractor/default.nix b/pkgs/applications/audio/qtractor/default.nix
index 3c31aff4232..4177dbeeb0c 100644
--- a/pkgs/applications/audio/qtractor/default.nix
+++ b/pkgs/applications/audio/qtractor/default.nix
@@ -1,18 +1,18 @@
-{ alsaLib, autoconf, automake, dssi, fetchurl, gtk, jackaudio
+{ alsaLib, autoconf, automake, dssi, fetchurl, gtk, jack2
, ladspaH, ladspaPlugins, liblo, libmad, libsamplerate, libsndfile
, libtool, libvorbis, pkgconfig, qt4, rubberband, stdenv }:
stdenv.mkDerivation rec {
- version = "0.5.4";
+ version = "0.6.2";
name = "qtractor-${version}";
src = fetchurl {
url = "mirror://sourceforge/qtractor/${name}.tar.gz";
- sha256 = "08vnvjl4w6z49s5shnip0qlwib0gwixw9wrqbazkh62i328fa05l";
+ sha256 = "08cr4lgm8bkkmsvfljszcqij3i52n989s7ncrbrn17n61rmgf8yw";
};
buildInputs =
- [ alsaLib autoconf automake dssi gtk jackaudio ladspaH
+ [ alsaLib autoconf automake dssi gtk jack2 ladspaH
ladspaPlugins liblo libmad libsamplerate libsndfile libtool
libvorbis pkgconfig qt4 rubberband
];
diff --git a/pkgs/applications/audio/quodlibet/default.nix b/pkgs/applications/audio/quodlibet/default.nix
index 9f4859d6e07..38c679d7a3e 100644
--- a/pkgs/applications/audio/quodlibet/default.nix
+++ b/pkgs/applications/audio/quodlibet/default.nix
@@ -1,48 +1,61 @@
-{ stdenv, fetchurl, python, buildPythonPackage, mutagen, pygtk, pygobject
-, pythonDBus, gst_python, gst_plugins_base, gst_plugins_good, gst_plugins_ugly }:
+{ stdenv, fetchurl, python, buildPythonPackage, mutagen, pygtk, pygobject, intltool
+, pythonDBus, gst_python, withGstPlugins ? false, gst_plugins_base ? null
+, gst_plugins_good ? null, gst_plugins_ugly ? null, gst_plugins_bad ? null }:
-let version = "2.5"; in
+assert withGstPlugins -> gst_plugins_base != null
+ || gst_plugins_good != null
+ || gst_plugins_ugly != null
+ || gst_plugins_bad != null;
+
+let version = "2.6.3"; in
buildPythonPackage {
# call the package quodlibet and just quodlibet
- name = "quodlibet-${version}";
+ name = "quodlibet-${version}"
+ + stdenv.lib.optionalString withGstPlugins "-with-gst-plugins";
namePrefix = "";
# XXX, tests fail
doCheck = false;
- src = [
+ srcs = [
(fetchurl {
- url = "https://quodlibet.googlecode.com/files/quodlibet-${version}.tar.gz";
- sha256 = "0qrmlz7m1jpmriy8bgycjiwzbf3annznkn4x5k32yy9bylxa7lwb";
+ url = "https://bitbucket.org/lazka/quodlibet-files/raw/default/releases/quodlibet-${version}.tar.gz";
+ sha256 = "0ilasi4b0ay8r6v6ba209wsm80fq2nmzigzc5kvphrk71jwypx6z";
})
(fetchurl {
- url = "https://quodlibet.googlecode.com/files/quodlibet-plugins-${version}.tar.gz";
- sha256 = "0kf2mkq2zk38626bn48gscvy6ir04f5b2z57ahlxlqy8imv2cjff";
+ url = "https://bitbucket.org/lazka/quodlibet-files/raw/default/releases/quodlibet-plugins-${version}.tar.gz";
+ sha256 = "1rv08rhdjad8sjhplqsspcf4vkazgkxyshsqmbfbrrk5kvv57ybc";
})
- ];
+ ];
+
+ preConfigure = ''
+ # TODO: for now don't a apply gdist overrides, will be needed for shipping icons, gtk, etc
+ sed -i /distclass/d setup.py
+ '';
sourceRoot = "quodlibet-${version}";
+
postUnpack = ''
# the patch searches for plugins in directory ../plugins
# so link the appropriate directory there
ln -sf quodlibet-plugins-${version} plugins
'';
+
patches = [ ./quodlibet-package-plugins.patch ];
- buildInputs = [
- gst_plugins_base gst_plugins_good gst_plugins_ugly
+ buildInputs = stdenv.lib.optionals withGstPlugins [
+ gst_plugins_base gst_plugins_good gst_plugins_ugly gst_plugins_bad
];
propagatedBuildInputs = [
- mutagen pygtk pygobject pythonDBus gst_python
+ mutagen pygtk pygobject pythonDBus gst_python intltool
];
- postInstall = ''
+ postInstall = stdenv.lib.optionalString withGstPlugins ''
# Wrap quodlibet so it finds the GStreamer plug-ins
- wrapProgram "$out/bin/quodlibet" --prefix \
- GST_PLUGIN_PATH ":" \
- "${gst_plugins_base}/lib/gstreamer-0.10:${gst_plugins_good}/lib/gstreamer-0.10:${gst_plugins_ugly}/lib/gstreamer-0.10"
+ wrapProgram "$out/bin/quodlibet" --prefix \
+ GST_PLUGIN_SYSTEM_PATH ":" "$GST_PLUGIN_SYSTEM_PATH" \
'';
meta = {
@@ -62,6 +75,7 @@ buildPythonPackage {
& internet radio, and all major audio formats.
'';
+ maintainers = [ stdenv.lib.maintainers.coroa ];
homepage = http://code.google.com/p/quodlibet/;
};
}
diff --git a/pkgs/applications/audio/rakarrack/default.nix b/pkgs/applications/audio/rakarrack/default.nix
index ba84fe5eaec..257a9967a5b 100644
--- a/pkgs/applications/audio/rakarrack/default.nix
+++ b/pkgs/applications/audio/rakarrack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, alsaUtils, fltk, jackaudio, libXft,
+{ stdenv, fetchurl, alsaLib, alsaUtils, fltk, jack2, libXft,
libXpm, libjpeg, libpng, libsamplerate, libsndfile, zlib }:
stdenv.mkDerivation rec {
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
patches = [ ./fltk-path.patch ];
- buildInputs = [ alsaLib alsaUtils fltk jackaudio libXft libXpm libjpeg
+ buildInputs = [ alsaLib alsaUtils fltk jack2 libXft libXpm libjpeg
libpng libsamplerate libsndfile zlib ];
meta = with stdenv.lib; {
diff --git a/pkgs/applications/audio/samplv1/default.nix b/pkgs/applications/audio/samplv1/default.nix
index 584b23b6a01..0cbdfa6973d 100644
--- a/pkgs/applications/audio/samplv1/default.nix
+++ b/pkgs/applications/audio/samplv1/default.nix
@@ -1,15 +1,15 @@
-{ stdenv, fetchurl, jackaudio, libsndfile, lv2, qt4 }:
+{ stdenv, fetchurl, jack2, libsndfile, lv2, qt4 }:
stdenv.mkDerivation rec {
name = "samplv1-${version}";
- version = "0.3.2";
+ version = "0.5.0";
src = fetchurl {
url = "mirror://sourceforge/samplv1/${name}.tar.gz";
- sha256 = "1j6q3ywbdsyhskc60p7k8ph058ylrrmjmri3q1wr2d2akcaqvb7m";
+ sha256 = "02mm5y1yzklvs5bpxl86y3dqcg7migfybmin8llk91pws6rl9b41";
};
- buildInputs = [ jackaudio libsndfile lv2 qt4 ];
+ buildInputs = [ jack2 libsndfile lv2 qt4 ];
meta = with stdenv.lib; {
description = "An old-school all-digital polyphonic sampler synthesizer with stereo fx";
diff --git a/pkgs/applications/audio/seq24/default.nix b/pkgs/applications/audio/seq24/default.nix
index 9f168f54eaf..10376e02f43 100644
--- a/pkgs/applications/audio/seq24/default.nix
+++ b/pkgs/applications/audio/seq24/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, gtkmm, jackaudio, pkgconfig }:
+{ stdenv, fetchurl, alsaLib, gtkmm, jack2, pkgconfig }:
stdenv.mkDerivation rec {
name = "seq24-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "07n80zj95i80vjmsflnlbqx5vv90qmp5f6a0zap8d30849l4y258";
};
- buildInputs = [ alsaLib gtkmm jackaudio pkgconfig ];
+ buildInputs = [ alsaLib gtkmm jack2 pkgconfig ];
meta = with stdenv.lib; {
description = "minimal loop based midi sequencer";
diff --git a/pkgs/applications/audio/setbfree/default.nix b/pkgs/applications/audio/setbfree/default.nix
new file mode 100644
index 00000000000..5119c384cf6
--- /dev/null
+++ b/pkgs/applications/audio/setbfree/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, alsaLib, freetype, ftgl, jack2, libX11, lv2
+, mesa, pkgconfig, ttf_bitstream_vera
+}:
+
+stdenv.mkDerivation rec {
+ name = "setbfree-${version}";
+ version = "0.7.5";
+
+ src = fetchurl {
+ url = "https://github.com/pantherb/setBfree/archive/v${version}.tar.gz";
+ sha256 = "1chlmgwricc6l4kyg35vc9v8f1n8psr28iihn4a9q2prj1ihqcbc";
+ };
+
+ patchPhase = ''
+ sed 's#/usr/local#$(out)#g' -i common.mak
+ sed 's#/usr/share/fonts/truetype/ttf-bitstream-vera#${ttf_bitstream_vera}/share/fonts/truetype#g' \
+ -i b_synth/Makefile
+ '';
+
+ buildInputs = [
+ alsaLib freetype ftgl jack2 libX11 lv2 mesa pkgconfig
+ ttf_bitstream_vera
+ ];
+
+ meta = with stdenv.lib; {
+ description = "A DSP tonewheel organ emulator";
+ homepage = http://setbfree.org;
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.goibhniu ];
+ };
+}
diff --git a/pkgs/applications/audio/snd/default.nix b/pkgs/applications/audio/snd/default.nix
index a49bfd9cccf..52cd2ad35ce 100644
--- a/pkgs/applications/audio/snd/default.nix
+++ b/pkgs/applications/audio/snd/default.nix
@@ -1,58 +1,26 @@
-args :
-let
- lib = args.lib;
- fetchurl = args.fetchurl;
- fullDepEntry = args.fullDepEntry;
+{ stdenv, fetchurl, pkgconfig
+, gtk2, alsaLib
+, fftw, gsl
+}:
- version = lib.attrByPath ["version"] "9.4" args;
- buildInputs = with args; [gtk glib pkgconfig
- libXpm gmp gettext libX11 fftw]
- ++ (lib.optional (args ? ruby) args.ruby)
- ++ (lib.optional (args ? mesa) args.mesa)
- ++ (lib.optional (args ? guile) args.guile)
- ++ (lib.optional (args ? libtool) args.libtool)
- ++ (lib.optional (args ? sndlib) args.sndlib)
- ++ (lib.optional (args ? alsaLib) args.alsaLib)
- ++ (lib.optional (args ? jackaudio) args.jackaudio)
- ;
- configureFlags = ["--with-gtk" "--with-xpm"]
- ++ (lib.optional (args ? ruby) "--with-ruby" )
- ++ (lib.optional (args ? mesa) "--with-gl" )
- ++ (lib.optional (args ? guile) "--with-guile")
- ++ (lib.optional (args ? sndlib) "--with-midi" )
- ++ (lib.optional (args ? alsaLib) "--with-alsa")
- ++ (lib.optional (args ? jackaudio) "--with-jack" )
- ++ [ "--with-fftw" "--htmldir=$out/share/snd/html" "--with-doc-dir=$out/share/snd/html" ]
- ;
-in
-rec {
- src = fetchurl {
- url = "mirror://sourceforge/snd/snd-${version}.tar.gz";
- sha256 = "0zqgfnkvkqxby1k74mwba1r4pb520glcsz5jjmpzm9m41nqnghmm";
- };
+stdenv.mkDerivation rec {
+ name = "snd-14.3";
- inherit buildInputs;
- configureFlags = [];
-
- /* doConfigure should be specified separately */
- phaseNames = ["doConfigure" "preBuild" "makeDocsWork"
- "doMakeInstall" "doForceShare"];
-
- makeDocsWork = fullDepEntry ''
- # hackish way to make html docs work
- h="$out/share/snd/html"; mkdir -p "$h"; cp *.html "$h"
- patch -p1 < ${./doc.patch}
- sed "s@HTML-DIR@$h@" -i index.scm snd-help.c
- '' ["defEnsureDir"];
-
- preBuild = fullDepEntry (''
- export NIX_LDFLAGS="$NIX_LDFLAGS -L${args.libX11}/lib -lX11"
- '') ["minInit" "doUnpack" "makeDocsWork"];
-
- name = "snd-" + version;
meta = {
description = "Sound editor";
homepage = http://ccrma.stanford.edu/software/snd;
- inherit src;
+ platforms = stdenv.lib.platforms.linux;
};
+
+ src = fetchurl {
+ url = "mirror://sourceforge/snd/${name}.tar.gz";
+ sha256 = "04shk34pza507kvm40dc6sdz5jz533z4q2h7m9hgqvw1r3f57ms6";
+ };
+
+ nativeBuildInputs = [ pkgconfig ];
+
+ buildInputs = [
+ gtk2 alsaLib
+ fftw gsl
+ ];
}
diff --git a/pkgs/applications/audio/snd/doc.patch b/pkgs/applications/audio/snd/doc.patch
deleted file mode 100644
index 4c40151e988..00000000000
--- a/pkgs/applications/audio/snd/doc.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-diff --git a/index.scm b/index.scm
-index 2148a58..713939c 100644
---- a/index.scm
-+++ b/index.scm
-@@ -18,24 +18,7 @@ and if one is found, and the Snd documentation can be found, calls (html-program
- (lambda (n)
- ;; look for doc on current dir, then html dir, then global dir
- ;; snd.html is what we'll search for
-- (let ((dir (if (file-exists? "snd.html")
-- (getcwd)
-- (if (and (string? (html-dir))
-- (file-exists? (string-append (html-dir) "/snd.html")))
-- (html-dir)
-- (if (file-exists? "/usr/share/doc/snd-9/snd.html")
-- "/usr/share/doc/snd-9"
-- (if (file-exists? "/usr/local/share/doc/snd-9/snd.html")
-- "/usr/local/share/doc/snd-9"
-- (if (file-exists? "/usr/doc/snd-9/snd.html")
-- "/usr/doc/snd-9"
-- (if (file-exists? "/usr/share/doc/snd-8/snd.html")
-- "/usr/share/doc/snd-8"
-- (if (file-exists? "/usr/local/share/doc/snd-8/snd.html")
-- "/usr/local/share/doc/snd-8"
-- (if (file-exists? "/usr/doc/snd-8/snd.html")
-- "/usr/doc/snd-8"
-- #f))))))))))
-+ (let (dir "HTML-DIR")
- (if dir
- (if (or (string=? (html-program) "netscape")
- (string=? (html-program) "mozilla")
-diff --git a/snd-help.c b/snd-help.c
-index a6557e0..a40a02e 100644
---- a/snd-help.c
-+++ b/snd-help.c
-@@ -3554,26 +3554,7 @@ static char *doc_files[DOC_DIRECTORIES] = {
-
- static char *html_directory(void)
- {
-- int i;
-- if (mus_file_probe("snd.html"))
-- return(mus_getcwd());
-- if (html_dir(ss))
-- {
-- bool happy;
-- char *hd = NULL;
-- hd = (char *)CALLOC(snd_strlen(html_dir(ss)) + 16, sizeof(char));
-- sprintf(hd, html_dir(ss), "/snd.html");
-- happy = mus_file_probe(hd);
-- FREE(hd);
-- if (happy) return(copy_string(html_dir(ss)));
-- }
--#ifdef MUS_DEFAULT_DOC_DIR
-- if (mus_file_probe(MUS_DEFAULT_DOC_DIR "/snd.html"))
-- return(copy_string(MUS_DEFAULT_DOC_DIR "/snd.html"));
--#endif
-- for (i = 0; i < DOC_DIRECTORIES; i++)
-- if (mus_file_probe(doc_files[i])) return(copy_string(doc_directories[i]));
-- return(NULL);
-+ return (copy_string ("HTML-DIR"));
- }
-
-
diff --git a/pkgs/applications/audio/sonic-visualiser/default.nix b/pkgs/applications/audio/sonic-visualiser/default.nix
index aeb90c09455..42c39062042 100644
--- a/pkgs/applications/audio/sonic-visualiser/default.nix
+++ b/pkgs/applications/audio/sonic-visualiser/default.nix
@@ -1,26 +1,29 @@
# TODO add plugins having various licenses, see http://www.vamp-plugins.org/download.html
-{ stdenv, fetchurl, alsaLib, bzip2, fftw, jackaudio, libX11, liblo
+{ stdenv, fetchurl, alsaLib, bzip2, fftw, jack2, libX11, liblo
, libmad, libogg, librdf, librdf_raptor, librdf_rasqal, libsamplerate
-, libsndfile, makeWrapper, pkgconfig, pulseaudio, qt4, redland
-, rubberband, vampSDK
+, libsndfile, pkgconfig, pulseaudio, qt5, redland
+, rubberband, serd, sord, vampSDK
}:
stdenv.mkDerivation rec {
name = "sonic-visualiser-${version}";
- version = "1.9";
+ version = "2.3";
src = fetchurl {
- url = "http://code.soundsoftware.ac.uk/attachments/download/194/${name}.tar.gz";
- sha256 = "00igf7j6s8xfyxnlkbqma0yby9pknxqzy8cmh0aw95ix80cw56fq";
+
+ url = "http://code.soundsoftware.ac.uk/attachments/download/918/${name}.tar.gz";
+ sha256 = "1f06w2rin4r2mbi00bg3nmqdi2xdy9vq4jcmfanxzj3ld66ik40c";
};
buildInputs =
- [ libsndfile qt4 fftw /* should be fftw3f ??*/ bzip2 librdf rubberband
+ [ libsndfile qt5 fftw /* should be fftw3f ??*/ bzip2 librdf rubberband
libsamplerate vampSDK alsaLib librdf_raptor librdf_rasqal redland
+ serd
+ sord
pkgconfig
# optional
- jackaudio
+ jack2
# portaudio
pulseaudio
libmad
@@ -28,11 +31,10 @@ stdenv.mkDerivation rec {
# fishsound
liblo
libX11
- makeWrapper
];
buildPhase = ''
- for i in sonic-visualiser svapp svcore svgui;
+ for i in sonic-visualiser svapp svcore svgui;
do cd $i && qmake -makefile PREFIX=$out && cd ..;
done
make
@@ -40,19 +42,15 @@ stdenv.mkDerivation rec {
installPhase = ''
mkdir -p $out/{bin,share/sonic-visualiser}
- cp sonic-visualiser/sonic-visualiser $out/bin
- cp -r sonic-visualiser/samples $out/share/sonic-visualiser/samples
- wrapProgram $out/bin/sonic-visualiser --prefix LD_LIBRARY_PATH : ${libX11}/lib
+ cp sonic-visualiser $out/bin/
+ cp -r samples $out/share/sonic-visualiser/
'';
- meta = {
+ meta = with stdenv.lib; {
description = "View and analyse contents of music audio files";
homepage = http://www.sonicvisualiser.org/;
- license = "GPLv2";
- maintainers =
- [ stdenv.lib.maintainers.marcweber
- stdenv.lib.maintainers.goibhniu
- ];
- platforms = stdenv.lib.platforms.linux;
+ license = licenses.gpl2Plus;
+ maintainers = [ maintainers.goibhniu maintainers.marcweber ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/spotify/default.nix b/pkgs/applications/audio/spotify/default.nix
index 615ee6a93cc..59b82d155da 100644
--- a/pkgs/applications/audio/spotify/default.nix
+++ b/pkgs/applications/audio/spotify/default.nix
@@ -1,24 +1,64 @@
{ fetchurl, stdenv, dpkg, xlibs, qt4, alsaLib, makeWrapper, openssl, freetype
, glib, pango, cairo, atk, gdk_pixbuf, gtk, cups, nspr, nss, libpng, GConf
-, libgcrypt, chromium, sqlite, gst_plugins_base, gstreamer, udev }:
+, libgcrypt, chromium, sqlite, gst_plugins_base, gstreamer, udev, fontconfig
+, dbus, expat }:
assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
let
- version = "0.9.4.183";
+ version = if stdenv.system == "i686-linux"
+ then "0.9.4.183.g644e24e.428"
+ else "0.9.11.27.g2b1a638.81";
+
qt4webkit =
if stdenv.system == "i686-linux" then
fetchurl {
- name = "libqtwebkit4_2.2_i386.deb";
- url = http://mirrors.us.kernel.org/ubuntu/pool/main/q/qtwebkit-source/libqtwebkit4_2.2~2011week36-0ubuntu1_i386.deb;
- sha256 = "0hi6cwx2b2cwa4nv5phqqw526lc8p9x7kjkcza9x47ny3npw2924";
+ name = "libqtwebkit4_2.3.2_i386.deb";
+ url = http://ie.archive.ubuntu.com/ubuntu/pool/main/q/qtwebkit-source/libqtwebkit4_2.3.2-0ubuntu7_i386.deb;
+ sha256 = "0q4abhczx91ma57fjss0gn8j6nkfbfsbsh6kxhykzj88dih2s8rn";
}
else
fetchurl {
- name = "libqtwebkit4_2.2_amd64.deb";
- url = http://ie.archive.ubuntu.com/ubuntu/pool/main/q/qtwebkit-source/libqtwebkit4_2.2~2011week36-0ubuntu1_amd64.deb;
- sha256 = "0bvy6qz9y19ck391z8c049v07y4vdyvgykpxi7x1nvn078p1imiw";
+ name = "libqtwebkit4_2.3.2_amd64.deb";
+ url = http://ie.archive.ubuntu.com/ubuntu/pool/main/q/qtwebkit-source/libqtwebkit4_2.3.2-0ubuntu7_amd64.deb;
+ sha256 = "0sac88avfivwkfhmd6fik7ili8fdznqas6741dbspf9mfnawbwch";
};
+
+ deps = [
+ alsaLib
+ atk
+ cairo
+ cups
+ dbus
+ expat
+ fontconfig
+ freetype
+ GConf
+ gdk_pixbuf
+ glib
+ gst_plugins_base
+ gstreamer
+ gtk
+ libgcrypt
+ libpng
+ nss
+ pango
+ qt4
+ sqlite
+ stdenv.gcc.gcc
+ xlibs.libX11
+ xlibs.libXcomposite
+ xlibs.libXdamage
+ xlibs.libXext
+ xlibs.libXfixes
+ xlibs.libXi
+ xlibs.libXrandr
+ xlibs.libXrender
+ xlibs.libXrender
+ xlibs.libXScrnSaver
+ #xlibs.libXss
+ ];
+
in
stdenv.mkDerivation {
@@ -27,13 +67,13 @@ stdenv.mkDerivation {
src =
if stdenv.system == "i686-linux" then
fetchurl {
- url = "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}.g644e24e.428-1_i386.deb";
+ url = "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}-1_i386.deb";
sha256 = "1wl6v5x8vm74h5lxp8fhvmih8l122aadsf1qxvpk0k3y6mbx0ifa";
}
else if stdenv.system == "x86_64-linux" then
fetchurl {
- url = "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}.g644e24e.428-1_amd64.deb";
- sha256 = "1yniln6iswrrrny01qr2w5zcvam0vnrvy9mwbnk9i14i2ch0f3fx";
+ url = "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}-1_amd64.deb";
+ sha256 = "0yfljiw01kssj3qaz8m0ppgrpjs6xrhzlr2wccp64bsnmin7g4sg";
}
else throw "Spotify not supported on this platform.";
@@ -51,34 +91,51 @@ stdenv.mkDerivation {
# Work around Spotify referring to a specific minor version of
# OpenSSL.
mkdir $out/lib
- ln -s ${openssl}/lib/libssl.so $out/lib/libssl.so.0.9.8
- ln -s ${openssl}/lib/libcrypto.so $out/lib/libcrypto.so.0.9.8
+
ln -s ${nss}/lib/libnss3.so $out/lib/libnss3.so.1d
ln -s ${nss}/lib/libnssutil3.so $out/lib/libnssutil3.so.1d
ln -s ${nss}/lib/libsmime3.so $out/lib/libsmime3.so.1d
+
+ ${if stdenv.system == "x86_64-linux" then ''
+ ln -s ${openssl}/lib/libssl.so $out/lib/libssl.so.1.0.0
+ ln -s ${openssl}/lib/libcrypto.so $out/lib/libcrypto.so.1.0.0
+ ln -s ${nspr}/lib/libnspr4.so $out/lib/libnspr4.so
+ ln -s ${nspr}/lib/libplc4.so $out/lib/libplc4.so
+ '' else ''
+ ln -s ${openssl}/lib/libssl.so $out/lib/libssl.so.0.9.8
+ ln -s ${openssl}/lib/libcrypto.so $out/lib/libcrypto.so.0.9.8
ln -s ${nspr}/lib/libnspr4.so $out/lib/libnspr4.so.0d
ln -s ${nspr}/lib/libplc4.so $out/lib/libplc4.so.0d
+ ''}
# Work around Spotify trying to open libudev.so.0 (which we don't have)
ln -s ${udev}/lib/libudev.so.1 $out/lib/libudev.so.0
mkdir -p $out/bin
+ rpath="$out/spotify-client/Data:$out/lib:$out/spotify-client:${stdenv.gcc.gcc}/lib64"
+
ln -s $out/spotify-client/spotify $out/bin/spotify
+
patchelf \
--interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
- --set-rpath $out/spotify-client/Data:$out/lib:$out/spotify-client:${stdenv.lib.makeLibraryPath [ xlibs.libXScrnSaver xlibs.libX11 qt4 alsaLib stdenv.gcc.gcc freetype glib pango cairo atk gdk_pixbuf gtk GConf cups sqlite]}:${stdenv.gcc.gcc}/lib64 \
- $out/spotify-client/spotify
+ --set-rpath $rpath $out/spotify-client/spotify
+
+ patchelf \
+ --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ --set-rpath $rpath $out/spotify-client/Data/SpotifyHelper
dpkg-deb -x ${qt4webkit} ./
mkdir -p $out/lib/
cp -v usr/lib/*/* $out/lib/
preload=$out/libexec/spotify/libpreload.so
+ librarypath="${stdenv.lib.makeLibraryPath deps}:$out/lib"
mkdir -p $out/libexec/spotify
gcc -shared ${./preload.c} -o $preload -ldl -DOUT=\"$out\" -fPIC
- wrapProgram $out/bin/spotify --set LD_PRELOAD $preload --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ GConf libpng cups libgcrypt sqlite gst_plugins_base gstreamer]}:$out/lib"
+ wrapProgram $out/bin/spotify --set LD_PRELOAD $preload --prefix LD_LIBRARY_PATH : "$librarypath"
+ wrapProgram $out/spotify-client/Data/SpotifyHelper --set LD_PRELOAD $preload --prefix LD_LIBRARY_PATH : "$librarypath"
# Desktop file
mkdir -p "$out/share/applications/"
@@ -92,7 +149,7 @@ stdenv.mkDerivation {
meta = {
homepage = https://www.spotify.com/;
description = "Spotify for Linux allows you to play music from the Spotify music service";
- license = "unfree";
+ license = stdenv.lib.licenses.unfree;
maintainers = [ stdenv.lib.maintainers.eelco ];
};
}
diff --git a/pkgs/applications/audio/streamripper/default.nix b/pkgs/applications/audio/streamripper/default.nix
new file mode 100644
index 00000000000..2df1e1e3b3b
--- /dev/null
+++ b/pkgs/applications/audio/streamripper/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl , glib, pkgconfig, libogg, libvorbis }:
+
+stdenv.mkDerivation rec {
+ name = "streamripper-${version}";
+ version = "1.64.6";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/streamripper/${name}.tar.gz";
+ sha256 = "0hnyv3206r0rfprn3k7k6a0j959kagsfyrmyjm3gsf3vkhp5zmy1";
+ };
+
+ buildInputs = [ pkgconfig glib libogg libvorbis ];
+
+ meta = with stdenv.lib; {
+ homepage = http://streamripper.sourceforge.net/;
+ description = "Application that lets you record streaming mp3 to your hard drive";
+ license = licenses.gpl2;
+ platforms = platforms.unix;
+ maintainers = with maintainers; [ the-kenny ];
+ };
+}
diff --git a/pkgs/applications/audio/synthv1/default.nix b/pkgs/applications/audio/synthv1/default.nix
index aadce32dda4..c6c464b9ad7 100644
--- a/pkgs/applications/audio/synthv1/default.nix
+++ b/pkgs/applications/audio/synthv1/default.nix
@@ -1,15 +1,15 @@
-{ stdenv, fetchurl, qt4, jackaudio, lv2 }:
+{ stdenv, fetchurl, qt4, jack2, lv2 }:
stdenv.mkDerivation rec {
name = "synthv1-${version}";
- version = "0.3.2";
+ version = "0.5.0";
src = fetchurl {
url = "mirror://sourceforge/synthv1/${name}.tar.gz";
- sha256 = "1230yf49qfw540yvp5n7sh6mf3k8590pzwc5mragd3nd6k6apgw9";
+ sha256 = "011kjccrdwb62rpck5gb8h4kvvm8rk6n77lj78ykxz4pxip5hf14";
};
- buildInputs = [ qt4 jackaudio lv2 ];
+ buildInputs = [ qt4 jack2 lv2 ];
meta = with stdenv.lib; {
description = "An old-school 4-oscillator subtractive polyphonic synthesizer with stereo fx";
diff --git a/pkgs/applications/audio/transcode/default.nix b/pkgs/applications/audio/transcode/default.nix
new file mode 100644
index 00000000000..c414992a12d
--- /dev/null
+++ b/pkgs/applications/audio/transcode/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, flac, lame, zlib, libjpeg, libvorbis, libtheora, libxml2
+, lzo, libdvdread, pkgconfig, x264, libmpeg2, xvidcore }:
+
+stdenv.mkDerivation rec {
+ name = "transcode-1.1.7";
+ src = fetchurl {
+ url = "https://bitbucket.org/france/transcode-tcforge/downloads/${name}.tar.bz2";
+ sha256 = "1e4e72d8e0dd62a80b8dd90699f5ca64c9b0cb37a5c9325c184166a9654f0a92";
+ };
+
+ buildInputs = [ flac lame zlib libjpeg libvorbis libtheora libxml2 lzo
+ libdvdread pkgconfig x264 libmpeg2 xvidcore ];
+ configureFlags = "--disable-ffmpeg --disable-libavcodec --disable-libavformat
+ --enable-lzo --enable-ogg --enable-vorbis --enable-theora --enable-libxml2
+ --enable-x264 --enable-libmpeg2 --enable-xvid";
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Suite of command line utilities for transcoding video and audio codecs, and for converting beween different container formats";
+ homepage = http://www.transcoding.org/;
+ license = licenses.lgpl2Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/vimpc/default.nix b/pkgs/applications/audio/vimpc/default.nix
new file mode 100755
index 00000000000..3e365cae8e9
--- /dev/null
+++ b/pkgs/applications/audio/vimpc/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, autoconf, automake, mpd_clientlib, ncurses, pcre, pkgconfig, taglib }:
+
+stdenv.mkDerivation rec {
+ version = "0.09.0";
+ name = "vimpc-${version}";
+
+ src = fetchurl {
+ url = "https://github.com/boysetsfrog/vimpc/archive/v${version}.tar.gz";
+ sha256 = "13eb229a5e9eee491765ee89f7fe6a38140a41a01434b117da3869d725c15706";
+ };
+
+ buildInputs = [ autoconf
+ automake
+ mpd_clientlib
+ ncurses
+ pcre
+ pkgconfig
+ taglib
+ ];
+
+ preConfigure = "./autogen.sh";
+
+ postInstall = ''
+ mkdir -p $out/etc
+ cp doc/vimpcrc.example $out/etc
+ '';
+
+ meta = {
+ description = "A vi/vim inspired client for the Music Player Daemon (mpd).";
+ homepage = https://github.com/boysetsfrog/vimpc;
+ license = "GPL3";
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/vmpk/default.nix b/pkgs/applications/audio/vmpk/default.nix
new file mode 100644
index 00000000000..9a75fa5f383
--- /dev/null
+++ b/pkgs/applications/audio/vmpk/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, cmake, pkgconfig
+, qt4, jack2
+}:
+
+let
+ version = "0.5.1";
+in stdenv.mkDerivation rec {
+ name = "vmpk-${version}";
+
+ meta = with stdenv.lib; {
+ description = "Virtual MIDI Piano Keyboard";
+ homepage = "http://vmpk.sourceforge.net/";
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ iyzsong ];
+ };
+
+ src = fetchurl {
+ url = "mirror://sourceforge/vmpk/${version}/${name}.tar.bz2";
+ sha256 = "11fqnxgs9hr9255d93n7lazxzjwn8jpmn23nywdksh0pb1ffvfrc";
+ };
+
+ nativeBuildInputs = [ cmake pkgconfig ];
+
+ buildInputs = [ qt4 jack2 ];
+}
diff --git a/pkgs/applications/audio/vorbis-tools/default.nix b/pkgs/applications/audio/vorbis-tools/default.nix
index 5db7cc30cf8..e4e5b7ff81a 100644
--- a/pkgs/applications/audio/vorbis-tools/default.nix
+++ b/pkgs/applications/audio/vorbis-tools/default.nix
@@ -16,6 +16,6 @@ stdenv.mkDerivation {
files, notably the `ogg123' player and the `oggenc' encoder.
'';
homepage = http://xiph.org/vorbis/;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/applications/audio/xmp/default.nix b/pkgs/applications/audio/xmp/default.nix
new file mode 100644
index 00000000000..7f21d389cf5
--- /dev/null
+++ b/pkgs/applications/audio/xmp/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, pkgconfig, alsaLib, libxmp }:
+
+stdenv.mkDerivation rec {
+ name = "xmp-4.0.7";
+
+ meta = with stdenv.lib; {
+ description = "Extended module player";
+ homepage = "http://xmp.sourceforge.net/";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ iyzsong ];
+ };
+
+ src = fetchurl {
+ url = "mirror://sourceforge/xmp/xmp/${name}.tar.gz";
+ sha256 = "0qgzzaxhshz5l7s21x89xb43pbbi0zap6a4lk4s7gjp1qca2agcw";
+ };
+
+ buildInputs = [ pkgconfig alsaLib libxmp ];
+}
diff --git a/pkgs/applications/audio/xsynth-dssi/default.nix b/pkgs/applications/audio/xsynth-dssi/default.nix
index 0cfbfb4c9bd..85e7235400b 100644
--- a/pkgs/applications/audio/xsynth-dssi/default.nix
+++ b/pkgs/applications/audio/xsynth-dssi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, autoconf, automake, dssi, gtk, jackaudio,
+{ stdenv, fetchurl, alsaLib, autoconf, automake, dssi, gtk, jack2,
ladspaH, ladspaPlugins, liblo, pkgconfig }:
stdenv.mkDerivation rec {
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
sha256 = "00nwv2pqjbmxqdc6xdm0cljq6z05lv4y6bibmhz1kih9lm0lklnk";
};
- buildInputs = [ alsaLib autoconf automake dssi gtk jackaudio ladspaH
+ buildInputs = [ alsaLib autoconf automake dssi gtk jack2 ladspaH
ladspaPlugins liblo pkgconfig ];
installPhase = ''
diff --git a/pkgs/applications/audio/yoshimi/default.nix b/pkgs/applications/audio/yoshimi/default.nix
index bce7e0ef5ee..91142691055 100644
--- a/pkgs/applications/audio/yoshimi/default.nix
+++ b/pkgs/applications/audio/yoshimi/default.nix
@@ -1,19 +1,23 @@
-{ stdenv, fetchurl, alsaLib, boost, cmake, fftwSinglePrec, fltk
-, jackaudio, libsndfile, mesa, minixml, pkgconfig, zlib }:
+{ stdenv, fetchurl, alsaLib, boost, cairo, cmake, fftwSinglePrec, fltk
+, jack2, libsndfile, mesa, minixml, pkgconfig, zlib
+}:
assert stdenv ? glibc;
stdenv.mkDerivation rec {
name = "yoshimi-${version}";
- version = "0.060.12";
+ version = "1.2.2";
src = fetchurl {
url = "mirror://sourceforge/yoshimi/${name}.tar.bz2";
- sha256 = "14javywkw6af9z9c7jr06rzdgzncyaz2ab6f0v0k6bgdndlcgslc";
+ sha256 = "1w23ral1qrbg9gqx833giqmchx7952f18yaa52aya9shsdlla83c";
};
- buildInputs = [ alsaLib boost fftwSinglePrec fltk jackaudio libsndfile mesa
- minixml zlib ];
+ buildInputs = [
+ alsaLib boost cairo fftwSinglePrec fltk jack2 libsndfile mesa
+ minixml zlib
+ ];
+
nativeBuildInputs = [ cmake pkgconfig ];
preConfigure = "cd src";
diff --git a/pkgs/applications/audio/zynaddsubfx/default.nix b/pkgs/applications/audio/zynaddsubfx/default.nix
index fcec85b7fe5..a5aa7d5c8d9 100644
--- a/pkgs/applications/audio/zynaddsubfx/default.nix
+++ b/pkgs/applications/audio/zynaddsubfx/default.nix
@@ -1,28 +1,21 @@
-{ stdenv, fetchurl, alsaLib, cmake, fftw, fltk13, minixml, pkgconfig, zlib }:
+{ stdenv, fetchurl, alsaLib, cmake, jack2, fftw, fltk13, minixml
+, pkgconfig, zlib
+}:
stdenv.mkDerivation rec {
name = "zynaddsubfx-${version}";
- version = "2.4.1";
+ version = "2.4.3";
src = fetchurl {
url = "mirror://sourceforge/zynaddsubfx/ZynAddSubFX-${version}.tar.bz2";
- sha256 = "1zn5lgh76rrbfj8d4jys2gc1j2pqrbdd18ywfdrk0s7jq4inwyfg";
+ sha256 = "0kgmwyh4rhyqdfrdzhbzjjk2hzggkp9c4aac6sy3xv6cc1b5jjxq";
};
- buildInputs = [ alsaLib fftw fltk13 minixml zlib ];
+ buildInputs = [ alsaLib jack2 fftw fltk13 minixml zlib ];
nativeBuildInputs = [ cmake pkgconfig ];
- patches = [
- (fetchurl {
- url = http://patch-tracker.debian.org/patch/series/dl/zynaddsubfx/2.4.0-1.2/09_fluid_1.3.patch;
- sha256 = "06wl7fs44b24ls1fzh21596n6zzc3ywm2bcdfrkfiiwpzin3yjq6";
- })
- ];
-
-#installPhase = "mkdir -pv $out/bin; cp -v zynaddsubfx $out/bin";
-
meta = with stdenv.lib; {
- description = "high quality software synthesizer";
+ description = "High quality software synthesizer";
homepage = http://zynaddsubfx.sourceforge.net;
license = licenses.gpl2;
platforms = platforms.linux;
diff --git a/pkgs/applications/display-managers/lightdm-gtk-greeter/default.nix b/pkgs/applications/display-managers/lightdm-gtk-greeter/default.nix
index 0b8863752d2..69f1eef9cec 100644
--- a/pkgs/applications/display-managers/lightdm-gtk-greeter/default.nix
+++ b/pkgs/applications/display-managers/lightdm-gtk-greeter/default.nix
@@ -10,18 +10,24 @@
let
ver_branch = "1.6";
- version = "1.5.1"; # 1.5.2 and 1.6.0 result into infinite cycling of X in restarts
+ version = "1.6.1";
in
stdenv.mkDerivation rec {
name = "lightdm-gtk-greeter-${version}";
src = fetchurl {
url = "${meta.homepage}/${ver_branch}/${version}/+download/${name}.tar.gz";
- sha256 = "08fnsbnay5jhd7ps8n91i6c227zq6xizpyn34qhqzykrga8pxkpc";
+ sha256 = "1nb8ljrbrp1zga083g3b633xi3izxxm4jipw1qgial1x16mqc0hz";
};
- patches = [ ./lightdm-gtk-greeter.patch ];
- patchFlags = "-p0";
+ patches = [
+ ./lightdm-gtk-greeter.patch
+ (fetchurl { # CVE-2014-0979, https://bugs.launchpad.net/lightdm-gtk-greeter/+bug/1266449
+ url = "https://launchpadlibrarian.net/161796033/07_fix-NULL-username.patch";
+ sha256 = "1sqkhsz1z10k6vlmlrqrfx452lznv30885fmnzc73p2zxdlw9q1a";
+ })
+ ];
+ patchFlags = "-p1";
buildInputs = [ pkgconfig lightdm intltool ]
++ (if useGTK2 then [ gtk2 makeWrapper ] else [ gtk3 ]);
@@ -39,5 +45,6 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://launchpad.net/lightdm-gtk-greeter;
platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.ocharles ];
};
}
diff --git a/pkgs/applications/display-managers/lightdm-gtk-greeter/lightdm-gtk-greeter.patch b/pkgs/applications/display-managers/lightdm-gtk-greeter/lightdm-gtk-greeter.patch
index 5ae5603b4dd..ea9e0eaec93 100644
--- a/pkgs/applications/display-managers/lightdm-gtk-greeter/lightdm-gtk-greeter.patch
+++ b/pkgs/applications/display-managers/lightdm-gtk-greeter/lightdm-gtk-greeter.patch
@@ -1,13 +1,13 @@
-=== modified file 'src/lightdm-gtk-greeter.c'
---- src/lightdm-gtk-greeter.c 2013-02-09 23:20:39 +0000
-+++ src/lightdm-gtk-greeter.c 2013-03-29 12:21:34 +0000
-@@ -1273,7 +1273,7 @@
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (session_combo), renderer, TRUE);
- gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (session_combo), renderer, "text", 0);
- model = gtk_combo_box_get_model (session_combo);
+diff --git a/src/lightdm-gtk-greeter.c b/src/lightdm-gtk-greeter.c
+index cc5f9e1..d615dc1 100644
+--- a/src/lightdm-gtk-greeter.c
++++ b/src/lightdm-gtk-greeter.c
+@@ -1716,7 +1716,7 @@ main (int argc, char **argv)
+ gtk_container_add (GTK_CONTAINER (menuitem), image);
+ gtk_widget_show (GTK_WIDGET (menuitem));
+
- items = lightdm_get_sessions ();
+ items = lightdm_get_sessions (greeter);
+ GSList *sessions = NULL;
for (item = items; item; item = item->next)
{
- LightDMSession *session = item->data;
-
diff --git a/pkgs/applications/display-managers/lightdm/default.nix b/pkgs/applications/display-managers/lightdm/default.nix
index 598c42199be..d4c6f24d69a 100644
--- a/pkgs/applications/display-managers/lightdm/default.nix
+++ b/pkgs/applications/display-managers/lightdm/default.nix
@@ -3,18 +3,18 @@
let
ver_branch = "1.8";
- version = "1.7.0";
+ version = "1.8.6";
in
stdenv.mkDerivation rec {
name = "lightdm-${version}";
src = fetchurl {
url = "${meta.homepage}/${ver_branch}/${version}/+download/${name}.tar.xz";
- sha256 = "0nwwjgc9xvwili6714ag88wsrf0lr5hv1i6z9f0xvin4ym18cbs5";
+ sha256 = "17ivc0c4dbnc0fzd581j53cn6hdav34zz2hswjzy8aczbpk605qi";
};
patches = [ ./lightdm.patch ];
- patchFlags = "-p0";
+ patchFlags = "-p1";
buildInputs = [
pkgconfig pam libxcb glib libXdmcp itstool libxml2 intltool libxklavier libgcrypt
@@ -27,5 +27,6 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://launchpad.net/lightdm;
platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.ocharles ];
};
}
diff --git a/pkgs/applications/display-managers/lightdm/lightdm.patch b/pkgs/applications/display-managers/lightdm/lightdm.patch
index a6e53bafcc7..d81e0aae56d 100644
--- a/pkgs/applications/display-managers/lightdm/lightdm.patch
+++ b/pkgs/applications/display-managers/lightdm/lightdm.patch
@@ -1,7 +1,8 @@
-=== modified file 'liblightdm-gobject/greeter.c'
---- liblightdm-gobject/greeter.c 2013-01-31 20:56:09 +0000
-+++ liblightdm-gobject/greeter.c 2013-03-29 14:15:58 +0000
-@@ -567,6 +567,21 @@
+diff --git a/liblightdm-gobject/greeter.c b/liblightdm-gobject/greeter.c
+index 9387118..635cea0 100644
+--- a/liblightdm-gobject/greeter.c
++++ b/liblightdm-gobject/greeter.c
+@@ -567,6 +567,21 @@ lightdm_greeter_get_default_session_hint (LightDMGreeter *greeter)
}
/**
@@ -23,11 +24,11 @@
* lightdm_greeter_get_hide_users_hint:
* @greeter: A #LightDMGreeter
*
-
-=== modified file 'liblightdm-gobject/lightdm/greeter.h'
---- liblightdm-gobject/lightdm/greeter.h 2013-01-31 20:56:09 +0000
-+++ liblightdm-gobject/lightdm/greeter.h 2013-03-29 11:56:11 +0000
-@@ -93,6 +93,8 @@
+diff --git a/liblightdm-gobject/lightdm/greeter.h b/liblightdm-gobject/lightdm/greeter.h
+index 7d8988f..2b54909 100644
+--- a/liblightdm-gobject/lightdm/greeter.h
++++ b/liblightdm-gobject/lightdm/greeter.h
+@@ -93,6 +93,8 @@ gboolean lightdm_greeter_get_select_guest_hint (LightDMGreeter *greeter);
const gchar *lightdm_greeter_get_autologin_user_hint (LightDMGreeter *greeter);
@@ -36,19 +37,19 @@
gboolean lightdm_greeter_get_autologin_guest_hint (LightDMGreeter *greeter);
gint lightdm_greeter_get_autologin_timeout_hint (LightDMGreeter *greeter);
-
-=== modified file 'liblightdm-gobject/lightdm/session.h'
---- liblightdm-gobject/lightdm/session.h 2013-01-31 20:56:09 +0000
-+++ liblightdm-gobject/lightdm/session.h 2013-03-29 11:59:16 +0000
+diff --git a/liblightdm-gobject/lightdm/session.h b/liblightdm-gobject/lightdm/session.h
+index 13ddcd9..cdb2fd6 100644
+--- a/liblightdm-gobject/lightdm/session.h
++++ b/liblightdm-gobject/lightdm/session.h
@@ -12,6 +12,7 @@
- #define _LIGHTDM_SESSION_H_
+ #define LIGHTDM_SESSION_H_
#include
+#include "greeter.h"
G_BEGIN_DECLS
-@@ -42,9 +43,9 @@
+@@ -42,9 +43,9 @@ typedef struct
GType lightdm_session_get_type (void);
@@ -60,10 +61,10 @@
const gchar *lightdm_session_get_key (LightDMSession *session);
-
-=== modified file 'liblightdm-gobject/session.c'
---- liblightdm-gobject/session.c 2013-01-31 20:56:09 +0000
-+++ liblightdm-gobject/session.c 2013-03-29 14:16:48 +0000
+diff --git a/liblightdm-gobject/session.c b/liblightdm-gobject/session.c
+index 949778f..db5e18a 100644
+--- a/liblightdm-gobject/session.c
++++ b/liblightdm-gobject/session.c
@@ -11,6 +11,7 @@
#include
#include
@@ -72,7 +73,7 @@
#include "lightdm/session.h"
enum {
-@@ -167,7 +168,7 @@
+@@ -189,7 +190,7 @@ load_sessions (const gchar *sessions_dir)
}
static void
@@ -81,18 +82,17 @@
{
GKeyFile *config_key_file = NULL;
gchar *config_path = NULL;
-@@ -183,8 +184,8 @@
+@@ -205,8 +206,7 @@ update_sessions (void)
remote_sessions_dir = g_strdup (REMOTE_SESSIONS_DIR);
/* Use session directory from configuration */
- /* FIXME: This should be sent in the greeter connection */
- config_path = g_build_filename (CONFIG_DIR, "lightdm.conf", NULL);
+ config_path = g_strdup (lightdm_greeter_get_config_path (greeter));
-+
config_key_file = g_key_file_new ();
result = g_key_file_load_from_file (config_key_file, config_path, G_KEY_FILE_NONE, &error);
- if (error)
-@@ -228,9 +229,9 @@
+ if (error && !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
+@@ -250,9 +250,9 @@ update_sessions (void)
* Return value: (element-type LightDMSession) (transfer none): A list of #LightDMSession
**/
GList *
@@ -104,7 +104,7 @@
return local_sessions;
}
-@@ -242,9 +243,9 @@
+@@ -264,9 +264,9 @@ lightdm_get_sessions (void)
* Return value: (element-type LightDMSession) (transfer none): A list of #LightDMSession
**/
GList *
@@ -116,78 +116,29 @@
return remote_sessions;
}
-
-=== modified file 'src/display.c'
---- src/display.c 2013-03-26 22:22:49 +0000
-+++ src/display.c 2013-03-29 12:12:43 +0000
-@@ -62,6 +62,9 @@
- /* Program to run sessions through */
- gchar *session_wrapper;
-
-+ /* Path to the configuration file that lightdm is running under */
-+ gchar *config_path;
+diff --git a/src/lightdm.c b/src/lightdm.c
+index 7d35034..910164c 100644
+--- a/src/lightdm.c
++++ b/src/lightdm.c
+@@ -1142,6 +1142,9 @@ main (int argc, char **argv)
+ }
+ }
+ g_clear_error (&error);
+
- /* TRUE if in a user session */
- gboolean in_user_session;
-
-@@ -213,6 +216,14 @@
- }
-
- void
-+display_set_config_path (Display *display, const gchar *config_path)
-+{
-+ g_return_if_fail (display != NULL);
-+ g_free (display->priv->config_path);
-+ display->priv->config_path = g_strdup (config_path);
-+}
++ config_set_string (config_get_instance (), "SeatDefaults", "config-path", config_path);
+
-+void
- display_set_show_remote_login_hint (Display *display, gboolean show_remote_login)
- {
- g_return_if_fail (display != NULL);
-@@ -436,6 +447,7 @@
- greeter_set_hint (display->priv->greeter, "show-remote-login", display->priv->greeter_show_remote_login ? "true" : "false");
- if (display->priv->greeter_is_lock)
- greeter_set_hint (display->priv->greeter, "lock-screen", "true");
-+ greeter_set_hint (display->priv->greeter, "config-path", display->priv->config_path);
-
- /* Run greeter as unprivileged user */
- if (getuid () != 0)
-
-=== modified file 'src/display.h'
---- src/display.h 2013-03-26 22:22:49 +0000
-+++ src/display.h 2013-03-29 12:12:37 +0000
-@@ -80,6 +80,8 @@
-
- void display_set_user_session (Display *display, SessionType type, const gchar *session_name);
-
-+void display_set_config_path (Display *display, const gchar *config_path);
-+
- gboolean display_start (Display *display);
-
- gboolean display_get_is_ready (Display *display);
-
-=== modified file 'src/lightdm.c'
---- src/lightdm.c 2013-03-07 21:40:31 +0000
-+++ src/lightdm.c 2013-03-29 11:48:45 +0000
-@@ -1050,6 +1050,7 @@
- g_debug ("Starting Light Display Manager %s, UID=%i PID=%i", VERSION, getuid (), getpid ());
-
- g_debug ("Loaded configuration from %s", config_path);
-+ config_set_string (config_get_instance (), "LightDM", "config-path", config_path);
g_free (config_path);
- g_debug ("Using D-Bus name %s", LIGHTDM_BUS_NAME);
-
-=== modified file 'src/seat.c'
---- src/seat.c 2013-03-26 22:22:49 +0000
-+++ src/seat.c 2013-03-29 12:13:00 +0000
-@@ -536,6 +536,7 @@
- if (!session_name)
- session_name = seat_get_string_property (seat, "user-session");
- display_set_user_session (display, SESSION_TYPE_LOCAL, session_name);
-+ display_set_config_path (display, config_get_string (config_get_instance (), "LightDM", "config-path"));
+ /* Set default values */
+diff --git a/src/seat.c b/src/seat.c
+index e2b9c2c..a950ea2 100644
+--- a/src/seat.c
++++ b/src/seat.c
+@@ -1137,6 +1137,7 @@ create_greeter_session (Seat *seat)
+ greeter_set_hint (greeter_session, "show-manual-login", seat_get_boolean_property (seat, "greeter-show-manual-login") ? "true" : "false");
+ greeter_set_hint (greeter_session, "show-remote-login", seat_get_boolean_property (seat, "greeter-show-remote-login") ? "true" : "false");
+ greeter_set_hint (greeter_session, "has-guest-account", seat_get_allow_guest (seat) && seat_get_boolean_property (seat, "greeter-allow-guest") ? "true" : "false");
++ greeter_set_hint (greeter_session, "config-path", seat_get_string_property (seat, "config-path"));
+
+ g_object_unref (session_config);
- seat->priv->displays = g_list_append (seat->priv->displays, display);
- g_signal_emit (seat, signals[DISPLAY_ADDED], 0, display);
-
diff --git a/pkgs/applications/display-managers/slim/default.nix b/pkgs/applications/display-managers/slim/default.nix
index 0b5bcccfb21..42d2c777aea 100644
--- a/pkgs/applications/display-managers/slim/default.nix
+++ b/pkgs/applications/display-managers/slim/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, cmake, pkgconfig, xorg, libjpeg, libpng
-, fontconfig, freetype, pam, dbus_libs }:
+, fontconfig, freetype, pam, dbus_libs, makeWrapper, pkgs }:
stdenv.mkDerivation rec {
name = "slim-1.3.6";
src = fetchurl {
- url = "http://download.berlios.de/slim/${name}.tar.gz";
+ url = "mirror://sourceforge/slim.berlios/${name}.tar.gz";
sha256 = "1pqhk22jb4aja4hkrm7rjgbgzjyh7i4zswdgf5nw862l2znzxpi1";
};
@@ -20,22 +20,24 @@ stdenv.mkDerivation rec {
./run-once.patch
];
- preConfigure = "substituteInPlace CMakeLists.txt --replace /etc $out/etc --replace /lib $out/lib";
+ preConfigure = "substituteInPlace CMakeLists.txt --replace /lib $out/lib";
cmakeFlags = [ "-DUSE_PAM=1" ];
+ NIX_CFLAGS_COMPILE = "-I${freetype}/include/freetype";
+
enableParallelBuilding = true;
buildInputs =
[ cmake pkgconfig libjpeg libpng fontconfig freetype
pam dbus_libs
- xorg.libX11 xorg.libXext xorg.libXrandr xorg.libXrender xorg.libXmu xorg.libXft
+ xorg.libX11 xorg.libXext xorg.libXrandr xorg.libXrender xorg.libXmu xorg.libXft makeWrapper
];
NIX_CFLAGS_LINK = "-lXmu";
meta = {
- homepage = http://slim.berlios.de;
+ homepage = http://sourceforge.net/projects/slim.berlios/; # berlios shut down; I found no replacement yet
platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/display-managers/slim/runtime-paths.patch b/pkgs/applications/display-managers/slim/runtime-paths.patch
index f6811dbe668..5a8e07bfbf0 100644
--- a/pkgs/applications/display-managers/slim/runtime-paths.patch
+++ b/pkgs/applications/display-managers/slim/runtime-paths.patch
@@ -1,6 +1,6 @@
-diff -ru -x '*~' slim-1.3.6-orig/app.cpp slim-1.3.6/app.cpp
+diff -ru slim-1.3.6-orig/app.cpp slim-1.3.6/app.cpp
--- slim-1.3.6-orig/app.cpp 2013-10-02 00:38:05.000000000 +0200
-+++ slim-1.3.6/app.cpp 2013-10-15 11:02:55.629263422 +0200
++++ slim-1.3.6/app.cpp 2014-03-30 19:01:04.115414201 +0200
@@ -200,7 +200,9 @@
/* Read configuration and theme */
@@ -23,3 +23,48 @@ diff -ru -x '*~' slim-1.3.6-orig/app.cpp slim-1.3.6/app.cpp
themeName = cfg->getOption("current_theme");
string::size_type pos;
if ((pos = themeName.find(",")) != string::npos) {
+diff -ru slim-1.3.6-orig/CMakeLists.txt slim-1.3.6/CMakeLists.txt
+--- slim-1.3.6-orig/CMakeLists.txt 2013-10-02 00:38:05.000000000 +0200
++++ slim-1.3.6/CMakeLists.txt 2014-03-30 19:16:48.445069729 +0200
+@@ -23,7 +23,7 @@
+
+ set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory")
+ set(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/share/slim")
+-set(SYSCONFDIR "/etc")
++set(SYSCONFDIR "$ENV{out}/etc")
+ set(LIBDIR "/lib")
+ set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
+
+@@ -40,7 +40,7 @@
+ set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DPACKAGE=\"slim\"")
+ set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DVERSION=\"${SLIM_VERSION}\"")
+ set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DPKGDATADIR=\"${PKGDATADIR}\"")
+-set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DSYSCONFDIR=\"${SYSCONFDIR}\"")
++set(SLIM_DEFINITIONS ${SLIM_DEFINITIONS} "-DSYSCONFDIR=\"/etc\"")
+
+ # Flags
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -O2")
+Only in slim-1.3.6: CMakeLists.txt~
+diff -ru slim-1.3.6-orig/slimlock.cpp slim-1.3.6/slimlock.cpp
+--- slim-1.3.6-orig/slimlock.cpp 2013-10-02 00:38:05.000000000 +0200
++++ slim-1.3.6/slimlock.cpp 2014-03-30 19:01:04.115414201 +0200
+@@ -106,13 +106,17 @@
+ unsigned int cfg_passwd_timeout;
+ // Read user's current theme
+ cfg = new Cfg;
+- cfg->readConf(CFGFILE);
++ char *cfgfile = getenv("SLIM_CFGFILE");
++ if (!cfgfile) cfgfile = CFGFILE;
++ cfg->readConf(cfgfile);
+ cfg->readConf(SLIMLOCKCFG);
+ string themebase = "";
+ string themefile = "";
+ string themedir = "";
+ themeName = "";
+- themebase = string(THEMESDIR) + "/";
++ char *themesdir = getenv("SLIM_THEMESDIR");
++ if (!themesdir) themesdir = THEMESDIR;
++ themebase = string(themesdir) + "/";
+ themeName = cfg->getOption("current_theme");
+ string::size_type pos;
+ if ((pos = themeName.find(",")) != string::npos) {
diff --git a/pkgs/applications/editors/atom/default.nix b/pkgs/applications/editors/atom/default.nix
new file mode 100644
index 00000000000..51844f64179
--- /dev/null
+++ b/pkgs/applications/editors/atom/default.nix
@@ -0,0 +1,68 @@
+{ stdenv, fetchurl, buildEnv, makeDesktopItem, makeWrapper, zlib, glib, alsaLib
+, dbus, gtk, atk, pango, freetype, fontconfig, libgnome_keyring3, gdk_pixbuf
+, cairo, cups, expat, libgpgerror, nspr, gconf, nss, xlibs
+}:
+
+let
+ atomEnv = buildEnv {
+ name = "env-atom";
+ paths = [
+ stdenv.gcc.gcc zlib glib dbus gtk atk pango freetype libgnome_keyring3
+ fontconfig gdk_pixbuf cairo cups expat libgpgerror alsaLib nspr gconf nss
+ xlibs.libXrender xlibs.libX11 xlibs.libXext xlibs.libXdamage xlibs.libXtst
+ xlibs.libXcomposite xlibs.libXi xlibs.libXfixes
+ ];
+ };
+in stdenv.mkDerivation rec {
+ name = "atom-${version}";
+ version = "0.99.0";
+
+ src = fetchurl {
+ url = https://github.com/hotice/webupd8/raw/master/atom-linux64-0.99.0~git20140525.tar.xz;
+ sha256 = "55c2415c96e1182ae1517751cbea1db64e9962683b384cfe5e182aec10aebecd";
+ name = "${name}.tar.xz";
+ };
+
+ iconsrc = fetchurl {
+ url = https://raw.githubusercontent.com/atom/atom/master/resources/atom.png;
+ sha256 = "66dc0b432eed7bcd738b7c1b194e539178a83d427c78f103041981f2b840e030";
+ };
+
+ desktopItem = makeDesktopItem {
+ name = "atom";
+ exec = "atom";
+ icon = iconsrc;
+ comment = "A hackable text editor for the 21st Century";
+ desktopName = "Atom";
+ genericName = "Text editor";
+ categories = "Development;TextEditor";
+ };
+
+ buildInputs = [ atomEnv makeWrapper ];
+
+ phases = [ "installPhase" ];
+
+ installPhase = ''
+ mkdir -p $out/share/atom
+ mkdir -p $out/bin
+ tar -C $out/share/atom -xvf $src
+ patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ $out/share/atom/atom
+ patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ $out/share/atom/resources/app/apm/node_modules/atom-package-manager/bin/node
+ makeWrapper $out/share/atom/atom $out/bin/atom \
+ --prefix "LD_LIBRARY_PATH" : "${atomEnv}/lib:${atomEnv}/lib64"
+
+ # Create a desktop item.
+ mkdir -p "$out/share/applications"
+ cp "${desktopItem}"/share/applications/* "$out/share/applications/"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A hackable text editor for the 21st Century";
+ homepage = https://atom.io/;
+ license = [ licenses.mit ];
+ maintainers = [ maintainers.offline ];
+ platforms = [ "x86_64-linux" ];
+ };
+}
diff --git a/pkgs/applications/editors/bvi/default.nix b/pkgs/applications/editors/bvi/default.nix
index 84b810bf460..e598fa19c5e 100644
--- a/pkgs/applications/editors/bvi/default.nix
+++ b/pkgs/applications/editors/bvi/default.nix
@@ -13,6 +13,6 @@ stdenv.mkDerivation {
meta = {
description = "Hex editor with vim style keybindings";
homepage = http://bvi.sourceforge.net/download.html;
- license = "GPL2";
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/applications/editors/codeblocks/default.nix b/pkgs/applications/editors/codeblocks/default.nix
new file mode 100644
index 00000000000..1bf4bb1f8e6
--- /dev/null
+++ b/pkgs/applications/editors/codeblocks/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, autoconf, automake, libtool, pkgconfig, file, zip, wxGTK, gtk
+, contribPlugins ? false, hunspell, gamin, boost
+}:
+
+with { inherit (stdenv.lib) optionalString optional optionals; };
+
+stdenv.mkDerivation rec {
+ name = "${pname}-${stdenv.lib.optionalString contribPlugins "full-"}${version}";
+ version = "13.12";
+ pname = "codeblocks";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/codeblocks/Sources/${version}/codeblocks_${version}-1.tar.gz";
+ sha256 = "044njhps4cm1ijfdyr5f9wjyd0vblhrz9b4603ma52wcdq25093p";
+ };
+
+ buildInputs = [ automake autoconf libtool pkgconfig file zip wxGTK gtk ]
+ ++ optionals contribPlugins [ hunspell gamin boost ];
+ enableParallelBuilding = true;
+ patches = [ ./writable-projects.patch ];
+ preConfigure = "substituteInPlace ./configure --replace /usr/bin/file ${file}/bin/file";
+ postConfigure = optionalString stdenv.isLinux "substituteInPlace libtool --replace ldconfig ${stdenv.gcc.libc}/sbin/ldconfig";
+ configureFlags = [ "--enable-pch=no" ]
+ ++ optional contribPlugins "--with-contrib-plugins";
+
+ meta = with stdenv.lib; {
+ maintainers = [ maintainers.linquize ];
+ platforms = platforms.all;
+ description = "The open source, cross platform, free C, C++ and Fortran IDE";
+ longDescription =
+ ''
+ Code::Blocks is a free C, C++ and Fortran IDE built to meet the most demanding needs of its users.
+ It is designed to be very extensible and fully configurable.
+ Finally, an IDE with all the features you need, having a consistent look, feel and operation across platforms.
+ '';
+ homepage = http://www.codeblocks.org;
+ license = licenses.gpl3;
+ };
+}
diff --git a/pkgs/applications/editors/codeblocks/writable-projects.patch b/pkgs/applications/editors/codeblocks/writable-projects.patch
new file mode 100644
index 00000000000..3b6364a52a1
--- /dev/null
+++ b/pkgs/applications/editors/codeblocks/writable-projects.patch
@@ -0,0 +1,18 @@
+diff --git a/src/plugins/scriptedwizard/wiz.cpp b/src/plugins/scriptedwizard/wiz.cpp
+index 0eb4b27..7d469fe 100644
+--- a/src/plugins/scriptedwizard/wiz.cpp
++++ b/src/plugins/scriptedwizard/wiz.cpp
+@@ -785,6 +785,13 @@ void Wiz::CopyFiles(cbProject* theproject, const wxString& prjdir, const wxStri
+ }
+ }
+ if (do_copy) wxCopyFile(srcfile, dstfile, true);
++ // Noticed! Files in Nix Store are readonly, so make the copied file writable
++ if (do_copy)
++ {
++ struct stat statbuf;
++ if (!::stat(dstfile.mb_str(), &statbuf))
++ ::chmod(dstfile.mb_str(), statbuf.st_mode | 0200);
++ }
+
+ // and add it to the project
+ fname.MakeRelativeTo(prjdir);
diff --git a/pkgs/applications/editors/dhex/default.nix b/pkgs/applications/editors/dhex/default.nix
index 45b7de900e2..7a0e9e59d7e 100644
--- a/pkgs/applications/editors/dhex/default.nix
+++ b/pkgs/applications/editors/dhex/default.nix
@@ -12,9 +12,9 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses ];
installPhase = ''
- ensureDir $out/bin
- ensureDir $out/share/man/man1
- ensureDir $out/share/man/man5
+ mkdir -p $out/bin
+ mkdir -p $out/share/man/man1
+ mkdir -p $out/share/man/man5
cp dhex $out/bin
cp dhex.1 $out/share/man/man1
diff --git a/pkgs/applications/editors/eclipse/default.nix b/pkgs/applications/editors/eclipse/default.nix
index fe3c7424907..b32981ccb94 100644
--- a/pkgs/applications/editors/eclipse/default.nix
+++ b/pkgs/applications/editors/eclipse/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, patchelf, makeDesktopItem, makeWrapper
+{ stdenv, fetchurl, makeDesktopItem, makeWrapper
, freetype, fontconfig, libX11, libXext, libXrender, zlib
, glib, gtk, libXtst, jre
}:
@@ -23,7 +23,7 @@ let
categories = "Application;Development;";
};
- buildInputs = [ makeWrapper patchelf ];
+ buildInputs = [ makeWrapper ];
buildCommand = ''
# Unpack tarball.
@@ -176,6 +176,22 @@ in {
};
};
+ eclipse_cpp_43 = buildEclipse {
+ name = "eclipse-cpp-4.3.2";
+ description = "Eclipse IDE for C/C++ Developers";
+ src =
+ if stdenv.system == "x86_64-linux" then
+ fetchurl {
+ url = http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/technology/epp/downloads/release/kepler/SR2/eclipse-cpp-kepler-SR2-linux-gtk-x86_64.tar.gz;
+ sha256 = "16zhjm6bx78263b1clg75kfiliahkhwg0k116vp9fj039nlpc30l";
+ }
+ else
+ fetchurl {
+ url = http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/technology/epp/downloads/release/kepler/SR2/eclipse-cpp-kepler-SR2-linux-gtk.tar.gz;
+ sha256 = "0d6jlj7hwz8blx6csrlyi2h2prql0wckbh7ihwjmgclwpcpj84g6";
+ };
+ };
+
eclipse_sdk_421 = buildEclipse {
name = "eclipse-sdk-4.2.1";
description = "Eclipse Classic";
@@ -222,4 +238,19 @@ in {
};
};
+ eclipse_sdk_44 = buildEclipse {
+ name = "eclipse-sdk-4.4";
+ description = "Eclipse Classic";
+ sources = {
+ "x86_64-linux" = fetchurl {
+ url = http://download.eclipse.org/eclipse/downloads/drops4/R-4.4-201406061215/eclipse-SDK-4.4-linux-gtk-x86_64.tar.gz;
+ sha256 = "14hdkijsjq0hhzi9ijpwjjkhz7wm0pry86l3dniy5snlh3l5bsb2";
+ };
+ "i686-linux" = fetchurl {
+ url = http://download.eclipse.org/eclipse/downloads/drops4/R-4.4-201406061215/eclipse-SDK-4.4-linux-gtk.tar.gz;
+ sha256 = "0hjc4zrsmik6vff851p0a4ydnx99840j2xrx8348kk6h0af8vx6z";
+ };
+ };
+ };
+
}
diff --git a/pkgs/applications/editors/ed/default.nix b/pkgs/applications/editors/ed/default.nix
index 3e22cfd0412..d3e9a4c4679 100644
--- a/pkgs/applications/editors/ed/default.nix
+++ b/pkgs/applications/editors/ed/default.nix
@@ -1,11 +1,11 @@
{ fetchurl, stdenv }:
stdenv.mkDerivation rec {
- name = "ed-1.7";
+ name = "ed-1.9";
src = fetchurl {
url = "mirror://gnu/ed/${name}.tar.gz";
- sha256 = "0c908wb5pm48rjrrfbm5dhrqzys8f1dbvi90dn0vgwjzk80l2hl9";
+ sha256 = "122syihsx2hwzj75mkf5a9ssiky2xby748kp4cc00wzhmp7p5cym";
};
/* FIXME: Tests currently fail on Darwin:
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
full-screen editors such as GNU Emacs or GNU Moe.
'';
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
homepage = http://www.gnu.org/software/ed/;
diff --git a/pkgs/applications/editors/emacs-23/builder.sh b/pkgs/applications/editors/emacs-23/builder.sh
deleted file mode 100644
index d04e7a4fdd3..00000000000
--- a/pkgs/applications/editors/emacs-23/builder.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-source $stdenv/setup
-
-# This hook is supposed to be run on Linux. It patches the proper locations of
-# the crt{1,i,n}.o files into the build to ensure that Emacs is linked with
-# *our* versions, not the ones found in the system, as it would do by default.
-# On other platforms, this appears to be unnecessary.
-preConfigure() {
- case "${system}" in
- x86_64-linux) glibclibdir=lib64 ;;
- i686-linux) glibclibdir=lib ;;
- *) return;
- esac
-
- libc=$(cat ${NIX_GCC}/nix-support/orig-libc)
- echo "libc: $libc"
-
- for i in src/s/*.h src/m/*.h; do
- substituteInPlace $i \
- --replace /usr/${glibclibdir}/crt1.o $libc/${glibclibdir}/crt1.o \
- --replace /usr/${glibclibdir}/crti.o $libc/${glibclibdir}/crti.o \
- --replace /usr/${glibclibdir}/crtn.o $libc/${glibclibdir}/crtn.o \
- --replace /usr/lib/crt1.o $libc/${glibclibdir}/crt1.o \
- --replace /usr/lib/crti.o $libc/${glibclibdir}/crti.o \
- --replace /usr/lib/crtn.o $libc/${glibclibdir}/crtn.o
- done
-
- for i in Makefile.in ./src/Makefile.in ./lib-src/Makefile.in ./leim/Makefile.in; do
- substituteInPlace $i --replace /bin/pwd pwd
- done
-}
-
-preBuild="make bootstrap"
-
-genericBuild
diff --git a/pkgs/applications/editors/emacs-23/default.nix b/pkgs/applications/editors/emacs-23/default.nix
deleted file mode 100644
index ab5c8e49e7f..00000000000
--- a/pkgs/applications/editors/emacs-23/default.nix
+++ /dev/null
@@ -1,72 +0,0 @@
-{ stdenv, fetchurl, ncurses, x11, libXaw, libXpm, Xaw3d
-, pkgconfig, gtk, libXft, dbus, libpng, libjpeg, libungif
-, libtiff, librsvg, texinfo, gconf
-}:
-
-assert (gtk != null) -> (pkgconfig != null);
-assert (libXft != null) -> libpng != null; # probably a bug
-assert stdenv.isDarwin -> libXaw != null; # fails to link otherwise
-
-stdenv.mkDerivation rec {
- name = "emacs-23.4";
-
- builder = ./builder.sh;
-
- src = fetchurl {
- url = "mirror://gnu/emacs/${name}.tar.bz2";
- sha256 = "1fc8x5p38qihg7l6z2b1hjc534lnjb8gqpwgywlwg5s3csg6ymr6";
- };
-
- buildInputs =
- [ ncurses x11 texinfo libXaw Xaw3d libXpm libpng libjpeg libungif
- libtiff librsvg libXft gconf
- ]
- ++ stdenv.lib.optionals (gtk != null) [ gtk pkgconfig ]
- ++ stdenv.lib.optional stdenv.isLinux dbus;
-
- configureFlags =
- stdenv.lib.optionals (gtk != null) [ "--with-x-toolkit=gtk" "--with-xft"]
-
- # On NixOS, help Emacs find `crt*.o'.
- ++ stdenv.lib.optional (stdenv ? glibc)
- [ "--with-crt-dir=${stdenv.glibc}/lib" ];
-
- postInstall = ''
- cat >$out/share/emacs/site-lisp/site-start.el <addr <= (unsigned long)my_edata
+ && my_size <= sectp->size))
+ unexec_error ("my_edata is not in section %s", SECT_DATA);
+- if (!unexec_write (sectp->offset, (void *) sectp->addr, my_size))
++ if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size))
+ unexec_error ("cannot write section %s", SECT_DATA);
+ if (!unexec_copy (sectp->offset + my_size, old_file_offset + my_size,
+ sectp->size - my_size))
+@@ -880,6 +880,27 @@
+ if (!unexec_write (header_offset, sectp, sizeof (struct section)))
+ unexec_error ("cannot write section %.16s's header", sectp->sectname);
+ }
++ else if (strncmp (sectp->sectname, "__bss", 5) == 0
++ || strncmp (sectp->sectname, "__pu_bss", 8) == 0)
++ {
++ sectp->flags = S_REGULAR;
++
++ /* These sections are produced by GCC 4.6+.
++
++ FIXME: We possibly ought to clear uninitialized local
++ variables in statically linked libraries like for
++ SECT_BSS (__bss) above, but setting up the markers we
++ need in lastfile.c would be rather messy. See
++ darwin_output_aligned_bss () in gcc/config/darwin.c for
++ the root of the problem, keeping in mind that the
++ sections are numbered by their alignment in GCC 4.6, but
++ by log2(alignment) in GCC 4.7. */
++
++ if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size))
++ unexec_error ("cannot copy section %.16s", sectp->sectname);
++ if (!unexec_write (header_offset, sectp, sizeof (struct section)))
++ unexec_error ("cannot write section %.16s's header", sectp->sectname);
++ }
+ else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
+ || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0
+ || strncmp (sectp->sectname, "__got", 16) == 0
+@@ -891,6 +912,7 @@
+ || strncmp (sectp->sectname, "__program_vars", 16) == 0
+ || strncmp (sectp->sectname, "__mod_init_func", 16) == 0
+ || strncmp (sectp->sectname, "__mod_term_func", 16) == 0
++ || strncmp (sectp->sectname, "__static_data", 16) == 0
+ || strncmp (sectp->sectname, "__objc_", 7) == 0)
+ {
+ if (!unexec_copy (sectp->offset, old_file_offset, sectp->size))
diff --git a/pkgs/applications/editors/emacs-24/default.nix b/pkgs/applications/editors/emacs-24/default.nix
index 18e263dae67..329fa3a5626 100644
--- a/pkgs/applications/editors/emacs-24/default.nix
+++ b/pkgs/applications/editors/emacs-24/default.nix
@@ -1,8 +1,8 @@
{ stdenv, fetchurl, ncurses, x11, libXaw, libXpm, Xaw3d
, pkgconfig, gtk, libXft, dbus, libpng, libjpeg, libungif
-, libtiff, librsvg, texinfo, gconf, libxml2, imagemagick, gnutls
+, libtiff, librsvg, texinfo, gconf, libxml2, imagemagick, openssl
, alsaLib, cairo
-, withX ? true
+, withX ? !stdenv.isDarwin, withGTK ? true
}:
assert (libXft != null) -> libpng != null; # probably a bug
@@ -18,20 +18,24 @@ stdenv.mkDerivation rec {
sha256 = "1385qzs3bsa52s5rcncbrkxlydkw0ajzrvfxgv8rws5fx512kakh";
};
+ patches = [ ./darwin-new-sections.patch ];
+
buildInputs =
- [ ncurses gconf libxml2 gnutls alsaLib pkgconfig texinfo ]
+ [ ncurses gconf libxml2 openssl alsaLib pkgconfig texinfo ]
++ stdenv.lib.optional stdenv.isLinux dbus
++ stdenv.lib.optionals withX
[ x11 libXaw Xaw3d libXpm libpng libjpeg libungif libtiff librsvg libXft
- imagemagick gtk ]
- ++ stdenv.lib.optional stdenv.isDarwin cairo;
+ imagemagick gtk gconf ]
+ ++ stdenv.lib.optional (stdenv.isDarwin && withX) cairo;
configureFlags =
- ( if withX then
+ ( if withX && withGTK then
[ "--with-x-toolkit=gtk" "--with-xft"]
+ else (if withX then
+ [ "--with-x-toolkit=lucid" "--with-xft" ]
else
[ "--with-x=no" "--with-xpm=no" "--with-jpeg=no" "--with-png=no"
- "--with-gif=no" "--with-tiff=no" ] )
+ "--with-gif=no" "--with-tiff=no" ] ) )
# On NixOS, help Emacs find `crt*.o'.
++ stdenv.lib.optional (stdenv ? glibc)
[ "--with-crt-dir=${stdenv.glibc}/lib" ];
diff --git a/pkgs/applications/editors/emacs-24/macport.nix b/pkgs/applications/editors/emacs-24/macport.nix
new file mode 100644
index 00000000000..d9b32351040
--- /dev/null
+++ b/pkgs/applications/editors/emacs-24/macport.nix
@@ -0,0 +1,100 @@
+{ stdenv, fetchurl, ncurses, pkgconfig, texinfo, libxml2, gnutls
+}:
+
+stdenv.mkDerivation rec {
+ emacsName = "emacs-24.3";
+ name = "${emacsName}-mac-4.8";
+
+ #builder = ./builder.sh;
+
+ src = fetchurl {
+ url = "mirror://gnu/emacs/${emacsName}.tar.xz";
+ sha256 = "1385qzs3bsa52s5rcncbrkxlydkw0ajzrvfxgv8rws5fx512kakh";
+ };
+
+ macportSrc = fetchurl {
+ url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${name}.tar.gz";
+ sha256 = "194y341zrpjp75mc3099kjc0inr1d379wwsnav257bwsc967h8yx";
+ };
+
+ patches = [ ./darwin-new-sections.patch ];
+
+ buildInputs = [ ncurses pkgconfig texinfo libxml2 gnutls ];
+
+ postUnpack = ''
+ mv $emacsName $name
+ tar xzf $macportSrc
+ mv $name $emacsName
+ '';
+
+ preConfigure = ''
+ patch -p0 < patch-mac
+
+ # The search for 'tputs' will fail because it's in ncursesw within the
+ # ncurses package, yet Emacs' configure script only looks in ncurses.
+ # Further, we need to make sure that the -L option occurs before mention
+ # of the library, so that it finds it within the Nix store.
+ sed -i 's/tinfo ncurses/tinfo ncursesw/' configure
+ ncurseslib=$(echo ${ncurses}/lib | sed 's#/#\\/#g')
+ sed -i "s/OLIBS=\$LIBS/OLIBS=\"-L$ncurseslib \$LIBS\"/" configure
+ sed -i 's/LIBS="\$LIBS_TERMCAP \$LIBS"/LIBS="\$LIBS \$LIBS_TERMCAP"/' configure
+
+ configureFlagsArray=(
+ LDFLAGS=-L${ncurses}/lib
+ --with-xml2=yes
+ --with-gnutls=yes
+ --with-mac
+ --enable-mac-app=$out/Applications
+ )
+ makeFlagsArray=(
+ CFLAGS=-O3
+ LDFLAGS="-O3 -L${ncurses}/lib"
+ );
+ '';
+
+ postInstall = ''
+ cat >$out/share/emacs/site-lisp/site-start.el <**20131103203640
+ Ignore-this: d12bac373e4aa0e5ffe6c390e1dfe269
+]
diff --git a/pkgs/applications/editors/emacs-modes/darcsum/default.nix b/pkgs/applications/editors/emacs-modes/darcsum/default.nix
new file mode 100644
index 00000000000..349146dbdd8
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/darcsum/default.nix
@@ -0,0 +1,34 @@
+# To automatically load darcsum when needed, add the following to your emacs init file:
+#
+# (autoload 'darcsum-changes "darcsum" nil t)
+# (autoload 'darcsum-whatsnew "darcsum" nil t)
+# (autoload 'darcsum-view "darcsum" nil t)
+#
+# (These lines were copied from 50darcsum.el in the darcsum repository.)
+
+
+{ fetchdarcs, stdenv }:
+
+stdenv.mkDerivation {
+ name = "darcsum-1.3";
+
+ src = fetchdarcs {
+ url = http://hub.darcs.net/simon/darcsum;
+ context = ./darcs_context;
+ sha256 = "18dyk2apmnjapd604a5njfqwjri1mc7lgjaajy9phicpibgdrwzh";
+ };
+
+ phases = [ "unpackPhase" "installPhase" ];
+
+ installPhase = ''
+ install -d "$out/share/emacs/site-lisp"
+ install darcsum.el "$out/share/emacs/site-lisp"
+ '';
+
+ meta = {
+ description = "A pcl-cvs like interface for managing darcs patches.";
+ homepage = "http://hub.darcs.net/simon/darcsum";
+ license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = [ stdenv.lib.maintainers.falsifian ];
+ };
+}
diff --git a/pkgs/applications/editors/emacs-modes/ecb/default.nix b/pkgs/applications/editors/emacs-modes/ecb/default.nix
index 33f0299f5f0..807bb91f850 100644
--- a/pkgs/applications/editors/emacs-modes/ecb/default.nix
+++ b/pkgs/applications/editors/emacs-modes/ecb/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
navigation and overview.
'';
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
homepage = http://ecb.sourceforge.net/;
diff --git a/pkgs/applications/editors/emacs-modes/emacs-clang-complete-async/default.nix b/pkgs/applications/editors/emacs-modes/emacs-clang-complete-async/default.nix
index 9db6e4cb736..af031a6e1a1 100644
--- a/pkgs/applications/editors/emacs-modes/emacs-clang-complete-async/default.nix
+++ b/pkgs/applications/editors/emacs-modes/emacs-clang-complete-async/default.nix
@@ -1,4 +1,4 @@
-{ clangStdenv, fetchgit, llvm, clangUnwrapped }:
+{ clangStdenv, fetchgit, llvm, clang }:
clangStdenv.mkDerivation {
name = "emacs-clang-complete-async-20130218";
@@ -8,7 +8,7 @@ clangStdenv.mkDerivation {
sha256 = "1c8zqi6axbsb951azz9iqx3j52j30nd9ypv396hvids3g02cirrf";
};
- buildInputs = [ llvm clangUnwrapped ];
+ buildInputs = [ llvm clang.clang ];
installPhase = ''
mkdir -p $out/bin
@@ -20,7 +20,6 @@ clangStdenv.mkDerivation {
meta = {
homepage = "https://github.com/Golevka/emacs-clang-complete-async";
description = "An emacs plugin to complete C and C++ code using libclang";
- license = "GPLv3+";
+ license = clangStdenv.lib.licenses.gpl3Plus;
};
}
-
diff --git a/pkgs/applications/editors/emacs-modes/emacs-w3m/default.nix b/pkgs/applications/editors/emacs-modes/emacs-w3m/default.nix
index e0373fca5df..26f313f038d 100644
--- a/pkgs/applications/editors/emacs-modes/emacs-w3m/default.nix
+++ b/pkgs/applications/editors/emacs-modes/emacs-w3m/default.nix
@@ -52,10 +52,10 @@ stdenv.mkDerivation rec {
developed a simple Emacs interface to w3m.
'';
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
homepage = http://emacs-w3m.namazu.org/;
- maintainers = [ ];
+ maintainers = [ stdenv.lib.maintainers.mornfall ];
};
}
diff --git a/pkgs/applications/editors/emacs-modes/emms/default.nix b/pkgs/applications/editors/emacs-modes/emms/default.nix
index 5439ba9e4d6..a44be28399d 100644
--- a/pkgs/applications/editors/emacs-modes/emms/default.nix
+++ b/pkgs/applications/editors/emacs-modes/emms/default.nix
@@ -64,9 +64,10 @@ stdenv.mkDerivation rec {
homepage = http://www.gnu.org/software/emms/;
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
- platforms = stdenv.lib.platforms.gnu;
+ platforms = stdenv.lib.platforms.unix;
+ broken = true;
};
}
diff --git a/pkgs/applications/editors/emacs-modes/ess/default.nix b/pkgs/applications/editors/emacs-modes/ess/default.nix
index 4bd5148b950..46e20a58ee6 100644
--- a/pkgs/applications/editors/emacs-modes/ess/default.nix
+++ b/pkgs/applications/editors/emacs-modes/ess/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, emacs, texinfo }:
-stdenv.mkDerivation {
- name = "ess-13.05";
+stdenv.mkDerivation rec {
+ name = "ess-13.09";
src = fetchurl {
- url = "http://ess.r-project.org/downloads/ess/ess-13.05.tgz";
- sha256 = "007rd8hg1aclr2i8178ym5c4bi7vgmwkp802v1mkgr85h50zlfdk";
+ url = "http://ess.r-project.org/downloads/ess/${name}.tgz";
+ sha256 = "1lki3vb6p7cw98zqq0gaia68flpqrjkd6dcl85fs0cc8qf55yqnh";
};
buildInputs = [ emacs texinfo ];
@@ -16,5 +16,6 @@ stdenv.mkDerivation {
description = "Emacs Speaks Statistics";
homepage = "http://ess.r-project.org/";
license = stdenv.lib.licenses.gpl2Plus;
+ hydraPlatforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/editors/emacs-modes/flymake-cursor/default.nix b/pkgs/applications/editors/emacs-modes/flymake-cursor/default.nix
index 4b2692a5e22..eae338d241d 100644
--- a/pkgs/applications/editors/emacs-modes/flymake-cursor/default.nix
+++ b/pkgs/applications/editors/emacs-modes/flymake-cursor/default.nix
@@ -5,7 +5,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "http://www.emacswiki.org/emacs/download/flymake-cursor.el";
- sha256 = "1qqppd1786w8pl1avjb01n23lwihb7m0hr23abjklsxz03gmp4qz";
+ sha256 = "10cpzrd588ya52blghxss5zkn6x8hc7bx1h0qbcdlybbmkjgpkxr";
};
phases = [ "buildPhase" "installPhase"];
@@ -26,7 +26,5 @@ stdenv.mkDerivation rec {
description = "Displays flymake error msg in minibuffer after delay";
homepage = http://www.emacswiki.org/emacs/flymake-cursor.el;
license = stdenv.lib.licenses.publicDomain;
-
- platforms = stdenv.lib.platforms.all;
};
}
diff --git a/pkgs/applications/editors/emacs-modes/gh/default.nix b/pkgs/applications/editors/emacs-modes/gh/default.nix
index 28773e97c40..dca84a7936d 100644
--- a/pkgs/applications/editors/emacs-modes/gh/default.nix
+++ b/pkgs/applications/editors/emacs-modes/gh/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
meta = {
description = "A (very early) GitHub client library for Emacs";
homepage = https://github.com/sigma/gh.el;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = stdenv.lib.platforms.all;
};
diff --git a/pkgs/applications/editors/emacs-modes/gist/default.nix b/pkgs/applications/editors/emacs-modes/gist/default.nix
index 21a2137dd39..08471247f08 100644
--- a/pkgs/applications/editors/emacs-modes/gist/default.nix
+++ b/pkgs/applications/editors/emacs-modes/gist/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Emacs integration for gist.github.com";
homepage = https://github.com/sigma/gist.el;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = stdenv.lib.platforms.all;
};
diff --git a/pkgs/applications/editors/emacs-modes/haskell/default.nix b/pkgs/applications/editors/emacs-modes/haskell/default.nix
index a1e52e1c301..3f4b93dc638 100644
--- a/pkgs/applications/editors/emacs-modes/haskell/default.nix
+++ b/pkgs/applications/editors/emacs-modes/haskell/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, emacs, texinfo }:
stdenv.mkDerivation rec {
- name = "haskell-mode-13.07";
+ name = "haskell-mode-13.10";
src = fetchurl {
- url = "https://github.com/haskell/haskell-mode/archive/v13.07.tar.gz";
- sha256 = "15c8ncj9mykkrizy1a8l94gq37s8hj13v3p5rgyaj9z0cwgl85kx";
+ url = "https://github.com/haskell/haskell-mode/archive/v13.10.tar.gz";
+ sha256 = "0hcg7wpalcdw8j36m8vd854zrrgym074r7m903rpwfrhx9mlg02b";
};
buildInputs = [ emacs texinfo ];
diff --git a/pkgs/applications/editors/emacs-modes/hol_light/default.nix b/pkgs/applications/editors/emacs-modes/hol_light/default.nix
index 24eba20be6c..c32669239f8 100644
--- a/pkgs/applications/editors/emacs-modes/hol_light/default.nix
+++ b/pkgs/applications/editors/emacs-modes/hol_light/default.nix
@@ -1,15 +1,12 @@
-{stdenv, fetchsvn}:
+{ stdenv, fetchsvn }:
-let
- revision = "73";
-in
-
-stdenv.mkDerivation {
- name = "hol_light_mode-${revision}";
+stdenv.mkDerivation rec {
+ name = "hol_light-mode-${version}";
+ version = "73";
src = fetchsvn {
url = http://seanmcl-ocaml-lib.googlecode.com/svn/trunk/workshop/software/emacs;
- rev = revision;
+ rev = version;
sha256 = "3ca83098960439da149a47e1caff32536601559a77f04822be742a390c67feb7";
};
@@ -20,6 +17,10 @@ stdenv.mkDerivation {
'';
meta = {
- description = "A HOL Light mode for emacs";
+ description = "A HOL Light mode for Emacs";
+ homepage = http://www.cl.cam.ac.uk/~jrh13/hol-light/;
+ license = stdenv.lib.licenses.gpl2Plus;
+ platforms = stdenv.lib.platforms.all;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
};
}
diff --git a/pkgs/applications/editors/emacs-modes/idris/default.nix b/pkgs/applications/editors/emacs-modes/idris/default.nix
new file mode 100644
index 00000000000..28375dcb68d
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/idris/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, emacs }:
+
+stdenv.mkDerivation rec {
+ name = "${pname}-${version}";
+ pname = "idris-mode";
+ version = "0.9.13.1";
+
+ src = fetchurl {
+ url = "https://github.com/idris-hackers/${pname}/archive/${version}.tar.gz";
+ sha256 = "0ymjbkwsq7qra691wyldw91xcdgrbx3468vvrha5jj92v7nwb8wx";
+ };
+
+ buildInputs = [ emacs ];
+
+ buildPhase = ''
+ emacs -L . --batch -f batch-byte-compile *.el
+ '';
+
+ installPhase = ''
+ install -d $out/share/emacs/site-lisp
+ install *.el *.elc $out/share/emacs/site-lisp
+ '';
+
+ meta = {
+ description = "Emacs major mode for Idris";
+ homepage = https://github.com/idris-hackers/idris-mode;
+ license = stdenv.lib.licenses.gpl3;
+
+ platforms = stdenv.lib.platforms.all;
+ };
+}
diff --git a/pkgs/applications/editors/emacs-modes/jade/default.nix b/pkgs/applications/editors/emacs-modes/jade/default.nix
index ab0e3512ef2..925fa54c735 100644
--- a/pkgs/applications/editors/emacs-modes/jade/default.nix
+++ b/pkgs/applications/editors/emacs-modes/jade/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation {
meta = {
description = "Emacs major mode for jade and stylus";
homepage = https://github.com/brianc/jade-mode;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = stdenv.lib.platforms.all;
};
diff --git a/pkgs/applications/editors/emacs-modes/jdee/default.nix b/pkgs/applications/editors/emacs-modes/jdee/default.nix
index b25d178d164..e47da7a4193 100644
--- a/pkgs/applications/editors/emacs-modes/jdee/default.nix
+++ b/pkgs/applications/editors/emacs-modes/jdee/default.nix
@@ -26,8 +26,8 @@ in
mkdir -p "dist"
cat > build.properties < # specify the correct JAVA_HOME
- > JAVA_HOME=${jre}
+ > JAVA_HOME=${jdk.jre}/lib/openjdk/jre
>
EOF
sed -i "s|/usr/share/jEdit/@jar.filename@|$out/share/jEdit/jedit.jar|g" package-files/linux/jedit
@@ -44,9 +44,7 @@ stdenv.mkDerivation {
chmod +x $out/bin/jedit
'';
- buildInputs = [ ant ];
-
- meta = {
+ meta = {
description = "Mature programmer's text editor (Java based)";
homepage = http://www.jedit.org;
license = "GPL";
diff --git a/pkgs/applications/editors/kdevelop/default.nix b/pkgs/applications/editors/kdevelop/default.nix
index 14f9c1eb0d4..b815b052347 100644
--- a/pkgs/applications/editors/kdevelop/default.nix
+++ b/pkgs/applications/editors/kdevelop/default.nix
@@ -1,28 +1,20 @@
{ stdenv, fetchurl, kdevplatform, cmake, pkgconfig, automoc4, shared_mime_info,
- kdebase_workspace, gettext, perl, okteta }:
+ kdebase_workspace, gettext, perl, okteta, qjson }:
stdenv.mkDerivation rec {
name = "${pname}-${version}";
- version = "4.3.1";
+ version = "4.6.0";
pname = "kdevelop";
src = fetchurl {
- url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.bz2";
- sha256 = "0015hv39rqhyq1w6jw65lx7ls4l5pc3a2asvd5zsd65831vrfxxs";
+ url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.xz";
+ sha256 = "1ee9e7b8c46f575dd29d920cfd6284130f2e738a2e1f52dfd97b075fab2e4c73";
};
- buildInputs = [ kdevplatform kdebase_workspace okteta ];
+ buildInputs = [ kdevplatform kdebase_workspace okteta qjson ];
nativeBuildInputs = [ cmake pkgconfig automoc4 shared_mime_info gettext perl ];
- patches =
- [ ( fetchurl {
- url = https://git.reviewboard.kde.org/r/105211/diff/raw/;
- name = "okteta-0.9.patch"; # fixes build with KDE-4.9.x
- sha256 = "1mvqhw7jr1vi66l3jgam3slyfafcvwy4g3iapfi69dpfnzhmcxl0";
- } )
- ];
-
NIX_CFLAGS_COMPILE = "-I${okteta}/include/KDE";
meta = with stdenv.lib; {
diff --git a/pkgs/applications/editors/leksah/default.nix b/pkgs/applications/editors/leksah/default.nix
deleted file mode 100644
index 86f0106ed05..00000000000
--- a/pkgs/applications/editors/leksah/default.nix
+++ /dev/null
@@ -1,28 +0,0 @@
-{ cabal, binary, binaryShared, Cabal, deepseq, enumerator, filepath
-, gio, glib, gtk, gtksourceview2, hslogger, leksahServer, ltk, mtl
-, network, parsec, QuickCheck, regexBase, regexTdfa, strict, text
-, time, transformers, utf8String
-}:
-
-cabal.mkDerivation (self: {
- pname = "leksah";
- version = "0.12.1.3";
- sha256 = "1w61wnd0nq9iqh0pwn9dz3m4qn3m0zasv0m3ki4k7plcdrmkqb3y";
- isLibrary = true;
- isExecutable = true;
- buildDepends = [
- binary binaryShared Cabal deepseq enumerator filepath gio glib gtk
- gtksourceview2 hslogger leksahServer ltk mtl network parsec
- QuickCheck regexBase regexTdfa strict text time transformers
- utf8String
- ];
- testDepends = [ Cabal QuickCheck ];
- noHaddock = true;
- meta = {
- homepage = "http://www.leksah.org";
- description = "Haskell IDE written in Haskell";
- license = "GPL";
- platforms = self.stdenv.lib.platforms.linux;
- maintainers = [ self.stdenv.lib.maintainers.andres ];
- };
-})
diff --git a/pkgs/applications/editors/lighttable/default.nix b/pkgs/applications/editors/lighttable/default.nix
new file mode 100644
index 00000000000..b5ab1950e2b
--- /dev/null
+++ b/pkgs/applications/editors/lighttable/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchurl, buildEnv, makeDesktopItem, makeWrapper, zlib, glib, alsaLib
+, dbus, gtk, atk, pango, freetype, fontconfig, libgnome_keyring3, gdk_pixbuf
+, cairo, cups, expat, libgpgerror, nspr, gnome3, nss, xlibs, udev
+}:
+
+let
+ libPath = stdenv.lib.makeLibraryPath [
+ stdenv.gcc.gcc zlib glib dbus gtk atk pango freetype libgnome_keyring3 nss
+ fontconfig gdk_pixbuf cairo cups expat libgpgerror alsaLib nspr gnome3.gconf
+ xlibs.libXrender xlibs.libX11 xlibs.libXext xlibs.libXdamage xlibs.libXtst
+ xlibs.libXcomposite xlibs.libXi xlibs.libXfixes
+];
+in
+assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
+
+stdenv.mkDerivation rec {
+ name = "LightTable-${version}";
+ version = "0.6.7";
+
+ src =
+ if stdenv.system == "i686-linux" then
+ fetchurl {
+ name = "LightTableLinux.tar.gz";
+ url = https://d35ac8ww5dfjyg.cloudfront.net/playground/bins/0.6.7/LightTableLinux.tar.gz;
+ sha256 = "3b09f9665ed1b4abb7c1ca16286ac7222caf6dc124059be6db4cb9f5fd041e73";
+ }
+ else
+ fetchurl {
+ name = "LightTableLinux64.tar.gz";
+ url = https://d35ac8ww5dfjyg.cloudfront.net/playground/bins/0.6.7/LightTableLinux64.tar.gz;
+ sha256 = "710d670ccc30aadba521ccb723388679ee6404aac662297a005432c811d59e82";
+ };
+
+ buildInputs = [ makeWrapper ];
+ phases = [ "installPhase" ];
+
+ installPhase = ''
+ tar xvf ${src}
+ mkdir -p $out/bin
+ mv LightTable $out/
+
+ patchelf \
+ --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ --set-rpath ${libPath}:${stdenv.gcc.gcc}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \
+ $out/LightTable/ltbin
+
+ ln -s ${udev}/lib/libudev.so.1 $out/LightTable/libudev.so.0
+
+ makeWrapper $out/LightTable/ltbin $out/bin/lighttable \
+ --prefix "LD_LIBRARY_PATH" : $out/LightTable
+ '';
+
+ meta = with stdenv.lib; {
+ description = "the next generation code editor";
+ homepage = http://www.lighttable.com/;
+ license = [ licenses.gpl3 ];
+ };
+}
diff --git a/pkgs/applications/editors/nano/default.nix b/pkgs/applications/editors/nano/default.nix
index 15cdadb04f5..caea8758d95 100644
--- a/pkgs/applications/editors/nano/default.nix
+++ b/pkgs/applications/editors/nano/default.nix
@@ -2,17 +2,19 @@
stdenv.mkDerivation (rec {
pname = "nano";
- version = "2.2.6";
+ version = "2.3.6";
name = "${pname}-${version}";
src = fetchurl {
url = "mirror://gnu/nano/${name}.tar.gz";
- sha256 = "0yp6pid67k8h7394spzw0067fl2r7rxm2b6kfccg87g8nlry2s5y";
+ sha256 = "a74bf3f18b12c1c777ae737c0e463152439e381aba8720b4bc67449f36a09534";
};
buildInputs = [ ncurses gettext ];
+ configureFlags = "sysconfdir=/etc";
+
meta = {
homepage = http://www.nano-editor.org/;
description = "A small, user-friendly console text editor";
diff --git a/pkgs/applications/editors/netbeans/default.nix b/pkgs/applications/editors/netbeans/default.nix
index f1fd9adbe86..5a2afebdd5c 100644
--- a/pkgs/applications/editors/netbeans/default.nix
+++ b/pkgs/applications/editors/netbeans/default.nix
@@ -11,10 +11,10 @@ let
};
in
stdenv.mkDerivation {
- name = "netbeans-7.2";
+ name = "netbeans-7.4";
src = fetchurl {
- url = http://download.netbeans.org/netbeans/7.2/final/zip/netbeans-7.2-201207171143-ml.zip;
- sha256 = "18ya1w291hdnc35vb12yqnai82wmqm7351wn82fax12kzha5fmci";
+ url = http://download.netbeans.org/netbeans/7.4/final/zip/netbeans-7.4-201310111528.zip;
+ sha256 = "0nrnghnsdix5cmp86xi1gmvarhjk2k8mlbld3dfa9impm8gpv6mx";
};
buildCommand = ''
# Unpack and copy the stuff
@@ -25,7 +25,9 @@ stdenv.mkDerivation {
# Create a wrapper capable of starting it
mkdir -p $out/bin
makeWrapper $out/netbeans/bin/netbeans $out/bin/netbeans \
- --prefix PATH : ${jdk}/bin:${which}/bin
+ --prefix PATH : ${jdk}/bin:${which}/bin \
+ --prefix JAVA_HOME : ${jdk}/lib/openjdk \
+ --add-flags "--jdkhome ${jdk}/lib/openjdk"
# Create desktop item, so we can pick it from the KDE/GNOME menu
mkdir -p $out/share/applications
diff --git a/pkgs/applications/editors/scite/default.nix b/pkgs/applications/editors/scite/default.nix
new file mode 100644
index 00000000000..234ee1f065e
--- /dev/null
+++ b/pkgs/applications/editors/scite/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, pkgconfig, gtk }:
+
+let
+ version = "3.3.7";
+
+ version_short = stdenv.lib.replaceChars [ "." ] [ "" ] "${version}";
+in stdenv.mkDerivation {
+ name = "scite-${version}";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/project/scintilla/SciTE/${version}/scite${version_short}.tgz";
+ sha256 = "0x7i6yxq50frsjkrp3lc5zy0d1ssq2n91igjn0dmqajpg7kls2dd";
+ };
+
+ buildInputs = [ pkgconfig gtk ];
+ sourceRoot = "scintilla/gtk";
+
+ buildPhase = ''
+ make
+ cd ../../scite/gtk
+ make prefix=$out/
+ '';
+
+ installPhase = ''
+ make install prefix=$out/
+ '';
+
+ meta = {
+ homepage = "http://www.scintilla.org/SciTE.html";
+ description = "SCIntilla based Text Editor";
+ license = stdenv.lib.licenses.mit;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = stdenv.lib.maintainers.rszibele;
+ };
+}
diff --git a/pkgs/applications/editors/sublime/default.nix b/pkgs/applications/editors/sublime/default.nix
index cfa44d9285c..0c967e05ba1 100644
--- a/pkgs/applications/editors/sublime/default.nix
+++ b/pkgs/applications/editors/sublime/default.nix
@@ -24,6 +24,7 @@ stdenv.mkDerivation rec {
mkdir -p $out/bin
mv Sublime* $out/sublime
ln -s $out/sublime/sublime_text $out/bin/sublime
+ ln -s $out/sublime/sublime_text $out/bin/sublime2
echo ${libPath}
patchelf \
@@ -34,6 +35,6 @@ stdenv.mkDerivation rec {
meta = {
description = "Sophisticated text editor for code, markup and prose";
- license = "unfree";
+ license = stdenv.lib.licenses.unfree;
};
}
diff --git a/pkgs/applications/editors/sublime3/default.nix b/pkgs/applications/editors/sublime3/default.nix
new file mode 100644
index 00000000000..3ef557cef4b
--- /dev/null
+++ b/pkgs/applications/editors/sublime3/default.nix
@@ -0,0 +1,62 @@
+{ fetchurl, stdenv, glib, xlibs, cairo, gtk, pango, makeWrapper}:
+
+assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
+
+let
+ build = "3059";
+ libPath = stdenv.lib.makeLibraryPath [glib xlibs.libX11 gtk cairo pango];
+in let
+ # package with just the binaries
+ sublime = stdenv.mkDerivation {
+ name = "sublimetext3-${build}-bin";
+
+ src =
+ if stdenv.system == "i686-linux" then
+ fetchurl {
+ name = "sublimetext-3.0.59.tar.bz2";
+ url = "http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_${build}_x32.tar.bz2";
+ sha256 = "5ee7b42b5db057108e97b86fd408124fc3f7b56662b2851f59d91f8f0c288088";
+ }
+ else
+ fetchurl {
+ name = "sublimetext-3.0.59.tar.bz2";
+ url = "http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_${build}_x64.tar.bz2";
+ sha256 = "da3039687664d33a734cea0151b2291ece9c7f35e5b73df5b2b5eac28a20b972";
+ };
+
+ dontStrip = true;
+ dontPatchELF = true;
+ buildInputs = [ makeWrapper ];
+
+ buildPhase = ''
+ for i in sublime_text plugin_host crash_reporter; do
+ patchelf \
+ --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ --set-rpath ${libPath}:${stdenv.gcc.gcc}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \
+ $i
+ done
+ '';
+
+ installPhase = ''
+ mkdir -p $out
+ cp -prvd * $out/
+ # Without this, plugin_host crashes, even though it has the rpath
+ wrapProgram $out/plugin_host --prefix LD_PRELOAD : ${stdenv.gcc.gcc}/lib${stdenv.lib.optionalString stdenv.is64bit "64"}/libgcc_s.so.1
+ '';
+ };
+in stdenv.mkDerivation {
+ name = "sublimetext3-${build}";
+
+ phases = [ "installPhase" ];
+ installPhase = ''
+ mkdir -p $out/bin
+ ln -s ${sublime}/sublime_text $out/bin/sublime
+ ln -s ${sublime}/sublime_text $out/bin/sublime3
+ '';
+
+ meta = {
+ description = "Sophisticated text editor for code, markup and prose";
+ maintainers = stdenv.lib.maintainers.wmertens;
+ license = stdenv.lib.licenses.unfree;
+ };
+}
diff --git a/pkgs/applications/editors/texmacs/default.nix b/pkgs/applications/editors/texmacs/default.nix
index 1c6d86a2f3d..ce863312251 100644
--- a/pkgs/applications/editors/texmacs/default.nix
+++ b/pkgs/applications/editors/texmacs/default.nix
@@ -88,7 +88,7 @@ stdenv.mkDerivation rec {
collaborative authoring are planned for later.
'';
homepage = http://texmacs.org/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.roconnor ];
platforms = stdenv.lib.platforms.gnu; # arbitrary choice
};
diff --git a/pkgs/applications/editors/texmaker/default.nix b/pkgs/applications/editors/texmaker/default.nix
new file mode 100644
index 00000000000..16335a55065
--- /dev/null
+++ b/pkgs/applications/editors/texmaker/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, qt4, popplerQt4, zlib, pkgconfig, poppler}:
+
+stdenv.mkDerivation rec {
+ pname = "texmaker";
+ version = "4.1.1";
+ name = "${pname}-${version}";
+
+ src = fetchurl {
+ url = "http://www.xm1math.net/texmaker/${name}.tar.bz2";
+ sha256 = "1h5rxdq6f05wk3lnlw96fxwrb14k77cx1mwy648127h2c8nsgw4z";
+ };
+
+ buildInputs = [ qt4 popplerQt4 zlib ];
+
+ nativeBuildInputs = [ pkgconfig poppler ];
+
+ preConfigure = ''
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$(echo ${poppler}/include/poppler/) " # for poppler-config.h
+ qmake PREFIX=$out DESKTOPDIR=$out/share/applications ICONDIR=$out/share/pixmaps texmaker.pro
+ '';
+
+ meta = with stdenv.lib; {
+ description = "TeX and LaTeX editor";
+ longDescription=''
+ This editor is a full fledged IDE for TeX and
+ LaTeX editing with completion, structure viewer, preview,
+ spell checking and support of any compilation chain.
+ '';
+ homepage = "http://www.xm1math.net/texmaker/";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ cfouche ];
+ };
+}
diff --git a/pkgs/applications/editors/texstudio/default.nix b/pkgs/applications/editors/texstudio/default.nix
new file mode 100644
index 00000000000..cd7f0b78c23
--- /dev/null
+++ b/pkgs/applications/editors/texstudio/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, qt4, popplerQt4, zlib}:
+
+stdenv.mkDerivation rec {
+ pname = "texstudio";
+ version = "2.7.0";
+ name = "${pname}-${version}";
+ altname="Texstudio";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/texstudio/${name}.tar.gz";
+ sha256 = "167d78nfk265jjvl129nr70v8ladb2rav2qyhw7ngr6m54gak831";
+ };
+
+ buildInputs = [ qt4 popplerQt4 zlib ];
+
+ preConfigure = ''
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$(echo ${popplerQt4}/include/poppler/qt4) "
+ qmake PREFIX=$out texstudio.pro
+ '';
+
+ meta = with stdenv.lib; {
+ description = "TeX and LaTeX editor";
+ longDescription=''
+ Fork of TeXMaker, this editor is a full fledged IDE for
+ LaTeX editing with completion, structure viewer, preview,
+ spell checking and support of any compilation chain.
+ '';
+ homepage = "http://texstudio.sourceforge.net/";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ cfouche ];
+ };
+}
diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix
index 789ddcc1039..710ceb7d31f 100644
--- a/pkgs/applications/editors/vim/configurable.nix
+++ b/pkgs/applications/editors/vim/configurable.nix
@@ -1,9 +1,35 @@
# TODO tidy up eg The patchelf code is patching gvim even if you don't build it..
# but I have gvim with python support now :) - Marc
-args@{source ? "default", ...}: with args;
+args@{pkgs, source ? "default", ...}: with args;
-let inherit (args.composableDerivation) composableDerivation edf; in
+let inherit (args.composableDerivation) composableDerivation edf;
+ nixosRuntimepath = pkgs.writeText "nixos-vimrc" ''
+ set nocompatible
+ syntax on
+
+ function! NixosPluginPath()
+ let seen = {}
+ for p in reverse(split($NIX_PROFILES))
+ for d in split(glob(p . '/share/vim-plugins/*'))
+ let pluginname = substitute(d, ".*/", "", "")
+ if !has_key(seen, pluginname)
+ exec 'set runtimepath^='.d
+ let seen[pluginname] = 1
+ endif
+ endfor
+ endfor
+ endfunction
+
+ execute NixosPluginPath()
+
+ if filereadable("/etc/vimrc")
+ source /etc/vimrc
+ elseif filereadable("/etc/vim/vimrc")
+ source /etc/vim/vimrc
+ endif
+ '';
+in
composableDerivation {
# use gccApple to compile on darwin
mkDerivation = ( if stdenv.isDarwin
@@ -11,18 +37,20 @@ composableDerivation {
else stdenv ).mkDerivation;
} (fix: {
- name = "vim_configurable-7.4.23";
+ name = "vim_configurable-7.4.335";
enableParallelBuilding = true; # test this
- src =
+ src =
builtins.getAttr source {
"default" =
# latest release
- args.fetchurl {
- url = ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2;
- sha256 = "1pjaffap91l2rb9pjnlbrpvb3ay5yhhr3g91zabjvw1rqk9adxfh";
- };
+ args.fetchhg {
+ url = "https://vim.googlecode.com/hg/";
+ rev = "v7-4-335";
+ sha256 = "0qnpzfcbi6fhz82pj68l4vrnigca1akq2ksrxz6krwlfhns6jhhj";
+ };
+
"vim-nox" =
{
# vim nox branch: client-server without X by uing sockets
@@ -33,16 +61,13 @@ composableDerivation {
}.src;
};
+ prePatch = "cd src";
+
# if darwin support is enabled, we want to make sure we're not building with
# OS-installed python framework
- preConfigure
- = stdenv.lib.optionalString
- (stdenv.isDarwin && (config.vim.darwin or true)) ''
- # TODO: we should find a better way of doing this as, if the configure
- # file changes, we need to change these line numbers
- sed -i "5641,5644d" src/auto/configure
- sed -i "5648d" src/auto/configure
- '';
+ patches = stdenv.lib.optionals
+ (stdenv.isDarwin && (config.vim.darwin or true))
+ [ ./python_framework.patch ];
configureFlags
= [ "--enable-gui=${args.gui}" "--with-features=${args.features}" ];
@@ -51,16 +76,6 @@ composableDerivation {
= [ ncurses pkgconfig gtk libX11 libXext libSM libXpm libXt libXaw libXau
libXmu glib libICE ];
- prePatch = "cd src";
-
- patches =
- [ ./patches/7.4.001 ./patches/7.4.002 ./patches/7.4.003 ./patches/7.4.004
- ./patches/7.4.005 ./patches/7.4.006 ./patches/7.4.007 ./patches/7.4.008
- ./patches/7.4.009 ./patches/7.4.010 ./patches/7.4.011 ./patches/7.4.012
- ./patches/7.4.013 ./patches/7.4.014 ./patches/7.4.015 ./patches/7.4.016
- ./patches/7.4.017 ./patches/7.4.018 ./patches/7.4.019 ./patches/7.4.020
- ./patches/7.4.021 ./patches/7.4.022 ./patches/7.4.023 ];
-
# most interpreters aren't tested yet.. (see python for example how to do it)
flags = {
ftNix = {
@@ -93,7 +108,17 @@ composableDerivation {
// edf { name = "tcl"; enable = { nativeBuildInputs = [tcl]; }; } #Include Tcl interpreter.
// edf { name = "ruby"; feat = "rubyinterp"; enable = { nativeBuildInputs = [ruby]; };} #Include Ruby interpreter.
- // edf { name = "lua" ; feat = "luainterp"; enable = { nativeBuildInputs = [lua]; configureFlags = ["--with-lua-prefix=${args.lua}"];};}
+ // edf {
+ name = "lua";
+ feat = "luainterp";
+ enable = {
+ nativeBuildInputs = [lua];
+ configureFlags = [
+ "--with-lua-prefix=${args.lua}"
+ "--enable-luainterp"
+ ];
+ };
+ }
// edf { name = "cscope"; } #Include cscope interface.
// edf { name = "workshop"; } #Include Sun Visual Workshop support.
// edf { name = "netbeans"; } #Disable NetBeans integration support.
@@ -108,6 +133,7 @@ composableDerivation {
;
cfg = {
+ luaSupport = config.vim.lua or true;
pythonSupport = config.vim.python or true;
rubySupport = config.vim.ruby or true;
nlsSupport = config.vim.nls or false;
@@ -145,6 +171,8 @@ composableDerivation {
echo $nativeBuildInputs
echo $rpath
patchelf --set-rpath $rpath $out/bin/{vim,gvim}
+
+ ln -sfn ${nixosRuntimepath} $out/share/vim/vimrc
'';
dontStrip = 1;
diff --git a/pkgs/applications/editors/vim/default.nix b/pkgs/applications/editors/vim/default.nix
index a2672b5c0d6..95f654eb8ca 100644
--- a/pkgs/applications/editors/vim/default.nix
+++ b/pkgs/applications/editors/vim/default.nix
@@ -1,16 +1,18 @@
-{ stdenv, fetchurl, ncurses, gettext, pkgconfig }:
+{ stdenv, fetchhg, ncurses, gettext, pkgconfig }:
stdenv.mkDerivation rec {
- patchLevel = "23";
- name = "vim-7.4.${patchLevel}";
-
- src = fetchurl {
- url = "ftp://ftp.vim.org/pub/vim/unix/${name}.tar.bz2";
- sha256 = "1pjaffap91l2rb9pjnlbrpvb3ay5yhhr3g91zabjvw1rqk9adxfh";
+ name = "vim-${version}";
+
+ version = "7.4.335";
+
+ src = fetchhg {
+ url = "https://vim.googlecode.com/hg/";
+ rev = "v7-4-335";
+ sha256 = "0qnpzfcbi6fhz82pj68l4vrnigca1akq2ksrxz6krwlfhns6jhhj";
};
enableParallelBuilding = true;
-
+
buildInputs = [ ncurses pkgconfig ];
nativeBuildInputs = [ gettext ];
@@ -44,16 +46,6 @@ stdenv.mkDerivation rec {
# sed -i -e 's/as_fn_error.*int32.*/:/' src/auto/configure
# '';
- prePatch = "cd src";
-
- patches =
- [ ./patches/7.4.001 ./patches/7.4.002 ./patches/7.4.003 ./patches/7.4.004
- ./patches/7.4.005 ./patches/7.4.006 ./patches/7.4.007 ./patches/7.4.008
- ./patches/7.4.009 ./patches/7.4.010 ./patches/7.4.011 ./patches/7.4.012
- ./patches/7.4.013 ./patches/7.4.014 ./patches/7.4.015 ./patches/7.4.016
- ./patches/7.4.017 ./patches/7.4.018 ./patches/7.4.019 ./patches/7.4.020
- ./patches/7.4.021 ./patches/7.4.022 ./patches/7.4.023 ];
-
meta = with stdenv.lib; {
description = "The most popular clone of the VI editor";
homepage = http://www.vim.org;
diff --git a/pkgs/applications/editors/vim/ft-nix-support.patch b/pkgs/applications/editors/vim/ft-nix-support.patch
index 4b5a742dac1..ed508784813 100644
--- a/pkgs/applications/editors/vim/ft-nix-support.patch
+++ b/pkgs/applications/editors/vim/ft-nix-support.patch
@@ -23,7 +23,7 @@ new file mode 100644
index 0000000..a2f9918
--- /dev/null
+++ b/runtime/syntax/nix.vim
-@@ -0,0 +1,40 @@
+@@ -0,0 +1,47 @@
+" Vim syntax file
+" Language: nix
+" Maintainer: Marc Weber
@@ -38,15 +38,16 @@ index 0000000..a2f9918
+ finish
+endif
+
-+syn keyword nixKeyword let throw inherit import true false null with
++syn keyword nixKeyword let in rec assert inherit import true false null with ...
++syn keyword nixBuiltin import abort baseNameOf dirOf isNull builtins map removeAttrs throw toString derivation
+syn keyword nixConditional if else then
+syn keyword nixBrace ( ) { } =
+syn keyword nixBuiltin __currentSystem __currentTime __isFunction __getEnv __trace __toPath __pathExists
+ \ __readFile __toXML __toFile __filterSource __attrNames __getAttr __hasAttr __isAttrs __listToAttrs __isList
+ \ __head __tail __add __sub __lessThan __substring __stringLength
+
-+syn match nixAttr "\w\+\ze\s*="
-+syn match nixFuncArg "\zs\w\+\ze\s*:"
++syn match nixAttr "[a-zA-Z0-9-_]\+\ze\s*="
++syn match nixFuncArg "\zs[a-zA-Z0-9-_]\+\ze\s*:"
+syn region nixStringParam start=+\${+ end=+}+
+syn region nixMultiLineComment start=+/\*+ skip=+\\"+ end=+\*/+
+syn match nixEndOfLineComment "#.*$"
@@ -54,6 +55,7 @@ index 0000000..a2f9918
+syn region nixString start=+"+ skip=+\\"+ end=+"+ contains=nixStringParam
+
+hi def link nixKeyword Keyword
++hi def link nixBuiltin Function
+hi def link nixConditional Conditional
+hi def link nixBrace Special
+hi def link nixString String
@@ -64,3 +66,10 @@ index 0000000..a2f9918
+hi def link nixEndOfLineComment Comment
+hi def link nixAttr Identifier
+hi def link nixFuncArg Identifier
++
++let b:current_syntax = "nix"
++
++" scan backwards to find begining of multiline statements
++syn sync ccomment nixMultiLineComment minlines=10 maxlines=500
++syn sync ccomment nixStringIndented minlines=10 maxlines=500
++syn sync ccomment nixString maxlines=10
diff --git a/pkgs/applications/editors/vim/macvim.nix b/pkgs/applications/editors/vim/macvim.nix
new file mode 100644
index 00000000000..feafa7b9977
--- /dev/null
+++ b/pkgs/applications/editors/vim/macvim.nix
@@ -0,0 +1,93 @@
+{ stdenv, stdenvAdapters, gccApple, fetchFromGitHub, ncurses, gettext,
+ pkgconfig, cscope, python, ruby, tcl, perl, luajit
+}:
+
+let inherit (stdenvAdapters.overrideGCC stdenv gccApple) mkDerivation;
+in mkDerivation rec {
+ name = "macvim-${version}";
+
+ version = "7.4.355";
+
+ src = fetchFromGitHub {
+ owner = "genoma";
+ repo = "macvim";
+ rev = "c18a61f9723565664ffc2eda9179e96c95860e25";
+ sha256 = "190bngg8m4bwqcia7w24gn7mmqkhk0mavxy81ziwysam1f652ymf";
+ };
+
+ enableParallelBuilding = true;
+
+ buildInputs = [
+ gettext ncurses pkgconfig luajit ruby tcl perl python
+ ];
+
+ patches = [ ./macvim.patch ];
+
+ postPatch = ''
+ substituteInPlace src/MacVim/mvim --replace "# VIM_APP_DIR=/Applications" "VIM_APP_DIR=$out/Applications"
+
+ # Don't create custom icons.
+ substituteInPlace src/MacVim/icons/Makefile --replace '$(MAKE) -C makeicns' ""
+ substituteInPlace src/MacVim/icons/make_icons.py --replace "dont_create = False" "dont_create = True"
+
+ # Full path to xcodebuild
+ substituteInPlace src/Makefile --replace "xcodebuild" "/usr/bin/xcodebuild"
+ '';
+
+ configureFlags = [
+ #"--enable-cscope" # TODO: cscope doesn't build on Darwin yet
+ "--enable-fail-if-missing"
+ "--with-features=huge"
+ "--enable-gui=macvim"
+ "--enable-multibyte"
+ "--enable-nls"
+ "--enable-luainterp=dynamic"
+ "--enable-pythoninterp=dynamic"
+ "--enable-perlinterp=dynamic"
+ "--enable-rubyinterp=dynamic"
+ "--enable-tclinterp=yes"
+ "--with-luajit"
+ "--with-lua-prefix=${luajit}"
+ "--with-ruby-command=${ruby}/bin/ruby"
+ "--with-tclsh=${tcl}/bin/tclsh"
+ "--with-tlib=ncurses"
+ "--with-compiledby=Nix"
+ ];
+
+ preConfigure = ''
+ DEV_DIR=$(/usr/bin/xcode-select -print-path)/Platforms/MacOSX.platform/Developer
+ configureFlagsArray+=(
+ "--with-developer-dir=$DEV_DIR"
+ )
+ '';
+
+ postInstall = ''
+ mkdir -p $out/Applications
+ cp -r src/MacVim/build/Release/MacVim.app $out/Applications
+
+ rm $out/bin/{Vimdiff,Vimtutor,Vim,ex,rVim,rview,view}
+
+ cp src/MacVim/mvim $out/bin
+ cp src/vimtutor $out/bin
+
+ for prog in "vimdiff" "vi" "vim" "ex" "rvim" "rview" "view"; do
+ ln -s $out/bin/mvim $out/bin/$prog
+ done
+
+ # Fix rpaths
+ exe="$out/Applications/MacVim.app/Contents/MacOS/Vim"
+ libperl=$(dirname $(find ${perl} -name "libperl.dylib"))
+ install_name_tool -add_rpath ${luajit}/lib $exe
+ install_name_tool -add_rpath ${tcl}/lib $exe
+ install_name_tool -add_rpath ${python}/lib $exe
+ install_name_tool -add_rpath $libperl $exe
+ install_name_tool -add_rpath ${ruby}/lib $exe
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Vim - the text editor - for Mac OS X";
+ homepage = https://github.com/b4winckler/macvim;
+ maintainers = with maintainers; [ cstrahan ];
+ platforms = platforms.darwin;
+ };
+}
diff --git a/pkgs/applications/editors/vim/macvim.patch b/pkgs/applications/editors/vim/macvim.patch
new file mode 100644
index 00000000000..a789b9952d2
--- /dev/null
+++ b/pkgs/applications/editors/vim/macvim.patch
@@ -0,0 +1,189 @@
+diff --git a/src/MacVim/MacVim.xcodeproj/project.pbxproj b/src/MacVim/MacVim.xcodeproj/project.pbxproj
+index 1c5ff47..677a2cc 100644
+--- a/src/MacVim/MacVim.xcodeproj/project.pbxproj
++++ b/src/MacVim/MacVim.xcodeproj/project.pbxproj
+@@ -437,6 +437,8 @@
+ /* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
++ attributes = {
++ };
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MacVim" */;
+ compatibilityVersion = "Xcode 2.4";
+ developmentRegion = English;
+@@ -632,6 +634,7 @@
+ INSTALL_PATH = "$(HOME)/Applications";
+ MACOSX_DEPLOYMENT_TARGET = "";
+ ONLY_ACTIVE_ARCH = YES;
++ OTHER_LDFLAGS = "-headerpad_max_install_names";
+ PRODUCT_NAME = MacVim;
+ VERSIONING_SYSTEM = "apple-generic";
+ WARNING_CFLAGS = "-Wall";
+@@ -662,6 +665,7 @@
+ INSTALL_PATH = "$(HOME)/Applications";
+ MACOSX_DEPLOYMENT_TARGET = "";
+ ONLY_ACTIVE_ARCH = YES;
++ OTHER_LDFLAGS = "-headerpad_max_install_names";
+ PRODUCT_NAME = MacVim;
+ VERSIONING_SYSTEM = "apple-generic";
+ WRAPPER_EXTENSION = app;
+
+diff --git a/src/vimtutor b/src/vimtutor
+index 70d9ec7..b565a1a 100755
+--- a/src/vimtutor
++++ b/src/vimtutor
+@@ -16,7 +16,7 @@ seq="vim vim8 vim75 vim74 vim73 vim72 vim71 vim70 vim7 vim6 vi"
+ if test "$1" = "-g"; then
+ # Try to use the GUI version of Vim if possible, it will fall back
+ # on Vim if Gvim is not installed.
+- seq="gvim gvim8 gvim75 gvim74 gvim73 gvim72 gvim71 gvim70 gvim7 gvim6 $seq"
++ seq="mvim gvim gvim8 gvim75 gvim74 gvim73 gvim72 gvim71 gvim70 gvim7 gvim6 $seq"
+ shift
+ fi
+
+
+diff --git a/src/auto/configure b/src/auto/configure
+index bc9f074..9b9125e 100755
+--- a/src/auto/configure
++++ b/src/auto/configure
+@@ -2252,7 +2252,7 @@ rm -f conftest.val
+ as_fn_set_status $ac_retval
+
+ } # ac_fn_c_compute_int
+-cat >auto/config.log <<_ACEOF
++cat >config.log <<_ACEOF
+ This file contains any messages produced by compilers while
+ running configure, to aid debugging if configure makes a mistake.
+
+@@ -2262,7 +2262,7 @@ generated by GNU Autoconf 2.69. Invocation command line was
+ $ $0 $@
+
+ _ACEOF
+-exec 5>>auto/config.log
++exec 5>>config.log
+ {
+ cat <<_ASUNAME
+ ## --------- ##
+@@ -5377,10 +5377,7 @@ $as_echo "no" >&6; }
+ fi
+
+ if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
+- if test "x$MACOSX" = "xyes"; then
+- MZSCHEME_LIBS="-framework Racket"
+- MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
+- elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
++ if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
+ MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
+ MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then
+@@ -5716,23 +5713,6 @@ $as_echo ">>> too old; need Perl version 5.003_01 or later <<<" >&6; }
+ fi
+
+ if test "x$MACOSX" = "xyes"; then
+- dir=/System/Library/Perl
+- darwindir=$dir/darwin
+- if test -d $darwindir; then
+- PERL=/usr/bin/perl
+- else
+- dir=/System/Library/Perl/5.8.1
+- darwindir=$dir/darwin-thread-multi-2level
+- if test -d $darwindir; then
+- PERL=/usr/bin/perl
+- fi
+- fi
+- if test -n "$PERL"; then
+- PERL_DIR="$dir"
+- PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
+- PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
+- PERL_LIBS="-L$darwindir/CORE -lperl"
+- fi
+ PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
+ PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
+ fi
+@@ -5926,10 +5906,6 @@ __:
+ eof
+ eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
+ rm -f -- "${tmp_mkf}"
+- if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
+- "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
+- vi_cv_path_python_plibs="-framework Python"
+- else
+ if test "${vi_cv_var_python_version}" = "1.4"; then
+ vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
+ else
+@@ -5937,7 +5913,6 @@ eof
+ fi
+ vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
+ vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
+- fi
+
+ fi
+
+@@ -6004,13 +5979,6 @@ rm -f core conftest.err conftest.$ac_objext \
+ $as_echo "no" >&6; }
+ fi
+
+- if test -n "$MACSDK"; then
+- PYTHON_CFLAGS=
+- PYTHON_LIBS=-framework Python
+- PYTHON_CONFDIR=
+- PYTHON_GETPATH_CFLAGS=
+- fi
+-
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compile and link flags for Python are sane" >&5
+ $as_echo_n "checking if compile and link flags for Python are sane... " >&6; }
+ cflags_save=$CFLAGS
+@@ -6853,11 +6821,7 @@ $as_echo "$tclver - OK" >&6; };
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of Tcl include" >&5
+ $as_echo_n "checking for location of Tcl include... " >&6; }
+- if test "x$MACOSX" != "xyes"; then
+ tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver"
+- else
+- tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
+- fi
+ TCL_INC=
+ for try in $tclinc; do
+ if test -f "$try/tcl.h"; then
+@@ -6875,12 +6839,8 @@ $as_echo "" >&6; }
+ if test -z "$SKIP_TCL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of tclConfig.sh script" >&5
+ $as_echo_n "checking for location of tclConfig.sh script... " >&6; }
+- if test "x$MACOSX" != "xyes"; then
+ tclcnf=`echo $tclinc | sed s/include/lib/g`
+ tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
+- else
+- tclcnf="/System/Library/Frameworks/Tcl.framework"
+- fi
+ for try in $tclcnf; do
+ if test -f $try/tclConfig.sh; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $try/tclConfig.sh" >&5
+@@ -7050,10 +7010,6 @@ $as_echo "$rubyhdrdir" >&6; }
+ if test -f "$rubylibdir/$librubya"; then
+ librubyarg="$librubyarg"
+ RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
+- elif test -d "/System/Library/Frameworks/Ruby.framework"; then
+- RUBY_LIBS="-framework Ruby"
+- RUBY_CFLAGS="-DRUBY_VERSION=$rubyversion"
+- librubyarg=
+ fi
+
+ if test "X$librubyarg" != "X"; then
+@@ -14061,7 +14017,7 @@ fi
+
+ _ACEOF
+ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+-exec 5>>auto/config.log
++exec 5>>config.log
+ {
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+@@ -14653,7 +14609,7 @@ if test "$no_create" != yes; then
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+- exec 5>>auto/config.log
++ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
diff --git a/pkgs/applications/editors/vim/patches/7.4.001 b/pkgs/applications/editors/vim/patches/7.4.001
deleted file mode 100644
index 5788972a569..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.001
+++ /dev/null
@@ -1,489 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.001
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.001
-Problem: Character classes such as [a-z] to not react to 'ignorecase'.
- Breaks man page highlighting. (Mario Grgic)
-Solution: Add separate items for classes that react to 'ignorecase'. Clean
- up logic handling character classes. Add more tests.
-Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
-
-
-*** ../vim-7.4.000/src/regexp_nfa.c 2013-08-01 18:27:51.000000000 +0200
---- src/regexp_nfa.c 2013-08-14 11:49:50.000000000 +0200
-***************
-*** 29,34 ****
---- 29,37 ----
- # define NFA_REGEXP_DEBUG_LOG "nfa_regexp_debug.log"
- #endif
-
-+ /* Added to NFA_ANY - NFA_NUPPER_IC to include a NL. */
-+ #define NFA_ADD_NL 31
-+
- enum
- {
- NFA_SPLIT = -1024,
-***************
-*** 183,188 ****
---- 186,198 ----
- NFA_NLOWER, /* Match non-lowercase char */
- NFA_UPPER, /* Match uppercase char */
- NFA_NUPPER, /* Match non-uppercase char */
-+ NFA_LOWER_IC, /* Match [a-z] */
-+ NFA_NLOWER_IC, /* Match [^a-z] */
-+ NFA_UPPER_IC, /* Match [A-Z] */
-+ NFA_NUPPER_IC, /* Match [^A-Z] */
-+
-+ NFA_FIRST_NL = NFA_ANY + NFA_ADD_NL,
-+ NFA_LAST_NL = NFA_NUPPER_IC + NFA_ADD_NL,
-
- NFA_CURSOR, /* Match cursor pos */
- NFA_LNUM, /* Match line number */
-***************
-*** 199,207 ****
- NFA_MARK_LT, /* Match < mark */
- NFA_VISUAL, /* Match Visual area */
-
-- NFA_FIRST_NL = NFA_ANY + ADD_NL,
-- NFA_LAST_NL = NFA_NUPPER + ADD_NL,
--
- /* Character classes [:alnum:] etc */
- NFA_CLASS_ALNUM,
- NFA_CLASS_ALPHA,
---- 209,214 ----
-***************
-*** 578,583 ****
---- 585,592 ----
- * On failure, return 0 (=FAIL)
- * Start points to the first char of the range, while end should point
- * to the closing brace.
-+ * Keep in mind that 'ignorecase' applies at execution time, thus [a-z] may
-+ * need to be interpreted as [a-zA-Z].
- */
- static int
- nfa_recognize_char_class(start, end, extra_newl)
-***************
-*** 681,687 ****
- return FAIL;
-
- if (newl == TRUE)
-! extra_newl = ADD_NL;
-
- switch (config)
- {
---- 690,696 ----
- return FAIL;
-
- if (newl == TRUE)
-! extra_newl = NFA_ADD_NL;
-
- switch (config)
- {
-***************
-*** 710,722 ****
- case CLASS_not | CLASS_az | CLASS_AZ:
- return extra_newl + NFA_NALPHA;
- case CLASS_az:
-! return extra_newl + NFA_LOWER;
- case CLASS_not | CLASS_az:
-! return extra_newl + NFA_NLOWER;
- case CLASS_AZ:
-! return extra_newl + NFA_UPPER;
- case CLASS_not | CLASS_AZ:
-! return extra_newl + NFA_NUPPER;
- }
- return FAIL;
- }
---- 719,731 ----
- case CLASS_not | CLASS_az | CLASS_AZ:
- return extra_newl + NFA_NALPHA;
- case CLASS_az:
-! return extra_newl + NFA_LOWER_IC;
- case CLASS_not | CLASS_az:
-! return extra_newl + NFA_NLOWER_IC;
- case CLASS_AZ:
-! return extra_newl + NFA_UPPER_IC;
- case CLASS_not | CLASS_AZ:
-! return extra_newl + NFA_NUPPER_IC;
- }
- return FAIL;
- }
-***************
-*** 914,920 ****
- break;
- }
-
-! extra = ADD_NL;
-
- /* "\_[" is collection plus newline */
- if (c == '[')
---- 923,929 ----
- break;
- }
-
-! extra = NFA_ADD_NL;
-
- /* "\_[" is collection plus newline */
- if (c == '[')
-***************
-*** 970,976 ****
- }
- #endif
- EMIT(nfa_classcodes[p - classchars]);
-! if (extra == ADD_NL)
- {
- EMIT(NFA_NEWL);
- EMIT(NFA_OR);
---- 979,985 ----
- }
- #endif
- EMIT(nfa_classcodes[p - classchars]);
-! if (extra == NFA_ADD_NL)
- {
- EMIT(NFA_NEWL);
- EMIT(NFA_OR);
-***************
-*** 1240,1260 ****
- {
- /*
- * Try to reverse engineer character classes. For example,
-! * recognize that [0-9] stands for \d and [A-Za-z_] with \h,
- * and perform the necessary substitutions in the NFA.
- */
- result = nfa_recognize_char_class(regparse, endp,
-! extra == ADD_NL);
- if (result != FAIL)
- {
-! if (result >= NFA_DIGIT && result <= NFA_NUPPER)
-! EMIT(result);
-! else /* must be char class + newline */
- {
-! EMIT(result - ADD_NL);
- EMIT(NFA_NEWL);
- EMIT(NFA_OR);
- }
- regparse = endp;
- mb_ptr_adv(regparse);
- return OK;
---- 1249,1269 ----
- {
- /*
- * Try to reverse engineer character classes. For example,
-! * recognize that [0-9] stands for \d and [A-Za-z_] for \h,
- * and perform the necessary substitutions in the NFA.
- */
- result = nfa_recognize_char_class(regparse, endp,
-! extra == NFA_ADD_NL);
- if (result != FAIL)
- {
-! if (result >= NFA_FIRST_NL && result <= NFA_LAST_NL)
- {
-! EMIT(result - NFA_ADD_NL);
- EMIT(NFA_NEWL);
- EMIT(NFA_OR);
- }
-+ else
-+ EMIT(result);
- regparse = endp;
- mb_ptr_adv(regparse);
- return OK;
-***************
-*** 1504,1510 ****
- * collection, add an OR below. But not for negated
- * range. */
- if (!negated)
-! extra = ADD_NL;
- }
- else
- {
---- 1513,1519 ----
- * collection, add an OR below. But not for negated
- * range. */
- if (!negated)
-! extra = NFA_ADD_NL;
- }
- else
- {
-***************
-*** 1537,1543 ****
- EMIT(NFA_END_COLL);
-
- /* \_[] also matches \n but it's not negated */
-! if (extra == ADD_NL)
- {
- EMIT(reg_string ? NL : NFA_NEWL);
- EMIT(NFA_OR);
---- 1546,1552 ----
- EMIT(NFA_END_COLL);
-
- /* \_[] also matches \n but it's not negated */
-! if (extra == NFA_ADD_NL)
- {
- EMIT(reg_string ? NL : NFA_NEWL);
- EMIT(NFA_OR);
-***************
-*** 2011,2017 ****
- if (c >= NFA_FIRST_NL && c <= NFA_LAST_NL)
- {
- addnl = TRUE;
-! c -= ADD_NL;
- }
-
- STRCPY(code, "");
---- 2020,2026 ----
- if (c >= NFA_FIRST_NL && c <= NFA_LAST_NL)
- {
- addnl = TRUE;
-! c -= NFA_ADD_NL;
- }
-
- STRCPY(code, "");
-***************
-*** 2217,2222 ****
---- 2226,2235 ----
- case NFA_NLOWER:STRCPY(code, "NFA_NLOWER"); break;
- case NFA_UPPER: STRCPY(code, "NFA_UPPER"); break;
- case NFA_NUPPER:STRCPY(code, "NFA_NUPPER"); break;
-+ case NFA_LOWER_IC: STRCPY(code, "NFA_LOWER_IC"); break;
-+ case NFA_NLOWER_IC: STRCPY(code, "NFA_NLOWER_IC"); break;
-+ case NFA_UPPER_IC: STRCPY(code, "NFA_UPPER_IC"); break;
-+ case NFA_NUPPER_IC: STRCPY(code, "NFA_NUPPER_IC"); break;
-
- default:
- STRCPY(code, "CHAR(x)");
-***************
-*** 2687,2692 ****
---- 2700,2709 ----
- case NFA_NLOWER:
- case NFA_UPPER:
- case NFA_NUPPER:
-+ case NFA_LOWER_IC:
-+ case NFA_NLOWER_IC:
-+ case NFA_UPPER_IC:
-+ case NFA_NUPPER_IC:
- /* possibly non-ascii */
- #ifdef FEAT_MBYTE
- if (has_mbyte)
-***************
-*** 3841,3846 ****
---- 3858,3867 ----
- case NFA_NLOWER:
- case NFA_UPPER:
- case NFA_NUPPER:
-+ case NFA_LOWER_IC:
-+ case NFA_NLOWER_IC:
-+ case NFA_UPPER_IC:
-+ case NFA_NUPPER_IC:
- case NFA_START_COLL:
- case NFA_START_NEG_COLL:
- case NFA_NEWL:
-***************
-*** 5872,5877 ****
---- 5893,5920 ----
- ADD_STATE_IF_MATCH(t->state);
- break;
-
-+ case NFA_LOWER_IC: /* [a-z] */
-+ result = ri_lower(curc) || (ireg_ic && ri_upper(curc));
-+ ADD_STATE_IF_MATCH(t->state);
-+ break;
-+
-+ case NFA_NLOWER_IC: /* [^a-z] */
-+ result = curc != NUL
-+ && !(ri_lower(curc) || (ireg_ic && ri_upper(curc)));
-+ ADD_STATE_IF_MATCH(t->state);
-+ break;
-+
-+ case NFA_UPPER_IC: /* [A-Z] */
-+ result = ri_upper(curc) || (ireg_ic && ri_lower(curc));
-+ ADD_STATE_IF_MATCH(t->state);
-+ break;
-+
-+ case NFA_NUPPER_IC: /* ^[A-Z] */
-+ result = curc != NUL
-+ && !(ri_upper(curc) || (ireg_ic && ri_lower(curc)));
-+ ADD_STATE_IF_MATCH(t->state);
-+ break;
-+
- case NFA_BACKREF1:
- case NFA_BACKREF2:
- case NFA_BACKREF3:
-*** ../vim-7.4.000/src/testdir/test64.in 2013-08-01 17:45:33.000000000 +0200
---- src/testdir/test64.in 2013-08-14 11:50:11.000000000 +0200
-***************
-*** 289,303 ****
- :call add(tl, [2, '.a\%$', " a\n "])
- :call add(tl, [2, '.a\%$', " a\n_a", "_a"])
- :"
-! :"""" Test recognition of some character classes
-! :call add(tl, [2, '[0-9]', '8', '8'])
-! :call add(tl, [2, '[^0-9]', '8'])
-! :call add(tl, [2, '[0-9a-fA-F]*', '0a7', '0a7'])
-! :call add(tl, [2, '[^0-9A-Fa-f]\+', '0a7'])
-! :call add(tl, [2, '[a-z_A-Z0-9]\+', 'aso_sfoij', 'aso_sfoij'])
-! :call add(tl, [2, '[a-z]', 'a', 'a'])
-! :call add(tl, [2, '[a-zA-Z]', 'a', 'a'])
-! :call add(tl, [2, '[A-Z]', 'a'])
- :call add(tl, [2, '\C[^A-Z]\+', 'ABCOIJDEOIFNSD jsfoij sa', ' jsfoij sa'])
- :"
- :"""" Tests for \z features
---- 289,317 ----
- :call add(tl, [2, '.a\%$', " a\n "])
- :call add(tl, [2, '.a\%$', " a\n_a", "_a"])
- :"
-! :"""" Test recognition of character classes
-! :call add(tl, [2, '[0-7]\+', 'x0123456789x', '01234567'])
-! :call add(tl, [2, '[^0-7]\+', '0a;X+% 897', 'a;X+% 89'])
-! :call add(tl, [2, '[0-9]\+', 'x0123456789x', '0123456789'])
-! :call add(tl, [2, '[^0-9]\+', '0a;X+% 9', 'a;X+% '])
-! :call add(tl, [2, '[0-9a-fA-F]\+', 'x0189abcdefg', '0189abcdef'])
-! :call add(tl, [2, '[^0-9A-Fa-f]\+', '0189g;X+% ab', 'g;X+% '])
-! :call add(tl, [2, '[a-z_A-Z0-9]\+', ';+aso_SfOij ', 'aso_SfOij'])
-! :call add(tl, [2, '[^a-z_A-Z0-9]\+', 'aSo_;+% sfOij', ';+% '])
-! :call add(tl, [2, '[a-z_A-Z]\+', '0abyz_ABYZ;', 'abyz_ABYZ'])
-! :call add(tl, [2, '[^a-z_A-Z]\+', 'abAB_09;+% yzYZ', '09;+% '])
-! :call add(tl, [2, '[a-z]\+', '0abcxyz1', 'abcxyz'])
-! :call add(tl, [2, '[a-z]\+', 'AabxyzZ', 'abxyz'])
-! :call add(tl, [2, '[^a-z]\+', 'a;X09+% x', ';X09+% '])
-! :call add(tl, [2, '[^a-z]\+', 'abX0;%yz', 'X0;%'])
-! :call add(tl, [2, '[a-zA-Z]\+', '0abABxzXZ9', 'abABxzXZ'])
-! :call add(tl, [2, '[^a-zA-Z]\+', 'ab09_;+ XZ', '09_;+ '])
-! :call add(tl, [2, '[A-Z]\+', 'aABXYZz', 'ABXYZ'])
-! :call add(tl, [2, '[^A-Z]\+', 'ABx0;%YZ', 'x0;%'])
-! :call add(tl, [2, '[a-z]\+\c', '0abxyzABXYZ;', 'abxyzABXYZ'])
-! :call add(tl, [2, '[A-Z]\+\c', '0abABxzXZ9', 'abABxzXZ'])
-! :call add(tl, [2, '\c[^a-z]\+', 'ab09_;+ XZ', '09_;+ '])
-! :call add(tl, [2, '\c[^A-Z]\+', 'ab09_;+ XZ', '09_;+ '])
- :call add(tl, [2, '\C[^A-Z]\+', 'ABCOIJDEOIFNSD jsfoij sa', ' jsfoij sa'])
- :"
- :"""" Tests for \z features
-*** ../vim-7.4.000/src/testdir/test64.ok 2013-08-01 18:28:56.000000000 +0200
---- src/testdir/test64.ok 2013-08-14 11:50:37.000000000 +0200
-***************
-*** 650,679 ****
- OK 0 - .a\%$
- OK 1 - .a\%$
- OK 2 - .a\%$
-! OK 0 - [0-9]
-! OK 1 - [0-9]
-! OK 2 - [0-9]
-! OK 0 - [^0-9]
-! OK 1 - [^0-9]
-! OK 2 - [^0-9]
-! OK 0 - [0-9a-fA-F]*
-! OK 1 - [0-9a-fA-F]*
-! OK 2 - [0-9a-fA-F]*
- OK 0 - [^0-9A-Fa-f]\+
- OK 1 - [^0-9A-Fa-f]\+
- OK 2 - [^0-9A-Fa-f]\+
- OK 0 - [a-z_A-Z0-9]\+
- OK 1 - [a-z_A-Z0-9]\+
- OK 2 - [a-z_A-Z0-9]\+
-! OK 0 - [a-z]
-! OK 1 - [a-z]
-! OK 2 - [a-z]
-! OK 0 - [a-zA-Z]
-! OK 1 - [a-zA-Z]
-! OK 2 - [a-zA-Z]
-! OK 0 - [A-Z]
-! OK 1 - [A-Z]
-! OK 2 - [A-Z]
- OK 0 - \C[^A-Z]\+
- OK 1 - \C[^A-Z]\+
- OK 2 - \C[^A-Z]\+
---- 650,721 ----
- OK 0 - .a\%$
- OK 1 - .a\%$
- OK 2 - .a\%$
-! OK 0 - [0-7]\+
-! OK 1 - [0-7]\+
-! OK 2 - [0-7]\+
-! OK 0 - [^0-7]\+
-! OK 1 - [^0-7]\+
-! OK 2 - [^0-7]\+
-! OK 0 - [0-9]\+
-! OK 1 - [0-9]\+
-! OK 2 - [0-9]\+
-! OK 0 - [^0-9]\+
-! OK 1 - [^0-9]\+
-! OK 2 - [^0-9]\+
-! OK 0 - [0-9a-fA-F]\+
-! OK 1 - [0-9a-fA-F]\+
-! OK 2 - [0-9a-fA-F]\+
- OK 0 - [^0-9A-Fa-f]\+
- OK 1 - [^0-9A-Fa-f]\+
- OK 2 - [^0-9A-Fa-f]\+
- OK 0 - [a-z_A-Z0-9]\+
- OK 1 - [a-z_A-Z0-9]\+
- OK 2 - [a-z_A-Z0-9]\+
-! OK 0 - [^a-z_A-Z0-9]\+
-! OK 1 - [^a-z_A-Z0-9]\+
-! OK 2 - [^a-z_A-Z0-9]\+
-! OK 0 - [a-z_A-Z]\+
-! OK 1 - [a-z_A-Z]\+
-! OK 2 - [a-z_A-Z]\+
-! OK 0 - [^a-z_A-Z]\+
-! OK 1 - [^a-z_A-Z]\+
-! OK 2 - [^a-z_A-Z]\+
-! OK 0 - [a-z]\+
-! OK 1 - [a-z]\+
-! OK 2 - [a-z]\+
-! OK 0 - [a-z]\+
-! OK 1 - [a-z]\+
-! OK 2 - [a-z]\+
-! OK 0 - [^a-z]\+
-! OK 1 - [^a-z]\+
-! OK 2 - [^a-z]\+
-! OK 0 - [^a-z]\+
-! OK 1 - [^a-z]\+
-! OK 2 - [^a-z]\+
-! OK 0 - [a-zA-Z]\+
-! OK 1 - [a-zA-Z]\+
-! OK 2 - [a-zA-Z]\+
-! OK 0 - [^a-zA-Z]\+
-! OK 1 - [^a-zA-Z]\+
-! OK 2 - [^a-zA-Z]\+
-! OK 0 - [A-Z]\+
-! OK 1 - [A-Z]\+
-! OK 2 - [A-Z]\+
-! OK 0 - [^A-Z]\+
-! OK 1 - [^A-Z]\+
-! OK 2 - [^A-Z]\+
-! OK 0 - [a-z]\+\c
-! OK 1 - [a-z]\+\c
-! OK 2 - [a-z]\+\c
-! OK 0 - [A-Z]\+\c
-! OK 1 - [A-Z]\+\c
-! OK 2 - [A-Z]\+\c
-! OK 0 - \c[^a-z]\+
-! OK 1 - \c[^a-z]\+
-! OK 2 - \c[^a-z]\+
-! OK 0 - \c[^A-Z]\+
-! OK 1 - \c[^A-Z]\+
-! OK 2 - \c[^A-Z]\+
- OK 0 - \C[^A-Z]\+
- OK 1 - \C[^A-Z]\+
- OK 2 - \C[^A-Z]\+
-*** ../vim-7.4.000/src/version.c 2013-08-10 13:29:20.000000000 +0200
---- src/version.c 2013-08-14 11:54:57.000000000 +0200
-***************
-*** 729,730 ****
---- 729,732 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 1,
- /**/
-
---
-How many light bulbs does it take to change a person?
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.002 b/pkgs/applications/editors/vim/patches/7.4.002
deleted file mode 100644
index d92f4de6c2d..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.002
+++ /dev/null
@@ -1,77 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.002
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4b.002
-Problem: Pattern with two alternative look-behind matches does not match.
- (Amadeus Demarzi)
-Solution: When comparing PIMs also compare their state ID to see if they are
- different.
-Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
-
-
-*** ../vim-7.4.001/src/regexp_nfa.c 2013-08-14 12:05:54.000000000 +0200
---- src/regexp_nfa.c 2013-08-14 13:12:09.000000000 +0200
-***************
-*** 3782,3787 ****
---- 3782,3790 ----
- if (two_unused)
- /* one is used and two is not: not equal */
- return FALSE;
-+ /* compare the state id */
-+ if (one->state->id != two->state->id)
-+ return FALSE;
- /* compare the position */
- if (REG_MULTI)
- return one->end.pos.lnum == two->end.pos.lnum
-*** ../vim-7.4.001/src/testdir/test64.in 2013-08-14 12:05:54.000000000 +0200
---- src/testdir/test64.in 2013-08-14 12:58:38.000000000 +0200
-***************
-*** 421,426 ****
---- 421,429 ----
- :call add(tl, [2, '\(foo\)\@<=\>', 'barfoo', '', 'foo'])
- :call add(tl, [2, '\(foo\)\@<=.*', 'foobar', 'bar', 'foo'])
- :"
-+ :" complicated look-behind match
-+ :call add(tl, [2, '\(r\@<=\|\w\@
- :call add(tl, [2, '\(a*\)\@>a', 'aaaa'])
- :call add(tl, [2, '\(a*\)\@>b', 'aaab', 'aaab', 'aaa'])
-*** ../vim-7.4.001/src/testdir/test64.ok 2013-08-14 12:05:54.000000000 +0200
---- src/testdir/test64.ok 2013-08-14 13:14:09.000000000 +0200
-***************
-*** 974,979 ****
---- 974,982 ----
- OK 0 - \(foo\)\@<=.*
- OK 1 - \(foo\)\@<=.*
- OK 2 - \(foo\)\@<=.*
-+ OK 0 - \(r\@<=\|\w\@a
- OK 1 - \(a*\)\@>a
- OK 2 - \(a*\)\@>a
-*** ../vim-7.4.001/src/version.c 2013-08-14 12:05:54.000000000 +0200
---- src/version.c 2013-08-14 13:13:45.000000000 +0200
-***************
-*** 729,730 ****
---- 729,732 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 2,
- /**/
-
---
-From "know your smileys":
- :-)-O Smiling doctor with stethoscope
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.003 b/pkgs/applications/editors/vim/patches/7.4.003
deleted file mode 100644
index 9aad3c8c8f1..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.003
+++ /dev/null
@@ -1,100 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.003
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.003
-Problem: Memory access error in Ruby syntax highlighting. (Christopher Chow)
-Solution: Refresh stale pointer. (James McCoy)
-Files: src/regexp_nfa.c
-
-
-*** ../vim-7.4.002/src/regexp_nfa.c 2013-08-14 13:31:03.000000000 +0200
---- src/regexp_nfa.c 2013-08-14 14:02:06.000000000 +0200
-***************
-*** 4120,4126 ****
- sub = &subs->norm;
- }
- #ifdef FEAT_SYN_HL
-! else if (state->c >= NFA_ZOPEN)
- {
- subidx = state->c - NFA_ZOPEN;
- sub = &subs->synt;
---- 4120,4126 ----
- sub = &subs->norm;
- }
- #ifdef FEAT_SYN_HL
-! else if (state->c >= NFA_ZOPEN && state->c <= NFA_ZOPEN9)
- {
- subidx = state->c - NFA_ZOPEN;
- sub = &subs->synt;
-***************
-*** 4189,4194 ****
---- 4189,4201 ----
- }
-
- subs = addstate(l, state->out, subs, pim, off);
-+ /* "subs" may have changed, need to set "sub" again */
-+ #ifdef FEAT_SYN_HL
-+ if (state->c >= NFA_ZOPEN && state->c <= NFA_ZOPEN9)
-+ sub = &subs->synt;
-+ else
-+ #endif
-+ sub = &subs->norm;
-
- if (save_in_use == -1)
- {
-***************
-*** 4237,4243 ****
- sub = &subs->norm;
- }
- #ifdef FEAT_SYN_HL
-! else if (state->c >= NFA_ZCLOSE)
- {
- subidx = state->c - NFA_ZCLOSE;
- sub = &subs->synt;
---- 4244,4250 ----
- sub = &subs->norm;
- }
- #ifdef FEAT_SYN_HL
-! else if (state->c >= NFA_ZCLOSE && state->c <= NFA_ZCLOSE9)
- {
- subidx = state->c - NFA_ZCLOSE;
- sub = &subs->synt;
-***************
-*** 4281,4286 ****
---- 4288,4300 ----
- }
-
- subs = addstate(l, state->out, subs, pim, off);
-+ /* "subs" may have changed, need to set "sub" again */
-+ #ifdef FEAT_SYN_HL
-+ if (state->c >= NFA_ZCLOSE && state->c <= NFA_ZCLOSE9)
-+ sub = &subs->synt;
-+ else
-+ #endif
-+ sub = &subs->norm;
-
- if (REG_MULTI)
- sub->list.multi[subidx].end = save_lpos;
-*** ../vim-7.4.002/src/version.c 2013-08-14 13:31:03.000000000 +0200
---- src/version.c 2013-08-14 14:03:51.000000000 +0200
-***************
-*** 729,730 ****
---- 729,732 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 3,
- /**/
-
---
-Where do you want to crash today?
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.004 b/pkgs/applications/editors/vim/patches/7.4.004
deleted file mode 100644
index f629d673fb8..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.004
+++ /dev/null
@@ -1,232 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.004
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.004
-Problem: When closing a window fails ":bwipe" may hang.
-Solution: Let win_close() return FAIL and break out of the loop.
-Files: src/window.c, src/proto/window.pro, src/buffer.c
-
-
-*** ../vim-7.4.003/src/window.c 2013-07-24 17:38:29.000000000 +0200
---- src/window.c 2013-08-14 16:52:44.000000000 +0200
-***************
-*** 2172,2179 ****
- * If "free_buf" is TRUE related buffer may be unloaded.
- *
- * Called by :quit, :close, :xit, :wq and findtag().
- */
-! void
- win_close(win, free_buf)
- win_T *win;
- int free_buf;
---- 2172,2180 ----
- * If "free_buf" is TRUE related buffer may be unloaded.
- *
- * Called by :quit, :close, :xit, :wq and findtag().
-+ * Returns FAIL when the window was not closed.
- */
-! int
- win_close(win, free_buf)
- win_T *win;
- int free_buf;
-***************
-*** 2190,2210 ****
- if (last_window())
- {
- EMSG(_("E444: Cannot close last window"));
-! return;
- }
-
- #ifdef FEAT_AUTOCMD
- if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_closing))
-! return; /* window is already being closed */
- if (win == aucmd_win)
- {
- EMSG(_("E813: Cannot close autocmd window"));
-! return;
- }
- if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window())
- {
- EMSG(_("E814: Cannot close window, only autocmd window would remain"));
-! return;
- }
- #endif
-
---- 2191,2211 ----
- if (last_window())
- {
- EMSG(_("E444: Cannot close last window"));
-! return FAIL;
- }
-
- #ifdef FEAT_AUTOCMD
- if (win->w_closing || (win->w_buffer != NULL && win->w_buffer->b_closing))
-! return FAIL; /* window is already being closed */
- if (win == aucmd_win)
- {
- EMSG(_("E813: Cannot close autocmd window"));
-! return FAIL;
- }
- if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window())
- {
- EMSG(_("E814: Cannot close window, only autocmd window would remain"));
-! return FAIL;
- }
- #endif
-
-***************
-*** 2212,2218 ****
- * and then close the window and the tab page to avoid that curwin and
- * curtab are invalid while we are freeing memory. */
- if (close_last_window_tabpage(win, free_buf, prev_curtab))
-! return;
-
- /* When closing the help window, try restoring a snapshot after closing
- * the window. Otherwise clear the snapshot, it's now invalid. */
---- 2213,2219 ----
- * and then close the window and the tab page to avoid that curwin and
- * curtab are invalid while we are freeing memory. */
- if (close_last_window_tabpage(win, free_buf, prev_curtab))
-! return FAIL;
-
- /* When closing the help window, try restoring a snapshot after closing
- * the window. Otherwise clear the snapshot, it's now invalid. */
-***************
-*** 2240,2261 ****
- win->w_closing = TRUE;
- apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
- if (!win_valid(win))
-! return;
- win->w_closing = FALSE;
- if (last_window())
-! return;
- }
- win->w_closing = TRUE;
- apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);
- if (!win_valid(win))
-! return;
- win->w_closing = FALSE;
- if (last_window())
-! return;
- # ifdef FEAT_EVAL
- /* autocmds may abort script processing */
- if (aborting())
-! return;
- # endif
- }
- #endif
---- 2241,2262 ----
- win->w_closing = TRUE;
- apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
- if (!win_valid(win))
-! return FAIL;
- win->w_closing = FALSE;
- if (last_window())
-! return FAIL;
- }
- win->w_closing = TRUE;
- apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);
- if (!win_valid(win))
-! return FAIL;
- win->w_closing = FALSE;
- if (last_window())
-! return FAIL;
- # ifdef FEAT_EVAL
- /* autocmds may abort script processing */
- if (aborting())
-! return FAIL;
- # endif
- }
- #endif
-***************
-*** 2303,2309 ****
- * other window or moved to another tab page. */
- else if (!win_valid(win) || last_window() || curtab != prev_curtab
- || close_last_window_tabpage(win, free_buf, prev_curtab))
-! return;
-
- /* Free the memory used for the window and get the window that received
- * the screen space. */
---- 2304,2310 ----
- * other window or moved to another tab page. */
- else if (!win_valid(win) || last_window() || curtab != prev_curtab
- || close_last_window_tabpage(win, free_buf, prev_curtab))
-! return FAIL;
-
- /* Free the memory used for the window and get the window that received
- * the screen space. */
-***************
-*** 2383,2388 ****
---- 2384,2390 ----
- #endif
-
- redraw_all_later(NOT_VALID);
-+ return OK;
- }
-
- /*
-*** ../vim-7.4.003/src/proto/window.pro 2013-08-10 13:37:30.000000000 +0200
---- src/proto/window.pro 2013-08-14 16:52:50.000000000 +0200
-***************
-*** 9,15 ****
- void win_equal __ARGS((win_T *next_curwin, int current, int dir));
- void close_windows __ARGS((buf_T *buf, int keep_curwin));
- int one_window __ARGS((void));
-! void win_close __ARGS((win_T *win, int free_buf));
- void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
- void win_free_all __ARGS((void));
- win_T *winframe_remove __ARGS((win_T *win, int *dirp, tabpage_T *tp));
---- 9,15 ----
- void win_equal __ARGS((win_T *next_curwin, int current, int dir));
- void close_windows __ARGS((buf_T *buf, int keep_curwin));
- int one_window __ARGS((void));
-! int win_close __ARGS((win_T *win, int free_buf));
- void win_close_othertab __ARGS((win_T *win, int free_buf, tabpage_T *tp));
- void win_free_all __ARGS((void));
- win_T *winframe_remove __ARGS((win_T *win, int *dirp, tabpage_T *tp));
-*** ../vim-7.4.003/src/buffer.c 2013-07-17 16:39:00.000000000 +0200
---- src/buffer.c 2013-08-14 16:54:34.000000000 +0200
-***************
-*** 1186,1192 ****
- && !(curwin->w_closing || curwin->w_buffer->b_closing)
- # endif
- && (firstwin != lastwin || first_tabpage->tp_next != NULL))
-! win_close(curwin, FALSE);
- #endif
-
- /*
---- 1186,1195 ----
- && !(curwin->w_closing || curwin->w_buffer->b_closing)
- # endif
- && (firstwin != lastwin || first_tabpage->tp_next != NULL))
-! {
-! if (win_close(curwin, FALSE) == FAIL)
-! break;
-! }
- #endif
-
- /*
-*** ../vim-7.4.003/src/version.c 2013-08-14 14:18:37.000000000 +0200
---- src/version.c 2013-08-14 17:10:23.000000000 +0200
-***************
-*** 729,730 ****
---- 729,732 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 4,
- /**/
-
---
-From "know your smileys":
- *<|:-) Santa Claus (Ho Ho Ho)
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.005 b/pkgs/applications/editors/vim/patches/7.4.005
deleted file mode 100644
index f85d1f0e3c8..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.005
+++ /dev/null
@@ -1,48 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.005
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.005
-Problem: Using "vaB" while 'virtualedit' is set selects the wrong area.
- (Dimitar Dimitrov)
-Solution: Reset coladd when finding a match.
-Files: src/search.c
-
-
-*** ../vim-7.4.004/src/search.c 2013-07-17 19:20:47.000000000 +0200
---- src/search.c 2013-08-14 17:32:38.000000000 +0200
-***************
-*** 1760,1765 ****
---- 1760,1768 ----
- #endif
-
- pos = curwin->w_cursor;
-+ #ifdef FEAT_VIRTUALEDIT
-+ pos.coladd = 0;
-+ #endif
- linep = ml_get(pos.lnum);
-
- cpo_match = (vim_strchr(p_cpo, CPO_MATCH) != NULL);
-*** ../vim-7.4.004/src/version.c 2013-08-14 17:11:14.000000000 +0200
---- src/version.c 2013-08-14 17:38:05.000000000 +0200
-***************
-*** 729,730 ****
---- 729,732 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 5,
- /**/
-
---
-You can't have everything. Where would you put it?
- -- Steven Wright
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.006 b/pkgs/applications/editors/vim/patches/7.4.006
deleted file mode 100644
index 55d3802c4d1..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.006
+++ /dev/null
@@ -1,66 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.006
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.006
-Problem: mkdir("foo/bar/", "p") gives an error message. (David Barnett)
-Solution: Remove the trailing slash. (lcd)
-Files: src/eval.c
-
-
-*** ../vim-7.4.005/src/eval.c 2013-07-05 18:23:42.000000000 +0200
---- src/eval.c 2013-08-22 12:00:28.000000000 +0200
-***************
-*** 14292,14297 ****
---- 14292,14301 ----
- return;
-
- dir = get_tv_string_buf(&argvars[0], buf);
-+ if (*gettail(dir) == NUL)
-+ /* remove trailing slashes */
-+ *gettail_sep(dir) = NUL;
-+
- if (argvars[1].v_type != VAR_UNKNOWN)
- {
- if (argvars[2].v_type != VAR_UNKNOWN)
-***************
-*** 14299,14305 ****
- if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
- mkdir_recurse(dir, prot);
- }
-! rettv->vval.v_number = prot != -1 ? vim_mkdir_emsg(dir, prot) : 0;
- }
- #endif
-
---- 14303,14309 ----
- if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
- mkdir_recurse(dir, prot);
- }
-! rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot);
- }
- #endif
-
-*** ../vim-7.4.005/src/version.c 2013-08-14 17:45:25.000000000 +0200
---- src/version.c 2013-08-22 12:02:46.000000000 +0200
-***************
-*** 729,730 ****
---- 729,732 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 6,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-97. Your mother tells you to remember something, and you look for
- a File/Save command.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.007 b/pkgs/applications/editors/vim/patches/7.4.007
deleted file mode 100644
index 5495ffbf979..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.007
+++ /dev/null
@@ -1,95 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.007
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.007
-Problem: Creating a preview window on startup leaves the screen layout in a
- messed up state. (Marius Gedminas)
-Solution: Don't change firstwin. (Christian Brabandt)
-Files: src/main.c
-
-
-*** ../vim-7.4.006/src/main.c 2013-07-03 12:36:49.000000000 +0200
---- src/main.c 2013-08-22 14:02:39.000000000 +0200
-***************
-*** 2727,2732 ****
---- 2727,2733 ----
- int arg_idx; /* index in argument list */
- int i;
- int advance = TRUE;
-+ win_T *win;
-
- # ifdef FEAT_AUTOCMD
- /*
-***************
-*** 2816,2839 ****
- # ifdef FEAT_AUTOCMD
- --autocmd_no_enter;
- # endif
- #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
-! /*
-! * Avoid making a preview window the current window.
-! */
-! if (firstwin->w_p_pvw)
- {
-! win_T *win;
-!
-! for (win = firstwin; win != NULL; win = win->w_next)
-! if (!win->w_p_pvw)
-! {
-! firstwin = win;
-! break;
-! }
- }
- #endif
-! /* make the first window the current window */
-! win_enter(firstwin, FALSE);
-
- # ifdef FEAT_AUTOCMD
- --autocmd_no_leave;
---- 2817,2838 ----
- # ifdef FEAT_AUTOCMD
- --autocmd_no_enter;
- # endif
-+
-+ /* make the first window the current window */
-+ win = firstwin;
- #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
-! /* Avoid making a preview window the current window. */
-! while (win->w_p_pvw)
- {
-! win = win->w_next;
-! if (win == NULL)
-! {
-! win = firstwin;
-! break;
-! }
- }
- #endif
-! win_enter(win, FALSE);
-
- # ifdef FEAT_AUTOCMD
- --autocmd_no_leave;
-*** ../vim-7.4.006/src/version.c 2013-08-22 12:06:50.000000000 +0200
---- src/version.c 2013-08-22 14:04:11.000000000 +0200
-***************
-*** 729,730 ****
---- 729,732 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 7,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-105. When someone asks you for your address, you tell them your URL.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.008 b/pkgs/applications/editors/vim/patches/7.4.008
deleted file mode 100644
index 6abd493f914..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.008
+++ /dev/null
@@ -1,71 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.008
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.008
-Problem: New regexp engine can't be interrupted.
-Solution: Check for CTRL-C pressed. (Yasuhiro Matsumoto)
-Files: src/regexp_nfa.c, src/regexp.c
-
-
-*** ../vim-7.4.007/src/regexp_nfa.c 2013-08-14 14:18:37.000000000 +0200
---- src/regexp_nfa.c 2013-08-25 16:55:56.000000000 +0200
-***************
-*** 5089,5094 ****
---- 5089,5100 ----
- return FALSE;
- }
- #endif
-+ /* Some patterns may take a long time to match, especially when using
-+ * recursive_regmatch(). Allow interrupting them with CTRL-C. */
-+ fast_breakcheck();
-+ if (got_int)
-+ return FALSE;
-+
- nfa_match = FALSE;
-
- /* Allocate memory for the lists of nodes. */
-*** ../vim-7.4.007/src/regexp.c 2013-08-01 18:31:30.000000000 +0200
---- src/regexp.c 2013-08-25 16:57:35.000000000 +0200
-***************
-*** 4311,4318 ****
- */
- for (;;)
- {
-! /* Some patterns may cause a long time to match, even though they are not
-! * illegal. E.g., "\([a-z]\+\)\+Q". Allow breaking them with CTRL-C. */
- fast_breakcheck();
-
- #ifdef DEBUG
---- 4311,4318 ----
- */
- for (;;)
- {
-! /* Some patterns may take a long time to match, e.g., "\([a-z]\+\)\+Q".
-! * Allow interrupting them with CTRL-C. */
- fast_breakcheck();
-
- #ifdef DEBUG
-*** ../vim-7.4.007/src/version.c 2013-08-22 14:14:23.000000000 +0200
---- src/version.c 2013-08-25 16:57:51.000000000 +0200
-***************
-*** 729,730 ****
---- 729,732 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 8,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-124. You begin conversations with, "Who is your internet service provider?"
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.009 b/pkgs/applications/editors/vim/patches/7.4.009
deleted file mode 100644
index f5e5fa60912..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.009
+++ /dev/null
@@ -1,64 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.009
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.009
-Problem: When a file was not decrypted (yet), writing it may destroy the
- contents.
-Solution: Mark the file as readonly until decryption was done. (Christian
- Brabandt)
-Files: src/fileio.c
-
-
-*** ../vim-7.4.008/src/fileio.c 2013-08-05 21:58:03.000000000 +0200
---- src/fileio.c 2013-08-25 17:45:27.000000000 +0200
-***************
-*** 2926,2934 ****
---- 2926,2939 ----
- int *did_ask; /* flag: whether already asked for key */
- {
- int method = crypt_method_from_magic((char *)ptr, *sizep);
-+ int b_p_ro = curbuf->b_p_ro;
-
- if (method >= 0)
- {
-+ /* Mark the buffer as read-only until the decryption has taken place.
-+ * Avoids accidentally overwriting the file with garbage. */
-+ curbuf->b_p_ro = TRUE;
-+
- set_crypt_method(curbuf, method);
- if (method > 0)
- (void)blowfish_self_test();
-***************
-*** 2977,2982 ****
---- 2982,2989 ----
- *sizep -= CRYPT_MAGIC_LEN + salt_len + seed_len;
- mch_memmove(ptr, ptr + CRYPT_MAGIC_LEN + salt_len + seed_len,
- (size_t)*sizep);
-+ /* Restore the read-only flag. */
-+ curbuf->b_p_ro = b_p_ro;
- }
- }
- /* When starting to edit a new file which does not have encryption, clear
-*** ../vim-7.4.008/src/version.c 2013-08-25 17:01:36.000000000 +0200
---- src/version.c 2013-08-25 17:44:30.000000000 +0200
-***************
-*** 729,730 ****
---- 729,732 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 9,
- /**/
-
---
-I have a watch cat! Just break in and she'll watch.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.010 b/pkgs/applications/editors/vim/patches/7.4.010
deleted file mode 100644
index fee6ba5b4a8..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.010
+++ /dev/null
@@ -1,79 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.010
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.010 (after 7.4.006)
-Problem: Crash with invalid argument to mkdir().
-Solution: Check for empty string. (lcd47)
-Files: src/eval.c
-
-
-*** ../vim-7.4.009/src/eval.c 2013-08-22 12:06:50.000000000 +0200
---- src/eval.c 2013-08-30 15:47:47.000000000 +0200
-***************
-*** 14292,14309 ****
- return;
-
- dir = get_tv_string_buf(&argvars[0], buf);
-! if (*gettail(dir) == NUL)
-! /* remove trailing slashes */
-! *gettail_sep(dir) = NUL;
-!
-! if (argvars[1].v_type != VAR_UNKNOWN)
- {
-! if (argvars[2].v_type != VAR_UNKNOWN)
-! prot = get_tv_number_chk(&argvars[2], NULL);
-! if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
-! mkdir_recurse(dir, prot);
- }
-- rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot);
- }
- #endif
-
---- 14292,14314 ----
- return;
-
- dir = get_tv_string_buf(&argvars[0], buf);
-! if (*dir == NUL)
-! rettv->vval.v_number = FAIL;
-! else
- {
-! if (*gettail(dir) == NUL)
-! /* remove trailing slashes */
-! *gettail_sep(dir) = NUL;
-!
-! if (argvars[1].v_type != VAR_UNKNOWN)
-! {
-! if (argvars[2].v_type != VAR_UNKNOWN)
-! prot = get_tv_number_chk(&argvars[2], NULL);
-! if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
-! mkdir_recurse(dir, prot);
-! }
-! rettv->vval.v_number = prot == -1 ? FAIL : vim_mkdir_emsg(dir, prot);
- }
- }
- #endif
-
-*** ../vim-7.4.009/src/version.c 2013-08-25 17:46:05.000000000 +0200
---- src/version.c 2013-08-30 15:48:37.000000000 +0200
-***************
-*** 729,730 ****
---- 729,732 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 10,
- /**/
-
---
-I wish there was a knob on the TV to turn up the intelligence.
-There's a knob called "brightness", but it doesn't seem to work.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.011 b/pkgs/applications/editors/vim/patches/7.4.011
deleted file mode 100644
index efff82c5eba..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.011
+++ /dev/null
@@ -1,100 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.011
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.011
-Problem: Cannot find out if "acl" and "xpm" features are supported.
-Solution: Add "acl" and "xpm" to the list of features. (Ken Takata)
-Files: src/eval.c, src/version.c
-
-
-*** ../vim-7.4.010/src/eval.c 2013-08-30 16:00:04.000000000 +0200
---- src/eval.c 2013-08-30 16:34:12.000000000 +0200
-***************
-*** 12135,12140 ****
---- 12135,12143 ----
- #ifndef CASE_INSENSITIVE_FILENAME
- "fname_case",
- #endif
-+ #ifdef HAVE_ACL
-+ "acl",
-+ #endif
- #ifdef FEAT_ARABIC
- "arabic",
- #endif
-***************
-*** 12538,12544 ****
- "xfontset",
- #endif
- #ifdef FEAT_XPM_W32
-! "xpm_w32",
- #endif
- #ifdef USE_XSMP
- "xsmp",
---- 12541,12552 ----
- "xfontset",
- #endif
- #ifdef FEAT_XPM_W32
-! "xpm",
-! "xpm_w32", /* for backward compatibility */
-! #else
-! # if defined(HAVE_XPM)
-! "xpm",
-! # endif
- #endif
- #ifdef USE_XSMP
- "xsmp",
-*** ../vim-7.4.010/src/version.c 2013-08-30 16:00:04.000000000 +0200
---- src/version.c 2013-08-30 16:34:37.000000000 +0200
-***************
-*** 60,65 ****
---- 60,70 ----
-
- static char *(features[]) =
- {
-+ #ifdef HAVE_ACL
-+ "+acl",
-+ #else
-+ "-acl",
-+ #endif
- #ifdef AMIGA /* only for Amiga systems */
- # ifdef FEAT_ARP
- "+ARP",
-***************
-*** 721,726 ****
---- 726,737 ----
- # else
- "-xpm_w32",
- # endif
-+ #else
-+ # ifdef HAVE_XPM
-+ "+xpm",
-+ # else
-+ "-xpm",
-+ # endif
- #endif
- NULL
- };
-*** ../vim-7.4.010/src/version.c 2013-08-30 16:00:04.000000000 +0200
---- src/version.c 2013-08-30 16:34:37.000000000 +0200
-***************
-*** 729,730 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 11,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-141. You'd rather go to http://www.weather.com/ than look out your window.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.012 b/pkgs/applications/editors/vim/patches/7.4.012
deleted file mode 100644
index f831442ea56..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.012
+++ /dev/null
@@ -1,202 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.012
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.012
-Problem: MS-Windows: resolving shortcut does not work properly with
- multi-byte characters.
-Solution: Use wide system functions. (Ken Takata)
-Files: src/os_mswin.c
-
-
-*** ../vim-7.4.011/src/os_mswin.c 2013-06-16 16:41:11.000000000 +0200
---- src/os_mswin.c 2013-08-30 16:43:23.000000000 +0200
-***************
-*** 1761,1769 ****
- IPersistFile *ppf = NULL;
- OLECHAR wsz[MAX_PATH];
- WIN32_FIND_DATA ffd; // we get those free of charge
-! TCHAR buf[MAX_PATH]; // could have simply reused 'wsz'...
- char_u *rfname = NULL;
- int len;
-
- /* Check if the file name ends in ".lnk". Avoid calling
- * CoCreateInstance(), it's quite slow. */
---- 1761,1773 ----
- IPersistFile *ppf = NULL;
- OLECHAR wsz[MAX_PATH];
- WIN32_FIND_DATA ffd; // we get those free of charge
-! CHAR buf[MAX_PATH]; // could have simply reused 'wsz'...
- char_u *rfname = NULL;
- int len;
-+ # ifdef FEAT_MBYTE
-+ IShellLinkW *pslw = NULL;
-+ WIN32_FIND_DATAW ffdw; // we get those free of charge
-+ # endif
-
- /* Check if the file name ends in ".lnk". Avoid calling
- * CoCreateInstance(), it's quite slow. */
-***************
-*** 1775,1792 ****
-
- CoInitialize(NULL);
-
- // create a link manager object and request its interface
- hr = CoCreateInstance(
- &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
- &IID_IShellLink, (void**)&psl);
- if (hr != S_OK)
-! goto shortcut_error;
-
- // Get a pointer to the IPersistFile interface.
- hr = psl->lpVtbl->QueryInterface(
- psl, &IID_IPersistFile, (void**)&ppf);
- if (hr != S_OK)
-! goto shortcut_error;
-
- // full path string must be in Unicode.
- MultiByteToWideChar(CP_ACP, 0, fname, -1, wsz, MAX_PATH);
---- 1779,1840 ----
-
- CoInitialize(NULL);
-
-+ # ifdef FEAT_MBYTE
-+ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
-+ {
-+ // create a link manager object and request its interface
-+ hr = CoCreateInstance(
-+ &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
-+ &IID_IShellLinkW, (void**)&pslw);
-+ if (hr == S_OK)
-+ {
-+ WCHAR *p = enc_to_utf16(fname, NULL);
-+
-+ if (p != NULL)
-+ {
-+ // Get a pointer to the IPersistFile interface.
-+ hr = pslw->lpVtbl->QueryInterface(
-+ pslw, &IID_IPersistFile, (void**)&ppf);
-+ if (hr != S_OK)
-+ goto shortcut_errorw;
-+
-+ // "load" the name and resolve the link
-+ hr = ppf->lpVtbl->Load(ppf, p, STGM_READ);
-+ if (hr != S_OK)
-+ goto shortcut_errorw;
-+ # if 0 // This makes Vim wait a long time if the target does not exist.
-+ hr = pslw->lpVtbl->Resolve(pslw, NULL, SLR_NO_UI);
-+ if (hr != S_OK)
-+ goto shortcut_errorw;
-+ # endif
-+
-+ // Get the path to the link target.
-+ ZeroMemory(wsz, MAX_PATH * sizeof(WCHAR));
-+ hr = pslw->lpVtbl->GetPath(pslw, wsz, MAX_PATH, &ffdw, 0);
-+ if (hr == S_OK && wsz[0] != NUL)
-+ rfname = utf16_to_enc(wsz, NULL);
-+
-+ shortcut_errorw:
-+ vim_free(p);
-+ if (hr == S_OK)
-+ goto shortcut_end;
-+ }
-+ }
-+ /* Retry with non-wide function (for Windows 98). */
-+ }
-+ # endif
- // create a link manager object and request its interface
- hr = CoCreateInstance(
- &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
- &IID_IShellLink, (void**)&psl);
- if (hr != S_OK)
-! goto shortcut_end;
-
- // Get a pointer to the IPersistFile interface.
- hr = psl->lpVtbl->QueryInterface(
- psl, &IID_IPersistFile, (void**)&ppf);
- if (hr != S_OK)
-! goto shortcut_end;
-
- // full path string must be in Unicode.
- MultiByteToWideChar(CP_ACP, 0, fname, -1, wsz, MAX_PATH);
-***************
-*** 1794,1805 ****
- // "load" the name and resolve the link
- hr = ppf->lpVtbl->Load(ppf, wsz, STGM_READ);
- if (hr != S_OK)
-! goto shortcut_error;
-! #if 0 // This makes Vim wait a long time if the target doesn't exist.
- hr = psl->lpVtbl->Resolve(psl, NULL, SLR_NO_UI);
- if (hr != S_OK)
-! goto shortcut_error;
-! #endif
-
- // Get the path to the link target.
- ZeroMemory(buf, MAX_PATH);
---- 1842,1853 ----
- // "load" the name and resolve the link
- hr = ppf->lpVtbl->Load(ppf, wsz, STGM_READ);
- if (hr != S_OK)
-! goto shortcut_end;
-! # if 0 // This makes Vim wait a long time if the target doesn't exist.
- hr = psl->lpVtbl->Resolve(psl, NULL, SLR_NO_UI);
- if (hr != S_OK)
-! goto shortcut_end;
-! # endif
-
- // Get the path to the link target.
- ZeroMemory(buf, MAX_PATH);
-***************
-*** 1807,1818 ****
- if (hr == S_OK && buf[0] != NUL)
- rfname = vim_strsave(buf);
-
-! shortcut_error:
- // Release all interface pointers (both belong to the same object)
- if (ppf != NULL)
- ppf->lpVtbl->Release(ppf);
- if (psl != NULL)
- psl->lpVtbl->Release(psl);
-
- CoUninitialize();
- return rfname;
---- 1855,1870 ----
- if (hr == S_OK && buf[0] != NUL)
- rfname = vim_strsave(buf);
-
-! shortcut_end:
- // Release all interface pointers (both belong to the same object)
- if (ppf != NULL)
- ppf->lpVtbl->Release(ppf);
- if (psl != NULL)
- psl->lpVtbl->Release(psl);
-+ # ifdef FEAT_MBYTE
-+ if (pslw != NULL)
-+ pslw->lpVtbl->Release(pslw);
-+ # endif
-
- CoUninitialize();
- return rfname;
-*** ../vim-7.4.011/src/version.c 2013-08-30 16:35:41.000000000 +0200
---- src/version.c 2013-08-30 16:39:40.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 12,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-142. You dream about creating the world's greatest web site.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.013 b/pkgs/applications/editors/vim/patches/7.4.013
deleted file mode 100644
index dcbe0fb3e43..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.013
+++ /dev/null
@@ -1,99 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.013
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.013
-Problem: File name buffer too small for utf-8.
-Solution: Use character count instead of byte count. (Ken Takata)
-Files: src/os_mswin.c
-
-
-*** ../vim-7.4.012/src/os_mswin.c 2013-08-30 16:44:15.000000000 +0200
---- src/os_mswin.c 2013-08-30 16:47:54.000000000 +0200
-***************
-*** 456,462 ****
---- 456,469 ----
- int
- mch_isFullName(char_u *fname)
- {
-+ #ifdef FEAT_MBYTE
-+ /* WinNT and later can use _MAX_PATH wide characters for a pathname, which
-+ * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
-+ * UTF-8. */
-+ char szName[_MAX_PATH * 3 + 1];
-+ #else
- char szName[_MAX_PATH + 1];
-+ #endif
-
- /* A name like "d:/foo" and "//server/share" is absolute */
- if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\'))
-***************
-*** 464,470 ****
- return TRUE;
-
- /* A name that can't be made absolute probably isn't absolute. */
-! if (mch_FullName(fname, szName, _MAX_PATH, FALSE) == FAIL)
- return FALSE;
-
- return pathcmp(fname, szName, -1) == 0;
---- 471,477 ----
- return TRUE;
-
- /* A name that can't be made absolute probably isn't absolute. */
-! if (mch_FullName(fname, szName, sizeof(szName) - 1, FALSE) == FAIL)
- return FALSE;
-
- return pathcmp(fname, szName, -1) == 0;
-***************
-*** 498,507 ****
- int
- vim_stat(const char *name, struct stat *stp)
- {
- char buf[_MAX_PATH + 1];
- char *p;
-
-! vim_strncpy((char_u *)buf, (char_u *)name, _MAX_PATH);
- p = buf + strlen(buf);
- if (p > buf)
- mb_ptr_back(buf, p);
---- 505,521 ----
- int
- vim_stat(const char *name, struct stat *stp)
- {
-+ #ifdef FEAT_MBYTE
-+ /* WinNT and later can use _MAX_PATH wide characters for a pathname, which
-+ * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
-+ * UTF-8. */
-+ char buf[_MAX_PATH * 3 + 1];
-+ #else
- char buf[_MAX_PATH + 1];
-+ #endif
- char *p;
-
-! vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1);
- p = buf + strlen(buf);
- if (p > buf)
- mb_ptr_back(buf, p);
-*** ../vim-7.4.012/src/version.c 2013-08-30 16:44:15.000000000 +0200
---- src/version.c 2013-08-30 16:47:36.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 13,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-143. You dream in pallettes of 216 websafe colors.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.014 b/pkgs/applications/editors/vim/patches/7.4.014
deleted file mode 100644
index f6554337f27..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.014
+++ /dev/null
@@ -1,102 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.014
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.014
-Problem: MS-Windows: check for writing to device does not work.
-Solution: Fix #ifdefs. (Ken Takata)
-Files: src/fileio.c
-
-
-*** ../vim-7.4.013/src/fileio.c 2013-08-25 17:46:05.000000000 +0200
---- src/fileio.c 2013-08-30 16:56:46.000000000 +0200
-***************
-*** 428,440 ****
- }
- }
-
-- #ifdef UNIX
-- /*
-- * On Unix it is possible to read a directory, so we have to
-- * check for it before the mch_open().
-- */
- if (!read_stdin && !read_buffer)
- {
- perm = mch_getperm(fname);
- if (perm >= 0 && !S_ISREG(perm) /* not a regular file ... */
- # ifdef S_ISFIFO
---- 428,440 ----
- }
- }
-
- if (!read_stdin && !read_buffer)
- {
-+ #ifdef UNIX
-+ /*
-+ * On Unix it is possible to read a directory, so we have to
-+ * check for it before the mch_open().
-+ */
- perm = mch_getperm(fname);
- if (perm >= 0 && !S_ISREG(perm) /* not a regular file ... */
- # ifdef S_ISFIFO
-***************
-*** 457,464 ****
- msg_scroll = msg_save;
- return FAIL;
- }
-!
-! # if defined(MSDOS) || defined(MSWIN) || defined(OS2)
- /*
- * MS-Windows allows opening a device, but we will probably get stuck
- * trying to read it.
---- 457,464 ----
- msg_scroll = msg_save;
- return FAIL;
- }
-! #endif
-! #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
- /*
- * MS-Windows allows opening a device, but we will probably get stuck
- * trying to read it.
-***************
-*** 470,478 ****
- msg_scroll = msg_save;
- return FAIL;
- }
-- # endif
-- }
- #endif
-
- /* Set default or forced 'fileformat' and 'binary'. */
- set_file_options(set_options, eap);
---- 470,477 ----
- msg_scroll = msg_save;
- return FAIL;
- }
- #endif
-+ }
-
- /* Set default or forced 'fileformat' and 'binary'. */
- set_file_options(set_options, eap);
-*** ../vim-7.4.013/src/version.c 2013-08-30 16:51:15.000000000 +0200
---- src/version.c 2013-08-30 16:54:33.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 14,
- /**/
-
---
-Drink wet cement and get really stoned.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.015 b/pkgs/applications/editors/vim/patches/7.4.015
deleted file mode 100644
index e8b284d12b3..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.015
+++ /dev/null
@@ -1,106 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.015
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.015
-Problem: MS-Windows: Detecting node type does not work for multi-byte
- characters.
-Solution: Use wide character function when needed. (Ken Takata)
-Files: src/os_win32.c
-
-
-*** ../vim-7.4.014/src/os_win32.c 2013-08-10 12:39:12.000000000 +0200
---- src/os_win32.c 2013-08-30 17:09:47.000000000 +0200
-***************
-*** 3107,3112 ****
---- 3107,3115 ----
- {
- HANDLE hFile;
- int type;
-+ #ifdef FEAT_MBYTE
-+ WCHAR *wn = NULL;
-+ #endif
-
- /* We can't open a file with a name "\\.\con" or "\\.\prn" and trying to
- * read from it later will cause Vim to hang. Thus return NODE_WRITABLE
-***************
-*** 3114,3127 ****
- if (STRNCMP(name, "\\\\.\\", 4) == 0)
- return NODE_WRITABLE;
-
-! hFile = CreateFile(name, /* file name */
-! GENERIC_WRITE, /* access mode */
-! 0, /* share mode */
-! NULL, /* security descriptor */
-! OPEN_EXISTING, /* creation disposition */
-! 0, /* file attributes */
-! NULL); /* handle to template file */
-
- if (hFile == INVALID_HANDLE_VALUE)
- return NODE_NORMAL;
-
---- 3117,3157 ----
- if (STRNCMP(name, "\\\\.\\", 4) == 0)
- return NODE_WRITABLE;
-
-! #ifdef FEAT_MBYTE
-! if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
-! {
-! wn = enc_to_utf16(name, NULL);
-! if (wn != NULL)
-! {
-! hFile = CreateFileW(wn, /* file name */
-! GENERIC_WRITE, /* access mode */
-! 0, /* share mode */
-! NULL, /* security descriptor */
-! OPEN_EXISTING, /* creation disposition */
-! 0, /* file attributes */
-! NULL); /* handle to template file */
-! if (hFile == INVALID_HANDLE_VALUE
-! && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
-! {
-! /* Retry with non-wide function (for Windows 98). */
-! vim_free(wn);
-! wn = NULL;
-! }
-! }
-! }
-! if (wn == NULL)
-! #endif
-! hFile = CreateFile(name, /* file name */
-! GENERIC_WRITE, /* access mode */
-! 0, /* share mode */
-! NULL, /* security descriptor */
-! OPEN_EXISTING, /* creation disposition */
-! 0, /* file attributes */
-! NULL); /* handle to template file */
-
-+ #ifdef FEAT_MBYTE
-+ vim_free(wn);
-+ #endif
- if (hFile == INVALID_HANDLE_VALUE)
- return NODE_NORMAL;
-
-*** ../vim-7.4.014/src/version.c 2013-08-30 17:06:56.000000000 +0200
---- src/version.c 2013-08-30 17:09:35.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 15,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-144. You eagerly await the update of the "Cool Site of the Day."
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.016 b/pkgs/applications/editors/vim/patches/7.4.016
deleted file mode 100644
index c58c605f5c1..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.016
+++ /dev/null
@@ -1,221 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.016
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.016
-Problem: MS-Windows: File name completion doesn't work properly with
- Chinese characters. (Yue Wu)
-Solution: Add fname_casew(). (Ken Takata)
-Files: src/os_win32.c
-
-
-*** ../vim-7.4.015/src/os_win32.c 2013-08-30 17:11:29.000000000 +0200
---- src/os_win32.c 2013-08-30 17:28:30.000000000 +0200
-***************
-*** 2500,2508 ****
---- 2500,2624 ----
- }
-
-
-+ #ifdef FEAT_MBYTE
-+ /*
-+ * fname_casew(): Wide version of fname_case(). Set the case of the file name,
-+ * if it already exists. When "len" is > 0, also expand short to long
-+ * filenames.
-+ * Return FAIL if wide functions are not available, OK otherwise.
-+ * NOTE: much of this is identical to fname_case(), keep in sync!
-+ */
-+ static int
-+ fname_casew(
-+ WCHAR *name,
-+ int len)
-+ {
-+ WCHAR szTrueName[_MAX_PATH + 2];
-+ WCHAR szTrueNameTemp[_MAX_PATH + 2];
-+ WCHAR *ptrue, *ptruePrev;
-+ WCHAR *porig, *porigPrev;
-+ int flen;
-+ WIN32_FIND_DATAW fb;
-+ HANDLE hFind;
-+ int c;
-+ int slen;
-+
-+ flen = (int)wcslen(name);
-+ if (flen > _MAX_PATH)
-+ return OK;
-+
-+ /* slash_adjust(name) not needed, already adjusted by fname_case(). */
-+
-+ /* Build the new name in szTrueName[] one component at a time. */
-+ porig = name;
-+ ptrue = szTrueName;
-+
-+ if (iswalpha(porig[0]) && porig[1] == L':')
-+ {
-+ /* copy leading drive letter */
-+ *ptrue++ = *porig++;
-+ *ptrue++ = *porig++;
-+ *ptrue = NUL; /* in case nothing follows */
-+ }
-+
-+ while (*porig != NUL)
-+ {
-+ /* copy \ characters */
-+ while (*porig == psepc)
-+ *ptrue++ = *porig++;
-+
-+ ptruePrev = ptrue;
-+ porigPrev = porig;
-+ while (*porig != NUL && *porig != psepc)
-+ {
-+ *ptrue++ = *porig++;
-+ }
-+ *ptrue = NUL;
-+
-+ /* To avoid a slow failure append "\*" when searching a directory,
-+ * server or network share. */
-+ wcscpy(szTrueNameTemp, szTrueName);
-+ slen = (int)wcslen(szTrueNameTemp);
-+ if (*porig == psepc && slen + 2 < _MAX_PATH)
-+ wcscpy(szTrueNameTemp + slen, L"\\*");
-+
-+ /* Skip "", "." and "..". */
-+ if (ptrue > ptruePrev
-+ && (ptruePrev[0] != L'.'
-+ || (ptruePrev[1] != NUL
-+ && (ptruePrev[1] != L'.' || ptruePrev[2] != NUL)))
-+ && (hFind = FindFirstFileW(szTrueNameTemp, &fb))
-+ != INVALID_HANDLE_VALUE)
-+ {
-+ c = *porig;
-+ *porig = NUL;
-+
-+ /* Only use the match when it's the same name (ignoring case) or
-+ * expansion is allowed and there is a match with the short name
-+ * and there is enough room. */
-+ if (_wcsicoll(porigPrev, fb.cFileName) == 0
-+ || (len > 0
-+ && (_wcsicoll(porigPrev, fb.cAlternateFileName) == 0
-+ && (int)(ptruePrev - szTrueName)
-+ + (int)wcslen(fb.cFileName) < len)))
-+ {
-+ wcscpy(ptruePrev, fb.cFileName);
-+
-+ /* Look for exact match and prefer it if found. Must be a
-+ * long name, otherwise there would be only one match. */
-+ while (FindNextFileW(hFind, &fb))
-+ {
-+ if (*fb.cAlternateFileName != NUL
-+ && (wcscoll(porigPrev, fb.cFileName) == 0
-+ || (len > 0
-+ && (_wcsicoll(porigPrev,
-+ fb.cAlternateFileName) == 0
-+ && (int)(ptruePrev - szTrueName)
-+ + (int)wcslen(fb.cFileName) < len))))
-+ {
-+ wcscpy(ptruePrev, fb.cFileName);
-+ break;
-+ }
-+ }
-+ }
-+ FindClose(hFind);
-+ *porig = c;
-+ ptrue = ptruePrev + wcslen(ptruePrev);
-+ }
-+ else if (hFind == INVALID_HANDLE_VALUE
-+ && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
-+ return FAIL;
-+ }
-+
-+ wcscpy(name, szTrueName);
-+ return OK;
-+ }
-+ #endif
-+
- /*
- * fname_case(): Set the case of the file name, if it already exists.
- * When "len" is > 0, also expand short to long filenames.
-+ * NOTE: much of this is identical to fname_casew(), keep in sync!
- */
- void
- fname_case(
-***************
-*** 2520,2530 ****
- int slen;
-
- flen = (int)STRLEN(name);
-! if (flen == 0 || flen > _MAX_PATH)
- return;
-
- slash_adjust(name);
-
- /* Build the new name in szTrueName[] one component at a time. */
- porig = name;
- ptrue = szTrueName;
---- 2636,2679 ----
- int slen;
-
- flen = (int)STRLEN(name);
-! if (flen == 0)
- return;
-
- slash_adjust(name);
-
-+ #ifdef FEAT_MBYTE
-+ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
-+ {
-+ WCHAR *p = enc_to_utf16(name, NULL);
-+
-+ if (p != NULL)
-+ {
-+ char_u *q;
-+ WCHAR buf[_MAX_PATH + 2];
-+
-+ wcscpy(buf, p);
-+ vim_free(p);
-+
-+ if (fname_casew(buf, (len > 0) ? _MAX_PATH : 0) == OK)
-+ {
-+ q = utf16_to_enc(buf, NULL);
-+ if (q != NULL)
-+ {
-+ vim_strncpy(name, q, (len > 0) ? len - 1 : flen);
-+ vim_free(q);
-+ return;
-+ }
-+ }
-+ }
-+ /* Retry with non-wide function (for Windows 98). */
-+ }
-+ #endif
-+
-+ /* If 'enc' is utf-8, flen can be larger than _MAX_PATH.
-+ * So we should check this after calling wide function. */
-+ if (flen > _MAX_PATH)
-+ return;
-+
- /* Build the new name in szTrueName[] one component at a time. */
- porig = name;
- ptrue = szTrueName;
-*** ../vim-7.4.015/src/version.c 2013-08-30 17:11:29.000000000 +0200
---- src/version.c 2013-08-30 17:15:06.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 16,
- /**/
-
---
-Fingers not found - Pound head on keyboard to continue.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.017 b/pkgs/applications/editors/vim/patches/7.4.017
deleted file mode 100644
index 7d7fad83fe7..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.017
+++ /dev/null
@@ -1,78 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.017
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.017
-Problem: ":help !!" does not find the "!!" tag in the help file. (Ben
- Fritz)
-Solution: When reading the start of the tags file do parse lines that are
- not header lines.
-Files: src/tag.c
-
-
-*** ../vim-7.4.016/src/tag.c 2013-06-15 22:26:26.000000000 +0200
---- src/tag.c 2013-09-05 12:03:38.000000000 +0200
-***************
-*** 1797,1809 ****
- */
- if (state == TS_START)
- {
-! /* The header ends when the line sorts below "!_TAG_".
-! * There may be non-header items before the header though,
-! * e.g. "!" itself. When case is folded lower case letters
-! * sort before "_". */
- if (STRNCMP(lbuf, "!_TAG_", 6) <= 0
- || (lbuf[0] == '!' && ASCII_ISLOWER(lbuf[1])))
- {
- /*
- * Read header line.
- */
---- 1797,1812 ----
- */
- if (state == TS_START)
- {
-! /* The header ends when the line sorts below "!_TAG_". When
-! * case is folded lower case letters sort before "_". */
- if (STRNCMP(lbuf, "!_TAG_", 6) <= 0
- || (lbuf[0] == '!' && ASCII_ISLOWER(lbuf[1])))
- {
-+ if (STRNCMP(lbuf, "!_TAG_", 6) != 0)
-+ /* Non-header item before the header, e.g. "!" itself.
-+ */
-+ goto parse_line;
-+
- /*
- * Read header line.
- */
-***************
-*** 1898,1903 ****
---- 1901,1907 ----
- #endif
- }
-
-+ parse_line:
- /*
- * Figure out where the different strings are in this line.
- * For "normal" tags: Do a quick check if the tag matches.
-*** ../vim-7.4.016/src/version.c 2013-08-30 17:29:10.000000000 +0200
---- src/version.c 2013-09-05 12:02:01.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 17,
- /**/
-
---
-An error has occurred. Hit any user to continue.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.018 b/pkgs/applications/editors/vim/patches/7.4.018
deleted file mode 100644
index 2214c30b2b8..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.018
+++ /dev/null
@@ -1,45 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.018
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.018
-Problem: When completing item becomes unselected. (Shougo Matsu)
-Solution: Revert patch 7.3.1269.
-Files: src/edit.c
-
-
-*** ../vim-7.4.017/src/edit.c 2013-07-04 20:22:25.000000000 +0200
---- src/edit.c 2013-09-05 12:39:53.000000000 +0200
-***************
-*** 3467,3473 ****
- }
-
- compl_enter_selects = !compl_used_match;
-- compl_shown_match = compl_curr_match = compl_first_match;
-
- /* Show the popup menu with a different set of matches. */
- ins_compl_show_pum();
---- 3467,3472 ----
-*** ../vim-7.4.017/src/version.c 2013-09-05 12:06:26.000000000 +0200
---- src/version.c 2013-09-05 12:40:34.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 18,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-169. You hire a housekeeper for your home page.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.019 b/pkgs/applications/editors/vim/patches/7.4.019
deleted file mode 100644
index b1532c19c81..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.019
+++ /dev/null
@@ -1,61 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.019
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.019
-Problem: MS-Windows: File name completion doesn't work properly with
- Chinese characters. (Yue Wu)
-Solution: Take care of multi-byte characters when looking for the start of
- the file name. (Ken Takata)
-Files: src/edit.c
-
-
-*** ../vim-7.4.018/src/edit.c 2013-09-05 12:49:48.000000000 +0200
---- src/edit.c 2013-09-05 13:45:27.000000000 +0200
-***************
-*** 5183,5190 ****
- }
- else if (ctrl_x_mode == CTRL_X_FILES)
- {
-! while (--startcol >= 0 && vim_isfilec(line[startcol]))
-! ;
- compl_col += ++startcol;
- compl_length = (int)curs_col - startcol;
- compl_pattern = addstar(line + compl_col, compl_length,
---- 5183,5196 ----
- }
- else if (ctrl_x_mode == CTRL_X_FILES)
- {
-! char_u *p = line + startcol;
-!
-! /* Go back to just before the first filename character. */
-! mb_ptr_back(line, p);
-! while (vim_isfilec(PTR2CHAR(p)) && p >= line)
-! mb_ptr_back(line, p);
-! startcol = p - line;
-!
- compl_col += ++startcol;
- compl_length = (int)curs_col - startcol;
- compl_pattern = addstar(line + compl_col, compl_length,
-*** ../vim-7.4.018/src/version.c 2013-09-05 12:49:48.000000000 +0200
---- src/version.c 2013-09-05 13:41:47.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 19,
- /**/
-
---
- Very funny, Scotty. Now beam down my clothes.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.020 b/pkgs/applications/editors/vim/patches/7.4.020
deleted file mode 100644
index 942d82fe255..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.020
+++ /dev/null
@@ -1,82 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.020
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.020
-Problem: NFA engine matches too much with \@>. (John McGowan)
-Solution: When a whole pattern match is found stop searching.
-Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
-
-
-*** ../vim-7.4.019/src/regexp_nfa.c 2013-08-25 17:01:36.000000000 +0200
---- src/regexp_nfa.c 2013-09-05 15:59:44.000000000 +0200
-***************
-*** 5322,5328 ****
- log_subsexpr(m);
- #endif
- nfa_match = TRUE;
-! break;
-
- case NFA_START_INVISIBLE:
- case NFA_START_INVISIBLE_FIRST:
---- 5322,5331 ----
- log_subsexpr(m);
- #endif
- nfa_match = TRUE;
-! /* See comment above at "goto nextchar". */
-! if (nextlist->n == 0)
-! clen = 0;
-! goto nextchar;
-
- case NFA_START_INVISIBLE:
- case NFA_START_INVISIBLE_FIRST:
-*** ../vim-7.4.019/src/testdir/test64.in 2013-08-14 13:31:03.000000000 +0200
---- src/testdir/test64.in 2013-09-05 15:35:44.000000000 +0200
-***************
-*** 427,432 ****
---- 427,433 ----
- :""""" \@>
- :call add(tl, [2, '\(a*\)\@>a', 'aaaa'])
- :call add(tl, [2, '\(a*\)\@>b', 'aaab', 'aaab', 'aaa'])
-+ :call add(tl, [2, '^\(.\{-}b\)\@>.', ' abcbd', ' abc', ' ab'])
- :" TODO: BT engine does not restore submatch after failure
- :call add(tl, [1, '\(a*\)\@>a\|a\+', 'aaaa', 'aaaa'])
- :"
-*** ../vim-7.4.019/src/testdir/test64.ok 2013-08-14 13:31:03.000000000 +0200
---- src/testdir/test64.ok 2013-09-05 16:03:34.000000000 +0200
-***************
-*** 983,988 ****
---- 983,991 ----
- OK 0 - \(a*\)\@>b
- OK 1 - \(a*\)\@>b
- OK 2 - \(a*\)\@>b
-+ OK 0 - ^\(.\{-}b\)\@>.
-+ OK 1 - ^\(.\{-}b\)\@>.
-+ OK 2 - ^\(.\{-}b\)\@>.
- OK 0 - \(a*\)\@>a\|a\+
- OK 2 - \(a*\)\@>a\|a\+
- OK 0 - \_[^8-9]\+
-*** ../vim-7.4.019/src/version.c 2013-09-05 13:50:49.000000000 +0200
---- src/version.c 2013-09-05 16:04:32.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 20,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-173. You keep tracking down the email addresses of all your friends
- (even childhood friends).
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.021 b/pkgs/applications/editors/vim/patches/7.4.021
deleted file mode 100644
index 0936d9a194b..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.021
+++ /dev/null
@@ -1,86 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.021
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.021
-Problem: NFA regexp: Using \ze in one branch which doesn't match may cause
- end of another branch to be wrong. (William Fugh)
-Solution: Set end position if it wasn't set yet.
-Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
-
-
-*** ../vim-7.4.020/src/regexp_nfa.c 2013-09-05 16:05:32.000000000 +0200
---- src/regexp_nfa.c 2013-09-05 20:56:25.000000000 +0200
-***************
-*** 4209,4218 ****
- break;
-
- case NFA_MCLOSE:
-! if (nfa_has_zend)
- {
-! /* Do not overwrite the position set by \ze. If no \ze
-! * encountered end will be set in nfa_regtry(). */
- subs = addstate(l, state->out, subs, pim, off);
- break;
- }
---- 4209,4219 ----
- break;
-
- case NFA_MCLOSE:
-! if (nfa_has_zend && (REG_MULTI
-! ? subs->norm.list.multi[0].end.lnum >= 0
-! : subs->norm.list.line[0].end != NULL))
- {
-! /* Do not overwrite the position set by \ze. */
- subs = addstate(l, state->out, subs, pim, off);
- break;
- }
-*** ../vim-7.4.020/src/testdir/test64.in 2013-09-05 16:05:32.000000000 +0200
---- src/testdir/test64.in 2013-09-05 20:55:18.000000000 +0200
-***************
-*** 328,333 ****
---- 328,334 ----
- :call add(tl, [2, 'abc \zsmatch\ze abc', 'abc abc abc match abc abc', 'match'])
- :call add(tl, [2, '\v(a \zsif .*){2}', 'a if then a if last', 'if last', 'a if last'])
- :call add(tl, [2, '\>\zs.', 'aword. ', '.'])
-+ :call add(tl, [2, '\s\+\ze\[/\|\s\zs\s\+', 'is [a t', ' '])
- :"
- :"""" Tests for \@= and \& features
- :call add(tl, [2, 'abc\@=', 'abc', 'ab'])
-*** ../vim-7.4.020/src/testdir/test64.ok 2013-09-05 16:05:32.000000000 +0200
---- src/testdir/test64.ok 2013-09-05 21:09:56.000000000 +0200
-***************
-*** 752,757 ****
---- 752,760 ----
- OK 0 - \>\zs.
- OK 1 - \>\zs.
- OK 2 - \>\zs.
-+ OK 0 - \s\+\ze\[/\|\s\zs\s\+
-+ OK 1 - \s\+\ze\[/\|\s\zs\s\+
-+ OK 2 - \s\+\ze\[/\|\s\zs\s\+
- OK 0 - abc\@=
- OK 1 - abc\@=
- OK 2 - abc\@=
-*** ../vim-7.4.020/src/version.c 2013-09-05 16:05:32.000000000 +0200
---- src/version.c 2013-09-05 21:11:38.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 21,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-174. You know what a listserv is.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.022 b/pkgs/applications/editors/vim/patches/7.4.022
deleted file mode 100644
index 81a0901f5b5..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.022
+++ /dev/null
@@ -1,148 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.022
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.022
-Problem: Deadlock while exiting, because of allocating memory.
-Solution: Do not use gettext() in deathtrap(). (James McCoy)
-Files: src/os_unix.c, src/misc1.c
-
-
-*** ../vim-7.4.021/src/os_unix.c 2013-07-03 16:32:32.000000000 +0200
---- src/os_unix.c 2013-09-05 21:40:06.000000000 +0200
-***************
-*** 957,964 ****
-
- /*
- * This function handles deadly signals.
-! * It tries to preserve any swap file and exit properly.
- * (partly from Elvis).
- */
- static RETSIGTYPE
- deathtrap SIGDEFARG(sigarg)
---- 957,966 ----
-
- /*
- * This function handles deadly signals.
-! * It tries to preserve any swap files and exit properly.
- * (partly from Elvis).
-+ * NOTE: Avoid unsafe functions, such as allocating memory, they can result in
-+ * a deadlock.
- */
- static RETSIGTYPE
- deathtrap SIGDEFARG(sigarg)
-***************
-*** 1090,1107 ****
- }
- if (entered == 2)
- {
-! OUT_STR(_("Vim: Double signal, exiting\n"));
- out_flush();
- getout(1);
- }
-
- #ifdef SIGHASARG
-! sprintf((char *)IObuff, _("Vim: Caught deadly signal %s\n"),
- signal_info[i].name);
- #else
-! sprintf((char *)IObuff, _("Vim: Caught deadly signal\n"));
- #endif
-! preserve_exit(); /* preserve files and exit */
-
- #ifdef NBDEBUG
- reset_signals();
---- 1092,1114 ----
- }
- if (entered == 2)
- {
-! /* No translation, it may call malloc(). */
-! OUT_STR("Vim: Double signal, exiting\n");
- out_flush();
- getout(1);
- }
-
-+ /* No translation, it may call malloc(). */
- #ifdef SIGHASARG
-! sprintf((char *)IObuff, "Vim: Caught deadly signal %s\n",
- signal_info[i].name);
- #else
-! sprintf((char *)IObuff, "Vim: Caught deadly signal\n");
- #endif
-!
-! /* Preserve files and exit. This sets the really_exiting flag to prevent
-! * calling free(). */
-! preserve_exit();
-
- #ifdef NBDEBUG
- reset_signals();
-*** ../vim-7.4.021/src/misc1.c 2013-08-03 17:29:33.000000000 +0200
---- src/misc1.c 2013-09-05 21:34:04.000000000 +0200
-***************
-*** 9174,9179 ****
---- 9174,9181 ----
- /*
- * Preserve files and exit.
- * When called IObuff must contain a message.
-+ * NOTE: This may be called from deathtrap() in a signal handler, avoid unsafe
-+ * functions, such as allocating memory.
- */
- void
- preserve_exit()
-***************
-*** 9196,9202 ****
- {
- if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL)
- {
-! OUT_STR(_("Vim: preserving files...\n"));
- screen_start(); /* don't know where cursor is now */
- out_flush();
- ml_sync_all(FALSE, FALSE); /* preserve all swap files */
---- 9198,9204 ----
- {
- if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL)
- {
-! OUT_STR("Vim: preserving files...\n");
- screen_start(); /* don't know where cursor is now */
- out_flush();
- ml_sync_all(FALSE, FALSE); /* preserve all swap files */
-***************
-*** 9206,9212 ****
-
- ml_close_all(FALSE); /* close all memfiles, without deleting */
-
-! OUT_STR(_("Vim: Finished.\n"));
-
- getout(1);
- }
---- 9208,9214 ----
-
- ml_close_all(FALSE); /* close all memfiles, without deleting */
-
-! OUT_STR("Vim: Finished.\n");
-
- getout(1);
- }
-*** ../vim-7.4.021/src/version.c 2013-09-05 21:15:38.000000000 +0200
---- src/version.c 2013-09-05 21:30:18.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 22,
- /**/
-
---
-hundred-and-one symptoms of being an internet addict:
-175. You send yourself e-mail before you go to bed to remind you
- what to do when you wake up.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/patches/7.4.023 b/pkgs/applications/editors/vim/patches/7.4.023
deleted file mode 100644
index 03005213ea4..00000000000
--- a/pkgs/applications/editors/vim/patches/7.4.023
+++ /dev/null
@@ -1,53 +0,0 @@
-To: vim_dev@googlegroups.com
-Subject: Patch 7.4.023
-Fcc: outbox
-From: Bram Moolenaar
-Mime-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-------------
-
-Patch 7.4.023
-Problem: Compiler warning on 64 bit windows.
-Solution: Add type cast. (Mike Williams)
-Files: src/edit.c
-
-
-*** ../vim-7.4.022/src/edit.c 2013-09-05 13:50:49.000000000 +0200
---- src/edit.c 2013-09-06 17:32:55.000000000 +0200
-***************
-*** 5189,5195 ****
- mb_ptr_back(line, p);
- while (vim_isfilec(PTR2CHAR(p)) && p >= line)
- mb_ptr_back(line, p);
-! startcol = p - line;
-
- compl_col += ++startcol;
- compl_length = (int)curs_col - startcol;
---- 5189,5195 ----
- mb_ptr_back(line, p);
- while (vim_isfilec(PTR2CHAR(p)) && p >= line)
- mb_ptr_back(line, p);
-! startcol = (int)(p - line);
-
- compl_col += ++startcol;
- compl_length = (int)curs_col - startcol;
-*** ../vim-7.4.022/src/version.c 2013-09-05 21:41:35.000000000 +0200
---- src/version.c 2013-09-06 17:33:41.000000000 +0200
-***************
-*** 740,741 ****
---- 740,743 ----
- { /* Add new patch number below this line */
-+ /**/
-+ 23,
- /**/
-
---
-Wizards had always known that the act of observation changed the thing that
-was observed, and sometimes forgot that it also changed the observer too.
- Terry Pratchett - Interesting times
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
-/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
-\\\ an exciting new programming language -- http://www.Zimbu.org ///
- \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
diff --git a/pkgs/applications/editors/vim/python_framework.patch b/pkgs/applications/editors/vim/python_framework.patch
new file mode 100644
index 00000000000..b7c7cee6cd9
--- /dev/null
+++ b/pkgs/applications/editors/vim/python_framework.patch
@@ -0,0 +1,23 @@
+diff --git a/src/auto/configure b/src/auto/configure
+index a9755a0..4a0e2a4 100755
+--- a/auto/configure
++++ b/auto/configure
+@@ -5638,10 +5638,6 @@ __:
+ eof
+ eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
+ rm -f -- "${tmp_mkf}"
+- if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
+- "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
+- vi_cv_path_python_plibs="-framework Python"
+- else
+ if test "${vi_cv_var_python_version}" = "1.4"; then
+ vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
+ else
+@@ -5649,7 +5645,6 @@ eof
+ fi
+ vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
+ vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
+- fi
+
+ fi
+
diff --git a/pkgs/applications/editors/vim/qvim.nix b/pkgs/applications/editors/vim/qvim.nix
new file mode 100644
index 00000000000..2357e23bf01
--- /dev/null
+++ b/pkgs/applications/editors/vim/qvim.nix
@@ -0,0 +1,126 @@
+args@{...}: with args;
+
+
+let inherit (args.composableDerivation) composableDerivation edf; in
+composableDerivation {
+ # use gccApple to compile on darwin
+ mkDerivation = ( if stdenv.isDarwin
+ then stdenvAdapters.overrideGCC stdenv gccApple
+ else stdenv ).mkDerivation;
+} (fix: {
+
+ name = "qvim-7.4";
+
+ enableParallelBuilding = true; # test this
+
+ src = fetchgit {
+ url = https://bitbucket.org/equalsraf/vim-qt.git ;
+ rev = "4160bfd5c1380e899d2f426b494fc4f1cf6ae85e";
+ sha256 = "1qa3xl1b9gqw66p71h53l7ibs4y3zfyj553jss70ybxaxchbhi5b";
+ };
+
+ # FIXME: adopt Darwin fixes from vim/default.nix, then chage meta.platforms.linux
+ # to meta.platforms.unix
+ preConfigure = assert (! stdenv.isDarwin); "";
+
+ configureFlags = [ "--with-vim-name=qvim" "--enable-gui=qt" "--with-features=${args.features}" ];
+
+ nativeBuildInputs
+ = [ ncurses pkgconfig libX11 libXext libSM libXpm libXt libXaw libXau
+ libXmu libICE qt4];
+
+ # most interpreters aren't tested yet.. (see python for example how to do it)
+ flags = {
+ ftNix = {
+ # because we cd to src in the main patch phase, we can't just add this
+ # patch to the list, we have to apply it manually
+ postPatch = ''
+ cd runtime
+ patch -p2 < ${./ft-nix-support.patch}
+ cd ..
+ '';
+ };
+ }
+ // edf { name = "darwin"; } #Disable Darwin (Mac OS X) support.
+ // edf { name = "xsmp"; } #Disable XSMP session management
+ // edf { name = "xsmp_interact"; } #Disable XSMP interaction
+ // edf { name = "mzscheme"; } #Include MzScheme interpreter.
+ // edf { name = "perl"; feat = "perlinterp"; enable = { nativeBuildInputs = [perl]; };} #Include Perl interpreter.
+
+ // edf {
+ name = "python";
+ feat = "pythoninterp";
+ enable = {
+ nativeBuildInputs = [ python ];
+ } // lib.optionalAttrs stdenv.isDarwin {
+ configureFlags
+ = [ "--enable-pythoninterp=yes"
+ "--with-python-config-dir=${python}/lib" ];
+ };
+ }
+
+ // edf { name = "tcl"; enable = { nativeBuildInputs = [tcl]; }; } #Include Tcl interpreter.
+ // edf { name = "ruby"; feat = "rubyinterp"; enable = { nativeBuildInputs = [ruby]; };} #Include Ruby interpreter.
+ // edf {
+ name = "lua";
+ feat = "luainterp";
+ enable = {
+ nativeBuildInputs = [lua];
+ configureFlags = [
+ "--with-lua-prefix=${args.lua}"
+ "--enable-luainterp"
+ ];
+ };
+ }
+ // edf { name = "cscope"; } #Include cscope interface.
+ // edf { name = "workshop"; } #Include Sun Visual Workshop support.
+ // edf { name = "netbeans"; } #Disable NetBeans integration support.
+ // edf { name = "sniff"; feat = "sniff" ; } #Include Sniff interface.
+ // edf { name = "multibyte"; } #Include multibyte editing support.
+ // edf { name = "hangulinput"; feat = "hangulinput" ;} #Include Hangul input support.
+ // edf { name = "xim"; } #Include XIM input support.
+ // edf { name = "fontset"; } #Include X fontset output support.
+ // edf { name = "acl"; } #Don't check for ACL support.
+ // edf { name = "gpm"; } #Don't use gpm (Linux mouse daemon).
+ // edf { name = "nls"; enable = {nativeBuildInputs = [gettext];}; } #Don't support NLS (gettext()).
+ ;
+
+ cfg = {
+ luaSupport = config.vim.lua or true;
+ pythonSupport = config.vim.python or true;
+ rubySupport = config.vim.ruby or true;
+ nlsSupport = config.vim.nls or false;
+ tclSupport = config.vim.tcl or false;
+ multibyteSupport = config.vim.multibyte or false;
+ cscopeSupport = config.vim.cscope or false;
+ netbeansSupport = config.netbeans or true; # eg envim is using it
+
+ # by default, compile with darwin support if we're compiling on darwin, but
+ # allow this to be disabled by setting config.vim.darwin to false
+ darwinSupport = stdenv.isDarwin && (config.vim.darwin or true);
+
+ # add .nix filetype detection and minimal syntax highlighting support
+ ftNixSupport = config.vim.ftNix or true;
+ };
+
+ postInstall = stdenv.lib.optionalString stdenv.isLinux ''
+ rpath=`patchelf --print-rpath $out/bin/qvim`;
+ for i in $nativeBuildInputs; do
+ echo adding $i/lib
+ rpath=$rpath:$i/lib
+ done
+ echo $nativeBuildInputs
+ echo $rpath
+ patchelf --set-rpath $rpath $out/bin/qvim
+ '';
+
+ dontStrip = 1;
+
+ meta = with stdenv.lib; {
+ description = "The most popular clone of the VI editor (Qt GUI fork)";
+ homepage = https://bitbucket.org/equalsraf/vim-qt/wiki/Home;
+ maintainers = with maintainers; [ smironov ];
+ platforms = platforms.linux;
+ };
+})
+
diff --git a/pkgs/applications/editors/yi/yi-contrib.nix b/pkgs/applications/editors/yi/yi-contrib.nix
new file mode 100644
index 00000000000..59b6992a369
--- /dev/null
+++ b/pkgs/applications/editors/yi/yi-contrib.nix
@@ -0,0 +1,19 @@
+# This file was auto-generated by cabal2nix. Please do NOT edit manually!
+
+{ cabal, filepath, lens, mtl, split, time, transformersBase, yi }:
+
+cabal.mkDerivation (self: {
+ pname = "yi-contrib";
+ version = "0.8.2";
+ sha256 = "17rbgrra1ghlywiraadf16n7igxp1k8jqqmb0iw8sc15y7825qqm";
+ buildDepends = [
+ filepath lens mtl split time transformersBase yi
+ ];
+ meta = {
+ homepage = "http://haskell.org/haskellwiki/Yi";
+ description = "Add-ons to Yi, the Haskell-Scriptable Editor";
+ license = "GPL";
+ platforms = self.ghc.meta.platforms;
+ maintainers = with self.stdenv.lib.maintainers; [ fuuzetsu ];
+ };
+})
diff --git a/pkgs/applications/editors/yi/yi.nix b/pkgs/applications/editors/yi/yi.nix
new file mode 100644
index 00000000000..ae5e9a83452
--- /dev/null
+++ b/pkgs/applications/editors/yi/yi.nix
@@ -0,0 +1,63 @@
+{ cabal, alex, binary, Cabal, cautiousFile, concreteTyperep
+, dataDefault, derive, Diff, dlist, dyre, filepath, fingertree
+, glib, gtk, hashable, hint, HUnit, lens, mtl, pango, parsec
+, pointedlist, QuickCheck, random, regexBase, regexTdfa, safe
+, split, tasty, tastyHunit, tastyQuickcheck, time, transformersBase
+, uniplate, unixCompat, unorderedContainers, utf8String, vty
+, xdgBasedir
+, withPango ? true
+
+# User may need extra dependencies for their configuration file so we
+# want to specify it here to have them available when wrapping the
+# produced binary.
+, extraDepends ? [ ]
+}:
+
+cabal.mkDerivation (self: {
+ pname = "yi";
+ version = "0.8.2";
+ sha256 = "18rnyswsdzkh0jdcqfg8pr90mpm6xf11siv598svqkxg12d2qql9";
+ isLibrary = true;
+ isExecutable = true;
+ buildDepends = [
+ binary Cabal cautiousFile concreteTyperep dataDefault derive Diff
+ dlist dyre filepath fingertree hashable hint lens mtl
+ parsec pointedlist QuickCheck random regexBase regexTdfa safe
+ split time transformersBase uniplate unixCompat unorderedContainers
+ utf8String vty xdgBasedir
+ ] ++ (if withPango then [ pango gtk glib ] else [ ]) ++ extraDepends;
+ testDepends = [
+ filepath HUnit QuickCheck tasty tastyHunit tastyQuickcheck
+ ];
+ buildTools = [ alex ];
+ configureFlags = if withPango then "-fpango" else "-f-pango";
+ doCheck = false;
+
+ # https://ghc.haskell.org/trac/ghc/ticket/9170
+ noHaddock = self.ghc.version == "7.6.3";
+
+ # Allows Yi to find the libraries it needs at runtime.
+ postInstall = ''
+ mv $out/bin/yi $out/bin/.yi-wrapped
+ cat - > $out/bin/yi < $out/zed/zed-bin
+ cp $NWPATH/nw.pak $out/zed/
+ cp nw/zed-linux $out/zed/zed
+ chmod +x $out/zed/zed*
+ cp Zed.desktop.tmpl Zed.svg Zed.png $out/zed
+ rm $out/zed/app.nw
+ '';
+
+ postFixup = ''
+ patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" $out/zed/zed-bin
+ patchelf --set-rpath "${rpath_env}/lib:${rpath_env}/lib64" $out/zed/zed-bin
+
+ mkdir -p $out/lib
+ ln -s ${udev}/lib/libudev.so.1 $out/lib/libudev.so.0
+
+ wrapProgram $out/zed/zed-bin \
+ --prefix LD_LIBRARY_PATH : $out/lib \
+ --prefix NODE_PATH : ${node_env}/lib/node_modules
+ '';
+ };
+
+ zed_script = writeScript "zed.sh" ''
+ if [[ $1 == http://* ]] || [[ $1 == https://* ]]; then
+ PROJECT=$1
+ elif [ "" != "$1" ]; then
+ PROJECT=$(readlink -f $1)
+ fi
+ ${zed}/zed/zed-bin $PROJECT
+ '';
+
+in stdenv.mkDerivation rec {
+ inherit name version;
+
+ src = zed;
+
+ installPhase = ''
+ mkdir -p $out/bin
+ ln -s ${zed_script} $out/bin/zed
+ '';
+
+ meta = {
+ description = "Zed is a fully offline-capable, open source, keyboard-focused, text and code editor for power users";
+ license = stdenv.lib.licenses.mit;
+ homepage = http://zedapp.org/;
+ maintainers = [ stdenv.lib.maintainers.matejc ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/editors/zed/node.nix b/pkgs/applications/editors/zed/node.nix
new file mode 100644
index 00000000000..b4a7cec4269
--- /dev/null
+++ b/pkgs/applications/editors/zed/node.nix
@@ -0,0 +1,634 @@
+{ self, fetchurl, fetchgit ? null, lib }:
+
+{
+ by-spec."asn1"."0.1.11" =
+ self.by-version."asn1"."0.1.11";
+ by-version."asn1"."0.1.11" = lib.makeOverridable self.buildNodePackage {
+ name = "node-asn1-0.1.11";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz";
+ name = "asn1-0.1.11.tgz";
+ sha1 = "559be18376d08a4ec4dbe80877d27818639b2df7";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."asn1" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "asn1" ];
+ };
+ by-spec."assert-plus"."0.1.2" =
+ self.by-version."assert-plus"."0.1.2";
+ by-version."assert-plus"."0.1.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-assert-plus-0.1.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz";
+ name = "assert-plus-0.1.2.tgz";
+ sha1 = "d93ffdbb67ac5507779be316a7d65146417beef8";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."assert-plus" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "assert-plus" ];
+ };
+ by-spec."async"."~0.9.0" =
+ self.by-version."async"."0.9.0";
+ by-version."async"."0.9.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-async-0.9.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/async/-/async-0.9.0.tgz";
+ name = "async-0.9.0.tgz";
+ sha1 = "ac3613b1da9bed1b47510bb4651b8931e47146c7";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."async" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "async" ];
+ };
+ by-spec."aws-sign2"."~0.5.0" =
+ self.by-version."aws-sign2"."0.5.0";
+ by-version."aws-sign2"."0.5.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-aws-sign2-0.5.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz";
+ name = "aws-sign2-0.5.0.tgz";
+ sha1 = "c57103f7a17fc037f02d7c2e64b602ea223f7d63";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."aws-sign2" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "aws-sign2" ];
+ };
+ by-spec."block-stream"."*" =
+ self.by-version."block-stream"."0.0.7";
+ by-version."block-stream"."0.0.7" = lib.makeOverridable self.buildNodePackage {
+ name = "node-block-stream-0.0.7";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/block-stream/-/block-stream-0.0.7.tgz";
+ name = "block-stream-0.0.7.tgz";
+ sha1 = "9088ab5ae1e861f4d81b176b4a8046080703deed";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."block-stream" or []);
+ deps = [
+ self.by-version."inherits"."2.0.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "block-stream" ];
+ };
+ by-spec."boom"."0.4.x" =
+ self.by-version."boom"."0.4.2";
+ by-version."boom"."0.4.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-boom-0.4.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/boom/-/boom-0.4.2.tgz";
+ name = "boom-0.4.2.tgz";
+ sha1 = "7a636e9ded4efcefb19cef4947a3c67dfaee911b";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."boom" or []);
+ deps = [
+ self.by-version."hoek"."0.9.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "boom" ];
+ };
+ by-spec."combined-stream"."~0.0.4" =
+ self.by-version."combined-stream"."0.0.5";
+ by-version."combined-stream"."0.0.5" = lib.makeOverridable self.buildNodePackage {
+ name = "node-combined-stream-0.0.5";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/combined-stream/-/combined-stream-0.0.5.tgz";
+ name = "combined-stream-0.0.5.tgz";
+ sha1 = "29ed76e5c9aad07c4acf9ca3d32601cce28697a2";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."combined-stream" or []);
+ deps = [
+ self.by-version."delayed-stream"."0.0.5"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "combined-stream" ];
+ };
+ by-spec."cryptiles"."0.2.x" =
+ self.by-version."cryptiles"."0.2.2";
+ by-version."cryptiles"."0.2.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-cryptiles-0.2.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz";
+ name = "cryptiles-0.2.2.tgz";
+ sha1 = "ed91ff1f17ad13d3748288594f8a48a0d26f325c";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."cryptiles" or []);
+ deps = [
+ self.by-version."boom"."0.4.2"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "cryptiles" ];
+ };
+ by-spec."ctype"."0.5.2" =
+ self.by-version."ctype"."0.5.2";
+ by-version."ctype"."0.5.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-ctype-0.5.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz";
+ name = "ctype-0.5.2.tgz";
+ sha1 = "fe8091d468a373a0b0c9ff8bbfb3425c00973a1d";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."ctype" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "ctype" ];
+ };
+ by-spec."delayed-stream"."0.0.5" =
+ self.by-version."delayed-stream"."0.0.5";
+ by-version."delayed-stream"."0.0.5" = lib.makeOverridable self.buildNodePackage {
+ name = "node-delayed-stream-0.0.5";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz";
+ name = "delayed-stream-0.0.5.tgz";
+ sha1 = "d4b1f43a93e8296dfe02694f4680bc37a313c73f";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."delayed-stream" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "delayed-stream" ];
+ };
+ by-spec."forever-agent"."~0.5.0" =
+ self.by-version."forever-agent"."0.5.2";
+ by-version."forever-agent"."0.5.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-forever-agent-0.5.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz";
+ name = "forever-agent-0.5.2.tgz";
+ sha1 = "6d0e09c4921f94a27f63d3b49c5feff1ea4c5130";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."forever-agent" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "forever-agent" ];
+ };
+ by-spec."form-data"."~0.1.0" =
+ self.by-version."form-data"."0.1.4";
+ by-version."form-data"."0.1.4" = lib.makeOverridable self.buildNodePackage {
+ name = "node-form-data-0.1.4";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz";
+ name = "form-data-0.1.4.tgz";
+ sha1 = "91abd788aba9702b1aabfa8bc01031a2ac9e3b12";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."form-data" or []);
+ deps = [
+ self.by-version."combined-stream"."0.0.5"
+ self.by-version."mime"."1.2.11"
+ self.by-version."async"."0.9.0"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "form-data" ];
+ };
+ by-spec."fstream"."~0.1.28" =
+ self.by-version."fstream"."0.1.29";
+ by-version."fstream"."0.1.29" = lib.makeOverridable self.buildNodePackage {
+ name = "node-fstream-0.1.29";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/fstream/-/fstream-0.1.29.tgz";
+ name = "fstream-0.1.29.tgz";
+ sha1 = "34d04023ebc91a9df47bd31ab97e4704b4db413f";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."fstream" or []);
+ deps = [
+ self.by-version."graceful-fs"."3.0.2"
+ self.by-version."inherits"."2.0.1"
+ self.by-version."mkdirp"."0.3.5"
+ self.by-version."rimraf"."2.2.8"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "fstream" ];
+ };
+ by-spec."graceful-fs"."~3.0.2" =
+ self.by-version."graceful-fs"."3.0.2";
+ by-version."graceful-fs"."3.0.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-graceful-fs-3.0.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.2.tgz";
+ name = "graceful-fs-3.0.2.tgz";
+ sha1 = "2cb5bf7f742bea8ad47c754caeee032b7e71a577";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."graceful-fs" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "graceful-fs" ];
+ };
+ by-spec."hawk"."~1.0.0" =
+ self.by-version."hawk"."1.0.0";
+ by-version."hawk"."1.0.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-hawk-1.0.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz";
+ name = "hawk-1.0.0.tgz";
+ sha1 = "b90bb169807285411da7ffcb8dd2598502d3b52d";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."hawk" or []);
+ deps = [
+ self.by-version."hoek"."0.9.1"
+ self.by-version."boom"."0.4.2"
+ self.by-version."cryptiles"."0.2.2"
+ self.by-version."sntp"."0.2.4"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "hawk" ];
+ };
+ by-spec."hoek"."0.9.x" =
+ self.by-version."hoek"."0.9.1";
+ by-version."hoek"."0.9.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-hoek-0.9.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz";
+ name = "hoek-0.9.1.tgz";
+ sha1 = "3d322462badf07716ea7eb85baf88079cddce505";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."hoek" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "hoek" ];
+ };
+ by-spec."http-signature"."~0.10.0" =
+ self.by-version."http-signature"."0.10.0";
+ by-version."http-signature"."0.10.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-http-signature-0.10.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/http-signature/-/http-signature-0.10.0.tgz";
+ name = "http-signature-0.10.0.tgz";
+ sha1 = "1494e4f5000a83c0f11bcc12d6007c530cb99582";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."http-signature" or []);
+ deps = [
+ self.by-version."assert-plus"."0.1.2"
+ self.by-version."asn1"."0.1.11"
+ self.by-version."ctype"."0.5.2"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "http-signature" ];
+ };
+ by-spec."inherits"."2" =
+ self.by-version."inherits"."2.0.1";
+ by-version."inherits"."2.0.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-inherits-2.0.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz";
+ name = "inherits-2.0.1.tgz";
+ sha1 = "b17d08d326b4423e568eff719f91b0b1cbdf69f1";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."inherits" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "inherits" ];
+ };
+ by-spec."inherits"."~2.0.0" =
+ self.by-version."inherits"."2.0.1";
+ by-spec."json-stringify-safe"."~5.0.0" =
+ self.by-version."json-stringify-safe"."5.0.0";
+ by-version."json-stringify-safe"."5.0.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-json-stringify-safe-5.0.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz";
+ name = "json-stringify-safe-5.0.0.tgz";
+ sha1 = "4c1f228b5050837eba9d21f50c2e6e320624566e";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."json-stringify-safe" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "json-stringify-safe" ];
+ };
+ by-spec."mime"."~1.2.11" =
+ self.by-version."mime"."1.2.11";
+ by-version."mime"."1.2.11" = lib.makeOverridable self.buildNodePackage {
+ name = "node-mime-1.2.11";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/mime/-/mime-1.2.11.tgz";
+ name = "mime-1.2.11.tgz";
+ sha1 = "58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."mime" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "mime" ];
+ };
+ by-spec."mime"."~1.2.9" =
+ self.by-version."mime"."1.2.11";
+ by-spec."mkdirp"."0.3" =
+ self.by-version."mkdirp"."0.3.5";
+ by-version."mkdirp"."0.3.5" = lib.makeOverridable self.buildNodePackage {
+ name = "node-mkdirp-0.3.5";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz";
+ name = "mkdirp-0.3.5.tgz";
+ sha1 = "de3e5f8961c88c787ee1368df849ac4413eca8d7";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."mkdirp" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "mkdirp" ];
+ };
+ by-spec."node-uuid"."~1.4.0" =
+ self.by-version."node-uuid"."1.4.1";
+ by-version."node-uuid"."1.4.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-node-uuid-1.4.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/node-uuid/-/node-uuid-1.4.1.tgz";
+ name = "node-uuid-1.4.1.tgz";
+ sha1 = "39aef510e5889a3dca9c895b506c73aae1bac048";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."node-uuid" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "node-uuid" ];
+ };
+ by-spec."oauth-sign"."~0.3.0" =
+ self.by-version."oauth-sign"."0.3.0";
+ by-version."oauth-sign"."0.3.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-oauth-sign-0.3.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz";
+ name = "oauth-sign-0.3.0.tgz";
+ sha1 = "cb540f93bb2b22a7d5941691a288d60e8ea9386e";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."oauth-sign" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "oauth-sign" ];
+ };
+ by-spec."punycode".">=0.2.0" =
+ self.by-version."punycode"."1.3.0";
+ by-version."punycode"."1.3.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-punycode-1.3.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/punycode/-/punycode-1.3.0.tgz";
+ name = "punycode-1.3.0.tgz";
+ sha1 = "7f5009ef539b9444be5c7a19abd2c3ca49e1731c";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."punycode" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "punycode" ];
+ };
+ by-spec."qs"."~0.6.0" =
+ self.by-version."qs"."0.6.6";
+ by-version."qs"."0.6.6" = lib.makeOverridable self.buildNodePackage {
+ name = "node-qs-0.6.6";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/qs/-/qs-0.6.6.tgz";
+ name = "qs-0.6.6.tgz";
+ sha1 = "6e015098ff51968b8a3c819001d5f2c89bc4b107";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."qs" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "qs" ];
+ };
+ by-spec."request"."~2.34.0" =
+ self.by-version."request"."2.34.0";
+ by-version."request"."2.34.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-request-2.34.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/request/-/request-2.34.0.tgz";
+ name = "request-2.34.0.tgz";
+ sha1 = "b5d8b9526add4a2d4629f4d417124573996445ae";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."request" or []);
+ deps = [
+ self.by-version."qs"."0.6.6"
+ self.by-version."json-stringify-safe"."5.0.0"
+ self.by-version."forever-agent"."0.5.2"
+ self.by-version."node-uuid"."1.4.1"
+ self.by-version."mime"."1.2.11"
+ self.by-version."tough-cookie"."0.12.1"
+ self.by-version."form-data"."0.1.4"
+ self.by-version."tunnel-agent"."0.3.0"
+ self.by-version."http-signature"."0.10.0"
+ self.by-version."oauth-sign"."0.3.0"
+ self.by-version."hawk"."1.0.0"
+ self.by-version."aws-sign2"."0.5.0"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "request" ];
+ };
+ "request" = self.by-version."request"."2.34.0";
+ by-spec."rimraf"."2" =
+ self.by-version."rimraf"."2.2.8";
+ by-version."rimraf"."2.2.8" = lib.makeOverridable self.buildNodePackage {
+ name = "rimraf-2.2.8";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz";
+ name = "rimraf-2.2.8.tgz";
+ sha1 = "e439be2aaee327321952730f99a8929e4fc50582";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."rimraf" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "rimraf" ];
+ };
+ by-spec."sntp"."0.2.x" =
+ self.by-version."sntp"."0.2.4";
+ by-version."sntp"."0.2.4" = lib.makeOverridable self.buildNodePackage {
+ name = "node-sntp-0.2.4";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz";
+ name = "sntp-0.2.4.tgz";
+ sha1 = "fb885f18b0f3aad189f824862536bceeec750900";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."sntp" or []);
+ deps = [
+ self.by-version."hoek"."0.9.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "sntp" ];
+ };
+ by-spec."tar"."~0.1.19" =
+ self.by-version."tar"."0.1.20";
+ by-version."tar"."0.1.20" = lib.makeOverridable self.buildNodePackage {
+ name = "node-tar-0.1.20";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/tar/-/tar-0.1.20.tgz";
+ name = "tar-0.1.20.tgz";
+ sha1 = "42940bae5b5f22c74483699126f9f3f27449cb13";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."tar" or []);
+ deps = [
+ self.by-version."block-stream"."0.0.7"
+ self.by-version."fstream"."0.1.29"
+ self.by-version."inherits"."2.0.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "tar" ];
+ };
+ "tar" = self.by-version."tar"."0.1.20";
+ by-spec."tough-cookie".">=0.12.0" =
+ self.by-version."tough-cookie"."0.12.1";
+ by-version."tough-cookie"."0.12.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-tough-cookie-0.12.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/tough-cookie/-/tough-cookie-0.12.1.tgz";
+ name = "tough-cookie-0.12.1.tgz";
+ sha1 = "8220c7e21abd5b13d96804254bd5a81ebf2c7d62";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."tough-cookie" or []);
+ deps = [
+ self.by-version."punycode"."1.3.0"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "tough-cookie" ];
+ };
+ by-spec."tunnel-agent"."~0.3.0" =
+ self.by-version."tunnel-agent"."0.3.0";
+ by-version."tunnel-agent"."0.3.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-tunnel-agent-0.3.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz";
+ name = "tunnel-agent-0.3.0.tgz";
+ sha1 = "ad681b68f5321ad2827c4cfb1b7d5df2cfe942ee";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."tunnel-agent" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "tunnel-agent" ];
+ };
+}
diff --git a/pkgs/applications/editors/zile/default.nix b/pkgs/applications/editors/zile/default.nix
index 87ea7ee6854..32d30cd4745 100644
--- a/pkgs/applications/editors/zile/default.nix
+++ b/pkgs/applications/editors/zile/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
preConfigure = "export gl_cv_func_fstatat_zero_flag=yes";
meta = {
- description = "GNU Zile, a lightweight Emacs clone";
+ description = "Lightweight Emacs clone";
longDescription = ''
GNU Zile, which is a lightweight Emacs clone. Zile is short
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
homepage = http://www.gnu.org/software/zile/;
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
maintainers = [ ];
};
diff --git a/pkgs/applications/graphics/ImageMagick/default.nix b/pkgs/applications/graphics/ImageMagick/default.nix
index c2a661c82fd..64b1f5b3b2c 100644
--- a/pkgs/applications/graphics/ImageMagick/default.nix
+++ b/pkgs/applications/graphics/ImageMagick/default.nix
@@ -1,6 +1,8 @@
{ stdenv
, fetchurl
+, pkgconfig
, bzip2
+, fontconfig
, freetype
, ghostscript ? null
, libjpeg
@@ -16,14 +18,14 @@
}:
let
- version = "6.8.6-9";
+ version = "6.8.9-0";
in
stdenv.mkDerivation rec {
name = "ImageMagick-${version}";
src = fetchurl {
url = "mirror://imagemagick/${name}.tar.xz";
- sha256 = "1bpj8676mph5cvyjsdgf27i6yg2iw9iskk5c69mvpxkyawgjw1vg";
+ sha256 = "1lapn2798fkc2wn81slpms5p21kq4dsyg45khsk7n8p69cvrmw2b";
};
enableParallelBuilding = true;
@@ -33,7 +35,7 @@ stdenv.mkDerivation rec {
export DVIDecodeDelegate=${tetex}/bin/dvips
'' else "";
- configureFlags = "" + stdenv.lib.optionalString (ghostscript != null && stdenv.system != "x86_64-darwin") ''
+ configureFlags = "" + stdenv.lib.optionalString (stdenv.system != "x86_64-darwin") ''
--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts
--with-gslib
'' + ''
@@ -42,17 +44,18 @@ stdenv.mkDerivation rec {
'';
propagatedBuildInputs =
- [ bzip2 freetype libjpeg libpng libtiff libxml2 zlib librsvg
+ [ bzip2 fontconfig freetype libjpeg libpng libtiff libxml2 zlib librsvg
libtool jasper libX11
- ] ++ stdenv.lib.optional (ghostscript != null && stdenv.system != "x86_64-darwin") ghostscript;
+ ] ++ stdenv.lib.optional (stdenv.system != "x86_64-darwin") ghostscript;
- buildInputs = [ tetex ];
+ buildInputs = [ tetex pkgconfig ];
postInstall = ''(cd "$out/include" && ln -s ImageMagick* ImageMagick)'';
- meta = {
+ meta = with stdenv.lib; {
homepage = http://www.imagemagick.org/;
description = "A software suite to create, edit, compose, or convert bitmap images";
- platforms = stdenv.lib.platforms.linux;
+ platforms = platforms.linux ++ [ "x86_64-darwin" ];
+ maintainers = with maintainers; [ the-kenny ];
};
}
diff --git a/pkgs/applications/graphics/alchemy/default.nix b/pkgs/applications/graphics/alchemy/default.nix
index 6a212a7a931..263c411a8db 100644
--- a/pkgs/applications/graphics/alchemy/default.nix
+++ b/pkgs/applications/graphics/alchemy/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
};
installPhase = ''
- ensureDir $out/bin $out/share
+ mkdir -p $out/bin $out/share
cp -a . $out/share/alchemy
cat >> $out/bin/alchemy << EOF
#!/bin/sh
@@ -22,6 +22,14 @@ stdenv.mkDerivation {
meta = {
description = "Drawing application";
+ longDescription = ''
+ Alchemy is an open drawing project aimed at exploring how we can sketch,
+ draw, and create on computers in new ways. Alchemy isn’t software for
+ creating finished artwork, but rather a sketching environment that
+ focuses on the absolute initial stage of the creation process.
+ Experimental in nature, Alchemy lets you brainstorm visually to explore
+ an expanded range of ideas and possibilities in a serendipitous way.
+ '';
homepage = http://al.chemy.org/;
license = stdenv.lib.licenses.gpl3Plus;
maintainers = [stdenv.lib.maintainers.marcweber];
diff --git a/pkgs/applications/graphics/autopanosiftc/default.nix b/pkgs/applications/graphics/autopanosiftc/default.nix
index a27d982ce8b..6d26dafae62 100644
--- a/pkgs/applications/graphics/autopanosiftc/default.nix
+++ b/pkgs/applications/graphics/autopanosiftc/default.nix
@@ -1,11 +1,11 @@
{stdenv, fetchurl, cmake, libpng, libtiff, libjpeg, panotools, libxml2 }:
stdenv.mkDerivation {
- name = "autopano-sift-C-2.5.0";
+ name = "autopano-sift-C-2.5.1";
src = fetchurl {
- url = mirror://sourceforge/hugin/autopano-sift-C-2.5.0.tar.gz;
- sha256 = "0pvkapjg7qdkjg151wjc7islly9ag8fg6bj0g5nbllv981ixjql3";
+ url = mirror://sourceforge/hugin/autopano-sift-C-2.5.1.tar.gz;
+ sha256 = "0dqk8ff82gmy4v5ns5nr9gpzkc1p7c2y8c8fkid102r47wsjk44s";
};
buildInputs = [ cmake libpng libtiff libjpeg panotools libxml2 ];
@@ -13,6 +13,6 @@ stdenv.mkDerivation {
meta = {
homepage = http://hugin.sourceforge.net/;
description = "Implementation in C of the autopano-sift algorithm for automatically stitching panoramas";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/applications/graphics/cinepaint/default.nix b/pkgs/applications/graphics/cinepaint/default.nix
index 8d88e570f27..41a4b102a6f 100644
--- a/pkgs/applications/graphics/cinepaint/default.nix
+++ b/pkgs/applications/graphics/cinepaint/default.nix
@@ -5,11 +5,11 @@
mesa, libXext, libXpm, libXau, libXxf86vm, pixman, libpthreadstubs, fltk } :
stdenv.mkDerivation rec {
- name = "cinepaint-1.0";
+ name = "cinepaint-1.1";
src = fetchurl {
url = "mirror://sourceforge/cinepaint/${name}.tgz";
- sha256 = "02mbpsykd7sfr9h6c6gxld6i3bdwnsgvm70b5yff01gwi69w2wi7";
+ sha256 = "0b5g4bkq62yiz1cnb2vfij0a8fw5w5z202v5dm4dh89k7cj0yq4w";
};
buildInputs = [ libpng gtk freetype fontconfig lcms flex libtiff libjpeg
diff --git a/pkgs/applications/graphics/comical/default.nix b/pkgs/applications/graphics/comical/default.nix
index 68910e67e25..2796a5535a0 100644
--- a/pkgs/applications/graphics/comical/default.nix
+++ b/pkgs/applications/graphics/comical/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Viewer of CBR and CBZ files, often used to store scanned comics";
homepage = http://comical.sourceforge.net/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/graphics/darktable/default.nix b/pkgs/applications/graphics/darktable/default.nix
index 76669626581..c4e2a7534af 100644
--- a/pkgs/applications/graphics/darktable/default.nix
+++ b/pkgs/applications/graphics/darktable/default.nix
@@ -9,12 +9,12 @@
assert stdenv ? glibc;
stdenv.mkDerivation rec {
- version = "1.2.3";
+ version = "1.4.2";
name = "darktable-${version}";
src = fetchurl {
url = "mirror://sourceforge/darktable/darktable/1.2/darktable-${version}.tar.xz";
- sha256 = "05kkkz13a5rhb246rq1nxv7h91pcvm15filvik8n8gn143h64sv8";
+ sha256 = "02875rnabw5m9aqfls59901889iyxkmm4xk445fvh1v06dp1lcf1";
};
buildInputs =
diff --git a/pkgs/applications/graphics/dia/default.nix b/pkgs/applications/graphics/dia/default.nix
index ab421cee158..da683888063 100644
--- a/pkgs/applications/graphics/dia/default.nix
+++ b/pkgs/applications/graphics/dia/default.nix
@@ -1,16 +1,21 @@
-{stdenv, fetchurl_gnome, gtk, pkgconfig, perl, perlXMLParser, libxml2, gettext
+{stdenv, fetchurl, fetchurlGnome, gtk, pkgconfig, perl, perlXMLParser, libxml2, gettext
, python, libxml2Python, docbook5, docbook_xsl, libxslt, intltool, libart_lgpl
, withGNOME ? false, libgnomeui }:
stdenv.mkDerivation rec {
name = src.pkgname;
- src = fetchurl_gnome {
+ src = fetchurlGnome {
project = "dia";
major = "0"; minor = "97"; patchlevel = "2"; extension = "xz";
sha256 = "1qgawm7rrf4wd1yc0fp39ywv8gbz4ry1s16k00dzg5w6p67lfqd7";
};
+ correctPersistence = fetchurl {
+ url = https://launchpadlibrarian.net/132677658/persistence;
+ sha256 = "1rv6zv9i03bna4bdp1wzn72lg7kdwi900y1izdq0imibi54nxjsk";
+ };
+
buildInputs =
[ gtk perlXMLParser libxml2 gettext python libxml2Python docbook5
libxslt docbook_xsl libart_lgpl
@@ -24,7 +29,17 @@ stdenv.mkDerivation rec {
# This file should normally require a gtk-update-icon-cache -q /usr/share/icons/hicolor command
# It have no reasons to exist in a redistribuable package
- postInstall = "rm $out/share/icons/hicolor/icon-theme.cache";
+ postInstall = ''
+ rm $out/share/icons/hicolor/icon-theme.cache
+
+ cd "$out"/bin/
+ mv dia .dia-wrapped
+ echo '#! ${stdenv.shell}' >> dia
+ echo 'test -f "$HOME/.dia/persistence" || cp ${correctPersistence} "$HOME/.dia/persistence" ' >> dia
+ echo 'chmod u+rw "$HOME/.dia/persistence" ' >> dia
+ echo "\"$out/bin/"'.dia-wrapped" "$@"' >> dia
+ chmod a+x dia
+ '';
meta = {
description = "Gnome Diagram drawing software";
diff --git a/pkgs/applications/graphics/digikam/default.nix b/pkgs/applications/graphics/digikam/default.nix
index 713adaffd06..5bc409d10e5 100644
--- a/pkgs/applications/graphics/digikam/default.nix
+++ b/pkgs/applications/graphics/digikam/default.nix
@@ -4,11 +4,11 @@ liblqr1, lensfun, pkgconfig, qjson, libkdcraw, opencv, libkexiv2, libkipi, boost
shared_desktop_ontologies, marble, mysql }:
stdenv.mkDerivation rec {
- name = "digikam-3.2.0";
+ name = "digikam-3.5.0";
src = fetchurl {
url = "http://download.kde.org/stable/digikam/${name}.tar.bz2";
- sha256 = "06j858d2nvbqh0bw6m60rh1bsws06fm5vfjpwwi3zxsf5ka08wmx";
+ sha256 = "0an4awlg0b8pwl6v8p5zfl3aghgnxck2pc322cyk6i6yznj2mgap";
};
nativeBuildInputs = [ cmake automoc4 pkgconfig ];
diff --git a/pkgs/applications/graphics/djview/default.nix b/pkgs/applications/graphics/djview/default.nix
index f832513a824..4ded807cb29 100644
--- a/pkgs/applications/graphics/djview/default.nix
+++ b/pkgs/applications/graphics/djview/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://djvu.sourceforge.net/djview4.html;
description = "A new portable DjVu viewer and browser plugin";
- license = "GPL2";
+ license = stdenv.lib.licenses.gpl2;
inherit (qt4.meta) platforms;
maintainers = [ stdenv.lib.maintainers.urkud ];
};
diff --git a/pkgs/applications/graphics/feh/default.nix b/pkgs/applications/graphics/feh/default.nix
index 0cd34027966..d23f42fdbf9 100644
--- a/pkgs/applications/graphics/feh/default.nix
+++ b/pkgs/applications/graphics/feh/default.nix
@@ -1,20 +1,25 @@
-{ stdenv, fetchurl, x11, imlib2, libjpeg, libpng, giblib
+{ stdenv, makeWrapper, fetchurl, x11, imlib2, libjpeg, libpng
, libXinerama, curl }:
stdenv.mkDerivation rec {
- name = "feh-2.8";
+ name = "feh-2.12";
src = fetchurl {
url = "http://feh.finalrewind.org/${name}.tar.bz2";
- sha256 = "0zmslchnzvi9ydxj2mgci4x8zpv5mdfkf7kyny3nibbpajibqmrx";
+ sha256 = "0ckhidmsms2l5jycp0qf71jzmb3bpbhjq3bcgfpvfvszah7pmq30";
};
- buildInputs = [x11 imlib2 giblib libjpeg libpng libXinerama curl ];
+ buildInputs = [makeWrapper x11 imlib2 libjpeg libpng libXinerama curl];
preBuild = ''
makeFlags="PREFIX=$out"
'';
+ postInstall = ''
+ wrapProgram "$out/bin/feh" --prefix PATH : "${libjpeg}/bin" \
+ --add-flags '--theme=feh'
+ '';
+
meta = {
description = "A light-weight image viewer";
homepage = https://derf.homelinux.org/projects/feh/;
diff --git a/pkgs/applications/graphics/freecad/default.nix b/pkgs/applications/graphics/freecad/default.nix
index 340c9d0a69e..a7665177046 100644
--- a/pkgs/applications/graphics/freecad/default.nix
+++ b/pkgs/applications/graphics/freecad/default.nix
@@ -1,18 +1,20 @@
-{ fetchurl, stdenv, cmake, coin3d, xercesc, ode, eigen, qt4, opencascade, gts,
-boost, zlib,
-python, swig, gfortran, soqt, libf2c, pyqt4, makeWrapper }:
+{ stdenv, fetchurl, cmake, coin3d, xercesc, ode, eigen, qt4, opencascade, gts
+, boost, zlib, python, swig, gfortran, soqt, libf2c, makeWrapper
+, matplotlib, pycollada, pyside, pysideShiboken }:
stdenv.mkDerivation rec {
name = "freecad-${version}";
- version = "0.13.1830";
+ version = "0.14.3702";
src = fetchurl {
url = "mirror://sourceforge/free-cad/${name}.tar.gz";
- sha256 = "04rgww5y32asn4sx5j4wh79ggvb479pq56xfcfj6gkg44mid23jm";
+ sha256 = "1jcx7d3mp2wxkd20qdvr4vlf7h5wb0jgab9dl63sicdz88swy97f";
};
buildInputs = [ cmake coin3d xercesc ode eigen qt4 opencascade gts boost
- zlib python swig gfortran soqt libf2c pyqt4 makeWrapper ];
+ zlib python swig gfortran soqt libf2c makeWrapper matplotlib
+ pycollada pyside pysideShiboken
+ ];
enableParallelBuilding = true;
@@ -28,11 +30,11 @@ stdenv.mkDerivation rec {
patches = [ ./pythonpath.patch ];
- meta = {
- homepage = http://free-cad.sourceforge.net/;
- license = [ "GPLv2+" "LGPLv2+" ];
+ meta = with stdenv.lib; {
description = "General purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler";
- maintainers = with stdenv.lib.maintainers; [viric];
- platforms = with stdenv.lib.platforms; linux;
+ homepage = http://www.freecadweb.org/;
+ license = licenses.lgpl2Plus;
+ maintainers = [ maintainers.viric ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/graphics/gcolor2/default.nix b/pkgs/applications/graphics/gcolor2/default.nix
new file mode 100644
index 00000000000..0af750ec989
--- /dev/null
+++ b/pkgs/applications/graphics/gcolor2/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchurl, gtk, perl, perlXMLParser, pkgconfig } :
+
+let version = "0.4"; in
+stdenv.mkDerivation {
+ name = "gcolor2-${version}";
+ arch = if stdenv.system == "x86_64-linux" then "amd64" else "386";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/project/gcolor2/gcolor2/${version}/gcolor2-${version}.tar.bz2";
+ sha1 = "e410a52dcff3d5c6c3d448b68a026d04ccd744be";
+
+ };
+
+ preConfigure = ''
+ sed -i 's/\[:space:\]/[&]/g' configure
+ '';
+
+ # from https://github.com/PhantomX/slackbuilds/tree/master/gcolor2/patches
+ patches = if stdenv.system == "x86_64-linux" then
+ [ ./gcolor2-amd64.patch ] else
+ [ ];
+
+buildInputs = [ gtk perl perlXMLParser pkgconfig ];
+
+ meta = {
+ description = "Simple GTK+2 color selector";
+ homepage = http://gcolor2.sourceforge.net/;
+ license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = with stdenv.lib.maintainers; [ notthemessiah ];
+ };
+}
diff --git a/pkgs/applications/graphics/gcolor2/gcolor2-amd64.patch b/pkgs/applications/graphics/gcolor2/gcolor2-amd64.patch
new file mode 100644
index 00000000000..cd06a8315f9
--- /dev/null
+++ b/pkgs/applications/graphics/gcolor2/gcolor2-amd64.patch
@@ -0,0 +1,46 @@
+diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN gcolor2-0.4.orig/src/callbacks.c gcolor2-0.4/src/callbacks.c
+--- gcolor2-0.4.orig/src/callbacks.c 2005-07-12 14:06:12.000000000 -0400
++++ gcolor2-0.4/src/callbacks.c 2007-02-17 19:19:38.000000000 -0500
+@@ -4,6 +4,9 @@
+
+ #include
+ #include
++#include
++#include
++#include
+
+ #include "callbacks.h"
+ #include "interface.h"
+@@ -172,6 +175,9 @@ void on_copy_color_to_clipboard_activate
+ gtk_clipboard_set_text (cb, hex, strlen (hex));
+ }
+
++void add_rgb_file (gchar *filename, gchar *type);
++gchar* get_system_file (void);
++
+ void on_show_system_colors_activate (GtkMenuItem *menuitem, gpointer user_data)
+ {
+ if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)))
+@@ -266,6 +272,8 @@ void on_save_button_clicked (GtkButton *
+ gtk_widget_destroy (savedialog);
+ }
+
++void add_list_color (gchar *spec, gchar *name, gchar *type, gboolean is_new_color);
++
+ void add_color_to_treeview ()
+ {
+ GtkTreeView *treeview;
+diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN gcolor2-0.4.orig/src/main.c gcolor2-0.4/src/main.c
+--- gcolor2-0.4.orig/src/main.c 2005-07-11 10:55:49.000000000 -0400
++++ gcolor2-0.4/src/main.c 2007-02-17 19:18:23.000000000 -0500
+@@ -4,6 +4,10 @@
+
+ #include
+ #include
++#include
++#include
++#include
++#include
+
+ #include "interface.h"
+ #include "support.h"
diff --git a/pkgs/applications/graphics/geeqie/default.nix b/pkgs/applications/graphics/geeqie/default.nix
index ff1e5052054..b170b784aaa 100644
--- a/pkgs/applications/graphics/geeqie/default.nix
+++ b/pkgs/applications/graphics/geeqie/default.nix
@@ -35,16 +35,17 @@ stdenv.mkDerivation rec {
description = "Geeqie, a lightweight GTK+ based image viewer";
longDescription =
- '' Geeqie is a lightweight GTK+ based image viewer for Unix like
- operating systems. It features: EXIF, IPTC and XMP metadata
- browsing and editing interoperability; easy integration with other
- software; geeqie works on files and directories, there is no need to
- import images; fast preview for many raw image formats; tools for
- image comparison, sorting and managing photo collection. Geeqie was
- initially based on GQview.
+ ''
+ Geeqie is a lightweight GTK+ based image viewer for Unix like
+ operating systems. It features: EXIF, IPTC and XMP metadata
+ browsing and editing interoperability; easy integration with other
+ software; geeqie works on files and directories, there is no need to
+ import images; fast preview for many raw image formats; tools for
+ image comparison, sorting and managing photo collection. Geeqie was
+ initially based on GQview.
'';
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
homepage = http://geeqie.sourceforge.net;
diff --git a/pkgs/applications/graphics/gimp/2.8.nix b/pkgs/applications/graphics/gimp/2.8.nix
index 4e12e232081..aca4d822c82 100644
--- a/pkgs/applications/graphics/gimp/2.8.nix
+++ b/pkgs/applications/graphics/gimp/2.8.nix
@@ -1,14 +1,14 @@
{ stdenv, fetchurl, pkgconfig, intltool, babl, gegl, gtk, glib, gdk_pixbuf
, pango, cairo, freetype, fontconfig, lcms, libpng, libjpeg, poppler, libtiff
, webkit, libmng, librsvg, libwmf, zlib, libzip, ghostscript, aalib, jasper
-, python, pygtk, libart_lgpl, libexif, gettext, xlibs }:
+, python, pygtk, libart_lgpl, libexif, gettext, xlibs, wrapPython }:
stdenv.mkDerivation rec {
- name = "gimp-2.8.6";
+ name = "gimp-2.8.10";
src = fetchurl {
- url = "ftp://ftp.gimp.org/pub/gimp/v2.8/${name}.tar.bz2";
- md5 = "12b3fdf33d1f07ae79b412a9e38b9693";
+ url = "http://download.gimp.org/pub/gimp/v2.8/${name}.tar.bz2";
+ sha256 = "1rha8yx0pplfjziqczjrxxp16vsvpmb5ziq3c218s4w9z4cqpzg7";
};
buildInputs =
@@ -16,8 +16,13 @@ stdenv.mkDerivation rec {
freetype fontconfig lcms libpng libjpeg poppler libtiff webkit
libmng librsvg libwmf zlib libzip ghostscript aalib jasper
python pygtk libart_lgpl libexif gettext xlibs.libXpm
+ wrapPython
];
+ pythonPath = [ pygtk ];
+
+ postInstall = ''wrapPythonPrograms'';
+
passthru = { inherit gtk; }; # probably its a good idea to use the same gtk in plugins ?
#configureFlags = [ "--disable-print" ];
@@ -29,5 +34,6 @@ stdenv.mkDerivation rec {
description = "The GNU Image Manipulation Program";
homepage = http://www.gimp.org/;
license = "GPL";
+ platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/graphics/gimp/default.nix b/pkgs/applications/graphics/gimp/default.nix
deleted file mode 100644
index 33d52c6645b..00000000000
--- a/pkgs/applications/graphics/gimp/default.nix
+++ /dev/null
@@ -1,32 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, gtk, freetype
-, fontconfig, libart_lgpl, libtiff, libjpeg, libpng, libexif, zlib, perl
-, perlXMLParser, python, pygtk, gettext, xlibs, intltool, babl_0_0_22, gegl_0_0_22
-}:
-
-stdenv.mkDerivation rec {
- name = "gimp-2.6.12";
-
- src = fetchurl {
- url = "ftp://ftp.gtk.org/pub/gimp/v2.6/${name}.tar.bz2";
- sha256 = "0qpcgaa4pdqqhyyy8vjvzfflxgsrrs25zk79gixzlnbzq3qwjlym";
- };
-
- buildInputs = [
- pkgconfig gtk freetype fontconfig
- libart_lgpl libtiff libjpeg libpng libexif zlib perl
- perlXMLParser python pygtk gettext intltool babl_0_0_22 gegl_0_0_22
- ];
-
- passthru = { inherit gtk; }; # probably its a good idea to use the same gtk in plugins ?
-
- configureFlags = [ "--disable-print" ];
-
- # "screenshot" needs this.
- NIX_LDFLAGS = "-rpath ${xlibs.libX11}/lib";
-
- meta = {
- description = "The GNU Image Manipulation Program";
- homepage = http://www.gimp.org/;
- license = "GPL";
- };
-}
diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix
index d314d93ea4c..7139bc71f3c 100644
--- a/pkgs/applications/graphics/gimp/plugins/default.nix
+++ b/pkgs/applications/graphics/gimp/plugins/default.nix
@@ -68,18 +68,33 @@ rec {
};
};
- fourier = pluginDerivation {
+ fourier = pluginDerivation rec {
/* menu:
Filters/Generic/FFT Forward
Filters/Generic/FFT Inverse
*/
- name = "fourier-0.3.3";
- buildInputs = [ gimp pkgs.fftwSinglePrec pkgconfig glib] ++ gimp.nativeBuildInputs;
+ name = "fourier-0.4.1";
+ buildInputs = [ gimp pkgs.fftw pkgconfig glib] ++ gimp.nativeBuildInputs;
postInstall = "fail";
installPhase = "installPlugins fourier";
src = fetchurl {
- url = http://people.via.ecp.fr/~remi/soft/gimp/fourier-0.3.3.tar.gz;
- sha256 = "0xxgp0lrjxsj54sgygi31c7q41jkqzn0v18qyznrviv8r099v29p";
+ url = "http://registry.gimp.org/files/${name}.tar.gz";
+ sha256 = "1pr3y3zl9w8xs1circdrxpr98myz9m8wfzy022al79z4pdanwvs1";
+ };
+ };
+
+ focusblur = pluginDerivation rec {
+ /* menu:
+ Blur/Focus Blur
+ */
+ name = "focusblur-3.2.6";
+ buildInputs = [ gimp pkgconfig pkgs.fftwSinglePrec ] ++ gimp.nativeBuildInputs;
+ patches = [ ./patches/focusblur-glib.patch ];
+ postInstall = "fail";
+ installPhase = "installPlugins src/focusblur";
+ src = fetchurl {
+ url = "http://registry.gimp.org/files/${name}.tar.bz2";
+ sha256 = "1gqf3hchz7n7v5kpqkhqh8kwnxbsvlb5cr2w2n7ngrvl56f5xs1h";
};
};
@@ -110,6 +125,9 @@ rec {
url = mirror://sourceforge/gimp-texturize/texturize-2.1_src.tgz;
sha256 = "0cdjq25g3yfxx6bzx6nid21kq659s1vl9id4wxyjs2dhcv229cg3";
};
+ patchPhase = ''
+ sed -i '/.*gimpimage_pdb.h.*/ d' src/*.c*
+ '';
installPhase = "installPlugins src/texturize";
};
@@ -140,21 +158,22 @@ rec {
installPhase = "installPlugins src/gimp-lqr-plugin";
};
- # this is more than a gimp plugin !
- # it can be made to compile the gimp plugin only though..
gmic =
- let imagemagick = pkgs.imagemagickBig; # maybe the non big version is enough?
- in pluginDerivation {
- name = "gmic-1.3.2.0";
- buildInputs = [ imagemagick pkgconfig gimp pkgs.fftwSinglePrec ] ++ gimp.nativeBuildInputs;
+ let
+ imagemagick = pkgs.imagemagickBig; # maybe the non big version is enough?
+ in pluginDerivation rec {
+ name = "gmic-1.5.7.2";
+ buildInputs = [imagemagick pkgconfig pkgs.fftw gimp] ++ gimp.nativeBuildInputs;
src = fetchurl {
- url = mirror://sourceforge/gmic/gmic_1.3.2.0.tar.gz;
- sha256 = "0mxq664vzzc2l6k6sqm9syp34mihhi262i6fixk1g12lmc28797h";
+ url = mirror://sourceforge/gmic/gmic_1.5.7.2.tar.gz;
+ sha256 = "1cpbxb3p2c8bcv2cbr150whapzjc7w09i3jza0z9x3xj8c0vdyv1";
};
preConfigure = ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${imagemagick}/include/ImageMagick"
'';
- installPhase = "installPlugins src/gmic4gimp";
+ sourceRoot = "${name}/src";
+ buildPhase = "make gimp";
+ installPhase = "installPlugins gmic_gimp";
meta = {
description = "script language for image processing which comes with its open-source interpreter";
homepage = http://gmic.sourceforge.net/repository.shtml;
@@ -170,9 +189,9 @@ rec {
# this is more than a gimp plugin !
# either load the raw image with gimp (and the import dialog will popup)
# or use the binary
- ufraw = pluginDerivation {
- name = "ufraw-0.15";
- buildInputs = [pkgs.lcms gimp] ++ gimp.nativeBuildInputs;
+ ufraw = pluginDerivation rec {
+ name = "ufraw-0.19.2";
+ buildInputs = [pkgs.gtkimageview pkgs.lcms gimp] ++ gimp.nativeBuildInputs;
# --enable-mime - install mime files, see README for more information
# --enable-extras - build extra (dcraw, nikon-curve) executables
# --enable-dst-correction - enable DST correction for file timestamps.
@@ -184,8 +203,8 @@ rec {
configureFlags = "--enable-extras --enable-dst-correction --enable-contrast";
src = fetchurl {
- url = mirror://sourceforge/ufraw/ufraw-0.15.tar.gz;
- sha256 = "0cf3csksjkyl91zxhjnn74vc31l14nm6n1i02s76xdvvkk9ics8k";
+ url = "mirror://sourceforge/ufraw/${name}.tar.gz";
+ sha256 = "1lxba7pb3vcsq94dwapg9bk9mb3ww6r3pvvcyb0ah5gh2sgzxgkk";
};
installPhase = "
installPlugins ufraw-gimp
@@ -217,7 +236,7 @@ rec {
homepage = http://lensfun.sebastiankraft.net/;
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.gnu;
};
diff --git a/pkgs/applications/graphics/gimp/plugins/patches/focusblur-glib.patch b/pkgs/applications/graphics/gimp/plugins/patches/focusblur-glib.patch
new file mode 100644
index 00000000000..b1079ab3660
--- /dev/null
+++ b/pkgs/applications/graphics/gimp/plugins/patches/focusblur-glib.patch
@@ -0,0 +1,200 @@
+ls diff --git focusblur-3.2.6/src/aaa.h focusblur-3.2.6/src/aaa.h
+index 4a6d90b..c74cab2 100644
+--- focusblur-3.2.6/src/aaa.h
++++ focusblur-3.2.6/src/aaa.h
+@@ -19,8 +19,7 @@
+ #ifndef __AAA_H__
+ #define __AAA_H__
+
+-#include
+-#include
++#include
+
+
+ G_BEGIN_DECLS
+diff --git focusblur-3.2.6/src/brush.h focusblur-3.2.6/src/brush.h
+index 685b253..8778fec 100644
+--- focusblur-3.2.6/src/brush.h
++++ focusblur-3.2.6/src/brush.h
+@@ -22,7 +22,7 @@
+ #ifndef __FOCUSBLUR_BRUSH_H__
+ #define __FOCUSBLUR_BRUSH_H__
+
+-#include
++#include
+ #include "focusblurtypes.h"
+
+ G_BEGIN_DECLS
+diff --git focusblur-3.2.6/src/depthmap.h focusblur-3.2.6/src/depthmap.h
+index 78f5e99..baee540 100644
+--- focusblur-3.2.6/src/depthmap.h
++++ focusblur-3.2.6/src/depthmap.h
+@@ -22,7 +22,7 @@
+ #ifndef __FOCUSBLUR_DEPTHMAP_H__
+ #define __FOCUSBLUR_DEPTHMAP_H__
+
+-#include
++#include
+
+ #include "focusblurtypes.h"
+ #include "focusblurenums.h"
+diff --git focusblur-3.2.6/src/diffusion.h focusblur-3.2.6/src/diffusion.h
+index 07ffe4b..3c1e4b9 100644
+--- focusblur-3.2.6/src/diffusion.h
++++ focusblur-3.2.6/src/diffusion.h
+@@ -23,7 +23,7 @@
+ #define __FOCUSBLUR_DIFFUSION_H__
+
+
+-#include
++#include
+
+ #include "focusblur.h"
+ #include "focusblurtypes.h"
+diff --git focusblur-3.2.6/src/fftblur.h focusblur-3.2.6/src/fftblur.h
+index 124bcba..cd809fa 100644
+--- focusblur-3.2.6/src/fftblur.h
++++ focusblur-3.2.6/src/fftblur.h
+@@ -23,8 +23,7 @@
+ #define __FOCUSBLUR_FFTBLUR_H__
+
+
+-#include
+-#include
++#include
+ #include
+
+ #include "focusblurparam.h"
+diff --git focusblur-3.2.6/src/fftblurbuffer.h focusblur-3.2.6/src/fftblurbuffer.h
+index b34d682..42e6380 100644
+--- focusblur-3.2.6/src/fftblurbuffer.h
++++ focusblur-3.2.6/src/fftblurbuffer.h
+@@ -28,8 +28,7 @@
+ #endif
+ #include
+
+-#include
+-#include
++#include
+ #include
+ #include
+ #include
+diff --git focusblur-3.2.6/src/fftblurproc.h focusblur-3.2.6/src/fftblurproc.h
+index 495572d..10a34f4 100644
+--- focusblur-3.2.6/src/fftblurproc.h
++++ focusblur-3.2.6/src/fftblurproc.h
+@@ -23,8 +23,7 @@
+ #define __FOCUSBLUR_FFTBLUR_PROC_H__
+
+
+-#include
+-#include
++#include
+
+ #include "focusblurtypes.h"
+
+diff --git focusblur-3.2.6/src/focusblur.h focusblur-3.2.6/src/focusblur.h
+index 54ca40a..d7e13a6 100644
+--- focusblur-3.2.6/src/focusblur.h
++++ focusblur-3.2.6/src/focusblur.h
+@@ -22,7 +22,7 @@
+ #ifndef __FOCUSBLUR_H__
+ #define __FOCUSBLUR_H__
+
+-#include
++#include
+
+ G_BEGIN_DECLS
+
+diff --git focusblur-3.2.6/src/focusblurparam.h focusblur-3.2.6/src/focusblurparam.h
+index 64c887b..32865b4 100644
+--- focusblur-3.2.6/src/focusblurparam.h
++++ focusblur-3.2.6/src/focusblurparam.h
+@@ -22,8 +22,7 @@
+ #ifndef __FOCUSBLUR_PARAM_H__
+ #define __FOCUSBLUR_PARAM_H__
+
+-#include
+-#include
++#include
+ #include
+ #include
+
+diff --git focusblur-3.2.6/src/focusblurstock.h focusblur-3.2.6/src/focusblurstock.h
+index 15f3603..cfc0567 100644
+--- focusblur-3.2.6/src/focusblurstock.h
++++ focusblur-3.2.6/src/focusblurstock.h
+@@ -22,7 +22,7 @@
+ #ifndef __FOCUSBLUR_STOCK_H__
+ #define __FOCUSBLUR_STOCK_H__
+
+-#include
++#include
+
+ G_BEGIN_DECLS
+
+diff --git focusblur-3.2.6/src/focusblurtypes.h focusblur-3.2.6/src/focusblurtypes.h
+index 0954c60..1531c84 100644
+--- focusblur-3.2.6/src/focusblurtypes.h
++++ focusblur-3.2.6/src/focusblurtypes.h
+@@ -22,7 +22,7 @@
+ #ifndef __FOCUSBLUR_TYPES_H__
+ #define __FOCUSBLUR_TYPES_H__
+
+-#include
++#include
+
+
+ G_BEGIN_DECLS
+diff --git focusblur-3.2.6/src/interface.h focusblur-3.2.6/src/interface.h
+index 6defd27..e819c60 100644
+--- focusblur-3.2.6/src/interface.h
++++ focusblur-3.2.6/src/interface.h
+@@ -22,7 +22,7 @@
+ #ifndef __FOCUSBLUR_INTERFACE_H__
+ #define __FOCUSBLUR_INTERFACE_H__
+
+-#include
++#include
+
+ #include "focusblurtypes.h"
+
+diff --git focusblur-3.2.6/src/render.h focusblur-3.2.6/src/render.h
+index febbd24..a501f1e 100644
+--- focusblur-3.2.6/src/render.h
++++ focusblur-3.2.6/src/render.h
+@@ -24,7 +24,7 @@
+
+ #include "config.h"
+
+-#include
++#include
+ //#include
+ #include
+
+diff --git focusblur-3.2.6/src/shine.h focusblur-3.2.6/src/shine.h
+index c5a3621..86b4c09 100644
+--- focusblur-3.2.6/src/shine.h
++++ focusblur-3.2.6/src/shine.h
+@@ -22,7 +22,7 @@
+ #ifndef __FOCUSBLUR_SHINE_H__
+ #define __FOCUSBLUR_SHINE_H__
+
+-#include
++#include
+ #include
+
+ #include "focusblurtypes.h"
+diff --git focusblur-3.2.6/src/source.h focusblur-3.2.6/src/source.h
+index 50d34ca..8eec35c 100644
+--- focusblur-3.2.6/src/source.h
++++ focusblur-3.2.6/src/source.h
+@@ -24,7 +24,7 @@
+
+ #include "config.h"
+
+-#include
++#include
+ #include
+
+ #include "focusblurtypes.h"
diff --git a/pkgs/applications/graphics/giv/default.nix b/pkgs/applications/graphics/giv/default.nix
index 8b2c45398d9..2e9d55a3f3f 100644
--- a/pkgs/applications/graphics/giv/default.nix
+++ b/pkgs/applications/graphics/giv/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Cross platform image and hierarchical vector viewer based";
homepage = http://giv.sourceforge.net/giv/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/graphics/gocr/default.nix b/pkgs/applications/graphics/gocr/default.nix
index 0f42ac7743e..919b9fcc4c3 100644
--- a/pkgs/applications/graphics/gocr/default.nix
+++ b/pkgs/applications/graphics/gocr/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, tk }:
stdenv.mkDerivation rec {
- name = "gocr-0.49";
+ name = "gocr-0.50";
src = fetchurl {
- url = http://www-e.uni-magdeburg.de/jschulen/ocr/gocr-0.49.tar.gz;
- sha256 = "06hpzp7rkkwfr1fvmc8kcfz9v490i9yir7f7imh13gmka0fr6afc";
+ url = "http://www-e.uni-magdeburg.de/jschulen/ocr/${name}.tar.gz";
+ sha256 = "1dgmcpapy7h68d53q2c5d0bpgzgfb2nw2blndnx9qhc7z12149mw";
};
postInstall = ''
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = "http://jocr.sourceforge.net/";
description = "GPL Optical Character Recognition";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
platforms = stdenv.lib.platforms.linux;
maintainers = [ stdenv.lib.maintainers.simons ];
diff --git a/pkgs/applications/graphics/grafx2/default.nix b/pkgs/applications/graphics/grafx2/default.nix
new file mode 100644
index 00000000000..6b7c9a27694
--- /dev/null
+++ b/pkgs/applications/graphics/grafx2/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, SDL, SDL_image, SDL_ttf, zlib, libpng, pkgconfig, lua5 }:
+
+stdenv.mkDerivation rec {
+
+ version = "2.4.2035";
+ name = "grafx2-${version}";
+
+ src = fetchurl {
+ url = "https://grafx2.googlecode.com/files/${name}-src.tgz";
+ sha256 = "0svsy6rqmdj11b400c242i2ixihyz0hds0dgicqz6g6dcgmcl62q";
+ };
+
+ buildInputs = [ SDL SDL_image SDL_ttf libpng zlib lua5 pkgconfig ];
+
+ preBuild = "cd src";
+
+ preInstall = '' mkdir -p "$out" '';
+
+ installPhase = ''make install prefix="$out"'';
+
+ meta = {
+ description = "GrafX2 is a bitmap paint program inspired by the Amiga programs Deluxe Paint and Brilliance.";
+ homepage = http://code.google.co/p/grafx2/;
+ license = stdenv.lib.licenses.gpl2;
+ platforms = [ "x86_64-linux" "i686-linux" ];
+ maintainers = [ stdenv.lib.maintainers.zoomulator ];
+ };
+}
diff --git a/pkgs/applications/graphics/graphicsmagick/1.3.7.nix b/pkgs/applications/graphics/graphicsmagick/1.3.7.nix
index 291d61d5f6f..8b780647dfa 100644
--- a/pkgs/applications/graphics/graphicsmagick/1.3.7.nix
+++ b/pkgs/applications/graphics/graphicsmagick/1.3.7.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
configureFlags = "--enable-shared";
buildInputs =
- [ bzip2 freetype ghostscript graphviz libjpeg libpng libtiff libX11 libxml2
+ [ libpng bzip2 freetype ghostscript graphviz libjpeg libtiff libX11 libxml2
zlib libtool
];
diff --git a/pkgs/applications/graphics/graphicsmagick/default.nix b/pkgs/applications/graphics/graphicsmagick/default.nix
index c02bc6024df..536249e70a6 100644
--- a/pkgs/applications/graphics/graphicsmagick/default.nix
+++ b/pkgs/applications/graphics/graphicsmagick/default.nix
@@ -1,18 +1,18 @@
{stdenv, fetchurl, bzip2, freetype, graphviz, ghostscript
, libjpeg, libpng, libtiff, libxml2, zlib, libtool, xz
-, libX11}:
+, libX11, quantumdepth ? 8}:
-let version = "1.3.13"; in
+let version = "1.3.18"; in
stdenv.mkDerivation {
name = "graphicsmagick-${version}";
src = fetchurl {
url = "mirror://sourceforge/graphicsmagick/GraphicsMagick-${version}.tar.xz";
- sha256 = "08lgjvhvhw3by5h4kfpl7072dbvkcpsajy5f6izq69cv61vadqs5";
+ sha256 = "1axh4j2jr3l92dan15b2nmx9da4l7i0rcz9b5bvfd4q742zfwj7x";
};
- configureFlags = "--enable-shared";
+ configureFlags = "--enable-shared --with-quantum-depth=" + toString quantumdepth;
buildInputs =
[ bzip2 freetype ghostscript graphviz libjpeg libpng libtiff libX11 libxml2
diff --git a/pkgs/applications/graphics/hoodle/default.nix b/pkgs/applications/graphics/hoodle/default.nix
new file mode 100644
index 00000000000..afa3a8ca0c7
--- /dev/null
+++ b/pkgs/applications/graphics/hoodle/default.nix
@@ -0,0 +1,22 @@
+# This file was auto-generated by cabal2nix. Please do NOT edit manually!
+
+{ cabal, cmdargs, configurator, dyre, filepath, hoodleCore, mtl }:
+
+cabal.mkDerivation (self: {
+ pname = "hoodle";
+ version = "0.3";
+ sha256 = "01wz7bwdr3i43ikaiaq8vpn6b0clxjnjyaw6nl6zaq489dhj6fv5";
+ isLibrary = true;
+ isExecutable = true;
+ buildDepends = [
+ cmdargs configurator dyre filepath hoodleCore mtl
+ ];
+ meta = {
+ homepage = "http://ianwookim.org/hoodle";
+ description = "Executable for hoodle";
+ license = self.stdenv.lib.licenses.gpl3;
+ platforms = self.ghc.meta.platforms;
+ hydraPlatforms = self.stdenv.lib.platforms.none;
+ maintainers = with self.stdenv.lib.maintainers; [ ianwookim ];
+ };
+})
diff --git a/pkgs/applications/graphics/hugin/default.nix b/pkgs/applications/graphics/hugin/default.nix
index a9ff7ef25c3..88912cbda55 100644
--- a/pkgs/applications/graphics/hugin/default.nix
+++ b/pkgs/applications/graphics/hugin/default.nix
@@ -1,25 +1,37 @@
-{stdenv, fetchurl, panotools, cmake, wxGTK, libtiff, libpng, openexr, boost
-, pkgconfig, exiv2, gettext, ilmbase, enblendenfuse, autopanosiftc, mesa
-, freeglut, glew, libXmu, libXi, tclap }:
+{ stdenv, cmake, fetchurl, gnumake, pkgconfig
+, boost, gettext, tclap, wxGTK
+, freeglut, glew, libXi, libXmu, mesa
+, autopanosiftc, enblendenfuse, exiv2, ilmbase, lensfun, libpng, libtiff
+, openexr, panotools, perlPackages
+}:
stdenv.mkDerivation rec {
- name = "hugin-2011.4.0";
+ name = "hugin-2013.0.0";
src = fetchurl {
url = "mirror://sourceforge/hugin/${name}.tar.bz2";
- sha256 = "1bnxljgqxzfdz14l7y29wzi52x1a38mghsjavnr28fr4vfmqwjrf";
+ sha256 = "1mgbvg09xvf0zcm9jfv5lb65nd292l86ffa23yp4pzm6izaiwkj8";
};
NIX_CFLAGS_COMPILE = "-I${ilmbase}/include/OpenEXR";
-#NIX_LDFLAGS = "-lrt";
+ buildInputs = [ boost gettext tclap wxGTK
+ freeglut glew libXi libXmu mesa
+ exiv2 ilmbase lensfun libtiff libpng openexr panotools
+ ];
- buildInputs = [ panotools wxGTK libtiff libpng openexr boost tclap
- exiv2 gettext ilmbase mesa freeglut glew libXmu libXi ];
+ # disable installation of the python scripting interface
+ cmakeFlags = [ "-DBUILD_HSI:BOOl=OFF" ];
nativeBuildInputs = [ cmake pkgconfig ];
- propagatedUserEnvPackages = [ enblendenfuse autopanosiftc ];
+ enableParallelBuilding = true;
+
+ # commandline tools needed by the hugin batch processor
+ # you may have to tell hugin (in the preferences) where these binaries reside
+ propagatedUserEnvPackages = [ autopanosiftc enblendenfuse gnumake
+ perlPackages.ImageExifTool
+ ];
postInstall = ''
mkdir -p "$out/nix-support"
@@ -29,7 +41,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://hugin.sourceforge.net/;
description = "Toolkit for stitching photographs and assembling panoramas, together with an easy to use graphical front end";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/graphics/inkscape/default.nix b/pkgs/applications/graphics/inkscape/default.nix
index 37905f8a73f..38ceefa4523 100644
--- a/pkgs/applications/graphics/inkscape/default.nix
+++ b/pkgs/applications/graphics/inkscape/default.nix
@@ -4,15 +4,18 @@
, gsl, python, pyxml, lxml, poppler, imagemagick, libwpg }:
stdenv.mkDerivation rec {
- name = "inkscape-0.48.4";
+ name = "inkscape-0.48.5";
src = fetchurl {
url = "mirror://sourceforge/inkscape/${name}.tar.bz2";
- sha256 = "17aiibgdwjqpjc38f0yr2sdlgwngg5ac9srlybjcx9aspf6ashc7";
+ sha256 = "0sfr7a1vr1066rrkkqbqvcqs3gawalj68ralnhd6k87jz62fcv1b";
};
patches = [ ./configure-python-libs.patch ];
+ postPatch = stdenv.lib.optionalString doCheck
+ ''sed -i 's:#include "../../src:#include "src:' src/cxxtests.cpp'';
+
propagatedBuildInputs = [
# Python is used at run-time to execute scripts, e.g., those from
# the "Effects" menu.
@@ -27,12 +30,17 @@ stdenv.mkDerivation rec {
configureFlags = "--with-python";
+ enableParallelBuilding = true;
+ doCheck = true;
+ checkFlags = "-j1";
+
postInstall = ''
# Make sure PyXML modules can be found at run-time.
for i in "$out/bin/"*
do
wrapProgram "$i" --prefix PYTHONPATH : \
- "$(toPythonPath ${pyxml}):$(toPythonPath ${lxml})" || \
+ "$(toPythonPath ${pyxml}):$(toPythonPath ${lxml})" \
+ --prefix PATH : ${python}/bin || \
exit 2
done
rm $out/share/icons/hicolor/icon-theme.cache
@@ -40,9 +48,11 @@ stdenv.mkDerivation rec {
NIX_LDFLAGS = "-lX11";
- meta = {
+ meta = with stdenv.lib; {
license = "GPL";
homepage = http://www.inkscape.org;
+ description = "Vector graphics editor";
+ platforms = platforms.all;
longDescription = ''
Inkscape is a feature-rich vector graphics editor that edits
files in the W3C SVG (Scalable Vector Graphics) file format.
diff --git a/pkgs/applications/graphics/inkscape/libpng-1.5.patch b/pkgs/applications/graphics/inkscape/libpng-1.5.patch
deleted file mode 100644
index 4c8a7ee5f9b..00000000000
--- a/pkgs/applications/graphics/inkscape/libpng-1.5.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-Source: upstream revisions 10061 and 10707
-
---- a/src/sp-image.cpp 2011-02-21 07:59:34 +0000
-+++ b/src/sp-image.cpp 2011-02-21 08:57:28 +0000
-@@ -387,9 +387,13 @@
-
- #if defined(PNG_iCCP_SUPPORTED)
- {
-- char* name = 0;
-+ png_charp name = 0;
- int compression_type = 0;
-- char* profile = 0;
-+#if (PNG_LIBPNG_VER < 10500)
-+ png_charp profile = 0;
-+#else
-+ png_bytep profile = 0;
-+#endif
- png_uint_32 proflen = 0;
- if ( png_get_iCCP(pngPtr, infoPtr, &name, &compression_type, &profile, &proflen) ) {
- // g_message("Found an iCCP chunk named [%s] with %d bytes and comp %d", name, proflen, compression_type);
-
---- a/src/extension/internal/pdfinput/svg-builder.cpp 2011-10-27 04:55:51 +0000
-+++ b/src/extension/internal/pdfinput/svg-builder.cpp 2011-10-29 20:34:00 +0000
-@@ -1481,7 +1481,7 @@
- return NULL;
- }
- // Set error handler
-- if (setjmp(png_ptr->jmpbuf)) {
-+ if (setjmp(png_jmpbuf(png_ptr))) {
- png_destroy_write_struct(&png_ptr, &info_ptr);
- return NULL;
- }
-
---- a/src/helper/png-write.cpp 2011-08-07 10:53:12 +0000
-+++ b/src/helper/png-write.cpp 2011-10-29 20:34:00 +0000
-@@ -166,8 +166,8 @@
- /* Set error handling. REQUIRED if you aren't supplying your own
- * error hadnling functions in the png_create_write_struct() call.
- */
-- if (setjmp(png_ptr->jmpbuf)) {
-- /* If we get here, we had a problem reading the file */
-+ if (setjmp(png_jmpbuf(png_ptr))) {
-+ // If we get here, we had a problem reading the file
- fclose(fp);
- png_destroy_write_struct(&png_ptr, &info_ptr);
- return false;
-
diff --git a/pkgs/applications/graphics/ipe/default.nix b/pkgs/applications/graphics/ipe/default.nix
index df50dd5bd79..53df14f8704 100644
--- a/pkgs/applications/graphics/ipe/default.nix
+++ b/pkgs/applications/graphics/ipe/default.nix
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
meta = {
description = "An editor for drawing figures";
homepage = http://ipe7.sourceforge.net;
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
longDescription = ''
Ipe is an extensible drawing editor for creating figures in PDF and Postscript format.
It supports making small figures for inclusion into LaTeX-documents
diff --git a/pkgs/applications/graphics/k3d/debian-patches.nix b/pkgs/applications/graphics/k3d/debian-patches.nix
index fe1289f1441..cf6b47ee959 100644
--- a/pkgs/applications/graphics/k3d/debian-patches.nix
+++ b/pkgs/applications/graphics/k3d/debian-patches.nix
@@ -1,6 +1,6 @@
# Generated by debian-patches.sh from debian-patches.txt
let
- prefix = "http://patch-tracker.debian.org/patch/series/dl/k3d/0.8.0.2-15";
+ prefix = "http://patch-tracker.debian.org/patch/series/dl/k3d/0.8.0.2-18";
in
[
{
@@ -9,6 +9,6 @@ in
}
{
url = "${prefix}/k3d_gtkmm224.patch";
- sha256 = "0a81fg96zby6kidqwj6n8mhbrh0j5fpnmfh7lr6havz5r2is9ks5";
+ sha256 = "1c7z2zkqs9qw185q7bhz6vvzl6vlf1zpg9vlhc1f0cz9rgak3gji";
}
]
diff --git a/pkgs/applications/graphics/k3d/default.nix b/pkgs/applications/graphics/k3d/default.nix
index 8920d243dbf..9f31d94ac7f 100644
--- a/pkgs/applications/graphics/k3d/default.nix
+++ b/pkgs/applications/graphics/k3d/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
preConfigure = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/build/lib"
- export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$(echo ${gtkglext}/include/gtkglext-*) -I$(echo ${gtkglext}/lib/gtkglext-*/include)"
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -fpermissive -I$(echo ${gtkglext}/include/gtkglext-*) -I$(echo ${gtkglext}/lib/gtkglext-*/include)"
'';
buildInputs = [
diff --git a/pkgs/applications/graphics/kipi-plugins/default.nix b/pkgs/applications/graphics/kipi-plugins/default.nix
index 61a8380b1c5..6a38698370d 100644
--- a/pkgs/applications/graphics/kipi-plugins/default.nix
+++ b/pkgs/applications/graphics/kipi-plugins/default.nix
@@ -25,5 +25,6 @@ stdenv.mkDerivation rec {
homepage = http://www.kipi-plugins.org;
inherit (kdelibs.meta) platforms;
maintainers = with stdenv.lib.maintainers; [ viric urkud ];
+ broken = true; # it should be build from digikam sources, perhaps together
};
}
diff --git a/pkgs/applications/graphics/luminance-hdr/default.nix b/pkgs/applications/graphics/luminance-hdr/default.nix
new file mode 100644
index 00000000000..7558b0aef4b
--- /dev/null
+++ b/pkgs/applications/graphics/luminance-hdr/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, cmake, fetchurl, pkgconfig, qt5, boost, exiv2, fftwFloat, gsl
+, ilmbase, lcms2, libraw, libtiff, openexr
+}:
+
+stdenv.mkDerivation rec {
+ name = "luminance-hdr-2.4.0";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/qtpfsgui/${name}.tar.bz2";
+ sha256 = "00fldbcizrx8jcnjgq74n3zmbm27dxzl96fxa7q49689mfnlw08l";
+ };
+
+ NIX_CFLAGS_COMPILE = "-I${ilmbase}/include/OpenEXR";
+
+ buildInputs = [ qt5 boost exiv2 fftwFloat gsl ilmbase lcms2 libraw libtiff openexr ];
+
+ nativeBuildInputs = [ cmake pkgconfig ];
+
+ meta = with stdenv.lib; {
+ homepage = http://qtpfsgui.sourceforge.net/;
+ description = "A complete open source solution for HDR photography";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.hrdinka ];
+ };
+}
diff --git a/pkgs/applications/graphics/mcomix/default.nix b/pkgs/applications/graphics/mcomix/default.nix
index 7629c57a2b8..cc1fe8c3a22 100644
--- a/pkgs/applications/graphics/mcomix/default.nix
+++ b/pkgs/applications/graphics/mcomix/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, buildPythonPackage, pygtk, pil }:
+{ stdenv, fetchurl, buildPythonPackage, pygtk, pil, python27Packages }:
buildPythonPackage rec {
namePrefix = "";
@@ -11,7 +11,7 @@ buildPythonPackage rec {
doCheck = false;
- pythonPath = [ pygtk pil ];
+ pythonPath = [ pygtk pil python27Packages.sqlite3 ];
meta = {
description = "Image viewer designed to handle comic books";
@@ -29,6 +29,6 @@ buildPythonPackage rec {
homepage = http://mcomix.sourceforge.net/;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/applications/graphics/meshlab/default.nix b/pkgs/applications/graphics/meshlab/default.nix
index 7151fc7af5c..9352ae092be 100644
--- a/pkgs/applications/graphics/meshlab/default.nix
+++ b/pkgs/applications/graphics/meshlab/default.nix
@@ -12,6 +12,12 @@ stdenv.mkDerivation rec {
# buildPhase gets removed from the 'meshlab' binary
dontPatchELF = true;
+ # Patches are from the Arch Linux package
+ patchPhase = ''
+ patch -Np0 -i "${./qt-4.8.patch}"
+ patch -Np1 -i "${./gcc-4.7.patch}"
+ '';
+
buildPhase = ''
mkdir -p "$out/include"
cp -r vcglib "$out/include"
@@ -41,7 +47,7 @@ stdenv.mkDerivation rec {
meta = {
description = "System for the processing and editing of unstructured 3D triangular meshes";
homepage = http://meshlab.sourceforge.net/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/graphics/meshlab/gcc-4.7.patch b/pkgs/applications/graphics/meshlab/gcc-4.7.patch
new file mode 100644
index 00000000000..07dc1a08aff
--- /dev/null
+++ b/pkgs/applications/graphics/meshlab/gcc-4.7.patch
@@ -0,0 +1,38 @@
+diff --git a/meshlab/src/meshlabplugins/decorate_base/colorhistogram.h b/meshlab/src/meshlabplugins/decorate_base/colorhistogram.h
+index 2351b2a..90c6d76 100644
+--- a/meshlab/src/meshlabplugins/decorate_base/colorhistogram.h
++++ b/meshlab/src/meshlabplugins/decorate_base/colorhistogram.h
+@@ -40,7 +40,7 @@ public:
+
+ //! Reset histogram data.
+ void Clear() {
+- this->::Clear();
++ Histogram::Clear();
+ CV.clear();
+ }
+ /*
+diff --git a/vcglib/wrap/gl/trimesh.h b/vcglib/wrap/gl/trimesh.h
+index 5d40404..ab9d0aa 100644
+--- a/vcglib/wrap/gl/trimesh.h
++++ b/vcglib/wrap/gl/trimesh.h
+@@ -1003,7 +1003,7 @@ void Crease(MESH_TYPE &m, typename MESH_TYPE::scalar_type angleRad)
+ }
+ }
+
+- m.vert.math::Swap(newvert);
++ m.vert.math.Swap(newvert);
+ m.vn=m.vert.size();
+ }
+
+diff --git a/vcglib/wrap/ply/plystuff.h b/vcglib/wrap/ply/plystuff.h
+index 3e41e63..4af9508 100644
+--- a/vcglib/wrap/ply/plystuff.h
++++ b/vcglib/wrap/ply/plystuff.h
+@@ -75,6 +75,7 @@ using namespace vcg;
+ #define pb_close _close
+ #define DIR_SEP "\\"
+ #else
++#include
+ #define pb_mkdir(n) mkdir(n,0755)
+ #define pb_access access
+ #define pb_stat stat
diff --git a/pkgs/applications/graphics/meshlab/qt-4.8.patch b/pkgs/applications/graphics/meshlab/qt-4.8.patch
new file mode 100644
index 00000000000..abfd77d6f25
--- /dev/null
+++ b/pkgs/applications/graphics/meshlab/qt-4.8.patch
@@ -0,0 +1,54 @@
+diff -Nur meshlab.orig/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp meshlab/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp
+--- meshlab.orig/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp 2011-01-25 18:51:28.000000000 +1100
++++ meshlab/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp 2012-01-07 11:47:12.836800072 +1100
+@@ -7,6 +7,12 @@
+ #include "SyntopiaCore/Logging/Logging.h"
+ #include "SyntopiaCore/Misc/MiniParser.h"
+
++#ifdef Q_WS_MAC
++#include
++#else
++#include
++#endif
++
+ using namespace SyntopiaCore::Math;
+ using namespace SyntopiaCore::Misc;
+
+diff -Nur meshlab.orig/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Sphere.h meshlab/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Sphere.h
+--- meshlab.orig/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Sphere.h 2011-01-25 18:51:28.000000000 +1100
++++ meshlab/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Sphere.h 2012-01-07 11:45:26.795586149 +1100
+@@ -3,6 +3,12 @@
+ #include "SyntopiaCore/Math/Vector3.h"
+ #include "Object3D.h"
+
++#ifdef Q_WS_MAC
++#include
++#else
++#include
++#endif
++
+ namespace SyntopiaCore {
+ namespace GLEngine {
+
+diff -Nur meshlab.orig/src/external/structuresynth/structuresynth.pro meshlab/src/external/structuresynth/structuresynth.pro
+--- meshlab.orig/src/external/structuresynth/structuresynth.pro 2011-01-25 18:49:34.000000000 +1100
++++ meshlab/src/external/structuresynth/structuresynth.pro 2012-01-07 11:51:46.695981995 +1100
+@@ -113,6 +113,7 @@
+ ssynth/StructureSynth/Model/Rendering/TemplateRenderer.cpp
+ CONFIG+=opengl
+ QT+=xml opengl script
++unix:LIBS += -lGLU
+ macx:DESTDIR = ../lib/macx
+ win32-g++:DESTDIR = ../lib/win32-gcc
+ win32-msvc2005:DESTDIR = ../lib/win32-msvc2005
+diff -Nur meshlab.orig/src/meshlab/meshlab.pro meshlab/src/meshlab/meshlab.pro
+--- meshlab.orig/src/meshlab/meshlab.pro 2011-02-15 20:39:47.000000000 +1100
++++ meshlab/src/meshlab/meshlab.pro 2012-01-07 11:57:18.055586086 +1100
+@@ -85,6 +85,7 @@
+ QT += xmlpatterns
+ QT += network
+ QT += script
++unix:LIBS += -lGLU
+
+
+ # the following line is needed to avoid mismatch between
diff --git a/pkgs/applications/graphics/minidjvu/default.nix b/pkgs/applications/graphics/minidjvu/default.nix
index e3c6deddb29..e354837f4b8 100644
--- a/pkgs/applications/graphics/minidjvu/default.nix
+++ b/pkgs/applications/graphics/minidjvu/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
meta = {
homepage = http://djvu.sourceforge.net/djview4.html;
description = "Black-and-white djvu page encoder and decoder that use interpage information";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.viric ];
};
}
diff --git a/pkgs/applications/graphics/mirage/default.nix b/pkgs/applications/graphics/mirage/default.nix
index dd1fbcc7e07..20f7460f7a1 100644
--- a/pkgs/applications/graphics/mirage/default.nix
+++ b/pkgs/applications/graphics/mirage/default.nix
@@ -5,25 +5,25 @@ buildPythonPackage rec {
name = "mirage-0.9.5.2";
src = fetchurl {
- url = "http://download.berlios.de/mirageiv/${name}.tar.bz2";
+ url = "mirror://sourceforge/mirageiv/${name}.tar.bz2";
sha256 = "d214a1b6d99d1d1e83da5848a2cef181f6781e0990e93f7ebff5880b0c43f43c";
};
- postInstall = ''
- mv $out/lib/${python.libPrefix}/site-packages/*.egg/share $out
- '';
-
doCheck = false;
buildInputs = [ stdenv libX11 gettext ];
+ patchPhase = ''
+ sed -i "s@/usr/local/share/locale@$out/share/locale@" mirage.py
+ '';
+
pythonPath = [ pygtk pil ];
meta = {
description = "Simple image viewer written in PyGTK";
- homepage = http://mirageiv.berlios.de/;
+ homepage = http://mirageiv.sourceforge.net/;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/applications/graphics/mypaint/default.nix b/pkgs/applications/graphics/mypaint/default.nix
index a59498b8f14..be8df8ef16d 100644
--- a/pkgs/applications/graphics/mypaint/default.nix
+++ b/pkgs/applications/graphics/mypaint/default.nix
@@ -1,5 +1,6 @@
-{ stdenv, fetchurl, gettext, glib, gtk, json_c, lcms2, libpng
-, makeWrapper, pkgconfig, pygtk, python, pythonPackages, scons, swig
+{ stdenv, fetchurl, gettext, glib, gtk, hicolor_icon_theme, json_c
+, lcms2, libpng , makeWrapper, pkgconfig, pygtk, python, pythonPackages
+, scons, swig
}:
stdenv.mkDerivation rec {
@@ -11,18 +12,21 @@ stdenv.mkDerivation rec {
sha256 = "0f7848hr65h909c0jkcx616flc0r4qh53g3kd1cgs2nr1pjmf3bq";
};
- buildInputs = [
+ buildInputs = [
gettext glib gtk json_c lcms2 libpng makeWrapper pkgconfig pygtk
python scons swig
];
-
- propagatedBuildInputs = [ pythonPackages.numpy ];
+
+ propagatedBuildInputs = [ hicolor_icon_theme pythonPackages.numpy ];
buildPhase = "scons prefix=$out";
installPhase = ''
scons prefix=$out install
- wrapProgram $out/bin/mypaint --prefix PYTHONPATH : $PYTHONPATH
+ sed -i -e 's|/usr/bin/env python2.7|${python}/bin/python|' $out/bin/mypaint
+ wrapProgram $out/bin/mypaint \
+ --prefix PYTHONPATH : $PYTHONPATH \
+ --prefix XDG_DATA_DIRS ":" "${hicolor_icon_theme}/share"
'';
meta = with stdenv.lib; {
diff --git a/pkgs/applications/graphics/ocrad/default.nix b/pkgs/applications/graphics/ocrad/default.nix
index 482b57d03d2..4c20a41061a 100644
--- a/pkgs/applications/graphics/ocrad/default.nix
+++ b/pkgs/applications/graphics/ocrad/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
backend to other programs.
'';
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
maintainers = [ ];
platforms = stdenv.lib.platforms.gnu; # arbitrary choice
diff --git a/pkgs/applications/graphics/openimageio/default.nix b/pkgs/applications/graphics/openimageio/default.nix
index f8160e4d688..d0a1fb38e0c 100644
--- a/pkgs/applications/graphics/openimageio/default.nix
+++ b/pkgs/applications/graphics/openimageio/default.nix
@@ -4,26 +4,26 @@
stdenv.mkDerivation rec {
name = "oiio-${version}";
- version = "1.1.12";
+ version = "1.4";
src = fetchurl {
- url = "https://github.com/OpenImageIO/oiio/archive/Release-${version}.zip";
- sha256 = "196iq15waa2yyryiwhf6ynlpqnpknm4cc4azakg01xs70yiphsfl";
+ url = "https://github.com/OpenImageIO/oiio/archive/RB-${version}.zip";
+ sha256 = "0ldj3hwpz363l1zyzf6c62wc5d2cpbiszlpjvv5w6rrsx2ddbbn1";
};
- buildInputs = [
+ buildInputs = [
boost cmake ilmbase libjpeg libpng libtiff opencolorio openexr unzip
];
- configurePhase = "";
+ cmakeFlags = [
+ "-DUSE_PYTHON=OFF"
+ ];
buildPhase = ''
make ILMBASE_HOME=${ilmbase} OPENEXR_HOME=${openexr} USE_PYTHON=0 \
INSTALLDIR=$out dist_dir=
'';
- installPhase = ":";
-
meta = with stdenv.lib; {
homepage = http://www.openimageio.org;
description = "A library and tools for reading and writing images";
diff --git a/pkgs/applications/graphics/openscad/default.nix b/pkgs/applications/graphics/openscad/default.nix
index d34eeba207c..d831df5d7b6 100644
--- a/pkgs/applications/graphics/openscad/default.nix
+++ b/pkgs/applications/graphics/openscad/default.nix
@@ -1,16 +1,19 @@
{ stdenv, fetchurl, qt4, bison, flex, eigen, boost, mesa, glew, opencsg, cgal
-, mpfr, gmp }:
+, mpfr, gmp, glib, pkgconfig
+}:
stdenv.mkDerivation rec {
- version = "2013.06";
+ version = "2014.03";
name = "openscad-${version}";
src = fetchurl {
- url = "https://openscad.googlecode.com/files/${name}.src.tar.gz";
- sha256 = "01r013l8zyfkgmqn05axh3rlfsjwd6j403w5ffl7nby4i2spiw1f";
+ url = "http://files.openscad.org/${name}.src.tar.gz";
+ sha256 = "1hv1lmq1ayhlvrz5sqipg650xryq25a9k22ysdw0dsrwg9ixqpw6";
};
- buildInputs = [ qt4 bison flex eigen boost mesa glew opencsg cgal gmp mpfr ];
+ buildInputs = [
+ qt4 bison flex eigen boost mesa glew opencsg cgal mpfr gmp glib pkgconfig
+ ];
configurePhase = ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$(echo ${eigen}/include/eigen*) "
diff --git a/pkgs/applications/graphics/panotools/default.nix b/pkgs/applications/graphics/panotools/default.nix
index 17e1b2e8b14..8e5204ac638 100644
--- a/pkgs/applications/graphics/panotools/default.nix
+++ b/pkgs/applications/graphics/panotools/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://panotools.sourceforge.net/;
description = "Free software suite for authoring and displaying virtual reality panoramas";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = stdenv.lib.platforms.gnu; # arbitrary choice
};
diff --git a/pkgs/applications/graphics/pencil/default.nix b/pkgs/applications/graphics/pencil/default.nix
new file mode 100644
index 00000000000..737baf375d1
--- /dev/null
+++ b/pkgs/applications/graphics/pencil/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, xulrunner }:
+
+stdenv.mkDerivation rec {
+ name = "pencil-2.0.5";
+
+ src = fetchurl {
+ url = "http://evoluspencil.googlecode.com/files/${name}.tar.gz";
+ sha256 = "0rn5nb08p8wph5s5gajkil6y06zgrm86p4gnjdgv76czx1fqazm0";
+ };
+
+ # Pre-built package
+ buildPhase = "true";
+
+ installPhase = ''
+ mkdir -p "$out"
+ cp -r usr/* "$out"
+ cp COPYING "$out/share/pencil"
+ sed -e "s|/usr/bin/xulrunner|${xulrunner}/bin/xulrunner|" \
+ -e "s|/usr/share/pencil|$out/share/pencil|" \
+ -i "$out/bin/pencil"
+ sed -e "s|/usr/bin/pencil|$out/bin/pencil|" \
+ -e "s|Icon=.*|Icon=$out/share/pencil/skin/classic/icon.svg|" \
+ -i "$out/share/applications/pencil.desktop"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "GUI prototyping/mockup tool";
+ homepage = http://pencil.evolus.vn/;
+ license = licenses.gpl2; # Commercial license is also available
+ maintainers = [ maintainers.bjornfor ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/graphics/photivo/default.nix b/pkgs/applications/graphics/photivo/default.nix
new file mode 100644
index 00000000000..156966ac46c
--- /dev/null
+++ b/pkgs/applications/graphics/photivo/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchhg, cmake, qt4, fftw, graphicsmagick_q16,
+ lcms2, lensfun, pkgconfig, libjpeg, exiv2, liblqr1 }:
+
+stdenv.mkDerivation rec {
+ name = "photivo-2014-01-25";
+
+ src = fetchhg {
+ url = "http://code.google.com/p/photivo/";
+ rev = "d687864489da";
+ sha256 = "0f6y18k7db2ci6xn664zcwm1g1k04sdv7gg1yd5jk41bndjb7z8h";
+ };
+
+ nativeBuildInputs = [ cmake pkgconfig ];
+
+ buildInputs = [ qt4 fftw graphicsmagick_q16 lcms2 lensfun libjpeg exiv2 liblqr1 ];
+ patchPhase = '' # kinda icky
+ sed -e '/("@INSTALL@")/d' \
+ -e s,@INSTALL@,$out/share/photivo, \
+ -i Sources/ptSettings.cpp
+ '';
+
+ meta = with stdenv.lib; {
+ platforms = platforms.linux;
+ maintainers = maintainers.mornfall;
+ };
+}
diff --git a/pkgs/applications/graphics/pinta/default.nix b/pkgs/applications/graphics/pinta/default.nix
index b54d73b4964..6958c94f7e1 100644
--- a/pkgs/applications/graphics/pinta/default.nix
+++ b/pkgs/applications/graphics/pinta/default.nix
@@ -37,7 +37,7 @@ stdenv.mkDerivation {
meta = {
homepage = http://www.pinta-project.com/;
description = "Drawing/editing program modeled after Paint.NET";
- license = "MIT";
+ license = stdenv.lib.licenses.mit;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/graphics/potrace/default.nix b/pkgs/applications/graphics/potrace/default.nix
new file mode 100644
index 00000000000..f58fe0e28c1
--- /dev/null
+++ b/pkgs/applications/graphics/potrace/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, zlib }:
+
+let version = "1.11"; in
+
+stdenv.mkDerivation {
+ name = "potrace-${version}";
+
+ src = fetchurl {
+ url = "http://potrace.sourceforge.net/download/potrace-${version}.tar.gz";
+ sha256 = "1bbyl7jgigawmwc8r14znv8lb6lrcxh8zpvynrl6s800dr4yp9as";
+ };
+
+ configureFlags = ["--with-libpotrace"];
+
+ buildInputs = [ zlib ];
+
+ meta = {
+ homepage = http://potrace.sourceforge.net/;
+ description = "A tool for tracing a bitmap, which means, transforming a bitmap into a smooth, scalable image";
+ platforms = stdenv.lib.platforms.unix;
+ maintainers = [ stdenv.lib.maintainers.pSub ];
+ license = stdenv.lib.licenses.gpl2;
+ };
+}
diff --git a/pkgs/applications/graphics/qiv/default.nix b/pkgs/applications/graphics/qiv/default.nix
index df18c6d1520..86891f2cb93 100644
--- a/pkgs/applications/graphics/qiv/default.nix
+++ b/pkgs/applications/graphics/qiv/default.nix
@@ -1,14 +1,15 @@
-{ stdenv, fetchurl, pkgconfig, gtk, imlib2, file } :
+{ stdenv, fetchurl, pkgconfig, gtk, imlib2, file, lcms2, libexif } :
stdenv.mkDerivation (rec {
- name = "qiv-2.2.4";
+ version = "2.3.1";
+ name = "qiv-${version}";
src = fetchurl {
url = "http://spiegl.de/qiv/download/${name}.tgz";
- sha256 = "ed6078dc550c1dc2fe35c1e0f46463c13589a24b83d4f7101b71a7485e51abb7";
+ sha256 = "1rlf5h67vhj7n1y7jqkm9k115nfnzpwngj3kzqsi2lg676srclv7";
};
- buildInputs = [ pkgconfig gtk imlib2 file ];
+ buildInputs = [ pkgconfig gtk imlib2 file lcms2 libexif ];
preBuild=''
substituteInPlace Makefile --replace /usr/local "$out"
@@ -18,5 +19,6 @@ stdenv.mkDerivation (rec {
meta = {
description = "qiv (quick image viewer)";
homepage = http://spiegl.de/qiv/;
+ inherit version;
};
})
diff --git a/pkgs/applications/graphics/qiv/default.upstream b/pkgs/applications/graphics/qiv/default.upstream
new file mode 100644
index 00000000000..e6c7ef2408e
--- /dev/null
+++ b/pkgs/applications/graphics/qiv/default.upstream
@@ -0,0 +1,3 @@
+url http://spiegl.de/qiv/download/
+version_link '[.]tgz$'
+do_overwrite() { do_overwrite_just_version; }
diff --git a/pkgs/applications/graphics/qtpfsgui/default.nix b/pkgs/applications/graphics/qtpfsgui/default.nix
index 95d7acca36c..cd8c76dc42c 100644
--- a/pkgs/applications/graphics/qtpfsgui/default.nix
+++ b/pkgs/applications/graphics/qtpfsgui/default.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
aims to provide a workflow for high dynamic range (HDR) imaging.
'';
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.gnu;
diff --git a/pkgs/applications/graphics/sane/backends-git.nix b/pkgs/applications/graphics/sane/backends-git.nix
index c9cea4109dc..67b733dda7a 100644
--- a/pkgs/applications/graphics/sane/backends-git.nix
+++ b/pkgs/applications/graphics/sane/backends-git.nix
@@ -1,16 +1,18 @@
-{ stdenv, fetchurl, fetchgit, hotplugSupport ? true, libusb ? null, gt68xxFirmware ? null }:
+{ stdenv, fetchurl, fetchgit, hotplugSupport ? true, libusb ? null
+, gt68xxFirmware ? null, snapscanFirmware ? null
+}:
let
firmware = gt68xxFirmware { inherit fetchurl; };
in
assert hotplugSupport -> (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux");
stdenv.mkDerivation {
- name = "sane-backends-1.0.23.296-gf139120";
+ name = "sane-backends-1.0.24.73-g6c4f6bc";
src = fetchgit {
- url = "http://git.debian.org/git/sane/sane-backends.git";
- rev = "f139120c72db6de98be95b52c206c2a4d8071e92";
- sha256 = "1b2fv19c8ijh9l0jjilli3j70n17wvcgpqq1nxmiby3ai6nrzk8d";
+ url = "git://alioth.debian.org/git/sane/sane-backends.git";
+ rev = "6c4f6bc58615755dc734281703b594cea3ebf848";
+ sha256 = "0f7lbv1rnr53n4rpihcd8dkfm01xvwfnx9i1nqaadrzbpvgkjrfa";
};
udevSupport = hotplugSupport;
@@ -29,6 +31,11 @@ stdenv.mkDerivation {
if gt68xxFirmware != null then
"mkdir -p \${out}/share/sane/gt68xx ; ln -s " + firmware.fw +
" \${out}/share/sane/gt68xx/" + firmware.name
+ else if snapscanFirmware != null then
+ "mkdir -p \${out}/share/sane/snapscan ; ln -s " + snapscanFirmware +
+ " \${out}/share/sane/snapscan/your-firmwarefile.bin ;" +
+ "mkdir -p \${out}/etc/sane.d ; " +
+ "echo epson2 > \${out}/etc/sane.d/dll.conf"
else "";
meta = {
diff --git a/pkgs/applications/graphics/sane/backends.nix b/pkgs/applications/graphics/sane/backends.nix
index a53466ae818..28d2f1e200b 100644
--- a/pkgs/applications/graphics/sane/backends.nix
+++ b/pkgs/applications/graphics/sane/backends.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchurl, hotplugSupport ? true, libusb ? null, libv4l ? null, pkgconfig ? null , gt68xxFirmware ? null }:
+{ stdenv, fetchurl, hotplugSupport ? true, libusb ? null, libv4l ? null
+, pkgconfig ? null, gt68xxFirmware ? null, snapscanFirmware ? null
+}:
assert hotplugSupport -> (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux");
@@ -6,12 +8,16 @@ let
firmware = gt68xxFirmware { inherit fetchurl; };
in
stdenv.mkDerivation rec {
- version = "1.0.23";
+ version = "1.0.24";
name = "sane-backends-${version}";
src = fetchurl {
- url = "https://launchpad.net/ubuntu/+archive/primary/+files/sane-backends_${version}.orig.tar.gz";
- sha256 = "4d4f5b2881615af7fc0ed75fdde7dc623a749e80e40f3f792fe4010163cbb029";
+ urls = [
+ "http://pkgs.fedoraproject.org/repo/pkgs/sane-backends/sane-backends-1.0.24.tar.gz/1ca68e536cd7c1852322822f5f6ac3a4/${name}.tar.gz"
+ "https://alioth.debian.org/frs/download.php/file/3958/${name}.tar.gz"
+ ];
+ curlOpts = "--insecure";
+ sha256 = "0ba68m6bzni54axjk15i51rya7hfsdliwvqyan5msl7iaid0iir7";
};
udevSupport = hotplugSupport;
@@ -36,12 +42,15 @@ stdenv.mkDerivation rec {
if gt68xxFirmware != null then
"mkdir -p \${out}/share/sane/gt68xx ; ln -s " + firmware.fw +
" \${out}/share/sane/gt68xx/" + firmware.name
+ else if snapscanFirmware != null then
+ "mkdir -p \${out}/share/sane/snapscan ; ln -s " + snapscanFirmware +
+ " \${out}/share/sane/snapscan/your-firmwarefile.bin"
else "";
meta = {
homepage = "http://www.sane-project.org/";
description = "Scanner Access Now Easy";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.simons ];
platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/applications/graphics/sane/config.nix b/pkgs/applications/graphics/sane/config.nix
new file mode 100644
index 00000000000..fc1cd81ebc6
--- /dev/null
+++ b/pkgs/applications/graphics/sane/config.nix
@@ -0,0 +1,27 @@
+{ stdenv }:
+
+{ paths }:
+
+with stdenv.lib;
+let installSanePath = path: ''
+ find "${path}/lib/sane" -not -type d -maxdepth 1 | while read backend; do
+ ln -s $backend $out/lib/sane/$(basename $backend)
+ done
+
+ find "${path}/etc/sane.d" -not -type d -maxdepth 1 | while read conf; do
+ ln -s $conf $out/etc/sane.d/$(basename $conf)
+ done
+
+ find "${path}/etc/sane.d/dll.d" -not -type d -maxdepth 1 | while read conf; do
+ ln -s $conf $out/etc/sane.d/dll.d/$(basename $conf)
+ done
+ '';
+in
+stdenv.mkDerivation {
+ name = "sane-config";
+ phases = "installPhase";
+
+ installPhase = ''
+ mkdir -p $out/etc/sane.d $out/etc/sane.d/dll.d $out/lib/sane
+ '' + concatMapStrings installSanePath paths;
+}
diff --git a/pkgs/applications/graphics/sane/frontends.nix b/pkgs/applications/graphics/sane/frontends.nix
index 9e73a08e096..a0f6e5bac50 100644
--- a/pkgs/applications/graphics/sane/frontends.nix
+++ b/pkgs/applications/graphics/sane/frontends.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = "http://www.sane-project.org/";
description = "Scanner Access Now Easy";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.simons ];
platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/applications/graphics/sane/xsane.nix b/pkgs/applications/graphics/sane/xsane.nix
index de8d4c33652..221a4340dce 100644
--- a/pkgs/applications/graphics/sane/xsane.nix
+++ b/pkgs/applications/graphics/sane/xsane.nix
@@ -1,24 +1,30 @@
-{ stdenv, fetchurl, saneBackends, saneFrontends, libX11, gtk, pkgconfig, libpng, libusb ? null }:
+{ stdenv, fetchurl, saneBackends, saneFrontends, libX11, gtk, pkgconfig, libpng
+, libusb ? null
+, gimpSupport ? false, gimp_2_8 ? null
+}:
+
+assert gimpSupport -> gimp_2_8 != null;
stdenv.mkDerivation rec {
- name = "xsane-0.998";
+ name = "xsane-0.999";
src = fetchurl {
url = "http://www.xsane.org/download/${name}.tar.gz";
- sha256 = "0vn2cj85ijgp2v2j2h9xpqmg2jwlbxmwyb88kxhjjakqay02ybm3";
+ sha256 = "0jrb918sfb9jw3vmrz0z7np4q55hgsqqffpixs0ir5nwcwzd50jp";
};
preConfigure = ''
sed -e '/SANE_CAP_ALWAYS_SETTABLE/d' -i src/xsane-back-gtk.c
'';
- buildInputs = [libpng saneBackends saneFrontends libX11 gtk pkgconfig ] ++
- (if libusb != null then [libusb] else []);
+ buildInputs = [libpng saneBackends saneFrontends libX11 gtk pkgconfig ]
+ ++ (if libusb != null then [libusb] else [])
+ ++ stdenv.lib.optional gimpSupport gimp_2_8;
meta = {
homepage = http://www.sane-project.org/;
description = "Graphical scanning frontend for sane";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [viric simons];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/graphics/shotwell/default.nix b/pkgs/applications/graphics/shotwell/default.nix
new file mode 100644
index 00000000000..1953f951d16
--- /dev/null
+++ b/pkgs/applications/graphics/shotwell/default.nix
@@ -0,0 +1,62 @@
+{ fetchurl, stdenv, m4, glibc, gtk3, libexif, libgphoto2, libsoup, libxml2, vala, sqlite, webkit
+, pkgconfig, gnome3, gst_all_1, which, udev, libraw, glib, json_glib, gettext, desktop_file_utils
+, lcms2, gdk_pixbuf, librsvg, makeWrapper, gnome_doc_utils }:
+
+# for dependencies see http://www.yorba.org/projects/shotwell/install/
+
+let
+ rest = stdenv.mkDerivation rec {
+ name = "rest-0.7.12";
+
+ src = fetchurl {
+ url = "mirror://gnome/sources/rest/0.7/${name}.tar.xz";
+ sha256 = "0fmg7fq5fx0jg3ryk71kwdkspsvj42acxy9imk7vznkqj29a9zqn";
+ };
+
+ configureFlags = "--with-ca-certificates=/etc/ssl/certs/ca-bundle.crt";
+
+ buildInputs = [ pkgconfig glib libsoup ];
+ };
+in stdenv.mkDerivation rec {
+ version = "0.18.0";
+ name = "shotwell-${version}";
+
+ src = fetchurl {
+ url = "mirror://gnome/sources/shotwell/0.18/${name}.tar.xz";
+ sha256 = "0cq0zs13f3f4xyz46yvj4qfpm5nh4ypds7r53pkqm4a3n8ybf5v7";
+ };
+
+ NIX_CFLAGS_COMPILE = "-I${glib}/include/glib-2.0 -I${glib}/lib/glib-2.0/include";
+
+ configureFlags = [ "--disable-gsettings-convert-install" ];
+
+ preConfigure = ''
+ patchShebangs .
+ '';
+
+ postInstall = ''
+ mkdir -p $out/share/gsettings-schemas/$name
+ mv $out/share/glib-2.0 $out/share/gsettings-schemas/$name/
+ '';
+
+ preFixup = ''
+ wrapProgram "$out/bin/shotwell" \
+ --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
+ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3}/share:$out/share:$GSETTINGS_SCHEMAS_PATH"
+ rm $out/share/icons/hicolor/icon-theme.cache
+ '';
+
+
+ buildInputs = [ m4 glibc gtk3 libexif libgphoto2 libsoup libxml2 vala sqlite webkit pkgconfig
+ gst_all_1.gstreamer gst_all_1.gst-plugins-base gnome3.libgee which udev gnome3.gexiv2
+ libraw rest json_glib gettext desktop_file_utils glib lcms2 gdk_pixbuf librsvg
+ makeWrapper gnome_doc_utils ];
+
+ meta = with stdenv.lib; {
+ description = "Popular photo organizer for the GNOME desktop";
+ homepage = http://www.yorba.org/projects/shotwell/;
+ license = licenses.lgpl21Plus;
+ maintainers = with maintainers; [iElectric];
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/graphics/smartdeblur/default.nix b/pkgs/applications/graphics/smartdeblur/default.nix
new file mode 100644
index 00000000000..083fde35902
--- /dev/null
+++ b/pkgs/applications/graphics/smartdeblur/default.nix
@@ -0,0 +1,32 @@
+{ fetchurl, stdenv, cmake, qt4, fftw }:
+
+let
+ rev = "9895036d26";
+in
+stdenv.mkDerivation rec {
+ name = "smartdeblur-git-${rev}";
+
+ src = fetchurl {
+ url = "https://github.com/Y-Vladimir/SmartDeblur/tarball/${rev}";
+ name = "${name}.tar.gz";
+ sha256 = "126x9x1zhqdarjz9in0p1qhmqg3jwz7frizadjvx723g2ppi33s4";
+ };
+
+ preConfigure = ''
+ cd src
+ '';
+
+ enableParallelBuilding = true;
+
+ buildInputs = [ cmake qt4 fftw ];
+
+ cmakeFlags = "-DUSE_SYSTEM_FFTW=ON";
+
+ meta = {
+ homepage = "https://github.com/Y-Vladimir/SmartDeblur";
+ description = "Tool for restoring blurry and defocused images";
+ license = stdenv.lib.licenses.gpl3;
+ maintainers = with stdenv.lib.maintainers; [ viric ];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/pkgs/applications/graphics/sxiv/default.nix b/pkgs/applications/graphics/sxiv/default.nix
index 26d910943ef..30513577d04 100644
--- a/pkgs/applications/graphics/sxiv/default.nix
+++ b/pkgs/applications/graphics/sxiv/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchurl, libX11, imlib2, giflib }:
stdenv.mkDerivation {
- name = "sxiv-1.1";
+ name = "sxiv-1.1.1";
src = fetchurl {
- url = "https://github.com/muennich/sxiv/archive/v1.1.tar.gz";
+ url = "https://github.com/muennich/sxiv/archive/v1.1.1.tar.gz";
name = "sxiv-1.1.tar.gz";
- sha256 = "0gsqwa1yacsig7ycjrw0sjyrsa9mynfzzbwm1vp2bgk4s9hb08kx";
+ sha256 = "07r8125xa8d5q71ql71s4i1dx4swy8hypxh2s5h7z2jnn5y9nmih";
};
buildInputs = [ libX11 imlib2 giflib ];
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
meta = {
description = "Simple X Image Viewer";
homepage = "https://github.com/muennich/sxiv";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/graphics/synfigstudio/default.nix b/pkgs/applications/graphics/synfigstudio/default.nix
new file mode 100644
index 00000000000..034a147b787
--- /dev/null
+++ b/pkgs/applications/graphics/synfigstudio/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchurl, boost, cairo, gettext, glibmm, gtk, gtkmm
+, libsigcxx, libtool, libxmlxx, pango, pkgconfig, imagemagick
+, intltool
+}:
+
+let
+ version = "0.64.1";
+
+ ETL = stdenv.mkDerivation rec {
+ name = "ETL-0.04.17";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/synfig/${name}.tar.gz";
+ sha256 = "13kpiswgcpsif9fwcplqr0405aqavqn390cjnivkn3pxv0d2q8iy";
+ };
+ };
+
+ synfig = stdenv.mkDerivation rec {
+ name = "synfig-${version}";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/synfig/synfig-${version}.tar.gz";
+ sha256 = "1b4ksxnqbaq4rxlvasmrvk7z4jvjbsg4ns3cns2qcnz64dyvbgda";
+ };
+
+ patches = [ ./synfig-cstring.patch ];
+
+ buildInputs = [
+ ETL boost cairo gettext glibmm libsigcxx libtool libxmlxx pango
+ pkgconfig
+ ];
+
+ configureFlags = [ "--with-boost-libdir=${boost}/lib" ];
+ };
+in
+stdenv.mkDerivation rec {
+ name = "synfigstudio-${version}";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/synfig/${name}.tar.gz";
+ sha256 = "0nl6vpsn5dcjd5qhbrmd0j4mr3wddvymkg9414m77cdpz4l8b9v2";
+ };
+
+ buildInputs = [
+ ETL boost cairo gettext glibmm gtk gtkmm imagemagick intltool
+ intltool libsigcxx libtool libxmlxx pkgconfig synfig
+ ];
+
+ meta = with stdenv.lib; {
+ description = "A 2D animation program";
+ homepage = http://www.synfig.org;
+ license = licenses.gpl2Plus;
+ maintainers = [ maintainers.goibhniu ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/graphics/synfigstudio/synfig-cstring.patch b/pkgs/applications/graphics/synfigstudio/synfig-cstring.patch
new file mode 100644
index 00000000000..51eb7704216
--- /dev/null
+++ b/pkgs/applications/graphics/synfigstudio/synfig-cstring.patch
@@ -0,0 +1,12 @@
+http://www.synfig.org/issues/thebuggenie/synfig/issues/438
+--- a/src/modules/mod_png/trgt_png.cpp
++++ b/src/modules/mod_png/trgt_png.cpp
+@@ -39,6 +39,7 @@
+ #include
+ #include
+ #include
++#include
+
+ #endif
+
+
diff --git a/pkgs/applications/graphics/tesseract/default.nix b/pkgs/applications/graphics/tesseract/default.nix
index e67d202dcae..83aff09e2aa 100644
--- a/pkgs/applications/graphics/tesseract/default.nix
+++ b/pkgs/applications/graphics/tesseract/default.nix
@@ -9,7 +9,7 @@ let
url = "http://tesseract-ocr.googlecode.com/files/tesseract-ocr-${majVersion}.${lang}.tar.gz";
inherit sha256;
};
- in
+ in
"tar xfvz ${src} -C $out/share/ --strip=1";
extraLanguages = ''
@@ -19,6 +19,7 @@ let
${f "nld" "162acxp1yb6gyki2is3ay2msalmfcsnrlsd9wml2ja05k94m6bjy"}
${f "eng" "1y5xf794n832s3lymzlsdm2s9nlrd2v27jjjp0fd9xp7c2ah4461"}
${f "slv" "0rqng43435cly32idxm1lvxkcippvc3xpxbfizwq5j0155ym00dr"}
+ ${f "jpn" "07v8pymd0iwyzh946lxylybda20gsw7p4fsb09jw147955x49gq9"}
'';
in
@@ -44,7 +45,7 @@ stdenv.mkDerivation rec {
meta = {
description = "OCR engine";
homepage = http://code.google.com/p/tesseract-ocr/;
- license = "Apache2.0";
+ license = stdenv.lib.licenses.asl20;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/graphics/ufraw/default.nix b/pkgs/applications/graphics/ufraw/default.nix
index 6ec1c5fafdc..783832abd00 100644
--- a/pkgs/applications/graphics/ufraw/default.nix
+++ b/pkgs/applications/graphics/ufraw/default.nix
@@ -1,18 +1,18 @@
{ fetchurl, stdenv, pkgconfig, gtk, gettext, bzip2, zlib
-, libjpeg, libtiff, cfitsio, exiv2, lcms, gtkimageview }:
+, libjpeg, libtiff, cfitsio, exiv2, lcms, gtkimageview, lensfun }:
stdenv.mkDerivation rec {
- name = "ufraw-0.18";
+ name = "ufraw-0.19.2";
src = fetchurl {
# XXX: These guys appear to mutate uploaded tarballs!
url = "mirror://sourceforge/ufraw/${name}.tar.gz";
- sha256 = "01cjdc748vamjpaw2sbm8a9kwmb2hry4f200j3hlvqg9c6f77zi4";
+ sha256 = "1lxba7pb3vcsq94dwapg9bk9mb3ww6r3pvvcyb0ah5gh2sgzxgkk";
};
buildInputs =
[ pkgconfig gtk gtkimageview gettext bzip2 zlib
- libjpeg libtiff cfitsio exiv2 lcms
+ libjpeg libtiff cfitsio exiv2 lcms lensfun
];
meta = {
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
the camera's tone curves.
'';
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ ];
platforms = stdenv.lib.platforms.gnu; # needs GTK+
diff --git a/pkgs/applications/graphics/viewnior/default.nix b/pkgs/applications/graphics/viewnior/default.nix
index 99e1ec1c169..dd8e01298ff 100644
--- a/pkgs/applications/graphics/viewnior/default.nix
+++ b/pkgs/applications/graphics/viewnior/default.nix
@@ -2,11 +2,11 @@
, intltool, gettext, shared_mime_info, glib, gdk_pixbuf, perl}:
stdenv.mkDerivation rec {
- name = "viewnior-1.3";
+ name = "viewnior-1.4";
src = fetchurl {
- url = "http://cloud.github.com/downloads/xsisqox/Viewnior/${name}.tar.gz";
- sha256 = "46c97c1a85361519b42fe008cfb8911e66f709f3a3a988c11047ab3726889f10";
+ url = "https://www.dropbox.com/s/zytq0suabesv933/${name}.tar.gz";
+ sha256 = "0vv1133phgfzm92md6bbccmcvfiqb4kz28z1572c0qj971yz457a";
};
buildInputs =
@@ -14,6 +14,10 @@ stdenv.mkDerivation rec {
shared_mime_info glib gdk_pixbuf perl
];
+ preFixup = ''
+ rm $out/share/icons/*/icon-theme.cache
+ '';
+
meta = {
description = "Viewnior is a fast and simple image viewer for GNU/Linux";
longDescription =
@@ -24,7 +28,7 @@ stdenv.mkDerivation rec {
in mind (follows Gnome HIG2).
'';
- license = "GPLv3";
+ license = stdenv.lib.licenses.gpl3;
homepage = http://xsisqox.github.com/Viewnior;
diff --git a/pkgs/applications/graphics/xaos/default.nix b/pkgs/applications/graphics/xaos/default.nix
index 307c9477929..8387b3486d4 100644
--- a/pkgs/applications/graphics/xaos/default.nix
+++ b/pkgs/applications/graphics/xaos/default.nix
@@ -1,17 +1,17 @@
-a :
-let
+a :
+let
fetchurl = a.fetchurl;
- version = a.lib.attrByPath ["version"] "3.5" a;
+ version = a.lib.attrByPath ["version"] "3.6" a;
buildInputs = with a; [
- aalib gsl libpng libX11 xproto libXext xextproto
+ aalib gsl libpng libX11 xproto libXext xextproto
libXt zlib gettext intltool perl
];
in
rec {
src = fetchurl {
url = "mirror://sourceforge/xaos/xaos-${version}.tar.gz";
- sha256 = "0hj8sxya4s9rc1m4xvxj00jgiczi3ljf2zvrhx34r3ja2m9af7s7";
+ sha256 = "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq";
};
inherit buildInputs;
@@ -24,11 +24,11 @@ rec {
sed -e s@/usr/@"$out/"@g -i configure $(find . -name 'Makefile*')
mkdir -p $out/share/locale
'') ["doUnpack" "minInit" "defEnsureDir"];
-
+
name = "xaos-" + version;
meta = {
homepage = http://xaos.sourceforge.net/;
description = "XaoS - fractal viewer";
- license = "GPLv2+";
+ license = a.stdenv.lib.licenses.gpl2Plus;
};
}
diff --git a/pkgs/applications/graphics/zgrviewer/default.nix b/pkgs/applications/graphics/zgrviewer/default.nix
index 5fe30bd7a03..4eefd5749b6 100644
--- a/pkgs/applications/graphics/zgrviewer/default.nix
+++ b/pkgs/applications/graphics/zgrviewer/default.nix
@@ -10,19 +10,19 @@ stdenv.mkDerivation rec {
buildInputs = [jre unzip];
buildPhase = "";
installPhase = ''
- mkdir -p "$out"/{bin,lib/java/zvtm/plugins,share/doc/zvtm}
+ mkdir -p "$out"/{bin,share/java/zvtm/plugins,share/doc/zvtm}
cp overview.html *.license.* "$out/share/doc/zvtm"
- cp -r target/* "$out/lib/java/zvtm/"
+ cp -r target/* "$out/share/java/zvtm/"
echo '#!/bin/sh' > "$out/bin/zgrviewer"
- echo "java -jar '$out/lib/java/zvtm/zgrviewer-${version}.jar'" >> "$out/bin/zgrviewer"
+ echo "java -jar '$out/share/java/zvtm/zgrviewer-${version}.jar'" >> "$out/bin/zgrviewer"
chmod a+x "$out/bin/zgrviewer"
'';
meta = {
# Quicker to unpack locally than load Hydra
- platforms = [];
+ hydraPlatforms = [];
maintainers = with stdenv.lib.maintainers; [raskin];
license = with stdenv.lib.licenses; lgpl21Plus;
description = "GraphViz graph viewer/navigator";
diff --git a/pkgs/applications/ike/default.nix b/pkgs/applications/ike/default.nix
index 52330b57b8f..1414310ebf3 100644
--- a/pkgs/applications/ike/default.nix
+++ b/pkgs/applications/ike/default.nix
@@ -1,8 +1,12 @@
-{ stdenv, fetchurl, cmake, openssl, libedit, flex, bison, qt4, makeWrapper, gcc }:
+{ stdenv, fetchurl, cmake, openssl, libedit, flex, bison, qt4, makeWrapper
+, gcc, nettools, iproute, linuxHeaders }:
# NOTE: use $out/etc/iked.conf as sample configuration and also set: dhcp_file "/etc/iked.dhcp";
# launch with "iked -f /etc/iked.conf"
+# NOTE: my testings reveal that kernels 3.11.10 and 3.12.6 won't let the traffic through the tunnel,
+# so I'm sticking with 3.4
+
stdenv.mkDerivation rec {
name = "ike-2.2.1";
@@ -11,11 +15,13 @@ stdenv.mkDerivation rec {
sha256 = "0fhyr2psd93b0zf7yfb72q3nqnh65mymgq5jpjcsj9jv5kfr6l8y";
};
- buildInputs = [ cmake openssl libedit flex bison qt4 makeWrapper ];
+ buildInputs = [ cmake openssl libedit flex bison qt4 makeWrapper nettools iproute ];
configurePhase = ''
mkdir -p $out/{bin,sbin,lib}
- cmake -DQTGUI=YES -DETCDIR=$out/etc -DLIBDIR=$out/lib -DSBINDIR=$out/sbin -DBINDIR=$out/bin -DMANDIR=$out/man -DNATT=YES -DCMAKE_INSTALL_PREFIX:BOOL=$out
+ cmake -DQTGUI=YES -DETCDIR=$out/etc -DLIBDIR=$out/lib -DSBINDIR=$out/sbin -DBINDIR=$out/bin \
+ -DKRNINC="${linuxHeaders}/include/" -DTESTS=YES \
+ -DMANDIR=$out/man -DNATT=YES -DCMAKE_INSTALL_PREFIX:BOOL=$out
'';
buildPhase = ''
@@ -25,7 +31,7 @@ stdenv.mkDerivation rec {
installPhase = ''
make install
for file in "$out"/bin/* "$out"/sbin/*; do
- wrapProgram $file --prefix LD_LIBRARY_PATH ":" "$out/lib:${openssl}/lib:${gcc.gcc}/lib:${libedit}/lib:${qt4}/lib"
+ wrapProgram $file --prefix LD_LIBRARY_PATH ":" "$out/lib:${openssl}/lib:${gcc.gcc}/lib:${stdenv.glibc}/lib::${gcc.gcc}/lib64:${stdenv.glibc}/lib64:${libedit}/lib:${qt4}/lib"
done
'';
@@ -34,6 +40,6 @@ stdenv.mkDerivation rec {
description = "IPsec Client for FreeBSD, NetBSD and many Linux based operating systems";
platforms = platforms.unix;
maintainers = [ maintainers.iElectric ];
- license = "sleepycat";
+ license = licenses.sleepycat;
};
}
diff --git a/pkgs/applications/inferno/default.nix b/pkgs/applications/inferno/default.nix
new file mode 100644
index 00000000000..c5a40fcbf5b
--- /dev/null
+++ b/pkgs/applications/inferno/default.nix
@@ -0,0 +1,64 @@
+{ fetchurl, fetchhg, stdenv, xlibs, gcc46, makeWrapper }:
+
+stdenv.mkDerivation rec {
+ # Inferno is a rolling release from a mercurial repository. For the verison number
+ # of the package I'm using the mercurial commit number.
+ version = "645";
+ name = "inferno-${version}";
+
+ # The mercurial repository does not contain all the components needed for the
+ # runtime system. The 'base' package contains these. For this package I download
+ # the base, extract the elements required from that, and add them to the source
+ # pulled from the mercurial repository.
+ srcBase = fetchurl {
+ url = "http://www.vitanuova.com/dist/4e/inferno-20100120.tgz";
+ sha256 = "0msvy3iwl4n5k0ry0xiyysjkq0qsawmwn3hvg67hbi5y8g7f7l88";
+ };
+
+ src = fetchhg {
+ url = "https://inferno-os.googlecode.com/hg";
+ rev = "7ab390b860ca";
+ sha256 = "09y0iclb3yy10gw1p0182sddg64xh60q2fx4ai7lxyfb65i76qbh";
+ };
+
+ # Fails with gcc48 due to inferno triggering an optimisation issue with floating point.
+ buildInputs = [ gcc46 xlibs.libX11 xlibs.libXpm xlibs.libXext xlibs.xextproto makeWrapper ];
+
+ infernoWrapper = ./inferno;
+
+ configurePhase = ''
+ tar --strip-components=1 -xvf $srcBase inferno/fonts inferno/Mkdirs inferno/empties
+ sed -e 's@^ROOT=.*$@ROOT='"$out"'/share/inferno@g' -e 's@^OBJTYPE=.*$@OBJTYPE=386@g' -e 's@^SYSHOST=.*$@SYSHOST=Linux@g' -i mkconfig
+ mkdir prof
+ sh Mkdirs
+ '';
+
+ buildPhase = ''
+ export PATH=$PATH:$out/share/inferno/Linux/386/bin
+ mkdir -p $out/share/inferno
+ cp -r . $out/share/inferno
+ ./makemk.sh
+ mk nuke
+ mk
+ '';
+
+ installPhase = ''
+ mk install
+ mkdir -p $out/bin
+ makeWrapper $out/share/inferno/Linux/386/bin/emu $out/bin/emu \
+ --suffix LD_LIBRARY_PATH ':' "${gcc46.gcc}/lib" \
+ --suffix PATH ':' "$out/share/inferno/Linux/386/bin"
+ makeWrapper $infernoWrapper $out/bin/inferno \
+ --suffix LD_LIBRARY_PATH ':' "${gcc46.gcc}/lib" \
+ --suffix PATH ':' "$out/share/inferno/Linux/386/bin" \
+ --set INFERNO_ROOT "$out/share/inferno"
+ '';
+
+ meta = {
+ description = "A compact distributed operating system for building cross-platform distributed systems";
+ homepage = "http://inferno-os.org/";
+ license = stdenv.lib.licenses.gpl2;
+ maintainers = [ "Chris Double " ];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/pkgs/applications/inferno/inferno b/pkgs/applications/inferno/inferno
new file mode 100755
index 00000000000..6eb6da8861a
--- /dev/null
+++ b/pkgs/applications/inferno/inferno
@@ -0,0 +1,31 @@
+#! /usr/bin/env bash
+
+
+export INFERNO_HOME="$HOME/.local/share/inferno"
+if [ -n "$XDG_DATA_HOME" ]
+ then export INFERNO_HOME="$XDG_DATA_HOME/inferno"
+fi
+
+if [ ! -d $INFERNO_HOME ]; then
+ mkdir -p $INFERNO_HOME
+fi
+
+if [ ! -d $INFERNO_HOME/tmp ]; then
+ mkdir -p $INFERNO_HOME/tmp
+fi
+
+for d in $INFERNO_HOME/{acme,appl,dis,lib,man,module,usr/inferno}; do
+ if [ ! -d $d ]; then
+ mkdir -p $d
+ cp --no-preserve=all -r $INFERNO_ROOT/${d#$INFERNO_HOME/}/* $d/
+ chmod -R +w $d
+ fi
+done
+
+if [ ! -d $INFERNO_HOME/usr/$USER ]; then
+ mkdir -p $INFERNO_HOME/usr/$USER
+ cp -r $INFERNO_ROOT/usr/inferno/* $INFERNO_HOME/usr/$USER/
+ chmod -R +w $INFERNO_HOME/usr/$USER
+fi
+
+exec emu "$@" /dis/sh.dis -c "bind -b -c '#U*$INFERNO_HOME/' /; /dis/sh.dis"
diff --git a/pkgs/applications/misc/abook/default.nix b/pkgs/applications/misc/abook/default.nix
index 3d187d92f5c..77e48e49dd8 100644
--- a/pkgs/applications/misc/abook/default.nix
+++ b/pkgs/applications/misc/abook/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = "http://abook.sourceforge.net/";
description = "Text-based addressbook program designed to use with mutt mail client";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.edwtjo ];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/misc/adobe-reader/default.nix b/pkgs/applications/misc/adobe-reader/default.nix
index 46ccdb39946..85bc89f7755 100644
--- a/pkgs/applications/misc/adobe-reader/default.nix
+++ b/pkgs/applications/misc/adobe-reader/default.nix
@@ -3,7 +3,7 @@
assert stdenv.system == "i686-linux";
-let version = "9.5.1"; in
+let version = "9.5.5"; in
stdenv.mkDerivation {
name = "adobe-reader-${version}-1";
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = "http://ardownload.adobe.com/pub/adobe/reader/unix/9.x/${version}/enu/AdbeRdr${version}-1_i486linux_enu.tar.bz2";
- sha256 = "19mwhbfsivb21zmrz2hllf0kh4i225ac697y026bakyysn0vig56";
+ sha256 = "0h35misxrqkl5zlmmvray1bqf4ywczkm89n9qw7d9arqbg3aj3pf";
};
# !!! Adobe Reader contains copies of OpenSSL, libcurl, and libicu.
@@ -25,6 +25,6 @@ stdenv.mkDerivation {
meta = {
description = "Adobe Reader, a viewer for PDF documents";
homepage = http://www.adobe.com/products/reader;
- license = "unfree";
+ license = stdenv.lib.licenses.unfree;
};
}
diff --git a/pkgs/applications/misc/arbtt/default.nix b/pkgs/applications/misc/arbtt/default.nix
index 92b8cb4f295..0c3939b5c25 100644
--- a/pkgs/applications/misc/arbtt/default.nix
+++ b/pkgs/applications/misc/arbtt/default.nix
@@ -1,21 +1,29 @@
-{ cabal, binary, bytestringProgress, deepseq, filepath
-, libXScrnSaver, parsec, pcreLight, strict, terminalProgressBar
-, time, transformers, utf8String, X11
+# This file was auto-generated by cabal2nix. Please do NOT edit manually!
+
+{ cabal, aeson, binary, bytestringProgress, deepseq, filepath
+, HUnit, libXScrnSaver, parsec, pcreLight, processExtras, strict
+, tasty, tastyGolden, tastyHunit, terminalProgressBar, time
+, transformers, utf8String, X11
}:
cabal.mkDerivation (self: {
pname = "arbtt";
- version = "0.7";
- sha256 = "05q31fsyrbkcx0mlf2r91zgmpma5sl2a7100h7qsa882sijc2ybn";
+ version = "0.8.1";
+ sha256 = "1qzmqjm8pfj59h0hrm28pp6qhzz2am5xq81mirnnchsgg52wrfn0";
isLibrary = false;
isExecutable = true;
buildDepends = [
- binary bytestringProgress deepseq filepath parsec pcreLight strict
- terminalProgressBar time transformers utf8String X11
+ aeson binary bytestringProgress deepseq filepath parsec pcreLight
+ strict terminalProgressBar time transformers utf8String X11
+ ];
+ testDepends = [
+ binary deepseq HUnit parsec pcreLight processExtras tasty
+ tastyGolden tastyHunit time transformers utf8String
];
extraLibraries = [ libXScrnSaver ];
+ jailbreak = true;
meta = {
- homepage = "http://www.joachim-breitner.de/projects#arbtt";
+ homepage = "http://arbtt.nomeata.de/";
description = "Automatic Rule-Based Time Tracker";
license = "GPL";
platforms = self.ghc.meta.platforms;
diff --git a/pkgs/applications/misc/audio/sox/default.nix b/pkgs/applications/misc/audio/sox/default.nix
index 50aa92f8d29..0663937c479 100644
--- a/pkgs/applications/misc/audio/sox/default.nix
+++ b/pkgs/applications/misc/audio/sox/default.nix
@@ -1,53 +1,33 @@
-{ composableDerivation, lib, fetchurl, alsaLib, libao, lame, libmad }:
+{ lib, stdenv, fetchurl
+, enableAlsa ? true, alsaLib ? null
+, enableLibao ? true, libao ? null
+, enableLame ? false, lame ? null
+, enableLibmad ? true, libmad ? null
+, enableLibogg ? true, libogg ? null, libvorbis ? null
+}:
-let inherit (composableDerivation) edf; in
+with stdenv.lib;
-composableDerivation.composableDerivation {} {
- name = "sox-14.3.0";
+stdenv.mkDerivation rec {
+ name = "sox-14.4.1";
src = fetchurl {
- url = mirror://sourceforge/sox/sox-14.3.0.tar.gz;
- sha256 = "15r39dq9nlwrypm0vpxmbxyqqv0bd6284djbi1fdfrlkjhf43gws";
+ url = "mirror://sourceforge/sox/${name}.tar.gz";
+ sha256 = "16x8gykfjdhxg0kdxwzcwgwpm5caa08y2mx18siqsq0ywmpjr34s";
};
- flags =
- # are these options of interest? We'll see
- #--disable-fftw disable usage of FFTW
- #--enable-debug enable debugging
- #--disable-cpu-clip disable tricky cpu specific clipper
- edf { name = "alsa"; enable = { buildInputs = [alsaLib]; }; }
- // edf { name = "libao"; enable = { buildInputs = [libao]; }; }
- // edf { name = "oss"; }
- // edf { name = "sun_audio"; }
- // edf { name = "dl-lame"; enable.buildInputs = [ lame ]; } # use shared library
- // edf { name = "lame"; enable.buildInputs = [ lame ]; }
- // edf { name = "dl-mad"; enable.buildInputs = [ libmad ]; } # use shared library
- // edf { name = "mad"; enable.buildInputs =[ libmad ]; }
- ;
-
- cfg = {
- ossSupport = false;
- sun_audioSupport = false;
- } // lib.listToAttrs
- [ { name = "dl-lameSupport"; value = true; }
- { name = "dl-madSupport"; value = true; }
- ];
-
- configureFlags = ["-enable-dl-lame"];
-
- optionals = [ "libsndfile" "libogg" "flac" "ffmpeg" "libmad" "lame"
- /* "amr-wb" "amr-nb" */
- "libsamplerate" /* "ladspa" */ ];
+ buildInputs =
+ optional (enableAlsa && stdenv.isLinux) alsaLib ++
+ optional enableLibao libao ++
+ optional enableLame lame ++
+ optional enableLibmad libmad ++
+ optionals enableLibogg [ libogg libvorbis ];
meta = {
description = "Sample Rate Converter for audio";
homepage = http://www.mega-nerd.com/SRC/index.html;
- maintainers = [lib.maintainers.marcweber];
- # you can choose one of the following licenses:
- license = [
- "GPL"
- # http://www.mega-nerd.com/SRC/libsamplerate-cul.pdf
- "libsamplerate Commercial Use License"
- ];
+ maintainers = [ lib.maintainers.marcweber lib.maintainers.shlevy ];
+ license = lib.licenses.gpl2Plus;
+ platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}
diff --git a/pkgs/applications/misc/audio/soxr/default.nix b/pkgs/applications/misc/audio/soxr/default.nix
index a8dd26ab609..73cdbb37616 100644
--- a/pkgs/applications/misc/audio/soxr/default.nix
+++ b/pkgs/applications/misc/audio/soxr/default.nix
@@ -15,6 +15,6 @@ stdenv.mkDerivation rec {
meta = {
description = "An audio resampling library";
homepage = http://soxr.sourceforge.net;
- license = "LGPLv2.1+";
+ license = stdenv.lib.licenses.lgpl21Plus;
};
}
diff --git a/pkgs/applications/misc/avrdudess/default.nix b/pkgs/applications/misc/avrdudess/default.nix
new file mode 100644
index 00000000000..64bca952ff5
--- /dev/null
+++ b/pkgs/applications/misc/avrdudess/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, unzip, mono, avrgcclibc, avrdude, gtk, xdg_utils }:
+
+stdenv.mkDerivation rec {
+ name = "avrdudess-2.2.20140102";
+
+ src = fetchurl {
+ url = "http://blog.zakkemble.co.uk/download/avrdudess_20140102.zip";
+ sha256 = "18llpvjsfhypzijrvfbzmcg3g141f307mzsrg11wcdxh9syxqak6";
+ };
+
+ buildInputs = [ unzip ];
+
+ phases = [ "buildPhase" ];
+
+ buildPhase = ''
+ mkdir -p "$out/avrdudess"
+ mkdir -p "$out/bin"
+
+ unzip "$src" -d "$out/avrdudess"
+
+ cat >> "$out/bin/avrdudess" << __EOF__
+ #!${stdenv.shell}
+ export LD_LIBRARY_PATH="${gtk}/lib:${mono}/lib"
+ # We need PATH from user env for xdg-open to find its tools, which
+ # typically depend on the currently running desktop environment.
+ export PATH="${avrgcclibc}/bin:${avrdude}/bin:${xdg_utils}/bin:\$PATH"
+
+ # avrdudess must have its resource files in its current working directory
+ cd $out/avrdudess && exec ${mono}/bin/mono "$out/avrdudess/avrdudess.exe" "\$@"
+ __EOF__
+
+ chmod a+x "$out/bin/"*
+ '';
+
+ meta = with stdenv.lib; {
+ description = "GUI for AVRDUDE (AVR microcontroller programmer)";
+ homepage = https://github.com/zkemble/AVRDUDESS;
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.bjornfor ];
+ };
+}
diff --git a/pkgs/applications/misc/bibletime/default.nix b/pkgs/applications/misc/bibletime/default.nix
index 36366d6ee72..41184d6e949 100644
--- a/pkgs/applications/misc/bibletime/default.nix
+++ b/pkgs/applications/misc/bibletime/default.nix
@@ -1,14 +1,14 @@
-{stdenv, fetchurl, cmake, sword, qt4, boost, cluceneCore}:
+{stdenv, fetchurl, cmake, sword, qt4, boost, clucene_core}:
stdenv.mkDerivation rec {
- version = "2.9.1";
+ version = "2.10.1";
name = "bibletime-${version}";
src = fetchurl {
- url = "mirror://sourceforge/bibletime/${name}.tar.bz2";
- sha256 = "1d8kh213rpx4d63sxl5mk1s94xv363l5prrq2kh06cpnl7a8d2ih";
+ url = "mirror://sourceforge/bibletime/${name}.tar.xz";
+ sha256 = "14fayy5h1ffjxin669q56fflxn4ij1irgn60cygwx2y02cwxbll6";
};
prePatch = ''
@@ -16,11 +16,11 @@ stdenv.mkDerivation rec {
'';
preConfigure = ''
- export CLUCENE_HOME=${cluceneCore};
+ export CLUCENE_HOME=${clucene_core};
export SWORD_HOME=${sword};
'';
- buildInputs = [ cmake sword qt4 boost cluceneCore ];
+ buildInputs = [ cmake sword qt4 boost clucene_core ];
cmakeFlags = "-DUSE_QT_WEBKIT=ON -DCMAKE_BUILD_TYPE=Debug";
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
description = "A Qt4 Bible study tool";
homepage = http://www.bibletime.info/;
platforms = stdenv.lib.platforms.linux;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.piotr ];
};
}
diff --git a/pkgs/applications/misc/bitcoin/default.nix b/pkgs/applications/misc/bitcoin/default.nix
index a6a289168c4..e38d427be8d 100644
--- a/pkgs/applications/misc/bitcoin/default.nix
+++ b/pkgs/applications/misc/bitcoin/default.nix
@@ -1,26 +1,39 @@
-{ fetchurl, stdenv, openssl, db4, boost, zlib, miniupnpc, qt4 }:
+{ fetchurl, stdenv, openssl, db48, boost, zlib, miniupnpc, qt4, utillinux
+, pkgconfig, protobuf, qrencode }:
stdenv.mkDerivation rec {
- version = "0.8.5";
+ version = "0.9.2.1";
name = "bitcoin-${version}";
src = fetchurl {
- url = "mirror://sourceforge/bitcoin/${name}-linux.tar.gz";
- sha256 = "0qqzwx1lihlrj7r08alsyznjfqvwncfm0nnxi1pcx0jyvq83ym44";
+ url = "https://bitcoin.org/bin/${version}/${name}-linux.tar.gz";
+ sha256 = "0060f7d38b98113ab912d4c184000291d7f026eaf77ca5830deec15059678f54";
};
- buildInputs = [ openssl db4 boost zlib miniupnpc qt4 ];
+ # hexdump from utillinux is required for tests
+ buildInputs = [
+ openssl db48 boost zlib miniupnpc qt4 utillinux pkgconfig protobuf qrencode
+ ];
- configurePhase = ''
- cd src
- qmake
+ unpackPhase = ''
+ mkdir tmp-extract && (cd tmp-extract && tar xf $src)
+ tar xf tmp-extract/bitcoin*/src/bitcoin*.tar*
+ cd bitcoin*
'';
- installPhase = ''
- mkdir -p $out/bin
- cp bitcoin-qt $out/bin
+ configureFlags = [
+ "--with-boost=${boost}"
+ ];
+
+ preCheck = ''
+ # At least one test requires writing in $HOME
+ HOME=$TMPDIR
'';
+ doCheck = true;
+
+ enableParallelBuilding = true;
+
meta = {
description = "Bitcoin is a peer-to-peer currency";
longDescription= ''
@@ -31,6 +44,6 @@ stdenv.mkDerivation rec {
'';
homepage = "http://www.bitcoin.org/";
maintainers = [ stdenv.lib.maintainers.roconnor ];
- license = "MIT";
+ license = stdenv.lib.licenses.mit;
};
}
diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix
index 0951340ee94..24a3fcd4cea 100644
--- a/pkgs/applications/misc/blender/default.nix
+++ b/pkgs/applications/misc/blender/default.nix
@@ -1,45 +1,60 @@
-{ stdenv, fetchurl, SDL, boost, cmake, ffmpeg, gettext, glew
-, ilmbase, jackaudio, libXi, libjpeg, libpng, libsamplerate, libsndfile
+{ stdenv, lib, fetchurl, fetchpatch, SDL, boost, cmake, ffmpeg, gettext, glew
+, ilmbase, libXi, libjpeg, libpng, libsamplerate, libsndfile
, libtiff, mesa, openal, opencolorio, openexr, openimageio, openjpeg, python
-, zlib
+, zlib, fftw
+, jackaudioSupport ? false, jack2
+, cudaSupport ? false, cudatoolkit6
}:
+with lib;
+
stdenv.mkDerivation rec {
- name = "blender-2.67";
+ name = "blender-2.71";
src = fetchurl {
url = "http://download.blender.org/source/${name}.tar.gz";
- sha256 = "066lwrm85455gs187bxr3jhqidc2f6f0791b4216jkagbszd9a8l";
+ sha256 = "12aqdrpl86xjk2xdwj2nbfcmdzyv61n443gw6j2japffm1kmlz8x";
};
- buildInputs = [
- SDL boost cmake ffmpeg gettext glew ilmbase jackaudio libXi
- libjpeg libpng libsamplerate libsndfile libtiff mesa openal
- opencolorio openexr openimageio openjpeg python zlib
- ];
+ buildInputs =
+ [ SDL boost cmake ffmpeg gettext glew ilmbase libXi
+ libjpeg libpng libsamplerate libsndfile libtiff mesa openal
+ opencolorio openexr openimageio /* openjpeg */ python zlib fftw
+ ]
+ ++ optional jackaudioSupport jack2
+ ++ optional cudaSupport cudatoolkit6;
+ postUnpack =
+ ''
+ substituteInPlace */doc/manpage/blender.1.py --replace /usr/bin/python ${python}/bin/python3
+ '';
- cmakeFlags = [
- "-DOPENEXR_INC=${openexr}/include/OpenEXR"
- "-DWITH_OPENCOLLADA=OFF"
- "-DWITH_CODEC_FFMPEG=ON"
- "-DWITH_CODEC_SNDFILE=ON"
- "-DWITH_JACK=ON"
- "-DWITH_INSTALL_PORTABLE=OFF"
- "-DPYTHON_LIBRARY=python${python.majorVersion}m"
- "-DPYTHON_LIBPATH=${python}/lib"
- "-DPYTHON_INCLUDE_DIR=${python}/include/python${python.majorVersion}m"
- ];
+ cmakeFlags =
+ [ "-DOPENEXR_INC=${openexr}/include/OpenEXR"
+ "-DWITH_OPENCOLLADA=OFF"
+ "-DWITH_MOD_OCEANSIM=ON"
+ "-DWITH_CODEC_FFMPEG=ON"
+ "-DWITH_CODEC_SNDFILE=ON"
+ "-DWITH_INSTALL_PORTABLE=OFF"
+ "-DPYTHON_LIBRARY=python${python.majorVersion}m"
+ "-DPYTHON_LIBPATH=${python}/lib"
+ "-DPYTHON_INCLUDE_DIR=${python}/include/python${python.majorVersion}m"
+ "-DPYTHON_VERSION=${python.majorVersion}"
+ ]
+ ++ optional jackaudioSupport "-DWITH_JACK=ON"
+ ++ optional cudaSupport "-DWITH_CYCLES_CUDA_BINARIES=ON";
NIX_CFLAGS_COMPILE = "-I${ilmbase}/include/OpenEXR -I${python}/include/${python.libPrefix}m";
enableParallelBuilding = true;
- meta = {
+ meta = with stdenv.lib; {
description = "3D Creation/Animation/Publishing System";
homepage = http://www.blender.org;
# They comment two licenses: GPLv2 and Blender License, but they
# say: "We've decided to cancel the BL offering for an indefinite period."
- license = "GPLv2+";
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.goibhniu ];
};
}
diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix
index 10d92e4d517..3d814bf6a30 100644
--- a/pkgs/applications/misc/calibre/default.nix
+++ b/pkgs/applications/misc/calibre/default.nix
@@ -4,11 +4,11 @@
}:
stdenv.mkDerivation rec {
- name = "calibre-1.8.0";
+ name = "calibre-1.48.0";
src = fetchurl {
url = "mirror://sourceforge/calibre/${name}.tar.xz";
- sha256 = "0awh24n5bvypmiylngmz0w0126yz1jxlrjfy9b4w5aflg7vgr0qq";
+ sha256 = "0wplmf3p4s5zwn9ri8ry18bx7k3pw1c1ngrc4msf7i8icq7hj177";
};
inherit python;
diff --git a/pkgs/applications/misc/camlistore/default.nix b/pkgs/applications/misc/camlistore/default.nix
new file mode 100644
index 00000000000..56131425ab4
--- /dev/null
+++ b/pkgs/applications/misc/camlistore/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, lib, go, fetchurl }:
+
+stdenv.mkDerivation rec {
+ version = "0.7";
+ name = "camlistore-${version}";
+
+ src = fetchurl {
+ url = "https://github.com/bradfitz/camlistore/archive/0.7.tar.gz";
+ sha256 = "0lc35x2b9llrnma0m5czivly0c3l4lh3ldw9hwn83lkh8n0bzn11";
+ };
+
+ buildInputs = [ go ];
+
+ buildPhase = ''
+ go run make.go
+ rm bin/README
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp bin/* $out/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Camlistore is a way of storing, syncing, sharing, modelling and backing up content";
+ homepage = https://camlistore.org;
+ license = licenses.asl20;
+ maintainers = with maintainers; [ cstrahan ];
+ platforms = platforms.unix;
+ };
+}
diff --git a/pkgs/applications/misc/cdrtools/default.nix b/pkgs/applications/misc/cdrtools/default.nix
index 94af2ee58f5..d1b3b284052 100644
--- a/pkgs/applications/misc/cdrtools/default.nix
+++ b/pkgs/applications/misc/cdrtools/default.nix
@@ -1,10 +1,10 @@
{stdenv, fetchurl}:
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
name = "cdrtools-2.01";
-
- configurePhase = "prefix=$out";
-
+
+ configurePhase = "prefix=$out";
+
#hack, I'm getting "chown: invalid user: `bin" error, so replace chown by a nop dummy script
preInstall = ''
mkdir "$TMP/bin"
@@ -14,16 +14,18 @@ stdenv.mkDerivation {
PATH="$TMP/bin:$PATH"
done
'';
-
+
src = fetchurl {
- url = ftp://ftp.berlios.de/pub/cdrecord/cdrtools-2.01.tar.bz2;
+ url = "mirror://sourceforge/cdrtools/${name}.tar.bz2";
md5 = "d44a81460e97ae02931c31188fe8d3fd";
};
-
+
patches = [./cdrtools-2.01-install.patch];
meta = {
- description = "Highly portable CD/DVD/BluRay command line recording software (deprecated; use cdrkit instead)";
- homepage = http://cdrecord.berlios.de/old/private/cdrecord.html;
+ homepage = http://sourceforge.net/projects/cdrtools/;
+ description = "Highly portable CD/DVD/BluRay command line recording software";
+ broken = true; # Build errors, probably because the source
+ # can't deal with recent versions of gcc.
};
}
diff --git a/pkgs/applications/misc/cgminer/default.nix b/pkgs/applications/misc/cgminer/default.nix
index 4ae404a002f..3247cb609fa 100644
--- a/pkgs/applications/misc/cgminer/default.nix
+++ b/pkgs/applications/misc/cgminer/default.nix
@@ -1,19 +1,22 @@
-{ fetchgit, stdenv, pkgconfig, libtool, autoconf, automake,
- curl, ncurses, amdappsdk, amdadlsdk, xorg }:
+{ fetchgit, stdenv, pkgconfig, libtool, autoconf, automake
+, curl, ncurses, amdappsdk, amdadlsdk, xorg, jansson }:
stdenv.mkDerivation rec {
- version = "2.11.4";
+ version = "3.7.2";
name = "cgminer-${version}";
src = fetchgit {
url = "https://github.com/ckolivas/cgminer.git";
- rev = "96c8ff5f10f2d8f0cf4d1bd889e8eeac2e4aa715";
- sha256 = "1vf9agy4vw50cap03qig2y65hdrsdy7cknkzyagv89w5xb230r9a";
+ rev = "refs/tags/v3.7.2";
+ sha256 = "0hl71328l19rlclajb6k9xsqybm2ln8g44p788gijpw4laj9yli6";
};
- buildInputs = [ autoconf automake pkgconfig libtool curl ncurses amdappsdk amdadlsdk xorg.libX11 xorg.libXext xorg.libXinerama ];
+ buildInputs = [
+ autoconf automake pkgconfig libtool curl ncurses amdappsdk amdadlsdk
+ xorg.libX11 xorg.libXext xorg.libXinerama jansson
+ ];
configureScript = "./autogen.sh";
- configureFlags = "--enable-scrypt";
+ configureFlags = "--enable-scrypt --enable-opencl";
NIX_LDFLAGS = "-lgcc_s -lX11 -lXext -lXinerama";
preConfigure = ''
@@ -21,7 +24,7 @@ stdenv.mkDerivation rec {
'';
postBuild = ''
- gcc api-example.c -I compat/jansson -o cgminer-api
+ gcc api-example.c -o cgminer-api
'';
postInstall = ''
@@ -39,6 +42,7 @@ stdenv.mkDerivation rec {
homepage = "https://github.com/ckolivas/cgminer";
license = licenses.gpl3;
maintainers = [ maintainers.offline ];
- platforms = [ "i686-linux" "x86_64-linux" ];
+ platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = [];
};
}
diff --git a/pkgs/applications/misc/cura/default.nix b/pkgs/applications/misc/cura/default.nix
new file mode 100644
index 00000000000..937025c0840
--- /dev/null
+++ b/pkgs/applications/misc/cura/default.nix
@@ -0,0 +1,71 @@
+{ stdenv, python27Packages, curaengine, makeDesktopItem, fetchgit }:
+let
+ py = python27Packages;
+in
+stdenv.mkDerivation rec {
+ name = "cura";
+
+ src = fetchgit {
+ url = "https://github.com/daid/Cura";
+ rev = "58414695269d60ca9b165e8cbc3424933ed79403";
+ sha256 = "1nxrrz8sjjx9i9cyvz15vay6yarnywp3vlk7qzr65sw88lzxgq23";
+ fetchSubmodules = false;
+ };
+
+ desktopItem = makeDesktopItem {
+ name = "Cura";
+ exec = "cura";
+ icon = "cura";
+ comment = "Cura";
+ desktopName = "Cura";
+ genericName = "3D printing host software";
+ categories = "GNOME;GTK;Utility;";
+ };
+
+ python_deps = [ py.pyopengl py.pyserial py.numpy py.wxPython30 py.power py.setuptools ];
+
+ pythonPath = python_deps;
+
+ propagatedBuildInputs = python_deps;
+
+ buildInputs = [ curaengine py.wrapPython ];
+
+ configurePhase = "";
+ buildPhase = "";
+
+ installPhase = ''
+ # Install Python code.
+ site_packages=$out/lib/python2.7/site-packages
+ mkdir -p $site_packages
+ cp -r Cura $site_packages/
+
+ # Install resources.
+ resources=$out/share/cura
+ mkdir -p $resources
+ cp -r resources/* $resources/
+ sed -i 's|os.path.join(os.path.dirname(__file__), "../../resources")|"'$resources'"|g' $site_packages/Cura/util/resources.py
+
+ # Install executable.
+ mkdir -p $out/bin
+ cp Cura/cura.py $out/bin/cura
+ chmod +x $out/bin/cura
+ sed -i 's|#!/usr/bin/python|#!/usr/bin/env python|' $out/bin/cura
+ wrapPythonPrograms
+
+ # Make it find CuraEngine.
+ echo "def getEngineFilename(): return '${curaengine}/bin/CuraEngine'" >> $site_packages/Cura/util/sliceEngine.py
+
+ # Install desktop item.
+ mkdir -p "$out"/share/applications
+ cp "$desktopItem"/share/applications/* "$out"/share/applications/
+ mkdir -p "$out"/share/icons
+ ln -s "$resources/images/c.png" "$out"/share/icons/cura.png
+ '';
+
+ meta = with stdenv.lib; {
+ description = "3D printing host software";
+ homepage = https://github.com/daid/Cura;
+ license = licenses.agpl3;
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/misc/curaengine/default.nix b/pkgs/applications/misc/curaengine/default.nix
new file mode 100644
index 00000000000..256d337f679
--- /dev/null
+++ b/pkgs/applications/misc/curaengine/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchgit }:
+stdenv.mkDerivation {
+ name = "curaengine";
+
+ src = fetchgit {
+ url = "https://github.com/Ultimaker/CuraEngine";
+ rev = "62667ff2e7479b55d75e3d1dc9136242adf4a6a0";
+ sha256 = "0c68xmnq4c49vzg2cyqb375kc72rcnghj21wp3919w8sfwil00vr";
+ };
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp CuraEngine $out/bin/
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Engine for processing 3D models into 3D printing instructions";
+ homepage = https://github.com/Ultimaker/CuraEngine;
+ license = licenses.agpl3;
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/misc/d4x/default.nix b/pkgs/applications/misc/d4x/default.nix
index 4eb4c441c99..d6ca3939d13 100644
--- a/pkgs/applications/misc/d4x/default.nix
+++ b/pkgs/applications/misc/d4x/default.nix
@@ -19,6 +19,6 @@ stdenv.mkDerivation {
meta = {
description = "Graphical download manager";
homepage = http://www.krasu.ru/soft/chuchelo/;
- license = "Artistic";
+ license = "perl";
};
}
diff --git a/pkgs/applications/misc/dmenu/default.nix b/pkgs/applications/misc/dmenu/default.nix
index 048514ad4aa..1ba3ee5268f 100644
--- a/pkgs/applications/misc/dmenu/default.nix
+++ b/pkgs/applications/misc/dmenu/default.nix
@@ -19,14 +19,17 @@ stdenv.mkDerivation rec {
patches = optional enableXft xftPatch;
+ postPatch = ''
+ sed -ri -e 's!\<(dmenu|stest)\>!'"$out/bin"'/&!g' dmenu_run
+ '';
+
preConfigure = [ ''sed -i "s@PREFIX = /usr/local@PREFIX = $out@g" config.mk'' ];
meta = {
description = "a generic, highly customizable, and efficient menu for the X Window System";
homepage = http://tools.suckless.org/dmenu;
- license = "MIT";
+ license = stdenv.lib.licenses.mit;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; all;
};
}
-
diff --git a/pkgs/applications/misc/dunst/default.nix b/pkgs/applications/misc/dunst/default.nix
index cb594e494db..039b4ac688b 100644
--- a/pkgs/applications/misc/dunst/default.nix
+++ b/pkgs/applications/misc/dunst/default.nix
@@ -1,18 +1,15 @@
-{ stdenv, fetchgit, coreutils , unzip, which, pkgconfig , dbus
+{ stdenv, fetchurl, coreutils , unzip, which, pkgconfig , dbus
, freetype, xdg_utils , libXext, glib, pango , cairo, libX11, libnotify
, libxdg_basedir , libXScrnSaver, xproto, libXinerama , perl, gdk_pixbuf
}:
stdenv.mkDerivation rec {
- rev = "6a3a855b48a3db64821d1cf8a91c5ee2815a2b2d";
- name = "dunst-${rev}";
+ name = "dunst-1.1.0";
+ version = "1.1.0";
- # 1.0.0 release doesn't include 100% CPU fix
- # https://github.com/knopwob/dunst/issues/98
- src = fetchgit {
- inherit rev;
- url = "https://github.com/knopwob/dunst.git";
- sha256 = "0m7yki16d72xm9n2m2fjszd8phqpn5b95q894cz75pmd0sv1j6bj";
+ src = fetchurl {
+ url = "https://github.com/knopwob/dunst/archive/v${version}.tar.gz";
+ sha256 = "0x95f57s0a96c4lifxdpf73v706iggwmdw8742mabbjnxq55l1qs";
};
patchPhase = ''
@@ -26,7 +23,7 @@ stdenv.mkDerivation rec {
libXScrnSaver xproto libXinerama perl];
buildPhase = ''
- export VERSION=${rev};
+ export VERSION=${version};
export PREFIX=$out;
make dunst;
'';
diff --git a/pkgs/applications/misc/electrum/default.nix b/pkgs/applications/misc/electrum/default.nix
new file mode 100644
index 00000000000..c35a2c7ff82
--- /dev/null
+++ b/pkgs/applications/misc/electrum/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, pythonPackages, slowaes, ecdsa, pyqt4 }:
+
+pythonPackages.buildPythonPackage rec {
+ name = "electrum-${version}";
+ version = "1.9.8";
+
+ src = fetchurl {
+ url = "https://download.electrum.org/Electrum-${version}.tar.gz";
+ sha256 = "8fc144a32013e4a747fea27fff981762a6b9e14cde9ffb405c4c721975d846ff";
+ };
+
+ buildInputs = [ slowaes ecdsa ];
+
+ propagatedBuildInputs = [
+ slowaes
+ ecdsa
+ pyqt4
+ ];
+
+ postPatch = ''
+ mkdir -p $out/share
+ sed -i 's@usr_share = .*@usr_share = os.getenv("out")+"/share"@' setup.py
+ '';
+
+ meta = {
+ description = "Bitcoin thin-wallet";
+ long-description = "Electrum is an easy to use Bitcoin client. It protects you from losing coins in a backup mistake or computer failure, because your wallet can be recovered from a secret phrase that you can write on paper or learn by heart. There is no waiting time when you start the client, because it does not download the Bitcoin blockchain.";
+ homepage = "https://electrum.org";
+ license = stdenv.lib.licenses.gpl3;
+ maintainers = [ "emery@vfemail.net" ];
+ };
+}
\ No newline at end of file
diff --git a/pkgs/applications/misc/epdfview/default.nix b/pkgs/applications/misc/epdfview/default.nix
index 6941e8df626..d79162289c3 100644
--- a/pkgs/applications/misc/epdfview/default.nix
+++ b/pkgs/applications/misc/epdfview/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
GTK+ libraries. The aim of ePDFView is to make a simple PDF document
viewer, in the lines of Evince but without using the Gnome libraries.
'';
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = with stdenv.lib.maintainers; [ astsmtl ];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/misc/evopedia/default.nix b/pkgs/applications/misc/evopedia/default.nix
index b070b629282..5ad82c9239c 100644
--- a/pkgs/applications/misc/evopedia/default.nix
+++ b/pkgs/applications/misc/evopedia/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Offline Wikipedia Viewer";
homepage = http://www.evopedia.info;
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/misc/evtest/default.nix b/pkgs/applications/misc/evtest/default.nix
index 635775e75ac..638f254364e 100644
--- a/pkgs/applications/misc/evtest/default.nix
+++ b/pkgs/applications/misc/evtest/default.nix
@@ -15,8 +15,8 @@ stdenv.mkDerivation rec {
meta = with stdenv.lib; {
description = "Simple tool for input event debugging";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
platforms = platforms.linux;
- maintainers = [maintainers.bjornfor];
+ maintainers = [ maintainers.bjornfor ];
};
}
diff --git a/pkgs/applications/misc/fbreader/default.nix b/pkgs/applications/misc/fbreader/default.nix
index fa361308ff1..2b193ef42cd 100644
--- a/pkgs/applications/misc/fbreader/default.nix
+++ b/pkgs/applications/misc/fbreader/default.nix
@@ -25,10 +25,11 @@ stdenv.mkDerivation {
--replace "/usr/share" "$out/share"
'';
- meta = {
+ meta = with stdenv.lib; {
description = "An e-book reader for Linux";
homepage = http://www.fbreader.org/;
- license = "GPL";
- maintainer = [ stdenv.lib.maintainers.coroa ];
+ license = licenses.gpl3;
+ platforms = platforms.linux; # possibly also on unix general
+ maintainers = [ maintainers.coroa ];
};
}
diff --git a/pkgs/applications/misc/fetchmail/default.nix b/pkgs/applications/misc/fetchmail/default.nix
index 79d27eea848..57d677395b4 100644
--- a/pkgs/applications/misc/fetchmail/default.nix
+++ b/pkgs/applications/misc/fetchmail/default.nix
@@ -1,14 +1,14 @@
{ stdenv, fetchurl, openssl }:
let
- version = "6.3.20";
+ version = "6.3.26";
in
stdenv.mkDerivation {
name="fetchmail-${version}";
src = fetchurl {
- url = "http://download.berlios.de/fetchmail/fetchmail-${version}.tar.bz2";
- sha256 = "22e94f11d885cb9330a197fd80217d44f65e6b087e4d4b4d83e573adfc24aa7b";
+ url = "mirror://sourceforge/fetchmail.berlios/fetchmail-${version}.tar.bz2";
+ sha256 = "08rafrs1dlr11myr0p99kg4k80qyy0fa63gg3ac88zn49174lwhw";
};
buildInputs = [ openssl ];
diff --git a/pkgs/applications/misc/finalterm/default.nix b/pkgs/applications/misc/finalterm/default.nix
new file mode 100644
index 00000000000..0c084f9d018
--- /dev/null
+++ b/pkgs/applications/misc/finalterm/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, lib, fetchFromGitHub, makeWrapper
+, pkgconfig, cmake, libxml2, vala, intltool, libmx, gnome3, gtk3, gtk_doc
+, keybinder3, clutter_gtk, libnotify
+, libxkbcommon, xlibs, udev
+, bashInteractive
+}:
+
+let rev = "5ccde4e8f2c02a398f9172e07c25262ecf954626";
+in stdenv.mkDerivation {
+ name = "finalterm-git-${builtins.substring 0 8 rev}";
+
+ src = fetchFromGitHub {
+ owner = "p-e-w";
+ repo = "finalterm";
+ inherit rev;
+ sha256 = "1gw6nc19whfjd4xj0lc0fmjypn8d7nasif79671859ymnfizyq4f";
+ };
+
+ buildInputs = [
+ pkgconfig cmake vala intltool gtk3 gnome3.gnome_common gnome3.libgee
+ gtk_doc clutter_gtk libmx keybinder3 libxml2 libnotify makeWrapper
+ xlibs.libpthreadstubs xlibs.libXdmcp xlibs.libxshmfence
+ libxkbcommon
+ ] ++ lib.optionals stdenv.isLinux [
+ udev
+ ];
+
+ preConfigure = ''
+ substituteInPlace data/org.gnome.finalterm.gschema.xml \
+ --replace "/bin/bash" "${bashInteractive}/bin/bash"
+
+ cmakeFlagsArray=(
+ -DMINIMAL_FLAGS=ON
+ )
+ '';
+
+ postFixup = ''
+ wrapProgram "$out/bin/finalterm" \
+ --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
+ --prefix GIO_EXTRA_MODULES : "${gnome3.dconf}/lib/gio/modules" \
+ --prefix XDG_DATA_DIRS : "${gnome3.gnome_icon_theme}/share:${gnome3.gtk}/share:$out/share:$GSETTINGS_SCHEMAS_PATH"
+ '';
+
+ meta = with lib; {
+ homepage = "http://finalterm.org";
+ description = "A new breed of terminal emulator";
+ longDescription = ''
+ Final Term is a new breed of terminal emulator.
+
+ It goes beyond mere emulation and understands what is happening inside the shell it is hosting. This allows it to offer features no other terminal can, including:
+
+ - Semantic text menus
+ - Smart command completion
+ - GUI terminal controls
+ '';
+ license = licenses.gpl3Plus;
+ maintainers = with maintainers; [ cstrahan ];
+ platforms = with platforms; linux;
+ };
+}
diff --git a/pkgs/applications/misc/freicoin/default.nix b/pkgs/applications/misc/freicoin/default.nix
index d5ed057f56b..65265fc07a5 100644
--- a/pkgs/applications/misc/freicoin/default.nix
+++ b/pkgs/applications/misc/freicoin/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, db4, boost, gmp, mpfr, miniupnpc, qt4, unzip }:
+{ fetchurl, stdenv, db, boost, gmp, mpfr, miniupnpc, qt4, unzip }:
stdenv.mkDerivation rec {
version = "0.8.3-1";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
# I think that openssl and zlib are required, but come through other
# packages
- buildInputs = [ db4 boost gmp mpfr miniupnpc qt4 unzip ];
+ buildInputs = [ db boost gmp mpfr miniupnpc qt4 unzip ];
configurePhase = "qmake";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Peer-to-peer currency with demurrage fee";
homepage = "http://freicoi.in/";
- license = "MIT";
+ license = stdenv.lib.licenses.mit;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/misc/galculator/default.nix b/pkgs/applications/misc/galculator/default.nix
new file mode 100644
index 00000000000..010f75a575e
--- /dev/null
+++ b/pkgs/applications/misc/galculator/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl
+, intltool, pkgconfig, gtk
+ }:
+
+stdenv.mkDerivation rec {
+
+ name = "galculator-${version}";
+ version = "2.1.3";
+
+ src = fetchurl {
+ url = "http://downloads.sourceforge.net/galculator/${name}.tar.gz";
+ sha256 = "12m7dldjk10lpkdxk7zpk98n32ci65zmxidghihb7n1m3rhp3q17";
+ };
+
+ buildInputs = [ intltool pkgconfig gtk ];
+
+ meta = {
+ description = "A GTK 2/3 algebraic and RPN calculator";
+ longDescription = ''
+ galculator is a GTK 2 / GTK 3 based calculator. Its main features include:
+
+ - Algebraic, RPN (Reverse Polish Notation), Formula Entry and Paper modes;
+ - Basic and Scientific Modes
+ - Decimal, hexadecimal, octal and binary number base
+ - Radiant, degree and grad support
+ - User defined constants and functions
+ - A bunch of common functions
+ - Binary arithmetic of configurable bit length and signedness
+ - Quad-precision floating point arithmetic, and 112-bit binary arithmetic
+ '';
+ homepage = http://galculator.sourceforge.net/;
+ license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = [ stdenv.lib.maintainers.AndersonTorres ];
+ };
+}
diff --git a/pkgs/applications/misc/gammu/bashcomp-dir.patch b/pkgs/applications/misc/gammu/bashcomp-dir.patch
new file mode 100644
index 00000000000..94cc2929c1e
--- /dev/null
+++ b/pkgs/applications/misc/gammu/bashcomp-dir.patch
@@ -0,0 +1,12 @@
+diff -Naur gammu-1.33.0.orig/contrib/CMakeLists.txt gammu-1.33.0/contrib/CMakeLists.txt
+--- gammu-1.33.0.orig/contrib/CMakeLists.txt 2013-12-26 20:56:22.887772110 +0100
++++ gammu-1.33.0/contrib/CMakeLists.txt 2013-12-26 20:57:04.386276037 +0100
+@@ -85,7 +85,7 @@
+ if (INSTALL_BASH_COMPLETION)
+ install (
+ FILES bash-completion/gammu
+- DESTINATION "/etc/bash_completion.d"
++ DESTINATION "${CMAKE_INSTALL_PREFIX}/etc/bash_completion.d"
+ COMPONENT "bash"
+ )
+ endif (INSTALL_BASH_COMPLETION)
diff --git a/pkgs/applications/misc/gammu/default.nix b/pkgs/applications/misc/gammu/default.nix
new file mode 100644
index 00000000000..56e45b11c70
--- /dev/null
+++ b/pkgs/applications/misc/gammu/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, python, pkgconfig, cmake, bluez, libusb1, curl
+, libiconv, gettext, sqlite }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+ name = "gammu-${version}";
+ version = "1.33.0";
+
+ src = fetchurl {
+ url = "http://sourceforge.net/projects/gammu/files/gammu/${version}/gammu-${version}.tar.xz";
+ sha256 = "18gplx1v9d70k1q86d5i4n4dfpx367g34pj3zscppx126vwhv112";
+ };
+
+ patches = [ ./bashcomp-dir.patch ];
+
+ buildInputs = [ python pkgconfig cmake bluez libusb1 curl libiconv
+ gettext sqlite ];
+
+ enableParallelBuilding = true;
+
+ meta = {
+ homepage = "http://wammu.eu/gammu/";
+ description = "Command line utility and library to control mobil phones";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.coroa ];
+ };
+}
diff --git a/pkgs/applications/misc/get_iplayer/default.nix b/pkgs/applications/misc/get_iplayer/default.nix
index 308b181fe88..08fad5a021d 100644
--- a/pkgs/applications/misc/get_iplayer/default.nix
+++ b/pkgs/applications/misc/get_iplayer/default.nix
@@ -1,6 +1,6 @@
{stdenv, fetchurl, flvstreamer, ffmpeg, makeWrapper, perl, buildPerlPackage, perlPackages, vlc, rtmpdump}:
buildPerlPackage {
- name = "get_iplayer-2.83";
+ name = "get_iplayer-2.86";
buildInputs = [makeWrapper perl];
propagatedBuildInputs = with perlPackages; [HTMLParser HTTPCookies LWP];
@@ -12,12 +12,12 @@ buildPerlPackage {
mkdir -p $out/bin
cp get_iplayer $out/bin
sed -i 's|^update_script|#update_script|' $out/bin/get_iplayer
- wrapProgram $out/bin/get_iplayer --suffix PATH : ${ffmpeg}/bin:${flvstreamer}/bin:${vlc}/bin:${rtmpdump}/bin
+ wrapProgram $out/bin/get_iplayer --suffix PATH : ${ffmpeg}/bin:${flvstreamer}/bin:${vlc}/bin:${rtmpdump}/bin --prefix PERL5LIB : $PERL5LIB
'';
src = fetchurl {
- url = ftp://ftp.infradead.org/pub/get_iplayer/get_iplayer-2.83.tar.gz;
- sha256 = "169zji0rr3z5ng6r4cyzvs89779m4iklln9gsqpryvm81ipalfga";
+ url = ftp://ftp.infradead.org/pub/get_iplayer/get_iplayer-2.86.tar.gz;
+ sha256 = "0zhcw0ikxrrz1jayx7jjgxmdf7gzk4pmzfvpraxmv64xwzgc1sc1";
};
}
diff --git a/pkgs/applications/misc/girara/default.nix b/pkgs/applications/misc/girara/default.nix
index e112427126a..b25d347ec87 100644
--- a/pkgs/applications/misc/girara/default.nix
+++ b/pkgs/applications/misc/girara/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, pkgconfig, gtk, gettext }:
stdenv.mkDerivation rec {
- name = "girara-0.1.5";
+ name = "girara-0.2.2";
src = fetchurl {
url = "http://pwmt.org/projects/girara/download/${name}.tar.gz";
- sha256 = "1hfi3jmx8ydvrqm3h6p6py2csavh7xx0223vxyca51kjl9mfnbld";
+ sha256 = "0lv6wqhx2avdxj6yx111jfs4j32r0xzmmkhy7pgzxpf73kgxz0k3";
};
buildInputs = [ pkgconfig gtk gettext ];
diff --git a/pkgs/applications/misc/gkrellm/default.nix b/pkgs/applications/misc/gkrellm/default.nix
index af10ca9800d..81f74847c2f 100644
--- a/pkgs/applications/misc/gkrellm/default.nix
+++ b/pkgs/applications/misc/gkrellm/default.nix
@@ -1,10 +1,10 @@
{ fetchurl, stdenv, gettext, pkgconfig, glib, gtk, libX11, libSM, libICE }:
stdenv.mkDerivation rec {
- name = "gkrellm-2.3.4";
+ name = "gkrellm-2.3.5";
src = fetchurl {
url = "http://members.dslextreme.com/users/billw/gkrellm/${name}.tar.bz2";
- sha256 = "0mjg2pxpiqms7d6dvxzxvpa420cakhpjxvrclhq0y8jd2dlv2irl";
+ sha256 = "12rc6zaa7kb60b9744lbrlfkxxfniprm6x0mispv63h4kh75navh";
};
buildInputs = [gettext pkgconfig glib gtk libX11 libSM libICE];
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
'';
homepage = http://members.dslextreme.com/users/billw/gkrellm/gkrellm.html;
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.unix;
diff --git a/pkgs/applications/misc/gksu/default.nix b/pkgs/applications/misc/gksu/default.nix
new file mode 100644
index 00000000000..61fd44925b7
--- /dev/null
+++ b/pkgs/applications/misc/gksu/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, pkgconfig, makeWrapper, gtk, gnome3, libgksu,
+ intltool, libstartup_notification, gtk_doc
+}:
+
+stdenv.mkDerivation rec {
+ version = "2.0.2";
+ pname = "gksu";
+ name = "${pname}-${version}";
+
+ src = fetchurl {
+ url = "http://people.debian.org/~kov/gksu/${name}.tar.gz";
+ sha256 = "0npfanlh28daapkg25q4fncxd89rjhvid5fwzjaw324x0g53vpm1";
+ };
+
+ patches = [
+ # https://savannah.nongnu.org/bugs/index.php?36127
+ ./gksu-2.0.2-glib-2.31.patch
+ ];
+
+ postPatch = ''
+ sed -i -e 's|/usr/bin/x-terminal-emulator|-l gnome-terminal|g' gksu.desktop
+ '';
+
+ configureFlags = "--disable-nautilus-extension";
+
+ buildInputs = [
+ pkgconfig makeWrapper gtk gnome3.gconf intltool
+ libstartup_notification gnome3.libgnome_keyring gtk_doc
+ ];
+
+ propagatedBuildInputs = [
+ libgksu
+ ];
+
+ meta = {
+ description = "A graphical frontend for libgksu";
+ longDescription = ''
+ GKSu is a library that provides a Gtk+ frontend to su and sudo.
+ It supports login shells and preserving environment when acting as
+ a su frontend. It is useful to menu items or other graphical
+ programs that need to ask a user's password to run another program
+ as another user.
+ '';
+ homepage = "http://www.nongnu.org/gksu/";
+ license = stdenv.lib.licenses.gpl2;
+ maintainers = [ stdenv.lib.maintainers.romildo ];
+ };
+}
diff --git a/pkgs/applications/misc/gksu/gksu-2.0.2-glib-2.31.patch b/pkgs/applications/misc/gksu/gksu-2.0.2-glib-2.31.patch
new file mode 100644
index 00000000000..fd711a321ac
--- /dev/null
+++ b/pkgs/applications/misc/gksu/gksu-2.0.2-glib-2.31.patch
@@ -0,0 +1,29 @@
+From 10c7e67e11a56e2fe1acf9b085772bc995d35bc0 Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev
+Date: Sat, 7 Apr 2012 17:57:36 -0400
+Subject: [PATCH] Fix glib includes for building with >=glib-2.31
+
+glib-2.31 and newer no longer allow most glib subheaders to be included
+directly.
+
+https://savannah.nongnu.org/bugs/index.php?36127
+---
+ nautilus-gksu/libnautilus-gksu.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/nautilus-gksu/libnautilus-gksu.c b/nautilus-gksu/libnautilus-gksu.c
+index 8e44d29..4acf3f8 100644
+--- a/nautilus-gksu/libnautilus-gksu.c
++++ b/nautilus-gksu/libnautilus-gksu.c
+@@ -5,7 +5,7 @@
+ #include
+ #include
+
+-#include
++#include
+ #include
+ #include
+ #include
+--
+1.7.8.5
+
diff --git a/pkgs/applications/misc/gnome_terminator/default.nix b/pkgs/applications/misc/gnome_terminator/default.nix
deleted file mode 100644
index b394719611d..00000000000
--- a/pkgs/applications/misc/gnome_terminator/default.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{ stdenv, fetchurl, python, pygtk, vte, gettext, intltool, makeWrapper }:
-
-stdenv.mkDerivation rec {
- name = "gnome-terminator-0.96";
-
- src = fetchurl {
- url = "https://launchpad.net/terminator/trunk/0.96/+download/terminator_0.96.tar.gz";
- sha256 = "d708c783c36233fcafbd0139a91462478ae40f5cf696ef4acfcaf5891a843201";
- };
-
- buildInputs =
- [ python pygtk vte gettext intltool makeWrapper
- ];
-
- phases = "unpackPhase installPhase";
-
- installPhase = ''
- python setup.py --without-icon-cache install --prefix=$out
- for i in $(cd $out/bin && ls); do
- wrapProgram $out/bin/$i \
- --prefix PYTHONPATH : "$(toPythonPath $out):$PYTHONPATH"
- done
- '';
-
- meta = {
- description = "Gnome terminal emulator with support for tiling and tabs";
- homepage = http://www.tenshu.net/p/terminator.html;
- license = "GPLv2";
- };
-}
diff --git a/pkgs/applications/misc/gnuradio-osmosdr/default.nix b/pkgs/applications/misc/gnuradio-osmosdr/default.nix
new file mode 100644
index 00000000000..2e9d74c2441
--- /dev/null
+++ b/pkgs/applications/misc/gnuradio-osmosdr/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchgit, cmake, pkgconfig, boost, gnuradio, rtl-sdr, uhd
+, makeWrapper
+, pythonSupport ? true, python, swig
+}:
+
+assert pythonSupport -> python != null && swig != null;
+
+stdenv.mkDerivation rec {
+ name = "gnuradio-osmosdr-${version}";
+ version = "0.1.0";
+
+ src = fetchgit {
+ url = "git://git.osmocom.org/gr-osmosdr";
+ rev = "refs/tags/v${version}";
+ sha256 = "112zfvnr6fjvhdc06ihi2sb0dp441qy7jq8rvr81nbyv3r8jspj4";
+ };
+
+ buildInputs = [
+ cmake pkgconfig boost gnuradio rtl-sdr uhd makeWrapper
+ ] ++ stdenv.lib.optionals pythonSupport [ python swig ];
+
+ postInstall = ''
+ for prog in "$out"/bin/*; do
+ wrapProgram "$prog" --set PYTHONPATH $PYTHONPATH:$(toPythonPath "$out")
+ done
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Gnuradio block for OsmoSDR and rtl-sdr";
+ homepage = http://sdr.osmocom.org/trac/wiki/GrOsmoSDR;
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.bjornfor ];
+ };
+}
diff --git a/pkgs/applications/misc/gnuradio/default.nix b/pkgs/applications/misc/gnuradio/default.nix
new file mode 100644
index 00000000000..1a0dea586d0
--- /dev/null
+++ b/pkgs/applications/misc/gnuradio/default.nix
@@ -0,0 +1,77 @@
+{ stdenv, fetchurl
+# core dependencies
+, cmake, pkgconfig, git, boost, cppunit, fftw
+# python wrappers
+, python, swig2, numpy, scipy, matplotlib
+# grc - the gnu radio companion
+, cheetahTemplate, pygtk
+# gr-wavelet: collection of wavelet blocks
+, gsl
+# gr-qtgui: the Qt-based GUI
+, qt4, qwt, pyqt4 #, pyqwt
+# gr-wxgui: the Wx-based GUI
+, wxPython, lxml
+# gr-audio: audio subsystems (system/OS dependent)
+, alsaLib
+# uhd: the Ettus USRP Hardware Driver Interface
+, uhd
+# gr-video-sdl: PAL and NTSC display
+, SDL
+, libusb1, orc, pyopengl
+, makeWrapper
+}:
+
+stdenv.mkDerivation rec {
+ name = "gnuradio-${version}";
+ version = "3.7.3";
+
+ src = fetchurl {
+ url = "http://gnuradio.org/releases/gnuradio/${name}.tar.gz";
+ sha256 = "0caj7dqppav53nhn0ima106hpsn0sakw57v1ihac9fk7ka0x2w8w";
+ };
+
+ buildInputs = [
+ cmake pkgconfig git boost cppunit fftw python swig2 orc lxml qt4 qwt
+ alsaLib SDL libusb1 uhd gsl makeWrapper
+ ];
+
+ propagatedBuildInputs = [
+ cheetahTemplate numpy scipy matplotlib pyqt4 pygtk wxPython pyopengl
+ ];
+
+ preConfigure = ''
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Wno-unused-variable"
+ '';
+
+ # - Ensure we get an interactive backend for matplotlib. If not the gr_plot_*
+ # programs will not display anything. Yes, $MATPLOTLIBRC must point to the
+ # *dirname* where matplotlibrc is located, not the file itself.
+ # - GNU Radio core is C++ but the user interface (GUI and API) is Python, so
+ # we must wrap the stuff in bin/.
+ postInstall = ''
+ printf "backend : Qt4Agg\n" > "$out/share/gnuradio/matplotlibrc"
+
+ for file in "$out"/bin/* "$out"/share/gnuradio/examples/*/*.py; do
+ wrapProgram "$file" \
+ --prefix PYTHONPATH : $PYTHONPATH:$(toPythonPath "$out") \
+ --set MATPLOTLIBRC "$out/share/gnuradio"
+ done
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Software Defined Radio (SDR) software";
+ longDescription = ''
+ GNU Radio is a free & open-source software development toolkit that
+ provides signal processing blocks to implement software radios. It can be
+ used with readily-available low-cost external RF hardware to create
+ software-defined radios, or without hardware in a simulation-like
+ environment. It is widely used in hobbyist, academic and commercial
+ environments to support both wireless communications research and
+ real-world radio systems.
+ '';
+ homepage = http://www.gnuradio.org;
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.bjornfor ];
+ };
+}
diff --git a/pkgs/applications/misc/goldendict/default.nix b/pkgs/applications/misc/goldendict/default.nix
index f7b8a511bc6..717d0a012a2 100644
--- a/pkgs/applications/misc/goldendict/default.nix
+++ b/pkgs/applications/misc/goldendict/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
cd ${name}-src
tar xf ${src}
'';
- patches = [ ./goldendict-paths.diff ];
+ patches = [ ./goldendict-paths.diff ./gcc47.patch ];
patchFlags = "-p 0";
configurePhase = ''
qmake
diff --git a/pkgs/applications/misc/goldendict/gcc47.patch b/pkgs/applications/misc/goldendict/gcc47.patch
new file mode 100644
index 00000000000..311dad4f648
--- /dev/null
+++ b/pkgs/applications/misc/goldendict/gcc47.patch
@@ -0,0 +1,40 @@
+From b00d081da20b9a6b257573c6b23a6bc640c4dab1 Mon Sep 17 00:00:00 2001
+From: Michael Palimaka
+Date: Fri, 20 Jul 2012 03:27:38 +1000
+Subject: [PATCH] Fix build with GCC 4.7 by adding missing includes.
+
+---
+ processwrapper.cc | 4 ++++
+ qtsingleapplication/src/qtlocalpeer.cpp | 1 +
+ 2 files changed, 5 insertions(+)
+
+diff --git processwrapper.cc processwrapper.cc
+index f7f3f19..86b985d 100644
+--- processwrapper.cc
++++ processwrapper.cc
+@@ -2,6 +2,10 @@
+
+ #include
+
++#if defined(Q_OS_UNIX)
++#include
++#endif
++
+ #ifdef Q_OS_WIN32
+
+ #include
+diff --git qtsingleapplication/src/qtlocalpeer.cpp qtsingleapplication/src/qtlocalpeer.cpp
+index 382d182..506c142 100644
+--- qtsingleapplication/src/qtlocalpeer.cpp
++++ qtsingleapplication/src/qtlocalpeer.cpp
+@@ -50,6 +50,7 @@ static PProcessIdToSessionId pProcessIdToSessionId = 0;
+ #endif
+ #if defined(Q_OS_UNIX)
+ #include
++#include
+ #endif
+
+ namespace QtLP_Private {
+--
+1.7.11.1
+
diff --git a/pkgs/applications/misc/googleearth/default.nix b/pkgs/applications/misc/googleearth/default.nix
index 08b868bca92..ea577beb592 100644
--- a/pkgs/applications/misc/googleearth/default.nix
+++ b/pkgs/applications/misc/googleearth/default.nix
@@ -71,7 +71,7 @@ stdenv.mkDerivation {
meta = {
description = "A world sphere viewer";
homepage = http://earth.google.com;
- license = "unfree";
+ license = stdenv.lib.licenses.unfree;
maintainers = [ stdenv.lib.maintainers.viric ];
};
}
diff --git a/pkgs/applications/misc/gphoto2/default.nix b/pkgs/applications/misc/gphoto2/default.nix
index cba54bf8013..7ff253fd4e8 100644
--- a/pkgs/applications/misc/gphoto2/default.nix
+++ b/pkgs/applications/misc/gphoto2/default.nix
@@ -3,11 +3,11 @@
}:
stdenv.mkDerivation rec {
- name = "gphoto2-2.5.2";
+ name = "gphoto2-2.5.3";
src = fetchurl {
url = "mirror://sourceforge/gphoto/${name}.tar.bz2";
- sha256 = "16c8k1cxfypg7v5h8xi87grclw7a5ayaamn548ys3zkj727r5fcf";
+ sha256 = "0i6qjyvgn3aaspiblmiwv51mfy92gm73xpbd3z41ki8mw7plg53i";
};
nativeBuildInputs = [ pkgconfig gettext ];
diff --git a/pkgs/applications/misc/gpsbabel/default.nix b/pkgs/applications/misc/gpsbabel/default.nix
index 29d5b1ee7cc..bf44f91056d 100644
--- a/pkgs/applications/misc/gpsbabel/default.nix
+++ b/pkgs/applications/misc/gpsbabel/default.nix
@@ -50,7 +50,7 @@ stdenv.mkDerivation {
homepage = http://www.gpsbabel.org/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.gnu; # arbitrary choice
diff --git a/pkgs/applications/misc/gpscorrelate/default.nix b/pkgs/applications/misc/gpscorrelate/default.nix
index 141476a6b40..9a59329871e 100644
--- a/pkgs/applications/misc/gpscorrelate/default.nix
+++ b/pkgs/applications/misc/gpscorrelate/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
one takes the GPS data in a different format.
'';
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
homepage = http://freefoote.dview.net/linux_gpscorr.html;
};
diff --git a/pkgs/applications/misc/gqrx/default.nix b/pkgs/applications/misc/gqrx/default.nix
new file mode 100644
index 00000000000..a5208107750
--- /dev/null
+++ b/pkgs/applications/misc/gqrx/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, qt4, gnuradio, boost, gnuradio-osmosdr
+# drivers (optional):
+, rtl-sdr
+, pulseaudioSupport ? true, pulseaudio
+}:
+
+assert pulseaudioSupport -> pulseaudio != null;
+
+stdenv.mkDerivation rec {
+ name = "gqrx-${version}";
+ version = "2.2.0";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/project/gqrx/${version}/${name}-src.tar.gz";
+ sha256 = "15ncx2shh43skph7sj3jvmkls9cbbbysld49c8xd23fhdsxanj9x";
+ };
+
+ buildInputs = [
+ qt4 gnuradio boost gnuradio-osmosdr rtl-sdr
+ ] ++ stdenv.lib.optionals pulseaudioSupport [ pulseaudio ];
+
+ configurePhase = ''qmake PREFIX="$out"'';
+
+ meta = with stdenv.lib; {
+ description = "Software defined radio (SDR) receiver";
+ longDescription = ''
+ Gqrx is a software defined radio receiver powered by GNU Radio and the Qt
+ GUI toolkit. It can process I/Q data from many types of input devices,
+ including Funcube Dongle Pro/Pro+, rtl-sdr, HackRF, and Universal
+ Software Radio Peripheral (USRP) devices.
+ '';
+ homepage = http://gqrx.dk/;
+ # Some of the code comes from the Cutesdr project, with a BSD license, but
+ # it's currently unknown which version of the BSD license that is.
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux; # should work on Darwin / OS X too
+ maintainers = [ maintainers.bjornfor ];
+ };
+}
diff --git a/pkgs/applications/misc/grip/default.nix b/pkgs/applications/misc/grip/default.nix
index 0c2b957bc7c..39621536e68 100644
--- a/pkgs/applications/misc/grip/default.nix
+++ b/pkgs/applications/misc/grip/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
meta = {
description = "GTK+-based audio CD player/ripper";
homepage = "http://nostatic.org/grip";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.marcweber stdenv.lib.maintainers.simons ];
platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/applications/misc/gv/default.nix b/pkgs/applications/misc/gv/default.nix
index efd9cf263e7..4867bef1f71 100644
--- a/pkgs/applications/misc/gv/default.nix
+++ b/pkgs/applications/misc/gv/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
interface for the Ghostscript interpreter.
'';
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
maintainers = [ ];
platforms = stdenv.lib.platforms.gnu; # arbitrary choice
};
diff --git a/pkgs/applications/misc/hello/ex-2/default.nix b/pkgs/applications/misc/hello/ex-2/default.nix
index 80a3fb702c0..71c9777ff9b 100644
--- a/pkgs/applications/misc/hello/ex-2/default.nix
+++ b/pkgs/applications/misc/hello/ex-2/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl }:
stdenv.mkDerivation rec {
- name = "hello-2.8";
+ name = "hello-2.9";
src = fetchurl {
url = "mirror://gnu/hello/${name}.tar.gz";
- sha256 = "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6";
+ sha256 = "19qy37gkasc4csb1d3bdiz9snn8mir2p3aj0jgzmfv0r2hi7mfzc";
};
doCheck = true;
@@ -17,8 +17,7 @@ stdenv.mkDerivation rec {
It is fully customizable.
'';
homepage = http://www.gnu.org/software/hello/manual/;
- license = "GPLv3+";
-
+ license = stdenv.lib.licenses.gpl3Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.all;
};
diff --git a/pkgs/applications/misc/htmldoc/default.nix b/pkgs/applications/misc/htmldoc/default.nix
index befa8d25210..e8274418ae1 100644
--- a/pkgs/applications/misc/htmldoc/default.nix
+++ b/pkgs/applications/misc/htmldoc/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://www.htmldoc.org/;
description = "Converts HTML files to indexed HTML, PS or PDF";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = with stdenv.lib.maintainers; [ viric ];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/misc/ikiwiki/default.nix b/pkgs/applications/misc/ikiwiki/default.nix
index baf97e7a824..fab492d5c09 100644
--- a/pkgs/applications/misc/ikiwiki/default.nix
+++ b/pkgs/applications/misc/ikiwiki/default.nix
@@ -23,7 +23,7 @@ assert mercurialSupport -> (mercurial != null);
let
name = "ikiwiki";
- version = "3.20130518";
+ version = "3.20140227";
lib = stdenv.lib;
in
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = "http://ftp.de.debian.org/debian/pool/main/i/ikiwiki/${name}_${version}.tar.gz";
- sha256 = "00mmxxlbzv6bz3cz3746r5lqwby6liwsg7m3jfba8258y52w13qp";
+ sha256 = "1bbpqs4c1la1yqcxcxj3xip3wadjnjq0wawv19j6d6baymm66cr3";
};
buildInputs = [ perl TextMarkdown URI HTMLParser HTMLScrubber HTMLTemplate
@@ -83,7 +83,7 @@ stdenv.mkDerivation {
meta = {
description = "Wiki compiler, storing pages and history in a RCS";
homepage = "http://ikiwiki.info/";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = stdenv.lib.platforms.linux;
maintainers = [ stdenv.lib.maintainers.simons ];
diff --git a/pkgs/applications/misc/jigdo/default.nix b/pkgs/applications/misc/jigdo/default.nix
index 6ceca2ea871..d722367d1b4 100644
--- a/pkgs/applications/misc/jigdo/default.nix
+++ b/pkgs/applications/misc/jigdo/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl, db45, gtk, bzip2 }:
+{ stdenv, fetchurl, db, gtk, bzip2 }:
stdenv.mkDerivation {
name = "jigdo-0.7.3";
- # Debian sources
+ # Debian sources
src = fetchurl {
url = http://ftp.de.debian.org/debian/pool/main/j/jigdo/jigdo_0.7.3.orig.tar.gz;
sha256 = "1qvqzgzb0dzq82fa1ffs6hyij655rajnfwkljk1y0mnkygnha1xv";
@@ -13,14 +13,14 @@ stdenv.mkDerivation {
url = http://ftp.de.debian.org/debian/pool/main/j/jigdo/jigdo_0.7.3-2.diff.gz;
sha256 = "0jnlzm9m2hjlnw0zs2fv456ml5r2jj2q1lncqbrgg52lq18f6fa3";
};
-
- buildInputs = [ db45 gtk bzip2 ];
+
+ buildInputs = [ db gtk bzip2 ];
configureFlags = "--without-libdb";
- meta = {
+ meta = {
description = "Download utility that can fetch files from several sources simultaneously";
homepage = http://atterer.net/jigdo/;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/applications/misc/kde-wacomtablet/default.nix b/pkgs/applications/misc/kde-wacomtablet/default.nix
index 22587a1bae0..ee93f57eafc 100644
--- a/pkgs/applications/misc/kde-wacomtablet/default.nix
+++ b/pkgs/applications/misc/kde-wacomtablet/default.nix
@@ -1,14 +1,14 @@
-{ stdenv, fetchurl, kdelibs, gettext }:
+{ stdenv, fetchurl, kdelibs, gettext, xf86_input_wacom }:
stdenv.mkDerivation rec {
- name = "wacomtablet-1.3.5";
+ name = "wacomtablet-2.0.2";
src = fetchurl {
- url = "http://kde-apps.org/CONTENT/content-files/114856-wacomtablet-v1.3.5.tar.bz2";
- sha256 = "0dgsp3izx2v44f6j8mhxc6zybjn5sj9038w6b4v2fgix47fri0ja";
+ url = "http://kde-apps.org/CONTENT/content-files/114856-wacomtablet-2.0.2.tar.xz";
+ sha256 = "13k5f5xpka5cbgl24a3j9khqcmp96x1vhynn9v558ag6dg9ch2hw";
};
- buildInputs = [ kdelibs ];
+ buildInputs = [ kdelibs xf86_input_wacom ];
nativeBuildInputs = [ gettext ];
diff --git a/pkgs/applications/misc/kdeconnect/default.nix b/pkgs/applications/misc/kdeconnect/default.nix
new file mode 100644
index 00000000000..663ce872e22
--- /dev/null
+++ b/pkgs/applications/misc/kdeconnect/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, gettext, kdelibs, libXtst, makeWrapper, qca2, qca2_ossl, qjson }:
+
+stdenv.mkDerivation rec {
+ name = "kdeconnect-${version}";
+ version = "0.7.2";
+
+ src = fetchurl {
+ url = "http://download.kde.org/unstable/kdeconnect/${version}/src/kdeconnect-kde-${version}.tar.xz";
+ sha256 = "1v7sicgy39n8pn7nzq9f7lkmwbcvavhy3b66agyhxwmyzz6mcd4g";
+ };
+
+ buildInputs = [ gettext kdelibs libXtst makeWrapper qca2 qca2_ossl qjson ];
+
+ postInstall = ''
+ wrapProgram $out/lib/kde4/libexec/kdeconnectd --prefix QT_PLUGIN_PATH : ${qca2_ossl}/lib/qt4/plugins
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A tool to connect and sync your devices with KDE";
+ longDescription = ''
+ The corresponding Android app, "KDE Connect", is available in
+ F-Droid and Google play and has the following features:
+
+ - Share files and URLs to KDE from any app
+ - Clipboard share: copy from or to your desktop
+ - Notifications sync (4.3+): Read your Android notifications from KDE
+ - Multimedia remote control: Use your phone as a remote control
+ - WiFi connection: no usb wire or bluetooth needed
+ - RSA Encryption: your information is safe
+ '';
+ license = licenses.gpl2;
+ homepage = https://projects.kde.org/projects/playground/base/kdeconnect-kde;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.goibhniu ];
+ };
+}
diff --git a/pkgs/applications/misc/keepass/default.nix b/pkgs/applications/misc/keepass/default.nix
index 0098e626b42..89f794850d2 100644
--- a/pkgs/applications/misc/keepass/default.nix
+++ b/pkgs/applications/misc/keepass/default.nix
@@ -24,12 +24,12 @@ stdenv.mkDerivation rec {
installPhase = ''
- ensureDir "$out/bin"
+ mkdir -p "$out/bin"
echo "${mono}/bin/mono $out/KeePass.exe" > $out/bin/keepass
chmod +x $out/bin/keepass
echo $out
cp -r ./* $out/
- ensureDir "$out/share/applications"
+ mkdir -p "$out/share/applications"
cp ${desktopItem}/share/applications/* $out/share/applications
'';
diff --git a/pkgs/applications/misc/keepassx/2.0.nix b/pkgs/applications/misc/keepassx/2.0.nix
new file mode 100644
index 00000000000..1a79af7cb57
--- /dev/null
+++ b/pkgs/applications/misc/keepassx/2.0.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, cmake, libgcrypt, qt4, xlibs, ... }:
+
+stdenv.mkDerivation {
+ name = "keepassx2-2.0alpha5";
+ src = fetchurl {
+ url = "https://github.com/keepassx/keepassx/archive/2.0-alpha5.tar.gz";
+ sha256 = "1vxj306zhrr38mvsy3vpjlg6d0xwlcvsi3l69nhhwzkccsc4smfm";
+ };
+
+ buildInputs = [ cmake libgcrypt qt4 xlibs.libXtst ];
+
+ meta = {
+ description = "Qt password manager compatible with its Win32 and Pocket PC versions";
+ homepage = http://www.keepassx.org/;
+ license = stdenv.lib.licenses.gpl2;
+ maintainers = with stdenv.lib.maintainers; [qknight];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/pkgs/applications/misc/keepassx/default.nix b/pkgs/applications/misc/keepassx/default.nix
index 375a1ae2419..fc089f4fa5b 100644
--- a/pkgs/applications/misc/keepassx/default.nix
+++ b/pkgs/applications/misc/keepassx/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
qmake PREFIX=$out
'';
+ patches = [ ./random.patch ];
+
buildInputs = [ bzip2 qt4 libX11 xextproto libXtst ];
meta = {
diff --git a/pkgs/applications/misc/keepassx/random.patch b/pkgs/applications/misc/keepassx/random.patch
new file mode 100644
index 00000000000..0a0b26f6e8c
--- /dev/null
+++ b/pkgs/applications/misc/keepassx/random.patch
@@ -0,0 +1,13 @@
+--- a/src/lib/random.cpp 2014-01-21 21:15:55.829312723 +0000
++++ b/src/lib/random.cpp 2014-01-21 21:16:36.752535839 +0000
+@@ -28,6 +28,10 @@
+ #include
+ #include
+ #endif
++#ifndef Q_WS_WIN
++ #include
++ #include
++#endif
+
+ #include
+ #include
diff --git a/pkgs/applications/misc/krename/default.nix b/pkgs/applications/misc/krename/default.nix
index e5af706d41c..75d8e5ecb89 100644
--- a/pkgs/applications/misc/krename/default.nix
+++ b/pkgs/applications/misc/krename/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, cmake, automoc4, kdelibs, taglib, exiv2, podofo, gettext, qt4, phonon }:
stdenv.mkDerivation rec {
- name = "krename-4.0.4";
+ name = "krename-4.0.9";
src = fetchurl {
url = "mirror://sourceforge/krename/${name}.tar.bz2";
- sha256 = "12qhclw1vbg5bv6619qd4408y8d1w26499gcr8gwhgfzk0v83hic";
+ sha256 = "11bdg5vdcs393n0aibhm3jh3wxlk5kz78jhkwf7cj9086qkg9wds";
};
buildInputs = [ cmake automoc4 kdelibs taglib exiv2 podofo gettext qt4 phonon ];
diff --git a/pkgs/applications/misc/krusader/default.nix b/pkgs/applications/misc/krusader/default.nix
index bd86501c30e..83c21da0e54 100644
--- a/pkgs/applications/misc/krusader/default.nix
+++ b/pkgs/applications/misc/krusader/default.nix
@@ -7,6 +7,7 @@ stdenv.mkDerivation rec {
sha256 = "1q1m4cjzz2m41pdpxnwrsiczc7990785b700lv64midjjgjnr7j6";
};
buildInputs = [ gettext kdelibs kde_baseapps ];
+ NIX_CFLAGS_COMPILE = "-fpermissive"; # fix build with newer gcc versions
meta = {
description = "Norton/Total Commander clone for KDE";
license = "GPL";
diff --git a/pkgs/applications/misc/librecad/2.0.nix b/pkgs/applications/misc/librecad/2.0.nix
index 2394d116314..8b7a9a40c87 100644
--- a/pkgs/applications/misc/librecad/2.0.nix
+++ b/pkgs/applications/misc/librecad/2.0.nix
@@ -1,12 +1,12 @@
-{ stdenv, fetchurl, qt4, muparser, which, boost}:
+{ stdenv, fetchurl, qt4, muparser, which, boost, pkgconfig }:
stdenv.mkDerivation {
- name = "librecad-2.0.0beta1";
+ name = "librecad-2.0.2";
src = fetchurl {
- url = https://github.com/LibreCAD/LibreCAD/tarball/2.0.0beta1;
- name = "librecad-2.0.0beta1.tar.gz";
- sha256 = "8bf969b79be115f3b3ff72cc030a4c21fe93164dd0cb19ddfb78a7d66b8bc770";
+ url = https://github.com/LibreCAD/LibreCAD/tarball/2.0.2;
+ name = "librecad-2.0.2.tar.gz";
+ sha256 = "0a5rs1h4n74d4bnrj91ij6y6wzc8d6nbrg9lfwjx8icjjl6hqikm";
};
patchPhase = ''
@@ -19,19 +19,21 @@ stdenv.mkDerivation {
'';
installPhase = ''
- ensureDir $out/bin $out/share
+ mkdir -p $out/bin $out/share
cp -R unix/librecad $out/bin
cp -R unix/resources $out/share/librecad
'';
buildInputs = [ qt4 muparser which boost ];
+ nativeBuildInputs = [ pkgconfig ];
enableParallelBuilding = true;
meta = {
description = "A 2D CAD package based upon Qt";
homepage = http://librecad.org;
- license = "GPLv2";
+ repositories.git = git://github.com/LibreCAD/LibreCAD.git;
+ license = stdenv.lib.licenses.gpl2;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/misc/librecad/default.nix b/pkgs/applications/misc/librecad/default.nix
index 59bd4888e4a..b2960e9f47d 100644
--- a/pkgs/applications/misc/librecad/default.nix
+++ b/pkgs/applications/misc/librecad/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchurl, qt4, muparser, which}:
stdenv.mkDerivation {
- name = "librecad-1.0.2";
+ name = "librecad-1.0.4";
src = fetchurl {
- url = https://github.com/LibreCAD/LibreCAD/tarball/v1.0.2;
- name = "librecad-1.0.2.tar.gz";
- sha256 = "13ee7e401e4f5fbc68c2e017b7189bec788038f4f6e77f559861ceb8cfb1907d";
+ url = https://github.com/LibreCAD/LibreCAD/tarball/v1.0.4;
+ name = "librecad-1.0.4.tar.gz";
+ sha256 = "00nzbijw7pn1zkj4256da501xcm6rkcvycpa79y6dr2p6c43yc6m";
};
patchPhase = ''
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
configurePhase = "qmake PREFIX=$out";
installPhase = ''
- ensureDir $out/bin $out/share
+ mkdir -p $out/bin $out/share
cp -R unix/librecad $out/bin
cp -R unix/resources $out/share/librecad
'';
@@ -27,7 +27,7 @@ stdenv.mkDerivation {
meta = {
description = "A 2D CAD package based upon Qt";
homepage = http://librecad.org;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/misc/llpp/default.nix b/pkgs/applications/misc/llpp/default.nix
new file mode 100644
index 00000000000..e04898fba29
--- /dev/null
+++ b/pkgs/applications/misc/llpp/default.nix
@@ -0,0 +1,75 @@
+{ stdenv, fetchgit, ocaml, mupdf, lablgl, mesa
+, libX11, libXext, gtk3, freetype, zlib, openjpeg
+, jbig2dec, libjpeg, ncurses }:
+
+stdenv.mkDerivation {
+ name = "llpp-2014-05-26";
+
+ src = fetchgit {
+ url = "git://repo.or.cz/llpp.git";
+ rev = "902143de64d86b5714b3a59d2cc7085083b87249";
+ sha256 = "038xl4gbvm57na2lz1fw36sf43zaxq407zi2d53985vc33677j9s";
+ };
+
+ buildInputs = [ ocaml mupdf lablgl mesa libX11 libXext gtk3
+ freetype jbig2dec libjpeg openjpeg zlib ncurses ];
+
+ # The build phase was extracted from buildall.sh, because that script
+ # fetched the dependencies on its own.
+ buildPhase = ''
+ ccopt="-O"
+ ccopt="$ccopt -I ${jbig2dec}/include"
+ ccopt="$ccopt -I ${libjpeg}/include"
+ ccopt="$ccopt -I ${freetype}/include/freetype2"
+ ccopt="$ccopt -I ${openjpeg}/include"
+ ccopt="$ccopt -I ${zlib}/include"
+ ccopt="$ccopt -I ${mupdf}/include"
+ ccopt="$ccopt -include ft2build.h"
+ ccopt="$ccopt -D_GNU_SOURCE"
+
+ cclib="$cclib -lmupdf"
+ cclib="$cclib -lz -ljpeg -lopenjp2 -ljbig2dec -lfreetype -lpthread"
+ cclib="$cclib -lX11"
+ cclib="$cclib -lfreetype"
+
+ comp=ocamlc.opt
+ cmsuf=cmo
+
+ sh mkhelp.sh keystoml.ml KEYS > help.ml
+
+ $comp -c -o link.o -ccopt "$ccopt" link.c
+ $comp -c -o help.$cmsuf help.ml
+ $comp -c -o utils.$cmsuf utils.ml
+ $comp -c -o wsi.cmi wsi.mli
+ $comp -c -o wsi.$cmsuf wsi.ml
+ $comp -c -o parser.$cmsuf parser.ml
+ $comp -c -o main.$cmsuf -I ${lablgl}/lib/ocaml/4.01.0/site-lib/lablgl main.ml
+
+ $comp -custom -o llpp \
+ -I ${lablgl}/lib/ocaml/4.01.0/site-lib/lablgl \
+ str.cma unix.cma lablgl.cma \
+ link.o \
+ -cclib "$cclib" \
+ help.cmo \
+ utils.cmo \
+ parser.cmo \
+ wsi.cmo \
+ main.cmo
+ '';
+
+ # Binary fails with 'No bytecode file specified.' if stripped.
+ dontStrip = true;
+
+ installPhase = ''
+ install -d $out/bin
+ install llpp llppac $out/bin
+ '';
+
+ meta = {
+ homepage = http://repo.or.cz/w/llpp.git;
+ description = "A MuPDF based PDF pager written in OCaml";
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.pSub ];
+ license = "GPL";
+ };
+}
diff --git a/pkgs/applications/misc/lxappearance/default.nix b/pkgs/applications/misc/lxappearance/default.nix
new file mode 100644
index 00000000000..9295eaabf32
--- /dev/null
+++ b/pkgs/applications/misc/lxappearance/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl, intltool, pkgconfig, libX11, gtk }:
+
+stdenv.mkDerivation rec {
+ name = "lxappearance-0.5.5";
+ src = fetchurl{
+ url = "http://downloads.sourceforge.net/project/lxde/LXAppearance/${name}.tar.xz";
+ sha256 = "8cae82e6425ba8a0267774e4d10096df2d91b0597520058331684a5ece068b4c";
+ };
+ buildInputs = [ intltool libX11 pkgconfig gtk ];
+ meta = {
+ description = "A lightweight program for configuring the theme and fonts of gtk applications";
+ maintainers = [ stdenv.lib.maintainers.hinton ];
+ platforms = stdenv.lib.platforms.all;
+ license = stdenv.lib.licenses.gpl2;
+ homepage = "http://lxappearance.sourceforce.net/";
+ };
+}
diff --git a/pkgs/applications/misc/lyx/default.nix b/pkgs/applications/misc/lyx/default.nix
index fd2e7c3ac42..da7be68be54 100644
--- a/pkgs/applications/misc/lyx/default.nix
+++ b/pkgs/applications/misc/lyx/default.nix
@@ -1,14 +1,14 @@
-{ fetchurl, stdenv, texLive, python, makeWrapper, pkgconfig
-, libX11, qt4, enchant #, mythes, boost
+{ fetchurl, stdenv, pkgconfig, python, file, bc
+, qt4, hunspell, makeWrapper #, mythes, boost
}:
stdenv.mkDerivation rec {
- version = "2.0.6";
+ version = "2.1.1";
name = "lyx-${version}";
src = fetchurl {
- url = "ftp://ftp.lyx.org/pub/lyx/stable/2.0.x/${name}.tar.xz";
- sha256 = "1llah9d9ymvdk8asmqslcwnicycxrwb27k8si184n5bfxvnjpjx5";
+ url = "ftp://ftp.lyx.org/pub/lyx/stable/2.1.x/${name}.tar.xz";
+ sha256 = "1fir1dzzy7c92jf3a3psnd10c6widslk0852xk4svpl6phcg4nya";
};
configureFlags = [
@@ -18,18 +18,29 @@ stdenv.mkDerivation rec {
#"--without-included-mythes" # such a small library isn't worth a separate package
];
+ # LaTeX is used from $PATH, as people often want to have it with extra pkgs
buildInputs = [
- texLive qt4 python makeWrapper pkgconfig
- enchant # mythes boost
+ pkgconfig qt4 python file/*for libmagic*/ bc
+ hunspell makeWrapper # enchant
];
+ enableParallelBuilding = true;
doCheck = true;
- meta = {
+ # python is run during runtime to do various tasks
+ postFixup = ''
+ sed '1s:/usr/bin/python:${python}/bin/python:'
+
+ wrapProgram "$out/bin/lyx" \
+ --prefix PATH : '${python}/bin'
+ '';
+
+ meta = with stdenv.lib; {
description = "WYSIWYM frontend for LaTeX, DocBook";
homepage = "http://www.lyx.org";
- license = "GPL2";
- maintainers = [ stdenv.lib.maintainers.vcunat ];
- platforms = stdenv.lib.platforms.linux;
+ license = licenses.gpl2Plus;
+ maintainers = [ maintainers.vcunat ];
+ platforms = platforms.linux;
};
}
+
diff --git a/pkgs/applications/misc/makeself/default.nix b/pkgs/applications/misc/makeself/default.nix
index 9ea5f18ee62..3ba0faef968 100644
--- a/pkgs/applications/misc/makeself/default.nix
+++ b/pkgs/applications/misc/makeself/default.nix
@@ -1,23 +1,25 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchgit }:
stdenv.mkDerivation rec {
- name = "makeself-2.1.5";
- src = fetchurl {
- url = "http://megastep.org/makeself/makeself.run";
- sha256 = "0khs19xpid4ng0igrjyz3vsi6a5xyixrrrhgdxpdhd2wnf5nc9w2";
+ name = "makeself-2.2.0";
+ src = fetchgit {
+ url = "https://github.com/megastep/makeself.git";
+ rev = "b836b9281ae99abe1865608b065551da56c80719";
+ sha256 = "f7c97f0f8ad8128f2f1b54383319f2cc44cbb05b60ced222784debdf326f23ad";
};
- unpackPhase = "sh ${src}";
installPhase = ''
- cd ${name}
mkdir -p $out/{bin,share/{${name},man/man1}}
- mv makeself.lsm README $out/share/${name}
+ mv makeself.lsm README.md $out/share/${name}
mv makeself.sh $out/bin/makeself
mv makeself.1 $out/share/man/man1/
mv makeself-header.sh $out/share/${name}
sed -e 's|HEADER=`dirname $0`/makeself-header.sh|HEADER=`dirname $0`/../share/${name}/makeself-header.sh|' -i $out/bin/makeself
'';
- meta = {
+ meta = with stdenv.lib; {
homepage = http://megastep.org/makeself;
description = "Utility to create self-extracting packages";
+ license = licenses.gpl2;
+ maintainers = [ maintainers.wmertens ];
+ platforms = platforms.all;
};
}
diff --git a/pkgs/applications/misc/merkaartor/default.nix b/pkgs/applications/misc/merkaartor/default.nix
index 6d10cbb8c21..932e5bb4830 100644
--- a/pkgs/applications/misc/merkaartor/default.nix
+++ b/pkgs/applications/misc/merkaartor/default.nix
@@ -1,22 +1,22 @@
-{stdenv, fetchurl, qt4, boost}:
+{stdenv, fetchurl, qt4, boost, proj, gdal}:
stdenv.mkDerivation rec {
- name = "merkaartor-0.17.2";
+ name = "merkaartor-0.18.1";
src = fetchurl {
- url = "http://merkaartor.be/attachments/download/253/merkaartor-0.17.2.tar.bz2";
- sha256 = "0akhp9czzn39132mgj9h38nlh4l9ibzn3vh93bfs685zxyn4yps2";
+ url = "http://merkaartor.be/attachments/download/301/merkaartor-0.18.1.tar.bz2";
+ sha256 = "17qk45pmlxqigla1915dvn9pp91y85d2bkcaap4g3m8mk1crcsix";
};
configurePhase = ''
qmake -makefile PREFIX=$out
'';
- buildInputs = [ qt4 boost ];
+ buildInputs = [ qt4 boost proj gdal ];
meta = {
description = "An openstreetmap editor";
homepage = http://merkaartor.org/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [viric urkud];
inherit (qt4.meta) platforms;
};
diff --git a/pkgs/applications/misc/mupdf/default.nix b/pkgs/applications/misc/mupdf/default.nix
index 220309a8e22..aa7c14634d1 100644
--- a/pkgs/applications/misc/mupdf/default.nix
+++ b/pkgs/applications/misc/mupdf/default.nix
@@ -1,21 +1,54 @@
-{ stdenv, fetchurl, pkgconfig, zlib, freetype, libjpeg, jbig2dec, openjpeg
+{ stdenv, fetchurl, fetchpatch, pkgconfig, zlib, freetype, libjpeg, jbig2dec, openjpeg
, libX11, libXext }:
stdenv.mkDerivation rec {
- name = "mupdf-1.3";
+ version = "1.5";
+ name = "mupdf-${version}";
src = fetchurl {
url = "http://mupdf.com/download/archive/${name}-source.tar.gz";
- sha256 = "0y247nka5gkr1ajn47jrlp5rcnf6h4ff7dfsprma3h4wxqdv7a5b";
+ sha256 = "0sl47zqf4c9fhs4h5zg046vixjmwgy4vhljhr5g4md733nash7z4";
};
buildInputs = [ pkgconfig zlib freetype libjpeg jbig2dec openjpeg libX11 libXext ];
+ enableParallelBuilding = true;
+
+ my_soname = "libmupdf.so.1.3";
+ my_soname_js_none = "libmupdf-js-none.so.1.3";
preBuild = ''
- export makeFlags="prefix=$out"
+ export makeFlags="prefix=$out build=release XCFLAGS=-fpic"
export NIX_CFLAGS_COMPILE=" $NIX_CFLAGS_COMPILE -I$(echo ${openjpeg}/include/openjpeg-*) "
+
+ # Copied from Gentoo ebuild
+ rm -rf thirdparty
+ sed -e "\$a\$(MUPDF_LIB): \$(MUPDF_JS_NONE_LIB)" \
+ -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname} -Wl,--no-undefined -o \$@ \$^ \$(MUPDF_JS_NONE_LIB) \$(LIBS)" \
+ -e "/^MUPDF_LIB :=/s:=.*:= \$(OUT)/${my_soname}:" \
+ -e "\$a\$(MUPDF_JS_NONE_LIB):" \
+ -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname_js_none} -Wl,--no-undefined -o \$@ \$^ \$(LIBS)" \
+ -e "/^MUPDF_JS_NONE_LIB :=/s:=.*:= \$(OUT)/${my_soname_js_none}:" \
+ -i Makefile
+
+ sed -e "s/libopenjpeg1/libopenjp2/" -i Makerules
'';
postInstall = ''
+ ln -s ${my_soname} $out/lib/libmupdf.so
+
+ mkdir -p "$out/lib/pkgconfig"
+ cat >"$out/lib/pkgconfig/mupdf.pc" < $out/share/applications/mupdf.desktop <=7,\
+ from distutils.core import setup, Extension, Command
+ from distutils.command.install_data import install_data
+
++import matplotlib
++matplotlib.use('Agg')
+ from ocrolib import default
++
+ modeldir = "models/"
+ modelfiles = default.installable
+ modelprefix = "http://iupr1.cs.uni-kl.de/~tmb/ocropus-models/"
diff --git a/pkgs/applications/misc/openjump/default.nix b/pkgs/applications/misc/openjump/default.nix
index 74f657ee02a..8a68bd7ccfb 100644
--- a/pkgs/applications/misc/openjump/default.nix
+++ b/pkgs/applications/misc/openjump/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
meta = {
description = "open source Geographic Information System (GIS) written in the Java programming language";
homepage = http://www.openjump.org/index.html;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [stdenv.lib.maintainers.marcweber];
platforms = stdenv.lib.platforms.linux;
};
diff --git a/pkgs/applications/misc/pcmanfm/default.nix b/pkgs/applications/misc/pcmanfm/default.nix
new file mode 100644
index 00000000000..f7180097961
--- /dev/null
+++ b/pkgs/applications/misc/pcmanfm/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, glib, gtk, intltool, libfm, libX11, pango, pkgconfig }:
+
+stdenv.mkDerivation {
+ name = "pcmanfm-1.2.0";
+ src = fetchurl {
+ url = "mirror://sourceforge/pcmanfm/pcmanfm-1.2.0.tar.xz";
+ sha256 = "1cmskj7dpjgrrn89z7cc1h1nsmd6qq3bakf207ldrhrxxv3fxl2j";
+ };
+
+ buildInputs = [ glib gtk intltool libfm libX11 pango pkgconfig ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://blog.lxde.org/?cat=28/";
+ license = licenses.gpl2Plus;
+ description = "File manager with GTK+ interface";
+ maintainers = [ maintainers.ttuegel ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/misc/pgadmin/default.nix b/pkgs/applications/misc/pgadmin/default.nix
index aac15789a2d..f26326f4d4e 100644
--- a/pkgs/applications/misc/pgadmin/default.nix
+++ b/pkgs/applications/misc/pgadmin/default.nix
@@ -2,11 +2,11 @@
stdenv.mkDerivation rec {
name = "pgadmin3-${version}";
- version = "1.16.1";
+ version = "1.18.1";
src = fetchurl {
url = "http://ftp.postgresql.org/pub/pgadmin3/release/v${version}/src/pgadmin3-${version}.tar.gz";
- sha256 = "13n2nyjnbmjbz9n0xp6627n3pavkqfp4n45l1mnqxhjdq8yj9fnl";
+ sha256 = "1h6bqslw53q44vy7z1q7wmxkgqdzxacfs8pfm2fxm8vcd8lkxb17";
};
buildInputs = [ postgresql wxGTK libxml2 libxslt openssl ];
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
description = "PostgreSQL administration GUI tool";
homepage = http://www.pgadmin.org;
license = licenses.gpl2;
- maintainers = [ maintainers.iElectric ];
+ maintainers = with maintainers; [ iElectric wmertens ];
platforms = platforms.unix;
};
}
diff --git a/pkgs/applications/misc/pitz/default.nix b/pkgs/applications/misc/pitz/default.nix
index 355ea9b2033..e4f097469a4 100644
--- a/pkgs/applications/misc/pitz/default.nix
+++ b/pkgs/applications/misc/pitz/default.nix
@@ -1,5 +1,6 @@
{ stdenv, fetchurl, buildPythonPackage, tempita, jinja2, pyyaml, clepy, mock
-, nose, decorator, docutils }:
+, nose, decorator, docutils
+}:
# TODO: pitz has a pitz-shell utility that depends on ipython, but it just
# errors out and dies (it probably depends on an old ipython version):
@@ -28,6 +29,6 @@ buildPythonPackage rec {
license = licenses.bsd3;
homepage = http://pitz.tplus1.com/;
platforms = platforms.linux;
- maintainers = [maintainers.bjornfor];
+ maintainers = [ maintainers.bjornfor ];
};
}
diff --git a/pkgs/applications/misc/posterazor/default.nix b/pkgs/applications/misc/posterazor/default.nix
new file mode 100644
index 00000000000..0cad2fbd2cd
--- /dev/null
+++ b/pkgs/applications/misc/posterazor/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, cmake, unzip, pkgconfig, libXpm, fltk13, freeimage }:
+
+stdenv.mkDerivation rec {
+ name = "posterazor-1.5";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/posterazor/1.5/PosteRazor-1.5-Source.zip";
+ sha256 = "0xy313d2j57s4wy2y3hjapbjr5zfaki0lhkfz6nw2p9gylcmwmjy";
+ };
+
+ buildInputs = [ cmake unzip pkgconfig libXpm fltk13 freeimage ];
+
+ unpackPhase = ''
+ unzip $src -d posterazor
+ cd posterazor/src
+ '';
+
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=667328
+ patchPhase = ''
+ sed "s/\(#define CASESENSITIVESTRCMP strcasecmp\)/#include \n\1/" -i FlPosteRazorDialog.cpp
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp PosteRazor $out/bin
+ '';
+
+ meta = {
+ homepage = "http://posterazor.sourceforge.net/";
+ description = "The PosteRazor cuts a raster image into pieces which can afterwards be printed out and assembled to a poster";
+ maintainers = [ stdenv.lib.maintainers.madjar ];
+ platforms = stdenv.lib.platforms.all;
+ };
+}
diff --git a/pkgs/applications/misc/printrun/default.nix b/pkgs/applications/misc/printrun/default.nix
new file mode 100644
index 00000000000..dc258d65328
--- /dev/null
+++ b/pkgs/applications/misc/printrun/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, python27Packages, fetchgit }:
+let
+ py = python27Packages;
+in
+py.buildPythonPackage rec {
+ name = "printrun";
+
+ src = fetchgit {
+ url = "https://github.com/kliment/Printrun";
+ rev = "0a7f2335d0c02c3cc283200867b41f8b337b1387";
+ sha256 = "1zvh5ih89isv51sraljm29z9k00srrdnklwkyp27ymxzlbcwq6gv";
+ };
+
+ propagatedBuildInputs = [ py.wxPython py.pyserial py.dbus py.psutil ];
+
+ doCheck = false;
+
+ postPatch = ''
+ sed -i -r "s|/usr(/local)?/share/|$out/share/|g" printrun/utils.py
+ sed -i "s|distutils.core|setuptools|" setup.py
+ sed -i "s|distutils.command.install |setuptools.command.install |" setup.py
+ '';
+
+ postInstall = ''
+ for f in $out/share/applications/*.desktop; do
+ sed -i -e "s|/usr/|$out/|g" "$f"
+ done
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Pronterface, Pronsole, and Printcore - Pure Python 3d printing host software";
+ homepage = https://github.com/kliment/Printrun;
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/misc/pstree/default.nix b/pkgs/applications/misc/pstree/default.nix
index 0d61d3d74cf..d4ffe2a4afd 100644
--- a/pkgs/applications/misc/pstree/default.nix
+++ b/pkgs/applications/misc/pstree/default.nix
@@ -16,5 +16,6 @@ stdenv.mkDerivation rec {
meta = {
description = "Show the set of running processes as a tree";
license = "GPL";
+ maintainers = stdenv.lib.maintainers.mornfall;
};
}
diff --git a/pkgs/applications/misc/qgis/default.nix b/pkgs/applications/misc/qgis/default.nix
index d6711c82968..cc26a74802b 100644
--- a/pkgs/applications/misc/qgis/default.nix
+++ b/pkgs/applications/misc/qgis/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
meta = {
description = "User friendly Open Source Geographic Information System";
homepage = http://www.qgis.org;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = with stdenv.lib.platforms; linux;
maintainers = with stdenv.lib.maintainers; [viric];
};
diff --git a/pkgs/applications/misc/qtbitcointrader/default.nix b/pkgs/applications/misc/qtbitcointrader/default.nix
new file mode 100644
index 00000000000..38606d79873
--- /dev/null
+++ b/pkgs/applications/misc/qtbitcointrader/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, qt4 }:
+
+let
+ version = "1.07.98";
+in
+stdenv.mkDerivation {
+ name = "qtbitcointrader-${version}";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/bitcointrader/SRC/QtBitcoinTrader-${version}.tar.gz";
+ sha256 = "1irz17q71fx64dfkmgajlyva7d1wifv4bxgb2iwz7d69rvhzaqzx";
+ };
+
+ buildInputs = [ qt4 ];
+
+ postUnpack = "sourceRoot=\${sourceRoot}/src";
+
+ configurePhase = ''
+ qmake \
+ PREFIX=$out \
+ DESKTOPDIR=$out/share/applications \
+ ICONDIR=$out/share/pixmaps \
+ QtBitcoinTrader_Desktop.pro
+ '';
+
+ meta = {
+ description = "Secure bitcoin trading client";
+ homepage = http://qtopentrader.com;
+ license = stdenv.lib.licenses.lgpl21Plus;
+ platforms = stdenv.lib.platforms.linux; # arbitrary choice
+ maintainers = [ stdenv.lib.maintainers.emery ];
+ };
+}
\ No newline at end of file
diff --git a/pkgs/applications/misc/ranger/default.nix b/pkgs/applications/misc/ranger/default.nix
new file mode 100644
index 00000000000..5f75c05a68f
--- /dev/null
+++ b/pkgs/applications/misc/ranger/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, buildPythonPackage, python, fetchurl }:
+
+buildPythonPackage {
+ name = "ranger-1.6.1";
+
+ meta = {
+ description = "File manager with minimalistic curses interface";
+ homepage = "http://ranger.nongnu.org/";
+ license = stdenv.lib.licenses.gpl3;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = with stdenv.lib.maintainers; [ iyzsong ];
+ };
+
+ src = fetchurl {
+ url = "http://ranger.nongnu.org/ranger-1.6.1.tar.gz";
+ sha256 = "0pnvfwk2a1p35246fihm3fsr1m7r2njirbxm28ba276psajk1cnc";
+ };
+
+ doCheck = false;
+
+ propagatedBuildInputs = with python.modules; [ curses ];
+}
diff --git a/pkgs/applications/misc/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix
index 3bed6e1a2d7..abf55aa22b9 100644
--- a/pkgs/applications/misc/redshift/default.nix
+++ b/pkgs/applications/misc/redshift/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
wrapProgram "$out/bin/redshift-gtk" --prefix PYTHONPATH : $PYTHONPATH:${pygtk}/lib/${python.libPrefix}/site-packages/gtk-2.0:${pyxdg}/lib/${python.libPrefix}/site-packages/pyxdg:$out/lib/${python.libPrefix}/site-packages
'';
- meta = {
+ meta = with stdenv.lib; {
description = "changes the color temperature of your screen gradually";
longDescription = ''
The color temperature is set according to the position of the
@@ -37,7 +37,9 @@ stdenv.mkDerivation rec {
temperature transitions smoothly from night to daytime
temperature to allow your eyes to slowly adapt.
'';
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
homepage = "http://jonls.dk/redshift";
+ platforms = platforms.linux;
+ maintainers = maintainers.mornfall;
};
}
diff --git a/pkgs/applications/misc/robomongo/default.nix b/pkgs/applications/misc/robomongo/default.nix
new file mode 100644
index 00000000000..ab8a803b7cb
--- /dev/null
+++ b/pkgs/applications/misc/robomongo/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, qt5, openssl, boost, cmake, scons, python, pcre, bzip2 }:
+
+stdenv.mkDerivation {
+ name = "robomongo-0.8.3";
+
+ src = fetchurl {
+ url = https://github.com/paralect/robomongo/archive/v0.8.3.tar.gz;
+ sha256 = "1x8vpmqvjscjcw30hf0i5vsrg3rldlwx6z52i1hymlck2jfzkank";
+ };
+
+ patches = [ ./robomongo.patch ];
+
+ NIX_CFLAGS_COMPILE = "-fno-stack-protector";
+
+ buildInputs = [ cmake boost scons qt5 openssl python pcre bzip2 ];
+
+ meta = {
+ homepage = "http://robomongo.org/";
+ description = "Query GUI for mongodb";
+ platforms = stdenv.lib.platforms.unix;
+ license = stdenv.lib.licenses.gpl3;
+ maintainers = [ stdenv.lib.maintainers.amorsillo ];
+ broken = true;
+ };
+}
diff --git a/pkgs/applications/misc/robomongo/robomongo.patch b/pkgs/applications/misc/robomongo/robomongo.patch
new file mode 100644
index 00000000000..2305ca732ea
--- /dev/null
+++ b/pkgs/applications/misc/robomongo/robomongo.patch
@@ -0,0 +1,48 @@
+Remove check for QT_NO_STYLE_GTK to avoid building with QCleanlooksStyle which results in error due to missing QCleanlooksStyle
+Ensure environment is preserved for scons build -- scons clears the env but we want to keep the nix build environment
+Fix typo in cmakelists
+diff -rupN robomongo-0.8.3/CMakeLists.txt robomongo-0.8.3-patched/CMakeLists.txt
+--- robomongo-0.8.3/CMakeLists.txt 2013-10-01 10:55:00.000000000 -0400
++++ robomongo-0.8.3-patched/CMakeLists.txt 2013-12-06 12:22:06.070659856 -0500
+@@ -133,7 +133,7 @@ ELSE()
+ ENDIF()
+
+ ##################################DEFAULT VALUES##########################################
+-IF(NOT CMAKE_INSTALL_PREFIX})
++IF(NOT CMAKE_INSTALL_PREFIX)
+ SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install")
+ ENDIF()
+
+diff -rupN robomongo-0.8.3/src/robomongo/gui/AppStyle.h robomongo-0.8.3-patched/src/robomongo/gui/AppStyle.h
+--- robomongo-0.8.3/src/robomongo/gui/AppStyle.h 2013-10-01 10:55:00.000000000 -0400
++++ robomongo-0.8.3-patched/src/robomongo/gui/AppStyle.h 2013-12-06 12:20:57.417297186 -0500
+@@ -8,13 +8,8 @@
+ #include
+ typedef QProxyStyle OsStyle;
+ #elif defined OS_LINUX
+- #if !defined(QT_NO_STYLE_GTK)
+- #include
+- typedef QProxyStyle OsStyle;
+- #else
+- #include
+- typedef QCleanlooksStyle OsStyle;
+- #endif
++ #include
++ typedef QProxyStyle OsStyle;
+ #endif
+
+ namespace Robomongo
+
+diff -rupN robomongo-0.8.3/src/third-party/mongodb/SConstruct robomongo-0.8.3-patched/src/third-party/mongodb/SConstruct
+--- robomongo-0.8.3/src/third-party/mongodb/SConstruct 2013-10-01 10:55:00.000000000 -0400
++++ robomongo-0.8.3-patched/src/third-party/mongodb/SConstruct 2013-12-06 12:21:45.705255731 -0500
+@@ -283,7 +283,8 @@ usePCH = has_option( "usePCH" )
+
+ justClientLib = (COMMAND_LINE_TARGETS == ['mongoclient'])
+
+-env = Environment( BUILD_DIR=variantDir,
++env = Environment( ENV=os.environ,
++ BUILD_DIR=variantDir,
+ CLIENT_ARCHIVE='${CLIENT_DIST_BASENAME}${DIST_ARCHIVE_SUFFIX}',
+ CLIENT_DIST_BASENAME=get_option('client-dist-basename'),
+ CLIENT_LICENSE='#distsrc/client/LICENSE.txt',
diff --git a/pkgs/applications/misc/rtl-sdr/default.nix b/pkgs/applications/misc/rtl-sdr/default.nix
new file mode 100644
index 00000000000..e6e76249388
--- /dev/null
+++ b/pkgs/applications/misc/rtl-sdr/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchgit, cmake, pkgconfig, libusb1 }:
+
+stdenv.mkDerivation rec {
+ name = "rtl-sdr-${version}";
+ version = "0.5.3";
+
+ src = fetchgit {
+ url = "git://git.osmocom.org/rtl-sdr.git";
+ rev = "refs/tags/v${version}";
+ sha256 = "00r5d08r12zzkd0xggd7l7p4r2278rzdhqdaihwjlajmr9qd3hs1";
+ };
+
+ buildInputs = [ cmake pkgconfig libusb1 ];
+
+ # Building with -DINSTALL_UDEV_RULES=ON tries to install udev rules to
+ # /etc/udev/rules.d/, and there is no option to install elsewhere. So install
+ # rules manually.
+ postInstall = ''
+ mkdir -p "$out/etc/udev/rules.d/"
+ cp ../rtl-sdr.rules "$out/etc/udev/rules.d/99-rtl-sdr.rules"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Turns your Realtek RTL2832 based DVB dongle into a SDR receiver";
+ homepage = http://sdr.osmocom.org/trac/wiki/rtl-sdr;
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.bjornfor ];
+ };
+}
diff --git a/pkgs/applications/misc/rxvt_unicode/default.nix b/pkgs/applications/misc/rxvt_unicode/default.nix
index c05dd028eb3..7392123673a 100644
--- a/pkgs/applications/misc/rxvt_unicode/default.nix
+++ b/pkgs/applications/misc/rxvt_unicode/default.nix
@@ -1,19 +1,20 @@
{ stdenv, fetchurl, perlSupport, libX11, libXt, libXft, ncurses, perl,
- fontconfig, freetype, pkgconfig, libXrender, gdkPixbufSupport, gdk_pixbuf }:
+ fontconfig, freetype, pkgconfig, libXrender, gdkPixbufSupport, gdk_pixbuf,
+ unicode3Support }:
let
name = "rxvt-unicode";
- version = "9.16";
+ version = "9.20";
n = "${name}-${version}";
in
stdenv.mkDerivation (rec {
- name = "${n}${if perlSupport then "-with-perl" else ""}";
+ name = "${n}${if perlSupport then "-with-perl" else ""}${if unicode3Support then "-with-unicode3" else ""}";
src = fetchurl {
url = "http://dist.schmorp.de/rxvt-unicode/Attic/rxvt-unicode-${version}.tar.bz2";
- sha256 = "0x28wyslqnhn2q11y4hncqdl07wgh5ypywl92fq0jxycr36ibfvn";
+ sha256 = "e73e13fe64b59fd3c8e6e20c00f149d388741f141b8155e4700d3ed40aa94b4e";
};
buildInputs =
@@ -24,10 +25,15 @@ stdenv.mkDerivation (rec {
outputs = [ "out" "terminfo" ];
+ patches = [
+ ./rxvt-unicode-9.06-font-width.patch
+ ./rxvt-unicode-256-color-resources.patch
+ ];
+
preConfigure =
''
mkdir -p $terminfo/share/terminfo
- configureFlags="--with-terminfo=$terminfo/share/terminfo --enable-256-color ${if perlSupport then "--enable-perl" else "--disable-perl"}";
+ configureFlags="--with-terminfo=$terminfo/share/terminfo --enable-256-color ${if perlSupport then "--enable-perl" else "--disable-perl"} ${if unicode3Support then "--enable-unicode3" else "--disable-unicode3"}";
export TERMINFO=$terminfo/share/terminfo # without this the terminfo won't be compiled by tic, see man tic
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${freetype}/include/freetype2"
NIX_LDFLAGS="$NIX_LDFLAGS -lfontconfig -lXrender "
@@ -38,15 +44,9 @@ stdenv.mkDerivation (rec {
ln -s $out/{lib/urxvt,lib/perl5/site_perl}
'';
- # we link the separate terminfo output to the main output
- # as I don't think there's a usecase for wanting urxvt without its terminfo files
- # and we don't want users to install them separately
- postInstall = ''
- ln -s $terminfo/share/terminfo $out/share
- '';
-
meta = {
description = "A clone of the well-known terminal emulator rxvt";
homepage = "http://software.schmorp.de/pkg/rxvt-unicode.html";
+ maintainers = stdenv.lib.maintainers.mornfall;
};
})
diff --git a/pkgs/applications/misc/rxvt_unicode/rxvt-unicode-256-color-resources.patch b/pkgs/applications/misc/rxvt_unicode/rxvt-unicode-256-color-resources.patch
new file mode 100644
index 00000000000..c8d2acfbdc5
--- /dev/null
+++ b/pkgs/applications/misc/rxvt_unicode/rxvt-unicode-256-color-resources.patch
@@ -0,0 +1,255 @@
+diff --git a/src/xdefaults.C b/src/xdefaults.C
+index 23b6822..382f3b1 100644
+--- a/src/xdefaults.C
++++ b/src/xdefaults.C
+@@ -155,6 +155,250 @@ optList[] = {
+ RSTRG (Rs_color + minCOLOR + 5, "color5", "color"),
+ RSTRG (Rs_color + minCOLOR + 6, "color6", "color"),
+ RSTRG (Rs_color + minCOLOR + 7, "color7", "color"),
++ // 88 xterm colors
++ RSTRG (Rs_color + minCOLOR + 16, "color16", "color"),
++ RSTRG (Rs_color + minCOLOR + 17, "color17", "color"),
++ RSTRG (Rs_color + minCOLOR + 18, "color18", "color"),
++ RSTRG (Rs_color + minCOLOR + 19, "color19", "color"),
++ RSTRG (Rs_color + minCOLOR + 20, "color20", "color"),
++ RSTRG (Rs_color + minCOLOR + 21, "color21", "color"),
++ RSTRG (Rs_color + minCOLOR + 22, "color22", "color"),
++ RSTRG (Rs_color + minCOLOR + 23, "color23", "color"),
++ RSTRG (Rs_color + minCOLOR + 24, "color24", "color"),
++ RSTRG (Rs_color + minCOLOR + 25, "color25", "color"),
++ RSTRG (Rs_color + minCOLOR + 26, "color26", "color"),
++ RSTRG (Rs_color + minCOLOR + 27, "color27", "color"),
++ RSTRG (Rs_color + minCOLOR + 28, "color28", "color"),
++ RSTRG (Rs_color + minCOLOR + 29, "color29", "color"),
++ RSTRG (Rs_color + minCOLOR + 30, "color30", "color"),
++ RSTRG (Rs_color + minCOLOR + 31, "color31", "color"),
++ RSTRG (Rs_color + minCOLOR + 32, "color32", "color"),
++ RSTRG (Rs_color + minCOLOR + 33, "color33", "color"),
++ RSTRG (Rs_color + minCOLOR + 34, "color34", "color"),
++ RSTRG (Rs_color + minCOLOR + 35, "color35", "color"),
++ RSTRG (Rs_color + minCOLOR + 36, "color36", "color"),
++ RSTRG (Rs_color + minCOLOR + 37, "color37", "color"),
++ RSTRG (Rs_color + minCOLOR + 38, "color38", "color"),
++ RSTRG (Rs_color + minCOLOR + 39, "color39", "color"),
++ RSTRG (Rs_color + minCOLOR + 40, "color40", "color"),
++ RSTRG (Rs_color + minCOLOR + 41, "color41", "color"),
++ RSTRG (Rs_color + minCOLOR + 42, "color42", "color"),
++ RSTRG (Rs_color + minCOLOR + 43, "color43", "color"),
++ RSTRG (Rs_color + minCOLOR + 44, "color44", "color"),
++ RSTRG (Rs_color + minCOLOR + 45, "color45", "color"),
++ RSTRG (Rs_color + minCOLOR + 46, "color46", "color"),
++ RSTRG (Rs_color + minCOLOR + 47, "color47", "color"),
++ RSTRG (Rs_color + minCOLOR + 48, "color48", "color"),
++ RSTRG (Rs_color + minCOLOR + 49, "color49", "color"),
++ RSTRG (Rs_color + minCOLOR + 50, "color50", "color"),
++ RSTRG (Rs_color + minCOLOR + 51, "color51", "color"),
++ RSTRG (Rs_color + minCOLOR + 52, "color52", "color"),
++ RSTRG (Rs_color + minCOLOR + 53, "color53", "color"),
++ RSTRG (Rs_color + minCOLOR + 54, "color54", "color"),
++ RSTRG (Rs_color + minCOLOR + 55, "color55", "color"),
++ RSTRG (Rs_color + minCOLOR + 56, "color56", "color"),
++ RSTRG (Rs_color + minCOLOR + 57, "color57", "color"),
++ RSTRG (Rs_color + minCOLOR + 58, "color58", "color"),
++ RSTRG (Rs_color + minCOLOR + 59, "color59", "color"),
++ RSTRG (Rs_color + minCOLOR + 60, "color60", "color"),
++ RSTRG (Rs_color + minCOLOR + 61, "color61", "color"),
++ RSTRG (Rs_color + minCOLOR + 62, "color62", "color"),
++ RSTRG (Rs_color + minCOLOR + 63, "color63", "color"),
++ RSTRG (Rs_color + minCOLOR + 64, "color64", "color"),
++ RSTRG (Rs_color + minCOLOR + 65, "color65", "color"),
++ RSTRG (Rs_color + minCOLOR + 66, "color66", "color"),
++ RSTRG (Rs_color + minCOLOR + 67, "color67", "color"),
++ RSTRG (Rs_color + minCOLOR + 68, "color68", "color"),
++ RSTRG (Rs_color + minCOLOR + 69, "color69", "color"),
++ RSTRG (Rs_color + minCOLOR + 70, "color70", "color"),
++ RSTRG (Rs_color + minCOLOR + 71, "color71", "color"),
++ RSTRG (Rs_color + minCOLOR + 72, "color72", "color"),
++ RSTRG (Rs_color + minCOLOR + 73, "color73", "color"),
++ RSTRG (Rs_color + minCOLOR + 74, "color74", "color"),
++ RSTRG (Rs_color + minCOLOR + 75, "color75", "color"),
++ RSTRG (Rs_color + minCOLOR + 76, "color76", "color"),
++ RSTRG (Rs_color + minCOLOR + 77, "color77", "color"),
++ RSTRG (Rs_color + minCOLOR + 78, "color78", "color"),
++ RSTRG (Rs_color + minCOLOR + 79, "color79", "color"),
++ RSTRG (Rs_color + minCOLOR + 80, "color80", "color"),
++ RSTRG (Rs_color + minCOLOR + 81, "color81", "color"),
++ RSTRG (Rs_color + minCOLOR + 82, "color82", "color"),
++ RSTRG (Rs_color + minCOLOR + 83, "color83", "color"),
++ RSTRG (Rs_color + minCOLOR + 84, "color84", "color"),
++ RSTRG (Rs_color + minCOLOR + 85, "color85", "color"),
++ RSTRG (Rs_color + minCOLOR + 86, "color86", "color"),
++ RSTRG (Rs_color + minCOLOR + 87, "color87", "color"),
++#if USE_256_COLORS
++ // 256 xterm colors
++ RSTRG (Rs_color + minCOLOR + 88, "color88", "color"),
++ RSTRG (Rs_color + minCOLOR + 89, "color89", "color"),
++ RSTRG (Rs_color + minCOLOR + 90, "color90", "color"),
++ RSTRG (Rs_color + minCOLOR + 91, "color91", "color"),
++ RSTRG (Rs_color + minCOLOR + 92, "color92", "color"),
++ RSTRG (Rs_color + minCOLOR + 93, "color93", "color"),
++ RSTRG (Rs_color + minCOLOR + 94, "color94", "color"),
++ RSTRG (Rs_color + minCOLOR + 95, "color95", "color"),
++ RSTRG (Rs_color + minCOLOR + 96, "color96", "color"),
++ RSTRG (Rs_color + minCOLOR + 97, "color97", "color"),
++ RSTRG (Rs_color + minCOLOR + 98, "color98", "color"),
++ RSTRG (Rs_color + minCOLOR + 99, "color99", "color"),
++ RSTRG (Rs_color + minCOLOR + 100, "color100", "color"),
++ RSTRG (Rs_color + minCOLOR + 101, "color101", "color"),
++ RSTRG (Rs_color + minCOLOR + 102, "color102", "color"),
++ RSTRG (Rs_color + minCOLOR + 103, "color103", "color"),
++ RSTRG (Rs_color + minCOLOR + 104, "color104", "color"),
++ RSTRG (Rs_color + minCOLOR + 105, "color105", "color"),
++ RSTRG (Rs_color + minCOLOR + 106, "color106", "color"),
++ RSTRG (Rs_color + minCOLOR + 107, "color107", "color"),
++ RSTRG (Rs_color + minCOLOR + 108, "color108", "color"),
++ RSTRG (Rs_color + minCOLOR + 109, "color109", "color"),
++ RSTRG (Rs_color + minCOLOR + 110, "color110", "color"),
++ RSTRG (Rs_color + minCOLOR + 111, "color111", "color"),
++ RSTRG (Rs_color + minCOLOR + 112, "color112", "color"),
++ RSTRG (Rs_color + minCOLOR + 113, "color113", "color"),
++ RSTRG (Rs_color + minCOLOR + 114, "color114", "color"),
++ RSTRG (Rs_color + minCOLOR + 115, "color115", "color"),
++ RSTRG (Rs_color + minCOLOR + 116, "color116", "color"),
++ RSTRG (Rs_color + minCOLOR + 117, "color117", "color"),
++ RSTRG (Rs_color + minCOLOR + 118, "color118", "color"),
++ RSTRG (Rs_color + minCOLOR + 119, "color119", "color"),
++ RSTRG (Rs_color + minCOLOR + 120, "color120", "color"),
++ RSTRG (Rs_color + minCOLOR + 121, "color121", "color"),
++ RSTRG (Rs_color + minCOLOR + 122, "color122", "color"),
++ RSTRG (Rs_color + minCOLOR + 123, "color123", "color"),
++ RSTRG (Rs_color + minCOLOR + 124, "color124", "color"),
++ RSTRG (Rs_color + minCOLOR + 125, "color125", "color"),
++ RSTRG (Rs_color + minCOLOR + 126, "color126", "color"),
++ RSTRG (Rs_color + minCOLOR + 127, "color127", "color"),
++ RSTRG (Rs_color + minCOLOR + 128, "color128", "color"),
++ RSTRG (Rs_color + minCOLOR + 129, "color129", "color"),
++ RSTRG (Rs_color + minCOLOR + 130, "color130", "color"),
++ RSTRG (Rs_color + minCOLOR + 131, "color131", "color"),
++ RSTRG (Rs_color + minCOLOR + 132, "color132", "color"),
++ RSTRG (Rs_color + minCOLOR + 133, "color133", "color"),
++ RSTRG (Rs_color + minCOLOR + 134, "color134", "color"),
++ RSTRG (Rs_color + minCOLOR + 135, "color135", "color"),
++ RSTRG (Rs_color + minCOLOR + 136, "color136", "color"),
++ RSTRG (Rs_color + minCOLOR + 137, "color137", "color"),
++ RSTRG (Rs_color + minCOLOR + 138, "color138", "color"),
++ RSTRG (Rs_color + minCOLOR + 139, "color139", "color"),
++ RSTRG (Rs_color + minCOLOR + 140, "color140", "color"),
++ RSTRG (Rs_color + minCOLOR + 141, "color141", "color"),
++ RSTRG (Rs_color + minCOLOR + 142, "color142", "color"),
++ RSTRG (Rs_color + minCOLOR + 143, "color143", "color"),
++ RSTRG (Rs_color + minCOLOR + 144, "color144", "color"),
++ RSTRG (Rs_color + minCOLOR + 145, "color145", "color"),
++ RSTRG (Rs_color + minCOLOR + 146, "color146", "color"),
++ RSTRG (Rs_color + minCOLOR + 147, "color147", "color"),
++ RSTRG (Rs_color + minCOLOR + 148, "color148", "color"),
++ RSTRG (Rs_color + minCOLOR + 149, "color149", "color"),
++ RSTRG (Rs_color + minCOLOR + 150, "color150", "color"),
++ RSTRG (Rs_color + minCOLOR + 151, "color151", "color"),
++ RSTRG (Rs_color + minCOLOR + 152, "color152", "color"),
++ RSTRG (Rs_color + minCOLOR + 153, "color153", "color"),
++ RSTRG (Rs_color + minCOLOR + 154, "color154", "color"),
++ RSTRG (Rs_color + minCOLOR + 155, "color155", "color"),
++ RSTRG (Rs_color + minCOLOR + 156, "color156", "color"),
++ RSTRG (Rs_color + minCOLOR + 157, "color157", "color"),
++ RSTRG (Rs_color + minCOLOR + 158, "color158", "color"),
++ RSTRG (Rs_color + minCOLOR + 159, "color159", "color"),
++ RSTRG (Rs_color + minCOLOR + 160, "color160", "color"),
++ RSTRG (Rs_color + minCOLOR + 161, "color161", "color"),
++ RSTRG (Rs_color + minCOLOR + 162, "color162", "color"),
++ RSTRG (Rs_color + minCOLOR + 163, "color163", "color"),
++ RSTRG (Rs_color + minCOLOR + 164, "color164", "color"),
++ RSTRG (Rs_color + minCOLOR + 165, "color165", "color"),
++ RSTRG (Rs_color + minCOLOR + 166, "color166", "color"),
++ RSTRG (Rs_color + minCOLOR + 167, "color167", "color"),
++ RSTRG (Rs_color + minCOLOR + 168, "color168", "color"),
++ RSTRG (Rs_color + minCOLOR + 169, "color169", "color"),
++ RSTRG (Rs_color + minCOLOR + 170, "color170", "color"),
++ RSTRG (Rs_color + minCOLOR + 171, "color171", "color"),
++ RSTRG (Rs_color + minCOLOR + 172, "color172", "color"),
++ RSTRG (Rs_color + minCOLOR + 173, "color173", "color"),
++ RSTRG (Rs_color + minCOLOR + 174, "color174", "color"),
++ RSTRG (Rs_color + minCOLOR + 175, "color175", "color"),
++ RSTRG (Rs_color + minCOLOR + 176, "color176", "color"),
++ RSTRG (Rs_color + minCOLOR + 177, "color177", "color"),
++ RSTRG (Rs_color + minCOLOR + 178, "color178", "color"),
++ RSTRG (Rs_color + minCOLOR + 179, "color179", "color"),
++ RSTRG (Rs_color + minCOLOR + 180, "color180", "color"),
++ RSTRG (Rs_color + minCOLOR + 181, "color181", "color"),
++ RSTRG (Rs_color + minCOLOR + 182, "color182", "color"),
++ RSTRG (Rs_color + minCOLOR + 183, "color183", "color"),
++ RSTRG (Rs_color + minCOLOR + 184, "color184", "color"),
++ RSTRG (Rs_color + minCOLOR + 185, "color185", "color"),
++ RSTRG (Rs_color + minCOLOR + 186, "color186", "color"),
++ RSTRG (Rs_color + minCOLOR + 187, "color187", "color"),
++ RSTRG (Rs_color + minCOLOR + 188, "color188", "color"),
++ RSTRG (Rs_color + minCOLOR + 189, "color189", "color"),
++ RSTRG (Rs_color + minCOLOR + 190, "color190", "color"),
++ RSTRG (Rs_color + minCOLOR + 191, "color191", "color"),
++ RSTRG (Rs_color + minCOLOR + 192, "color192", "color"),
++ RSTRG (Rs_color + minCOLOR + 193, "color193", "color"),
++ RSTRG (Rs_color + minCOLOR + 194, "color194", "color"),
++ RSTRG (Rs_color + minCOLOR + 195, "color195", "color"),
++ RSTRG (Rs_color + minCOLOR + 196, "color196", "color"),
++ RSTRG (Rs_color + minCOLOR + 197, "color197", "color"),
++ RSTRG (Rs_color + minCOLOR + 198, "color198", "color"),
++ RSTRG (Rs_color + minCOLOR + 199, "color199", "color"),
++ RSTRG (Rs_color + minCOLOR + 200, "color200", "color"),
++ RSTRG (Rs_color + minCOLOR + 201, "color201", "color"),
++ RSTRG (Rs_color + minCOLOR + 202, "color202", "color"),
++ RSTRG (Rs_color + minCOLOR + 203, "color203", "color"),
++ RSTRG (Rs_color + minCOLOR + 204, "color204", "color"),
++ RSTRG (Rs_color + minCOLOR + 205, "color205", "color"),
++ RSTRG (Rs_color + minCOLOR + 206, "color206", "color"),
++ RSTRG (Rs_color + minCOLOR + 207, "color207", "color"),
++ RSTRG (Rs_color + minCOLOR + 208, "color208", "color"),
++ RSTRG (Rs_color + minCOLOR + 209, "color209", "color"),
++ RSTRG (Rs_color + minCOLOR + 210, "color210", "color"),
++ RSTRG (Rs_color + minCOLOR + 211, "color211", "color"),
++ RSTRG (Rs_color + minCOLOR + 212, "color212", "color"),
++ RSTRG (Rs_color + minCOLOR + 213, "color213", "color"),
++ RSTRG (Rs_color + minCOLOR + 214, "color214", "color"),
++ RSTRG (Rs_color + minCOLOR + 215, "color215", "color"),
++ RSTRG (Rs_color + minCOLOR + 216, "color216", "color"),
++ RSTRG (Rs_color + minCOLOR + 217, "color217", "color"),
++ RSTRG (Rs_color + minCOLOR + 218, "color218", "color"),
++ RSTRG (Rs_color + minCOLOR + 219, "color219", "color"),
++ RSTRG (Rs_color + minCOLOR + 220, "color220", "color"),
++ RSTRG (Rs_color + minCOLOR + 221, "color221", "color"),
++ RSTRG (Rs_color + minCOLOR + 222, "color222", "color"),
++ RSTRG (Rs_color + minCOLOR + 223, "color223", "color"),
++ RSTRG (Rs_color + minCOLOR + 224, "color224", "color"),
++ RSTRG (Rs_color + minCOLOR + 225, "color225", "color"),
++ RSTRG (Rs_color + minCOLOR + 226, "color226", "color"),
++ RSTRG (Rs_color + minCOLOR + 227, "color227", "color"),
++ RSTRG (Rs_color + minCOLOR + 228, "color228", "color"),
++ RSTRG (Rs_color + minCOLOR + 229, "color229", "color"),
++ RSTRG (Rs_color + minCOLOR + 230, "color230", "color"),
++ RSTRG (Rs_color + minCOLOR + 231, "color231", "color"),
++ RSTRG (Rs_color + minCOLOR + 232, "color232", "color"),
++ RSTRG (Rs_color + minCOLOR + 233, "color233", "color"),
++ RSTRG (Rs_color + minCOLOR + 234, "color234", "color"),
++ RSTRG (Rs_color + minCOLOR + 235, "color235", "color"),
++ RSTRG (Rs_color + minCOLOR + 236, "color236", "color"),
++ RSTRG (Rs_color + minCOLOR + 237, "color237", "color"),
++ RSTRG (Rs_color + minCOLOR + 238, "color238", "color"),
++ RSTRG (Rs_color + minCOLOR + 239, "color239", "color"),
++ RSTRG (Rs_color + minCOLOR + 240, "color240", "color"),
++ RSTRG (Rs_color + minCOLOR + 241, "color241", "color"),
++ RSTRG (Rs_color + minCOLOR + 242, "color242", "color"),
++ RSTRG (Rs_color + minCOLOR + 243, "color243", "color"),
++ RSTRG (Rs_color + minCOLOR + 244, "color244", "color"),
++ RSTRG (Rs_color + minCOLOR + 245, "color245", "color"),
++ RSTRG (Rs_color + minCOLOR + 246, "color246", "color"),
++ RSTRG (Rs_color + minCOLOR + 247, "color247", "color"),
++ RSTRG (Rs_color + minCOLOR + 248, "color248", "color"),
++ RSTRG (Rs_color + minCOLOR + 249, "color249", "color"),
++ RSTRG (Rs_color + minCOLOR + 250, "color250", "color"),
++ RSTRG (Rs_color + minCOLOR + 251, "color251", "color"),
++ RSTRG (Rs_color + minCOLOR + 252, "color252", "color"),
++ RSTRG (Rs_color + minCOLOR + 253, "color253", "color"),
++ RSTRG (Rs_color + minCOLOR + 254, "color254", "color"),
++ RSTRG (Rs_color + minCOLOR + 255, "color255", "color"),
++#endif
+ RSTRG (Rs_color + minBrightCOLOR + 0, "color8", "color"),
+ RSTRG (Rs_color + minBrightCOLOR + 1, "color9", "color"),
+ RSTRG (Rs_color + minBrightCOLOR + 2, "color10", "color"),
diff --git a/pkgs/applications/misc/rxvt_unicode/rxvt-unicode-9.06-font-width.patch b/pkgs/applications/misc/rxvt_unicode/rxvt-unicode-9.06-font-width.patch
new file mode 100644
index 00000000000..636083218fa
--- /dev/null
+++ b/pkgs/applications/misc/rxvt_unicode/rxvt-unicode-9.06-font-width.patch
@@ -0,0 +1,21 @@
+--- a/src/rxvtfont.C 2008-07-09 12:21:45.000000000 +0400
++++ b/src/rxvtfont.C 2009-10-30 14:32:53.000000000 +0300
+@@ -1195,12 +1195,14 @@
+ XGlyphInfo g;
+ XftTextExtents16 (disp, f, &ch, 1, &g);
+
+- g.width -= g.x;
+-
++/*
++ * bukind: don't use g.width as a width of a character!
++ * instead use g.xOff, see e.g.: http://keithp.com/~keithp/render/Xft.tutorial
++ */
+ int wcw = WCWIDTH (ch);
+- if (wcw > 0) g.width = (g.width + wcw - 1) / wcw;
++ if (wcw > 1) g.xOff = g.xOff / wcw;
++ if (width < g.xOff) width = g.xOff;
+
+- if (width < g.width ) width = g.width;
+ if (height < g.height ) height = g.height;
+ if (glheight < g.height - g.y) glheight = g.height - g.y;
+ }
\ No newline at end of file
diff --git a/pkgs/applications/misc/sakura/default.nix b/pkgs/applications/misc/sakura/default.nix
index e1492a47691..151b8a077d5 100644
--- a/pkgs/applications/misc/sakura/default.nix
+++ b/pkgs/applications/misc/sakura/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
terminals in one window and adds a contextual menu with some basic
options. No more no less.
'';
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = with stdenv.lib.maintainers; [ astsmtl ];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/misc/slic3r/default.nix b/pkgs/applications/misc/slic3r/default.nix
index aa2ceb08e80..06a5cca94a8 100644
--- a/pkgs/applications/misc/slic3r/default.nix
+++ b/pkgs/applications/misc/slic3r/default.nix
@@ -1,24 +1,23 @@
{ stdenv, fetchgit, perl, makeWrapper, makeDesktopItem
-# Perl modules:
-, EncodeLocale, MathClipper, ExtUtilsXSpp, BoostGeometryUtils
-, MathConvexHullMonotoneChain, MathGeometryVoronoi, MathPlanePath, Moo
-, IOStringy, ClassXSAccessor, Wx, GrowlGNTP, NetDBus }:
+, which, perlPackages
+}:
stdenv.mkDerivation rec {
- version = "0.9.10b";
+ version = "1.1.7";
name = "slic3r-${version}";
# Slic3r doesn't put out tarballs, only a git repository is available
src = fetchgit {
url = "git://github.com/alexrj/Slic3r";
rev = "refs/tags/${version}";
- sha256 = "0j06h0z65qn4kyb2b7pnq6bcn4al60q227iz9jlrin0ffx3l0ra7";
+ sha256 = "0hss90iw4xwca08d03wrz0fds5nqwb9zjqii2n6rgpcl4km69fka";
};
- buildInputs = [ perl makeWrapper
+ buildInputs = with perlPackages; [ perl makeWrapper which
EncodeLocale MathClipper ExtUtilsXSpp BoostGeometryUtils
MathConvexHullMonotoneChain MathGeometryVoronoi MathPlanePath Moo
- IOStringy ClassXSAccessor Wx GrowlGNTP NetDBus
+ IOStringy ClassXSAccessor Wx GrowlGNTP NetDBus ImportInto XMLSAX
+ ExtUtilsMakeMaker
];
desktopItem = makeDesktopItem {
@@ -31,13 +30,23 @@ stdenv.mkDerivation rec {
categories = "Application;Development;";
};
- # Nothing to do here
- buildPhase = "true";
+ buildPhase = ''
+ export SLIC3R_NO_AUTO=true
+ export PERL5LIB="./xs/blib/arch/:./xs/blib/lib:$PERL5LIB"
+
+ pushd xs
+ perl Build.PL
+ perl Build
+ popd
+
+ perl Build.PL
+ '';
installPhase = ''
mkdir -p "$out/share/slic3r/"
cp -r * "$out/share/slic3r/"
- wrapProgram "$out/share/slic3r/slic3r.pl" --prefix PERL5LIB : $PERL5LIB
+ wrapProgram "$out/share/slic3r/slic3r.pl" \
+ --prefix PERL5LIB : "$out/share/slic3r/xs/blib/arch:$out/share/slic3r/xs/blib/lib:$PERL5LIB"
mkdir -p "$out/bin"
ln -s "$out/share/slic3r/slic3r.pl" "$out/bin/slic3r"
mkdir -p "$out/share/pixmaps/"
@@ -56,6 +65,6 @@ stdenv.mkDerivation rec {
homepage = http://slic3r.org/;
license = licenses.agpl3;
platforms = platforms.linux;
- maintainers = [ maintainers.bjornfor ];
+ maintainers = with maintainers; [ bjornfor the-kenny ];
};
}
diff --git a/pkgs/applications/misc/spacefm/default.nix b/pkgs/applications/misc/spacefm/default.nix
new file mode 100644
index 00000000000..7dbe723d9eb
--- /dev/null
+++ b/pkgs/applications/misc/spacefm/default.nix
@@ -0,0 +1,30 @@
+{ pkgs, fetchurl, stdenv, gtk3, udev, desktop_file_utils, shared_mime_info
+, intltool, pkgconfig, makeWrapper
+}:
+
+let
+ version = "0.9.4";
+
+in stdenv.mkDerivation rec {
+ name = "spacefm-${version}";
+
+ src = fetchurl {
+ url = "https://github.com/IgnorantGuru/spacefm/blob/pkg/${version}/${name}.tar.xz?raw=true";
+ sha256 = "0marwa031jk24q8hy90dr7yw6rv5hn1shar404zpb1k57v4nr23m";
+ };
+
+ buildInputs = [ gtk3 udev desktop_file_utils shared_mime_info intltool pkgconfig makeWrapper ];
+
+ preFixup = ''
+ wrapProgram "$out/bin/spacefm" \
+ --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
+ '';
+
+ meta = {
+ description = "Multi-panel tabbed file and desktop manager for Linux with built-in VFS, udev- or HAL-based device manager, customizable menu system, and bash integration.";
+ platforms = pkgs.lib.platforms.linux;
+ license = pkgs.lib.licenses.gpl3;
+ };
+
+}
+
diff --git a/pkgs/applications/misc/st/default.nix b/pkgs/applications/misc/st/default.nix
index 41575ce35a6..1dcdf78456d 100644
--- a/pkgs/applications/misc/st/default.nix
+++ b/pkgs/applications/misc/st/default.nix
@@ -1,20 +1,20 @@
-{ stdenv, fetchurl, writeText, libX11, ncurses, libXext, libXft, fontconfig
+{ stdenv, fetchurl, pkgconfig, writeText, libX11, ncurses, libXext, libXft, fontconfig
, conf? null}:
with stdenv.lib;
stdenv.mkDerivation rec {
- name = "st-0.4.1";
+ name = "st-0.5";
src = fetchurl {
url = "http://dl.suckless.org/st/${name}.tar.gz";
- sha256 = "0cdzwbm5fxrwz8ryxkh90d3vwx54wjyywgj28ymsb5fdv3396bzf";
+ sha256 = "0knxpzaa86pprng6hak8hx8bw22yw22rpz1ffxjpcvqlz3xdv05f";
};
configFile = optionalString (conf!=null) (writeText "config.def.h" conf);
preBuild = optionalString (conf!=null) "cp ${configFile} config.def.h";
- buildInputs = [ libX11 ncurses libXext libXft fontconfig ];
+ buildInputs = [ pkgconfig libX11 ncurses libXext libXft fontconfig ];
NIX_LDFLAGS = "-lfontconfig";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://st.suckless.org/;
- license = "MIT";
+ license = stdenv.lib.licenses.mit;
maintainers = with maintainers; [viric];
platforms = with platforms; linux;
};
diff --git a/pkgs/applications/misc/stardict/stardict.nix b/pkgs/applications/misc/stardict/stardict.nix
index 9eb3e112342..1ca8ec045d6 100644
--- a/pkgs/applications/misc/stardict/stardict.nix
+++ b/pkgs/applications/misc/stardict/stardict.nix
@@ -39,8 +39,7 @@ stdenv.mkDerivation rec {
meta = {
description = "stardict";
homepage = "A international dictionary supporting fuzzy and glob style matching";
- license = "LGPL3";
+ license = stdenv.lib.licenses.lgpl3;
maintainers = with stdenv.lib.maintainers; [qknight];
};
}
-
diff --git a/pkgs/applications/misc/surf/default.nix b/pkgs/applications/misc/surf/default.nix
index 42792ba8f91..983fbde0c45 100644
--- a/pkgs/applications/misc/surf/default.nix
+++ b/pkgs/applications/misc/surf/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "01b8hq8z2wd7ssym5bypx2b15mrs1lhgkrcgxf700kswxvxcrhgx";
};
- buildInputs = [ gtk makeWrapper webkit pkgconfig glib libsoup ];
+ buildInputs = [ gtk makeWrapper webkit gsettings_desktop_schemas pkgconfig glib libsoup ];
# Allow users set their own list of patches
inherit patches;
@@ -21,9 +21,12 @@ stdenv.mkDerivation rec {
preConfigure = [ ''sed -i "s@PREFIX = /usr/local@PREFIX = $out@g" config.mk'' ];
installPhase = ''
make PREFIX=/ DESTDIR=$out install
+ '';
+
+ preFixup = ''
wrapProgram "$out/bin/surf" \
--prefix GIO_EXTRA_MODULES : ${glib_networking}/lib/gio/modules \
- --prefix XDG_DATA_DIRS : "${gsettings_desktop_schemas}/share"
+ --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
'';
meta = {
@@ -35,7 +38,7 @@ stdenv.mkDerivation rec {
surf to another URI by setting its XProperties.
'';
homepage = http://surf.suckless.org;
- license = "MIT";
+ license = stdenv.lib.licenses.mit;
platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/misc/sweethome3d/default.nix b/pkgs/applications/misc/sweethome3d/default.nix
new file mode 100644
index 00000000000..ab7a8240ebf
--- /dev/null
+++ b/pkgs/applications/misc/sweethome3d/default.nix
@@ -0,0 +1,66 @@
+{ stdenv, fetchurl, fetchcvs, makeWrapper, makeDesktopItem, jdk, jre, ant
+, p7zip }:
+
+let
+
+ mkSweetHome3D =
+ { name, module, version, src, license, description }:
+
+ stdenv.mkDerivation rec {
+ inherit name version src description;
+ exec = stdenv.lib.toLower module;
+ sweethome3dItem = makeDesktopItem {
+ inherit name exec;
+ comment = description;
+ desktopName = name;
+ genericName = "Computer Aided (Interior) Design";
+ categories = "Application;CAD;";
+ };
+
+ buildInputs = [ ant jdk jre makeWrapper p7zip ];
+
+ buildPhase = ''
+ ant furniture textures help
+ mkdir -p $out/share/{java,applications}
+ mv build/*.jar $out/share/java/.
+ ant
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp install/${module}-${version}.jar $out/share/java/.
+ cp ${sweethome3dItem}/share/applications/* $out/share/applications
+ makeWrapper ${jre}/bin/java $out/bin/$exec \
+ --add-flags "-jar $out/share/java/${module}-${version}.jar -cp $out/share/java/Furniture.jar:$out/share/java/Textures.jar:$out/share/java/Help.jar ${if stdenv.system == "x86_64-linux" then "-d64" else "-d32"}"
+ '';
+
+ dontStrip = true;
+
+ meta = {
+ homepage = "http://www.sweethome3d.com/index.jsp";
+ inherit description;
+ inherit license;
+ maintainers = [ stdenv.lib.maintainers.edwtjo ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+ };
+
+ d2u = stdenv.lib.replaceChars ["."] ["_"];
+
+in rec {
+
+ application = mkSweetHome3D rec {
+ version = "4.3.1";
+ module = "SweetHome3D";
+ name = stdenv.lib.toLower module + "-application-" + version;
+ description = "Design and visualize your future home";
+ license = stdenv.lib.licenses.gpl2Plus;
+ src = fetchcvs {
+ cvsRoot = ":pserver:anonymous@sweethome3d.cvs.sourceforge.net:/cvsroot/sweethome3d";
+ sha256 = "0jn3xamghz8rsmzvpd57cvz32yk8mni8dyx15xizjcki0450bp3f";
+ module = module;
+ tag = "V_" + d2u version;
+ };
+ };
+
+}
diff --git a/pkgs/applications/misc/sweethome3d/editors.nix b/pkgs/applications/misc/sweethome3d/editors.nix
new file mode 100644
index 00000000000..9eca1df59f5
--- /dev/null
+++ b/pkgs/applications/misc/sweethome3d/editors.nix
@@ -0,0 +1,90 @@
+{ stdenv, fetchurl, fetchcvs, makeWrapper, makeDesktopItem, jdk, jre, ant
+, p7zip, sweethome3dApp }:
+
+let
+
+ sweetExec = with stdenv.lib;
+ m: "sweethome3d-"
+ + removeSuffix "libraryeditor" (toLower m)
+ + "-editor";
+ sweetName = m: v: sweetExec m + "-" + v;
+
+ mkEditorProject =
+ { name, module, version, src, license, description }:
+
+ stdenv.mkDerivation rec {
+ application = sweethome3dApp;
+ inherit name module version src description;
+ exec = sweetExec module;
+ editorItem = makeDesktopItem {
+ inherit name exec;
+ comment = description;
+ desktopName = name;
+ genericName = "Computer Aided (Interior) Design";
+ categories = "Application;CAD;";
+ };
+
+ buildInputs = [ ant jre jdk makeWrapper ];
+
+ patchPhase = ''
+ sed -i -e 's,../SweetHome3D,${application.src},g' build.xml
+ '';
+
+ buildPhase = ''
+ ant -lib ${application.src}/libtest -lib ${application.src}/lib -lib ${jdk}/lib
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ mkdir -p $out/share/{java,applications}
+ cp ${module}-${version}.jar $out/share/java/.
+ cp ${editorItem}/share/applications/* $out/share/applications
+ makeWrapper ${jre}/bin/java $out/bin/$exec \
+ --add-flags "-jar $out/share/java/${module}-${version}.jar ${if stdenv.system == "x86_64-linux" then "-d64" else "-d32"}"
+ '';
+
+ dontStrip = true;
+
+ meta = {
+ homepage = "http://www.sweethome3d.com/index.jsp";
+ inherit description;
+ inherit license;
+ maintainers = [ stdenv.lib.maintainers.edwtjo ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+
+ };
+
+ d2u = stdenv.lib.replaceChars ["."] ["_"];
+
+in rec {
+
+ textures-editor = mkEditorProject rec {
+ version = "1.3";
+ module = "TexturesLibraryEditor";
+ name = sweetName module version;
+ description = "Easily create SH3T files and edit the properties of the texture images it contain";
+ license = stdenv.lib.licenses.gpl2Plus;
+ src = fetchcvs {
+ cvsRoot = ":pserver:anonymous@sweethome3d.cvs.sourceforge.net:/cvsroot/sweethome3d";
+ sha256 = "1caf1hmf87bj5dr7w2swnlbvkb3q1jdjr1zgjn1k07d0fxh0ikbx";
+ module = module;
+ tag = "V_" + d2u version;
+ };
+ };
+
+ furniture-editor = mkEditorProject rec {
+ version = "1.13";
+ module = "FurnitureLibraryEditor";
+ name = sweetName module version;
+ description = "Quickly create SH3F files and edit the properties of the 3D models it contain";
+ license = stdenv.lib.licenses.gpl2;
+ src = fetchcvs {
+ cvsRoot = ":pserver:anonymous@sweethome3d.cvs.sourceforge.net:/cvsroot/sweethome3d";
+ sha256 = "1nll5589rc0g71zd86cwmzl4p2icynykj106schmxric9v17jbv5";
+ module = module;
+ tag = "V_" + d2u version;
+ };
+ };
+
+}
diff --git a/pkgs/applications/misc/synergy/cryptopp.patch b/pkgs/applications/misc/synergy/cryptopp.patch
index d0aebb87261..1c296423acd 100644
--- a/pkgs/applications/misc/synergy/cryptopp.patch
+++ b/pkgs/applications/misc/synergy/cryptopp.patch
@@ -1,32 +1,30 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 3b61fc0..2206646 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -133,6 +133,9 @@ if (UNIX)
+diff -urN synergy-1.4.17-Source/CMakeLists.txt synergy-1.4.17-Source-fix/CMakeLists.txt
+--- synergy-1.4.17-Source/CMakeLists.txt 2014-03-14 21:34:19.000000000 +0100
++++ synergy-1.4.17-Source-fix/CMakeLists.txt 2014-04-11 13:37:18.839338710 +0200
+@@ -145,6 +145,9 @@
check_type_size(long SIZEOF_LONG)
check_type_size(short SIZEOF_SHORT)
-+ # let's just assume cryptopp exists (provided by the Nix expression)
-+ list(APPEND libs cryptopp)
++ # let's just assume cryptopp exists (provided by the Nix expression)
++ list(APPEND libs cryptopp)
+
# pthread is used on both Linux and Mac
check_library_exists("pthread" pthread_create "" HAVE_PTHREAD)
if (HAVE_PTHREAD)
-@@ -303,7 +306,6 @@ if (VNC_SUPPORT)
+@@ -317,7 +320,6 @@
endif()
add_subdirectory(src)
--add_subdirectory(tools)
+-add_subdirectory(ext)
if (WIN32)
- # add /analyze in order to unconver potential bugs in the source code
-diff --git a/src/lib/io/CCryptoMode.h b/src/lib/io/CCryptoMode.h
-index 9b7e8ad..0d659ac 100644
---- a/src/lib/io/CCryptoMode.h
-+++ b/src/lib/io/CCryptoMode.h
-@@ -17,9 +17,9 @@
-
- #pragma once
+ # TODO: consider using /analyze to uncover potential bugs in the source code.
+diff -urN synergy-1.4.17-Source/src/lib/io/CryptoMode_cryptopp.h synergy-1.4.17-Source-fix/src/lib/io/CryptoMode_cryptopp.h
+--- synergy-1.4.17-Source/src/lib/io/CryptoMode_cryptopp.h 2014-02-28 13:36:45.000000000 +0100
++++ synergy-1.4.17-Source-fix/src/lib/io/CryptoMode_cryptopp.h 2014-04-11 13:36:01.111985556 +0200
+@@ -25,6 +25,6 @@
+ # pragma GCC system_header
+ #endif
-#include
-#include
@@ -34,21 +32,14 @@ index 9b7e8ad..0d659ac 100644
+#include
+#include
+#include
- #include "ECryptoMode.h"
- #include "CString.h"
+diff -urN synergy-1.4.17-Source/src/lib/io/CryptoStream_cryptopp.h synergy-1.4.17-Source-fix/src/lib/io/CryptoStream_cryptopp.h
+--- synergy-1.4.17-Source/src/lib/io/CryptoStream_cryptopp.h 2014-02-28 13:36:45.000000000 +0100
++++ synergy-1.4.17-Source-fix/src/lib/io/CryptoStream_cryptopp.h 2014-04-11 13:36:07.173013005 +0200
+@@ -25,5 +25,5 @@
+ # pragma GCC system_header
+ #endif
-diff --git a/src/lib/io/CCryptoStream.h b/src/lib/io/CCryptoStream.h
-index 104b1f6..09c4dc4 100644
---- a/src/lib/io/CCryptoStream.h
-+++ b/src/lib/io/CCryptoStream.h
-@@ -20,8 +20,8 @@
- #include "BasicTypes.h"
- #include "CStreamFilter.h"
- #include "CCryptoMode.h"
-#include
-#include
+#include
+#include
-
- class CCryptoOptions;
-
diff --git a/pkgs/applications/misc/synergy/default.nix b/pkgs/applications/misc/synergy/default.nix
index c01d67943e5..8d914c26221 100644
--- a/pkgs/applications/misc/synergy/default.nix
+++ b/pkgs/applications/misc/synergy/default.nix
@@ -1,36 +1,38 @@
-{ stdenv, fetchurl, cmake, x11, libX11, libXi, libXtst, libXrandr, xinput
-, cryptopp ? null, unzip ? null }:
+{ stdenv, fetchurl, cmake, x11, libX11, libXi, libXtst, libXrandr, xinput, curl
+, cryptopp ? null, unzip }:
assert stdenv.isLinux -> cryptopp != null;
-assert !stdenv.isLinux -> unzip != null;
with stdenv.lib;
stdenv.mkDerivation rec {
- name = "synergy-1.4.15";
+ name = "synergy-1.5.0";
src = fetchurl {
- url = "http://synergy.googlecode.com/files/${name}-Source.tar.gz";
- sha256 = "0l1mxxky9hacyva0npzkgkwg4wkmihzq3abdrds0w5f6is44adv4";
+ url = "http://synergy-project.org/files/packages/synergy-1.5.0-r2278-Source.tar.gz";
+ sha256 = "097hk9v01lwzs7ly6ynadxmjh7ad68l5si7w4qmjn6z7l8b61gv6";
};
patches = optional stdenv.isLinux ./cryptopp.patch;
- postPatch = if stdenv.isLinux then ''
+ postPatch = (if stdenv.isLinux then ''
sed -i -e '/HAVE_X11_EXTENSIONS_XRANDR_H/c \
set(HAVE_X11_EXTENSIONS_XRANDR_H true)' CMakeLists.txt
'' else ''
- ${unzip}/bin/unzip -d tools/cryptopp562 tools/cryptopp562.zip
+ ${unzip}/bin/unzip -d ext/cryptopp562 ext/cryptopp562.zip
+ '') + ''
+ ${unzip}/bin/unzip -d ext/gmock-1.6.0 ext/gmock-1.6.0.zip
+ ${unzip}/bin/unzip -d ext/gtest-1.6.0 ext/gtest-1.6.0.zip
'';
- buildInputs = [ cmake x11 libX11 libXi libXtst libXrandr xinput ]
+ buildInputs = [ cmake x11 libX11 libXi libXtst libXrandr xinput curl ]
++ optional stdenv.isLinux cryptopp;
# At this moment make install doesn't work for synergy
# http://synergy-foss.org/spit/issues/details/3317/
installPhase = ''
- ensureDir $out/bin
+ mkdir -p $out/bin
cp ../bin/synergyc $out/bin
cp ../bin/synergys $out/bin
cp ../bin/synergyd $out/bin
diff --git a/pkgs/applications/misc/taffybar/default.nix b/pkgs/applications/misc/taffybar/default.nix
new file mode 100644
index 00000000000..6b282116343
--- /dev/null
+++ b/pkgs/applications/misc/taffybar/default.nix
@@ -0,0 +1,27 @@
+# This file was auto-generated by cabal2nix. Please do NOT edit manually!
+
+{ cabal, cairo, dbus, dyre, enclosedExceptions, filepath, gtk
+, gtkTraymanager, HStringTemplate, HTTP, mtl, network, parsec, safe
+, split, stm, text, time, transformers, utf8String, X11, xdgBasedir
+, xmonad, xmonadContrib
+}:
+
+cabal.mkDerivation (self: {
+ pname = "taffybar";
+ version = "0.4.0";
+ sha256 = "1l6zl5mlpkdsvs3id6ivh4b74p65n6jr17k23y2cdwj2fr9prvr8";
+ isLibrary = true;
+ isExecutable = true;
+ buildDepends = [
+ cairo dbus dyre enclosedExceptions filepath gtk gtkTraymanager
+ HStringTemplate HTTP mtl network parsec safe split stm text time
+ transformers utf8String X11 xdgBasedir xmonad xmonadContrib
+ ];
+ pkgconfigDepends = [ gtk ];
+ meta = {
+ homepage = "http://github.com/travitch/taffybar";
+ description = "A desktop bar similar to xmobar, but with more GUI";
+ license = self.stdenv.lib.licenses.bsd3;
+ platforms = self.ghc.meta.platforms;
+ };
+})
diff --git a/pkgs/applications/misc/tangogps/default.nix b/pkgs/applications/misc/tangogps/default.nix
index 609849166d1..aa1df2c9d1a 100644
--- a/pkgs/applications/misc/tangogps/default.nix
+++ b/pkgs/applications/misc/tangogps/default.nix
@@ -38,6 +38,6 @@ stdenv.mkDerivation rec {
#homepage = http://www.tangogps.org/; # no longer valid, I couldn't find any other
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
};
}
diff --git a/pkgs/applications/misc/taskjuggler/default.nix b/pkgs/applications/misc/taskjuggler/default.nix
index 77acc511fe4..e1e04771460 100644
--- a/pkgs/applications/misc/taskjuggler/default.nix
+++ b/pkgs/applications/misc/taskjuggler/default.nix
@@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = "http://www.taskjuggler.org";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
description = "Project management tool";
longDescription = ''
TaskJuggler is a modern and powerful, Open Source project management
diff --git a/pkgs/applications/misc/taskwarrior/default.nix b/pkgs/applications/misc/taskwarrior/default.nix
index dc1fce1d64c..998c34e5610 100644
--- a/pkgs/applications/misc/taskwarrior/default.nix
+++ b/pkgs/applications/misc/taskwarrior/default.nix
@@ -1,17 +1,17 @@
-{stdenv, fetchurl, cmake}:
+{ stdenv, fetchurl, cmake, libuuid }:
stdenv.mkDerivation rec {
name = "taskwarrior-${version}";
- version = "2.2.0";
+ version = "2.3.0";
enableParallelBuilding = true;
src = fetchurl {
url = "http://www.taskwarrior.org/download/task-${version}.tar.gz";
- sha256 = "057fh50qp9bd5s08rw51iybpamn55v5nhn3s6ds89g76hp95vqir";
+ sha256 = "0wxcfq0n96vmcbwrlk2x377k8cc5k4i64ca6p02y74g6168ji6ib";
};
- nativeBuildInputs = [ cmake ];
+ nativeBuildInputs = [ cmake libuuid ];
meta = {
description = "GTD (getting things done) implementation";
diff --git a/pkgs/applications/misc/terminator/default.nix b/pkgs/applications/misc/terminator/default.nix
new file mode 100644
index 00000000000..c337cd329c9
--- /dev/null
+++ b/pkgs/applications/misc/terminator/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, python, pygtk, notify, keybinder, vte, gettext, intltool
+, makeWrapper
+}:
+
+stdenv.mkDerivation rec {
+ name = "terminator-${version}";
+ version = "0.97";
+
+ src = fetchurl {
+ url = "https://launchpad.net/terminator/trunk/${version}/+download/${name}.tar.gz";
+ sha256 = "1xykpx10g2zssx0ss6351ca6vmmma7zwxxhjz0fg28ps4dq88cci";
+ };
+
+ buildInputs = [
+ python pygtk notify keybinder vte gettext intltool makeWrapper
+ ];
+
+ installPhase = ''
+ python setup.py --without-icon-cache install --prefix="$out"
+
+ for file in "$out"/bin/*; do
+ wrapProgram "$file" \
+ --prefix PYTHONPATH : "$(toPythonPath $out):$PYTHONPATH"
+ done
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Terminal emulator with support for tiling and tabs";
+ longDescription = ''
+ The goal of this project is to produce a useful tool for arranging
+ terminals. It is inspired by programs such as gnome-multi-term,
+ quadkonsole, etc. in that the main focus is arranging terminals in grids
+ (tabs is the most common default method, which Terminator also supports).
+ '';
+ homepage = http://gnometerminator.blogspot.no/p/introduction.html;
+ license = licenses.gpl2;
+ maintainers = [ maintainers.bjornfor ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/misc/tint2/default.nix b/pkgs/applications/misc/tint2/default.nix
new file mode 100644
index 00000000000..9eb3ed13af5
--- /dev/null
+++ b/pkgs/applications/misc/tint2/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, pkgconfig, cmake, pango, cairo, glib, imlib2, libXinerama
+, libXrender, libXcomposite, libXdamage, libX11, libXrandr, gtk, libpthreadstubs
+, libXdmcp
+}:
+
+stdenv.mkDerivation rec {
+ name = "tint2-${version}";
+ version = "0.11";
+
+ src = fetchurl {
+ url = "http://tint2.googlecode.com/files/${name}.tar.bz2";
+ sha256 = "07a74ag7lhc6706z34zvqj2ikyyl7wnzisfxpld67ljpc1m6w47y";
+ };
+
+ buildInputs = [ pkgconfig cmake pango cairo glib imlib2 libXinerama
+ libXrender libXcomposite libXdamage libX11 libXrandr gtk libpthreadstubs
+ libXdmcp
+ ];
+
+ preConfigure = "substituteInPlace CMakeLists.txt --replace /etc $out/etc";
+
+ cmakeFlags = [
+ "-DENABLE_TINT2CONF=0"
+ ];
+
+ meta = {
+ homepage = http://code.google.com/p/tint2;
+ license = stdenv.lib.licenses.gpl2;
+ description = "A simple panel/taskbar unintrusive and light (memory / cpu / aestetic)";
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/misc/twmn/default.nix b/pkgs/applications/misc/twmn/default.nix
new file mode 100644
index 00000000000..65c2ccb5ff0
--- /dev/null
+++ b/pkgs/applications/misc/twmn/default.nix
@@ -0,0 +1,29 @@
+{ fetchurl, stdenv, fetchgit, qt4, pkgconfig, boost, dbus }:
+
+stdenv.mkDerivation rec {
+ rev = "9f52882688ba03d7aaab2e3fd83cb05cfbf1a374";
+ name = "twmn-${rev}";
+
+ src = fetchgit {
+ inherit rev;
+ url = "https://github.com/sboli/twmn.git";
+ sha256 = "1jd2y0ydcpjdmjbx77lw35710sqfwbgyrnpv66mi3gwvrbyiwpf3";
+ };
+
+ buildInputs = [ qt4 pkgconfig boost ];
+ propagatedBuildInputs = [ dbus ];
+
+ configurePhase = "qmake";
+
+ installPhase = ''
+ mkdir -p "$out/bin"
+ cp bin/* "$out/bin"
+ '';
+
+ meta = {
+ description = "A notification system for tiling window managers";
+ homepage = "https://github.com/sboli/twmn";
+ platforms = with stdenv.lib.platforms; linux;
+ maintainers = [ stdenv.lib.maintainers.matejc ];
+ };
+}
diff --git a/pkgs/applications/misc/vanitygen/default.nix b/pkgs/applications/misc/vanitygen/default.nix
index e16767d4c26..6be2dc394cc 100644
--- a/pkgs/applications/misc/vanitygen/default.nix
+++ b/pkgs/applications/misc/vanitygen/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
buildInputs = [ openssl pcre ];
installPhase = ''
- ensureDir $out/bin
+ mkdir -p $out/bin
cp vanitygen $out/bin
cp keyconv $out/bin/vanitygen-keyconv
'';
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
and will run about 30% faster.
'';
homepage = "https://github.com/samr7/vanitygen";
- license = "AGPLv3";
+ license = stdenv.lib.licenses.agpl3;
platforms = stdenv.lib.platforms.all;
};
}
diff --git a/pkgs/applications/misc/vifm/default.nix b/pkgs/applications/misc/vifm/default.nix
index 7230e84601e..5abf57ae1fc 100644
--- a/pkgs/applications/misc/vifm/default.nix
+++ b/pkgs/applications/misc/vifm/default.nix
@@ -2,17 +2,16 @@
let
name = "vifm-${version}";
- version = "0.7.5";
+ version = "0.7.7";
in stdenv.mkDerivation {
inherit name;
src = fetchurl {
- url="mirror://sourceforge/project/vifm/vifm/${name}.tar.bz2";
- sha256 ="1r1d92zrff94rfx011dw2qsgdwd2ksqlz15la74d6h7sfcsnyd01";
+ url = "mirror://sourceforge/project/vifm/vifm/${name}.tar.bz2";
+ sha256 = "1lflmkd5q7qqi9d44py0y41pcx5bsadkihn3gc0x5cka04f2gh0d";
};
- #phaseNames = ["doConfigure" "doMakeInstall"];
buildInputs = [ utillinux ncurses file libX11 ];
meta = {
diff --git a/pkgs/applications/misc/viking/default.nix b/pkgs/applications/misc/viking/default.nix
index 70ac055db09..6508b12e1de 100644
--- a/pkgs/applications/misc/viking/default.nix
+++ b/pkgs/applications/misc/viking/default.nix
@@ -38,6 +38,6 @@ stdenv.mkDerivation {
homepage = http://viking.sourceforge.net/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
};
}
diff --git a/pkgs/applications/misc/vue/default.nix b/pkgs/applications/misc/vue/default.nix
index c90e4d24f37..542f11f6e67 100644
--- a/pkgs/applications/misc/vue/default.nix
+++ b/pkgs/applications/misc/vue/default.nix
@@ -11,10 +11,10 @@ let
(builtins.attrNames (builtins.removeAttrs x helperArgNames));
sourceInfo = rec {
baseName="vue";
- version="3.1.2";
+ version="3.2.2";
name="${baseName}-${version}";
- url="http://releases.atech.tufts.edu/vue/v${version}/VUE_3_1_2.zip";
- hash="0ga98gnp4qhcrb31cb8j0mwbrh6ym6hr4k5y4blxvyfff9c0vq47";
+ url="releases.atech.tufts.edu/jenkins/job/VUE/64/deployedArtifacts/download/artifact.2";
+ hash="0sb1kgan8fvph2cqfxk3906cwx5wy83zni2vlz4zzi6yg4zvfxld";
};
in
rec {
@@ -30,9 +30,8 @@ rec {
phaseNames = ["doDeploy"];
doDeploy = a.fullDepEntry ''
- unzip ${src}
mkdir -p "$out"/{share/vue,bin}
- cp VUE.jar "$out/share/vue/vue.jar"
+ cp ${src} "$out/share/vue/vue.jar"
echo '#!${a.stdenv.shell}' >> "$out/bin/vue"
echo '${a.jre}/bin/java -jar "'"$out/share/vue/vue.jar"'" "$@"' >> "$out/bin/vue"
chmod a+x "$out/bin/vue"
diff --git a/pkgs/applications/misc/wmname/default.nix b/pkgs/applications/misc/wmname/default.nix
index 417d4a5ae68..0f71a53075f 100644
--- a/pkgs/applications/misc/wmname/default.nix
+++ b/pkgs/applications/misc/wmname/default.nix
@@ -15,6 +15,6 @@ stdenv.mkDerivation rec {
meta = {
description = "Prints or set the window manager name property of the root window";
homepage = "http://tools.suckless.org/wmname";
- license = "MIT";
+ license = stdenv.lib.licenses.mit;
};
}
diff --git a/pkgs/applications/misc/xca/default.nix b/pkgs/applications/misc/xca/default.nix
index fb6b011f30a..0bc2170340c 100644
--- a/pkgs/applications/misc/xca/default.nix
+++ b/pkgs/applications/misc/xca/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, which, openssl, qt4, libtool }:
+{ stdenv, fetchurl, pkgconfig, which, openssl, qt4, libtool, gcc, makeWrapper }:
stdenv.mkDerivation rec {
name = "xca-${version}";
@@ -15,7 +15,12 @@ stdenv.mkDerivation rec {
prefix=$out ./configure ${openssl} ${libtool}
'';
- buildInputs = [ openssl qt4 libtool ];
+ postInstall = ''
+ wrapProgram "$out/bin/xca" \
+ --prefix LD_LIBRARY_PATH : "${qt4}/lib:${gcc.gcc}/lib:${gcc.gcc}/lib64:${openssl}/lib:${libtool}/lib"
+ '';
+
+ buildInputs = [ openssl qt4 libtool gcc makeWrapper ];
nativeBuildInputs = [ pkgconfig ];
meta = with stdenv.lib; {
diff --git a/pkgs/applications/misc/xchm/default.nix b/pkgs/applications/misc/xchm/default.nix
index aed55c67c10..c6bfa07cb88 100644
--- a/pkgs/applications/misc/xchm/default.nix
+++ b/pkgs/applications/misc/xchm/default.nix
@@ -1,10 +1,10 @@
{stdenv, fetchurl, wxGTK, chmlib}:
stdenv.mkDerivation {
- name = "xchm-1.18";
+ name = "xchm-1.23";
src = fetchurl {
- url = mirror://sourceforge/xchm/xchm-1.18.tar.gz;
- sha256 = "1wvvyzqbmj3c6i46x4vpxkawjwmmp276r84ifvlzaj5q4b52g5gw";
+ url = mirror://sourceforge/xchm/xchm-1.23.tar.gz;
+ sha256 = "0qn0fyxcrn30ndq2asx31k0qkx3grbm16fb1y580wd2gjmh5r3wg";
};
buildInputs = [wxGTK chmlib];
diff --git a/pkgs/applications/misc/xcruiser/default.nix b/pkgs/applications/misc/xcruiser/default.nix
new file mode 100644
index 00000000000..15202a1e90c
--- /dev/null
+++ b/pkgs/applications/misc/xcruiser/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, gccmakedep, xlibs }:
+
+stdenv.mkDerivation {
+ name = "xcruiser-0.30";
+
+ src = fetchurl {
+ url = mirror://sourceforge/xcruiser/xcruiser/xcruiser-0.30/xcruiser-0.30.tar.gz;
+ sha256 = "1r8whva38xizqdh7jmn6wcmfmsndc67pkw22wzfzr6rq0vf6hywi";
+ };
+
+ buildInputs = with xlibs; [ gccmakedep imake libXt libXaw libXpm libXext ];
+
+ configurePhase = "xmkmf -a";
+
+ preBuild = ''
+ makeFlagsArray=( BINDIR=$out/bin XAPPLOADDIR=$out/etc/X11/app-defaults)
+ '';
+
+ meta = with stdenv.lib;
+ { description = "Filesystem visualization utility";
+ longDescription = ''
+ XCruiser, formerly known as XCruise, is a filesystem visualization utility.
+ It constructs a virtually 3-D formed universe from a directory
+ tree and allows you to "cruise" within a visualized filesystem.
+ '';
+ homepage = http://xcruiser.sourceforge.net/;
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ emery ];
+ };
+}
diff --git a/pkgs/applications/misc/xfe/default.nix b/pkgs/applications/misc/xfe/default.nix
index 9b1385d9d6a..d09a899b897 100644
--- a/pkgs/applications/misc/xfe/default.nix
+++ b/pkgs/applications/misc/xfe/default.nix
@@ -24,8 +24,8 @@ stdenv.mkDerivation rec {
Xfe aims to be the filemanager of choice for all the Unix addicts!
'';
homepage = "http://sourceforge.net/projects/xfe/";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.bbenoist ];
- platforms = stdenv.lib.platforms.mesaPlatforms;
+ platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/misc/xfontsel/default.nix b/pkgs/applications/misc/xfontsel/default.nix
index b159dd282e2..2bb05fe44e0 100644
--- a/pkgs/applications/misc/xfontsel/default.nix
+++ b/pkgs/applications/misc/xfontsel/default.nix
@@ -4,11 +4,11 @@
{stdenv, fetchurl, makeWrapper, libX11, pkgconfig, libXaw}:
stdenv.mkDerivation rec {
- name = "xfontsel-1.0.2";
+ name = "xfontsel-1.0.5";
src = fetchurl {
url = "mirror://xorg/individual/app/${name}.tar.bz2";
- sha256 = "1a86a08sf0wjrki9ydh7hr5qf6hrixc4ljlxizakjzmx20wvlrks";
+ sha256 = "1grir464hy52a71r3mpm9mzvkf7nwr3vk0b1vc27pd3gp588a38p";
};
buildInputs = [libX11 makeWrapper pkgconfig libXaw];
@@ -28,8 +28,8 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://www.x.org/;
description = "Allows testing the fonts available in an X server";
- licesnse = "free";
+ license = "free";
maintainers = with stdenv.lib.maintainers; [viric];
- platforms = with stdenv.lib.platforms; linux;
+ platforms = with stdenv.lib.platforms; linux ++ darwin;
};
}
diff --git a/pkgs/applications/misc/xlsfonts/default.nix b/pkgs/applications/misc/xlsfonts/default.nix
index 879f5ae568c..06b09154ba5 100644
--- a/pkgs/applications/misc/xlsfonts/default.nix
+++ b/pkgs/applications/misc/xlsfonts/default.nix
@@ -4,11 +4,11 @@
{stdenv, fetchurl, libX11, pkgconfig}:
stdenv.mkDerivation rec {
- name = "xlsfonts-1.0.2";
+ name = "xlsfonts-1.0.4";
src = fetchurl {
url = "mirror://xorg/individual/app/${name}.tar.bz2";
- sha256 = "070iym754g3mf9x6xczl4gdnpvlk6rdyl1ndwhpjl21vg2dm2vnc";
+ sha256 = "1lhcx600z9v65nk93xaxfzi79bm4naynabb52gz1vy1bxj2r25r8";
};
buildInputs = [libX11 pkgconfig];
@@ -16,8 +16,8 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://www.x.org/;
description = "Lists the fonts available in the X server";
- licesnse = "free";
+ license = "free";
maintainers = with stdenv.lib.maintainers; [viric];
- platforms = with stdenv.lib.platforms; linux;
+ platforms = with stdenv.lib.platforms; linux ++ darwin;
};
}
diff --git a/pkgs/applications/misc/xmobar/add-freeration-variable.patch b/pkgs/applications/misc/xmobar/add-freeration-variable.patch
deleted file mode 100644
index a8c10e1a30d..00000000000
--- a/pkgs/applications/misc/xmobar/add-freeration-variable.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-diff --git a/readme.md b/readme.md
-index f4f07e8..de679c7 100644
---- a/readme.md
-+++ b/readme.md
-@@ -645,7 +645,7 @@ something like:
- - Args: default monitor arguments
- - Variables that can be used with the `-t`/`--template` argument:
- `total`, `free`, `buffer`, `cache`, `rest`, `used`,
-- `usedratio`, `usedbar`, `freebar`
-+ `usedratio`, `usedbar`, `freeratio`, `freebar`
- - Default template: `Mem: % (M)`
-
- ### `Swap Args RefreshRate`
-diff --git a/src/Plugins/Monitors/Mem.hs b/src/Plugins/Monitors/Mem.hs
-index 5c55ee2..3cf46c7 100644
---- a/src/Plugins/Monitors/Mem.hs
-+++ b/src/Plugins/Monitors/Mem.hs
-@@ -19,8 +19,8 @@ import Plugins.Monitors.Common
- memConfig :: IO MConfig
- memConfig = mkMConfig
- "Mem: % (M)" -- template
-- ["usedbar", "freebar", "usedratio", "total",
-- "free", "buffer", "cache", "rest", "used"] -- available replacements
-+ ["usedbar", "freebar", "usedratio", "freeratio", "total",
-+ "free", "buffer", "cache", "rest", "used"] -- available replacements
-
- fileMEM :: IO String
- fileMEM = readFile "/proc/meminfo"
-@@ -33,7 +33,8 @@ parseMEM =
- rest = free + buffer + cache
- used = total - rest
- usedratio = used / total
-- return [usedratio, total, free, buffer, cache, rest, used]
-+ freeratio = free / total
-+ return [usedratio, freeratio, total, free, buffer, cache, rest, used, freeratio]
-
- totalMem :: IO Float
- totalMem = fmap ((*1024) . (!!1)) parseMEM
-@@ -42,15 +43,16 @@ usedMem :: IO Float
- usedMem = fmap ((*1024) . (!!6)) parseMEM
-
- formatMem :: [Float] -> Monitor [String]
--formatMem (r:xs) =
-+formatMem (r:fr:xs) =
- do let f = showDigits 0
- rr = 100 * r
- ub <- showPercentBar rr r
- fb <- showPercentBar (100 - rr) (1 - r)
- rs <- showPercentWithColors r
-+ fs <- showPercentWithColors fr
- s <- mapM (showWithColors f) xs
-- return (ub:fb:rs:s)
--formatMem _ = return $ replicate 9 "N/A"
-+ return (ub:fb:rs:fs:s)
-+formatMem _ = return $ replicate 10 "N/A"
-
- runMem :: [String] -> Monitor String
- runMem _ =
diff --git a/pkgs/applications/misc/xmobar/default.nix b/pkgs/applications/misc/xmobar/default.nix
index 273998dde5d..8d73dfebb18 100644
--- a/pkgs/applications/misc/xmobar/default.nix
+++ b/pkgs/applications/misc/xmobar/default.nix
@@ -1,23 +1,28 @@
-{ cabal, filepath, libXrandr, mtl, parsec, regexCompat, stm, time
-, utf8String, X11, X11Xft
+# This file was auto-generated by cabal2nix. Please do NOT edit manually!
+
+{ cabal, alsaCore, alsaMixer, dbus, filepath, hinotify, HTTP
+, libmpd, libXrandr, mtl, parsec, regexCompat, stm, time
+, timezoneOlson, timezoneSeries, utf8String, wirelesstools, X11
+, X11Xft
}:
cabal.mkDerivation (self: {
pname = "xmobar";
- version = "0.19";
- sha256 = "1lwbww9vpqscip16lqiax2qvfyksxms5xx4n0s61mzw7v61hyxq2";
+ version = "0.21";
+ sha256 = "1h0gsb808zm4j4kmw7fl4339wllc16ldy1ki96l8w3fvj30bcxpm";
isLibrary = false;
isExecutable = true;
buildDepends = [
- filepath mtl parsec regexCompat stm time utf8String X11 X11Xft
+ alsaCore alsaMixer dbus filepath hinotify HTTP libmpd mtl parsec
+ regexCompat stm time timezoneOlson timezoneSeries utf8String X11
+ X11Xft
];
- extraLibraries = [ libXrandr ];
- configureFlags = "-fwith_xft";
+ extraLibraries = [ libXrandr wirelesstools ];
+ configureFlags = "-fall_extensions";
meta = {
- homepage = "http://projects.haskell.org/xmobar/";
+ homepage = "http://xmobar.org";
description = "A Minimalistic Text Based Status Bar";
license = self.stdenv.lib.licenses.bsd3;
- platforms = self.ghc.meta.platforms;
- maintainers = [ self.stdenv.lib.maintainers.andres ];
+ platforms = self.stdenv.lib.platforms.linux;
};
})
diff --git a/pkgs/applications/misc/xneur/default.nix b/pkgs/applications/misc/xneur/default.nix
index 4f6e3342f58..cc08436fa03 100644
--- a/pkgs/applications/misc/xneur/default.nix
+++ b/pkgs/applications/misc/xneur/default.nix
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Utility for switching between keyboard layouts";
homepage = http://xneur.ru;
- license = "GPL2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.raskin ];
platforms = stdenv.lib.platforms.linux;
};
diff --git a/pkgs/applications/misc/xterm/default.nix b/pkgs/applications/misc/xterm/default.nix
index ef2d846dd2e..00e9ab0c810 100644
--- a/pkgs/applications/misc/xterm/default.nix
+++ b/pkgs/applications/misc/xterm/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, xorg, ncurses, freetype, fontconfig, pkgconfig }:
stdenv.mkDerivation rec {
- name = "xterm-281";
+ name = "xterm-303";
src = fetchurl {
url = "ftp://invisible-island.net/xterm/${name}.tgz";
- sha256 = "1yrjjya7z5s3fi0iiaxgna35jh0ib2zx1yafyng35jma6qbwhxx7";
+ sha256 = "0n7hay16aam9kfn642ri0wj5yzilbjm3l8znxc2p5dx9pn3rkwla";
};
buildInputs =
@@ -36,6 +36,6 @@ stdenv.mkDerivation rec {
homepage = http://invisible-island.net/xterm;
license = "BSD";
maintainers = with stdenv.lib.maintainers; [viric];
- platforms = with stdenv.lib.platforms; linux;
+ platforms = with stdenv.lib.platforms; linux ++ darwin;
};
}
diff --git a/pkgs/applications/misc/yeganesh/default.nix b/pkgs/applications/misc/yeganesh/default.nix
index 36a5817772d..f26d315fce2 100644
--- a/pkgs/applications/misc/yeganesh/default.nix
+++ b/pkgs/applications/misc/yeganesh/default.nix
@@ -1,3 +1,5 @@
+# This file was auto-generated by cabal2nix. Please do NOT edit manually!
+
{ cabal, filepath, strict, time, xdgBasedir }:
cabal.mkDerivation (self: {
diff --git a/pkgs/applications/misc/ykpers/default.nix b/pkgs/applications/misc/ykpers/default.nix
new file mode 100644
index 00000000000..e7bfa8ded50
--- /dev/null
+++ b/pkgs/applications/misc/ykpers/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl, pkgconfig, libusb1, libyubikey}:
+
+stdenv.mkDerivation rec
+{
+ version = "1.15.0";
+ name = "ykpers-${version}";
+
+ src = fetchurl
+ {
+ url = "http://opensource.yubico.com/yubikey-personalization/releases/${name}.tar.gz";
+ sha256 = "1n4s8kk31q5zh2rm7sj9qmv86yl8ibimdnpvk9ny391a88qlypyd";
+ };
+
+ buildInputs = [pkgconfig libusb1 libyubikey];
+
+ meta =
+ {
+ homepage = "http://opensource.yubico.com/yubikey-personalization/";
+ description = "YubiKey Personalization cross-platform library and tool";
+ license = "bsd";
+ maintainers = [ stdenv.lib.maintainers.calrama ];
+ };
+}
diff --git a/pkgs/applications/misc/zathura/core/default.nix b/pkgs/applications/misc/zathura/core/default.nix
index e5eae771d8b..5f44f79ebcd 100644
--- a/pkgs/applications/misc/zathura/core/default.nix
+++ b/pkgs/applications/misc/zathura/core/default.nix
@@ -1,29 +1,25 @@
-{ stdenv, fetchurl, pkgconfig, gtk, girara, gettext, docutils, file, makeWrapper }:
+{ stdenv, fetchurl, pkgconfig, gtk, girara, gettext, docutils, file, makeWrapper, zathura_icon }:
stdenv.mkDerivation rec {
-
- version = "0.2.2";
-
+ version = "0.2.9";
name = "zathura-core-${version}";
src = fetchurl {
url = "http://pwmt.org/projects/zathura/download/zathura-${version}.tar.gz";
- sha256 = "1ja2j9ygymr259fxf02j1vkvalypac48gpadq8fn3qbclxxj61k5";
+ sha256 = "17z05skjk95115ajp6459k1djadza1w8kck7jn1qnd697r01s1rc";
};
- buildInputs = [ pkgconfig gtk girara gettext makeWrapper ];
-
- # Bug in zathura build system: we should remove empty manfiles in order them
- # to be compiled properly
- preBuild = ''
- rm zathura.1
- rm zathurarc.5
- '';
+ buildInputs = [ pkgconfig file gtk girara gettext makeWrapper ];
makeFlags = [ "PREFIX=$(out)" "RSTTOMAN=${docutils}/bin/rst2man.py" "VERBOSE=1" ];
postInstall = ''
- wrapProgram "$out/bin/zathura" --prefix PATH ":" "${file}/bin"
+ wrapProgram "$out/bin/zathura" \
+ --prefix PATH ":" "${file}/bin" \
+ --prefix XDG_CONFIG_DIRS ":" "$out/etc"
+
+ mkdir -pv $out/etc
+ echo "set window-icon ${zathura_icon}" > $out/etc/zathurarc
'';
meta = {
diff --git a/pkgs/applications/misc/zathura/default.nix b/pkgs/applications/misc/zathura/default.nix
index 8bdc7865832..1a4ab3d772c 100644
--- a/pkgs/applications/misc/zathura/default.nix
+++ b/pkgs/applications/misc/zathura/default.nix
@@ -1,32 +1,45 @@
-{ callPackage, pkgs, fetchurl }:
+{ callPackage, pkgs, fetchurl, useMupdf }:
rec {
inherit (pkgs) stdenv;
- zathura_core = callPackage ./core { };
+ icon = ./icon.xpm;
+
+ zathura_core = callPackage ./core {
+ gtk = pkgs.gtk3;
+ zathura_icon = icon;
+ };
zathura_pdf_poppler = callPackage ./pdf-poppler { };
- zathura_djvu = callPackage ./djvu { };
+ zathura_pdf_mupdf = callPackage ./pdf-mupdf {
+ gtk = pkgs.gtk3;
+ };
- zathura_ps = callPackage ./ps { };
+ zathura_djvu = callPackage ./djvu {
+ gtk = pkgs.gtk3;
+ };
+
+ zathura_ps = callPackage ./ps {
+ gtk = pkgs.gtk3;
+ };
zathuraWrapper = stdenv.mkDerivation {
- inherit zathura_core;
+ inherit zathura_core icon;
name = "zathura-${zathura_core.version}";
plugins_path = stdenv.lib.makeSearchPath "lib" [
- zathura_pdf_poppler
zathura_djvu
zathura_ps
+ (if useMupdf then zathura_pdf_mupdf else zathura_pdf_poppler)
];
- icon = ./icon.xpm;
-
builder = ./builder.sh;
+ preferLocalBuild = true;
+
meta = {
homepage = http://pwmt.org/projects/zathura/;
description = "A highly customizable and functional PDF viewer";
diff --git a/pkgs/applications/misc/zathura/djvu/default.nix b/pkgs/applications/misc/zathura/djvu/default.nix
index 9486acfef65..1a2347f2727 100644
--- a/pkgs/applications/misc/zathura/djvu/default.nix
+++ b/pkgs/applications/misc/zathura/djvu/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, pkgconfig, gtk, zathura_core, girara, djvulibre, gettext }:
stdenv.mkDerivation rec {
- name = "zathura-djvu-0.2.1";
+ name = "zathura-djvu-0.2.3";
src = fetchurl {
url = "http://pwmt.org/projects/zathura/plugins/download/${name}.tar.gz";
- sha256 = "d8bb3c9e30244a0733e49740ee2dd099ce39fa16f2c320af27a0c09d9a25bcc3";
+ sha256 = "12gd8kb0al5mknh4rlvxzgzwz3vhjggqjh8ws27phaq14paq4vn1";
};
buildInputs = [ pkgconfig djvulibre gettext zathura_core gtk girara ];
diff --git a/pkgs/applications/misc/zathura/pdf-mupdf/config.patch b/pkgs/applications/misc/zathura/pdf-mupdf/config.patch
new file mode 100644
index 00000000000..c7d172c9263
--- /dev/null
+++ b/pkgs/applications/misc/zathura/pdf-mupdf/config.patch
@@ -0,0 +1,17 @@
+--- zathura-pdf-mupdf-0.2.6/config.mk
++++ zathura-pdf-mupdf-0.2.6/config.mk
+@@ -32,10 +32,11 @@
+ OPENSSL_INC ?= $(shell pkg-config --cflags libcrypto)
+ OPENSSL_LIB ?= $(shell pkg-config --libs libcrypto)
+
+-MUPDF_LIB ?= -lmupdf -lmupdf-js-none
++MUPDF_INC ?= $(shell pkg-config --cflags mupdf)
++MUPDF_LIB ?= $(shell pkg-config --libs mupdf)
+
+-INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC}
+-LIBS = ${GTK_LIB} ${GIRARA_LIB} ${MUPDF_LIB} ${OPENSSL_LIB} -ljbig2dec -lopenjp2 -ljpeg
++INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC} ${MUPDF_INC}
++LIBS = ${GTK_LIB} ${GIRARA_LIB} ${OPENSSL_LIB} ${MUPDF_LIB} -ljbig2dec -ljpeg
+
+ # flags
+ CFLAGS += -std=c99 -fPIC -pedantic -Wall -Wno-format-zero-length $(INCS)
diff --git a/pkgs/applications/misc/zathura/pdf-mupdf/default.nix b/pkgs/applications/misc/zathura/pdf-mupdf/default.nix
new file mode 100644
index 00000000000..4e585d852a2
--- /dev/null
+++ b/pkgs/applications/misc/zathura/pdf-mupdf/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, pkgconfig, zathura_core, gtk, girara, mupdf, openssl, openjpeg, libjpeg, jbig2dec }:
+
+stdenv.mkDerivation rec {
+ version = "0.2.6";
+ name = "zathura-pdf-mupdf-${version}";
+
+ src = fetchurl {
+ url = "http://pwmt.org/projects/zathura/plugins/download/${name}.tar.gz";
+ sha256 = "5df94b6f906008b5f3bca770a552da6d2917d6b8d3e4b3049cb7001302041b20";
+ };
+
+ buildInputs = [ pkgconfig zathura_core gtk girara openssl mupdf openjpeg libjpeg jbig2dec ];
+
+ makeFlags = "PREFIX=$(out) PLUGINDIR=$(out)/lib";
+
+ preConfigure = "patch -p1 < ${./config.patch}";
+
+ meta = {
+ homepage = http://pwmt.org/projects/zathura/;
+ description = "A zathura PDF plugin (mupdf)";
+ longDescription = ''
+ The zathura-pdf-mupdf plugin adds PDF support to zathura by
+ using the mupdf rendering library.
+ '';
+ license = stdenv.lib.licenses.zlib;
+ platforms = stdenv.lib.platforms.linux;
+# maintainers = [ ];
+ };
+}
diff --git a/pkgs/applications/misc/zathura/pdf-poppler/default.nix b/pkgs/applications/misc/zathura/pdf-poppler/default.nix
index faf4e49b968..6625bf47194 100644
--- a/pkgs/applications/misc/zathura/pdf-poppler/default.nix
+++ b/pkgs/applications/misc/zathura/pdf-poppler/default.nix
@@ -1,24 +1,24 @@
-{ stdenv, fetchurl, pkgconfig, zathura_core, girara, poppler, gettext }:
+{ stdenv, fetchurl, pkgconfig, zathura_core, girara, poppler }:
stdenv.mkDerivation rec {
- version = "0.2.2";
+ version = "0.2.5";
name = "zathura-pdf-poppler-${version}";
src = fetchurl {
url = "http://pwmt.org/projects/zathura/plugins/download/${name}.tar.gz";
- sha256 = "0px59f0bnmb9992n3c9iyzcwd6w7vg8ga069vc8qj4726ljml4c7";
+ sha256 = "1b0chsds8iwjm4g629p6a67nb6wgra65pw2vvngd7g35dmcjgcv0";
};
- buildInputs = [ pkgconfig poppler gettext zathura_core girara ];
+ buildInputs = [ pkgconfig poppler zathura_core girara ];
makeFlags = "PREFIX=$(out) PLUGINDIR=$(out)/lib";
meta = {
homepage = http://pwmt.org/projects/zathura/;
- description = "A zathura PDF plugin";
+ description = "A zathura PDF plugin (poppler)";
longDescription = ''
The zathura-pdf-poppler plugin adds PDF support to zathura by
- using the poppler rendering engine.
+ using the poppler rendering library.
'';
license = stdenv.lib.licenses.zlib;
platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/applications/misc/zathura/ps/default.nix b/pkgs/applications/misc/zathura/ps/default.nix
index 7c0dd552a66..eef02001601 100644
--- a/pkgs/applications/misc/zathura/ps/default.nix
+++ b/pkgs/applications/misc/zathura/ps/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, pkgconfig, gtk, zathura_core, girara, libspectre, gettext }:
stdenv.mkDerivation rec {
- name = "zathura-ps-0.2.0";
+ name = "zathura-ps-0.2.2";
src = fetchurl {
url = "http://pwmt.org/projects/zathura/plugins/download/${name}.tar.gz";
- sha256 = "717eda01213b162421b6b52f29d6b981edc302fddf351ccb2c093b6842751414";
+ sha256 = "1a6ps5v1wk18qvslbkjln6w8wfzzr6fi13ls96vbdc03vdhn4m76";
};
buildInputs = [ pkgconfig libspectre gettext zathura_core gtk girara ];
diff --git a/pkgs/applications/networking/bittorrentsync/default.nix b/pkgs/applications/networking/bittorrentsync/default.nix
index c2d2f28751a..989ceb235b0 100644
--- a/pkgs/applications/networking/bittorrentsync/default.nix
+++ b/pkgs/applications/networking/bittorrentsync/default.nix
@@ -1,47 +1,42 @@
{ stdenv, fetchurl, patchelf }:
-# this package contains the daemon version of bittorrent sync
-# it's unfortunately closed source.
-
let
- # TODO: arm, ppc, osx
-
arch = if stdenv.system == "x86_64-linux" then "x64"
else if stdenv.system == "i686-linux" then "i386"
else throw "Bittorrent Sync for: ${stdenv.system} not supported!";
-
- interpreter = if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2"
- else if stdenv.system == "i686-linux" then "ld-linux.so.2"
+
+ sha256 = if stdenv.system == "x86_64-linux" then "1xba0wv45w4kg84i5sywkfk44vj9wxkr7f1vga2mpz86j8vq25iy"
+ else if stdenv.system == "i686-linux" then "10ml1wclix9236zcb4mh60hdm9vvfaarlb62z7fdrwk6ikqbm7fk"
else throw "Bittorrent Sync for: ${stdenv.system} not supported!";
- version = "1.1.70";
- sha256 = if stdenv.system == "x86_64-linux" then "1hnyncq5439fxn1q8dkzcg2alxjkanr4q4pgqqf3nngz4cdar5vi"
- else if stdenv.system == "i686-linux" then "1ijdmzl8bnb4k99vrjn5gd31hy64p9wiyxw5wc5gbpgap191h5i5"
- else throw "Bittorrent Sync for: ${stdenv.system} not supported!";
+ libPath = stdenv.lib.makeLibraryPath [ stdenv.gcc.libc ];
+in
+stdenv.mkDerivation rec {
+ name = "btsync-${version}";
+ version = "1.3.94";
-in stdenv.mkDerivation {
- name = "btsync-bin-${version}";
- src = fetchurl {
- url = "http://syncapp.bittorrent.com/${version}/btsync_${arch}-${version}.tar.gz";
+ src = fetchurl {
+ url = "http://syncapp.bittorrent.com/${version}/btsync_${arch}-${version}.tar.gz";
inherit sha256;
};
- sourceRoot = ".";
-
- installPhase = ''
- ensureDir "$out/bin/"
- cp -r "btsync" "$out/bin/"
-
- patchelf --set-interpreter ${stdenv.glibc}/lib/${interpreter} \
- "$out/bin/btsync"
- '';
-
+ dontStrip = true; # Don't strip, otherwise patching the rpaths breaks
+ sourceRoot = ".";
buildInputs = [ patchelf ];
+ installPhase = ''
+ mkdir -p "$out/bin/"
+ cp -r "btsync" "$out/bin/"
+
+ patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ --set-rpath ${libPath} "$out/bin/btsync"
+ '';
+
meta = {
- homepage = "http://labs.bittorrent.com/experiments/sync.html";
description = "Automatically sync files via secure, distributed technology";
- license = stdenv.lib.licenses.unfree;
- maintainers = [ stdenv.lib.maintainers.iElectric ];
+ homepage = "http://www.bittorrent.com/sync";
+ license = stdenv.lib.licenses.unfreeRedistributable;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = with stdenv.lib.maintainers; [ iElectric thoughtpolice ];
};
}
diff --git a/pkgs/applications/networking/browsers/chromium/browser.nix b/pkgs/applications/networking/browsers/chromium/browser.nix
new file mode 100644
index 00000000000..daab75c74ff
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/browser.nix
@@ -0,0 +1,42 @@
+{ stdenv, mkChromiumDerivation }:
+
+with stdenv.lib;
+
+mkChromiumDerivation (base: rec {
+ name = "chromium-browser";
+ packageName = "chromium";
+ buildTargets = [ "mksnapshot" "chrome" ];
+
+ installPhase = ''
+ mkdir -p "$libExecPath"
+ cp -v "$buildPath/"*.pak "$libExecPath/"
+ cp -v "$buildPath/icudtl.dat" "$libExecPath/"
+ cp -vLR "$buildPath/locales" "$buildPath/resources" "$libExecPath/"
+ cp -v $buildPath/libffmpegsumo.so "$libExecPath/"
+
+ cp -v "$buildPath/chrome" "$libExecPath/$packageName"
+
+ mkdir -vp "$out/share/man/man1"
+ cp -v "$buildPath/chrome.1" "$out/share/man/man1/$packageName.1"
+
+ for icon_file in chrome/app/theme/chromium/product_logo_*[0-9].png; do
+ num_and_suffix="''${icon_file##*logo_}"
+ icon_size="''${num_and_suffix%.*}"
+ expr "$icon_size" : "^[0-9][0-9]*$" || continue
+ logo_output_prefix="$out/share/icons/hicolor"
+ logo_output_path="$logo_output_prefix/''${icon_size}x''${icon_size}/apps"
+ mkdir -vp "$logo_output_path"
+ cp -v "$icon_file" "$logo_output_path/$packageName.png"
+ done
+ '';
+
+ preHook = "unset NIX_ENFORCE_PURITY";
+
+ meta = {
+ description = "An open source web browser from Google";
+ homepage = http://www.chromium.org/;
+ maintainers = with maintainers; [ goibhniu chaoflow aszlig wizeman ];
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ };
+})
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
new file mode 100644
index 00000000000..b9011c0236f
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -0,0 +1,220 @@
+{ stdenv, fetchurl, ninja, which
+
+# default dependencies
+, bzip2, flac, speex, icu, libopus
+, libevent, expat, libjpeg, snappy
+, libpng, libxml2, libxslt
+, xdg_utils, yasm, minizip, libwebp
+, libusb1, libexif, pciutils
+
+, python, pythonPackages, perl, pkgconfig
+, nspr, udev, krb5
+, utillinux, alsaLib
+, gcc, bison, gperf
+, glib, gtk, dbus_glib
+, libXScrnSaver, libXcursor, libXtst, mesa
+, protobuf, speechd, libXdamage
+
+# optional dependencies
+, libgcrypt ? null # gnomeSupport || cupsSupport
+
+# package customization
+, enableSELinux ? false, libselinux ? null
+, enableNaCl ? false
+, useOpenSSL ? false, nss ? null, openssl ? null
+, gnomeSupport ? false, gnome ? null
+, gnomeKeyringSupport ? false, libgnome_keyring3 ? null
+, proprietaryCodecs ? true
+, cupsSupport ? false
+, pulseSupport ? false, pulseaudio ? null
+
+, source
+, plugins
+}:
+
+buildFun:
+
+with stdenv.lib;
+
+let
+ # The additional attributes for creating derivations based on the chromium
+ # source tree.
+ extraAttrs = buildFun base;
+
+ mkGypFlags =
+ let
+ sanitize = value:
+ if value == true then "1"
+ else if value == false then "0"
+ else "${value}";
+ toFlag = key: value: "-D${key}=${sanitize value}";
+ in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs));
+
+ gypFlagsUseSystemLibs = {
+ use_system_bzip2 = true;
+ use_system_flac = true;
+ use_system_libevent = true;
+ use_system_libexpat = true;
+ use_system_libexif = true;
+ use_system_libjpeg = true;
+ use_system_libpng = true;
+ use_system_libwebp = true;
+ use_system_libxml = true;
+ use_system_opus = true;
+ use_system_snappy = true;
+ use_system_speex = true;
+ use_system_ssl = useOpenSSL;
+ use_system_stlport = true;
+ use_system_xdg_utils = true;
+ use_system_yasm = true;
+ use_system_zlib = false;
+ use_system_protobuf = true;
+
+ use_system_harfbuzz = false;
+ use_system_icu = false; # Doesn't support ICU 52 yet.
+ use_system_libusb = false; # http://crbug.com/266149
+ use_system_skia = false;
+ use_system_sqlite = false; # http://crbug.com/22208
+ use_system_v8 = false;
+ };
+
+ opusWithCustomModes = libopus.override {
+ withCustomModes = true;
+ };
+
+ defaultDependencies = [
+ bzip2 flac speex icu opusWithCustomModes
+ libevent expat libjpeg snappy
+ libpng libxml2 libxslt
+ xdg_utils yasm minizip libwebp
+ libusb1 libexif
+ ];
+
+ # build paths and release info
+ packageName = extraAttrs.packageName or extraAttrs.name;
+ buildType = "Release";
+ buildPath = "out/${buildType}";
+ libExecPath = "$out/libexec/${packageName}";
+
+ base = rec {
+ name = "${packageName}-${version}";
+ inherit (source) version;
+ inherit packageName buildType buildPath;
+ src = source;
+
+ buildInputs = defaultDependencies ++ [
+ which
+ python perl pkgconfig
+ nspr udev
+ (if useOpenSSL then openssl else nss)
+ utillinux alsaLib
+ bison gperf krb5
+ glib gtk dbus_glib
+ libXScrnSaver libXcursor libXtst mesa
+ pciutils protobuf speechd libXdamage
+ pythonPackages.gyp pythonPackages.ply pythonPackages.jinja2
+ ] ++ optional gnomeKeyringSupport libgnome_keyring3
+ ++ optionals gnomeSupport [ gnome.GConf libgcrypt ]
+ ++ optional enableSELinux libselinux
+ ++ optional cupsSupport libgcrypt
+ ++ optional pulseSupport pulseaudio;
+
+ # XXX: Wait for https://crbug.com/239107 and https://crbug.com/239181 to
+ # be fixed, then try again to unbundle everything into separate
+ # derivations.
+ prePatch = ''
+ cp -dsr --no-preserve=mode "${source.main}"/* .
+ cp -dsr --no-preserve=mode "${source.sandbox}" sandbox
+ cp -dr "${source.bundled}" third_party
+ chmod -R u+w third_party
+
+ # Hardcode source tree root in all gyp files
+ find -iname '*.gyp*' \( -type f -o -type l \) \
+ -exec sed -i -e 's|<(DEPTH)|'"$(pwd)"'|g' {} + \
+ -exec chmod u+w {} +
+ '';
+
+ postPatch = ''
+ sed -i -e '/base::FilePath exe_dir/,/^ *} *$/c \
+ sandbox_binary = base::FilePath(getenv("CHROMIUM_SANDBOX_BINARY_PATH"));
+ ' sandbox/linux/suid/client/setuid_sandbox_client.cc
+
+ sed -i -e '/module_path *=.*libexif.so/ {
+ s|= [^;]*|= base::FilePath().AppendASCII("${libexif}/lib/libexif.so")|
+ }' chrome/utility/media_galleries/image_metadata_extractor.cc
+ '';
+
+ gypFlags = mkGypFlags (gypFlagsUseSystemLibs // {
+ linux_use_gold_binary = false;
+ linux_use_gold_flags = false;
+ proprietary_codecs = false;
+ use_gnome_keyring = gnomeKeyringSupport;
+ use_gconf = gnomeSupport;
+ use_gio = gnomeSupport;
+ use_pulseaudio = pulseSupport;
+ linux_link_pulseaudio = pulseSupport;
+ disable_nacl = !enableNaCl;
+ use_openssl = useOpenSSL;
+ selinux = enableSELinux;
+ use_cups = cupsSupport;
+ linux_sandbox_chrome_path="${libExecPath}/${packageName}";
+ werror = "";
+ clang = false;
+
+ # FIXME: In version 37, omnibox.mojom.js doesn't seem to be generated.
+ use_mojo = versionOlder source.version "37.0.0.0";
+
+ # Google API keys, see:
+ # http://www.chromium.org/developers/how-tos/api-keys
+ # Note: These are for NixOS/nixpkgs use ONLY. For your own distribution,
+ # please get your own set of keys.
+ google_api_key = "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI";
+ google_default_client_id = "404761575300.apps.googleusercontent.com";
+ google_default_client_secret = "9rIFQjfnkykEmqb6FfjJQD1D";
+
+ } // optionalAttrs proprietaryCodecs {
+ # enable support for the H.264 codec
+ proprietary_codecs = true;
+ ffmpeg_branding = "Chrome";
+ } // optionalAttrs (stdenv.system == "x86_64-linux") {
+ target_arch = "x64";
+ python_arch = "x86-64";
+ } // optionalAttrs (stdenv.system == "i686-linux") {
+ target_arch = "ia32";
+ python_arch = "ia32";
+ } // (extraAttrs.gypFlags or {}));
+
+ configurePhase = ''
+ # This is to ensure expansion of $out.
+ libExecPath="${libExecPath}"
+ python build/linux/unbundle/replace_gyp_files.py ${gypFlags}
+ python build/gyp_chromium -f ninja --depth "$(pwd)" ${gypFlags}
+ '';
+
+ buildPhase = let
+ CC = "${gcc}/bin/gcc";
+ CXX = "${gcc}/bin/g++";
+ buildCommand = target: let
+ # XXX: Only needed for version 36 and older!
+ targetSuffix = optionalString
+ (versionOlder source.version "37.0.0.0" && target == "mksnapshot")
+ (if stdenv.is64bit then ".x64" else ".ia32");
+ in ''
+ CC="${CC}" CC_host="${CC}" \
+ CXX="${CXX}" CXX_host="${CXX}" \
+ LINK_host="${CXX}" \
+ "${ninja}/bin/ninja" -C "${buildPath}" \
+ -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \
+ "${target}${targetSuffix}"
+ '' + optionalString (target == "mksnapshot" || target == "chrome") ''
+ paxmark m "${buildPath}/${target}${targetSuffix}"
+ '';
+ targets = extraAttrs.buildTargets or [];
+ commands = map buildCommand targets;
+ in concatStringsSep "\n" commands;
+ };
+
+# Remove some extraAttrs we supplied to the base attributes already.
+in stdenv.mkDerivation (base // removeAttrs extraAttrs [
+ "name" "gypFlags" "buildTargets"
+])
diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix
index fa91a877fdc..4dfdca882bc 100644
--- a/pkgs/applications/networking/browsers/chromium/default.nix
+++ b/pkgs/applications/networking/browsers/chromium/default.nix
@@ -1,276 +1,86 @@
-{ stdenv, fetchurl, makeWrapper, ninja, which
-
-# default dependencies
-, bzip2, flac, speex
-, libevent, expat, libjpeg
-, libpng, libxml2, libxslt
-, xdg_utils, yasm, zlib
-, libusb1, libexif, pciutils
-
-, python, pythonPackages, perl, pkgconfig
-, nspr, udev, krb5, file
-, utillinux, alsaLib
-, gcc, bison, gperf
-, glib, gtk, dbus_glib
-, libXScrnSaver, libXcursor, libXtst, mesa
-, protobuf, speechd, libXdamage
-
-# optional dependencies
-, libgcrypt ? null # gnomeSupport || cupsSupport
+{ newScope, stdenv, makeWrapper, makeDesktopItem
# package customization
, channel ? "stable"
-, enableSELinux ? false, libselinux ? null
+, enableSELinux ? false
, enableNaCl ? false
-, useOpenSSL ? false, nss ? null, openssl ? null
-, gnomeSupport ? false, gconf ? null
-, gnomeKeyringSupport ? false, libgnome_keyring ? null
+, useOpenSSL ? false
+, gnomeSupport ? false
+, gnomeKeyringSupport ? false
, proprietaryCodecs ? true
+, enablePepperFlash ? false
+, enablePepperPDF ? false
, cupsSupport ? false
-, pulseSupport ? false, pulseaudio ? null
+, pulseSupport ? false
}:
-with stdenv.lib;
-
let
- src = with getAttr channel (import ./sources.nix); stdenv.mkDerivation {
- name = "chromium-source-${version}";
+ callPackage = newScope chromium;
- src = fetchurl {
- inherit url sha256;
+ chromium = {
+ source = callPackage ./source {
+ inherit channel;
+ # XXX: common config
+ inherit useOpenSSL;
};
- phases = [ "unpackPhase" "patchPhase" "installPhase" ];
+ mkChromiumDerivation = callPackage ./common.nix {
+ inherit enableSELinux enableNaCl useOpenSSL gnomeSupport
+ gnomeKeyringSupport proprietaryCodecs cupsSupport
+ pulseSupport;
+ };
- opensslPatches = optional useOpenSSL openssl.patches;
+ browser = callPackage ./browser.nix { };
+ sandbox = callPackage ./sandbox.nix { };
- prePatch = "patchShebangs .";
-
- patches = singleton (
- if versionOlder version "31.0.0.0"
- then ./sandbox_userns_30.patch
- else ./sandbox_userns_31.patch
- );
-
- postPatch = ''
- sed -i -r -e 's/-f(stack-protector)(-all)?/-fno-\1/' build/common.gypi
- sed -i -e 's|/usr/bin/gcc|gcc|' third_party/WebKit/Source/core/core.gypi
- '' + optionalString useOpenSSL ''
- cat $opensslPatches | patch -p1 -d third_party/openssl/openssl
- '';
-
- outputs = [ "out" "sandbox" "bundled" "main" ];
- installPhase = ''
- ensureDir "$out" "$sandbox" "$bundled" "$main"
-
- header "copying browser main sources to $main"
- find . -mindepth 1 -maxdepth 1 \
- \! -path ./sandbox \
- \! -path ./third_party \
- \! -path ./build \
- \! -path ./tools \
- \! -name '.*' \
- -print | xargs cp -rt "$main"
- stopNest
-
- header "copying sandbox components to $sandbox"
- cp -rt "$sandbox" sandbox/*
- stopNest
-
- header "copying third party sources to $bundled"
- cp -rt "$bundled" third_party/*
- stopNest
-
- header "copying build requisites to $out"
- cp -rt "$out" build tools
- stopNest
-
- rm -rf "$out/tools/gyp" # XXX: Don't even copy it in the first place.
- '';
-
- passthru = {
- inherit version;
+ plugins = callPackage ./plugins.nix {
+ inherit enablePepperFlash enablePepperPDF;
};
};
- mkGypFlags =
- let
- sanitize = value:
- if value == true then "1"
- else if value == false then "0"
- else "${value}";
- toFlag = key: value: "-D${key}=${sanitize value}";
- in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs));
-
- gypFlagsUseSystemLibs = {
- use_system_bzip2 = true;
- use_system_flac = true;
- use_system_libevent = true;
- use_system_libexpat = true;
- use_system_libexif = true;
- use_system_libjpeg = true;
- use_system_libpng = false; # PNG dlopen() version conflict
- use_system_libusb = true;
- use_system_libxml = true;
- use_system_speex = true;
- use_system_ssl = useOpenSSL;
- use_system_stlport = true;
- use_system_xdg_utils = true;
- use_system_yasm = true;
- use_system_zlib = false; # http://crbug.com/143623
- use_system_protobuf = true;
-
- use_system_harfbuzz = false;
- use_system_icu = false;
- use_system_libwebp = false; # http://crbug.com/133161
- use_system_skia = false;
- use_system_sqlite = false; # http://crbug.com/22208
- use_system_v8 = false;
+ desktopItem = makeDesktopItem {
+ name = "chromium";
+ exec = "chromium";
+ icon = "${chromium.browser}/share/icons/hicolor/48x48/apps/chromium.png";
+ comment = "An open source web browser from Google";
+ desktopName = "Chromium";
+ genericName = "Web browser";
+ mimeType = stdenv.lib.concatStringsSep ";" [
+ "text/html"
+ "text/xml"
+ "application/xhtml+xml"
+ "x-scheme-handler/http"
+ "x-scheme-handler/https"
+ "x-scheme-handler/ftp"
+ "x-scheme-handler/mailto"
+ "x-scheme-handler/webcal"
+ ];
+ categories = "Network;WebBrowser";
};
- defaultDependencies = [
- bzip2 flac speex
- libevent expat libjpeg
- libpng libxml2 libxslt
- xdg_utils yasm zlib
- libusb1 libexif
- ];
+in stdenv.mkDerivation {
+ name = "chromium-${channel}-${chromium.browser.version}";
- sandbox = import ./sandbox.nix {
- inherit stdenv;
- src = src.sandbox;
- binary = "${packageName}_sandbox";
- };
+ buildInputs = [ makeWrapper ];
- # build paths and release info
- packageName = "chromium";
- buildType = "Release";
- buildPath = "out/${buildType}";
- libExecPath = "$out/libexec/${packageName}";
- sandboxPath = "${sandbox}/bin/${packageName}_sandbox";
-
-in stdenv.mkDerivation rec {
- name = "${packageName}-${src.version}";
- inherit packageName src;
-
- buildInputs = defaultDependencies ++ [
- which makeWrapper
- python perl pkgconfig
- nspr udev
- (if useOpenSSL then openssl else nss)
- utillinux alsaLib
- gcc bison gperf
- krb5 file
- glib gtk dbus_glib
- libXScrnSaver libXcursor libXtst mesa
- pciutils protobuf speechd libXdamage
- pythonPackages.gyp
- ] ++ optional gnomeKeyringSupport libgnome_keyring
- ++ optionals gnomeSupport [ gconf libgcrypt ]
- ++ optional enableSELinux libselinux
- ++ optional cupsSupport libgcrypt
- ++ optional pulseSupport pulseaudio;
-
- prePatch = ''
- # XXX: Figure out a way how to split these properly.
- #cpflags="-dsr --no-preserve=mode"
- cpflags="-dr"
- cp $cpflags "${src.main}"/* .
- cp $cpflags "${src.bundled}" third_party
- cp $cpflags "${src.sandbox}" sandbox
- chmod -R u+w . # XXX!
- '';
-
- postPatch = ''
- sed -i -e '/base::FilePath exe_dir/,/^ *} *$/c \
- sandbox_binary = \
- base::FilePath("'"${sandboxPath}"'");
- ' content/browser/browser_main_loop.cc
- '';
-
- gypFlags = mkGypFlags (gypFlagsUseSystemLibs // {
- linux_use_gold_binary = false;
- linux_use_gold_flags = false;
- proprietary_codecs = false;
- use_gnome_keyring = gnomeKeyringSupport;
- use_gconf = gnomeSupport;
- use_gio = gnomeSupport;
- use_pulseaudio = pulseSupport;
- disable_nacl = !enableNaCl;
- use_openssl = useOpenSSL;
- selinux = enableSELinux;
- use_cups = cupsSupport;
- linux_sandbox_path="${sandboxPath}";
- linux_sandbox_chrome_path="${libExecPath}/${packageName}";
- werror = "";
-
- # Google API keys, see http://www.chromium.org/developers/how-tos/api-keys.
- # Note: These are for NixOS/nixpkgs use ONLY. For your own distribution,
- # please get your own set of keys.
- google_api_key = "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI";
- google_default_client_id = "404761575300.apps.googleusercontent.com";
- google_default_client_secret = "9rIFQjfnkykEmqb6FfjJQD1D";
-
- } // optionalAttrs proprietaryCodecs {
- # enable support for the H.264 codec
- proprietary_codecs = true;
- ffmpeg_branding = "Chrome";
- } // optionalAttrs (stdenv.system == "x86_64-linux") {
- target_arch = "x64";
- } // optionalAttrs (stdenv.system == "i686-linux") {
- target_arch = "ia32";
- });
-
- configurePhase = ''
- python build/gyp_chromium -f ninja --depth "$(pwd)" ${gypFlags}
- '';
-
- buildPhase = let
- CC = "${gcc}/bin/gcc";
- CXX = "${gcc}/bin/g++";
+ buildCommand = let
+ browserBinary = "${chromium.browser}/libexec/chromium/chromium";
+ sandboxBinary = "${chromium.sandbox}/bin/chromium-sandbox";
in ''
- CC="${CC}" CC_host="${CC}" \
- CXX="${CXX}" CXX_host="${CXX}" \
- LINK_host="${CXX}" \
- "${ninja}/bin/ninja" -C "${buildPath}" \
- -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \
- chrome ${optionalString (!enableSELinux) "chrome_sandbox"}
+ mkdir -p "$out/bin" "$out/share/applications"
+
+ ln -s "${chromium.browser}/share" "$out/share"
+ makeWrapper "${browserBinary}" "$out/bin/chromium" \
+ --set CHROMIUM_SANDBOX_BINARY_PATH "${sandboxBinary}" \
+ --add-flags "${chromium.plugins.flagsEnabled}"
+
+ ln -s "${chromium.browser}/share/icons" "$out/share/icons"
+ cp -v "${desktopItem}/share/applications/"* "$out/share/applications"
'';
- installPhase = ''
- ensureDir "${libExecPath}"
- cp -v "${buildPath}/"*.pak "${libExecPath}/"
- cp -vR "${buildPath}/locales" "${buildPath}/resources" "${libExecPath}/"
- cp -v ${buildPath}/libffmpegsumo.so "${libExecPath}/"
-
- cp -v "${buildPath}/chrome" "${libExecPath}/${packageName}"
-
- mkdir -vp "$out/bin"
- makeWrapper "${libExecPath}/${packageName}" "$out/bin/${packageName}"
-
- mkdir -vp "$out/share/man/man1"
- cp -v "${buildPath}/chrome.1" "$out/share/man/man1/${packageName}.1"
-
- for icon_file in chrome/app/theme/chromium/product_logo_*[0-9].png; do
- num_and_suffix="''${icon_file##*logo_}"
- icon_size="''${num_and_suffix%.*}"
- expr "$icon_size" : "^[0-9][0-9]*$" || continue
- logo_output_prefix="$out/share/icons/hicolor"
- logo_output_path="$logo_output_prefix/''${icon_size}x''${icon_size}/apps"
- mkdir -vp "$logo_output_path"
- cp -v "$icon_file" "$logo_output_path/${packageName}.png"
- done
- '';
+ inherit (chromium.browser) meta packageName;
passthru = {
- inherit sandbox;
- };
-
- meta = {
- description = "An open source web browser from Google";
- homepage = http://www.chromium.org/;
- maintainers = with maintainers; [ goibhniu chaoflow aszlig ];
- license = licenses.bsd3;
- platforms = platforms.linux;
+ mkDerivation = chromium.mkChromiumDerivation;
};
}
diff --git a/pkgs/applications/networking/browsers/chromium/plugins.nix b/pkgs/applications/networking/browsers/chromium/plugins.nix
new file mode 100644
index 00000000000..e0c45f91075
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/plugins.nix
@@ -0,0 +1,78 @@
+{ stdenv
+, enablePepperFlash ? false
+, enablePepperPDF ? false
+
+, source
+}:
+
+with stdenv.lib;
+
+let
+ plugins = stdenv.mkDerivation {
+ name = "chromium-binary-plugins";
+
+ # XXX: Only temporary and has to be version-specific
+ src = source.plugins;
+
+ phases = [ "unpackPhase" "patchPhase" "checkPhase" "installPhase" ];
+ outputs = [ "pdf" "flash" ];
+
+ unpackCmd = let
+ chan = if source.channel == "dev" then "chrome-unstable"
+ else if source.channel == "stable" then "chrome"
+ else "chrome-${source.channel}";
+ in ''
+ mkdir -p plugins
+ ar p "$src" data.tar.lzma | tar xJ -C plugins --strip-components=4 \
+ ./opt/google/${chan}/PepperFlash \
+ ./opt/google/${chan}/libpdf.so
+ '';
+
+ doCheck = true;
+ checkPhase = ''
+ ! find -iname '*.so' -exec ldd {} + | grep 'not found'
+ '';
+
+ patchPhase = let
+ rpaths = [ stdenv.gcc.gcc ];
+ mkrpath = p: "${makeSearchPath "lib64" p}:${makeSearchPath "lib" p}";
+ in ''
+ for sofile in PepperFlash/libpepflashplayer.so libpdf.so; do
+ chmod +x "$sofile"
+ patchelf --set-rpath "${mkrpath rpaths}" "$sofile"
+ done
+ '';
+
+ installPhase = let
+ pdfName = "Chrome PDF Viewer";
+ pdfDescription = "Portable Document Format";
+ pdfMimeTypes = concatStringsSep ";" [
+ "application/pdf"
+ "application/x-google-chrome-print-preview-pdf"
+ ];
+ pdfInfo = "#${pdfName}#${pdfDescription};${pdfMimeTypes}";
+ in ''
+ install -vD libpdf.so "$pdf/lib/libpdf.so"
+ mkdir -p "$pdf/nix-support"
+ echo "--register-pepper-plugins='$pdf/lib/libpdf.so${pdfInfo}'" \
+ > "$pdf/nix-support/chromium-flags"
+
+ flashVersion="$(
+ sed -n -r 's/.*"version": "([^"]+)",.*/\1/p' PepperFlash/manifest.json
+ )"
+
+ install -vD PepperFlash/libpepflashplayer.so \
+ "$flash/lib/libpepflashplayer.so"
+ mkdir -p "$flash/nix-support"
+ echo "--ppapi-flash-path='$flash/lib/libpepflashplayer.so'" \
+ "--ppapi-flash-version=$flashVersion" \
+ > "$flash/nix-support/chromium-flags"
+ '';
+
+ passthru.flagsEnabled = let
+ enabledPlugins = optional enablePepperFlash plugins.flash
+ ++ optional enablePepperPDF plugins.pdf;
+ getFlags = plugin: "$(< ${plugin}/nix-support/chromium-flags)";
+ in concatStringsSep " " (map getFlags enabledPlugins);
+ };
+in plugins
diff --git a/pkgs/applications/networking/browsers/chromium/sandbox.nix b/pkgs/applications/networking/browsers/chromium/sandbox.nix
index b43385e8633..b470ed63325 100644
--- a/pkgs/applications/networking/browsers/chromium/sandbox.nix
+++ b/pkgs/applications/networking/browsers/chromium/sandbox.nix
@@ -1,12 +1,13 @@
-{ stdenv, src, binary }:
+{ stdenv, source }:
stdenv.mkDerivation {
- name = "chromium-sandbox-${src.version}";
- inherit src;
+ name = "chromium-sandbox-${source.version}";
+ src = source.sandbox;
patchPhase = ''
sed -i -e '/#include.*base_export/c \
#define BASE_EXPORT __attribute__((visibility("default")))
+ /#include/s|sandbox/linux|'"$(pwd)"'/linux|
' linux/suid/*.[hc]
'';
@@ -15,6 +16,6 @@ stdenv.mkDerivation {
'';
installPhase = ''
- install -svD sandbox "$out/bin/${binary}"
+ install -svD sandbox "$out/bin/chromium-sandbox"
'';
}
diff --git a/pkgs/applications/networking/browsers/chromium/sandbox_userns_30.patch b/pkgs/applications/networking/browsers/chromium/sandbox_userns_30.patch
deleted file mode 100644
index 9a412352c52..00000000000
--- a/pkgs/applications/networking/browsers/chromium/sandbox_userns_30.patch
+++ /dev/null
@@ -1,293 +0,0 @@
-commit 41510de6ae32e6161073992bd1243f7f33148a06
-Author: aszlig
-Date: Thu May 16 14:17:56 2013 +0200
-
- zygote: Add support for user namespaces on Linux.
-
- The implementation is done by patching the Zygote host to execute the sandbox
- binary with CLONE_NEWUSER and setting the uid and gid mapping so that the child
- process is using uid 0 and gid 0 which map to the current user of the parent.
- Afterwards, the sandbox will continue as if it was called as a setuid binary.
-
- In addition, this adds new_user_namespace as an option in process_util in order
- to set the UID and GID mapping correctly. The reason for this is that just
- passing CLONE_NEWUSER to clone_flags doesn't help in LaunchProcess(), because
- without setting the mappings exec*() will clear the process's capability sets.
-
- If the kernel doesn't support unprivileged user namespaces and the sandbox
- binary doesn't have the setuid flag, the Zygote main process will run without a
- sandbox. This is to mimic the behaviour if no SUID sandbox binary path is set.
-
- Signed-off-by: aszlig
-
-diff --git a/base/process/launch.h b/base/process/launch.h
-index 45b1053..ce71418 100644
---- a/base/process/launch.h
-+++ b/base/process/launch.h
-@@ -51,6 +51,7 @@ struct LaunchOptions {
- new_process_group(false)
- #if defined(OS_LINUX)
- , clone_flags(0)
-+ , new_user_namespace(false)
- #endif // OS_LINUX
- #if defined(OS_CHROMEOS)
- , ctrl_terminal_fd(-1)
-@@ -125,6 +126,9 @@ struct LaunchOptions {
- #if defined(OS_LINUX)
- // If non-zero, start the process using clone(), using flags as provided.
- int clone_flags;
-+
-+ // If true, start the process in a new user namespace.
-+ bool new_user_namespace;
- #endif // defined(OS_LINUX)
-
- #if defined(OS_CHROMEOS)
-diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
-index 52e149c..312f835 100644
---- a/base/process/launch_posix.cc
-+++ b/base/process/launch_posix.cc
-@@ -37,6 +37,13 @@
- #include "base/threading/platform_thread.h"
- #include "base/threading/thread_restrictions.h"
-
-+#if defined(OS_LINUX)
-+#include
-+#if !defined(CLONE_NEWUSER)
-+#define CLONE_NEWUSER 0x10000000
-+#endif
-+#endif
-+
- #if defined(OS_CHROMEOS)
- #include
- #endif
-@@ -416,13 +423,23 @@ bool LaunchProcess(const std::vector& argv,
-
- pid_t pid;
- #if defined(OS_LINUX)
-- if (options.clone_flags) {
-+ int map_pipe_fd[2];
-+ int flags = options.clone_flags;
-+
-+ if (options.new_user_namespace) {
-+ flags |= CLONE_NEWUSER;
-+ if (pipe(map_pipe_fd) < 0) {
-+ DPLOG(ERROR) << "user namespace pipe";
-+ return false;
-+ }
-+ }
-+
-+ if (options.clone_flags || options.new_user_namespace) {
- // Signal handling in this function assumes the creation of a new
- // process, so we check that a thread is not being created by mistake
- // and that signal handling follows the process-creation rules.
-- RAW_CHECK(
-- !(options.clone_flags & (CLONE_SIGHAND | CLONE_THREAD | CLONE_VM)));
-- pid = syscall(__NR_clone, options.clone_flags, 0, 0, 0);
-+ RAW_CHECK(!(flags & (CLONE_SIGHAND | CLONE_THREAD | CLONE_VM)));
-+ pid = syscall(__NR_clone, flags, 0, 0, 0);
- } else
- #endif
- {
-@@ -440,6 +457,21 @@ bool LaunchProcess(const std::vector& argv,
- } else if (pid == 0) {
- // Child process
-
-+#if defined(OS_LINUX)
-+ if (options.new_user_namespace) {
-+ // Close the write end of the pipe so we get an EOF when the parent closes
-+ // the FD. This is to avoid race conditions when the UID/GID mappings are
-+ // written _after_ execvp().
-+ close(map_pipe_fd[1]);
-+
-+ char dummy;
-+ if (HANDLE_EINTR(read(map_pipe_fd[0], &dummy, 1)) != 0) {
-+ RAW_LOG(ERROR, "Unexpected input in uid/gid mapping pipe.");
-+ _exit(127);
-+ }
-+ }
-+#endif
-+
- // DANGER: fork() rule: in the child, if you don't end up doing exec*(),
- // you call _exit() instead of exit(). This is because _exit() does not
- // call any previously-registered (in the parent) exit handlers, which
-@@ -555,6 +587,40 @@ bool LaunchProcess(const std::vector& argv,
- _exit(127);
- } else {
- // Parent process
-+#if defined(OS_LINUX)
-+ if (options.new_user_namespace) {
-+ // We need to write UID/GID mapping here to map the current user outside
-+ // the namespace to the root user inside the namespace in order to
-+ // correctly "fool" the child process.
-+ char buf[256];
-+ int map_fd, map_len;
-+
-+ snprintf(buf, sizeof(buf), "/proc/%d/uid_map", pid);
-+ map_fd = open(buf, O_RDWR);
-+ DPCHECK(map_fd >= 0);
-+ snprintf(buf, sizeof(buf), "0 %d 1", geteuid());
-+ map_len = strlen(buf);
-+ if (write(map_fd, buf, map_len) != map_len) {
-+ RAW_LOG(WARNING, "Can't write to uid_map.");
-+ }
-+ close(map_fd);
-+
-+ snprintf(buf, sizeof(buf), "/proc/%d/gid_map", pid);
-+ map_fd = open(buf, O_RDWR);
-+ DPCHECK(map_fd >= 0);
-+ snprintf(buf, sizeof(buf), "0 %d 1", getegid());
-+ map_len = strlen(buf);
-+ if (write(map_fd, buf, map_len) != map_len) {
-+ RAW_LOG(WARNING, "Can't write to gid_map.");
-+ }
-+ close(map_fd);
-+
-+ // Close the pipe on the parent, so the child can continue doing the
-+ // execvp() call.
-+ close(map_pipe_fd[1]);
-+ }
-+#endif
-+
- if (options.wait) {
- // While this isn't strictly disk IO, waiting for another process to
- // finish is the sort of thing ThreadRestrictions is trying to prevent.
-diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc
-index bb84e62..bce0d18 100644
---- a/content/browser/zygote_host/zygote_host_impl_linux.cc
-+++ b/content/browser/zygote_host/zygote_host_impl_linux.cc
-@@ -119,25 +119,31 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) {
-
- sandbox_binary_ = sandbox_cmd.c_str();
-
-- // A non empty sandbox_cmd means we want a SUID sandbox.
-- using_suid_sandbox_ = !sandbox_cmd.empty();
-+ bool userns_sandbox = false;
-+ const std::vector cmd_line_unwrapped(cmd_line.argv());
-
-- if (using_suid_sandbox_) {
-+ if (!sandbox_cmd.empty()) {
- struct stat st;
- if (stat(sandbox_binary_.c_str(), &st) != 0) {
- LOG(FATAL) << "The SUID sandbox helper binary is missing: "
- << sandbox_binary_ << " Aborting now.";
- }
-
-- if (access(sandbox_binary_.c_str(), X_OK) == 0 &&
-- (st.st_uid == 0) &&
-- (st.st_mode & S_ISUID) &&
-- (st.st_mode & S_IXOTH)) {
-+ if (access(sandbox_binary_.c_str(), X_OK) == 0) {
-+ using_suid_sandbox_ = true;
-+
- cmd_line.PrependWrapper(sandbox_binary_);
-
- scoped_ptr
- sandbox_client(sandbox::SetuidSandboxClient::Create());
- sandbox_client->SetupLaunchEnvironment();
-+
-+ if (!((st.st_uid == 0) &&
-+ (st.st_mode & S_ISUID) &&
-+ (st.st_mode & S_IXOTH))) {
-+ userns_sandbox = true;
-+ sandbox_client->SetNoSuid();
-+ }
- } else {
- LOG(FATAL) << "The SUID sandbox helper binary was found, but is not "
- "configured correctly. Rather than run without sandboxing "
-@@ -161,7 +167,19 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) {
- base::ProcessHandle process = -1;
- base::LaunchOptions options;
- options.fds_to_remap = &fds_to_map;
-+ if (userns_sandbox)
-+ options.new_user_namespace = true;
- base::LaunchProcess(cmd_line.argv(), options, &process);
-+
-+ if (process == -1 && userns_sandbox) {
-+ LOG(ERROR) << "User namespace sandbox failed to start, running without "
-+ << "sandbox! You need at least kernel 3.8.0 with CONFIG_USER_NS "
-+ << "enabled in order to use the sandbox without setuid bit.";
-+ using_suid_sandbox_ = false;
-+ options.new_user_namespace = false;
-+ base::LaunchProcess(cmd_line_unwrapped, options, &process);
-+ }
-+
- CHECK(process != -1) << "Failed to launch zygote process";
-
- if (using_suid_sandbox_) {
-diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc
-index 1f0e9f5..ade5aab 100644
---- a/content/zygote/zygote_main_linux.cc
-+++ b/content/zygote/zygote_main_linux.cc
-@@ -420,6 +420,13 @@ static bool EnterSandbox(sandbox::SetuidSandboxClient* setuid_sandbox,
- *has_started_new_init = true;
- }
-
-+ // Don't set non-dumpable, as it causes trouble when the host tries to find
-+ // the zygote process (XXX: Not quite sure why this happens with user
-+ // namespaces). Fortunately, we also have the seccomp filter sandbox which
-+ // should disallow the use of ptrace.
-+ if (setuid_sandbox->IsNoSuid())
-+ return true;
-+
- #if !defined(OS_OPENBSD)
- // Previously, we required that the binary be non-readable. This causes the
- // kernel to mark the process as non-dumpable at startup. The thinking was
-diff --git a/sandbox/linux/suid/client/setuid_sandbox_client.cc b/sandbox/linux/suid/client/setuid_sandbox_client.cc
-index 34231d4..36e3201 100644
---- a/sandbox/linux/suid/client/setuid_sandbox_client.cc
-+++ b/sandbox/linux/suid/client/setuid_sandbox_client.cc
-@@ -166,6 +166,10 @@ bool SetuidSandboxClient::IsInNewNETNamespace() const {
- return env_->HasVar(kSandboxNETNSEnvironmentVarName);
- }
-
-+bool SetuidSandboxClient::IsNoSuid() const {
-+ return env_->HasVar(kSandboxNoSuidVarName);
-+}
-+
- bool SetuidSandboxClient::IsSandboxed() const {
- return sandboxed_;
- }
-@@ -175,5 +179,9 @@ void SetuidSandboxClient::SetupLaunchEnvironment() {
- SetSandboxAPIEnvironmentVariable(env_);
- }
-
-+void SetuidSandboxClient::SetNoSuid() {
-+ env_->SetVar(kSandboxNoSuidVarName, "1");
-+}
-+
- } // namespace sandbox
-
-diff --git a/sandbox/linux/suid/client/setuid_sandbox_client.h b/sandbox/linux/suid/client/setuid_sandbox_client.h
-index a9f6536..2e8113a 100644
---- a/sandbox/linux/suid/client/setuid_sandbox_client.h
-+++ b/sandbox/linux/suid/client/setuid_sandbox_client.h
-@@ -39,6 +39,8 @@ class SetuidSandboxClient {
- bool IsInNewPIDNamespace() const;
- // Did the setuid helper create a new network namespace ?
- bool IsInNewNETNamespace() const;
-+ // Is sandboxed without SUID binary ?
-+ bool IsNoSuid() const;
- // Are we done and fully sandboxed ?
- bool IsSandboxed() const;
-
-@@ -46,6 +48,8 @@ class SetuidSandboxClient {
- // helper.
- void SetupLaunchEnvironment();
-
-+ void SetNoSuid();
-+
- private:
- // Holds the environment. Will never be NULL.
- base::Environment* env_;
-diff --git a/sandbox/linux/suid/common/sandbox.h b/sandbox/linux/suid/common/sandbox.h
-index aad4ff8..bd710d5 100644
---- a/sandbox/linux/suid/common/sandbox.h
-+++ b/sandbox/linux/suid/common/sandbox.h
-@@ -18,6 +18,7 @@ static const char kAdjustLowMemMarginSwitch[] = "--adjust-low-mem";
-
- static const char kSandboxDescriptorEnvironmentVarName[] = "SBX_D";
- static const char kSandboxHelperPidEnvironmentVarName[] = "SBX_HELPER_PID";
-+static const char kSandboxNoSuidVarName[] = "SBX_NO_SUID";
-
- static const long kSUIDSandboxApiNumber = 1;
- static const char kSandboxEnvironmentApiRequest[] = "SBX_CHROME_API_RQ";
diff --git a/pkgs/applications/networking/browsers/chromium/sandbox_userns_31.patch b/pkgs/applications/networking/browsers/chromium/sandbox_userns_31.patch
deleted file mode 100644
index 490c1a9cebe..00000000000
--- a/pkgs/applications/networking/browsers/chromium/sandbox_userns_31.patch
+++ /dev/null
@@ -1,297 +0,0 @@
-commit ff4e8b4af04c58fc4c58ee7ed108aefcdc26a960
-Author: aszlig
-Date: Thu May 16 14:17:56 2013 +0200
-
- zygote: Add support for user namespaces on Linux.
-
- The implementation is done by patching the Zygote host to execute the sandbox
- binary with CLONE_NEWUSER and setting the uid and gid mapping so that the child
- process is using uid 0 and gid 0 which map to the current user of the parent.
- Afterwards, the sandbox will continue as if it was called as a setuid binary.
-
- In addition, this adds new_user_namespace as an option in process_util in order
- to set the UID and GID mapping correctly. The reason for this is that just
- passing CLONE_NEWUSER to clone_flags doesn't help in LaunchProcess(), because
- without setting the mappings exec*() will clear the process's capability sets.
-
- If the kernel doesn't support unprivileged user namespaces and the sandbox
- binary doesn't have the setuid flag, the Zygote main process will run without a
- sandbox. This is to mimic the behaviour if no SUID sandbox binary path is set.
-
- Signed-off-by: aszlig
-
-diff --git a/base/process/launch.cc b/base/process/launch.cc
-index 1329a5a..ec28fdf 100644
---- a/base/process/launch.cc
-+++ b/base/process/launch.cc
-@@ -24,6 +24,7 @@ LaunchOptions::LaunchOptions()
- new_process_group(false)
- #if defined(OS_LINUX)
- , clone_flags(0)
-+ , new_user_namespace(false)
- #endif // OS_LINUX
- #if defined(OS_CHROMEOS)
- , ctrl_terminal_fd(-1)
-diff --git a/base/process/launch.h b/base/process/launch.h
-index ac2df5e..34a3851 100644
---- a/base/process/launch.h
-+++ b/base/process/launch.h
-@@ -100,6 +100,9 @@ struct BASE_EXPORT LaunchOptions {
- #if defined(OS_LINUX)
- // If non-zero, start the process using clone(), using flags as provided.
- int clone_flags;
-+
-+ // If true, start the process in a new user namespace.
-+ bool new_user_namespace;
- #endif // defined(OS_LINUX)
-
- #if defined(OS_CHROMEOS)
-diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
-index de6286d..9333494 100644
---- a/base/process/launch_posix.cc
-+++ b/base/process/launch_posix.cc
-@@ -37,6 +37,13 @@
- #include "base/threading/platform_thread.h"
- #include "base/threading/thread_restrictions.h"
-
-+#if defined(OS_LINUX)
-+#include
-+#if !defined(CLONE_NEWUSER)
-+#define CLONE_NEWUSER 0x10000000
-+#endif
-+#endif
-+
- #if defined(OS_CHROMEOS)
- #include
- #endif
-@@ -294,13 +301,23 @@ bool LaunchProcess(const std::vector