diff --git a/.version b/.version
index 07167f90842e..af805b45bd8d 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-14.02
\ No newline at end of file
+14.04
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 000000000000..8ded8807ede9
--- /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/#installing-nixos)
+* [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 9d5764a6307f..c1b9bfd39f92 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/coding-conventions.xml b/doc/coding-conventions.xml
index e55f86ae3d31..61d373738f90 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/language-support.xml b/doc/language-support.xml
index 69361e3be6c3..f5e89df57fcc 100644
--- a/doc/language-support.xml
+++ b/doc/language-support.xml
@@ -108,7 +108,7 @@ a preConfigure hook to generate a configuration
file used by Makefile.PL:
-{buildPerlPackage, fetchurl, db4}:
+{buildPerlPackage, fetchurl, db}:
buildPerlPackage rec {
name = "BerkeleyDB-0.36";
@@ -119,8 +119,8 @@ buildPerlPackage rec {
};
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
'';
}
diff --git a/doc/meta.xml b/doc/meta.xml
index 00e9b8ac67a1..6c8e458509a7 100644
--- a/doc/meta.xml
+++ b/doc/meta.xml
@@ -164,7 +164,7 @@ meta.hydraPlatforms = [];
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.
- Sush packages should be removed from Nixpkgs eventually unless
+ Such packages should be removed from Nixpkgs eventually unless
they are fixed.
diff --git a/doc/outline.txt b/doc/outline.txt
deleted file mode 100644
index 816cdbdc3ed7..000000000000
--- 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 35983f0b114a..49c674052b95 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.
diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index f0cabe425a3d..74eb63b4b498 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -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/licenses.nix b/lib/licenses.nix
index b13a72f3f644..20c1b2200315 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -25,19 +25,15 @@
amd = {
shortName = "amd";
fullName = "AMD License Agreement";
- url = "http://developer.amd.com/amd-license-agreement/";
- };
+ url = http://developer.amd.com/amd-license-agreement/;
+ };#
- 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";
+ apsl20 = {
+ shortName = "APSL 2.0";
+ fullName = "Apple Public Source License 2.0";
+ url = http://opensource.org/licenses/APSL-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";
@@ -68,6 +64,12 @@
url = https://fedoraproject.org/wiki/Licensing/BSD;
};
+ cc-by-30 = {
+ shortName = "CC BY 3.0";
+ fullName = "Creative Commons Attribution 3.0";
+ url = http://creativecommons.org/licenses/by/3.0;
+ };
+
cddl = {
shortName = "CDDL";
fullName = "Common Development Distribution License ";
@@ -86,7 +88,11 @@
url = http://www.eclipse.org/legal/epl-v10.html;
};
- gpl2 = "GPLv2";
+ gpl2 = {
+ shortName = "GPLv2";
+ fullName = "GNU General Public License version 2";
+ url = http://www.gnu.org/licenses/old-licenses/gpl-2.0.html;
+ };
gpl2Oss = {
shortName = "GPLv2+OSS";
@@ -94,9 +100,11 @@
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+";
+ gpl2Plus = {
+ shortName = "GPLv2+";
+ fullName = "GNU General Public License version 2 or later";
+ url = http://www.gnu.org/licenses/old-licenses/gpl-2.0.html;
+ };
gpl3 = {
shortName = "GPLv3";
@@ -140,7 +148,11 @@
url = https://fedoraproject.org/wiki/Licensing/libtiff;
};
- lgpl2 = "LGPLv2";
+ lgpl2 = {
+ shortName = "LGPLv2";
+ fullName = "GNU Library General Public License version 2";
+ url = http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html;
+ };
lgpl2Plus = {
shortName = "LGPLv2+";
@@ -148,7 +160,11 @@
url = http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html;
};
- lgpl21 = "LGPLv2.1";
+ lgpl21 = {
+ shortName = "LGPLv2.1";
+ fullName = "GNU Lesser General Public License version 2.1";
+ url = http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html;
+ };
lgpl21Plus = {
shortName = "LGPLv2.1+";
@@ -238,4 +254,10 @@
fullName = "Zope Public License 2.1";
url = "http://old.zope.org/Resources/License/ZPL-2.1";
};
+
+ sleepycat = {
+ shortName = "Sleepycat";
+ fullName = "Sleepycat Public License";
+ url = "https://en.wikipedia.org/wiki/Sleepycat_License";
+ };
}
diff --git a/lib/lists.nix b/lib/lists.nix
index 71a897027962..4b5f04a67585 100644
--- a/lib/lists.nix
+++ b/lib/lists.nix
@@ -226,4 +226,5 @@ in rec {
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 c29259c6386c..78355eff0045 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -4,35 +4,46 @@
/* Add your name and email address here. Keep the list
alphabetically sorted. */
+ _1126 = "Christian Lask ";
aforemny = "Alexander Foremny ";
+ 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 ";
astsmtl = "Alexander Tsamutali ";
aszlig = "aszlig ";
bbenoist = "Baptist BENOIST ";
+ bennofs = "Benno Fünfstück ";
bjg = "Brian Gough ";
bjornfor = "Bjørn Forsman ";
bluescreen303 = "Mathijs Kwik ";
bodil = "Bodil Stokke ";
+ calrama = "Moritz Maxeiner ";
chaoflow = "Florian Friesdorf ";
coconnor = "Corey O'Connor ";
coroa = "Jonas Hörsch ";
edwtjo = "Edward Tjörnhammar ";
eelco = "Eelco Dolstra ";
- ertes = "Ertugrul Söylemez ";
+ emery = "Emery Hemingawy ";
+ ertes = "Ertugrul Söylemez ";
+ falsifian = "James Cook ";
garbas = "Rok Garbas ";
goibhniu = "Cillian de Róiste ";
guibert = "David Guibert ";
+ hinton = "Tom Hinton ";
ianwookim = "Ian-Woo Kim ";
iElectric = "Domen Kozar ";
iyzsong = "Song Wenwu ";
jcumming = "Jack Cummings ";
+ 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 ";
@@ -40,6 +51,7 @@
matejc = "Matej Cotman ";
modulistic = "Pablo Costa ";
mornfall = "Petr Ročkai ";
+ msackman = "Matthew Sackman ";
ocharles = "Oliver Charles ";
offline = "Jaka Hudoklin ";
orbitz = "Malcolm Matalka ";
@@ -47,26 +59,34 @@
phreedom = "Evgeny Egorochkin ";
pierron = "Nicolas B. Pierron ";
piotr = "Piotr Pietraszkiewicz ";
+ pkmx = "Chih-Mao Chen ";
pSub = "Pascal Wittmann ";
qknight = "Joachim Schiele ";
raskin = "Michael Raskin <7c6f434c@mail.ru>";
+ redbaron = "Maxim Ivanov ";
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 ";
smironov = "Sergey Mironov ";
+ sprock = "Roger Mason ";
thammers = "Tobias Hammerschmidt ";
the-kenny = "Moritz Ulrich ";
+ thoughtpolice = "Austin Seipp ";
tomberek = "Thomas Bereknyei ";
+ ttuegel = "Thomas Tuegel ";
urkud = "Yury G. Kudryashov ";
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 ";
z77z = "Marco Maggesi ";
zef = "Zef Hemel ";
zimbatm = "zimbatm ";
diff --git a/lib/meta.nix b/lib/meta.nix
index 74e9cfb411c4..44e3cc011f18 100644
--- a/lib/meta.nix
+++ b/lib/meta.nix
@@ -14,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
@@ -31,11 +31,10 @@ 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.
- */
- appendToName = suffix: updateName (name: "${name}-${suffix}");
+ /* 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
@@ -51,7 +50,7 @@ rec {
/* Apply lowPrio to an attrset with derivations
*/
- lowPrioSet = set: mapDerivationAttrset lowPrio set;
+ lowPrioSet = set: mapDerivationAttrset lowPrio set;
/* Increase the nix-env priority of the package, i.e., this
@@ -63,5 +62,5 @@ rec {
/* Apply hiPrio to an attrset with derivations
*/
hiPrioSet = set: mapDerivationAttrset hiPrio set;
-
+
}
diff --git a/lib/modules.nix b/lib/modules.nix
index fa31ce6399ce..017c9255246f 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
@@ -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,
@@ -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:
@@ -302,8 +321,13 @@ rec {
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/sources.nix b/lib/sources.nix
index 6f8554d340be..a80e4397d6a4 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/trivial.nix b/lib/trivial.nix
index 760a74ce6664..e073da4900cc 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -41,4 +41,13 @@ rec {
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 bdd21f123952..baf8aa5e5743 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;
@@ -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);
}
diff --git a/maintainers/scripts/copy-tarball.sh b/maintainers/scripts/copy-tarball.sh
deleted file mode 100755
index 792071c129b9..000000000000
--- 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 000000000000..0746fb21069d
--- /dev/null
+++ b/maintainers/scripts/copy-tarballs.pl
@@ -0,0 +1,95 @@
+#! /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";
+ last if $? >> 8 == 255;
+ 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");
+}
diff --git a/maintainers/scripts/copy-tarballs.sh b/maintainers/scripts/copy-tarballs.sh
deleted file mode 100755
index a261f8175859..000000000000
--- 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/nixos/.topmsg b/nixos/.topmsg
deleted file mode 100644
index 9632e5926312..000000000000
--- a/nixos/.topmsg
+++ /dev/null
@@ -1 +0,0 @@
-improvements to vsftpd module
diff --git a/nixos/doc/manual/configuration.xml b/nixos/doc/manual/configuration.xml
index e6d7dee251af..0ffee826dc49 100644
--- a/nixos/doc/manual/configuration.xml
+++ b/nixos/doc/manual/configuration.xml
@@ -237,7 +237,7 @@ postgresql.package = pkgs.postgresql90;
-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:
@@ -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";
@@ -1025,7 +1037,6 @@ users.extraUsers.alice =
home = "/home/alice";
description = "Alice Foobar";
extraGroups = [ "wheel" ];
- isSystemUser = false;
useDefaultShell = true;
openssh.authorizedKeys.keys = [ "ssh-dss AAAAB3Nza... alice@foobar" ];
};
@@ -1172,7 +1183,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:
@@ -1184,7 +1195,7 @@ driver from a set of X.org drivers (such as vesa
and intel). You can also specify a driver
manually, e.g.
-services.xserver.videoDrivers = [ "r128" ];
+hardware.opengl.videoDrivers = [ "r128" ];
to enable X.org’s xf86-video-r128 driver.
@@ -1227,7 +1238,7 @@ $ systemctl start display-manager.service
has better 3D performance than the X.org drivers. It is not enabled
by default because it’s not free software. You can enable it as follows:
-services.xserver.videoDrivers = [ "nvidia" ];
+hardware.opengl.videoDrivers = [ "nvidia" ];
You may need to reboot after enabling this driver to prevent a clash
with other kernel modules.
@@ -1264,9 +1275,9 @@ services.xserver.synaptics.twoFingerScroll = true;
-Networking
+Networking
-Secure shell access
+Secure shell access
Secure shell (SSH) access to your machine can be enabled by
setting:
@@ -1294,7 +1305,7 @@ users.extraUsers.alice.openssh.authorizedKeys.keys =
-IPv4 configuration
+IPv4 configuration
By default, NixOS uses DHCP (specifically,
dhcpcd) to automatically configure network
@@ -1337,7 +1348,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 +1363,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 +1397,7 @@ always allowed.)
-Wireless networks
+Wireless networks
NixOS will start wpa_supplicant for you if you enable this setting:
@@ -1445,7 +1458,7 @@ networking.localCommands =
-Linux kernel
+Linux kernel
You can override the Linux kernel and associated packages using
the option . For instance, this
diff --git a/nixos/doc/manual/containers.xml b/nixos/doc/manual/containers.xml
new file mode 100644
index 000000000000..b8f170fc614f
--- /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 c-container-name
+(e.g., c-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 = ["c-+"];
+networking.nat.externalInterface = "eth0";
+
+where eth0 should be replaced with the desired
+external interface. Note that c-+ is a wildcard
+that matches all container interfaces.
+
+
+
+
+
+
diff --git a/nixos/doc/manual/development.xml b/nixos/doc/manual/development.xml
index be1cbc97d5ed..a93b4b163bd5 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
@@ -74,7 +75,7 @@ in nixos/ as packages.
-
+
Writing NixOS modules
@@ -188,9 +189,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
@@ -579,7 +580,7 @@ systemd.services.dhcpcd =
-
+
Building specific parts of NixOS
@@ -692,7 +693,7 @@ $ systemctl start tmp-httpd.service
-
+
Building your own NixOS CD
@@ -748,57 +749,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
@@ -811,17 +1065,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
@@ -829,54 +1077,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 70001577692e..03540aa83aaa 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
@@ -295,8 +296,74 @@ $ 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).
+
+
+ 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, and
+ to false. nixos-generate-config
+ should do this automatically for new configurations when booted in
+ UEFI mode.
+
+
+ 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 withoua 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).
+
+
+
+
+
+
diff --git a/nixos/doc/manual/manual.xml b/nixos/doc/manual/manual.xml
index 6e13281cbd94..8d7c28dee733 100644
--- a/nixos/doc/manual/manual.xml
+++ b/nixos/doc/manual/manual.xml
@@ -54,10 +54,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 6d11ad7a6c4a..bb65a49217f0 100644
--- a/nixos/doc/manual/options-to-docbook.xsl
+++ b/nixos/doc/manual/options-to-docbook.xsl
@@ -18,15 +18,13 @@
-
+
-
-
+
+
+
diff --git a/nixos/doc/manual/release-notes.xml b/nixos/doc/manual/release-notes.xml
new file mode 100644
index 000000000000..7995497708e0
--- /dev/null
+++ b/nixos/doc/manual/release-notes.xml
@@ -0,0 +1,84 @@
+
+
+Release notes
+
+
+
+
+
+Release 14.04 (“Baboon”, 2014/04/??)
+
+This is the second stable release branch of NixOS. The main
+enhancements are the following:
+
+
+
+ Installation on UEFI systems is now supported. See
+ for
+ details.
+
+ NixOS is now based on Glibc 2.19 and GCC
+ 4.8.
+
+
+
+
+
+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 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
+ .
+
+
+
+
+
+
+
+
+
+
+
+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 e50099707cc5..e1a358df2aac 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 c6e0a3a7888c..c7d65112b649 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/eval-config.nix b/nixos/lib/eval-config.nix
index 4b8c7354a7ec..0fa00637a93a 100644
--- a/nixos/lib/eval-config.nix
+++ b/nixos/lib/eval-config.nix
@@ -26,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;
};
@@ -53,7 +58,7 @@ rec {
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/test-driver/Machine.pm b/nixos/lib/test-driver/Machine.pm
index a28214ea934f..e2bd3393d872 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/test-driver.pl b/nixos/lib/test-driver/test-driver.pl
index c6a707cdf6b9..358c29e515f2 100644
--- a/nixos/lib/test-driver/test-driver.pl
+++ b/nixos/lib/test-driver/test-driver.pl
@@ -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 3407229e921a..8d17958b9d2f 100644
--- a/nixos/lib/testing.nix
+++ b/nixos/lib/testing.nix
@@ -67,103 +67,55 @@ 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, ... } @ t:
- for d in ${x}/coverage-data/*; do
- echo "doing $d"
- [ -n "$(ls -A "$d")" ] || continue
+ let
- 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 "nixos-test-driver"
+ { buildInputs = [ makeWrapper];
+ testScript = 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"}
+ ''; # "
- 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 driver test; };
runInMachine =
@@ -193,7 +145,7 @@ rec {
exit $?
'';
- testscript = ''
+ testScript = ''
startAll;
$client->waitForUnit("multi-user.target");
${preBuild}
@@ -206,7 +158,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
''; # */
diff --git a/nixos/maintainers/scripts/ec2/create-ebs-amis.py b/nixos/maintainers/scripts/ec2/create-ebs-amis.py
index 541eadd7b8c9..eab111a2665b 100755
--- a/nixos/maintainers/scripts/ec2/create-ebs-amis.py
+++ b/nixos/maintainers/scripts/ec2/create-ebs-amis.py
@@ -203,7 +203,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/gce/create-gce.sh b/nixos/maintainers/scripts/gce/create-gce.sh
new file mode 100755
index 000000000000..8bf36f33c7db
--- /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 7de95200cfa9..51a6676fe4a0 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;
{
diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix
index 987bb1088c0d..cf70ca264d6a 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 a4f69809b2a4..c78b52fe29e1 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 f43784f6d03e..16df197d87f3 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;
{
diff --git a/nixos/modules/config/fonts/ghostscript.nix b/nixos/modules/config/fonts/ghostscript.nix
index 9ef00396808c..a41f00a76c57 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;
{
diff --git a/nixos/modules/config/gnu.nix b/nixos/modules/config/gnu.nix
index 6f5d2950463f..f8c35b440d12 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 56d541cb9b3b..8182b8ae8081 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.variables =
+ { 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 3323046ac5b4..bb5a95ebc844 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
diff --git a/nixos/modules/config/ldap.nix b/nixos/modules/config/ldap.nix
index 113f5d8bcbde..8171f460385b 100644
--- a/nixos/modules/config/ldap.nix
+++ b/nixos/modules/config/ldap.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
with pkgs;
let
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix
index 9ac68b428190..43717697ebd3 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
diff --git a/nixos/modules/config/no-x-libs.nix b/nixos/modules/config/no-x-libs.nix
index ec7bf3fea7b5..f91dbb4cc281 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 2e2125d44f7b..45695d9cb89f 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 7299136235ed..17f3ed00b9be 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 e7cbe7a28f36..eedc4ca2b2f2 100644
--- a/nixos/modules/config/pulseaudio.nix
+++ b/nixos/modules/config/pulseaudio.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
with pkgs;
let
@@ -77,7 +77,7 @@ in {
};
package = mkOption {
- type = types.path;
+ type = types.package;
default = pulseaudio;
example = literalExample "pulseaudio.override { jackaudioSupport = true; }";
description = ''
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index 0b4f75a35216..9e212847e489 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
diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix
index 65d7722abfa7..427b2519cbdf 100644
--- a/nixos/modules/config/swap.nix
+++ b/nixos/modules/config/swap.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, utils, ... }:
+{ config, lib, pkgs, utils, ... }:
-with pkgs.lib;
+with lib;
with utils;
{
diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix
index 8f9b31dccff3..542360219193 100644
--- a/nixos/modules/config/sysctl.nix
+++ b/nixos/modules/config/sysctl.nix
@@ -1,12 +1,12 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
sysctlOption = mkOptionType {
name = "sysctl option value";
- check = x: isBool x || isString x || isInt x;
+ check = x: isBool x || isString x || isInt x || isNull x;
merge = args: defs: (last defs).value; # FIXME: hacky way to allow overriding in configuration.nix.
};
@@ -29,8 +29,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,22 +40,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
- ConditionPathIsReadWrite = "/proc/sys/"; # prevent systemd-sysctl in containers
- };
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = true;
- ExecStart = "${config.systemd.package}/lib/systemd/systemd-sysctl";
- };
};
# Enable hardlink and symlink restrictions. See
@@ -65,8 +57,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-path.nix b/nixos/modules/config/system-path.nix
index 2f61947c3bcc..2ea998bbb635 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
@@ -134,6 +135,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 42fbe841d070..88aa7866c2b2 100644
--- a/nixos/modules/config/timezone.nix
+++ b/nixos/modules/config/timezone.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
options = {
diff --git a/nixos/modules/config/unix-odbc-drivers.nix b/nixos/modules/config/unix-odbc-drivers.nix
index 0f6084690589..b725e6cae732 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
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix
index 714de646eb7a..8b8f6bd909e3 100644
--- a/nixos/modules/config/users-groups.nix
+++ b/nixos/modules/config/users-groups.nix
@@ -1,11 +1,32 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
ids = config.ids;
- users = config.users;
+ cfg = config.users;
+
+ nonUidUsers = filterAttrs (n: u: u.createUser && u.uid == null) cfg.extraUsers;
+ nonGidGroups = filterAttrs (n: g: g.gid == null) cfg.extraGroups;
+
+ 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 +34,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 +52,14 @@ 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 mutableUsers option
+ is false, the UID cannot be null. Otherwise, the UID might be
+ null, in which case a free UID is picked on activation (by the
+ useradd command).
+ '';
};
group = mkOption {
@@ -60,31 +89,54 @@ 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.";
+ passwordFile = mkOption {
+ type = with types; uniq (nullOr string);
+ default = null;
+ description = ''
+ 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}
+ '';
};
createUser = mkOption {
@@ -96,19 +148,11 @@ let
then not modify any of the basic properties for the user account.
'';
};
-
- 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);
+ shell = mkIf config.useDefaultShell (mkDefault cfg.defaultUserShell);
};
};
@@ -119,41 +163,167 @@ 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 mutableUsers option
+ is false, the GID cannot be null. Otherwise, the GID might be
+ null, in which case a free GID is picked on activation (by the
+ groupadd command).
+ '';
+ };
+
+ 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" (
+ getGroup = gname:
let
- p = partition (u: u.isAlias) (attrValues config.users.extraUsers);
- in concatStrings (map serializedUser p.wrong ++ map serializedUser p.right));
+ groups = mapAttrsToList (n: g: g) (
+ filterAttrs (n: g: g.name == gname) cfg.extraGroups
+ );
+ in
+ if length groups == 1 then head groups
+ else if groups == [] then throw "Group ${gname} not defined"
+ else throw "Group ${gname} has multiple definitions";
-in
+ getUser = uname:
+ let
+ users = mapAttrsToList (n: u: u) (
+ filterAttrs (n: u: u.name == uname) cfg.extraUsers
+ );
+ in
+ if length users == 1 then head users
+ else if users == [] then throw "User ${uname} not defined"
+ else throw "User ${uname} has multiple definitions";
-{
+ mkGroupEntry = gname:
+ let
+ g = getGroup gname;
+ users = mapAttrsToList (n: u: u.name) (
+ filterAttrs (n: u: elem g.name u.extraGroups) cfg.extraUsers
+ );
+ in concatStringsSep ":" [
+ g.name "x" (toString g.gid)
+ (concatStringsSep "," (users ++ (filter (u: !(elem u users)) g.members)))
+ ];
+
+ mkPasswdEntry = uname: let u = getUser uname; in
+ concatStringsSep ":" [
+ u.name "x" (toString u.uid)
+ (toString (getGroup u.group).gid)
+ u.description u.home u.shell
+ ];
+
+ sortOn = a: sort (as1: as2: lessThan (getAttr a as1) (getAttr a as2));
+
+ groupFile = pkgs.writeText "group" (
+ concatStringsSep "\n" (map (g: mkGroupEntry g.name) (
+ let f = g: g.gid != null; in
+ sortOn "gid" (filter f (attrValues cfg.extraGroups))
+ ))
+ );
+
+ passwdFile = pkgs.writeText "passwd" (
+ concatStringsSep "\n" (map (u: mkPasswdEntry u.name) (
+ let f = u: u.createUser && (u.uid != null); in
+ sortOn "uid" (filter f (attrValues cfg.extraUsers))
+ ))
+ );
+
+ # If mutableUsers is true, this script adds all users/groups defined in
+ # users.extra{Users,Groups} to /etc/{passwd,group} iff there isn't any
+ # existing user/group with the same name in those files.
+ # If mutableUsers is false, the /etc/{passwd,group} files will simply be
+ # replaced with the users/groups defined in the NixOS configuration.
+ # The merging procedure could certainly be improved, and instead of just
+ # keeping the lines as-is from /etc/{passwd,group} they could be combined
+ # in some way with the generated content from the NixOS configuration.
+ merger = src: pkgs.writeScript "merger" ''
+ #!${pkgs.bash}/bin/bash
+
+ PATH=${pkgs.gawk}/bin:${pkgs.gnugrep}/bin:$PATH
+
+ ${if !cfg.mutableUsers
+ then ''cp ${src} $1.tmp''
+ else ''awk -F: '{ print "^"$1":.*" }' $1 | egrep -vf - ${src} | cat $1 - > $1.tmp''
+ }
+
+ # set mtime to +1, otherwise change might go unnoticed (vipw/vigr only looks at mtime)
+ touch -m -t $(date -d @$(($(stat -c %Y $1)+1)) +%Y%m%d%H%M.%S) $1.tmp
+
+ mv -f $1.tmp $1
+ '';
+
+ idsAreUnique = set: idAttr: !(fold (name: args@{ dup, acc }:
+ let
+ 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;
+
+ uidsAreUnique = idsAreUnique (filterAttrs (n: u: u.uid != null) cfg.extraUsers) "uid";
+ gidsAreUnique = idsAreUnique (filterAttrs (n: g: g.gid != null) cfg.extraGroups) "gid";
+
+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;
@@ -194,11 +364,17 @@ in
example = "!";
description = ''
The (hashed) password for the root account set on initial
- installation. The empty string denotes that root can login
+ 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 !
+ sudo). The string !
prevents root from logging in using a password.
+ Note, setting this option sets
+ users.extraUsers.root.hashedPassword.
+ Note, 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.
'';
};
@@ -211,144 +387,120 @@ in
users.extraUsers = {
root = {
+ uid = ids.uids.root;
description = "System administrator";
home = "/root";
- shell = config.users.defaultUserShell;
+ shell = 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" ]
- ''
- # 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:${config.security.initialRootPassword}:::::::" >> /etc/shadow
- fi
+ system.activationScripts.users =
+ let
+ mkhomeUsers = filterAttrs (n: u: u.createHome) cfg.extraUsers;
+ setpwUsers = filterAttrs (n: u: u.createUser) cfg.extraUsers;
+ pwFile = u: if !(isNull u.hashedPassword)
+ then pkgs.writeTextFile { name = "password-file"; text = u.hashedPassword; }
+ else if !(isNull u.password)
+ then pkgs.runCommand "password-file" { pw = u.password; } ''
+ echo -n "$pw" | ${pkgs.mkpasswd}/bin/mkpasswd -s > $out
+ '' else u.passwordFile;
+ setpw = n: u: ''
+ setpw=yes
+ ${optionalString cfg.mutableUsers ''
+ test "$(getent shadow '${u.name}' | cut -d: -f2)" != "x" && setpw=no
+ ''}
+ if [ "$setpw" == "yes" ]; then
+ ${if !(isNull (pwFile u))
+ then ''
+ echo -n "${u.name}:" | cat - "${pwFile u}" | \
+ ${pkgs.shadow}/sbin/chpasswd -e
+ ''
+ else "passwd -l '${u.name}' &>/dev/null"
+ }
+ fi
+ '';
+ mkhome = n: u: ''
+ uid="$(id -u ${u.name})"
+ gid="$(id -g ${u.name})"
+ h="${u.home}"
+ test -a "$h" || mkdir -p "$h" || true
+ test "$(stat -c %u "$h")" = $uid || chown $uid "$h" || true
+ test "$(stat -c %g "$h")" = $gid || chgrp $gid "$h" || true
+ '';
+ groupadd = n: g: ''
+ if [ -z "$(getent group "${g.name}")" ]; then
+ echo "Adding group ${g.name}"
+ ${pkgs.shadow}/sbin/groupadd "${g.name}"
+ fi
+ '';
+ useradd = n: u: ''
+ if ! id "${u.name}" &>/dev/null; then
+ echo "Adding user ${u.name}"
+ ${pkgs.shadow}/sbin/useradd \
+ -g "${u.group}" \
+ -s "${u.shell}" \
+ -d "${u.home}" \
+ "${u.name}"
+ echo "${u.name}:x" | ${pkgs.shadow}/sbin/chpasswd -e
+ fi
+ '';
+ in stringAfter [ "etc" ] ''
+ touch /etc/group
+ touch /etc/passwd
+ VISUAL=${merger groupFile} ${pkgs.shadow}/sbin/vigr &>/dev/null
+ VISUAL=${merger passwdFile} ${pkgs.shadow}/sbin/vipw &>/dev/null
+ ${pkgs.shadow}/sbin/grpconv
+ ${pkgs.shadow}/sbin/pwconv
+ ${concatStrings (mapAttrsToList groupadd nonGidGroups)}
+ ${concatStrings (mapAttrsToList useradd nonUidUsers)}
+ ${concatStrings (mapAttrsToList mkhome mkhomeUsers)}
+ ${concatStrings (mapAttrsToList setpw setpwUsers)}
'';
- # Print a reminder for users to set a root password.
- environment.interactiveShellInit =
- ''
- if [ "$UID" = 0 ]; then
- read _l < /etc/shadow
- if [ "''${_l:0:6}" = root:: ]; then
- cat >&2 <nvidia driver and for
- mesa.
+ Mesa.
'';
};
- services.mesa.s3tcSupport = mkOption {
+ hardware.opengl.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.
+ to OpenGL drivers instead of the patent-free S2TC replacement.
Using this library may require a patent license depending on your location.
'';
};
- services.mesa.videoDrivers = mkOption {
+ hardware.opengl.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" ];
description = ''
- The names of the video drivers that the mesa should
- support. Mesa will try all of the drivers listed
- here until it finds one that supports your video card.
+ The names of the opengl video drivers the configuration
+ supports. They will be tried in order until one that
+ supports your card is found.
'';
};
};
config = mkIf cfg.enable {
+ assertions = pkgs.lib.singleton {
+ assertion = cfg.driSupport32Bit -> pkgs.stdenv.isx86_64;
+ message = "Option driSupport32Bit only makes sens on a 64-bit system.";
+ };
+
system.activationScripts.setup-opengl.deps = [];
system.activationScripts.setup-opengl.text = ''
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" cfg.videoDrivers then
+ ${optionalString (pkgs.stdenv.isi686) "ln -sf opengl-driver /run/opengl-driver-32"}
+ ''
+ #TODO: The OpenGL driver should depend on what's detected at runtime.
+ +( if elem "nvidia" cfg.videoDrivers then
''
ln -sf ${kernelPackages.nvidia_x11} /run/opengl-driver
${optionalString cfg.driSupport32Bit
@@ -84,18 +88,25 @@ in {
else if elem "ati_unfree" cfg.videoDrivers then
"ln -sf ${kernelPackages.ati_drivers_x11} /run/opengl-driver"
else
+ let
+ lib_fun = 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)
+ ];
+ };
+ in
''
- ${optionalString cfg.driSupport "ln -sf ${pkgs.mesa_drivers} /run/opengl-driver"}
+ ${optionalString cfg.driSupport "ln -sf ${lib_fun pkgs} /run/opengl-driver"}
${optionalString cfg.driSupport32Bit
- "ln -sf ${pkgs_i686.mesa_drivers} /run/opengl-driver-32"}
+ "ln -sf ${lib_fun pkgs_i686} /run/opengl-driver-32"}
''
- }
- '';
+ );
environment.variables.LD_LIBRARY_PATH =
- [ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ]
- ++ optional cfg.s3tcSupport "${pkgs.libtxc_dxtn}/lib"
- ++ optional (cfg.s3tcSupport && cfg.driSupport32Bit) "${pkgs_i686.libtxc_dxtn}/lib";
+ [ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ];
boot.extraModulePackages =
optional (elem "nvidia" cfg.videoDrivers) kernelPackages.nvidia_x11 ++
diff --git a/nixos/modules/hardware/pcmcia.nix b/nixos/modules/hardware/pcmcia.nix
index 206846567505..d7d002ae6c8a 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 000000000000..f06139adc445
--- /dev/null
+++ b/nixos/modules/hardware/video/bumblebee.nix
@@ -0,0 +1,41 @@
+{ 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.
+ '';
+ };
+ };
+
+ 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";
+ path = [ kernel.bbswitch pkgs.bumblebee ];
+ serviceConfig = {
+ Restart = "always";
+ RestartSec = 60;
+ CPUSchedulingPolicy = "idle";
+ };
+ };
+ };
+}
diff --git a/nixos/modules/installer/cd-dvd/channel.nix b/nixos/modules/installer/cd-dvd/channel.nix
index 9aca5b89d258..ca0e233f9e3f 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
@@ -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 1aba67dcd9e9..a120a01041bd 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_${config.system.nixosVersion}";
# Make the installer more likely to succeed in low memory
# environments. The kernel's overcommit heustistics bite us
@@ -29,14 +29,15 @@ 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" ];
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
index debf3e7db906..65aa11670893 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/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix
index 00a9e91c7338..00f5fae84342 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
diff --git a/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix b/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
index 13ed95d4cebd..c274970c5536 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
diff --git a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix
index fcb96f7a24fe..0357bf801960 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
diff --git a/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix b/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
index 7f253d595dc3..1008bd5d3d0d 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,7 @@ in
};
# Setting vesa, we don't get the nvidia driver, which can't work in arm.
- services.xserver.videoDriver = "vesa";
- services.xserver.videoDrivers = [];
+ hardware.opengl.videoDrivers = [ "vesa" ];
services.nixosManual.enable = false;
# Include the firmware for various wireless cards.
diff --git a/nixos/modules/installer/cd-dvd/system-tarball.nix b/nixos/modules/installer/cd-dvd/system-tarball.nix
index 8d678fba71f5..eaecbe1381f5 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 09d04608e685..f350cd986afa 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 814858fdffda..b30c569ed2a7 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/nixos-checkout.nix b/nixos/modules/installer/tools/nixos-checkout.nix
index 418998556864..3338e5119acb 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 6b42058a8926..da1d26882772 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -61,7 +61,7 @@ my @attrs = ();
my @kernelModules = ();
my @initrdKernelModules = ();
my @modulePackages = ();
-my @imports = ("");
+my @imports = ("");
sub debug {
@@ -96,9 +96,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") {
@@ -130,6 +130,7 @@ sub pciCheck {
# broadcom STA driver (wl.ko)
# list taken from http://www.broadcom.com/docs/linux_sta/README.txt
+ # FIXME: still needed?
if ($vendor eq "0x14e4" &&
($device eq "0x4311" || $device eq "0x4312" || $device eq "0x4313" ||
$device eq "0x4315" || $device eq "0x4327" || $device eq "0x4328" ||
@@ -156,6 +157,7 @@ sub pciCheck {
# Assume that all NVIDIA cards are supported by the NVIDIA driver.
# There may be exceptions (e.g. old cards).
+ # FIXME: do we want to enable an unfree driver here?
$videoDriver = "nvidia" if $vendor eq "0x10de" && $class =~ /^0x03/;
}
@@ -163,16 +165,16 @@ foreach my $path (glob "/sys/bus/pci/devices/*") {
pciCheck $path;
}
-push @attrs, "services.xserver.videoDrivers = [ \"$videoDriver\" ];" if $videoDriver;
+push @attrs, "hardware.opengl.videoDrivers = [ \"$videoDriver\" ];" if $videoDriver;
# Idem for USB devices.
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 +218,22 @@ foreach my $path (glob "/sys/class/block/*") {
}
+my $dmi = `@dmidecode@/sbin/dmidecode`;
+
+
# Check if we're a VirtualBox guest. If so, enable the guest
# additions.
-my $dmi = `@dmidecode@/sbin/dmidecode`;
if ($dmi =~ /Manufacturer: innotek/) {
push @attrs, "services.virtualbox.enable = true;"
}
+# Likewise for QEMU.
+if ($dmi =~ /Manufacturer: Bochs/) {
+ push @imports, "";
+}
+
+
# Generate the swapDevices option from the currently activated swap
# devices.
my @swaps = read_file("/proc/swaps");
@@ -256,7 +266,7 @@ 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";
# Skip the optional fields.
my $n = 6; $n++ while $fields[$n] ne "-"; $n++;
@@ -305,7 +315,15 @@ EOF
fileSystems.\"$mountPoint\" =
{ device = \"$device\";
fsType = \"$fsType\";
- options = \"${\join ",", uniq(@extraOptions, @superOptions, @mountOptions)}\";
+EOF
+
+ if (scalar @extraOptions > 0) {
+ $fileSystems .= <&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 5c89394abceb..d7b749573fa9 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,30 @@ 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
+
+
+# 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 +125,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 +160,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
diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix
index 652bfa917dfa..7dbcc261485d 100644
--- a/nixos/modules/installer/tools/tools.nix
+++ b/nixos/modules/installer/tools/tools.nix
@@ -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 76cc29a1facd..0a52cbea2897 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 =
@@ -15,5 +15,5 @@ with pkgs.lib;
# Add some more video drivers to give X11 a shot at working in
# VMware and QEMU.
- services.xserver.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" ];
+ hardware.opengl.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" ];
}
diff --git a/nixos/modules/misc/assertions.nix b/nixos/modules/misc/assertions.nix
index 5fb88308b776..786ec7d250c4 100644
--- a/nixos/modules/misc/assertions.nix
+++ b/nixos/modules/misc/assertions.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/misc/check-config.nix b/nixos/modules/misc/check-config.nix
index f759c88d3a1f..e9803de21961 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 6e71baa9a431..d68f38bae2f5 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 16eec9043212..2d9ea1450ff0 100644
--- a/nixos/modules/misc/ids.nix
+++ b/nixos/modules/misc/ids.nix
@@ -110,6 +110,27 @@
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;
# When adding a uid, make sure it doesn't match an existing gid.
@@ -199,6 +220,22 @@
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;
# When adding a gid, make sure it doesn't match an existing uid.
diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix
index b6408be5844f..45da0df7967c 100644
--- a/nixos/modules/misc/locate.nix
+++ b/nixos/modules/misc/locate.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix
index 7433fab168e2..a5dad7dd9071 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:
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix
index ae9fb5fb2a0e..67bafac4c455 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;
{
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 442edd8029de..5c30d74be694 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -29,7 +29,9 @@
./hardware/network/intel-3945abg.nix
./hardware/network/ralink.nix
./hardware/network/rtl8192c.nix
+ ./hardware/opengl.nix
./hardware/pcmcia.nix
+ ./hardware/video/bumblebee.nix
./installer/tools/nixos-checkout.nix
./installer/tools/tools.nix
./misc/assertions.nix
@@ -59,6 +61,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
@@ -76,20 +80,34 @@
./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/memcached.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/virtuoso.nix
+ ./services/databases/monetdb.nix
+ ./services/desktops/accountservice.nix
+ ./services/desktops/gnome3/at-spi2-core.nix
+ ./services/desktops/gnome3/evolution-data-server.nix
+ ./services/desktops/gnome3/gnome-keyring.nix
+ ./services/desktops/gnome3/gnome-online-accounts.nix
+ ./services/desktops/gnome3/gnome-user-share.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
@@ -116,13 +134,16 @@
./services/mail/spamassassin.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/gpsd.nix
./services/misc/nix-daemon.nix
./services/misc/nix-gc.nix
+ ./services/misc/nix-ssh-serve.nix
./services/misc/nixos-manual.nix
+ ./services/misc/rippled.nix
./services/misc/rogue.nix
./services/misc/svnserve.nix
./services/misc/synergy.nix
@@ -142,11 +163,14 @@
./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/btsync.nix
+ ./services/networking/cjdns.nix
./services/networking/connman.nix
./services/networking/cntlm.nix
./services/networking/chrony.nix
@@ -170,8 +194,11 @@
./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/ntopng.nix
./services/networking/ntpd.nix
./services/networking/oidentd.nix
@@ -184,7 +211,10 @@
./services/networking/rdnssd.nix
./services/networking/rpcbind.nix
./services/networking/sabnzbd.nix
+ ./services/networking/searx.nix
+ ./services/networking/spiped.nix
./services/networking/supybot.nix
+ ./services/networking/syncthing.nix
./services/networking/ssh/lshd.nix
./services/networking/ssh/sshd.nix
./services/networking/tftpd.nix
@@ -200,6 +230,7 @@
./services/scheduling/cron.nix
./services/scheduling/fcron.nix
./services/search/elasticsearch.nix
+ ./services/search/solr.nix
./services/security/clamav.nix
./services/security/haveged.nix
./services/security/fprot.nix
@@ -222,8 +253,10 @@
./services/web-servers/lighttpd/cgit.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
@@ -234,7 +267,6 @@
./services/x11/hardware/multitouch.nix
./services/x11/hardware/synaptics.nix
./services/x11/hardware/wacom.nix
- ./services/x11/mesa.nix
./services/x11/window-managers/awesome.nix
#./services/x11/window-managers/compiz.nix
./services/x11/window-managers/default.nix
@@ -282,6 +314,7 @@
./tasks/scsi-link-power-management.nix
./tasks/swraid.nix
./testing/service-runner.nix
+ ./virtualisation/container-config.nix
./virtualisation/containers.nix
./virtualisation/libvirtd.nix
#./virtualisation/nova.nix
diff --git a/nixos/modules/profiles/clone-config.nix b/nixos/modules/profiles/clone-config.nix
index 04ee76d8d3e9..f0d60bb6c428 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 396dcf6c5d3b..605cc6aad1de 100644
--- a/nixos/modules/profiles/demo.nix
+++ b/nixos/modules/profiles/demo.nix
@@ -11,6 +11,6 @@
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 541c46ca50c2..14fc905f783e 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;
diff --git a/nixos/modules/profiles/installation-device.nix b/nixos/modules/profiles/installation-device.nix
index 3b058c6e9715..5aab2a2954e7 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 821b9f93465a..5067622aaf16 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 c8e6fd4aa768..0a92b7ace507 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" ];
+
+ 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 7fdaab9d67df..e457db22333b 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;
diff --git a/nixos/modules/programs/bash/bash.nix b/nixos/modules/programs/bash/bash.nix
index 9d33e26c4959..9584f07b0945 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
diff --git a/nixos/modules/programs/bash/command-not-found.nix b/nixos/modules/programs/bash/command-not-found.nix
index 502320446a37..8c86d48b0808 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/environment.nix b/nixos/modules/programs/environment.nix
index 7c1922cdfd89..aa9aec078342 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,8 +17,7 @@ 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 =
[ "/nix/var/nix/profiles/per-user/root/channels/nixos"
@@ -45,7 +44,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/shadow.nix b/nixos/modules/programs/shadow.nix
index 9e46ab8b298f..a24350994992 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
@@ -58,7 +58,8 @@ in
config = {
- environment.systemPackages = [ pkgs.shadow ];
+ environment.systemPackages =
+ pkgs.lib.optional config.users.mutableUsers pkgs.shadow;
environment.etc =
[ { # /etc/login.defs: global configuration for pwdutils. You
@@ -94,6 +95,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 8052502c21ea..80d40a7c708c 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 a66679dff90d..fdb9dfd4b8c2 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 904989d57a09..34eafd4fa846 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 7ab653dd19fd..2b70a795f4fd 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;
diff --git a/nixos/modules/programs/virtualbox.nix b/nixos/modules/programs/virtualbox.nix
index 340fec0496ae..10e657abd3c5 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
diff --git a/nixos/modules/programs/wvdial.nix b/nixos/modules/programs/wvdial.nix
index da3f7dce98a1..8e7d0e51a4e0 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 cff751934d7d..7bcf8da2c659 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
@@ -116,8 +116,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}
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index 6ff5277cf9ca..0a67aeb81e56 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 []));
}
];
@@ -101,6 +103,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,10 +117,12 @@ 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" ] [ "services" "mesa" "driSupport" ]
-++ obsolete [ "services" "xserver" "driSupport32Bit" ] [ "services" "mesa" "driSupport32Bit" ]
-++ obsolete [ "services" "xserver" "s3tcSupport" ] [ "services" "mesa" "s3tcSupport" ]
-++ obsolete [ "services" "xserver" "videoDrivers" ] [ "services" "mesa" "videoDrivers" ]
+++ obsolete [ "services" "xserver" "driSupport" ] [ "hardware" "opengl" "driSupport" ]
+++ obsolete [ "services" "xserver" "driSupport32Bit" ] [ "hardware" "opengl" "driSupport32Bit" ]
+++ obsolete [ "services" "xserver" "s3tcSupport" ] [ "hardware" "opengl" "s3tcSupport" ]
+++ obsolete [ "services" "xserver" "videoDrivers" ] [ "hardware" "opengl" "videoDrivers" ]
+
+++ obsolete [ "services" "mysql55" ] [ "services" "mysql" ]
# Options that are obsolete and have no replacement.
++ obsolete' [ "boot" "loader" "grub" "bootDevice" ]
diff --git a/nixos/modules/security/apparmor-suid.nix b/nixos/modules/security/apparmor-suid.nix
index bc661164fdc2..b89b379ae666 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 b9f151590028..da7c93beee98 100644
--- a/nixos/modules/security/apparmor.nix
+++ b/nixos/modules/security/apparmor.nix
@@ -1,55 +1,39 @@
-{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 {
+ assertions =
+ [ { assertion = config.boot.kernelPackages.kernel.features ? apparmor
+ && config.boot.kernelPackages.kernel.features.apparmor;
+ message = "Your selected kernel does not have AppArmor support";
+ }
+ ];
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 +45,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 2e93fb36b450..f159e359f968 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,11 +10,6 @@ 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";
diff --git a/nixos/modules/security/duosec.nix b/nixos/modules/security/duosec.nix
new file mode 100644
index 000000000000..bd9611384828
--- /dev/null
+++ b/nixos/modules/security/duosec.nix
@@ -0,0 +1,198 @@
+{ 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.
+ '';
+ };
+ };
+ };
+
+ 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
+ AllowTcpForwarding no
+ '');
+ };
+}
diff --git a/nixos/modules/security/grsecurity.nix b/nixos/modules/security/grsecurity.nix
new file mode 100644
index 000000000000..90462a2d6d0d
--- /dev/null
+++ b/nixos/modules/security/grsecurity.nix
@@ -0,0 +1,443 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.security.grsecurity;
+
+ mkKernel = kernel: patch:
+ assert patch.kversion == kernel.version;
+ { inherit kernel patch;
+ inherit (patch) grversion revision;
+ };
+
+ stable-patch = with pkgs.kernelPatches;
+ if cfg.vserver then grsecurity_vserver else grsecurity_stable;
+ stableKernel = mkKernel pkgs.linux_3_2 stable-patch;
+ testKernel = mkKernel pkgs.linux_3_13 pkgs.kernelPatches.grsecurity_unstable;
+
+ ## -- grsecurity configuration -----------------------------------------------
+
+ grsecPrioCfg =
+ if cfg.config.priority == "security" then
+ "GRKERNSEC_CONFIG_PRIORITY_SECURITY y"
+ else
+ "GRKERNSEC_CONFIG_PRIORITY_PERF y";
+
+ grsecSystemCfg =
+ if cfg.config.system == "desktop" then
+ "GRKERNSEC_CONFIG_DESKTOP y"
+ else
+ "GRKERNSEC_CONFIG_SERVER y";
+
+ grsecVirtCfg =
+ if cfg.config.virtualisationConfig == "none" then
+ "GRKERNSEC_CONFIG_VIRT_NONE y"
+ else if cfg.config.virtualisationConfig == "host" then
+ "GRKERNSEC_CONFIG_VIRT_HOST y"
+ else
+ "GRKERNSEC_CONFIG_VIRT_GUEST y";
+
+ grsecHwvirtCfg = if cfg.config.virtualisationConfig == "none" then "" else
+ if cfg.config.hardwareVirtualisation == true then
+ "GRKERNSEC_CONFIG_VIRT_EPT y"
+ else
+ "GRKERNSEC_CONFIG_VIRT_SOFT y";
+
+ grsecVirtswCfg =
+ let virtCfg = opt: "GRKERNSEC_CONFIG_VIRT_"+opt+" y";
+ in
+ if cfg.config.virtualisationConfig == "none" then ""
+ else if cfg.config.virtualisationSoftware == "xen" then virtCfg "XEN"
+ else if cfg.config.virtualisationSoftware == "kvm" then virtCfg "KVM"
+ else if cfg.config.virtualisationSoftware == "vmware" then virtCfg "VMWARE"
+ else virtCfg "VIRTUALBOX";
+
+ grsecMainConfig = if cfg.config.mode == "custom" then "" else ''
+ GRKERNSEC_CONFIG_AUTO y
+ ${grsecPrioCfg}
+ ${grsecSystemCfg}
+ ${grsecVirtCfg}
+ ${grsecHwvirtCfg}
+ ${grsecVirtswCfg}
+ '';
+
+ grsecConfig =
+ let boolToKernOpt = b: if b then "y" else "n";
+ # Disable RANDSTRUCT under virtualbox, as it has some kind of
+ # breakage with the vbox guest drivers
+ randstruct = optionalString config.services.virtualbox.enable
+ "GRKERNSEC_RANDSTRUCT n";
+ # Disable restricting links under the testing kernel, as something
+ # has changed causing it to fail miserably during boot.
+ restrictLinks = optionalString cfg.testing
+ "GRKERNSEC_LINK n";
+ in ''
+ SECURITY_APPARMOR y
+ DEFAULT_SECURITY_APPARMOR y
+ GRKERNSEC y
+ ${grsecMainConfig}
+
+ ${if cfg.config.restrictProc then
+ "GRKERNSEC_PROC_USER y"
+ else
+ optionalString cfg.config.restrictProcWithGroup ''
+ GRKERNSEC_PROC_USERGROUP y
+ GRKERNSEC_PROC_GID ${toString cfg.config.unrestrictProcGid}
+ ''
+ }
+
+ GRKERNSEC_SYSCTL ${boolToKernOpt cfg.config.sysctl}
+ GRKERNSEC_CHROOT_CHMOD ${boolToKernOpt cfg.config.denyChrootChmod}
+ GRKERNSEC_NO_RBAC ${boolToKernOpt cfg.config.disableRBAC}
+ ${randstruct}
+ ${restrictLinks}
+
+ ${cfg.config.kernelExtraConfig}
+ '';
+
+ ## -- grsecurity kernel packages ---------------------------------------------
+
+ localver = grkern:
+ "-grsec" + optionalString cfg.config.verboseVersion
+ "-${grkern.grversion}-${grkern.revision}";
+
+ grsecurityOverrider = args: grkern: {
+ # Apparently as of gcc 4.6, gcc-plugin headers (which are needed by PaX plugins)
+ # include libgmp headers, so we need these extra tweaks
+ buildInputs = args.buildInputs ++ [ pkgs.gmp ];
+ preConfigure = ''
+ ${args.preConfigure or ""}
+ sed -i 's|-I|-I${pkgs.gmp}/include -I|' scripts/gcc-plugin.sh
+ sed -i 's|HOST_EXTRACFLAGS +=|HOST_EXTRACFLAGS += -I${pkgs.gmp}/include|' tools/gcc/Makefile
+ sed -i 's|HOST_EXTRACXXFLAGS +=|HOST_EXTRACXXFLAGS += -I${pkgs.gmp}/include|' tools/gcc/Makefile
+ rm localversion-grsec
+ echo ${localver grkern} > localversion-grsec
+ '';
+ };
+
+ mkGrsecPkg = grkern:
+ let kernelPkg = lowPrio (overrideDerivation (grkern.kernel.override (args: {
+ kernelPatches = args.kernelPatches ++ [ grkern.patch pkgs.kernelPatches.grsec_fix_path ];
+ argsOverride = {
+ modDirVersion = "${grkern.kernel.modDirVersion}${localver grkern}";
+ };
+ extraConfig = grsecConfig;
+ })) (args: grsecurityOverrider args grkern));
+ in pkgs.linuxPackagesFor kernelPkg (mkGrsecPkg grkern);
+
+ grsecPackage = mkGrsecPkg (if cfg.stable then stableKernel else testKernel);
+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.
+ '';
+ };
+
+ vserver = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable the stable grsecurity/vserver patches, 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 by
+ 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 by 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 by 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.testing -> !cfg.vserver);
+ message = "The vserver patches are only supported in the stable kernel.";
+ }
+ { 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 support, gradm udev rules, and utilities
+ security.apparmor.enable = true;
+ boot.kernelPackages = grsecPackage;
+ 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 93d12d292e4d..6a5eb4c720f8 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
@@ -187,6 +187,8 @@ let
# Session management.
session required pam_unix.so
+ ${optionalString cfg.setLoginUid
+ "session required pam_loginuid.so"}
${optionalString cfg.updateWtmp
"session required ${pkgs.pam}/lib/security/pam_lastlog.so silent"}
${optionalString config.users.ldap.enable
@@ -197,8 +199,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 4cc99995fbca..11708a1f0167 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 dbec4ad98d16..5933cdc0cec3 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
@@ -63,6 +63,9 @@ in
systemd.packages = [ pkgs.polkit ];
+ systemd.services.polkit.restartTriggers = [ config.system.path ];
+ systemd.services.polkit.unitConfig.X-StopIfChanged = false;
+
# The polkit daemon reads action/rule files
environment.pathsToLink = [ "/share/polkit-1" ];
diff --git a/nixos/modules/security/prey.nix b/nixos/modules/security/prey.nix
index 75b95d5fbb04..e29fa5395a1a 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 720ac02f2e81..c31e57e6f6f8 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 = {
diff --git a/nixos/modules/security/rtkit.nix b/nixos/modules/security/rtkit.nix
index 164ad9b3aa7d..ba07591bb770 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;
{
diff --git a/nixos/modules/security/setuid-wrapper.c b/nixos/modules/security/setuid-wrapper.c
index 007ffbc34fe9..ffd0b65b7629 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 62df85816e50..4cdc1023baab 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 = ''
@@ -115,8 +117,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 215a8ecd6018..956856c64995 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
diff --git a/nixos/modules/services/amqp/activemq/default.nix b/nixos/modules/services/amqp/activemq/default.nix
index 915d179e6999..f1f3d005f30f 100644
--- a/nixos/modules/services/amqp/activemq/default.nix
+++ b/nixos/modules/services/amqp/activemq/default.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
with pkgs;
let
diff --git a/nixos/modules/services/amqp/rabbitmq.nix b/nixos/modules/services/amqp/rabbitmq.nix
index 696b5ad43797..bef15fb64b7f 100644
--- a/nixos/modules/services/amqp/rabbitmq.nix
+++ b/nixos/modules/services/amqp/rabbitmq.nix
@@ -1,22 +1,13 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
-
cfg = config.services.rabbitmq;
- run = cmd: "${pkgs.sudo}/bin/sudo -E -u rabbitmq ${cmd}";
-
-in
-
-{
-
-
+in {
###### interface
-
options = {
-
services.rabbitmq = {
enable = mkOption {
@@ -40,55 +31,59 @@ in
'';
};
- };
+ dataDir = mkOption {
+ type = types.path;
+ default = "/var/lib/rabbitmq";
+ description = ''
+ Data directory for rabbitmq.
+ '';
+ };
+
+ };
};
###### 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
-
- 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"}
- '';
+ 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 = "";
};
+ 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
+ '';
+ };
+
};
}
diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix
index c9a2ef4589bd..9a70d9edfa72 100644
--- a/nixos/modules/services/audio/alsa.nix
+++ b/nixos/modules/services/audio/alsa.nix
@@ -1,7 +1,7 @@
# ALSA sound support.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/audio/fuppes.nix b/nixos/modules/services/audio/fuppes.nix
index 3eb0732bae2e..4a975ed5f538 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/mpd.nix b/nixos/modules/services/audio/mpd.nix
index a9880dee20c4..1b50f06bf30d 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
diff --git a/nixos/modules/services/backup/almir.nix b/nixos/modules/services/backup/almir.nix
index d5bc932c6b96..5ce215c5c4b5 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 272903c99e33..c2255f688181 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 3ff9978fbb96..28f607861f77 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 e68ad794a96b..1f7b123eca37 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 178ba3ec7207..48ad7582b7e6 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 5c7f7ffae5b3..5d3675fa3e9d 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;
diff --git a/nixos/modules/services/backup/tarsnap.nix b/nixos/modules/services/backup/tarsnap.nix
new file mode 100644
index 000000000000..1966242e3dcb
--- /dev/null
+++ b/nixos/modules/services/backup/tarsnap.nix
@@ -0,0 +1,204 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.tarsnap;
+
+ optionalNullStr = e: v: if e == null then "" else v;
+
+ configFile = pkgs.writeText "tarsnap.conf" ''
+ cachedir ${cfg.cachedir}
+ keyfile ${cfg.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.
+ '';
+ };
+
+ label = mkOption {
+ type = types.str;
+ default = "nixos";
+ description = ''
+ Specifies the label for archives created by Tarsnap. The
+ full name will be
+ label-$(date+"%Y%m%d%H%M%S"). For
+ example, by default your backups will look similar to
+ nixos-20140301011501.
+ '';
+ };
+
+ 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.
+ '';
+ };
+
+ 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.
+ '';
+ };
+
+ 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.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions =
+ [ { assertion = cfg.directories != [];
+ message = "Must specify directories for Tarsnap to back up";
+ }
+ { assertion = cfg.lowmem -> !cfg.verylowmem && (cfg.verylowmem -> !cfg.lowmem);
+ message = "You cannot set both lowmem and verylowmem";
+ }
+ ];
+
+ systemd.services.tarsnap-backup = {
+ description = "Tarsnap Backup process";
+ path = [ pkgs.tarsnap pkgs.coreutils ];
+ script = ''
+ mkdir -p -m 0755 $(dirname ${cfg.cachedir})
+ mkdir -p -m 0600 ${cfg.cachedir}
+ exec tarsnap --configfile ${configFile} -c -f ${cfg.label}-$(date +"%Y%m%d%H%M%S") ${concatStringsSep " " cfg.directories}
+ '';
+ };
+
+ services.cron.systemCronJobs = optional cfg.enable
+ "${cfg.period} root ${config.systemd.package}/bin/systemctl start tarsnap-backup.service";
+
+ 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 000000000000..b01b5c3245a4
--- /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 000000000000..5836d92a4fc0
--- /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 7872ea2dc6a3..68913f15f953 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
diff --git a/nixos/modules/services/databases/4store.nix b/nixos/modules/services/databases/4store.nix
index 412d14b050cb..1725672a6594 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
diff --git a/nixos/modules/services/databases/couchdb.nix b/nixos/modules/services/databases/couchdb.nix
new file mode 100644
index 000000000000..5088c7416810
--- /dev/null
+++ b/nixos/modules/services/databases/couchdb.nix
@@ -0,0 +1,174 @@
+{ 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.
+ '';
+ };
+ };
+
+ };
+
+ ###### 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};
+
+ if [ "$(id -u)" = 0 ]; then
+ chown ${cfg.user}:${cfg.group} `dirname ${cfg.uriFile}`
+ chown ${cfg.user}:${cfg.group} ${cfg.databaseDir}
+ chown ${cfg.user}:${cfg.group} ${cfg.viewIndexDir}
+ 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}";
+ };
+ };
+
+ 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 75c225bdb67b..83dd4951170a 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
diff --git a/nixos/modules/services/databases/memcached.nix b/nixos/modules/services/databases/memcached.nix
index 505253229c9c..c6875af506d3 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
diff --git a/nixos/modules/services/databases/monetdb.nix b/nixos/modules/services/databases/monetdb.nix
new file mode 100644
index 000000000000..9f09c71e005a
--- /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 213a60687b23..fe82ca430e13 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.
";
diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix
index 8be05a27cdcb..1ca45d90f891 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,10 +8,14 @@ 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"
@@ -19,7 +23,7 @@ let
[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}"}
- ${optionalString (cfg.replication.role == "slave")
+ ${optionalString (cfg.replication.role == "slave" && !is55)
''
master-host = ${cfg.replication.masterHost}
master-user = ${cfg.replication.masterUser}
@@ -47,7 +51,8 @@ in
};
package = mkOption {
- default = pkgs.mysql;
+ type = types.package;
+ example = literalExample "pkgs.mysql";
description = "
Which MySQL derivation to use.
";
@@ -176,7 +181,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 +221,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 +250,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 fe8b29e3c6b7..000000000000
--- 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 0fc8b88c6526..c95238b34515 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
diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix
index 265d26e8ce98..ad83cb553e1d 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
@@ -55,7 +55,7 @@ in
};
package = mkOption {
- type = types.path;
+ type = types.package;
example = literalExample "pkgs.postgresql92";
description = ''
PostgreSQL package to use.
@@ -215,7 +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 = "process"; # FIXME: this may cause processes to be left behind in the cgroup even after the final SIGKILL
+ 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 ea6399ba4f44..4ef48df9831c 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;
@@ -45,6 +45,7 @@ in
package = mkOption {
default = pkgs.redis;
description = "Which Redis derivation to use.";
+ type = types.package;
};
user = mkOption {
diff --git a/nixos/modules/services/databases/virtuoso.nix b/nixos/modules/services/databases/virtuoso.nix
index 6a29fc132114..f955cb74b6ba 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/accountservice.nix b/nixos/modules/services/desktops/accountservice.nix
new file mode 100644
index 000000000000..386dfe98bd23
--- /dev/null
+++ b/nixos/modules/services/desktops/accountservice.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.accountservice ];
+
+ services.dbus.packages = [ pkgs.accountservice ];
+
+ systemd.packages = [ pkgs.accountservice ];
+ };
+
+}
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 000000000000..22a54f511d1c
--- /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.gnome3.at_spi2_core ];
+
+ services.dbus.packages = [ pkgs.gnome3.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 000000000000..a49b5b477689
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/evolution-data-server.nix
@@ -0,0 +1,39 @@
+# Evolution Data Server daemon.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+
+ ###### 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 = [ pkgs.evolution_data_server ];
+
+ services.dbus.packages = [ pkgs.evolution_data_server ];
+
+ };
+
+}
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 000000000000..447fd783f148
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-keyring.nix
@@ -0,0 +1,40 @@
+# GNOME Keyring daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+{
+
+ ###### 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 = [ pkgs.gnome3.gnome_keyring ];
+
+ services.dbus.packages = [ pkgs.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 000000000000..365e19c15bb1
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix
@@ -0,0 +1,39 @@
+# GNOME Online Accounts daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+{
+
+ ###### 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 = [ pkgs.gnome3.gnome_online_accounts ];
+
+ services.dbus.packages = [ pkgs.gnome3.gnome_online_accounts ];
+
+ };
+
+}
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 000000000000..df796ed77ff4
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-user-share.nix
@@ -0,0 +1,42 @@
+# GNOME User Share daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+{
+
+ ###### 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 = [ pkgs.gnome3.gnome-user-share ];
+
+ services.xserver.displayManager.sessionCommands = with pkgs.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/sushi.nix b/nixos/modules/services/desktops/gnome3/sushi.nix
new file mode 100644
index 000000000000..7a4389038b22
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/sushi.nix
@@ -0,0 +1,38 @@
+# GNOME Sushi daemon.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+
+ ###### 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 = [ pkgs.gnome3.sushi ];
+
+ services.dbus.packages = [ pkgs.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 000000000000..94a22d0c8819
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/tracker.nix
@@ -0,0 +1,39 @@
+# Tracker daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+{
+
+ ###### 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 = [ pkgs.gnome3.tracker ];
+
+ services.dbus.packages = [ pkgs.gnome3.tracker ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/telepathy.nix b/nixos/modules/services/desktops/telepathy.nix
new file mode 100644
index 000000000000..2554f3a1666f
--- /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 92c9112eeb6c..7a3ecebec39c 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;
diff --git a/nixos/modules/services/games/minecraft-server.nix b/nixos/modules/services/games/minecraft-server.nix
new file mode 100644
index 000000000000..4c734aefa469
--- /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 000000000000..18547f170a3f
--- /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 2329f38dfc25..a710636c1400 100644
--- a/nixos/modules/services/hardware/acpid.nix
+++ b/nixos/modules/services/hardware/acpid.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix
index a70a66c2ba0b..68d0406e63bd 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;
{
diff --git a/nixos/modules/services/hardware/pcscd.nix b/nixos/modules/services/hardware/pcscd.nix
index 9f389efc06d4..6e30dfb752d2 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 32599554fc12..04db46999b0a 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 5979feb82409..01d910575bb5 100644
--- a/nixos/modules/services/hardware/sane.nix
+++ b/nixos/modules/services/hardware/sane.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/hardware/thinkfan.nix b/nixos/modules/services/hardware/thinkfan.nix
index b39c9cb1d9bb..16c31aab2d50 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 52b3ad435797..507752dabcf7 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
@@ -83,8 +83,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
@@ -243,5 +243,9 @@ in
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
index 531ee192573a..c9d11bcfc687 100644
--- a/nixos/modules/services/hardware/udisks.nix
+++ b/nixos/modules/services/hardware/udisks.nix
@@ -1,8 +1,8 @@
# Udisks daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/hardware/udisks2.nix b/nixos/modules/services/hardware/udisks2.nix
index 178ec379ff1b..f5b641c7378b 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 4a9b13d4aa09..a202d82f646a 100644
--- a/nixos/modules/services/hardware/upower.nix
+++ b/nixos/modules/services/hardware/upower.nix
@@ -1,8 +1,8 @@
# Upower daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/logging/klogd.nix b/nixos/modules/services/logging/klogd.nix
index 36b530d0077e..f69e08152b55 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
diff --git a/nixos/modules/services/logging/logcheck.nix b/nixos/modules/services/logging/logcheck.nix
index 2a6a6516f488..1cd032ffa76b 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 c6c0d2ea2382..804f9a0847ff 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;
diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix
index 21128779e8f6..480e35a1156d 100644
--- a/nixos/modules/services/logging/logstash.nix
+++ b/nixos/modules/services/logging/logstash.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.logstash;
diff --git a/nixos/modules/services/logging/rsyslogd.nix b/nixos/modules/services/logging/rsyslogd.nix
index 680c7a912c1f..d4b7aa809f00 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/syslogd.nix b/nixos/modules/services/logging/syslogd.nix
index 36a0ace927ae..325868079e22 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 92682d644f41..1fb7102e7f3e 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 79f211ad86e3..2dd27a2033a7 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 bad0b22625dc..b7e1d295f2c5 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 2732fd602004..fbc4b1d7d8a8 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 2633289b46d5..8f75bd8ab5d0 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 aaf1dfcc210c..a3ac9e372422 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 50491c556e8a..e645bd25a66d 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 f715013b51f3..8f25df809cd6 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 {
diff --git a/nixos/modules/services/misc/dictd.nix b/nixos/modules/services/misc/dictd.nix
new file mode 100644
index 000000000000..552e0a435efe
--- /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 82526b154e7a..94d0caaa76b7 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
diff --git a/nixos/modules/services/misc/felix.nix b/nixos/modules/services/misc/felix.nix
index 2da50fc85957..a01c7f08b914 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 9f4c4645279f..0093e3c0c33a 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;
diff --git a/nixos/modules/services/misc/gpsd.nix b/nixos/modules/services/misc/gpsd.nix
index bc1d1f4575a8..4a677f33fa0c 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/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index cca42aa11009..4bfd6268234d 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
@@ -58,7 +58,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,7 +253,7 @@ in
config = {
- nix.chrootDirs = [ "/dev" "/dev/pts" "/proc" "/bin" ];
+ nix.chrootDirs = [ "/bin" ];
environment.etc."nix/nix.conf".source = nixConf;
@@ -275,28 +275,18 @@ in
) cfg.buildMachines;
};
- systemd.sockets."nix-daemon" =
- { description = "Nix Daemon Socket";
- wantedBy = [ "sockets.target" ];
- before = [ "multi-user.target" ];
- unitConfig.ConditionPathIsReadWrite = "/nix/var/nix/daemon-socket/";
- 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"; };
- unitConfig.ConditionPathIsReadWrite = "/nix/var/nix/daemon-socket/";
-
serviceConfig =
- { ExecStart = "@${nix}/bin/nix-daemon nix-daemon --daemon";
- KillMode = "process";
- Nice = cfg.daemonNiceLevel;
+ { Nice = cfg.daemonNiceLevel;
IOSchedulingPriority = cfg.daemonIONiceLevel;
LimitNOFILE = 4096;
};
@@ -352,8 +342,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 fa20e0956f59..6a7a7f4cee72 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 000000000000..80e7961b1f82
--- /dev/null
+++ b/nixos/modules/services/misc/nix-ssh-serve.nix
@@ -0,0 +1,45 @@
+{ config, lib, pkgs, ... }:
+
+let
+ serveOnly = pkgs.writeScript "nix-store-serve" ''
+ #!${pkgs.stdenv.shell}
+ if [ "$SSH_ORIGINAL_COMMAND" != "nix-store --serve" ]; then
+ echo 'Error: You are only allowed to run `nix-store --serve'\'''!' >&2
+ exit 1
+ fi
+ exec /run/current-system/sw/bin/nix-store --serve
+ '';
+
+ inherit (lib) mkIf mkOption types;
+in {
+ options = {
+ nix.sshServe = {
+ enable = mkOption {
+ description = "Whether to enable serving the nix store over ssh.";
+ default = false;
+ type = types.bool;
+ };
+ };
+ };
+
+ config = mkIf config.nix.sshServe.enable {
+ users.extraUsers.nix-ssh = {
+ description = "User for running nix-store --serve.";
+ uid = config.ids.uids.nix-ssh;
+ shell = pkgs.stdenv.shell;
+ };
+
+ services.openssh.enable = true;
+
+ services.openssh.extraConfig = ''
+ Match User nix-ssh
+ AllowAgentForwarding no
+ AllowTcpForwarding no
+ PermitTTY no
+ PermitTunnel no
+ X11Forwarding no
+ ForceCommand ${serveOnly}
+ Match All
+ '';
+ };
+}
diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix
index 1a8b85db3290..808c5dcbdc6f 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
diff --git a/nixos/modules/services/misc/rippled.nix b/nixos/modules/services/misc/rippled.nix
new file mode 100644
index 000000000000..2c1fec9f6d7c
--- /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 de25cc0fb982..ed8da8a518ff 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 b0806d14738b..848905ca457f 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 63e7c7667e57..ec8ff426f0a6 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
diff --git a/nixos/modules/services/monitoring/apcupsd.nix b/nixos/modules/services/monitoring/apcupsd.nix
index 58ec8a49694b..6cc0c122ec62 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;
@@ -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 Kill Power";
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 37ce1c099df9..bddf102ee517 100644
--- a/nixos/modules/services/monitoring/dd-agent.nix
+++ b/nixos/modules/services/monitoring/dd-agent.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.dd-agent;
diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix
index be57b8c5c03f..cb67b9d4fcbb 100644
--- a/nixos/modules/services/monitoring/graphite.nix
+++ b/nixos/modules/services/monitoring/graphite.nix
@@ -1,20 +1,34 @@
-{ 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-agregation.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;
};
@@ -23,6 +37,14 @@ 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";
@@ -38,8 +60,8 @@ in {
port = mkOption {
description = "Graphite web frontend port";
- default = "8080";
- type = types.str;
+ default = 8080;
+ type = types.int;
};
};
@@ -152,31 +174,17 @@ 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 {
+ 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";
+ };
restartTriggers = [
pkgs.pythonPackages.carbon
cfg.carbon.config
@@ -185,33 +193,45 @@ in {
cfg.carbon.rewriteRules
];
preStart = ''
- mkdir -p ${dataDir}/whisper
+ mkdir -m 0700 -p ${cfg.dataDir}/whisper
+ if [ "$(id -u)" = 0 ]; then chown -R graphite:graphite ${cfg.dataDir}; fi
'';
};
- systemd.services.carbonAggregator = mkIf cfg.carbon.enableAggregator {
+ 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
];
};
- systemd.services.carbonRelay = mkIf cfg.carbon.enableRelay {
+ 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
];
};
- systemd.services.graphiteWeb = mkIf cfg.web.enable {
+ systemd.services.graphiteWeb = {
+ enable = cfg.web.enable;
description = "Graphite Web Interface";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
@@ -224,14 +244,15 @@ 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";
};
preStart = ''
if ! test -e ${dataDir}/db-created; then
- mkdir -p ${dataDir}/{whisper/,log/webapp/}
+ mkdir -m 0700 -p ${dataDir}/{whisper/,log/webapp/}
+ if [ "$(id -u)" = 0 ]; then chown -R graphite:graphite ${cfg.dataDir}; fi
# populate database
${pkgs.python27Packages.graphite_web}/bin/manage-graphite.py syncdb --noinput
@@ -259,7 +280,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/munin.nix b/nixos/modules/services/monitoring/munin.nix
index 153f49429029..966c2eca282a 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,10 +173,12 @@ 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 {
diff --git a/nixos/modules/services/monitoring/nagios/default.nix b/nixos/modules/services/monitoring/nagios/default.nix
index c809a3b84573..2eeddf782501 100644
--- a/nixos/modules/services/monitoring/nagios/default.nix
+++ b/nixos/modules/services/monitoring/nagios/default.nix
@@ -1,7 +1,7 @@
# Nagios system/network monitoring daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix
index 512e639721e4..250035fe447f 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 979debefdd9f..05950639c1e0 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,13 +64,13 @@ 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";
- default = 2003;
+ default = config.services.graphite.web.port;
type = types.uniq types.int;
};
diff --git a/nixos/modules/services/monitoring/systemhealth.nix b/nixos/modules/services/monitoring/systemhealth.nix
index 0a3e666ad4e7..b0e59595e133 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;
diff --git a/nixos/modules/services/monitoring/ups.nix b/nixos/modules/services/monitoring/ups.nix
index c00f4bad9351..cc9026f768a8 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/zabbix-agent.nix b/nixos/modules/services/monitoring/zabbix-agent.nix
index 229236c1bbd4..481298f763a4 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
diff --git a/nixos/modules/services/monitoring/zabbix-server.nix b/nixos/modules/services/monitoring/zabbix-server.nix
index 6735b4ca3279..ca283ea2a99f 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 1a00ccab0a61..b914724abfe2 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 4daa5e9d0639..2217fec3b0f7 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 4a888b64bd34..b34ebc3663e3 100644
--- a/nixos/modules/services/network-filesystems/openafs-client/default.nix
+++ b/nixos/modules/services/network-filesystems/openafs-client/default.nix
@@ -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 000000000000..bc17add809b2
--- /dev/null
+++ b/nixos/modules/services/network-filesystems/rsyncd.nix
@@ -0,0 +1,139 @@
+{ config, pkgs, ... }:
+
+with pkgs.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 ];
+ };
+}
\ No newline at end of file
diff --git a/nixos/modules/services/network-filesystems/samba.nix b/nixos/modules/services/network-filesystems/samba.nix
index 4f6fce6cd52e..51a4d193d504 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
diff --git a/nixos/modules/services/networking/amuled.nix b/nixos/modules/services/networking/amuled.nix
index 8652d0daf4c8..516238fdddf6 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 2256de89630d..284b2b84e6c7 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
@@ -142,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 765dc014dcb7..57547da10067 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 fe37e8ea0120..7276603da16f 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 000000000000..8b288a713c60
--- /dev/null
+++ b/nixos/modules/services/networking/btsync.nix
@@ -0,0 +1,280 @@
+{ 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";
+ description = ''
+ HTTP web login username.
+ '';
+ };
+
+ httpPass = mkOption {
+ type = types.str;
+ example = "arebelongtous";
+ 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.";
+ }
+ # TODO FIXME: the README says not specifying the login/pass means it
+ # should disable authentication, but apparently it doesn't?
+ { assertion = cfg.enableWebUI -> cfg.httpLogin != "" && cfg.httpPass != "";
+ message = "If using the web UI, you must configure a login/password.";
+ }
+ # TODO FIXME: assert the existence of sharedFolder directories?
+ ];
+
+ 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 5e9818858e0c..d1684dd9f05d 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 000000000000..9306ffd5a18a
--- /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 96396878afc9..a50aa4d0636b 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
index 2b26fe88129b..7ed1e4805d8f 100644
--- a/nixos/modules/services/networking/connman.nix
+++ b/nixos/modules/services/networking/connman.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
with pkgs;
let
diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix
index 08a5d6de6a2b..35a3cfff8406 100644
--- a/nixos/modules/services/networking/dhcpcd.nix
+++ b/nixos/modules/services/networking/dhcpcd.nix
@@ -1,10 +1,10 @@
-{ 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.
@@ -34,8 +34,9 @@ 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*
+ # (Xen) and virbr* and vnet* (libvirt) and c-* and ctmp-* (NixOS
+ # containers).
+ denyinterfaces ${toString ignoredInterfaces} peth* vif* tap* tun* virbr* vnet* vboxnet* c-* ctmp-*
${config.networking.dhcpcd.extraConfig}
'';
@@ -79,6 +80,7 @@ in
options = {
networking.dhcpcd.denyInterfaces = mkOption {
+ type = types.listOf types.str;
default = [];
description = ''
Disable the DHCP client for any interface whose name matches
@@ -89,6 +91,7 @@ in
};
networking.dhcpcd.extraConfig = mkOption {
+ type = types.lines;
default = "";
description = ''
Literal string to append to the config file generated for dhcpcd.
@@ -106,7 +109,7 @@ in
{ description = "DHCP Client";
wantedBy = [ "network.target" ];
- after = [ "systemd-udev-settle.service" ];
+ after = [ "systemd-udev-settle.service" ]; # FIXME
# Stopping dhcpcd during a reconfiguration is undesirable
# because it brings down the network interfaces configured by
diff --git a/nixos/modules/services/networking/dhcpd.nix b/nixos/modules/services/networking/dhcpd.nix
index 5b2058e4e129..89f686c28703 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
diff --git a/nixos/modules/services/networking/dnsmasq.nix b/nixos/modules/services/networking/dnsmasq.nix
index b726493d421f..8e38b9d017a3 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 8a01c217eb5c..28b8e234a5cf 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
diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix
index 3c0c51e6ec8a..42914bfe5d62 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 f5bc550ab5f8..5ba85178179b 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 a4bd2098986d..e9cacf4a16e8 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 a7c7c206198f..5864efaca51f 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 421c0d9bb697..03ee54af4334 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 3b92eb8b06bd..416007941976 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/haproxy.nix b/nixos/modules/services/networking/haproxy.nix
index c8345a528a72..c2e2c2d7a418 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 4edea12b6be8..2adbb0a5c4e3 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 4e939d603542..20bfca8f8723 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 cd150fe63fd3..bc0fbb42c99d 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/default.nix b/nixos/modules/services/networking/ircd-hybrid/default.nix
index cd82a41ef7af..a3d5b71740f6 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
index 76dd66013ba7..d2045c9efc58 100644
--- a/nixos/modules/services/networking/kippo.nix
+++ b/nixos/modules/services/networking/kippo.nix
@@ -6,8 +6,8 @@
# 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.
-{ pkgs, config, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.kippo;
in
@@ -76,8 +76,9 @@ rec {
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"; };
+ users.extraGroups = singleton { name = "kippo";gid=108; };
systemd.services.kippo = with pkgs; {
description = "Kippo Web Server";
diff --git a/nixos/modules/services/networking/minidlna.nix b/nixos/modules/services/networking/minidlna.nix
index 73fcb1eeea8e..a519857d6a0b 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
diff --git a/nixos/modules/services/networking/murmur.nix b/nixos/modules/services/networking/murmur.nix
new file mode 100644
index 000000000000..4f91a4947479
--- /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 ce28f0188284..e8d9d00cc0a2 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 40c20aae4ef0..54bdf19373d5 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
with pkgs;
let
@@ -31,7 +31,7 @@ let
[modem-manager]
Identity=unix-group:networkmanager
- Action=org.freedesktop.ModemManager.*
+ Action=org.freedesktop.ModemManager*
ResultAny=yes
ResultInactive=no
ResultActive=yes
@@ -42,7 +42,7 @@ let
subject.isInGroup("networkmanager")
&& subject.active
&& (action.id.indexOf("org.freedesktop.NetworkManager.") == 0
- || action.id.indexOf("org.freedesktop.ModemManager.") == 0
+ || action.id.indexOf("org.freedesktop.ModemManager") == 0
))
{ return polkit.Result.YES; }
});
@@ -89,7 +89,7 @@ in {
to change network settings to this group.
'';
};
-
+
packages = mkOption {
type = types.listOf types.path;
default = [ ];
@@ -130,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";
@@ -159,6 +161,7 @@ in {
networkmanager_vpnc
networkmanager_openconnect
networkmanager_pptp
+ modemmanager
];
users.extraGroups = singleton {
@@ -174,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
@@ -204,6 +204,7 @@ in {
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 000000000000..49e5f3559803
--- /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 000000000000..b97435042395
--- /dev/null
+++ b/nixos/modules/services/networking/notbit.nix
@@ -0,0 +1,93 @@
+{ config, lib, pkgs, ... }:
+
+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}
+ '';
+ };
+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 = 8443;
+ 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";
+ };
+
+ };
+
+ };
+
+ ### implementation
+
+ config = mkIf cfg.enable {
+
+ environment.systemPackages = [ pkgs.notbit 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 -p ${toString cfg.port}";
+ 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/ntopng.nix b/nixos/modules/services/networking/ntopng.nix
index 156a6b32a6ab..ab86f1a5b2b4 100644
--- a/nixos/modules/services/networking/ntopng.nix
+++ b/nixos/modules/services/networking/ntopng.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/ntpd.nix b/nixos/modules/services/networking/ntpd.nix
index e5e164021d3a..2f638904406b 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 a2a555a8ad1b..923e7cd0986e 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 b2efb5e9c123..c3b4ba90b4e7 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 292d45f43475..e3998b1e5b28 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
diff --git a/nixos/modules/services/networking/prayer.nix b/nixos/modules/services/networking/prayer.nix
index fb541bf101ae..ad0fb0af01cb 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 89c40c531579..950112b2dabe 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 f3a4e457ec84..749e5dcebb61 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/radvd.nix b/nixos/modules/services/networking/radvd.nix
index 8d586ce6e46b..08762c9c8372 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 f797206ad5c7..4c1891816e3e 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 c966f85e260d..eef1e8e8cd88 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 8816ac0d2f83..83db0841b346 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 000000000000..b29db58af99b
--- /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 000000000000..ec5908b182fb
--- /dev/null
+++ b/nixos/modules/services/networking/spiped.nix
@@ -0,0 +1,212 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.spiped;
+in
+{
+ options = {
+ services.spiped = 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 = {
+ assertions = mapAttrsToList (name: c: {
+ assertion = (c.encrypt -> !c.decrypt) || (c.decrypt -> c.encrypt);
+ message = "A pipe must either encrypt or decrypt";
+ }) cfg;
+
+ 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 != {})
+ "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;
+ };
+}
diff --git a/nixos/modules/services/networking/ssh/lshd.nix b/nixos/modules/services/networking/ssh/lshd.nix
index 04ef76f1e4d4..fca30a1fe49c 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
diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix
index 85b6ab1efecf..b66ccb87120c 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
@@ -258,7 +258,6 @@ in
path = [ pkgs.openssh pkgs.gawk ];
environment.LD_LIBRARY_PATH = nssModulesPath;
- environment.LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
preStart =
''
@@ -285,7 +284,7 @@ in
networking.firewall.allowedTCPPorts = cfg.ports;
security.pam.services.sshd =
- { startSession = true;
+ { startSession = !config.boot.isContainer;
showMotd = true;
unixAuth = cfg.passwordAuthentication;
};
diff --git a/nixos/modules/services/networking/supybot.nix b/nixos/modules/services/networking/supybot.nix
index fa8b7556de5d..2cfb9fc9b923 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 000000000000..02572c1e27d2
--- /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 48cb884f2466..1359006aef4e 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/tftpd.nix b/nixos/modules/services/networking/tftpd.nix
index 37935496c597..a2f7ff06ea61 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 fb75b4ed069a..30ce4b49fa8d 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
diff --git a/nixos/modules/services/networking/vsftpd.nix b/nixos/modules/services/networking/vsftpd.nix
index 1c77cc6df4ea..62b6027c0120 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
@@ -91,6 +91,7 @@ let
${optionalString (pkgs.stdenv.system == "x86_64-linux") ''
seccomp_sandbox=NO
''}
+ anon_umask=${cfg.anonymousUmask}
'';
in
@@ -139,6 +140,13 @@ in
description = "RSA certificate file.";
};
+ anonymousUmask = mkOption {
+ type = types.string;
+ default = "077";
+ example = "002";
+ description = "Anonymous write umask.";
+ };
+
} // (listToAttrs (catAttrs "nixosOption" optionDescription));
};
diff --git a/nixos/modules/services/networking/wakeonlan.nix b/nixos/modules/services/networking/wakeonlan.nix
index 1fc54986b16f..11bb7e925255 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 12042bbad6c9..4b76350ecf8a 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 8e0122732164..18258084fc2c 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 5e5f81ed5a0b..eb721ec34559 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
diff --git a/nixos/modules/services/networking/xinetd.nix b/nixos/modules/services/networking/xinetd.nix
index 626183b810f1..14ee52ae52e6 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/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index 1be3587c3bb9..4b758608cb64 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
@@ -143,7 +143,9 @@ 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 =
''
diff --git a/nixos/modules/services/scheduling/atd.nix b/nixos/modules/services/scheduling/atd.nix
index c516c5889f12..c6f128ec4026 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 44ed1ba5a078..5da71b12dd76 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
diff --git a/nixos/modules/services/scheduling/fcron.nix b/nixos/modules/services/scheduling/fcron.nix
index fda29ca0482b..346a64f2c3cb 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
diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix
index b3d934862abf..b7a3566f95d9 100644
--- a/nixos/modules/services/search/elasticsearch.nix
+++ b/nixos/modules/services/search/elasticsearch.nix
@@ -1,20 +1,26 @@
-{ 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)
+ ];
+ };
+
in {
###### interface
@@ -34,14 +40,14 @@ in {
port = mkOption {
description = "Elasticsearch port to listen for HTTP traffic";
- default = "9200";
- type = types.str;
+ default = 9200;
+ type = types.int;
};
tcp_port = mkOption {
description = "Elasticsearch port for the node to node communication";
- default = "9300";
- type = types.str;
+ default = 9300;
+ type = types.int;
};
cluster_name = mkOption {
@@ -79,27 +85,32 @@ in {
'';
type = types.str;
};
+
+ dataDir = mkOption {
+ type = types.path;
+ default = "/var/lib/elasticsearch";
+ description = ''
+ Data directory for elasticsearch.
+ '';
+ };
};
###### 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 = {
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 -f -Des.path.conf=${configDir}";
User = "elasticsearch";
};
+ preStart = ''
+ mkdir -m 0700 -p ${cfg.dataDir}
+ if [ "$(id -u)" = 0 ]; then chown -R elasticsearch ${cfg.dataDir}; fi
+ '';
};
environment.systemPackages = [ pkgs.elasticsearch ];
@@ -108,8 +119,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 000000000000..38d9dedbe3cf
--- /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 5ccb4927fcb7..057891a60475 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 ae1fd22d23ee..af5450166379 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
diff --git a/nixos/modules/services/security/fprot.nix b/nixos/modules/services/security/fprot.nix
index 9f1fc4ed6d8b..7270a9f98145 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/haveged.nix b/nixos/modules/services/security/haveged.nix
index c3ea3fb03ed9..1d52ed55dbda 100644
--- a/nixos/modules/services/security/haveged.nix
+++ b/nixos/modules/services/security/haveged.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/security/tor.nix b/nixos/modules/services/security/tor.nix
index e70eb8511a63..582dd124c290 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 1c158906a911..53f48a714b4b 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 d6974282a6b5..ede6c983677a 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 cb5110f6feb3..8cc655803c59 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
diff --git a/nixos/modules/services/system/nscd.nix b/nixos/modules/services/system/nscd.nix
index b817b1df779f..f357eb4e1fc8 100644
--- a/nixos/modules/services/system/nscd.nix
+++ b/nixos/modules/services/system/nscd.nix
@@ -1,10 +1,11 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
nssModulesPath = config.system.nssModules.path;
+ cfg = config.services.nscd;
inherit (pkgs.lib) singleton;
@@ -24,6 +25,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 +38,7 @@ in
###### implementation
- config = mkIf config.services.nscd.enable {
+ config = mkIf cfg.enable {
users.extraUsers = singleton
{ name = "nscd";
@@ -56,7 +63,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 ${pkgs.writeText "nscd.conf" cfg.config}";
Type = "forking";
PIDFile = "/run/nscd/nscd.pid";
Restart = "always";
diff --git a/nixos/modules/services/torrent/deluge.nix b/nixos/modules/services/torrent/deluge.nix
index e0c212e5661f..00df4042d890 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 68f9b0647c0e..5cdecd1eb577 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";
@@ -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
@@ -161,9 +140,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 ae4fa87d4b7b..df21ebbd9743 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 74cee67aeae9..03b0f39824d0 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,15 @@ 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 = [ "getty.target" ];
- 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
index 302e660a7bff..70555e5d8825 100644
--- a/nixos/modules/services/ttys/kmscon.nix
+++ b/nixos/modules/services/ttys/kmscon.nix
@@ -44,6 +44,7 @@ in {
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
@@ -62,17 +63,19 @@ in {
X-RestartIfChanged=false
'';
- systemd.units."autovt@.service".linkTarget = "${config.systemd.units."kmsconvt@.service".unit}/kmsconvt@.service";
+ 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;
-
- systemd.units."kmsconvt@tty1.service".extraConfig.wait-for-vconsole-setup = "After=systemd-vconsole-setup.service";
+ systemd.services.systemd-vconsole-setup.restartIfChanged = false;
services.kmscon.extraConfig = mkIf cfg.hwRender ''
drm
hwaccel
'';
- services.mesa.enable = mkIf cfg.hwRender true;
+ 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 cdb42fa7308a..75ec6671d156 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
@@ -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;
@@ -188,7 +189,11 @@ let
subservices = callSubservices serverInfo cfg.extraSubservices;
- documentRoot = if cfg.documentRoot != null then cfg.documentRoot else
+ 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" {} "ensureDir $out";
documentRootConf = ''
@@ -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 ""}
@@ -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;
};
}));
@@ -572,7 +577,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,6 +587,12 @@ 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
{ name = "wwwrun";
@@ -610,7 +621,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,8 +633,8 @@ 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 =
''
diff --git a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix
index 423087991e13..7d59c13b9575 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
@@ -93,6 +93,10 @@ let
ensureDir $out
cp -r * $out
cp ${mediawikiConfig} $out/LocalSettings.php
+ sed -i 's|/bin/bash|${pkgs.stdenv.shell}|' \
+ $out/maintenance/fuzz-tester.php \
+ $out/bin/ulimit.sh \
+ $out/includes/GlobalFunctions.php
'';
};
@@ -122,7 +126,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 +150,8 @@ in
''}
'';
+ documentRoot = if config.urlPrefix == "" then mediawikiRoot else null;
+
enablePHP = true;
options = {
@@ -290,6 +307,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/per-server-options.nix b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
index 53f34e28c27e..b8e863345398 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/trac.nix b/nixos/modules/services/web-servers/apache-httpd/trac.nix
index dc82fd34f2fa..ad791d7d9582 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
diff --git a/nixos/modules/services/web-servers/apache-httpd/zabbix.nix b/nixos/modules/services/web-servers/apache-httpd/zabbix.nix
index a6e6042fdf6d..cab16593bcbc 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/jboss/default.nix b/nixos/modules/services/web-servers/jboss/default.nix
index e1bcede6563c..8a292ad67917 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 62264f1db452..dbff565bd8a3 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;
diff --git a/nixos/modules/services/web-servers/lighttpd/default.nix b/nixos/modules/services/web-servers/lighttpd/default.nix
index 4cc34c65d843..3ba934c72bf8 100644
--- a/nixos/modules/services/web-servers/lighttpd/default.nix
+++ b/nixos/modules/services/web-servers/lighttpd/default.nix
@@ -1,8 +1,8 @@
# NixOS module for lighttpd web server
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/web-servers/lighttpd/gitweb.nix b/nixos/modules/services/web-servers/lighttpd/gitweb.nix
index f02bd4db2645..d49278be09a8 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;
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix
index 4a1b6de2873f..ff94ee42d28d 100644
--- a/nixos/modules/services/web-servers/nginx/default.nix
+++ b/nixos/modules/services/web-servers/nginx/default.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.nginx;
@@ -9,6 +9,12 @@ let
user ${cfg.user} ${cfg.group};
daemon off;
${cfg.config}
+ ${optionalString (cfg.httpConfig != "") ''
+ http {
+ ${cfg.httpConfig}
+ }
+ ''}
+ ${cfg.appendConfig}
'';
in
@@ -24,6 +30,7 @@ in
package = mkOption {
default = pkgs.nginx;
+ type = types.package;
description = "
Nginx package to use.
";
@@ -36,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 = "
diff --git a/nixos/modules/services/web-servers/phpfpm.nix b/nixos/modules/services/web-servers/phpfpm.nix
new file mode 100644
index 000000000000..4a14f9b41a42
--- /dev/null
+++ b/nixos/modules/services/web-servers/phpfpm.nix
@@ -0,0 +1,84 @@
+{ 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.
+ '';
+ };
+
+ 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}";
+ PIDFile = pidFile;
+ };
+ };
+
+ };
+}
diff --git a/nixos/modules/services/web-servers/tomcat.nix b/nixos/modules/services/web-servers/tomcat.nix
index a68828de5d8e..b5eee8f8be8f 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
diff --git a/nixos/modules/services/web-servers/varnish/default.nix b/nixos/modules/services/web-servers/varnish/default.nix
index 7e327120c3d1..364f6c68faca 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 000000000000..7f48012f158e
--- /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 576f4b08fb90..21117118457d 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 035b23b4e1bb..b82398ccf9dd 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,7 @@ 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 ./kde4.nix ./e17.nix ];
+ imports = [ ./none.nix ./xterm.nix ./xfce.nix ./kde4.nix ./e17.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 3d91617c62aa..4cac53c9c75b 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/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix
new file mode 100644
index 000000000000..4620bc6722af
--- /dev/null
+++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix
@@ -0,0 +1,129 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.desktopManager.gnome3;
+ gnome3 = pkgs.gnome3;
+
+ # 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;
+
+in {
+
+ options = {
+
+ services.xserver.desktopManager.gnome3.enable = mkOption {
+ default = false;
+ example = true;
+ description = "Enable Gnome 3 desktop manager.";
+ };
+
+ 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.gnome3.at-spi2-core.enable = true;
+ services.gnome3.evolution-data-server.enable = 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.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;
+
+ fonts.extraFonts = [ 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
+
+ # Don't let epiphany depend upon gnome-shell
+ export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${pkgs.gnome3.gnome_shell}/share/gsettings-schemas/${pkgs.gnome3.gnome_shell.name}
+
+ # Let gnome-control-center find gnome-shell search providers
+ export GNOME_SEARCH_PROVIDERS_DIR=${config.system.path}/share/gnome-shell/search-providers/
+
+ # 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"
+ "${pkgs.glib_networking}/lib/gio/modules" ];
+ environment.systemPackages =
+ [ pkgs.desktop_file_utils
+ pkgs.glib_networking
+ pkgs.gtk3 # for gtk-update-icon-cache
+ pkgs.ibus
+ pkgs.shared_mime_info # for update-mime-database
+ 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
+ ] ++ (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.file-roller
+ gnome3.gnome-tweak-tool
+ ] 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 108b52bb951d..26b0612671c4 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
@@ -159,7 +159,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 000000000000..97e966ca0197
--- /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 5e5fab3ed2bb..a72eea76239f 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}
@@ -81,7 +81,7 @@ in
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 edc61c103ea9..eab914071410 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 33d97e0e07a9..c02ccdf12b65 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 575386bac0aa..3bf18bd58c84 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
@@ -51,17 +51,6 @@ let
''}
- ${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.
diff --git a/nixos/modules/services/x11/display-managers/kdm.nix b/nixos/modules/services/x11/display-managers/kdm.nix
index c51e7edfddf3..7ec489ae3e73 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 e4125891e6cb..d459c59b0483 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
@@ -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 35834ef3764b..114d34557a07 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"
@@ -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 4f9048bfd910..6e6e88e67218 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 91e01f2e30b1..f2227a34a20c 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 = {
@@ -106,15 +120,10 @@ 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}"
- ${if cfg.tapButtons then "" else ''Option "MaxTapTime" "0"''}
- Option "TapButton1" "${builtins.elemAt cfg.buttonsMap 0}"
- Option "TapButton2" "${builtins.elemAt cfg.buttonsMap 1}"
- Option "TapButton3" "${builtins.elemAt cfg.buttonsMap 2}"
+ ${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}"
diff --git a/nixos/modules/services/x11/hardware/wacom.nix b/nixos/modules/services/x11/hardware/wacom.nix
index dfc588cd2132..540ed168b489 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 b9ad962d8e46..d73b58de6c08 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;
};
};
};
@@ -41,10 +54,12 @@ in {
description = "Redshift colour temperature adjuster";
requires = [ "display-manager.service" ];
after = [ "display-manager.service" ];
- script = ''
+ 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 bf9c3435503d..bdc23c0acd18 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
@@ -27,7 +27,7 @@ in
config = {
services.xserver.enable = true;
- services.xserver.videoDrivers = [];
+ hardware.opengl.videoDrivers = [];
# Enable KDM. Any display manager will do as long as it supports XDMCP.
services.xserver.displayManager.kdm.enable = true;
diff --git a/nixos/modules/services/x11/window-managers/awesome.nix b/nixos/modules/services/x11/window-managers/awesome.nix
index 1c61419a44c0..9b2f042a87a6 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/compiz.nix b/nixos/modules/services/x11/window-managers/compiz.nix
index 209401f26468..ffd71e5f91ec 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 4d52e398b477..f27ba3661413 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,6 @@ in
./wmii.nix
./xmonad.nix
./i3.nix
- ./xbmc.nix
./herbstluftwm.nix
];
diff --git a/nixos/modules/services/x11/window-managers/herbstluftwm.nix b/nixos/modules/services/x11/window-managers/herbstluftwm.nix
index 9480abba43b7..6cda910b6b33 100644
--- a/nixos/modules/services/x11/window-managers/herbstluftwm.nix
+++ b/nixos/modules/services/x11/window-managers/herbstluftwm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.xserver.windowManager.herbstluftwm;
diff --git a/nixos/modules/services/x11/window-managers/i3.nix b/nixos/modules/services/x11/window-managers/i3.nix
index e53d86187ae6..e85c3bce591d 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 b7da4051c141..36028da453a5 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 712e2038594e..d13cbcfe40e8 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/twm.nix b/nixos/modules/services/x11/window-managers/twm.nix
index d80ffe4942fb..684b34c2f246 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 b61521274fba..75f6fdfe3bc4 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 46494202b404..000000000000
--- 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/xfs.nix b/nixos/modules/services/x11/xfs.nix
index 44c1d533c3ac..196f3beb41e9 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 5600ce7fac13..65f93b544996 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
@@ -20,9 +20,16 @@ let
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 = config.services.mesa.videoDrivers;
+ driverNames = config.hardware.opengl.videoDrivers;
+
+ needsAcpid =
+ (elem "nvidia" driverNames) ||
+ (elem "nvidiaLegacy173" driverNames) ||
+ (elem "nvidiaLegacy304" driverNames);
drivers = flip map driverNames
(name: { inherit name; driverName = name; } //
@@ -181,7 +188,7 @@ in
description = ''
The name of the video driver for your graphics card. This
option is obsolete; please set the
- instead.
+ instead.
'';
};
@@ -194,17 +201,6 @@ in
'';
};
- 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;
@@ -372,6 +368,14 @@ in
'';
};
+ useGlamor = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to use the Glamor module for 2D acceleration,
+ if possible.
+ '';
+ };
};
};
@@ -381,15 +385,15 @@ in
###### implementation
config = mkIf cfg.enable {
- services.mesa.enable = true;
- services.mesa.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
+ hardware.opengl.enable = true;
+ hardware.opengl.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
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;
@@ -428,6 +432,8 @@ in
++ optional (elem "virtualbox" driverNames) xorg.xrefresh
++ optional (elem "ati_unfree" driverNames) kernelPackages.ati_drivers_x11;
+ services.acpid.enable = mkIf needsAcpid true;
+
environment.pathsToLink =
[ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ];
@@ -436,7 +442,8 @@ in
systemd.services."display-manager" =
{ description = "X11 Server";
- after = [ "systemd-udev-settle.service" "local-fs.target" ];
+ after = [ "systemd-udev-settle.service" "local-fs.target" ]
+ ++ optional needsAcpid "acpid.service";
restartIfChanged = false;
@@ -523,6 +530,13 @@ in
'')}
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: ''
@@ -530,6 +544,7 @@ in
Section "Device"
Identifier "Device-${driver.name}[0]"
Driver "${driver.driverName}"
+ ${if cfg.useGlamor then ''Option "AccelMethod" "glamor"'' else ""}
${cfg.deviceSection}
${xrandrDeviceSection}
EndSection
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index 1545bcb8a1f9..41fe7d309a5a 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
diff --git a/nixos/modules/system/activation/no-clone.nix b/nixos/modules/system/activation/no-clone.nix
index c9ab691ce477..7f4584435266 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 91beed1130eb..25b5afe99da4 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -27,7 +27,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);
@@ -96,12 +99,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 {
@@ -109,6 +118,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);
@@ -125,7 +142,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;
}
@@ -160,7 +177,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$/) {
@@ -170,7 +187,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")) {
push @unitsToSkip, $unit;
} else {
# If this unit is socket-activated, then stop the
@@ -319,7 +339,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";
$systemdManager->StartUnit($_, "replace") for @start;
unlink($startListFile);
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index 30a529988a96..1600a1fb0104 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;
@@ -68,6 +68,7 @@ let
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
diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix
index 2b075bf6a6d2..b81bcf20f439 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
@@ -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)
@@ -203,6 +203,9 @@ in
# To wait for SCSI devices to appear.
"scsi_wait_scan"
+
+ # Needed by the stage 2 init script.
+ "rtc_cmos"
];
boot.initrd.kernelModules =
@@ -215,37 +218,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" ];
- conflicts = [ "shutdown.target" ];
- unitConfig =
- { DefaultDependencies = false;
- ConditionCapability = "CAP_SYS_MODULE";
- };
+ { 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 7e739173f9a3..241cfc7e836d 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 9855c8c19dd0..4b5e84f53c1a 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 ef6ff71ed778..a3b09223cbb8 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
@@ -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 = ''
diff --git a/nixos/modules/system/boot/loader/grub/memtest.nix b/nixos/modules/system/boot/loader/grub/memtest.nix
index 80c1a160cfde..94e5a14174b0 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 9ea224b51f63..db73544181b6 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 7edc30776379..19c613a7c94c 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;
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 4b0fcd85b4b5..3b33d42b4ae4 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 5bc856c3df0b..d3f32418a64c 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 ba357f5d2de3..c923cc49c449 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 44cadcd64a76..68bc936c5b0b 100644
--- a/nixos/modules/system/boot/shutdown.nix
+++ b/nixos/modules/system/boot/shutdown.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index 1f65026b5def..216937a619b1 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -14,7 +14,7 @@ fail() {
# in an interactive shell.
cat <restartIfChanged is
+ ignored.
+ '';
+ };
+
stopIfChanged = mkOption {
type = types.bool;
default = true;
@@ -268,7 +299,7 @@ in rec {
};
- socketOptions = unitOptions // {
+ socketOptions = commonUnitOptions // {
listenStreams = mkOption {
default = [];
@@ -295,7 +326,7 @@ in rec {
};
- timerOptions = unitOptions // {
+ timerOptions = commonUnitOptions // {
timerConfig = mkOption {
default = {};
@@ -314,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";
@@ -358,7 +406,7 @@ in rec {
};
};
- automountOptions = unitOptions // {
+ automountOptions = commonUnitOptions // {
where = mkOption {
example = "/mnt";
@@ -382,4 +430,6 @@ in rec {
};
};
+ targetOptions = commonUnitOptions;
+
}
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index b575deb24b7b..6c6adab66e7c 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,29 +11,26 @@ let
systemd = cfg.package;
makeUnit = name: unit:
- pkgs.runCommand "unit" { preferLocalBuild = true; inherit (unit) text; }
- ((if !unit.enable then ''
- mkdir -p $out
- ln -s /dev/null $out/${name}
- '' else if unit.linkTarget != null then ''
- mkdir -p $out
- ln -s ${unit.linkTarget} $out/${name}
- '' else if unit.text != null then ''
- mkdir -p $out
- echo -n "$text" > $out/${name}
- '' else "") + optionalString (unit.extraConfig != {}) ''
- mkdir -p $out/${name}.d
- ${concatStringsSep "\n" (mapAttrsToList (n: v: "echo -n \"${v}\" > $out/${name}.d/${n}") unit.extraConfig)}
- '');
+ if unit.enable then
+ pkgs.runCommand "unit" { preferLocalBuild = true; inherit (unit) text; }
+ ''
+ mkdir -p $out
+ echo -n "$text" > $out/${name}
+ ''
+ else
+ pkgs.runCommand "unit" { preferLocalBuild = true; }
+ ''
+ mkdir -p $out
+ ln -s /dev/null $out/${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"
@@ -43,6 +40,7 @@ let
"sigpwr.target"
"timers.target"
"paths.target"
+ "rpcbind.target"
# Rescue mode.
"rescue.target"
@@ -55,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"
@@ -67,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.
@@ -80,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"
@@ -93,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"
@@ -121,12 +136,30 @@ 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 [
@@ -134,16 +167,26 @@ let
"emergency.service"
];
- 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"
+ ];
+
makeJobScript = name: text:
let x = pkgs.writeTextFile { name = "unit-script"; executable = true; destination = "/bin/${name}"; inherit text; };
in "${x}/bin/${name}";
@@ -151,15 +194,23 @@ let
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;
};
};
@@ -244,6 +295,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 =
@@ -255,15 +311,16 @@ let
serviceToUnit = name: def:
{ inherit (def) wantedBy requiredBy enable;
- text =
+ text = commonUnitText def +
''
- [Unit]
- ${attrsToSection def.unitConfig}
-
[Service]
${let env = cfg.globalEnvironment // def.environment;
in concatMapStrings (n: "Environment=\"${n}=${getAttr n env}\"\n") (attrNames env)}
- ${optionalString (!def.restartIfChanged) "X-RestartIfChanged=false"}
+ ${if def.reloadIfChanged then ''
+ X-ReloadIfChanged=true
+ '' else if !def.restartIfChanged then ''
+ X-RestartIfChanged=false
+ '' else ""}
${optionalString (!def.stopIfChanged) "X-StopIfChanged=false"}
${attrsToSection def.serviceConfig}
'';
@@ -271,11 +328,8 @@ let
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)}
@@ -284,23 +338,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}
'';
@@ -308,70 +365,99 @@ let
automountToUnit = name: def:
{ inherit (def) wantedBy requiredBy enable;
- text =
+ text = commonUnitText def +
''
- [Unit]
- ${attrsToSection def.unitConfig}
-
[Automount]
${attrsToSection def.automountConfig}
'';
};
- 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 (mapAttrsToList (n: v: v.unit) cfg.units)}; do
- ln -fs $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/
+ files=$(echo $i/etc/systemd/${type}/* $i/lib/systemd/${type}/*)
+ if [ -n "$files" ]; then
+ ln -s $files $out/
+ fi
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)}
+ '') unit.wantedBy) units)}
${concatStrings (mapAttrsToList (name: unit:
concatMapStrings (name2: ''
mkdir -p $out/'${name2}.requires'
ln -sfn '../${name}' $out/'${name2}.requires'/
- '') unit.requiredBy) cfg.units)}
+ '') 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 ../autovt@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
@@ -393,55 +479,9 @@ in
default = {};
type = types.attrsOf types.optionSet;
options = { name, config, ... }:
- { options = {
- text = mkOption {
- type = types.nullOr types.str;
- default = null;
- description = "Text of this systemd unit.";
- };
- 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.";
- };
- unit = mkOption {
- internal = true;
- description = "The generated unit.";
- };
- linkTarget = mkOption {
- default = null;
- description = "The file to symlink this target to.";
- type = types.nullOr types.path;
- };
- extraConfig = mkOption {
- default = {};
- example = { "foo@1.conf" = "X-RestartIfChanged=false"; };
- type = types.attrsOf types.lines;
- description = ''
- Extra files to be appended to the configuration for the unit.
- This can be used to override configuration for a unit provided
- by systemd or another package, or to override only a single instance
- of a template unit.
- '';
- };
- };
+ { options = concreteUnitOptions;
config = {
- unit = makeUnit name config;
+ unit = mkDefault (makeUnit name config);
};
};
};
@@ -455,7 +495,7 @@ in
systemd.targets = mkOption {
default = {};
type = types.attrsOf types.optionSet;
- options = [ unitOptions unitConfig ];
+ options = [ targetOptions unitConfig ];
description = "Definition of systemd target units.";
};
@@ -480,6 +520,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;
@@ -567,6 +614,14 @@ in
'';
};
+ 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.lines;
@@ -590,6 +645,41 @@ in
'';
};
+ systemd.tmpfiles.rules = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "d /tmp 1777 root root 10d" ];
+ description = ''
+ 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.";
+ };
+
};
@@ -597,11 +687,20 @@ in
config = {
- system.build.units = units;
+ assertions = mapAttrsToList (name: service: {
+ assertion = service.serviceConfig.Type or "" == "oneshot" -> service.serviceConfig.Restart or "no" == "no";
+ message = "${name}: Type=oneshot services 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 =
''
@@ -645,8 +744,11 @@ in
'';
# 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 =
@@ -654,6 +756,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)
@@ -661,6 +764,9 @@ in
(v: let n = escapeSystemdPath v.where;
in nameValuePair "${n}.automount" (automountToUnit n v)) cfg.automounts);
+ systemd.user.units =
+ mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.user.services;
+
system.requiredKernelConfig = map config.lib.kernelConfig.isEnabled [
"CGROUPS" "AUTOFS4_FS" "DEVTMPFS"
];
@@ -673,6 +779,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 =
@@ -682,43 +790,25 @@ 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}
+ '';
};
}
diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix
index a8f0a59b6fa9..22d55a9e246c 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 = {
diff --git a/nixos/modules/system/etc/make-etc.sh b/nixos/modules/system/etc/make-etc.sh
index 7cf68db9ddce..60d4ba1301a3 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 4b79dbaab89e..8ba9a370b27a 100644
--- a/nixos/modules/system/etc/setup-etc.pl
+++ b/nixos/modules/system/etc/setup-etc.pl
@@ -60,7 +60,15 @@ sub link {
if ($mode eq "direct-symlink") {
atomicSymlink readlink("$static/$fn"), $target or warn;
} else {
+ open UID, "<$_.uid";
+ my $uid = ; chomp $uid;
+ close UID;
+ open GID, "<$_.gid";
+ my $gid = ; chomp $gid;
+ close 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;
}
diff --git a/nixos/modules/system/upstart/upstart.nix b/nixos/modules/system/upstart/upstart.nix
index aa5c8dfe64b2..5c0461304072 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 705ec93a1360..eb1dfe5f6be2 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,31 +28,28 @@ 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" ];
-
- unitConfig.ConditionPathIsReadWrite = "/sys/devices/";
-
- 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 ];
+ script = ''
+ cpupower frequency-set -g ${cfg.cpuFreqGovernor}
+ '';
+ unitConfig.ConditionVirtualization = false;
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = "yes";
};
- };
+ };
+ };
}
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index b0bcd2eb373e..954d0b0781f7 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
@@ -148,7 +148,7 @@ in
system.fsPackages = [ pkgs.dosfstools ];
environment.systemPackages =
- [ pkgs.ntfs3g pkgs.cifs_utils ]
+ [ pkgs.ntfs3g pkgs.cifs_utils pkgs.fuse ]
++ config.system.fsPackages;
environment.etc.fstab.text =
diff --git a/nixos/modules/tasks/filesystems/btrfs.nix b/nixos/modules/tasks/filesystems/btrfs.nix
index d95a32e2e3f7..d0a2ac645e0b 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/nfs.nix b/nixos/modules/tasks/filesystems/nfs.nix
index 2b720a93b893..e8c3d8ab56d5 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 f8c6a7000040..a3bfb3fed8ef 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/vfat.nix b/nixos/modules/tasks/filesystems/vfat.nix
index 5ca72f142b7d..4cfe6e208f7e 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 6800696a05a3..5225b62a88c5 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 7c3c662eeac9..1d75a24692c0 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,35 @@
# - /etc/zfs/zpool.cache handling
-with pkgs.lib;
+with lib;
let
cfgSpl = config.boot.spl;
+ 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;
+ autosnapPkg = pkgs.zfstools.override {
+ zfs = config.boot.kernelPackages.zfs;
+ };
+
+ zfsAutoSnap = "${autosnapPkg}/bin/zfs-auto-snapshot";
+
in
{
###### interface
-
- options = {
- boot.spl.hostid = mkOption {
+
+ options = {
+ boot.spl.hostid = mkOption {
default = "";
example = "0xdeadbeef";
description = ''
@@ -34,62 +46,177 @@ in
manually import pools.
'';
};
+
+ 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 = [ kernel.zfs kernel.spl ];
+ 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 ${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
+ '';
+ 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 = "${kernel.zfs}/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 = "${kernel.zfs}/sbin/zfs mount -a";
+ ExecStop = "${kernel.zfs}/sbin/zfs umount -a";
+ };
+ restartIfChanged = false;
+ };
+
+ 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.
+ })
+
+ (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 1083fb784fc0..03c42404e5d5 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" ];
- conflicts = [ "shutdown.target" ];
- unitConfig =
- { DefaultDependencies = "no";
- 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 0e0272388c76..d56a8a2f63a8 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 9619f0f5ebe7..9cc8b154324f 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -50,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";
@@ -171,6 +191,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.";
@@ -401,9 +430,11 @@ in
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 != "") ''
@@ -435,6 +466,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" ];
@@ -468,11 +500,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
''
diff --git a/nixos/modules/tasks/scsi-link-power-management.nix b/nixos/modules/tasks/scsi-link-power-management.nix
index 071a80865983..a74023dec21a 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
diff --git a/nixos/modules/testing/minimal-kernel.nix b/nixos/modules/testing/minimal-kernel.nix
index 0418de800c8d..0cbca71e1326 100644
--- a/nixos/modules/testing/minimal-kernel.nix
+++ b/nixos/modules/testing/minimal-kernel.nix
@@ -5,7 +5,7 @@ let
(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
index 6f17ed77dad9..dfe8b430e045 100644
--- a/nixos/modules/testing/service-runner.nix
+++ b/nixos/modules/testing/service-runner.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix
index 28494e1c7b2a..9100a433cd63 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
@@ -86,6 +86,8 @@ let kernel = config.boot.kernelPackages.kernel; in
(isEnabled "VIRTIO_CONSOLE")
];
+ networking.usePredictableInterfaceNames = false;
+
};
}
diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix
index abd2a1084bd9..18b18dd4b230 100644
--- a/nixos/modules/virtualisation/amazon-image.nix
+++ b/nixos/modules/virtualisation/amazon-image.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
imports = [ ../profiles/headless.nix ./ec2-data.nix ];
@@ -164,5 +164,5 @@ with pkgs.lib;
# 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 = "!";
+ security.initialRootPassword = mkDefault "!";
}
diff --git a/nixos/modules/virtualisation/container-config.nix b/nixos/modules/virtualisation/container-config.nix
new file mode 100644
index 000000000000..195a8056bf82
--- /dev/null
+++ b/nixos/modules/virtualisation/container-config.nix
@@ -0,0 +1,91 @@
+{ 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;
+
+ # 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;
+ };
+
+ };
+
+}
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index bcbfaacd703f..4fca872d72eb 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -1,6 +1,31 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
+
+let
+
+ runInNetns = pkgs.stdenv.mkDerivation {
+ name = "run-in-netns";
+ unpackPhase = "true";
+ buildPhase = ''
+ mkdir -p $out/bin
+ gcc ${./run-in-netns.c} -o $out/bin/run-in-netns
+ '';
+ installPhase = "true";
+ };
+
+ 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;
+ };
+
+ system = config.nixpkgs.system;
+
+in
{
options = {
@@ -14,19 +39,12 @@ with pkgs.lib;
'';
};
- systemd.containers = mkOption {
+ containers = mkOption {
type = types.attrsOf (types.submodule (
{ config, options, name, ... }:
{
options = {
- root = mkOption {
- type = types.path;
- description = ''
- The root directory of the container.
- '';
- };
-
config = mkOption {
description = ''
A specification of the desired configuration of this
@@ -45,21 +63,54 @@ with pkgs.lib;
'';
};
+ 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
+ c-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
- [ { root = mkDefault "/var/lib/containers/${name}";
- }
- (mkIf options.config.isDefined {
+ [ (mkIf options.config.isDefined {
path = (import ../../lib/eval-config.nix {
+ inherit system;
modules =
let extraConfig =
{ boot.isContainer = true;
- security.initialRootPassword = "!";
+ security.initialRootPassword = mkDefault "!";
networking.hostName = mkDefault name;
+ networking.useDHCP = false;
};
in [ extraConfig config.config ];
- prefix = [ "systemd" "containers" name ];
+ prefix = [ "containers" name ];
}).config.system.build.toplevel;
})
];
@@ -69,12 +120,10 @@ with pkgs.lib;
example = literalExample
''
{ webserver =
- { root = "/containers/webserver";
- path = "/nix/var/nix/profiles/webserver";
+ { path = "/nix/var/nix/profiles/webserver";
};
database =
- { root = "/containers/database";
- config =
+ { config =
{ config, pkgs, ... }:
{ services.postgresql.enable = true;
services.postgresql.package = pkgs.postgresql92;
@@ -94,44 +143,151 @@ with pkgs.lib;
};
- config = {
+ config = mkIf (!config.boot.isContainer) {
- systemd.services = mapAttrs' (name: container: nameValuePair "container-${name}"
- { description = "Container '${name}'";
+ systemd.services."container@" =
+ { description = "Container '%i'";
- wantedBy = [ "multi-user.target" ];
+ unitConfig.RequiresMountsFor = [ "/var/lib/containers/%i" ];
- unitConfig.RequiresMountsFor = [ container.root ];
+ path = [ pkgs.iproute ];
+
+ environment.INSTANCE = "%i";
+ environment.root = "/var/lib/containers/%i";
preStart =
''
- mkdir -p -m 0755 ${container.root}/etc
- if ! [ -e ${container.root}/etc/os-release ]; then
- touch ${container.root}/etc/os-release
+ mkdir -p -m 0755 $root/var/lib
+
+ # Create a named pipe to get a signal when the container
+ # has finished booting.
+ rm -f $root/var/lib/startup-done
+ mkfifo -m 0600 $root/var/lib/startup-done
+ '';
+
+ script =
+ ''
+ mkdir -p -m 0755 "$root/etc" "$root/var/lib"
+ 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"
+
+ if [ -f "/etc/containers/$INSTANCE.conf" ]; then
+ . "/etc/containers/$INSTANCE.conf"
+ fi
+
+ # Cleanup from last time.
+ ifaceHost=c-$INSTANCE
+ ifaceCont=ctmp-$INSTANCE
+ ns=net-$INSTANCE
+ ip netns del $ns 2> /dev/null || true
+ ip link del $ifaceHost 2> /dev/null || true
+ ip link del $ifaceCont 2> /dev/null || true
+
+ if [ "$PRIVATE_NETWORK" = 1 ]; then
+ # Create a pair of virtual ethernet devices. On the host,
+ # we get ‘c- /dev/null; then break; fi
- sleep 1
- done
- fi
+ machinectl poweroff "$INSTANCE"
'';
- }) config.systemd.containers;
+
+ restartIfChanged = false;
+ #reloadIfChanged = true; # FIXME
+
+ serviceConfig.ExecReload = pkgs.writeScript "reload-container"
+ ''
+ #! ${pkgs.stdenv.shell} -e
+ SYSTEM_PATH=/nix/var/nix/profiles/system
+ if [ -f "/etc/containers/$INSTANCE.conf" ]; then
+ . "/etc/containers/$INSTANCE.conf"
+ fi
+ echo $SYSTEM_PATH/bin/switch-to-configuration test | \
+ ${pkgs.socat}/bin/socat unix:$root/var/lib/run-command.socket -
+ '';
+
+ serviceConfig.SyslogIdentifier = "container %i";
+ };
+
+ # 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);
+
+ environment.systemPackages = [ nixos-container ];
};
-}
\ No newline at end of file
+}
diff --git a/nixos/modules/virtualisation/ec2-data.nix b/nixos/modules/virtualisation/ec2-data.nix
index 5133a98cd962..246d35065317 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 = {
diff --git a/nixos/modules/virtualisation/google-compute-image.nix b/nixos/modules/virtualisation/google-compute-image.nix
index 098c9ede8533..34b8b0e9c1ca 100644
--- a/nixos/modules/virtualisation/google-compute-image.nix
+++ b/nixos/modules/virtualisation/google-compute-image.nix
@@ -1,7 +1,9 @@
-{ config, pkgs, ... }:
-
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ diskSize = "100G";
+in
{
imports = [ ../profiles/headless.nix ../profiles/qemu-guest.nix ];
@@ -12,7 +14,7 @@ with pkgs.lib;
''
mkdir $out
diskImage=$out/$diskImageBase
- truncate $diskImage --size 10G
+ truncate $diskImage --size ${diskSize}
mv closure xchg/
'';
@@ -20,8 +22,9 @@ with pkgs.lib;
''
PATH=$PATH:${pkgs.gnutar}/bin:${pkgs.gzip}/bin
pushd $out
- tar -Szcf $diskImageBase.tar.gz $diskImageBase
- rm $out/$diskImageBase
+ 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";
@@ -32,7 +35,7 @@ with pkgs.lib;
''
# Create partition table
${pkgs.parted}/sbin/parted /dev/vda mklabel msdos
- ${pkgs.parted}/sbin/parted /dev/vda mkpart primary ext4 1 10G
+ ${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
@@ -114,7 +117,7 @@ with pkgs.lib;
# 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 Google Compute machines.
- security.initialRootPassword = "!";
+ security.initialRootPassword = mkDefault "!";
# Configure default metadata hostnames
networking.extraHosts = ''
diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix
index 583b09192e33..d7d700d88412 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 =
''
diff --git a/nixos/modules/virtualisation/nixos-container.pl b/nixos/modules/virtualisation/nixos-container.pl
new file mode 100644
index 000000000000..2fd41a340962
--- /dev/null
+++ b/nixos/modules/virtualisation/nixos-container.pl
@@ -0,0 +1,238 @@
+#! @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';
+
+# Parse the command line.
+
+sub showHelp {
+ print < [--config ] [--ensure-unique-name]
+ nixos-container destroy
+ nixos-container start
+ nixos-container stop
+ nixos-container login
+ nixos-container root-login
+ nixos-container run -- args...
+ nixos-container set-root-password
+ nixos-container show-ip
+EOF
+ exit 0;
+}
+
+my $ensureUniqueName = 0;
+my $extraConfig = "";
+
+GetOptions(
+ "help" => sub { showHelp() },
+ "ensure-unique-name" => \$ensureUniqueName,
+ "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";
+ write_file($confFile, \@conf);
+
+ close($lock);
+
+ print STDERR "host IP is $hostAddress, container IP is $localAddress\n";
+
+ mkpath("$root/etc/nixos", 0, 0755);
+
+ my $nixosConfigFile = "$root/etc/nixos/configuration.nix";
+ writeNixOSConfig $nixosConfigFile;
+
+ # 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);
+
+ 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 $confFile = "/etc/containers/$containerName.conf";
+die "$0: container ‘$containerName’ does not exist\n" if !-e $confFile;
+
+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($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 "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;
+
+ 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;
+ open(SOCAT, "|-", $socat, "unix:$root/var/lib/run-command.socket", "-");
+ print SOCAT join(' ', map { "'$_'" } @ARGV), "\n";
+ 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";
+ open(SOCAT, "|-", $socat, "unix:$root/var/lib/run-command.socket", "-");
+ print SOCAT "passwd\n";
+ print SOCAT "$password\n";
+ print SOCAT "$password\n";
+ 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";
+}
+
+else {
+ die "$0: unknown action ‘$action’\n";
+}
diff --git a/nixos/modules/virtualisation/nova-image.nix b/nixos/modules/virtualisation/nova-image.nix
index 5c9481b71278..2523dacc0b56 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 e0d25183574e..8795b5b52d5a 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
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index 2218e1045eb8..6605b94439bc 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
@@ -386,8 +386,7 @@ in
# When building a regular system configuration, override whatever
# video driver the host uses.
- services.xserver.videoDriver = mkVMOverride null;
- services.xserver.videoDrivers = mkVMOverride [ "vesa" ];
+ hardware.opengl.videoDrivers = mkVMOverride [ "vesa" ];
services.xserver.defaultDepth = mkVMOverride 0;
services.xserver.resolutions = mkVMOverride [ { x = 1024; y = 768; } ];
services.xserver.monitorSection =
@@ -400,6 +399,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/run-in-netns.c b/nixos/modules/virtualisation/run-in-netns.c
new file mode 100644
index 000000000000..d375bddf2e6b
--- /dev/null
+++ b/nixos/modules/virtualisation/run-in-netns.c
@@ -0,0 +1,50 @@
+#define _GNU_SOURCE
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main(int argc, char * * argv)
+{
+ if (argc < 3) {
+ fprintf(stderr, "%s: missing arguments\n", argv[0]);
+ return 1;
+ }
+
+ char nsPath[PATH_MAX];
+
+ sprintf(nsPath, "/run/netns/%s", argv[1]);
+
+ int fd = open(nsPath, O_RDONLY);
+ if (fd == -1) {
+ fprintf(stderr, "%s: opening network namespace: %s\n", argv[0], strerror(errno));
+ return 1;
+ }
+
+ if (setns(fd, CLONE_NEWNET) == -1) {
+ fprintf(stderr, "%s: setting network namespace: %s\n", argv[0], strerror(errno));
+ return 1;
+ }
+
+ umount2(nsPath, MNT_DETACH);
+ if (unlink(nsPath) == -1) {
+ fprintf(stderr, "%s: unlinking network namespace: %s\n", argv[0], strerror(errno));
+ return 1;
+ }
+
+ /* FIXME: Remount /sys so that /sys/class/net reflects the
+ interfaces visible in the network namespace. This requires
+ bind-mounting /sys/fs/cgroups etc. */
+
+ execv(argv[2], argv + 2);
+ fprintf(stderr, "%s: running command: %s\n", argv[0], strerror(errno));
+ return 1;
+}
diff --git a/nixos/modules/virtualisation/virtualbox-guest.nix b/nixos/modules/virtualisation/virtualbox-guest.nix
index 664fd21781cd..96354f1d81d0 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
@@ -38,6 +38,8 @@ optionalAttrs (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) # ugly...
boot.extraModulePackages = [ kernel.virtualboxGuestAdditions ];
+ boot.kernelModules = [ "vboxsf" ];
+
users.extraGroups.vboxsf.gid = config.ids.gids.vboxsf;
systemd.services.virtualbox =
@@ -52,7 +54,7 @@ optionalAttrs (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) # ugly...
serviceConfig.ExecStart = "@${kernel.virtualboxGuestAdditions}/sbin/VBoxService VBoxService --foreground";
};
- services.xserver.videoDrivers = mkOverride 50 [ "virtualbox" ];
+ hardware.opengl.videoDrivers = mkOverride 50 [ "virtualbox" ];
services.xserver.config =
''
diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix
index 71bdf31a98d2..3247881784e4 100644
--- a/nixos/modules/virtualisation/virtualbox-image.nix
+++ b/nixos/modules/virtualisation/virtualbox-image.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
system.build.virtualBoxImage =
@@ -92,7 +92,7 @@ with pkgs.lib;
--audiocontroller ac97 --audio alsa \
--rtcuseutc on \
--usb on --mouse usbtablet
- VBoxManage storagectl "$vmName" --name SATA --add sata --sataportcount 4 --bootable on --hostiocache on
+ 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
@@ -111,5 +111,5 @@ with pkgs.lib;
# Prevent logging in as root without a password. For NixOps, we
# don't need this because the user can login via SSH, and for the
# demo images, there is a demo user account that can sudo to root.
- security.initialRootPassword = "!";
+ security.initialRootPassword = mkDefault "!";
}
diff --git a/nixos/modules/virtualisation/xen-dom0.nix b/nixos/modules/virtualisation/xen-dom0.nix
index 40f6929be4f0..566059472c9f 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
diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix
index dccc3acbf464..32f523750004 100644
--- a/nixos/release-combined.nix
+++ b/nixos/release-combined.nix
@@ -44,7 +44,7 @@ in rec {
(all nixos.iso_graphical)
(all nixos.ova)
- #(all nixos.tests.efi-installer.simple)
+ # (all nixos.tests.efi-installer.simple)
(all nixos.tests.firefox)
(all nixos.tests.firewall)
(all nixos.tests.installer.grub1)
@@ -60,6 +60,8 @@ in rec {
(all nixos.tests.openssh)
(all nixos.tests.printing)
(all nixos.tests.proxy)
+ (all nixos.tests.udisks)
+ (all nixos.tests.udisks2)
(all nixos.tests.xfce)
nixpkgs.tarball
diff --git a/nixos/release.nix b/nixos/release.nix
index ff094cce05fa..4a10ff39ed0c 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -14,6 +14,8 @@ let
forAllSystems = pkgs.lib.genAttrs systems;
+ callTest = fn: args: forAllSystems (system: import fn ({ inherit system; } // args));
+
pkgs = import nixpkgs { system = "x86_64-linux"; };
lib = pkgs.lib;
@@ -207,13 +209,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.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.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.rabbitmq = callTest tests/rabbitmq.nix {};
+ tests.runInMachine = callTest tests/run-in-machine.nix {};
+ tests.simple = callTest tests/simple.nix {};
+ tests.tomcat = callTest tests/tomcat.nix {};
+ tests.udisks = callTest tests/udisks.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 d95361dcd83d..4091e7ece501 100644
--- a/nixos/tests/avahi.nix
+++ b/nixos/tests/avahi.nix
@@ -1,8 +1,7 @@
-{ pkgs, ... }:
+# Test whether `avahi-daemon' and `libnss-mdns' work as expected.
-with pkgs;
+import ./make-test.nix {
-{
nodes = {
one =
{ config, pkgs, ... }: {
@@ -17,7 +16,6 @@ with pkgs;
};
};
- # Test whether `avahi-daemon' and `libnss-mdns' work as expected.
testScript =
'' startAll;
diff --git a/nixos/tests/bittorrent.nix b/nixos/tests/bittorrent.nix
index 6e67edb0b820..b58657a5ecdb 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
@@ -33,6 +33,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 +42,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 +53,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 +71,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 +80,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 +109,4 @@ in
$client2->succeed("cmp /tmp/test.tar.bz2 ${file}");
'';
-}
+})
diff --git a/nixos/tests/common/user-account.nix b/nixos/tests/common/user-account.nix
index 8157cf8d263e..0239a3c4d08a 100644
--- a/nixos/tests/common/user-account.nix
+++ b/nixos/tests/common/user-account.nix
@@ -7,5 +7,6 @@
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 000000000000..8ad9cd6e0d79
--- /dev/null
+++ b/nixos/tests/containers.nix
@@ -0,0 +1,79 @@
+# Test for NixOS' container support.
+
+import ./make-test.nix {
+
+ 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");
+ $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 574e1dd2f8b8..000000000000
--- a/nixos/tests/default.nix
+++ /dev/null
@@ -1,40 +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 {});
- logstash = makeTest (import ./logstash.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/firefox.nix b/nixos/tests/firefox.nix
index ca634ffcf1e0..b42d473b8025 100644
--- a/nixos/tests/firefox.nix
+++ b/nixos/tests/firefox.nix
@@ -1,6 +1,4 @@
-{ pkgs, ... }:
-
-{
+import ./make-test.nix ({ pkgs, ... }: {
machine =
{ config, pkgs, ... }:
@@ -16,7 +14,6 @@
$machine->waitForWindow(qr/Valgrind/);
$machine->sleep(40); # wait until Firefox has finished loading the page
$machine->screenshot("screen");
-
'';
-}
+})
diff --git a/nixos/tests/firewall.nix b/nixos/tests/firewall.nix
index de32b98e5d2f..d10e10b1d91c 100644
--- a/nixos/tests/firewall.nix
+++ b/nixos/tests/firewall.nix
@@ -1,8 +1,6 @@
# Test the firewall module.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
nodes =
{ walled =
@@ -17,6 +15,7 @@
{ config, pkgs, ... }:
{ services.httpd.enable = true;
services.httpd.adminAddr = "foo@example.org";
+ networking.firewall.enable = false;
};
};
@@ -33,7 +32,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 000000000000..f1a6ce633313
--- /dev/null
+++ b/nixos/tests/gnome3.nix
@@ -0,0 +1,29 @@
+import ./make-test.nix {
+
+ 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/installer.nix b/nixos/tests/installer.nix
index 7581c10a01d0..43bea22d852e 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
@@ -39,7 +40,7 @@ let
{ imports =
[ ./hardware-configuration.nix
- "''${modulesPath}/testing/test-instrumentation.nix"
+
];
boot.loader.grub.version = ${toString grubVersion};
@@ -48,7 +49,6 @@ let
''}
boot.loader.grub.device = "${grubDevice}";
boot.loader.grub.extraConfig = "serial; terminal_output.serial";
- boot.initrd.kernelModules = [ "virtio_console" ];
environment.systemPackages = [ ${optionalString testChannel "pkgs.rlwrap"} ];
}
@@ -80,6 +80,8 @@ let
virtualisation.writableStore = true;
virtualisation.pathsInNixDB = channelContents ++ [ pkgs.hello.src ];
virtualisation.memorySize = 768;
+
+ networking.firewall.allowedTCPPorts = [ 80 ];
};
channelContents = [ pkgs.rlwrap ];
@@ -98,7 +100,7 @@ let
my $machine = createMachine({ hda => "harddisk",
hdaInterface => "${iface}",
cdrom => glob("${iso}/iso/*.iso"),
- qemuFlags => '${optionalString testChannel (toString (qemuNICFlags 1 1 2))} ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"}'});
+ qemuFlags => '${optionalString testChannel (toString (qemuNICFlags 1 1 2))} ${optionalString (iso.system == "x86_64-linux") "-cpu kvm64"}'});
$machine->start;
${optionalString testChannel ''
@@ -177,7 +179,7 @@ let
# 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;
@@ -189,8 +191,10 @@ let
'';
- makeTest = { createPartitions, fileSystems, testChannel ? false, grubVersion ? 2, grubDevice ? "/dev/vda" }:
- { inherit iso;
+ makeInstallerTest =
+ { createPartitions, fileSystems, testChannel ? false, grubVersion ? 2, grubDevice ? "/dev/vda" }:
+ makeTest {
+ inherit iso;
nodes = if testChannel then { inherit webserver; } else { };
testScript = testScriptFun {
inherit createPartitions fileSystems testChannel grubVersion grubDevice;
@@ -205,7 +209,7 @@ in {
# The (almost) simplest partitioning scheme: a swap partition and
# one big filesystem partition.
- simple = makeTest
+ simple = makeInstallerTest
{ createPartitions =
''
$machine->succeed(
@@ -224,7 +228,7 @@ in {
};
# Same as the previous, but now with a separate /boot partition.
- separateBoot = makeTest
+ separateBoot = makeInstallerTest
{ createPartitions =
''
$machine->succeed(
@@ -238,7 +242,7 @@ 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",
);
'';
@@ -247,14 +251,14 @@ in {
# Create two physical LVM partitions combined into one volume group
# that contains the logical swap and root partitions.
- lvm = makeTest
+ lvm = makeInstallerTest
{ 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",
@@ -270,8 +274,7 @@ in {
fileSystems = rootFS;
};
- /*
- swraid = makeTest
+ swraid = makeInstallerTest
{ createPartitions =
''
$machine->succeed(
@@ -303,10 +306,9 @@ in {
'';
fileSystems = rootFS + bootFS;
};
- */
# Test a basic install using GRUB 1.
- grub1 = makeTest
+ grub1 = makeInstallerTest
{ createPartitions =
''
$machine->succeed(
@@ -327,7 +329,7 @@ in {
};
# Rebuild the CD configuration with a little modification.
- rebuildCD =
+ rebuildCD = makeTest
{ inherit iso;
nodes = { };
testScript =
diff --git a/nixos/tests/ipv6.nix b/nixos/tests/ipv6.nix
index 29d675e180a3..eb15363d3c32 100644
--- a/nixos/tests/ipv6.nix
+++ b/nixos/tests/ipv6.nix
@@ -1,9 +1,7 @@
# Test of IPv6 functionality in NixOS, including whether router
# solicication/advertisement using radvd works.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
nodes =
{ client = { config, pkgs, ... }: { };
@@ -12,6 +10,7 @@
{ config, pkgs, ... }:
{ services.httpd.enable = true;
services.httpd.adminAddr = "foo@example.org";
+ networking.firewall.allowedTCPPorts = [ 80 ];
};
router =
diff --git a/nixos/tests/jenkins.nix b/nixos/tests/jenkins.nix
new file mode 100644
index 000000000000..9d3f76ca3e15
--- /dev/null
+++ b/nixos/tests/jenkins.nix
@@ -0,0 +1,41 @@
+# 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 {
+
+ 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 status jenkins.service");
+ '';
+}
diff --git a/nixos/tests/kde4.nix b/nixos/tests/kde4.nix
index 3fb35bbab098..725759ab758a 100644
--- a/nixos/tests/kde4.nix
+++ b/nixos/tests/kde4.nix
@@ -1,6 +1,4 @@
-{ pkgs, ... }:
-
-{
+import ./make-test.nix ({ pkgs, ... }: {
machine =
{ config, pkgs, ... }:
@@ -64,4 +62,4 @@
$machine->screenshot("screen");
'';
-}
+})
diff --git a/nixos/tests/kexec.nix b/nixos/tests/kexec.nix
index b8da332b919b..b09287682c01 100644
--- a/nixos/tests/kexec.nix
+++ b/nixos/tests/kexec.nix
@@ -1,8 +1,6 @@
# Test whether fast reboots via kexec work.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
machine = { config, pkgs, ... }:
{ virtualisation.vlans = [ ]; };
diff --git a/nixos/tests/login.nix b/nixos/tests/login.nix
index ed7d97867179..44c53c231c81 100644
--- a/nixos/tests/login.nix
+++ b/nixos/tests/login.nix
@@ -1,12 +1,16 @@
-config: { pkgs, ... }:
+import ./make-test.nix ({ pkgs, latestKernel ? false, ... }:
{
- 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 +20,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 +64,4 @@ config: { pkgs, ... }:
};
'';
-}
+})
diff --git a/nixos/tests/logstash.nix b/nixos/tests/logstash.nix
index ee309d39f872..e6aba7a10126 100644
--- a/nixos/tests/logstash.nix
+++ b/nixos/tests/logstash.nix
@@ -1,9 +1,8 @@
-{ pkgs, ... }:
+# This test runs logstash and checks if messages flows and
+# elasticsearch is started.
-# This test runs logstash and checks if messages flows and elasticsearch is
-# started
+import ./make-test.nix {
-{
nodes = {
one =
{ config, pkgs, ... }:
@@ -28,10 +27,10 @@
};
};
};
-
+
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");
diff --git a/nixos/tests/make-test.nix b/nixos/tests/make-test.nix
new file mode 100644
index 000000000000..285ca5b71d6e
--- /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 d355d705a24c..363be2cbb357 100644
--- a/nixos/tests/misc.nix
+++ b/nixos/tests/misc.nix
@@ -1,8 +1,6 @@
# Miscellaneous small tests that don't warrant their own VM run.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
machine =
{ config, pkgs, ... }:
@@ -10,6 +8,7 @@
[ { device = "/root/swapfile"; size = 128; } ];
environment.variables.EDITOR = pkgs.lib.mkOverride 0 "emacs";
services.nixosManual.enable = pkgs.lib.mkOverride 0 true;
+ systemd.tmpfiles.rules = [ "d /tmp 1777 root root 10d" ];
};
testScript =
@@ -65,6 +64,22 @@
$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 ]');
+ };
'';
}
diff --git a/nixos/tests/mpich.nix b/nixos/tests/mpich.nix
index d57512ebdfed..13cd0960d07c 100644
--- a/nixos/tests/mpich.nix
+++ b/nixos/tests/mpich.nix
@@ -1,10 +1,6 @@
# Simple example to showcase distributed tests using NixOS VMs.
-{ pkgs, ... }:
-
-with pkgs;
-
-{
+import ./make-test.nix {
nodes = {
master =
{ config, pkgs, ... }: {
diff --git a/nixos/tests/mumble.nix b/nixos/tests/mumble.nix
new file mode 100644
index 000000000000..8896830b0c22
--- /dev/null
+++ b/nixos/tests/mumble.nix
@@ -0,0 +1,55 @@
+import ./make-test.nix (
+
+let
+ client = { config, pkgs, ... }: {
+ imports = [ ./common/x11.nix ];
+ environment.systemPackages = [ pkgs.mumble ];
+ };
+in
+{
+ 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 &");
+
+ $server->sleep(10); # Wait for Mumble UI to pop up
+
+ # cancel client audio configuration
+ $client1->sendKeys("esc");
+ $client2->sendKeys("esc");
+ $server->sleep(1);
+
+ # cancel client cert configuration
+ $client1->sendKeys("esc");
+ $client2->sendKeys("esc");
+ $server->sleep(1);
+
+ # accept server certificate
+ $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 66ae1c0d87f7..acc4b949ab57 100644
--- a/nixos/tests/munin.nix
+++ b/nixos/tests/munin.nix
@@ -1,13 +1,12 @@
-{ pkgs, ... }:
-
# This test runs basic munin setup with node and cron job running on the same
# machine.
-{
- nodes = {
+import ./make-test.nix {
+
+ nodes = {
one =
{ config, pkgs, ... }:
- {
+ {
services = {
munin-node.enable = true;
munin-cron = {
@@ -20,10 +19,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 28a1187dd184..7d0cf6d85a1a 100644
--- a/nixos/tests/mysql-replication.nix
+++ b/nixos/tests/mysql-replication.nix
@@ -1,9 +1,10 @@
-{ pkgs, ... }:
+import ./make-test.nix (
let
replicateUser = "replicate";
replicatePassword = "secret";
in
+
{
nodes = {
master =
@@ -11,13 +12,15 @@ in
{
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 +28,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 +41,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 +59,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 b48850738b72..566d03baf367 100644
--- a/nixos/tests/mysql.nix
+++ b/nixos/tests/mysql.nix
@@ -1,14 +1,14 @@
-{ pkgs, ... }:
+import ./make-test.nix {
-{
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 a13714d60a94..02981469e106 100644
--- a/nixos/tests/nat.nix
+++ b/nixos/tests/nat.nix
@@ -4,14 +4,13 @@
# router connected to both that performs Network Address Translation
# for the client.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
nodes =
{ client =
{ config, pkgs, nodes, ... }:
{ virtualisation.vlans = [ 1 ];
+ networking.firewall.allowPing = true;
networking.defaultGateway =
nodes.router.config.networking.interfaces.eth2.ipAddress;
};
@@ -19,6 +18,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 +27,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 51abf57e1b75..864d05626b67 100644
--- a/nixos/tests/nfs.nix
+++ b/nixos/tests/nfs.nix
@@ -1,6 +1,4 @@
-{ version }:
-
-{ pkgs, ... }:
+import ./make-test.nix ({ version, ... }:
let
@@ -13,6 +11,7 @@ let
options = "vers=${toString version}";
}
];
+ networking.firewall.enable = false; # FIXME: only open statd
};
in
@@ -31,6 +30,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 +82,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 49d92fbde908..0b9714c275da 100644
--- a/nixos/tests/openssh.nix
+++ b/nixos/tests/openssh.nix
@@ -1,6 +1,5 @@
-{ pkgs, ... }:
+import ./make-test.nix ({ pkgs, ... }: {
-{
nodes = {
server =
@@ -35,4 +34,4 @@
$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");
'';
-}
+})
diff --git a/nixos/tests/partition.nix b/nixos/tests/partition.nix
index 7126e7255ef4..309afa4ce9d0 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;
@@ -224,4 +224,4 @@ in {
ensureMountPoint("/mnt/boot");
};
'';
-}
+})
diff --git a/nixos/tests/printing.nix b/nixos/tests/printing.nix
index 13cc3115d50e..9b96e3d7b20c 100644
--- a/nixos/tests/printing.nix
+++ b/nixos/tests/printing.nix
@@ -1,8 +1,6 @@
# Test printing via CUPS.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix ({pkgs, ... }: {
nodes = {
@@ -17,6 +15,7 @@
Allow from all
'';
+ networking.firewall.allowedTCPPorts = [ 631 ];
};
client =
@@ -32,12 +31,14 @@
# Make sure that cups is up on both sides.
$server->waitForUnit("cupsd.service");
+ $server->waitForUnit("network.target");
$client->waitForUnit("cupsd.service");
+ $client->waitForUnit("network.target");
$client->succeed("lpstat -r") =~ /scheduler is running/ or die;
$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 +88,4 @@
}
'';
-}
+})
diff --git a/nixos/tests/proxy.nix b/nixos/tests/proxy.nix
index 3b79c16ea2c4..88dbdb2720fb 100644
--- a/nixos/tests/proxy.nix
+++ b/nixos/tests/proxy.nix
@@ -1,16 +1,14 @@
-{ 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
@@ -21,8 +19,7 @@ in
{ 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 +47,8 @@ in
# For testing; don't want to wait forever for dead backend servers.
ProxyTimeout 5
'';
+
+ networking.firewall.allowedTCPPorts = [ 80 ];
};
backend1 = backend;
@@ -91,4 +90,4 @@ in
$client->succeed("curl --fail http://proxy/");
'';
-}
+})
diff --git a/nixos/tests/quake3.nix b/nixos/tests/quake3.nix
index 925011077805..3ff12fd57c06 100644
--- a/nixos/tests/quake3.nix
+++ b/nixos/tests/quake3.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+import ./make-test.nix (
let
@@ -14,11 +14,13 @@ in
rec {
+ 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 +37,7 @@ rec {
"'+map q3dm7' '+addbot grunt' '+addbot daemia' 2> /tmp/log";
};
nixpkgs.config.packageOverrides = overrides;
+ networking.firewall.allowedUDPPorts = [ 27960 ];
};
client1 = client;
@@ -76,4 +79,4 @@ rec {
$server->stopJob("quake3-server");
'';
-}
+})
diff --git a/nixos/tests/rabbitmq.nix b/nixos/tests/rabbitmq.nix
new file mode 100644
index 000000000000..ffcdde9d87f2
--- /dev/null
+++ b/nixos/tests/rabbitmq.nix
@@ -0,0 +1,17 @@
+# This test runs rabbitmq and checks if rabbitmq is up and running.
+
+import ./make-test.nix ({ pkgs, ... }: {
+
+ 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 8efe26c17082..7f6e6a6dc573 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 eee13a101334..e21b919cdf80 100644
--- a/nixos/tests/simple.nix
+++ b/nixos/tests/simple.nix
@@ -1,11 +1,11 @@
-{ pkgs, ... }:
+import ./make-test.nix {
-{
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 309da90c5df1..e6746dc08287 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
@@ -114,4 +114,4 @@ in
$webserver->stopJob("httpd");
'';
-}
+})
diff --git a/nixos/tests/tomcat.nix b/nixos/tests/tomcat.nix
index 6bc88ec82fa2..3b0b1bb79117 100644
--- a/nixos/tests/tomcat.nix
+++ b/nixos/tests/tomcat.nix
@@ -1,17 +1,15 @@
-{ pkgs, ... }:
+import ./make-test.nix {
-{
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 +24,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 e0d256f57019..3f17dafaca15 100644
--- a/nixos/tests/trac.nix
+++ b/nixos/tests/trac.nix
@@ -1,6 +1,5 @@
-{ pkgs, ... }:
+import ./make-test.nix ({ pkgs, ... }: {
-{
nodes = {
storage =
{ config, pkgs, ... }:
@@ -68,4 +67,4 @@
$client->screenshot("screen");
'';
-}
+})
diff --git a/nixos/tests/udisks.nix b/nixos/tests/udisks.nix
new file mode 100644
index 000000000000..b7f2e2c00315
--- /dev/null
+++ b/nixos/tests/udisks.nix
@@ -0,0 +1,56 @@
+import ./make-test.nix ({ pkgs, ... }:
+
+let
+
+ stick = pkgs.fetchurl {
+ url = http://nixos.org/~eelco/nix/udisks-test.img.xz;
+ sha256 = "0was1xgjkjad91nipzclaz5biv3m4b2nk029ga6nk7iklwi19l8b";
+ };
+
+in
+
+{
+
+ machine =
+ { config, pkgs, ... }:
+ { services.udisks.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("udisks --enumerate | grep /org/freedesktop/UDisks/devices/vda");
+ $machine->fail("udisks --enumerate | grep /org/freedesktop/UDisks/devices/sda1");
+
+ # Attach a USB stick and wait for it to show up.
+ $machine->sendMonitorCommand("usb_add disk:$stick");
+ $machine->waitUntilSucceeds("udisks --enumerate | grep /org/freedesktop/UDisks/devices/sda1");
+ $machine->succeed("udisks --show-info /dev/sda1 | grep 'label:.*USBSTICK'");
+
+ # Mount the stick as a non-root user and do some stuff with it.
+ $machine->succeed("su - alice -c 'udisks --enumerate | grep /org/freedesktop/UDisks/devices/sda1'");
+ $machine->succeed("su - alice -c 'udisks --mount /dev/sda1'");
+ $machine->succeed("su - alice -c 'cat /media/USBSTICK/test.txt'") =~ /Hello World/ or die;
+ $machine->succeed("su - alice -c 'echo foo > /media/USBSTICK/bar.txt'");
+
+ # Unmounting the stick should make the mountpoint disappear.
+ $machine->succeed("su - alice -c 'udisks --unmount /dev/sda1'");
+ $machine->fail("[ -d /media/USBSTICK ]");
+
+ # Remove the USB stick.
+ $machine->sendMonitorCommand("usb_del 0.3"); # FIXME
+ $machine->waitUntilFails("udisks --enumerate | grep /org/freedesktop/UDisks/devices/sda1");
+ $machine->fail("[ -e /dev/sda ]");
+ '';
+
+})
diff --git a/nixos/tests/udisks2.nix b/nixos/tests/udisks2.nix
new file mode 100644
index 000000000000..e0c57d7c34d6
--- /dev/null
+++ b/nixos/tests/udisks2.nix
@@ -0,0 +1,56 @@
+import ./make-test.nix ({ pkgs, ... }:
+
+let
+
+ stick = pkgs.fetchurl {
+ url = http://nixos.org/~eelco/nix/udisks-test.img.xz;
+ sha256 = "0was1xgjkjad91nipzclaz5biv3m4b2nk029ga6nk7iklwi19l8b";
+ };
+
+in
+
+{
+
+ 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 9f9692f8a014..ded37943e51d 100644
--- a/nixos/tests/xfce.nix
+++ b/nixos/tests/xfce.nix
@@ -1,6 +1,4 @@
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
machine =
{ config, pkgs, ... }:
@@ -17,6 +15,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 9dbdada07d49..c5e35d8867c8 100644
--- a/pkgs/applications/audio/a2jmidid/default.nix
+++ b/pkgs/applications/audio/a2jmidid/default.nix
@@ -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/amarok/default.nix b/pkgs/applications/audio/amarok/default.nix
index 1dac3f6b853a..b1bcfe869f78 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 000000000000..dd23504d3fad
--- /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 bf2ee04cbce9..000000000000
--- 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 3ed650d4ae73..4315a5a7547e 100644
--- a/pkgs/applications/audio/ardour/default.nix
+++ b/pkgs/applications/audio/ardour/default.nix
@@ -1,50 +1,62 @@
-{ 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, 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
+ tag = "3.5.357";
+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 = "1e026fb9a6ad4179d52c4b578cc3861bdfd3629b9e7b7a7341d431c7d3692c42";
};
- 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 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 = ''
+ # The funny revision number is from `git describe rev`
+ printf '#include "libs/ardour/ardour/revision.h"\nnamespace ARDOUR { const char* revision = \"${tag}-gce4d125\"; }\n' > libs/ardour/revision.cc
+ # Note the different version number
+ sed -i '33i rev = \"3.5-357-gce4d125\"' 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
'';
- 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 d838d29e8be1..409a831727bb 100644
--- a/pkgs/applications/audio/audacious/default.nix
+++ b/pkgs/applications/audio/audacious/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation {
source $stdenv/setup
# gsettings schemas for file dialogues
for file in "$out/bin/"*; do
- wrapProgram "$file" --prefix XDG_DATA_DIRS : "$XDG_ADD"
+ wrapProgram "$file" --prefix XDG_DATA_DIRS : "$XDG_ADD:$GSETTINGS_SCHEMAS_PATH"
done
)
'';
diff --git a/pkgs/applications/audio/clementine/default.nix b/pkgs/applications/audio/clementine/default.nix
index cf554f83c8b0..4352e2e133a6 100644
--- a/pkgs/applications/audio/clementine/default.nix
+++ b/pkgs/applications/audio/clementine/default.nix
@@ -44,5 +44,6 @@ stdenv.mkDerivation {
description = "A multiplatform music player";
license = licenses.gpl3Plus;
platforms = platforms.linux;
+ maintainers = [ maintainers.ttuegel ];
};
}
diff --git a/pkgs/applications/audio/drumkv1/default.nix b/pkgs/applications/audio/drumkv1/default.nix
index fc2453869e55..39f6ae0ded4e 100644
--- a/pkgs/applications/audio/drumkv1/default.nix
+++ b/pkgs/applications/audio/drumkv1/default.nix
@@ -2,11 +2,11 @@
stdenv.mkDerivation rec {
name = "drumkv1-${version}";
- version = "0.3.6";
+ version = "0.4.1";
src = fetchurl {
url = "mirror://sourceforge/drumkv1/${name}.tar.gz";
- sha256 = "13prman3jlh3xz56675vnnnghnmmbxpq8gqdhv5llgd8ggzhmyjn";
+ sha256 = "0wxbn5qm3dn9spwbm618flgrwvls7bipg0nhgn0lv4za2g823g56";
};
buildInputs = [ jackaudio libsndfile lv2 qt4 ];
diff --git a/pkgs/applications/audio/ekho/default.nix b/pkgs/applications/audio/ekho/default.nix
new file mode 100644
index 000000000000..dd9b830be841
--- /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/flac/default.nix b/pkgs/applications/audio/flac/default.nix
index 0383a1ce0ad5..1c8dc56de61c 100644
--- a/pkgs/applications/audio/flac/default.nix
+++ b/pkgs/applications/audio/flac/default.nix
@@ -12,9 +12,10 @@ stdenv.mkDerivation rec {
doCheck = true; # takes lots of time but will be run rarely (small build-time closure)
- 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/gigedit/default.nix b/pkgs/applications/audio/gigedit/default.nix
index be6970f01e16..269b48aebb8f 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/guitarix/default.nix b/pkgs/applications/audio/guitarix/default.nix
index 17d53a621ca6..44b0e9ef0d79 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, jackaudio, 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 jackaudio
+ 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/ingen/default.nix b/pkgs/applications/audio/ingen/default.nix
new file mode 100644
index 000000000000..73138cc269d0
--- /dev/null
+++ b/pkgs/applications/audio/ingen/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchsvn, boost, ganv, glibmm, gtk, gtkmm, jackaudio, 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 jackaudio 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/jalv/default.nix b/pkgs/applications/audio/jalv/default.nix
index 6b15052769be..2baf69cef4fd 100644
--- a/pkgs/applications/audio/jalv/default.nix
+++ b/pkgs/applications/audio/jalv/default.nix
@@ -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/lash/default.nix b/pkgs/applications/audio/lash/default.nix
index 72087c76b05d..ad52e7b2d85c 100644
--- a/pkgs/applications/audio/lash/default.nix
+++ b/pkgs/applications/audio/lash/default.nix
@@ -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/lastwatch/default.nix b/pkgs/applications/audio/lastwatch/default.nix
index 324a0b0bebcb..c09d397eefa3 100644
--- a/pkgs/applications/audio/lastwatch/default.nix
+++ b/pkgs/applications/audio/lastwatch/default.nix
@@ -19,8 +19,6 @@ 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";
diff --git a/pkgs/applications/audio/mid2key/default.nix b/pkgs/applications/audio/mid2key/default.nix
index 1e163391a397..26ea2c7b0b2c 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/moc/default.nix b/pkgs/applications/audio/moc/default.nix
index 74ae3dcf22bb..5356d4ce298a 100644
--- a/pkgs/applications/audio/moc/default.nix
+++ b/pkgs/applications/audio/moc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ncurses, pkgconfig, alsaLib, flac, libmad, speex, ffmpeg_0_10, libvorbis, mpc, libsndfile, jackaudio, db4, libmodplug, timidity, libid3tag, libtool }:
+{ stdenv, fetchurl, ncurses, pkgconfig, alsaLib, flac, libmad, speex, ffmpeg_0_10, libvorbis, mpc, libsndfile, jackaudio, db, libmodplug, timidity, libid3tag, libtool }:
stdenv.mkDerivation rec {
name = "moc-${version}";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
configurePhase = "./configure prefix=$out";
- buildInputs = [ ncurses pkgconfig alsaLib flac libmad speex ffmpeg_0_10 libvorbis mpc libsndfile jackaudio db4 libmodplug timidity libid3tag libtool ];
+ buildInputs = [ ncurses pkgconfig alsaLib flac libmad speex ffmpeg_0_10 libvorbis mpc libsndfile jackaudio 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.";
diff --git a/pkgs/applications/audio/monkeys-audio/default.nix b/pkgs/applications/audio/monkeys-audio/default.nix
index 48b0b52c5ea7..08aa7e017b21 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/default.nix b/pkgs/applications/audio/mopidy/default.nix
index b684fee37d56..04393372cf30 100644
--- a/pkgs/applications/audio/mopidy/default.nix
+++ b/pkgs/applications/audio/mopidy/default.nix
@@ -13,7 +13,7 @@ pythonPackages.buildPythonPackage rec {
};
propagatedBuildInputs = with pythonPackages; [
- gst_python pygobject pykka pyspotify pylast cherrypy ws4py
+ gst_python pygobject pykka pyspotify pylast cherrypy ws4py gst_plugins_base gst_plugins_good
];
# python zip complains about old timestamps
@@ -27,8 +27,7 @@ pythonPackages.buildPythonPackage rec {
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
+ --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH"
done
'';
diff --git a/pkgs/applications/audio/mpc/default.nix b/pkgs/applications/audio/mpc/default.nix
index bd21550a64cf..ae6d9e0c7e60 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 ];
@@ -24,4 +24,4 @@ stdenv.mkDerivation rec {
maintainers = [ stdenv.lib.maintainers.algorith ];
platforms = stdenv.lib.platforms.linux;
};
-}
\ No newline at end of file
+}
diff --git a/pkgs/applications/audio/mpg123/default.nix b/pkgs/applications/audio/mpg123/default.nix
index f14e2764211e..3edb7ae6793b 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.16.0";
+ name = "mpg123-1.19.0";
src = fetchurl {
- url = mirror://sourceforge/mpg123/mpg123-1.16.0.tar.bz2;
- sha256 = "1lznnfdvg69a9qbbhvhfc9i86hxdmdqx67lvbkqbh8mmhpip43zh";
+ 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/ncmpc/default.nix b/pkgs/applications/audio/ncmpc/default.nix
new file mode 100755
index 000000000000..6db80f39e2cf
--- /dev/null
+++ b/pkgs/applications/audio/ncmpc/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, glib, ncurses, mpd_clientlib }:
+
+stdenv.mkDerivation rec {
+ version = "0.21";
+ name = "ncmpc-${version}";
+
+ src = fetchurl {
+ url = "http://www.musicpd.org/download/ncmpc/0/ncmpc-${version}.tar.bz2";
+ sha256 = "648e846e305c867cb937dcb467393c2f5a30bf460bdf77b63de7af69fba1fd07";
+ };
+
+ buildInputs = [ pkgconfig glib ncurses mpd_clientlib ];
+
+ 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/pamixer/default.nix b/pkgs/applications/audio/pamixer/default.nix
new file mode 100644
index 000000000000..acdda1799d03
--- /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/pianobooster/default.nix b/pkgs/applications/audio/pianobooster/default.nix
index d5cdffbed952..67848cdc804b 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 000000000000..2b1b28c5a849
--- /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 000000000000..8cdd8738e2b3
--- /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 f2f196acdd85..b8a283125fc4 100644
--- a/pkgs/applications/audio/praat/default.nix
+++ b/pkgs/applications/audio/praat/default.nix
@@ -1,14 +1,15 @@
-{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 = ''
@@ -22,5 +23,6 @@ stdenv.mkDerivation {
description = "Doing phonetics by computer";
homepage = http://www.fon.hum.uva.nl/praat/;
license = "GPLv2+"; # Has some 3rd-party code in it though
+ platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/audio/puredata/default.nix b/pkgs/applications/audio/puredata/default.nix
index b1df008398db..d0394b72eddc 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, jackaudio, 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 jackaudio ];
+
+ configureFlags = ''
+ --enable-alsa
+ --enable-jack
+ --disable-portaudio
'';
postInstall = ''
diff --git a/pkgs/applications/audio/qmmp/default.nix b/pkgs/applications/audio/qmmp/default.nix
index 255c63a5d6d2..a18ef97dd60a 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.3";
+ name = "qmmp-0.7.6";
src = fetchurl {
url = "http://qmmp.ylsoftware.com/files/${name}.tar.bz2";
- sha256 = "0qjmnyq3qmrm510g3lsa6vd80nmbz0859pwhnaaa19ah0jhf3r2p";
+ sha256 = "1hq08ii06lyfg516jrvxdfcjj509gvglvdlsr96aqi1fh8v4k5p9";
};
buildInputs =
diff --git a/pkgs/applications/audio/qsampler/default.nix b/pkgs/applications/audio/qsampler/default.nix
index 7cfe73c9c750..b851517b8724 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/qtractor/default.nix b/pkgs/applications/audio/qtractor/default.nix
index e04ad9ddd14c..c70842c399ad 100644
--- a/pkgs/applications/audio/qtractor/default.nix
+++ b/pkgs/applications/audio/qtractor/default.nix
@@ -3,12 +3,12 @@
, libtool, libvorbis, pkgconfig, qt4, rubberband, stdenv }:
stdenv.mkDerivation rec {
- version = "0.5.12";
+ version = "0.6.0";
name = "qtractor-${version}";
src = fetchurl {
url = "mirror://sourceforge/qtractor/${name}.tar.gz";
- sha256 = "0yf2p9l3hj8pd550v3rbbjqkvxnvn8p6nsnm4aj2v5q4mgg2c8cc";
+ sha256 = "0aw6g0biqzysnsk5vd6wx3q1khyav6krhjz7bzk0v7d2160bn40r";
};
buildInputs =
diff --git a/pkgs/applications/audio/quodlibet/default.nix b/pkgs/applications/audio/quodlibet/default.nix
index c865314cb175..ea8ae88f022e 100644
--- a/pkgs/applications/audio/quodlibet/default.nix
+++ b/pkgs/applications/audio/quodlibet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python, buildPythonPackage, mutagen, pygtk, pygobject
+{ 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 }:
@@ -18,7 +18,7 @@ buildPythonPackage {
# XXX, tests fail
doCheck = false;
- src = [
+ srcs = [
(fetchurl {
url = "https://bitbucket.org/lazka/quodlibet-files/raw/default/releases/quodlibet-${version}.tar.gz";
sha256 = "0ilasi4b0ay8r6v6ba209wsm80fq2nmzigzc5kvphrk71jwypx6z";
@@ -27,14 +27,21 @@ buildPythonPackage {
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 = stdenv.lib.optionals withGstPlugins [
@@ -42,18 +49,13 @@ buildPythonPackage {
];
propagatedBuildInputs = [
- mutagen pygtk pygobject pythonDBus gst_python
+ mutagen pygtk pygobject pythonDBus gst_python intltool
];
postInstall = stdenv.lib.optionalString withGstPlugins ''
# Wrap quodlibet so it finds the GStreamer plug-ins
- wrapProgram "$out/bin/quodlibet" --prefix \
- GST_PLUGIN_PATH ":" \
- ${ stdenv.lib.concatStringsSep ":"
- (map (s: s+"/lib/gstreamer-0.10")
- (stdenv.lib.filter (s: s != null) [
- gst_plugins_base gst_plugins_good gst_plugins_ugly gst_plugins_bad
- ])) }
+ wrapProgram "$out/bin/quodlibet" --prefix \
+ GST_PLUGIN_SYSTEM_PATH ":" "$GST_PLUGIN_SYSTEM_PATH" \
'';
meta = {
diff --git a/pkgs/applications/audio/samplv1/default.nix b/pkgs/applications/audio/samplv1/default.nix
index 8c73928c79a4..f1d3be317d17 100644
--- a/pkgs/applications/audio/samplv1/default.nix
+++ b/pkgs/applications/audio/samplv1/default.nix
@@ -2,11 +2,11 @@
stdenv.mkDerivation rec {
name = "samplv1-${version}";
- version = "0.3.6";
+ version = "0.4.1";
src = fetchurl {
url = "mirror://sourceforge/samplv1/${name}.tar.gz";
- sha256 = "1fgy9w3mp0p8i1v41a7gmpzzk268k7bp75d4sgzfprikjihc6ary";
+ sha256 = "1cx3qs9vrdwmym2qsghqq53bshnjqgpqypsilr1m2i1cpfnfrr6x";
};
buildInputs = [ jackaudio libsndfile lv2 qt4 ];
diff --git a/pkgs/applications/audio/sonic-visualiser/default.nix b/pkgs/applications/audio/sonic-visualiser/default.nix
index aeb90c09455b..7704397e6d0a 100644
--- a/pkgs/applications/audio/sonic-visualiser/default.nix
+++ b/pkgs/applications/audio/sonic-visualiser/default.nix
@@ -2,22 +2,25 @@
{ stdenv, fetchurl, alsaLib, bzip2, fftw, jackaudio, 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
@@ -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/synthv1/default.nix b/pkgs/applications/audio/synthv1/default.nix
index c93c4c852256..4037b88ecb7e 100644
--- a/pkgs/applications/audio/synthv1/default.nix
+++ b/pkgs/applications/audio/synthv1/default.nix
@@ -2,11 +2,11 @@
stdenv.mkDerivation rec {
name = "synthv1-${version}";
- version = "0.3.6";
+ version = "0.4.1";
src = fetchurl {
url = "mirror://sourceforge/synthv1/${name}.tar.gz";
- sha256 = "1xj4dk1g546f9fv2c4i7g3f1axrxfrxzk9w1nidhj3686j79nyry";
+ sha256 = "1j1x8n3rlwrh373wqmm6mj3cgyk3apvnpqygx1700fl4cf249agl";
};
buildInputs = [ qt4 jackaudio lv2 ];
diff --git a/pkgs/applications/audio/vmpk/default.nix b/pkgs/applications/audio/vmpk/default.nix
new file mode 100644
index 000000000000..7fffa77b5a39
--- /dev/null
+++ b/pkgs/applications/audio/vmpk/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, cmake, pkgconfig
+, qt4, jackaudio
+}:
+
+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 jackaudio ];
+}
diff --git a/pkgs/applications/audio/yoshimi/default.nix b/pkgs/applications/audio/yoshimi/default.nix
index 698c8dc0ddad..df0b98cdd9e4 100644
--- a/pkgs/applications/audio/yoshimi/default.nix
+++ b/pkgs/applications/audio/yoshimi/default.nix
@@ -6,11 +6,11 @@ assert stdenv ? glibc;
stdenv.mkDerivation rec {
name = "yoshimi-${version}";
- version = "1.1.0";
+ version = "1.2.0";
src = fetchurl {
url = "mirror://sourceforge/yoshimi/${name}.tar.bz2";
- sha256 = "0rb0q0bqsaaj3imdjgfaigj1kbjqkx1gm91nh2mdgy9i09rygsbv";
+ sha256 = "0p4v39kxxzzfvaazzxarx54i164ghpfxq0ljkavlgr8fnix5v3mx";
};
buildInputs = [
diff --git a/pkgs/applications/display-managers/lightdm-gtk-greeter/default.nix b/pkgs/applications/display-managers/lightdm-gtk-greeter/default.nix
index 0b8863752d2a..69f1eef9cecb 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 5ae5603b4dd6..ea9e0eaec936 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 598c42199bec..d4c6f24d69a3 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 a6e53bafcc79..d81e0aae56d5 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 0b5bcccfb21a..bf2c34b9318e 100644
--- a/pkgs/applications/display-managers/slim/default.nix
+++ b/pkgs/applications/display-managers/slim/default.nix
@@ -1,5 +1,5 @@
{ 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";
@@ -20,7 +20,7 @@ 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" ];
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
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";
diff --git a/pkgs/applications/display-managers/slim/runtime-paths.patch b/pkgs/applications/display-managers/slim/runtime-paths.patch
index f6811dbe6682..5a8e07bfbf07 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/ed/default.nix b/pkgs/applications/editors/ed/default.nix
index 3e22cfd0412d..88b539d29f5f 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:
diff --git a/pkgs/applications/editors/emacs-24/default.nix b/pkgs/applications/editors/emacs-24/default.nix
index c558b483e97b..6ecee37d21e1 100644
--- a/pkgs/applications/editors/emacs-24/default.nix
+++ b/pkgs/applications/editors/emacs-24/default.nix
@@ -2,7 +2,7 @@
, pkgconfig, gtk, libXft, dbus, libpng, libjpeg, libungif
, libtiff, librsvg, texinfo, gconf, libxml2, imagemagick, gnutls
, alsaLib, cairo
-, withX ? !stdenv.isDarwin
+, withX ? !stdenv.isDarwin, withGTK ? true
}:
assert (libXft != null) -> libpng != null; # probably a bug
@@ -27,11 +27,13 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional stdenv.isDarwin 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-modes/bbdb/default.nix b/pkgs/applications/editors/emacs-modes/bbdb/default.nix
index da92c38d0780..ed96e6892833 100644
--- a/pkgs/applications/editors/emacs-modes/bbdb/default.nix
+++ b/pkgs/applications/editors/emacs-modes/bbdb/default.nix
@@ -1,12 +1,12 @@
{stdenv, fetchurl, emacs, texinfo, ctags}:
-stdenv.mkDerivation {
- name = "bbdb-2.35";
+stdenv.mkDerivation rec {
+ name = "bbdb-2.36";
src = fetchurl {
# not using mirror:// because it produces a different file
- url = http://bbdb.sourceforge.net/bbdb-2.35.tar.gz;
- sha256 = "3fb1316e2ed74d47ca61187fada550e58797467bd9e8ad67343ed16da769f916";
+ url = "http://bbdb.sourceforge.net/${name}.tar.gz";
+ sha256 = "1rmw94l71ahfbynyy0bijfy488q9bl5ksl4zpvg7j9dbmgbh296r";
};
patches = [ ./install-infodir.patch ];
@@ -28,8 +28,8 @@ stdenv.mkDerivation {
'';
meta = {
+ homepage = "http://bbdb.sourceforge.net/";
description = "The Insidious Big Brother Database (BBDB), a contact management utility for Emacs";
- homepage = http://bbdb.sourceforge.net/;
license = "GPL";
};
}
diff --git a/pkgs/applications/editors/emacs-modes/cryptol/default.nix b/pkgs/applications/editors/emacs-modes/cryptol/default.nix
new file mode 100644
index 000000000000..3290041178ef
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/cryptol/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchgit, emacs }:
+
+stdenv.mkDerivation rec {
+ name = "cryptol-mode-${version}";
+ version = "20141010";
+
+ src = fetchgit {
+ url = "https://github.com/thoughtpolice/cryptol-mode.git";
+ rev = "50075d49d7c4ec4b03ce31b634424410262c1ad4";
+ sha256 = "6ecd4904b7f3b1cd0721591ce45f16fe11cd1dd5fd7af8110d1f84b133ed4aec";
+ };
+
+ buildInputs = [ emacs ];
+
+ installPhase = ''
+ install -d $out/share/emacs/site-lisp
+ install *.el *.elc $out/share/emacs/site-lisp
+ '';
+
+ meta = {
+ description = "Emacs major mode for Cryptol";
+ homepage = "https://thoughtpolice/cryptol-mode";
+ license = stdenv.lib.licenses.gpl3Plus;
+ platforms = stdenv.lib.platforms.all;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ };
+}
diff --git a/pkgs/applications/editors/emacs-modes/darcsum/darcs_context b/pkgs/applications/editors/emacs-modes/darcsum/darcs_context
new file mode 100644
index 000000000000..7e9de1ed80b5
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/darcsum/darcs_context
@@ -0,0 +1,7 @@
+
+Context:
+
+[TAG 1.3
+Simon Michael **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 000000000000..cf2bcc6e30b9
--- /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 = "GPLv2+";
+ maintainers = [ stdenv.lib.maintainers.falsifian ];
+ };
+}
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 6d10244a8795..b23c6da6123c 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, llvmFull }:
+{ clangStdenv, fetchgit, llvm, clang }:
clangStdenv.mkDerivation {
name = "emacs-clang-complete-async-20130218";
@@ -8,7 +8,7 @@ clangStdenv.mkDerivation {
sha256 = "1c8zqi6axbsb951azz9iqx3j52j30nd9ypv396hvids3g02cirrf";
};
- buildInputs = [ llvmFull ];
+ buildInputs = [ llvm clang.clang ];
installPhase = ''
mkdir -p $out/bin
diff --git a/pkgs/applications/editors/emacs-modes/emacs-w3m/default.nix b/pkgs/applications/editors/emacs-modes/emacs-w3m/default.nix
index e0373fca5df5..3ba848affc0d 100644
--- a/pkgs/applications/editors/emacs-modes/emacs-w3m/default.nix
+++ b/pkgs/applications/editors/emacs-modes/emacs-w3m/default.nix
@@ -56,6 +56,6 @@ stdenv.mkDerivation rec {
homepage = http://emacs-w3m.namazu.org/;
- maintainers = [ ];
+ maintainers = [ stdenv.lib.maintainers.mornfall ];
};
}
diff --git a/pkgs/applications/editors/emacs-modes/flymake-cursor/default.nix b/pkgs/applications/editors/emacs-modes/flymake-cursor/default.nix
index 4b2692a5e22a..eae338d241de 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/idris/default.nix b/pkgs/applications/editors/emacs-modes/idris/default.nix
index 7bd39cd2b4e0..8671a926f677 100644
--- a/pkgs/applications/editors/emacs-modes/idris/default.nix
+++ b/pkgs/applications/editors/emacs-modes/idris/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchgit, emacs }:
stdenv.mkDerivation rec {
- name = "idris-mode-20140106";
+ name = "idris-mode-20140405";
src = fetchgit {
url = https://github.com/idris-hackers/idris-mode.git;
- rev = "47df65dd5b554c1d7cf70a07c3bd06d80867f870";
- sha256 = "55df66d1bace134bea83f0547e01daf068fc96dc080cf88ea8945ddcb2d08ea4";
+ rev = "2e2d18fb757da4b42940ebe2a57d7a117175489f";
+ sha256 = "d4b52c6c43c038c94a7464cd9c849cd40c01696c440da8b057c00a9be22f9ac0";
};
buildInputs = [ emacs ];
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Emacs major mode for Idris";
- homepage = https://github.com/idris-hackers/idris-modehttps://github.com/idris-hackers/idris-mode;
+ homepage = https://github.com/idris-hackers/idris-mode;
license = "GPLv3";
platforms = stdenv.lib.platforms.all;
diff --git a/pkgs/applications/editors/emacs-modes/structured-haskell-mode/default.nix b/pkgs/applications/editors/emacs-modes/structured-haskell-mode/default.nix
new file mode 100644
index 000000000000..a832c7d5942c
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/structured-haskell-mode/default.nix
@@ -0,0 +1,22 @@
+{ cabal, emacs, haskellSrcExts }:
+
+cabal.mkDerivation (self: {
+ pname = "structured-haskell-mode";
+ version = "1.0.2";
+ sha256 = "1lwdhlr38y5hdr78nplplr3q0hrjhryw378f1857qh0lvp03gwl2";
+ isLibrary = false;
+ isExecutable = true;
+ buildDepends = [ haskellSrcExts ];
+ buildTools = [ emacs ];
+ postInstall = ''
+ emacs -L elisp --batch -f batch-byte-compile "elisp/"*.el
+ install -d $out/share/emacs/site-lisp
+ install "elisp/"*.el "elisp/"*.elc $out/share/emacs/site-lisp
+ '';
+ meta = {
+ homepage = "https://github.com/chrisdone/structured-haskell-mode";
+ description = "Structured editing Emacs mode for Haskell";
+ license = self.stdenv.lib.licenses.bsd3;
+ platforms = self.ghc.meta.platforms;
+ };
+})
diff --git a/pkgs/applications/editors/emacs-modes/writegood/default.nix b/pkgs/applications/editors/emacs-modes/writegood/default.nix
new file mode 100644
index 000000000000..353215a5d485
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/writegood/default.nix
@@ -0,0 +1,30 @@
+{stdenv, fetchurl, emacs}:
+
+let version = "1.3";
+
+in stdenv.mkDerivation {
+ name = "writegood-mode-${version}";
+ src = fetchurl {
+ url = "https://github.com/bnbeckwith/writegood-mode/archive/v${version}.tar.gz";
+ sha256 = "0p34rgawnqg94vk4lcw14x99rrvsd23dmbwkxz2vax5kq6l8y5yf";
+ };
+
+ 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 minor mode that aids in finding common writing problems";
+ homepage = https://github.com/bnbeckwith/writegood-mode;
+ platforms = stdenv.lib.platforms.all;
+ maintainers = [ stdenv.lib.maintainers.pSub ];
+ license = "GPL3";
+ };
+}
diff --git a/pkgs/applications/editors/idea/default.nix b/pkgs/applications/editors/idea/default.nix
index 74dbaf78dac8..c6301bd8a302 100644
--- a/pkgs/applications/editors/idea/default.nix
+++ b/pkgs/applications/editors/idea/default.nix
@@ -5,10 +5,10 @@
let
buildIdea =
- { name, src, description, license }:
+ { name, version, build, src, description, license }:
stdenv.mkDerivation rec {
- inherit name src license;
+ inherit name build src license;
ideaItem = makeDesktopItem {
name = "IDEA";
exec = "idea";
@@ -23,27 +23,30 @@ let
buildCommand = ''
tar xvzf $src
mkdir -p $out
- cp -a $name $out
+ cp -a idea-$build $out
interpreter=$(echo ${stdenv.glibc}/lib/ld-linux*.so.2)
- 7z x $out/$name/lib/snappy-java-1.0.5.jar
- rm $out/$name/lib/snappy-java-1.0.5.jar
+ 7z x $out/idea-$build/lib/snappy-java-1.0.5.jar
+ rm $out/idea-$build/lib/snappy-java-1.0.5.jar
if [ "${stdenv.system}" == "x86_64-linux" ];then
- patchelf --set-interpreter $interpreter $out/$name/bin/fsnotifier64
+ patchelf --set-interpreter $interpreter $out/idea-$build/bin/fsnotifier64
patchelf --set-rpath ${stdenv.gcc.gcc}/lib64/ org/xerial/snappy/native/Linux/amd64/libsnappyjava.so
else
- patchelf --set-interpreter $interpreter $out/$name/bin/fsnotifier
+ patchelf --set-interpreter $interpreter $out/idea-$build/bin/fsnotifier
patchelf --set-rpath ${stdenv.gcc.gcc}/lib/ org/xerial/snappy/native/Linux/i386/libsnappyjava.so
fi
- 7z a -tzip $out/$name/lib/snappy-java-1.0.5.jar .
+ 7z a -tzip $out/idea-$build/lib/snappy-java-1.0.5.jar .
mkdir -p $out/bin
- makeWrapper $out/$name/bin/idea.sh $out/bin/idea \
+
+ jdk=${jdk}/lib/openjdk
+
+ makeWrapper $out/idea-$build/bin/idea.sh $out/bin/idea \
--prefix PATH : ${jdk}/bin:${coreutils}/bin:${gnugrep}/bin:${which}/bin:${git}/bin \
--prefix LD_RUN_PATH : ${stdenv.gcc.gcc}/lib/ \
- --prefix JDK_HOME : ${jdk} \
- --prefix IDEA_JDK : ${jdk}
+ --prefix JDK_HOME : $jdk \
+ --prefix IDEA_JDK : $jdk
mkdir -p $out/share/applications
cp ${ideaItem}/share/applications/* $out/share/applications
@@ -61,43 +64,27 @@ let
in {
- idea_community_1301 = buildIdea {
- name = "idea-IC-133.331";
+ idea_community_1311 = buildIdea rec {
+ name = "idea-community-${version}";
+ version = "13.1.1";
+ build = "IC-135.480";
description = "IntelliJ IDEA 13 Community Edition";
license = stdenv.lib.licenses.asl20.shortName;
src = fetchurl {
- url = http://download-ln.jetbrains.com/idea/ideaIC-13.0.1.tar.gz;
- sha256 = "6f268bb1dbe61ed0274fd2ea9b4b7403f50da11bdde208bcfc8c391d235d7c02";
+ url = "http://download-ln.jetbrains.com/idea/ideaIC-${version}.tar.gz";
+ sha256 = "9e28d3e5682b037c9d6190622ab2a47112fa792539083cc7a4cb24f3f7bf7d22";
};
};
- idea_ultimate_1301 = buildIdea {
- name = "idea-IU-133.331";
+ idea_ultimate_1311 = buildIdea rec {
+ name = "idea-ultimate-${version}";
+ version = "13.1.1";
+ build = "IU-135.480";
description = "IntelliJ IDEA 13 Ultimate Edition";
license = stdenv.lib.licenses.unfree;
src = fetchurl {
- url = http://download-ln.jetbrains.com/idea/ideaIU-13.0.1.tar.gz;
- sha256 = "d3638d97b719773459d5027ba096b52695325b241cbf5e31e535165a5f19849d";
- };
- };
-
- idea_community_13 = buildIdea {
- name = "idea-IC-133.193";
- description = "IntelliJ IDEA 13 Community Edition";
- license = stdenv.lib.licenses.asl20.shortName;
- src = fetchurl {
- url = http://download-ln.jetbrains.com/idea/ideaIC-13.tar.gz;
- sha256 = "5cd88b8effc5e4e55d999df1cec6f54c53b5adf0b88e49400b3a185bef7db13a";
- };
- };
-
- idea_ultimate_13 = buildIdea {
- name = "idea-IU-133.193";
- description = "IntelliJ IDEA 13 Ultimate Edition";
- license = stdenv.lib.licenses.unfree;
- src = fetchurl {
- url = http://download-ln.jetbrains.com/idea/ideaIU-13.tar.gz;
- sha256 = "211a782654d04f2fe5fce9084043edfb8355a7bc4dc41fee7dc79cfe604d4654";
+ url = "http://download-ln.jetbrains.com/idea/ideaIU-${version}.tar.gz";
+ sha256 = "d699abcdcace387105a465049e015c1367dedf42f7a5f5a1f7b3d840e98b2658";
};
};
diff --git a/pkgs/applications/editors/kdevelop/default.nix b/pkgs/applications/editors/kdevelop/default.nix
index 14f9c1eb0d49..b815b0523471 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/netbeans/default.nix b/pkgs/applications/editors/netbeans/default.nix
index f1fd9adbe86a..5a2afebdd5cf 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 000000000000..234ee1f065e4
--- /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 cfa44d9285cc..c7867ce22af2 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 \
diff --git a/pkgs/applications/editors/sublime3/default.nix b/pkgs/applications/editors/sublime3/default.nix
new file mode 100644
index 000000000000..3d9dec0d8f8a
--- /dev/null
+++ b/pkgs/applications/editors/sublime3/default.nix
@@ -0,0 +1,40 @@
+{ fetchurl, stdenv, glib, xlibs, cairo, gtk, pango}:
+let
+ libPath = stdenv.lib.makeLibraryPath [glib xlibs.libX11 gtk cairo pango];
+in
+assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
+
+stdenv.mkDerivation rec {
+ name = "sublimetext3-3.0.59";
+ 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_3059_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_3059_x64.tar.bz2;
+ sha256 = "da3039687664d33a734cea0151b2291ece9c7f35e5b73df5b2b5eac28a20b972";
+ };
+ buildCommand = ''
+ tar xvf ${src}
+ mkdir -p $out/bin
+ mv sublime_text_3 $out/sublime
+ ln -s $out/sublime/sublime_text $out/bin/sublime
+ ln -s $out/sublime/sublime_text $out/bin/sublime3
+
+ echo ${libPath}
+ patchelf \
+ --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ --set-rpath ${libPath}:${stdenv.gcc.gcc}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \
+ $out/sublime/sublime_text
+ '';
+
+ meta = {
+ description = "Sophisticated text editor for code, markup and prose";
+ license = "unfree";
+ };
+}
diff --git a/pkgs/applications/editors/vim/default.nix b/pkgs/applications/editors/vim/default.nix
index 7dd4a0519ce4..673174904129 100644
--- a/pkgs/applications/editors/vim/default.nix
+++ b/pkgs/applications/editors/vim/default.nix
@@ -1,8 +1,10 @@
{ stdenv, fetchhg, ncurses, gettext, pkgconfig }:
stdenv.mkDerivation rec {
- name = "vim-7.4.131";
-
+ name = "vim-${version}";
+
+ version = "7.4.131";
+
src = fetchhg {
url = "https://vim.googlecode.com/hg/";
tag = "v7-4-131";
@@ -10,7 +12,7 @@ stdenv.mkDerivation rec {
};
enableParallelBuilding = true;
-
+
buildInputs = [ ncurses pkgconfig ];
nativeBuildInputs = [ gettext ];
diff --git a/pkgs/applications/editors/vim/ft-nix-support.patch b/pkgs/applications/editors/vim/ft-nix-support.patch
index 0e73162d33ef..ed508784813c 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
@@ -46,8 +46,8 @@ index 0000000..a2f9918
+ \ __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 "#.*$"
@@ -66,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/wrapper.nix b/pkgs/applications/editors/vim/wrapper.nix
new file mode 100644
index 000000000000..72e868050537
--- /dev/null
+++ b/pkgs/applications/editors/vim/wrapper.nix
@@ -0,0 +1,32 @@
+{ stdenv, makeWrapper, writeText, vim, vimrc }:
+
+let
+
+ vimrcfile = writeText "vimrc" vimrc;
+
+ p = builtins.parseDrvName vim.name;
+
+in stdenv.mkDerivation rec {
+ name = "${p.name}-with-vimrc-${p.version}";
+
+ buildInputs = [ makeWrapper vim vimrcfile ];
+
+ phases = [ "installPhase" ];
+
+ installPhase = ''
+ mkdir -p $out
+ cp -r ${vim}/* $out/
+
+ chmod u+w $out/bin
+ chmod u+w $out/share/vim
+
+ ln -s ${vimrcfile} $out/share/vim/vimrc
+ wrapProgram $out/bin/vim --set VIM "$out/share/vim"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "The most popular clone of the VI editor";
+ homepage = http://www.vim.org;
+ platforms = platforms.unix;
+ };
+}
diff --git a/pkgs/applications/editors/yi/yi-contrib.nix b/pkgs/applications/editors/yi/yi-contrib.nix
index e2fadcca345d..c7d3f0940164 100644
--- a/pkgs/applications/editors/yi/yi-contrib.nix
+++ b/pkgs/applications/editors/yi/yi-contrib.nix
@@ -1,10 +1,12 @@
-{ cabal, dataAccessor, filepath, mtl, split, yi }:
+{ cabal, filepath, lens, mtl, split, time, transformersBase, yi }:
cabal.mkDerivation (self: {
pname = "yi-contrib";
- version = "0.7.0";
- sha256 = "12x9ps5yrszr8dlj15kmsm9myq3gzd9x9nacvl3x6cq91wk53mzj";
- buildDepends = [ dataAccessor filepath mtl split yi ];
+ version = "0.8.1";
+ sha256 = "0jsbga30x302mr708vj5y7cpc961vh85dshpq2zlrf44dh0kmpvf";
+ buildDepends = [
+ filepath lens mtl split time transformersBase yi
+ ];
meta = {
homepage = "http://haskell.org/haskellwiki/Yi";
description = "Add-ons to Yi, the Haskell-Scriptable Editor";
diff --git a/pkgs/applications/editors/yi/yi.nix b/pkgs/applications/editors/yi/yi.nix
index 4dfc60bef769..96e4a06965c1 100644
--- a/pkgs/applications/editors/yi/yi.nix
+++ b/pkgs/applications/editors/yi/yi.nix
@@ -1,32 +1,30 @@
{ cabal, alex, binary, Cabal, cautiousFile, concreteTyperep
-, dataAccessor, dataAccessorMtl, dataAccessorTemplate, derive, Diff
-, dlist, dyre, filepath, fingertree, ghcPaths, glib, gtk, hashable
-, hint, HUnit, mtl, pango, parsec, pointedlist, pureMD5, QuickCheck
-, random, regexBase, regexTdfa, split, testFramework
-, testFrameworkHunit, time, uniplate, unixCompat
-, unorderedContainers, utf8String, vty, xdgBasedir
+, 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
}:
cabal.mkDerivation (self: {
pname = "yi";
- version = "0.7.0";
- sha256 = "0mzcjgp12k5mxb37r6chxsk726b1qxds49ch656bpgrg7n22w2j1";
+ version = "0.8.1";
+ sha256 = "1hyqlydc0na9pkb3fkbp13c6vnp4f80z8237bvrv12wkk5syyn23";
isLibrary = true;
isExecutable = true;
buildDepends = [
- binary Cabal cautiousFile concreteTyperep dataAccessor
- dataAccessorMtl dataAccessorTemplate derive Diff dlist dyre
- filepath fingertree ghcPaths glib gtk hashable hint mtl pango
- parsec pointedlist pureMD5 QuickCheck random regexBase regexTdfa
- split time uniplate unixCompat unorderedContainers utf8String vty
- xdgBasedir
+ binary Cabal cautiousFile concreteTyperep dataDefault derive Diff
+ dlist dyre filepath fingertree glib gtk hashable hint lens mtl
+ pango parsec pointedlist QuickCheck random regexBase regexTdfa safe
+ split time transformersBase uniplate unixCompat unorderedContainers
+ utf8String vty xdgBasedir
];
testDepends = [
- filepath HUnit QuickCheck testFramework testFrameworkHunit
+ filepath HUnit QuickCheck tasty tastyHunit tastyQuickcheck
];
buildTools = [ alex ];
configureFlags = "-fpango";
- jailbreak = true;
doCheck = false;
meta = {
homepage = "http://haskell.org/haskellwiki/Yi";
diff --git a/pkgs/applications/graphics/ImageMagick/default.nix b/pkgs/applications/graphics/ImageMagick/default.nix
index 66a7f334dbdd..64b1f5b3b2c1 100644
--- a/pkgs/applications/graphics/ImageMagick/default.nix
+++ b/pkgs/applications/graphics/ImageMagick/default.nix
@@ -18,14 +18,14 @@
}:
let
- version = "6.8.7-6";
+ version = "6.8.9-0";
in
stdenv.mkDerivation rec {
name = "ImageMagick-${version}";
src = fetchurl {
url = "mirror://imagemagick/${name}.tar.xz";
- sha256 = "0cbfhk184kxdxz5czyyqxac29mbfiahygjji6k97z6hp8ngnqlvh";
+ sha256 = "1lapn2798fkc2wn81slpms5p21kq4dsyg45khsk7n8p69cvrmw2b";
};
enableParallelBuilding = true;
diff --git a/pkgs/applications/graphics/darktable/default.nix b/pkgs/applications/graphics/darktable/default.nix
index 766696265812..d4983ca04d83 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.1";
name = "darktable-${version}";
src = fetchurl {
url = "mirror://sourceforge/darktable/darktable/1.2/darktable-${version}.tar.xz";
- sha256 = "05kkkz13a5rhb246rq1nxv7h91pcvm15filvik8n8gn143h64sv8";
+ sha256 = "1pkixhiyyjx5wx4dlkvabga9glcx374f1ic2kxmzzdprfm6kkqfd";
};
buildInputs =
diff --git a/pkgs/applications/graphics/feh/default.nix b/pkgs/applications/graphics/feh/default.nix
index 0cd340279665..4f52e6dec0fd 100644
--- a/pkgs/applications/graphics/feh/default.nix
+++ b/pkgs/applications/graphics/feh/default.nix
@@ -1,20 +1,24 @@
-{ stdenv, fetchurl, x11, imlib2, libjpeg, libpng, giblib
+{ stdenv, makeWrapper, fetchurl, x11, imlib2, libjpeg, libpng, giblib
, libXinerama, curl }:
stdenv.mkDerivation rec {
- name = "feh-2.8";
+ name = "feh-2.10";
src = fetchurl {
url = "http://feh.finalrewind.org/${name}.tar.bz2";
- sha256 = "0zmslchnzvi9ydxj2mgci4x8zpv5mdfkf7kyny3nibbpajibqmrx";
+ sha256 = "10ya8j0mxlni08qli3gdkyjhy54g4d2q2kc0hhragmzd9s42ly5w";
};
- buildInputs = [x11 imlib2 giblib libjpeg libpng libXinerama curl ];
+ buildInputs = [makeWrapper x11 imlib2 giblib libjpeg libpng libXinerama curl ];
preBuild = ''
makeFlags="PREFIX=$out"
'';
+ postInstall = ''
+ wrapProgram "$out/bin/feh" --prefix PATH : "${libjpeg}/bin"
+ '';
+
meta = {
description = "A light-weight image viewer";
homepage = https://derf.homelinux.org/projects/feh/;
diff --git a/pkgs/applications/graphics/freecad/cmake.patch b/pkgs/applications/graphics/freecad/cmake.patch
new file mode 100644
index 000000000000..62efaf1e29dc
--- /dev/null
+++ b/pkgs/applications/graphics/freecad/cmake.patch
@@ -0,0 +1,32 @@
+diff -urN freecad-0.13.1830.old/cMake/FreeCadMacros.cmake freecad-0.13.1830/cMake/FreeCadMacros.cmake
+--- freecad-0.13.1830.old/cMake/FreeCadMacros.cmake 2013-02-02 18:09:17.000000000 +0100
++++ freecad-0.13.1830/cMake/FreeCadMacros.cmake 2014-04-20 10:52:17.293599913 +0200
+@@ -201,7 +201,7 @@
+ #endmacro(fc_add_resources)
+
+ MACRO (fc_add_resources outfiles )
+- QT4_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN})
++ QT4_EXTRACT_OPTIONS(rcc_files rcc_options rcc_target ${ARGN})
+
+ FOREACH (it ${rcc_files})
+ GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE)
+diff -urN freecad-0.13.1830.old/CMakeLists.txt freecad-0.13.1830/CMakeLists.txt
+--- freecad-0.13.1830.old/CMakeLists.txt 2013-02-02 18:09:17.000000000 +0100
++++ freecad-0.13.1830/CMakeLists.txt 2014-04-20 10:28:41.782536753 +0200
+@@ -314,14 +314,14 @@
+ macro(fc_wrap_cpp outfiles )
+ # get include dirs
+ QT4_GET_MOC_FLAGS(moc_flags)
+- QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN})
++ QT4_EXTRACT_OPTIONS(moc_files moc_options moc_target ${ARGN})
+ # fixes bug 0000585: bug with boost 1.48
+ SET(moc_options ${moc_options} -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
+
+ foreach(it ${moc_files})
+ get_filename_component(it ${it} ABSOLUTE)
+ QT4_MAKE_OUTPUT_FILE(${it} moc_ cpp outfile)
+- QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}")
++ QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}" "")
+ set(${outfiles} ${${outfiles}} ${outfile})
+ add_file_dependencies(${it} ${outfile})
+ endforeach(it)
diff --git a/pkgs/applications/graphics/freecad/default.nix b/pkgs/applications/graphics/freecad/default.nix
index 37265c954e83..770a7ee8212b 100644
--- a/pkgs/applications/graphics/freecad/default.nix
+++ b/pkgs/applications/graphics/freecad/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
--set COIN_GL_NO_CURRENT_CONTEXT_CHECK 1
'';
- patches = [ ./pythonpath.patch ];
+ patches = [ ./pythonpath.patch ./cmake.patch ];
meta = {
homepage = http://free-cad.sourceforge.net/;
diff --git a/pkgs/applications/graphics/gimp/2.8.nix b/pkgs/applications/graphics/gimp/2.8.nix
index af7d9e3399b0..0f8d6d45f128 100644
--- a/pkgs/applications/graphics/gimp/2.8.nix
+++ b/pkgs/applications/graphics/gimp/2.8.nix
@@ -1,7 +1,7 @@
{ 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.10";
@@ -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 33d52c6645be..000000000000
--- 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/hoodle/default.nix b/pkgs/applications/graphics/hoodle/default.nix
new file mode 100644
index 000000000000..e553875f756c
--- /dev/null
+++ b/pkgs/applications/graphics/hoodle/default.nix
@@ -0,0 +1,20 @@
+{ cabal, cmdargs, configurator, dyre, filepath, hoodleCore, mtl }:
+
+cabal.mkDerivation (self: {
+ pname = "hoodle";
+ version = "0.2.2.1";
+ sha256 = "1qkyyzfmprhniwarnq6cdmv1r6605b3h2lsc1rlalxhq6jh5gamd";
+ isLibrary = true;
+ isExecutable = true;
+ buildDepends = [
+ cmdargs configurator dyre filepath hoodleCore mtl
+ ];
+ jailbreak = true;
+ meta = {
+ homepage = "http://ianwookim.org/hoodle";
+ description = "Executable for hoodle";
+ license = self.stdenv.lib.licenses.gpl3;
+ platforms = self.ghc.meta.platforms;
+ maintainers = [ self.stdenv.lib.maintainers.ianwookim ];
+ };
+})
diff --git a/pkgs/applications/graphics/inkscape/default.nix b/pkgs/applications/graphics/inkscape/default.nix
index 37905f8a73f6..478a0ff7e50c 100644
--- a/pkgs/applications/graphics/inkscape/default.nix
+++ b/pkgs/applications/graphics/inkscape/default.nix
@@ -13,6 +13,10 @@ stdenv.mkDerivation rec {
patches = [ ./configure-python-libs.patch ];
+ postPatch = ''
+ patch -p0 < ${./spuriouscomma.patch}
+ '';
+
propagatedBuildInputs = [
# Python is used at run-time to execute scripts, e.g., those from
# the "Effects" menu.
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 4c8a7ee5f9b6..000000000000
--- 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/inkscape/spuriouscomma.patch b/pkgs/applications/graphics/inkscape/spuriouscomma.patch
new file mode 100644
index 000000000000..bc538068f9e3
--- /dev/null
+++ b/pkgs/applications/graphics/inkscape/spuriouscomma.patch
@@ -0,0 +1,11 @@
+--- src/widgets/desktop-widget.h~ 2011-07-08 13:25:09.000000000 -0500
++++ src/widgets/desktop-widget.h 2013-02-15 16:04:45.806910365 -0600
+@@ -239,7 +239,7 @@
+ private:
+ GtkWidget *tool_toolbox;
+ GtkWidget *aux_toolbox;
+- GtkWidget *commands_toolbox,;
++ GtkWidget *commands_toolbox;
+ GtkWidget *snap_toolbox;
+
+ static void init(SPDesktopWidget *widget);
diff --git a/pkgs/applications/graphics/k3d/default.nix b/pkgs/applications/graphics/k3d/default.nix
index 8920d243dbf0..9f31d94ac7fb 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/mirage/default.nix b/pkgs/applications/graphics/mirage/default.nix
index cd5388c1b88f..67b91fd68570 100644
--- a/pkgs/applications/graphics/mirage/default.nix
+++ b/pkgs/applications/graphics/mirage/default.nix
@@ -9,10 +9,6 @@ buildPythonPackage rec {
sha256 = "d214a1b6d99d1d1e83da5848a2cef181f6781e0990e93f7ebff5880b0c43f43c";
};
- postInstall = ''
- mv $out/lib/${python.libPrefix}/site-packages/*.egg/share $out
- '';
-
doCheck = false;
buildInputs = [ stdenv libX11 gettext ];
diff --git a/pkgs/applications/graphics/openimageio/default.nix b/pkgs/applications/graphics/openimageio/default.nix
index 8748c808dc07..f63f41a8ed10 100644
--- a/pkgs/applications/graphics/openimageio/default.nix
+++ b/pkgs/applications/graphics/openimageio/default.nix
@@ -4,11 +4,11 @@
stdenv.mkDerivation rec {
name = "oiio-${version}";
- version = "1.1.12";
+ version = "1.3.12";
src = fetchurl {
url = "https://github.com/OpenImageIO/oiio/archive/Release-${version}.zip";
- sha256 = "0v84xna2vp83njxbizlxnindcp2i67xd89kgl9nic1hz6ywlylz6";
+ sha256 = "114jx4pcqhzdchzpxbwrfzqmnxr2bm8cw13g4akz1hg8pvr1dhsb";
};
buildInputs = [
diff --git a/pkgs/applications/graphics/openscad/default.nix b/pkgs/applications/graphics/openscad/default.nix
index a1238fe3dcd9..d831df5d7b66 100644
--- a/pkgs/applications/graphics/openscad/default.nix
+++ b/pkgs/applications/graphics/openscad/default.nix
@@ -1,17 +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/photivo/default.nix b/pkgs/applications/graphics/photivo/default.nix
index 257ee681db61..61e3f666dca7 100644
--- a/pkgs/applications/graphics/photivo/default.nix
+++ b/pkgs/applications/graphics/photivo/default.nix
@@ -2,15 +2,25 @@
lcms2, lensfun, pkgconfig, libjpeg, exiv2, liblqr1 }:
stdenv.mkDerivation rec {
- name = "photivo-2013-05-20";
+ name = "photivo-2014-01-25";
src = fetchhg {
url = "http://code.google.com/p/photivo/";
- tag = "6256ff175312";
- sha256 = "0pyvkijr7wwik21hdp1zwbbyqnhc07kf0m48ih1rws78fq3h86cc";
+ tag = "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/sane/backends.nix b/pkgs/applications/graphics/sane/backends.nix
index 3b5077a14e2a..3d95dcd81ee8 100644
--- a/pkgs/applications/graphics/sane/backends.nix
+++ b/pkgs/applications/graphics/sane/backends.nix
@@ -12,7 +12,10 @@ stdenv.mkDerivation rec {
name = "sane-backends-${version}";
src = fetchurl {
- url = "https://alioth.debian.org/frs/download.php/file/3958/${name}.tar.gz";
+ 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";
};
diff --git a/pkgs/applications/graphics/shotwell/default.nix b/pkgs/applications/graphics/shotwell/default.nix
new file mode 100644
index 000000000000..1953f951d169
--- /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/synfigstudio/default.nix b/pkgs/applications/graphics/synfigstudio/default.nix
new file mode 100644
index 000000000000..034a147b7874
--- /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 000000000000..51eb77042161
--- /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/viewnior/default.nix b/pkgs/applications/graphics/viewnior/default.nix
index 99e1ec1c169b..aa09fb705f1c 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 =
diff --git a/pkgs/applications/ike/default.nix b/pkgs/applications/ike/default.nix
index 7bba42152e8c..1414310ebf33 100644
--- a/pkgs/applications/ike/default.nix
+++ b/pkgs/applications/ike/default.nix
@@ -31,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
'';
@@ -40,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/misc/audio/sox/default.nix b/pkgs/applications/misc/audio/sox/default.nix
index 50aa92f8d293..570699fb619e 100644
--- a/pkgs/applications/misc/audio/sox/default.nix
+++ b/pkgs/applications/misc/audio/sox/default.nix
@@ -1,48 +1,31 @@
-{ composableDerivation, lib, fetchurl, alsaLib, libao, lame, libmad }:
-
-let inherit (composableDerivation) edf; in
-
-composableDerivation.composableDerivation {} {
- name = "sox-14.3.0";
+{ 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 (stdenv.lib) optional optionals;
+in 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 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];
+ maintainers = [stdenv.lib.maintainers.marcweber stdenv.lib.maintainers.shlevy];
# you can choose one of the following licenses:
license = [
"GPL"
diff --git a/pkgs/applications/misc/bitcoin/default.nix b/pkgs/applications/misc/bitcoin/default.nix
index 9e20be0dcbcd..118b56c55b07 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.6";
+ version = "0.9.1";
name = "bitcoin-${version}";
src = fetchurl {
- url = "mirror://sourceforge/bitcoin/${name}-linux.tar.gz";
- sha256 = "036xx06gyrfh65rpdapff3viz1f38vzkj7lnhil6fc0s7pjmsjbk";
+ url = "https://bitcoin.org/bin/${version}/${name}-linux.tar.gz";
+ sha256 = "3fabc1c629007b465a278525883663d41a2ba62699f2773536a8bf59ca210425";
};
- 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= ''
diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix
index 0951340ee945..2e9cf46bf864 100644
--- a/pkgs/applications/misc/blender/default.nix
+++ b/pkgs/applications/misc/blender/default.nix
@@ -5,11 +5,11 @@
}:
stdenv.mkDerivation rec {
- name = "blender-2.67";
+ name = "blender-2.70";
src = fetchurl {
url = "http://download.blender.org/source/${name}.tar.gz";
- sha256 = "066lwrm85455gs187bxr3jhqidc2f6f0791b4216jkagbszd9a8l";
+ sha256 = "0j73yfpavcrzg5v54kcha7sig6179g5ykrlhih8d288pnb5c7596";
};
buildInputs = [
@@ -35,11 +35,14 @@ stdenv.mkDerivation rec {
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 1e16e22c0fe6..c2d8e7979e45 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.17.0";
+ name = "calibre-1.31.0";
src = fetchurl {
url = "mirror://sourceforge/calibre/${name}.tar.xz";
- sha256 = "1g0kwfr0v4hgwik7hpajdvg1ganyi7hlq6wvq4r5218yvdq5mkzn";
+ sha256 = "1fl42y8ppw8s51v66dqsrg1ib28yi6z5779r9wfvdbl9v1clilfc";
};
inherit python;
diff --git a/pkgs/applications/misc/cgminer/default.nix b/pkgs/applications/misc/cgminer/default.nix
index 54650d395c2b..3247cb609fa6 100644
--- a/pkgs/applications/misc/cgminer/default.nix
+++ b/pkgs/applications/misc/cgminer/default.nix
@@ -1,5 +1,5 @@
-{ fetchgit, stdenv, pkgconfig, libtool, autoconf, automake,
- curl, ncurses, amdappsdk, amdadlsdk, xorg, jansson }:
+{ fetchgit, stdenv, pkgconfig, libtool, autoconf, automake
+, curl, ncurses, amdappsdk, amdadlsdk, xorg, jansson }:
stdenv.mkDerivation rec {
version = "3.7.2";
@@ -42,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 000000000000..937025c08403
--- /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 000000000000..256d337f679e
--- /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/electrum/default.nix b/pkgs/applications/misc/electrum/default.nix
new file mode 100644
index 000000000000..c35a2c7ff821
--- /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/freicoin/default.nix b/pkgs/applications/misc/freicoin/default.nix
index d5ed057f56b8..33d8585bb2dd 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";
diff --git a/pkgs/applications/misc/girara/default.nix b/pkgs/applications/misc/girara/default.nix
index 7af8cbeccc63..4db4e4b10916 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.9";
+ name = "girara-0.2.0";
src = fetchurl {
url = "http://pwmt.org/projects/girara/download/${name}.tar.gz";
- sha256 = "1kd20dalnpy07hajv0rkmkbsym4bpfxh0gby7j2mvkvl5qr3vx70";
+ sha256 = "0k8p5sgazqw7r78ssqh8bm2hn98xjml5w76l9awa66yq0k5m8jyi";
};
buildInputs = [ pkgconfig gtk gettext ];
diff --git a/pkgs/applications/misc/gnome_terminator/default.nix b/pkgs/applications/misc/gnome_terminator/default.nix
deleted file mode 100644
index b394719611de..000000000000
--- 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 000000000000..2e9d74c2441d
--- /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
index 08d2b29a92a8..1a0dea586d0e 100644
--- a/pkgs/applications/misc/gnuradio/default.nix
+++ b/pkgs/applications/misc/gnuradio/default.nix
@@ -23,11 +23,11 @@
stdenv.mkDerivation rec {
name = "gnuradio-${version}";
- version = "3.7.1";
+ version = "3.7.3";
src = fetchurl {
url = "http://gnuradio.org/releases/gnuradio/${name}.tar.gz";
- sha256 = "1kfni8vpgr6v9rdiz3zsmwc07qj6zka9x22z2y0y4rak2xnzdxz9";
+ sha256 = "0caj7dqppav53nhn0ima106hpsn0sakw57v1ihac9fk7ka0x2w8w";
};
buildInputs = [
@@ -51,9 +51,9 @@ stdenv.mkDerivation rec {
postInstall = ''
printf "backend : Qt4Agg\n" > "$out/share/gnuradio/matplotlibrc"
- for file in "$out"/bin/*; do
+ for file in "$out"/bin/* "$out"/share/gnuradio/examples/*/*.py; do
wrapProgram "$file" \
- --set PYTHONPATH $PYTHONPATH:$(toPythonPath "$out") \
+ --prefix PYTHONPATH : $PYTHONPATH:$(toPythonPath "$out") \
--set MATPLOTLIBRC "$out/share/gnuradio"
done
'';
diff --git a/pkgs/applications/misc/goldendict/default.nix b/pkgs/applications/misc/goldendict/default.nix
index f7b8a511bc66..717d0a012a2c 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 000000000000..311dad4f6487
--- /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/gphoto2/default.nix b/pkgs/applications/misc/gphoto2/default.nix
index cba54bf8013c..7ff253fd4e8d 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/gqrx/default.nix b/pkgs/applications/misc/gqrx/default.nix
new file mode 100644
index 000000000000..a52081077509
--- /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/ikiwiki/default.nix b/pkgs/applications/misc/ikiwiki/default.nix
index 6e5eece5d34d..b347f971ee0f 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.20140102";
+ 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 = "0nsyfq7j03cg4qq73kw7cxnc7wgbr2m75fqmmll77wyl9cb661lj";
+ sha256 = "1bbpqs4c1la1yqcxcxj3xip3wadjnjq0wawv19j6d6baymm66cr3";
};
buildInputs = [ perl TextMarkdown URI HTMLParser HTMLScrubber HTMLTemplate
diff --git a/pkgs/applications/misc/jigdo/default.nix b/pkgs/applications/misc/jigdo/default.nix
index 24edc0e128a7..fe4c0287fdd2 100644
--- a/pkgs/applications/misc/jigdo/default.nix
+++ b/pkgs/applications/misc/jigdo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, db4, gtk, bzip2 }:
+{ stdenv, fetchurl, db, gtk, bzip2 }:
stdenv.mkDerivation {
name = "jigdo-0.7.3";
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
sha256 = "0jnlzm9m2hjlnw0zs2fv456ml5r2jj2q1lncqbrgg52lq18f6fa3";
};
- buildInputs = [ db4 gtk bzip2 ];
+ buildInputs = [ db gtk bzip2 ];
configureFlags = "--without-libdb";
diff --git a/pkgs/applications/misc/kde-wacomtablet/default.nix b/pkgs/applications/misc/kde-wacomtablet/default.nix
index 22587a1bae04..3e652c717ec4 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";
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.tar.bz2";
+ sha256 = "1vqdmkfl0awsjxl6p8bihz198hlc75d3zn7xwwryc674l76s25ax";
};
- buildInputs = [ kdelibs ];
+ buildInputs = [ kdelibs xf86_input_wacom ];
nativeBuildInputs = [ gettext ];
diff --git a/pkgs/applications/misc/keepassx/2.0.nix b/pkgs/applications/misc/keepassx/2.0.nix
new file mode 100644
index 000000000000..1a79af7cb577
--- /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 375a1ae2419a..fc089f4fa5b7 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 000000000000..0a0b26f6e8c9
--- /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/krusader/default.nix b/pkgs/applications/misc/krusader/default.nix
index bd86501c30e2..83c21da0e542 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 2394d116314e..2f140db93973 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 = ''
@@ -25,12 +25,14 @@ stdenv.mkDerivation {
'';
buildInputs = [ qt4 muparser which boost ];
+ nativeBuildInputs = [ pkgconfig ];
enableParallelBuilding = true;
meta = {
description = "A 2D CAD package based upon Qt";
homepage = http://librecad.org;
+ repositories.git = git://github.com/LibreCAD/LibreCAD.git;
license = "GPLv2";
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 59bd4888e4a6..b225519f4868 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 = ''
diff --git a/pkgs/applications/misc/lxappearance/default.nix b/pkgs/applications/misc/lxappearance/default.nix
new file mode 100644
index 000000000000..9295eaabf322
--- /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 fd2e7c3ac426..1ea4f06c9273 100644
--- a/pkgs/applications/misc/lyx/default.nix
+++ b/pkgs/applications/misc/lyx/default.nix
@@ -3,12 +3,12 @@
}:
stdenv.mkDerivation rec {
- version = "2.0.6";
+ version = "2.0.7";
name = "lyx-${version}";
src = fetchurl {
url = "ftp://ftp.lyx.org/pub/lyx/stable/2.0.x/${name}.tar.xz";
- sha256 = "1llah9d9ymvdk8asmqslcwnicycxrwb27k8si184n5bfxvnjpjx5";
+ sha256 = "0qp8xqmlafib4hispjgl1friln0w3s05mi20sjfzaxnl6jkvv5q5";
};
configureFlags = [
diff --git a/pkgs/applications/misc/merkaartor/default.nix b/pkgs/applications/misc/merkaartor/default.nix
index 6d10cbb8c21f..e6636415b5ef 100644
--- a/pkgs/applications/misc/merkaartor/default.nix
+++ b/pkgs/applications/misc/merkaartor/default.nix
@@ -1,17 +1,17 @@
-{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";
diff --git a/pkgs/applications/misc/mupdf/default.nix b/pkgs/applications/misc/mupdf/default.nix
index 17b86910de07..ef7571f5d14f 100644
--- a/pkgs/applications/misc/mupdf/default.nix
+++ b/pkgs/applications/misc/mupdf/default.nix
@@ -8,6 +8,13 @@ stdenv.mkDerivation rec {
sha256 = "0y247nka5gkr1ajn47jrlp5rcnf6h4ff7dfsprma3h4wxqdv7a5b";
};
+ patches = [(fetchurl {
+ name = "CVE-2014-2013.patch";
+ url = "http://git.ghostscript.com/?p=mupdf.git;a=commitdiff_plain;"
+ + "h=60dabde18d7fe12b19da8b509bdfee9cc886aafc";
+ sha256 = "1walj3wir9x50i6lph33bx14c8593r9xrn08gkd3v7r6d15lmjps";
+ })];
+
buildInputs = [ pkgconfig zlib freetype libjpeg jbig2dec openjpeg libX11 libXext ];
enableParallelBuilding = true;
@@ -32,6 +39,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://mupdf.com/;
+ repositories.git = git://git.ghostscript.com/mupdf.git;
description = "Lightweight PDF viewer and toolkit written in portable C";
license = "GPLv3+";
maintainers = with stdenv.lib.maintainers; [ viric ];
diff --git a/pkgs/applications/misc/nc-indicators/default.nix b/pkgs/applications/misc/nc-indicators/default.nix
new file mode 100644
index 000000000000..a33cfbdf159a
--- /dev/null
+++ b/pkgs/applications/misc/nc-indicators/default.nix
@@ -0,0 +1,16 @@
+{ cabal, attoparsec, gtk, hflags, lens, pipes, stm }:
+
+cabal.mkDerivation (self: {
+ pname = "nc-indicators";
+ version = "0.1";
+ sha256 = "19amwfcbwfxcj0gr7w0vgxl427l43q3l2s3n3zsxhqwkfblxmfy5";
+ isLibrary = false;
+ isExecutable = true;
+ buildDepends = [ attoparsec gtk hflags lens pipes stm ];
+ meta = {
+ homepage = "https://github.com/nilcons/nc-indicators/issues";
+ description = "CPU load and memory usage indicators for i3bar";
+ license = self.stdenv.lib.licenses.asl20;
+ platforms = self.ghc.meta.platforms;
+ };
+})
diff --git a/pkgs/applications/misc/nut/default.nix b/pkgs/applications/misc/nut/default.nix
index 92cd0de8b312..3e972f672cc2 100644
--- a/pkgs/applications/misc/nut/default.nix
+++ b/pkgs/applications/misc/nut/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
"--without-powerman" # Until we have it ...
"--without-cgi"
"--without-hal"
- "--with-systemdsystemunitdir=$(out)/etc/systemd/systemd"
+ "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
"--with-udev-dir=$(out)/etc/udev"
];
diff --git a/pkgs/applications/misc/pcmanfm/default.nix b/pkgs/applications/misc/pcmanfm/default.nix
new file mode 100644
index 000000000000..f71800979619
--- /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/printrun/default.nix b/pkgs/applications/misc/printrun/default.nix
new file mode 100644
index 000000000000..dc258d653280
--- /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 0d61d3d74cfb..d4ffe2a4afd7 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/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix
index ae983aedc679..88d6e7a7cf94 100644
--- a/pkgs/applications/misc/redshift/default.nix
+++ b/pkgs/applications/misc/redshift/default.nix
@@ -40,5 +40,6 @@ stdenv.mkDerivation rec {
license = "GPLv3+";
homepage = "http://jonls.dk/redshift";
platforms = platforms.linux;
+ maintainers = maintainers.mornfall;
};
}
diff --git a/pkgs/applications/misc/rtl-sdr/default.nix b/pkgs/applications/misc/rtl-sdr/default.nix
new file mode 100644
index 000000000000..e6e762493883
--- /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 640ace40277d..2e3ef9f0d10e 100644
--- a/pkgs/applications/misc/rxvt_unicode/default.nix
+++ b/pkgs/applications/misc/rxvt_unicode/default.nix
@@ -24,6 +24,8 @@ stdenv.mkDerivation (rec {
outputs = [ "out" "terminfo" ];
+ patches = [ ./rxvt-unicode-9.06-font-width.patch ];
+
preConfigure =
''
mkdir -p $terminfo/share/terminfo
@@ -41,5 +43,6 @@ stdenv.mkDerivation (rec {
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-9.06-font-width.patch b/pkgs/applications/misc/rxvt_unicode/rxvt-unicode-9.06-font-width.patch
new file mode 100644
index 000000000000..636083218fa5
--- /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/spacefm/default.nix b/pkgs/applications/misc/spacefm/default.nix
index 6d52f63ff6b4..7dbe723d9eb2 100644
--- a/pkgs/applications/misc/spacefm/default.nix
+++ b/pkgs/applications/misc/spacefm/default.nix
@@ -3,21 +3,21 @@
}:
let
- version = "0.9.2";
+ 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 = "3767137d74aa78597ffb42a6121784e91a4276efcd5d718b3793b9790f82268c";
+ sha256 = "0marwa031jk24q8hy90dr7yw6rv5hn1shar404zpb1k57v4nr23m";
};
buildInputs = [ gtk3 udev desktop_file_utils shared_mime_info intltool pkgconfig makeWrapper ];
- postInstall = ''
+ preFixup = ''
wrapProgram "$out/bin/spacefm" \
- --prefix XDG_DATA_DIRS : "${gtk3}/share"
+ --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
'';
meta = {
diff --git a/pkgs/applications/misc/st/default.nix b/pkgs/applications/misc/st/default.nix
index 41575ce35a69..fda89f1cd3dd 100644
--- a/pkgs/applications/misc/st/default.nix
+++ b/pkgs/applications/misc/st/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, writeText, libX11, ncurses, libXext, libXft, fontconfig
+{ stdenv, fetchurl, pkgconfig, writeText, libX11, ncurses, libXext, libXft, fontconfig
, conf? null}:
with stdenv.lib;
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
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";
diff --git a/pkgs/applications/misc/surf/default.nix b/pkgs/applications/misc/surf/default.nix
index 42792ba8f91d..651cfcca4067 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 = {
diff --git a/pkgs/applications/misc/synergy/cryptopp.patch b/pkgs/applications/misc/synergy/cryptopp.patch
index d0aebb872610..1c296423acd6 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 c01d67943e57..834b514148b6 100644
--- a/pkgs/applications/misc/synergy/default.nix
+++ b/pkgs/applications/misc/synergy/default.nix
@@ -1,29 +1,31 @@
-{ 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.4.17";
src = fetchurl {
- url = "http://synergy.googlecode.com/files/${name}-Source.tar.gz";
- sha256 = "0l1mxxky9hacyva0npzkgkwg4wkmihzq3abdrds0w5f6is44adv4";
+ url = "http://fossfiles.com/synergy/${name}-r2055-Source.tar.gz";
+ sha256 = "1mwaapvq9vsm0rdpq99fyzcw6wbp83rg6cylcqcgjjd21c6y9iwm";
};
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
diff --git a/pkgs/applications/misc/taffybar/default.nix b/pkgs/applications/misc/taffybar/default.nix
new file mode 100644
index 000000000000..a92e7e32f048
--- /dev/null
+++ b/pkgs/applications/misc/taffybar/default.nix
@@ -0,0 +1,25 @@
+{ cabal, cairo, dbus, dyre, filepath, gtk, gtkTraymanager
+, HStringTemplate, HTTP, mtl, network, parsec, split, stm, text
+, time, transformers, utf8String, X11, xdgBasedir, xmonad
+, xmonadContrib
+}:
+
+cabal.mkDerivation (self: {
+ pname = "taffybar";
+ version = "0.3.0";
+ sha256 = "02vpfbwfprca997ykk746ih7id0ls3i5pnb33gj3nrfgc59fkz7v";
+ isLibrary = true;
+ isExecutable = true;
+ buildDepends = [
+ cairo dbus dyre filepath gtk gtkTraymanager HStringTemplate HTTP
+ mtl network parsec 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/terminator/default.nix b/pkgs/applications/misc/terminator/default.nix
new file mode 100644
index 000000000000..c337cd329c92
--- /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/twmn/default.nix b/pkgs/applications/misc/twmn/default.nix
new file mode 100644
index 000000000000..65c2ccb5ff0b
--- /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/xmobar/add-freeration-variable.patch b/pkgs/applications/misc/xmobar/add-freeration-variable.patch
deleted file mode 100644
index a8c10e1a30d6..000000000000
--- 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 7eacaf15b625..a7aeed339e24 100644
--- a/pkgs/applications/misc/xmobar/default.nix
+++ b/pkgs/applications/misc/xmobar/default.nix
@@ -1,15 +1,16 @@
-{ cabal, alsaCore, alsaMixer, filepath, libXrandr, mtl, parsec
-, regexCompat, stm, time, utf8String, wirelesstools, X11, X11Xft
+{ cabal, alsaCore, alsaMixer, filepath, HTTP, libXrandr, mtl
+, parsec, regexCompat, stm, time, utf8String, wirelesstools, X11
+, X11Xft
}:
cabal.mkDerivation (self: {
pname = "xmobar";
- version = "0.19";
- sha256 = "1lwbww9vpqscip16lqiax2qvfyksxms5xx4n0s61mzw7v61hyxq2";
+ version = "0.20.1";
+ sha256 = "16jfgn6ciqxrwj6qjhbcpms7mzlbxfaxyxfxp64xvnw626xlpjvk";
isLibrary = false;
isExecutable = true;
buildDepends = [
- alsaCore alsaMixer filepath mtl parsec regexCompat stm time
+ alsaCore alsaMixer filepath HTTP mtl parsec regexCompat stm time
utf8String X11 X11Xft
];
extraLibraries = [ libXrandr wirelesstools ];
diff --git a/pkgs/applications/misc/xterm/default.nix b/pkgs/applications/misc/xterm/default.nix
index 1d050182da33..ac2f6dd7756f 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-300";
+ name = "xterm-303";
src = fetchurl {
url = "ftp://invisible-island.net/xterm/${name}.tgz";
- sha256 = "1k8p7q4d1gpk6zikb8hys8b30yq2v001nlp3r9g40my31ij9al31";
+ sha256 = "0n7hay16aam9kfn642ri0wj5yzilbjm3l8znxc2p5dx9pn3rkwla";
};
buildInputs =
diff --git a/pkgs/applications/misc/ykpers/default.nix b/pkgs/applications/misc/ykpers/default.nix
new file mode 100644
index 000000000000..e7bfa8ded50e
--- /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 00e1e6cd28a1..933882c940bb 100644
--- a/pkgs/applications/misc/zathura/core/default.nix
+++ b/pkgs/applications/misc/zathura/core/default.nix
@@ -1,12 +1,12 @@
-{ 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.6";
+ version = "0.2.7";
name = "zathura-core-${version}";
src = fetchurl {
url = "http://pwmt.org/projects/zathura/download/zathura-${version}.tar.gz";
- sha1 = "d84878388969d523027a1661f49fd29638bd460b";
+ sha256 = "ef43be7705612937d095bfbe719a03503bf7e45493ea9409cb43a45cf96f0daf";
};
buildInputs = [ pkgconfig file gtk girara gettext makeWrapper ];
@@ -21,7 +21,12 @@ stdenv.mkDerivation rec {
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 74288657fb35..f943bff7bf0c 100644
--- a/pkgs/applications/misc/zathura/default.nix
+++ b/pkgs/applications/misc/zathura/default.nix
@@ -3,8 +3,11 @@
rec {
inherit (pkgs) stdenv;
+ icon = ./icon.xpm;
+
zathura_core = callPackage ./core {
gtk = pkgs.gtk3;
+ zathura_icon = icon;
};
zathura_pdf_poppler = callPackage ./pdf-poppler { };
@@ -19,7 +22,7 @@ rec {
zathuraWrapper = stdenv.mkDerivation {
- inherit zathura_core;
+ inherit zathura_core icon;
name = "zathura-${zathura_core.version}";
@@ -29,10 +32,10 @@ rec {
zathura_ps
];
- 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/pdf-poppler/default.nix b/pkgs/applications/misc/zathura/pdf-poppler/default.nix
index 71c418f168c4..ce4894e6c0f1 100644
--- a/pkgs/applications/misc/zathura/pdf-poppler/default.nix
+++ b/pkgs/applications/misc/zathura/pdf-poppler/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchurl, pkgconfig, zathura_core, girara, poppler, gettext }:
stdenv.mkDerivation rec {
- version = "0.2.4";
+ version = "0.2.5";
name = "zathura-pdf-poppler-${version}";
src = fetchurl {
url = "http://pwmt.org/projects/zathura/plugins/download/${name}.tar.gz";
- sha256 = "1x1n21naixb87g1knznjfjfibazzwbn1cv7d42kxgwlnf1p1wbzm";
+ sha256 = "1b0chsds8iwjm4g629p6a67nb6wgra65pw2vvngd7g35dmcjgcv0";
};
buildInputs = [ pkgconfig poppler gettext zathura_core girara ];
diff --git a/pkgs/applications/networking/bittorrentsync/default.nix b/pkgs/applications/networking/bittorrentsync/default.nix
index 895ebd7911be..d0611d5b6024 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 "16jdnip51fsnc2g0vib2zb4f06z5p1myzv9brrp42lq63l4skylj"
+ else if stdenv.system == "i686-linux" then "15bspn9frm2n7bzj7pdgbpd7gjjcxp0yx2sksa4ly6wmlv9lvf1j"
else throw "Bittorrent Sync for: ${stdenv.system} not supported!";
- version = "1.2.82";
- sha256 = if stdenv.system == "x86_64-linux" then "0cqrscav57xwz7rag6wy06xw6z7ca97xailprgg6jdjv4pnc91ra"
- else if stdenv.system == "i686-linux" then "1b9rnfk0wkhj1zybvfqwgd9dcqnxwdnp7m0vf6lhrgi75cydj7is"
- 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.87";
-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 = ".";
+ dontStrip = true; # Don't strip, otherwise patching the rpaths breaks
+ sourceRoot = ".";
+ buildInputs = [ patchelf ];
installPhase = ''
ensureDir "$out/bin/"
cp -r "btsync" "$out/bin/"
- patchelf --set-interpreter ${stdenv.glibc}/lib/${interpreter} \
- "$out/bin/btsync"
+ patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ --set-rpath ${libPath} "$out/bin/btsync"
'';
- buildInputs = [ patchelf ];
-
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/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix
index 87cdf673041a..213e75ee6efa 100644
--- a/pkgs/applications/networking/browsers/chromium/default.nix
+++ b/pkgs/applications/networking/browsers/chromium/default.nix
@@ -8,7 +8,7 @@
, libusb1, libexif, pciutils
, python, pythonPackages, perl, pkgconfig
-, nspr, udev, krb5, file
+, nspr, udev, krb5
, utillinux, alsaLib
, gcc, bison, gperf
, glib, gtk, dbus_glib
@@ -40,6 +40,8 @@ let
inherit url sha256;
};
+ buildInputs = [ python ]; # cannot patch shebangs otherwise
+
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
opensslPatches = optional useOpenSSL openssl.patches;
@@ -49,15 +51,19 @@ let
patches = singleton ./sandbox_userns_31.patch;
postPatch = ''
- sed -i -r -e 's/-f(stack-protector)(-all)?/-fno-\1/' build/common.gypi
- '' + (if versionOlder version "32.0.0.0" then ''
- sed -i -e 's|/usr/bin/gcc|gcc|' third_party/WebKit/Source/core/core.gypi
- '' else ''
+ sed -i -r \
+ -e 's/-f(stack-protector)(-all)?/-fno-\1/' \
+ -e 's|/bin/echo|echo|' \
+ -e "/python_arch/s/: *'[^']*'/: '""'/" \
+ build/common.gypi chrome/chrome_tests.gypi
+ sed -i '/not RunGN/,+1d' build/gyp_chromium
sed -i -e 's|/usr/bin/gcc|gcc|' \
third_party/WebKit/Source/build/scripts/scripts.gypi \
third_party/WebKit/Source/build/scripts/preprocessor.pm
- '') + optionalString useOpenSSL ''
+ '' + optionalString useOpenSSL ''
cat $opensslPatches | patch -p1 -d third_party/openssl/openssl
+ '' + optionalString (!versionOlder version "34.0.0.0") ''
+ sed -i '/import.*depot/d' build/gyp_chromium
'';
outputs = [ "out" "sandbox" "bundled" "main" ];
@@ -160,8 +166,7 @@ in stdenv.mkDerivation rec {
nspr udev
(if useOpenSSL then openssl else nss)
utillinux alsaLib
- gcc bison gperf
- krb5 file
+ gcc bison gperf krb5
glib gtk dbus_glib
libXScrnSaver libXcursor libXtst mesa
pciutils protobuf speechd libXdamage
@@ -218,8 +223,10 @@ in stdenv.mkDerivation rec {
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";
});
configurePhase = ''
@@ -241,6 +248,9 @@ in stdenv.mkDerivation rec {
installPhase = ''
ensureDir "${libExecPath}"
cp -v "${buildPath}/"*.pak "${libExecPath}/"
+ ${optionalString (!versionOlder src.version "34.0.0.0") ''
+ cp -v "${buildPath}/icudtl.dat" "${libExecPath}/"
+ ''}
cp -vR "${buildPath}/locales" "${buildPath}/resources" "${libExecPath}/"
cp -v ${buildPath}/libffmpegsumo.so "${libExecPath}/"
@@ -270,7 +280,7 @@ in stdenv.mkDerivation rec {
meta = {
description = "An open source web browser from Google";
homepage = http://www.chromium.org/;
- maintainers = with maintainers; [ goibhniu chaoflow aszlig ];
+ maintainers = with maintainers; [ goibhniu chaoflow aszlig wizeman ];
license = licenses.bsd3;
platforms = platforms.linux;
};
diff --git a/pkgs/applications/networking/browsers/chromium/sources.nix b/pkgs/applications/networking/browsers/chromium/sources.nix
index b7a30ef63f7d..49b5e2b42215 100644
--- a/pkgs/applications/networking/browsers/chromium/sources.nix
+++ b/pkgs/applications/networking/browsers/chromium/sources.nix
@@ -1,18 +1,18 @@
# This file is autogenerated from update.sh in the same directory.
{
dev = {
- version = "33.0.1712.4";
- url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-33.0.1712.4.tar.xz";
- sha256 = "1c1m0y3nnz2lclqi21j6hgqmb46p1hv7c22zz9fn7dax7jkimydk";
+ version = "35.0.1883.0";
+ url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-35.0.1883.0.tar.xz";
+ sha256 = "0qbv6prxl18y5824pfd13ng9798g561gzb6nypwp502hqr45jvb6";
};
beta = {
- version = "32.0.1700.19";
- url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-32.0.1700.19.tar.xz";
- sha256 = "0d0kgy160pyg472ka43gxk7n09pqhhs9nd93jyxrp9qsyllfc425";
+ version = "34.0.1847.60";
+ url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-34.0.1847.60.tar.xz";
+ sha256 = "1na5d6z4a0wkabn7cj62vyiv3mmvcb6qdvrkyy6fj79h7gk2hb7k";
};
stable = {
- version = "32.0.1700.77";
- url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-32.0.1700.77.tar.xz";
- sha256 = "1mwqa5k32d168swpw0bdcnhglxwcqdsx766fq0iz22h3hd4ccdwa";
+ version = "34.0.1847.116";
+ url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-34.0.1847.116.tar.xz";
+ sha256 = "04cpfav5rqa117igvzmrw0045r2ljxg5fqb46qgqvkgff30pjrfx";
};
}
diff --git a/pkgs/applications/networking/browsers/conkeror/default.nix b/pkgs/applications/networking/browsers/conkeror/default.nix
index fc84f7fcecc2..79402c31f8b6 100644
--- a/pkgs/applications/networking/browsers/conkeror/default.nix
+++ b/pkgs/applications/networking/browsers/conkeror/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchgit, unzip, xulrunner, makeWrapper }:
stdenv.mkDerivation {
- name = "conkeror-1.0pre-20131116-1";
+ name = "conkeror-1.0pre-20140212";
src = fetchgit {
url = git://repo.or.cz/conkeror.git;
- rev = "refs/tags/debian-1.0--pre+git131116-1";
- sha256 = "6fe0f30487c5bb8f2183dc7c2e15cf29df7cc8b1950b5fc15c26510c74a1f7d3";
+ rev = "07064d76d10e0978c6de535e21f4597d44560fbd";
+ sha256 = "b03a7debee8583ff7a3f2d95474f60e956f0e24dbd1a8fd22412de1d6627f322";
};
buildInputs = [ unzip makeWrapper ];
diff --git a/pkgs/applications/networking/browsers/dillo/default.nix b/pkgs/applications/networking/browsers/dillo/default.nix
new file mode 100644
index 000000000000..0cf23f38b0f0
--- /dev/null
+++ b/pkgs/applications/networking/browsers/dillo/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl
+, fltk
+, openssl
+, libjpeg, libpng
+, perl
+, libXcursor, libXi, libXinerama
+}:
+
+stdenv.mkDerivation rec {
+ version = "3.0.4";
+ name = "dillo-${version}";
+
+ src = fetchurl {
+ url = "http://www.dillo.org/download/${name}.tar.bz2";
+ sha256 = "0ffz481vgl7f12f575pmbagm8swgxgv9s9c0p8c7plhd04jsnazf";
+ };
+
+ buildInputs = with stdenv.lib;
+ [ fltk openssl libjpeg libpng libXcursor libXi libXinerama ];
+
+ nativeBuildInputs = [ perl ];
+
+ configureFlags = "--enable-ssl";
+
+ meta = {
+ homepage = http://www.dillo.org/;
+ description = "A fast graphical web browser with a small footprint";
+ maintainers = [ stdenv.lib.maintainers.AndersonTorres ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/networking/browsers/dwb/default.nix b/pkgs/applications/networking/browsers/dwb/default.nix
index 0421a8a6c6a8..010dbd168a8d 100644
--- a/pkgs/applications/networking/browsers/dwb/default.nix
+++ b/pkgs/applications/networking/browsers/dwb/default.nix
@@ -2,25 +2,25 @@
m4, glib_networking, gsettings_desktop_schemas }:
stdenv.mkDerivation {
- name = "dwb-0.1";
+ name = "dwb-2014-04-20";
src = fetchgit {
url = "https://bitbucket.org/portix/dwb.git";
- rev = "84a8621787baded72e84afdd5cdda278cb81e007";
- sha256 = "5a32f3c21ad59b43935a16108244f84d260fafaea9b93d41e8de9ba9089ee7b0";
+ rev = "117a6a8cdb84b30b0c084dee531b650664d09ba2";
+ sha256 = "1k1nax3ij64b2hbn9paqj128yyzy41b61xd2m1ayq9y17k9als0b";
};
- buildInputs = [ pkgconfig makeWrapper libsoup webkit gtk3 gnutls json_c m4 ];
+ buildInputs = [ pkgconfig makeWrapper gsettings_desktop_schemas libsoup webkit gtk3 gnutls json_c m4 ];
# There are Xlib and gtk warnings therefore I have set Wno-error
preBuild=''
makeFlagsArray=(CPPFLAGS="-Wno-error" GTK=3 PREFIX=$out);
'';
- postInstall=''
+ preFixup=''
wrapProgram "$out/bin/dwb" \
--prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
- --prefix XDG_DATA_DIRS : "${gsettings_desktop_schemas}/share:$out/share"
+ --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:$out/share"
wrapProgram "$out/bin/dwbem" \
--prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules"
'';
diff --git a/pkgs/applications/networking/browsers/elinks/default.nix b/pkgs/applications/networking/browsers/elinks/default.nix
index 142e5a65df6c..61db2656a409 100644
--- a/pkgs/applications/networking/browsers/elinks/default.nix
+++ b/pkgs/applications/networking/browsers/elinks/default.nix
@@ -1,6 +1,6 @@
{ stdenv, fetchurl, perl, ncurses, x11, bzip2, zlib, openssl
, spidermonkey, gpm
-, enableGuile ? true, guile ? null
+, enableGuile ? false, guile ? null # Incompatible licenses, LGPLv3 - GPLv2
, enablePython ? false, python ? null
}:
@@ -43,5 +43,6 @@ stdenv.mkDerivation rec {
meta = {
description = "Full-featured text-mode web browser";
homepage = http://elinks.or.cz;
+ license = "GPLv2";
};
}
diff --git a/pkgs/applications/networking/browsers/firefox/default.nix b/pkgs/applications/networking/browsers/firefox/default.nix
index 27363482be09..b45fb4bbae75 100644
--- a/pkgs/applications/networking/browsers/firefox/default.nix
+++ b/pkgs/applications/networking/browsers/firefox/default.nix
@@ -17,9 +17,9 @@ assert stdenv.gcc ? libc && stdenv.gcc.libc != null;
rec {
- firefoxVersion = "26.0";
+ firefoxVersion = "27.0.1";
- xulVersion = "26.0"; # this attribute is used by other packages
+ xulVersion = "27.0.1"; # this attribute is used by other packages
src = fetchurl {
@@ -29,7 +29,7 @@ rec {
# Fall back to this url for versions not available at releases.mozilla.org.
"http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.bz2"
];
- sha1 = "f7c6642d6f62aea8d4eced48dd27aba0634edcd5";
+ sha256 = "13qd53yf8dn9m03p4x5ml9h3mys60nba5nz82lcvaq7ycp1pl1bn";
};
commonConfigureFlags =
@@ -82,7 +82,7 @@ rec {
"--disable-javaxpcom"
] ++ commonConfigureFlags;
- enableParallelBuilding = true;
+ #enableParallelBuilding = true; # cf. https://github.com/NixOS/nixpkgs/pull/1699#issuecomment-35196282
preConfigure =
''
@@ -116,6 +116,7 @@ rec {
for i in $out/lib/$libDir/{plugin-container,xulrunner,xulrunner-stub}; do
wrapProgram $i --prefix LD_LIBRARY_PATH ':' "$out/lib/$libDir"
done
+
rm -f $out/bin/run-mozilla.sh
''; # */
@@ -162,13 +163,20 @@ rec {
"SYSTEM_LIBXUL=1"
];
- # Hack to work around make's idea of -lbz2 dependency
+ # Because preConfigure runs configure from a subdirectory.
+ configureScript = "../configure";
+
preConfigure =
''
+ # Hack to work around make's idea of -lbz2 dependency
find . -name Makefile.in -execdir sed -i '{}' -e '1ivpath %.so ${
stdenv.lib.concatStringsSep ":"
(map (s : s + "/lib") (buildInputs ++ [stdenv.gcc.libc]))
}' ';'
+
+ # Building directly in the main source directory is not allowed.
+ mkdir obj_dir
+ cd obj_dir
'';
postInstall =
@@ -187,7 +195,7 @@ rec {
meta = {
description = "Mozilla Firefox - the browser, reloaded";
homepage = http://www.mozilla.com/en-US/firefox/;
- maintainers = [ stdenv.lib.maintainers.eelco ];
+ maintainers = with stdenv.lib.maintainers; [ eelco wizeman ];
};
passthru = {
diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix
index bf4c7f3e7d22..6a00dfcd8c19 100644
--- a/pkgs/applications/networking/browsers/firefox/wrapper.nix
+++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix
@@ -2,8 +2,10 @@
, browserName, desktopName, nameSuffix, icon
}:
+let p = builtins.parseDrvName browser.name; in
+
stdenv.mkDerivation {
- name = browser.name + "-with-plugins";
+ name = "${p.name}-with-plugins-${p.version}";
desktopItem = makeDesktopItem {
name = browserName;
@@ -40,6 +42,8 @@ stdenv.mkDerivation {
echo ${browser} > $out/nix-support/propagated-user-env-packages
'';
+ preferLocalBuild = true;
+
# Let each plugin tell us (through its `mozillaPlugin') attribute
# where to find the plugin in its tree.
plugins = map (x: x + x.mozillaPlugin) plugins;
diff --git a/pkgs/applications/networking/browsers/icecat-3/default.nix b/pkgs/applications/networking/browsers/icecat-3/default.nix
index 84269a290e9a..ef2c69422b62 100644
--- a/pkgs/applications/networking/browsers/icecat-3/default.nix
+++ b/pkgs/applications/networking/browsers/icecat-3/default.nix
@@ -105,7 +105,7 @@ stdenv.mkDerivation {
'';
homepage = http://www.gnu.org/software/gnuzilla/;
- licenses = [ "GPLv2+" "LGPLv2+" "MPLv1+" ];
+ license = [ "GPLv2+" "LGPLv2+" "MPLv1+" ];
maintainers = [ ];
platforms = stdenv.lib.platforms.gnu;
diff --git a/pkgs/applications/networking/browsers/kwebkitpart/default.nix b/pkgs/applications/networking/browsers/kwebkitpart/default.nix
index e9babf787bd1..5ced048fe649 100644
--- a/pkgs/applications/networking/browsers/kwebkitpart/default.nix
+++ b/pkgs/applications/networking/browsers/kwebkitpart/default.nix
@@ -1,12 +1,13 @@
{ stdenv, fetchgit, kdelibs }:
stdenv.mkDerivation rec {
- name = "kwebkitpart-1.3.2";
+ name = "kwebkitpart-${version}";
+ version = "1.3.3";
src = fetchgit {
url = git://anongit.kde.org/kwebkitpart;
- rev = "292f32fda933b2ead5a61ff1ec457f839fad5c85";
- sha256 = "1b2jar9b1yb3gy9fnq8dn2n4z8lffb6pfrj9jc4rjzv5b3rwh1ak";
+ rev = "refs/tags/v${version}";
+ sha256 = "0kszffgg3zpf319lmzlmdba5gq8kdr5xwb69xwy4s2abc9nvwvbi";
};
buildInputs = [ kdelibs ];
diff --git a/pkgs/applications/networking/browsers/links2/default.nix b/pkgs/applications/networking/browsers/links2/default.nix
index 7efdf7ed015e..9b9d9ab6db17 100644
--- a/pkgs/applications/networking/browsers/links2/default.nix
+++ b/pkgs/applications/networking/browsers/links2/default.nix
@@ -8,12 +8,12 @@
}:
stdenv.mkDerivation rec {
- version = "2.5";
+ version = "2.8";
name = "links2-${version}";
src = fetchurl {
url = "${meta.homepage}/download/links-${version}.tar.bz2";
- sha256 = "1wlmj8s6bxgznh0pnawihyvhffzryciz3lkagcxhf7fp64zz5izm";
+ sha256 = "15h07498z52jfdahzgvkphg1f7qvxnpbyfn2xmsls0d2dwwdll3r";
};
buildInputs =
diff --git a/pkgs/applications/networking/browsers/midori/default.nix b/pkgs/applications/networking/browsers/midori/default.nix
index b2ca7c42e76c..d3135e0be8e3 100644
--- a/pkgs/applications/networking/browsers/midori/default.nix
+++ b/pkgs/applications/networking/browsers/midori/default.nix
@@ -3,8 +3,11 @@
, glib_networking, gsettings_desktop_schemas
}:
+let
+ version = "0.5.7";
+in
stdenv.mkDerivation rec {
- name = "midori-0.5.6";
+ name = "midori-${version}";
meta = {
description = "Lightweight WebKitGTK+ web browser";
@@ -15,8 +18,8 @@ stdenv.mkDerivation rec {
};
src = fetchurl {
- url = "${meta.homepage}/downloads/midori_0.5.6_all_.tar.bz2";
- sha256 = "0jpj8cw0dzamzylzslayamjhv0is0xd99dyaql4nyxrkk5fipgn5";
+ url = "${meta.homepage}/downloads/midori_${version}_all_.tar.bz2";
+ sha256 = "0k8bppicgzm97g5x8ahvpw9wvg2f1mq093qp8biwr858m0mbnx98";
};
buildInputs = [
@@ -29,9 +32,9 @@ stdenv.mkDerivation rec {
-DUSE_ZEITGEIST=OFF
'';
- postInstall = ''
+ preFixup = ''
wrapProgram $out/bin/midori \
--prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
- --prefix XDG_DATA_DIRS : "${gtk3}/share:${gsettings_desktop_schemas}/share"
+ --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
'';
}
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-11/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-11/default.nix
index d4d95f7e5b99..a78ab7d27f72 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-11/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-11/default.nix
@@ -35,6 +35,8 @@
}:
let
+ # -> http://get.adobe.com/flashplayer/
+ version = "11.2.202.350";
src =
if stdenv.system == "x86_64-linux" then
@@ -43,10 +45,9 @@ let
# http://labs.adobe.com/technologies/flashplayer10/faq.html
throw "no x86_64 debugging version available"
else rec {
- # -> http://labs.adobe.com/downloads/flashplayer10.html
- version = "11.2.202.310";
+ inherit version;
url = "http://fpdownload.macromedia.com/get/flashplayer/pdc/${version}/install_flash_player_11_linux.x86_64.tar.gz";
- sha256 = "03r9r7h3l4i15hw62k9il6pjzq122nldbgxr37b4y10xp08a9izj";
+ sha256 = "0f5y05c0acvdzd7a7qi93kd17byazf9swm6gml5rph5bc25aw77l";
}
else if stdenv.system == "i686-linux" then
if debug then {
@@ -55,9 +56,9 @@ let
url = http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_plugin_debug.i386.tar.gz;
sha256 = "1z3649lv9sh7jnwl8d90a293nkaswagj2ynhsr4xmwiy7c0jz2lk";
} else rec {
- version = "11.2.202.310";
+ inherit version;
url = "http://fpdownload.macromedia.com/get/flashplayer/pdc/${version}/install_flash_player_11_linux.i386.tar.gz";
- sha256 = "0qf09p92silp81pjfcg2vcfcfi1padizmb58q5iaarnapgkawlbh";
+ sha256 = "0nsrj56xbpn8r4365zby8qbc38cl2anb5ky0h7jwyh7xyrs9xmml";
}
else throw "Flash Player is not supported on this platform";
@@ -87,5 +88,7 @@ stdenv.mkDerivation {
meta = {
description = "Adobe Flash Player browser plugin";
homepage = http://www.adobe.com/products/flashplayer/;
+ maintainer = with stdenv.lib.maintainers; [ wizeman ];
+ license = "unfree";
};
}
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/fribid/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/fribid/default.nix
index 66bd28424c0e..8cda5ad5762f 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/fribid/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/fribid/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
meta = {
description = "A browser plugin to manage Swedish BankID:s";
homepage = http://fribid.se;
- licenses = [ "GPLv2" "MPLv1" ];
+ license = [ "GPLv2" "MPLv1" ];
maintainers = [ stdenv.lib.maintainers.edwtjo ];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/google-talk-plugin/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/google-talk-plugin/default.nix
index 4f7d3feb8ad6..e1bc4e977f6a 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/google-talk-plugin/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/google-talk-plugin/default.nix
@@ -45,20 +45,22 @@ in
stdenv.mkDerivation rec {
name = "google-talk-plugin-${version}";
- # Use the following to determine the current upstream version:
- # curl -s http://dl.google.com/linux/talkplugin/deb/dists/stable/main/binary-amd64/Packages | sed -nr 's/^Version: *([^ ]+)-1$/\1/p'
- version = "4.2.1.0";
+
+ # You can get the upstream version and SHA-1 hash from the following URLs:
+ # http://dl.google.com/linux/talkplugin/deb/dists/stable/main/binary-amd64/Packages
+ # http://dl.google.com/linux/talkplugin/deb/dists/stable/main/binary-i386/Packages
+ version = "5.1.5.0";
src =
if stdenv.system == "x86_64-linux" then
fetchurl {
url = "${baseURL}/google-talkplugin_${version}-1_amd64.deb";
- sha256 = "1g7kpz2lzzz1gri5rd3isp7cfyls6gzwcw2kc8jgrgrixq9iixfd";
+ sha1 = "fc830f4c7f5816f4578ec73e6d4aef059ad4a0b1";
}
else if stdenv.system == "i686-linux" then
fetchurl {
url = "${baseURL}/google-talkplugin_${version}-1_i386.deb";
- sha256 = "1z0zbblzlky9nyifxmnl49v4zafpqp3l08b9v1486sinm35rf58r";
+ sha1 = "9b7043c3585b3479ba11aabb7b8af755a61df963";
}
else throw "Google Talk does not support your platform.";
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/mplayerplug-in/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/mplayerplug-in/default.nix
index 6ee1735f76c7..5b6b2176d47e 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/mplayerplug-in/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/mplayerplug-in/default.nix
@@ -34,6 +34,6 @@ stdenv.mkDerivation rec {
meta = {
description = "A browser plugin that uses mplayer to play digital media from websites";
homepage = http://mplayerplug-in.sourceforge.net/;
- licenses = [ "GPLv2+" "LGPLv2+" "MPLv1+" ];
+ license = [ "GPLv2+" "LGPLv2+" "MPLv1+" ];
};
}
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/nspluginwrapper/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/nspluginwrapper/default.nix
index 7cb1abf31537..51511621dce6 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/nspluginwrapper/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/nspluginwrapper/default.nix
@@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
buildInputs = [which pkgconfig file glib gtk2 gtk3 curl];
+ preferLocalBuild = true;
+
meta = {
description = ''A wrapper to run browser plugins out-of-process'';
homepage = "http://nspluginwrapper.org/";
diff --git a/pkgs/applications/networking/browsers/uzbl/default.nix b/pkgs/applications/networking/browsers/uzbl/default.nix
index 4c6458d909fd..81b4f5c01d9a 100644
--- a/pkgs/applications/networking/browsers/uzbl/default.nix
+++ b/pkgs/applications/networking/browsers/uzbl/default.nix
@@ -1,45 +1,39 @@
-a :
-let
- fetchgit = a.fetchgit;
+{ stdenv, fetchurl, pkgconfig, python, makeWrapper, pygtk
+, webkit, glib_networking, gsettings_desktop_schemas
+}:
- buildInputs = with a; [
- libsoup pkgconfig webkit gtk makeWrapper
- kbproto glib pango cairo gdk_pixbuf atk
- python3
- ];
-in
-rec {
- src = fetchgit {
- url = "https://github.com/Dieterbe/uzbl.git";
- rev = "refs/tags/2012.05.14";
- sha256 = "1crvikb0qqsx5qb003i4w7ywh72psl37gjslrj5hx2fd2f215l0l";
- };
+stdenv.mkDerivation rec {
+ name = "uzbl-20120514";
- name = "uzbl-git";
-
- inherit buildInputs;
- configureFlags = [];
-
- /* doConfigure should be removed if not needed */
- phaseNames = ["addInputs" "setVars" "doMakeInstall" "doWrap"];
-
- setVars = a.noDepEntry (''
- export NIX_LDFLAGS="$NIX_LDFLAGS -L${a.libX11}/lib -lX11"
- '');
-
- doWrap = a.makeManyWrappers "$out/bin/uzbl-core"
- ''
- --prefix GST_PLUGIN_PATH : ${a.webkit.gstreamer}/lib/gstreamer-* \
- --prefix GST_PLUGIN_PATH : ${a.webkit.gst_plugins_base}/lib/gstreamer-* \
- --prefix GST_PLUGIN_PATH : ${a.webkit.gst_plugins_good}/lib/gstreamer-* \
- --prefix GST_PLUGIN_PATH : ${a.webkit.gst_ffmpeg}/lib/gstreamer-* \
- --prefix GIO_EXTRA_MODULES : ${a.glib_networking}/lib/gio/modules
- '';
-
- installFlags = "PREFIX=$out PYINSTALL_EXTRA=\"--prefix=$out\"";
-
- meta = {
+ meta = with stdenv.lib; {
description = "Tiny externally controllable webkit browser";
- maintainers = [a.lib.maintainers.raskin];
+ homepage = "http://uzbl.org/";
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ raskin ];
};
+
+ src = fetchurl {
+ name = "${name}.tar.gz";
+ url = "https://github.com/uzbl/uzbl/archive/2012.05.14.tar.gz";
+ sha256 = "1flpf0rg0c3n9bjifr37zxljn9yxslg8vkll7ghkm341x76cbkwn";
+ };
+
+ preConfigure = ''
+ makeFlags="$makeFlags PREFIX=$out"
+ makeFlags="$makeFlags PYINSTALL_EXTRA=--prefix=$out"
+ '';
+
+ preFixup = ''
+ for f in $out/bin/*; do
+ wrapProgram $f \
+ --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
+ --prefix PYTHONPATH : "$PYTHONPATH" \
+ --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:$out/share"
+ done
+ '';
+
+ nativeBuildInputs = [ pkgconfig python makeWrapper ];
+
+ buildInputs = [ webkit pygtk ];
}
diff --git a/pkgs/applications/networking/browsers/vimb/default.nix b/pkgs/applications/networking/browsers/vimb/default.nix
new file mode 100644
index 000000000000..6cb52be775c6
--- /dev/null
+++ b/pkgs/applications/networking/browsers/vimb/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, pkgconfig, libsoup, webkit, gtk, glib_networking
+, gsettings_desktop_schemas, makeWrapper
+}:
+
+stdenv.mkDerivation rec {
+ name = "vimb-${version}";
+ version = "2.2";
+
+ src = fetchurl {
+ url = "https://github.com/fanglingsu/vimb/archive/${version}.tar.gz";
+ sha256 = "18gig6rcxv0i4a8mz3jv29zpj0323zw45jsg1ycx61a08rzag60m";
+ };
+
+ # Nixos default ca bundle
+ patchPhase = ''
+ sed -i s,/etc/ssl/certs/ca-certificates.crt,/etc/ssl/certs/ca-bundle.crt, src/default.h
+ '';
+
+ buildInputs = [ makeWrapper gtk libsoup pkgconfig webkit gsettings_desktop_schemas ];
+
+ makeFlags = [ "PREFIX=$(out)" ];
+
+ preFixup = ''
+ wrapProgram "$out/bin/vimb" \
+ --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
+ --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
+ '';
+
+ meta = {
+ description = "A Vim-like browser";
+ longDescription = ''
+ A fast and lightweight vim like web browser based on the webkit web
+ browser engine and the GTK toolkit. Vimb is modal like the great vim
+ editor and also easily configurable during runtime. Vimb is mostly
+ keyboard driven and does not detract you from your daily work.
+ '';
+ homepage = "http://fanglingsu.github.io/vimb/";
+ license = stdenv.lib.licenses.gpl3;
+ maintainers = [ stdenv.lib.maintainers.rickynils ];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/pkgs/applications/networking/browsers/vimprobable2/default.nix b/pkgs/applications/networking/browsers/vimprobable2/default.nix
index ee8e4b8434a4..8e1e00795d24 100644
--- a/pkgs/applications/networking/browsers/vimprobable2/default.nix
+++ b/pkgs/applications/networking/browsers/vimprobable2/default.nix
@@ -2,25 +2,28 @@
pkgconfig, webkit, gsettings_desktop_schemas }:
stdenv.mkDerivation rec {
- version = "1.2.1";
+ version = "1.4.2";
name = "vimprobable2-${version}";
src = fetchurl {
url = "mirror://sourceforge/vimprobable/vimprobable2_${version}.tar.bz2";
- sha256 = "19zx1k3s2gnhzzd2wpyqsk151w9p52ifl64xaz9a6qkgvrxlli8p";
+ sha256 = "13jdximksh9r3cgd2f8vms0pbsn3x0gxvyqdqiw16xp5fmdx5kzr";
};
# Nixos default ca bundle
patchPhase = ''
- sed -i s,/etc/ssl/certs/ca-certificates.crt,/etc/ca-bundle.crt, config.h
+ sed -i s,/etc/ssl/certs/ca-certificates.crt,/etc/ssl/certs/ca-bundle.crt, config.h
'';
- buildInputs = [ makeWrapper gtk libsoup libX11 perl pkgconfig webkit ];
+ buildInputs = [ makeWrapper gtk libsoup libX11 perl pkgconfig webkit gsettings_desktop_schemas ];
installPhase = ''
make PREFIX=/ DESTDIR=$out install
+ '';
+
+ preFixup = ''
wrapProgram "$out/bin/vimprobable2" \
--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 = {
diff --git a/pkgs/applications/networking/browsers/w3m/default.nix b/pkgs/applications/networking/browsers/w3m/default.nix
index 5953111fad59..5f046f7b7328 100644
--- a/pkgs/applications/networking/browsers/w3m/default.nix
+++ b/pkgs/applications/networking/browsers/w3m/default.nix
@@ -39,8 +39,9 @@ stdenv.mkDerivation rec {
enableParallelBuilding = false;
- meta = {
+ meta = with stdenv.lib; {
homepage = http://w3m.sourceforge.net/;
description = "A text-mode web browser";
+ maintainers = maintainers.mornfall;
};
}
diff --git a/pkgs/applications/networking/cluster/hadoop/default.nix b/pkgs/applications/networking/cluster/hadoop/default.nix
index ef2f16e31936..f6e86c6289cf 100644
--- a/pkgs/applications/networking/cluster/hadoop/default.nix
+++ b/pkgs/applications/networking/cluster/hadoop/default.nix
@@ -2,11 +2,11 @@
stdenv.mkDerivation rec {
- name = "hadoop-2.0.2-alpha";
+ name = "hadoop-2.2.0";
src = fetchurl {
url = "mirror://apache/hadoop/common/${name}/${name}.tar.gz";
- sha256 = "1r7ailmqhny3pl5nb8bcblnhckszy6hb9n58kwa3s4b8qfk87gkb";
+ sha256 = "0r0kx8arsrvmcfy0693hpv4cz3i0razvk1xa3yhlf3ybb80a8106";
};
buildInputs = [ makeWrapper ];
diff --git a/pkgs/applications/networking/cluster/spark/default.nix b/pkgs/applications/networking/cluster/spark/default.nix
new file mode 100644
index 000000000000..61f2d0c6e202
--- /dev/null
+++ b/pkgs/applications/networking/cluster/spark/default.nix
@@ -0,0 +1,127 @@
+{ stdenv, fetchurl, jre, bash, simpleBuildTool, python27Packages }:
+
+stdenv.mkDerivation rec {
+ name = "spark-${version}";
+ version = "0.9.0";
+
+ src = fetchurl {
+ url = "http://d3kbcqa49mib13.cloudfront.net/${name}-incubating-bin-cdh4.tgz";
+ sha256 = "0dgirq2ws25accijijanqij6d1mwxkrcqkmq1xsslfpz26svs1w1";
+ };
+
+ unpackPhase = ''tar zxf $src'';
+
+ untarDir = "spark-${version}-incubating-bin-cdh4";
+ installPhase = ''
+ set -x
+ mkdir -p $out/lib $out/bin
+ mv ${untarDir} $out/lib
+
+ cat > $out/bin/spark-class < []" >&2
+ exit 1
+ fi
+
+ export SPARK_MEM=\''${SPARK_MEM:-1024m}
+
+ JAVA_OPTS=""
+ JAVA_OPTS="\$JAVA_OPTS -Djava.library.path=\"\$SPARK_LIBRARY_PATH\""
+ JAVA_OPTS="\$JAVA_OPTS -Xms\$SPARK_MEM -Xmx\$SPARK_MEM"
+ export JAVA_OPTS
+
+ CLASSPATH=\`$out/lib/${untarDir}/bin/compute-classpath.sh\`
+ export CLASSPATH
+
+ exec ${jre}/bin/java -cp "\$CLASSPATH" \$JAVA_OPTS "\$@"
+ EOF
+ chmod +x $out/bin/spark-class
+
+ cat > $out/bin/spark-shell </dev/null)
+ if [[ ! \$? ]]; then
+ saved_stty=""
+ fi
+
+ $out/bin/spark-class \$OPTIONS org.apache.spark.repl.Main "\$@"
+
+ exit_status=\$?
+ onExit
+ EOF
+ chmod +x $out/bin/spark-shell
+
+ cat > $out/bin/pyspark < $out/bin/spark-upload-scala < $out/bin/spark-upload-python <.
patches = [ ./find-ca-bundle.patch ];
postInstall = ''
@@ -19,12 +20,11 @@ stdenv.mkDerivation {
chmod 555 "$out/bin/snipe"
'';
- meta = {
+ meta = with stdenv.lib; {
description = "Simple, lightweight tool for sniping eBay auctions";
- homepage = "http://esnipe.rsourceforge.net";
- license = "GPLv2";
-
- platforms = stdenv.lib.platforms.all;
- maintainers = [ stdenv.lib.maintainers.simons ];
+ homepage = http://esnipe.rsourceforge.net;
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ lovek323 simons ];
+ platforms = platforms.all;
};
}
diff --git a/pkgs/applications/networking/feedreaders/newsbeuter/default.nix b/pkgs/applications/networking/feedreaders/newsbeuter/default.nix
index 029a6f8e6339..e5f18f72cedc 100644
--- a/pkgs/applications/networking/feedreaders/newsbeuter/default.nix
+++ b/pkgs/applications/networking/feedreaders/newsbeuter/default.nix
@@ -1,23 +1,24 @@
-{ stdenv, fetchurl, sqlite, curl, pkgconfig, libxml2, stfl, json_c, ncurses
+{ stdenv, fetchurl, sqlite, curl, pkgconfig, libxml2, stfl, json-c-0-11, ncurses
, gettext, libiconvOrEmpty, makeWrapper, perl }:
stdenv.mkDerivation rec {
- name = "newsbeuter-2.7";
+ name = "newsbeuter-2.8";
src = fetchurl {
url = "http://www.newsbeuter.org/downloads/${name}.tar.gz";
- sha256 = "0flhzzlbdirjmrq738gmcxqqnifg3kb7plcwqcxshpizmjkhswp6";
+ sha256 = "013qi8yghpms2qq1b3xbrlmfgpj0ybgk0qhj245ni4kpxila0wn8";
+
};
buildInputs
# use gettext instead of libintlOrEmpty so we have access to the msgfmt
# command
- = [ pkgconfig sqlite curl libxml2 stfl json_c ncurses gettext perl ]
+ = [ pkgconfig sqlite curl libxml2 stfl json-c-0-11 ncurses gettext perl ]
++ libiconvOrEmpty
++ stdenv.lib.optional stdenv.isDarwin makeWrapper;
preBuild = ''
- sed -i -e 104,108d config.sh
+ sed -i -e 110,114d config.sh
sed -i "1 s%^.*$%#!${perl}/bin/perl%" txt2h.pl
export LDFLAGS=-lncursesw
'';
diff --git a/pkgs/applications/networking/feedreaders/newsbeuter/dev.nix b/pkgs/applications/networking/feedreaders/newsbeuter/dev.nix
index 17e97d92b897..4390360ff9e8 100644
--- a/pkgs/applications/networking/feedreaders/newsbeuter/dev.nix
+++ b/pkgs/applications/networking/feedreaders/newsbeuter/dev.nix
@@ -2,11 +2,12 @@
, gettext, libiconvOrEmpty, makeWrapper, perl }:
stdenv.mkDerivation rec {
- name = "newsbeuter-dev-20131118";
+ name = "newsbeuter-dev-20140309";
src = fetchgit {
url = "https://github.com/akrennmair/newsbeuter.git";
- rev = "18b73f7d44a99a698d4878fe7d226f55842132c2";
+ rev = "1427bdb0705806368db39576a9b803df82fa0415";
+ sha256 = "b29a304a46bf56b439d0d35ea586f7fd0fbf1a5565dca95de76e774885d8b64b";
};
buildInputs
@@ -17,7 +18,7 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional stdenv.isDarwin makeWrapper;
preBuild = ''
- sed -i -e 104,108d config.sh
+ sed -i -e 110,114d config.sh
sed -i "1 s%^.*$%#!${perl}/bin/perl%" txt2h.pl
export LDFLAGS=-lncursesw
'';
diff --git a/pkgs/applications/networking/ftp/filezilla/default.nix b/pkgs/applications/networking/ftp/filezilla/default.nix
index b7c9a76e151f..a8b4cfaf9266 100644
--- a/pkgs/applications/networking/ftp/filezilla/default.nix
+++ b/pkgs/applications/networking/ftp/filezilla/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, dbus, gnutls2, wxGTK28, libidn, tinyxml, gettext
+{ stdenv, fetchurl, dbus, gnutls, wxGTK28, libidn, tinyxml, gettext
, pkgconfig, xdg_utils, gtk2, sqlite }:
let version = "3.7.3"; in
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
];
buildInputs = [
- dbus gnutls2 wxGTK28 libidn tinyxml gettext pkgconfig xdg_utils gtk2 sqlite
+ dbus gnutls wxGTK28 libidn tinyxml gettext pkgconfig xdg_utils gtk2 sqlite
];
meta = with stdenv.lib; {
diff --git a/pkgs/applications/networking/instant-messengers/ekiga/default.nix b/pkgs/applications/networking/instant-messengers/ekiga/default.nix
index 276df1ae7a15..9de14cae6f0f 100644
--- a/pkgs/applications/networking/instant-messengers/ekiga/default.nix
+++ b/pkgs/applications/networking/instant-messengers/ekiga/default.nix
@@ -2,7 +2,7 @@ x@{builderDefsPackage
, cyrus_sasl, gettext, openldap, ptlib, opal, GConf, libXv, rarian, intltool
, perl, perlXMLParser, evolution_data_server, gnome_doc_utils, avahi
, libsigcxx, gtk, dbus_glib, libnotify, libXext, xextproto, automake
- , autoconf, pkgconfig, libxml2, videoproto, unixODBC, db4, nspr, nss, zlib
+ , autoconf, pkgconfig, libxml2, videoproto, unixODBC, db, nspr, nss, zlib
, libXrandr, randrproto, which, libxslt, libtasn1, gmp, nettle
, ...}:
builderDefsPackage
diff --git a/pkgs/applications/networking/instant-messengers/jitsi/default.nix b/pkgs/applications/networking/instant-messengers/jitsi/default.nix
new file mode 100644
index 000000000000..e6dd6569a55f
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/jitsi/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, makeDesktopItem, unzip, ant, jdk }:
+
+stdenv.mkDerivation rec {
+
+ name = "jitsi-${version}";
+ version = "2.4.4997";
+
+ src = fetchurl {
+ url = "https://download.jitsi.org/jitsi/src/jitsi-src-${version}.zip";
+ sha256 = "f1c2688d7d6bf1916fed3b8b105a785662980c5b297dcab3c9e7d272647ef825";
+ };
+
+ patches = [ ./jitsi.patch ];
+
+ jitsiItem = makeDesktopItem {
+ name = "Jitsi";
+ exec = "jitsi";
+ comment = "VoIP and Instant Messaging client";
+ desktopName = "Jitsi";
+ genericName = "Instant Messaging";
+ categories = "Application;Internet;";
+ };
+
+ buildInputs = [unzip ant jdk];
+
+ buildPhase = ''ant make'';
+
+ installPhase = ''
+ mkdir -p $out
+ cp -a lib $out/
+ cp -a sc-bundles $out/
+ mkdir $out/bin
+ cp resources/install/generic/run.sh $out/bin/jitsi
+ chmod +x $out/bin/jitsi
+ sed -i 's| java | ${jdk}/bin/java |' $out/bin/jitsi
+ patchShebangs $out
+ '';
+
+ meta = {
+ homepage = https://jitsi.org/;
+ description = "Open Source Video Calls and Chat";
+ license = stdenv.lib.licenses.lgpl21Plus.shortName;
+ platforms = stdenv.lib.platforms.linux;
+ };
+
+}
diff --git a/pkgs/applications/networking/instant-messengers/jitsi/jitsi.patch b/pkgs/applications/networking/instant-messengers/jitsi/jitsi.patch
new file mode 100644
index 000000000000..9163cecd175b
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/jitsi/jitsi.patch
@@ -0,0 +1,27 @@
+--- /home/dario/Downloads/jitsi/resources/install/generic/run.sh 2013-11-01 15:37:21.000000000 +0000
++++ jitsi/resources/install/generic/run.sh 2014-03-04 11:52:30.796397567 +0000
+@@ -1,4 +1,9 @@
+-mkdir -p $HOME/.sip-communicator/log
++#! /bin/bash
++# A modified version of the generic run.sh
++
++#mkdir -p $HOME/.sip-communicator/log
++
++cd "$( dirname "$( dirname "${BASH_SOURCE[0]}" )" )"
+
+ # Get architecture
+ ARCH=`uname -m | sed -e s/x86_64/64/ -e s/i.86/32/`
+@@ -6,10 +11,12 @@
+ # Additionnal JVM arguments
+ CLIENTARGS=""
+
++NATIVELIBS="lib/native/linux-64"
+ if [ $ARCH -eq 32 ]
+ then
+ CLIENTARGS="-client -Xmx256m"
++ NATIVELIBS="lib/native/linux"
+ fi
+
+ export PATH=$PATH:native
+-java $CLIENTARGS -classpath "lib/felix.jar:sc-bundles/sc-launcher.jar:sc-bundles/util.jar:lib/" -Djava.library.path=native -Dfelix.config.properties=file:./lib/felix.client.run.properties -Djava.util.logging.config.file=lib/logging.properties net.java.sip.communicator.launcher.SIPCommunicator
++exec java $CLIENTARGS -classpath "lib/felix.jar:sc-bundles/sc-launcher.jar:sc-bundles/util.jar:lib/" -Djava.library.path=$NATIVELIBS -Dfelix.config.properties=file:lib/felix.client.run.properties -Djava.util.logging.config.file=lib/logging.properties net.java.sip.communicator.launcher.SIPCommunicator
diff --git a/pkgs/applications/networking/instant-messengers/kadu/cmake.patch b/pkgs/applications/networking/instant-messengers/kadu/cmake.patch
new file mode 100644
index 000000000000..bb2d2d39d25a
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/kadu/cmake.patch
@@ -0,0 +1,13 @@
+diff -ru kadu-0.12.2.orig/plugins/jabber_protocol/3rdparty/CMakeLists.txt kadu-0.12.2/plugins/jabber_protocol/3rdparty/CMakeLists.txt
+--- kadu-0.12.2.orig/plugins/jabber_protocol/3rdparty/CMakeLists.txt 2012-08-30 16:13:17.000000000 +0200
++++ kadu-0.12.2/plugins/jabber_protocol/3rdparty/CMakeLists.txt 2014-02-15 10:20:33.368716013 +0100
+@@ -26,7 +26,7 @@
+ get_filename_component (_basename ${_current_MOC} NAME_WE)
+ set (_header ${_abs_FILE})
+ set (_moc ${_abs_PATH}/${_current_MOC})
+- QT4_CREATE_MOC_COMMAND (${_header} ${_moc} "${_moc_INCS}" "")
++ QT4_CREATE_MOC_COMMAND (${_header} ${_moc} "${_moc_INCS}" "" "")
+ MACRO_ADD_FILE_DEPENDENCIES (${_abs_FILE} ${_moc})
+ endforeach (_current_MOC_INC)
+ endif (_match)
+Only in kadu-0.12.2/plugins/jabber_protocol/3rdparty: CMakeLists.txt~
diff --git a/pkgs/applications/networking/instant-messengers/kadu/default.nix b/pkgs/applications/networking/instant-messengers/kadu/default.nix
index 03cbb1ce0737..4e176ec56dcb 100644
--- a/pkgs/applications/networking/instant-messengers/kadu/default.nix
+++ b/pkgs/applications/networking/instant-messengers/kadu/default.nix
@@ -26,6 +26,7 @@ stdenv.mkDerivation {
sed -i -e '/mpd_mediaplayer/d' \
-e '/encryption_ng/d' \
-e '/encryption_ng_simlite/d' Plugins.cmake
+ patch -p1 < ${./cmake.patch}
'';
NIX_LDFLAGS="-lX11";
diff --git a/pkgs/applications/networking/instant-messengers/pidgin/default.nix b/pkgs/applications/networking/instant-messengers/pidgin/default.nix
index d0652adcb0d6..6e6fd6d0eb6c 100644
--- a/pkgs/applications/networking/instant-messengers/pidgin/default.nix
+++ b/pkgs/applications/networking/instant-messengers/pidgin/default.nix
@@ -21,10 +21,10 @@
} :
stdenv.mkDerivation rec {
- name = "pidgin-2.10.7";
+ name = "pidgin-2.10.9";
src = fetchurl {
url = "mirror://sourceforge/pidgin/${name}.tar.bz2";
- sha256 = "14piyx4xpc3l8286x4nh5pna2wfyn9cv0qa29br1q3d2xja2k8zb";
+ sha256 = "06gka47myl9f5x0flkq74ml75akkf28rx9sl8pm3wqkzazc2wdnw";
};
inherit nss ncurses;
@@ -51,8 +51,11 @@ stdenv.mkDerivation rec {
configureFlags="--with-nspr-includes=${nspr}/include/nspr --with-nspr-libs=${nspr}/lib --with-nss-includes=${nss}/include/nss --with-nss-libs=${nss}/lib --with-ncurses-headers=${ncurses}/include --disable-meanwhile --disable-nm --disable-tcl"
+ (lib.optionalString (gnutls != null) " --enable-gnutls=yes --enable-nss=no")
;
- meta = {
+ meta = with stdenv.lib; {
description = "Pidgin IM - XMPP(Jabber), AIM/ICQ, IRC, SIP etc client";
homepage = http://pidgin.im;
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.vcunat ];
};
}
diff --git a/pkgs/applications/networking/instant-messengers/sflphone/default.nix b/pkgs/applications/networking/instant-messengers/sflphone/default.nix
index 2401d796bfdc..a31a682abf88 100644
--- a/pkgs/applications/networking/instant-messengers/sflphone/default.nix
+++ b/pkgs/applications/networking/instant-messengers/sflphone/default.nix
@@ -75,8 +75,10 @@ rec {
'';
# gtk3 programs have the runtime dependency on XDG_DATA_DIRS
- postInstall = ''
- wrapProgram $out/bin/sflphone* --prefix XDG_DATA_DIRS ":" ${gtk}/share
+ preFixup = ''
+ for f in "$out/bin/sflphone" "$out/bin/sflphone-client-gnome"; do
+ wrapProgram $f --prefix XDG_DATA_DIRS ":" "${gtk}/share:$GSETTINGS_SCHEMAS_PATH"
+ done
'';
buildInputs = [ daemon pkgconfig gtk glib dbus_glib libnotify intltool makeWrapper ];
diff --git a/pkgs/applications/networking/instant-messengers/skype/default.nix b/pkgs/applications/networking/instant-messengers/skype/default.nix
index ebd84ff47b89..20a304952a7a 100644
--- a/pkgs/applications/networking/instant-messengers/skype/default.nix
+++ b/pkgs/applications/networking/instant-messengers/skype/default.nix
@@ -5,11 +5,11 @@
assert stdenv.system == "i686-linux";
stdenv.mkDerivation rec {
- name = "skype-4.2.0.11";
+ name = "skype-4.2.0.13";
src = fetchurl {
url = "http://download.skype.com/linux/${name}.tar.bz2";
- sha256 = "0kh66p50m3x4ql6j8ciz73c30npcizd00ya9qrhid711rar0mlw7";
+ sha256 = "137kp6c0v4z7n7pp4hwrx4gjgk4knwj815dc6swh44lb5cj1c5m5";
};
buildInputs =
diff --git a/pkgs/applications/networking/instant-messengers/telegram-cli/default.nix b/pkgs/applications/networking/instant-messengers/telegram-cli/default.nix
new file mode 100644
index 000000000000..51639f6050dc
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/telegram-cli/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchgit, libconfig, lua5_2, openssl, readline, zlib
+}:
+
+stdenv.mkDerivation rec {
+ name = "telegram-cli";
+
+ src = fetchgit {
+ url = "https://github.com/vysheng/tg.git";
+ rev = "ac6079a00ac66bb37a3179a82af130b41ec39bc9";
+ sha256 = "1rpwnyzmqk7p97n5pd00m5c6rypc39mb3hs94qxxrdcpwpgcb73q";
+ };
+
+ buildInputs = [ libconfig lua5_2 openssl readline zlib ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp ./telegram $out/bin/telegram-wo-key
+ cp ./tg.pub $out/
+ cat > $out/bin/telegram < $out/share/applications/thunderbird.desktop < jackaudio != null;
+assert speechdSupport -> speechd != null;
+let
+ optional = stdenv.lib.optional;
+ optionalString = stdenv.lib.optionalString;
+in
stdenv.mkDerivation rec {
name = "mumble-" + version;
- version = "1.2.4";
+ version = "1.2.5";
src = fetchurl {
url = "mirror://sourceforge/mumble/${name}.tar.gz";
- sha256 = "16wwj6gwcnyjlnzh7wk0l255ldxmbwx0wi652sdp20lsv61q7kx1";
+ sha256 = "1bsgains6xgpgpd1b5bq682z0kswp5fcjh2cir4c4qkndya5clci";
};
- patchPhase = ''
- patch -p1 < ${ ./mumble-jack-support.patch }
- '';
+ patches = optional jackSupport ./mumble-jack-support.patch;
configurePhase = ''
qmake CONFIG+=no-g15 CONFIG+=no-update CONFIG+=no-server \
CONFIG+=no-embed-qt-translations CONFIG+=packaged \
CONFIG+=bundled-celt CONFIG+=no-bundled-opus \
+ ${optionalString (!speechdSupport) "CONFIG+=no-speechd"} \
+ ${optionalString jackSupport "CONFIG+=no-oss CONFIG+=no-alsa CONFIG+=jackaudio"} \
CONFIG+=no-bundled-speex
- ''
- + stdenv.lib.optionalString jackSupport ''
- CONFIG+=no-oss CONFIG+=no-alsa CONFIG+=jackaudio
'';
- buildInputs = [ qt4 boost speechd protobuf libsndfile speex
+ buildInputs = [ qt4 boost protobuf libsndfile speex
libopus avahi pkgconfig ]
- ++ (stdenv.lib.optional jackSupport jackaudio);
+ ++ (optional jackSupport jackaudio)
+ ++ (optional speechdSupport speechd);
installPhase = ''
mkdir -p $out
cp -r ./release $out/bin
'';
- meta = {
- homepage = http://mumble.sourceforge.net/;
+ meta = with stdenv.lib; {
+ homepage = "http://mumble.sourceforge.net/";
description = "Low-latency, high quality voice chat software";
- license = "BSD";
- platforms = with stdenv.lib.platforms; linux;
- maintainers = with stdenv.lib.maintainers; [viric];
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ viric ];
};
}
diff --git a/pkgs/applications/networking/mumble/murmur.nix b/pkgs/applications/networking/mumble/murmur.nix
index b40632384c2b..b886896c071f 100644
--- a/pkgs/applications/networking/mumble/murmur.nix
+++ b/pkgs/applications/networking/mumble/murmur.nix
@@ -1,30 +1,46 @@
-{ stdenv, fetchurl, qt4, boost, protobuf, avahi, libcap, pkgconfig }:
+{ stdenv, fetchurl, qt4, boost, protobuf
+, avahi, libcap, pkgconfig
+, iceSupport ? false
+, zeroc_ice ? null
+}:
+assert iceSupport -> zeroc_ice != null;
+
+let
+ optional = stdenv.lib.optional;
+ optionalString = stdenv.lib.optionalString;
+in
stdenv.mkDerivation rec {
name = "murmur-" + version;
- version = "1.2.4";
+ version = "1.2.5";
src = fetchurl {
url = "mirror://sourceforge/mumble/mumble-${version}.tar.gz";
- sha256 = "16wwj6gwcnyjlnzh7wk0l255ldxmbwx0wi652sdp20lsv61q7kx1";
+ sha256 = "1bsgains6xgpgpd1b5bq682z0kswp5fcjh2cir4c4qkndya5clci";
};
- configurePhase = ''
- qmake CONFIG+=no-client CONFIG+=no-ice CONFIG+=no-embed-qt
+ patchPhase = optional iceSupport ''
+ sed -i 's,/usr/share/Ice/,${zeroc_ice}/,g' src/murmur/murmur.pro
'';
- buildInputs = [ qt4 boost protobuf avahi libcap pkgconfig ];
+ configurePhase = ''
+ qmake CONFIG+=no-client CONFIG+=no-embed-qt \
+ ${optionalString (!iceSupport) "CONFIG+=no-ice"}
+ '';
+
+ buildInputs = [ qt4 boost protobuf avahi libcap pkgconfig ]
+ ++ optional iceSupport [ zeroc_ice ];
installPhase = ''
mkdir -p $out
cp -r ./release $out/bin
'';
- meta = {
- homepage = http://mumble.sourceforge.net/;
+ meta = with stdenv.lib; {
+ homepage = "http://mumble.sourceforge.net/";
description = "Low-latency, high quality voice chat software";
- license = "BSD";
- platforms = with stdenv.lib.platforms; linux;
- maintainers = with stdenv.lib.maintainers; [viric];
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ viric ];
};
}
diff --git a/pkgs/applications/networking/newsreaders/liferea/default.nix b/pkgs/applications/networking/newsreaders/liferea/default.nix
index 093b801401dc..650e3237fe41 100644
--- a/pkgs/applications/networking/newsreaders/liferea/default.nix
+++ b/pkgs/applications/networking/newsreaders/liferea/default.nix
@@ -1,30 +1,57 @@
-{ stdenv, fetchurl, pkgconfig, intltool, glib, gtk2, gnome2 /*just GConf*/
-, libsoup, libunique, libxslt, webkit_gtk2, json_glib
-, libnotify /*optional*/ }:
+{ stdenv, fetchurl, pkgconfig, intltool, python, pygobject3
+, glib, gnome3, pango, libxml2, libxslt, sqlite, libsoup, glib_networking
+, webkitgtk, json_glib, gobjectIntrospection, gst_all_1
+, libnotify
+, makeWrapper
+}:
-let version = "1.8.15";
+let pname = "liferea";
+ version = "1.10.8";
in
stdenv.mkDerivation rec {
- name = "liferea-${version}";
+ name = "${pname}-${version}";
src = fetchurl {
- url = "mirror://sourceforge/liferea/Liferea%20Stable/${version}/${name}.tar.bz2";
- sha256 = "12hhdl5biwcvr9ds7pdhhvlp4vggjix6xm4z5pnfaz53ai2dnc99";
+ url = "https://github.com/lwindolf/${pname}/releases/download/v${version}/${name}.tar.bz2";
+ sha256 = "1d3icma90mj0nai20pfhxp4k4l33iwkkkcddb9vg5hi4yq4wpmwx";
};
- buildInputs = [
- pkgconfig intltool gtk2 gnome2.GConf
- libsoup libunique libxslt webkit_gtk2 json_glib
+ buildInputs = with gst_all_1; [
+ pkgconfig intltool python
+ glib gnome3.gtk pango libxml2 libxslt sqlite libsoup
+ webkitgtk json_glib gobjectIntrospection gnome3.gsettings_desktop_schemas
+ gnome3.libpeas gnome3.dconf
+ gst-plugins-base gst-plugins-good gst-plugins-bad
+ gnome3.libgnome_keyring
libnotify
+ makeWrapper
];
preFixup = ''
- rm $out/share/icons/hicolor/icon-theme.cache'';
+ rm $out/share/icons/hicolor/icon-theme.cache
+
+ for f in "$out"/bin/*; do
+ wrapProgram "$f" \
+ --prefix PYTHONPATH : "$(toPythonPath $out):$(toPythonPath ${pygobject3})" \
+ --prefix LD_LIBRARY_PATH : "${gnome3.libgnome_keyring}/lib" \
+ --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
+ --prefix GIO_EXTRA_MODULES : "${gnome3.dconf}/lib/gio/modules:${glib_networking}/lib/gio/modules" \
+ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gnome3.gnome_icon_theme}/share:${gnome3.gtk}/share:$out/share:$GSETTINGS_SCHEMAS_PATH"
+ done
+ '';
meta = {
description = "A GTK-based news feed agregator";
homepage = http://lzone.de/liferea/;
- maintainers = [ stdenv.lib.maintainers.vcunat ];
+ license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = with stdenv.lib.maintainers; [ vcunat romildo ];
platforms = stdenv.lib.platforms.linux;
+
+ longDescription = ''
+ Liferea (Linux Feed Reader) is an RSS/RDF feed reader.
+ It's intended to be a clone of the Windows-only FeedReader.
+ It can be used to maintain a list of subscribed feeds,
+ browse through their items, and show their contents.
+ '';
};
}
diff --git a/pkgs/applications/networking/newsreaders/slrn/default.nix b/pkgs/applications/networking/newsreaders/slrn/default.nix
new file mode 100644
index 000000000000..c933460af43b
--- /dev/null
+++ b/pkgs/applications/networking/newsreaders/slrn/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl,
+slang, ncurses
+}:
+
+let version = "1.0.1"; in
+
+stdenv.mkDerivation {
+ name = "slrn-${version}";
+
+ src = fetchurl {
+ url = "http://www.jedsoft.org/slrn/download/slrn-1.0.1.tar.gz";
+ sha256 = "1rmaprfwvshzkv0c5vi43839cz3laqjpl306b9z0ghwyjdha1d06";
+ };
+
+ preConfigure = ''
+ sed -i -e "s|-ltermcap|-lncurses|" configure
+ sed -i autoconf/Makefile.in src/Makefile.in \
+ -e "s|/bin/cp|cp|" \
+ -e "s|/bin/rm|rm|"
+ '';
+
+ configureFlags = "--with-slang=${slang}";
+
+ buildInputs = [ slang ncurses ];
+
+ meta = {
+ description = "The slrn (S-Lang read news) newsreader";
+ homepage = http://slrn.sourceforge.net/index.html;
+ license = stdenv.lib.licenses.gpl2;
+ };
+}
diff --git a/pkgs/applications/networking/notbit/default.nix b/pkgs/applications/networking/notbit/default.nix
new file mode 100644
index 000000000000..db900f9ff256
--- /dev/null
+++ b/pkgs/applications/networking/notbit/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchgit, autoconf, automake, pkgconfig, openssl }:
+
+stdenv.mkDerivation rec {
+ name = "notbit-0.2-28-g06f9160";
+
+ src = fetchgit {
+ url = "git://git.busydoingnothing.co.uk/notbit";
+ rev = "06f916081836de12f8e57a9f50c95d4d1b51627f";
+ sha256 = "d5c38eea1d9ca213bfbea5c88350478a5088b5532e939de9680d72e60aa65288";
+ };
+
+ buildInputs = [ autoconf automake pkgconfig openssl ];
+
+ preConfigure = "autoreconf -vfi";
+
+ meta = with stdenv.lib; {
+ homepage = http://busydoingnothing.co.uk/notbit/;
+ description = "A minimal bitmessage client";
+ license = licenses.mit;
+
+ # This is planned to change when the project officially supports other platforms
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/networking/p2p/gnunet/default.nix b/pkgs/applications/networking/p2p/gnunet/default.nix
index 045e6557730e..bbb3561bae97 100644
--- a/pkgs/applications/networking/p2p/gnunet/default.nix
+++ b/pkgs/applications/networking/p2p/gnunet/default.nix
@@ -4,11 +4,11 @@
, makeWrapper }:
stdenv.mkDerivation rec {
- name = "gnunet-0.10.0";
+ name = "gnunet-0.10.1";
src = fetchurl {
url = "mirror://gnu/gnunet/${name}.tar.gz";
- sha256 = "0zqpc47kywhjrpphl0palz849khv00ra2gjrfkysp6p0gfsbvd0i";
+ sha256 = "04wxzm3wkgqbn42b8ksr4cx6m5cckyig5cls1adh0nwdczwvnp7n";
};
buildInputs = [
diff --git a/pkgs/applications/networking/p2p/ktorrent/default.nix b/pkgs/applications/networking/p2p/ktorrent/default.nix
index b408f20b7110..e53fda089111 100644
--- a/pkgs/applications/networking/p2p/ktorrent/default.nix
+++ b/pkgs/applications/networking/p2p/ktorrent/default.nix
@@ -5,11 +5,11 @@ stdenv.mkDerivation rec {
name = pname + "-" + version;
pname = "ktorrent";
- version = "4.2.1";
+ version = "4.3.1";
src = fetchurl {
url = "${meta.homepage}/downloads/${version}/${name}.tar.bz2";
- sha256 = "1b6w7i1vvq8mlw9yrlxvb51hvaj6rpl8lv9b9zagyl3wcanz73zd";
+ sha256 = "66094f6833347afb0c49e332f0ec15ec48db652cbe66476840846ffd5ca0e4a1";
};
patches = [ ./find-workspace.diff ];
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
meta = {
description = "KDE integrated BtTorrent client";
- homepage = http://ktorrent.org;
+ homepage = http://ktorrent.pwsp.net;
maintainers = with stdenv.lib.maintainers; [ sander urkud ];
inherit (libktorrent.meta) platforms;
};
diff --git a/pkgs/applications/networking/p2p/mldonkey/default.nix b/pkgs/applications/networking/p2p/mldonkey/default.nix
index 2f739b056d4f..57ea62485310 100644
--- a/pkgs/applications/networking/p2p/mldonkey/default.nix
+++ b/pkgs/applications/networking/p2p/mldonkey/default.nix
@@ -1,11 +1,11 @@
{stdenv, fetchurl, ocaml, zlib, bzip2, ncurses, file, gd, libpng }:
stdenv.mkDerivation (rec {
- name = "mldonkey-3.1.3";
+ name = "mldonkey-3.1.5";
src = fetchurl {
url = "mirror://sourceforge/mldonkey/${name}.tar.bz2";
- sha256 = "1qnr0qzliw4aynf2zhmm5hmrc9bd5vhdq3bi8n88j4nc86gry9bw";
+ sha256 = "1jqik6b09p27ckssppfiqpph7alxbgpnf9w1s0lalmi3qyyd9ybl";
};
meta = {
diff --git a/pkgs/applications/networking/p2p/ncdc/default.nix b/pkgs/applications/networking/p2p/ncdc/default.nix
new file mode 100644
index 000000000000..794f6fe43087
--- /dev/null
+++ b/pkgs/applications/networking/p2p/ncdc/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, ncurses, zlib, bzip2, sqlite, pkgconfig, glib, gnutls }:
+
+stdenv.mkDerivation rec {
+ name = "ncdc-${version}";
+ version = "1.19";
+
+ src = fetchurl {
+ url = "http://dev.yorhel.nl/download/ncdc-1.19.tar.gz";
+ sha256 = "1wgvqwfxq9kc729h2r528n55821w87sfbm4h21mr6pvkpfw30hf2";
+ };
+
+ buildInputs = [ ncurses zlib bzip2 sqlite pkgconfig glib gnutls ];
+
+ meta = {
+ description = "modern and lightweight direct connect client with a friendly ncurses interface";
+ homepage = http://dev.yorhel.nl/ncdc;
+ license = stdenv.lib.licenses.mit;
+ platforms = stdenv.lib.platforms.linux; # arbitrary
+ maintainers = [ stdenv.lib.maintainers.emery ];
+ };
+}
diff --git a/pkgs/applications/networking/p2p/retroshare/default.nix b/pkgs/applications/networking/p2p/retroshare/default.nix
index d4e3aa91cc0b..3ae4f2a74838 100644
--- a/pkgs/applications/networking/p2p/retroshare/default.nix
+++ b/pkgs/applications/networking/p2p/retroshare/default.nix
@@ -1,28 +1,38 @@
-{stdenv, fetchurl, qt, libupnp, gpgme, libgnome_keyring, glib}:
-
-throw "still fails to build"
+{ stdenv, fetchurl, cmake, qt, libupnp, gpgme, gnome3, glib, libssh, pkgconfig, protobuf, bzip2
+, libXScrnSaver, speex, curl, libxml2, libxslt }:
stdenv.mkDerivation {
- name = "retroshare-0.5.1d";
+ name = "retroshare-0.5.5c";
src = fetchurl {
- url = mirror://sourceforge/retroshare/RetroShare-v0.5.1d.tar.gz;
- sha256 = "15971wxx8djwcxn170jyn0mlh7cfzqsf031aa849wr9z234gwrcn";
+ url = mirror://sourceforge/project/retroshare/RetroShare/0.5.5c/retroshare_0.5.5-0.7068.tar.gz;
+ sha256 = "0l2n4pr1hq66q6qa073hrdx3s3d7iw54z8ay1zy82zhk2rwhsavp";
};
- buildInputs = [ qt libupnp gpgme libgnome_keyring glib ];
+ NIX_CFLAGS_COMPILE = "-I${glib}/include/glib-2.0 -I${glib}/lib/glib-2.0/include -I${libxml2}/include/libxml2";
- buildPhase = ''
- cd libbitdht/src
- qmake libbitdht.pro PREFIX=$out
- make
- cd ../..
- cd libretroshare/src
- qmake libretroshare.pro PREFIX=$out
- make
- cd ../../src
- qmake libretroshare.pro PREFIX=$out
- make
+ patchPhase = "sed -i 's/UpnpString_get_String(es_event->PublisherUrl)/es_event->PublisherUrl/' libretroshare/src/upnp/UPnPBase.cpp";
+
+ buildInputs = [ speex qt libupnp gpgme gnome3.libgnome_keyring glib libssh pkgconfig
+ protobuf bzip2 libXScrnSaver curl libxml2 libxslt ];
+
+ sourceRoot = "retroshare-0.5.5/src";
+
+ configurePhase = ''
+ qmake PREFIX=$out DESTDIR=$out RetroShare.pro
'';
+ postInstall = ''
+ mkdir -p $out/bin
+ ln -s $out/retroshare-nogui $out/bin
+ ln -s $out/RetroShare $out/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "";
+ homepage = http://retroshare.sourceforge.net/;
+ #license = licenses.bsd2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.iElectric ];
+ };
}
diff --git a/pkgs/applications/networking/p2p/transmission-remote-gtk/default.nix b/pkgs/applications/networking/p2p/transmission-remote-gtk/default.nix
index 894b1363cd04..968aba20754a 100644
--- a/pkgs/applications/networking/p2p/transmission-remote-gtk/default.nix
+++ b/pkgs/applications/networking/p2p/transmission-remote-gtk/default.nix
@@ -1,15 +1,20 @@
-{ stdenv, fetchurl, pkgconfig, intltool, gtk, json_glib, curl }:
+{ stdenv, makeWrapper, fetchurl, pkgconfig, intltool, gtk3, json_glib, curl }:
stdenv.mkDerivation rec {
- name = "transmission-remote-gtk-1.0.1";
+ name = "transmission-remote-gtk-1.1.1";
src = fetchurl {
url = "http://transmission-remote-gtk.googlecode.com/files/${name}.tar.gz";
- sha256 = "b1ae032dd52b2d7975656913e4fe39e7f74d29ef8138292d8b82318ff9afed6f";
+ sha256 = "1jbh2pm4i740cmzqd2r7zxnqqipvv2v2ndmnmk53nqrxcbgc4nlz";
};
- buildInputs = [ pkgconfig intltool gtk json_glib curl ];
+ buildInputs = [ makeWrapper pkgconfig intltool gtk3 json_glib curl ];
+
+ preFixup = ''
+ wrapProgram "$out/bin/transmission-remote-gtk" \
+ --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
+ '';
meta = {
description = "GTK remote control for the Transmission BitTorrent client";
diff --git a/pkgs/applications/networking/p2p/transmission/default.nix b/pkgs/applications/networking/p2p/transmission/default.nix
index cb439ddb4624..29fb558c83d6 100644
--- a/pkgs/applications/networking/p2p/transmission/default.nix
+++ b/pkgs/applications/networking/p2p/transmission/default.nix
@@ -27,10 +27,10 @@ stdenv.mkDerivation rec {
configureFlags = [ "--with-systemd-daemon" ]
++ optional enableGTK3 "--with-gtk";
- postInstall = optionalString enableGTK3 /* gsettings schemas for file dialogues */ ''
+ preFixup = optionalString enableGTK3 /* gsettings schemas for file dialogues */ ''
rm "$out/share/icons/hicolor/icon-theme.cache"
wrapProgram "$out/bin/transmission-gtk" \
- --prefix XDG_DATA_DIRS : "${gtk3}/share"
+ --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
'';
meta = with stdenv.lib; {
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
'';
homepage = http://www.transmissionbt.com/;
license = licenses.gpl2; # parts are under MIT
- maintainers = with maintainers; [ astsmtl vcunat ];
+ maintainers = with maintainers; [ astsmtl vcunat wizeman ];
platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/networking/remote/freerdp/default.nix b/pkgs/applications/networking/remote/freerdp/default.nix
index 8f89d70405ad..8785837fbb93 100644
--- a/pkgs/applications/networking/remote/freerdp/default.nix
+++ b/pkgs/applications/networking/remote/freerdp/default.nix
@@ -61,7 +61,5 @@ stdenv.mkDerivation rec {
homepage = http://www.freerdp.com/;
license = "free-non-copyleft";
-
- maintainers = [ stdenv.lib.maintainers.shlevy ];
};
}
diff --git a/pkgs/applications/networking/remote/freerdp/unstable.nix b/pkgs/applications/networking/remote/freerdp/unstable.nix
index cce3d23d1945..6c133e9dbb49 100644
--- a/pkgs/applications/networking/remote/freerdp/unstable.nix
+++ b/pkgs/applications/networking/remote/freerdp/unstable.nix
@@ -70,8 +70,6 @@ stdenv.mkDerivation rec {
homepage = http://www.freerdp.com/;
license = "free-non-copyleft";
-
- maintainers = [ stdenv.lib.maintainers.shlevy ];
};
}
diff --git a/pkgs/applications/networking/remote/rdesktop/default.nix b/pkgs/applications/networking/remote/rdesktop/default.nix
index c8c72160b341..9ba9e3aa3fc4 100644
--- a/pkgs/applications/networking/remote/rdesktop/default.nix
+++ b/pkgs/applications/networking/remote/rdesktop/default.nix
@@ -2,17 +2,21 @@
stdenv.mkDerivation (rec {
pname = "rdesktop";
- version = "1.7.1";
+ version = "1.8.1";
name = "${pname}-${version}";
src = fetchurl {
url = "mirror://sourceforge/${pname}/${name}.tar.gz";
- sha256 = "0yc4xz95w40m8ailpjgqp9h7bkc758vp0dlq4nj1pvr3xfnl7sni";
+ sha256 = "0il248cdsxvwjsl4bswf27ld9r1a7d48jf6bycr86kf3i55q7k3n";
};
buildInputs = [openssl libX11];
- configureFlags = [ "--with-openssl=${openssl}" ];
+ configureFlags = [
+ "--with-openssl=${openssl}"
+ "--disable-credssp"
+ "--disable-smartcard"
+ ];
meta = {
description = "rdesktop is an open source client for Windows Terminal Services";
diff --git a/pkgs/applications/networking/remote/ssvnc/default.nix b/pkgs/applications/networking/remote/ssvnc/default.nix
index b2c9b7c3e73a..619925354f06 100644
--- a/pkgs/applications/networking/remote/ssvnc/default.nix
+++ b/pkgs/applications/networking/remote/ssvnc/default.nix
@@ -1,8 +1,9 @@
-{ stdenv, fetchurl, imake, zlib, openjdk, libX11, libXt, libXmu, libXaw, libXext, libXpm, openjpeg, openssl }:
+{ stdenv, fetchurl, imake, zlib, openjdk, libX11, libXt, libXmu
+, libXaw, libXext, libXpm, openjpeg, openssl, tcl, tk }:
-let version = "1.0.29"; in
stdenv.mkDerivation rec {
name = "ssvnc-${version}";
+ version = "1.0.29";
src = fetchurl {
url = "mirror://sourceforge/ssvnc/${name}.src.tar.gz";
@@ -13,6 +14,10 @@ stdenv.mkDerivation rec {
configurePhase = "makeFlags=PREFIX=$out";
+ postInstall = ''
+ sed -i -e 's|exec wish|exec ${tk}/bin/wish|' $out/lib/ssvnc/util/ssvnc.tcl
+ '';
+
meta = {
description = "VNC viewer that adds encryption security to VNC connections";
homepage = "http://www.karlrunge.com/x11vnc/ssvnc.html";
diff --git a/pkgs/applications/networking/remote/teamviewer/default.nix b/pkgs/applications/networking/remote/teamviewer/default.nix
index 8c6295197643..1bf40eabfae4 100644
--- a/pkgs/applications/networking/remote/teamviewer/default.nix
+++ b/pkgs/applications/networking/remote/teamviewer/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchurl, libX11, libXtst, libXext, libXdamage, libXfixes, wine, makeWrapper
-, bash }:
+, bash, findutils, coreutils }:
assert stdenv.system == "i686-linux";
let
@@ -31,6 +31,13 @@ stdenv.mkDerivation {
cat > $out/bin/teamviewer << EOF
#!${bash}/bin/sh
+ # Teamviewer puts symlinks to nix store paths in ~/.teamviewer. When those
+ # paths become garbage collected, teamviewer crashes upon start because of
+ # those broken symlinks. An easy workaround to this behaviour is simply to
+ # delete all symlinks before we start teamviewer. Teamviewer will fixup the
+ # symlinks, just like it did the first time the user ran it.
+ ${findutils}/bin/find "\$HOME"/.teamviewer/*/*/"Program Files/TeamViewer/" -type l -print0 | ${findutils}/bin/xargs -0 ${coreutils}/bin/rm
+
export LD_LIBRARY_PATH=${toldpath}\''${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH}
export PATH=${topath}\''${PATH:+:\$PATH}
$out/share/teamviewer/wrapper wine "c:\Program Files\TeamViewer\Version7\TeamViewer.exe" "\$@"
diff --git a/pkgs/applications/networking/seafile-client/default.nix b/pkgs/applications/networking/seafile-client/default.nix
new file mode 100644
index 000000000000..d24437aabb6b
--- /dev/null
+++ b/pkgs/applications/networking/seafile-client/default.nix
@@ -0,0 +1,39 @@
+{stdenv, fetchurl, writeScript, pkgconfig, cmake, qt4, seafile-shared, ccnet, makeWrapper}:
+
+stdenv.mkDerivation rec
+{
+ version = "2.1.1";
+ name = "seafile-client-${version}";
+
+ src = fetchurl
+ {
+ url = "https://github.com/haiwen/seafile-client/archive/v${version}.tar.gz";
+ sha256 = "d98515ea229df702cbe973d85ec0bd5cf3f5282ef1022ba0157d5301b521c8e0";
+ };
+
+ buildInputs = [ pkgconfig cmake qt4 seafile-shared makeWrapper ];
+
+ builder = writeScript "${name}-builder.sh" ''
+ source $stdenv/setup
+
+ tar xvfz $src
+ cd seafile-client-*
+
+ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_BUILD_RPATH=ON -DCMAKE_INSTALL_PREFIX="$out" .
+ make -j1
+
+ make install
+
+ wrapProgram $out/bin/seafile-applet \
+ --suffix PATH : ${ccnet}/bin:${seafile-shared}/bin
+ '';
+
+ meta =
+ {
+ homepage = "https://github.com/haiwen/seafile-clients";
+ description = "Desktop client for Seafile, the Next-generation Open Source Cloud Storage";
+ license = stdenv.lib.licenses.asl20;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.calrama ];
+ };
+}
diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index ed2ce4c12c00..256681ec54e2 100644
--- a/pkgs/applications/networking/sniffers/wireshark/default.nix
+++ b/pkgs/applications/networking/sniffers/wireshark/default.nix
@@ -17,6 +17,10 @@ stdenv.mkDerivation {
geoip libnl c-ares gtk python
];
+ preConfigure = ''
+ sed -re 's/g_memmove/memmove/' -i $(grep -rl g_memmove .)
+ '';
+
configureFlags = "--disable-usr-local --disable-silent-rules --with-gtk2 --without-gtk3 --without-qt --with-ssl";
desktopItem = makeDesktopItem {
diff --git a/pkgs/applications/networking/sync/rsync/default.nix b/pkgs/applications/networking/sync/rsync/default.nix
index 5447b21009ff..5265faf87b6f 100644
--- a/pkgs/applications/networking/sync/rsync/default.nix
+++ b/pkgs/applications/networking/sync/rsync/default.nix
@@ -6,16 +6,17 @@
assert enableACLs -> acl != null;
stdenv.mkDerivation rec {
- name = "rsync-3.0.9";
+ name = "rsync-${version}";
+ version = "3.1.0";
mainSrc = fetchurl {
- url = http://rsync.samba.org/ftp/rsync/src/rsync-3.0.9.tar.gz;
- sha256 = "01bw4klqsrlhh3i9lazd485sd9qx5djvnwa21lj2h3a9sn6hzw9h";
+ url = "http://rsync.samba.org/ftp/rsync/src/rsync-${version}.tar.gz";
+ sha256 = "0kirw8wglqvwi1v8bwxp373g03xg857h59j5k3mmgff9gzvj7jl1";
};
patchesSrc = fetchurl {
- url = http://rsync.samba.org/ftp/rsync/rsync-patches-3.0.9.tar.gz;
- sha256 = "0c1e9b56e99667dfc47641124460bac61a04c5d2ee89f575c6bc78c7a69005a9";
+ url = "http://rsync.samba.org/ftp/rsync/rsync-patches-${version}.tar.gz";
+ sha256 = "0sl8aadpjblvbb05vgais40z90yzhr09rwz0cykjdiv452gli75p";
};
srcs = [mainSrc] ++ stdenv.lib.optional enableCopyDevicesPatch patchesSrc;
@@ -30,6 +31,6 @@ stdenv.mkDerivation rec {
license = stdenv.lib.licenses.gpl3Plus;
platforms = stdenv.lib.platforms.unix;
- maintainers = [ stdenv.lib.maintainers.simons ];
+ maintainers = [ stdenv.lib.maintainers.simons stdenv.lib.maintainers.emery ];
};
}
diff --git a/pkgs/applications/networking/sync/unison/default.nix b/pkgs/applications/networking/sync/unison/default.nix
index 35dd2d2a7d02..744c8c01efa5 100644
--- a/pkgs/applications/networking/sync/unison/default.nix
+++ b/pkgs/applications/networking/sync/unison/default.nix
@@ -3,10 +3,10 @@
stdenv.mkDerivation (rec {
- name = "unison-2.40.63";
+ name = "unison-2.40.102";
src = fetchurl {
- url = "http://www.seas.upenn.edu/~bcpierce/unison/download/releases/${name}/${name}.tar.gz";
- sha256 = "17fd2bg5jxwbib87j6j2bjpwdm66whqm1fq46v70hfby79j00vkf";
+ url = "http://www.seas.upenn.edu/~bcpierce/unison/download/releases/stable/${name}.tar.gz";
+ sha256 = "0m78q5vnsric1virvkmxxx32ipaq0cnj0kbirdbg36395gq94jix";
};
buildInputs = [ ocaml makeWrapper ncurses ];
diff --git a/pkgs/applications/networking/syncthing/default.nix b/pkgs/applications/networking/syncthing/default.nix
new file mode 100644
index 000000000000..50bc61eeeff0
--- /dev/null
+++ b/pkgs/applications/networking/syncthing/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, fetchgit, go }:
+
+stdenv.mkDerivation rec {
+ name = "syncthing-${version}";
+ version = "0.7.1";
+
+ src = fetchgit {
+ url = "git://github.com/calmh/syncthing.git";
+ rev = "refs/tags/v${version}";
+ sha256 = "1rja837kimiq15km8cridbm5yxvkm6mkvkwywdi76qf9rm0pcjl1";
+ };
+
+ buildInputs = [ go ];
+
+ buildPhase = ''
+ mkdir -p "./dependencies/src/github.com/calmh/syncthing"
+
+ cp -r "./auto" "./dependencies/src/github.com/calmh/syncthing"
+ cp -r "./buffers" "./dependencies/src/github.com/calmh/syncthing"
+ cp -r "./cid" "./dependencies/src/github.com/calmh/syncthing"
+ cp -r "./discover" "./dependencies/src/github.com/calmh/syncthing"
+ cp -r "./files" "./dependencies/src/github.com/calmh/syncthing"
+ cp -r "./lamport" "./dependencies/src/github.com/calmh/syncthing"
+ cp -r "./protocol" "./dependencies/src/github.com/calmh/syncthing"
+ cp -r "./scanner" "./dependencies/src/github.com/calmh/syncthing"
+ cp -r "./mc" "./dependencies/src/github.com/calmh/syncthing"
+ cp -r "./xdr" "./dependencies/src/github.com/calmh/syncthing"
+
+ export GOPATH="`pwd`/Godeps/_workspace:`pwd`/dependencies"
+
+ go test -cpu=1,2,4 ./...
+
+ mkdir ./bin
+
+ go build -o ./bin/syncthing -ldflags "-w -X main.Version v${version}" ./cmd/syncthing
+ go build -o ./bin/stcli -ldflags "-w -X main.Version v${version}" ./cmd/stcli
+ '';
+
+ installPhase = ''
+ ensureDir $out/bin
+ cp -r ./bin $out
+ '';
+
+ meta = {
+ homepage = http://syncthing.net/;
+ description = "Syncthing replaces Dropbox and BitTorrent Sync with something open, trustworthy and decentralized";
+ license = with stdenv.lib.licenses; mit;
+ maintainers = with stdenv.lib.maintainers; [ matejc ];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/pkgs/applications/networking/yafc/default.nix b/pkgs/applications/networking/yafc/default.nix
index bdbb53d1675f..752a7824e6f0 100644
--- a/pkgs/applications/networking/yafc/default.nix
+++ b/pkgs/applications/networking/yafc/default.nix
@@ -1,13 +1,13 @@
-{stdenv, fetchurl, readline, libssh, intltool}:
+{stdenv, fetchurl, readline, libssh, intltool, libbsd}:
stdenv.mkDerivation rec {
- name = "yafc-1.2.3";
+ name = "yafc-1.3.2";
src = fetchurl {
- url = "https://github.com/downloads/sebastinas/yafc/${name}.tar.xz";
- sha256 = "11h5r9ragfpil338kq981wxnifacflqfwgydhmy00b3fbdlnxzsi";
+ url = "http://www.yafc-ftp.com/upload/${name}.tar.xz";
+ sha256 = "0rrhik00xynxg5s3ffqlyynvy8ssv8zfaixkpb77baxa274gnbd7";
};
- buildInputs = [ readline libssh intltool ];
+ buildInputs = [ readline libssh intltool libbsd ];
meta = {
description = "ftp/sftp client with readline, autocompletion and bookmarks";
diff --git a/pkgs/applications/networking/znc/default.nix b/pkgs/applications/networking/znc/default.nix
index a43d8fa9d11d..dbf886de9786 100644
--- a/pkgs/applications/networking/znc/default.nix
+++ b/pkgs/applications/networking/znc/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, openssl, pkgconfig
+{ stdenv, fetchurl, openssl, pkgconfig
, withPerl ? false, perl
, withPython ? false, python3
, withTcl ? false, tcl
@@ -7,10 +7,11 @@
with stdenv.lib;
stdenv.mkDerivation rec {
- name = "znc-1.0";
+ name = "znc-1.2";
+
src = fetchurl {
url = "http://znc.in/releases/${name}.tar.gz";
- sha256 = "0ah6890ngvj97kah3x7fd8yzi6dpdgrxw1b2skj2cyv98bd3jmd8";
+ sha256 = "07bh306wl5494sqsgz4a526wvyrylkc8vpnbr5pkxwjg90mcv8nr";
};
buildInputs = [ openssl pkgconfig ]
@@ -24,11 +25,11 @@ stdenv.mkDerivation rec {
+ optionalString withTcl "--enable-tcl --with-tcl=${tcl}/lib "
+ optionalString withCyrus "--enable-cyrus ";
- meta = {
+ meta = with stdenv.lib; {
description = "Advanced IRC bouncer";
homepage = http://wiki.znc.in/ZNC;
- maintainers = [ stdenv.lib.maintainers.viric ];
- license = "ASL2.0";
- platforms = stdenv.lib.platforms.unix;
+ maintainers = with maintainers; [ viric ];
+ license = licenses.asl20;
+ platforms = platforms.unix;
};
}
diff --git a/pkgs/applications/office/calligra/default.nix b/pkgs/applications/office/calligra/default.nix
index 137e7be019fa..e87053d53264 100644
--- a/pkgs/applications/office/calligra/default.nix
+++ b/pkgs/applications/office/calligra/default.nix
@@ -6,11 +6,11 @@
}:
stdenv.mkDerivation rec {
- name = "calligra-2.7.2";
+ name = "calligra-2.7.5";
src = fetchurl {
url = "mirror://kde/stable/${name}/${name}.tar.xz";
- sha256 = "1awnvv62fp5bjhi6fys37s6lpzxaig4v15m1zjlgxq82ig61w6sq";
+ sha256 = "0png8ac10xywxsml1z18as18kc9k9162l6an67hi6lgx0rv27ldi";
};
nativeBuildInputs = [ cmake perl pkgconfig ];
diff --git a/pkgs/applications/office/gnucash/default.nix b/pkgs/applications/office/gnucash/default.nix
index c8ebe6e2b12c..ee0475d45ec0 100644
--- a/pkgs/applications/office/gnucash/default.nix
+++ b/pkgs/applications/office/gnucash/default.nix
@@ -1,7 +1,7 @@
{ fetchurl, stdenv, pkgconfig, libxml2, gconf, glib, gtk, libgnomeui, libofx
, libgtkhtml, gtkhtml, libgnomeprint, goffice, enchant, gettext, libbonoboui
, intltool, perl, guile, slibGuile, swig, isocodes, bzip2, makeWrapper, libglade
-, libgsf, libart_lgpl, perlPackages
+, libgsf, libart_lgpl, perlPackages, aqbanking, gwenhywfar
}:
/* If you experience GConf errors when running GnuCash on NixOS, see
@@ -21,10 +21,10 @@ stdenv.mkDerivation rec {
pkgconfig libxml2 gconf glib gtk libgnomeui libgtkhtml gtkhtml
libgnomeprint goffice enchant gettext intltool perl guile slibGuile
swig isocodes bzip2 makeWrapper libofx libglade libgsf libart_lgpl
- perlPackages.DateManip perlPackages.FinanceQuote
+ perlPackages.DateManip perlPackages.FinanceQuote aqbanking gwenhywfar
];
- configureFlags = "CFLAGS=-O3 CXXFLAGS=-O3 --disable-dbi --enable-ofx";
+ configureFlags = "CFLAGS=-O3 CXXFLAGS=-O3 --disable-dbi --enable-ofx --enable-aqbanking";
postInstall = ''
# Auto-updaters don't make sense in Nix.
diff --git a/pkgs/applications/office/gnumeric/default.nix b/pkgs/applications/office/gnumeric/default.nix
index 0108f934693e..014aa5bf0fd2 100644
--- a/pkgs/applications/office/gnumeric/default.nix
+++ b/pkgs/applications/office/gnumeric/default.nix
@@ -3,11 +3,11 @@
}:
stdenv.mkDerivation rec {
- name = "gnumeric-1.12.9";
+ name = "gnumeric-1.12.12";
src = fetchurl {
url = "mirror://gnome/sources/gnumeric/1.12/${name}.tar.xz";
- sha256 = "1rv2ifw6rp0iza4fkf3bffvdkyi77dwvzdnvcbpqcyn2kxfsvlsc";
+ sha256 = "096i9x6b4i6x24vc4lsxx8fg2n2pjs2jb6x3bkg3ppa2c60w1jq0";
};
preConfigure = ''sed -i 's/\(SUBDIRS.*\) doc/\1/' Makefile.in''; # fails when installing docs
@@ -20,9 +20,12 @@ stdenv.mkDerivation rec {
goffice gtk3 makeWrapper
];
- postInstall = ''
- wrapProgram "$out"/bin/gnumeric-* \
- --prefix XDG_DATA_DIRS : "${gtk3}/share:${gnome_icon_theme}/share"
+ preFixup = ''
+ for f in "$out"/bin/gnumeric-*; do
+ wrapProgram $f \
+ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH"
+ done
+ rm $out/share/icons/hicolor/icon-theme.cache
'';
meta = with stdenv.lib; {
diff --git a/pkgs/applications/office/homebank/default.nix b/pkgs/applications/office/homebank/default.nix
index d531a327d7cc..5e5c98e82601 100644
--- a/pkgs/applications/office/homebank/default.nix
+++ b/pkgs/applications/office/homebank/default.nix
@@ -2,7 +2,7 @@
let
download_root = "http://homebank.free.fr/public/";
- name = "homebank-4.5.4";
+ name = "homebank-4.5.5";
lastrelease = download_root + name + ".tar.gz";
oldrelease = download_root + "old/" + name + ".tar.gz";
in
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
src = fetchurl {
urls = [ lastrelease oldrelease ];
- sha256 = "10xh76mxwbl56xp118gg3b4isv16yvhsvqxwqc28pqqxkpr7vpdk";
+ sha256 = "05k4497qsb6fzr662h9yxz1amsavd287wh0sabrpr9jdbh3jcfkg";
};
buildInputs = [ pkgconfig gtk libofx intltool ];
diff --git a/pkgs/applications/office/kmymoney/default.nix b/pkgs/applications/office/kmymoney/default.nix
index d55c66a26246..87e3bfd53126 100644
--- a/pkgs/applications/office/kmymoney/default.nix
+++ b/pkgs/applications/office/kmymoney/default.nix
@@ -1,20 +1,22 @@
{ stdenv, fetchurl, cmake, kdelibs, automoc4, kdepimlibs, gettext, pkgconfig
-, shared_mime_info, perl, boost, gpgme, gmpxx, libalkimia, libofx, libical }:
+, shared_mime_info, perl, boost, gpgme, gmpxx, libalkimia, libofx, libical
+, doxygen }:
stdenv.mkDerivation rec {
- name = "kmymoney-4.6.2";
+ name = "kmymoney-4.6.4";
src = fetchurl {
- url = "mirror://sourceforge/kmymoney2/${name}.tar.bz2";
- sha256 = "0x9bl4h2mk8dv49nnn7drv528fnl5ynvvyy7q4m22k0d5yxarn5d";
+ url = "mirror://sourceforge/kmymoney2/${name}.tar.xz";
+ sha256 = "04n0lgi2yrx67bgjzbdbcm10pxs7l53srmp240znzw59njnjyll9";
};
- buildInputs = [ kdepimlibs perl boost gpgme gmpxx libalkimia libofx libical ];
+ buildInputs = [ kdepimlibs perl boost gpgme gmpxx libalkimia libofx libical
+ doxygen ];
nativeBuildInputs = [ cmake automoc4 gettext shared_mime_info pkgconfig ];
KDEDIRS = libalkimia;
- patches = [ ./qgpgme.patch ./qt-4.8.patch ];
+ patches = [ ./qgpgme.patch ];
meta = {
homepage = http://kmymoney2.sourceforge.net/;
diff --git a/pkgs/applications/office/kmymoney/qt-4.8.patch b/pkgs/applications/office/kmymoney/qt-4.8.patch
deleted file mode 100644
index 7e9a44337cd9..000000000000
--- a/pkgs/applications/office/kmymoney/qt-4.8.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From: Christoph Feck
-Date: Thu, 10 Nov 2011 11:34:20 +0000
-Subject: Fix compile with Qt 4.8
-X-Git-Url: http://quickgit.kde.org/?p=kmymoney.git&a=commitdiff&h=8324cfb9657d8c03f83691402386e8c5bfb29981
----
-Fix compile with Qt 4.8
-
-Sideported commits f42a0a3d878afebb298609c9886851858c56cc15 and
-fe74b25bf3b78c42e95569fe467a397876bc9c04 from massif-visualizer
----
-
-
---- a/libkdchart/src/KDChartBackgroundAttributes.cpp
-+++ b/libkdchart/src/KDChartBackgroundAttributes.cpp
-@@ -22,6 +22,7 @@
-
- #include "KDChartBackgroundAttributes.h"
- #include
-+#include
-
- #include
-
-@@ -150,7 +151,7 @@ QDebug operator<<(QDebug dbg, const KDCh
- << "visible="<)
+
+ get_target_property(TARGETS_PUBLIC_HEADERS ${target} PUBLIC_HEADER)
++ set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON)
+ if (EXISTS "${TARGETS_PUBLIC_HEADERS}")
+ list(APPEND stp_public_headers "${TARGETS_PUBLIC_HEADERS}")
+ message("Adding public header(s) ${TARGETS_PUBLIC_HEADERS} to target libstp")
+diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt
+index 0735137..73039f5 100644
+--- a/src/main/CMakeLists.txt
++++ b/src/main/CMakeLists.txt
+@@ -3,12 +3,6 @@ include_directories(${CMAKE_BINARY_DIR}/src/AST/)
+
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GitSHA1.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp" @ONLY)
+
+-add_library(globalstp OBJECT
+- Globals.cpp
+- ${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp
+-)
+-add_dependencies(globalstp ASTKind_header)
+-
+ # -----------------------------------------------------------------------------
+ # Create binary
+ # -----------------------------------------------------------------------------
diff --git a/pkgs/applications/science/logic/stp/fixrefs.diff b/pkgs/applications/science/logic/stp/fixrefs.diff
new file mode 100644
index 000000000000..60ad4949f076
--- /dev/null
+++ b/pkgs/applications/science/logic/stp/fixrefs.diff
@@ -0,0 +1,192 @@
+commit 53b6043e25b2eba264faab845077fbf6736cf22f
+Author: Petr Rockai
+Date: Tue Jan 7 13:30:07 2014 +0100
+
+ aig: Comment out unused functions with undefined references in them.
+
+diff --git a/src/extlib-abc/aig/aig/aigPart.c b/src/extlib-abc/aig/aig/aigPart.c
+index a4cc116..5bd5f08 100644
+--- a/src/extlib-abc/aig/aig/aigPart.c
++++ b/src/extlib-abc/aig/aig/aigPart.c
+@@ -869,6 +869,7 @@ Vec_Ptr_t * Aig_ManMiterPartitioned( Aig_Man_t * p1, Aig_Man_t * p2, int nPartSi
+ SeeAlso []
+
+ ***********************************************************************/
++#if 0
+ Aig_Man_t * Aig_ManChoicePartitioned( Vec_Ptr_t * vAigs, int nPartSize )
+ {
+ extern int Cmd_CommandExecute( void * pAbc, char * sCommand );
+@@ -981,6 +982,7 @@ Aig_Man_t * Aig_ManChoicePartitioned( Vec_Ptr_t * vAigs, int nPartSize )
+ Aig_ManMarkValidChoices( pAig );
+ return pAig;
+ }
++#endif
+
+
+ ////////////////////////////////////////////////////////////////////////
+diff --git a/src/extlib-abc/aig/aig/aigShow.c b/src/extlib-abc/aig/aig/aigShow.c
+index ae8fa8b..f04eedc 100644
+--- a/src/extlib-abc/aig/aig/aigShow.c
++++ b/src/extlib-abc/aig/aig/aigShow.c
+@@ -326,6 +326,7 @@ void Aig_WriteDotAig( Aig_Man_t * pMan, char * pFileName, int fHaig, Vec_Ptr_t *
+ SeeAlso []
+
+ ***********************************************************************/
++#if 0
+ void Aig_ManShow( Aig_Man_t * pMan, int fHaig, Vec_Ptr_t * vBold )
+ {
+ extern void Abc_ShowFile( char * FileNameDot );
+@@ -347,7 +348,7 @@ void Aig_ManShow( Aig_Man_t * pMan, int fHaig, Vec_Ptr_t * vBold )
+ // visualize the file
+ Abc_ShowFile( FileNameDot );
+ }
+-
++#endif
+
+ ////////////////////////////////////////////////////////////////////////
+ /// END OF FILE ///
+diff --git a/src/extlib-abc/aig/dar/darRefact.c b/src/extlib-abc/aig/dar/darRefact.c
+index d744b4f..23fc3d5 100644
+--- a/src/extlib-abc/aig/dar/darRefact.c
++++ b/src/extlib-abc/aig/dar/darRefact.c
+@@ -340,6 +340,7 @@ printf( "\n" );
+ SeeAlso []
+
+ ***********************************************************************/
++#if 0
+ int Dar_ManRefactorTryCuts( Ref_Man_t * p, Aig_Obj_t * pObj, int nNodesSaved, int Required )
+ {
+ Vec_Ptr_t * vCut;
+@@ -428,6 +429,7 @@ int Dar_ManRefactorTryCuts( Ref_Man_t * p, Aig_Obj_t * pObj, int nNodesSaved, in
+ }
+ return p->GainBest;
+ }
++#endif
+
+ /**Function*************************************************************
+
+@@ -461,6 +463,7 @@ int Dar_ObjCutLevelAchieved( Vec_Ptr_t * vCut, int nLevelMin )
+ SeeAlso []
+
+ ***********************************************************************/
++#if 0
+ int Dar_ManRefactor( Aig_Man_t * pAig, Dar_RefPar_t * pPars )
+ {
+ // Bar_Progress_t * pProgress;
+@@ -583,6 +586,7 @@ p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
+ return 1;
+
+ }
++#endif
+
+ ////////////////////////////////////////////////////////////////////////
+ /// END OF FILE ///
+diff --git a/src/extlib-abc/aig/dar/darScript.c b/src/extlib-abc/aig/dar/darScript.c
+index e60df00..1b9c24f 100644
+--- a/src/extlib-abc/aig/dar/darScript.c
++++ b/src/extlib-abc/aig/dar/darScript.c
+@@ -64,6 +64,7 @@ Aig_Man_t * Dar_ManRewriteDefault( Aig_Man_t * pAig )
+ SeeAlso []
+
+ ***********************************************************************/
++#if 0
+ Aig_Man_t * Dar_ManRwsat( Aig_Man_t * pAig, int fBalance, int fVerbose )
+ //alias rwsat "st; rw -l; b -l; rw -l; rf -l"
+ {
+@@ -108,7 +109,7 @@ Aig_Man_t * Dar_ManRwsat( Aig_Man_t * pAig, int fBalance, int fVerbose )
+
+ return pAig;
+ }
+-
++#endif
+
+ /**Function*************************************************************
+
+@@ -121,6 +122,7 @@ Aig_Man_t * Dar_ManRwsat( Aig_Man_t * pAig, int fBalance, int fVerbose )
+ SeeAlso []
+
+ ***********************************************************************/
++#if 0
+ Aig_Man_t * Dar_ManCompress( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fVerbose )
+ //alias compress2 "b -l; rw -l; rwz -l; b -l; rwz -l; b -l"
+ {
+@@ -180,6 +182,7 @@ Aig_Man_t * Dar_ManCompress( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, i
+
+ return pAig;
+ }
++#endif
+
+ /**Function*************************************************************
+
+@@ -192,6 +195,7 @@ Aig_Man_t * Dar_ManCompress( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, i
+ SeeAlso []
+
+ ***********************************************************************/
++#if 0
+ Aig_Man_t * Dar_ManCompress2( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fVerbose )
+ //alias compress2 "b -l; rw -l; rf -l; b -l; rw -l; rwz -l; b -l; rfz -l; rwz -l; b -l"
+ {
+@@ -285,6 +289,7 @@ Aig_Man_t * Dar_ManCompress2( Aig_Man_t * pAig, int fBalance, int fUpdateLevel,
+ }
+ return pAig;
+ }
++#endif
+
+ /**Function*************************************************************
+
+@@ -297,6 +302,7 @@ Aig_Man_t * Dar_ManCompress2( Aig_Man_t * pAig, int fBalance, int fUpdateLevel,
+ SeeAlso []
+
+ ***********************************************************************/
++#if 0
+ Vec_Ptr_t * Dar_ManChoiceSynthesis( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fVerbose )
+ //alias resyn "b; rw; rwz; b; rwz; b"
+ //alias resyn2 "b; rw; rf; b; rw; rwz; b; rfz; rwz; b"
+@@ -311,6 +317,7 @@ Vec_Ptr_t * Dar_ManChoiceSynthesis( Aig_Man_t * pAig, int fBalance, int fUpdateL
+ Vec_PtrPush( vAigs, pAig );
+ return vAigs;
+ }
++#endif
+
+ /**Function*************************************************************
+
+diff --git a/src/extlib-abc/aig/kit/kitAig.c b/src/extlib-abc/aig/kit/kitAig.c
+index de301f2..7e5df0f 100644
+--- a/src/extlib-abc/aig/kit/kitAig.c
++++ b/src/extlib-abc/aig/kit/kitAig.c
+@@ -95,6 +95,7 @@ Aig_Obj_t * Kit_GraphToAig( Aig_Man_t * pMan, Aig_Obj_t ** pFanins, Kit_Graph_t
+ SeeAlso []
+
+ ***********************************************************************/
++#if 0
+ Aig_Obj_t * Kit_TruthToAig( Aig_Man_t * pMan, Aig_Obj_t ** pFanins, unsigned * pTruth, int nVars, Vec_Int_t * vMemory )
+ {
+ Aig_Obj_t * pObj;
+@@ -113,6 +114,7 @@ Aig_Obj_t * Kit_TruthToAig( Aig_Man_t * pMan, Aig_Obj_t ** pFanins, unsigned * p
+ Kit_GraphFree( pGraph );
+ return pObj;
+ }
++#endif
+
+ ////////////////////////////////////////////////////////////////////////
+ /// END OF FILE ///
+diff --git a/src/extlib-abc/aig/kit/kitGraph.c b/src/extlib-abc/aig/kit/kitGraph.c
+index 39ef587..0485c66 100644
+--- a/src/extlib-abc/aig/kit/kitGraph.c
++++ b/src/extlib-abc/aig/kit/kitGraph.c
+@@ -349,6 +349,7 @@ unsigned Kit_GraphToTruth( Kit_Graph_t * pGraph )
+ SeeAlso []
+
+ ***********************************************************************/
++#if 0
+ Kit_Graph_t * Kit_TruthToGraph( unsigned * pTruth, int nVars, Vec_Int_t * vMemory )
+ {
+ Kit_Graph_t * pGraph;
+@@ -365,6 +366,7 @@ Kit_Graph_t * Kit_TruthToGraph( unsigned * pTruth, int nVars, Vec_Int_t * vMemor
+ pGraph = Kit_SopFactor( vMemory, RetValue, nVars, vMemory );
+ return pGraph;
+ }
++#endif
+
+ /**Function*************************************************************
+
diff --git a/pkgs/applications/science/logic/z3/default.nix b/pkgs/applications/science/logic/z3/default.nix
new file mode 100644
index 000000000000..eeef03eb1619
--- /dev/null
+++ b/pkgs/applications/science/logic/z3/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, python, unzip, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+ name = "z3-${version}";
+ version = "4.3.1";
+ src = fetchurl {
+ url = "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx\?ProjectName\=z3\&changeSetId\=89c1785b73225a1b363c0e485f854613121b70a7";
+ name = "${name}.zip";
+ sha256 = "3b94465c52ec174350d8707dd6a1fb0cef42f0fa23f148cc1808c14f3c2c7f76";
+ };
+
+ buildInputs = [ python unzip autoreconfHook ];
+ enableParallelBuilding = true;
+
+ # The zip file doesn't unpack a directory, just the code itself.
+ unpackPhase = "mkdir ${name} && cd ${name} && unzip $src";
+ postConfigure = ''
+ python scripts/mk_make.py
+ cd build
+ '';
+
+ # z3's install phase is stupid because it tries to calculate the
+ # python package store location itself, meaning it'll attempt to
+ # write files into the nix store, and fail.
+ soext = if stdenv.system == "x86_64-darwin" then ".dylib" else ".so";
+ installPhase = ''
+ mkdir -p $out/bin $out/lib/${python.libPrefix}/site-packages $out/include
+ cp ../src/api/z3.h $out/include
+ cp ../src/api/z3_api.h $out/include
+ cp ../src/api/z3_v1.h $out/include
+ cp ../src/api/z3_macros.h $out/include
+ cp ../src/api/c++/z3++.h $out/include
+ cp z3 $out/bin
+ cp libz3${soext} $out/lib
+ cp libz3${soext} $out/lib/${python.libPrefix}/site-packages
+ cp z3*.pyc $out/lib/${python.libPrefix}/site-packages
+ '';
+
+ meta = {
+ description = "Z3 is a high-performance theorem prover and SMT solver";
+ homepage = "http://z3.codeplex.com";
+ license = stdenv.lib.licenses.unfreeRedistributable;
+ platforms = stdenv.lib.platforms.unix;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ };
+}
diff --git a/pkgs/applications/science/math/R/default.nix b/pkgs/applications/science/math/R/default.nix
index 6c8ec9e68c53..4a58c15941c8 100644
--- a/pkgs/applications/science/math/R/default.nix
+++ b/pkgs/applications/science/math/R/default.nix
@@ -5,11 +5,11 @@
}:
stdenv.mkDerivation rec {
- name = "R-3.0.2";
+ name = "R-3.1.0";
src = fetchurl {
url = "http://cran.r-project.org/src/base/R-3/${name}.tar.gz";
- sha256 = "0jq2vk6bgksbvgmdjvv7vfj6llp091d0nhl5j825aya4c2nhavlm";
+ sha256 = "1qjzbw341bvi1h4jwbvdkvq8j0z9l3m85mpgrlfw0n2cz2806s4a";
};
buildInputs = [ blas bzip2 gfortran liblapack libX11 libXmu libXt
diff --git a/pkgs/applications/science/math/fricas/default.nix b/pkgs/applications/science/math/fricas/default.nix
new file mode 100644
index 000000000000..1817c43ed7be
--- /dev/null
+++ b/pkgs/applications/science/math/fricas/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, sbcl, libX11, libXpm, libICE, libSM, libXt, libXau, libXdmcp }:
+
+stdenv.mkDerivation rec {
+ name = "fricas-1.2.2";
+
+ src = fetchurl {
+ url = "http://sourceforge.net/projects/fricas/files/fricas/1.2.2/${name}-full.tar.bz2";
+ sha256 = "87db64a1fd4211f3b776793acea931b4271d2e7a28396414c7d7397d833defe1";
+ };
+
+ buildInputs = [ sbcl libX11 libXpm libICE libSM libXt libXau libXdmcp ];
+
+ dontStrip = true;
+
+ meta = {
+ homepage = http://fricas.sourceforge.net/;
+ description = "Fricas CAS";
+ license = stdenv.lib.licenses.bsd3;
+
+ hydraPlatforms = stdenv.lib.platforms.linux;
+ maintainers = stdenv.lib.maintainers.sprock;
+ };
+}
diff --git a/pkgs/applications/science/math/maxima/default.nix b/pkgs/applications/science/math/maxima/default.nix
index 684ac321900f..7123b476f356 100644
--- a/pkgs/applications/science/math/maxima/default.nix
+++ b/pkgs/applications/science/math/maxima/default.nix
@@ -2,7 +2,7 @@
let
name = "maxima";
- version = "5.32.1";
+ version = "5.33.0";
searchPath =
stdenv.lib.makeSearchPath "bin"
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = "mirror://sourceforge/${name}/${name}-${version}.tar.gz";
- sha256 = "0krxha1jckgw5s52bjasf7bnkcnq81qyi2k1bcglgqzfp79b44gw";
+ sha256 = "13axm11xw0f3frx5b0qdidi7igkn1524fzz77s9rbpl2yy2nrbz2";
};
buildInputs = [sbcl texinfo perl makeWrapper];
diff --git a/pkgs/applications/science/math/pssp/default.nix b/pkgs/applications/science/math/pssp/default.nix
index 587f41fe998b..0a9e0e4735d0 100644
--- a/pkgs/applications/science/math/pssp/default.nix
+++ b/pkgs/applications/science/math/pssp/default.nix
@@ -3,11 +3,11 @@
}:
stdenv.mkDerivation rec {
- name = "pspp-0.8.1";
+ name = "pspp-0.8.2";
src = fetchurl {
url = "mirror://gnu/pspp/${name}.tar.gz";
- sha256 = "0qhxsdbwxd3cn1shc13wxvx2lg32lp4z6sz24kv3jz7p5xfi8j7x";
+ sha256 = "1w7h3dglgx0jlq1wb605b8pgfsk2vr1q2q2rj7bsajh9ihbcsixr";
};
buildInputs = [ libxml2 readline zlib perl cairo gtk gsl pkgconfig
diff --git a/pkgs/applications/science/math/sloane/default.nix b/pkgs/applications/science/math/sloane/default.nix
new file mode 100644
index 000000000000..1e318bd8a79f
--- /dev/null
+++ b/pkgs/applications/science/math/sloane/default.nix
@@ -0,0 +1,21 @@
+{ cabal, ansiTerminal, cmdargs, HTTP, terminalSize, url }:
+
+cabal.mkDerivation (self: {
+ pname = "sloane";
+ version = "1.6";
+ sha256 = "0my3j53bda3s8zxnm6is1align4k082wwsfg2y1i75js5z9kwmzy";
+ isLibrary = false;
+ isExecutable = true;
+ buildDepends = [ ansiTerminal cmdargs HTTP terminalSize url ];
+ postInstall = ''
+ mkdir -p $out/share/man/man1
+ cp sloane.1 $out/share/man/man1/
+ '';
+ meta = {
+ homepage = "http://github.com/akc/sloane";
+ description = "A command line interface to Sloane's On-Line Encyclopedia of Integer Sequences";
+ license = self.stdenv.lib.licenses.bsd3;
+ platforms = self.ghc.meta.platforms;
+ maintainers = with self.stdenv.lib.maintainers; [ akc ];
+ };
+})
diff --git a/pkgs/applications/science/misc/megam/default.nix b/pkgs/applications/science/misc/megam/default.nix
new file mode 100644
index 000000000000..a0ee505dc97f
--- /dev/null
+++ b/pkgs/applications/science/misc/megam/default.nix
@@ -0,0 +1,46 @@
+{ fetchurl, stdenv, ocaml, makeWrapper, ncurses }:
+
+let version = "0.92"; in
+stdenv.mkDerivation rec {
+ name = "megam-${version}";
+
+ src = fetchurl {
+ url = "http://hal3.name/megam/megam_src.tgz";
+ sha256 = "dc0e9f59ff8513449fe3bd40b260141f89c88a4edf6ddc8b8a394c758e49724e";
+ };
+
+ patches = [ ./ocaml-includes.patch ./ocaml-3.12.patch ];
+
+ buildInputs = [ ocaml ncurses ];
+
+ nativeBuildInputs = [ makeWrapper ];
+
+ makeFlags = "CAML_INCLUDES=${ocaml}/lib/ocaml/caml";
+
+ # see https://bugzilla.redhat.com/show_bug.cgi?id=435559
+ dontStrip = true;
+
+ installPhase = ''
+ mkdir -pv $out/bin
+ cp -Rv megam $out/bin
+ '';
+
+
+ meta = {
+ description = "MEGA Model Optimization Package";
+
+ longDescription =
+ '' The software here is an implementation of maximum likelihood
+ and maximum a posterior optimization of the parameters of
+ these models. The algorithms used are much more efficient
+ than the iterative scaling techniques used in almost every
+ other maxent package out there. '';
+
+ homepage = http://www.umiacs.umd.edu/~hal/megam;
+
+ license = "non-commercial";
+
+ maintainers = [ ];
+ platforms = stdenv.lib.platforms.gnu; # arbitrary choice
+ };
+}
diff --git a/pkgs/applications/science/misc/megam/ocaml-3.12.patch b/pkgs/applications/science/misc/megam/ocaml-3.12.patch
new file mode 100644
index 000000000000..8265acf6e4a7
--- /dev/null
+++ b/pkgs/applications/science/misc/megam/ocaml-3.12.patch
@@ -0,0 +1,12 @@
+diff -ru megam_0.92/Makefile megam_0.92-b/Makefile
+--- megam_0.92/Makefile 2007-10-08 18:06:04.000000000 +0100
++++ megam_0.92-b/Makefile 2013-11-25 10:14:20.000000000 +0000
+@@ -59,7 +59,7 @@
+
+ WITHUNIX =unix.cma -cclib -lunix
+
+-WITHSTR =str.cma -cclib -lstr
++WITHSTR =str.cma -cclib -lcamlstr
+
+ WITHBIGARRAY =bigarray.cma -cclib -lbigarray
+
diff --git a/pkgs/applications/science/misc/megam/ocaml-includes.patch b/pkgs/applications/science/misc/megam/ocaml-includes.patch
new file mode 100644
index 000000000000..b3a56643448c
--- /dev/null
+++ b/pkgs/applications/science/misc/megam/ocaml-includes.patch
@@ -0,0 +1,21 @@
+diff -ru megam_0.92/Makefile megam_0.92-b/Makefile
+--- megam_0.92/Makefile 2007-10-08 18:06:04.000000000 +0100
++++ megam_0.92-b/Makefile 2013-11-25 10:14:20.000000000 +0000
+@@ -41,7 +41,7 @@
+ #
+ # The Caml compilers. #
+ # You may fix here the path to access the Caml compiler on your machine
+-CAMLC = ocamlc -g
++CAMLC = ocamlc -g $(WITHCLIBS)
+ CAMLOPT = ocamlopt -unsafe -ccopt -O4 -ccopt -ffast-math -inline 99999
+ CAMLDEP = ocamldep
+ CAMLLEX = ocamllex
+@@ -70,7 +70,7 @@
+ WITHDBM =dbm.cma -cclib -lmldbm -cclib -lndbm
+
+ #WITHCLIBS =-I /usr/lib/ocaml/3.09.2/caml
+-WITHCLIBS =-I /usr/lib/ocaml/caml
++WITHCLIBS =-I $(CAML_INCLUDES)
+
+ ################ End of user's variables #####################
+
diff --git a/pkgs/applications/science/misc/root/cmake.patch b/pkgs/applications/science/misc/root/cmake.patch
new file mode 100644
index 000000000000..b6efd7444fe9
--- /dev/null
+++ b/pkgs/applications/science/misc/root/cmake.patch
@@ -0,0 +1,11 @@
+--- cmake/modules/RootBuildOptions.cmake 1969-12-31 20:30:01.000000000 -0330
++++ cmake/modules/RootBuildOptions.cmake 2014-01-10 14:09:29.424937408 -0330
+@@ -149,7 +149,7 @@
+
+ #---General Build options----------------------------------------------------------------------
+ # use, i.e. don't skip the full RPATH for the build tree
+-set(CMAKE_SKIP_BUILD_RPATH FALSE)
++set(CMAKE_SKIP_BUILD_RPATH TRUE)
+ # when building, don't use the install RPATH already (but later on when installing)
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+ # add the automatically determined parts of the RPATH
diff --git a/pkgs/applications/science/misc/root/default.nix b/pkgs/applications/science/misc/root/default.nix
new file mode 100644
index 000000000000..53a045ac6f0e
--- /dev/null
+++ b/pkgs/applications/science/misc/root/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, cmake, mesa, libX11, gfortran, libXpm, libXft, libXext, zlib }:
+
+stdenv.mkDerivation rec {
+ name = "root-${version}";
+ version = "5.34.15";
+
+ src = fetchurl {
+ url = "ftp://root.cern.ch/root/root_v${version}.source.tar.gz";
+ sha256 = "1bkiggcyya39a794d3d2rzzmmkbdymf86hbqhh0l1pl4f38xvp6i";
+ };
+
+ buildInputs = [ cmake gfortran mesa libX11 libXpm libXft libXext zlib ];
+
+ # CMAKE_INSTALL_RPATH_USE_LINK_PATH is set to FALSE in
+ # /cmake/modules/RootBuildOptions.cmake.
+ # This patch sets it to TRUE.
+ patches = [ ./cmake.patch ];
+ patchFlags = "-p0";
+
+ enableParallelBuilding = true;
+
+ meta = {
+ homepage = "http://root.cern.ch/drupal/";
+ description = "A data analysis framework";
+ platforms = stdenv.lib.platforms.mesaPlatforms;
+ };
+}
diff --git a/pkgs/applications/taxes/aangifte-2005/builder.sh b/pkgs/applications/taxes/aangifte-2005/builder.sh
deleted file mode 100644
index 8d284176d444..000000000000
--- a/pkgs/applications/taxes/aangifte-2005/builder.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-source $stdenv/setup
-
-buildPhase() {
- for i in bin/*; do
- patchelf \
- --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
- --set-rpath $libX11/lib:$libXext/lib \
- $i
- done
-}
-
-installPhase() {
- mkdir -p $out
- cp -prvd * $out/
-}
-
-genericBuild
diff --git a/pkgs/applications/taxes/aangifte-2005/default.nix b/pkgs/applications/taxes/aangifte-2005/default.nix
deleted file mode 100644
index 03ba20b11dae..000000000000
--- a/pkgs/applications/taxes/aangifte-2005/default.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-{stdenv, fetchurl, libX11, libXext}:
-
-stdenv.mkDerivation {
- name = "aangifte2005-1";
- builder = ./builder.sh;
-
- src = fetchurl {
- url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2005_linux.tar.gz;
- md5 = "9cc709b8ad041f4b20154ff1491d0436";
- };
-
- inherit libX11 libXext;
-}
diff --git a/pkgs/applications/taxes/aangifte-2006/default.nix b/pkgs/applications/taxes/aangifte-2006/default.nix
index 8bf5ddeee40d..72d6999fa1d7 100644
--- a/pkgs/applications/taxes/aangifte-2006/default.nix
+++ b/pkgs/applications/taxes/aangifte-2006/default.nix
@@ -14,5 +14,8 @@ stdenv.mkDerivation {
meta = {
description = "Elektronische aangifte IB 2006";
url = "http://www.belastingdienst.nl/download/1341.html";
+ license = stdenv.lib.licenses.unfree;
+ platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = [];
};
}
diff --git a/pkgs/applications/taxes/aangifte-2007/default.nix b/pkgs/applications/taxes/aangifte-2007/default.nix
index 3cd472b51c25..15c826feb6e7 100644
--- a/pkgs/applications/taxes/aangifte-2007/default.nix
+++ b/pkgs/applications/taxes/aangifte-2007/default.nix
@@ -17,5 +17,8 @@ stdenv.mkDerivation {
meta = {
description = "Elektronische aangifte IB 2007";
url = "http://www.belastingdienst.nl/download/1341.html";
+ license = stdenv.lib.licenses.unfree;
+ platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = [];
};
}
diff --git a/pkgs/applications/taxes/aangifte-2008/default.nix b/pkgs/applications/taxes/aangifte-2008/default.nix
index 85d5b3045be0..905471cb76b8 100644
--- a/pkgs/applications/taxes/aangifte-2008/default.nix
+++ b/pkgs/applications/taxes/aangifte-2008/default.nix
@@ -18,5 +18,8 @@ stdenv.mkDerivation {
meta = {
description = "Elektronische aangifte IB 2008 (Dutch Tax Return Program)";
url = http://www.belastingdienst.nl/particulier/aangifte2008/aangifte_2008/aangifte_2008.html;
+ license = stdenv.lib.licenses.unfree;
+ platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = [];
};
}
diff --git a/pkgs/applications/taxes/aangifte-2009/default.nix b/pkgs/applications/taxes/aangifte-2009/default.nix
index eeeb4a1d1e53..9aa7a8172711 100644
--- a/pkgs/applications/taxes/aangifte-2009/default.nix
+++ b/pkgs/applications/taxes/aangifte-2009/default.nix
@@ -33,5 +33,8 @@ stdenv.mkDerivation {
meta = {
description = "Elektronische aangifte IB 2009 (Dutch Tax Return Program)";
url = http://www.belastingdienst.nl/particulier/aangifte2009/download/;
+ license = stdenv.lib.licenses.unfree;
+ platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = [];
};
}
diff --git a/pkgs/applications/taxes/aangifte-2010/default.nix b/pkgs/applications/taxes/aangifte-2010/default.nix
index 65ff561ee9ef..23338c01ec3e 100644
--- a/pkgs/applications/taxes/aangifte-2010/default.nix
+++ b/pkgs/applications/taxes/aangifte-2010/default.nix
@@ -33,5 +33,8 @@ stdenv.mkDerivation {
meta = {
description = "Elektronische aangifte IB 2010 (Dutch Tax Return Program)";
url = http://www.belastingdienst.nl/particulier/aangifte2009/download/;
+ license = stdenv.lib.licenses.unfree;
+ platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = [];
};
}
diff --git a/pkgs/applications/taxes/aangifte-2011/default.nix b/pkgs/applications/taxes/aangifte-2011/default.nix
index 0bffad95d50b..e5bc233affa0 100644
--- a/pkgs/applications/taxes/aangifte-2011/default.nix
+++ b/pkgs/applications/taxes/aangifte-2011/default.nix
@@ -33,5 +33,8 @@ stdenv.mkDerivation {
meta = {
description = "Elektronische aangifte IB 2011 (Dutch Tax Return Program)";
url = http://www.belastingdienst.nl/particulier/aangifte2009/download/;
+ license = stdenv.lib.licenses.unfree;
+ platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = [];
};
}
diff --git a/pkgs/applications/taxes/aangifte-2012/default.nix b/pkgs/applications/taxes/aangifte-2012/default.nix
index 8f36fd485ddd..544fe4ec55f9 100644
--- a/pkgs/applications/taxes/aangifte-2012/default.nix
+++ b/pkgs/applications/taxes/aangifte-2012/default.nix
@@ -34,5 +34,8 @@ stdenv.mkDerivation {
meta = {
description = "Elektronische aangifte IB 2012 (Dutch Tax Return Program)";
url = http://www.belastingdienst.nl/particulier/aangifte2012/download/;
+ license = stdenv.lib.licenses.unfree;
+ platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = [];
};
}
diff --git a/pkgs/applications/taxes/aangifte-2013/default.nix b/pkgs/applications/taxes/aangifte-2013/default.nix
new file mode 100644
index 000000000000..5cf90320adc7
--- /dev/null
+++ b/pkgs/applications/taxes/aangifte-2013/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, makeWrapper, xdg_utils, libX11, libXext, libSM }:
+
+stdenv.mkDerivation {
+ name = "aangifte2013-1";
+
+ src = fetchurl {
+ url = http://download.belastingdienst.nl/belastingdienst/apps/linux/ib2013_linux.tar.gz;
+ sha256 = "05biqxz39gwln960xj31yg8s2chdn9vs0lzm4rlcwcavxy8lam1c";
+ };
+
+ dontStrip = true;
+ dontPatchELF = true;
+
+ buildInputs = [ makeWrapper ];
+
+ buildPhase =
+ ''
+ for i in bin/*; do
+ patchelf \
+ --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ --set-rpath ${stdenv.lib.makeLibraryPath [ libX11 libXext libSM ]}:$(cat $NIX_GCC/nix-support/orig-gcc)/lib \
+ $i
+ done
+ '';
+
+ installPhase =
+ ''
+ mkdir -p $out
+ cp -prvd * $out/
+ wrapProgram $out/bin/ib2013ux --prefix PATH : ${xdg_utils}/bin \
+ --prefix LD_PRELOAD : $(cat $NIX_GCC/nix-support/orig-gcc)/lib/libgcc_s.so.1
+ '';
+
+ meta = {
+ description = "Elektronische aangifte IB 2013 (Dutch Tax Return Program)";
+ url = http://www.belastingdienst.nl/wps/wcm/connect/bldcontentnl/themaoverstijgend/programmas_en_formulieren/aangifteprogramma_2013_linux;
+ license = stdenv.lib.licenses.unfree;
+ platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = [];
+ };
+}
diff --git a/pkgs/applications/version-management/bazaar/add_certificates.patch b/pkgs/applications/version-management/bazaar/add_certificates.patch
new file mode 100644
index 000000000000..332f42aa89cc
--- /dev/null
+++ b/pkgs/applications/version-management/bazaar/add_certificates.patch
@@ -0,0 +1,11 @@
+diff -ru orig/bzrlib/transport/http/_urllib2_wrappers.py bzr-2.6.0/bzrlib/transport/http/_urllib2_wrappers.py
+--- orig/bzrlib/transport/http/_urllib2_wrappers.py 2013-07-27 13:50:53.000000000 +0200
++++ bzr-2.6.0/bzrlib/transport/http/_urllib2_wrappers.py 2014-02-04 18:34:15.838622492 +0100
+@@ -86,6 +86,7 @@
+ u"/usr/local/share/certs/ca-root-nss.crt", # FreeBSD
+ # XXX: Needs checking, can't trust the interweb ;) -- vila 2012-01-25
+ u'/etc/openssl/certs/ca-certificates.crt', # Solaris
++ u'@certPath@',
+ ]
+ def default_ca_certs():
+ if sys.platform == 'win32':
diff --git a/pkgs/applications/version-management/bazaar/default.nix b/pkgs/applications/version-management/bazaar/default.nix
index 1eb114ecd8ce..2ea916052a38 100644
--- a/pkgs/applications/version-management/bazaar/default.nix
+++ b/pkgs/applications/version-management/bazaar/default.nix
@@ -1,20 +1,28 @@
-{ stdenv, fetchurl, pythonPackages }:
+{ stdenv, fetchurl, pythonPackages, cacert }:
stdenv.mkDerivation rec {
- version = "2.5";
- release = ".1";
+ version = "2.6";
+ release = ".0";
name = "bazaar-${version}${release}";
src = fetchurl {
url = "http://launchpad.net/bzr/${version}/${version}${release}/+download/bzr-${version}${release}.tar.gz";
- sha256 = "10krjbzia2avn09p0cdlbx2wya0r5v11w5ymvyl72af5dkx4cwwn";
+ sha256 = "1c6sj77h5f97qimjc14kr532kgc0jk3wq778xrkqi0pbh9qpk509";
};
- buildInputs = [ pythonPackages.python pythonPackages.wrapPython ];
+ buildInputs = [ pythonPackages.python pythonPackages.wrapPython cacert ];
# Readline support is needed by bzrtools.
pythonPath = [ pythonPackages.readline ];
+ # Bazaar can't find the certificates alone
+ patches = [ ./add_certificates.patch ];
+ postPatch = ''
+ substituteInPlace bzrlib/transport/http/_urllib2_wrappers.py \
+ --subst-var-by "certPath" "${cacert}/etc/ca-bundle.crt"
+ '';
+
+
installPhase = ''
python setup.py install --prefix=$out
wrapPythonPrograms
diff --git a/pkgs/applications/version-management/codeville/0.8.0.nix b/pkgs/applications/version-management/codeville/0.8.0.nix
index 5c1910d6c6f6..0c0f3c4c19c0 100644
--- a/pkgs/applications/version-management/codeville/0.8.0.nix
+++ b/pkgs/applications/version-management/codeville/0.8.0.nix
@@ -1,6 +1,6 @@
args : with args;
-if (! python ? db4Support) || (! python.db4Support) then
+if (! python ? dbSupport) || (! python.dbSupport) then
throw ''Python DB4 support is required for codeville.''
else
diff --git a/pkgs/applications/version-management/fossil/default.nix b/pkgs/applications/version-management/fossil/default.nix
index 2a669729a9c6..c2793190e892 100644
--- a/pkgs/applications/version-management/fossil/default.nix
+++ b/pkgs/applications/version-management/fossil/default.nix
@@ -1,11 +1,11 @@
{stdenv, fetchurl, zlib, openssl, tcl, readline, sqlite, withJson ? true}:
stdenv.mkDerivation {
- name = "fossil-1.27";
+ name = "fossil-1.28";
src = fetchurl {
- url = http://www.fossil-scm.org/download/fossil-src-20130911114349.tar.gz;
- sha256 = "0n40z8bx2311i11zjx2x15lw3q8vzjwvfqzikrjlqnpal4vzd72f";
+ url = http://www.fossil-scm.org/download/fossil-src-20140127173344.tar.gz;
+ sha256 = "105a3f3wiqshmkw8q7f7ask3nm0jkjf0h3h2283qiqlsqfkwb9xc";
};
buildInputs = [ zlib openssl readline sqlite ];
diff --git a/pkgs/applications/version-management/git-and-tools/cgit/default.nix b/pkgs/applications/version-management/git-and-tools/cgit/default.nix
index ce4d9f98596f..47fa80cb9013 100644
--- a/pkgs/applications/version-management/git-and-tools/cgit/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/cgit/default.nix
@@ -4,20 +4,23 @@
}:
stdenv.mkDerivation rec {
- name = "cgit-0.10";
+ name = "cgit-${version}";
+ version = "0.10.1";
src = fetchurl {
url = "http://git.zx2c4.com/cgit/snapshot/${name}.tar.xz";
- sha256 = "0ynywva0lrsasdm3nlk3dmd8k5bnrd9qlvmk4n42dfw9g1xj5i4h";
+ sha256 = "0bci1p9spf79wirc4lk36cndcx2b9wj0fq1l58rlp6r563is77l3";
};
# cgit is is tightly coupled with git and needs a git source tree to build.
# The cgit-0.10 Makefile has GIT_VER = 1.8.5, so use that version.
# IMPORTANT: Remember to check which git version cgit needs on every version
# bump.
+ # NOTE: as of 0.10.1, the git version is compatible from 1.9.0 to
+ # 1.9.2 (see the repository history)
gitSrc = fetchurl {
- url = https://git-core.googlecode.com/files/git-1.8.5.tar.gz;
- sha256 = "08vbq8y3jx1da417hkqmrkdkysac1sqjvrjmaj1v56dmkghm43w7";
+ url = "https://www.kernel.org/pub/software/scm/git/git-1.9.2.tar.xz";
+ sha256 = "1x4rb06vw4ckdflmn01r5l9spvn7cng4i5mm3sbd0n8cz0n6xz13";
};
buildInputs = [
@@ -53,6 +56,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://git.zx2c4.com/cgit/about/;
+ repositories.git = git://git.zx2c4.com/cgit;
description = "Web frontend for git repositories";
license = stdenv.lib.licenses.gpl2;
platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix
index ee1de54a4fb0..96e4631889c7 100644
--- a/pkgs/applications/version-management/git-and-tools/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/default.nix
@@ -4,10 +4,8 @@
args: with args; with pkgs;
let
inherit (pkgs) stdenv fetchgit fetchurl subversion;
-in
-rec {
- git = lib.makeOverridable (import ./git) {
+ gitBase = lib.makeOverridable (import ./git) {
inherit fetchurl stdenv curl openssl zlib expat perl python gettext gnugrep
asciidoc xmlto docbook2x docbook_xsl docbook_xml_dtd_45 libxslt cpio tcl
tk makeWrapper subversionClient gzip;
@@ -24,6 +22,9 @@ rec {
];
};
+in
+rec {
+
# support for bugzilla
gitBz = import ./git-bz {
inherit fetchgit stdenv makeWrapper python asciidoc xmlto # docbook2x docbook_xsl docbook_xml_dtd_45 libxslt
@@ -31,17 +32,19 @@ rec {
inherit (pythonPackages) pysqlite;
};
+ git = appendToName "minimal" gitBase;
+
# Git with SVN support, but without GUI.
- gitSVN = lowPrio (appendToName "with-svn" (git.override {
+ gitSVN = lowPrio (appendToName "with-svn" (gitBase.override {
svnSupport = true;
}));
# The full-featured Git.
- gitFull = appendToName "full" (git.override {
+ gitFull = gitBase.override {
svnSupport = true;
guiSupport = true;
sendEmailSupport = !stdenv.isDarwin;
- });
+ };
gitAnnex = pkgs.haskellPackages.gitAnnex;
diff --git a/pkgs/applications/version-management/git-and-tools/git-annex/default.nix b/pkgs/applications/version-management/git-and-tools/git-annex/default.nix
index 28b64c118bae..dcf76160ec61 100644
--- a/pkgs/applications/version-management/git-and-tools/git-annex/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git-annex/default.nix
@@ -1,34 +1,37 @@
-{ cabal, aeson, async, blazeBuilder, bloomfilter, bup
+{ cabal, aeson, async, blazeBuilder, bloomfilter, bup, byteable
, caseInsensitive, clientsession, cryptoApi, cryptohash, curl
, dataDefault, dataenc, DAV, dbus, dlist, dns, editDistance
-, extensibleExceptions, feed, filepath, git, gnupg1, gnutls, hamlet
-, hinotify, hS3, hslogger, HTTP, httpConduit, httpTypes, IfElse
-, json, lsof, MissingH, MonadCatchIOTransformers, monadControl, mtl
-, network, networkConduit, networkInfo, networkMulticast
-, networkProtocolXmpp, openssh, perl, QuickCheck, random, regexTdfa
-, rsync, SafeSemaphore, SHA, stm, tasty, tastyHunit
-, tastyQuickcheck, text, time, transformers, unixCompat, utf8String
-, uuid, wai, waiLogger, warp, which, xmlConduit, xmlTypes, yesod
-, yesodCore, yesodDefault, yesodForm, yesodStatic
+, extensibleExceptions, fdoNotify, feed, filepath, git, gnupg1
+, gnutls, hamlet, hinotify, hS3, hslogger, HTTP, httpClient
+, httpConduit, httpTypes, IfElse, json, liftedBase, lsof, MissingH
+, MonadCatchIOTransformers, monadControl, mtl, network
+, networkConduit, networkInfo, networkMulticast
+, networkProtocolXmpp, openssh, optparseApplicative, perl
+, QuickCheck, random, regexTdfa, rsync, SafeSemaphore, securemem
+, SHA, stm, tasty, tastyHunit, tastyQuickcheck, tastyRerun, text
+, time, transformers, unixCompat, utf8String, uuid, wai, waiLogger
+, warp, warpTls, which, xmlTypes, yesod, yesodCore, yesodDefault
+, yesodForm, yesodStatic
}:
cabal.mkDerivation (self: {
pname = "git-annex";
- version = "5.20140108";
- sha256 = "17j1avmg66lda52p93689n4mas46rfbjdvss1rvmdh10cj7hg8jy";
+ version = "5.20140405";
+ sha256 = "0nbfnv9z2jhx2jr2nma0y1znvbaa09rv1drl6wk27j6xsbiq3p3k";
isLibrary = false;
isExecutable = true;
buildDepends = [
- aeson async blazeBuilder bloomfilter caseInsensitive clientsession
- cryptoApi cryptohash dataDefault dataenc DAV dbus dlist dns
- editDistance extensibleExceptions feed filepath gnutls hamlet
- hinotify hS3 hslogger HTTP httpConduit httpTypes IfElse json
- MissingH MonadCatchIOTransformers monadControl mtl network
- networkConduit networkInfo networkMulticast networkProtocolXmpp
- QuickCheck random regexTdfa SafeSemaphore SHA stm tasty tastyHunit
- tastyQuickcheck text time transformers unixCompat utf8String uuid
- wai waiLogger warp xmlConduit xmlTypes yesod yesodCore yesodDefault
- yesodForm yesodStatic
+ aeson async blazeBuilder bloomfilter byteable caseInsensitive
+ clientsession cryptoApi cryptohash dataDefault dataenc DAV dbus
+ dlist dns editDistance extensibleExceptions fdoNotify feed filepath
+ gnutls hamlet hinotify hS3 hslogger HTTP httpClient httpConduit
+ httpTypes IfElse json liftedBase MissingH MonadCatchIOTransformers
+ monadControl mtl network networkConduit networkInfo
+ networkMulticast networkProtocolXmpp optparseApplicative QuickCheck
+ random regexTdfa SafeSemaphore securemem SHA stm tasty tastyHunit
+ tastyQuickcheck tastyRerun text time transformers unixCompat
+ utf8String uuid wai waiLogger warp warpTls xmlTypes yesod yesodCore
+ yesodDefault yesodForm yesodStatic
];
buildTools = [ bup curl git gnupg1 lsof openssh perl rsync which ];
configureFlags = "-fS3
@@ -51,6 +54,7 @@ cabal.mkDerivation (self: {
cp dist/build/git-annex/git-annex git-annex
./git-annex test
'';
+ propagatedUserEnvPkgs = [git lsof];
meta = {
homepage = "http://git-annex.branchable.com/";
description = "manage files with git, without checking their contents into git";
diff --git a/pkgs/applications/version-management/git-and-tools/git/cert-path.patch b/pkgs/applications/version-management/git-and-tools/git/cert-path.patch
new file mode 100644
index 000000000000..846752f5bfe3
--- /dev/null
+++ b/pkgs/applications/version-management/git-and-tools/git/cert-path.patch
@@ -0,0 +1,12 @@
+diff -ru -x '*~' git-1.9.2-orig/git-send-email.perl git-1.9.2/git-send-email.perl
+--- git-1.9.2-orig/git-send-email.perl 2014-04-09 21:09:34.000000000 +0200
++++ git-1.9.2/git-send-email.perl 2014-04-16 18:35:05.861132282 +0200
+@@ -1094,6 +1094,8 @@
+ return;
+ }
+
++ $smtp_ssl_cert_path //= $ENV{'OPENSSL_X509_CERT_FILE'};
++
+ if (!defined $smtp_ssl_cert_path) {
+ # use the OpenSSL defaults
+ return (SSL_verify_mode => SSL_VERIFY_PEER());
diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix
index dd8821711de1..861030bae994 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -10,7 +10,7 @@
let
- version = "1.8.5.2";
+ version = "1.9.2";
svn = subversionClient.override { perlBindings = true; };
@@ -20,11 +20,11 @@ stdenv.mkDerivation {
name = "git-${version}";
src = fetchurl {
- url = "http://git-core.googlecode.com/files/git-${version}.tar.gz";
- sha256 = "12iyj6f89dmb1cn2pvym5lrf23g4m71mp9pwkbi1zscb9d998ih2";
+ url = "https://www.kernel.org/pub/software/scm/git/git-${version}.tar.xz";
+ sha256 = "1x4rb06vw4ckdflmn01r5l9spvn7cng4i5mm3sbd0n8cz0n6xz13";
};
- patches = [ ./docbook2texi.patch ./symlinks-in-bin.patch ];
+ patches = [ ./docbook2texi.patch ./symlinks-in-bin.patch ./cert-path.patch ];
buildInputs = [curl openssl zlib expat gettext cpio makeWrapper]
++ stdenv.lib.optionals withManual [ asciidoc texinfo xmlto docbook2x
@@ -35,7 +35,10 @@ stdenv.mkDerivation {
NIX_LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
makeFlags = "prefix=\${out} sysconfdir=/etc/ PERL_PATH=${perl}/bin/perl SHELL_PATH=${stdenv.shell} "
- + (if pythonSupport then "PYTHON_PATH=${python}/bin/python" else "NO_PYTHON=1");
+ + (if pythonSupport then "PYTHON_PATH=${python}/bin/python" else "NO_PYTHON=1")
+ + (if stdenv.isSunOS then " INSTALL=install NO_INET_NTOP= NO_INET_PTON=" else "")
+ + (if stdenv.isDarwin then " NO_APPLE_COMMON_CRYPTO=1" else "");
+
# FIXME: "make check" requires Sparse; the Makefile must be tweaked
# so that `SPARSE_FLAGS' corresponds to the current architecture...
@@ -46,8 +49,7 @@ stdenv.mkDerivation {
postInstall =
''
notSupported() {
- echo -e "#\!/bin/sh\necho '`basename $1` not supported, $2'\nexit 1" > "$1"
- chmod +x $1
+ unlink $1 || true
}
# Install git-subtree.
@@ -65,7 +67,7 @@ stdenv.mkDerivation {
mkdir -p $out/etc/bash_completion.d
ln -s $out/share/git/contrib/completion/git-completion.bash $out/etc/bash_completion.d/
- # grep is a runtime dependence, need to patch so that it's found
+ # grep is a runtime dependency, need to patch so that it's found
substituteInPlace $out/libexec/git-core/git-sh-setup \
--replace ' grep' ' ${gnugrep}/bin/grep' \
--replace ' egrep' ' ${gnugrep}/bin/egrep'
@@ -76,7 +78,7 @@ stdenv.mkDerivation {
-e 's| perl -e| ${perl}/bin/perl -e|g' \
$out/libexec/git-core/{git-am,git-submodule}
- # gzip (and optionally bzip2, xz, zip) are a runtime dependencies for
+ # gzip (and optionally bzip2, xz, zip) are runtime dependencies for
# gitweb.cgi, need to patch so that it's found
sed -i -e "s|'compressor' => \['gzip'|'compressor' => ['${gzip}/bin/gzip'|" \
$out/share/gitweb/gitweb.cgi
@@ -93,7 +95,7 @@ stdenv.mkDerivation {
--set GITPERLLIB "$gitperllib" \
--prefix PATH : "${svn}/bin" ''
else '' # replace git-svn by notification script
- notSupported $out/libexec/git-core/git-svn "reinstall with config git = { svnSupport = true } set"
+ notSupported $out/libexec/git-core/git-svn
'')
+ (if sendEmailSupport then
@@ -105,7 +107,7 @@ stdenv.mkDerivation {
wrapProgram $out/libexec/git-core/git-send-email \
--set GITPERLLIB "$gitperllib" ''
else '' # replace git-send-email by notification script
- notSupported $out/libexec/git-core/git-send-email "reinstall with config git = { sendEmailSupport = true } set"
+ notSupported $out/libexec/git-core/git-send-email
'')
+ stdenv.lib.optionalString withManual ''# Install man pages and Info manual
@@ -122,8 +124,7 @@ stdenv.mkDerivation {
'' else ''
# Don't wrap Tcl/Tk, replace them by notification scripts
for prog in bin/gitk libexec/git-core/git-gui; do
- notSupported "$out/$prog" \
- "reinstall with config git = { guiSupport = true; } set"
+ notSupported "$out/$prog"
done
'');
diff --git a/pkgs/applications/version-management/git-and-tools/gitflow/default.nix b/pkgs/applications/version-management/git-and-tools/gitflow/default.nix
index 26a7826d4f0c..0898345c30b6 100644
--- a/pkgs/applications/version-management/git-and-tools/gitflow/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/gitflow/default.nix
@@ -2,11 +2,11 @@
stdenv.mkDerivation rec {
name = "gitflow-${version}";
- version = "1.6.1";
+ version = "1.7.0";
src = fetchurl {
url = "https://github.com/petervanderdoes/gitflow/archive/${version}.tar.gz";
- sha256 = "1f4879ahi8diddn7qvhr0dkj96gh527xnfihbf1ha83fn9cvvcls";
+ sha256 = "0rppgyqgk0drip6852bdm2479zks16cb3mj1jdw6jq80givrqnjx";
};
preBuild = ''
diff --git a/pkgs/applications/version-management/git-and-tools/hub/default.nix b/pkgs/applications/version-management/git-and-tools/hub/default.nix
index b9a053211fae..28484322d351 100644
--- a/pkgs/applications/version-management/git-and-tools/hub/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/hub/default.nix
@@ -2,11 +2,11 @@
stdenv.mkDerivation rec {
name = "hub-${version}";
- version = "1.10.6";
+ version = "1.12.0";
src = fetchurl {
url = "https://github.com/github/hub/archive/v${version}.tar.gz";
- sha256 = "0vfl1iq1927in81vd7zvp7yqqzay7pciyj87s83qfxrqyjpxn609";
+ sha256 = "1lbl4dl7483q320qw4jm6mqq4dbbk3xncypxgg86zcdigxvw6igv";
};
buildInputs = [ rake makeWrapper ];
diff --git a/pkgs/applications/version-management/git-and-tools/stgit/default.nix b/pkgs/applications/version-management/git-and-tools/stgit/default.nix
index 6518f32ef7c6..d4b74390c4cc 100644
--- a/pkgs/applications/version-management/git-and-tools/stgit/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/stgit/default.nix
@@ -1,14 +1,14 @@
{ stdenv, fetchurl, python, git }:
let
- name = "stgit-0.16";
+ name = "stgit-0.17.1";
in
stdenv.mkDerivation {
inherit name;
src = fetchurl {
url = "http://download.gna.org/stgit/${name}.tar.gz";
- sha256 = "0hla6401g2kicaakz4awk67yf8fhqbw1shn1p9ma5x6ca29s3w82";
+ sha256 = "1pka0ns9x0kabn036zsf0mwmwiynckhnva51kgxsch9fqah6acyl";
};
buildInputs = [ python git ];
diff --git a/pkgs/applications/version-management/git-and-tools/svn2git/default.nix b/pkgs/applications/version-management/git-and-tools/svn2git/default.nix
index 0053a1dfafbe..b0cfcaeb1108 100644
--- a/pkgs/applications/version-management/git-and-tools/svn2git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/svn2git/default.nix
@@ -1,14 +1,14 @@
{ stdenv, fetchurl, ruby, makeWrapper, git }:
let
- version = "2.2.2";
+ version = "2.2.5";
in
stdenv.mkDerivation {
name = "svn2git-${version}";
src = fetchurl {
url = "https://github.com/nirvdrum/svn2git/archive/v${version}.tar.gz";
- sha256 = "14zinkpgybz15jvbfw0sb432w6f5w4sa5pdqycjwva8v8lxqn9mh";
+ sha256 = "1afmrr80357pg3kawyghhc55z1pszaq8fyrrjmxa6nr9dcrqjwwh";
};
buildInputs = [ ruby makeWrapper ];
diff --git a/pkgs/applications/version-management/git-and-tools/tig/default.nix b/pkgs/applications/version-management/git-and-tools/tig/default.nix
index 23009efdbd54..fd9011130e34 100644
--- a/pkgs/applications/version-management/git-and-tools/tig/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/tig/default.nix
@@ -26,6 +26,6 @@ stdenv.mkDerivation rec {
description = "Text-mode interface for git";
maintainers = with maintainers; [ garbas bjornfor iElectric ];
license = licenses.gpl2;
- platforms = platforms.linux;
+ platforms = platforms.unix;
};
}
diff --git a/pkgs/applications/version-management/gource/default.nix b/pkgs/applications/version-management/gource/default.nix
index 3b6d19e8fcf2..13c554767743 100644
--- a/pkgs/applications/version-management/gource/default.nix
+++ b/pkgs/applications/version-management/gource/default.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
configureFlags = "--with-boost-libdir=${boost}/lib";
+ NIX_CFLAGS_COMPILE = "-fpermissive"; # fix build with newer gcc versions
+
meta = {
homepage = "http://code.google.com/p/gource/";
description = "software version control visualization tool";
diff --git a/pkgs/applications/version-management/kdesvn/default.nix b/pkgs/applications/version-management/kdesvn/default.nix
index 6373eb9f7f97..60f5d8bb9e08 100644
--- a/pkgs/applications/version-management/kdesvn/default.nix
+++ b/pkgs/applications/version-management/kdesvn/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gettext, apr, aprutil, subversion, db4, kdelibs, expat }:
+{ stdenv, fetchurl, gettext, apr, aprutil, subversion, db, kdelibs, expat }:
# the homepage mentions this is the final release.
# from now on, kdesvn will be part of the official kde software distribution
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
sed -i -e "s|/usr|${subversion}|g" src/svnqt/cmakemodules/FindSubversion.cmake
'';
- buildInputs = [ apr aprutil subversion db4 kdelibs expat ];
+ buildInputs = [ apr aprutil subversion db kdelibs expat ];
nativeBuildInputs = [ gettext ];
diff --git a/pkgs/applications/version-management/mercurial/default.nix b/pkgs/applications/version-management/mercurial/default.nix
index fae0c6a5ed6b..5fdafe8ac2aa 100644
--- a/pkgs/applications/version-management/mercurial/default.nix
+++ b/pkgs/applications/version-management/mercurial/default.nix
@@ -2,7 +2,7 @@
, guiSupport ? false, tk ? null, curses }:
let
- name = "mercurial-2.8.2";
+ name = "mercurial-2.9.2";
in
stdenv.mkDerivation {
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = "http://mercurial.selenic.com/release/${name}.tar.gz";
- sha256 = "0vxyxx91k6z0knfqslbwxswbc52abrg2pdf395kwvij026ibm9f8";
+ sha256 = "0lwgncim4cy91ly8389h2bbhl4nbi8xjgp0kx37kgq8q2lx2nil6";
};
inherit python; # pass it so that the same version can be used in hg2git
diff --git a/pkgs/applications/version-management/mr/default.nix b/pkgs/applications/version-management/mr/default.nix
index 9e8024d7b191..e89cea6aadce 100644
--- a/pkgs/applications/version-management/mr/default.nix
+++ b/pkgs/applications/version-management/mr/default.nix
@@ -17,13 +17,14 @@ stdenv.mkDerivation rec {
'';
installPhase = ''
- mkdir -pv $out/bin $out/share/man/man1
+ mkdir -pv $out/bin $out/share/man/man1 $out/share/mr
cp -v mr $out/bin
cp -v webcheckout $out/bin
cp -v mr.1 $out/share/man/man1
cp -v webcheckout.1 $out/share/man/man1
+ cp -v lib/* $out/share/mr
'';
-
+
meta = {
description = "Multiple Repository management tool";
longDescription = ''The mr(1) command can checkout, update, or perform other actions on a
@@ -53,4 +54,3 @@ stdenv.mkDerivation rec {
maintainers = [ stdenv.lib.maintainers.antono ];
};
}
-
diff --git a/pkgs/applications/version-management/rcs/default.nix b/pkgs/applications/version-management/rcs/default.nix
index 5f88bbc74cc6..90bca9b07124 100644
--- a/pkgs/applications/version-management/rcs/default.nix
+++ b/pkgs/applications/version-management/rcs/default.nix
@@ -1,13 +1,15 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, ed }:
stdenv.mkDerivation rec {
- name = "rcs-5.8.2";
+ name = "rcs-5.9.2";
src = fetchurl {
- url = "mirror://gnu/rcs/${name}.tar.gz";
- sha256 = "1p4kqqrvc7plc3n6ls4xwp6d3mw1jcx9p36pilwd65q31mgbs07a";
+ url = "mirror://gnu/rcs/${name}.tar.xz";
+ sha256 = "0wdmmplga9k05d9k7wjqv4zb6xvvzsli8hmn206pvangki1g66k5";
};
+ buildInputs = [ ed ];
+
doCheck = true;
meta = {
diff --git a/pkgs/applications/version-management/subversion/default.nix b/pkgs/applications/version-management/subversion/default.nix
index 67346ef8389b..e699b82f2b0a 100644
--- a/pkgs/applications/version-management/subversion/default.nix
+++ b/pkgs/applications/version-management/subversion/default.nix
@@ -17,13 +17,13 @@ assert javahlBindings -> jdk != null && perl != null;
stdenv.mkDerivation rec {
- version = "1.8.5";
+ version = "1.8.8";
name = "subversion-${version}";
src = fetchurl {
url = "mirror://apache/subversion/${name}.tar.bz2";
- sha256 = "0r3mxrrlr1l9s2nh829bf0qmrfaafkq3di6ndr10j76sxkqjnlpx";
+ sha256 = "1cqxwydjidyf59y4lgkxl7bra1sy28abqm2mi5971qjsv0f96s8m";
};
buildInputs = [ zlib apr aprutil sqlite ]
@@ -77,6 +77,6 @@ stdenv.mkDerivation rec {
description = "A version control system intended to be a compelling replacement for CVS in the open source community";
homepage = http://subversion.apache.org/;
maintainers = with stdenv.lib.maintainers; [ eelco lovek323 ];
- platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+ hydraPlatforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
};
}
diff --git a/pkgs/applications/version-management/vcsh/default.nix b/pkgs/applications/version-management/vcsh/default.nix
new file mode 100644
index 000000000000..d438cb1bc6cd
--- /dev/null
+++ b/pkgs/applications/version-management/vcsh/default.nix
@@ -0,0 +1,28 @@
+{stdenv, fetchgit}:
+
+stdenv.mkDerivation rec {
+ rev = "75c4c554eefbefb714fabd356933858edbce3b1e";
+ version = "1.20131229";
+ name = "vcsh-${version}_${rev}";
+
+ src = fetchgit {
+ inherit rev;
+ url = "https://github.com/RichiH/vcsh";
+ sha256 = "0rc82a8vnnk9q6q88z9s10873gqgdpppbpwy2yw8a7hydqrpn0hs";
+ };
+
+ phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp vcsh $out/bin
+ '';
+
+ meta = {
+ description = "Version Control System for $HOME";
+ homepage = https://github.com/RichiH/vcsh;
+ license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = [ stdenv.lib.maintainers.garbas ];
+ platforms = stdenv.lib.platforms.unix;
+ };
+}
diff --git a/pkgs/applications/video/aegisub/default.nix b/pkgs/applications/video/aegisub/default.nix
index cbbb23b04a05..9bbc7c9e7395 100644
--- a/pkgs/applications/video/aegisub/default.nix
+++ b/pkgs/applications/video/aegisub/default.nix
@@ -5,7 +5,7 @@
, libass, fftw, ffms
, ffmpeg, pkgconfig, zlib # Undocumented (?) dependencies
, spellChecking ? true, hunspell ? null
-, automationSupport ? true, lua ? null
+, automationSupport ? true, lua ? null
, openalSupport ? false, openal ? null
, alsaSupport ? true, alsaLib ? null
, pulseaudioSupport ? true, pulseaudio ? null
@@ -39,11 +39,11 @@ stdenv.mkDerivation rec {
;
NIX_LDFLAGS = "-liconv -lavutil -lavformat -lavcodec -lswscale -lz -lm";
-
- preConfigure = "cd aegisub";
-
+
+ preConfigure = "cd aegisub";
+
postInstall = "ln -s $out/bin/aegisub-3.0 $out/bin/aegisub";
-
+
meta = {
description = "An advanced subtitle editor";
longDescription = ''
@@ -53,7 +53,12 @@ stdenv.mkDerivation rec {
built-in real-time video preview.
'';
homepage = http://www.aegisub.org/;
- license = "BSD"; # The Aegisub sources are itself BSD/ISC, but they are linked against GPL'd softwares
+ license = stdenv.lib.licenses.bsd3;
+ # The Aegisub sources are itself BSD/ISC,
+ # but they are linked against GPL'd softwares
+ # - so the resulting program will be GPL
+ maintainers = [ stdenv.lib.maintainers.AndersonTorres ];
platforms = stdenv.lib.platforms.linux;
+
};
}
diff --git a/pkgs/applications/video/avidemux/default.nix b/pkgs/applications/video/avidemux/default.nix
index d706d16241ce..485d8c54eb36 100644
--- a/pkgs/applications/video/avidemux/default.nix
+++ b/pkgs/applications/video/avidemux/default.nix
@@ -1,20 +1,23 @@
{stdenv, fetchurl, cmake, pkgconfig, libxml2, qt4, gtk, gettext, SDL,
libXv, pixman, libpthreadstubs, libXau, libXdmcp, libxslt, x264,
-alsaLib, lame, faac, faad2, libvorbis, yasm, libvpx, xvidcore, libva }:
+alsaLib, lame, faad2, libvorbis, yasm, libvpx, xvidcore, libva,
+faac ? null, faacSupport ? false }:
assert stdenv ? glibc;
+assert faacSupport -> faac != null;
stdenv.mkDerivation {
name = "avidemux-2.5.6";
-
+
src = fetchurl {
url = mirror://sourceforge/avidemux/avidemux_2.5.6.tar.gz;
sha256 = "12wvxz0n2g85f079d8mdkkp2zm279d34m9v7qgcqndh48cn7znnn";
};
-
+
buildInputs = [ cmake pkgconfig libxml2 qt4 gtk gettext SDL libXv
- pixman libpthreadstubs libXau libXdmcp libxslt x264 alsaLib
- lame faac faad2 libvorbis yasm libvpx xvidcore libva ];
+ pixman libpthreadstubs libXau libXdmcp libxslt x264 alsaLib
+ lame faad2 libvorbis yasm libvpx xvidcore libva
+ ] ++ stdenv.lib.optional faacSupport faac;
cmakeFlags = "-DPTHREAD_INCLUDE_DIR=${stdenv.glibc}/include" +
" -DGETTEXT_INCLUDE_DIR=${gettext}/include" +
@@ -34,7 +37,7 @@ stdenv.mkDerivation {
make install
'';
- meta = {
+ meta = {
homepage = http://fixounet.free.fr/avidemux/;
description = "Free video editor designed for simple video editing tasks";
maintainers = with stdenv.lib.maintainers; [viric];
diff --git a/pkgs/applications/video/bangarang/default.nix b/pkgs/applications/video/bangarang/default.nix
index 5dde88076a1e..1058243c0e08 100644
--- a/pkgs/applications/video/bangarang/default.nix
+++ b/pkgs/applications/video/bangarang/default.nix
@@ -10,6 +10,8 @@ stdenv.mkDerivation rec {
buildInputs = [ kdelibs phonon soprano shared_desktop_ontologies kdemultimedia taglib gettext ];
nativeBuildInputs = [ cmake ];
+ patches = [ ./gcc-4.7.patch ];
+
meta = with stdenv.lib; {
description = "A media player for KDE based on Nepomuk and Phonon";
longDescription = ''
diff --git a/pkgs/applications/video/bangarang/gcc-4.7.patch b/pkgs/applications/video/bangarang/gcc-4.7.patch
new file mode 100644
index 000000000000..d4f650b9caf5
--- /dev/null
+++ b/pkgs/applications/video/bangarang/gcc-4.7.patch
@@ -0,0 +1,45 @@
+commit b893fcdb7ddfc8c59fd29a29b7265a713c3dbab1
+Author: Alex Fiestas
+Date: Thu Mar 29 10:09:22 2012 +0200
+
+ Build fix: Add unistd.h include since sleep is defined there
+
+diff --git a/src/platform/infofetchers/lastfminfofetcher.cpp b/src/platform/infofetchers/lastfminfofetcher.cpp
+index 0c49d69..fcc4cd3 100644
+--- a/src/platform/infofetchers/lastfminfofetcher.cpp
++++ b/src/platform/infofetchers/lastfminfofetcher.cpp
+@@ -32,6 +32,8 @@
+ #include
+ #include
+
++#include
++
+ LastfmInfoFetcher::LastfmInfoFetcher(QObject *parent) :
+ InfoFetcher(parent)
+ {
+diff --git a/src/platform/infofetchers/tmdbinfofetcher.cpp b/src/platform/infofetchers/tmdbinfofetcher.cpp
+index 7801644..3c01960 100644
+--- a/src/platform/infofetchers/tmdbinfofetcher.cpp
++++ b/src/platform/infofetchers/tmdbinfofetcher.cpp
+@@ -30,6 +30,8 @@
+ #include
+ #include
+
++#include
++
+ TMDBInfoFetcher::TMDBInfoFetcher(QObject *parent) :
+ InfoFetcher(parent)
+ {
+diff --git a/src/platform/infofetchers/tvdbinfofetcher.cpp b/src/platform/infofetchers/tvdbinfofetcher.cpp
+index ff351b0..670ed18 100644
+--- a/src/platform/infofetchers/tvdbinfofetcher.cpp
++++ b/src/platform/infofetchers/tvdbinfofetcher.cpp
+@@ -30,6 +30,8 @@
+ #include
+ #include
+
++#include
++
+ TVDBInfoFetcher::TVDBInfoFetcher(QObject *parent) :
+ InfoFetcher(parent)
+ {
diff --git a/pkgs/applications/video/dvswitch/default.nix b/pkgs/applications/video/dvswitch/default.nix
deleted file mode 100644
index 8803fe0a7868..000000000000
--- a/pkgs/applications/video/dvswitch/default.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{ stdenv, fetchurl, alsaLib, boost, cmake, gtkmm, libXau, libXdmcp
-, libXv, libav, pixman, libpthreadstubs, pkgconfig
-}:
-
-stdenv.mkDerivation rec {
- name = "dvswitch-${version}";
- version = "0.8.3.6";
-
- src = fetchurl {
- url = "https://alioth.debian.org/frs/download.php/3615/${name}.tar.gz";
- sha256 = "7bd196389f9913ae08e12a29e168d79324c508bb545eab114df77b0375cd87f0";
- };
-
- buildInputs = [
- alsaLib boost cmake gtkmm libXau libXdmcp libXv libav
- libpthreadstubs pixman pkgconfig
- ];
-
- patchPhase = ''
- sed -e "s@prefix /usr/local@prefix $out@" -i CMakeLists.txt
- '';
-
- meta = with stdenv.lib; {
- description = "interactive live video mixer for DV streams";
- homepage = "http://dvswitch.alioth.debian.org";
- license = licenses.gpl2Plus;
- maintainers = [ maintainers.goibhniu ];
- };
-}
diff --git a/pkgs/applications/video/gnash/default.nix b/pkgs/applications/video/gnash/default.nix
index 4f2addcc99b0..ef40d614a397 100644
--- a/pkgs/applications/video/gnash/default.nix
+++ b/pkgs/applications/video/gnash/default.nix
@@ -10,7 +10,13 @@
assert stdenv ? glibc;
-let version = "0.8.10"; in
+let version = "0.8.10";
+ patch_CVE = fetchurl {
+ url = "http://git.savannah.gnu.org/cgit/gnash.git/patch/?id=bb4dc77eecb6ed1b967e3ecbce3dac6c5e6f1527";
+ sha256 = "1g7ymbq9vxi0mwcgs2dpyd2sf30gaam7blza0ywiwj32f5wk62v1";
+ name = "CVE-2012-1175.patch";
+ };
+in
stdenv.mkDerivation rec {
name = "gnash-${version}";
@@ -21,6 +27,8 @@ stdenv.mkDerivation rec {
};
patchPhase = ''
+ patch -p1 < ${patch_CVE}
+
# Add all libs to `macros/libslist', a list of library search paths.
for lib in ${lib.concatStringsSep " "
(map (lib: "\"${lib}\"/lib")
@@ -73,6 +81,8 @@ stdenv.mkDerivation rec {
echo "\$GST_PLUGIN_PATH set to \`$GST_PLUGIN_PATH'"
'';
+ postConfigure = "echo '#define nullptr NULL' >> gnashconfig.h";
+
# Make sure `gtk-gnash' gets `libXext' in its `RPATH'.
NIX_LDFLAGS="-lX11 -lXext";
@@ -87,9 +97,7 @@ stdenv.mkDerivation rec {
# (e.g., gst-ffmpeg is needed to watch movies such as YouTube's).
for prog in "$out/bin/"*
do
- wrapProgram "$prog" --prefix \
- GST_PLUGIN_PATH ":" \
- "${gst_plugins_base}/lib/gstreamer-0.10:${gst_plugins_good}/lib/gstreamer-0.10:${gst_ffmpeg}/lib/gstreamer-0.10"
+ wrapProgram "$prog" --prefix GST_PLUGIN_SYSTEM_PATH ":" "$GST_PLUGIN_SYSTEM_PATH"
done
'';
diff --git a/pkgs/applications/video/kazam/bug_1190693.patch b/pkgs/applications/video/kazam/bug_1190693.patch
new file mode 100644
index 000000000000..9f00c6b60791
--- /dev/null
+++ b/pkgs/applications/video/kazam/bug_1190693.patch
@@ -0,0 +1,14 @@
+=== modified file 'kazam/frontend/indicator.py'
+--- a/kazam/frontend/indicator.py 2013-01-26 01:53:53 +0000
++++ b/kazam/frontend/indicator.py 2013-06-13 18:18:37 +0000
+@@ -291,3 +291,9 @@
+ def start_recording(self):
+ logger.debug("Recording started.")
+ self.indicator.set_from_icon_name("kazam-recording")
++
++ def hide_it(self):
++ self.indicator.set_visible(False)
++
++ def show_it(self):
++ self.indicator.set_visible(True)
+
diff --git a/pkgs/applications/video/kazam/datadir.patch b/pkgs/applications/video/kazam/datadir.patch
new file mode 100644
index 000000000000..114d4228be2d
--- /dev/null
+++ b/pkgs/applications/video/kazam/datadir.patch
@@ -0,0 +1,11 @@
+--- a/bin/kazam 2014-02-03 23:11:38.465614061 +0100
++++ b/bin/kazam-1 2014-02-03 23:12:28.447058700 +0100
+@@ -68,7 +68,7 @@
+ # when base install path is not /usr
+ curpath = os.path.abspath(__file__)
+ curpath = os.path.realpath(curpath)
+- datadir = curpath.split('bin/')[0] + "share/kazam/"
++ datadir = os.path.realpath(os.path.join(curpath, "./../../", "share/kazam/"))
+
+ try:
+ import platform
diff --git a/pkgs/applications/video/kazam/default.nix b/pkgs/applications/video/kazam/default.nix
new file mode 100644
index 000000000000..17bf282a459a
--- /dev/null
+++ b/pkgs/applications/video/kazam/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, python3Packages, gst_all_1, makeWrapper, gobjectIntrospection
+, gtk3, libwnck3, keybinder, intltool, libcanberra }:
+
+
+python3Packages.buildPythonPackage rec {
+ name = "kazam-${version}";
+ version = "1.4.3";
+ namePrefix = "";
+
+ src = fetchurl {
+ url = "https://launchpad.net/kazam/stable/${version}/+download/kazam-${version}.tar.gz";
+ sha256 = "00bcn0yj9xrv87sf6xd3wpilsjgjpsj15zzpjh351ffpjnr0ica8";
+ };
+
+ # TODO: keybinder, appindicator3
+ buildInputs = with python3Packages;
+ [ pygobject3 pyxdg pycairo gst_all_1.gstreamer gst_all_1.gst-plugins-base
+ gst_all_1.gst-plugins-good gobjectIntrospection gtk3 libwnck3 distutils_extra
+ intltool dbus ];
+
+ # TODO: figure out why PYTHONPATH is not passed automatically for those programs
+ pythonPath = with python3Packages;
+ [ pygobject3 pyxdg pycairo dbus ];
+
+ patches = [ ./datadir.patch ./bug_1190693.patch ];
+ prePatch = ''
+ rm setup.cfg
+ substituteInPlace kazam/backend/grabber.py --replace "/usr/bin/canberra-gtk-play" "${libcanberra}/bin/canberra-gtk-play"
+ '';
+
+ # no tests
+ doCheck = false;
+
+ preFixup = ''
+ wrapProgram $out/bin/kazam \
+ --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
+ --prefix LD_LIBRARY_PATH ":" "${gtk3}/lib:${gst_all_1.gstreamer}/lib:${keybinder}/lib" \
+ --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH" \
+ --prefix XDG_DATA_DIRS : "${gtk3}/share" \
+ --set GST_REGISTRY "/tmp/kazam.gstreamer.registry";
+ '';
+
+
+ meta = with stdenv.lib; {
+ description = "Cross-platform, Friend-2-Friend and secure decentralised communication platform";
+ homepage = https://code.launchpad.net/kazam;
+ #license = licenses.bsd2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.iElectric ];
+ };
+}
diff --git a/pkgs/applications/video/miro/default.nix b/pkgs/applications/video/miro/default.nix
index 5ca6c80dc7c1..528eeff7e239 100644
--- a/pkgs/applications/video/miro/default.nix
+++ b/pkgs/applications/video/miro/default.nix
@@ -1,7 +1,7 @@
{ stdenv, fetchurl, python, buildPythonPackage, pythonPackages, pkgconfig
-, pyrex096, ffmpeg, boost, glib, pygobject, gtk2, webkit_gtk2, libsoup, pygtk
+, pyrex096, ffmpeg, boost, glib, pygobject, gtk2, webkitgtk2, libsoup, pygtk
, taglib, pysqlite, pycurl, mutagen, pycairo, pythonDBus, pywebkitgtk
-, libtorrentRasterbar
+, libtorrentRasterbar, glib_networking, gsettings_desktop_schemas
, gst_python, gst_plugins_base, gst_plugins_good, gst_ffmpeg
}:
@@ -22,9 +22,6 @@ buildPythonPackage rec {
patches = [ ./gconf.patch ];
postPatch = ''
- sed -i -e '2i import os; os.environ["GST_PLUGIN_PATH"] = \\\
- '"'$GST_PLUGIN_PATH'" miro.real
-
sed -i -e 's/\$(shell which python)/python/' Makefile
sed -i -e 's|/usr/bin/||' -e 's|/usr||' \
-e 's/BUILD_TIME[^,]*/BUILD_TIME=0/' setup.py
@@ -40,10 +37,6 @@ buildPythonPackage rec {
plat/resources.py
'';
- installCommand = ''
- python setup.py install --prefix= --root="$out"
- '';
-
# Disabled for now, because it requires networking and even if we skip those
# tests, the whole test run takes around 10-20 minutes.
doCheck = false;
@@ -51,12 +44,22 @@ buildPythonPackage rec {
HOME="$TEMPDIR" LANG=en_US.UTF-8 python miro.real --unittest
'';
+ preInstall = ''
+ # see https://bitbucket.org/pypa/setuptools/issue/130/install_data-doesnt-respect-prefix
+ ${python}/bin/${python.executable} setup.py install_data --root=$out
+ sed -i '/data_files=data_files/d' setup.py
+ '';
+
postInstall = ''
mv "$out/bin/miro.real" "$out/bin/miro"
+ wrapProgram "$out/bin/miro" \
+ --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH" \
+ --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
+ --prefix XDG_DATA_DIRS : "${gsettings_desktop_schemas}/share:$out/share"
'';
buildInputs = [
- pkgconfig pyrex096 ffmpeg boost glib pygobject gtk2 webkit_gtk2 libsoup
+ pkgconfig pyrex096 ffmpeg boost glib pygobject gtk2 webkitgtk2 libsoup
pygtk taglib
];
diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix
index a20dc0cf590e..903b9afdc4a7 100644
--- a/pkgs/applications/video/mpv/default.nix
+++ b/pkgs/applications/video/mpv/default.nix
@@ -1,5 +1,6 @@
{ stdenv, fetchurl, fetchgit, freetype, pkgconfig, freefont_ttf, ffmpeg, libass
-, lua5, perl, libpthreadstubs
+, lua, perl, libpthreadstubs
+, lua5_sockets
, python3, docutils, which
, x11Support ? true, libX11 ? null, libXext ? null, mesa ? null, libXxf86vm ? null
, xineramaSupport ? true, libXinerama ? null
@@ -46,26 +47,25 @@ assert cacaSupport -> libcaca != null;
# but by purity reasons it should be avoided; thanks the-kenny to point it out!
# Now, it will just download and package Waf, mimetizing bootstrap.py behaviour
-let
+let
waf = fetchurl {
- url = https://waf.googlecode.com/files/waf-1.7.13;
- sha256 = "03cc750049350ee01cdbc584b70924e333fcc17ba4a2d04648dab1535538a873";
+ url = https://waf.googlecode.com/files/waf-1.7.15;
+ sha256 = "e5ae7028f9b2d8ce1acb9fe1092e8010a90ba764d3ac065ea4e846743290b1d6";
};
- version = "0.3.2";
-
in
stdenv.mkDerivation rec {
name = "mpv-${version}";
+ version = "0.3.7";
src = fetchurl {
url = "https://github.com/mpv-player/mpv/archive/v${version}.tar.gz";
- sha256 = "1vzdhzry2adyp2yh2dmy1qznqhnzar7g24rhi0vv624jgd20qax2";
+ sha256 = "1qmwmjvgdwh88l2caw2xy1d2h1cdg2w1hl4q5iwx2c0q7a99h41m";
};
buildInputs = with stdenv.lib;
- [ waf freetype pkgconfig ffmpeg libass docutils which libpthreadstubs ]
+ [ waf freetype pkgconfig ffmpeg libass docutils which libpthreadstubs lua5_sockets ]
++ optionals x11Support [ libX11 libXext mesa libXxf86vm ]
++ optional alsaSupport alsaLib
++ optional xvSupport libXv
@@ -86,7 +86,7 @@ stdenv.mkDerivation rec {
++ optional cacaSupport libcaca
;
- nativeBuildInputs = [ python3 lua5 perl ];
+ nativeBuildInputs = [ python3 lua perl ];
# There are almost no need of "configure flags", but some libraries
@@ -109,7 +109,7 @@ stdenv.mkDerivation rec {
python3 ${waf} install
# Maybe not needed, but it doesn't hurt anyway: a standard font
mkdir -p $out/share/mpv
- ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf
+ ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf
'';
meta = {
@@ -118,7 +118,8 @@ stdenv.mkDerivation rec {
mpv is a free and open-source general-purpose video player, based on the MPlayer and mplayer2 projects, with great improvements above both.
'';
homepage = "http://mpv.io";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = [ stdenv.lib.maintainers.AndersonTorres ];
platforms = stdenv.lib.platforms.linux;
};
}
@@ -126,6 +127,6 @@ stdenv.mkDerivation rec {
# Heavily based on mplayer2 expression
# TODO: Wayland support
-# TODO: investigate libquvi support: it isn't detected by Waf script!
-# TODO: investigate caca support: it isn't detected by Waf script!
-# TODO: a more systematic way to test this package
+# TODO: investigate libquvi support
+# TODO: investigate caca support
+# TODO: investigate lua5_sockets bug
diff --git a/pkgs/applications/video/pitivi/default.nix b/pkgs/applications/video/pitivi/default.nix
new file mode 100644
index 000000000000..7f53aa07db60
--- /dev/null
+++ b/pkgs/applications/video/pitivi/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchurl, pkgconfig, intltool, itstool, makeWrapper
+, pythonPackages, gst, clutter-gst, clutter-gtk
+, gobjectIntrospection, clutter, gtk3, librsvg
+, gnome_icon_theme, gnome_icon_theme_symbolic, gnome3
+}:
+
+let
+ version = "0.93";
+in stdenv.mkDerivation rec {
+ name = "pitivi-${version}";
+
+ src = fetchurl {
+ url = "mirror://gnome/sources/pitivi/${version}/${name}.tar.xz";
+ sha256 = "0z89dwrd7akhkap270i372yszqib8yqcymv78lhdmn3a8bsa7jhp";
+ };
+
+ meta = with stdenv.lib; {
+ description = "Non-Linear video editor utilizing the power of GStreamer";
+ homepage = "http://pitivi.org/";
+ longDescription = ''
+ Pitivi is a video editor built upon the GStreamer Editing Services.
+ It aims to be an intuitive and flexible application
+ that can appeal to newbies and professionals alike.
+ '';
+ license = licenses.lgpl21Plus;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ iyzsong ];
+ };
+
+ nativeBuildInputs = [ pkgconfig intltool itstool makeWrapper ];
+
+ buildInputs = [
+ gobjectIntrospection clutter-gst clutter-gtk librsvg
+ ] ++ (with gst; [
+ gst-python gst-editing-services
+ gst-plugins-base gst-plugins-good
+ gst-plugins-bad gst-plugins-ugly gst-libav
+ ]) ++ (with pythonPackages; [
+ python pygobject3 pyxdg numpy pycairo sqlite3
+ ]);
+
+ preFixup = with stdenv.lib; with gst; let
+ libraryPath = makeLibraryPath [
+ gstreamer gst-editing-services
+ clutter-gst clutter-gtk clutter gtk3
+ gnome3.gnome_desktop
+ ];
+ in ''
+ wrapProgram "$out/bin/pitivi" \
+ --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
+ --prefix LD_LIBRARY_PATH : "${libraryPath}" \
+ --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0" \
+ --prefix XDG_DATA_DIRS : "\$XDG_ICON_DIRS:$out/share:$GSETTINGS_SCHEMAS_PATH"
+ rm $out/share/icons/hicolor/icon-theme.cache
+ '';
+}
diff --git a/pkgs/applications/video/quvi/library.nix b/pkgs/applications/video/quvi/library.nix
index 49207ad06615..0fdd78fe1068 100644
--- a/pkgs/applications/video/quvi/library.nix
+++ b/pkgs/applications/video/quvi/library.nix
@@ -1,15 +1,15 @@
-{stdenv, fetchurl, pkgconfig, lua5, curl, quvi_scripts}:
+{stdenv, fetchurl, pkgconfig, lua5, curl, quvi_scripts, libproxy, libgcrypt}:
stdenv.mkDerivation rec {
name = "libquvi-${version}";
- version="0.4.0";
+ version="0.9.4";
src = fetchurl {
- url = "mirror://sourceforge/quvi/libquvi-${version}.tar.gz";
- sha256 = "15cm9j8dssn2zhplqvlw49piwfw511lia6b635byiwfniqf6dnwp";
+ url = "mirror://sourceforge/quvi/libquvi-${version}.tar.xz";
+ sha256 = "1cl1kbgxl1jnx2nwx4z90l0lap09lnnj1fg7hxsxk3m6aj4y4grd";
};
- buildInputs = [ pkgconfig lua5 curl quvi_scripts ];
+ buildInputs = [ pkgconfig lua5 curl quvi_scripts libproxy libgcrypt ];
meta = {
description = "Web video downloader";
diff --git a/pkgs/applications/video/quvi/scripts.nix b/pkgs/applications/video/quvi/scripts.nix
index cc82158ae829..68b61fc453de 100644
--- a/pkgs/applications/video/quvi/scripts.nix
+++ b/pkgs/applications/video/quvi/scripts.nix
@@ -2,11 +2,11 @@
stdenv.mkDerivation rec {
name = "quvi-scripts-${version}";
- version="0.4.0";
+ version="0.9.20131130";
src = fetchurl {
- url = "mirror://sourceforge/quvi/libquvi-scripts-${version}.tar.gz";
- sha256 = "14p1sn7id4n35isaw3i3h8vsgfqlym09fih9k5xfqwsg6n7xdvq5";
+ url = "mirror://sourceforge/quvi/libquvi-scripts-${version}.tar.xz";
+ sha256 = "1qvp6z5k1qgcys7vf7jd6fm0g07xixmciwj14ypn1kqhmjgizwhp";
};
buildInputs = [ pkgconfig ];
diff --git a/pkgs/applications/video/quvi/tool.nix b/pkgs/applications/video/quvi/tool.nix
index f8b6aad43106..807e3954d6fe 100644
--- a/pkgs/applications/video/quvi/tool.nix
+++ b/pkgs/applications/video/quvi/tool.nix
@@ -1,22 +1,25 @@
-{stdenv, fetchurl, pkgconfig, lua5, curl, quvi_scripts, libquvi}:
+{stdenv, fetchurl, pkgconfig, lua5, curl, quvi_scripts, libquvi, lua5_sockets, glib, makeWrapper}:
stdenv.mkDerivation rec {
name = "quvi-${version}";
- version="0.4.0";
+ version="0.9.5";
src = fetchurl {
- url = "mirror://sourceforge/quvi/quvi-${version}.tar.gz";
- sha256 = "0qzyj55py4z7pg97794jjycq8nvrlr02072rgjzg8jgknw49hgfv";
+ url = "mirror://sourceforge/quvi/quvi-${version}.tar.xz";
+ sha256 = "1h52s265rp3af16dvq1xlscp2926jqap2l4ah94vrfchv6m1hffb";
};
- buildInputs = [ pkgconfig lua5 curl quvi_scripts libquvi ];
+ buildInputs = [ pkgconfig lua5 curl quvi_scripts libquvi glib makeWrapper ];
+ postInstall = ''
+ wrapProgram $out/bin/quvi --set LUA_PATH "${lua5_sockets}/share/lua/${lua5.luaversion}/?.lua"
+ '';
- meta = {
+ meta = {
description = "Web video downloader";
homepage = http://quvi.sf.net;
license = "LGPLv2.1+";
platforms = stdenv.lib.platforms.linux;
- maintainers = [ stdenv.lib.maintainers.mornfall ];
+ maintainers = [ stdenv.lib.maintainers.mornfall ];
};
}
diff --git a/pkgs/applications/video/simplescreenrecorder/default.nix b/pkgs/applications/video/simplescreenrecorder/default.nix
new file mode 100644
index 000000000000..3251127c7a19
--- /dev/null
+++ b/pkgs/applications/video/simplescreenrecorder/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, alsaLib, ffmpeg, jackaudio, libX11, libXext
+, libXfixes, mesa, pkgconfig, pulseaudio, qt4
+}:
+
+stdenv.mkDerivation rec {
+ name = "simplescreenrecorder-${version}";
+ version = "0.2.2";
+
+ src = fetchurl {
+ url = "https://github.com/MaartenBaert/ssr/archive/${version}.tar.gz";
+ sha256 = "0k1r1ilpk05qmwpnld95zxxk57qvyaq2r9f4i3la7y0xh9bz1gls";
+ };
+
+ buildInputs = [
+ alsaLib ffmpeg jackaudio libX11 libXext libXfixes mesa pkgconfig
+ pulseaudio qt4
+ ];
+
+ meta = with stdenv.lib; {
+ description = "A screen recorder for Linux";
+ homepage = http://www.maartenbaert.be/simplescreenrecorder;
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.goibhniu ];
+ };
+}
diff --git a/pkgs/applications/video/vlc/default.nix b/pkgs/applications/video/vlc/default.nix
index d75cca14b3a0..2c5b53c596a6 100644
--- a/pkgs/applications/video/vlc/default.nix
+++ b/pkgs/applications/video/vlc/default.nix
@@ -6,15 +6,16 @@
, mpeg2dec, udev, gnutls, avahi, libcddb, jackaudio, SDL, SDL_image
, libmtp, unzip, taglib, libkate, libtiger, libv4l, samba, liboggz
, libass, libva, libdvbpsi, libdc1394, libraw1394, libopus
+, libvdpau
}:
stdenv.mkDerivation rec {
name = "vlc-${version}";
- version = "2.1.2";
+ version = "2.1.4";
src = fetchurl {
url = "http://download.videolan.org/pub/videolan/vlc/${version}/${name}.tar.xz";
- sha256 = "1i4fzjv2x8mzx0bg52mgh1rrlircmb81jr58z90blbmww4mq36r1";
+ sha256 = "1lymhbb2bns73qivdaqanhggjjhyc9fwfgf5ikhng0a74msnqmiy";
};
buildInputs =
@@ -24,7 +25,7 @@ stdenv.mkDerivation rec {
udev gnutls avahi libcddb jackaudio SDL SDL_image libmtp unzip taglib
libkate libtiger libv4l samba liboggz libass libdvbpsi libva
xlibs.xlibs xlibs.libXv xlibs.libXvMC xlibs.libXpm xlibs.xcbutilkeysyms
- libdc1394 libraw1394 libopus libebml libmatroska
+ libdc1394 libraw1394 libopus libebml libmatroska libvdpau
];
nativeBuildInputs = [ pkgconfig ];
@@ -33,6 +34,8 @@ stdenv.mkDerivation rec {
[ "--enable-alsa"
"--with-kde-solid=$out/share/apps/solid/actions"
"--enable-dc1394"
+ "--enable-ncurses"
+ "--enable-vdpau"
];
preConfigure = ''sed -e "s@/bin/echo@echo@g" -i configure'';
@@ -49,5 +52,6 @@ stdenv.mkDerivation rec {
description = "Cross-platform media player and streaming server";
homepage = http://www.videolan.org/vlc/;
platforms = platforms.linux;
+ license = licenses.lgpl21Plus;
};
}
diff --git a/pkgs/applications/virtualization/8086tiny/builder.sh b/pkgs/applications/virtualization/8086tiny/builder.sh
new file mode 100644
index 000000000000..36c381bececc
--- /dev/null
+++ b/pkgs/applications/virtualization/8086tiny/builder.sh
@@ -0,0 +1,19 @@
+
+source $stdenv/setup
+
+mkdir -p ./$name $out/bin $out/share/$name $out/share/doc/$name/images
+
+cd $name
+tar xf $src
+make 8086tiny
+
+install 8086tiny $out/bin
+install bios $out/share/$name/8086tiny-bios
+install fd.img $out/share/$name/8086tiny-floppy.img
+install bios_source/bios.asm $out/share/$name/8086tiny-bios-src.asmn
+install docs/8086tiny.css $out/share/doc/$name
+install docs/doc.html $out/share/doc/$name
+for i in docs/images/*.gif
+do
+ install $i $out/share/doc/$name/images
+done
diff --git a/pkgs/applications/virtualization/8086tiny/default.nix b/pkgs/applications/virtualization/8086tiny/default.nix
new file mode 100644
index 000000000000..8e5108b44109
--- /dev/null
+++ b/pkgs/applications/virtualization/8086tiny/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl
+, localBios ? false, nasm ? null
+, sdlSupport ? true, SDL ? null
+}:
+
+
+assert sdlSupport -> (SDL != null);
+
+
+stdenv.mkDerivation rec {
+
+ name = "8086tiny-${version}";
+ version = "1.20";
+
+ src = fetchurl {
+ url ="http://www.megalith.co.uk/8086tiny/downloads/8086tiny_120.tar.bz2";
+ sha256 = "0yapnr8wvlx7h1q1w98yfy2vsbf0rlp4wd99r3xb0b7l70b36mpw";
+ };
+
+ buildInputs = with stdenv.lib;
+ optionals localBios [ nasm ]
+ ++ optionals sdlSupport [ SDL ];
+
+ builder = ./builder.sh;
+
+ meta = {
+ description = "An open-source 8086 emulator";
+ longDescription = ''
+ 8086tiny is a tiny, open source (MIT), portable (little-endian hosts) Intel PC emulator, powerful enough to run DOS, Windows 3.0, Excel, MS Flight Simulator, AutoCAD, Lotus 1-2-3, and similar applications. 8086tiny emulates a "late 80's era" PC XT-type machine.
+
+ 8086tiny is based on an IOCCC 2013 winning entry. In fact that is the "unobfuscated" version :)
+ '';
+ homepage = http://www.megalith.co.uk/8086tiny/index.html;
+ license = stdenv.lib.licenses.mit;
+ maintainers = [ stdenv.lib.maintainers.AndersonTorres ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
+
+# TODO: add support for a locally made BIOS
diff --git a/pkgs/applications/virtualization/OVMF/default.nix b/pkgs/applications/virtualization/OVMF/default.nix
index e6d0b7cb40dd..54d697d42751 100644
--- a/pkgs/applications/virtualization/OVMF/default.nix
+++ b/pkgs/applications/virtualization/OVMF/default.nix
@@ -12,7 +12,7 @@ let
in
stdenv.mkDerivation (edk2.setup "OvmfPkg/OvmfPkg${targetArch}.dsc" {
- name = "OVMF-2012-10-09";
+ name = "OVMF-2014-02-01";
unpackPhase = ''
for file in \
diff --git a/pkgs/applications/virtualization/bochs/default.nix b/pkgs/applications/virtualization/bochs/default.nix
index 6b8cf5dc0356..75afcb41f808 100644
--- a/pkgs/applications/virtualization/bochs/default.nix
+++ b/pkgs/applications/virtualization/bochs/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
url = "http://downloads.sourceforge.net/project/bochs/bochs/${version}/${name}.tar.gz";
sha256 = "042blm1xb9ig4fh2bv8nrrfpgkcxy4hq8yrkx7mrdpm5g4mvfwyr";
};
-
+
buildInputs = with stdenv.lib;
[ libX11 mesa ]
++ optionals sdlSupport [ SDL ]
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
++ optionals curlSupport [ curl ];
configureFlags = ''
- --with-x11
+ --with-x11
--with-term=${if termSupport then "yes" else "no"}
--with-sdl=${if sdlSupport then "yes" else "no"}
--with-svga=no
@@ -42,11 +42,11 @@ stdenv.mkDerivation rec {
--enable-plugins=no
--enable-disasm
--enable-debugger
- --enable-ne2000
- --enable-e1000
- --enable-sb16
- --enable-voodoo
- --enable-usb
+ --enable-ne2000
+ --enable-e1000
+ --enable-sb16
+ --enable-voodoo
+ --enable-usb
--enable-pnic
'';
@@ -56,7 +56,8 @@ stdenv.mkDerivation rec {
Bochs is an open-source (LGPL), highly portable IA-32 PC emulator, written in C++, that runs on most popular platforms. It includes emulation of the Intel x86 CPU, common I/O devices, and a custom BIOS.
'';
homepage = http://bochs.sourceforge.net/;
- license = "LGPL";
+ license = stdenv.lib.licenses.lgpl2Plus;
+ maintainers = [ stdenv.lib.maintainers.AndersonTorres ];
platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/virtualization/docker/default.nix b/pkgs/applications/virtualization/docker/default.nix
new file mode 100644
index 000000000000..40385d9d36af
--- /dev/null
+++ b/pkgs/applications/virtualization/docker/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, makeWrapper, go, lxc, sqlite, iproute, bridge_utils, devicemapper,
+btrfsProgs, iptables, bash}:
+
+stdenv.mkDerivation rec {
+ name = "docker-${version}";
+ version = "0.9.1";
+
+ src = fetchurl {
+ url = "https://github.com/dotcloud/docker/archive/v${version}.tar.gz";
+ sha256 = "0m4s21dxd1bj08xrmi7iw77djj3cpxvjsin12p6v6v1qnigm18ww";
+ };
+
+ phases = ["unpackPhase" "preBuild" "buildPhase" "installPhase"];
+
+ buildInputs = [ makeWrapper go sqlite lxc iproute bridge_utils devicemapper btrfsProgs iptables ];
+
+ preBuild = ''
+ patchShebangs ./hack
+ '';
+
+ buildPhase = ''
+ export AUTO_GOPATH=1
+ export DOCKER_GITCOMMIT="867b2a90c228f62cdcd44907ceef279a2d8f1ac5"
+ ./hack/make.sh dynbinary
+ '';
+
+ installPhase = ''
+ install -Dm755 ./bundles/${version}/dynbinary/docker-${version} $out/bin/docker
+ install -Dm755 ./bundles/${version}/dynbinary/dockerinit-${version} $out/bin/dockerinit
+ wrapProgram $out/bin/docker --prefix PATH : "${iproute}/sbin:sbin:${lxc}/bin:${iptables}/sbin"
+
+ # systemd
+ install -Dm644 ./contrib/init/systemd/docker.service $out/etc/systemd/system/docker.service
+
+ # completion
+ install -Dm644 ./contrib/completion/bash/docker $out/share/bash-completion/completions/docker
+ install -Dm644 ./contrib/completion/zsh/_docker $out/share/zsh/site-functions/_docker
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = http://www.docker.io/;
+ description = "An open source project to pack, ship and run any application as a lightweight container";
+ license = licenses.asl20;
+ maintainers = with maintainers; [ offline ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix
index dcf5b4e50097..b6e28d444111 100644
--- a/pkgs/applications/virtualization/qemu/default.nix
+++ b/pkgs/applications/virtualization/qemu/default.nix
@@ -1,29 +1,29 @@
{ stdenv, fetchurl, python, zlib, pkgconfig, glib, ncurses, perl, pixman
-, attr, libcap, vde2, alsaLib, texinfo, libuuid
+, attr, libcap, vde2, alsaLib, texinfo, libuuid, flex, bison
, makeWrapper
, sdlSupport ? true, SDL
, vncSupport ? true, libjpeg, libpng
-, spiceSupport ? true, spice, spice_protocol
+, spiceSupport ? true, spice, spice_protocol, usbredir
, x86Only ? false
}:
-let n = "qemu-1.5.2"; in
+let n = "qemu-1.7.1"; in
stdenv.mkDerivation rec {
name = n + (if x86Only then "-x86-only" else "");
src = fetchurl {
url = "http://wiki.qemu.org/download/${n}.tar.bz2";
- sha256 = "0l52jwlxmwp9g3jpq0g7ix9dq4qgh46nd2h58lh47f0a35yi8qgn";
+ sha256 = "1x5y06zhp0gc97g1sb98vf7dkawg63xywv0mbnpfnbi20jh452fn";
};
buildInputs =
[ python zlib pkgconfig glib ncurses perl pixman attr libcap
- vde2 alsaLib texinfo libuuid makeWrapper
+ vde2 alsaLib texinfo libuuid flex bison makeWrapper
]
++ stdenv.lib.optionals sdlSupport [ SDL ]
++ stdenv.lib.optionals vncSupport [ libjpeg libpng ]
- ++ stdenv.lib.optionals spiceSupport [ spice_protocol spice ];
+ ++ stdenv.lib.optionals spiceSupport [ spice_protocol spice usbredir ];
enableParallelBuilding = true;
@@ -43,11 +43,11 @@ stdenv.mkDerivation rec {
fi
'';
- meta = {
+ meta = with stdenv.lib; {
homepage = http://www.qemu.org/;
description = "A generic and open source machine emulator and virtualizer";
- license = "GPLv2+";
- maintainers = with stdenv.lib.maintainers; [ viric shlevy eelco ];
- platforms = stdenv.lib.platforms.linux;
+ license = licenses.gpl2Plus;
+ maintainers = with maintainers; [ viric shlevy eelco ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/virtualization/virt-manager/default.nix b/pkgs/applications/virtualization/virt-manager/default.nix
index fb2dde66442f..dba0d11b425a 100644
--- a/pkgs/applications/virtualization/virt-manager/default.nix
+++ b/pkgs/applications/virtualization/virt-manager/default.nix
@@ -1,74 +1,67 @@
{ stdenv, fetchurl, pythonPackages, intltool, libxml2Python, curl, python
, makeWrapper, virtinst, pyGtkGlade, pythonDBus, gnome_python, gtkvnc, vte
-, spiceSupport ? true, spice_gtk
+, gtk3, gobjectIntrospection, libvirt-glib, gsettings_desktop_schemas, glib
+, avahi, dconf, spiceSupport ? true, spice_gtk
}:
with stdenv.lib;
+with pythonPackages;
-let version = "0.9.5"; in
-
-stdenv.mkDerivation rec {
+buildPythonPackage rec {
name = "virt-manager-${version}";
+ version = "1.0.1";
+ namePrefix = "";
src = fetchurl {
- url = "http://virt-manager.et.redhat.com/download/sources/virt-manager/virt-manager-${version}.tar.gz";
- sha256 = "0gc06cdbq6c2a06l939516lvjii7lr0wng90kqgl1i5q5wlgnajx";
+ url = "http://virt-manager.org/download/sources/virt-manager/${name}.tar.gz";
+ sha256 = "1n248kack1fni8y17ysgq5xhvffcgy4l62hnd0zvr4kjw0579qq8";
};
- pythonPath = with pythonPackages;
- [ setuptools eventlet greenlet gflags netaddr sqlalchemy carrot routes
+ propagatedBuildInputs =
+ [ eventlet greenlet gflags netaddr sqlalchemy carrot routes
paste_deploy m2crypto ipy boto_1_9 twisted sqlalchemy_migrate
distutils_extra simplejson readline glance cheetah lockfile httplib2
- # !!! should libvirt be a build-time dependency? Note that
- # libxml2Python is a dependency of libvirt.py.
- libvirt libxml2Python urlgrabber virtinst pyGtkGlade pythonDBus gnome_python
- gtkvnc vte
+ urlgrabber virtinst pyGtkGlade pythonDBus gnome_python pygobject3
+ libvirt libxml2Python ipaddr vte
] ++ optional spiceSupport spice_gtk;
buildInputs =
- [ pythonPackages.python
- pythonPackages.wrapPython
- pythonPackages.mox
- pythonPackages.urlgrabber
+ [ mox
intltool
- pyGtkGlade
- pythonDBus
- gnome_python
gtkvnc
- ] ++ pythonPath;
+ gtk3
+ libvirt-glib
+ avahi
+ glib
+ gobjectIntrospection
+ ];
- buildPhase = "make";
-
- nativeBuildInputs = [ makeWrapper pythonPackages.wrapPython ];
-
- # TODO
- # virt-manager -> import gtk.glade -> No module named glade --> fixed by removing 'pygtk' and by only using pyGtkGlade
- # -> import gconf -> ImportError: No module named gconf
- # -> pfad um gtk-2.0 erweitern in virt-manger runner -> /nix/store/hnyxc9i4yz2mc42n44ms13mn8n486s5h-gnome-python-2.28.1/lib/python2.7/site-packages/gtk-2.0
- # -> Error starting Virtual Machine Manager: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See http://projects.gnome.org/gconf/ for information. (Details - 1: GetIOR failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.GConf was not provided by any .service files)
-
-#Traceback (most recent call last):
-# File "/nix/store/y9rcdiv6686sqcv4r39p575s37jzc2cz-virt-manager-0.9.1/share/virt-manager/virt-manager.py", line 383, in
-# main()
-# File "/nix/store/y9rcdiv6686sqcv4r39p575s37jzc2cz-virt-manager-0.9.1/share/virt-manager/virt-manager.py", line 315, in main
-# config = virtManager.config.vmmConfig(appname, appversion, glade_dir)
-# File "/nix/store/y9rcdiv6686sqcv4r39p575s37jzc2cz-virt-manager-0.9.1/share/virt-manager/virtManager/config.py", line 98, in __init__
-# self.conf.add_dir(self.conf_dir, gconf.CLIENT_PRELOAD_NONE)
-#GError: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See http://projects.gnome.org/gconf/ for information. (Details - 1: GetIOR failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.GConf was not provided by any .service files)
-# -> fixed by http://nixos.org/wiki/Solve_GConf_errors_when_running_GNOME_applications & a restart
- # virt-manager-tui -> ImportError: No module named newt_syrup.dialogscreen
-
- installPhase = ''
- make install
-
- # A hack, but the most reliable method so far
- echo "#!/usr/bin/env python" | cat - src/virt-manager.py > $out/bin/virt-manager
- echo "#!/usr/bin/env python" | cat - src/virt-manager-tui.py > $out/bin/virt-manager-tui
-
- wrapPythonPrograms
+ configurePhase = ''
+ sed -i 's/from distutils.core/from setuptools/g' setup.py
+ sed -i 's/from distutils.command.install/from setuptools.command.install/g' setup.py
+ python setup.py configure --prefix=$out
'';
- meta = {
+ buildPhase = "true";
+
+ postInstall = ''
+ # GI_TYPELIB_PATH is needed at runtime for GObject stuff to work
+ for file in "$out"/bin/*; do
+ wrapProgram "$file" \
+ --prefix GI_TYPELIB_PATH : $GI_TYPELIB_PATH \
+ --prefix GIO_EXTRA_MODULES : "${dconf}/lib/gio/modules" \
+ --prefix GSETTINGS_SCHEMA_DIR : $out/share/glib-2.0/schemas \
+ --prefix LD_LIBRARY_PATH : ${gtk3}/lib/:${libvirt-glib}/lib/:${vte}/lib:${gtkvnc}/lib${optionalString spiceSupport ":${spice_gtk}/lib"} \
+ --prefix XDG_DATA_DIRS : "$out/share:${gsettings_desktop_schemas}/share:${gtk3}/share:\$XDG_DATA_DIRS"
+ done
+
+ ${glib}/bin/glib-compile-schemas "$out"/share/glib-2.0/schemas
+ '';
+
+ # Failed tests
+ doCheck = false;
+
+ meta = with stdenv.lib; {
homepage = http://virt-manager.org;
description = "Desktop user interface for managing virtual machines";
longDescription = ''
@@ -76,7 +69,7 @@ stdenv.mkDerivation rec {
virtual machines through libvirt. It primarily targets KVM VMs, but also
manages Xen and LXC (linux containers).
'';
- license = "GPLv2";
- maintainers = with stdenv.lib.maintainers; [qknight];
+ license = licenses.gpl2;
+ maintainers = with maintainers; [qknight offline];
};
}
diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix
index 2ce134090fe5..266ab11a39fb 100644
--- a/pkgs/applications/virtualization/virtualbox/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/default.nix
@@ -1,6 +1,6 @@
{ stdenv, fetchurl, lib, iasl, dev86, pam, libxslt, libxml2, libX11, xproto, libXext
, libXcursor, libXmu, qt4, libIDL, SDL, libcap, zlib, libpng, glib, kernel, lvm2
-, which, alsaLib, curl, gawk
+, which, alsaLib, curl, libvpx, gawk
, xorriso, makeself, perl, pkgconfig
, javaBindings ? false, jdk ? null
, pythonBindings ? false, python ? null
@@ -11,7 +11,7 @@ with stdenv.lib;
let
- version = "4.2.18"; # changes ./guest-additions as well
+ version = "4.3.10"; # changes ./guest-additions as well
forEachModule = action: ''
for mod in \
@@ -31,13 +31,13 @@ let
'';
# See https://github.com/NixOS/nixpkgs/issues/672 for details
- extpackRevision = "88780";
+ extpackRevision = "93012";
extensionPack = requireFile rec {
name = "Oracle_VM_VirtualBox_Extension_Pack-${version}-${extpackRevision}.vbox-extpack";
# IMPORTANT: Hash must be base16 encoded because it's used as an input to
# VBoxExtPackHelperApp!
- # Tip: see http://dlc.sun.com.edgesuite.net/virtualbox/4.2.18/SHA256SUMS
- sha256 = "1d1737b59d0f30f5d42beeabaff168bdc0a75b8b28df685979be6173e5adbbba";
+ # Tip: see http://dlc.sun.com.edgesuite.net/virtualbox/4.3.10/SHA256SUMS
+ sha256 = "ec3f2a98373d5e228acb4756ac07f44212c4d53f6b83deee81b791abb0d2608a";
message = ''
In order to use the extension pack, you need to comply with the VirtualBox Personal Use
and Evaluation License (PUEL) by downloading the related binaries from:
@@ -56,12 +56,12 @@ in stdenv.mkDerivation {
src = fetchurl {
url = "http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}.tar.bz2";
- sha256 = "9dbddf393b029c549249f627d12040c1d257972bc09292969b8819a31ab78d74";
+ sha256 = "739835aee3274a663b23eeb748bd0430e8a5d8ba2f4d0eae5dc47ff2c485e23b";
};
buildInputs =
[ iasl dev86 libxslt libxml2 xproto libX11 libXext libXcursor qt4 libIDL SDL
- libcap glib lvm2 python alsaLib curl pam xorriso makeself perl
+ libcap glib lvm2 python alsaLib curl libvpx pam xorriso makeself perl
pkgconfig which libXmu ]
++ optional javaBindings jdk
++ optional pythonBindings python;
diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
index 805e0b867d97..5fc755904170 100644
--- a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = "http://download.virtualbox.org/virtualbox/${version}/VBoxGuestAdditions_${version}.iso";
- sha256 = "f11a7f13dfe7bf9f246fb877144bb467fe6deadcd876568ec79b6ccd3b59d767";
+ sha256 = "247e15e9a205dcd4761f6cb547ceca2a61e8d6905c1930870939fd323f4cd1ae";
};
KERN_DIR = "${kernel.dev}/lib/modules/*/build";
diff --git a/pkgs/applications/window-managers/dwm/confnotify-6.0.patch b/pkgs/applications/window-managers/dwm/confnotify-6.0.patch
deleted file mode 100644
index 5b5e2ebb68a7..000000000000
--- a/pkgs/applications/window-managers/dwm/confnotify-6.0.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Fix SDL fullscreen problems when the resolution changes:
-https://groups.google.com/d/msg/wmii/nJBrSjrnnq8/ZEYWOWE5pj4J
-
-diff -r ec4baab78314 dwm.c
---- a/dwm.c Mon Dec 19 15:38:30 2011 +0100
-+++ b/dwm.c Sat Jan 14 12:35:50 2012 +0100
-@@ -397,9 +397,10 @@
- showhide(m->stack);
- else for(m = mons; m; m = m->next)
- showhide(m->stack);
-- if(m)
-+ if(m) {
- arrangemon(m);
-- else for(m = mons; m; m = m->next)
-+ restack(m);
-+ } else for(m = mons; m; m = m->next)
- arrangemon(m);
- }
-
-@@ -408,7 +409,6 @@
- strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
- if(m->lt[m->sellt]->arrange)
- m->lt[m->sellt]->arrange(m);
-- restack(m);
- }
-
- void
-@@ -1827,6 +1827,8 @@
- .event_mask = ButtonPressMask|ExposureMask
- };
- for(m = mons; m; m = m->next) {
-+ if (m->barwin)
-+ continue;
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
- CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
diff --git a/pkgs/applications/window-managers/dwm/default.nix b/pkgs/applications/window-managers/dwm/default.nix
index 82eb9e56935f..b69dd9d8a492 100644
--- a/pkgs/applications/window-managers/dwm/default.nix
+++ b/pkgs/applications/window-managers/dwm/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
prePatch = ''sed -i "s@/usr/local@$out@" config.mk'';
# Allow users set their own list of patches
- patches = [ ./confnotify-6.0.patch ] ++ patches;
+ inherit patches;
buildPhase = " make ";
diff --git a/pkgs/applications/window-managers/i3/default.nix b/pkgs/applications/window-managers/i3/default.nix
index f6d2dc4cfe5e..ebdc7b143c37 100644
--- a/pkgs/applications/window-managers/i3/default.nix
+++ b/pkgs/applications/window-managers/i3/default.nix
@@ -1,18 +1,18 @@
{ fetchurl, stdenv, which, pkgconfig, libxcb, xcbutilkeysyms, xcbutil,
xcbutilwm, libstartup_notification, libX11, pcre, libev, yajl,
- libXcursor, coreutils, perl, pango }:
+ xcb-util-cursor, coreutils, perl, pango }:
stdenv.mkDerivation rec {
name = "i3-${version}";
- version = "4.6";
+ version = "4.7.2";
src = fetchurl {
url = "http://i3wm.org/downloads/${name}.tar.bz2";
- sha256 = "1qand44hjqz84f2xzd0mmyk9vpsm7iwz6446s4ivdj6f86213lpm";
+ sha256 = "14zkn5jgm0b7ablvxcxh9gdzq6mjdd6i1kl9dbmifl2a6rg5dr3g";
};
buildInputs = [ which pkgconfig libxcb xcbutilkeysyms xcbutil xcbutilwm
- libstartup_notification libX11 pcre libev yajl libXcursor perl pango ];
+ libstartup_notification libX11 pcre libev yajl xcb-util-cursor perl pango ];
patchPhase = ''
patchShebangs .
diff --git a/pkgs/applications/window-managers/openbox/default.nix b/pkgs/applications/window-managers/openbox/default.nix
index 487a8a5b387a..56a5f0e3e2ce 100644
--- a/pkgs/applications/window-managers/openbox/default.nix
+++ b/pkgs/applications/window-managers/openbox/default.nix
@@ -1,6 +1,6 @@
{ stdenv, fetchurl, pkgconfig
, libxml2, libXinerama, libXcursor, libXau, libXrandr
-, imlib2, pango, libstartup_notification }:
+, imlib2, pango, libstartup_notification, makeWrapper}:
stdenv.mkDerivation rec {
name = "openbox-3.5.2";
@@ -9,6 +9,7 @@ stdenv.mkDerivation rec {
pkgconfig libxml2
libXinerama libXcursor libXau libXrandr
imlib2 pango libstartup_notification
+ makeWrapper
];
src = fetchurl {
@@ -16,6 +17,14 @@ stdenv.mkDerivation rec {
sha256 = "0cxgb334zj6aszwiki9g10i56sm18i7w1kw52vdnwgzq27pv93qj";
};
+ # Openbox needs XDG_DATA_DIRS set or it can't find its default theme
+ postInstall = ''
+ wrapProgram "$out/bin/openbox" --prefix XDG_DATA_DIRS : "$out/share"
+ wrapProgram "$out/bin/openbox-session" --prefix XDG_DATA_DIRS : "$out/share"
+ wrapProgram "$out/bin/openbox-gnome-session" --prefix XDG_DATA_DIRS : "$out/share"
+ wrapProgram "$out/bin/openbox-kde-session" --prefix XDG_DATA_DIRS : "$out/share"
+ '';
+
meta = {
description = "X window manager for non-desktop embedded systems";
homepage = http://openbox.org/;
diff --git a/pkgs/applications/window-managers/trayer/default.nix b/pkgs/applications/window-managers/trayer/default.nix
index b8ecf81f7fc7..9b9017420c02 100644
--- a/pkgs/applications/window-managers/trayer/default.nix
+++ b/pkgs/applications/window-managers/trayer/default.nix
@@ -20,8 +20,6 @@ stdenv.mkDerivation rec {
description = "A lightweight GTK2-based systray for UNIX desktop";
- maintainers = [ stdenv.lib.maintainers.shlevy ];
-
platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/window-managers/weston/default.nix b/pkgs/applications/window-managers/weston/default.nix
index 913235287ac5..4880029119eb 100644
--- a/pkgs/applications/window-managers/weston/default.nix
+++ b/pkgs/applications/window-managers/weston/default.nix
@@ -1,20 +1,20 @@
{ stdenv, fetchurl, pkgconfig, wayland, mesa, libxkbcommon
, cairo, libxcb, libXcursor, x11, udev, libdrm, mtdev
-, libjpeg, pam, autoconf, automake, libtool }:
+, libjpeg, pam, autoconf, automake, libtool, dbus }:
-let version = "1.3.1"; in
+let version = "1.4.0"; in
stdenv.mkDerivation rec {
name = "weston-${version}";
src = fetchurl {
url = "http://wayland.freedesktop.org/releases/${name}.tar.xz";
- sha256 = "1isvh66irrz707r69495767n5yxp07dvy0xx6mj1mbj1n4s1657p";
+ sha256 = "0r7dz72ys9p3f697ajgmihkar2da36bnjna6yanb3kg9k2fk38kl";
};
buildInputs = [
pkgconfig wayland mesa libxkbcommon
- cairo libxcb libXcursor x11 udev libdrm mtdev libjpeg pam
+ cairo libxcb libXcursor x11 udev libdrm mtdev libjpeg pam dbus.libs
];
NIX_CFLAGS_COMPILE = "-I${libdrm}/include/libdrm";
diff --git a/pkgs/applications/window-managers/xmonad/default.nix b/pkgs/applications/window-managers/xmonad/default.nix
index 54ef0b274aa8..c80c8f1c9db0 100644
--- a/pkgs/applications/window-managers/xmonad/default.nix
+++ b/pkgs/applications/window-managers/xmonad/default.nix
@@ -10,8 +10,9 @@ cabal.mkDerivation (self: {
extensibleExceptions filepath mtl utf8String X11
];
postInstall = ''
+ shopt -s globstar
mkdir -p $out/share/man/man1
- mv $out/share/xmonad-*/man/*.1 $out/share/man/man1/
+ mv "$out/"**"/man/"*.1 $out/share/man/man1/
'';
patches = [
diff --git a/pkgs/build-support/build-fhs-chrootenv/default.nix b/pkgs/build-support/build-fhs-chrootenv/default.nix
index 8756c4835b29..2f3aa14c6a0f 100644
--- a/pkgs/build-support/build-fhs-chrootenv/default.nix
+++ b/pkgs/build-support/build-fhs-chrootenv/default.nix
@@ -1,10 +1,12 @@
{stdenv, glibc, glibcLocales, gcc, coreutils, diffutils, findutils, gnused, gnugrep, gnutar, gzip, bzip2,
-bashInteractive, xz, shadow, gawk, less, buildEnv}:
+bashInteractive, xz, shadow, gawk, less, su, buildEnv}:
{name, pkgs ? [], profile ? ""}:
let
- basePkgs = [ glibc glibcLocales gcc coreutils diffutils findutils gnused gnugrep gnutar gzip bzip2
-bashInteractive xz shadow gawk less ];
+ basePkgs = [
+ glibc glibcLocales gcc coreutils diffutils findutils gnused gnugrep gnutar
+ gzip bzip2 bashInteractive xz shadow gawk less su
+ ];
# Compose a global profile for the chroot environment
profilePkg = stdenv.mkDerivation {
@@ -31,16 +33,16 @@ bashInteractive xz shadow gawk less ];
mountSh = ./mount.sh.in;
loadSh = ./load.sh.in;
umountSh = ./umount.sh.in;
- destroySh = ./destroy.sh.in;
-in
-stdenv.mkDerivation {
- name = "${name}-chrootenv";
- buildCommand = ''
- mkdir -p $out/sw
- cd $out/sw
-
- for i in ${staticUsrProfile}/{etc,bin,lib{,32,64},sbin,var}
- do
+ destroySh = ./destroy.sh.in;
+in
+stdenv.mkDerivation {
+ name = "${name}-chrootenv";
+ buildCommand = ''
+ mkdir -p $out/sw
+ cd $out/sw
+
+ for i in ${staticUsrProfile}/{etc,bin,lib{,32,64},sbin,var}
+ do
if [ -x "$i" ]
then
ln -s "$i"
diff --git a/pkgs/build-support/build-pecl.nix b/pkgs/build-support/build-pecl.nix
new file mode 100644
index 000000000000..d84497e8019c
--- /dev/null
+++ b/pkgs/build-support/build-pecl.nix
@@ -0,0 +1,9 @@
+{ stdenv, php, autoreconfHook }:
+
+args: stdenv.mkDerivation (args // {
+ buildInputs = [ php autoreconfHook ] ++ args.buildInputs or [];
+
+ makeFlags = [ "EXTENSION_DIR=$(out)/lib/php/extensions" ] ++ args.makeFlags or [];
+
+ autoreconfPhase = "phpize";
+})
diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix
index 6dc83963d19d..ed7ca30db132 100644
--- a/pkgs/build-support/cabal/default.nix
+++ b/pkgs/build-support/cabal/default.nix
@@ -195,10 +195,6 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
done
done
- ${optionalString self.enableSharedExecutables ''
- configureFlags+=" --ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.ghc.name}/${self.pname}-${self.version}";
- ''}
-
echo "configure flags: $extraConfigureFlags $configureFlags"
./Setup configure --verbose --prefix="$out" --libdir='$prefix/lib/$compiler' \
--libsubdir='$pkgid' $extraConfigureFlags $configureFlags 2>&1 \
@@ -220,7 +216,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
./Setup build ${self.buildTarget}
export GHC_PACKAGE_PATH=$(${ghc.GHCPackages})
- test -n "$noHaddock" || ./Setup haddock
+ test -n "$noHaddock" || ./Setup haddock --html --hoogle
eval "$postBuild"
'';
diff --git a/pkgs/build-support/clang-wrapper/default.nix b/pkgs/build-support/clang-wrapper/default.nix
index 05b8194697e1..4b2a5a1182ea 100644
--- a/pkgs/build-support/clang-wrapper/default.nix
+++ b/pkgs/build-support/clang-wrapper/default.nix
@@ -18,21 +18,21 @@ let
clangVersion = (builtins.parseDrvName clang.name).version;
clangName = (builtins.parseDrvName clang.name).name;
-
+
in
stdenv.mkDerivation {
name =
(if name != "" then name else clangName + "-wrapper") +
(if clang != null && clangVersion != "" then "-" + clangVersion else "");
-
+
builder = ./builder.sh;
setupHook = ./setup-hook.sh;
clangWrapper = ./clang-wrapper.sh;
ldWrapper = ./ld-wrapper.sh;
utils = ./utils.sh;
addFlags = ./add-flags;
-
+
inherit nativeTools nativeLibc nativePrefix clang clangVersion libcxx;
libcxxabi = libcxx.abi or null;
@@ -42,7 +42,7 @@ stdenv.mkDerivation {
binutils = if nativeTools then null else binutils;
# The wrapper scripts use 'cat', so we may need coreutils
coreutils = if nativeTools then null else coreutils;
-
+
langC = true;
langCC = true;
shell = if shell == "" then stdenv.shell else
@@ -65,7 +65,7 @@ stdenv.mkDerivation {
if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform");
};
-
+
meta =
let clang_ = if clang != null then clang else {}; in
(if clang_ ? meta then removeAttrs clang.meta ["priority"] else {}) //
@@ -84,4 +84,6 @@ stdenv.mkDerivation {
if stdenv.system == "mips64el-linux" then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform")
else "";
+
+ preferLocalBuild = true;
}
diff --git a/pkgs/build-support/clang-wrapper/setup-hook.sh b/pkgs/build-support/clang-wrapper/setup-hook.sh
index 74365a527043..f7687651eaf6 100644
--- a/pkgs/build-support/clang-wrapper/setup-hook.sh
+++ b/pkgs/build-support/clang-wrapper/setup-hook.sh
@@ -1,6 +1,6 @@
addCVars () {
if test -d $1/include; then
- export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$1/include"
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
fi
if test -d $1/lib64; then
@@ -31,3 +31,6 @@ fi
if test -n "@coreutils@"; then
addToSearchPath PATH @coreutils@/bin
fi
+
+: ${CXX:=clang++}
+export CXX
diff --git a/pkgs/build-support/fetchgit/builder.sh b/pkgs/build-support/fetchgit/builder.sh
index 5c7d92698cc3..9050cce6ee8f 100644
--- a/pkgs/build-support/fetchgit/builder.sh
+++ b/pkgs/build-support/fetchgit/builder.sh
@@ -6,6 +6,8 @@ source $stdenv/setup
header "exporting $url (rev $rev) into $out"
-$fetcher --builder --url "$url" --out "$out" --rev "$rev" ${leaveDotGit:+--leave-dotGit}
+$fetcher --builder --url "$url" --out "$out" --rev "$rev" \
+ ${leaveDotGit:+--leave-dotGit} \
+ ${fetchSubmodules:+--fetch-submodules}
stopNest
diff --git a/pkgs/build-support/fetchgit/default.nix b/pkgs/build-support/fetchgit/default.nix
index e94e4185936b..a17daf9a2c57 100644
--- a/pkgs/build-support/fetchgit/default.nix
+++ b/pkgs/build-support/fetchgit/default.nix
@@ -1,5 +1,5 @@
{stdenv, git, cacert}:
-{url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? false }:
+{url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? false, fetchSubmodules ? true}:
/* NOTE:
fetchgit has one problem: git fetch only works for refs.
@@ -23,6 +23,8 @@
server admins start using the new version?
*/
+assert md5 != "" || sha256 != "";
+
stdenv.mkDerivation {
name = "git-export";
builder = ./builder.sh;
@@ -33,7 +35,7 @@ stdenv.mkDerivation {
outputHashMode = "recursive";
outputHash = if sha256 == "" then md5 else sha256;
- inherit url rev leaveDotGit;
+ inherit url rev leaveDotGit fetchSubmodules;
GIT_SSL_CAINFO = "${cacert}/etc/ca-bundle.crt";
@@ -44,5 +46,7 @@ stdenv.mkDerivation {
# by definition pure.
"http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
];
+
+ preferLocalBuild = true;
}
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git
index 8d0de055c756..6e79f82eae86 100755
--- a/pkgs/build-support/fetchgit/nix-prefetch-git
+++ b/pkgs/build-support/fetchgit/nix-prefetch-git
@@ -6,6 +6,7 @@ expHash=
hashType=$NIX_HASH_ALGO
deepClone=$NIX_PREFETCH_GIT_DEEP_CLONE
leaveDotGit=$NIX_PREFETCH_GIT_LEAVE_DOT_GIT
+fetchSubmodules=
builder=
if test -n "$deepClone"; then
@@ -33,6 +34,7 @@ for arg; do
--deepClone) deepClone=true;;
--no-deepClone) deepClone=false;;
--leave-dotGit) leaveDotGit=true;;
+ --fetch-submodules) fetchSubmodules=true;;
--builder) builder=true;;
*)
argi=$(($argi + 1))
@@ -66,6 +68,7 @@ Options:
--deepClone Clone submodules recursively.
--no-deepClone Do not clone submodules.
--leave-dotGit Keep the .git directories.
+ --fetch-submodules Fetch submodules.
--builder Clone as fetchgit does, but url, rev, and out option are mandatory.
"
exit 1
@@ -178,7 +181,9 @@ clone(){
)
# Checkout linked sources.
- init_submodules;
+ if test -n "$fetchSubmodules"; then
+ init_submodules;
+ fi
if [ -z "$builder" -a -f .topdeps ]; then
if tg help 2>&1 > /dev/null
diff --git a/pkgs/build-support/fetchsvn/default.nix b/pkgs/build-support/fetchsvn/default.nix
index 30625a758f8c..228a5eaa5804 100644
--- a/pkgs/build-support/fetchsvn/default.nix
+++ b/pkgs/build-support/fetchsvn/default.nix
@@ -40,4 +40,6 @@ stdenv.mkDerivation {
# by definition pure.
"http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
];
+
+ preferLocalBuild = true;
}
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix
index 294d9a43ef7d..af4a6700153c 100644
--- a/pkgs/build-support/fetchurl/default.nix
+++ b/pkgs/build-support/fetchurl/default.nix
@@ -66,6 +66,7 @@ in
showURLs ? false
}:
+assert builtins.isList urls;
assert urls != [] -> url == "";
assert url != "" -> urls == [];
diff --git a/pkgs/build-support/fetchurl/mirrors.nix b/pkgs/build-support/fetchurl/mirrors.nix
index c6c294d55042..c4841c50d94c 100644
--- a/pkgs/build-support/fetchurl/mirrors.nix
+++ b/pkgs/build-support/fetchurl/mirrors.nix
@@ -159,7 +159,7 @@ rec {
# Debian.
debian = [
- #ftp://ftp.au.debian.org/debian/
+ ftp://ftp.au.debian.org/debian/
ftp://ftp.de.debian.org/debian/
ftp://ftp.es.debian.org/debian/
ftp://ftp.fr.debian.org/debian/
diff --git a/pkgs/build-support/gcc-cross-wrapper/builder.sh b/pkgs/build-support/gcc-cross-wrapper/builder.sh
index 5a5bd45a8f81..2dfa315d168f 100644
--- a/pkgs/build-support/gcc-cross-wrapper/builder.sh
+++ b/pkgs/build-support/gcc-cross-wrapper/builder.sh
@@ -87,6 +87,8 @@ mkGccWrapper $out/bin/$crossConfig-gcc $gccPath/$crossConfig-gcc
mkGccWrapper $out/bin/$crossConfig-g++ $gccPath/$crossConfig-g++
ln -s $crossConfig-g++ $out/bin/$crossConfig-c++
+mkGccWrapper $out/bin/$crossConfig-cpp $gccPath/$crossConfig-cpp
+
mkGccWrapper $out/bin/$crossConfig-g77 $gccPath/$crossConfig-g77
ln -s $crossConfig-g77 $out/bin/$crossConfig-f77
diff --git a/pkgs/build-support/gcc-wrapper/builder.sh b/pkgs/build-support/gcc-wrapper/builder.sh
index ed7ad0a50b73..c79680712ee7 100644
--- a/pkgs/build-support/gcc-wrapper/builder.sh
+++ b/pkgs/build-support/gcc-wrapper/builder.sh
@@ -66,13 +66,23 @@ else
echo "$gccCFlags" > $out/nix-support/gcc-cflags
gccPath="$gcc/bin"
- ldPath="$binutils/bin"
+ # On Illumos/Solaris we might prefer native ld
+ if test -n "$nativePrefix"; then
+ ldPath="$nativePrefix/bin"
+ else
+ ldPath="$binutils/bin"
+ fi;
fi
doSubstitute() {
local src=$1
local dst=$2
+ local ld="$ldPath/ld"
+ if $ld -V 2>&1 |grep Solaris; then
+ # Use Solaris specific linker wrapper
+ ld="$out/bin/ld-solaris"
+ fi
# Can't use substitute() here, because replace may not have been
# built yet (in the bootstrap).
sed \
@@ -85,7 +95,7 @@ doSubstitute() {
-e "s^@binutils@^$binutils^g" \
-e "s^@coreutils@^$coreutils^g" \
-e "s^@libc@^$libc^g" \
- -e "s^@ld@^$ldPath/ld^g" \
+ -e "s^@ld@^$ld^g" \
< "$src" > "$dst"
}
@@ -144,6 +154,8 @@ then
ln -sv g++ $out/bin/c++
fi
+mkGccWrapper $out/bin/cpp $gccPath/cpp || true
+
if mkGccWrapper $out/bin/gfortran $gccPath/gfortran
then
ln -sv gfortran $out/bin/g77
@@ -174,6 +186,13 @@ ln -s $ldPath/as $out/bin/as
doSubstitute "$ldWrapper" "$out/bin/ld"
chmod +x "$out/bin/ld"
+# Copy solaris ld wrapper if needed
+if $ldPath/ld -V 2>&1 |grep Solaris; then
+ # Use Solaris specific linker wrapper
+ sed -e "s^@ld@^$ldPath/ld^g" < "$ldSolarisWrapper" > "$out/bin/ld-solaris"
+ chmod +x "$out/bin/ld-solaris"
+fi
+
# Emit a setup hook. Also store the path to the original GCC and
# Glibc.
diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix
index 992c0f9af371..8e8b0b909454 100644
--- a/pkgs/build-support/gcc-wrapper/default.nix
+++ b/pkgs/build-support/gcc-wrapper/default.nix
@@ -29,22 +29,23 @@ stdenv.mkDerivation {
name =
(if name != "" then name else gccName + "-wrapper") +
(if gcc != null && gccVersion != "" then "-" + gccVersion else "");
-
+
builder = ./builder.sh;
setupHook = ./setup-hook.sh;
gccWrapper = ./gcc-wrapper.sh;
gnatWrapper = ./gnat-wrapper.sh;
gnatlinkWrapper = ./gnatlink-wrapper.sh;
ldWrapper = ./ld-wrapper.sh;
+ ldSolarisWrapper = ./ld-solaris-wrapper.sh;
utils = ./utils.sh;
addFlags = ./add-flags;
-
+
inherit nativeTools nativeLibc nativePrefix gcc;
libc = if nativeLibc then null else libc;
binutils = if nativeTools then null else binutils;
# The wrapper scripts use 'cat', so we may need coreutils
coreutils = if nativeTools then null else coreutils;
-
+
langC = if nativeTools then true else gcc.langC;
langCC = if nativeTools then true else gcc.langCC;
langFortran = if nativeTools then false else gcc ? langFortran;
@@ -71,7 +72,9 @@ stdenv.mkDerivation {
if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform");
};
-
+
+ preferLocalBuild = true;
+
meta =
let gcc_ = if gcc != null then gcc else {}; in
(if gcc_ ? meta then removeAttrs gcc.meta ["priority"] else {}) //
diff --git a/pkgs/build-support/gcc-wrapper/ld-solaris-wrapper.sh b/pkgs/build-support/gcc-wrapper/ld-solaris-wrapper.sh
new file mode 100644
index 000000000000..5a7b92b5ad7d
--- /dev/null
+++ b/pkgs/build-support/gcc-wrapper/ld-solaris-wrapper.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+set -e
+set -u
+
+# I've also tried adding -z direct and -z lazyload, but it gave too many problems with C++ exceptions :'(
+# Also made sure libgcc would not be lazy-loaded, as suggested here: https://www.illumos.org/issues/2534#note-3
+# but still no success.
+cmd="@ld@ -z ignore"
+
+args=("$@");
+
+# This loop makes sure all -L arguments are before -l arguments, or ld may complain it cannot find a library.
+# GNU binutils does not have this problem:
+# http://stackoverflow.com/questions/5817269/does-the-order-of-l-and-l-options-in-the-gnu-linker-matter
+i=0;
+while [[ $i -lt $# ]]; do
+ case "${args[$i]}" in
+ -L) cmd="$cmd ${args[$i]} ${args[($i+1)]}"; i=($i+1); ;;
+ -L*) cmd="$cmd ${args[$i]}" ;;
+ *) ;;
+ esac
+ i=($i+1);
+done
+
+i=0;
+while [[ $i -lt $# ]]; do
+ case "${args[$i]}" in
+ -L) i=($i+1); ;;
+ -L*) ;;
+ *) cmd="$cmd ${args[$i]}" ;;
+ esac
+ i=($i+1);
+done
+
+# Trace:
+set -x
+exec $cmd
+
+exit 0
diff --git a/pkgs/build-support/gcc-wrapper/setup-hook.sh b/pkgs/build-support/gcc-wrapper/setup-hook.sh
index 513ab8053a7e..298ade21d1f5 100644
--- a/pkgs/build-support/gcc-wrapper/setup-hook.sh
+++ b/pkgs/build-support/gcc-wrapper/setup-hook.sh
@@ -1,6 +1,6 @@
addCVars () {
if test -d $1/include; then
- export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$1/include"
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
fi
if test -d $1/lib64; then
diff --git a/pkgs/build-support/kdewrapper/default.nix b/pkgs/build-support/kdewrapper/default.nix
index be90011f4939..6dcf68a324a2 100644
--- a/pkgs/build-support/kdewrapper/default.nix
+++ b/pkgs/build-support/kdewrapper/default.nix
@@ -39,4 +39,6 @@ stdenv.mkDerivation {
chmod +x $PROG
done
'';
+
+ preferLocalBuild = true;
}
diff --git a/pkgs/build-support/kernel/cpio-clean.pl b/pkgs/build-support/kernel/cpio-clean.pl
new file mode 100644
index 000000000000..ddc6435a5a81
--- /dev/null
+++ b/pkgs/build-support/kernel/cpio-clean.pl
@@ -0,0 +1,17 @@
+use strict;
+
+# Make inode number, link info and mtime consistent in order to get a consistent hash.
+#
+# Author: Alexander Kjeldaas
+
+use Archive::Cpio;
+
+my $cpio = Archive::Cpio->new;
+my $IN = \*STDIN;
+my $ino = 1;
+$cpio->read_with_handler($IN, sub {
+ my ($e) = @_;
+ $e->{mtime} = 1;
+ $cpio->write_one(\*STDOUT, $e);
+ });
+$cpio->write_trailer(\*STDOUT);
diff --git a/pkgs/build-support/kernel/make-initrd.nix b/pkgs/build-support/kernel/make-initrd.nix
index 4ddf0706e03e..0582ca553012 100644
--- a/pkgs/build-support/kernel/make-initrd.nix
+++ b/pkgs/build-support/kernel/make-initrd.nix
@@ -12,10 +12,10 @@
# `contents = {object = ...; symlink = /init;}' is a typical
# argument.
-{stdenv, perl, cpio, contents, ubootChooser, compressor}:
+{stdenv, perl, perlArchiveCpio, cpio, contents, ubootChooser, compressor}:
let
- inputsFun = ubootName : [perl cpio]
+ inputsFun = ubootName : [perl cpio perlArchiveCpio ]
++ stdenv.lib.optional (ubootName != null) [ (ubootChooser ubootName) ];
makeUInitrdFun = ubootName : (ubootName != null);
in
@@ -35,6 +35,7 @@ stdenv.mkDerivation {
exportReferencesGraph =
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
pathsFromGraph = ./paths-from-graph.pl;
+ cpioClean = ./cpio-clean.pl;
crossAttrs = {
nativeBuildInputs = inputsFun stdenv.cross.platform.uboot;
diff --git a/pkgs/build-support/kernel/make-initrd.sh b/pkgs/build-support/kernel/make-initrd.sh
index f6cadaf02819..17b261f98407 100644
--- a/pkgs/build-support/kernel/make-initrd.sh
+++ b/pkgs/build-support/kernel/make-initrd.sh
@@ -36,7 +36,7 @@ storePaths=$(perl $pathsFromGraph closure-*)
# Put the closure in a gzipped cpio archive.
mkdir -p $out
-(cd root && find * -print0 | cpio -o -H newc --null | $compressor > $out/initrd)
+(cd root && find * -print0 | cpio -o -H newc --null | perl $cpioClean | $compressor > $out/initrd)
if [ -n "$makeUInitrd" ]; then
mv $out/initrd $out/initrd.gz
diff --git a/pkgs/build-support/release/debian-build.nix b/pkgs/build-support/release/debian-build.nix
index ba7be86a6c1e..168b44ad74c7 100644
--- a/pkgs/build-support/release/debian-build.nix
+++ b/pkgs/build-support/release/debian-build.nix
@@ -51,7 +51,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
'';
installPhase = ''
- eval "$preInstall"
+ eval "$preInstall"
export LOGNAME=root
${checkinstall}/sbin/checkinstall --nodoc -y -D \
@@ -59,6 +59,8 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
--requires="${concatStringsSep "," debRequires}" \
--provides="${concatStringsSep "," debProvides}" \
${optionalString (src ? version) "--pkgversion=$(echo ${src.version} | tr _ -)"} \
+ ''${debMaintainer:+--maintainer="'$debMaintainer'"} \
+ $checkInstallFlags \
make install
mkdir -p $out/debs
@@ -79,7 +81,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
echo "file deb-extra $(ls $i/debs/*.deb | sort | head -1)" >> $out/nix-support/hydra-build-products
done
- eval "$postInstall"
+ eval "$postInstall"
''; # */
meta = (if args ? meta then args.meta else {}) // {
diff --git a/pkgs/build-support/release/default.nix b/pkgs/build-support/release/default.nix
index 3d593f0b6bb7..6288935ec2a5 100644
--- a/pkgs/build-support/release/default.nix
+++ b/pkgs/build-support/release/default.nix
@@ -27,10 +27,14 @@ rec {
} // args);
coverageAnalysis = args: nixBuild (
- { inherit lcov;
+ { inherit lcov enableGCOVInstrumentation makeGCOVReport;
doCoverageAnalysis = true;
} // args);
+ gcovReport = args: import ./gcov-report.nix (
+ { inherit runCommand lcov rsync;
+ } // args);
+
rpmBuild = args: import ./rpm-build.nix (
{ inherit vmTools;
} // args);
diff --git a/pkgs/build-support/release/gcov-report.nix b/pkgs/build-support/release/gcov-report.nix
new file mode 100644
index 000000000000..8ce5c0488a7d
--- /dev/null
+++ b/pkgs/build-support/release/gcov-report.nix
@@ -0,0 +1,49 @@
+{ runCommand, lcov, rsync, coverageRuns, lcovFilter ? [ "/nix/store/*" ], baseDirHack ? false }:
+
+runCommand "coverage"
+ { buildInputs = [ lcov rsync ];
+ inherit lcovFilter baseDirHack;
+ }
+ ''
+ mkdir -p $TMPDIR/gcov $out/nix-support $out/coverage
+ info=$out/coverage/full.info
+
+ for p in ${toString coverageRuns}; do
+ if [ -f $p/nix-support/hydra-build-products ]; then
+ cat $p/nix-support/hydra-build-products >> $out/nix-support/hydra-build-products
+ fi
+
+ [ ! -e $p/nix-support/failed ] || touch $out/nix-support/failed
+
+ opts=
+ for d in $p/coverage-data/*; do
+ for i in $(cd $d/nix/store && ls); do
+ if ! [ -e /nix/store/$i/.build ]; then continue; fi
+ if [ -e $TMPDIR/gcov/nix/store/$i ]; then continue; fi
+ echo "copying $i..."
+ rsync -a /nix/store/$i/.build/* $TMPDIR/gcov/
+ if [ -n "$baseDirHack" ]; then
+ opts="-b $TMPDIR/gcov/$(cd /nix/store/$i/.build && ls)"
+ fi
+ done
+
+ for i in $(cd $d/nix/store && ls); do
+ rsync -a $d/nix/store/$i/.build/* $TMPDIR/gcov/ --include '*/' --include '*.gcda' --exclude '*'
+ done
+ done
+
+ chmod -R u+w $TMPDIR/gcov
+
+ echo "producing info..."
+ geninfo --ignore-errors source,gcov $TMPDIR/gcov --output-file $TMPDIR/app.info $opts
+ cat $TMPDIR/app.info >> $info
+ done
+
+ echo "making report..."
+ set -o noglob
+ lcov --remove $info ''$lcovFilter > $info.tmp
+ set +o noglob
+ mv $info.tmp $info
+ genhtml --show-details $info -o $out/coverage
+ echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products
+ ''
diff --git a/pkgs/build-support/release/maven-build.nix b/pkgs/build-support/release/maven-build.nix
index 39f069cd57f0..6b47bb9cae90 100644
--- a/pkgs/build-support/release/maven-build.nix
+++ b/pkgs/build-support/release/maven-build.nix
@@ -78,7 +78,7 @@ stdenv.mkDerivation ( rec {
zip=$(ls target/*.zip| head -1)
releaseName=$(basename $zip .zip)
- releaseName="$releaseName-r${toString src.rev}"
+ releaseName="$releaseName-r${toString src.rev or "0"}"
cp $zip $out/release/$releaseName.zip
echo "$releaseName" > $out/nix-support/hydra-release-name
diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix
index 88bafd84faa3..8ebae24c6733 100644
--- a/pkgs/build-support/release/nix-build.nix
+++ b/pkgs/build-support/release/nix-build.nix
@@ -15,6 +15,7 @@
, failureHook ? null
, prePhases ? []
, postPhases ? []
+, buildInputs ? []
, ... } @ args:
stdenv.mkDerivation (
@@ -61,13 +62,6 @@ stdenv.mkDerivation (
. ${./functions.sh}
origSrc=$src
src=$(findTarballs $src | head -1)
-
- # Set GCC flags for coverage analysis, if desired.
- if test -n "${toString doCoverageAnalysis}"; then
- export NIX_CFLAGS_COMPILE="-O0 --coverage $NIX_CFLAGS_COMPILE"
- export CFLAGS="-O0"
- export CXXFLAGS="-O0"
- fi
'';
initPhase = ''
@@ -85,30 +79,13 @@ stdenv.mkDerivation (
prePhases = ["initPhase"] ++ prePhases;
- # In the report phase, create a coverage analysis report.
- coverageReportPhase = if doCoverageAnalysis then ''
- ${args.lcov}/bin/lcov --directory . --capture --output-file app.info
- set -o noglob
- ${args.lcov}/bin/lcov --remove app.info $lcovFilter > app2.info
- set +o noglob
- mv app2.info app.info
-
- mkdir $out/coverage
- ${args.lcov}/bin/genhtml app.info $lcovExtraTraceFiles -o $out/coverage > log
-
- # Grab the overall coverage percentage for use in release overviews.
- grep "Overall coverage rate" log | sed 's/^.*(\(.*\)%).*$/\1/' > $out/nix-support/coverage-rate
-
- echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products
- '' else "";
-
+ buildInputs = buildInputs ++ stdenv.lib.optional doCoverageAnalysis args.makeGCOVReport;
lcovFilter = ["/nix/store/*"] ++ lcovFilter;
inherit lcovExtraTraceFiles;
- postPhases = postPhases ++
- (stdenv.lib.optional doCoverageAnalysis "coverageReportPhase") ++ ["finalPhase"];
+ postPhases = postPhases ++ ["finalPhase"];
meta = (if args ? meta then args.meta else {}) // {
description = if doCoverageAnalysis then "Coverage analysis" else "Nix package for ${stdenv.system}";
diff --git a/pkgs/build-support/setup-hooks/enable-coverage-instrumentation.sh b/pkgs/build-support/setup-hooks/enable-coverage-instrumentation.sh
new file mode 100644
index 000000000000..7175b408b02f
--- /dev/null
+++ b/pkgs/build-support/setup-hooks/enable-coverage-instrumentation.sh
@@ -0,0 +1,31 @@
+postPhases+=" cleanupBuildDir"
+
+# Force GCC to build with coverage instrumentation. Also disable
+# optimisation, since it may confuse things.
+export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -O0 --coverage"
+
+# FIXME: Handle the case where postUnpack is already set.
+postUnpack() {
+ # This is an uberhack to prevent libtool from remoaving gcno
+ # files. This has been fixed in libtool, but there are packages
+ # out there with old ltmain.sh scripts. See
+ # http://www.mail-archive.com/libtool@gnu.org/msg10725.html
+ for i in $(find -name ltmain.sh); do
+ substituteInPlace $i --replace '*.$objext)' '*.$objext | *.gcno)'
+ done
+}
+
+# Get rid of everything that isn't a gcno file or a C source file.
+# Also strip the `.tmp_' prefix from gcno files. (The Linux kernel
+# creates these.)
+cleanupBuildDir() {
+ if ! [ -e $out/.build ]; then return; fi
+
+ find $out/.build/ -type f -a ! \
+ \( -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.h" -o -name "*.hh" -o -name "*.y" -o -name "*.l" -o -name "*.gcno" \) \
+ | xargs rm -f --
+
+ for i in $(find $out/.build/ -name ".tmp_*.gcno"); do
+ mv "$i" "$(echo $i | sed s/.tmp_//)"
+ done
+}
diff --git a/pkgs/build-support/setup-hooks/keep-build-tree.sh b/pkgs/build-support/setup-hooks/keep-build-tree.sh
new file mode 100644
index 000000000000..754900bfc337
--- /dev/null
+++ b/pkgs/build-support/setup-hooks/keep-build-tree.sh
@@ -0,0 +1,6 @@
+prePhases+=" moveBuildDir"
+
+moveBuildDir() {
+ mkdir -p $out/.build
+ cd $out/.build
+}
diff --git a/pkgs/build-support/setup-hooks/make-coverage-analysis-report.sh b/pkgs/build-support/setup-hooks/make-coverage-analysis-report.sh
new file mode 100644
index 000000000000..4b8abb61ace5
--- /dev/null
+++ b/pkgs/build-support/setup-hooks/make-coverage-analysis-report.sh
@@ -0,0 +1,18 @@
+postPhases+=" coverageReportPhase"
+
+coverageReportPhase() {
+ lcov --directory . --capture --output-file app.info
+ set -o noglob
+ lcov --remove app.info ${lcovFilter:-"/nix/store/*"} > app2.info
+ set +o noglob
+ mv app2.info app.info
+
+ mkdir -p $out/coverage
+ genhtml app.info $lcovExtraTraceFiles -o $out/coverage > log
+
+ # Grab the overall coverage percentage for use in release overviews.
+ mkdir -p $out/nix-support
+ grep "Overall coverage rate" log | sed 's/^.*(\(.*\)%).*$/\1/' > $out/nix-support/coverage-rate
+
+ echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products
+}
diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix
index 5ae2e7b4fc9b..c08a6c3a265f 100644
--- a/pkgs/build-support/trivial-builders.nix
+++ b/pkgs/build-support/trivial-builders.nix
@@ -33,6 +33,7 @@ rec {
# Shorthands for `writeTextFile'.
writeText = name: text: writeTextFile {inherit name text;};
+ writeTextDir = name: text: writeTextFile {inherit name text; destination = "/${name}";};
writeScript = name: text: writeTextFile {inherit name text; executable = true;};
writeScriptBin = name: text: writeTextFile {inherit name text; executable = true; destination = "/bin/${name}";};
diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix
index 625f93c874f2..274cd05024bd 100644
--- a/pkgs/build-support/vm/default.nix
+++ b/pkgs/build-support/vm/default.nix
@@ -2,7 +2,7 @@
, kernel ? pkgs.linux_3_10
, img ? "bzImage"
, rootModules ?
- [ "virtio_pci" "virtio_blk" "virtio_balloon" "ext4" "unix" "9p" "9pnet_virtio" ]
+ [ "virtio_pci" "virtio_blk" "virtio_balloon" "ext4" "unix" "9p" "9pnet_virtio" "rtc_cmos" ]
}:
with pkgs;
@@ -57,6 +57,7 @@ rec {
mknod ${dev}/random c 1 8
mknod ${dev}/urandom c 1 9
mknod ${dev}/tty c 5 0
+ mknod ${dev}/rtc c 254 0
. /sys/class/block/${hd}/uevent
mknod ${dev}/${hd} b $MAJOR $MINOR
'';
@@ -159,6 +160,10 @@ rec {
#! ${bash}/bin/sh
source /tmp/xchg/saved-env
+ # Set the system time from the hardware clock. Works around an
+ # apparent KVM > 1.5.2 bug.
+ ${pkgs.utillinux}/sbin/hwclock -s
+
export NIX_STORE=/nix/store
export NIX_BUILD_TOP=/tmp
export TMPDIR=/tmp
@@ -924,6 +929,32 @@ rec {
packages = commonFedoraPackages ++ [ "cronie" "util-linux" ];
};
+ fedora17i386 = {
+ name = "fedora-17-i386";
+ fullName = "Fedora 17 (i386)";
+ packagesList = fetchurl {
+ url = mirror://fedora/linux/releases/17/Everything/i386/os/repodata/82dc1ea6d26e53a367dc6e7472113c4454c9a8ac7c98d4bfb11fd0b6f311450f-primary.xml.gz;
+ sha256 = "03s527rvdl0zn6zx963wmjlcjm247h8p4x3fviks6lvfsak1xp42";
+ };
+ urlPrefix = mirror://fedora/linux/releases/17/Everything/i386/os;
+ archs = ["noarch" "i386" "i586" "i686"];
+ packages = commonFedoraPackages ++ [ "cronie" "util-linux" ];
+ unifiedSystemDir = true;
+ };
+
+ fedora17x86_64 = {
+ name = "fedora-17-x86_64";
+ fullName = "Fedora 17 (x86_64)";
+ packagesList = fetchurl {
+ url = mirror://fedora/linux/releases/17/Everything/x86_64/os/repodata/7009de56f1a1c399930fa72094a310a40d38153c96d0b5af443914d3d6a7d811-primary.xml.gz;
+ sha256 = "04fqlzbd651r8jpvbl4n7hakh3d422ir88571y9rkhx1y5bdw2bh";
+ };
+ urlPrefix = mirror://fedora/linux/releases/17/Everything/x86_64/os;
+ archs = ["noarch" "x86_64"];
+ packages = commonFedoraPackages ++ [ "cronie" "util-linux" ];
+ unifiedSystemDir = true;
+ };
+
fedora18i386 = {
name = "fedora-18-i386";
fullName = "Fedora 18 (i386)";
@@ -1505,22 +1536,22 @@ rec {
debian70x86_64 = debian7x86_64;
debian7i386 = {
- name = "debian-7.3-wheezy-i386";
- fullName = "Debian 7.3 Wheezy (i386)";
+ name = "debian-7.4-wheezy-i386";
+ fullName = "Debian 7.4 Wheezy (i386)";
packagesList = fetchurl {
url = mirror://debian/dists/wheezy/main/binary-i386/Packages.bz2;
- sha256 = "037637520ce371a50beb5446fd27a731f30b51bc362c2f4a5dcfce9c7e30ffb6";
+ sha256 = "9f19822c82e25cd149f82b0d16fdbc00d1080db7f34e41de456498dc7c54f2b4";
};
urlPrefix = mirror://debian;
packages = commonDebianPackages;
};
debian7x86_64 = {
- name = "debian-7.3-wheezy-amd64";
- fullName = "Debian 7.3 Wheezy (amd64)";
+ name = "debian-7.4-wheezy-amd64";
+ fullName = "Debian 7.4 Wheezy (amd64)";
packagesList = fetchurl {
url = mirror://debian/dists/wheezy/main/binary-amd64/Packages.bz2;
- sha256 = "c2ed55a2a263d482826c934b97ad910984fa5695ab1c480841741b828d0590a5";
+ sha256 = "160ee0917693bc2e8f69b233c220857f35a70d906540d99d2779def576daf5f7";
};
urlPrefix = mirror://debian;
packages = commonDebianPackages;
@@ -1688,5 +1719,4 @@ rec {
};
};
-
-}
+} // import ./windows pkgs
diff --git a/pkgs/build-support/vm/windows/bootstrap.nix b/pkgs/build-support/vm/windows/bootstrap.nix
new file mode 100644
index 000000000000..47afce5b5a37
--- /dev/null
+++ b/pkgs/build-support/vm/windows/bootstrap.nix
@@ -0,0 +1,83 @@
+{ stdenv, fetchurl, vmTools, writeScript, writeText, runCommand, makeInitrd
+, python, perl, coreutils, dosfstools, gzip, mtools, netcat, openssh, qemu
+, samba, socat, vde2, cdrkit, pathsFromGraph
+}:
+
+{ isoFile, productKey, arch ? null }:
+
+with stdenv.lib;
+
+let
+ controller = import ./controller {
+ inherit stdenv writeScript vmTools makeInitrd;
+ inherit samba vde2 openssh socat netcat coreutils gzip;
+ };
+
+ mkCygwinImage = import ./cygwin-iso {
+ inherit stdenv fetchurl runCommand python perl cdrkit pathsFromGraph;
+ arch = let
+ defaultArch = if stdenv.is64bit then "x86_64" else "i686";
+ in if arch == null then defaultArch else arch;
+ };
+
+ installer = import ./install {
+ inherit controller mkCygwinImage;
+ inherit stdenv runCommand openssh qemu writeText dosfstools mtools;
+ };
+in rec {
+ installedVM = installer {
+ inherit isoFile productKey;
+ };
+
+ runInVM = img: attrs: controller (attrs // {
+ inherit (installedVM) sshKey;
+ qemuArgs = attrs.qemuArgs or [] ++ [
+ "-boot order=c"
+ "-drive file=${img},index=0,media=disk"
+ ];
+ });
+
+ runAndSuspend = let
+ drives = {
+ s = {
+ source = "nixstore";
+ target = "/nix/store";
+ };
+ x = {
+ source = "xchg";
+ target = "/tmp/xchg";
+ };
+ };
+
+ genDriveCmds = letter: { source, target }: [
+ "net use ${letter}: '\\\\192.168.0.2\\${source}' /persistent:yes"
+ "mkdir -p '${target}'"
+ "mount -o bind '/cygdrive/${letter}' '${target}'"
+ "echo '/cygdrive/${letter} ${target} none bind 0 0' >> /etc/fstab"
+ ];
+ in runInVM "winvm.img" {
+ command = concatStringsSep " && " ([
+ "net config server /autodisconnect:-1"
+ ] ++ concatLists (mapAttrsToList genDriveCmds drives));
+ suspendTo = "state.gz";
+ };
+
+ suspendedVM = stdenv.mkDerivation {
+ name = "cygwin-suspended-vm";
+ buildCommand = ''
+ ${qemu}/bin/qemu-img create \
+ -b "${installedVM}/disk.img" \
+ -f qcow2 winvm.img
+ ${runAndSuspend}
+ ensureDir "$out"
+ cp winvm.img "$out/disk.img"
+ cp state.gz "$out/state.gz"
+ '';
+ };
+
+ resumeAndRun = command: runInVM "${suspendedVM}/disk.img" {
+ resumeFrom = "${suspendedVM}/state.gz";
+ qemuArgs = singleton "-snapshot";
+ inherit command;
+ };
+}
diff --git a/pkgs/build-support/vm/windows/controller/default.nix b/pkgs/build-support/vm/windows/controller/default.nix
new file mode 100644
index 000000000000..fe4b5b7f6c24
--- /dev/null
+++ b/pkgs/build-support/vm/windows/controller/default.nix
@@ -0,0 +1,229 @@
+{ stdenv, writeScript, vmTools, makeInitrd
+, samba, vde2, openssh, socat, netcat, coreutils, gzip
+}:
+
+{ sshKey
+, qemuArgs ? []
+, command ? "sync"
+, suspendTo ? null
+, resumeFrom ? null
+, installMode ? false
+}:
+
+with stdenv.lib;
+
+let
+ preInitScript = writeScript "preinit.sh" ''
+ #!${vmTools.initrdUtils}/bin/ash -e
+ export PATH=${vmTools.initrdUtils}/bin
+ mount -t proc none /proc
+ mount -t sysfs none /sys
+ for arg in $(cat /proc/cmdline); do
+ if [ "x''${arg#command=}" != "x$arg" ]; then
+ command="''${arg#command=}"
+ fi
+ done
+
+ for i in $(cat ${modulesClosure}/insmod-list); do
+ insmod $i
+ done
+
+ mkdir -p /dev /fs
+
+ mount -t tmpfs none /dev
+ mknod /dev/null c 1 3
+ mknod /dev/zero c 1 5
+ mknod /dev/random c 1 8
+ mknod /dev/urandom c 1 9
+ mknod /dev/tty c 5 0
+
+ ifconfig lo up
+ ifconfig eth0 up 192.168.0.2
+
+ mount -t tmpfs none /fs
+ mkdir -p /fs/nix/store /fs/xchg /fs/dev /fs/sys /fs/proc /fs/etc /fs/tmp
+
+ mount -o bind /dev /fs/dev
+ mount -t sysfs none /fs/sys
+ mount -t proc none /fs/proc
+
+ mount -t 9p \
+ -o trans=virtio,version=9p2000.L,msize=262144,cache=loose \
+ store /fs/nix/store
+
+ mount -t 9p \
+ -o trans=virtio,version=9p2000.L,msize=262144,cache=loose \
+ xchg /fs/xchg
+
+ echo root:x:0:0::/root:/bin/false > /fs/etc/passwd
+
+ set +e
+ chroot /fs $command $out
+ echo $? > /fs/xchg/in-vm-exit
+
+ poweroff -f
+ '';
+
+ initrd = makeInitrd {
+ contents = singleton {
+ object = preInitScript;
+ symlink = "/init";
+ };
+ };
+
+ shellEscape = x: "'${replaceChars ["'"] [("'\\'" + "'")] x}'";
+
+ loopForever = "while :; do ${coreutils}/bin/sleep 1; done";
+
+ initScript = writeScript "init.sh" (''
+ #!${stdenv.shell}
+ ${coreutils}/bin/cp -L "${sshKey}" /ssh.key
+ ${coreutils}/bin/chmod 600 /ssh.key
+ '' + (if installMode then ''
+ echo -n "Waiting for Windows installation to finish..."
+ while ! ${netcat}/bin/netcat -z 192.168.0.1 22; do
+ echo -n .
+ # Print a dot every 10 seconds only to shorten line length.
+ ${coreutils}/bin/sleep 10
+ done
+ echo " success."
+ # Loop forever, because this VM is going to be killed.
+ ${loopForever}
+ '' else ''
+ ${coreutils}/bin/mkdir -p /etc/samba /etc/samba/private \
+ /var/lib/samba /var/log /var/run
+ ${coreutils}/bin/cat > /etc/samba/smb.conf < saved-env
+ XCHG_DIR="$(${coreutils}/bin/mktemp -d nix-vm.XXXXXXXXXX --tmpdir)"
+ ${coreutils}/bin/mv saved-env "$XCHG_DIR/"
+
+ eval "$preVM"
+
+ QEMU_VDE_SOCKET="$(pwd)/vde.ctl"
+ MONITOR_SOCKET="$(pwd)/monitor"
+ ${vde2}/bin/vde_switch -s "$QEMU_VDE_SOCKET" &
+ echo 'alive?' | ${socat}/bin/socat - \
+ UNIX-CONNECT:$QEMU_VDE_SOCKET/ctl,retry=20
+ '';
+
+ bgBoth = optionalString (suspendTo != null) " &";
+
+ vmExec = if installMode then ''
+ ${vmTools.qemuProg} ${controllerQemuArgs} &
+ ${vmTools.qemuProg} ${cygwinQemuArgs}${bgBoth}
+ '' else ''
+ ${vmTools.qemuProg} ${cygwinQemuArgs} &
+ ${vmTools.qemuProg} ${controllerQemuArgs}${bgBoth}
+ '';
+
+ postVM = if suspendTo != null then ''
+ while ! test -e "$XCHG_DIR/suspend_now"; do sleep 1; done
+ ${socat}/bin/socat - UNIX-CONNECT:$MONITOR_SOCKET < '${suspendTo}'"
+ quit
+ CMD
+ wait %-
+
+ eval "$postVM"
+ exit 0
+ '' else if installMode then ''
+ eval "$postVM"
+ exit 0
+ '' else ''
+ if ! test -e "$XCHG_DIR/in-vm-exit"; then
+ echo "Virtual machine didn't produce an exit code."
+ exit 1
+ fi
+
+ eval "$postVM"
+ exit $(< "$XCHG_DIR/in-vm-exit")
+ '';
+
+in writeScript "run-cygwin-vm.sh" ''
+ #!${stdenv.shell} -e
+ ${preVM}
+ ${vmExec}
+ ${postVM}
+''
diff --git a/pkgs/build-support/vm/windows/cygwin-iso/default.nix b/pkgs/build-support/vm/windows/cygwin-iso/default.nix
new file mode 100644
index 000000000000..d9801428a887
--- /dev/null
+++ b/pkgs/build-support/vm/windows/cygwin-iso/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchurl, runCommand, python, perl, cdrkit, pathsFromGraph
+, arch ? "x86_64"
+}:
+
+{ packages ? []
+, mirror ? "http://ftp.gwdg.de/pub/linux/sources.redhat.com/cygwin"
+, extraContents ? []
+}:
+
+let
+ cygPkgList = if arch == "x86_64" then fetchurl {
+ url = "${mirror}/x86_64/setup.ini";
+ sha256 = "0ljsxdkx9s916wp28kcvql3bjx80zzzidan6jicby7i9s3sm96n9";
+ } else fetchurl {
+ url = "${mirror}/x86/setup.ini";
+ sha256 = "1slyj4qha7x649ggwdski9spmyrbs04z2d46vgk8krllg0kppnjv";
+ };
+
+ cygwinCross = (import ../../../../top-level/all-packages.nix {
+ inherit (stdenv) system;
+ crossSystem = {
+ libc = "msvcrt";
+ platform = {};
+ openssl.system = "mingw64";
+ inherit arch;
+ config = "${arch}-w64-mingw32";
+ };
+ }).windows.cygwinSetup.crossDrv;
+
+ makeCygwinClosure = { packages, packageList }: let
+ expr = import (runCommand "cygwin.nix" { buildInputs = [ python ]; } ''
+ python ${./mkclosure.py} "${packages}" ${toString packageList} > "$out"
+ '');
+ gen = { url, md5 }: {
+ source = fetchurl {
+ url = "${mirror}/${url}";
+ inherit md5;
+ };
+ target = url;
+ };
+ in map gen expr;
+
+in import {
+ inherit stdenv perl cdrkit pathsFromGraph;
+ contents = [
+ { source = "${cygwinCross}/bin/setup.exe";
+ target = "setup.exe";
+ }
+ { source = cygPkgList;
+ target = "setup.ini";
+ }
+ ] ++ makeCygwinClosure {
+ packages = cygPkgList;
+ packageList = packages;
+ } ++ extraContents;
+}
diff --git a/pkgs/build-support/vm/windows/cygwin-iso/mkclosure.py b/pkgs/build-support/vm/windows/cygwin-iso/mkclosure.py
new file mode 100644
index 000000000000..48d569a6bd3e
--- /dev/null
+++ b/pkgs/build-support/vm/windows/cygwin-iso/mkclosure.py
@@ -0,0 +1,78 @@
+# Ugliest Python code I've ever written. -- aszlig
+import sys
+
+def get_plist(path):
+ in_pack = False
+ in_str = False
+ current_key = None
+ buf = ""
+ packages = {}
+ package_name = None
+ package_attrs = {}
+ with open(path, 'r') as setup:
+ for line in setup:
+ if in_str and line.rstrip().endswith('"'):
+ package_attrs[current_key] = buf + line.rstrip()[:-1]
+ in_str = False
+ continue
+ elif in_str:
+ buf += line
+ continue
+
+ if line.startswith('@'):
+ in_pack = True
+ package_name = line[1:].strip()
+ package_attrs = {}
+ elif in_pack and ':' in line:
+ key, value = line.split(':', 1)
+ if value.lstrip().startswith('"'):
+ if value.lstrip()[1:].rstrip().endswith('"'):
+ value = value.strip().strip('"')
+ else:
+ in_str = True
+ current_key = key.strip().lower()
+ buf = value.lstrip()[1:]
+ continue
+ package_attrs[key.strip().lower()] = value.strip()
+ elif in_pack:
+ in_pack = False
+ packages[package_name] = package_attrs
+ return packages
+
+def main():
+ packages = get_plist(sys.argv[1])
+ to_include = set()
+
+ def traverse(package):
+ to_include.add(package)
+ attrs = packages.get(package, {})
+ deps = attrs.get('requires', '').split()
+ for new_dep in set(deps) - to_include:
+ traverse(new_dep)
+
+ map(traverse, sys.argv[2:])
+
+ sys.stdout.write('[\n')
+ for package, attrs in packages.iteritems():
+ if package not in to_include:
+ cats = [c.lower() for c in attrs.get('category', '').split()]
+ if 'base' not in cats:
+ continue
+
+ install_line = attrs.get('install')
+ if install_line is None:
+ continue
+
+ url, size, md5 = install_line.split(' ', 2)
+
+ pack = [
+ ' {',
+ ' url = "{0}";'.format(url),
+ ' md5 = "{0}";'.format(md5),
+ ' }',
+ ];
+ sys.stdout.write('\n'.join(pack) + '\n')
+ sys.stdout.write(']\n')
+
+if __name__ == '__main__':
+ main()
diff --git a/pkgs/build-support/vm/windows/default.nix b/pkgs/build-support/vm/windows/default.nix
new file mode 100644
index 000000000000..f9b44d450d99
--- /dev/null
+++ b/pkgs/build-support/vm/windows/default.nix
@@ -0,0 +1,48 @@
+pkgs:
+
+let
+ bootstrapper = import ./bootstrap.nix {
+ inherit (pkgs) stdenv vmTools writeScript writeText runCommand makeInitrd;
+ inherit (pkgs) coreutils dosfstools gzip mtools netcat openssh qemu samba;
+ inherit (pkgs) socat vde2 fetchurl python perl cdrkit pathsFromGraph;
+ };
+
+ builder = ''
+ source /tmp/xchg/saved-env 2> /dev/null || true
+ export NIX_STORE=/nix/store
+ export NIX_BUILD_TOP=/tmp
+ export TMPDIR=/tmp
+ export PATH=/empty
+ cd "$NIX_BUILD_TOP"
+ exec $origBuilder $origArgs
+ '';
+
+in {
+ runInWindowsVM = drv: let
+ newDrv = drv.override {
+ stdenv = drv.stdenv.override {
+ shell = "/bin/sh";
+ };
+ };
+ in pkgs.lib.overrideDerivation drv (attrs: let
+ bootstrap = bootstrapper attrs.windowsImage;
+ in {
+ requiredSystemFeatures = [ "kvm" ];
+ builder = "${pkgs.stdenv.shell}";
+ args = ["-e" (bootstrap.resumeAndRun builder)];
+ windowsImage = bootstrap.suspendedVM;
+ origArgs = attrs.args;
+ origBuilder = if attrs.builder == attrs.stdenv.shell
+ then "/bin/sh"
+ else attrs.builder;
+
+ postHook = ''
+ PATH=/usr/bin:/bin:/usr/sbin:/sbin
+ SHELL=/bin/sh
+ eval "$origPostHook"
+ '';
+
+ origPostHook = attrs.postHook or "";
+ fixupPhase = ":";
+ });
+}
diff --git a/pkgs/build-support/vm/windows/install/default.nix b/pkgs/build-support/vm/windows/install/default.nix
new file mode 100644
index 000000000000..10690bf6b287
--- /dev/null
+++ b/pkgs/build-support/vm/windows/install/default.nix
@@ -0,0 +1,74 @@
+{ stdenv, runCommand, openssh, qemu, controller, mkCygwinImage
+, writeText, dosfstools, mtools
+}:
+
+{ isoFile
+, productKey
+}:
+
+let
+ bootstrapAfterLogin = runCommand "bootstrap.sh" {} ''
+ cat > "$out" < ~/.ssh/authorized_keys <> $out/etc/X11/xkb/symbols/us
- '';
-}
diff --git a/pkgs/data/misc/xkeyboard-config/level3-deadkeys-us-intl b/pkgs/data/misc/xkeyboard-config/level3-deadkeys-us-intl
deleted file mode 100644
index 76905b7b77be..000000000000
--- a/pkgs/data/misc/xkeyboard-config/level3-deadkeys-us-intl
+++ /dev/null
@@ -1,95 +0,0 @@
-
-// Grabbed from http://lists.freedesktop.org/archives/xorg/2007-July/026686.html
-// Submitted there by Adriaan van Nijendaal, he says he submitted it to X.org
-// for inclusion, so it should be OK to use it as if it were part of X.org
-
-// The keyboard section in the X-server config file
-// (/etc/X11/xorg.conf on my system) looks like this:
-//
-// Section "InputDevice"
-// Driver "kbd"
-// Identifier "Keyboard[0]"
-// Option "XkbModel" "pc101"
-// Option "XkbLayout" "us"
-// Option "XkbVariant" "altgr-intl"
-// EndSection
-//
-// To be effective, you need to install this file, change the X config
-// file and restart the X-server. Or, alternatively, you can do this
-// run-time:
-//
-// setxkbmap -v -rules xorg -model pc101 -layout us -variant altgr-intl
-//
-// Once the X-server has loaded the new config, a keyboard can be
-// displayed with: (if you change "-ll 1" into "-ll 2", you'll see
-// the special keys ONLY.)
-//
-// xkbcomp -o /tmp/keyboard.xkm -opt cgkst -xkb $DISPLAY
-// xkbprint -o /tmp/keyboard.xkm.ps -kc -nkg 2 -ntg 4 -lg 1 -ll 1 \
-// -lc en_US.iso885915 -level2 -mono -label symbols -w 3 $DISPLAY;
-// gv -seascape /tmp/keyboard.xkm.ps
-// rm -f /tmp/keyboard.xkm.ps /tmp/keyboard.xkm
-//
-
-partial hidden alphanumeric_keys
-xkb_symbols "altgr-intl-rich" {
-
- name[Group1]= "U.S. English - International (AltGr dead keys)";
-
- include "us(basic)"
-
- key { [ grave, asciitilde, dead_grave, dead_tilde ] };
- key { [ 1, exclam, onesuperior, exclamdown ] };
- key { [ 2, at, twosuperior, dead_doubleacute] };
- key { [ 3, numbersign, threesuperior, dead_macron ] };
- key { [ 4, dollar, currency, sterling ] };
- key { [ 5, percent, EuroSign, approxeq ] };
- key { [ 6, asciicircum, dead_circumflex, dead_stroke ] };
- key { [ 7, ampersand, dead_horn ] };
- key { [ 8, asterisk, dead_ogonek, infinity ] };
- key { [ 9, parenleft, leftsinglequotemark,dead_breve ] };
- key { [ 0, parenright,rightsinglequotemark,dead_abovering ] };
- key { [ minus, underscore, yen, dead_belowdot ] };
- key { [ equal, plus, multiply, division ] };
-
- key { [ q, Q, adiaeresis, Adiaeresis ] };
- key { [ w, W, aring, Aring ] };
- key { [ e, E, eacute, Eacute ] };
- key { [ r, R, ediaeresis, Ediaeresis ] };
- key { [ t, T, thorn, THORN ] };
- key { [ y, Y, udiaeresis, Udiaeresis ] };
- key { [ u, U, uacute, Uacute ] };
- key { [ i, I, iacute, Iacute ] };
- key { [ o, O, oacute, Oacute ] };
- key { [ p, P, odiaeresis, Odiaeresis ] };
- key { [ bracketleft, braceleft, guillemotleft, lessthanequal ] };
- key { [ bracketright,braceright, guillemotright, greaterthanequal] };
-
- key { [ a, A, aacute, Aacute ] };
- key { [ s, S, ssharp, section ] };
- key { [ d, D, eth, ETH ] };
- key { [ f, F, union, intersection ] };
- key { [ g, G, eng, ENG ] };
- key { [ h, H, hyphen, nobreakspace ] };
- key { [ j, J, idiaeresis, Idiaeresis ] };
- key { [ k, K ] };
- key { [ l, L, oslash, Ooblique ] };
- key { [semicolon, colon, paragraph, degree ] };
- key { [apostrophe, quotedbl, dead_acute, dead_diaeresis ] };
-
- key { [ z, Z, ae, AE ] };
- key { [ x, X, oe, OE ] };
- key { [ c, C, copyright, cent ] };
- key { [ v, V, registered, trademark ] };
- key { [ b, B, emdash, endash ] };
- key { [ n, N, nu, numerosign ] };
- key { [ m, M, mu, plusminus ] };
- key { [ comma, less, ccedilla, Ccedilla ] };
- key { [ period, greater, dead_abovedot, dead_caron ] };
- key { [ slash, question, questiondown, dead_hook ] };
- key { [backslash, bar, notsign, brokenbar ] };
-
- // Let's have free choice
- //include "level3(ralt_switch)"
-};
-
diff --git a/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl-ns/default.nix b/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl-ns/default.nix
index c143ce166983..bfe454a49fe1 100644
--- a/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl-ns/default.nix
+++ b/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl-ns/default.nix
@@ -1,11 +1,11 @@
{stdenv, fetchurl}:
stdenv.mkDerivation rec {
- name = "docbook-xsl-ns-1.75.2";
+ name = "docbook-xsl-ns-1.78.1";
src = fetchurl {
url = "mirror://sourceforge/docbook/${name}.tar.bz2";
- sha256 = "1pr7m0hmqilk25hjx33kq2vqn2xf6cx6zhxqm35fdvnjccazlxg2";
+ sha256 = "1x3sc0axk9z3i6n0jhlsmzlmb723a4sjgslm9g12by6phirdx3ng";
};
buildPhase = "true";
diff --git a/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl/default.nix b/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl/default.nix
index c54d8f304b62..981aa59369de 100644
--- a/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl/default.nix
+++ b/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl/default.nix
@@ -1,10 +1,10 @@
{stdenv, fetchurl}:
stdenv.mkDerivation {
- name = "docbook-xsl-1.72.0";
+ name = "docbook-xsl-1.78.1";
builder = ./builder.sh;
src = fetchurl {
- url = mirror://sourceforge/docbook/docbook-xsl-1.72.0.tar.bz2;
- sha256 = "1cnrfgqz8pc9wnlgqjch2338ad7jki6d4h6b2fhaxn1a2201df5k";
+ url = mirror://sourceforge/docbook/docbook-xsl-1.78.1.tar.bz2;
+ sha256 = "0rxl013ncmz1n6ymk2idvx3hix9pdabk8xn01cpcv32wmfb753y9";
};
}
diff --git a/pkgs/desktops/cinnamon/automount-plugin.patch b/pkgs/desktops/cinnamon/automount-plugin.patch
new file mode 100644
index 000000000000..3d90da99f088
--- /dev/null
+++ b/pkgs/desktops/cinnamon/automount-plugin.patch
@@ -0,0 +1,448 @@
+
+diff -Naur cinnamon-settings-daemon-2.0.1.orig/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in cinnamon-settings-daemon-2.0.1/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in
+--- cinnamon-settings-daemon-2.0.6.orig/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in 2013-11-03 10:50:04.000000000 -0500
++++ cinnamon-settings-daemon-2.0.6/data/org.cinnamon.settings-daemon.plugins.gschema.xml.in.in 2013-11-05 15:33:21.112912392 -0500
+@@ -2,6 +2,7 @@
+
+
+
++
+
+
+
+@@ -42,6 +43,18 @@
+ <_summary>Priority to use for this plugin
+ <_description>Priority to use for this plugin in cinnamon-settings-daemon startup queue
+
++
++
++
++ true
++ <_summary>Activation of this plugin
++ <_description>Whether this plugin would be activated by cinnamon-settings-daemon or not
++
++
++ 97
++ <_summary>Priority to use for this plugin
++ <_description>Priority to use for this plugin in cinnamon-settings-daemon startup queue
++
+
+
+
+diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/automount.cinnamon-settings-plugin.in cinnamon-settings-daemon-2.0.1/plugins/automount/automount.cinnamon-settings-plugin.in
+--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/automount.cinnamon-settings-plugin.in 1970-01-01 01:00:00.000000000 +0100
++++ cinnamon-settings-daemon-2.0.1/plugins/automount/automount.cinnamon-settings-plugin.in 2013-10-08 22:35:10.771472456 +0200
+@@ -0,0 +1,8 @@
++[Cinnamon Settings Plugin]
++Module=automount
++IAge=0
++_Name=Automount
++_Description=Automounter plugin
++Authors=Tomas Bzatek
++Copyright=Copyright © 2010 Red Hat, Inc.
++Website=
+diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.c cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.c
+--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.c 2013-10-02 16:13:56.000000000 +0200
++++ cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.c 1970-01-01 01:00:00.000000000 +0100
+@@ -1,65 +0,0 @@
+-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+- *
+- * Copyright (C) 2010 Red Hat, Inc.
+- *
+- * This program is free software; you can redistribute it and/or modify
+- * it under the terms of the GNU General Public License as published by
+- * the Free Software Foundation; either version 2 of the License, or
+- * (at your option) any later version.
+- *
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU General Public License for more details.
+- *
+- * You should have received a copy of the GNU General Public License
+- * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+- *
+- * Author: Tomas Bzatek
+- */
+-
+-#include "config.h"
+-
+-#include
+-#include
+-#include
+-#include
+-
+-#include "csd-automount-manager.h"
+-
+-int
+-main (int argc,
+- char **argv)
+-{
+- GMainLoop *loop;
+- CsdAutomountManager *manager;
+- GError *error = NULL;
+-
+- g_type_init ();
+- gtk_init (&argc, &argv);
+-
+- bindtextdomain (GETTEXT_PACKAGE, CINNAMON_SETTINGS_LOCALEDIR);
+- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+- textdomain (GETTEXT_PACKAGE);
+-
+- loop = g_main_loop_new (NULL, FALSE);
+- manager = csd_automount_manager_new ();
+-
+- csd_automount_manager_start (manager, &error);
+-
+- if (error != NULL) {
+- g_printerr ("Unable to start the mount manager: %s",
+- error->message);
+-
+- g_error_free (error);
+- _exit (1);
+- }
+-
+- g_main_loop_run (loop);
+-
+- csd_automount_manager_stop (manager);
+- g_main_loop_unref (loop);
+-
+- return 0;
+-}
+diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in
+--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in 2013-10-02 16:13:56.000000000 +0200
++++ cinnamon-settings-daemon-2.0.1/plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in 1970-01-01 01:00:00.000000000 +0100
+@@ -1,12 +0,0 @@
+-[Desktop Entry]
+-_Name=Mount Helper
+-_Comment=Automount and autorun plugged devices
+-Exec=@LIBEXECDIR@/cinnamon-fallback-mount-helper
+-Icon=drive-optical
+-Terminal=false
+-Type=Application
+-Categories=
+-NoDisplay=true
+-OnlyShowIn=GNOME;
+-X-GNOME-Autostart-Notify=true
+-
+diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.c cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.c
+--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.c 1970-01-01 01:00:00.000000000 +0100
++++ cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.c 2013-10-08 22:35:10.771472456 +0200
+@@ -0,0 +1,106 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
++ *
++ * Copyright (C) 2010 Red Hat, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ *
++ * Author: Tomas Bzatek
++ */
++
++#include "config.h"
++
++#include
++#include
++
++#include "cinnamon-settings-plugin.h"
++#include "csd-automount-plugin.h"
++#include "csd-automount-manager.h"
++
++struct CsdAutomountPluginPrivate {
++ CsdAutomountManager *manager;
++};
++
++#define CSD_AUTOMOUNT_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPluginPrivate))
++
++CINNAMON_SETTINGS_PLUGIN_REGISTER (CsdAutomountPlugin, csd_automount_plugin)
++
++static void
++csd_automount_plugin_init (CsdAutomountPlugin *plugin)
++{
++ plugin->priv = CSD_AUTOMOUNT_PLUGIN_GET_PRIVATE (plugin);
++
++ g_debug ("Automount plugin initializing");
++
++ plugin->priv->manager = csd_automount_manager_new ();
++}
++
++static void
++csd_automount_plugin_finalize (GObject *object)
++{
++ CsdAutomountPlugin *plugin;
++
++ g_return_if_fail (object != NULL);
++ g_return_if_fail (CSD_IS_AUTOMOUNT_PLUGIN (object));
++
++ g_debug ("Automount plugin finalizing");
++
++ plugin = CSD_AUTOMOUNT_PLUGIN (object);
++
++ g_return_if_fail (plugin->priv != NULL);
++
++ if (plugin->priv->manager != NULL) {
++ g_object_unref (plugin->priv->manager);
++ }
++
++ G_OBJECT_CLASS (csd_automount_plugin_parent_class)->finalize (object);
++}
++
++static void
++impl_activate (CinnamonSettingsPlugin *plugin)
++{
++ gboolean res;
++ GError *error;
++
++ g_debug ("Activating automount plugin");
++
++ error = NULL;
++ res = csd_automount_manager_start (CSD_AUTOMOUNT_PLUGIN (plugin)->priv->manager, &error);
++ if (! res) {
++ g_warning ("Unable to start automount manager: %s", error->message);
++ g_error_free (error);
++ }
++}
++
++static void
++impl_deactivate (CinnamonSettingsPlugin *plugin)
++{
++ g_debug ("Deactivating automount plugin");
++ csd_automount_manager_stop (CSD_AUTOMOUNT_PLUGIN (plugin)->priv->manager);
++}
++
++static void
++csd_automount_plugin_class_init (CsdAutomountPluginClass *klass)
++{
++ GObjectClass *object_class = G_OBJECT_CLASS (klass);
++ CinnamonSettingsPluginClass *plugin_class = CINNAMON_SETTINGS_PLUGIN_CLASS (klass);
++
++ object_class->finalize = csd_automount_plugin_finalize;
++
++ plugin_class->activate = impl_activate;
++ plugin_class->deactivate = impl_deactivate;
++
++ g_type_class_add_private (klass, sizeof (CsdAutomountPluginPrivate));
++}
++
+diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.h cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.h
+--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/csd-automount-plugin.h 1970-01-01 01:00:00.000000000 +0100
++++ cinnamon-settings-daemon-2.0.1/plugins/automount/csd-automount-plugin.h 2013-10-08 22:35:10.771472456 +0200
+@@ -0,0 +1,60 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
++ *
++ * Copyright (C) 2010 Red Hat, Inc.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ *
++ * Author: Tomas Bzatek
++ */
++
++#ifndef __CSD_AUTOMOUNT_PLUGIN_H__
++#define __CSD_AUTOMOUNT_PLUGIN_H__
++
++#include
++#include
++#include
++
++#include "cinnamon-settings-plugin.h"
++
++G_BEGIN_DECLS
++
++#define CSD_TYPE_AUTOMOUNT_PLUGIN (csd_automount_plugin_get_type ())
++#define CSD_AUTOMOUNT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPlugin))
++#define CSD_AUTOMOUNT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPluginClass))
++#define CSD_IS_AUTOMOUNT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CSD_TYPE_AUTOMOUNT_PLUGIN))
++#define CSD_IS_AUTOMOUNT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CSD_TYPE_AUTOMOUNT_PLUGIN))
++#define CSD_AUTOMOUNT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CSD_TYPE_AUTOMOUNT_PLUGIN, CsdAutomountPluginClass))
++
++typedef struct CsdAutomountPluginPrivate CsdAutomountPluginPrivate;
++
++typedef struct
++{
++ CinnamonSettingsPlugin parent;
++ CsdAutomountPluginPrivate *priv;
++} CsdAutomountPlugin;
++
++typedef struct
++{
++ CinnamonSettingsPluginClass parent_class;
++} CsdAutomountPluginClass;
++
++GType csd_automount_plugin_get_type (void) G_GNUC_CONST;
++
++/* All the plugins must implement this function */
++G_MODULE_EXPORT GType register_cinnamon_settings_plugin (GTypeModule *module);
++
++G_END_DECLS
++
++#endif /* __CSD_AUTOMOUNT_PLUGIN_H__ */
+diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/Makefile.am cinnamon-settings-daemon-2.0.1/plugins/automount/Makefile.am
+--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/Makefile.am 2013-10-02 16:13:56.000000000 +0200
++++ cinnamon-settings-daemon-2.0.1/plugins/automount/Makefile.am 2013-10-08 22:48:19.240865461 +0200
+@@ -1,38 +1,87 @@
+-libexec_PROGRAMS = cinnamon-fallback-mount-helper
++NULL =
+
+-cinnamon_fallback_mount_helper_SOURCES = \
+- cinnamon-fallback-mount-helper.c \
+- csd-automount-manager.c \
+- csd-automount-manager.h \
+- csd-autorun.c \
+- csd-autorun.h
++plugin_name = automount
+
+-cinnamon_fallback_mount_helper_CPPFLAGS = \
++libexec_PROGRAMS = csd-test-automount
++
++csd_test_automount_SOURCES = \
++ test-automount.c \
++ csd-automount-manager.h \
++ csd-automount-manager.c \
++ csd-autorun.c \
++ csd-autorun.h \
++ $(NULL)
++
++csd_test_automount_CPPFLAGS = \
+ -I$(top_srcdir)/cinnamon-settings-daemon \
++ -I$(top_srcdir)/plugins/common \
+ -DCINNAMON_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+ $(AM_CPPFLAGS)
+
+-cinnamon_fallback_mount_helper_CFLAGS = \
++csd_test_automount_CFLAGS = \
++ $(PLUGIN_CFLAGS) \
+ $(SETTINGS_PLUGIN_CFLAGS) \
+ $(SYSTEMD_CFLAGS) \
+ $(AUTOMOUNT_CFLAGS)
++ $(AM_CFLAGS)
++
++csd_test_automount_LDADD = \
++ $(top_builddir)/cinnamon-settings-daemon/libcsd.la \
++ $(SETTINGS_PLUGIN_LIBS) \
++ $(SYSTEMD_LIBS) \
++ $(AUTOMOUNT_LIBS) \
++ $(NULL)
++
++plugin_LTLIBRARIES = \
++ libautomount.la \
++ $(NULL)
++
++libautomount_la_SOURCES = \
++ csd-automount-plugin.h \
++ csd-automount-plugin.c \
++ csd-automount-manager.h \
++ csd-automount-manager.c \
++ csd-autorun.c \
++ csd-autorun.h \
++ $(NULL)
++
++libautomount_la_CPPFLAGS = \
++ -I$(top_srcdir)/cinnamon-settings-daemon \
++ -DCINNAMON_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
++ $(AM_CPPFLAGS)
++
++libautomount_la_CFLAGS = \
++ $(SETTINGS_PLUGIN_CFLAGS) \
++ $(SYSTEMD_CFLAGS) \
++ $(AUTOMOUNT_CFLAGS) \
++ $(AM_CFLAGS)
++
++libautomount_la_LDFLAGS = \
++ $(CSD_PLUGIN_LDFLAGS) \
++ $(NULL)
+
+-cinnamon_fallback_mount_helper_LDADD = \
++libautomount_la_LIBADD = \
+ $(SETTINGS_PLUGIN_LIBS) \
+ $(SYSTEMD_LIBS) \
+ $(AUTOMOUNT_LIBS) \
+- $(top_builddir)/cinnamon-settings-daemon/libcsd.la
++ $(NULL)
+
+-autostartdir = $(datadir)/applications
+-autostart_in_files = cinnamon-fallback-mount-helper.desktop.in
+-autostart_in_in_files = cinnamon-fallback-mount-helper.desktop.in.in
+-autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
++plugin_in_files = \
++ automount.cinnamon-settings-plugin.in \
++ $(NULL)
+
+-$(autostart_in_files): $(autostart_in_in_files)
+- @sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
++plugin_DATA = $(plugin_in_files:.cinnamon-settings-plugin.in=.cinnamon-settings-plugin)
+
+-@INTLTOOL_DESKTOP_RULE@
++EXTRA_DIST = \
++ $(plugin_in_files) \
++ $(NULL)
+
+-EXTRA_DIST = $(autostart_in_in_files)
++CLEANFILES = \
++ $(plugin_DATA) \
++ $(NULL)
+
+-CLEANFILES = $(autostart_DATA) $(autostart_in_files)
++DISTCLEANFILES = \
++ $(plugin_DATA) \
++ $(NULL)
++
++@CSD_INTLTOOL_PLUGIN_RULE@
+diff -Naur cinnamon-settings-daemon-2.0.1.orig/plugins/automount/test-automount.c cinnamon-settings-daemon-2.0.1/plugins/automount/test-automount.c
+--- cinnamon-settings-daemon-2.0.1.orig/plugins/automount/test-automount.c 1970-01-01 01:00:00.000000000 +0100
++++ cinnamon-settings-daemon-2.0.1/plugins/automount/test-automount.c 2013-10-08 22:42:53.759486525 +0200
+@@ -0,0 +1,7 @@
++#define NEW csd_automount_manager_new
++#define START csd_automount_manager_start
++#define STOP csd_automount_manager_stop
++#define MANAGER CsdAutomountManager
++#include "csd-automount-manager.h"
++
++#include "test-plugin.h"
+diff -Naur cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.in cinnamon-settings-daemon-2.0.1/po/POTFILES.in
+--- cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.in 2013-10-02 16:13:56.000000000 +0200
++++ cinnamon-settings-daemon-2.0.1/po/POTFILES.in 2013-10-08 22:35:10.771472456 +0200
+@@ -18,8 +18,9 @@
+ plugins/a11y-keyboard/csd-a11y-preferences-dialog.c
+ [type: gettext/glade]plugins/a11y-keyboard/csd-a11y-preferences-dialog.ui
+ [type: gettext/ini]plugins/a11y-settings/a11y-settings.cinnamon-settings-plugin.in
+-plugins/automount/cinnamon-fallback-mount-helper.desktop.in.in
++[type: gettext/ini]plugins/automount/automount.cinnamon-settings-plugin.in
+ plugins/automount/csd-automount-manager.c
++plugins/automount/csd-automount-plugin.c
+ plugins/automount/csd-autorun.c
+ [type: gettext/ini]plugins/background/background.cinnamon-settings-plugin.in
+ [type: gettext/ini]plugins/clipboard/clipboard.cinnamon-settings-plugin.in
+diff -Naur cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.skip cinnamon-settings-daemon-2.0.1/po/POTFILES.skip
+--- cinnamon-settings-daemon-2.0.1.orig/po/POTFILES.skip 2013-10-02 16:13:56.000000000 +0200
++++ cinnamon-settings-daemon-2.0.1/po/POTFILES.skip 2013-10-08 22:37:20.224645009 +0200
+@@ -20,6 +20,5 @@
+ data/org.cinnamon.settings-daemon.plugins.updates.gschema.xml.in
+ data/org.cinnamon.settings-daemon.plugins.xrandr.gschema.xml.in
+ data/org.cinnamon.settings-daemon.plugins.xsettings.gschema.xml.in
+-plugins/automount/gnome-fallback-mount-helper.desktop.in
+ plugins/power/org.cinnamon.settings-daemon.plugins.power.policy.in
+ plugins/wacom/org.cinnamon.settings-daemon.plugins.wacom.policy.in
diff --git a/pkgs/desktops/cinnamon/cinnamon-control-center.nix b/pkgs/desktops/cinnamon/cinnamon-control-center.nix
new file mode 100644
index 000000000000..ab2f389b4f5f
--- /dev/null
+++ b/pkgs/desktops/cinnamon/cinnamon-control-center.nix
@@ -0,0 +1,40 @@
+
+{ stdenv, fetchurl, pkgconfig, autoreconfHook, glib, gettext, gnome_common, cinnamon-desktop, intltool, libxslt, gtk3, libnotify,
+gnome-menus, libxml2, systemd, upower, cinnamon-settings-daemon, colord, polkit, ibus, libcanberra_gtk3, pulseaudio, isocodes, krb5,
+libxkbfile}:
+
+let
+ version = "2.0.9";
+in
+stdenv.mkDerivation {
+ name = "cinnamon-control-center-${version}";
+
+ src = fetchurl {
+ url = "http://github.com/linuxmint/cinnamon-control-center/archive/${version}.tar.gz";
+ sha256 = "0kivqdgsf8w257j2ja6fap0dpvljcnb9gphr3knp7y6ma2d1gfv3";
+ };
+
+ configureFlags = "--enable-systemd --disable-update-mimedb" ;
+
+ patches = [ ./region.patch];
+
+ buildInputs = [
+ pkgconfig autoreconfHook
+ glib gettext gnome_common
+ intltool libxslt gtk3 cinnamon-desktop
+ libnotify gnome-menus libxml2 systemd
+ upower cinnamon-settings-daemon colord
+ polkit ibus libcanberra_gtk3 pulseaudio
+ isocodes krb5 libxkbfile ];
+
+ preBuild = "patchShebangs ./scripts";
+
+ meta = {
+ homepage = "http://cinnamon.linuxmint.com";
+ description = "The cinnamon session files" ;
+
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.roelof ];
+ };
+}
+
diff --git a/pkgs/desktops/cinnamon/cinnamon-desktop.nix b/pkgs/desktops/cinnamon/cinnamon-desktop.nix
index e158b4898840..d3cf04e835d1 100644
--- a/pkgs/desktops/cinnamon/cinnamon-desktop.nix
+++ b/pkgs/desktops/cinnamon/cinnamon-desktop.nix
@@ -22,10 +22,6 @@ stdenv.mkDerivation {
xkeyboard_config libxkbfile libX11 libXrandr libXext
];
- postInstall = ''
- ${glib}/bin/glib-compile-schemas $out/share/glib-2.0/schemas/
- '';
-
meta = {
homepage = "http://cinnamon.linuxmint.com";
description = "Library and data for various Cinnamon modules";
diff --git a/pkgs/desktops/cinnamon/cinnamon-session.nix b/pkgs/desktops/cinnamon/cinnamon-session.nix
index 850dd4e6c5af..534fa11f0467 100644
--- a/pkgs/desktops/cinnamon/cinnamon-session.nix
+++ b/pkgs/desktops/cinnamon/cinnamon-session.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
};
- configureFlags = "--disable-schemas-compile --enable-systemd --disable-gconf" ;
+ configureFlags = "--enable-systemd --disable-gconf" ;
patches = [ ./remove-sessionmigration.patch ./timeout.patch];
@@ -23,17 +23,17 @@ stdenv.mkDerivation {
gtk3 dbus_glib upower json_glib
intltool systemd xorg.xtrans
makeWrapper
+ cinnamon-desktop/*gschemas*/
];
preBuild = "patchShebangs ./scripts";
- postInstall = ''
- ${glib}/bin/glib-compile-schemas $out/share/glib-2.0/schemas/
+ postFixup = ''
rm $out/share/icons/hicolor/icon-theme.cache
for f in "$out"/bin/*; do
- wrapProgram "$f" --prefix XDG_DATA_DIRS : "$out/share:${cinnamon-desktop}/share"
+ wrapProgram "$f" --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
done
'';
diff --git a/pkgs/desktops/cinnamon/cinnamon-settings-daemon.nix b/pkgs/desktops/cinnamon/cinnamon-settings-daemon.nix
new file mode 100644
index 000000000000..c397a9758e2c
--- /dev/null
+++ b/pkgs/desktops/cinnamon/cinnamon-settings-daemon.nix
@@ -0,0 +1,52 @@
+
+{ stdenv, fetchurl, pkgconfig, autoreconfHook, glib, gettext, gnome_common, cinnamon-desktop, intltool, gtk3,
+libnotify, lcms2, libxklavier, libgnomekbd, libcanberra, pulseaudio, upower, libcanberra_gtk3, colord,
+systemd, libxslt, docbook_xsl, makeWrapper, gsettings_desktop_schemas}:
+
+let
+ version = "2.0.10";
+in
+stdenv.mkDerivation {
+ name = "cinnamon-settings-daemon-${version}";
+
+ src = fetchurl {
+ url = "http://github.com/linuxmint/cinnamon-settings-daemon/archive/${version}.tar.gz";
+ sha256 = "10r75xsngb7ipv9fy07dyfb256bqybzcxbwny60sgjhrksk3v9mg";
+ };
+
+ NIX_CFLAGS_COMPILE = "-I${glib}/include/gio-unix-2.0";
+
+ configureFlags = "--enable-systemd" ;
+
+ patches = [ ./systemd-support.patch ./automount-plugin.patch ./dpms.patch];
+
+ buildInputs = [
+ pkgconfig autoreconfHook
+ glib gettext gnome_common
+ intltool gtk3 libnotify lcms2
+ libgnomekbd libxklavier colord
+ libcanberra pulseaudio upower
+ libcanberra_gtk3 cinnamon-desktop
+ systemd libxslt docbook_xsl makeWrapper
+ gsettings_desktop_schemas
+ ];
+
+ preBuild = "patchShebangs ./scripts";
+
+ #ToDo: missing org.cinnamon.gschema.xml, probably not packaged yet
+ postFixup = ''
+ for f in "$out"/libexec/*; do
+ wrapProgram "$f" --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
+ done
+ '';
+
+
+ meta = {
+ homepage = "http://cinnamon.linuxmint.com";
+ description = "The cinnamon session files" ;
+
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.roelof ];
+ };
+}
+
diff --git a/pkgs/desktops/cinnamon/dpms.patch b/pkgs/desktops/cinnamon/dpms.patch
new file mode 100644
index 000000000000..a73f33dc6182
--- /dev/null
+++ b/pkgs/desktops/cinnamon/dpms.patch
@@ -0,0 +1,30 @@
+
+-- a/plugins/power/csd-power-manager.c
++++ b/plugins/power/csd-power-manager.c
+@@ -33,6 +33,8 @@
+ #include
+ #include
+
++#include
++
+ #define GNOME_DESKTOP_USE_UNSTABLE_API
+ #include
+
+@@ -3967,6 +3790,17 @@ csd_power_manager_start (CsdPowerManager
+ /* set the initial dim time that can adapt for the user */
+ refresh_idle_dim_settings (manager);
+
++ /* Make sure that Xorg's DPMS extension never gets in our way. The defaults seem to have changed in Xorg 1.14
++ * being "0" by default to being "600" by default
++ * https://bugzilla.gnome.org/show_bug.cgi?id=709114
++ */
++ gdk_error_trap_push ();
++ int dummy;
++ if (DPMSQueryExtension(GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &dummy, &dummy)) {
++ DPMSSetTimeouts (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), 0, 0, 0);
++ }
++ gdk_error_trap_pop_ignored ();
++
+ manager->priv->xscreensaver_watchdog_timer_id = g_timeout_add_seconds (XSCREENSAVER_WATCHDOG_TIMEOUT,
+ disable_builtin_screensaver,
+ NULL);
diff --git a/pkgs/desktops/cinnamon/gtkdoc.patch b/pkgs/desktops/cinnamon/gtkdoc.patch
new file mode 100644
index 000000000000..6398306a76ae
--- /dev/null
+++ b/pkgs/desktops/cinnamon/gtkdoc.patch
@@ -0,0 +1,41 @@
+--- a/src/meta/prefs.h
++++ b/src/meta/prefs.h
+@@ -310,13 +310,13 @@ typedef struct
+ */
+ GSList *bindings;
+
+- /** for keybindings that can have shift or not like Alt+Tab */
++ /* for keybindings that can have shift or not like Alt+Tab */
+ gboolean add_shift:1;
+
+- /** for keybindings that apply only to a window */
++ /* for keybindings that apply only to a window */
+ gboolean per_window:1;
+
+- /** for keybindings not added with meta_display_add_keybinding() */
++ /* for keybindings not added with meta_display_add_keybinding() */
+ gboolean builtin:1;
+ } MetaKeyPref;
+
+@@ -339,5 +339,3 @@ CDesktopVisualBellType meta_prefs_get_vi
+ MetaPlacementMode meta_prefs_get_placement_mode (void);
+
+ #endif
+-
+-
+--- a/src/core/workspace.c
++++ b/src/core/workspace.c
+@@ -194,7 +194,7 @@ meta_workspace_new (MetaScreen *screen)
+ return workspace;
+ }
+
+-/** Foreach function for workspace_free_struts() */
++/* Foreach function for workspace_free_struts() */
+ static void
+ free_this (gpointer candidate, gpointer dummy)
+ {
+@@ -1390,4 +1390,3 @@ meta_workspace_get_screen (MetaWorkspace
+ {
+ return workspace->screen;
+ }
+-
diff --git a/pkgs/desktops/cinnamon/keyboard.patch b/pkgs/desktops/cinnamon/keyboard.patch
new file mode 100644
index 000000000000..f67d961ff58f
--- /dev/null
+++ b/pkgs/desktops/cinnamon/keyboard.patch
@@ -0,0 +1,4729 @@
+
+diff -uNrp a/cinnamon-settings-daemon/main.c b/cinnamon-settings-daemon/main.c
+--- a/cinnamon-settings-daemon/main.c 2013-08-24 18:04:31.000000000 +0100
++++ b/cinnamon-settings-daemon/main.c 2013-08-25 16:36:02.000000000 +0100
+@@ -319,6 +319,29 @@ set_legacy_ibus_env_vars (GDBusProxy *pr
+ }
+ #endif
+
++static void
++got_session_proxy (GObject *source_object,
++ GAsyncResult *res,
++ gpointer user_data)
++{
++ GDBusProxy *proxy;
++ GError *error = NULL;
++
++ proxy = g_dbus_proxy_new_finish (res, &error);
++ if (proxy == NULL) {
++ g_debug ("Could not connect to the Session manager: %s", error->message);
++ g_error_free (error);
++ } else {
++ set_locale (proxy);
++#ifdef HAVE_IBUS
++ /* This will register with cinnamon-session after calling Setenv. */
++ set_legacy_ibus_env_vars (proxy);
++#else
++ register_with_gnome_session (proxy);
++#endif
++ }
++}
++
+ static gboolean
+ on_term_signal_pipe_closed (GIOChannel *source,
+ GIOCondition condition,
+@@ -368,6 +391,16 @@ set_session_over_handler (GDBusConnectio
+ {
+ g_assert (bus != NULL);
+
++ g_dbus_proxy_new (bus,
++ G_DBUS_PROXY_FLAGS_NONE,
++ NULL,
++ GNOME_SESSION_DBUS_NAME,
++ GNOME_SESSION_DBUS_OBJECT,
++ GNOME_SESSION_DBUS_INTERFACE,
++ NULL,
++ (GAsyncReadyCallback) got_session_proxy,
++ NULL);
++
+ watch_for_term_signal (manager);
+ }
+
+@@ -390,56 +423,6 @@ name_lost_handler (GDBusConnection *conn
+ gtk_main_quit ();
+ }
+
+-static gboolean
+-do_register_client (gpointer user_data)
+-{
+- GDBusProxy *proxy = (GDBusProxy *) user_data;
+- g_assert (proxy != NULL);
+-
+- const char *startup_id = g_getenv ("DESKTOP_AUTOSTART_ID");
+- g_dbus_proxy_call (proxy,
+- "RegisterClient",
+- g_variant_new ("(ss)", "cinnamon-settings-daemon", startup_id ? startup_id : ""),
+- G_DBUS_CALL_FLAGS_NONE,
+- -1,
+- NULL,
+- (GAsyncReadyCallback) on_client_registered,
+- manager);
+-
+- return FALSE;
+-}
+-
+-static void
+-queue_register_client (void)
+-{
+- GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+- if (!bus)
+- return;
+-
+- GError *error = NULL;
+- GDBusProxy *proxy = g_dbus_proxy_new_sync (bus,
+- G_DBUS_PROXY_FLAGS_NONE,
+- NULL,
+- GNOME_SESSION_DBUS_NAME,
+- GNOME_SESSION_DBUS_OBJECT,
+- GNOME_SESSION_DBUS_INTERFACE,
+- NULL,
+- &error);
+- g_object_unref (bus);
+-
+- if (proxy == NULL) {
+- g_debug ("Could not connect to the Session manager: %s", error->message);
+- g_error_free (error);
+- return;
+- }
+-
+- /* Register the daemon with cinnamon-session */
+- g_signal_connect (G_OBJECT (proxy), "g-signal",
+- G_CALLBACK (on_session_over), NULL);
+-
+- g_idle_add_full (G_PRIORITY_DEFAULT, do_register_client, proxy, NULL);
+-}
+-
+ static void
+ bus_register (void)
+ {
+@@ -541,8 +524,6 @@ main (int argc, char *argv[])
+
+ notify_init ("cinnamon-settings-daemon");
+
+- queue_register_client ();
+-
+ bus_register ();
+
+ cinnamon_settings_profile_start ("cinnamon_settings_manager_new");
+diff -uNrp a/configure.ac b/configure.ac
+--- a/configure.ac 2013-08-24 18:04:31.000000000 +0100
++++ b/configure.ac 2013-08-25 16:36:02.000000000 +0100
+@@ -53,6 +53,7 @@ UPOWER_GLIB_REQUIRED_VERSION=0.9.1
+ PA_REQUIRED_VERSION=0.9.16
+ UPOWER_REQUIRED_VERSION=0.9.11
+ GTK_XINPUT_2_3_VERSION=3.7.8
++IBUS_REQUIRED_VERSION=1.4.2
+
+ #EXTRA_COMPILE_WARNINGS(yes)
+
+@@ -199,8 +200,21 @@ dnl ------------------------------------
+ dnl - Keyboard plugin stuff
+ dnl ---------------------------------------------------------------------------
+
+-LIBGNOMEKBD_REQUIRED=2.91.1
+-PKG_CHECK_MODULES(KEYBOARD, [libgnomekbdui >= $LIBGNOMEKBD_REQUIRED libgnomekbd >= $LIBGNOMEKBD_REQUIRED libxklavier >= 5.0 kbproto])
++AC_ARG_ENABLE(ibus,
++ AS_HELP_STRING([--disable-ibus],
++ [Disable IBus support]),
++ enable_ibus=$enableval,
++ enable_ibus=yes)
++
++if test "x$enable_ibus" = "xyes" ; then
++ IBUS_MODULE="ibus-1.0 >= $IBUS_REQUIRED_VERSION"
++ AC_DEFINE(HAVE_IBUS, 1, [Defined if IBus support is enabled])
++else
++ IBUS_MODULE=
++fi
++AM_CONDITIONAL(HAVE_IBUS, test "x$enable_ibus" == "xyes")
++
++PKG_CHECK_MODULES(KEYBOARD, xkbfile $IBUS_MODULE cinnamon-desktop >= $CINNAMON_DESKTOP_REQUIRED_VERSION)
+
+ dnl ---------------------------------------------------------------------------
+ dnl - Housekeeping plugin stuff
+diff -uNrp a/data/org.cinnamon.settings-daemon.plugins.media-keys.gschema.xml.in.in b/data/org.cinnamon.settings-daemon.plugins.media-keys.gschema.xml.in.in
+--- a/data/org.cinnamon.settings-daemon.plugins.media-keys.gschema.xml.in.in 2013-08-24 18:04:31.000000000 +0100
++++ b/data/org.cinnamon.settings-daemon.plugins.media-keys.gschema.xml.in.in 2013-08-25 16:36:02.000000000 +0100
+@@ -175,6 +175,15 @@
+ <_summary>Magnifier zoom out
+ <_description>Binding for the magnifier to zoom out
+
++
++ ''
++ <_summary>Switch input source
++ <_description>Binding to select the next input source
++
++
++ ''
++ <_summary>Switch input source backward
++ <_description>Binding to select the previous input source
++
+
+-
+-
++
+\ No newline at end of file
+diff -uNrp a/plugins/keyboard/csd-keyboard-manager.c b/plugins/keyboard/csd-keyboard-manager.c
+--- a/plugins/keyboard/csd-keyboard-manager.c 2013-08-24 18:04:31.000000000 +0100
++++ b/plugins/keyboard/csd-keyboard-manager.c 2013-08-25 16:36:02.000000000 +0100
+@@ -40,19 +40,22 @@
+
+ #include
+ #include
++#include
++
++#define GNOME_DESKTOP_USE_UNSTABLE_API
++#include
++
++#ifdef HAVE_IBUS
++#include
++#endif
+
+ #include "cinnamon-settings-profile.h"
+ #include "csd-keyboard-manager.h"
++#include "csd-input-helper.h"
+ #include "csd-enums.h"
+
+-#include "csd-keyboard-xkb.h"
+-
+ #define CSD_KEYBOARD_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CSD_TYPE_KEYBOARD_MANAGER, CsdKeyboardManagerPrivate))
+
+-#ifndef HOST_NAME_MAX
+-# define HOST_NAME_MAX 255
+-#endif
+-
+ #define CSD_KEYBOARD_DIR "org.cinnamon.settings-daemon.peripherals.keyboard"
+
+ #define KEY_REPEAT "repeat"
+@@ -60,6 +63,7 @@
+ #define KEY_INTERVAL "repeat-interval"
+ #define KEY_DELAY "delay"
+ #define KEY_CLICK_VOLUME "click-volume"
++#define KEY_REMEMBER_NUMLOCK_STATE "remember-numlock-state"
+ #define KEY_NUMLOCK_STATE "numlock-state"
+
+ #define KEY_BELL_VOLUME "bell-volume"
+@@ -67,27 +71,560 @@
+ #define KEY_BELL_DURATION "bell-duration"
+ #define KEY_BELL_MODE "bell-mode"
+
+-#define LIBGNOMEKBD_KEYBOARD_DIR "org.gnome.libgnomekbd.keyboard"
+-#define LIBGNOMEKBD_KEY_LAYOUTS "layouts"
++#define KEY_SWITCHER "input-sources-switcher"
++
++#define GNOME_DESKTOP_INTERFACE_DIR "org.cinnamon.desktop.interface"
++
++#define KEY_GTK_IM_MODULE "gtk-im-module"
++#define GTK_IM_MODULE_SIMPLE "gtk-im-context-simple"
++#define GTK_IM_MODULE_IBUS "ibus"
++
++#define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.cinnamon.desktop.input-sources"
++
++#define KEY_CURRENT_INPUT_SOURCE "current"
++#define KEY_INPUT_SOURCES "sources"
++#define KEY_KEYBOARD_OPTIONS "xkb-options"
++
++#define INPUT_SOURCE_TYPE_XKB "xkb"
++#define INPUT_SOURCE_TYPE_IBUS "ibus"
++
++#define DEFAULT_LANGUAGE "en_US"
+
+ struct CsdKeyboardManagerPrivate
+ {
+ guint start_idle_id;
+ GSettings *settings;
+- GSettings *libgnomekbd_settings;
+- gboolean have_xkb;
++ GSettings *input_sources_settings;
++ GSettings *interface_settings;
++ GnomeXkbInfo *xkb_info;
++#ifdef HAVE_IBUS
++ IBusBus *ibus;
++ GHashTable *ibus_engines;
++ GHashTable *ibus_xkb_engines;
++ GCancellable *ibus_cancellable;
++ gboolean session_is_fallback;
++#endif
+ gint xkb_event_base;
+ CsdNumLockState old_state;
++ GdkDeviceManager *device_manager;
++ guint device_added_id;
++ guint device_removed_id;
++
++ gboolean input_sources_switcher_spawned;
++ GPid input_sources_switcher_pid;
+ };
+
+ static void csd_keyboard_manager_class_init (CsdKeyboardManagerClass *klass);
+ static void csd_keyboard_manager_init (CsdKeyboardManager *keyboard_manager);
+ static void csd_keyboard_manager_finalize (GObject *object);
++static gboolean apply_input_sources_settings (GSettings *settings,
++ gpointer keys,
++ gint n_keys,
++ CsdKeyboardManager *manager);
++static void set_gtk_im_module (CsdKeyboardManager *manager,
++ const gchar *new_module);
+
+ G_DEFINE_TYPE (CsdKeyboardManager, csd_keyboard_manager, G_TYPE_OBJECT)
+
+ static gpointer manager_object = NULL;
+
++static void
++init_builder_with_sources (GVariantBuilder *builder,
++ GSettings *settings)
++{
++ const gchar *type;
++ const gchar *id;
++ GVariantIter iter;
++ GVariant *sources;
++
++ sources = g_settings_get_value (settings, KEY_INPUT_SOURCES);
++
++ g_variant_builder_init (builder, G_VARIANT_TYPE ("a(ss)"));
++
++ g_variant_iter_init (&iter, sources);
++ while (g_variant_iter_next (&iter, "(&s&s)", &type, &id))
++ g_variant_builder_add (builder, "(ss)", type, id);
++
++ g_variant_unref (sources);
++}
++
++static gboolean
++schema_is_installed (const gchar *name)
++{
++ const gchar * const *schemas;
++ const gchar * const *s;
++
++ schemas = g_settings_list_schemas ();
++ for (s = schemas; *s; ++s)
++ if (g_str_equal (*s, name))
++ return TRUE;
++
++ return FALSE;
++}
++
++#ifdef HAVE_IBUS
++static void
++clear_ibus (CsdKeyboardManager *manager)
++{
++ CsdKeyboardManagerPrivate *priv = manager->priv;
++
++ g_cancellable_cancel (priv->ibus_cancellable);
++ g_clear_object (&priv->ibus_cancellable);
++ g_clear_pointer (&priv->ibus_engines, g_hash_table_destroy);
++ g_clear_pointer (&priv->ibus_xkb_engines, g_hash_table_destroy);
++ g_clear_object (&priv->ibus);
++}
++
++static gchar *
++make_xkb_source_id (const gchar *engine_id)
++{
++ gchar *id;
++ gchar *p;
++ gint n_colons = 0;
++
++ /* engine_id is like "xkb:layout:variant:lang" where
++ * 'variant' and 'lang' might be empty */
++
++ engine_id += 4;
++
++ for (p = (gchar *)engine_id; *p; ++p)
++ if (*p == ':')
++ if (++n_colons == 2)
++ break;
++ if (!*p)
++ return NULL;
++
++ id = g_strndup (engine_id, p - engine_id + 1);
++
++ id[p - engine_id] = '\0';
++
++ /* id is "layout:variant" where 'variant' might be empty */
++
++ for (p = id; *p; ++p)
++ if (*p == ':') {
++ if (*(p + 1) == '\0')
++ *p = '\0';
++ else
++ *p = '+';
++ break;
++ }
++
++ /* id is "layout+variant" or "layout" */
++
++ return id;
++}
++
++static void
++fetch_ibus_engines_result (GObject *object,
++ GAsyncResult *result,
++ CsdKeyboardManager *manager)
++{
++ CsdKeyboardManagerPrivate *priv = manager->priv;
++ GList *list, *l;
++ GError *error = NULL;
++
++ /* engines shouldn't be there yet */
++ g_return_if_fail (priv->ibus_engines == NULL);
++
++ g_clear_object (&priv->ibus_cancellable);
++
++ list = ibus_bus_list_engines_async_finish (priv->ibus,
++ result,
++ &error);
++ if (!list && error) {
++ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
++ g_warning ("Couldn't finish IBus request: %s", error->message);
++ g_error_free (error);
++
++ clear_ibus (manager);
++ return;
++ }
++
++ /* Maps IBus engine ids to engine description objects */
++ priv->ibus_engines = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
++ /* Maps XKB source id strings to engine description objects */
++ priv->ibus_xkb_engines = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
++
++ for (l = list; l; l = l->next) {
++ IBusEngineDesc *engine = l->data;
++ const gchar *engine_id = ibus_engine_desc_get_name (engine);
++
++ g_hash_table_replace (priv->ibus_engines, (gpointer)engine_id, engine);
++
++ if (strncmp ("xkb:", engine_id, 4) == 0) {
++ gchar *xkb_source_id = make_xkb_source_id (engine_id);
++ if (xkb_source_id)
++ g_hash_table_replace (priv->ibus_xkb_engines,
++ xkb_source_id,
++ engine);
++ }
++ }
++ g_list_free (list);
++
++ apply_input_sources_settings (priv->input_sources_settings, NULL, 0, manager);
++}
++
++static void
++fetch_ibus_engines (CsdKeyboardManager *manager)
++{
++ CsdKeyboardManagerPrivate *priv = manager->priv;
++
++ /* engines shouldn't be there yet */
++ g_return_if_fail (priv->ibus_engines == NULL);
++ g_return_if_fail (priv->ibus_cancellable == NULL);
++
++ priv->ibus_cancellable = g_cancellable_new ();
++
++ ibus_bus_list_engines_async (priv->ibus,
++ -1,
++ priv->ibus_cancellable,
++ (GAsyncReadyCallback)fetch_ibus_engines_result,
++ manager);
++}
++
++static void
++maybe_start_ibus (CsdKeyboardManager *manager,
++ GVariant *sources)
++{
++ gboolean need_ibus = FALSE;
++ GVariantIter iter;
++ const gchar *type;
++
++ if (manager->priv->session_is_fallback)
++ return;
++
++ g_variant_iter_init (&iter, sources);
++ while (g_variant_iter_next (&iter, "(&s&s)", &type, NULL))
++ if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) {
++ need_ibus = TRUE;
++ break;
++ }
++
++ if (!need_ibus)
++ return;
++
++ if (!manager->priv->ibus) {
++ ibus_init ();
++ manager->priv->ibus = ibus_bus_new ();
++ g_signal_connect_swapped (manager->priv->ibus, "connected",
++ G_CALLBACK (fetch_ibus_engines), manager);
++ g_signal_connect_swapped (manager->priv->ibus, "disconnected",
++ G_CALLBACK (clear_ibus), manager);
++ }
++ /* IBus doesn't export API in the session bus. The only thing
++ * we have there is a well known name which we can use as a
++ * sure-fire way to activate it. */
++ g_bus_unwatch_name (g_bus_watch_name (G_BUS_TYPE_SESSION,
++ IBUS_SERVICE_IBUS,
++ G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
++ NULL,
++ NULL,
++ NULL,
++ NULL));
++}
++
++static void
++got_session_name (GObject *object,
++ GAsyncResult *res,
++ CsdKeyboardManager *manager)
++{
++ GVariant *result, *variant;
++ GDBusConnection *connection = G_DBUS_CONNECTION (object);
++ CsdKeyboardManagerPrivate *priv = manager->priv;
++ const gchar *session_name = NULL;
++ GError *error = NULL;
++
++ /* IBus shouldn't have been touched yet */
++ g_return_if_fail (priv->ibus == NULL);
++
++ g_clear_object (&priv->ibus_cancellable);
++
++ result = g_dbus_connection_call_finish (connection, res, &error);
++ if (!result) {
++ g_warning ("Couldn't get session name: %s", error->message);
++ g_error_free (error);
++ goto out;
++ }
++
++ g_variant_get (result, "(v)", &variant);
++ g_variant_unref (result);
++
++ g_variant_get (variant, "&s", &session_name);
++
++ if (g_strcmp0 (session_name, "gnome") == 0)
++ manager->priv->session_is_fallback = FALSE;
++
++ g_variant_unref (variant);
++ out:
++ apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager);
++ g_object_unref (connection);
++}
++
++static void
++got_bus (GObject *object,
++ GAsyncResult *res,
++ CsdKeyboardManager *manager)
++{
++ GDBusConnection *connection;
++ CsdKeyboardManagerPrivate *priv = manager->priv;
++ GError *error = NULL;
++
++ /* IBus shouldn't have been touched yet */
++ g_return_if_fail (priv->ibus == NULL);
++
++ g_clear_object (&priv->ibus_cancellable);
++
++ connection = g_bus_get_finish (res, &error);
++ if (!connection) {
++ g_warning ("Couldn't get session bus: %s", error->message);
++ g_error_free (error);
++ apply_input_sources_settings (priv->input_sources_settings, NULL, 0, manager);
++ return;
++ }
++
++ priv->ibus_cancellable = g_cancellable_new ();
++
++ g_dbus_connection_call (connection,
++ "org.gnome.SessionManager",
++ "/org/gnome/SessionManager",
++ "org.freedesktop.DBus.Properties",
++ "Get",
++ g_variant_new ("(ss)",
++ "org.gnome.SessionManager",
++ "SessionName"),
++ NULL,
++ G_DBUS_CALL_FLAGS_NONE,
++ -1,
++ priv->ibus_cancellable,
++ (GAsyncReadyCallback)got_session_name,
++ manager);
++}
++
++static void
++set_ibus_engine_finish (GObject *object,
++ GAsyncResult *res,
++ CsdKeyboardManager *manager)
++{
++ gboolean result;
++ IBusBus *ibus = IBUS_BUS (object);
++ CsdKeyboardManagerPrivate *priv = manager->priv;
++ GError *error = NULL;
++
++ g_clear_object (&priv->ibus_cancellable);
++
++ result = ibus_bus_set_global_engine_async_finish (ibus, res, &error);
++ if (!result) {
++ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
++ g_warning ("Couldn't set IBus engine: %s", error->message);
++ g_error_free (error);
++ }
++}
++
++static void
++set_ibus_engine (CsdKeyboardManager *manager,
++ const gchar *engine_id)
++{
++ CsdKeyboardManagerPrivate *priv = manager->priv;
++
++ g_return_if_fail (priv->ibus != NULL);
++ g_return_if_fail (priv->ibus_engines != NULL);
++
++ g_cancellable_cancel (priv->ibus_cancellable);
++ g_clear_object (&priv->ibus_cancellable);
++ priv->ibus_cancellable = g_cancellable_new ();
++
++ ibus_bus_set_global_engine_async (priv->ibus,
++ engine_id,
++ -1,
++ priv->ibus_cancellable,
++ (GAsyncReadyCallback)set_ibus_engine_finish,
++ manager);
++}
++
++static void
++set_ibus_xkb_engine (CsdKeyboardManager *manager,
++ const gchar *xkb_id)
++{
++ IBusEngineDesc *engine;
++ CsdKeyboardManagerPrivate *priv = manager->priv;
++
++ if (!priv->ibus_xkb_engines)
++ return;
++
++ engine = g_hash_table_lookup (priv->ibus_xkb_engines, xkb_id);
++ if (!engine)
++ return;
++
++ set_ibus_engine (manager, ibus_engine_desc_get_name (engine));
++}
++
++/* XXX: See upstream bug:
++ * https://codereview.appspot.com/6586075/ */
++static gchar *
++layout_from_ibus_layout (const gchar *ibus_layout)
++{
++ const gchar *p;
++
++ /* we get something like "layout(variant)[option1,option2]" */
++
++ p = ibus_layout;
++ while (*p) {
++ if (*p == '(' || *p == '[')
++ break;
++ p += 1;
++ }
++
++ return g_strndup (ibus_layout, p - ibus_layout);
++}
++
++static gchar *
++variant_from_ibus_layout (const gchar *ibus_layout)
++{
++ const gchar *a, *b;
++
++ /* we get something like "layout(variant)[option1,option2]" */
++
++ a = ibus_layout;
++ while (*a) {
++ if (*a == '(')
++ break;
++ a += 1;
++ }
++ if (!*a)
++ return NULL;
++
++ a += 1;
++ b = a;
++ while (*b) {
++ if (*b == ')')
++ break;
++ b += 1;
++ }
++ if (!*b)
++ return NULL;
++
++ return g_strndup (a, b - a);
++}
++
++static gchar **
++options_from_ibus_layout (const gchar *ibus_layout)
++{
++ const gchar *a, *b;
++ GPtrArray *opt_array;
++
++ /* we get something like "layout(variant)[option1,option2]" */
++
++ a = ibus_layout;
++ while (*a) {
++ if (*a == '[')
++ break;
++ a += 1;
++ }
++ if (!*a)
++ return NULL;
++
++ opt_array = g_ptr_array_new ();
++
++ do {
++ a += 1;
++ b = a;
++ while (*b) {
++ if (*b == ',' || *b == ']')
++ break;
++ b += 1;
++ }
++ if (!*b)
++ goto out;
++
++ g_ptr_array_add (opt_array, g_strndup (a, b - a));
++
++ a = b;
++ } while (*a && *a == ',');
++
++out:
++ g_ptr_array_add (opt_array, NULL);
++ return (gchar **) g_ptr_array_free (opt_array, FALSE);
++}
++
++static const gchar *
++engine_from_locale (void)
++{
++ const gchar *locale;
++ const gchar *locale_engine[][2] = {
++ { "as_IN", "m17n:as:phonetic" },
++ { "bn_IN", "m17n:bn:inscript" },
++ { "gu_IN", "m17n:gu:inscript" },
++ { "hi_IN", "m17n:hi:inscript" },
++ { "ja_JP", "anthy" },
++ { "kn_IN", "m17n:kn:kgp" },
++ { "ko_KR", "hangul" },
++ { "mai_IN", "m17n:mai:inscript" },
++ { "ml_IN", "m17n:ml:inscript" },
++ { "mr_IN", "m17n:mr:inscript" },
++ { "or_IN", "m17n:or:inscript" },
++ { "pa_IN", "m17n:pa:inscript" },
++ { "sd_IN", "m17n:sd:inscript" },
++ { "ta_IN", "m17n:ta:tamil99" },
++ { "te_IN", "m17n:te:inscript" },
++ { "zh_CN", "pinyin" },
++ { "zh_HK", "cangjie3" },
++ { "zh_TW", "chewing" },
++ };
++ gint i;
++
++ locale = setlocale (LC_CTYPE, NULL);
++ if (!locale)
++ return NULL;
++
++ for (i = 0; i < G_N_ELEMENTS (locale_engine); ++i)
++ if (g_str_has_prefix (locale, locale_engine[i][0]))
++ return locale_engine[i][1];
++
++ return NULL;
++}
++
++static void
++add_ibus_sources_from_locale (GSettings *settings)
++{
++ const gchar *locale_engine;
++ GVariantBuilder builder;
++
++ locale_engine = engine_from_locale ();
++ if (!locale_engine)
++ return;
++
++ init_builder_with_sources (&builder, settings);
++ g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_IBUS, locale_engine);
++ g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
++}
++
++static void
++convert_ibus (GSettings *settings)
++{
++ GVariantBuilder builder;
++ GSettings *ibus_settings;
++ gchar **engines, **e;
++
++ if (!schema_is_installed ("org.freedesktop.ibus.general"))
++ return;
++
++ init_builder_with_sources (&builder, settings);
++
++ ibus_settings = g_settings_new ("org.freedesktop.ibus.general");
++ engines = g_settings_get_strv (ibus_settings, "preload-engines");
++ for (e = engines; *e; ++e) {
++ if (g_str_has_prefix (*e, "xkb:"))
++ continue;
++ g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_IBUS, *e);
++ }
++
++ g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
++
++ g_strfreev (engines);
++ g_object_unref (ibus_settings);
++}
++#endif /* HAVE_IBUS */
++
+ static gboolean
+ xkb_set_keyboard_autorepeat_rate (guint delay, guint interval)
+ {
+@@ -97,32 +634,33 @@ xkb_set_keyboard_autorepeat_rate (guint
+ interval);
+ }
+
+-static void
+-numlock_xkb_init (CsdKeyboardManager *manager)
++static gboolean
++check_xkb_extension (CsdKeyboardManager *manager)
+ {
+ Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+- gboolean have_xkb;
+ int opcode, error_base, major, minor;
++ gboolean have_xkb;
+
+ have_xkb = XkbQueryExtension (dpy,
+ &opcode,
+ &manager->priv->xkb_event_base,
+ &error_base,
+ &major,
+- &minor)
+- && XkbUseExtension (dpy, &major, &minor);
++ &minor);
++ return have_xkb;
++}
+
+- if (have_xkb) {
+- XkbSelectEventDetails (dpy,
+- XkbUseCoreKbd,
+- XkbStateNotifyMask,
+- XkbModifierLockMask,
+- XkbModifierLockMask);
+- } else {
+- g_warning ("XKB extension not available");
+- }
++static void
++xkb_init (CsdKeyboardManager *manager)
++{
++ Display *dpy;
+
+- manager->priv->have_xkb = have_xkb;
++ dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++ XkbSelectEventDetails (dpy,
++ XkbUseCoreKbd,
++ XkbStateNotify,
++ XkbModifierLockMask,
++ XkbModifierLockMask);
+ }
+
+ static unsigned
+@@ -143,19 +681,32 @@ numlock_set_xkb_state (CsdNumLockState n
+ XkbLockModifiers (dpy, XkbUseCoreKbd, num_mask, new_state == CSD_NUM_LOCK_STATE_ON ? num_mask : 0);
+ }
+
++static const char *
++num_lock_state_to_string (CsdNumLockState numlock_state)
++{
++ switch (numlock_state) {
++ case CSD_NUM_LOCK_STATE_UNKNOWN:
++ return "CSD_NUM_LOCK_STATE_UNKNOWN";
++ case CSD_NUM_LOCK_STATE_ON:
++ return "CSD_NUM_LOCK_STATE_ON";
++ case CSD_NUM_LOCK_STATE_OFF:
++ return "CSD_NUM_LOCK_STATE_OFF";
++ default:
++ return "UNKNOWN";
++ }
++}
++
+ static GdkFilterReturn
+-numlock_xkb_callback (GdkXEvent *xev_,
+- GdkEvent *gdkev_,
+- gpointer user_data)
++xkb_events_filter (GdkXEvent *xev_,
++ GdkEvent *gdkev_,
++ gpointer user_data)
+ {
+ XEvent *xev = (XEvent *) xev_;
+ XkbEvent *xkbev = (XkbEvent *) xev;
+ CsdKeyboardManager *manager = (CsdKeyboardManager *) user_data;
+
+- if (xev->type != manager->priv->xkb_event_base)
+- return GDK_FILTER_CONTINUE;
+-
+- if (xkbev->any.xkb_type != XkbStateNotify)
++ if (xev->type != manager->priv->xkb_event_base ||
++ xkbev->any.xkb_type != XkbStateNotify)
+ return GDK_FILTER_CONTINUE;
+
+ if (xkbev->state.changed & XkbModifierLockMask) {
+@@ -166,6 +717,9 @@ numlock_xkb_callback (GdkXEvent *xev_,
+ numlock_state = (num_mask & locked_mods) ? CSD_NUM_LOCK_STATE_ON : CSD_NUM_LOCK_STATE_OFF;
+
+ if (numlock_state != manager->priv->old_state) {
++ g_debug ("New num-lock state '%s' != Old num-lock state '%s'",
++ num_lock_state_to_string (numlock_state),
++ num_lock_state_to_string (manager->priv->old_state));
+ g_settings_set_enum (manager->priv->settings,
+ KEY_NUMLOCK_STATE,
+ numlock_state);
+@@ -177,57 +731,509 @@ numlock_xkb_callback (GdkXEvent *xev_,
+ }
+
+ static void
+-numlock_install_xkb_callback (CsdKeyboardManager *manager)
++install_xkb_filter (CsdKeyboardManager *manager)
+ {
+- if (!manager->priv->have_xkb)
+- return;
+-
+ gdk_window_add_filter (NULL,
+- numlock_xkb_callback,
++ xkb_events_filter,
+ manager);
+ }
+
+-static guint
+-_csd_settings_get_uint (GSettings *settings,
+- const char *key)
++static void
++remove_xkb_filter (CsdKeyboardManager *manager)
+ {
+- guint value;
++ gdk_window_remove_filter (NULL,
++ xkb_events_filter,
++ manager);
++}
+
+- g_settings_get (settings, key, "u", &value);
+- return value;
++static void
++free_xkb_component_names (XkbComponentNamesRec *p)
++{
++ g_return_if_fail (p != NULL);
++
++ free (p->keymap);
++ free (p->keycodes);
++ free (p->types);
++ free (p->compat);
++ free (p->symbols);
++ free (p->geometry);
++
++ g_free (p);
++}
++
++static void
++upload_xkb_description (const gchar *rules_file_path,
++ XkbRF_VarDefsRec *var_defs,
++ XkbComponentNamesRec *comp_names)
++{
++ Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
++ XkbDescRec *xkb_desc;
++ gchar *rules_file;
++
++ /* Upload it to the X server using the same method as setxkbmap */
++ xkb_desc = XkbGetKeyboardByName (display,
++ XkbUseCoreKbd,
++ comp_names,
++ XkbGBN_AllComponentsMask,
++ XkbGBN_AllComponentsMask &
++ (~XkbGBN_GeometryMask), True);
++ if (!xkb_desc) {
++ g_warning ("Couldn't upload new XKB keyboard description");
++ return;
++ }
++
++ XkbFreeKeyboard (xkb_desc, 0, True);
++
++ rules_file = g_path_get_basename (rules_file_path);
++
++ if (!XkbRF_SetNamesProp (display, rules_file, var_defs))
++ g_warning ("Couldn't update the XKB root window property");
++
++ g_free (rules_file);
++}
++
++static gchar *
++language_code_from_locale (const gchar *locale)
++{
++ if (!locale || !locale[0] || !locale[1])
++ return NULL;
++
++ if (!locale[2] || locale[2] == '_' || locale[2] == '.')
++ return g_strndup (locale, 2);
++
++ if (!locale[3] || locale[3] == '_' || locale[3] == '.')
++ return g_strndup (locale, 3);
++
++ return NULL;
++}
++
++static gchar *
++build_xkb_group_string (const gchar *user,
++ const gchar *locale,
++ const gchar *latin)
++{
++ gchar *string;
++ gsize length = 0;
++ guint commas = 2;
++
++ if (latin)
++ length += strlen (latin);
++ else
++ commas -= 1;
++
++ if (locale)
++ length += strlen (locale);
++ else
++ commas -= 1;
++
++ length += strlen (user) + commas + 1;
++
++ string = malloc (length);
++
++ if (locale && latin)
++ sprintf (string, "%s,%s,%s", user, locale, latin);
++ else if (locale)
++ sprintf (string, "%s,%s", user, locale);
++ else if (latin)
++ sprintf (string, "%s,%s", user, latin);
++ else
++ sprintf (string, "%s", user);
++
++ return string;
++}
++
++static gboolean
++layout_equal (const gchar *layout_a,
++ const gchar *variant_a,
++ const gchar *layout_b,
++ const gchar *variant_b)
++{
++ return !g_strcmp0 (layout_a, layout_b) && !g_strcmp0 (variant_a, variant_b);
+ }
+
+ static void
+-apply_settings (GSettings *settings,
+- const char *key,
+- CsdKeyboardManager *manager)
++replace_layout_and_variant (CsdKeyboardManager *manager,
++ XkbRF_VarDefsRec *xkb_var_defs,
++ const gchar *layout,
++ const gchar *variant)
+ {
++ /* Toolkits need to know about both a latin layout to handle
++ * accelerators which are usually defined like Ctrl+C and a
++ * layout with the symbols for the language used in UI strings
++ * to handle mnemonics like Alt+Ф, so we try to find and add
++ * them in XKB group slots after the layout which the user
++ * actually intends to type with. */
++ const gchar *latin_layout = "us";
++ const gchar *latin_variant = "";
++ const gchar *locale_layout = NULL;
++ const gchar *locale_variant = NULL;
++ const gchar *locale;
++ gchar *language;
++
++ if (!layout)
++ return;
++
++ if (!variant)
++ variant = "";
++
++ locale = setlocale (LC_MESSAGES, NULL);
++ /* If LANG is empty, default to en_US */
++ if (!locale)
++ language = g_strdup (DEFAULT_LANGUAGE);
++ else
++ language = language_code_from_locale (locale);
++
++ if (!language)
++ language = language_code_from_locale (DEFAULT_LANGUAGE);
++
++ gnome_xkb_info_get_layout_info_for_language (manager->priv->xkb_info,
++ language,
++ NULL,
++ NULL,
++ NULL,
++ &locale_layout,
++ &locale_variant);
++ g_free (language);
++
++ /* We want to minimize the number of XKB groups if we have
++ * duplicated layout+variant pairs.
++ *
++ * Also, if a layout doesn't have a variant we still have to
++ * include it in the variants string because the number of
++ * variants must agree with the number of layouts. For
++ * instance:
++ *
++ * layouts: "us,ru,us"
++ * variants: "dvorak,,"
++ */
++ if (layout_equal (latin_layout, latin_variant, locale_layout, locale_variant) ||
++ layout_equal (latin_layout, latin_variant, layout, variant)) {
++ latin_layout = NULL;
++ latin_variant = NULL;
++ }
++
++ if (layout_equal (locale_layout, locale_variant, layout, variant)) {
++ locale_layout = NULL;
++ locale_variant = NULL;
++ }
++
++ free (xkb_var_defs->layout);
++ xkb_var_defs->layout = build_xkb_group_string (layout, locale_layout, latin_layout);
++
++ free (xkb_var_defs->variant);
++ xkb_var_defs->variant = build_xkb_group_string (variant, locale_variant, latin_variant);
++}
++
++static gchar *
++build_xkb_options_string (gchar **options)
++{
++ gchar *string;
++
++ if (*options) {
++ gint i;
++ gsize len;
++ gchar *ptr;
++
++ /* First part, getting length */
++ len = 1 + strlen (options[0]);
++ for (i = 1; options[i] != NULL; i++)
++ len += strlen (options[i]);
++ len += (i - 1); /* commas */
++
++ /* Second part, building string */
++ string = malloc (len);
++ ptr = g_stpcpy (string, *options);
++ for (i = 1; options[i] != NULL; i++) {
++ ptr = g_stpcpy (ptr, ",");
++ ptr = g_stpcpy (ptr, options[i]);
++ }
++ } else {
++ string = malloc (1);
++ *string = '\0';
++ }
++
++ return string;
++}
++
++static gchar **
++append_options (gchar **a,
++ gchar **b)
++{
++ gchar **c, **p;
++
++ if (!a && !b)
++ return NULL;
++ else if (!a)
++ return g_strdupv (b);
++ else if (!b)
++ return g_strdupv (a);
++
++ c = g_new0 (gchar *, g_strv_length (a) + g_strv_length (b) + 1);
++ p = c;
++
++ while (*a) {
++ *p = g_strdup (*a);
++ p += 1;
++ a += 1;
++ }
++ while (*b) {
++ *p = g_strdup (*b);
++ p += 1;
++ b += 1;
++ }
++
++ return c;
++}
++
++static void
++add_xkb_options (CsdKeyboardManager *manager,
++ XkbRF_VarDefsRec *xkb_var_defs,
++ gchar **extra_options)
++{
++ gchar **options;
++ gchar **settings_options;
++
++ settings_options = g_settings_get_strv (manager->priv->input_sources_settings,
++ KEY_KEYBOARD_OPTIONS);
++ options = append_options (settings_options, extra_options);
++ g_strfreev (settings_options);
++
++ free (xkb_var_defs->options);
++ xkb_var_defs->options = build_xkb_options_string (options);
++
++ g_strfreev (options);
++}
++
++static void
++apply_xkb_settings (CsdKeyboardManager *manager,
++ const gchar *layout,
++ const gchar *variant,
++ gchar **options)
++{
++ XkbRF_RulesRec *xkb_rules;
++ XkbRF_VarDefsRec *xkb_var_defs;
++ gchar *rules_file_path;
++
++ gnome_xkb_info_get_var_defs (&rules_file_path, &xkb_var_defs);
++
++ add_xkb_options (manager, xkb_var_defs, options);
++ replace_layout_and_variant (manager, xkb_var_defs, layout, variant);
++
++ gdk_error_trap_push ();
++
++ xkb_rules = XkbRF_Load (rules_file_path, NULL, True, True);
++ if (xkb_rules) {
++ XkbComponentNamesRec *xkb_comp_names;
++ xkb_comp_names = g_new0 (XkbComponentNamesRec, 1);
++
++ XkbRF_GetComponents (xkb_rules, xkb_var_defs, xkb_comp_names);
++ upload_xkb_description (rules_file_path, xkb_var_defs, xkb_comp_names);
++
++ free_xkb_component_names (xkb_comp_names);
++ XkbRF_Free (xkb_rules, True);
++ } else {
++ g_warning ("Couldn't load XKB rules");
++ }
++
++ if (gdk_error_trap_pop ())
++ g_warning ("Error loading XKB rules");
++
++ gnome_xkb_info_free_var_defs (xkb_var_defs);
++ g_free (rules_file_path);
++}
++
++static void
++set_gtk_im_module (CsdKeyboardManager *manager,
++ const gchar *new_module)
++{
++ CsdKeyboardManagerPrivate *priv = manager->priv;
++ gchar *current_module;
++
++ current_module = g_settings_get_string (priv->interface_settings,
++ KEY_GTK_IM_MODULE);
++ if (!g_str_equal (current_module, new_module))
++ g_settings_set_string (priv->interface_settings,
++ KEY_GTK_IM_MODULE,
++ new_module);
++ g_free (current_module);
++}
++
++static gboolean
++apply_input_sources_settings (GSettings *settings,
++ gpointer keys,
++ gint n_keys,
++ CsdKeyboardManager *manager)
++{
++ CsdKeyboardManagerPrivate *priv = manager->priv;
++ GVariant *sources;
++ guint current;
++ guint n_sources;
++ const gchar *type = NULL;
++ const gchar *id = NULL;
++ gchar *layout = NULL;
++ gchar *variant = NULL;
++ gchar **options = NULL;
++
++ sources = g_settings_get_value (priv->input_sources_settings, KEY_INPUT_SOURCES);
++ current = g_settings_get_uint (priv->input_sources_settings, KEY_CURRENT_INPUT_SOURCE);
++ n_sources = g_variant_n_children (sources);
++
++ if (n_sources < 1)
++ goto exit;
++
++ if (current >= n_sources) {
++ g_settings_set_uint (priv->input_sources_settings,
++ KEY_CURRENT_INPUT_SOURCE,
++ n_sources - 1);
++ goto exit;
++ }
++
++#ifdef HAVE_IBUS
++ maybe_start_ibus (manager, sources);
++#endif
++
++ g_variant_get_child (sources, current, "(&s&s)", &type, &id);
++
++ if (g_str_equal (type, INPUT_SOURCE_TYPE_XKB)) {
++ const gchar *l, *v;
++ gnome_xkb_info_get_layout_info (priv->xkb_info, id, NULL, NULL, &l, &v);
++
++ layout = g_strdup (l);
++ variant = g_strdup (v);
++
++ if (!layout || !layout[0]) {
++ g_warning ("Couldn't find XKB input source '%s'", id);
++ goto exit;
++ }
++ set_gtk_im_module (manager, GTK_IM_MODULE_SIMPLE);
++#ifdef HAVE_IBUS
++ set_ibus_xkb_engine (manager, id);
++#endif
++ } else if (g_str_equal (type, INPUT_SOURCE_TYPE_IBUS)) {
++#ifdef HAVE_IBUS
++ IBusEngineDesc *engine_desc = NULL;
++
++ if (priv->session_is_fallback)
++ goto exit;
++
++ if (priv->ibus_engines)
++ engine_desc = g_hash_table_lookup (priv->ibus_engines, id);
++ else
++ goto exit; /* we'll be called again when ibus is up and running */
++
++ if (engine_desc) {
++ const gchar *ibus_layout;
++ ibus_layout = ibus_engine_desc_get_layout (engine_desc);
++
++ if (ibus_layout) {
++ layout = layout_from_ibus_layout (ibus_layout);
++ variant = variant_from_ibus_layout (ibus_layout);
++ options = options_from_ibus_layout (ibus_layout);
++ }
++ } else {
++ g_warning ("Couldn't find IBus input source '%s'", id);
++ goto exit;
++ }
++
++ set_gtk_im_module (manager, GTK_IM_MODULE_IBUS);
++ set_ibus_engine (manager, id);
++#else
++ g_warning ("IBus input source type specified but IBus support was not compiled");
++#endif
++ } else {
++ g_warning ("Unknown input source type '%s'", type);
++ }
++
++ exit:
++ apply_xkb_settings (manager, layout, variant, options);
++ g_variant_unref (sources);
++ g_free (layout);
++ g_free (variant);
++ g_strfreev (options);
++ /* Prevent individual "changed" signal invocations since we
++ don't need them. */
++ return TRUE;
++}
++
++static void
++apply_bell (CsdKeyboardManager *manager)
++{
++ GSettings *settings;
+ XKeyboardControl kbdcontrol;
+- gboolean repeat;
+ gboolean click;
+- guint interval;
+- guint delay;
+- int click_volume;
+ int bell_volume;
+ int bell_pitch;
+ int bell_duration;
+ CsdBellMode bell_mode;
+- gboolean rnumlock;
+-
+- if (g_strcmp0 (key, KEY_NUMLOCK_STATE) == 0)
+- return;
++ int click_volume;
+
+- repeat = g_settings_get_boolean (settings, KEY_REPEAT);
++ g_debug ("Applying the bell settings");
++ settings = manager->priv->settings;
+ click = g_settings_get_boolean (settings, KEY_CLICK);
+- interval = _csd_settings_get_uint (settings, KEY_INTERVAL);
+- delay = _csd_settings_get_uint (settings, KEY_DELAY);
+ click_volume = g_settings_get_int (settings, KEY_CLICK_VOLUME);
++
+ bell_pitch = g_settings_get_int (settings, KEY_BELL_PITCH);
+ bell_duration = g_settings_get_int (settings, KEY_BELL_DURATION);
+
+ bell_mode = g_settings_get_enum (settings, KEY_BELL_MODE);
+ bell_volume = (bell_mode == CSD_BELL_MODE_ON) ? 50 : 0;
+
++ /* as percentage from 0..100 inclusive */
++ if (click_volume < 0) {
++ click_volume = 0;
++ } else if (click_volume > 100) {
++ click_volume = 100;
++ }
++ kbdcontrol.key_click_percent = click ? click_volume : 0;
++ kbdcontrol.bell_percent = bell_volume;
++ kbdcontrol.bell_pitch = bell_pitch;
++ kbdcontrol.bell_duration = bell_duration;
++
++ gdk_error_trap_push ();
++ XChangeKeyboardControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
++ KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration,
++ &kbdcontrol);
++
++ XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE);
++ gdk_error_trap_pop_ignored ();
++}
++
++static void
++apply_numlock (CsdKeyboardManager *manager)
++{
++ GSettings *settings;
++ gboolean rnumlock;
++
++ g_debug ("Applying the num-lock settings");
++ settings = manager->priv->settings;
++ rnumlock = g_settings_get_boolean (settings, KEY_REMEMBER_NUMLOCK_STATE);
++ manager->priv->old_state = g_settings_get_enum (manager->priv->settings, KEY_NUMLOCK_STATE);
++
++ gdk_error_trap_push ();
++ if (rnumlock) {
++ g_debug ("Remember num-lock is set, so applying setting '%s'",
++ num_lock_state_to_string (manager->priv->old_state));
++ numlock_set_xkb_state (manager->priv->old_state);
++ }
++
++ XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE);
++ gdk_error_trap_pop_ignored ();
++}
++
++static void
++apply_repeat (CsdKeyboardManager *manager)
++{
++ GSettings *settings;
++ gboolean repeat;
++ guint interval;
++ guint delay;
++
++ g_debug ("Applying the repeat settings");
++ settings = manager->priv->settings;
++ repeat = g_settings_get_boolean (settings, KEY_REPEAT);
++ interval = g_settings_get_uint (settings, KEY_INTERVAL);
++ delay = g_settings_get_uint (settings, KEY_DELAY);
++
+ gdk_error_trap_push ();
+ if (repeat) {
+ gboolean rate_set = FALSE;
+@@ -243,124 +1249,319 @@ apply_settings (GSettings *sett
+ XAutoRepeatOff (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+ }
+
+- /* as percentage from 0..100 inclusive */
+- if (click_volume < 0) {
+- click_volume = 0;
+- } else if (click_volume > 100) {
+- click_volume = 100;
++ XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE);
++ gdk_error_trap_pop_ignored ();
++}
++
++static void
++apply_all_settings (CsdKeyboardManager *manager)
++{
++ apply_repeat (manager);
++ apply_bell (manager);
++ apply_numlock (manager);
++}
++
++static void
++set_input_sources_switcher (CsdKeyboardManager *manager,
++ gboolean state)
++{
++ if (state) {
++ GError *error = NULL;
++ char *args[2];
++
++ if (manager->priv->input_sources_switcher_spawned)
++ set_input_sources_switcher (manager, FALSE);
++
++ args[0] = LIBEXECDIR "/csd-input-sources-switcher";
++ args[1] = NULL;
++
++ g_spawn_async (NULL, args, NULL,
++ 0, NULL, NULL,
++ &manager->priv->input_sources_switcher_pid, &error);
++
++ manager->priv->input_sources_switcher_spawned = (error == NULL);
++
++ if (error) {
++ g_warning ("Couldn't spawn %s: %s", args[0], error->message);
++ g_error_free (error);
++ }
++ } else if (manager->priv->input_sources_switcher_spawned) {
++ kill (manager->priv->input_sources_switcher_pid, SIGHUP);
++ g_spawn_close_pid (manager->priv->input_sources_switcher_pid);
++ manager->priv->input_sources_switcher_spawned = FALSE;
+ }
+- kbdcontrol.key_click_percent = click ? click_volume : 0;
+- kbdcontrol.bell_percent = bell_volume;
+- kbdcontrol.bell_pitch = bell_pitch;
+- kbdcontrol.bell_duration = bell_duration;
+- XChangeKeyboardControl (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+- KBKeyClickPercent | KBBellPercent | KBBellPitch | KBBellDuration,
+- &kbdcontrol);
++}
+
+- if (g_strcmp0 (key, "remember-numlock-state") == 0 || key == NULL) {
+- rnumlock = g_settings_get_boolean (settings, "remember-numlock-state");
++static gboolean
++enable_switcher (CsdKeyboardManager *manager)
++{
++ CsdInputSourcesSwitcher switcher;
+
+- manager->priv->old_state = g_settings_get_enum (manager->priv->settings, KEY_NUMLOCK_STATE);
++ switcher = g_settings_get_enum (manager->priv->settings, KEY_SWITCHER);
+
+- if (manager->priv->have_xkb && rnumlock)
+- numlock_set_xkb_state (manager->priv->old_state);
++ return switcher != CSD_INPUT_SOURCES_SWITCHER_OFF;
++}
++
++static void
++settings_changed (GSettings *settings,
++ const char *key,
++ CsdKeyboardManager *manager)
++{
++ if (g_strcmp0 (key, KEY_CLICK) == 0||
++ g_strcmp0 (key, KEY_CLICK_VOLUME) == 0 ||
++ g_strcmp0 (key, KEY_BELL_PITCH) == 0 ||
++ g_strcmp0 (key, KEY_BELL_DURATION) == 0 ||
++ g_strcmp0 (key, KEY_BELL_MODE) == 0) {
++ g_debug ("Bell setting '%s' changed, applying bell settings", key);
++ apply_bell (manager);
++ } else if (g_strcmp0 (key, KEY_REMEMBER_NUMLOCK_STATE) == 0) {
++ g_debug ("Remember Num-Lock state '%s' changed, applying num-lock settings", key);
++ apply_numlock (manager);
++ } else if (g_strcmp0 (key, KEY_NUMLOCK_STATE) == 0) {
++ g_debug ("Num-Lock state '%s' changed, will apply at next startup", key);
++ } else if (g_strcmp0 (key, KEY_REPEAT) == 0 ||
++ g_strcmp0 (key, KEY_INTERVAL) == 0 ||
++ g_strcmp0 (key, KEY_DELAY) == 0) {
++ g_debug ("Key repeat setting '%s' changed, applying key repeat settings", key);
++ apply_repeat (manager);
++ } else if (g_strcmp0 (key, KEY_SWITCHER) == 0) {
++ set_input_sources_switcher (manager, enable_switcher (manager));
++ } else {
++ g_warning ("Unhandled settings change, key '%s'", key);
+ }
+
+- XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE);
+- gdk_error_trap_pop_ignored ();
+ }
+
+-void
+-csd_keyboard_manager_apply_settings (CsdKeyboardManager *manager)
++static void
++device_added_cb (GdkDeviceManager *device_manager,
++ GdkDevice *device,
++ CsdKeyboardManager *manager)
+ {
+- apply_settings (manager->priv->settings, NULL, manager);
++ GdkInputSource source;
++
++ source = gdk_device_get_source (device);
++ if (source == GDK_SOURCE_KEYBOARD) {
++ g_debug ("New keyboard plugged in, applying all settings");
++ apply_all_settings (manager);
++ apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager);
++ run_custom_command (device, COMMAND_DEVICE_ADDED);
++ }
+ }
+
+ static void
+-apply_libgnomekbd_settings (GSettings *settings,
+- const char *key,
+- CsdKeyboardManager *manager)
++device_removed_cb (GdkDeviceManager *device_manager,
++ GdkDevice *device,
++ CsdKeyboardManager *manager)
+ {
+- gchar **layouts;
++ GdkInputSource source;
+
+- layouts = g_settings_get_strv (settings, LIBGNOMEKBD_KEY_LAYOUTS);
++ source = gdk_device_get_source (device);
++ if (source == GDK_SOURCE_KEYBOARD) {
++ run_custom_command (device, COMMAND_DEVICE_REMOVED);
++ }
++}
+
+- /* Get accounts daemon */
+- GDBusProxy *proxy = NULL;
+- GDBusProxy *user = NULL;
+- GVariant *variant = NULL;
+- GError *error = NULL;
+- gchar *object_path = NULL;
++static void
++set_devicepresence_handler (CsdKeyboardManager *manager)
++{
++ GdkDeviceManager *device_manager;
+
+- proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+- G_DBUS_PROXY_FLAGS_NONE,
+- NULL,
+- "org.freedesktop.Accounts",
+- "/org/freedesktop/Accounts",
+- "org.freedesktop.Accounts",
+- NULL,
+- &error);
++ device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
+
+- if (proxy == NULL) {
+- g_warning ("Failed to contact accounts service: %s", error->message);
+- g_error_free (error);
+- goto bail;
++ manager->priv->device_added_id = g_signal_connect (G_OBJECT (device_manager), "device-added",
++ G_CALLBACK (device_added_cb), manager);
++ manager->priv->device_removed_id = g_signal_connect (G_OBJECT (device_manager), "device-removed",
++ G_CALLBACK (device_removed_cb), manager);
++ manager->priv->device_manager = device_manager;
++}
++
++static void
++create_sources_from_current_xkb_config (GSettings *settings)
++{
++ GVariantBuilder builder;
++ XkbRF_VarDefsRec *xkb_var_defs;
++ gchar *tmp;
++ gchar **layouts = NULL;
++ gchar **variants = NULL;
++ guint i, n;
++
++ gnome_xkb_info_get_var_defs (&tmp, &xkb_var_defs);
++ g_free (tmp);
++
++ if (xkb_var_defs->layout)
++ layouts = g_strsplit (xkb_var_defs->layout, ",", 0);
++ if (xkb_var_defs->variant)
++ variants = g_strsplit (xkb_var_defs->variant, ",", 0);
++
++ gnome_xkb_info_free_var_defs (xkb_var_defs);
++
++ if (!layouts)
++ goto out;
++
++ if (variants && variants[0])
++ n = MIN (g_strv_length (layouts), g_strv_length (variants));
++ else
++ n = g_strv_length (layouts);
++
++ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)"));
++ for (i = 0; i < n && layouts[i][0]; ++i) {
++ if (variants && variants[i] && variants[i][0])
++ tmp = g_strdup_printf ("%s+%s", layouts[i], variants[i]);
++ else
++ tmp = g_strdup (layouts[i]);
++
++ g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, tmp);
++ g_free (tmp);
+ }
++ g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
++out:
++ g_strfreev (layouts);
++ g_strfreev (variants);
++}
+
+- variant = g_dbus_proxy_call_sync (proxy,
+- "FindUserByName",
+- g_variant_new ("(s)", g_get_user_name ()),
+- G_DBUS_CALL_FLAGS_NONE,
+- -1,
+- NULL,
+- &error);
++static void
++convert_libgnomekbd_options (GSettings *settings)
++{
++ GPtrArray *opt_array;
++ GSettings *libgnomekbd_settings;
++ gchar **options, **o;
+
+- if (variant == NULL) {
+- g_warning ("Could not contact accounts service to look up '%s': %s",
+- g_get_user_name (), error->message);
+- g_error_free (error);
+- goto bail;
++ if (!schema_is_installed ("org.gnome.libgnomekbd.keyboard"))
++ return;
++
++ opt_array = g_ptr_array_new_with_free_func (g_free);
++
++ libgnomekbd_settings = g_settings_new ("org.gnome.libgnomekbd.keyboard");
++ options = g_settings_get_strv (libgnomekbd_settings, "options");
++
++ for (o = options; *o; ++o) {
++ gchar **strv;
++
++ strv = g_strsplit (*o, "\t", 2);
++ if (strv[0] && strv[1]) {
++ /* We don't want the group switcher because
++ * it's incompatible with the way we use XKB
++ * groups. */
++ if (!g_str_has_prefix (strv[1], "grp:"))
++ g_ptr_array_add (opt_array, g_strdup (strv[1]));
++ }
++ g_strfreev (strv);
+ }
++ g_ptr_array_add (opt_array, NULL);
+
+- g_variant_get (variant, "(o)", &object_path);
+- user = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+- G_DBUS_PROXY_FLAGS_NONE,
+- NULL,
+- "org.freedesktop.Accounts",
+- object_path,
+- "org.freedesktop.Accounts.User",
+- NULL,
+- &error);
+- g_free (object_path);
++ g_settings_set_strv (settings, KEY_KEYBOARD_OPTIONS, (const gchar * const*) opt_array->pdata);
+
+- if (user == NULL) {
+- g_warning ("Could not create proxy for user '%s': %s",
+- g_variant_get_string (variant, NULL), error->message);
+- g_error_free (error);
+- goto bail;
++ g_strfreev (options);
++ g_object_unref (libgnomekbd_settings);
++ g_ptr_array_free (opt_array, TRUE);
++}
++
++static void
++convert_libgnomekbd_layouts (GSettings *settings)
++{
++ GVariantBuilder builder;
++ GSettings *libgnomekbd_settings;
++ gchar **layouts, **l;
++
++ if (!schema_is_installed ("org.gnome.libgnomekbd.keyboard"))
++ return;
++
++ init_builder_with_sources (&builder, settings);
++
++ libgnomekbd_settings = g_settings_new ("org.gnome.libgnomekbd.keyboard");
++ layouts = g_settings_get_strv (libgnomekbd_settings, "layouts");
++
++ for (l = layouts; *l; ++l) {
++ gchar *id;
++ gchar **strv;
++
++ strv = g_strsplit (*l, "\t", 2);
++ if (strv[0] && !strv[1])
++ id = g_strdup (strv[0]);
++ else if (strv[0] && strv[1])
++ id = g_strdup_printf ("%s+%s", strv[0], strv[1]);
++ else
++ id = NULL;
++
++ if (id)
++ g_variant_builder_add (&builder, "(ss)", INPUT_SOURCE_TYPE_XKB, id);
++
++ g_free (id);
++ g_strfreev (strv);
+ }
+- g_variant_unref (variant);
+
+- variant = g_dbus_proxy_call_sync (user,
+- "SetXKeyboardLayouts",
+- g_variant_new ("(^as)", layouts),
+- G_DBUS_CALL_FLAGS_NONE,
+- -1,
+- NULL,
+- &error);
++ g_settings_set_value (settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder));
++
++ g_strfreev (layouts);
++ g_object_unref (libgnomekbd_settings);
++}
+
+- if (variant == NULL) {
+- g_warning ("Failed to set the keyboard layouts: %s", error->message);
++static void
++maybe_convert_old_settings (GSettings *settings)
++{
++ GVariant *sources;
++ gchar **options;
++ gchar *stamp_dir_path = NULL;
++ gchar *stamp_file_path = NULL;
++ GError *error = NULL;
++
++ stamp_dir_path = g_build_filename (g_get_user_data_dir (), PACKAGE_NAME, NULL);
++ if (g_mkdir_with_parents (stamp_dir_path, 0755)) {
++ g_warning ("Failed to create directory %s: %s", stamp_dir_path, g_strerror (errno));
++ goto out;
++ }
++
++ stamp_file_path = g_build_filename (stamp_dir_path, "input-sources-converted", NULL);
++ if (g_file_test (stamp_file_path, G_FILE_TEST_EXISTS))
++ goto out;
++
++ sources = g_settings_get_value (settings, KEY_INPUT_SOURCES);
++ if (g_variant_n_children (sources) < 1) {
++ convert_libgnomekbd_layouts (settings);
++#ifdef HAVE_IBUS
++ convert_ibus (settings);
++#endif
++ }
++ g_variant_unref (sources);
++
++ options = g_settings_get_strv (settings, KEY_KEYBOARD_OPTIONS);
++ if (g_strv_length (options) < 1)
++ convert_libgnomekbd_options (settings);
++ g_strfreev (options);
++
++ if (!g_file_set_contents (stamp_file_path, "", 0, &error)) {
++ g_warning ("%s", error->message);
+ g_error_free (error);
+- goto bail;
+ }
++out:
++ g_free (stamp_file_path);
++ g_free (stamp_dir_path);
++}
+
+-bail:
+- if (proxy != NULL)
+- g_object_unref (proxy);
+- if (variant != NULL)
+- g_variant_unref (variant);
+- g_strfreev (layouts);
++static void
++maybe_create_input_sources (CsdKeyboardManager *manager)
++{
++ GSettings *settings;
++ GVariant *sources;
++
++ settings = manager->priv->input_sources_settings;
++
++ if (g_getenv ("RUNNING_UNDER_GDM")) {
++ create_sources_from_current_xkb_config (settings);
++ return;
++ }
++
++ maybe_convert_old_settings (settings);
++
++ /* if we still don't have anything do some educated guesses */
++ sources = g_settings_get_value (settings, KEY_INPUT_SOURCES);
++ if (g_variant_n_children (sources) < 1) {
++ create_sources_from_current_xkb_config (settings);
++#ifdef HAVE_IBUS
++ add_ibus_sources_from_locale (settings);
++#endif
++ }
++ g_variant_unref (sources);
+ }
+
+ static gboolean
+@@ -370,26 +1571,41 @@ start_keyboard_idle_cb (CsdKeyboardManag
+
+ g_debug ("Starting keyboard manager");
+
+- manager->priv->have_xkb = 0;
+ manager->priv->settings = g_settings_new (CSD_KEYBOARD_DIR);
+- manager->priv->libgnomekbd_settings = g_settings_new (LIBGNOMEKBD_KEYBOARD_DIR);
+
+- /* Essential - xkb initialization should happen before */
+- csd_keyboard_xkb_init (manager);
++ xkb_init (manager);
+
+- numlock_xkb_init (manager);
++ set_devicepresence_handler (manager);
+
++ manager->priv->input_sources_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR);
++ manager->priv->interface_settings = g_settings_new (GNOME_DESKTOP_INTERFACE_DIR);
++ manager->priv->xkb_info = gnome_xkb_info_new ();
++
++ maybe_create_input_sources (manager);
++
++#ifdef HAVE_IBUS
++ /* We don't want to touch IBus until we are sure this isn't a
++ fallback session. */
++ manager->priv->session_is_fallback = TRUE;
++ manager->priv->ibus_cancellable = g_cancellable_new ();
++ g_bus_get (G_BUS_TYPE_SESSION,
++ manager->priv->ibus_cancellable,
++ (GAsyncReadyCallback)got_bus,
++ manager);
++#else
++ apply_input_sources_settings (manager->priv->input_sources_settings, NULL, 0, manager);
++#endif
+ /* apply current settings before we install the callback */
+- csd_keyboard_manager_apply_settings (manager);
++ g_debug ("Started the keyboard plugin, applying all settings");
++ apply_all_settings (manager);
+
+ g_signal_connect (G_OBJECT (manager->priv->settings), "changed",
+- G_CALLBACK (apply_settings), manager);
+-
+- apply_libgnomekbd_settings (manager->priv->libgnomekbd_settings, NULL, manager);
+- g_signal_connect (G_OBJECT (manager->priv->libgnomekbd_settings), "changed",
+- G_CALLBACK (apply_libgnomekbd_settings), manager);
++ G_CALLBACK (settings_changed), manager);
++ g_signal_connect (G_OBJECT (manager->priv->input_sources_settings), "change-event",
++ G_CALLBACK (apply_input_sources_settings), manager);
+
+- numlock_install_xkb_callback (manager);
++ install_xkb_filter (manager);
++ set_input_sources_switcher (manager, enable_switcher (manager));
+
+ cinnamon_settings_profile_end (NULL);
+
+@@ -404,6 +1620,11 @@ csd_keyboard_manager_start (CsdKeyboardM
+ {
+ cinnamon_settings_profile_start (NULL);
+
++ if (check_xkb_extension (manager) == FALSE) {
++ g_debug ("XKB is not supported, not applying any settings");
++ return TRUE;
++ }
++
+ manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_keyboard_idle_cb, manager);
+
+ cinnamon_settings_profile_end (NULL);
+@@ -418,37 +1639,24 @@ csd_keyboard_manager_stop (CsdKeyboardMa
+
+ g_debug ("Stopping keyboard manager");
+
+- if (p->settings != NULL) {
+- g_object_unref (p->settings);
+- p->settings = NULL;
+- }
++ g_clear_object (&p->settings);
++ g_clear_object (&p->input_sources_settings);
++ g_clear_object (&p->interface_settings);
++ g_clear_object (&p->xkb_info);
+
+- if (p->libgnomekbd_settings != NULL) {
+- g_object_unref (p->libgnomekbd_settings);
+- p->libgnomekbd_settings = NULL;
+- }
++#ifdef HAVE_IBUS
++ clear_ibus (manager);
++#endif
+
+- if (p->have_xkb) {
+- gdk_window_remove_filter (NULL,
+- numlock_xkb_callback,
+- manager);
++ if (p->device_manager != NULL) {
++ g_signal_handler_disconnect (p->device_manager, p->device_added_id);
++ g_signal_handler_disconnect (p->device_manager, p->device_removed_id);
++ p->device_manager = NULL;
+ }
+
+- csd_keyboard_xkb_shutdown ();
+-}
+-
+-static GObject *
+-csd_keyboard_manager_constructor (GType type,
+- guint n_construct_properties,
+- GObjectConstructParam *construct_properties)
+-{
+- CsdKeyboardManager *keyboard_manager;
+-
+- keyboard_manager = CSD_KEYBOARD_MANAGER (G_OBJECT_CLASS (csd_keyboard_manager_parent_class)->constructor (type,
+- n_construct_properties,
+- construct_properties));
++ remove_xkb_filter (manager);
+
+- return G_OBJECT (keyboard_manager);
++ set_input_sources_switcher (manager, FALSE);
+ }
+
+ static void
+@@ -456,7 +1664,6 @@ csd_keyboard_manager_class_init (CsdKeyb
+ {
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+- object_class->constructor = csd_keyboard_manager_constructor;
+ object_class->finalize = csd_keyboard_manager_finalize;
+
+ g_type_class_add_private (klass, sizeof (CsdKeyboardManagerPrivate));
+diff -uNrp a/plugins/keyboard/csd-keyboard-manager.h b/plugins/keyboard/csd-keyboard-manager.h
+--- a/plugins/keyboard/csd-keyboard-manager.h 2013-08-24 18:04:31.000000000 +0100
++++ b/plugins/keyboard/csd-keyboard-manager.h 2013-08-25 16:36:02.000000000 +0100
+@@ -51,7 +51,6 @@ CsdKeyboardManager * csd_keyboard_
+ gboolean csd_keyboard_manager_start (CsdKeyboardManager *manager,
+ GError **error);
+ void csd_keyboard_manager_stop (CsdKeyboardManager *manager);
+-void csd_keyboard_manager_apply_settings (CsdKeyboardManager *manager);
+
+ G_END_DECLS
+
+diff -uNrp a/plugins/keyboard/csd-keyboard-plugin.h b/plugins/keyboard/csd-keyboard-plugin.h
+--- a/plugins/keyboard/csd-keyboard-plugin.h 2013-08-24 18:04:31.000000000 +0100
++++ b/plugins/keyboard/csd-keyboard-plugin.h 2013-08-25 16:36:02.000000000 +0100
+@@ -52,7 +52,7 @@ typedef struct
+ GType csd_keyboard_plugin_get_type (void) G_GNUC_CONST;
+
+ /* All the plugins must implement this function */
+-G_MODULE_EXPORT GType register_cinnamon_settings_plugin (GTypeModule *module);
++G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module);
+
+ G_END_DECLS
+
+diff -uNrp a/plugins/keyboard/csd-keyboard-xkb.c b/plugins/keyboard/csd-keyboard-xkb.c
+--- a/plugins/keyboard/csd-keyboard-xkb.c 2013-08-24 18:04:31.000000000 +0100
++++ b/plugins/keyboard/csd-keyboard-xkb.c 1970-01-01 01:00:00.000000000 +0100
+@@ -1,579 +0,0 @@
+-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+- *
+- * Copyright (C) 2001 Udaltsoft
+- *
+- * Written by Sergey V. Oudaltsov
+- *
+- * This program is free software; you can redistribute it and/or modify
+- * it under the terms of the GNU General Public License as published by
+- * the Free Software Foundation; either version 2, or (at your option)
+- * any later version.
+- *
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU General Public License for more details.
+- *
+- * You should have received a copy of the GNU General Public License
+- * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 51 Franklin Street - Suite 500, Boston, MA
+- * 02110-1335, USA.
+- */
+-
+-#include "config.h"
+-
+-#include
+-#include
+-
+-#include
+-#include
+-#include
+-#include
+-
+-#include
+-
+-#include
+-#include
+-#include
+-#include
+-#include
+-
+-#include "csd-keyboard-xkb.h"
+-#include "delayed-dialog.h"
+-#include "cinnamon-settings-profile.h"
+-
+-#define SETTINGS_KEYBOARD_DIR "org.cinnamon.settings-daemon.plugins.keyboard"
+-
+-static CsdKeyboardManager *manager = NULL;
+-
+-static XklEngine *xkl_engine;
+-static XklConfigRegistry *xkl_registry = NULL;
+-
+-static GkbdDesktopConfig current_config;
+-static GkbdKeyboardConfig current_kbd_config;
+-
+-/* never terminated */
+-static GkbdKeyboardConfig initial_sys_kbd_config;
+-
+-static gboolean inited_ok = FALSE;
+-
+-static GSettings *settings_desktop = NULL;
+-static GSettings *settings_keyboard = NULL;
+-
+-static PostActivationCallback pa_callback = NULL;
+-static void *pa_callback_user_data = NULL;
+-
+-static GtkStatusIcon *icon = NULL;
+-
+-static GHashTable *preview_dialogs = NULL;
+-
+-static void
+-activation_error (void)
+-{
+- char const *vendor;
+- GtkWidget *dialog;
+-
+- vendor =
+- ServerVendor (GDK_DISPLAY_XDISPLAY
+- (gdk_display_get_default ()));
+-
+- /* VNC viewers will not work, do not barrage them with warnings */
+- if (NULL != vendor && NULL != strstr (vendor, "VNC"))
+- return;
+-
+- dialog = gtk_message_dialog_new_with_markup (NULL,
+- 0,
+- GTK_MESSAGE_ERROR,
+- GTK_BUTTONS_CLOSE,
+- _
+- ("Error activating XKB configuration.\n"
+- "There can be various reasons for that.\n\n"
+- "If you report this situation as a bug, include the results of\n"
+- " • %s\n"
+- " • %s\n"
+- " • %s\n"
+- " • %s"),
+- "xprop -root | grep XKB",
+- "gsettings get org.gnome.libgnomekbd.keyboard model",
+- "gsettings get org.gnome.libgnomekbd.keyboard layouts",
+- "gsettings get org.gnome.libgnomekbd.keyboard options");
+- g_signal_connect (dialog, "response",
+- G_CALLBACK (gtk_widget_destroy), NULL);
+- csd_delayed_show_dialog (dialog);
+-}
+-
+-static gboolean
+-ensure_xkl_registry (void)
+-{
+- if (!xkl_registry) {
+- xkl_registry =
+- xkl_config_registry_get_instance (xkl_engine);
+- /* load all materials, unconditionally! */
+- if (!xkl_config_registry_load (xkl_registry, TRUE)) {
+- g_object_unref (xkl_registry);
+- xkl_registry = NULL;
+- return FALSE;
+- }
+- }
+-
+- return TRUE;
+-}
+-
+-static void
+-apply_desktop_settings (void)
+-{
+- if (!inited_ok)
+- return;
+-
+- csd_keyboard_manager_apply_settings (manager);
+- gkbd_desktop_config_load (¤t_config);
+- /* again, probably it would be nice to compare things
+- before activating them */
+- gkbd_desktop_config_activate (¤t_config);
+-}
+-
+-static void
+-popup_menu_launch_capplet ()
+-{
+- GAppInfo *info;
+- GdkAppLaunchContext *ctx;
+- GError *error = NULL;
+-
+- info =
+- g_app_info_create_from_commandline
+- ("cinnamon-settings region", NULL, 0, &error);
+-
+- if (info != NULL) {
+- ctx =
+- gdk_display_get_app_launch_context
+- (gdk_display_get_default ());
+-
+- if (g_app_info_launch (info, NULL,
+- G_APP_LAUNCH_CONTEXT (ctx), &error) == FALSE) {
+- g_warning
+- ("Could not execute keyboard properties capplet: [%s]\n",
+- error->message);
+- g_error_free (error);
+- }
+-
+- g_object_unref (info);
+- g_object_unref (ctx);
+- }
+-
+-}
+-
+-static void
+-show_layout_destroy (GtkWidget * dialog, gint group)
+-{
+- g_hash_table_remove (preview_dialogs, GINT_TO_POINTER (group));
+-}
+-
+-static void
+-popup_menu_show_layout ()
+-{
+- GtkWidget *dialog;
+- XklEngine *engine =
+- xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY
+- (gdk_display_get_default ()));
+- XklState *xkl_state = xkl_engine_get_current_state (engine);
+-
+- gchar **group_names = gkbd_status_get_group_names ();
+-
+- gpointer p = g_hash_table_lookup (preview_dialogs,
+- GINT_TO_POINTER
+- (xkl_state->group));
+-
+- if (xkl_state->group < 0
+- || xkl_state->group >= g_strv_length (group_names)) {
+- return;
+- }
+-
+- if (p != NULL) {
+- /* existing window */
+- gtk_window_present (GTK_WINDOW (p));
+- return;
+- }
+-
+- if (!ensure_xkl_registry ())
+- return;
+-
+- dialog = gkbd_keyboard_drawing_dialog_new ();
+- gkbd_keyboard_drawing_dialog_set_group (dialog, xkl_registry, xkl_state->group);
+-
+- g_signal_connect (dialog, "destroy",
+- G_CALLBACK (show_layout_destroy),
+- GINT_TO_POINTER (xkl_state->group));
+- g_hash_table_insert (preview_dialogs,
+- GINT_TO_POINTER (xkl_state->group), dialog);
+- gtk_widget_show_all (dialog);
+-}
+-
+-static void
+-popup_menu_set_group (gint group_number, gboolean only_menu)
+-{
+-
+- XklEngine *engine = gkbd_status_get_xkl_engine ();
+-
+- XklState *st = xkl_engine_get_current_state(engine);
+- Window cur;
+- st->group = group_number;
+- xkl_engine_allow_one_switch_to_secondary_group (engine);
+- cur = xkl_engine_get_current_window (engine);
+- if (cur != (Window) NULL) {
+- xkl_debug (150, "Enforcing the state %d for window %lx\n",
+- st->group, cur);
+-
+- xkl_engine_save_state (engine,
+- xkl_engine_get_current_window
+- (engine), st);
+-/* XSetInputFocus( GDK_DISPLAY(), cur, RevertToNone, CurrentTime );*/
+- } else {
+- xkl_debug (150,
+- "??? Enforcing the state %d for unknown window\n",
+- st->group);
+- /* strange situation - bad things can happen */
+- }
+- if (!only_menu)
+- xkl_engine_lock_group (engine, st->group);
+-}
+-
+-static void
+-popup_menu_set_group_cb (GtkMenuItem * item, gpointer param)
+-{
+- gint group_number = GPOINTER_TO_INT (param);
+-
+- popup_menu_set_group(group_number, FALSE);
+-}
+-
+-
+-static GtkMenu *
+-create_status_menu (void)
+-{
+- GtkMenu *popup_menu = GTK_MENU (gtk_menu_new ());
+- int i = 0;
+-
+- GtkMenu *groups_menu = GTK_MENU (gtk_menu_new ());
+- gchar **current_name = gkbd_status_get_group_names ();
+-
+- GtkWidget *item = gtk_menu_item_new_with_mnemonic (_("_Layouts"));
+- gtk_widget_show (item);
+- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);
+- gtk_menu_item_set_submenu (GTK_MENU_ITEM (item),
+- GTK_WIDGET (groups_menu));
+-
+- item = gtk_menu_item_new_with_mnemonic (_("Show _Keyboard Layout..."));
+- gtk_widget_show (item);
+- g_signal_connect (item, "activate", popup_menu_show_layout, NULL);
+- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);
+-
+- /* translators note:
+- * This is the name of the cinnamon-settings "region" panel */
+- item = gtk_menu_item_new_with_mnemonic (_("Region and Language Settings"));
+- gtk_widget_show (item);
+- g_signal_connect (item, "activate", popup_menu_launch_capplet, NULL);
+- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), item);
+-
+- for (i = 0; current_name && *current_name; i++, current_name++) {
+-
+- gchar *image_file = gkbd_status_get_image_filename (i);
+-
+- if (image_file == NULL) {
+- item =
+- gtk_menu_item_new_with_label (*current_name);
+- } else {
+- GdkPixbuf *pixbuf =
+- gdk_pixbuf_new_from_file_at_size (image_file,
+- 24, 24,
+- NULL);
+- GtkWidget *img =
+- gtk_image_new_from_pixbuf (pixbuf);
+- item =
+- gtk_image_menu_item_new_with_label
+- (*current_name);
+- gtk_widget_show (img);
+- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM
+- (item), img);
+- gtk_image_menu_item_set_always_show_image
+- (GTK_IMAGE_MENU_ITEM (item), TRUE);
+- g_free (image_file);
+- }
+- gtk_widget_show (item);
+- gtk_menu_shell_append (GTK_MENU_SHELL (groups_menu), item);
+- g_signal_connect (item, "activate",
+- G_CALLBACK (popup_menu_set_group_cb),
+- GINT_TO_POINTER (i));
+- }
+-
+- return popup_menu;
+-}
+-
+-static void
+-status_icon_popup_menu_cb (GtkStatusIcon * icon, guint button, guint time)
+-{
+- GtkMenu *popup_menu = create_status_menu ();
+-
+- gtk_menu_popup (popup_menu, NULL, NULL,
+- gtk_status_icon_position_menu,
+- (gpointer) icon, button, time);
+-}
+-
+-static void
+-show_hide_icon ()
+-{
+- if (g_strv_length (current_kbd_config.layouts_variants) > 1) {
+- if (icon == NULL) {
+- xkl_debug (150, "Creating keyboard status icon\n");
+- icon = gkbd_status_new ();
+- g_signal_connect (icon, "popup-menu",
+- G_CALLBACK
+- (status_icon_popup_menu_cb),
+- NULL);
+-
+- }
+- } else {
+- if (icon != NULL) {
+- xkl_debug (150, "Destroying icon\n");
+- g_object_unref (icon);
+- icon = NULL;
+- }
+- }
+-}
+-
+-static gboolean
+-try_activating_xkb_config_if_new (GkbdKeyboardConfig *
+- current_sys_kbd_config)
+-{
+- /* Activate - only if different! */
+- if (!gkbd_keyboard_config_equals
+- (¤t_kbd_config, current_sys_kbd_config)) {
+- if (gkbd_keyboard_config_activate (¤t_kbd_config)) {
+- if (pa_callback != NULL) {
+- (*pa_callback) (pa_callback_user_data);
+- return TRUE;
+- }
+- } else {
+- return FALSE;
+- }
+- }
+- return TRUE;
+-}
+-
+-static gboolean
+-filter_xkb_config (void)
+-{
+- XklConfigItem *item;
+- gchar *lname;
+- gchar *vname;
+- gchar **lv;
+- gboolean any_change = FALSE;
+-
+- xkl_debug (100, "Filtering configuration against the registry\n");
+- if (!ensure_xkl_registry ())
+- return FALSE;
+-
+- lv = current_kbd_config.layouts_variants;
+- item = xkl_config_item_new ();
+- while (*lv) {
+- xkl_debug (100, "Checking [%s]\n", *lv);
+- if (gkbd_keyboard_config_split_items (*lv, &lname, &vname)) {
+- gboolean should_be_dropped = FALSE;
+- g_snprintf (item->name, sizeof (item->name), "%s",
+- lname);
+- if (!xkl_config_registry_find_layout
+- (xkl_registry, item)) {
+- xkl_debug (100, "Bad layout [%s]\n",
+- lname);
+- should_be_dropped = TRUE;
+- } else if (vname) {
+- g_snprintf (item->name,
+- sizeof (item->name), "%s",
+- vname);
+- if (!xkl_config_registry_find_variant
+- (xkl_registry, lname, item)) {
+- xkl_debug (100,
+- "Bad variant [%s(%s)]\n",
+- lname, vname);
+- should_be_dropped = TRUE;
+- }
+- }
+- if (should_be_dropped) {
+- gkbd_strv_behead (lv);
+- any_change = TRUE;
+- continue;
+- }
+- }
+- lv++;
+- }
+- g_object_unref (item);
+- return any_change;
+-}
+-
+-static void
+-apply_xkb_settings (void)
+-{
+- GkbdKeyboardConfig current_sys_kbd_config;
+-
+- if (!inited_ok)
+- return;
+-
+- gkbd_keyboard_config_init (¤t_sys_kbd_config, xkl_engine);
+-
+- gkbd_keyboard_config_load (¤t_kbd_config,
+- &initial_sys_kbd_config);
+-
+- gkbd_keyboard_config_load_from_x_current (¤t_sys_kbd_config,
+- NULL);
+-
+- if (!try_activating_xkb_config_if_new (¤t_sys_kbd_config)) {
+- if (filter_xkb_config ()) {
+- if (!try_activating_xkb_config_if_new
+- (¤t_sys_kbd_config)) {
+- g_warning
+- ("Could not activate the filtered XKB configuration");
+- activation_error ();
+- }
+- } else {
+- g_warning
+- ("Could not activate the XKB configuration");
+- activation_error ();
+- }
+- } else
+- xkl_debug (100,
+- "Actual KBD configuration was not changed: redundant notification\n");
+-
+- gkbd_keyboard_config_term (¤t_sys_kbd_config);
+- show_hide_icon ();
+-}
+-
+-static void
+-csd_keyboard_xkb_analyze_sysconfig (void)
+-{
+- if (!inited_ok)
+- return;
+-
+- gkbd_keyboard_config_init (&initial_sys_kbd_config, xkl_engine);
+- gkbd_keyboard_config_load_from_x_initial (&initial_sys_kbd_config,
+- NULL);
+-}
+-
+-void
+-csd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun,
+- void *user_data)
+-{
+- pa_callback = fun;
+- pa_callback_user_data = user_data;
+-}
+-
+-static GdkFilterReturn
+-csd_keyboard_xkb_evt_filter (GdkXEvent * xev, GdkEvent * event)
+-{
+- XEvent *xevent = (XEvent *) xev;
+- xkl_engine_filter_events (xkl_engine, xevent);
+- return GDK_FILTER_CONTINUE;
+-}
+-
+-/* When new Keyboard is plugged in - reload the settings */
+-static void
+-csd_keyboard_new_device (XklEngine * engine)
+-{
+- apply_desktop_settings ();
+- apply_xkb_settings ();
+-}
+-
+-void
+-csd_keyboard_xkb_init (CsdKeyboardManager * kbd_manager)
+-{
+- Display *display =
+- GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+- cinnamon_settings_profile_start (NULL);
+-
+- gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
+- DATADIR G_DIR_SEPARATOR_S
+- "icons");
+-
+- manager = kbd_manager;
+- cinnamon_settings_profile_start ("xkl_engine_get_instance");
+- xkl_engine = xkl_engine_get_instance (display);
+- cinnamon_settings_profile_end ("xkl_engine_get_instance");
+- if (xkl_engine) {
+- inited_ok = TRUE;
+-
+- gkbd_desktop_config_init (¤t_config, xkl_engine);
+- gkbd_keyboard_config_init (¤t_kbd_config,
+- xkl_engine);
+- xkl_engine_backup_names_prop (xkl_engine);
+- csd_keyboard_xkb_analyze_sysconfig ();
+-
+- settings_desktop = g_settings_new (GKBD_DESKTOP_SCHEMA);
+- settings_keyboard = g_settings_new (GKBD_KEYBOARD_SCHEMA);
+- g_signal_connect (settings_desktop, "changed",
+- (GCallback) apply_desktop_settings,
+- NULL);
+- g_signal_connect (settings_keyboard, "changed",
+- (GCallback) apply_xkb_settings, NULL);
+-
+- gdk_window_add_filter (NULL, (GdkFilterFunc)
+- csd_keyboard_xkb_evt_filter, NULL);
+-
+- if (xkl_engine_get_features (xkl_engine) &
+- XKLF_DEVICE_DISCOVERY)
+- g_signal_connect (xkl_engine, "X-new-device",
+- G_CALLBACK
+- (csd_keyboard_new_device), NULL);
+-
+- cinnamon_settings_profile_start ("xkl_engine_start_listen");
+- xkl_engine_start_listen (xkl_engine,
+- XKLL_MANAGE_LAYOUTS |
+- XKLL_MANAGE_WINDOW_STATES);
+- cinnamon_settings_profile_end ("xkl_engine_start_listen");
+-
+- cinnamon_settings_profile_start ("apply_desktop_settings");
+- apply_desktop_settings ();
+- cinnamon_settings_profile_end ("apply_desktop_settings");
+- cinnamon_settings_profile_start ("apply_xkb_settings");
+- apply_xkb_settings ();
+- cinnamon_settings_profile_end ("apply_xkb_settings");
+- }
+- preview_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal);
+-
+- cinnamon_settings_profile_end (NULL);
+-}
+-
+-void
+-csd_keyboard_xkb_shutdown (void)
+-{
+- if (!inited_ok)
+- return;
+-
+- pa_callback = NULL;
+- pa_callback_user_data = NULL;
+- manager = NULL;
+-
+- if (preview_dialogs != NULL)
+- g_hash_table_destroy (preview_dialogs);
+-
+- if (!inited_ok)
+- return;
+-
+- xkl_engine_stop_listen (xkl_engine,
+- XKLL_MANAGE_LAYOUTS |
+- XKLL_MANAGE_WINDOW_STATES);
+-
+- gdk_window_remove_filter (NULL, (GdkFilterFunc)
+- csd_keyboard_xkb_evt_filter, NULL);
+-
+- g_object_unref (settings_desktop);
+- settings_desktop = NULL;
+- g_object_unref (settings_keyboard);
+- settings_keyboard = NULL;
+-
+- if (xkl_registry) {
+- g_object_unref (xkl_registry);
+- }
+-
+- g_object_unref (xkl_engine);
+-
+- xkl_engine = NULL;
+-
+- inited_ok = FALSE;
+-}
+diff -uNrp a/plugins/keyboard/csd-keyboard-xkb.h b/plugins/keyboard/csd-keyboard-xkb.h
+--- a/plugins/keyboard/csd-keyboard-xkb.h 2013-08-24 18:04:31.000000000 +0100
++++ b/plugins/keyboard/csd-keyboard-xkb.h 1970-01-01 01:00:00.000000000 +0100
+@@ -1,39 +0,0 @@
+-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+- * cinnamon-settings-keyboard-xkb.h
+- *
+- * Copyright (C) 2001 Udaltsoft
+- *
+- * Written by Sergey V. Oudaltsov
+- *
+- * This program is free software; you can redistribute it and/or modify
+- * it under the terms of the GNU General Public License as published by
+- * the Free Software Foundation; either version 2, or (at your option)
+- * any later version.
+- *
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU General Public License for more details.
+- *
+- * You should have received a copy of the GNU General Public License
+- * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 51 Franklin Street - Suite 500, Boston, MA
+- * 02110-1335, USA.
+- */
+-
+-#ifndef __CSD_KEYBOARD_XKB_H
+-#define __CSD_KEYBOARD_XKB_H
+-
+-#include
+-#include "csd-keyboard-manager.h"
+-
+-void csd_keyboard_xkb_init (CsdKeyboardManager *manager);
+-void csd_keyboard_xkb_shutdown (void);
+-
+-typedef void (*PostActivationCallback) (void *userData);
+-
+-void
+-csd_keyboard_xkb_set_post_activation_callback (PostActivationCallback fun,
+- void *userData);
+-
+-#endif
+diff -uNrp a/plugins/keyboard/delayed-dialog.c b/plugins/keyboard/delayed-dialog.c
+--- a/plugins/keyboard/delayed-dialog.c 2013-08-24 18:04:31.000000000 +0100
++++ b/plugins/keyboard/delayed-dialog.c 1970-01-01 01:00:00.000000000 +0100
+@@ -1,128 +0,0 @@
+-/*
+- * Copyright © 2006 Novell, Inc.
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public License as
+- * published by the Free Software Foundation; either version 2, or (at
+- * your option) any later version.
+- *
+- * This program is distributed in the hope that it will be useful, but
+- * WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- * General Public License for more details.
+- *
+- * You should have received a copy of the GNU General Public License
+- * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 51 Franklin Street - Suite 500, Boston, MA
+- * 02110-1335, USA.
+- */
+-
+-#include
+-#include
+-
+-#include
+-#include
+-
+-#include "delayed-dialog.h"
+-
+-static gboolean delayed_show_timeout (gpointer data);
+-static GdkFilterReturn message_filter (GdkXEvent *xevent,
+- GdkEvent *event,
+- gpointer data);
+-
+-static GSList *dialogs = NULL;
+-
+-/**
+- * csd_delayed_show_dialog:
+- * @dialog: the dialog
+- *
+- * Shows the dialog as with gtk_widget_show(), unless a window manager
+- * hasn't been started yet, in which case it will wait up to 5 seconds
+- * for that to happen before showing the dialog.
+- **/
+-void
+-csd_delayed_show_dialog (GtkWidget *dialog)
+-{
+- GdkDisplay *display = gtk_widget_get_display (dialog);
+- Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
+- GdkScreen *screen = gtk_widget_get_screen (dialog);
+- char selection_name[10];
+- Atom selection_atom;
+-
+- /* We can't use gdk_selection_owner_get() for this, because
+- * it's an unknown out-of-process window.
+- */
+- snprintf (selection_name, sizeof (selection_name), "WM_S%d",
+- gdk_screen_get_number (screen));
+- selection_atom = XInternAtom (xdisplay, selection_name, True);
+- if (selection_atom &&
+- XGetSelectionOwner (xdisplay, selection_atom) != None) {
+- gtk_widget_show (dialog);
+- return;
+- }
+-
+- dialogs = g_slist_prepend (dialogs, dialog);
+-
+- gdk_window_add_filter (NULL, message_filter, NULL);
+-
+- g_timeout_add (5000, delayed_show_timeout, NULL);
+-}
+-
+-static gboolean
+-delayed_show_timeout (gpointer data)
+-{
+- GSList *l;
+-
+- for (l = dialogs; l; l = l->next)
+- gtk_widget_show (l->data);
+- g_slist_free (dialogs);
+- dialogs = NULL;
+-
+- /* FIXME: There's no gdk_display_remove_client_message_filter */
+-
+- return FALSE;
+-}
+-
+-static GdkFilterReturn
+-message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
+-{
+- XClientMessageEvent *evt;
+- char *selection_name;
+- int screen;
+- GSList *l, *next;
+-
+- if (((XEvent *)xevent)->type != ClientMessage)
+- return GDK_FILTER_CONTINUE;
+-
+- evt = (XClientMessageEvent *)xevent;
+-
+- if (evt->message_type != XInternAtom (evt->display, "MANAGER", FALSE))
+- return GDK_FILTER_CONTINUE;
+-
+- selection_name = XGetAtomName (evt->display, evt->data.l[1]);
+-
+- if (strncmp (selection_name, "WM_S", 4) != 0) {
+- XFree (selection_name);
+- return GDK_FILTER_CONTINUE;
+- }
+-
+- screen = atoi (selection_name + 4);
+-
+- for (l = dialogs; l; l = next) {
+- GtkWidget *dialog = l->data;
+- next = l->next;
+-
+- if (gdk_screen_get_number (gtk_widget_get_screen (dialog)) == screen) {
+- gtk_widget_show (dialog);
+- dialogs = g_slist_remove (dialogs, dialog);
+- }
+- }
+-
+- if (!dialogs) {
+- gdk_window_remove_filter (NULL, message_filter, NULL);
+- }
+-
+- XFree (selection_name);
+-
+- return GDK_FILTER_CONTINUE;
+-}
+diff -uNrp a/plugins/keyboard/delayed-dialog.h b/plugins/keyboard/delayed-dialog.h
+--- a/plugins/keyboard/delayed-dialog.h 2013-08-24 18:04:31.000000000 +0100
++++ b/plugins/keyboard/delayed-dialog.h 1970-01-01 01:00:00.000000000 +0100
+@@ -1,32 +0,0 @@
+-/*
+- * Copyright © 2006 Novell, Inc.
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public License as
+- * published by the Free Software Foundation; either version 2, or (at
+- * your option) any later version.
+- *
+- * This program is distributed in the hope that it will be useful, but
+- * WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- * General Public License for more details.
+- *
+- * You should have received a copy of the GNU General Public License
+- * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 51 Franklin Street - Suite 500, Boston, MA
+- * 02110-1335, USA.
+- */
+-
+-
+-#ifndef __DELAYED_DIALOG_H
+-#define __DELAYED_DIALOG_H
+-
+-#include
+-
+-G_BEGIN_DECLS
+-
+-void csd_delayed_show_dialog (GtkWidget *dialog);
+-
+-G_END_DECLS
+-
+-#endif
+diff -uNrp a/plugins/keyboard/gkbd-configuration.c b/plugins/keyboard/gkbd-configuration.c
+--- a/plugins/keyboard/gkbd-configuration.c 2013-08-24 18:04:31.000000000 +0100
++++ b/plugins/keyboard/gkbd-configuration.c 1970-01-01 01:00:00.000000000 +0100
+@@ -1,350 +0,0 @@
+-/*
+- * Copyright (C) 2010 Canonical Ltd.
+- *
+- * Authors: Jan Arne Petersen
+- *
+- * Based on gkbd-status.c by Sergey V. Udaltsov
+- *
+- * This library is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU Lesser General Public
+- * License as published by the Free Software Foundation; either
+- * version 2 of the License, or (at your option) any later version.
+- *
+- * This library is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- * Lesser General Public License for more details.
+- *
+- * You should have received a copy of the GNU Lesser General Public
+- * License along with this library; if not, write to the
+- * Free Software Foundation, Inc., 51 Franklin Street - Suite 500,
+- * Boston, MA 02110-1335, USA.
+- */
+-
+-#include
+-
+-#include
+-#include
+-#include
+-
+-#include
+-#include
+-
+-#include "gkbd-configuration.h"
+-
+-struct _GkbdConfigurationPrivate {
+- XklEngine *engine;
+- XklConfigRegistry *registry;
+-
+- GkbdDesktopConfig cfg;
+- GkbdIndicatorConfig ind_cfg;
+- GkbdKeyboardConfig kbd_cfg;
+-
+- gchar **full_group_names;
+- gchar **short_group_names;
+-
+- gulong state_changed_handler;
+- gulong config_changed_handler;
+-};
+-
+-enum {
+- SIGNAL_CHANGED,
+- SIGNAL_GROUP_CHANGED,
+- LAST_SIGNAL
+-};
+-
+-static guint signals[LAST_SIGNAL] = { 0, };
+-
+-#define GKBD_CONFIGURATION_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GKBD_TYPE_CONFIGURATION, GkbdConfigurationPrivate))
+-
+-G_DEFINE_TYPE (GkbdConfiguration, gkbd_configuration, G_TYPE_OBJECT)
+-
+-/* Should be called once for all widgets */
+-static void
+-gkbd_configuration_cfg_changed (GSettings *settings,
+- const char *key,
+- GkbdConfiguration * configuration)
+-{
+- GkbdConfigurationPrivate *priv = configuration->priv;
+-
+- xkl_debug (100,
+- "General configuration changed in GSettings - reiniting...\n");
+- gkbd_desktop_config_load (&priv->cfg);
+- gkbd_desktop_config_activate (&priv->cfg);
+-
+- g_signal_emit (configuration,
+- signals[SIGNAL_CHANGED], 0);
+-}
+-
+-/* Should be called once for all widgets */
+-static void
+-gkbd_configuration_ind_cfg_changed (GSettings *settings,
+- const char *key,
+- GkbdConfiguration * configuration)
+-{
+- GkbdConfigurationPrivate *priv = configuration->priv;
+- xkl_debug (100,
+- "Applet configuration changed in GSettings - reiniting...\n");
+- gkbd_indicator_config_load (&priv->ind_cfg);
+-
+- gkbd_indicator_config_free_image_filenames (&priv->ind_cfg);
+- gkbd_indicator_config_load_image_filenames (&priv->ind_cfg,
+- &priv->kbd_cfg);
+-
+- gkbd_indicator_config_activate (&priv->ind_cfg);
+-
+- g_signal_emit (configuration,
+- signals[SIGNAL_CHANGED], 0);
+-}
+-
+-static void
+-gkbd_configuration_load_group_names (GkbdConfiguration * configuration,
+- XklConfigRec * xklrec)
+-{
+- GkbdConfigurationPrivate *priv = configuration->priv;
+-
+- if (!gkbd_desktop_config_load_group_descriptions (&priv->cfg,
+- priv->registry,
+- (const char **) xklrec->layouts,
+- (const char **) xklrec->variants,
+- &priv->short_group_names,
+- &priv->full_group_names)) {
+- /* We just populate no short names (remain NULL) -
+- * full names are going to be used anyway */
+- gint i, total_groups =
+- xkl_engine_get_num_groups (priv->engine);
+- xkl_debug (150, "group descriptions loaded: %d!\n",
+- total_groups);
+- priv->full_group_names =
+- g_new0 (char *, total_groups + 1);
+-
+- if (xkl_engine_get_features (priv->engine) &
+- XKLF_MULTIPLE_LAYOUTS_SUPPORTED) {
+- for (i = 0; priv->kbd_cfg.layouts_variants[i]; i++) {
+- priv->full_group_names[i] =
+- g_strdup ((char *) priv->kbd_cfg.layouts_variants[i]);
+- }
+- } else {
+- for (i = total_groups; --i >= 0;) {
+- priv->full_group_names[i] =
+- g_strdup_printf ("Group %d", i);
+- }
+- }
+- }
+-}
+-
+-/* Should be called once for all widgets */
+-static void
+-gkbd_configuration_kbd_cfg_callback (XklEngine *engine,
+- GkbdConfiguration *configuration)
+-{
+- GkbdConfigurationPrivate *priv = configuration->priv;
+- XklConfigRec *xklrec = xkl_config_rec_new ();
+- xkl_debug (100,
+- "XKB configuration changed on X Server - reiniting...\n");
+-
+- gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg,
+- xklrec);
+-
+- gkbd_indicator_config_free_image_filenames (&priv->ind_cfg);
+- gkbd_indicator_config_load_image_filenames (&priv->ind_cfg,
+- &priv->kbd_cfg);
+-
+- g_strfreev (priv->full_group_names);
+- priv->full_group_names = NULL;
+-
+- g_strfreev (priv->short_group_names);
+- priv->short_group_names = NULL;
+-
+- gkbd_configuration_load_group_names (configuration,
+- xklrec);
+-
+- g_signal_emit (configuration,
+- signals[SIGNAL_CHANGED],
+- 0);
+-
+- g_object_unref (G_OBJECT (xklrec));
+-}
+-
+-/* Should be called once for all applets */
+-static void
+-gkbd_configuration_state_callback (XklEngine * engine,
+- XklEngineStateChange changeType,
+- gint group, gboolean restore,
+- GkbdConfiguration * configuration)
+-{
+- xkl_debug (150, "group is now %d, restore: %d\n", group, restore);
+-
+- if (changeType == GROUP_CHANGED) {
+- g_signal_emit (configuration,
+- signals[SIGNAL_GROUP_CHANGED], 0,
+- group);
+- }
+-}
+-
+-static void
+-gkbd_configuration_init (GkbdConfiguration *configuration)
+-{
+- GkbdConfigurationPrivate *priv;
+- XklConfigRec *xklrec = xkl_config_rec_new ();
+-
+- priv = GKBD_CONFIGURATION_GET_PRIVATE (configuration);
+- configuration->priv = priv;
+-
+- priv->engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
+- if (priv->engine == NULL) {
+- xkl_debug (0, "Libxklavier initialization error");
+- return;
+- }
+-
+- priv->state_changed_handler =
+- g_signal_connect (priv->engine, "X-state-changed",
+- G_CALLBACK (gkbd_configuration_state_callback),
+- configuration);
+- priv->config_changed_handler =
+- g_signal_connect (priv->engine, "X-config-changed",
+- G_CALLBACK (gkbd_configuration_kbd_cfg_callback),
+- configuration);
+-
+- gkbd_desktop_config_init (&priv->cfg, priv->engine);
+- gkbd_keyboard_config_init (&priv->kbd_cfg, priv->engine);
+- gkbd_indicator_config_init (&priv->ind_cfg, priv->engine);
+-
+- gkbd_desktop_config_load (&priv->cfg);
+- gkbd_desktop_config_activate (&priv->cfg);
+-
+- priv->registry = xkl_config_registry_get_instance (priv->engine);
+- xkl_config_registry_load (priv->registry,
+- priv->cfg.load_extra_items);
+-
+- gkbd_keyboard_config_load_from_x_current (&priv->kbd_cfg,
+- xklrec);
+-
+- gkbd_indicator_config_load (&priv->ind_cfg);
+-
+- gkbd_indicator_config_load_image_filenames (&priv->ind_cfg,
+- &priv->kbd_cfg);
+-
+- gkbd_indicator_config_activate (&priv->ind_cfg);
+-
+- gkbd_configuration_load_group_names (configuration,
+- xklrec);
+- g_object_unref (G_OBJECT (xklrec));
+-
+- gkbd_desktop_config_start_listen (&priv->cfg,
+- G_CALLBACK (gkbd_configuration_cfg_changed),
+- configuration);
+- gkbd_indicator_config_start_listen (&priv->ind_cfg,
+- G_CALLBACK (gkbd_configuration_ind_cfg_changed),
+- configuration);
+- xkl_engine_start_listen (priv->engine,
+- XKLL_TRACK_KEYBOARD_STATE);
+-
+- xkl_debug (100, "Initiating the widget startup process for %p\n",
+- configuration);
+-}
+-
+-static void
+-gkbd_configuration_finalize (GObject * obj)
+-{
+- GkbdConfiguration *configuration = GKBD_CONFIGURATION (obj);
+- GkbdConfigurationPrivate *priv = configuration->priv;
+-
+- xkl_debug (100,
+- "Starting the gnome-kbd-configuration widget shutdown process for %p\n",
+- configuration);
+-
+- xkl_engine_stop_listen (priv->engine,
+- XKLL_TRACK_KEYBOARD_STATE);
+-
+- gkbd_desktop_config_stop_listen (&priv->cfg);
+- gkbd_indicator_config_stop_listen (&priv->ind_cfg);
+-
+- gkbd_indicator_config_term (&priv->ind_cfg);
+- gkbd_keyboard_config_term (&priv->kbd_cfg);
+- gkbd_desktop_config_term (&priv->cfg);
+-
+- if (g_signal_handler_is_connected (priv->engine,
+- priv->state_changed_handler)) {
+- g_signal_handler_disconnect (priv->engine,
+- priv->state_changed_handler);
+- priv->state_changed_handler = 0;
+- }
+- if (g_signal_handler_is_connected (priv->engine,
+- priv->config_changed_handler)) {
+- g_signal_handler_disconnect (priv->engine,
+- priv->config_changed_handler);
+- priv->config_changed_handler = 0;
+- }
+-
+- g_object_unref (priv->registry);
+- priv->registry = NULL;
+- g_object_unref (priv->engine);
+- priv->engine = NULL;
+-
+- G_OBJECT_CLASS (gkbd_configuration_parent_class)->finalize (obj);
+-}
+-
+-static void
+-gkbd_configuration_class_init (GkbdConfigurationClass * klass)
+-{
+- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+-
+- /* Initing vtable */
+- object_class->finalize = gkbd_configuration_finalize;
+-
+- /* Signals */
+- signals[SIGNAL_CHANGED] = g_signal_new ("changed",
+- GKBD_TYPE_CONFIGURATION,
+- G_SIGNAL_RUN_LAST,
+- 0,
+- NULL, NULL,
+- g_cclosure_marshal_VOID__VOID,
+- G_TYPE_NONE,
+- 0);
+- signals[SIGNAL_GROUP_CHANGED] = g_signal_new ("group-changed",
+- GKBD_TYPE_CONFIGURATION,
+- G_SIGNAL_RUN_LAST,
+- 0,
+- NULL, NULL,
+- g_cclosure_marshal_VOID__INT,
+- G_TYPE_NONE,
+- 1,
+- G_TYPE_INT);
+-
+- g_type_class_add_private (klass, sizeof (GkbdConfigurationPrivate));
+-}
+-
+-GkbdConfiguration *
+-gkbd_configuration_get (void)
+-{
+- static gpointer instance = NULL;
+-
+- if (!instance) {
+- instance = g_object_new (GKBD_TYPE_CONFIGURATION, NULL);
+- g_object_add_weak_pointer (instance, &instance);
+- } else {
+- g_object_ref (instance);
+- }
+-
+- return instance;
+-}
+-
+-XklEngine *
+-gkbd_configuration_get_xkl_engine (GkbdConfiguration *configuration)
+-{
+- return configuration->priv->engine;
+-}
+-
+-const char * const *
+-gkbd_configuration_get_group_names (GkbdConfiguration *configuration)
+-{
+- return configuration->priv->full_group_names;
+-}
+-
+-const char * const *
+-gkbd_configuration_get_short_group_names (GkbdConfiguration *configuration)
+-{
+- return configuration->priv->short_group_names;
+-}
+diff -uNrp a/plugins/keyboard/gkbd-configuration.h b/plugins/keyboard/gkbd-configuration.h
+--- a/plugins/keyboard/gkbd-configuration.h 2013-08-24 18:04:31.000000000 +0100
++++ b/plugins/keyboard/gkbd-configuration.h 1970-01-01 01:00:00.000000000 +0100
+@@ -1,65 +0,0 @@
+-/*
+- * Copyright (C) 2010 Canonical Ltd.
+- *
+- * Authors: Jan Arne Petersen
+- *
+- * Based on gkbd-status.h by Sergey V. Udaltsov
+- *
+- * This library is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU Lesser General Public
+- * License as published by the Free Software Foundation; either
+- * version 2 of the License, or (at your option) any later version.
+- *
+- * This library is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- * Lesser General Public License for more details.
+- *
+- * You should have received a copy of the GNU Lesser General Public
+- * License along with this library; if not, write to the
+- * Free Software Foundation, Inc., 51 Franklin Street - Suite 500,
+- * Boston, MA 02110-1335, USA.
+- */
+-
+-#ifndef __GKBD_CONFIGURATION_H__
+-#define __GKBD_CONFIGURATION_H__
+-
+-#include
+-
+-#include
+-
+-G_BEGIN_DECLS
+-
+-typedef struct _GkbdConfiguration GkbdConfiguration;
+-typedef struct _GkbdConfigurationPrivate GkbdConfigurationPrivate;
+-typedef struct _GkbdConfigurationClass GkbdConfigurationClass;
+-
+-#define GKBD_TYPE_CONFIGURATION (gkbd_configuration_get_type ())
+-#define GKBD_CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfiguration))
+-#define GKBD_INDCATOR_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfigurationClass))
+-#define GKBD_IS_CONFIGURATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKBD_TYPE_CONFIGURATION))
+-#define GKBD_IS_CONFIGURATION_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), GKBD_TYPE_CONFIGURATION))
+-#define GKBD_CONFIGURATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GKBD_TYPE_CONFIGURATION, GkbdConfigurationClass))
+-
+-struct _GkbdConfiguration {
+- GObject parent;
+-
+- GkbdConfigurationPrivate *priv;
+-};
+-
+-struct _GkbdConfigurationClass {
+- GObjectClass parent_class;
+-};
+-
+-extern GType gkbd_configuration_get_type (void);
+-
+-extern GkbdConfiguration *gkbd_configuration_get (void);
+-
+-extern XklEngine *gkbd_configuration_get_xkl_engine (GkbdConfiguration *configuration);
+-
+-extern const char * const *gkbd_configuration_get_group_names (GkbdConfiguration *configuration);
+-extern const char * const *gkbd_configuration_get_short_group_names (GkbdConfiguration *configuration);
+-
+-G_END_DECLS
+-
+-#endif
+diff -uNrp a/plugins/keyboard/.indent.pro b/plugins/keyboard/.indent.pro
+--- a/plugins/keyboard/.indent.pro 1970-01-01 01:00:00.000000000 +0100
++++ b/plugins/keyboard/.indent.pro 2013-08-25 16:36:02.000000000 +0100
+@@ -0,0 +1,2 @@
++-kr -i8 -pcs -lps -psl
++
+diff -uNrp a/plugins/keyboard/Makefile.am b/plugins/keyboard/Makefile.am
+--- a/plugins/keyboard/Makefile.am 2013-08-24 18:04:31.000000000 +0100
++++ b/plugins/keyboard/Makefile.am 2013-08-25 16:36:02.000000000 +0100
+@@ -20,25 +20,20 @@ libkeyboard_la_SOURCES = \
+ csd-keyboard-plugin.c \
+ csd-keyboard-manager.h \
+ csd-keyboard-manager.c \
+- csd-keyboard-xkb.h \
+- csd-keyboard-xkb.c \
+- delayed-dialog.h \
+- delayed-dialog.c \
+- gkbd-configuration.c \
+- gkbd-configuration.h \
+ $(NULL)
+
+ libkeyboard_la_CPPFLAGS = \
+ -I$(top_srcdir)/cinnamon-settings-daemon \
+ -I$(top_srcdir)/data \
++ -I$(top_srcdir)/plugins/common \
+ -DDATADIR=\""$(pkgdatadir)"\" \
++ -DLIBEXECDIR=\""$(libexecdir)"\" \
+ -DCINNAMON_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+ $(AM_CPPFLAGS)
+
+ libkeyboard_la_CFLAGS = \
+ $(PLUGIN_CFLAGS) \
+ $(SETTINGS_PLUGIN_CFLAGS) \
+- $(APPINDICATOR_CFLAGS) \
+ $(KEYBOARD_CFLAGS) \
+ $(AM_CFLAGS)
+
+@@ -46,19 +41,63 @@ libkeyboard_la_LDFLAGS = \
+ $(CSD_PLUGIN_LDFLAGS) \
+ $(NULL)
+
+-libkeyboard_la_LIBADD = \
+- $(SETTINGS_PLUGIN_LIBS) \
+- $(XF86MISC_LIBS) \
+- $(KEYBOARD_LIBS) \
+- $(APPINDICATOR_LIBS) \
++libkeyboard_la_LIBADD = \
++ $(top_builddir)/plugins/common/libcommon.la \
++ $(SETTINGS_PLUGIN_LIBS) \
++ $(XF86MISC_LIBS) \
++ $(KEYBOARD_LIBS) \
+ $(NULL)
+
++libexec_PROGRAMS = csd-test-keyboard
++csd_test_keyboard_SOURCES = \
++ test-keyboard.c \
++ csd-keyboard-manager.h \
++ csd-keyboard-manager.c \
++ $(NULL)
++
++csd_test_keyboard_CFLAGS = $(libkeyboard_la_CFLAGS)
++csd_test_keyboard_CPPFLAGS = $(libkeyboard_la_CPPFLAGS)
++csd_test_keyboard_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/cinnamon-settings-daemon/libcsd.la
++
+ plugin_in_files = \
+ keyboard.cinnamon-settings-plugin.in \
+ $(NULL)
+
+ plugin_DATA = $(plugin_in_files:.cinnamon-settings-plugin.in=.cinnamon-settings-plugin)
+
++if HAVE_IBUS
++noinst_PROGRAMS = test-keyboard-ibus-utils
++test_keyboard_ibus_utils_SOURCES = test-keyboard-ibus-utils.c
++test_keyboard_ibus_utils_CFLAGS = $(libkeyboard_la_CFLAGS)
++test_keyboard_ibus_utils_CPPFLAGS = $(libkeyboard_la_CPPFLAGS)
++test_keyboard_ibus_utils_LDADD = $(libkeyboard_la_LIBADD) $(top_builddir)/cinnamon-settings-daemon/libcsd.la
++
++check-local: test-keyboard-ibus-utils
++ $(builddir)/test-keyboard-ibus-utils > /dev/null
++endif
++
++libexec_PROGRAMS += csd-input-sources-switcher
++
++csd_input_sources_switcher_SOURCES = \
++ csd-input-sources-switcher.c \
++ $(NULL)
++
++csd_input_sources_switcher_CPPFLAGS = \
++ -I$(top_srcdir)/data \
++ -I$(top_srcdir)/plugins/common \
++ $(AM_CPPFLAGS) \
++ $(NULL)
++
++csd_input_sources_switcher_CFLAGS = \
++ $(SETTINGS_PLUGIN_CFLAGS) \
++ $(AM_CFLAGS) \
++ $(NULL)
++
++csd_input_sources_switcher_LDADD = \
++ $(top_builddir)/plugins/common/libcommon.la \
++ $(SETTINGS_PLUGIN_LIBS) \
++ $(NULL)
++
+ EXTRA_DIST = \
+ $(icons_DATA) \
+ $(plugin_in_files) \
+diff -uNrp a/plugins/keyboard/test-keyboard.c b/plugins/keyboard/test-keyboard.c
+--- a/plugins/keyboard/test-keyboard.c 1970-01-01 01:00:00.000000000 +0100
++++ b/plugins/keyboard/test-keyboard.c 2013-08-25 16:36:02.000000000 +0100
+@@ -0,0 +1,7 @@
++#define NEW csd_keyboard_manager_new
++#define START csd_keyboard_manager_start
++#define STOP csd_keyboard_manager_stop
++#define MANAGER CsdKeyboardManager
++#include "csd-keyboard-manager.h"
++
++#include "test-plugin.h"
+diff -uNrp a/plugins/keyboard/test-keyboard-ibus-utils.c b/plugins/keyboard/test-keyboard-ibus-utils.c
+--- a/plugins/keyboard/test-keyboard-ibus-utils.c 1970-01-01 01:00:00.000000000 +0100
++++ b/plugins/keyboard/test-keyboard-ibus-utils.c 2013-08-25 16:36:02.000000000 +0100
+@@ -0,0 +1,116 @@
++#include "csd-keyboard-manager.c"
++
++static void
++test_make_xkb_source_id (void)
++{
++ gint i;
++ const gchar *test_strings[][2] = {
++ /* input output */
++ { "xkb:aa:bb:cc", "aa+bb" },
++ { "xkb:aa:bb:", "aa+bb" },
++ { "xkb:aa::cc", "aa" },
++ { "xkb:aa::", "aa" },
++ { "xkb::bb:cc", "+bb" },
++ { "xkb::bb:", "+bb" },
++ { "xkb:::cc", "" },
++ { "xkb:::", "" },
++ };
++
++ for (i = 0; i < G_N_ELEMENTS (test_strings); ++i)
++ g_assert_cmpstr (make_xkb_source_id (test_strings[i][0]), ==, test_strings[i][1]);
++}
++
++static void
++test_layout_from_ibus_layout (void)
++{
++ gint i;
++ const gchar *test_strings[][2] = {
++ /* input output */
++ { "", "" },
++ { "a", "a" },
++ { "a(", "a" },
++ { "a[", "a" },
++ };
++
++ for (i = 0; i < G_N_ELEMENTS (test_strings); ++i)
++ g_assert_cmpstr (layout_from_ibus_layout (test_strings[i][0]), ==, test_strings[i][1]);
++}
++
++static void
++test_variant_from_ibus_layout (void)
++{
++ gint i;
++ const gchar *test_strings[][2] = {
++ /* input output */
++ { "", NULL },
++ { "a", NULL },
++ { "(", NULL },
++ { "()", "" },
++ { "(b)", "b" },
++ { "a(", NULL },
++ { "a()", "" },
++ { "a(b)", "b" },
++ };
++
++ for (i = 0; i < G_N_ELEMENTS (test_strings); ++i)
++ g_assert_cmpstr (variant_from_ibus_layout (test_strings[i][0]), ==, test_strings[i][1]);
++}
++
++static void
++test_options_from_ibus_layout (void)
++{
++ gint i, j;
++ gchar *output_0[] = {
++ NULL
++ };
++ gchar *output_1[] = {
++ "",
++ NULL
++ };
++ gchar *output_2[] = {
++ "b",
++ NULL
++ };
++ gchar *output_3[] = {
++ "b", "",
++ NULL
++ };
++ gchar *output_4[] = {
++ "b", "c",
++ NULL
++ };
++ const gpointer tests[][2] = {
++ /* input output */
++ { "", NULL },
++ { "a", NULL },
++ { "a[", output_0 },
++ { "a[]", output_1 },
++ { "a[b]", output_2 },
++ { "a[b,]", output_3 },
++ { "a[b,c]", output_4 },
++ };
++
++ for (i = 0; i < G_N_ELEMENTS (tests); ++i) {
++ if (tests[i][1] == NULL) {
++ g_assert (options_from_ibus_layout (tests[i][0]) == NULL);
++ } else {
++ gchar **strv_a = options_from_ibus_layout (tests[i][0]);
++ gchar **strv_b = tests[i][1];
++
++ g_assert (g_strv_length (strv_a) == g_strv_length (strv_b));
++ for (j = 0; j < g_strv_length (strv_a); ++j)
++ g_assert_cmpstr (strv_a[j], ==, strv_b[j]);
++ }
++ }
++}
++
++int
++main (void)
++{
++ test_make_xkb_source_id ();
++ test_layout_from_ibus_layout ();
++ test_variant_from_ibus_layout ();
++ test_options_from_ibus_layout ();
++
++ return 0;
++}
+diff -uNrp a/plugins/keyboard/xxx/csd-keyboard-xkb.c b/plugins/keyboard/xxx/csd-keyboard-xkb.c
+--- a/plugins/keyboard/xxx/csd-keyboard-xkb.c 1970-01-01 01:00:00.000000000 +0100
++++ b/plugins/keyboard/xxx/csd-keyboard-xkb.c 2013-08-25 16:36:02.000000000 +0100
+@@ -0,0 +1,579 @@
++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
++ *
++ * Copyright (C) 2001 Udaltsoft
++ *
++ * Written by Sergey V. Oudaltsov
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street - Suite 500, Boston, MA
++ * 02110-1335, USA.
++ */
++
++#include "config.h"
++
++#include
++#include
++
++#include
++#include
++#include
++#include
++
++#include