diff --git a/.version b/.version
index af805b45bd8..d3a61dbd830 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-14.04
\ No newline at end of file
+14.10
\ No newline at end of file
diff --git a/README.md b/README.md
index 8ded8807ede..e59b15425e9 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
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)
+* [NixOS installation instructions](http://nixos.org/nixos/manual/#ch-installation)
* [Manual (How to write packages for Nix)](http://nixos.org/nixpkgs/manual/)
* [Manual (NixOS)](http://nixos.org/nixos/manual/)
* [Continuous build](http://hydra.nixos.org/jobset/nixos/trunk-combined)
diff --git a/doc/meta.xml b/doc/meta.xml
index 00e9b8ac67a..6c8e458509a 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/quick-start.xml b/doc/quick-start.xml
index 35983f0b114..49c674052b9 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/lib/composable-derivation.nix b/lib/composable-derivation.nix
index 1099bd152bf..8e8faae3982 100644
--- a/lib/composable-derivation.nix
+++ b/lib/composable-derivation.nix
@@ -1,15 +1,74 @@
{lib, pkgs} :
let inherit (lib) nv nvs; in
{
- # see for example:
- # - development/interpreters/php_configurable/default.nix
- # - .. search composableDerivation in all-packages.nix ..
+
+ # composableDerivation basically mixes these features:
+ # - fix function
+ # - mergeAttrBy
+ # - provides shortcuts for "options" such as "--enable-foo" and adding
+ # buildInputs, see php example
#
- # You should be able to override anything you like easily
- # grep the mailinglist by title "python proposal" (dec 08)
- # -> http://mail.cs.uu.nl/pipermail/nix-dev/2008-December/001571.html
- # to see why this got complicated when using all its features
- # TODO add newer example using new syntax (kernel derivation proposal -> mailinglist)
+ # It predates styles which are common today, such as
+ # * the config attr
+ # * mkDerivation.override feature
+ # * overrideDerivation (lib/customization.nix)
+ #
+ # Some of the most more important usage examples (which could be rewritten if it was important):
+ # * php
+ # * postgis
+ # * vim_configurable
+ #
+ # A minimal example illustrating most features would look like this:
+ # let base = composableDerivation { (fixed : let inherit (fixed.fixed) name in {
+ # src = fetchurl {
+ # }
+ # buildInputs = [A];
+ # preConfigre = "echo ${name}";
+ # # attention, "name" attr is missing, thus you cannot instantiate "base".
+ # }
+ # in {
+ # # These all add name attribute, thus you can instantiate those:
+ # v1 = base.merge ({ name = "foo-add-B"; buildInputs = [B]; }); // B gets merged into buildInputs
+ # v2 = base.merge ({ name = "mix-in-pre-configure-lines" preConfigre = ""; });
+ # v3 = base.replace ({ name = "foo-no-A-only-B;" buildInputs = [B]; });
+ # }
+ #
+ # So yes, you can think about it being something like nixos modules, and
+ # you'd be merging "features" in one at a time using .merge or .replace
+ # Thanks Shea for telling me that I rethink the documentation ..
+ #
+ # issues:
+ # * its complicated to understand
+ # * some "features" such as exact merge behaviour are burried in mergeAttrBy
+ # and defaultOverridableDelayableArgs assuming the default behaviour does
+ # the right thing in the common case
+ # * Eelco once said using such fix style functions are slow to evaluate
+ # * Too quick & dirty. Hard to understand for others. The benefit was that
+ # you were able to create a kernel builder like base derivation and replace
+ # / add patches the way you want without having to declare function arguments
+ #
+ # nice features:
+ # declaring "optional featuers" is modular. For instance:
+ # flags.curl = {
+ # configureFlags = ["--with-curl=${curl}" "--with-curlwrappers"];
+ # buildInputs = [curl openssl];
+ # };
+ # flags.other = { .. }
+ # (Example taken from PHP)
+ #
+ # alternative styles / related features:
+ # * Eg see function supporting building the kernel
+ # * versionedDerivation (discussion about this is still going on - or ended)
+ # * composedArgsAndFun
+ # * mkDerivation.override
+ # * overrideDerivation
+ # * using { .., *Support ? false }: like configurable options.
+ # To find those examples use grep
+ #
+ # To sum up: It exists for historical reasons - and for most commonly used
+ # tasks the alternatives should be used
+ #
+ # If you have questions about this code ping Marc Weber.
composableDerivation = {
mkDerivation ? pkgs.stdenv.mkDerivation,
diff --git a/lib/licenses.nix b/lib/licenses.nix
index 603fddcb857..e49528f2a2e 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -64,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 ";
@@ -202,6 +208,12 @@
url = https://www.mozilla.org/MPL/2.0;
};
+ ofl = {
+ shortName = "OFL";
+ fullName = "SIL Open Font License";
+ url = "http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL_web";
+ };
+
openssl = {
shortName = "openssl";
fullName = "OpenSSL license";
@@ -254,4 +266,22 @@
fullName = "Sleepycat Public License";
url = "https://en.wikipedia.org/wiki/Sleepycat_License";
};
+
+ cecill-c = {
+ shortName = "CeCILL-C";
+ fullName = "CEA CNRS INRIA Logiciel Libre";
+ url = "http://www.cecill.info/licences.en.html";
+ };
+
+ msrla = {
+ shortName = "MSR-LA";
+ fullName = "Microsoft Research License Agreement";
+ url = "http://research.microsoft.com/en-us/projects/pex/msr-la.txt";
+ };
+
+ inria = {
+ shortName = "INRIA-NCLA";
+ fullName = "INRIA Non-Commercial License Agreement";
+ url = "http://compcert.inria.fr/doc/LICENSE";
+ };
}
diff --git a/lib/lists.nix b/lib/lists.nix
index 6c7773304de..4b5f04a6758 100644
--- a/lib/lists.nix
+++ b/lib/lists.nix
@@ -227,6 +227,4 @@ in rec {
crossLists = f: foldl (fs: args: concatMap (f: map f args) fs) [f];
- # List difference, xs - ys. Removes elements of ys from xs.
- difference = xs: ys: filter (y: !(builtins.elem y ys)) xs;
}
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 34896dfaeac..8a98cb14651 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -14,23 +14,29 @@
AndersonTorres = "Anderson Torres ";
andres = "Andres Loeh ";
antono = "Antono Vasiljev ";
+ arobyn = "Alexei Robyn ";
astsmtl = "Alexander Tsamutali ";
aszlig = "aszlig ";
bbenoist = "Baptist BENOIST ";
bennofs = "Benno Fünfstück ";
+ berdario = "Dario Bertini ";
bjg = "Brian Gough ";
bjornfor = "Bjørn Forsman ";
bluescreen303 = "Mathijs Kwik ";
bodil = "Bodil Stokke ";
calrama = "Moritz Maxeiner ";
+ cfouche = "Chaddaï Fouché ";
chaoflow = "Florian Friesdorf ";
coconnor = "Corey O'Connor ";
coroa = "Jonas Hörsch ";
+ cstrahan = "Charles Strahan ";
+ ederoyd46 = "Matthew Brown ";
edwtjo = "Edward Tjörnhammar ";
eelco = "Eelco Dolstra ";
- emery = "Emery Hemingawy ";
+ emery = "Emery Hemingway ";
ertes = "Ertugrul Söylemez ";
falsifian = "James Cook ";
+ fuuzetsu = "Mateusz Kowalczyk ";
garbas = "Rok Garbas ";
goibhniu = "Cillian de Róiste ";
guibert = "David Guibert ";
@@ -39,6 +45,8 @@
iElectric = "Domen Kozar ";
iyzsong = "Song Wenwu ";
jcumming = "Jack Cummings ";
+ joelteon = "Joel Taylor ";
+ jwiegley = "John Wiegley ";
kkallio = "Karn Kallio ";
ktosiek = "Tomasz Kontusz ";
lethalman = "Luca Bruno ";
@@ -59,10 +67,12 @@
pierron = "Nicolas B. Pierron ";
piotr = "Piotr Pietraszkiewicz ";
pkmx = "Chih-Mao Chen ";
+ plcplc = "Philip Lykke Carlsen ";
pSub = "Pascal Wittmann ";
qknight = "Joachim Schiele ";
raskin = "Michael Raskin <7c6f434c@mail.ru>";
redbaron = "Maxim Ivanov ";
+ relrod = "Ricky Elrod ";
rickynils = "Rickard Nilsson ";
rob = "Rob Vermaas ";
roconnor = "Russell O'Connor ";
@@ -80,12 +90,14 @@
tomberek = "Thomas Bereknyei ";
ttuegel = "Thomas Tuegel ";
urkud = "Yury G. Kudryashov ";
+ vbmithr = "Vincent Bernardoff ";
vcunat = "Vladimír Čunát ";
viric = "Lluís Batlle i Rossell ";
vizanto = "Danny Wilson ";
vlstill = "Vladimír Štill ";
winden = "Antonio Vargas Gonzalez ";
wizeman = "Ricardo M. Correia ";
+ wmertens = "Wout Mertens ";
z77z = "Marco Maggesi ";
zef = "Zef Hemel ";
zimbatm = "zimbatm ";
diff --git a/lib/modules.nix b/lib/modules.nix
index 017c9255246..633b6fc05b2 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -319,6 +319,8 @@ rec {
mkForce = mkOverride 50;
mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’
+ mkStrict = builtins.trace "`mkStrict' is obsolete; use `mkOverride 0' instead." (mkOverride 0);
+
mkFixStrictness = id; # obsolete, no-op
mkOrder = priority: content:
diff --git a/lib/strings.nix b/lib/strings.nix
index cd748f02cc6..5f76da5c33c 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -56,12 +56,14 @@ rec {
optionalString = cond: string: if cond then string else "";
- # Determine whether a filename ends in the given suffix.
- hasSuffix = ext: fileName:
- let lenFileName = stringLength fileName;
- lenExt = stringLength ext;
- in !(lessThan lenFileName lenExt) &&
- substring (sub lenFileName lenExt) lenFileName fileName == ext;
+ # Determine whether a string has given prefix/suffix.
+ hasPrefix = pref: str:
+ substring 0 (stringLength pref) str == pref;
+ hasSuffix = suff: str:
+ let lenStr = stringLength str;
+ lenSuff = stringLength suff;
+ in lenStr >= lenSuff &&
+ substring (lenStr - lenSuff) lenStr str == suff;
# Convert a string to a list of characters (i.e. singleton strings).
@@ -155,8 +157,18 @@ rec {
preLen = stringLength pre;
sLen = stringLength s;
in
- if pre == substring 0 preLen s then
- substring preLen (sub sLen preLen) s
+ if hasPrefix pre s then
+ substring preLen (sLen - preLen) s
+ else
+ s;
+
+ removeSuffix = suf: s:
+ let
+ sufLen = stringLength suf;
+ sLen = stringLength s;
+ in
+ if sufLen <= sLen && suf == substring (sLen - sufLen) sufLen s then
+ substring 0 (sLen - sufLen) s
else
s;
diff --git a/lib/types.nix b/lib/types.nix
index baf8aa5e574..f5700ab0269 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -194,6 +194,12 @@ rec {
args = { name = ""; }; }).options;
};
+ enum = values: mkOptionType {
+ name = "one of ${concatStringsSep ", " values}";
+ check = flip elem values;
+ merge = mergeOneOption;
+ };
+
# Obsolete alternative to configOf. It takes its option
# declarations from the ‘options’ attribute of containing option
# declaration.
diff --git a/maintainers/scripts/copy-tarballs.pl b/maintainers/scripts/copy-tarballs.pl
index 0746fb21069..c6d77529dd4 100755
--- a/maintainers/scripts/copy-tarballs.pl
+++ b/maintainers/scripts/copy-tarballs.pl
@@ -75,7 +75,6 @@ foreach my $file (@{$data->{list}->{attrs}}) {
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;
@@ -92,4 +91,7 @@ foreach my $file (@{$data->{list}->{attrs}}) {
my $sha256 = hashFile("sha256", 0, $storePath) or die;
symlink("../$fn", "$tarballsCache/sha256/$sha256");
+
+ $sha256 = hashFile("sha256", 1, $storePath) or die;
+ symlink("../$fn", "$tarballsCache/sha256/$sha256");
}
diff --git a/nixos/doc/manual/configuration.xml b/nixos/doc/manual/configuration.xml
index 246ab11587a..803a3393d15 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
@@ -538,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
@@ -730,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:
@@ -935,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";
@@ -1183,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:
@@ -1195,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.
-hardware.opengl.videoDrivers = [ "r128" ];
+services.xserver.videoDrivers = [ "r128" ];
to enable X.org’s xf86-video-r128 driver.
@@ -1238,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:
-hardware.opengl.videoDrivers = [ "nvidia" ];
+services.xserver.videoDrivers = [ "nvidia" ];
You may need to reboot after enabling this driver to prevent a clash
with other kernel modules.
@@ -1275,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:
@@ -1305,7 +1305,7 @@ users.extraUsers.alice.openssh.authorizedKeys.keys =
-IPv4 configuration
+IPv4 configuration
By default, NixOS uses DHCP (specifically,
dhcpcd) to automatically configure network
@@ -1348,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
@@ -1363,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 ];
@@ -1395,7 +1397,7 @@ always allowed.)
-Wireless networks
+Wireless networks
NixOS will start wpa_supplicant for you if you enable this setting:
@@ -1456,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
index b8f170fc614..2530d519521 100644
--- a/nixos/doc/manual/containers.xml
+++ b/nixos/doc/manual/containers.xml
@@ -213,8 +213,8 @@ $ ping -c1 10.233.4.2
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
+called ve-container-name
+(e.g., ve-foo). The container has its own network
namespace and the CAP_NET_ADMIN capability, so it
can perform arbitrary network configuration such as setting up
firewall rules, without affecting or having access to the host’s
@@ -228,11 +228,11 @@ on the host:
networking.nat.enable = true;
-networking.nat.internalInterfaces = ["c-+"];
+networking.nat.internalInterfaces = ["ve-+"];
networking.nat.externalInterface = "eth0";
where eth0 should be replaced with the desired
-external interface. Note that c-+ is a wildcard
+external interface. Note that ve-+ is a wildcard
that matches all container interfaces.
diff --git a/nixos/doc/manual/development.xml b/nixos/doc/manual/development.xml
index be1cbc97d5e..2f0c2a7aa8d 100644
--- a/nixos/doc/manual/development.xml
+++ b/nixos/doc/manual/development.xml
@@ -1,5 +1,6 @@
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xml:id="ch-development">
Development
@@ -9,7 +10,7 @@ NixOS.
-
+
Getting the sources
@@ -38,7 +39,37 @@ This will check out the latest NixOS sources to
and the Nixpkgs sources to
/my/sources/nixpkgs.
(The NixOS source tree lives in a subdirectory of the Nixpkgs
-repository.) If you want to rebuild your system using your (modified)
+repository.)
+
+It’s often inconvenient to develop directly on the master
+branch, since if somebody has just committed (say) a change to GCC,
+then the binary cache may not have caught up yet and you’ll have to
+rebuild everything from source. So you may want to create a local
+branch based on your current NixOS version:
+
+
+$ nixos-version
+14.04.273.ea1952b (Baboon)
+
+$ git checkout -b local ea1952b
+
+
+Or, to base your local branch on the latest version available in the
+NixOS channel:
+
+
+$ curl -sI http://nixos.org/channels/nixos-unstable/ | grep Location
+Location: http://releases.nixos.org/nixos/unstable/nixos-14.10pre43986.acaf4a6/
+
+$ git checkout -b local acaf4a6
+
+
+You can then use git rebase to sync your local
+branch with the upstream branch, and use git
+cherry-pick to copy commits from your local branch to the
+upstream branch.
+
+If you want to rebuild your system using your (modified)
sources, you need to tell nixos-rebuild about them
using the flag:
@@ -74,7 +105,7 @@ in nixos/ as packages.
-
+
Writing NixOS modules
@@ -188,9 +219,9 @@ commands to be executed periodically by cron).
NixOS module for the “locate” service
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let locatedb = "/var/cache/locatedb"; in
@@ -579,7 +610,7 @@ systemd.services.dhcpcd =
-
+
Building specific parts of NixOS
@@ -692,7 +723,7 @@ $ systemctl start tmp-httpd.service
-
+
Building your own NixOS CD
@@ -728,18 +759,22 @@ $ mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso
Testing the installer
-Building, burning, and
-booting from an installation CD is rather
+Building, burning, and booting from an installation CD is rather
tedious, so here is a quick way to see if the installer works
properly:
$ nix-build -A config.system.build.nixos-install
-$ dd if=/dev/zero of=diskimage seek=2G count=0 bs=1
-$ yes | mke2fs -j diskimage
-$ mount -o loop diskimage /mnt
+$ mount -t tmpfs none /mnt
$ ./result/bin/nixos-install
+To start a login shell in the new NixOS installation in
+/mnt:
+
+
+$ ./result/bin/nixos-install --chroot
+
+
@@ -748,57 +783,310 @@ $ ./result/bin/nixos-install
-Whole-system testing using virtual machines
+
-Complete NixOS GNU/Linux systems can be tested in virtual
-machines (VMs). This makes it possible to test a system upgrade or
-configuration change before rebooting into it, using the
-nixos-rebuild build-vm or nixos-rebuild
-build-vm-with-bootloader command.
+NixOS tests
-
-The tests/ directory in the NixOS source
-tree contains several whole-system unit tests.
-These tests can be runNixOS tests can be run both from
-NixOS and from a non-NixOS GNU/Linux distribution, provided the Nix
-package manager is installed. from the NixOS source
-tree as follows:
+When you add some feature to NixOS, you should write a test for
+it. NixOS tests are kept in the directory nixos/tests,
+and are executed (using Nix) by a testing framework that automatically
+starts one or more virtual machines containing the NixOS system(s)
+required for the test.
+
+Writing tests
+
+A NixOS test is a Nix expression that has the following structure:
+
+
+import ./make-test.nix {
+
+ # Either the configuration of a single machine:
+ machine =
+ { config, pkgs, ... }:
+ { configuration…
+ };
+
+ # Or a set of machines:
+ nodes =
+ { machine1 =
+ { config, pkgs, ... }: { … };
+ machine2 =
+ { config, pkgs, ... }: { … };
+ …
+ };
+
+ testScript =
+ ''
+ Perl code…
+ '';
+}
+
+
+The attribute testScript is a bit of Perl code that
+executes the test (described below). During the test, it will start
+one or more virtual machines, the configuration of which is described
+by the attribute machine (if you need only one
+machine in your test) or by the attribute nodes (if
+you need multiple machines). For instance, login.nix
+only needs a single machine to test whether users can log in on the
+virtual console, whether device ownership is correctly maintained when
+switching between consoles, and so on. On the other hand, nfs.nix,
+which tests NFS client and server functionality in the Linux kernel
+(including whether locks are maintained across server crashes),
+requires three machines: a server and two clients.
+
+There are a few special NixOS configuration options for test
+VMs:
+
+
+
+
+
+
+
+ The memory of the VM in
+ megabytes.
+
+
+
+
+ The virtual networks to which the VM is
+ connected. See nat.nix
+ for an example.
+
+
+
+
+ By default, the Nix store in the VM is not
+ writable. If you enable this option, a writable union file system
+ is mounted on top of the Nix store to make it appear
+ writable. This is necessary for tests that run Nix operations that
+ modify the store.
+
+
+
+
+For more options, see the module qemu-vm.nix.
+
+The test script is a sequence of Perl statements that perform
+various actions, such as starting VMs, executing commands in the VMs,
+and so on. Each virtual machine is represented as an object stored in
+the variable $name,
+where name is the identifier of the machine
+(which is just machine if you didn’t specify
+multiple machines using the nodes attribute). For
+instance, the following starts the machine, waits until it has
+finished booting, then executes a command and checks that the output
+is more-or-less correct:
+
+
+$machine->start;
+$machine->waitForUnit("default.target");
+$machine->succeed("uname") =~ /Linux/;
+
+
+The first line is actually unnecessary; machines are implicitly
+started when you first execute an action on them (such as
+waitForUnit or succeed). If you
+have multiple machines, you can speed up the test by starting them in
+parallel:
+
+
+startAll;
+
+
+
+
+The following methods are available on machine objects:
+
+
+
+
+ start
+ Start the virtual machine. This method is
+ asynchronous — it does not wait for the machine to finish
+ booting.
+
+
+
+ shutdown
+ Shut down the machine, waiting for the VM to
+ exit.
+
+
+
+ crash
+ Simulate a sudden power failure, by telling the VM
+ to exit immediately.
+
+
+
+ block
+ Simulate unplugging the Ethernet cable that
+ connects the machine to the other machines.
+
+
+
+ unblock
+ Undo the effect of
+ block.
+
+
+
+ screenshot
+ Take a picture of the display of the virtual
+ machine, in PNG format. The screenshot is linked from the HTML
+ log.
+
+
+
+ sendMonitorCommand
+ Send a command to the QEMU monitor. This is rarely
+ used, but allows doing stuff such as attaching virtual USB disks
+ to a running machine.
+
+
+
+ sendKeys
+ Simulate pressing keys on the virtual keyboard,
+ e.g., sendKeys("ctrl-alt-delete").
+
+
+
+ sendChars
+ Simulate typing a sequence of characters on the
+ virtual keyboard, e.g., sendKeys("foobar\n")
+ will type the string foobar followed by the
+ Enter key.
+
+
+
+ execute
+ Execute a shell command, returning a list
+ (status,
+ stdout).
+
+
+
+ succeed
+ Execute a shell command, raising an exception if
+ the exit status is not zero, otherwise returning the standard
+ output.
+
+
+
+ fail
+ Like succeed, but raising
+ an exception if the command returns a zero status.
+
+
+
+ waitUntilSucceeds
+ Repeat a shell command with 1-second intervals
+ until it succeeds.
+
+
+
+ waitUntilFails
+ Repeat a shell command with 1-second intervals
+ until it fails.
+
+
+
+ waitForUnit
+ Wait until the specified systemd unit has reached
+ the “active” state.
+
+
+
+ waitForFile
+ Wait until the specified file
+ exists.
+
+
+
+ waitForOpenPort
+ Wait until a process is listening on the given TCP
+ port (on localhost, at least).
+
+
+
+ waitForClosedPort
+ Wait until nobody is listening on the given TCP
+ port.
+
+
+
+ waitForX
+ Wait until the X11 server is accepting
+ connections.
+
+
+
+ waitForWindow
+ Wait until an X11 window has appeared whose name
+ matches the given regular expression, e.g.,
+ waitForWindow(qr/Terminal/).
+
+
+
+
+
+
+
+
+
+Running tests
+
+You can run tests using nix-build. For
+example, to run the test login.nix,
+you just do:
-$ nix-build tests/ -A nfs.test
+$ nix-build '<nixpkgs/nixos/tests/login.nix>'
-This performs an automated test of the NFS client and server
-functionality in the Linux kernel, including file locking semantics
-(e.g., whether locks are maintained across server crashes). It will
-first build or download all the dependencies of the test (e.g., all
-packages needed to run a NixOS VM). The test is defined in
-tests/nfs.nix. If the test succeeds,
-nix-build will place a symlink
-./result in the current directory pointing at the
-location in the Nix store of the test results (e.g., screenshots, test
-reports, and so on). In particular, a pretty-printed log of the test
-is written to log.html, which can be viewed using
-a web browser like this:
+or, if you don’t want to rely on NIX_PATH:
+
+
+$ cd /my/nixpkgs/nixos/tests
+$ nix-build login.nix
+…
+running the VM test script
+machine: QEMU running (pid 8841)
+…
+6 out of 6 tests succeeded
+
+
+After building/downloading all required dependencies, this will
+perform a build that starts a QEMU/KVM virtual machine containing a
+NixOS system. The virtual machine mounts the Nix store of the host;
+this makes VM creation very fast, as no disk image needs to be
+created. Afterwards, you can view a pretty-printed log of the test:
$ firefox result/log.html
+
It is also possible to run the test environment interactively,
allowing you to experiment with the VMs. For example:
-$ nix-build tests/ -A nfs.driver
+$ nix-build login.nix -A driver
$ ./result/bin/nixos-run-vms
-The script nixos-run-vms starts the three virtual
-machines defined in the NFS test using QEMU/KVM. The root file system
-of the VMs is created on the fly and kept across VM restarts in
+The script nixos-run-vms starts the virtual
+machines defined by test. The root file system of the VMs is created
+on the fly and kept across VM restarts in
./hostname.qcow2.
Finally, the test itself can be run interactively. This is
@@ -811,17 +1099,11 @@ starting VDE switch for network 1
>
-Perl statements can now be typed in to start or manipulate the VMs:
+You can then take any Perl statement, e.g.
-> startAll;
-(the VMs start booting)
-> $server->waitForJob("nfs-kernel-nfsd");
-> $client1->succeed("flock -x /data/lock -c 'sleep 100000' &");
-> $client2->fail("flock -n -s /data/lock true");
-> $client1->shutdown;
-(this releases client1's lock)
-> $client2->succeed("flock -n -s /data/lock true");
+> startAll
+> $machine->succeed("touch /tmp/foo")
The function testScript executes the entire test
@@ -829,54 +1111,7 @@ script and drops you back into the test driver command line upon its
completion. This allows you to inspect the state of the VMs after the
test (e.g. to debug the test script).
-This and other tests are continuously run on the Hydra
-instance at nixos.org, which allows
-developers to be notified of any regressions introduced by a NixOS or
-Nixpkgs change.
-
-The actual Nix programming interface to VM testing is in NixOS,
-under
-lib/testing.nix. This file defines a
-function which takes an attribute set containing a
-nixpkgs attribute (the path to a Nixpkgs checkout),
-and a system attribute (the system type). It
-returns an attribute set containing several utility functions, among
-which the main entry point is makeTest.
-
-
-The makeTest function takes a function
-similar to that found in
-tests/nfs.nix (discussed above). It
-returns an attribute set containing (among others):
-
-
-
-
- test
- A derivation containing the test log as an HTML
- file, as seen above, suitable for presentation in the Hydra
- continuous build system.
-
-
-
- report
- A derivation containing a code coverage report, with
- meta-data suitable for Hydra.
-
-
-
- driver
- A derivation containing scripts to run the VM test or
- interact with the VM network interactively, as seen above.
-
-
-
-
-
-
+
diff --git a/nixos/doc/manual/installation.xml b/nixos/doc/manual/installation.xml
index f6b477ed69b..fa4b89e6ba8 100644
--- a/nixos/doc/manual/installation.xml
+++ b/nixos/doc/manual/installation.xml
@@ -1,13 +1,13 @@
+ xml:id="ch-installation">
Installing NixOS
-
+
Obtaining NixOS
@@ -51,7 +51,7 @@ running NixOS system through several other means:
-
+
Installation
@@ -209,7 +209,20 @@ $ nixos-install
a network issue while downloading binaries from the NixOS binary
cache), you can just re-run nixos-install.
Otherwise, fix your configuration.nix and
- then re-run nixos-install.
+ then re-run nixos-install.
+
+ As the last step, nixos-install will ask
+ you to set the password for the root user, e.g.
+
+
+setting root password...
+Enter new UNIX password: ***
+Retype new UNIX password: ***
+
+
+
+
+
If everything went well:
@@ -318,8 +331,7 @@ changes:
You must set to
- true, and
- to false. nixos-generate-config
+ true. nixos-generate-config
should do this automatically for new configurations when booted in
UEFI mode.
@@ -339,7 +351,7 @@ changes:
-Booting from a USB stick
+Booting from a USB stick
For systems withoua CD drive, the NixOS livecd can be booted from
a usb stick. For non-UEFI installations,
@@ -473,7 +485,7 @@ been built. These channels are:
Stable channels, such as nixos-13.10.
+ xlink:href="http://nixos.org/channels/nixos-14.04">nixos-14.04.
These only get conservative bug fixes and package upgrades. For
instance, a channel update may cause the Linux kernel on your
system to be upgraded from 3.4.66 to 3.4.67 (a minor bug fix), but
@@ -499,8 +511,8 @@ appliances.)
When you first install NixOS, you’re automatically subscribed to
the NixOS channel that corresponds to your installation source. For
-instance, if you installed from a 13.10 ISO, you will be subscribed to
-the nixos-13.10 channel. To see which NixOS
+instance, if you installed from a 14.04 ISO, you will be subscribed to
+the nixos-14.04 channel. To see which NixOS
channel you’re subscribed to, run the following as root:
@@ -515,10 +527,10 @@ $ nix-channel --add http://nixos.org/channels/channel-name
(Be sure to include the nixos parameter at the
-end.) For instance, to use the NixOS 13.10 stable channel:
+end.) For instance, to use the NixOS 14.04 stable channel:
-$ nix-channel --add http://nixos.org/channels/nixos-13.10 nixos
+$ nix-channel --add http://nixos.org/channels/nixos-14.04 nixos
But it you want to live on the bleeding edge:
diff --git a/nixos/doc/manual/man-nixos-install.xml b/nixos/doc/manual/man-nixos-install.xml
index d5157859857..0ebee7d23f9 100644
--- a/nixos/doc/manual/man-nixos-install.xml
+++ b/nixos/doc/manual/man-nixos-install.xml
@@ -42,6 +42,9 @@ the following steps:
and generates a GRUB configuration file that boots into the NixOS
configuration just installed.
+ It prompts you for a password for the root
+ account.
+
diff --git a/nixos/doc/manual/manual.xml b/nixos/doc/manual/manual.xml
index 5753a8ff9e7..8d7c28dee73 100644
--- a/nixos/doc/manual/manual.xml
+++ b/nixos/doc/manual/manual.xml
@@ -60,7 +60,7 @@
- List of options
+ Configuration options
diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl
index 9647aae0f2f..bb65a49217f 100644
--- a/nixos/doc/manual/options-to-docbook.xsl
+++ b/nixos/doc/manual/options-to-docbook.xsl
@@ -18,13 +18,12 @@
+
-
+
+
diff --git a/nixos/doc/manual/release-notes.xml b/nixos/doc/manual/release-notes.xml
index 10815ba613a..52e88bb4c86 100644
--- a/nixos/doc/manual/release-notes.xml
+++ b/nixos/doc/manual/release-notes.xml
@@ -1,16 +1,40 @@
Release notes
-
+
-Release 14.04 (“Baboon”, 2014/04/??)
+Release 14.10 (“Caterpillar”, 2014/10/??)
-This is the second stable release branch of NixOS. The main
-enhancements are the following:
+When upgrading from a previous release, please be aware of the
+following incompatible changes:
+
+
+
+ The host side of a container virtual Ethernet pair
+ is now called ve-container-name
+ rather than c-container-name.
+
+
+
+
+
+
+
+
+
+
+
+
+Release 14.04 (“Baboon”, 2014/04/30)
+
+This is the second stable release branch of NixOS. In addition
+to numerous new and upgraded packages and modules, this release has
+the following highlights:
@@ -18,9 +42,65 @@ enhancements are the following:
for
details.
+ Systemd has been updated to version 212, which has
+ numerous
+ improvements. NixOS now automatically starts systemd user
+ instances when you log in. You can define global user units through
+ the options.
+
NixOS is now based on Glibc 2.19 and GCC
4.8.
+ The default Linux kernel has been updated to
+ 3.12.
+
+ KDE has been updated to 4.12.
+
+ GNOME 3.10 experimental support has been added.
+
+ Nix has been updated to 1.7 (details).
+
+ NixOS now supports fully declarative management of
+ users and groups. If you set to
+ false, then the contents of
+ /etc/passwd and /etc/group
+ will be congruent
+ to your NixOS configuration. For instance, if you remove a user from
+ and run
+ nixos-rebuild, the user account will cease to
+ exist. Also, imperative commands for managing users and groups, such
+ as useradd, are no longer available. If
+ is true (the
+ default), then behaviour is unchanged from NixOS
+ 13.10.
+
+ NixOS now has basic container support, meaning you
+ can easily run a NixOS instance as a container in a NixOS host
+ system. These containers are suitable for testing and
+ experimentation but not production use, since they’re not fully
+ isolated from the host. See for
+ details.
+
+ Systemd units provided by packages can now be
+ overridden from the NixOS configuration. For instance, if a package
+ foo provides systemd units, you can say:
+
+
+systemd.packages = [ pkgs.foo ];
+
+
+ to enable those units. You can then set or override unit options in
+ the usual way, e.g.
+
+
+systemd.services.foo.wantedBy = [ "multi-user.target" ];
+systemd.services.foo.serviceConfig.MemoryLimit = "512M";
+
+
+
+
@@ -47,6 +127,18 @@ error: package ‘nvidia-x11-331.49-3.12.17’ in ‘…/nvidia-x11/default.nix:
+ The Adobe Flash player is no longer enabled by
+ default in the Firefox and Chromium wrappers. To enable it, you must
+ set:
+
+
+nixpkgs.config.allowUnfree = true;
+nixpkgs.config.firefox.enableAdobeFlash = true; # for Firefox
+nixpkgs.config.chromium.enableAdobeFlash = true; # for Chromium
+
+
+
+
The firewall is now enabled by default. If you don’t
want this, you need to disable it explicitly:
@@ -65,6 +157,28 @@ networking.firewall.enable = false;
sets a default for the option
.
+ Package variants are now differentiated by suffixing
+ the name, rather than the version. For instance,
+ sqlite-3.8.4.3-interactive is now called
+ sqlite-interactive-3.8.4.3. This ensures that
+ nix-env -i sqlite is unambiguous, and that
+ nix-env -u won’t “upgrade”
+ sqlite to sqlite-interactive
+ or vice versa. Notably, this change affects the Firefox wrapper
+ (which provides plugins), as it is now called
+ firefox-wrapper. So when using
+ nix-env, you should do nix-env -e
+ firefox; nix-env -i firefox-wrapper if you want to keep
+ using the wrapper. This change does not affect declarative package
+ management, since attribute names like
+ pkgs.firefoxWrapper were already
+ unambiguous.
+
+ The symlink /etc/ca-bundle.crt
+ is gone. Programs should instead use the environment variable
+ OPENSSL_X509_CERT_FILE (which points to
+ /etc/ssl/certs/ca-bundle.crt).
+
diff --git a/nixos/doc/manual/running.xml b/nixos/doc/manual/running.xml
index e50099707cc..e1a358df2aa 100644
--- a/nixos/doc/manual/running.xml
+++ b/nixos/doc/manual/running.xml
@@ -11,7 +11,7 @@ service manager.
-Service management
+Service management
In NixOS, all system services are started and monitored using
the systemd program. Systemd is the “init” process of the system
@@ -92,7 +92,7 @@ necessary).
-Rebooting and shutting down
+Rebooting and shutting down
The system can be shut down (and automatically powered off) by
doing:
@@ -134,7 +134,7 @@ authentication.
-User sessions
+User sessions
Systemd keeps track of all users who are logged into the system
(e.g. on a virtual console or remotely via SSH). The command
@@ -185,7 +185,7 @@ $ loginctl terminate-session c3
-Control groups
+Control groups
To keep track of the processes in a running system, systemd uses
control groups (cgroups). A control group is a
@@ -258,7 +258,7 @@ usage.
-Logging
+Logging
System-wide logging is provided by systemd’s
journal, which subsumes traditional logging
@@ -308,7 +308,7 @@ groups. All users have a private journal that can be read using
-Cleaning up the Nix store
+Cleaning up the Nix store
Nix has a purely functional model, meaning that packages are
never upgraded in place. Instead new versions of packages end up in a
diff --git a/nixos/doc/manual/troubleshooting.xml b/nixos/doc/manual/troubleshooting.xml
index c6e0a3a7888..c7d65112b64 100644
--- a/nixos/doc/manual/troubleshooting.xml
+++ b/nixos/doc/manual/troubleshooting.xml
@@ -1,12 +1,13 @@
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xml:id="ch-troubleshooting">
Troubleshooting
-Boot problems
+Boot problems
If NixOS fails to boot, there are a number of kernel command
line parameters that may help you to identify or fix the issue. You
@@ -69,7 +70,7 @@ unless something is very wrong.)
-Maintenance mode
+Maintenance mode
You can enter rescue mode by running:
@@ -85,7 +86,7 @@ just exit from the rescue shell.
-Rolling back configuration changes
+Rolling back configuration changes
After running nixos-rebuild to switch to a
new configuration, you may find that the new configuration doesn’t
@@ -131,7 +132,7 @@ lrwxrwxrwx 1 root root 78 Aug 12 13:54 /nix/var/nix/profiles/system-268-link ->
-Nix store corruption
+Nix store corruption
After a system crash, it’s possible for files in the Nix store
to become corrupted. (For instance, the Ext4 file system has the
@@ -166,7 +167,7 @@ binary cache; otherwise, they cannot be repaired.
-Nix network issues
+Nix network issues
Nix uses a so-called binary cache to
optimise building a package from source into downloading it as a
diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix
index e082b174454..0fa00637a93 100644
--- a/nixos/lib/eval-config.nix
+++ b/nixos/lib/eval-config.nix
@@ -58,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 99810f87750..e2bd3393d87 100644
--- a/nixos/lib/test-driver/Machine.pm
+++ b/nixos/lib/test-driver/Machine.pm
@@ -495,7 +495,7 @@ sub waitForX {
my ($self, $regexp) = @_;
$self->nest("waiting for the X11 server", sub {
retry sub {
- my ($status, $out) = $self->execute("journalctl -bu systemd-logind | grep Linked");
+ 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 358c29e515f..8ad0d67f68c 100644
--- a/nixos/lib/test-driver/test-driver.pl
+++ b/nixos/lib/test-driver/test-driver.pl
@@ -52,12 +52,12 @@ sub createMachine {
my ($args) = @_;
my $vm = Machine->new({%{$args}, log => $log, redirectSerial => ($ENV{USE_SERIAL} // "0") ne "1"});
$vms{$vm->name} = $vm;
+ $context .= "my \$" . $vm->name . " = \$vms{'" . $vm->name . "'}; ";
return $vm;
}
foreach my $vmScript (@ARGV) {
my $vm = createMachine({startCommand => $vmScript});
- $context .= "my \$" . $vm->name . " = \$vms{'" . $vm->name . "'}; ";
}
diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix
index d5338bc04ca..942a2158b15 100644
--- a/nixos/lib/testing.nix
+++ b/nixos/lib/testing.nix
@@ -67,57 +67,55 @@ rec {
};
- makeTest = testFun: complete (call testFun);
- makeTests = testsFun: lib.mapAttrs (name: complete) (call testsFun);
+ makeTest =
+ { testScript, makeCoverageReport ? false, ... } @ t:
- apply = makeTest; # compatibility
- call = f: f { inherit pkgs system; };
+ let
- complete = { testScript, ... } @ t: t // rec {
+ nodes = buildVirtualNetwork (
+ t.nodes or (if t ? machine then { machine = t.machine; } else { }));
- nodes = buildVirtualNetwork (
- t.nodes or (if t ? machine then { machine = t.machine; } else { }));
+ testScript' =
+ # Call the test script with the computed nodes.
+ if builtins.isFunction testScript
+ then testScript { inherit nodes; }
+ else testScript;
- 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);
- vlans = map (m: m.config.virtualisation.vlans) (lib.attrValues nodes);
+ vms = map (m: m.config.system.build.vm) (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];
+ 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"}
+ ''; # "
- # 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;
- test = runTests driver;
+ report = releaseTools.gcovReport { coverageRuns = [ test ]; };
- report = releaseTools.gcovReport { coverageRuns = [ test ]; };
- };
+ in (if makeCoverageReport then report else test) // { inherit driver test; };
runInMachine =
@@ -147,7 +145,7 @@ rec {
exit $?
'';
- testscript = ''
+ testScript = ''
startAll;
$client->waitForUnit("multi-user.target");
${preBuild}
@@ -160,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
''; # */
@@ -198,6 +196,6 @@ rec {
} // args);
- simpleTest = as: (makeTest ({ ... }: as)).test;
+ simpleTest = as: (makeTest as).test;
}
diff --git a/nixos/maintainers/scripts/ec2/amazon-base-config.nix b/nixos/maintainers/scripts/ec2/amazon-base-config.nix
new file mode 100644
index 00000000000..d23f15e828b
--- /dev/null
+++ b/nixos/maintainers/scripts/ec2/amazon-base-config.nix
@@ -0,0 +1,5 @@
+{ modulesPath, ...}:
+{
+ imports = [ "${modulesPath}/virtualisation/amazon-config.nix" ];
+ services.journald.rateLimitBurst = 0;
+}
diff --git a/nixos/maintainers/scripts/ec2/amazon-hvm-config.nix b/nixos/maintainers/scripts/ec2/amazon-hvm-config.nix
new file mode 100644
index 00000000000..d0c7f3a6a6c
--- /dev/null
+++ b/nixos/maintainers/scripts/ec2/amazon-hvm-config.nix
@@ -0,0 +1,5 @@
+{ config, pkgs, ...}:
+{
+ imports = [ ./amazon-base-config.nix ];
+ ec2.hvm = true;
+}
diff --git a/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix b/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix
new file mode 100644
index 00000000000..d9feba164a7
--- /dev/null
+++ b/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix
@@ -0,0 +1,33 @@
+{ config, pkgs, lib, ...}:
+let
+ cloudUtils = pkgs.fetchurl {
+ url = "https://launchpad.net/cloud-utils/trunk/0.27/+download/cloud-utils-0.27.tar.gz";
+ sha256 = "16shlmg36lidp614km41y6qk3xccil02f5n3r4wf6d1zr5n4v8vd";
+ };
+ growpart = pkgs.stdenv.mkDerivation {
+ name = "growpart";
+ src = cloudUtils;
+ buildPhase = ''
+ cp bin/growpart $out
+ sed -i 's|awk|gawk|' $out
+ sed -i 's|sed|gnused|' $out
+ '';
+ dontInstall = true;
+ dontPatchShebangs = true;
+ };
+in
+{
+ imports = [ ./amazon-base-config.nix ];
+ ec2.hvm = true;
+ boot.loader.grub.device = lib.mkOverride 0 "nodev";
+
+ boot.initrd.extraUtilsCommands = ''
+ cp -v ${pkgs.gawk}/bin/gawk $out/bin/gawk
+ cp -v ${pkgs.gnused}/bin/sed $out/bin/gnused
+ cp -v ${pkgs.utillinux}/sbin/sfdisk $out/bin/sfdisk
+ cp -v ${growpart} $out/bin/growpart
+ '';
+ boot.initrd.postDeviceCommands = ''
+ [ -e /dev/xvda ] && [ -e /dev/xvda1 ] && TMPDIR=/run sh $(type -P growpart) /dev/xvda 1
+ '';
+}
diff --git a/nixos/maintainers/scripts/ec2/create-ebs-amis.py b/nixos/maintainers/scripts/ec2/create-ebs-amis.py
index eab111a2665..14607b9a367 100755
--- a/nixos/maintainers/scripts/ec2/create-ebs-amis.py
+++ b/nixos/maintainers/scripts/ec2/create-ebs-amis.py
@@ -8,15 +8,17 @@ import nixops.util
from nixops import deployment
from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType
import boto.ec2
+from nixops.statefile import StateFile, get_default_state_file
parser = argparse.ArgumentParser(description='Create an EBS-backed NixOS AMI')
parser.add_argument('--region', dest='region', required=True, help='EC2 region to create the image in')
+parser.add_argument('--channel', dest='channel', default="13.10", help='Channel to use')
parser.add_argument('--keep', dest='keep', action='store_true', help='Keep NixOps machine after use')
parser.add_argument('--hvm', dest='hvm', action='store_true', help='Create HVM image')
parser.add_argument('--key', dest='key_name', action='store_true', help='Keypair used for HVM instance creation', default="rob")
args = parser.parse_args()
-instance_type = "m3.xlarge" if args.hvm else "m1.small"
+instance_type = "m3.medium" if args.hvm else "m1.small"
ebs_size = 8 if args.hvm else 20
@@ -37,11 +39,11 @@ f.write('''{{
'''.format(args.region, ebs_size))
f.close()
-db = deployment.open_database(deployment.get_default_state_file())
+db = StateFile(get_default_state_file())
try:
- depl = deployment.open_deployment(db, "ebs-creator")
+ depl = db.open_deployment("ebs-creator")
except Exception:
- depl = deployment.create_deployment(db)
+ depl = db.create_deployment()
depl.name = "ebs-creator"
depl.auto_response = "y"
depl.nix_exprs = [os.path.abspath("./ebs-creator.nix"), os.path.abspath("./ebs-creator-config.nix")]
@@ -50,7 +52,6 @@ depl.deploy(allow_reboot=True)
m = depl.machines['machine']
-
# Do the installation.
device="/dev/xvdg"
if args.hvm:
@@ -64,24 +65,27 @@ m.run_command("mkdir -p /mnt")
m.run_command("mount {0} /mnt".format(device))
m.run_command("touch /mnt/.ebs")
m.run_command("mkdir -p /mnt/etc/nixos")
-m.run_command("nix-channel --add http://nixos.org/channels/nixos-unstable")
+
+m.run_command("nix-channel --add http://nixos.org/channels/nixos-{} nixos".format(args.channel))
m.run_command("nix-channel --update")
-m.run_command("nixos-rebuild switch")
-version = m.run_command("nixos-version", capture_stdout=True).split(' ')[0]
+
+version = m.run_command("nix-instantiate --eval-only -A lib.nixpkgsVersion ''", capture_stdout=True).split(' ')[0].replace('"','').strip()
print >> sys.stderr, "NixOS version is {0}".format(version)
-m.upload_file("./amazon-base-config.nix", "/mnt/etc/nixos/configuration.nix")
-m.run_command("nixos-install")
if args.hvm:
+ m.upload_file("./amazon-base-config.nix", "/mnt/etc/nixos/amazon-base-config.nix")
+ m.upload_file("./amazon-hvm-config.nix", "/mnt/etc/nixos/configuration.nix")
+ m.upload_file("./amazon-hvm-install-config.nix", "/mnt/etc/nixos/amazon-hvm-install-config.nix")
+ m.run_command("NIXOS_CONFIG=/etc/nixos/amazon-hvm-install-config.nix nixos-install")
m.run_command('nix-env -iA nixos.pkgs.grub')
m.run_command('cp /nix/store/*-grub-0.97*/lib/grub/i386-pc/* /mnt/boot/grub')
- m.run_command('sed -i "s|hd0|hd0,0|" /mnt/boot/grub/menu.lst')
m.run_command('echo "(hd1) /dev/xvdg" > device.map')
m.run_command('echo -e "root (hd1,0)\nsetup (hd1)" | grub --device-map=device.map --batch')
-
+else:
+ m.upload_file("./amazon-base-config.nix", "/mnt/etc/nixos/configuration.nix")
+ m.run_command("nixos-install")
m.run_command("umount /mnt")
-
if args.hvm:
ami_name = "nixos-{0}-x86_64-ebs-hvm".format(version)
description = "NixOS {0} (x86_64; EBS root; hvm)".format(version)
diff --git a/nixos/maintainers/scripts/ec2/ebs-creator.nix b/nixos/maintainers/scripts/ec2/ebs-creator.nix
index 43dbd86f675..37795d5d5b4 100644
--- a/nixos/maintainers/scripts/ec2/ebs-creator.nix
+++ b/nixos/maintainers/scripts/ec2/ebs-creator.nix
@@ -4,10 +4,11 @@
machine =
{ config, pkgs, resources, ... }:
{ deployment.targetEnv = "ec2";
- deployment.ec2.instanceType = "m1.large";
+ deployment.ec2.instanceType = "c3.large";
deployment.ec2.securityGroups = [ "admin" ];
deployment.ec2.ebsBoot = false;
deployment.ec2.keyPair = resources.ec2KeyPairs.keypair.name;
+ deployment.ec2.zone = "us-east-1e";
environment.systemPackages = [ pkgs.parted ];
};
}
diff --git a/nixos/maintainers/scripts/gce/create-gce.sh b/nixos/maintainers/scripts/gce/create-gce.sh
new file mode 100755
index 00000000000..8bf36f33c7d
--- /dev/null
+++ b/nixos/maintainers/scripts/gce/create-gce.sh
@@ -0,0 +1,14 @@
+#! /bin/sh -e
+
+export NIX_PATH=nixpkgs=../../../..
+export NIXOS_CONFIG=$(dirname $(readlink -f $0))/../../../modules/virtualisation/google-compute-image.nix
+export TIMESTAMP=$(date +%Y%m%d%H%M)
+
+nix-build '' \
+ -A config.system.build.googleComputeImage --argstr system x86_64-linux -o gce --option extra-binary-caches http://hydra.nixos.org -j 10
+
+img=$(echo gce/*.tar.gz)
+if ! gsutil ls gs://nixos/$(basename $img); then
+ gsutil cp $img gs://nixos/$(basename $img)
+fi
+gcutil addimage $(basename $img .raw.tar.gz | sed 's|\.|-|' | sed 's|_|-|') gs://nixos/$(basename $img)
diff --git a/nixos/modules/config/fonts/corefonts.nix b/nixos/modules/config/fonts/corefonts.nix
index 7de95200cfa..ad797087932 100644
--- a/nixos/modules/config/fonts/corefonts.nix
+++ b/nixos/modules/config/fonts/corefonts.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -25,7 +25,7 @@ with pkgs.lib;
config = mkIf config.fonts.enableCoreFonts {
- fonts.extraFonts = [ pkgs.corefonts ];
+ fonts.fonts = [ pkgs.corefonts ];
};
diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix
index 987bb1088c0..cf70ca264d6 100644
--- a/nixos/modules/config/fonts/fontconfig.nix
+++ b/nixos/modules/config/fonts/fontconfig.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/config/fonts/fontdir.nix b/nixos/modules/config/fonts/fontdir.nix
index a4f69809b2a..c78b52fe29e 100644
--- a/nixos/modules/config/fonts/fontdir.nix
+++ b/nixos/modules/config/fonts/fontdir.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/config/fonts/fonts.nix b/nixos/modules/config/fonts/fonts.nix
index f43784f6d03..49b1e1d42a3 100644
--- a/nixos/modules/config/fonts/fonts.nix
+++ b/nixos/modules/config/fonts/fonts.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -10,40 +10,37 @@ with pkgs.lib;
# TODO: find another name for it.
fonts = mkOption {
- default = [
- # - the user's .fonts directory
- "~/.fonts"
- # - the user's current profile
- "~/.nix-profile/lib/X11/fonts"
- "~/.nix-profile/share/fonts"
- # - the default profile
- "/nix/var/nix/profiles/default/lib/X11/fonts"
- "/nix/var/nix/profiles/default/share/fonts"
- ];
- description = "List of primary font paths.";
- apply = list: list ++ [
- # - a few statically built locations
- pkgs.xorg.fontbhttf
- pkgs.xorg.fontbhlucidatypewriter100dpi
- pkgs.xorg.fontbhlucidatypewriter75dpi
- pkgs.ttf_bitstream_vera
- pkgs.freefont_ttf
- pkgs.liberation_ttf
- pkgs.xorg.fontbh100dpi
- pkgs.xorg.fontmiscmisc
- pkgs.xorg.fontcursormisc
- ]
- ++ config.fonts.extraFonts;
- };
-
- extraFonts = mkOption {
- default = [];
+ type = types.listOf types.path;
example = [ pkgs.dejavu_fonts ];
- description = "List of packages with additional fonts.";
+ description = "List of primary font paths.";
+ apply = list: list ++
+ [ # - the user's current profile
+ "~/.nix-profile/lib/X11/fonts"
+ "~/.nix-profile/share/fonts"
+ # - the default profile
+ "/nix/var/nix/profiles/default/lib/X11/fonts"
+ "/nix/var/nix/profiles/default/share/fonts"
+ ];
};
};
};
+ config = {
+
+ fonts.fonts =
+ [ pkgs.xorg.fontbhttf
+ pkgs.xorg.fontbhlucidatypewriter100dpi
+ pkgs.xorg.fontbhlucidatypewriter75dpi
+ pkgs.ttf_bitstream_vera
+ pkgs.freefont_ttf
+ pkgs.liberation_ttf
+ pkgs.xorg.fontbh100dpi
+ pkgs.xorg.fontmiscmisc
+ pkgs.xorg.fontcursormisc
+ ];
+
+ };
+
}
diff --git a/nixos/modules/config/fonts/ghostscript.nix b/nixos/modules/config/fonts/ghostscript.nix
index 9ef00396808..1c62a525de9 100644
--- a/nixos/modules/config/fonts/ghostscript.nix
+++ b/nixos/modules/config/fonts/ghostscript.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -25,7 +25,7 @@ with pkgs.lib;
config = mkIf config.fonts.enableGhostscriptFonts {
- fonts.extraFonts = [ "${pkgs.ghostscript}/share/ghostscript/fonts" ];
+ fonts.fonts = [ "${pkgs.ghostscript}/share/ghostscript/fonts" ];
};
diff --git a/nixos/modules/config/gnu.nix b/nixos/modules/config/gnu.nix
index 6f5d2950463..f8c35b440d1 100644
--- a/nixos/modules/config/gnu.nix
+++ b/nixos/modules/config/gnu.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
options = {
@@ -36,7 +36,7 @@ with pkgs.lib;
# GNU lsh.
services.openssh.enable = false;
services.lshd.enable = true;
- services.xserver.startOpenSSHAgent = false;
+ programs.ssh.startAgent = false;
services.xserver.startGnuPGAgent = true;
# TODO: GNU dico.
diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix
index 310739aa170..8182b8ae808 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
@@ -76,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 3323046ac5b..bb5a95ebc84 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 113f5d8bcbd..8171f460385 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 9ac68b42819..43717697ebd 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 ec7bf3fea7b..f91dbb4cc28 100644
--- a/nixos/modules/config/no-x-libs.nix
+++ b/nixos/modules/config/no-x-libs.nix
@@ -1,6 +1,9 @@
-{ config, pkgs, ... }:
+# This module gets rid of all dependencies on X11 client libraries
+# (including fontconfig).
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+
+with lib;
{
options = {
@@ -8,18 +11,22 @@ with pkgs.lib;
type = types.bool;
default = false;
description = ''
- Switch off the options in the default configuration that require X libraries.
- Currently this includes: ssh X11 forwarding, dbus, fonts.enableCoreFonts,
- fonts.enableFontConfig
+ Switch off the options in the default configuration that
+ require X11 libraries. This includes client-side font
+ configuration and SSH forwarding of X11 authentication
+ in. Thus, you probably do not want to enable this option if
+ you want to run X11 programs on this machine via SSH.
'';
};
};
config = mkIf config.environment.noXlibs {
programs.ssh.setXAuthLocation = false;
- fonts = {
- enableCoreFonts = false;
- enableFontConfig = false;
- };
+ security.pam.services.su.forwardXAuth = lib.mkForce false;
+
+ fonts.enableFontConfig = false;
+
+ nixpkgs.config.packageOverrides = pkgs:
+ { dbus = pkgs.dbus.override { useX11 = false; }; };
};
}
diff --git a/nixos/modules/config/nsswitch.nix b/nixos/modules/config/nsswitch.nix
index 2e2125d44f7..45695d9cb89 100644
--- a/nixos/modules/config/nsswitch.nix
+++ b/nixos/modules/config/nsswitch.nix
@@ -1,8 +1,8 @@
# Configuration for the Name Service Switch (/etc/nsswitch.conf).
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/config/power-management.nix b/nixos/modules/config/power-management.nix
index c80b1ec3ddc..17f3ed00b9b 100644
--- a/nixos/modules/config/power-management.nix
+++ b/nixos/modules/config/power-management.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -65,11 +65,7 @@ in
config = mkIf cfg.enable {
- 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 db4f1b43a11..9802b898a5d 100644
--- a/nixos/modules/config/pulseaudio.nix
+++ b/nixos/modules/config/pulseaudio.nix
@@ -1,24 +1,26 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
with pkgs;
let
cfg = config.hardware.pulseaudio;
+ systemWide = cfg.enable && cfg.systemWide;
+ nonSystemWide = cfg.enable && !cfg.systemWide;
+
uid = config.ids.uids.pulseaudio;
gid = config.ids.gids.pulseaudio;
- pulseRuntimePath = "/var/run/pulse";
+ stateDir = "/run/pulse";
# Create pulse/client.conf even if PulseAudio is disabled so
# that we can disable the autospawn feature in programs that
# are built with PulseAudio support (like KDE).
clientConf = writeText "client.conf" ''
- autospawn=${if (cfg.enable && !cfg.systemWide) then "yes" else "no"}
- ${optionalString (cfg.enable && !cfg.systemWide)
- "daemon-binary=${cfg.package}/bin/pulseaudio"}
+ autospawn=${if nonSystemWide then "yes" else "no"}
+ ${optionalString nonSystemWide "daemon-binary=${cfg.package}/bin/pulseaudio"}
'';
# Write an /etc/asound.conf that causes all ALSA applications to
@@ -68,7 +70,7 @@ in {
configFile = mkOption {
type = types.uniq types.path;
- default = "${pulseaudio}/etc/pulse/default.pa";
+ default = "${cfg.package}/etc/pulse/default.pa";
description = ''
The path to the configuration the PulseAudio server
should use. By default, the "default.pa" configuration
@@ -86,6 +88,17 @@ in {
default PulseAudio in Nixpkgs.
'';
};
+
+ daemon = {
+ logLevel = mkOption {
+ type = types.str;
+ default = "notice";
+ description = ''
+ The log level that the system-wide pulseaudio daemon should use,
+ if activated.
+ '';
+ };
+ };
};
};
@@ -111,21 +124,20 @@ in {
security.rtkit.enable = true;
})
- (mkIf (cfg.enable && !cfg.systemWide) {
+ (mkIf nonSystemWide {
environment.etc = singleton {
target = "pulse/default.pa";
source = cfg.configFile;
};
})
- (mkIf (cfg.enable && cfg.systemWide) {
+ (mkIf systemWide {
users.extraUsers.pulse = {
# For some reason, PulseAudio wants UID == GID.
uid = assert uid == gid; uid;
group = "pulse";
extraGroups = [ "audio" ];
description = "PulseAudio system service user";
- home = pulseRuntimePath;
};
users.extraGroups.pulse.gid = gid;
@@ -134,15 +146,15 @@ in {
description = "PulseAudio System-Wide Server";
wantedBy = [ "sound.target" ];
before = [ "sound.target" ];
- path = [ cfg.package ];
- environment.PULSE_RUNTIME_PATH = pulseRuntimePath;
+ environment.PULSE_RUNTIME_PATH = stateDir;
preStart = ''
- mkdir -p --mode 755 ${pulseRuntimePath}
- chown -R pulse:pulse ${pulseRuntimePath}
- '';
- script = ''
- exec pulseaudio --system -n --file="${cfg.configFile}"
+ mkdir -p --mode 755 ${stateDir}
+ chown -R pulse:pulse ${stateDir}
'';
+ serviceConfig = {
+ ExecStart = "${cfg.package}/bin/pulseaudio -D --log-level=${cfg.daemon.logLevel} --system --use-pid-file -n --file=${cfg.configFile}";
+ PIDFile = "${stateDir}/pid";
+ };
};
})
];
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index 0b4f75a3521..9e212847e48 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 65d7722abfa..ac1c32387c5 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;
{
@@ -106,6 +106,7 @@ with utils;
if [ ! -e "${sw.device}" ]; then
fallocate -l ${toString sw.size}M "${sw.device}" ||
dd if=/dev/zero of="${sw.device}" bs=1M count=${toString sw.size}
+ chmod 0600 ${sw.device}
mkswap ${sw.device}
fi
'';
diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix
index a910c699cc9..54236021919 100644
--- a/nixos/modules/config/sysctl.nix
+++ b/nixos/modules/config/sysctl.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -45,19 +45,8 @@ in
) 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
diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix
index 1913e17f929..2ea998bbb63 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
@@ -135,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 42fbe841d07..65703d8bb08 100644
--- a/nixos/modules/config/timezone.nix
+++ b/nixos/modules/config/timezone.nix
@@ -1,6 +1,12 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
+
+let
+
+ tzdir = "${pkgs.tzdata}/share/zoneinfo";
+
+in
{
options = {
@@ -26,8 +32,10 @@ with pkgs.lib;
environment.variables.TZDIR = "/etc/zoneinfo";
+ systemd.globalEnvironment.TZDIR = tzdir;
+
environment.etc.localtime =
- { source = "${pkgs.tzdata}/share/zoneinfo/${config.time.timeZone}";
+ { source = "${tzdir}/${config.time.timeZone}";
mode = "direct-symlink";
};
diff --git a/nixos/modules/config/unix-odbc-drivers.nix b/nixos/modules/config/unix-odbc-drivers.nix
index 0f608469058..b725e6cae73 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 c27a94a22d5..5de81a77342 100644
--- a/nixos/modules/config/users-groups.nix
+++ b/nixos/modules/config/users-groups.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -55,13 +55,27 @@ let
type = with types; nullOr int;
default = null;
description = ''
- The account UID. If the mutableUsers option
+ The account UID. If the 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).
'';
};
+ isSystemUser = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Indicates if the user is a system user or not. This option
+ only has an effect if is
+ true and is
+ , in which case it determines whether
+ the user's UID is allocated in the range for system users
+ (below 500) or in the range for normal users (starting at
+ 1000).
+ '';
+ };
+
group = mkOption {
type = types.str;
default = "nogroup";
@@ -360,8 +374,8 @@ in {
security.initialRootPassword = mkOption {
type = types.str;
- default = "";
- example = "!";
+ default = "!";
+ example = "";
description = ''
The (hashed) password for the root account set on initial
installation. The empty string denotes that root can login
@@ -369,9 +383,9 @@ in {
as SSH, or indirectly via su or
sudo). The string !
prevents root from logging in using a password.
- Note, setting this option sets
+ Note that setting this option sets
users.extraUsers.root.hashedPassword.
- Note, if users.mutableUsers is false
+ Also, if users.mutableUsers is false
you cannot change the root password manually, so in that case
the name of this option is a bit misleading, since it will define
the root password beyond the user initialisation phase.
@@ -459,17 +473,17 @@ in {
'';
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}" \
+ -G "${concatStringsSep "," u.extraGroups}" \
-s "${u.shell}" \
-d "${u.home}" \
+ ${optionalString u.isSystemUser "--system"} \
"${u.name}"
echo "${u.name}:x" | ${pkgs.shadow}/sbin/chpasswd -e
fi
@@ -495,7 +509,7 @@ in {
message = "uids and gids must be unique!";
}
{ assertion = cfg.mutableUsers || (nonUidUsers == {});
- message = "When mutableUsers is false, no uid can be null";
+ message = "When mutableUsers is false, no uid can be null: ${toString (attrNames nonUidUsers)}";
}
{ assertion = cfg.mutableUsers || (nonGidGroups == {});
message = "When mutableUsers is false, no gid can be null";
diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix
index 027dd827b4d..3820a95b12e 100644
--- a/nixos/modules/hardware/all-firmware.nix
+++ b/nixos/modules/hardware/all-firmware.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/hardware/cpu/amd-microcode.nix b/nixos/modules/hardware/cpu/amd-microcode.nix
index 5720a63834f..86a3df5da21 100644
--- a/nixos/modules/hardware/cpu/amd-microcode.nix
+++ b/nixos/modules/hardware/cpu/amd-microcode.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/hardware/cpu/intel-microcode.nix b/nixos/modules/hardware/cpu/intel-microcode.nix
index 9046ddf83bb..800c391b293 100644
--- a/nixos/modules/hardware/cpu/intel-microcode.nix
+++ b/nixos/modules/hardware/cpu/intel-microcode.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/hardware/network/b43.nix b/nixos/modules/hardware/network/b43.nix
index 03f81f92ef0..e63f2d04d1a 100644
--- a/nixos/modules/hardware/network/b43.nix
+++ b/nixos/modules/hardware/network/b43.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let kernelVersion = config.boot.kernelPackages.kernel.version; in
diff --git a/nixos/modules/hardware/opengl.nix b/nixos/modules/hardware/opengl.nix
index 603012cb109..096f7e2c097 100644
--- a/nixos/modules/hardware/opengl.nix
+++ b/nixos/modules/hardware/opengl.nix
@@ -1,14 +1,31 @@
-{ config, pkgs, pkgs_i686, ... }:
+{ config, lib, pkgs, pkgs_i686, ... }:
+
+with lib;
+
let
- inherit (pkgs.lib) mkOption types mkIf optional optionals elem optionalString optionalAttrs;
cfg = config.hardware.opengl;
kernelPackages = config.boot.kernelPackages;
-in {
+
+ videoDrivers = config.services.xserver.videoDrivers;
+
+ makePackage = p: p.buildEnv {
+ name = "mesa-drivers+txc-${p.mesa_drivers.version}";
+ paths =
+ [ p.mesa_drivers
+ p.mesa_noglu # mainly for libGL
+ (if cfg.s3tcSupport then p.libtxc_dxtn else p.libtxc_dxtn_s2tc)
+ p.udev
+ ];
+ };
+
+in
+
+{
options = {
hardware.opengl.enable = mkOption {
- description = "Whether this configuration requires opengl.";
+ description = "Whether this configuration requires OpenGL.";
type = types.bool;
default = false;
internal = true;
@@ -39,83 +56,70 @@ in {
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.
'';
};
-
- 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" ];
+ hardware.opengl.package = mkOption {
+ type = types.package;
+ internal = true;
description = ''
- The names of the opengl video drivers the configuration
- supports. They will be tried in order until one that
- supports your card is found.
+ The package that provides the OpenGL implementation.
'';
};
+
+ hardware.opengl.package32 = mkOption {
+ type = types.package;
+ internal = true;
+ description = ''
+ The package that provides the 32-bit OpenGL implementation on
+ 64-bit systems. Used when is
+ set.
+ '';
+ };
+
};
config = mkIf cfg.enable {
+
assertions = pkgs.lib.singleton {
assertion = cfg.driSupport32Bit -> pkgs.stdenv.isx86_64;
- message = "Option driSupport32Bit only makes sens on a 64-bit system.";
+ message = "Option driSupport32Bit only makes sense on a 64-bit system.";
};
- system.activationScripts.setup-opengl.deps = [];
- system.activationScripts.setup-opengl.text = ''
- rm -f /run/opengl-driver{,-32}
- ${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
- "ln -sf ${pkgs_i686.linuxPackages.nvidia_x11.override { libsOnly = true; kernel = null; } } /run/opengl-driver-32"}
- ''
- else if elem "nvidiaLegacy173" cfg.videoDrivers then
- "ln -sf ${kernelPackages.nvidia_x11_legacy173} /run/opengl-driver"
- else if elem "nvidiaLegacy304" cfg.videoDrivers then
- ''
- ln -sf ${kernelPackages.nvidia_x11_legacy304} /run/opengl-driver
- ${optionalString cfg.driSupport32Bit
- "ln -sf ${pkgs_i686.linuxPackages.nvidia_x11_legacy304.override { libsOnly = true; kernel = null; } } /run/opengl-driver-32"}
- ''
- else if elem "ati_unfree" cfg.videoDrivers then
- "ln -sf ${kernelPackages.ati_drivers_x11} /run/opengl-driver"
- else
- ''
- ${optionalString cfg.driSupport "ln -sf ${pkgs.mesa_drivers} /run/opengl-driver"}
- ${optionalString cfg.driSupport32Bit
- "ln -sf ${pkgs_i686.mesa_drivers} /run/opengl-driver-32"}
- ''
- );
+ system.activationScripts.setup-opengl =
+ ''
+ ln -sfn ${cfg.package} /run/opengl-driver
+ ${if pkgs.stdenv.isi686 then ''
+ ln -sfn opengl-driver /run/opengl-driver-32
+ '' else if cfg.driSupport32Bit then ''
+ ln -sfn ${cfg.package32} /run/opengl-driver-32
+ '' else ''
+ rm -f /run/opengl-driver-32
+ ''}
+ '';
environment.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" ];
+
+ # FIXME: move this into card-specific modules.
+ hardware.opengl.package = mkDefault
+ (if elem "ati_unfree" videoDrivers then
+ kernelPackages.ati_drivers_x11
+ else
+ makePackage pkgs);
+
+ hardware.opengl.package32 = mkDefault (makePackage pkgs_i686);
boot.extraModulePackages =
- optional (elem "nvidia" cfg.videoDrivers) kernelPackages.nvidia_x11 ++
- optional (elem "nvidiaLegacy173" cfg.videoDrivers) kernelPackages.nvidia_x11_legacy173 ++
- optional (elem "nvidiaLegacy304" cfg.videoDrivers) kernelPackages.nvidia_x11_legacy304 ++
- optional (elem "virtualbox" cfg.videoDrivers) kernelPackages.virtualboxGuestAdditions ++
- optional (elem "ati_unfree" cfg.videoDrivers) kernelPackages.ati_drivers_x11;
+ optional (elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions ++
+ optional (elem "ati_unfree" videoDrivers) kernelPackages.ati_drivers_x11;
- boot.blacklistedKernelModules =
- optionals (elem "nvidia" cfg.videoDrivers) [ "nouveau" "nvidiafb" ];
-
- environment.etc = (optionalAttrs (elem "ati_unfree" cfg.videoDrivers) {
+ environment.etc =
+ optionalAttrs (elem "ati_unfree" videoDrivers) {
"ati".source = "${kernelPackages.ati_drivers_x11}/etc/ati";
- })
- // (optionalAttrs (elem "nvidia" cfg.videoDrivers) {
- "OpenCL/vendors/nvidia.icd".source = "${kernelPackages.nvidia_x11}/lib/vendors/nvidia.icd";
- });
+ };
};
}
diff --git a/nixos/modules/hardware/pcmcia.nix b/nixos/modules/hardware/pcmcia.nix
index 20684656750..d7d002ae6c8 100644
--- a/nixos/modules/hardware/pcmcia.nix
+++ b/nixos/modules/hardware/pcmcia.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/hardware/video/bumblebee.nix b/nixos/modules/hardware/video/bumblebee.nix
index 504da2cde85..52dea798f87 100644
--- a/nixos/modules/hardware/video/bumblebee.nix
+++ b/nixos/modules/hardware/video/bumblebee.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
let kernel = config.boot.kernelPackages; in
-with pkgs.lib;
+with lib;
{
@@ -17,6 +17,12 @@ with pkgs.lib;
Only nvidia driver is supported so far.
'';
};
+ hardware.bumblebee.group = mkOption {
+ default = "wheel";
+ example = "video";
+ type = types.uniq types.str;
+ description = ''Group for bumblebee socket'';
+ };
};
config = mkIf config.hardware.bumblebee.enable {
@@ -29,13 +35,15 @@ with pkgs.lib;
systemd.services.bumblebeed = {
description = "Bumblebee Hybrid Graphics Switcher";
wantedBy = [ "display-manager.service" ];
- script = "bumblebeed --use-syslog";
+ script = "bumblebeed --use-syslog -g ${config.hardware.bumblebee.group}";
path = [ kernel.bbswitch pkgs.bumblebee ];
serviceConfig = {
Restart = "always";
RestartSec = 60;
CPUSchedulingPolicy = "idle";
};
+ environment.LD_LIBRARY_PATH="/run/opengl-driver/lib/";
+ environment.MODULE_DIR="/run/current-system/kernel-modules/lib/modules/";
};
};
}
diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix
new file mode 100644
index 00000000000..2b9221ec5d7
--- /dev/null
+++ b/nixos/modules/hardware/video/nvidia.nix
@@ -0,0 +1,54 @@
+# This module provides the proprietary NVIDIA X11 / OpenGL drivers.
+
+{ config, lib, pkgs, pkgs_i686, ... }:
+
+with lib;
+
+let
+
+ drivers = config.services.xserver.videoDrivers;
+
+ # FIXME: should introduce an option like
+ # ‘hardware.video.nvidia.package’ for overriding the default NVIDIA
+ # driver.
+ enabled = elem "nvidia" drivers || elem "nvidiaLegacy173" drivers || elem "nvidiaLegacy304" drivers;
+
+ nvidia_x11 =
+ if elem "nvidia" drivers then
+ config.boot.kernelPackages.nvidia_x11
+ else if elem "nvidiaLegacy173" drivers then
+ config.boot.kernelPackages.nvidia_x11_legacy173
+ else if elem "nvidiaLegacy304" drivers then
+ config.boot.kernelPackages.nvidia_x11_legacy304
+ else throw "impossible";
+
+in
+
+{
+
+ config = mkIf enabled {
+
+ services.xserver.drivers = singleton
+ { name = "nvidia"; modules = [ nvidia_x11 ]; libPath = [ nvidia_x11 ]; };
+
+ services.xserver.screenSection =
+ ''
+ Option "RandRRotation" "on"
+ '';
+
+ hardware.opengl.package = nvidia_x11;
+ hardware.opengl.package32 = pkgs_i686.linuxPackages.nvidia_x11.override { libsOnly = true; kernel = null; };
+
+ environment.systemPackages = [ nvidia_x11 ];
+
+ boot.extraModulePackages = [ nvidia_x11 ];
+
+ boot.blacklistedKernelModules = [ "nouveau" "nvidiafb" ];
+
+ services.acpid.enable = true;
+
+ environment.etc."OpenCL/vendors/nvidia.icd".source = "${nvidia_x11}/lib/vendors/nvidia.icd";
+
+ };
+
+}
diff --git a/nixos/modules/installer/cd-dvd/channel.nix b/nixos/modules/installer/cd-dvd/channel.nix
index 74428f66dfa..ca0e233f9e3 100644
--- a/nixos/modules/installer/cd-dvd/channel.nix
+++ b/nixos/modules/installer/cd-dvd/channel.nix
@@ -1,9 +1,9 @@
# Provide an initial copy of the NixOS channel so that the user
# doesn't need to run "nix-channel --update" first.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-base.nix
index 74a2f50f027..eb7c4026857 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 =
@@ -39,6 +39,9 @@ with pkgs.lib;
# Add Memtest86+ to the CD.
boot.loader.grub.memtest86.enable = true;
- # Get a console as soon as the initrd loads fbcon on EFI boot
+ # Get a console as soon as the initrd loads fbcon on EFI boot.
boot.initrd.kernelModules = [ "fbcon" ];
+
+ # Allow the user to log in as root without a password.
+ security.initialRootPassword = "";
}
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
index debf3e7db90..65aa1167089 100644
--- a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
+++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
@@ -1,9 +1,9 @@
# This module defines a NixOS installation CD that contains X11 and
# KDE 4.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
imports = [ ./installation-cd-base.nix ../../profiles/graphical.nix ];
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix
index 00a9e91c733..28c42d64f6f 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
@@ -67,7 +67,7 @@ let
${config.boot.kernelPackages.kernel}/bzImage ::boot/bzImage
mcopy -v -i "$out" \
${config.system.build.initialRamdisk}/initrd ::boot/initrd
- '';
+ ''; # */
targetArch = if pkgs.stdenv.isi686 then
"ia32"
@@ -177,39 +177,45 @@ in
# recognise that.
boot.kernelParams = [ "root=LABEL=${config.isoImage.volumeID}" ];
- # Note that /dev/root is a symlink to the actual root device
- # specified on the kernel command line, created in the stage 1 init
- # script.
- fileSystems."/".device = "/dev/root";
+ fileSystems."/" =
+ { fsType = "tmpfs";
+ device = "none";
+ options = "mode=0755";
+ };
- fileSystems."/nix/store" =
+ # Note that /dev/root is a symlink to the actual root device
+ # specified on the kernel command line, created in the stage 1
+ # init script.
+ fileSystems."/iso" =
+ { device = "/dev/root";
+ neededForBoot = true;
+ noCheck = true;
+ };
+
+ fileSystems."/nix/.ro-store" =
{ fsType = "squashfs";
- device = "/nix-store.squashfs";
+ device = "/iso/nix-store.squashfs";
options = "loop";
+ neededForBoot = true;
+ };
+
+ fileSystems."/nix/.rw-store" =
+ { fsType = "tmpfs";
+ device = "none";
+ options = "mode=0755";
+ neededForBoot = true;
};
boot.initrd.availableKernelModules = [ "squashfs" "iso9660" ];
boot.initrd.kernelModules = [ "loop" ];
- # In stage 1, mount a tmpfs on top of / (the ISO image) and
- # /nix/store (the squashfs image) to make this a live CD.
+ # In stage 1, mount a tmpfs on top of /nix/store (the squashfs
+ # image) to make this a live CD.
boot.initrd.postMountCommands =
''
- mkdir -p /unionfs-chroot/ro-root
- mount --rbind $targetRoot /unionfs-chroot/ro-root
-
- mkdir /unionfs-chroot/rw-root
- mount -t tmpfs -o "mode=755" none /unionfs-chroot/rw-root
- mkdir /mnt-root-union
- unionfs -o allow_other,cow,chroot=/unionfs-chroot,max_files=32768 /rw-root=RW:/ro-root=RO /mnt-root-union
- oldTargetRoot=$targetRoot
- targetRoot=/mnt-root-union
-
- mkdir /unionfs-chroot/rw-store
- mount -t tmpfs -o "mode=755" none /unionfs-chroot/rw-store
- mkdir -p $oldTargetRoot/nix/store
- unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768 /rw-store=RW:/ro-root/nix/store=RO /mnt-root-union/nix/store
+ mkdir -p $targetRoot/nix/store
+ unionfs -o allow_other,cow,nonempty,chroot=$targetRoot,max_files=32768 /nix/.rw-store=RW:/nix/.ro-store=RO $targetRoot/nix/store
'';
# Closures to be copied to the Nix store on the CD, namely the init
@@ -253,10 +259,6 @@ in
{ source = config.system.build.squashfsStore;
target = "/nix-store.squashfs";
}
- { # Quick hack: need a mount point for the store.
- source = pkgs.runCommand "empty" {} "mkdir -p $out";
- target = "/nix/store";
- }
] ++ optionals config.isoImage.makeEfiBootable [
{ source = efiImg;
target = "/boot/efi.img";
diff --git a/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix b/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
index 13ed95d4ceb..c274970c553 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 fcb96f7a24f..0357bf80196 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 c3ced849001..3626308bff8 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,7 +138,8 @@ in
};
# Setting vesa, we don't get the nvidia driver, which can't work in arm.
- hardware.opengl.videoDrivers = [ "vesa" ];
+ services.xserver.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 8d678fba71f..eaecbe1381f 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball.nix
@@ -2,9 +2,9 @@
# configuration. The derivation for the ISO image will be placed in
# config.system.build.tarball.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/installer/scan/detected.nix b/nixos/modules/installer/scan/detected.nix
index 09d04608e68..f350cd986af 100644
--- a/nixos/modules/installer/scan/detected.nix
+++ b/nixos/modules/installer/scan/detected.nix
@@ -1,8 +1,8 @@
# List all devices which are detected by nixos-hardware-scan.
# Common devices are enabled by default.
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
config = mkDefault {
diff --git a/nixos/modules/installer/scan/not-detected.nix b/nixos/modules/installer/scan/not-detected.nix
index 814858fdffd..b30c569ed2a 100644
--- a/nixos/modules/installer/scan/not-detected.nix
+++ b/nixos/modules/installer/scan/not-detected.nix
@@ -1,8 +1,8 @@
# List all devices which are _not_ detected by nixos-hardware-scan.
# Common devices are enabled by default.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
hardware.enableAllFirmware = true;
diff --git a/nixos/modules/installer/tools/get-version-suffix b/nixos/modules/installer/tools/get-version-suffix
index 461fbf4d3d8..b8972cd57d2 100644
--- a/nixos/modules/installer/tools/get-version-suffix
+++ b/nixos/modules/installer/tools/get-version-suffix
@@ -17,6 +17,6 @@ getVersion() {
if nixpkgs=$(nix-instantiate --find-file nixpkgs "$@"); then
getVersion $nixpkgs
if [ -n "$rev" ]; then
- echo "pre-$rev"
+ echo ".git.$rev"
fi
fi
diff --git a/nixos/modules/installer/tools/nixos-checkout.nix b/nixos/modules/installer/tools/nixos-checkout.nix
index 41899855686..3338e5119ac 100644
--- a/nixos/modules/installer/tools/nixos-checkout.nix
+++ b/nixos/modules/installer/tools/nixos-checkout.nix
@@ -1,9 +1,9 @@
# This module generates the nixos-checkout script, which replaces the
# Nixpkgs source trees in /etc/nixos/nixpkgs with a Git checkout.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index da1d2688277..ab058efc709 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -1,9 +1,11 @@
#! @perl@
+use Cwd 'abs_path';
use File::Spec;
use File::Path;
use File::Basename;
use File::Slurp;
+use File::stat;
sub uniq {
@@ -130,13 +132,14 @@ 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" ||
$device eq "0x4329" || $device eq "0x432a" || $device eq "0x432b" ||
$device eq "0x432c" || $device eq "0x432d" || $device eq "0x4353" ||
- $device eq "0x4357" || $device eq "0x4358" || $device eq "0x4359" ) )
+ $device eq "0x4357" || $device eq "0x4358" || $device eq "0x4359" ||
+ $device eq "0x4331" || $device eq "0x43a0" || $device eq "0x43b1"
+ ) )
{
push @modulePackages, "config.boot.kernelPackages.broadcom_sta";
push @kernelModules, "wl";
@@ -158,14 +161,14 @@ 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/;
+ #$videoDriver = "nvidia" if $vendor eq "0x10de" && $class =~ /^0x03/;
}
foreach my $path (glob "/sys/bus/pci/devices/*") {
pciCheck $path;
}
-push @attrs, "hardware.opengl.videoDrivers = [ \"$videoDriver\" ];" if $videoDriver;
+push @attrs, "services.xserver.videoDrivers = [ \"$videoDriver\" ];" if $videoDriver;
# Idem for USB devices.
@@ -218,22 +221,41 @@ foreach my $path (glob "/sys/class/block/*") {
}
-my $dmi = `@dmidecode@/sbin/dmidecode`;
+my $virt = `systemd-detect-virt`;
+chomp $virt;
# Check if we're a VirtualBox guest. If so, enable the guest
# additions.
-if ($dmi =~ /Manufacturer: innotek/) {
+if ($virt eq "oracle") {
push @attrs, "services.virtualbox.enable = true;"
}
# Likewise for QEMU.
-if ($dmi =~ /Manufacturer: Bochs/) {
+if ($virt eq "qemu" || $virt eq "kvm" || $virt eq "bochs") {
push @imports, "";
}
+# For a device name like /dev/sda1, find a more stable path like
+# /dev/disk/by-uuid/X or /dev/disk/by-label/Y.
+sub findStableDevPath {
+ my ($dev) = @_;
+ return $dev if substr($dev, 0, 1) ne "/";
+ return $dev unless -e $dev;
+
+ my $st = stat($dev) or return $dev;
+
+ foreach my $dev2 (glob("/dev/disk/by-uuid/*"), glob("/dev/mapper/*"), glob("/dev/disk/by-label/*")) {
+ my $st2 = stat($dev2) or next;
+ return $dev2 if $st->rdev == $st2->rdev;
+ }
+
+ return $dev;
+}
+
+
# Generate the swapDevices option from the currently activated swap
# devices.
my @swaps = read_file("/proc/swaps");
@@ -241,7 +263,9 @@ shift @swaps;
my @swapDevices;
foreach my $swap (@swaps) {
$swap =~ /^(\S+)\s/;
- push @swapDevices, "{ device = \"$1\"; }";
+ next unless -e $1;
+ my $dev = findStableDevPath $1;
+ push @swapDevices, "{ device = \"$dev\"; }";
}
@@ -267,6 +291,7 @@ foreach my $fs (read_file("/proc/self/mountinfo")) {
# Skip special filesystems.
next if in($mountPoint, "/proc") || in($mountPoint, "/dev") || in($mountPoint, "/sys") || in($mountPoint, "/run") || $mountPoint eq "/var/lib/nfs/rpc_pipefs";
+ next if $mountPoint eq "/var/setuid-wrappers";
# Skip the optional fields.
my $n = 6; $n++ while $fields[$n] ne "-"; $n++;
@@ -280,9 +305,11 @@ foreach my $fs (read_file("/proc/self/mountinfo")) {
# Maybe this is a bind-mount of a filesystem we saw earlier?
if (defined $fsByDev{$fields[2]}) {
my $path = $fields[3]; $path = "" if $path eq "/";
+ my $base = $fsByDev{$fields[2]};
+ $base = "" if $base eq "/";
$fileSystems .= <
-# * run the activation script of the configuration (also installs Grub)
+# * install the boot loader
+
+# Re-exec ourselves in a private mount namespace so that our bind
+# mounts get cleaned up automatically.
+if [ "$(id -u)" = 0 ]; then
+ if [ -z "$NIXOS_INSTALL_REEXEC" ]; then
+ export NIXOS_INSTALL_REEXEC=1
+ exec unshare --mount --uts -- "$0" "$@"
+ else
+ mount --make-rprivate /
+ fi
+fi
# Parse the command line for the -I flag
extraBuildFlags=()
+chrootCommand=(/run/current-system/sw/bin/bash)
while [ "$#" -gt 0 ]; do
i="$1"; shift 1
@@ -19,6 +30,14 @@ while [ "$#" -gt 0 ]; do
absolute_path=$(readlink -m $given_path)
extraBuildFlags+=("$i" "/mnt$absolute_path")
;;
+ --show-trace)
+ extraBuildFlags+=("$i")
+ ;;
+ --chroot)
+ runChroot=1
+ chrootCommand=("$@")
+ break
+ ;;
--help)
exec man nixos-install
exit 1
@@ -37,10 +56,6 @@ if test -z "$mountPoint"; then
mountPoint=/mnt
fi
-if test -z "$NIXOS_CONFIG"; then
- NIXOS_CONFIG=/etc/nixos/configuration.nix
-fi
-
if ! test -e "$mountPoint"; then
echo "mount point $mountPoint doesn't exist"
exit 1
@@ -51,53 +66,45 @@ if ! grep -F -q " $mountPoint " /proc/mounts; then
exit 1
fi
+
+# Mount some stuff in the target root directory.
+mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/etc $mountPoint/run $mountPoint/home
+mkdir -m 01777 -p $mountPoint/tmp
+mkdir -m 0755 -p $mountPoint/tmp/root
+mkdir -m 0755 -p $mountPoint/var/setuid-wrappers
+mount --rbind /dev $mountPoint/dev
+mount --rbind /proc $mountPoint/proc
+mount --rbind /sys $mountPoint/sys
+mount --rbind / $mountPoint/tmp/root
+mount -t tmpfs -o "mode=0755" none $mountPoint/run
+mount -t tmpfs -o "mode=0755" none $mountPoint/var/setuid-wrappers
+rm -rf $mountPoint/var/run
+ln -s /run $mountPoint/var/run
+rm -f $mountPoint/etc/{resolv.conf,hosts}
+cp -f /etc/resolv.conf /etc/hosts $mountPoint/etc/
+
+
+if [ -n "$runChroot" ]; then
+ if ! [ -L $mountPoint/nix/var/nix/profiles/system ]; then
+ echo "$0: installation not finished; cannot chroot into installation directory"
+ exit 1
+ fi
+ ln -s /nix/var/nix/profiles/system $mountPoint/run/current-system
+ exec chroot $mountPoint "${chrootCommand[@]}"
+fi
+
+
+# Get the path of the NixOS configuration file.
+if test -z "$NIXOS_CONFIG"; then
+ NIXOS_CONFIG=/etc/nixos/configuration.nix
+fi
+
if ! test -e "$mountPoint/$NIXOS_CONFIG"; then
echo "configuration file $mountPoint/$NIXOS_CONFIG doesn't exist"
exit 1
fi
-
-# Mount some stuff in the target root directory. We bind-mount /etc
-# into the chroot because we need networking and the nixbld user
-# accounts in /etc/passwd. But we do need the target's /etc/nixos.
-mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/mnt $mountPoint/mnt2 $mountPoint/mnt-nixpkgs $mountPoint/etc /etc/nixos
-mount --make-private / # systemd makes / shared, which is annoying
-mount --bind / $mountPoint/mnt
-mount --bind /nix $mountPoint/mnt/nix
-mount --bind /nix/store $mountPoint/mnt/nix/store
-mount --bind /dev $mountPoint/dev
-mount --bind /dev/shm $mountPoint/dev/shm
-mount --bind /proc $mountPoint/proc
-mount --bind /sys $mountPoint/sys
-mount --bind /sys/firmware/efi/efivars $mountPoint/sys/firmware/efi/efivars &>/dev/null || true
-mount --bind $mountPoint/etc/nixos $mountPoint/mnt2
-mount --bind /etc $mountPoint/etc
-mount --bind $mountPoint/mnt2 $mountPoint/etc/nixos
-
-cleanup() {
- set +e
- mountpoint -q $mountPoint/etc/nixos && umount $mountPoint/etc/nixos
- mountpoint -q $mountPoint/etc && umount $mountPoint/etc
- umount $mountPoint/mnt2
- umount $mountPoint/mnt-nixpkgs
- umount $mountPoint/sys/firmware/efi/efivars &>/dev/null || true
- umount $mountPoint/sys
- umount $mountPoint/proc
- umount $mountPoint/dev/shm
- umount $mountPoint/dev
- umount $mountPoint/mnt/nix/store
- umount $mountPoint/mnt/nix
- umount $mountPoint/mnt
- rmdir $mountPoint/mnt $mountPoint/mnt2 $mountPoint/mnt-nixpkgs
-}
-
-trap "cleanup" EXIT
-
-mkdir -m 01777 -p $mountPoint/tmp
-mkdir -m 0755 -p $mountPoint/var
-
-
# Create the necessary Nix directories on the target device, if they
# don't already exist.
mkdir -m 0755 -p \
@@ -110,25 +117,11 @@ mkdir -m 0755 -p \
$mountPoint/nix/var/log/nix/drvs
mkdir -m 1775 -p $mountPoint/nix/store
-build_users_group=$(@perl@/bin/perl -I @nix@/lib/perl5/site_perl/*/* -e 'use Nix::Config; Nix::Config::readConfig; print $Nix::Config::config{"build-users-group"};')
-if test -n "$build_users_group"; then
- chown root:"$build_users_group" $mountPoint/nix/store
-else
- chown root $mountPoint/nix/store
-fi
+chown root:nixbld $mountPoint/nix/store
-# Get the store paths to copy from the references graph.
-storePaths=$(@perl@/bin/perl @pathsFromGraph@ @nixClosure@)
-
-
-# Copy Nix to the Nix store on the target device.
-echo "copying Nix to $mountPoint...."
-for i in $storePaths; do
- echo " $i"
- chattr -R -i $mountPoint/$i 2> /dev/null || true # clear immutable bit
- rsync -a $i $mountPoint/nix/store/
-done
+# There is no daemon in the chroot.
+unset NIX_REMOTE
# We don't have locale-archive in the chroot, so clear $LANG.
@@ -137,28 +130,36 @@ export LC_ALL=
export LC_TIME=
-# There is no daemon in the chroot
-unset NIX_REMOTE
-
-
# Create a temporary Nix config file that causes the nixbld users to
# be used.
-if test -n "$build_users_group"; then
- echo "build-users-group = $build_users_group" > $mountPoint/tmp/nix.conf
-fi
+echo "build-users-group = nixbld" > $mountPoint/tmp/nix.conf # FIXME: remove in Nix 1.8
binary_caches=$(@perl@/bin/perl -I @nix@/lib/perl5/site_perl/*/* -e 'use Nix::Config; Nix::Config::readConfig; print $Nix::Config::config{"binary-caches"};')
if test -n "$binary_caches"; then
echo "binary-caches = $binary_caches" >> $mountPoint/tmp/nix.conf
fi
export NIX_CONF_DIR=/tmp
+touch $mountPoint/etc/passwd $mountPoint/etc/group
+mount --bind -o ro /etc/passwd $mountPoint/etc/passwd
+mount --bind -o ro /etc/group $mountPoint/etc/group
-# Register the paths in the Nix closure as valid. This is necessary
-# to prevent them from being deleted the first time we install
-# something. (I.e., Nix will see that, e.g., the glibc path is not
-# valid, delete it to get it out of the way, but as a result nothing
-# will work anymore.)
-chroot $mountPoint @nix@/bin/nix-store --register-validity < @nixClosure@
+
+# Copy Nix to the Nix store on the target device, unless it's already there.
+if ! NIX_DB_DIR=$mountPoint/nix/var/nix/db nix-store --check-validity @nix@ 2> /dev/null; then
+ echo "copying Nix to $mountPoint...."
+ for i in $(@perl@/bin/perl @pathsFromGraph@ @nixClosure@); do
+ echo " $i"
+ chattr -R -i $mountPoint/$i 2> /dev/null || true # clear immutable bit
+ rsync -a $i $mountPoint/nix/store/
+ done
+
+ # Register the paths in the Nix closure as valid. This is necessary
+ # to prevent them from being deleted the first time we install
+ # something. (I.e., Nix will see that, e.g., the glibc path is not
+ # valid, delete it to get it out of the way, but as a result nothing
+ # will work anymore.)
+ chroot $mountPoint @nix@/bin/nix-store --register-validity < @nixClosure@
+fi
# Create the required /bin/sh symlink; otherwise lots of things
@@ -168,15 +169,9 @@ mkdir -m 0755 -p $mountPoint/bin
ln -sf @shell@ $mountPoint/bin/sh
-if test -n "$NIXOS_PREPARE_CHROOT_ONLY"; then
- echo "User requested only to prepare chroot. Exiting."
- exit 0
-fi
-
-
# Make the build below copy paths from the CD if possible. Note that
-# /mnt in the chroot is the root of the CD.
-export NIX_OTHER_STORES=/mnt/nix:$NIX_OTHER_STORES
+# /tmp/root in the chroot is the root of the CD.
+export NIX_OTHER_STORES=/tmp/root/nix:$NIX_OTHER_STORES
p=@nix@/libexec/nix/substituters
export NIX_SUBSTITUTERS=$p/copy-from-other-stores.pl:$p/download-from-binary-cache.pl
@@ -191,15 +186,15 @@ done
# Get the absolute path to the NixOS/Nixpkgs sources.
-mount --bind $(readlink -f $(nix-instantiate --find-file nixpkgs)) $mountPoint/mnt-nixpkgs
+nixpkgs="$(readlink -f $(nix-instantiate --find-file nixpkgs))"
# Build the specified Nix expression in the target store and install
# it into the system configuration profile.
echo "building the system configuration..."
-NIX_PATH="nixpkgs=/mnt-nixpkgs:nixos=/mnt-nixpkgs/nixos:nixos-config=$NIXOS_CONFIG" NIXOS_CONFIG= \
+NIX_PATH="nixpkgs=/tmp/root/$nixpkgs:nixos-config=$NIXOS_CONFIG" NIXOS_CONFIG= \
chroot $mountPoint @nix@/bin/nix-env \
- "${extraBuildFlags[@]}" -p /nix/var/nix/profiles/system -f '' --set -A system --show-trace
+ "${extraBuildFlags[@]}" -p /nix/var/nix/profiles/system -f '' --set -A system
# Copy the NixOS/Nixpkgs sources to the target as the initial contents
@@ -217,10 +212,8 @@ mkdir -m 0700 -p $mountPoint/root/.nix-defexpr
ln -sfn /nix/var/nix/profiles/per-user/root/channels $mountPoint/root/.nix-defexpr/channels
-# We're done building/downloading, so we don't need the /etc bind
-# mount anymore. In fact, below we want to modify the target's /etc.
-umount $mountPoint/etc/nixos
-umount $mountPoint/etc
+# Get rid of the /etc bind mounts.
+umount $mountPoint/etc/passwd $mountPoint/etc/group
# Grub needs an mtab.
@@ -238,3 +231,17 @@ touch $mountPoint/etc/NIXOS
echo "finalising the installation..."
NIXOS_INSTALL_GRUB=1 chroot $mountPoint \
/nix/var/nix/profiles/system/bin/switch-to-configuration boot
+
+
+# Run the activation script.
+chroot $mountPoint /nix/var/nix/profiles/system/activate
+
+
+# Ask the user to set a root password.
+if [ -t 0 ] ; then
+ echo "setting root password..."
+ chroot $mountPoint passwd
+fi
+
+
+echo "installation finished!"
diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh
index 2a1c397553b..d7b749573fa 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
@@ -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 652bfa917df..5ebf05e340f 100644
--- a/nixos/modules/installer/tools/tools.nix
+++ b/nixos/modules/installer/tools/tools.nix
@@ -38,7 +38,6 @@ let
name = "nixos-generate-config";
src = ./nixos-generate-config.pl;
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
- inherit (pkgs) dmidecode;
};
nixos-option = makeProg {
@@ -80,9 +79,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 9ef41e47074..f68f8dc40aa 100644
--- a/nixos/modules/installer/virtualbox-demo.nix
+++ b/nixos/modules/installer/virtualbox-demo.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
imports =
@@ -15,5 +15,5 @@ with pkgs.lib;
# Add some more video drivers to give X11 a shot at working in
# VMware and QEMU.
- hardware.opengl.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" ];
+ services.xserver.videoDrivers = mkOverride 40 [ "virtualbox" "vmware" "cirrus" "vesa" ];
}
diff --git a/nixos/modules/misc/assertions.nix b/nixos/modules/misc/assertions.nix
index 5fb88308b77..c1be36e98cb 100644
--- a/nixos/modules/misc/assertions.nix
+++ b/nixos/modules/misc/assertions.nix
@@ -1,14 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
-
-let
-
- failed = map (x: x.message) (filter (x: !x.assertion) config.assertions);
-
- showWarnings = res: fold (w: x: builtins.trace "[1;31mwarning: ${w}[0m" x) res config.warnings;
-
-in
+with lib;
{
@@ -38,15 +30,5 @@ in
};
};
-
- config = {
-
- # This option is evaluated always. Thus the assertions are checked
- # as well. Hacky!
- environment.systemPackages = showWarnings (
- if [] == failed then []
- else throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failed)}");
-
- };
-
+ # impl of assertions is in
}
diff --git a/nixos/modules/misc/check-config.nix b/nixos/modules/misc/check-config.nix
index f759c88d3a1..e9803de2196 100644
--- a/nixos/modules/misc/check-config.nix
+++ b/nixos/modules/misc/check-config.nix
@@ -1,6 +1,6 @@
-{ pkgs, ... }:
+{ lib, ... }:
-with pkgs.lib;
+with lib;
{
options = {
diff --git a/nixos/modules/misc/crashdump.nix b/nixos/modules/misc/crashdump.nix
index 6e71baa9a43..d68f38bae2f 100644
--- a/nixos/modules/misc/crashdump.nix
+++ b/nixos/modules/misc/crashdump.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
crashdump = config.boot.crashDump;
diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix
index c6581fee551..db50a010e7d 100644
--- a/nixos/modules/misc/ids.nix
+++ b/nixos/modules/misc/ids.nix
@@ -52,13 +52,13 @@
osgi = 34;
tor = 35;
cups = 36;
- foldingAtHome = 37;
+ foldingathome = 37;
sabnzbd = 38;
kdm = 39;
- ghostOne = 40;
+ ghostone = 40;
git = 41;
- fourStore = 42;
- fourStoreEndpoint = 43;
+ fourstore = 42;
+ fourstorehttp = 43;
virtuoso = 44;
rtkit = 45;
dovecot2 = 46;
@@ -84,7 +84,7 @@
postgres = 71;
smbguest = 74;
varnish = 75;
- dd-agent = 76;
+ datadog = 76;
lighttpd = 77;
lightdm = 78;
freenet = 79;
@@ -129,8 +129,12 @@
foundationdb = 118;
newrelic = 119;
starbound = 120;
+ hydra = 122;
+ spiped = 123;
+ teamspeak = 124;
+ influxdb = 125;
- # When adding a uid, make sure it doesn't match an existing gid.
+ # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
nixbld = 30000; # start of range of uids
nobody = 65534;
@@ -171,8 +175,8 @@
osgi = 34;
ghostOne = 40;
git = 41;
- fourStore = 42;
- fourStoreEndpoint = 43;
+ fourstore = 42;
+ fourstorehttpd = 43;
virtuoso = 44;
dovecot2 = 46;
prayer = 49;
@@ -199,7 +203,7 @@
vboxsf = 73;
smbguest = 74;
varnish = 75;
- dd-agent = 76;
+ datadog = 76;
lighttpd = 77;
lightdm = 78;
freenet = 79;
@@ -232,8 +236,12 @@
newrelic = 119;
starbound = 120;
grsecurity = 121;
+ hydra = 122;
+ spiped = 123;
+ teamspeak = 124;
+ influxdb = 125;
- # When adding a gid, make sure it doesn't match an existing uid.
+ # When adding a gid, make sure it doesn't match an existing uid. And don't use gids above 399!
users = 100;
nixbld = 30000;
diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix
index b6408be5844..45da0df7967 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 7433fab168e..f41c8817ba4 100644
--- a/nixos/modules/misc/nixpkgs.nix
+++ b/nixos/modules/misc/nixpkgs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
isConfig = x:
@@ -62,8 +62,7 @@ in
type = types.str;
description = ''
Specifies the Nix platform type for which NixOS should be built.
- If unset, it defaults to the platform type of your host system
- (${builtins.currentSystem}).
+ If unset, it defaults to the platform type of your host system.
Specifying this option is useful when doing distributed
multi-platform deployment, or when building virtual machines.
'';
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix
index ae9fb5fb2a0..f4271cea853 100644
--- a/nixos/modules/misc/version.nix
+++ b/nixos/modules/misc/version.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -53,7 +53,7 @@ with pkgs.lib;
mkDefault (if pathExists fn then readFile fn else "master");
# Note: code names must only increase in alphabetical order.
- system.nixosCodeName = "Baboon";
+ system.nixosCodeName = "Caterpillar";
# Generate /etc/os-release. See
# http://0pointer.de/public/systemd-man/os-release.html for the
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index b2f530474b5..4ceb48989be 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -32,6 +32,7 @@
./hardware/opengl.nix
./hardware/pcmcia.nix
./hardware/video/bumblebee.nix
+ ./hardware/video/nvidia.nix
./installer/tools/nixos-checkout.nix
./installer/tools/tools.nix
./misc/assertions.nix
@@ -97,10 +98,20 @@
./services/databases/postgresql.nix
./services/databases/virtuoso.nix
./services/databases/monetdb.nix
+ ./services/databases/influxdb.nix
./services/desktops/accountservice.nix
+ ./services/desktops/geoclue2.nix
./services/desktops/gnome3/at-spi2-core.nix
./services/desktops/gnome3/evolution-data-server.nix
+ ./services/desktops/gnome3/gnome-documents.nix
+ ./services/desktops/gnome3/gnome-keyring.nix
+ ./services/desktops/gnome3/gnome-online-accounts.nix
+ ./services/desktops/gnome3/gnome-online-miners.nix
+ ./services/desktops/gnome3/gnome-user-share.nix
+ ./services/desktops/gnome3/gvfs.nix
+ ./services/desktops/gnome3/seahorse.nix
./services/desktops/gnome3/sushi.nix
+ ./services/desktops/gnome3/tracker.nix
./services/desktops/telepathy.nix
./services/games/ghost-one.nix
./services/games/minecraft-server.nix
@@ -112,7 +123,6 @@
./services/hardware/pommed.nix
./services/hardware/sane.nix
./services/hardware/udev.nix
- ./services/hardware/udisks.nix
./services/hardware/udisks2.nix
./services/hardware/upower.nix
./services/hardware/thinkfan.nix
@@ -128,7 +138,7 @@
./services/mail/opensmtpd.nix
./services/mail/postfix.nix
./services/mail/spamassassin.nix
- ./services/misc/autofs.nix
+ #./services/misc/autofs.nix
./services/misc/cgminer.nix
./services/misc/dictd.nix
./services/misc/disnix.nix
@@ -159,6 +169,7 @@
./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
@@ -207,10 +218,12 @@
./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/teamspeak3.nix
./services/networking/tftpd.nix
./services/networking/unbound.nix
./services/networking/vsftpd.nix
@@ -242,6 +255,7 @@
./services/ttys/agetty.nix
./services/ttys/kmscon.nix
./services/web-servers/apache-httpd/default.nix
+ ./services/web-servers/fcgiwrap.nix
./services/web-servers/jboss/default.nix
./services/web-servers/lighttpd/default.nix
./services/web-servers/lighttpd/cgit.nix
@@ -296,17 +310,20 @@
./tasks/filesystems.nix
./tasks/filesystems/btrfs.nix
./tasks/filesystems/ext.nix
+ ./tasks/filesystems/f2fs.nix
./tasks/filesystems/nfs.nix
./tasks/filesystems/reiserfs.nix
./tasks/filesystems/unionfs-fuse.nix
./tasks/filesystems/vfat.nix
./tasks/filesystems/xfs.nix
./tasks/filesystems/zfs.nix
+ ./tasks/encrypted-devices.nix
./tasks/kbd.nix
./tasks/lvm.nix
./tasks/network-interfaces.nix
./tasks/scsi-link-power-management.nix
./tasks/swraid.nix
+ ./tasks/trackpoint.nix
./testing/service-runner.nix
./virtualisation/container-config.nix
./virtualisation/containers.nix
diff --git a/nixos/modules/profiles/base.nix b/nixos/modules/profiles/base.nix
index 20b808c29e0..562419b3fac 100644
--- a/nixos/modules/profiles/base.nix
+++ b/nixos/modules/profiles/base.nix
@@ -34,6 +34,7 @@
pkgs.dosfstools
pkgs.xfsprogs
pkgs.jfsutils
+ pkgs.f2fs-tools
#pkgs.jfsrec # disabled because of Boost dependency
# Some compression/archiver tools.
@@ -50,6 +51,6 @@
];
# Include support for various filesystems.
- boot.supportedFilesystems = [ "btrfs" "reiserfs" "vfat" ];
+ boot.supportedFilesystems = [ "btrfs" "reiserfs" "vfat" "f2fs" ];
}
diff --git a/nixos/modules/profiles/clone-config.nix b/nixos/modules/profiles/clone-config.nix
index 04ee76d8d3e..f0d60bb6c42 100644
--- a/nixos/modules/profiles/clone-config.nix
+++ b/nixos/modules/profiles/clone-config.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, modules, ... }:
+{ config, lib, pkgs, modules, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/profiles/headless.nix b/nixos/modules/profiles/headless.nix
index 541c46ca50c..4be0fb44216 100644
--- a/nixos/modules/profiles/headless.nix
+++ b/nixos/modules/profiles/headless.nix
@@ -1,9 +1,9 @@
# Common configuration for headless machines (e.g., Amazon EC2
# instances).
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
sound.enable = false;
@@ -12,6 +12,8 @@ with pkgs.lib;
# Don't start a tty on the serial consoles.
systemd.services."serial-getty@ttyS0".enable = false;
systemd.services."serial-getty@hvc0".enable = false;
+ systemd.services."getty@tty1".enable = false;
+ systemd.services."autovt@".enable = false;
# Since we can't manually respond to a panic, just reboot.
boot.kernelParams = [ "panic=1" "boot.panic_on_fail" ];
diff --git a/nixos/modules/profiles/installation-device.nix b/nixos/modules/profiles/installation-device.nix
index 3b058c6e971..5aab2a2954e 100644
--- a/nixos/modules/profiles/installation-device.nix
+++ b/nixos/modules/profiles/installation-device.nix
@@ -1,7 +1,7 @@
# Provide a basic configuration for installation devices like CDs.
-{ config, pkgs, modules, ... }:
+{ config, lib, ... }:
-with pkgs.lib;
+with lib;
{
imports =
@@ -45,7 +45,7 @@ with pkgs.lib;
# Enable wpa_supplicant, but don't start it by default.
networking.wireless.enable = true;
- jobs.wpa_supplicant.startOn = pkgs.lib.mkOverride 50 "";
+ jobs.wpa_supplicant.startOn = mkOverride 50 "";
# Tell the Nix evaluator to garbage collect more aggressively.
# This is desirable in memory-constrained environments that don't
diff --git a/nixos/modules/profiles/minimal.nix b/nixos/modules/profiles/minimal.nix
index 821b9f93465..5067622aaf1 100644
--- a/nixos/modules/profiles/minimal.nix
+++ b/nixos/modules/profiles/minimal.nix
@@ -1,11 +1,8 @@
# This module defines a small NixOS configuration. It does not
# contain any graphical stuff.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
{
- # Don't include X libraries.
- programs.ssh.setXAuthLocation = false;
- fonts.enableFontConfig = false;
- fonts.enableCoreFonts = false;
+ environment.noXlibs = true;
}
diff --git a/nixos/modules/profiles/qemu-guest.nix b/nixos/modules/profiles/qemu-guest.nix
index 0a92b7ace50..79890aa7f17 100644
--- a/nixos/modules/profiles/qemu-guest.nix
+++ b/nixos/modules/profiles/qemu-guest.nix
@@ -5,7 +5,7 @@
{
boot.initrd.availableKernelModules = [ "virtio_net" "virtio_pci" "virtio_blk" "9p" "9pnet_virtio" ];
- boot.initrd.kernelModules = [ "virtio_balloon" "virtio_console" ];
+ boot.initrd.kernelModules = [ "virtio_balloon" "virtio_console" "virtio_rng" ];
boot.initrd.postDeviceCommands =
''
diff --git a/nixos/modules/programs/atop.nix b/nixos/modules/programs/atop.nix
index 7fdaab9d67d..e457db22333 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 9d33e26c495..c5c0f9d0121 100644
--- a/nixos/modules/programs/bash/bash.nix
+++ b/nixos/modules/programs/bash/bash.nix
@@ -1,9 +1,9 @@
# This module defines global configuration for the Bash shell, in
# particular /etc/bashrc and /etc/profile.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -40,6 +40,7 @@ in
programs.bash = {
+ /*
enable = mkOption {
default = true;
description = ''
@@ -52,6 +53,7 @@ in
'';
type = types.bool;
};
+ */
shellAliases = mkOption {
default = config.environment.shellAliases // { which = "type -P"; };
@@ -114,7 +116,7 @@ in
};
- config = mkIf cfg.enable {
+ config = /* mkIf cfg.enable */ {
programs.bash = {
diff --git a/nixos/modules/programs/bash/command-not-found.nix b/nixos/modules/programs/bash/command-not-found.nix
index 502320446a3..8c86d48b080 100644
--- a/nixos/modules/programs/bash/command-not-found.nix
+++ b/nixos/modules/programs/bash/command-not-found.nix
@@ -3,9 +3,9 @@
# SQLite database that maps program names to Nix package names (e.g.,
# "pdflatex" is mapped to "tetex").
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/programs/environment.nix b/nixos/modules/programs/environment.nix
index 489a7a4d269..aa9aec07834 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"
diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix
index 15b083b72d2..27a18c726a3 100644
--- a/nixos/modules/programs/shadow.nix
+++ b/nixos/modules/programs/shadow.nix
@@ -1,8 +1,8 @@
# Configuration for the pwdutils suite of tools: passwd, useradd, etc.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -10,12 +10,12 @@ let
''
DEFAULT_HOME yes
- SYS_UID_MIN 100
+ SYS_UID_MIN 400
SYS_UID_MAX 499
UID_MIN 1000
UID_MAX 29999
- SYS_GID_MIN 100
+ SYS_GID_MIN 400
SYS_GID_MAX 499
GID_MIN 1000
GID_MAX 29999
diff --git a/nixos/modules/programs/shell.nix b/nixos/modules/programs/shell.nix
index 226105a0c97..80d40a7c708 100644
--- a/nixos/modules/programs/shell.nix
+++ b/nixos/modules/programs/shell.nix
@@ -1,8 +1,8 @@
# This module defines a standard configuration for NixOS shells.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix
index 89333533465..fdb9dfd4b8c 100644
--- a/nixos/modules/programs/ssh.nix
+++ b/nixos/modules/programs/ssh.nix
@@ -1,8 +1,8 @@
# Global configuration for the SSH client.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.programs.ssh;
cfgd = config.services.openssh;
@@ -47,7 +47,20 @@ in
for help.
'';
};
+
+ startAgent = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Whether to start the OpenSSH agent when you log in. The OpenSSH agent
+ remembers private keys for you so that you don't have to type in
+ passphrases every time you make an SSH connection. Use
+ ssh-add to add a key to the agent.
+ '';
+ };
+
};
+
};
config = {
@@ -71,5 +84,28 @@ in
target = "ssh/ssh_config";
}
];
+
+ # FIXME: this should really be socket-activated for über-awesomeness.
+ systemd.user.services.ssh-agent =
+ { enable = cfg.startAgent;
+ description = "SSH Agent";
+ wantedBy = [ "default.target" ];
+ serviceConfig =
+ { ExecStartPre = "${pkgs.coreutils}/bin/rm -f %t/ssh-agent";
+ ExecStart = "${pkgs.openssh}/bin/ssh-agent -a %t/ssh-agent";
+ StandardOutput = "null";
+ Type = "forking";
+ Restart = "on-failure";
+ SuccessExitStatus = "0 2";
+ };
+ };
+
+ environment.extraInit = optionalString cfg.startAgent
+ ''
+ if [ -z "$SSH_AUTH_SOCK" -a -n "$XDG_RUNTIME_DIR" ]; then
+ export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent"
+ fi
+ '';
+
};
}
diff --git a/nixos/modules/programs/ssmtp.nix b/nixos/modules/programs/ssmtp.nix
index 904989d57a0..34eafd4fa84 100644
--- a/nixos/modules/programs/ssmtp.nix
+++ b/nixos/modules/programs/ssmtp.nix
@@ -3,9 +3,9 @@
# directly to an SMTP server defined in its configuration file, wihout
# queueing mail locally.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/programs/venus.nix b/nixos/modules/programs/venus.nix
index 7ab653dd19f..2b70a795f4f 100644
--- a/nixos/modules/programs/venus.nix
+++ b/nixos/modules/programs/venus.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.venus;
diff --git a/nixos/modules/programs/virtualbox.nix b/nixos/modules/programs/virtualbox.nix
index 340fec0496a..10e657abd3c 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 da3f7dce98a..8e7d0e51a4e 100644
--- a/nixos/modules/programs/wvdial.nix
+++ b/nixos/modules/programs/wvdial.nix
@@ -1,8 +1,8 @@
# Global configuration for wvdial.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix
index 69a56ff69a0..1857371ebe8 100644
--- a/nixos/modules/programs/zsh/zsh.nix
+++ b/nixos/modules/programs/zsh/zsh.nix
@@ -1,8 +1,8 @@
# This module defines global configuration for the zshell.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -26,11 +26,6 @@ in
default = false;
description = ''
Whenever to configure Zsh as an interactive shell.
- Note that this tries to make Zsh the default
- ,
- which in turn means that you might need to explicitly
- set this variable if you have another shell configured
- with NixOS.
'';
type = types.bool;
};
@@ -168,7 +163,7 @@ in
environment.systemPackages = [ pkgs.zsh ];
- users.defaultUserShell = mkDefault "/run/current-system/sw/bin/zsh";
+ #users.defaultUserShell = mkDefault "/run/current-system/sw/bin/zsh";
environment.shells =
[ "/run/current-system/sw/bin/zsh"
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index 72093aab5cd..0ee2caa28ea 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, options, ... }:
+{ config, lib, options, ... }:
-with pkgs.lib;
+with lib;
let
@@ -17,7 +17,7 @@ let
inherit from to;
name = "Obsolete name";
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;
+ define = x: builtins.trace "Obsolete option `${showOption from}' is used. It was renamed to `${showOption to}'." x;
};
# abort if deprecated option is used
@@ -25,7 +25,7 @@ let
inherit from to;
name = "Deprecated name";
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}'.";
+ define = x: abort "Deprecated option `${showOption from}' is used. It was renamed to `${showOption to}'.";
};
showOption = concatStringsSep ".";
@@ -74,6 +74,7 @@ in zipModules ([]
++ obsolete [ "environment" "x11Packages" ] [ "environment" "systemPackages" ]
++ obsolete [ "environment" "enableBashCompletion" ] [ "programs" "bash" "enableCompletion" ]
++ obsolete [ "environment" "nix" ] [ "nix" "package" ]
+++ obsolete [ "fonts" "extraFonts" ] [ "fonts" "fonts" ]
++ obsolete [ "security" "extraSetuidPrograms" ] [ "security" "setuidPrograms" ]
++ obsolete [ "networking" "enableWLAN" ] [ "networking" "wireless" "enable" ]
@@ -103,6 +104,7 @@ 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
@@ -119,12 +121,13 @@ in zipModules ([]
++ 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 [ "hardware" "opengl" "videoDrivers" ] [ "services" "xserver" "videoDrivers" ]
++ obsolete [ "services" "mysql55" ] [ "services" "mysql" ]
# Options that are obsolete and have no replacement.
++ obsolete' [ "boot" "loader" "grub" "bootDevice" ]
++ obsolete' [ "boot" "initrd" "luks" "enable" ]
+++ obsolete' [ "programs" "bash" "enable" ]
)
diff --git a/nixos/modules/security/apparmor-suid.nix b/nixos/modules/security/apparmor-suid.nix
index bc661164fdc..b89b379ae66 100644
--- a/nixos/modules/security/apparmor-suid.nix
+++ b/nixos/modules/security/apparmor-suid.nix
@@ -1,8 +1,8 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
let
cfg = config.security.apparmor;
in
-with pkgs.lib;
+with lib;
{
options.security.apparmor.confineSUIDApplications = mkOption {
diff --git a/nixos/modules/security/apparmor.nix b/nixos/modules/security/apparmor.nix
index b9f15159002..f29e7a5ad81 100644
--- a/nixos/modules/security/apparmor.nix
+++ b/nixos/modules/security/apparmor.nix
@@ -1,55 +1,32 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
+
+with lib;
let
cfg = config.security.apparmor;
in
-
-with pkgs.lib;
-
{
-
- ###### interface
-
options = {
-
security.apparmor = {
-
enable = mkOption {
type = types.bool;
default = false;
- description = ''
- Enable AppArmor application security system. Enable only if
- you want to further improve AppArmor.
- '';
+ description = "Enable the AppArmor Mandatory Access Control system.";
};
profiles = mkOption {
type = types.listOf types.path;
default = [];
- description = ''
- List of file names of AppArmor profiles.
- '';
+ description = "List of files containing AppArmor profiles.";
};
-
};
};
-
- ###### implementation
-
- config = mkIf (cfg.enable) {
-
- assertions = [ { assertion = config.boot.kernelPackages.kernel.features ? apparmor
- && config.boot.kernelPackages.kernel.features.apparmor;
- message = "AppArmor is enabled, but the kernel doesn't have AppArmor support"; }
- ];
-
+ config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.apparmor ];
-
systemd.services.apparmor = {
- #wantedBy = [ "basic.target" ];
wantedBy = [ "local-fs.target" ];
- path = [ pkgs.apparmor ];
+ path = [ pkgs.apparmor ];
serviceConfig = {
Type = "oneshot";
@@ -61,9 +38,6 @@ with pkgs.lib;
''${pkgs.apparmor}/sbin/apparmor_parser -Rv -I ${pkgs.apparmor}/etc/apparmor.d/ "${profile}" ; ''
) cfg.profiles;
};
-
};
-
};
-
}
diff --git a/nixos/modules/security/ca.nix b/nixos/modules/security/ca.nix
index 05cd1c3ecc1..f159e359f96 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;
{
diff --git a/nixos/modules/security/duosec.nix b/nixos/modules/security/duosec.nix
index 989bd13d101..9893e63fb24 100644
--- a/nixos/modules/security/duosec.nix
+++ b/nixos/modules/security/duosec.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.security.duosec;
@@ -165,6 +165,17 @@ in
whitelist.
'';
};
+
+ allowTcpForwarding = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ By default, when SSH forwarding, enabling Duo Security will
+ disable TCP forwarding. By enabling this, you potentially
+ undermine some of the SSH based login security. Note this is
+ not needed if you use PAM.
+ '';
+ };
};
};
@@ -192,7 +203,9 @@ in
# Duo Security configuration
ForceCommand ${config.security.wrapperDir}/login_duo
PermitTunnel no
- AllowTcpForwarding no
+ ${optionalString (!cfg.allowTcpForwarding) ''
+ AllowTcpForwarding no
+ ''}
'');
};
}
diff --git a/nixos/modules/security/grsecurity.nix b/nixos/modules/security/grsecurity.nix
index 913a0afc452..f4af04247fe 100644
--- a/nixos/modules/security/grsecurity.nix
+++ b/nixos/modules/security/grsecurity.nix
@@ -1,132 +1,17 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+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}
- ''
+ customGrsecPkg =
+ (import ../../../pkgs/build-support/grsecurity
+ {
+ inherit lib pkgs;
+ grsecOptions = cfg;
}
-
- 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);
+ ).grsecPackage;
in
{
options = {
@@ -434,9 +319,9 @@ in
chmod -R 0600 /etc/grsec
'';
- # Enable apparmor support, gradm udev rules, and utilities
+ # Enable AppArmor, gradm udev rules, and utilities
security.apparmor.enable = true;
- boot.kernelPackages = grsecPackage;
+ boot.kernelPackages = customGrsecPkg;
services.udev.packages = [ pkgs.gradm ];
environment.systemPackages = [ pkgs.gradm pkgs.paxctl pkgs.pax-utils ];
};
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index 93d12d292e4..6a5eb4c720f 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 4cc99995fbc..11708a1f016 100644
--- a/nixos/modules/security/pam_usb.nix
+++ b/nixos/modules/security/pam_usb.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/security/polkit.nix b/nixos/modules/security/polkit.nix
index dbec4ad98d1..95b659d96f0 100644
--- a/nixos/modules/security/polkit.nix
+++ b/nixos/modules/security/polkit.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -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" ];
@@ -95,10 +98,6 @@ in
''
# Probably no more needed, clean up
rm -rf /var/lib/{polkit-1,PolicyKit}
-
- # Force polkitd to be restarted so that it reloads its
- # configuration.
- ${pkgs.procps}/bin/pkill -INT -u root -x polkitd
'';
users.extraUsers.polkituser = {
diff --git a/nixos/modules/security/prey.nix b/nixos/modules/security/prey.nix
index 75b95d5fbb0..e29fa5395a1 100644
--- a/nixos/modules/security/prey.nix
+++ b/nixos/modules/security/prey.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.prey;
diff --git a/nixos/modules/security/rngd.nix b/nixos/modules/security/rngd.nix
index 720ac02f2e8..c31e57e6f6f 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 164ad9b3aa7..afe93f24273 100644
--- a/nixos/modules/security/rtkit.nix
+++ b/nixos/modules/security/rtkit.nix
@@ -1,9 +1,9 @@
# A module for ‘rtkit’, a DBus system service that hands out realtime
# scheduling priority to processes that ask for it.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -25,8 +25,13 @@ with pkgs.lib;
config = mkIf config.security.rtkit.enable {
+ security.polkit.enable = true;
+
+ # To make polkit pickup rtkit policies
environment.systemPackages = [ pkgs.rtkit ];
+ systemd.packages = [ pkgs.rtkit ];
+
services.dbus.packages = [ pkgs.rtkit ];
users.extraUsers = singleton
diff --git a/nixos/modules/security/setuid-wrapper.c b/nixos/modules/security/setuid-wrapper.c
index 007ffbc34fe..ffd0b65b762 100644
--- a/nixos/modules/security/setuid-wrapper.c
+++ b/nixos/modules/security/setuid-wrapper.c
@@ -30,8 +30,8 @@ int main(int argc, char * * argv)
creating hard link `X' from some other location, along with a
false `X.real' file, to allow arbitrary programs from being
executed setuid. */
- assert ((strncmp(self, wrapperDir, sizeof(wrapperDir)) == 0) &&
- (self[strlen(wrapperDir)] == '/'));
+ assert ((strncmp(self, wrapperDir, strlen(wrapperDir)) == 0) &&
+ (self[strlen(wrapperDir)] == '/'));
/* Make *really* *really* sure that we were executed as `self',
and not, say, as some other setuid program. That is, our
@@ -42,12 +42,12 @@ int main(int argc, char * * argv)
assert (lstat(self, &st) != -1);
//printf("%d %d\n", st.st_uid, st.st_gid);
-
+
assert ((st.st_mode & S_ISUID) == 0 ||
- (st.st_uid == geteuid()));
+ (st.st_uid == geteuid()));
assert ((st.st_mode & S_ISGID) == 0 ||
- st.st_gid == getegid());
+ st.st_gid == getegid());
/* And, of course, we shouldn't be writable. */
assert (!(st.st_mode & (S_IWGRP | S_IWOTH)));
@@ -69,13 +69,13 @@ int main(int argc, char * * argv)
real[len] = 0;
close(fdSelf);
-
+
//printf("real = %s, len = %d\n", real, len);
execve(real, argv, environ);
fprintf(stderr, "%s: cannot run `%s': %s\n",
argv[0], real, strerror(errno));
-
+
exit(1);
}
diff --git a/nixos/modules/security/setuid-wrappers.nix b/nixos/modules/security/setuid-wrappers.nix
index 62df85816e5..4cdc1023baa 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 215a8ecd601..6cfeac0d7dc 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
@@ -62,6 +62,7 @@ in
Defaults:root,%wheel env_keep+=NIX_CONF_DIR
Defaults:root,%wheel env_keep+=NIX_PATH
Defaults:root,%wheel env_keep+=TERMINFO_DIRS
+ Defaults:root,%wheel env_keep+=TERMINFO
# Keep SSH_AUTH_SOCK so that pam_ssh_agent_auth.so can do its magic.
Defaults env_keep+=SSH_AUTH_SOCK
diff --git a/nixos/modules/services/amqp/activemq/default.nix b/nixos/modules/services/amqp/activemq/default.nix
index 915d179e699..f1f3d005f30 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 dc1a68aefbb..bef15fb64b7 100644
--- a/nixos/modules/services/amqp/rabbitmq.nix
+++ b/nixos/modules/services/amqp/rabbitmq.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.rabbitmq;
diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix
index c9a2ef4589b..653c0ed5d70 100644
--- a/nixos/modules/services/audio/alsa.nix
+++ b/nixos/modules/services/audio/alsa.nix
@@ -1,14 +1,12 @@
# ALSA sound support.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
inherit (pkgs) alsaUtils;
- soundState = "/var/lib/alsa/asound.state";
-
in
{
@@ -35,6 +33,17 @@ in
'';
};
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ example = ''
+ defaults.pcm.!card 3
+ '';
+ description = ''
+ Set addition configuration for system-wide alsa.
+ '';
+ };
+
};
};
@@ -46,6 +55,13 @@ in
environment.systemPackages = [ alsaUtils ];
+ environment.etc = mkIf (config.sound.extraConfig != "")
+ [
+ { source = pkgs.writeText "asound.conf" config.sound.extraConfig;
+ target = "asound.conf";
+ }
+ ];
+
# ALSA provides a udev rule for restoring volume settings.
services.udev.packages = [ alsaUtils ];
diff --git a/nixos/modules/services/audio/fuppes.nix b/nixos/modules/services/audio/fuppes.nix
index 3eb0732bae2..4a975ed5f53 100644
--- a/nixos/modules/services/audio/fuppes.nix
+++ b/nixos/modules/services/audio/fuppes.nix
@@ -1,10 +1,10 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.fuppesd;
in
-with pkgs.lib;
+with lib;
{
options = {
diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix
index a9880dee20c..1b50f06bf30 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 8fdcdd6c7be..5ce215c5c4b 100644
--- a/nixos/modules/services/backup/almir.nix
+++ b/nixos/modules/services/backup/almir.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.almir;
diff --git a/nixos/modules/services/backup/bacula.nix b/nixos/modules/services/backup/bacula.nix
index 272903c99e3..c2255f68818 100644
--- a/nixos/modules/services/backup/bacula.nix
+++ b/nixos/modules/services/backup/bacula.nix
@@ -1,9 +1,9 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
# TODO: test configuration when building nixexpr (use -t parameter)
# TODO: support sqlite3 (it's deprecate?) and mysql
-with pkgs.lib;
+with lib;
let
libDir = "/var/lib/bacula";
diff --git a/nixos/modules/services/backup/mysql-backup.nix b/nixos/modules/services/backup/mysql-backup.nix
index 3ff9978fbb9..28f607861f7 100644
--- a/nixos/modules/services/backup/mysql-backup.nix
+++ b/nixos/modules/services/backup/mysql-backup.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/backup/postgresql-backup.nix b/nixos/modules/services/backup/postgresql-backup.nix
index e68ad794a96..1f7b123eca3 100644
--- a/nixos/modules/services/backup/postgresql-backup.nix
+++ b/nixos/modules/services/backup/postgresql-backup.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
inherit (pkgs) postgresql gzip;
diff --git a/nixos/modules/services/backup/rsnapshot.nix b/nixos/modules/services/backup/rsnapshot.nix
index 178ba3ec720..48ad7582b7e 100644
--- a/nixos/modules/services/backup/rsnapshot.nix
+++ b/nixos/modules/services/backup/rsnapshot.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.rsnapshot;
in
diff --git a/nixos/modules/services/backup/sitecopy-backup.nix b/nixos/modules/services/backup/sitecopy-backup.nix
index 5c7f7ffae5b..5d3675fa3e9 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
index ac8f008069a..1b0bcadca15 100644
--- a/nixos/modules/services/backup/tarsnap.nix
+++ b/nixos/modules/services/backup/tarsnap.nix
@@ -1,15 +1,15 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+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}
+ configFile = cfg: ''
+ cachedir ${config.services.tarsnap.cachedir}
+ keyfile ${config.services.tarsnap.keyfile}
${optionalString cfg.nodump "nodump"}
${optionalString cfg.printStats "print-stats"}
${optionalNullStr cfg.checkpointBytes "checkpoint-bytes "+cfg.checkpointBytes}
@@ -39,15 +39,15 @@ in
'';
};
- label = mkOption {
- type = types.str;
- default = "nixos";
+ keyfile = mkOption {
+ type = types.path;
+ default = "/root/tarsnap.key";
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.
+ 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.
'';
};
@@ -55,122 +55,158 @@ in
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.
+ 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.
+ config = mkOption {
+ type = types.attrsOf (types.submodule (
+ {
+ options = {
+ nodump = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ If set to true, then don't
+ archive files which have the
+ nodump flag set.
+ '';
+ };
+
+ printStats = mkOption {
+ type = types.bool;
+ default = true;
+ description = "Print statistics when creating archives.";
+ };
+
+ checkpointBytes = mkOption {
+ type = types.nullOr types.str;
+ default = "1G";
+ description = ''
+ Create a checkpoint per a particular amount of
+ uploaded data. By default, Tarsnap will create
+ checkpoints once per GB of data uploaded. At
+ minimum, checkpointBytes must be
+ 1GB.
+
+ Can also be set to null to
+ disable checkpointing.
+ '';
+ };
+
+ period = mkOption {
+ type = types.str;
+ default = "15 01 * * *";
+ description = ''
+ This option defines (in the format used by cron)
+ when tarsnap is run for backups. The default is to
+ backup the specified paths at 01:15 at night every
+ day.
+ '';
+ };
+
+ aggressiveNetworking = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Aggressive network behaviour: Use multiple TCP
+ connections when writing archives. Use of this
+ option is recommended only in cases where TCP
+ congestion control is known to be the limiting
+ factor in upload performance.
+ '';
+ };
+
+ directories = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = "List of filesystem paths to archive.";
+ };
+
+ excludes = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Exclude files and directories matching the specified
+ patterns.
+ '';
+ };
+
+ includes = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Include only files and directories matching the
+ specified patterns.
+
+ Note that exclusions specified via
+ excludes take precedence over
+ inclusions.
+ '';
+ };
+
+ lowmem = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Attempt to reduce tarsnap memory consumption. This
+ option will slow down the process of creating
+ archives, but may help on systems where the average
+ size of files being backed up is less than 1 MB.
+ '';
+ };
+
+ verylowmem = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Try even harder to reduce tarsnap memory
+ consumption. This can significantly slow down
+ tarsnap, but reduces its memory usage by an
+ additional factor of 2 beyond what the
+ lowmem option does.
+ '';
+ };
+ };
+ }
+ ));
+
+ default = {};
+
+ example = literalExample ''
+ {
+ nixos =
+ { directories = [ "/home" "/root/ssl" ];
+ };
+
+ gamedata =
+ { directories = [ "/var/lib/minecraft "];
+ period = "*/30 * * * *";
+ };
+ }
'';
- };
- 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.
+ Configuration of a Tarsnap archive. In the example, your
+ machine will have two tarsnap archives:
+ gamedata (backed up every 30 minutes) and
+ nixos (backed up at 1:15 AM every night by
+ default). You can control individual archive backups using
+ systemctl, using the
+ tarsnap@nixos or
+ tarsnap@gamedata units. For example,
+ systemctl start tarsnap@nixos will
+ immediately create a new NixOS archive. By default, archives
+ are suffixed with the timestamp of when they were started,
+ down to second resolution. This means you can use GNU
+ sort to sort output easily.
'';
};
};
@@ -178,26 +214,40 @@ in
config = mkIf cfg.enable {
assertions =
- [ { assertion = cfg.directories != [];
+ (mapAttrsToList (name: cfg:
+ { assertion = cfg.directories != [];
message = "Must specify directories for Tarsnap to back up";
- }
+ }) cfg.config) ++
+ (mapAttrsToList (name: cfg:
{ assertion = cfg.lowmem -> !cfg.verylowmem && (cfg.verylowmem -> !cfg.lowmem);
message = "You cannot set both lowmem and verylowmem";
- }
- ];
+ }) cfg.config);
+
+ systemd.services."tarsnap@" = {
+ description = "Tarsnap Backup of '%i'";
+ requires = [ "network.target" ];
- systemd.services.tarsnap-backup = {
- description = "Tarsnap Backup process";
path = [ pkgs.tarsnap pkgs.coreutils ];
+ scriptArgs = "%i";
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}
+ DIRS=`cat /etc/tarsnap/$1.dirs`
+ exec tarsnap --configfile /etc/tarsnap/$1.conf -c -f $1-$(date +"%Y%m%d%H%M%S") $DIRS
'';
};
- services.cron.systemCronJobs = optional cfg.enable
- "${cfg.period} root ${config.systemd.package}/bin/systemctl start tarsnap-backup.service";
+ services.cron.systemCronJobs = mapAttrsToList (name: cfg:
+ "${cfg.period} root ${config.systemd.package}/bin/systemctl start tarsnap@${name}"
+ ) cfg.config;
+
+ environment.etc =
+ (mapAttrs' (name: cfg: nameValuePair "tarsnap/${name}.conf"
+ { text = configFile cfg;
+ }) cfg.config) //
+ (mapAttrs' (name: cfg: nameValuePair "tarsnap/${name}.dirs"
+ { text = concatStringsSep " " cfg.directories;
+ }) cfg.config);
environment.systemPackages = [ pkgs.tarsnap ];
};
diff --git a/nixos/modules/services/continuous-integration/jenkins/default.nix b/nixos/modules/services/continuous-integration/jenkins/default.nix
index 23fa32ef511..b01b5c3245a 100644
--- a/nixos/modules/services/continuous-integration/jenkins/default.nix
+++ b/nixos/modules/services/continuous-integration/jenkins/default.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.jenkins;
in {
diff --git a/nixos/modules/services/continuous-integration/jenkins/slave.nix b/nixos/modules/services/continuous-integration/jenkins/slave.nix
index 9d952b2d2be..5836d92a4fc 100644
--- a/nixos/modules/services/continuous-integration/jenkins/slave.nix
+++ b/nixos/modules/services/continuous-integration/jenkins/slave.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.jenkinsSlave;
masterCfg = config.services.jenkins;
diff --git a/nixos/modules/services/databases/4store-endpoint.nix b/nixos/modules/services/databases/4store-endpoint.nix
index 7872ea2dc6a..f2d64b6891d 100644
--- a/nixos/modules/services/databases/4store-endpoint.nix
+++ b/nixos/modules/services/databases/4store-endpoint.nix
@@ -1,10 +1,10 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.fourStoreEndpoint;
endpointUser = "fourstorehttp";
run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${endpointUser} -c";
in
-with pkgs.lib;
+with lib;
{
###### interface
@@ -54,7 +54,7 @@ with pkgs.lib;
users.extraUsers = singleton
{ name = endpointUser;
- uid = config.ids.uids.fourStoreEndpoint;
+ uid = config.ids.uids.fourstorehttp;
description = "4Store SPARQL endpoint user";
# home = stateDir;
};
diff --git a/nixos/modules/services/databases/4store.nix b/nixos/modules/services/databases/4store.nix
index 412d14b050c..469fef69c95 100644
--- a/nixos/modules/services/databases/4store.nix
+++ b/nixos/modules/services/databases/4store.nix
@@ -1,11 +1,11 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.fourStore;
stateDir = "/var/lib/4store";
fourStoreUser = "fourstore";
run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fourStoreUser}";
in
-with pkgs.lib;
+with lib;
{
###### interface
@@ -45,7 +45,7 @@ with pkgs.lib;
users.extraUsers = singleton
{ name = fourStoreUser;
- uid = config.ids.uids.fourStore;
+ uid = config.ids.uids.fourstore;
description = "4Store database user";
home = stateDir;
};
diff --git a/nixos/modules/services/databases/couchdb.nix b/nixos/modules/services/databases/couchdb.nix
index b48d3a64767..e1fe6be6f6a 100644
--- a/nixos/modules/services/databases/couchdb.nix
+++ b/nixos/modules/services/databases/couchdb.nix
@@ -1,5 +1,6 @@
-{ config, pkgs, ... }:
- with pkgs.lib;
+{ config, lib, pkgs, ... }:
+
+with lib;
let
cfg = config.services.couchdb;
@@ -125,6 +126,16 @@ in {
Extra configuration. Overrides any other cofiguration.
'';
};
+
+ configFile = mkOption {
+ type = types.string;
+ default = "/var/lib/couchdb/couchdb.ini";
+ description = ''
+ Custom configuration file. File needs to be readable and writable
+ from couchdb user/group.
+ '';
+ };
+
};
};
@@ -145,11 +156,13 @@ in {
mkdir -p `dirname ${cfg.logFile}`;
mkdir -p ${cfg.databaseDir};
mkdir -p ${cfg.viewIndexDir};
+ touch ${cfg.configFile}
if [ "$(id -u)" = 0 ]; then
- chown ${cfg.user}:${cfg.group} `dirname ${cfg.uriFile}`
+ chown ${cfg.user}:${cfg.group} ${cfg.uriFile}
chown ${cfg.user}:${cfg.group} ${cfg.databaseDir}
chown ${cfg.user}:${cfg.group} ${cfg.viewIndexDir}
+ chown ${cfg.user}:${cfg.group} ${cfg.configFile}
fi
'';
@@ -157,7 +170,7 @@ in {
PermissionsStartOnly = true;
User = cfg.user;
Group = cfg.group;
- ExecStart = "${cfg.package}/bin/couchdb -a ${configFile} -a ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig}";
+ ExecStart = "${cfg.package}/bin/couchdb -a ${configFile} -a ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig} -a ${cfg.configFile}";
};
};
diff --git a/nixos/modules/services/databases/firebird.nix b/nixos/modules/services/databases/firebird.nix
index f9f7e9d7c51..83dd4951170 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
diff --git a/nixos/modules/services/databases/influxdb.nix b/nixos/modules/services/databases/influxdb.nix
new file mode 100644
index 00000000000..61fe96d5d64
--- /dev/null
+++ b/nixos/modules/services/databases/influxdb.nix
@@ -0,0 +1,241 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.influxdb;
+
+ influxdbConfig = pkgs.writeText "config.toml" ''
+ bind-address = "${cfg.bindAddress}"
+
+ [logging]
+ level = "info"
+ file = "stdout"
+
+ [admin]
+ port = ${toString cfg.adminPort}
+ assets = "${pkgs.influxdb}/share/influxdb/admin"
+
+ [api]
+ port = ${toString cfg.apiPort}
+ ${cfg.apiExtraConfig}
+
+ [input_plugins]
+ ${cfg.inputPluginsConfig}
+
+ [raft]
+ dir = "${cfg.dataDir}/raft"
+ ${cfg.raftConfig}
+
+ [storage]
+ dir = "${cfg.dataDir}/db"
+ ${cfg.storageConfig}
+
+ [cluster]
+ ${cfg.clusterConfig}
+
+ [sharding]
+ ${cfg.shardingConfig}
+
+ [wal]
+ dir = "${cfg.dataDir}/wal"
+ ${cfg.walConfig}
+
+ ${cfg.extraConfig}
+ '';
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.influxdb = {
+
+ enable = mkOption {
+ default = false;
+ description = "Whether to enable the influxdb server";
+ type = types.uniq types.bool;
+ };
+
+ package = mkOption {
+ default = pkgs.influxdb;
+ description = "Which influxdb derivation to use";
+ type = types.package;
+ };
+
+ user = mkOption {
+ default = "influxdb";
+ description = "User account under which influxdb runs";
+ type = types.string;
+ };
+
+ group = mkOption {
+ default = "influxdb";
+ description = "Group under which influxdb runs";
+ type = types.string;
+ };
+
+ dataDir = mkOption {
+ default = "/var/db/influxdb";
+ description = "Data directory for influxd data files.";
+ type = types.path;
+ };
+
+ bindAddress = mkOption {
+ default = "127.0.0.1";
+ description = "Address where influxdb listens";
+ type = types.str;
+ };
+
+ adminPort = mkOption {
+ default = 8083;
+ description = "The port where influxdb admin listens";
+ type = types.int;
+ };
+
+ apiPort = mkOption {
+ default = 8086;
+ description = "The port where influxdb api listens";
+ type = types.int;
+ };
+
+ apiExtraConfig = mkOption {
+ default = ''
+ read-timeout = "5s"
+ '';
+ description = "Extra influxdb api configuration";
+ example = ''
+ ssl-port = 8084
+ ssl-cert = /path/to/cert.pem
+ read-timeout = "5s"
+ '';
+ type = types.lines;
+ };
+
+ inputPluginsConfig = mkOption {
+ default = "";
+ description = "Configuration of influxdb extra plugins";
+ example = ''
+ [input_plugins.graphite]
+ enabled = true
+ port = 2003
+ database = "graphite"
+ '';
+ };
+
+ raftConfig = mkOption {
+ default = ''
+ port = 8090
+ '';
+ description = "Influxdb raft configuration";
+ type = types.lines;
+ };
+
+ storageConfig = mkOption {
+ default = ''
+ write-buffer-size = 10000
+ '';
+ description = "Influxdb raft configuration";
+ type = types.lines;
+ };
+
+ clusterConfig = mkOption {
+ default = ''
+ protobuf_port = 8099
+ protobuf_timeout = "2s"
+ protobuf_heartbeat = "200ms"
+ protobuf_min_backoff = "1s"
+ protobuf_max_backoff = "10s"
+
+ write-buffer-size = 10000
+ max-response-buffer-size = 100
+
+ concurrent-shard-query-limit = 10
+ '';
+ description = "Influxdb cluster configuration";
+ type = types.lines;
+ };
+
+ leveldbConfig = mkOption {
+ default = ''
+ max-open-files = 40
+ lru-cache-size = "200m"
+ max-open-shards = 0
+ point-batch-size = 100
+ write-batch-size = 5000000
+ '';
+ description = "Influxdb leveldb configuration";
+ type = types.lines;
+ };
+
+ shardingConfig = mkOption {
+ default = ''
+ replication-factor = 1
+
+ [sharding.short-term]
+ duration = "7d"
+ split = 1
+
+ [sharding.long-term]
+ duration = "30d"
+ split = 1
+ '';
+ description = "Influxdb sharding configuration";
+ type = types.lines;
+ };
+
+ walConfig = mkOption {
+ default = ''
+ flush-after = 1000
+ bookmark-after = 1000
+ index-after = 1000
+ requests-per-logfile = 10000
+ '';
+ description = "Influxdb write-ahead log configuration";
+ type = types.lines;
+ };
+
+ extraConfig = mkOption {
+ default = "";
+ description = "Extra configuration options for influxdb";
+ type = types.string;
+ };
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.influxdb.enable {
+
+ systemd.services.influxdb = {
+ description = "InfluxDB Server";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+ serviceConfig = {
+ ExecStart = ''${cfg.package}/bin/influxdb -config "${influxdbConfig}"'';
+ User = "${cfg.user}";
+ Group = "${cfg.group}";
+ PermissionsStartOnly = true;
+ };
+ preStart = ''
+ mkdir -m 0770 -p ${cfg.dataDir}
+ if [ "$(id -u)" = 0 ]; then chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}; fi
+ '';
+ };
+
+ users.extraUsers = optional (cfg.user == "influxdb") {
+ name = "influxdb";
+ uid = config.ids.uids.influxdb;
+ description = "Influxdb daemon user";
+ };
+
+ users.extraGroups = optional (cfg.group == "influxdb") {
+ name = "influxdb";
+ gid = config.ids.gids.influxdb;
+ };
+ };
+
+}
diff --git a/nixos/modules/services/databases/memcached.nix b/nixos/modules/services/databases/memcached.nix
index 505253229c9..c6875af506d 100644
--- a/nixos/modules/services/databases/memcached.nix
+++ b/nixos/modules/services/databases/memcached.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/databases/monetdb.nix b/nixos/modules/services/databases/monetdb.nix
index 9d3059c7f45..9f09c71e005 100644
--- a/nixos/modules/services/databases/monetdb.nix
+++ b/nixos/modules/services/databases/monetdb.nix
@@ -1,9 +1,9 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.monetdb;
monetdbUser = "monetdb";
in
-with pkgs.lib;
+with lib;
{
###### interface
diff --git a/nixos/modules/services/databases/mongodb.nix b/nixos/modules/services/databases/mongodb.nix
index a2f2593e797..fe82ca430e1 100644
--- a/nixos/modules/services/databases/mongodb.nix
+++ b/nixos/modules/services/databases/mongodb.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix
index 44fb0062f92..b94a3fbf3de 100644
--- a/nixos/modules/services/databases/mysql.nix
+++ b/nixos/modules/services/databases/mysql.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -21,6 +21,7 @@ let
myCnf = pkgs.writeText "my.cnf"
''
[mysqld]
+ port = ${toString cfg.port}
${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "log-bin=mysql-bin"}
${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "server-id = ${toString cfg.replication.serverId}"}
${optionalString (cfg.replication.role == "slave" && !is55)
diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix
index 0fc8b88c652..c95238b3451 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 cc4230d4d6a..ad83cb553e1 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
@@ -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 9a4ce36a5cb..4ef48df9831 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;
diff --git a/nixos/modules/services/databases/virtuoso.nix b/nixos/modules/services/databases/virtuoso.nix
index 6a29fc13211..f955cb74b6b 100644
--- a/nixos/modules/services/databases/virtuoso.nix
+++ b/nixos/modules/services/databases/virtuoso.nix
@@ -1,10 +1,10 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.virtuoso;
virtuosoUser = "virtuoso";
stateDir = "/var/lib/virtuoso";
in
-with pkgs.lib;
+with lib;
{
###### interface
diff --git a/nixos/modules/services/desktops/accountservice.nix b/nixos/modules/services/desktops/accountservice.nix
index b21207f05a1..386dfe98bd2 100644
--- a/nixos/modules/services/desktops/accountservice.nix
+++ b/nixos/modules/services/desktops/accountservice.nix
@@ -1,8 +1,8 @@
# AccountsService daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/desktops/geoclue2.nix b/nixos/modules/services/desktops/geoclue2.nix
new file mode 100644
index 00000000000..6bdd5edff1f
--- /dev/null
+++ b/nixos/modules/services/desktops/geoclue2.nix
@@ -0,0 +1,39 @@
+# GeoClue 2 daemon.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.geoclue2 = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GeoClue 2 daemon, a DBus service
+ that provides location informationfor accessing.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.geoclue2.enable {
+
+ environment.systemPackages = [ pkgs.geoclue2 ];
+
+ services.dbus.packages = [ pkgs.geoclue2 ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/at-spi2-core.nix b/nixos/modules/services/desktops/gnome3/at-spi2-core.nix
index 7a25a794c2e..615f272e7b9 100644
--- a/nixos/modules/services/desktops/gnome3/at-spi2-core.nix
+++ b/nixos/modules/services/desktops/gnome3/at-spi2-core.nix
@@ -1,9 +1,12 @@
# at-spi2-core daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
{
###### interface
@@ -30,9 +33,9 @@ with pkgs.lib;
config = mkIf config.services.gnome3.at-spi2-core.enable {
- environment.systemPackages = [ pkgs.gnome3.at_spi2_core ];
+ environment.systemPackages = [ gnome3.at_spi2_core ];
- services.dbus.packages = [ pkgs.gnome3.at_spi2_core ];
+ services.dbus.packages = [ 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
index 64592133666..a8f8da0eed5 100644
--- a/nixos/modules/services/desktops/gnome3/evolution-data-server.nix
+++ b/nixos/modules/services/desktops/gnome3/evolution-data-server.nix
@@ -1,9 +1,12 @@
# Evolution Data Server daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
{
###### interface
@@ -30,9 +33,9 @@ with pkgs.lib;
config = mkIf config.services.gnome3.evolution-data-server.enable {
- environment.systemPackages = [ pkgs.evolution_data_server ];
+ environment.systemPackages = [ gnome3.evolution_data_server ];
- services.dbus.packages = [ pkgs.evolution_data_server ];
+ services.dbus.packages = [ gnome3.evolution_data_server ];
};
diff --git a/nixos/modules/services/desktops/gnome3/gnome-documents.nix b/nixos/modules/services/desktops/gnome3/gnome-documents.nix
new file mode 100644
index 00000000000..2279ef48fb9
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-documents.nix
@@ -0,0 +1,46 @@
+# GNOME Documents daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gnome-documents = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GNOME Documents services, a document
+ manager application for GNOME.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gnome-documents.enable {
+
+ environment.systemPackages = [ gnome3.gnome-documents ];
+
+ services.dbus.packages = [ gnome3.gnome-documents ];
+
+ services.gnome3.gnome-online-accounts.enable = true;
+
+ services.gnome3.gnome-online-miners.enable = true;
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gnome-keyring.nix b/nixos/modules/services/desktops/gnome3/gnome-keyring.nix
new file mode 100644
index 00000000000..be14f1fcbc0
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-keyring.nix
@@ -0,0 +1,43 @@
+# GNOME Keyring daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gnome-keyring = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GNOME Keyring daemon, a service designed to
+ take care of the user's security credentials,
+ such as user names and passwordsa search engine.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gnome-keyring.enable {
+
+ environment.systemPackages = [ gnome3.gnome_keyring ];
+
+ services.dbus.packages = [ gnome3.gnome_keyring ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix b/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix
new file mode 100644
index 00000000000..a41fb0101f0
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix
@@ -0,0 +1,42 @@
+# GNOME Online Accounts daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gnome-online-accounts = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GNOME Online Accounts daemon, a service that provides
+ a single sign-on framework for the GNOME desktop.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gnome-online-accounts.enable {
+
+ environment.systemPackages = [ gnome3.gnome_online_accounts ];
+
+ services.dbus.packages = [ gnome3.gnome_online_accounts ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gnome-online-miners.nix b/nixos/modules/services/desktops/gnome3/gnome-online-miners.nix
new file mode 100644
index 00000000000..030d4bac6a7
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-online-miners.nix
@@ -0,0 +1,42 @@
+# GNOME Online Miners daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gnome-online-miners = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GNOME Online Miners, a service that
+ crawls through your online content.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gnome-online-miners.enable {
+
+ environment.systemPackages = [ gnome3.gnome-online-miners ];
+
+ services.dbus.packages = [ gnome3.gnome-online-miners ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gnome-user-share.nix b/nixos/modules/services/desktops/gnome3/gnome-user-share.nix
new file mode 100644
index 00000000000..3b6c713f7be
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gnome-user-share.nix
@@ -0,0 +1,45 @@
+# GNOME User Share daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gnome-user-share = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable GNOME User Share, a service that exports the
+ contents of the Public folder in your home directory on the local network.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gnome-user-share.enable {
+
+ environment.systemPackages = [ gnome3.gnome-user-share ];
+
+ services.xserver.displayManager.sessionCommands = with gnome3; ''
+ # Don't let gnome-control-center depend upon gnome-user-share
+ export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${gnome-user-share}/share/gsettings-schemas/${gnome-user-share.name}
+ '';
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/gvfs.nix b/nixos/modules/services/desktops/gnome3/gvfs.nix
new file mode 100644
index 00000000000..1a003ddd1ef
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/gvfs.nix
@@ -0,0 +1,42 @@
+# gvfs backends
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.gvfs = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable gvfs backends, userspace virtual filesystem used
+ by GNOME components via D-Bus.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.gvfs.enable {
+
+ environment.systemPackages = [ gnome3.gvfs ];
+
+ services.dbus.packages = [ gnome3.gvfs ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/seahorse.nix b/nixos/modules/services/desktops/gnome3/seahorse.nix
new file mode 100644
index 00000000000..01e4a24f267
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/seahorse.nix
@@ -0,0 +1,41 @@
+# Seahorse daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.seahorse = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable Seahorse search provider for the GNOME Shell activity search.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.seahorse.enable {
+
+ environment.systemPackages = [ gnome3.seahorse ];
+
+ services.dbus.packages = [ gnome3.seahorse ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/gnome3/sushi.nix b/nixos/modules/services/desktops/gnome3/sushi.nix
index 7fe37e26f43..ff7f484602c 100644
--- a/nixos/modules/services/desktops/gnome3/sushi.nix
+++ b/nixos/modules/services/desktops/gnome3/sushi.nix
@@ -1,9 +1,12 @@
# GNOME Sushi daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
{
###### interface
@@ -29,9 +32,9 @@ with pkgs.lib;
config = mkIf config.services.gnome3.sushi.enable {
- environment.systemPackages = [ pkgs.gnome3.sushi ];
+ environment.systemPackages = [ gnome3.sushi ];
- services.dbus.packages = [ pkgs.gnome3.sushi ];
+ services.dbus.packages = [ gnome3.sushi ];
};
diff --git a/nixos/modules/services/desktops/gnome3/tracker.nix b/nixos/modules/services/desktops/gnome3/tracker.nix
new file mode 100644
index 00000000000..670e585c6f5
--- /dev/null
+++ b/nixos/modules/services/desktops/gnome3/tracker.nix
@@ -0,0 +1,42 @@
+# Tracker daemon.
+
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+ gnome3 = config.environment.gnome3.packageSet;
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.gnome3.tracker = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable Tracker services, a search engine,
+ search tool and metadata storage system.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.gnome3.tracker.enable {
+
+ environment.systemPackages = [ gnome3.tracker ];
+
+ services.dbus.packages = [ gnome3.tracker ];
+
+ };
+
+}
diff --git a/nixos/modules/services/desktops/telepathy.nix b/nixos/modules/services/desktops/telepathy.nix
index bd417db88af..2554f3a1666 100644
--- a/nixos/modules/services/desktops/telepathy.nix
+++ b/nixos/modules/services/desktops/telepathy.nix
@@ -1,8 +1,8 @@
# Telepathy daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/games/ghost-one.nix b/nixos/modules/services/games/ghost-one.nix
index 92c9112eeb6..07d7287ed88 100644
--- a/nixos/modules/services/games/ghost-one.nix
+++ b/nixos/modules/services/games/ghost-one.nix
@@ -1,5 +1,5 @@
-{pkgs, config, ...}:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.ghostOne;
@@ -57,14 +57,14 @@ in
users.extraUsers = singleton
{ name = ghostUser;
- uid = config.ids.uids.ghostOne;
+ uid = config.ids.uids.ghostone;
description = "Ghost One game server user";
home = stateDir;
};
users.extraGroups = singleton
{ name = ghostUser;
- gid = config.ids.gids.ghostOne;
+ gid = config.ids.gids.ghostone;
};
services.ghostOne.config = ''
diff --git a/nixos/modules/services/games/minecraft-server.nix b/nixos/modules/services/games/minecraft-server.nix
index ac70bc53473..4c734aefa46 100644
--- a/nixos/modules/services/games/minecraft-server.nix
+++ b/nixos/modules/services/games/minecraft-server.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.minecraft-server;
diff --git a/nixos/modules/services/hardware/80-net-name-slot.rules b/nixos/modules/services/hardware/80-net-name-slot.rules
new file mode 100644
index 00000000000..18547f170a3
--- /dev/null
+++ b/nixos/modules/services/hardware/80-net-name-slot.rules
@@ -0,0 +1,13 @@
+# Copied from systemd 203.
+ACTION=="remove", GOTO="net_name_slot_end"
+SUBSYSTEM!="net", GOTO="net_name_slot_end"
+NAME!="", GOTO="net_name_slot_end"
+
+IMPORT{cmdline}="net.ifnames"
+ENV{net.ifnames}=="0", GOTO="net_name_slot_end"
+
+NAME=="", ENV{ID_NET_NAME_ONBOARD}!="", NAME="$env{ID_NET_NAME_ONBOARD}"
+NAME=="", ENV{ID_NET_NAME_SLOT}!="", NAME="$env{ID_NET_NAME_SLOT}"
+NAME=="", ENV{ID_NET_NAME_PATH}!="", NAME="$env{ID_NET_NAME_PATH}"
+
+LABEL="net_name_slot_end"
diff --git a/nixos/modules/services/hardware/acpid.nix b/nixos/modules/services/hardware/acpid.nix
index 2329f38dfc2..a710636c140 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 a70a66c2ba0..68d0406e63b 100644
--- a/nixos/modules/services/hardware/bluetooth.nix
+++ b/nixos/modules/services/hardware/bluetooth.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/hardware/pcscd.nix b/nixos/modules/services/hardware/pcscd.nix
index 6d429c94b28..6e30dfb752d 100644
--- a/nixos/modules/services/hardware/pcscd.nix
+++ b/nixos/modules/services/hardware/pcscd.nix
@@ -1,10 +1,10 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
let
cfgFile = pkgs.writeText "reader.conf" "";
in
-with pkgs.lib;
+with lib;
{
@@ -28,9 +28,15 @@ with pkgs.lib;
config = mkIf config.services.pcscd.enable {
+ systemd.sockets.pcscd = {
+ description = "PCSC-Lite Socket";
+ wantedBy = [ "sockets.target" ];
+ before = [ "multi-user.target" ];
+ socketConfig.ListenStream = "/run/pcscd/pcscd.comm";
+ };
+
systemd.services.pcscd = {
description = "PCSC-Lite daemon";
- wantedBy = [ "multi-user.target" ];
preStart = ''
mkdir -p /var/lib/pcsc
rm -Rf /var/lib/pcsc/drivers
@@ -38,7 +44,8 @@ with pkgs.lib;
'';
serviceConfig = {
Type = "forking";
- ExecStart = "${pkgs.pcsclite}/sbin/pcscd -c ${cfgFile}";
+ ExecStart = "${pkgs.pcsclite}/sbin/pcscd --auto-exit -c ${cfgFile}";
+ ExecReload = "${pkgs.pcsclite}/sbin/pcscd --hotplug";
};
};
diff --git a/nixos/modules/services/hardware/pommed.nix b/nixos/modules/services/hardware/pommed.nix
index 32599554fc1..04db46999b0 100644
--- a/nixos/modules/services/hardware/pommed.nix
+++ b/nixos/modules/services/hardware/pommed.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix
index 5979feb8240..f7b25c18787 100644
--- a/nixos/modules/services/hardware/sane.nix
+++ b/nixos/modules/services/hardware/sane.nix
@@ -1,10 +1,12 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends;
+ backends = [ pkg ] ++ config.hardware.sane.extraBackends;
+ saneConfig = pkgs.mkSaneConfig { paths = backends; };
in
@@ -26,6 +28,12 @@ in
description = "Use a development snapshot of SANE scanner drivers.";
};
+ hardware.sane.extraBackends = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = "Packages providing extra SANE backends to enable.";
+ };
+
};
@@ -33,8 +41,12 @@ in
config = mkIf config.hardware.sane.enable {
- environment.systemPackages = [ pkg ];
- services.udev.packages = [ pkg ];
+ environment.systemPackages = backends;
+ environment.variables = {
+ SANE_CONFIG_DIR = mkDefault "${saneConfig}/etc/sane.d";
+ LD_LIBRARY_PATH = [ "${saneConfig}/lib/sane" ];
+ };
+ services.udev.packages = backends;
users.extraGroups."scanner".gid = config.ids.gids.scanner;
diff --git a/nixos/modules/services/hardware/thinkfan.nix b/nixos/modules/services/hardware/thinkfan.nix
index b39c9cb1d9b..16c31aab2d5 100644
--- a/nixos/modules/services/hardware/thinkfan.nix
+++ b/nixos/modules/services/hardware/thinkfan.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix
index 52b3ad43579..068d14217a2 100644
--- a/nixos/modules/services/hardware/udev.nix
+++ b/nixos/modules/services/hardware/udev.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -20,6 +20,9 @@ let
# Miscellaneous devices.
KERNEL=="kvm", MODE="0666"
KERNEL=="kqemu", MODE="0666"
+
+ # Needed for gpm.
+ SUBSYSTEM=="input", KERNEL=="mice", TAG+="systemd"
'';
# Perform substitutions in all udev rules files.
@@ -83,8 +86,8 @@ let
grep -l '\(RUN+\|IMPORT{program}\)="\(/usr\)\?/s\?bin' $i/*/udev/rules.d/* || true
done
- ${optionalString (!config.networking.usePredictableInterfaceNames) ''
- ln -s /dev/null $out/80-net-name-slot.rules
+ ${optionalString config.networking.usePredictableInterfaceNames ''
+ cp ${./80-net-name-slot.rules} $out/80-net-name-slot.rules
''}
# If auto-configuration is disabled, then remove
@@ -243,5 +246,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
deleted file mode 100644
index 531ee192573..00000000000
--- a/nixos/modules/services/hardware/udisks.nix
+++ /dev/null
@@ -1,45 +0,0 @@
-# Udisks daemon.
-
-{ config, pkgs, ... }:
-
-with pkgs.lib;
-
-{
-
- ###### interface
-
- options = {
-
- services.udisks = {
-
- enable = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Whether to enable Udisks, a DBus service that allows
- applications to query and manipulate storage devices.
- '';
- };
-
- };
-
- };
-
-
- ###### implementation
-
- config = mkIf config.services.udisks.enable {
-
- environment.systemPackages = [ pkgs.udisks ];
-
- services.dbus.packages = [ pkgs.udisks ];
-
- system.activationScripts.udisks =
- ''
- mkdir -m 0755 -p /var/lib/udisks
- '';
-
- services.udev.packages = [ pkgs.udisks ];
- };
-
-}
diff --git a/nixos/modules/services/hardware/udisks2.nix b/nixos/modules/services/hardware/udisks2.nix
index 178ec379ff1..f5b641c7378 100644
--- a/nixos/modules/services/hardware/udisks2.nix
+++ b/nixos/modules/services/hardware/udisks2.nix
@@ -1,8 +1,8 @@
# Udisks daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -14,7 +14,7 @@ with pkgs.lib;
enable = mkOption {
type = types.bool;
- default = false;
+ default = true;
description = ''
Whether to enable Udisks, a DBus service that allows
applications to query and manipulate storage devices.
diff --git a/nixos/modules/services/hardware/upower.nix b/nixos/modules/services/hardware/upower.nix
index 4a9b13d4aa0..0b6a101efa0 100644
--- a/nixos/modules/services/hardware/upower.nix
+++ b/nixos/modules/services/hardware/upower.nix
@@ -1,9 +1,12 @@
# Upower daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
+let
+ cfg = config.services.upower;
+in
{
###### interface
@@ -21,6 +24,15 @@ with pkgs.lib;
'';
};
+ package = mkOption {
+ type = types.package;
+ default = pkgs.upower;
+ example = lib.literalExample "pkgs.upower";
+ description = ''
+ Which upower package to use.
+ '';
+ };
+
};
};
@@ -28,13 +40,13 @@ with pkgs.lib;
###### implementation
- config = mkIf config.services.upower.enable {
+ config = mkIf cfg.enable {
- environment.systemPackages = [ pkgs.upower ];
+ environment.systemPackages = [ cfg.package ];
- services.dbus.packages = [ pkgs.upower ];
+ services.dbus.packages = [ cfg.package ];
- services.udev.packages = [ pkgs.upower ];
+ services.udev.packages = [ cfg.package ];
systemd.services.upower =
{ description = "Power Management Daemon";
@@ -42,7 +54,7 @@ with pkgs.lib;
serviceConfig =
{ Type = "dbus";
BusName = "org.freedesktop.UPower";
- ExecStart = "@${pkgs.upower}/libexec/upowerd upowerd";
+ ExecStart = "@${cfg.package}/libexec/upowerd upowerd";
};
};
diff --git a/nixos/modules/services/logging/klogd.nix b/nixos/modules/services/logging/klogd.nix
index 36b530d0077..f69e08152b5 100644
--- a/nixos/modules/services/logging/klogd.nix
+++ b/nixos/modules/services/logging/klogd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
###### interface
diff --git a/nixos/modules/services/logging/logcheck.nix b/nixos/modules/services/logging/logcheck.nix
index ef147f95358..1cd032ffa76 100644
--- a/nixos/modules/services/logging/logcheck.nix
+++ b/nixos/modules/services/logging/logcheck.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.logcheck;
diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix
index c6c0d2ea238..804f9a0847f 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 21128779e8f..480e35a1156 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 680c7a912c1..d4b7aa809f0 100644
--- a/nixos/modules/services/logging/rsyslogd.nix
+++ b/nixos/modules/services/logging/rsyslogd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/logging/syslogd.nix b/nixos/modules/services/logging/syslogd.nix
index 36a0ace927a..325868079e2 100644
--- a/nixos/modules/services/logging/syslogd.nix
+++ b/nixos/modules/services/logging/syslogd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix
index 92682d644f4..1fb7102e7f3 100644
--- a/nixos/modules/services/mail/dovecot.nix
+++ b/nixos/modules/services/mail/dovecot.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/mail/freepops.nix b/nixos/modules/services/mail/freepops.nix
index 79f211ad86e..2dd27a2033a 100644
--- a/nixos/modules/services/mail/freepops.nix
+++ b/nixos/modules/services/mail/freepops.nix
@@ -1,6 +1,6 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.mail.freepopsd;
diff --git a/nixos/modules/services/mail/mail.nix b/nixos/modules/services/mail/mail.nix
index bad0b22625d..b7e1d295f2c 100644
--- a/nixos/modules/services/mail/mail.nix
+++ b/nixos/modules/services/mail/mail.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/mail/opensmtpd.nix b/nixos/modules/services/mail/opensmtpd.nix
index 0c18c464520..fbc4b1d7d8a 100644
--- a/nixos/modules/services/mail/opensmtpd.nix
+++ b/nixos/modules/services/mail/opensmtpd.nix
@@ -1,7 +1,7 @@
-{ pkgs, config, ... }:
+{ config, lib, pkgs, ... }:
with pkgs;
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix
index 2633289b46d..8f75bd8ab5d 100644
--- a/nixos/modules/services/mail/postfix.nix
+++ b/nixos/modules/services/mail/postfix.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/mail/spamassassin.nix b/nixos/modules/services/mail/spamassassin.nix
index aaf1dfcc210..a3ac9e37242 100644
--- a/nixos/modules/services/mail/spamassassin.nix
+++ b/nixos/modules/services/mail/spamassassin.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/autofs.nix b/nixos/modules/services/misc/autofs.nix
index 50491c556e8..e645bd25a66 100644
--- a/nixos/modules/services/misc/autofs.nix
+++ b/nixos/modules/services/misc/autofs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/cgminer.nix b/nixos/modules/services/misc/cgminer.nix
index 20b7c34e886..8f25df809cd 100644
--- a/nixos/modules/services/misc/cgminer.nix
+++ b/nixos/modules/services/misc/cgminer.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.cgminer;
diff --git a/nixos/modules/services/misc/dictd.nix b/nixos/modules/services/misc/dictd.nix
index fd68f847010..552e0a435ef 100644
--- a/nixos/modules/services/misc/dictd.nix
+++ b/nixos/modules/services/misc/dictd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/misc/disnix.nix b/nixos/modules/services/misc/disnix.nix
index 82526b154e7..94d0caaa76b 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 2da50fc8595..a01c7f08b91 100644
--- a/nixos/modules/services/misc/felix.nix
+++ b/nixos/modules/services/misc/felix.nix
@@ -1,7 +1,7 @@
# Felix server
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/folding-at-home.nix b/nixos/modules/services/misc/folding-at-home.nix
index 9f4c4645279..392d2d1f002 100644
--- a/nixos/modules/services/misc/folding-at-home.nix
+++ b/nixos/modules/services/misc/folding-at-home.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
stateDir = "/var/lib/foldingathome";
cfg = config.services.foldingAtHome;
@@ -44,7 +44,7 @@ in {
users.extraUsers = singleton
{ name = fahUser;
- uid = config.ids.uids.foldingAtHome;
+ uid = config.ids.uids.foldingathome;
description = "Folding@Home user";
home = stateDir;
};
diff --git a/nixos/modules/services/misc/gpsd.nix b/nixos/modules/services/misc/gpsd.nix
index 99b733d399e..4a677f33fa0 100644
--- a/nixos/modules/services/misc/gpsd.nix
+++ b/nixos/modules/services/misc/gpsd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index bbcf290a795..4bfd6268234 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
@@ -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 pkgs.openssh ]
+ 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 fa20e0956f5..6a7a7f4cee7 100644
--- a/nixos/modules/services/misc/nix-gc.nix
+++ b/nixos/modules/services/misc/nix-gc.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.nix.gc;
diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix
index 1a8b85db329..808c5dcbdc6 100644
--- a/nixos/modules/services/misc/nixos-manual.nix
+++ b/nixos/modules/services/misc/nixos-manual.nix
@@ -3,9 +3,9 @@
# of the virtual consoles. The latter is useful for the installation
# CD.
-{ config, pkgs, baseModules, ... } @ extraArgs:
+{ config, lib, pkgs, baseModules, ... } @ extraArgs:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/rippled.nix b/nixos/modules/services/misc/rippled.nix
index e4d1caa565c..2c1fec9f6d7 100644
--- a/nixos/modules/services/misc/rippled.nix
+++ b/nixos/modules/services/misc/rippled.nix
@@ -1,8 +1,8 @@
# configuration building is commented out until better tested.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.rippled;
diff --git a/nixos/modules/services/misc/rogue.nix b/nixos/modules/services/misc/rogue.nix
index de25cc0fb98..ed8da8a518f 100644
--- a/nixos/modules/services/misc/rogue.nix
+++ b/nixos/modules/services/misc/rogue.nix
@@ -1,9 +1,9 @@
# Execute the game `rogue' on tty 9. Mostly used by the NixOS
# installation CD.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/svnserve.nix b/nixos/modules/services/misc/svnserve.nix
index b0806d14738..848905ca457 100644
--- a/nixos/modules/services/misc/svnserve.nix
+++ b/nixos/modules/services/misc/svnserve.nix
@@ -1,7 +1,7 @@
# SVN server
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/misc/synergy.nix b/nixos/modules/services/misc/synergy.nix
index 63e7c7667e5..ec8ff426f0a 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 38fd53653d6..6cc0c122ec6 100644
--- a/nixos/modules/services/monitoring/apcupsd.nix
+++ b/nixos/modules/services/monitoring/apcupsd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.apcupsd;
diff --git a/nixos/modules/services/monitoring/dd-agent.nix b/nixos/modules/services/monitoring/dd-agent.nix
index 37ce1c099df..deef64d6998 100644
--- a/nixos/modules/services/monitoring/dd-agent.nix
+++ b/nixos/modules/services/monitoring/dd-agent.nix
@@ -1,58 +1,117 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.dd-agent;
- datadog_conf = pkgs.runCommand "datadog.conf" {} ''
- sed -e 's|^api_key:|api_key: ${cfg.api_key}|' ${optionalString (cfg.hostname != null)
- "-e 's|^#hostname: mymachine.mydomain|hostname: ${cfg.hostname}|'"
- } ${pkgs.dd-agent}/etc/dd-agent/datadog.conf.example > $out
+ ddConf = pkgs.writeText "datadog.conf" ''
+ [Main]
+ dd_url: https://app.datadoghq.com
+ skip_ssl_validation: no
+ api_key: ${cfg.api_key}
+ ${optionalString (cfg.hostname != null) "hostname: ${cfg.hostname}"}
+
+ collector_log_file: /var/log/datadog/collector.log
+ forwarder_log_file: /var/log/datadog/forwarder.log
+ dogstatsd_log_file: /var/log/datadog/dogstatsd.log
+ pup_log_file: /var/log/datadog/pup.log
+
+ # proxy_host: my-proxy.com
+ # proxy_port: 3128
+ # proxy_user: user
+ # proxy_password: password
+
+ # tags: mytag0, mytag1
+
+ # collect_ec2_tags: no
+ # recent_point_threshold: 30
+ # use_mount: no
+ # listen_port: 17123
+ # graphite_listen_port: 17124
+ # non_local_traffic: no
+ # use_curl_http_client: False
+ # bind_host: localhost
+
+ # use_pup: no
+ # pup_port: 17125
+ # pup_interface: localhost
+ # pup_url: http://localhost:17125
+
+ # dogstatsd_port : 8125
+ # dogstatsd_interval : 10
+ # dogstatsd_normalize : yes
+ # statsd_forward_host: address_of_own_statsd_server
+ # statsd_forward_port: 8125
+
+ # device_blacklist_re: .*\/dev\/mapper\/lxc-box.*
+
+ # ganglia_host: localhost
+ # ganglia_port: 8651
'';
+
+ postgresqlConfig = pkgs.writeText "postgres.yaml" cfg.postgresqlConfig;
+ nginxConfig = pkgs.writeText "nginx.yaml" cfg.nginxConfig;
+
+ etcfiles =
+ [ { source = ddConf;
+ target = "dd-agent/datadog.conf";
+ } ] ++
+ (optional (cfg.postgresqlConfig != null)
+ { source = postgresqlConfig;
+ target = "dd-agent/conf.d/postgres.yaml";
+ }) ++
+ (optional (cfg.nginxConfig != null)
+ { source = nginxConfig;
+ target = "dd-agent/conf.d/nginx.yaml";
+ });
+
in {
options.services.dd-agent = {
enable = mkOption {
description = "Whether to enable the dd-agent montioring service";
-
default = false;
-
type = types.bool;
};
- # !!! This gets stored in the store (world-readable), wish we had https://github.com/NixOS/nix/issues/8
api_key = mkOption {
description = "The Datadog API key to associate the agent with your account";
-
example = "ae0aa6a8f08efa988ba0a17578f009ab";
-
type = types.str;
};
hostname = mkOption {
description = "The hostname to show in the Datadog dashboard (optional)";
-
default = null;
-
example = "mymachine.mydomain";
+ type = types.uniq (types.nullOr types.string);
+ };
+ postgresqlConfig = mkOption {
+ description = "Datadog PostgreSQL integration configuration";
+ default = null;
+ type = types.uniq (types.nullOr types.string);
+ };
+
+ nginxConfig = mkOption {
+ description = "Datadog nginx integration configuration";
+ default = null;
type = types.uniq (types.nullOr types.string);
};
};
config = mkIf cfg.enable {
- environment.etc = [ { source = datadog_conf; target = "dd-agent/datadog.conf"; } ];
environment.systemPackages = [ pkgs."dd-agent" pkgs.sysstat pkgs.procps ];
- users.extraUsers."dd-agent" = {
+ users.extraUsers.datadog = {
description = "Datadog Agent User";
- uid = config.ids.uids.dd-agent;
- group = "dd-agent";
+ uid = config.ids.uids.datadog;
+ group = "datadog";
home = "/var/log/datadog/";
createHome = true;
};
- users.extraGroups.dd-agent.gid = config.ids.gids.dd-agent;
+ users.extraGroups.datadog.gid = config.ids.gids.datadog;
systemd.services.dd-agent = {
description = "Datadog agent monitor";
@@ -60,28 +119,30 @@ in {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.dd-agent}/bin/dd-agent foreground";
- User = "dd-agent";
- Group = "dd-agent";
+ User = "datadog";
+ Group = "datadog";
Restart = "always";
RestartSec = 2;
};
- restartTriggers = [ pkgs.dd-agent datadog_conf ];
+ restartTriggers = [ pkgs.dd-agent ddConf postgresqlConfig nginxConfig ];
};
systemd.services.dogstatsd = {
description = "Datadog statsd";
- path = [ pkgs."dd-agent" pkgs.python ];
+ path = [ pkgs."dd-agent" pkgs.python pkgs.procps ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.dd-agent}/bin/dogstatsd start";
- User = "dd-agent";
- Group = "dd-agent";
+ User = "datadog";
+ Group = "datadog";
Type = "forking";
PIDFile = "/tmp/dogstatsd.pid";
Restart = "always";
RestartSec = 2;
};
- restartTriggers = [ pkgs.dd-agent datadog_conf ];
+ restartTriggers = [ pkgs.dd-agent ddConf postgresqlConfig nginxConfig ];
};
+
+ environment.etc = etcfiles;
};
}
diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix
index 3e2e7e9df6e..3a5b13d6d40 100644
--- a/nixos/modules/services/monitoring/graphite.nix
+++ b/nixos/modules/services/monitoring/graphite.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.graphite;
@@ -12,7 +12,7 @@ let
name = "graphite-config";
paths = lists.filter (el: el != null) [
(writeTextOrNull "carbon.conf" cfg.carbon.config)
- (writeTextOrNull "storage-agregation.conf" cfg.carbon.storageAggregation)
+ (writeTextOrNull "storage-aggregation.conf" cfg.carbon.storageAggregation)
(writeTextOrNull "storage-schemas.conf" cfg.carbon.storageSchemas)
(writeTextOrNull "blacklist.conf" cfg.carbon.blacklist)
(writeTextOrNull "whitelist.conf" cfg.carbon.whitelist)
@@ -184,6 +184,7 @@ in {
ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-cache"}";
User = "graphite";
Group = "graphite";
+ PermissionsStartOnly = true;
};
restartTriggers = [
pkgs.pythonPackages.carbon
@@ -193,8 +194,9 @@ in {
cfg.carbon.rewriteRules
];
preStart = ''
- mkdir -m 0700 -p ${cfg.dataDir}/whisper
- if [ "$(id -u)" = 0 ]; then chown -R graphite:graphite ${cfg.dataDir}; fi
+ mkdir -p ${cfg.dataDir}/whisper
+ chmod 0700 ${cfg.dataDir}/whisper
+ chown -R graphite:graphite ${cfg.dataDir}
'';
};
@@ -235,6 +237,7 @@ in {
description = "Graphite Web Interface";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
+ path = [ pkgs.perl ];
environment = {
PYTHONPATH = "${pkgs.python27Packages.graphite_web}/lib/python2.7/site-packages";
DJANGO_SETTINGS_MODULE = "graphite.settings";
@@ -248,11 +251,12 @@ in {
--call django.core.handlers.wsgi:WSGIHandler'';
User = "graphite";
Group = "graphite";
+ PermissionsStartOnly = true;
};
preStart = ''
if ! test -e ${dataDir}/db-created; then
- mkdir -m 0700 -p ${dataDir}/{whisper/,log/webapp/}
- if [ "$(id -u)" = 0 ]; then chown -R graphite:graphite ${cfg.dataDir}; fi
+ mkdir -p ${dataDir}/{whisper/,log/webapp/}
+ chmod 0700 ${dataDir}/{whisper/,log/webapp/}
# populate database
${pkgs.python27Packages.graphite_web}/bin/manage-graphite.py syncdb --noinput
@@ -261,6 +265,8 @@ in {
${pkgs.python27Packages.graphite_web}/bin/build-index.sh
touch ${dataDir}/db-created
+
+ chown -R graphite:graphite ${cfg.dataDir}
fi
'';
restartTriggers = [
diff --git a/nixos/modules/services/monitoring/munin.nix b/nixos/modules/services/monitoring/munin.nix
index 39c4fb1aefa..966c2eca282 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;
diff --git a/nixos/modules/services/monitoring/nagios/default.nix b/nixos/modules/services/monitoring/nagios/default.nix
index c809a3b8457..2eeddf78250 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 512e639721e..250035fe447 100644
--- a/nixos/modules/services/monitoring/smartd.nix
+++ b/nixos/modules/services/monitoring/smartd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/monitoring/statsd.nix b/nixos/modules/services/monitoring/statsd.nix
index 54b7e79f82e..05950639c1e 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
diff --git a/nixos/modules/services/monitoring/systemhealth.nix b/nixos/modules/services/monitoring/systemhealth.nix
index 0a3e666ad4e..b0e59595e13 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 c00f4bad935..cc9026f768a 100644
--- a/nixos/modules/services/monitoring/ups.nix
+++ b/nixos/modules/services/monitoring/ups.nix
@@ -1,8 +1,8 @@
-{config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
# TODO: This is not secure, have a look at the file docs/security.txt inside
# the project sources.
-with pkgs.lib;
+with lib;
let
cfg = config.power.ups;
diff --git a/nixos/modules/services/monitoring/zabbix-agent.nix b/nixos/modules/services/monitoring/zabbix-agent.nix
index 229236c1bbd..a943075be0c 100644
--- a/nixos/modules/services/monitoring/zabbix-agent.nix
+++ b/nixos/modules/services/monitoring/zabbix-agent.nix
@@ -1,7 +1,7 @@
# Zabbix agent daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -67,11 +67,11 @@ in
config = mkIf cfg.enable {
- users.extraUsers = singleton
+ users.extraUsers = mkIf (!config.services.zabbixServer.enable) (singleton
{ name = "zabbix";
uid = config.ids.uids.zabbix;
description = "Zabbix daemon user";
- };
+ });
systemd.services."zabbix-agent" =
{ description = "Zabbix Agent";
diff --git a/nixos/modules/services/monitoring/zabbix-server.nix b/nixos/modules/services/monitoring/zabbix-server.nix
index 6735b4ca327..ca283ea2a99 100644
--- a/nixos/modules/services/monitoring/zabbix-server.nix
+++ b/nixos/modules/services/monitoring/zabbix-server.nix
@@ -1,7 +1,7 @@
# Zabbix server daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/network-filesystems/drbd.nix b/nixos/modules/services/network-filesystems/drbd.nix
index 1a00ccab0a6..b914724abfe 100644
--- a/nixos/modules/services/network-filesystems/drbd.nix
+++ b/nixos/modules/services/network-filesystems/drbd.nix
@@ -1,8 +1,8 @@
# Support for DRBD, the Distributed Replicated Block Device.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.drbd; in
diff --git a/nixos/modules/services/network-filesystems/nfsd.nix b/nixos/modules/services/network-filesystems/nfsd.nix
index 4daa5e9d063..2217fec3b0f 100644
--- a/nixos/modules/services/network-filesystems/nfsd.nix
+++ b/nixos/modules/services/network-filesystems/nfsd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/network-filesystems/rsyncd.nix b/nixos/modules/services/network-filesystems/rsyncd.nix
new file mode 100644
index 00000000000..bc17add809b
--- /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 4f6fce6cd52..51a4d193d50 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 8652d0daf4c..516238fdddf 100644
--- a/nixos/modules/services/networking/amuled.nix
+++ b/nixos/modules/services/networking/amuled.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.amule;
diff --git a/nixos/modules/services/networking/avahi-daemon.nix b/nixos/modules/services/networking/avahi-daemon.nix
index d7dfca2c8dc..284b2b84e6c 100644
--- a/nixos/modules/services/networking/avahi-daemon.nix
+++ b/nixos/modules/services/networking/avahi-daemon.nix
@@ -1,7 +1,7 @@
# Avahi daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/bind.nix b/nixos/modules/services/networking/bind.nix
index 765dc014dcb..57547da1006 100644
--- a/nixos/modules/services/networking/bind.nix
+++ b/nixos/modules/services/networking/bind.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/bitlbee.nix b/nixos/modules/services/networking/bitlbee.nix
index fe37e8ea012..7276603da16 100644
--- a/nixos/modules/services/networking/bitlbee.nix
+++ b/nixos/modules/services/networking/bitlbee.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/btsync.nix b/nixos/modules/services/networking/btsync.nix
index e7fb471ccf4..5d0e17c293e 100644
--- a/nixos/modules/services/networking/btsync.nix
+++ b/nixos/modules/services/networking/btsync.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.btsync;
@@ -24,7 +24,7 @@ let
optionalString (e ? "knownHosts")
(concatStringsSep "," (map (v: "\"${v}\"") e."knownHosts"));
- sharedFoldersRecord = with pkgs.lib;
+ sharedFoldersRecord =
concatStringsSep "," (map (entry:
let helper = attr: v:
if (entry ? attr) then boolStr entry.attr else boolStr v;
@@ -164,6 +164,7 @@ in
httpLogin = mkOption {
type = types.str;
example = "allyourbase";
+ default = "";
description = ''
HTTP web login username.
'';
@@ -172,6 +173,7 @@ in
httpPass = mkOption {
type = types.str;
example = "arebelongtous";
+ default = "";
description = ''
HTTP web login password.
'';
@@ -237,12 +239,6 @@ in
{ 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 = {
diff --git a/nixos/modules/services/networking/chrony.nix b/nixos/modules/services/networking/chrony.nix
index 5e9818858e0..d1684dd9f05 100644
--- a/nixos/modules/services/networking/chrony.nix
+++ b/nixos/modules/services/networking/chrony.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/cjdns.nix b/nixos/modules/services/networking/cjdns.nix
index 9b715ec6384..9306ffd5a18 100644
--- a/nixos/modules/services/networking/cjdns.nix
+++ b/nixos/modules/services/networking/cjdns.nix
@@ -8,9 +8,9 @@
# (without too much shell hackery), a skeleton of the
# configuration building lies commented out.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/cntlm.nix b/nixos/modules/services/networking/cntlm.nix
index 96396878afc..a50aa4d0636 100644
--- a/nixos/modules/services/networking/cntlm.nix
+++ b/nixos/modules/services/networking/cntlm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -34,7 +34,7 @@ in
password = mkOption {
default = "/etc/cntlm.password";
- type = with pkgs.lib.types; string;
+ type = types.str;
description = ''Proxy account password. Note: use chmod 0600 on /etc/cntlm.password for security.'';
};
diff --git a/nixos/modules/services/networking/connman.nix b/nixos/modules/services/networking/connman.nix
index 2b26fe88129..7ed1e4805d8 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 bf7f5089368..5a353fc0942 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
- dhcpcd = if !config.boot.isContainer then pkgs.dhcpcd else pkgs.dhcpcd_without_udev;
+ 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,9 +34,8 @@ 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) and c-* and ctmp-* (NixOS
- # containers).
- denyinterfaces ${toString ignoredInterfaces} peth* vif* tap* tun* virbr* vnet* vboxnet* c-* ctmp-*
+ # (Xen) and virbr* and vnet* (libvirt).
+ denyinterfaces ${toString ignoredInterfaces} lo peth* vif* tap* tun* virbr* vnet* vboxnet*
${config.networking.dhcpcd.extraConfig}
'';
@@ -44,17 +43,6 @@ let
# Hook for emitting ip-up/ip-down events.
exitHook = pkgs.writeText "dhcpcd.exit-hook"
''
- #exec >> /var/log/dhcpcd 2>&1
- #set -x
-
- params="IFACE=$interface REASON=$reason"
-
- # only works when interface is wireless and wpa_supplicant has a control socket
- # but we allow it to fail silently
- ${optionalString config.networking.wireless.enable ''
- params+=" $(${pkgs.wpa_supplicant}/sbin/wpa_cli -i$interface status 2>/dev/null | grep ssid | sed 's|^b|B|;s|ssid|SSID|' | xargs)"
- ''}
-
if [ "$reason" = BOUND -o "$reason" = REBOOT ]; then
# Restart ntpd. We need to restart it to make sure that it
# will actually do something: if ntpd cannot resolve the
@@ -69,6 +57,8 @@ let
#if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then
# ${config.systemd.package}/bin/systemctl start ip-down.target
#fi
+
+ ${config.networking.dhcpcd.runHook}
'';
in
@@ -80,6 +70,7 @@ in
options = {
networking.dhcpcd.denyInterfaces = mkOption {
+ type = types.listOf types.str;
default = [];
description = ''
Disable the DHCP client for any interface whose name matches
@@ -90,12 +81,23 @@ in
};
networking.dhcpcd.extraConfig = mkOption {
+ type = types.lines;
default = "";
description = ''
Literal string to append to the config file generated for dhcpcd.
'';
};
+ networking.dhcpcd.runHook = mkOption {
+ type = types.lines;
+ default = "";
+ example = "if [[ $reason =~ BOUND ]]; then echo $interface: Routers are $new_routers - were $old_routers; fi";
+ description = ''
+ Shell code that will be run after all other hooks. See
+ `man dhcpcd-run-hooks` for details on what is possible.
+ '';
+ };
+
};
@@ -120,9 +122,8 @@ in
serviceConfig =
{ Type = "forking";
PIDFile = "/run/dhcpcd.pid";
- ExecStart = "@${dhcpcd}/sbin/dhcpcd dhcpcd --config ${dhcpcdConf}";
+ ExecStart = "@${dhcpcd}/sbin/dhcpcd dhcpcd --quiet --config ${dhcpcdConf}";
ExecReload = "${dhcpcd}/sbin/dhcpcd --rebind";
- StandardError = "null";
Restart = "always";
};
};
diff --git a/nixos/modules/services/networking/dhcpd.nix b/nixos/modules/services/networking/dhcpd.nix
index 5b2058e4e12..89f686c2870 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 b726493d421..8e38b9d017a 100644
--- a/nixos/modules/services/networking/dnsmasq.nix
+++ b/nixos/modules/services/networking/dnsmasq.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.dnsmasq;
diff --git a/nixos/modules/services/networking/ejabberd.nix b/nixos/modules/services/networking/ejabberd.nix
index 8a01c217eb5..28b8e234a5c 100644
--- a/nixos/modules/services/networking/ejabberd.nix
+++ b/nixos/modules/services/networking/ejabberd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix
index a1ca5dcdcb1..42914bfe5d6 100644
--- a/nixos/modules/services/networking/firewall.nix
+++ b/nixos/modules/services/networking/firewall.nix
@@ -18,11 +18,9 @@
*/
+{ config, lib, pkgs, ... }:
-
-{ config, pkgs, ... }:
-
-with pkgs.lib;
+with lib;
let
@@ -266,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}
diff --git a/nixos/modules/services/networking/flashpolicyd.nix b/nixos/modules/services/networking/flashpolicyd.nix
index f5bc550ab5f..5ba85178179 100644
--- a/nixos/modules/services/networking/flashpolicyd.nix
+++ b/nixos/modules/services/networking/flashpolicyd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/freenet.nix b/nixos/modules/services/networking/freenet.nix
index a4bd2098986..e9cacf4a16e 100644
--- a/nixos/modules/services/networking/freenet.nix
+++ b/nixos/modules/services/networking/freenet.nix
@@ -1,8 +1,8 @@
# NixOS module for Freenet daemon
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/git-daemon.nix b/nixos/modules/services/networking/git-daemon.nix
index 2e7c9c68e2f..5864efaca51 100644
--- a/nixos/modules/services/networking/git-daemon.nix
+++ b/nixos/modules/services/networking/git-daemon.nix
@@ -1,5 +1,5 @@
-{pkgs, config, ...}:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.gitDaemon;
diff --git a/nixos/modules/services/networking/gnunet.nix b/nixos/modules/services/networking/gnunet.nix
index 421c0d9bb69..03ee54af433 100644
--- a/nixos/modules/services/networking/gnunet.nix
+++ b/nixos/modules/services/networking/gnunet.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/gogoclient.nix b/nixos/modules/services/networking/gogoclient.nix
index 3b92eb8b06b..41600794197 100644
--- a/nixos/modules/services/networking/gogoclient.nix
+++ b/nixos/modules/services/networking/gogoclient.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.gogoclient;
in
diff --git a/nixos/modules/services/networking/haproxy.nix b/nixos/modules/services/networking/haproxy.nix
index c8345a528a7..c2e2c2d7a41 100644
--- a/nixos/modules/services/networking/haproxy.nix
+++ b/nixos/modules/services/networking/haproxy.nix
@@ -1,9 +1,9 @@
-{ config, pkgs, ...}:
+{ config, lib, pkgs, ... }:
let
cfg = config.services.haproxy;
haproxyCfg = pkgs.writeText "haproxy.conf" cfg.config;
in
-with pkgs.lib;
+with lib;
{
options = {
services.haproxy = {
diff --git a/nixos/modules/services/networking/hostapd.nix b/nixos/modules/services/networking/hostapd.nix
index 4edea12b6be..2adbb0a5c4e 100644
--- a/nixos/modules/services/networking/hostapd.nix
+++ b/nixos/modules/services/networking/hostapd.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
# TODO:
#
@@ -9,7 +9,7 @@
# wpa_supplicant and hostapd on the same wireless interface doesn't make any sense
# perhaps an assertion that there is a dhcp server and a dns server on the IP address serviced by the hostapd?
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/ifplugd.nix b/nixos/modules/services/networking/ifplugd.nix
index 4e939d60354..20bfca8f872 100644
--- a/nixos/modules/services/networking/ifplugd.nix
+++ b/nixos/modules/services/networking/ifplugd.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/iodined.nix b/nixos/modules/services/networking/iodined.nix
index cd150fe63fd..bc0fbb42c99 100644
--- a/nixos/modules/services/networking/iodined.nix
+++ b/nixos/modules/services/networking/iodined.nix
@@ -1,8 +1,8 @@
# NixOS module for iodine, ip over dns daemon
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.iodined;
diff --git a/nixos/modules/services/networking/ircd-hybrid/default.nix b/nixos/modules/services/networking/ircd-hybrid/default.nix
index cd82a41ef7a..a3d5b71740f 100644
--- a/nixos/modules/services/networking/ircd-hybrid/default.nix
+++ b/nixos/modules/services/networking/ircd-hybrid/default.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/kippo.nix b/nixos/modules/services/networking/kippo.nix
index 164c38940f7..d2045c9efc5 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
diff --git a/nixos/modules/services/networking/minidlna.nix b/nixos/modules/services/networking/minidlna.nix
index 73fcb1eeea8..a519857d6a0 100644
--- a/nixos/modules/services/networking/minidlna.nix
+++ b/nixos/modules/services/networking/minidlna.nix
@@ -1,8 +1,8 @@
# Module for MiniDLNA, a simple DLNA server.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/murmur.nix b/nixos/modules/services/networking/murmur.nix
index 2a5549beaf8..4f91a494747 100644
--- a/nixos/modules/services/networking/murmur.nix
+++ b/nixos/modules/services/networking/murmur.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.murmur;
diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix
index 7f4094de12f..e8d9d00cc0a 100644
--- a/nixos/modules/services/networking/nat.nix
+++ b/nixos/modules/services/networking/nat.nix
@@ -2,9 +2,9 @@
# 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
diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index fd5ff5e4498..54bdf19373d 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
diff --git a/nixos/modules/services/networking/notbit.nix b/nixos/modules/services/networking/notbit.nix
index 83dafd08379..3e8c956f191 100644
--- a/nixos/modules/services/networking/notbit.nix
+++ b/nixos/modules/services/networking/notbit.nix
@@ -1,5 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
+with pkgs.lib;
let
cfg = config.services.notbit;
varDir = "/var/lib/notbit";
@@ -14,9 +15,13 @@ let
--set XDG_RUNTIME_DIR ${varDir}
'';
};
+ opts = "${optionalString cfg.allowPrivateAddresses "-L"} ${optionalString cfg.noBootstrap "-b"} ${optionalString cfg.specifiedPeersOnly "-e"}";
+ peers = concatStringsSep " " (map (str: "-P \"${str}\"") cfg.peers);
+ listen = if cfg.listenAddress == [] then "-p ${toString cfg.port}" else
+ concatStringsSep " " (map (addr: "-a \"${addr}:${toString cfg.port}\"") cfg.listenAddress);
in
-with pkgs.lib;
+with lib;
{
### configuration
@@ -35,7 +40,7 @@ with pkgs.lib;
port = mkOption {
type = types.uniq types.int;
- default = 8443;
+ default = 8444;
description = "The port which the daemon listens for other bitmessage clients";
};
@@ -45,6 +50,38 @@ with pkgs.lib;
description = "Set the nice level for the notbit daemon";
};
+ listenAddress = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "localhost" "myhostname" ];
+ description = "The addresses which notbit will use to listen for incoming connections. These addresses are advertised to connecting clients.";
+ };
+
+ peers = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "bitmessage.org:8877" ];
+ description = "The initial set of peers notbit will connect to.";
+ };
+
+ specifiedPeersOnly = mkOption {
+ type = types.uniq types.bool;
+ default = false;
+ description = "If true, notbit will only connect to peers specified by the peers option.";
+ };
+
+ allowPrivateAddresses = mkOption {
+ type = types.uniq types.bool;
+ default = false;
+ description = "If true, notbit will allow connections to to RFC 1918 addresses.";
+ };
+
+ noBootstrap = mkOption {
+ type = types.uniq types.bool;
+ default = false;
+ description = "If true, notbit will not bootstrap an initial peerlist from bitmessage.org servers";
+ };
+
};
};
@@ -53,7 +90,7 @@ with pkgs.lib;
config = mkIf cfg.enable {
- environment.systemPackages = [ pkgs.notbit sendmail ];
+ environment.systemPackages = [ sendmail ];
systemd.services.notbit = {
description = "Notbit daemon";
@@ -70,7 +107,7 @@ with pkgs.lib;
serviceConfig = {
Type = "forking";
- ExecStart = "${pkgs.notbit}/bin/notbit -d -p ${toString cfg.port}";
+ ExecStart = "${pkgs.notbit}/bin/notbit -d ${listen} ${peers} ${opts}";
User = "notbit";
Group = "notbit";
UMask = "0077";
diff --git a/nixos/modules/services/networking/ntopng.nix b/nixos/modules/services/networking/ntopng.nix
index 156a6b32a6a..ab86f1a5b2b 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 fb7d6802136..2f638904406 100644
--- a/nixos/modules/services/networking/ntpd.nix
+++ b/nixos/modules/services/networking/ntpd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/oidentd.nix b/nixos/modules/services/networking/oidentd.nix
index a2a555a8ad1..923e7cd0986 100644
--- a/nixos/modules/services/networking/oidentd.nix
+++ b/nixos/modules/services/networking/oidentd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/networking/openfire.nix b/nixos/modules/services/networking/openfire.nix
index b2efb5e9c12..c3b4ba90b4e 100644
--- a/nixos/modules/services/networking/openfire.nix
+++ b/nixos/modules/services/networking/openfire.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/openvpn.nix b/nixos/modules/services/networking/openvpn.nix
index 292d45f4347..9dc88e61865 100644
--- a/nixos/modules/services/networking/openvpn.nix
+++ b/nixos/modules/services/networking/openvpn.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -56,6 +56,7 @@ let
serviceConfig.ExecStart = "@${openvpn}/sbin/openvpn openvpn --config ${configFile}";
serviceConfig.Restart = "always";
+ serviceConfig.Type = "notify";
};
in
diff --git a/nixos/modules/services/networking/prayer.nix b/nixos/modules/services/networking/prayer.nix
index fb541bf101a..ad0fb0af01c 100644
--- a/nixos/modules/services/networking/prayer.nix
+++ b/nixos/modules/services/networking/prayer.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/privoxy.nix b/nixos/modules/services/networking/privoxy.nix
index 89c40c53157..950112b2dab 100644
--- a/nixos/modules/services/networking/privoxy.nix
+++ b/nixos/modules/services/networking/privoxy.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/quassel.nix b/nixos/modules/services/networking/quassel.nix
index f3a4e457ec8..749e5dcebb6 100644
--- a/nixos/modules/services/networking/quassel.nix
+++ b/nixos/modules/services/networking/quassel.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
quassel = pkgs.kde4.quasselDaemon;
diff --git a/nixos/modules/services/networking/radvd.nix b/nixos/modules/services/networking/radvd.nix
index 8d586ce6e46..08762c9c837 100644
--- a/nixos/modules/services/networking/radvd.nix
+++ b/nixos/modules/services/networking/radvd.nix
@@ -1,8 +1,8 @@
# Module for the IPv6 Router Advertisement Daemon.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/rdnssd.nix b/nixos/modules/services/networking/rdnssd.nix
index f797206ad5c..4c1891816e3 100644
--- a/nixos/modules/services/networking/rdnssd.nix
+++ b/nixos/modules/services/networking/rdnssd.nix
@@ -1,9 +1,9 @@
# Module for rdnssd, a daemon that configures DNS servers in
# /etc/resolv/conf from IPv6 RDNSS advertisements.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/networking/rpcbind.nix b/nixos/modules/services/networking/rpcbind.nix
index c966f85e260..eef1e8e8cd8 100644
--- a/nixos/modules/services/networking/rpcbind.nix
+++ b/nixos/modules/services/networking/rpcbind.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/sabnzbd.nix b/nixos/modules/services/networking/sabnzbd.nix
index 8816ac0d2f8..83db0841b34 100644
--- a/nixos/modules/services/networking/sabnzbd.nix
+++ b/nixos/modules/services/networking/sabnzbd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/searx.nix b/nixos/modules/services/networking/searx.nix
index 30f21151a76..b29db58af99 100644
--- a/nixos/modules/services/networking/searx.nix
+++ b/nixos/modules/services/networking/searx.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/spiped.nix b/nixos/modules/services/networking/spiped.nix
new file mode 100644
index 00000000000..005d7182351
--- /dev/null
+++ b/nixos/modules/services/networking/spiped.nix
@@ -0,0 +1,220 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.spiped;
+in
+{
+ options = {
+ services.spiped = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Enable the spiped service module.";
+ };
+
+ config = mkOption {
+ type = types.attrsOf (types.submodule (
+ {
+ options = {
+ encrypt = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Take unencrypted connections from the
+ source socket and send encrypted
+ connections to the target socket.
+ '';
+ };
+
+ decrypt = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Take encrypted connections from the
+ source socket and send unencrypted
+ connections to the target socket.
+ '';
+ };
+
+ source = mkOption {
+ type = types.str;
+ description = ''
+ Address on which spiped should listen for incoming
+ connections. Must be in one of the following formats:
+ /absolute/path/to/unix/socket,
+ host.name:port,
+ [ip.v4.ad.dr]:port or
+ [ipv6::addr]:port - note that
+ hostnames are resolved when spiped is launched and are
+ not re-resolved later; thus if DNS entries change
+ spiped will continue to connect to the expired
+ address.
+ '';
+ };
+
+ target = mkOption {
+ type = types.str;
+ description = "Address to which spiped should connect.";
+ };
+
+ keyfile = mkOption {
+ type = types.path;
+ description = ''
+ Name of a file containing the spiped key. As the
+ daemon runs as the spiped user, the
+ key file must be somewhere owned by that user. By
+ default, we recommend putting the keys for any spipe
+ services in /var/lib/spiped.
+ '';
+ };
+
+ timeout = mkOption {
+ type = types.int;
+ default = 5;
+ description = ''
+ Timeout, in seconds, after which an attempt to connect to
+ the target or a protocol handshake will be aborted (and the
+ connection dropped) if not completed
+ '';
+ };
+
+ maxConns = mkOption {
+ type = types.int;
+ default = 100;
+ description = ''
+ Limit on the number of simultaneous connections allowed.
+ '';
+ };
+
+ waitForDNS = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Wait for DNS. Normally when spiped is
+ launched it resolves addresses and binds to its source
+ socket before the parent process returns; with this option
+ it will daemonize first and retry failed DNS lookups until
+ they succeed. This allows spiped to
+ launch even if DNS isn't set up yet, but at the expense of
+ losing the guarantee that once spiped has
+ finished launching it will be ready to create pipes.
+ '';
+ };
+
+ disableKeepalives = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Disable transport layer keep-alives.";
+ };
+
+ weakHandshake = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Use fast/weak handshaking: This reduces the CPU time spent
+ in the initial connection setup, at the expense of losing
+ perfect forward secrecy.
+ '';
+ };
+
+ resolveRefresh = mkOption {
+ type = types.int;
+ default = 60;
+ description = ''
+ Resolution refresh time for the target socket, in seconds.
+ '';
+ };
+
+ disableReresolution = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Disable target address re-resolution.";
+ };
+ };
+ }
+ ));
+
+ default = {};
+
+ example = literalExample ''
+ {
+ pipe1 =
+ { keyfile = "/var/lib/spiped/pipe1.key";
+ encrypt = true;
+ source = "localhost:6000";
+ target = "endpoint.example.com:7000";
+ };
+ pipe2 =
+ { keyfile = "/var/lib/spiped/pipe2.key";
+ decrypt = true;
+ source = "0.0.0.0:7000";
+ target = "localhost:3000";
+ };
+ }
+ '';
+
+ description = ''
+ Configuration for a secure pipe daemon. The daemon can be
+ started, stopped, or examined using
+ systemctl, under the name
+ spiped@foo.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions = mapAttrsToList (name: c: {
+ assertion = (c.encrypt -> !c.decrypt) || (c.decrypt -> c.encrypt);
+ message = "A pipe must either encrypt or decrypt";
+ }) cfg.config;
+
+ users.extraGroups.spiped.gid = config.ids.gids.spiped;
+ users.extraUsers.spiped = {
+ description = "Secure Pipe Service user";
+ group = "spiped";
+ uid = config.ids.uids.spiped;
+ };
+
+ systemd.services."spiped@" = {
+ description = "Secure pipe '%i'";
+ after = [ "network.target" ];
+
+ serviceConfig = {
+ Restart = "always";
+ User = "spiped";
+ PermissionsStartOnly = true;
+ };
+
+ preStart = ''
+ cd /var/lib/spiped
+ chmod -R 0660 *
+ chown -R spiped:spiped *
+ '';
+ scriptArgs = "%i";
+ script = "exec ${pkgs.spiped}/bin/spiped -F `cat /etc/spiped/$1.spec`";
+ };
+
+ system.activationScripts.spiped = optionalString (cfg.config != {})
+ "mkdir -p /var/lib/spiped";
+
+ # Setup spiped config files
+ environment.etc = mapAttrs' (name: cfg: nameValuePair "spiped/${name}.spec"
+ { text = concatStringsSep " "
+ [ (if cfg.encrypt then "-e" else "-d") # Mode
+ "-s ${cfg.source}" # Source
+ "-t ${cfg.target}" # Target
+ "-k ${cfg.keyfile}" # Keyfile
+ "-n ${toString cfg.maxConns}" # Max number of conns
+ "-o ${toString cfg.timeout}" # Timeout
+ (optionalString cfg.waitForDNS "-D") # Wait for DNS
+ (optionalString cfg.weakHandshake "-f") # No PFS
+ (optionalString cfg.disableKeepalives "-j") # Keepalives
+ (if cfg.disableReresolution then "-R"
+ else "-r ${toString cfg.resolveRefresh}")
+ ];
+ }) cfg.config;
+ };
+}
diff --git a/nixos/modules/services/networking/ssh/lshd.nix b/nixos/modules/services/networking/ssh/lshd.nix
index 04ef76f1e4d..fca30a1fe49 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 537fe0848ea..e4b29a0b909 100644
--- a/nixos/modules/services/networking/ssh/sshd.nix
+++ b/nixos/modules/services/networking/ssh/sshd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -18,9 +18,9 @@ let
knownHosts = map (h: getAttr h cfg.knownHosts) (attrNames cfg.knownHosts);
knownHostsFile = pkgs.writeText "ssh_known_hosts" (
- flip concatMapStrings knownHosts (h:
- "${concatStringsSep "," h.hostNames} ${readFile h.publicKeyFile}"
- )
+ flip concatMapStrings knownHosts (h: ''
+ ${concatStringsSep "," h.hostNames} ${if h.publicKey != null then h.publicKey else readFile h.publicKeyFile}
+ '')
);
userOptions = {
@@ -39,7 +39,7 @@ let
};
keyFiles = mkOption {
- type = types.listOf types.unspecified;
+ type = types.listOf types.path;
default = [];
description = ''
A list of files each containing one OpenSSH public key that should be
@@ -86,6 +86,16 @@ in
'';
};
+ startWhenNeeded = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If set, sshd is socket-activated; that
+ is, instead of having it permanently running as a daemon,
+ systemd will start an instance for each incoming connection.
+ '';
+ };
+
forwardX11 = mkOption {
type = types.bool;
default = cfgc.setXAuthLocation;
@@ -172,7 +182,7 @@ in
};
authorizedKeysFiles = mkOption {
- type = types.listOf types.unspecified;
+ type = types.listOf types.str;
default = [];
description = "Files from with authorized keys are read.";
};
@@ -208,7 +218,18 @@ in
the host's ssh service.
'';
};
+ publicKey = mkOption {
+ default = null;
+ type = types.nullOr types.str;
+ description = ''
+ The public key data for the host. You can fetch a public key
+ from a running SSH server with the ssh-keyscan
+ command.
+ '';
+ };
publicKeyFile = mkOption {
+ default = null;
+ type = types.nullOr types.path;
description = ''
The path to the public key file for the host. The public
key file is read at build time and saved in the Nix store.
@@ -248,44 +269,66 @@ in
}
];
- systemd.services.sshd =
- { description = "SSH Daemon";
+ systemd =
+ let
+ service =
+ { description = "SSH Daemon";
- wantedBy = [ "multi-user.target" ];
+ wantedBy = optional (!cfg.startWhenNeeded) "multi-user.target";
- stopIfChanged = false;
+ stopIfChanged = false;
- path = [ pkgs.openssh pkgs.gawk ];
+ path = [ pkgs.openssh pkgs.gawk ];
- environment.LD_LIBRARY_PATH = nssModulesPath;
- environment.LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
+ environment.LD_LIBRARY_PATH = nssModulesPath;
- preStart =
- ''
- mkdir -m 0755 -p /etc/ssh
+ preStart =
+ ''
+ mkdir -m 0755 -p /etc/ssh
- ${flip concatMapStrings cfg.hostKeys (k: ''
- if ! [ -f "${k.path}" ]; then
- ssh-keygen -t "${k.type}" -b "${toString k.bits}" -f "${k.path}" -N ""
- fi
- '')}
- '';
+ ${flip concatMapStrings cfg.hostKeys (k: ''
+ if ! [ -f "${k.path}" ]; then
+ ssh-keygen -t "${k.type}" -b "${toString k.bits}" -f "${k.path}" -N ""
+ fi
+ '')}
+ '';
- serviceConfig =
- { ExecStart =
- "${pkgs.openssh}/sbin/sshd " +
- "-f ${pkgs.writeText "sshd_config" cfg.extraConfig}";
- Restart = "always";
- Type = "forking";
- KillMode = "process";
- PIDFile = "/run/sshd.pid";
+ serviceConfig =
+ { ExecStart =
+ "${pkgs.openssh}/sbin/sshd " + (optionalString cfg.startWhenNeeded "-i ") +
+ "-f ${pkgs.writeText "sshd_config" cfg.extraConfig}";
+ KillMode = "process";
+ } // (if cfg.startWhenNeeded then {
+ StandardInput = "socket";
+ } else {
+ Restart = "always";
+ Type = "forking";
+ PIDFile = "/run/sshd.pid";
+ });
};
+ in
+
+ if cfg.startWhenNeeded then {
+
+ sockets.sshd =
+ { description = "SSH Socket";
+ wantedBy = [ "sockets.target" ];
+ socketConfig.ListenStream = cfg.ports;
+ socketConfig.Accept = true;
+ };
+
+ services."sshd@" = service;
+
+ } else {
+
+ services.sshd = service;
+
};
networking.firewall.allowedTCPPorts = cfg.ports;
security.pam.services.sshd =
- { startSession = !config.boot.isContainer;
+ { startSession = true;
showMotd = true;
unixAuth = cfg.passwordAuthentication;
};
@@ -335,7 +378,12 @@ in
'';
assertions = [{ assertion = if cfg.forwardX11 then cfgc.setXAuthLocation else true;
- message = "cannot enable X11 forwarding without setting xauth location";}];
+ message = "cannot enable X11 forwarding without setting xauth location";}]
+ ++ flip mapAttrsToList cfg.knownHosts (name: data: {
+ assertion = (data.publicKey == null && data.publicKeyFile != null) ||
+ (data.publicKey != null && data.publicKeyFile == null);
+ message = "knownHost ${name} must contain either a publicKey or publicKeyFile";
+ });
};
diff --git a/nixos/modules/services/networking/supybot.nix b/nixos/modules/services/networking/supybot.nix
index fa8b7556de5..2cfb9fc9b92 100644
--- a/nixos/modules/services/networking/supybot.nix
+++ b/nixos/modules/services/networking/supybot.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix
index 8ca16730a94..02572c1e27d 100644
--- a/nixos/modules/services/networking/syncthing.nix
+++ b/nixos/modules/services/networking/syncthing.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/tcpcrypt.nix b/nixos/modules/services/networking/tcpcrypt.nix
index 48cb884f246..1359006aef4 100644
--- a/nixos/modules/services/networking/tcpcrypt.nix
+++ b/nixos/modules/services/networking/tcpcrypt.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/teamspeak3.nix b/nixos/modules/services/networking/teamspeak3.nix
new file mode 100644
index 00000000000..2d3478d52f8
--- /dev/null
+++ b/nixos/modules/services/networking/teamspeak3.nix
@@ -0,0 +1,142 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+ ts3 = pkgs.teamspeak_server;
+ cfg = config.services.teamspeak3;
+ user = "teamspeak";
+ group = "teamspeak";
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.teamspeak3 = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to run the Teamspeak3 voice communication server daemon.
+ '';
+ };
+
+ dataDir = mkOption {
+ type = types.path;
+ default = "/var/lib/teamspeak3-server";
+ description = ''
+ Directory to store TS3 database and other state/data files.
+ '';
+ };
+
+ logPath = mkOption {
+ type = types.path;
+ default = "/var/log/teamspeak3-server/";
+ description = ''
+ Directory to store log files in.
+ '';
+ };
+
+ voiceIP = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ description = ''
+ IP on which the server instance will listen for incoming voice connections. Defaults to any IP.
+ '';
+ };
+
+ defaultVoicePort = mkOption {
+ type = types.int;
+ default = 9987;
+ description = ''
+ Default UDP port for clients to connect to virtual servers - used for first virtual server, subsequent ones will open on incrementing port numbers by default.
+ '';
+ };
+
+ fileTransferIP = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ description = ''
+ IP on which the server instance will listen for incoming file transfer connections. Defaults to any IP.
+ '';
+ };
+
+ fileTransferPort = mkOption {
+ type = types.int;
+ default = 30033;
+ description = ''
+ TCP port opened for file transfers.
+ '';
+ };
+
+ queryIP = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ description = ''
+ IP on which the server instance will listen for incoming ServerQuery connections. Defaults to any IP.
+ '';
+ };
+
+ queryPort = mkOption {
+ type = types.int;
+ default = 10011;
+ description = ''
+ TCP port opened for ServerQuery connections.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers.teamspeak =
+ { name = "teamspeak";
+ description = "Teamspeak3 voice communication server daemon";
+ group = group;
+ uid = config.ids.uids.teamspeak;
+ };
+
+ users.extraGroups.teamspeak =
+ { name = "teamspeak";
+ gid = config.ids.gids.teamspeak;
+ };
+
+ systemd.services.teamspeak3-server = {
+ description = "Teamspeak3 voice communication server daemon";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ preStart = ''
+ mkdir -p ${cfg.dataDir}
+ mkdir -p ${cfg.logPath}
+ chown ${user}:${group} ${cfg.dataDir}
+ chown ${user}:${group} ${cfg.logPath}
+ '';
+
+ serviceConfig =
+ { ExecStart = ''
+ ${ts3}/bin/ts3server \
+ dbsqlpath=${ts3}/lib/teamspeak/sql/ logpath=${cfg.logPath} \
+ voice_ip=${cfg.voiceIP} default_voice_port=${toString cfg.defaultVoicePort} \
+ filetransfer_ip=${cfg.fileTransferIP} filetransfer_port=${toString cfg.fileTransferPort} \
+ query_ip=${cfg.queryIP} query_port=${toString cfg.queryPort}
+ '';
+ WorkingDirectory = cfg.dataDir;
+ User = user;
+ Group = group;
+ PermissionsStartOnly = true; # preStart needs to run with root permissions
+ };
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/tftpd.nix b/nixos/modules/services/networking/tftpd.nix
index 37935496c59..a2f7ff06ea6 100644
--- a/nixos/modules/services/networking/tftpd.nix
+++ b/nixos/modules/services/networking/tftpd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/networking/unbound.nix b/nixos/modules/services/networking/unbound.nix
index fb75b4ed069..415ff13bdda 100644
--- a/nixos/modules/services/networking/unbound.nix
+++ b/nixos/modules/services/networking/unbound.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -18,25 +18,25 @@ let
"forward-zone:\n name: .\n" +
concatMapStrings (x: " forward-addr: ${x}\n") cfg.forwardAddresses;
- confFile = pkgs.writeText "unbound.conf"
- ''
- server:
- directory: "${stateDir}"
- username: ${username}
- # make sure unbound can access entropy from inside the chroot.
- # e.g. on linux the use these commands (on BSD, devfs(8) is used):
- # mount --bind -n /dev/random /etc/unbound/dev/random
- # and mount --bind -n /dev/log /etc/unbound/dev/log
- chroot: "${stateDir}"
- # logfile: "${stateDir}/unbound.log" #uncomment to use logfile.
- pidfile: "${stateDir}/unbound.pid"
- verbosity: 1 # uncomment and increase to get more logging.
- # listen on all interfaces, answer queries from the local subnet.
+ confFile = pkgs.writeText "unbound.conf" ''
+ server:
+ directory: "${stateDir}"
+ username: ${username}
+ # make sure unbound can access entropy from inside the chroot.
+ # e.g. on linux the use these commands (on BSD, devfs(8) is used):
+ # mount --bind -n /dev/random /etc/unbound/dev/random
+ # and mount --bind -n /dev/log /etc/unbound/dev/log
+ chroot: "${stateDir}"
+ # logfile: "${stateDir}/unbound.log" #uncomment to use logfile.
+ pidfile: "${stateDir}/unbound.pid"
+ verbosity: 1 # uncomment and increase to get more logging.
${interfaces}
${access}
- ${forward}
- ${cfg.extraConfig}
- '';
+
+ ${forward}
+
+ ${cfg.extraConfig}
+ '';
in
@@ -45,74 +45,61 @@ in
###### interface
options = {
-
services.unbound = {
enable = mkOption {
- default = false;
- description = "
- Whether to enable the Unbound domain name server.
- ";
+ default = false;
+ description = "Whether to enable the Unbound domain name server.";
};
allowedAccess = mkOption {
- default = ["127.0.0.0/24"];
- description = "
- What networks are allowed to use us as a resolver.
- ";
+ default = ["127.0.0.0/24"];
+ description = "What networks are allowed to use unbound as a resolver.";
};
interfaces = mkOption {
- default = [ "127.0.0.0" "::1" ];
- description = "
- What addresses the server should listen to.
- ";
+ default = [ "127.0.0.1" "::1" ];
+ description = "What addresses the server should listen on.";
};
forwardAddresses = mkOption {
- default = [ ];
- description = "
- What servers to forward the queries to.
- ";
+ default = [ ];
+ description = "What servers to forward queries to.";
};
extraConfig = mkOption {
- default = "";
- description = "
- Extra unbound config
- ";
+ default = "";
+ description = "Extra lines of unbound config.";
};
};
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ environment.systemPackages = [ pkgs.unbound ];
+
+ users.extraUsers = singleton {
+ name = username;
+ uid = config.ids.uids.unbound;
+ description = "unbound daemon user";
+ home = stateDir;
+ createHome = true;
+ };
+
+ systemd.services.unbound = {
+ description="Unbound recursive Domain Name Server";
+ after = [ "network.target" ];
+ before = [ "nss-lookup.target" ];
+ wants = [" nss-lookup.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ path = [ pkgs.unbound ];
+ serviceConfig.ExecStart = "${pkgs.unbound}/sbin/unbound -d -c ${confFile}";
+ };
};
-
- ###### implementation
-
- config = mkIf config.services.unbound.enable {
- environment.systemPackages = [ pkgs.unbound ];
-
- users.extraUsers = singleton
- { name = username;
- uid = config.ids.uids.unbound;
- description = "unbound daemon user";
- home = "/tmp";
- };
-
- jobs.unbound =
- { description = "Unbound name server job";
-
- preStart =
- ''
- ${pkgs.coreutils}/bin/mkdir -p ${stateDir}
- '';
-
- daemonType = "fork";
-
- exec = "${pkgs.unbound}/sbin/unbound -c ${confFile}";
- };
-
- };
-
}
diff --git a/nixos/modules/services/networking/vsftpd.nix b/nixos/modules/services/networking/vsftpd.nix
index 763fa8dc3c4..62b6027c012 100644
--- a/nixos/modules/services/networking/vsftpd.nix
+++ b/nixos/modules/services/networking/vsftpd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/networking/wakeonlan.nix b/nixos/modules/services/networking/wakeonlan.nix
index 1fc54986b16..11bb7e92525 100644
--- a/nixos/modules/services/networking/wakeonlan.nix
+++ b/nixos/modules/services/networking/wakeonlan.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
interfaces = config.services.wakeonlan.interfaces;
diff --git a/nixos/modules/services/networking/websockify.nix b/nixos/modules/services/networking/websockify.nix
index 12042bbad6c..4b76350ecf8 100644
--- a/nixos/modules/services/networking/websockify.nix
+++ b/nixos/modules/services/networking/websockify.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.networking.websockify; in {
options = {
diff --git a/nixos/modules/services/networking/wicd.nix b/nixos/modules/services/networking/wicd.nix
index 8e012273216..18258084fc2 100644
--- a/nixos/modules/services/networking/wicd.nix
+++ b/nixos/modules/services/networking/wicd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix
index 5e5f81ed5a0..771eeecd772 100644
--- a/nixos/modules/services/networking/wpa_supplicant.nix
+++ b/nixos/modules/services/networking/wpa_supplicant.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -46,9 +46,7 @@ in
example = [ "wlan0" "wlan1" ];
description = ''
The interfaces wpa_supplicant will use. If empty, it will
- automatically use all wireless interfaces. (Note that auto-detection is currently
- broken on Linux 3.4.x kernels. See http://github.com/NixOS/nixos/issues/10 for
- further details.)
+ automatically use all wireless interfaces.
'';
};
@@ -92,11 +90,11 @@ in
services.dbus.packages = [ pkgs.wpa_supplicant ];
+ # FIXME: start a separate wpa_supplicant instance per interface.
jobs.wpa_supplicant =
{ description = "WPA Supplicant";
wantedBy = [ "network.target" ];
- after = [ "systemd-udev-settle.service" ];
path = [ pkgs.wpa_supplicant ];
@@ -135,6 +133,12 @@ in
assertions = [{ assertion = !cfg.userControlled.enable || cfg.interfaces != [];
message = "user controlled wpa_supplicant needs explicit networking.wireless.interfaces";}];
+ # Restart wpa_supplicant when a wlan device appears or disappears.
+ services.udev.extraRules =
+ ''
+ ACTION=="add|remove", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", RUN+="${config.systemd.package}/bin/systemctl try-restart wpa_supplicant.service"
+ '';
+
};
}
diff --git a/nixos/modules/services/networking/xinetd.nix b/nixos/modules/services/networking/xinetd.nix
index 626183b810f..14ee52ae52e 100644
--- a/nixos/modules/services/networking/xinetd.nix
+++ b/nixos/modules/services/networking/xinetd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index fb8923e107a..d229c610669 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -56,6 +56,15 @@ in
'';
};
+ listenAddresses = mkOption {
+ type = types.listOf types.str;
+ default = [ "127.0.0.1:631" ];
+ example = [ "*:631" ];
+ description = ''
+ A list of addresses and ports on which to listen.
+ '';
+ };
+
bindirCmds = mkOption {
type = types.lines;
internal = true;
@@ -126,7 +135,8 @@ in
{ description = "CUPS Printing Daemon";
wantedBy = [ "multi-user.target" ];
- after = [ "network-interfaces.target" ];
+ wants = [ "network.target" ];
+ after = [ "network.target" ];
path = [ cups ];
@@ -145,7 +155,7 @@ in
services.printing.drivers =
[ pkgs.cups pkgs.cups_pdf_filter pkgs.ghostscript additionalBackends
pkgs.perl pkgs.coreutils pkgs.gnused pkgs.bc pkgs.gawk pkgs.gnugrep
- ];
+ ];
services.printing.cupsdConf =
''
@@ -153,7 +163,9 @@ in
SystemGroup root wheel
- Listen localhost:631
+ ${concatMapStrings (addr: ''
+ Listen ${addr}
+ '') cfg.listenAddresses}
Listen /var/run/cups/cups.sock
# Note: we can't use ${cups}/etc/cups as the ServerRoot, since
diff --git a/nixos/modules/services/scheduling/atd.nix b/nixos/modules/services/scheduling/atd.nix
index c516c5889f1..c6f128ec402 100644
--- a/nixos/modules/services/scheduling/atd.nix
+++ b/nixos/modules/services/scheduling/atd.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/scheduling/cron.nix b/nixos/modules/services/scheduling/cron.nix
index 44ed1ba5a07..5da71b12dd7 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 fda29ca0482..346a64f2c3c 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 d647301889a..b7a3566f95d 100644
--- a/nixos/modules/services/search/elasticsearch.nix
+++ b/nixos/modules/services/search/elasticsearch.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.elasticsearch;
diff --git a/nixos/modules/services/search/solr.nix b/nixos/modules/services/search/solr.nix
index a1567c535d9..38d9dedbe3c 100644
--- a/nixos/modules/services/search/solr.nix
+++ b/nixos/modules/services/search/solr.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/security/clamav.nix b/nixos/modules/services/security/clamav.nix
index 5ccb4927fcb..057891a6047 100644
--- a/nixos/modules/services/security/clamav.nix
+++ b/nixos/modules/services/security/clamav.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
clamavUser = "clamav";
stateDir = "/var/lib/clamav";
diff --git a/nixos/modules/services/security/fail2ban.nix b/nixos/modules/services/security/fail2ban.nix
index ae1fd22d23e..af545016637 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 5f8d398996f..7270a9f9814 100644
--- a/nixos/modules/services/security/fprot.nix
+++ b/nixos/modules/services/security/fprot.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
fprotUser = "fprot";
stateDir = "/var/lib/fprot";
diff --git a/nixos/modules/services/security/haveged.nix b/nixos/modules/services/security/haveged.nix
index c3ea3fb03ed..1d52ed55dbd 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 e70eb8511a6..582dd124c29 100644
--- a/nixos/modules/services/security/tor.nix
+++ b/nixos/modules/services/security/tor.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/security/torify.nix b/nixos/modules/services/security/torify.nix
index 1c158906a91..53f48a714b4 100644
--- a/nixos/modules/services/security/torify.nix
+++ b/nixos/modules/services/security/torify.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.tor;
diff --git a/nixos/modules/services/security/torsocks.nix b/nixos/modules/services/security/torsocks.nix
index d6974282a6b..ede6c983677 100644
--- a/nixos/modules/services/security/torsocks.nix
+++ b/nixos/modules/services/security/torsocks.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.tor;
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index cb5110f6feb..8d02a6404ac 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
@@ -16,7 +16,7 @@ let
buildCommand = ''
ensureDir $out
- cp -v ${pkgs.dbus_daemon}/etc/dbus-1/system.conf $out/system.conf
+ cp -v ${pkgs.dbus.daemon}/etc/dbus-1/system.conf $out/system.conf
# !!! Hm, these `sed' calls are rather error-prone...
@@ -31,7 +31,7 @@ let
-e 's||${systemServiceDirs}|' \
-e 's|system.d|${systemIncludeDirs}|'
- cp ${pkgs.dbus_daemon}/etc/dbus-1/session.conf $out/session.conf
+ cp ${pkgs.dbus.daemon}/etc/dbus-1/session.conf $out/session.conf
# Add the services and session.d directories to the session bus
# search path.
@@ -97,7 +97,7 @@ in
config = mkIf cfg.enable {
- environment.systemPackages = [ pkgs.dbus_daemon pkgs.dbus_tools ];
+ environment.systemPackages = [ pkgs.dbus.daemon pkgs.dbus_tools ];
environment.etc = singleton
{ source = configDir;
@@ -113,30 +113,7 @@ in
users.extraGroups.messagebus.gid = config.ids.gids.messagebus;
- # FIXME: these are copied verbatim from the dbus source tree. We
- # should install and use the originals.
- systemd.units."dbus.socket".text =
- ''
- [Unit]
- Description=D-Bus System Message Bus Socket
-
- [Socket]
- ListenStream=/var/run/dbus/system_bus_socket
- '';
-
- systemd.units."dbus.service".text =
- ''
- [Unit]
- Description=D-Bus System Message Bus
- Requires=dbus.socket
-
- [Service]
- ExecStartPre=${pkgs.dbus_tools}/bin/dbus-uuidgen --ensure
- ExecStartPre=-${pkgs.coreutils}/bin/rm -f /var/run/dbus/pid
- ExecStart=${pkgs.dbus_daemon}/bin/dbus-daemon --system --address=systemd: --nofork --systemd-activation
- ExecReload=${pkgs.dbus_tools}/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
- OOMScoreAdjust=-900
- '';
+ systemd.packages = [ pkgs.dbus.daemon ];
security.setuidOwners = singleton
{ program = "dbus-daemon-launch-helper";
diff --git a/nixos/modules/services/system/nscd.nix b/nixos/modules/services/system/nscd.nix
index 3259bdbbe12..1ac82064a1f 100644
--- a/nixos/modules/services/system/nscd.nix
+++ b/nixos/modules/services/system/nscd.nix
@@ -1,6 +1,6 @@
-{pkgs, config, ...}:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -9,6 +9,8 @@ let
inherit (pkgs.lib) singleton;
+ cfgFile = pkgs.writeText "nscd.conf" cfg.config;
+
in
{
@@ -63,7 +65,7 @@ in
restartTriggers = [ config.environment.etc.hosts.source ];
serviceConfig =
- { ExecStart = "@${pkgs.glibc}/sbin/nscd nscd -f ${pkgs.writeText "nscd.conf" cfg.config}";
+ { ExecStart = "@${pkgs.glibc}/sbin/nscd nscd -f ${cfgFile}";
Type = "forking";
PIDFile = "/run/nscd/nscd.pid";
Restart = "always";
@@ -73,6 +75,15 @@ in
"${pkgs.glibc}/sbin/nscd --invalidate hosts"
];
};
+
+ # Urgggggh... Nscd forks before opening its socket and writing
+ # its pid. So wait until it's ready.
+ postStart =
+ ''
+ while ! ${pkgs.glibc}/sbin/nscd -g -f ${cfgFile} > /dev/null; do
+ sleep 0.2
+ done
+ '';
};
};
diff --git a/nixos/modules/services/torrent/deluge.nix b/nixos/modules/services/torrent/deluge.nix
index e0c212e5661..00df4042d89 100644
--- a/nixos/modules/services/torrent/deluge.nix
+++ b/nixos/modules/services/torrent/deluge.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.deluge;
diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix
index 68f9b0647c0..02db4a7a5b2 100644
--- a/nixos/modules/services/torrent/transmission.nix
+++ b/nixos/modules/services/torrent/transmission.nix
@@ -1,13 +1,14 @@
-# NixOS module for Transmission BitTorrent daemon
+{ config, lib, pkgs, ... }:
-{ config, pkgs, ... }:
-
-with pkgs.lib;
+with lib;
let
-
cfg = config.services.transmission;
+ apparmor = config.security.apparmor.enable;
+
homeDir = "/var/lib/transmission";
+ downloadDir = "${homeDir}/Downloads";
+ incompleteDir = "${homeDir}/.incomplete";
settingsDir = "${homeDir}/.config/transmission-daemon";
settingsFile = "${settingsDir}/settings.json";
@@ -31,16 +32,12 @@ let
(if isList value then value else [value]))
as));
+ # for users in group "transmission" to have access to torrents
+ fullSettings = cfg.settings // { umask = 2; };
in
-
{
-
- ### configuration
-
options = {
-
services.transmission = {
-
enable = mkOption {
type = types.uniq types.bool;
default = false;
@@ -59,65 +56,48 @@ in
type = types.attrs;
default =
{
- # for users in group "transmission" to have access to torrents
- umask = 2;
- }
- ;
+ download-dir = downloadDir;
+ incomplete-dir = incompleteDir;
+ incomplete-dir-enabled = true;
+ };
example =
{
download-dir = "/srv/torrents/";
incomplete-dir = "/srv/torrents/.incomplete/";
incomplete-dir-enabled = true;
rpc-whitelist = "127.0.0.1,192.168.*.*";
- # for users in group "transmission" to have access to torrents
- umask = 2;
- }
- ;
+ };
description = ''
Attribute set whos fields overwrites fields in settings.json (each
time the service starts). String values must be quoted, integer and
boolean values must not.
- See https://trac.transmissionbt.com/wiki/EditConfigFiles for documentation
- and/or look at ${settingsFile}."
+ See https://trac.transmissionbt.com/wiki/EditConfigFiles for
+ documentation and/or look at ${settingsFile}.
'';
};
- rpc_port = mkOption {
+ port = mkOption {
type = types.uniq types.int;
default = 9091;
description = "TCP port number to run the RPC/web interface.";
};
-
- apparmor = mkOption {
- type = types.uniq types.bool;
- default = true;
- description = "Generate apparmor profile for transmission-daemon.";
- };
};
-
};
- ### implementation
-
config = mkIf cfg.enable {
-
systemd.services.transmission = {
- description = "Transmission BitTorrent Daemon";
- after = [ "network.target" ] ++ optional (config.security.apparmor.enable && cfg.apparmor) "apparmor.service";
- requires = mkIf (config.security.apparmor.enable && cfg.apparmor) [ "apparmor.service" ];
+ description = "Transmission BitTorrent Service";
+ after = [ "network.target" ] ++ optional apparmor "apparmor.service";
+ requires = mkIf apparmor [ "apparmor.service" ];
wantedBy = [ "multi-user.target" ];
# 1) Only the "transmission" user and group have access to torrents.
# 2) Optionally update/force specific fields into the configuration file.
- serviceConfig.ExecStartPre =
- if cfg.settings != {} then ''
- ${pkgs.stdenv.shell} -c "chmod 770 ${homeDir} && mkdir -p ${settingsDir} && ${pkgs.transmission}/bin/transmission-daemon -d |& sed ${attrsToSedArgs cfg.settings} > ${settingsFile}.tmp && mv ${settingsFile}.tmp ${settingsFile}"
- ''
- else ''
- ${pkgs.stdenv.shell} -c "chmod 770 ${homeDir}"
- '';
- serviceConfig.ExecStart = "${pkgs.transmission}/bin/transmission-daemon -f --port ${toString config.services.transmission.rpc_port}";
+ serviceConfig.ExecStartPre = ''
+ ${pkgs.stdenv.shell} -c "chmod 770 ${homeDir} && mkdir -p ${settingsDir} ${downloadDir} ${incompleteDir} && ${pkgs.transmission}/bin/transmission-daemon -d |& sed ${attrsToSedArgs fullSettings} > ${settingsFile}.tmp && mv ${settingsFile}.tmp ${settingsFile}"
+ '';
+ serviceConfig.ExecStart = "${pkgs.transmission}/bin/transmission-daemon -f --port ${toString config.services.transmission.port}";
serviceConfig.ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
serviceConfig.User = "transmission";
# NOTE: transmission has an internal umask that also must be set (in settings.json)
@@ -127,6 +107,7 @@ in
# It's useful to have transmission in path, e.g. for remote control
environment.systemPackages = [ pkgs.transmission ];
+ users.extraGroups.transmission.gid = config.ids.gids.transmission;
users.extraUsers.transmission = {
group = "transmission";
uid = config.ids.uids.transmission;
@@ -135,10 +116,8 @@ in
createHome = true;
};
- users.extraGroups.transmission.gid = config.ids.gids.transmission;
-
# AppArmor profile
- security.apparmor.profiles = mkIf (config.security.apparmor.enable && cfg.apparmor) [
+ security.apparmor.profiles = mkIf apparmor [
(pkgs.writeText "apparmor-transmission-daemon" ''
#include
@@ -146,13 +125,17 @@ in
#include
#include
- ${pkgs.glibc}/lib/*.so mr,
- ${pkgs.libevent}/lib/libevent*.so* mr,
- ${pkgs.curl}/lib/libcurl*.so* mr,
- ${pkgs.openssl}/lib/libssl*.so* mr,
- ${pkgs.openssl}/lib/libcrypto*.so* mr,
- ${pkgs.zlib}/lib/libz*.so* mr,
- ${pkgs.libssh2}/lib/libssh2*.so* mr,
+ ${pkgs.glibc}/lib/*.so mr,
+ ${pkgs.libevent}/lib/libevent*.so* mr,
+ ${pkgs.curl}/lib/libcurl*.so* mr,
+ ${pkgs.openssl}/lib/libssl*.so* mr,
+ ${pkgs.openssl}/lib/libcrypto*.so* mr,
+ ${pkgs.zlib}/lib/libz*.so* mr,
+ ${pkgs.libssh2}/lib/libssh2*.so* mr,
+ ${pkgs.systemd}/lib/libsystemd*.so* mr,
+ ${pkgs.xz}/lib/liblzma*.so* mr,
+ ${pkgs.libgcrypt}/lib/libgcrypt*.so* mr,
+ ${pkgs.libgpgerror}/lib/libgpg-error*.so* mr,
@{PROC}/sys/kernel/random/uuid r,
@{PROC}/sys/vm/overcommit_memory r,
@@ -161,9 +144,9 @@ in
owner ${settingsDir}/** rw,
- ${cfg.settings.download-dir}/** rw,
- ${optionalString cfg.settings.incomplete-dir-enabled ''
- ${cfg.settings.incomplete-dir}/** rw,
+ ${fullSettings.download-dir}/** rw,
+ ${optionalString fullSettings.incomplete-dir-enabled ''
+ ${fullSettings.incomplete-dir}/** rw,
''}
}
'')
diff --git a/nixos/modules/services/ttys/agetty.nix b/nixos/modules/services/ttys/agetty.nix
index ca4fbeb0add..df21ebbd974 100644
--- a/nixos/modules/services/ttys/agetty.nix
+++ b/nixos/modules/services/ttys/agetty.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
@@ -49,22 +49,20 @@ with pkgs.lib;
config = {
systemd.services."getty@" =
- { baseUnit = pkgs.runCommand "getty.service" {}
- ''
- sed '/ExecStart/ d' < ${config.systemd.package}/example/systemd/system/getty@.service > $out
- '';
- serviceConfig.ExecStart = "@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login %I 38400";
+ { serviceConfig.ExecStart = "@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login --keep-baud %I 115200,38400,9600 $TERM";
restartIfChanged = false;
};
systemd.services."serial-getty@" =
- { baseUnit = pkgs.runCommand "serial-getty.service" {}
- ''
- sed '/ExecStart/ d' < ${config.systemd.package}/example/systemd/system/serial-getty@.service > $out
- '';
- serviceConfig.ExecStart =
+ { 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}";
+ in "@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login %I ${speeds} $TERM";
+ 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;
};
diff --git a/nixos/modules/services/ttys/gpm.nix b/nixos/modules/services/ttys/gpm.nix
index 74cee67aeae..308a6d3643a 100644
--- a/nixos/modules/services/ttys/gpm.nix
+++ b/nixos/modules/services/ttys/gpm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -40,12 +40,16 @@ in
config = mkIf cfg.enable {
- jobs.gpm =
- { description = "General purpose mouse";
+ systemd.services.gpm =
+ { description = "Console Mouse Daemon";
- startOn = "started udev";
+ wantedBy = [ "multi-user.target" ];
+ requires = [ "dev-input-mice.device" ];
+ after = [ "dev-input-mice.device" ];
- exec = "${pkgs.gpm}/sbin/gpm -m /dev/input/mice -t ${cfg.protocol} -D &>/dev/null";
+ serviceConfig.ExecStart = "@${pkgs.gpm}/sbin/gpm gpm -m /dev/input/mice -t ${cfg.protocol}";
+ serviceConfig.Type = "forking";
+ serviceConfig.PIDFile = "/run/gpm.pid";
};
};
diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index 949dce96824..75ec6671d15 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
@@ -65,7 +65,7 @@ let
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;
@@ -450,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
@@ -510,7 +510,7 @@ in
virtualHosts = mkOption {
type = types.listOf (types.submodule (
{ options = import ./per-server-options.nix {
- inherit pkgs;
+ inherit lib;
forMainServer = false;
};
}));
@@ -577,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;
});
diff --git a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix
index f5669faebc9..7d59c13b957 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
diff --git a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
index 53f34e28c27..b8e86334539 100644
--- a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
@@ -3,9 +3,9 @@
# has additional options that affect the web server as a whole, like
# the user/group to run under.)
-{ forMainServer, pkgs }:
+{ forMainServer, lib }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/services/web-servers/apache-httpd/phabricator.nix b/nixos/modules/services/web-servers/apache-httpd/phabricator.nix
new file mode 100644
index 00000000000..c7a9bdf68c5
--- /dev/null
+++ b/nixos/modules/services/web-servers/apache-httpd/phabricator.nix
@@ -0,0 +1,41 @@
+{ config, lib, pkgs, ... }:
+let
+ phabricatorRoot = pkgs.stdenv.mkDerivation rec {
+ version = "2014-05-12";
+ name = "phabricator-${version}";
+ srcLibphutil = pkgs.fetchgit {
+ url = git://github.com/facebook/libphutil.git;
+ rev = "2f3b5a1cf6ea464a0250d4b1c653a795a90d2716";
+ sha256 = "9598cec400984dc149162f1e648814a54ea0cd34fcd529973dc83f5486fdd9fd";
+ };
+ srcArcanist = pkgs.fetchgit {
+ url = git://github.com/facebook/arcanist.git;
+ rev = "54c377448db8dbc40f0ca86d43c837d30e493485";
+ sha256 = "086db3c0d1154fbad23e7c6def31fd913384ee20247b329515838b669c3028e0";
+ };
+ srcPhabricator = pkgs.fetchgit {
+ url = git://github.com/facebook/phabricator.git;
+ rev = "1644ef185ecf1e9fca3eb6b16351ef46b19d110f";
+ sha256 = "e1135e4ba76d53f48aad4161563035414ed7e878f39a8a34a875a01b41b2a084";
+ };
+
+ buildCommand = ''
+ mkdir -p $out
+ cp -R ${srcLibphutil} $out/libphutil
+ cp -R ${srcArcanist} $out/arcanist
+ cp -R ${srcPhabricator} $out/phabricator
+ '';
+ };
+in {
+ enablePHP = true;
+ extraApacheModules = [ "mod_rewrite" ];
+ DocumentRoot = "${phabricatorRoot}/phabricator/webroot";
+ extraConfig = ''
+ DocumentRoot ${phabricatorRoot}/phabricator/webroot
+
+ RewriteEngine on
+ RewriteRule ^/rsrc/(.*) - [L,QSA]
+ RewriteRule ^/favicon.ico - [L,QSA]
+ RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
+ '';
+}
diff --git a/nixos/modules/services/web-servers/apache-httpd/trac.nix b/nixos/modules/services/web-servers/apache-httpd/trac.nix
index dc82fd34f2f..8fe8b90d823 100644
--- a/nixos/modules/services/web-servers/apache-httpd/trac.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/trac.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, serverInfo, ... }:
+{ config, lib, pkgs, serverInfo, ... }:
-with pkgs.lib;
+with lib;
let
@@ -8,8 +8,6 @@ let
subversion = pkgs.subversion.override (origArgs: {
bdbSupport = true;
httpServer = true;
- sslSupport = true;
- compressionSupport = true;
pythonBindings = true;
});
diff --git a/nixos/modules/services/web-servers/apache-httpd/zabbix.nix b/nixos/modules/services/web-servers/apache-httpd/zabbix.nix
index a6e6042fdf6..cab16593bcb 100644
--- a/nixos/modules/services/web-servers/apache-httpd/zabbix.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/zabbix.nix
@@ -1,4 +1,6 @@
-{ config, pkgs, serverInfo, ... }:
+{ config, lib, pkgs, serverInfo, ... }:
+
+with lib;
let
@@ -51,7 +53,7 @@ in
options = {
- urlPrefix = pkgs.lib.mkOption {
+ urlPrefix = mkOption {
default = "/zabbix";
description = "
The URL prefix under which the Zabbix service appears.
@@ -59,9 +61,9 @@ in
";
};
- configFile = pkgs.lib.mkOption {
+ configFile = mkOption {
default = null;
- type = with pkgs.lib.types; nullOr path;
+ type = types.nullOr types.path;
description = ''
The configuration file (zabbix.conf.php) which contains the database
connection settings. If not set, the configuration settings will created
@@ -69,7 +71,7 @@ in
'';
};
- stateDir = pkgs.lib.mkOption {
+ stateDir = mkOption {
default = "/var/lib/zabbix/frontend";
description = "
Directory where the dynamically generated configuration data
diff --git a/nixos/modules/services/web-servers/fcgiwrap.nix b/nixos/modules/services/web-servers/fcgiwrap.nix
new file mode 100644
index 00000000000..7e91e7b60ee
--- /dev/null
+++ b/nixos/modules/services/web-servers/fcgiwrap.nix
@@ -0,0 +1,49 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.fcgiwrap;
+
+in {
+
+ options = {
+ services.fcgiwrap = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable fcgiwrap, a server for running CGI applications over FastCGI.";
+ };
+
+ preforkProcesses = mkOption {
+ type = types.int;
+ default = 1;
+ description = "Number of processes to prefork.";
+ };
+
+ bindSocket = mkOption {
+ type = types.string;
+ default = "unix:/run/fcgiwrap.sock";
+ description = ''
+ Socket to bind to. Valid socket URLs are:
+ unix:/path/to/socket for Unix sockets
+ tcp:dot.ted.qu.ad:port for IPv4 sockets
+ tcp6:[ipv6_addr]:port for IPv6 sockets
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+
+ systemd.services.fcgiwrap = {
+ after = [ "nss-user-lookup.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig = {
+ ExecStart = "${pkgs.fcgiwrap}/sbin/fcgiwrap -c ${builtins.toString cfg.preforkProcesses} -s ${cfg.bindSocket}";
+ };
+ };
+
+ };
+}
diff --git a/nixos/modules/services/web-servers/jboss/default.nix b/nixos/modules/services/web-servers/jboss/default.nix
index e1bcede6563..8a292ad6791 100644
--- a/nixos/modules/services/web-servers/jboss/default.nix
+++ b/nixos/modules/services/web-servers/jboss/default.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/web-servers/lighttpd/cgit.nix b/nixos/modules/services/web-servers/lighttpd/cgit.nix
index 62264f1db45..dbff565bd8a 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 4cc34c65d84..3ba934c72bf 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 f02bd4db264..d49278be09a 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 62153613355..ff94ee42d28 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;
diff --git a/nixos/modules/services/web-servers/phpfpm.nix b/nixos/modules/services/web-servers/phpfpm.nix
index 6ffe4beaa5d..4a14f9b41a4 100644
--- a/nixos/modules/services/web-servers/phpfpm.nix
+++ b/nixos/modules/services/web-servers/phpfpm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.phpfpm;
diff --git a/nixos/modules/services/web-servers/tomcat.nix b/nixos/modules/services/web-servers/tomcat.nix
index a68828de5d8..1de3d40165e 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
@@ -119,6 +119,8 @@ in
startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
+ daemonType = "daemon";
+
preStart =
''
# Create the base directory
@@ -327,10 +329,12 @@ in
done
''
else ""}
-
- ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c 'CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} JAVA_OPTS="${cfg.javaOpts}" CATALINA_OPTS="${cfg.catalinaOpts}" ${tomcat}/bin/startup.sh'
'';
+ script = ''
+ ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c 'CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} JAVA_OPTS="${cfg.javaOpts}" CATALINA_OPTS="${cfg.catalinaOpts}" ${tomcat}/bin/startup.sh'
+ '';
+
postStop =
''
echo "Stopping tomcat..."
diff --git a/nixos/modules/services/web-servers/varnish/default.nix b/nixos/modules/services/web-servers/varnish/default.nix
index 7e327120c3d..364f6c68fac 100644
--- a/nixos/modules/services/web-servers/varnish/default.nix
+++ b/nixos/modules/services/web-servers/varnish/default.nix
@@ -1,9 +1,9 @@
-{ config, pkgs, ...}:
+{ config, lib, pkgs, ...}:
let
cfg = config.services.varnish;
in
-with pkgs.lib;
+with lib;
{
options = {
services.varnish = {
diff --git a/nixos/modules/services/web-servers/winstone.nix b/nixos/modules/services/web-servers/winstone.nix
index 33c7e730118..7f48012f158 100644
--- a/nixos/modules/services/web-servers/winstone.nix
+++ b/nixos/modules/services/web-servers/winstone.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/web-servers/zope2.nix b/nixos/modules/services/web-servers/zope2.nix
index 576f4b08fb9..21117118457 100644
--- a/nixos/modules/services/web-servers/zope2.nix
+++ b/nixos/modules/services/web-servers/zope2.nix
@@ -1,6 +1,6 @@
-{ pkgs, config, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix
index 753babf6a22..b82398ccf9d 100644
--- a/nixos/modules/services/x11/desktop-managers/default.nix
+++ b/nixos/modules/services/x11/desktop-managers/default.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/e17.nix b/nixos/modules/services/x11/desktop-managers/e17.nix
index 3d91617c62a..4cac53c9c75 100644
--- a/nixos/modules/services/x11/desktop-managers/e17.nix
+++ b/nixos/modules/services/x11/desktop-managers/e17.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix
index bebda772352..df50ca8c905 100644
--- a/nixos/modules/services/x11/desktop-managers/gnome3.nix
+++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix
@@ -1,10 +1,30 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.xserver.desktopManager.gnome3;
- gnome3 = pkgs.gnome3;
+ gnome3 = config.environment.gnome3.packageSet;
+
+ # Remove packages of ys from xs, based on their names
+ removePackagesByName = xs: ys:
+ let
+ pkgName = drv: (builtins.parseDrvName drv.name).name;
+ ysNames = map pkgName ys;
+ res = (filter (x: !(builtins.elem (pkgName x) ysNames)) xs);
+ in
+ filter (x: !(builtins.elem (pkgName x) ysNames)) xs;
+
+ # Prioritize nautilus by default when opening directories
+ mimeAppsList = pkgs.writeTextFile {
+ name = "gnome-mimeapps";
+ destination = "/share/applications/mimeapps.list";
+ text = ''
+ [Default Applications]
+ inode/directory=nautilus.desktop
+ '';
+ };
+
in {
options = {
@@ -15,6 +35,12 @@ in {
description = "Enable Gnome 3 desktop manager.";
};
+ environment.gnome3.packageSet = mkOption {
+ default = pkgs.gnome3;
+ example = literalExample "pkgs.gnome3_12";
+ description = "Which Gnome 3 package set to use.";
+ };
+
environment.gnome3.excludePackages = mkOption {
default = [];
example = "[ pkgs.gnome3.totem ]";
@@ -30,14 +56,24 @@ in {
security.polkit.enable = true;
services.udisks2.enable = true;
services.accounts-daemon.enable = true;
+ services.geoclue2.enable = mkDefault true;
services.gnome3.at-spi2-core.enable = true;
services.gnome3.evolution-data-server.enable = true;
- services.gnome3.sushi.enable = true;
- services.telepathy.enable = true;
+ services.gnome3.gnome-documents.enable = mkDefault true;
+ services.gnome3.gnome-keyring.enable = true;
+ services.gnome3.gnome-online-accounts.enable = mkDefault true;
+ services.gnome3.gnome-user-share.enable = mkDefault true;
+ services.gnome3.gvfs.enable = true;
+ services.gnome3.seahorse.enable = mkDefault true;
+ services.gnome3.sushi.enable = mkDefault true;
+ services.gnome3.tracker.enable = mkDefault true;
+ hardware.pulseaudio.enable = mkDefault true;
+ services.telepathy.enable = mkDefault true;
networking.networkmanager.enable = true;
services.upower.enable = config.powerManagement.enable;
+ services.upower.package = gnome3.upower;
- fonts.extraFonts = [ pkgs.dejavu_fonts ];
+ fonts.fonts = [ pkgs.dejavu_fonts ];
services.xserver.desktopManager.session = singleton
{ name = "gnome3";
@@ -50,25 +86,46 @@ in {
export XDG_MENU_PREFIX=gnome
+ # Don't let epiphany depend upon gnome-shell
+ # Don't let gnome-session depend upon vino (for .desktop autostart condition)
+ # Override default mimeapps
+ export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${gnome3.gnome_shell}/share/gsettings-schemas/${gnome3.gnome_shell.name}:${gnome3.vino}/share/gsettings-schemas/${gnome3.vino.name}:${mimeAppsList}/share
+
+ # Let gnome-control-center find gnome-shell search providers
+ export GNOME_SEARCH_PROVIDERS_DIR=${config.system.path}/share/gnome-shell/search-providers/
+
+ # Let nautilus find extensions
+ export NAUTILUS_EXTENSION_DIR=${config.system.path}/lib/nautilus/extensions-3.0/
+
+ # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
+ ${pkgs.xdg-user-dirs}/bin/xdg-user-dirs-update
+
${gnome3.gnome_session}/bin/gnome-session&
waitPID=$!
'';
};
environment.variables.GIO_EXTRA_MODULES = [ "${gnome3.dconf}/lib/gio/modules"
- "${pkgs.glib_networking}/lib/gio/modules" ];
+ "${gnome3.glib_networking}/lib/gio/modules"
+ "${gnome3.gvfs}/lib/gio/modules" ];
environment.systemPackages =
- [ gnome3.dconf
- pkgs.glib_networking
+ [ pkgs.desktop_file_utils
+ gnome3.glib_networking
+ gnome3.gtk3 # for gtk-update-icon-cache
pkgs.ibus
+ pkgs.shared_mime_info # for update-mime-database
+ gnome3.gvfs
+ gnome3.dconf
gnome3.gnome-backgrounds
gnome3.gnome_control_center
gnome3.gnome_icon_theme
+ gnome3.gnome-menus
gnome3.gnome_settings_daemon
gnome3.gnome_shell
gnome3.gnome_themes_standard
- ] ++ (lists.difference [
+ ] ++ (removePackagesByName [
gnome3.baobab
+ gnome3.empathy
gnome3.eog
gnome3.epiphany
gnome3.evince
@@ -81,12 +138,26 @@ in {
gnome3.gnome-contacts
gnome3.gnome-font-viewer
gnome3.gnome-screenshot
+ gnome3.gnome-shell-extensions
gnome3.gnome-system-log
gnome3.gnome-system-monitor
gnome3.gnome_terminal
+ gnome3.gnome-user-docs
+ gnome3.bijiben
+ gnome3.evolution
gnome3.file-roller
+ gnome3.gedit
+ gnome3.gnome-clocks
+ gnome3.gnome-music
+ gnome3.gnome-tweak-tool
+ gnome3.gnome-photos
+ gnome3.nautilus-sendto
] config.environment.gnome3.excludePackages);
+
+ # Needed for themes and backgrounds
+ environment.pathsToLink = [ "/share" ];
+
};
diff --git a/nixos/modules/services/x11/desktop-managers/kde4.nix b/nixos/modules/services/x11/desktop-managers/kde4.nix
index 108b52bb951..f74dd7e0444 100644
--- a/nixos/modules/services/x11/desktop-managers/kde4.nix
+++ b/nixos/modules/services/x11/desktop-managers/kde4.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -43,7 +43,6 @@ let
phononBackendPackages = flip concatMap cfg.phononBackends
(name: attrByPath [name] (throw "unknown phonon backend `${name}'") phononBackends);
- wantsUdisks2 = pkgs.kde4.kdelibs.wantsUdisks2 or false;
in
{
@@ -158,8 +157,7 @@ in
};
# Enable helpful DBus services.
- services.udisks.enable = ! wantsUdisks2;
- services.udisks2.enable = wantsUdisks2;
+ services.udisks2.enable = true;
services.upower.enable = config.powerManagement.enable;
security.pam.services.kde = { allowNullPassword = true; };
diff --git a/nixos/modules/services/x11/desktop-managers/xbmc.nix b/nixos/modules/services/x11/desktop-managers/xbmc.nix
index 51278c5fadb..97e966ca019 100644
--- a/nixos/modules/services/x11/desktop-managers/xbmc.nix
+++ b/nixos/modules/services/x11/desktop-managers/xbmc.nix
@@ -1,6 +1,6 @@
-{ pkgs, config, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.xserver.desktopManager.xbmc;
diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix
index 9ce7744b065..a72eea76239 100644
--- a/nixos/modules/services/x11/desktop-managers/xfce.nix
+++ b/nixos/modules/services/x11/desktop-managers/xfce.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/desktop-managers/xterm.nix b/nixos/modules/services/x11/desktop-managers/xterm.nix
index 7321199b818..eab91407141 100644
--- a/nixos/modules/services/x11/desktop-managers/xterm.nix
+++ b/nixos/modules/services/x11/desktop-managers/xterm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/display-managers/auto.nix b/nixos/modules/services/x11/display-managers/auto.nix
index 33d97e0e07a..c02ccdf12b6 100644
--- a/nixos/modules/services/x11/display-managers/auto.nix
+++ b/nixos/modules/services/x11/display-managers/auto.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix
index 575386bac0a..3bf18bd58c8 100644
--- a/nixos/modules/services/x11/display-managers/default.nix
+++ b/nixos/modules/services/x11/display-managers/default.nix
@@ -7,9 +7,9 @@
# (e.g., KDE, Gnome or a plain xterm), and optionally the *window
# manager* (e.g. kwin or twm).
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -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 c51e7edfddf..7ec489ae3e7 100644
--- a/nixos/modules/services/x11/display-managers/kdm.nix
+++ b/nixos/modules/services/x11/display-managers/kdm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix
index 0fa16a77c1b..d459c59b048 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
diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix
index cfe3ee53224..48feb12d044 100644
--- a/nixos/modules/services/x11/display-managers/slim.nix
+++ b/nixos/modules/services/x11/display-managers/slim.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -58,7 +58,7 @@ in
default = null;
example = literalExample ''
pkgs.fetchurl {
- url = http://download.berlios.de/slim/slim-wave.tar.gz;
+ url = "mirror://sourceforge/slim.berlios/slim-wave.tar.gz";
sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy";
}
'';
@@ -66,7 +66,7 @@ in
The theme for the SLiM login manager. If not specified, SLiM's
default theme is used. See for a
- collection of themes.
+ collection of themes. TODO: berlios shut down.
'';
};
diff --git a/nixos/modules/services/x11/hardware/multitouch.nix b/nixos/modules/services/x11/hardware/multitouch.nix
index 4f9048bfd91..6e6e88e6721 100644
--- a/nixos/modules/services/x11/hardware/multitouch.nix
+++ b/nixos/modules/services/x11/hardware/multitouch.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.xserver.multitouch; in
diff --git a/nixos/modules/services/x11/hardware/synaptics.nix b/nixos/modules/services/x11/hardware/synaptics.nix
index fe9dcd51a7a..f2227a34a20 100644
--- a/nixos/modules/services/x11/hardware/synaptics.nix
+++ b/nixos/modules/services/x11/hardware/synaptics.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let cfg = config.services.xserver.synaptics;
tapConfig = if cfg.tapButtons then enabledTapConfig else disabledTapConfig;
diff --git a/nixos/modules/services/x11/hardware/wacom.nix b/nixos/modules/services/x11/hardware/wacom.nix
index dfc588cd213..540ed168b48 100644
--- a/nixos/modules/services/x11/hardware/wacom.nix
+++ b/nixos/modules/services/x11/hardware/wacom.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix
index 02416f5ef12..d73b58de6c0 100644
--- a/nixos/modules/services/x11/redshift.nix
+++ b/nixos/modules/services/x11/redshift.nix
@@ -1,5 +1,5 @@
-{ config, pkgs, ... }:
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
let
cfg = config.services.redshift;
diff --git a/nixos/modules/services/x11/terminal-server.nix b/nixos/modules/services/x11/terminal-server.nix
index f16a424b457..a036e085b0b 100644
--- a/nixos/modules/services/x11/terminal-server.nix
+++ b/nixos/modules/services/x11/terminal-server.nix
@@ -5,9 +5,9 @@
# not, a X server (Xvfb) is started for that user. The Xvfb instances
# persist across VNC sessions.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -27,7 +27,7 @@ in
config = {
services.xserver.enable = true;
- hardware.opengl.videoDrivers = [];
+ services.xserver.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 1c61419a44c..9b2f042a87a 100644
--- a/nixos/modules/services/x11/window-managers/awesome.nix
+++ b/nixos/modules/services/x11/window-managers/awesome.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/compiz.nix b/nixos/modules/services/x11/window-managers/compiz.nix
index 209401f2646..ffd71e5f91e 100644
--- a/nixos/modules/services/x11/window-managers/compiz.nix
+++ b/nixos/modules/services/x11/window-managers/compiz.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/default.nix b/nixos/modules/services/x11/window-managers/default.nix
index 1c10333462c..f27ba366141 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;
diff --git a/nixos/modules/services/x11/window-managers/herbstluftwm.nix b/nixos/modules/services/x11/window-managers/herbstluftwm.nix
index 9480abba43b..6cda910b6b3 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 e53d86187ae..e85c3bce591 100644
--- a/nixos/modules/services/x11/window-managers/i3.nix
+++ b/nixos/modules/services/x11/window-managers/i3.nix
@@ -1,6 +1,6 @@
-{ pkgs, config, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.xserver.windowManager.i3;
diff --git a/nixos/modules/services/x11/window-managers/icewm.nix b/nixos/modules/services/x11/window-managers/icewm.nix
index b7da4051c14..36028da453a 100644
--- a/nixos/modules/services/x11/window-managers/icewm.nix
+++ b/nixos/modules/services/x11/window-managers/icewm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/metacity.nix b/nixos/modules/services/x11/window-managers/metacity.nix
index 712e2038594..d13cbcfe40e 100644
--- a/nixos/modules/services/x11/window-managers/metacity.nix
+++ b/nixos/modules/services/x11/window-managers/metacity.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/twm.nix b/nixos/modules/services/x11/window-managers/twm.nix
index d80ffe4942f..684b34c2f24 100644
--- a/nixos/modules/services/x11/window-managers/twm.nix
+++ b/nixos/modules/services/x11/window-managers/twm.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/window-managers/wmii.nix b/nixos/modules/services/x11/window-managers/wmii.nix
index b61521274fb..75f6fdfe3bc 100644
--- a/nixos/modules/services/x11/window-managers/wmii.nix
+++ b/nixos/modules/services/x11/window-managers/wmii.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/xfs.nix b/nixos/modules/services/x11/xfs.nix
index 44c1d533c3a..196f3beb41e 100644
--- a/nixos/modules/services/x11/xfs.nix
+++ b/nixos/modules/services/x11/xfs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index 2985e55e787..5f3e8003b45 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, pkgs_i686, ... }:
+{ config, lib, pkgs, pkgs_i686, ... }:
-with pkgs.lib;
+with lib;
let
@@ -11,30 +11,16 @@ let
xorg = pkgs.xorg;
- # Map video driver names to driver packages.
+ # Map video driver names to driver packages. FIXME: move into card-specific modules.
knownVideoDrivers = {
ati_unfree = { modules = [ kernelPackages.ati_drivers_x11 ]; driverName = "fglrx"; };
nouveau = { modules = [ pkgs.xf86_video_nouveau ]; };
- nvidia = { modules = [ kernelPackages.nvidia_x11 ]; };
- nvidiaLegacy173 = { modules = [ kernelPackages.nvidia_x11_legacy173 ]; driverName = "nvidia"; };
- nvidiaLegacy304 = { modules = [ kernelPackages.nvidia_x11_legacy304 ]; driverName = "nvidia"; };
unichrome = { modules = [ pkgs.xorgVideoUnichrome ]; };
virtualbox = { modules = [ kernelPackages.virtualboxGuestAdditions ]; driverName = "vboxvideo"; };
ati = { modules = [ pkgs.xorg.xf86videoati pkgs.xorg.glamoregl ]; };
intel-testing = { modules = with pkgs.xorg; [ xf86videointel-testing glamoregl ]; driverName = "intel"; };
};
- driverNames = config.hardware.opengl.videoDrivers;
-
- needsAcpid =
- (elem "nvidia" driverNames) ||
- (elem "nvidiaLegacy173" driverNames) ||
- (elem "nvidiaLegacy304" driverNames);
-
- drivers = flip map driverNames
- (name: { inherit name; driverName = name; } //
- attrByPath [name] (if (hasAttr ("xf86video" + name) xorg) then { modules = [(getAttr ("xf86video" + name) xorg) ]; } else throw "unknown video driver `${name}'") knownVideoDrivers);
-
fontsForXServer =
config.fonts.fonts ++
# We don't want these fonts in fonts.conf, because then modern,
@@ -79,7 +65,6 @@ let
monitors = foldl mkMonitor [] xrandrHeads;
in concatMapStrings (getAttr "value") monitors;
-
configFile = pkgs.stdenv.mkDerivation {
name = "xserver.conf";
@@ -181,6 +166,18 @@ in
'';
};
+ videoDrivers = mkOption {
+ type = types.listOf types.str;
+ # !!! We'd like "nv" here, but it segfaults the X server.
+ default = [ "ati" "cirrus" "intel" "vesa" "vmware" "modesetting" ];
+ example = [ "vesa" ];
+ description = ''
+ The names of the video drivers the configuration
+ supports. They will be tried in order until one that
+ supports your card is found.
+ '';
+ };
+
videoDriver = mkOption {
type = types.nullOr types.str;
default = null;
@@ -188,7 +185,16 @@ in
description = ''
The name of the video driver for your graphics card. This
option is obsolete; please set the
- instead.
+ instead.
+ '';
+ };
+
+ drivers = mkOption {
+ type = types.listOf types.attrs;
+ internal = true;
+ description = ''
+ A list of attribute sets specifying drivers to be loaded by
+ the X11 server.
'';
};
@@ -201,17 +207,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;
@@ -396,15 +391,27 @@ in
###### implementation
config = mkIf cfg.enable {
- hardware.opengl.enable = true;
- hardware.opengl.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
+
+ hardware.opengl.enable = mkDefault true;
+
+ services.xserver.videoDrivers = mkIf (cfg.videoDriver != null) [ cfg.videoDriver ];
+
+ # FIXME: somehow check for unknown driver names.
+ services.xserver.drivers = flip concatMap cfg.videoDrivers (name:
+ let driver =
+ attrByPath [name]
+ (if (hasAttr ("xf86video" + name) xorg)
+ then { modules = [(getAttr ("xf86video" + name) xorg) ]; }
+ else null)
+ knownVideoDrivers;
+ in optional (driver != null) ({ inherit name; driverName = name; } // driver));
assertions =
- [ { assertion = !(cfg.startOpenSSHAgent && cfg.startGnuPGAgent);
+ [ { assertion = !(config.programs.ssh.startAgent && cfg.startGnuPGAgent);
message =
''
- The OpenSSH agent and GnuPG agent cannot be started both.
- Choose between `startOpenSSHAgent' and `startGnuPGAgent'.
+ The OpenSSH agent and GnuPG agent cannot be started both. Please
+ choose between ‘programs.ssh.startAgent’ and ‘services.xserver.startGnuPGAgent’.
'';
}
{ assertion = config.security.polkit.enable;
@@ -437,24 +444,18 @@ in
pkgs.xterm
pkgs.xdg_utils
]
- ++ optional (elem "nvidia" driverNames) kernelPackages.nvidia_x11
- ++ optional (elem "nvidiaLegacy173" driverNames) kernelPackages.nvidia_x11_legacy173
- ++ optional (elem "nvidiaLegacy304" driverNames) kernelPackages.nvidia_x11_legacy304
- ++ optional (elem "virtualbox" driverNames) xorg.xrefresh
- ++ optional (elem "ati_unfree" driverNames) kernelPackages.ati_drivers_x11;
-
- services.acpid.enable = mkIf needsAcpid true;
+ ++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh
+ ++ optional (elem "ati_unfree" cfg.videoDrivers) kernelPackages.ati_drivers_x11;
environment.pathsToLink =
[ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ];
systemd.defaultUnit = mkIf cfg.autorun "graphical.target";
- systemd.services."display-manager" =
+ systemd.services.display-manager =
{ description = "X11 Server";
- after = [ "systemd-udev-settle.service" "local-fs.target" ]
- ++ optional needsAcpid "acpid.service";
+ after = [ "systemd-udev-settle.service" "local-fs.target" "acpid.service" ];
restartIfChanged = false;
@@ -462,15 +463,11 @@ in
{ FONTCONFIG_FILE = "/etc/fonts/fonts.conf"; # !!! cleanup
XKB_BINDIR = "${xorg.xkbcomp}/bin"; # Needed for the Xkb extension.
XORG_DRI_DRIVER_PATH = "/run/opengl-driver/lib/dri"; # !!! Depends on the driver selected at runtime.
- } // optionalAttrs (elem "nvidia" driverNames) {
- LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11}/lib";
- } // optionalAttrs (elem "nvidiaLegacy173" driverNames) {
- LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11_legacy173}/lib";
- } // optionalAttrs (elem "nvidiaLegacy304" driverNames) {
- LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.nvidia_x11_legacy304}/lib";
- } // optionalAttrs (elem "ati_unfree" driverNames) {
- LD_LIBRARY_PATH = "${xorg.libX11}/lib:${xorg.libXext}/lib:${kernelPackages.ati_drivers_x11}/lib:${kernelPackages.ati_drivers_x11}/X11R6/lib64/modules/linux";
- #XORG_DRI_DRIVER_PATH = "${kernelPackages.ati_drivers_x11}/lib/dri"; # is ignored because ati drivers ship their own unpatched libglx.so !
+ LD_LIBRARY_PATH = concatStringsSep ":" (
+ [ "${xorg.libX11}/lib" "${xorg.libXext}/lib" ]
+ ++ optionals (elem "ati_unfree" cfg.videoDrivers)
+ [ "${kernelPackages.ati_drivers_x11}/lib" "${kernelPackages.ati_drivers_x11}/X11R6/lib64/modules/linux" ]
+ ++ concatLists (catAttrs "libPath" cfg.drivers));
} // cfg.displayManager.job.environment;
preStart =
@@ -500,7 +497,7 @@ in
] ++ optional (!cfg.enableTCP) "-nolisten tcp";
services.xserver.modules =
- concatLists (catAttrs "modules" drivers) ++
+ concatLists (catAttrs "modules" cfg.drivers) ++
[ xorg.xorgserver
xorg.xf86inputevdev
];
@@ -536,7 +533,7 @@ in
${cfg.serverLayoutSection}
# Reference the Screen sections for each driver. This will
# cause the X server to try each in turn.
- ${flip concatMapStrings drivers (d: ''
+ ${flip concatMapStrings cfg.drivers (d: ''
Screen "Screen-${d.name}[0]"
'')}
EndSection
@@ -550,11 +547,11 @@ in
# For each supported driver, add a "Device" and "Screen"
# section.
- ${flip concatMapStrings drivers (driver: ''
+ ${flip concatMapStrings cfg.drivers (driver: ''
Section "Device"
Identifier "Device-${driver.name}[0]"
- Driver "${driver.driverName}"
+ Driver "${driver.driverName or driver.name}"
${if cfg.useGlamor then ''Option "AccelMethod" "glamor"'' else ""}
${cfg.deviceSection}
${xrandrDeviceSection}
@@ -573,10 +570,6 @@ in
DefaultDepth ${toString cfg.defaultDepth}
''}
- ${optionalString (driver.name == "nvidia") ''
- Option "RandRRotation" "on"
- ''}
-
${optionalString
(driver.name != "virtualbox" &&
(cfg.resolutions != [] ||
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index 1545bcb8a1f..b1bad956b4b 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
@@ -109,12 +109,12 @@ in
''
# Various log/runtime directories.
- touch /var/run/utmp # must exist
- chgrp ${toString config.ids.gids.utmp} /var/run/utmp
- chmod 664 /var/run/utmp
+ touch /run/utmp # must exist
+ chgrp ${toString config.ids.gids.utmp} /run/utmp
+ chmod 664 /run/utmp
- mkdir -m 0755 -p /var/run/nix/current-load # for distributed builds
- mkdir -m 0700 -p /var/run/nix/remote-stores
+ mkdir -m 0755 -p /run/nix/current-load # for distributed builds
+ mkdir -m 0700 -p /run/nix/remote-stores
mkdir -m 0755 -p /var/log
@@ -127,11 +127,6 @@ in
mkdir -m 0555 -p /var/empty
'';
- system.activationScripts.media =
- ''
- mkdir -m 0755 -p /media
- '';
-
system.activationScripts.usrbinenv =
''
mkdir -m 0755 -p /usr/bin
diff --git a/nixos/modules/system/activation/no-clone.nix b/nixos/modules/system/activation/no-clone.nix
index c9ab691ce47..7f458443526 100644
--- a/nixos/modules/system/activation/no-clone.nix
+++ b/nixos/modules/system/activation/no-clone.nix
@@ -1,6 +1,6 @@
-{pkgs, ...}:
+{ lib, ... }:
-with pkgs.lib;
+with lib;
{
boot.loader.grub.device = mkOverride 0 "nodev";
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index fd2b5b7950d..12012698efe 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -65,7 +65,7 @@ $SIG{PIPE} = "IGNORE";
sub getActiveUnits {
# FIXME: use D-Bus or whatever to query this, since parsing the
# output of list-units is likely to break.
- my $lines = `@systemd@/bin/systemctl list-units --full`;
+ my $lines = `LANG= systemctl list-units --full --no-legend`;
my $res = {};
foreach my $line (split '\n', $lines) {
chomp $line;
@@ -96,18 +96,19 @@ sub parseFstab {
sub parseUnit {
my ($filename) = @_;
- parseKeyValues(read_file($filename));
+ my $info = {};
+ parseKeyValues($info, read_file($filename));
+ parseKeyValues($info, read_file("${filename}.d/overrides.conf")) if -f "${filename}.d/overrides.conf";
+ return $info;
}
sub parseKeyValues {
- my @lines = @_;
- my $info = {};
+ my $info = shift;
foreach my $line (@_) {
# FIXME: not quite correct.
$line =~ /^([^=]+)=(.*)$/ or next;
$info->{$1} = $2;
}
- return $info;
}
sub boolIsTrue {
@@ -115,6 +116,14 @@ sub boolIsTrue {
return $s eq "yes" || $s eq "true";
}
+# As a fingerprint for determining whether a unit has changed, we use
+# its absolute path. If it has an override file, we append *its*
+# absolute path as well.
+sub fingerprintUnit {
+ my ($s) = @_;
+ return abs_path($s) . (-f "${s}.d/overrides.conf" ? " " . abs_path "${s}.d/overrides.conf" : "");
+}
+
# Stop all services that no longer exist or have changed in the new
# configuration.
my (@unitsToStop, @unitsToSkip);
@@ -166,7 +175,7 @@ while (my ($unit, $state) = each %{$activePrev}) {
}
}
- elsif (abs_path($prevUnitFile) ne abs_path($newUnitFile)) {
+ elsif (fingerprintUnit($prevUnitFile) ne fingerprintUnit($newUnitFile)) {
if ($unit eq "sysinit.target" || $unit eq "basic.target" || $unit eq "multi-user.target" || $unit eq "graphical.target") {
# Do nothing. These cannot be restarted directly.
} elsif ($unit =~ /\.mount$/) {
@@ -179,7 +188,7 @@ while (my ($unit, $state) = each %{$activePrev}) {
if (boolIsTrue($unitInfo->{'X-ReloadIfChanged'} // "no")) {
write_file($reloadListFile, { append => 1 }, "$unit\n");
}
- elsif (!boolIsTrue($unitInfo->{'X-RestartIfChanged'} // "yes")) {
+ elsif (!boolIsTrue($unitInfo->{'X-RestartIfChanged'} // "yes") || boolIsTrue($unitInfo->{'RefuseManualStop'} // "no") ) {
push @unitsToSkip, $unit;
} else {
# If this unit is socket-activated, then stop the
@@ -288,7 +297,7 @@ foreach my $device (keys %$prevSwaps) {
if (scalar @unitsToStop > 0) {
@unitsToStop = unique(@unitsToStop);
print STDERR "stopping the following units: ", join(", ", sort(@unitsToStop)), "\n";
- system("@systemd@/bin/systemctl", "stop", "--", @unitsToStop); # FIXME: ignore errors?
+ system("systemctl", "stop", "--", @unitsToStop); # FIXME: ignore errors?
}
print STDERR "NOT restarting the following units: ", join(", ", sort(@unitsToSkip)), "\n"
@@ -354,7 +363,8 @@ while (my ($unit, $state) = each %{$activeNew}) {
elsif ($state->{state} eq "auto-restart") {
# A unit in auto-restart state is a failure *if* it previously failed to start
my $lines = `@systemd@/bin/systemctl show '$unit'`;
- my $info = parseKeyValues(split "\n", $lines);
+ my $info = {};
+ parseKeyValues($info, split("\n", $lines));
if ($info->{ExecMainStatus} ne '0') {
push @failed, $unit;
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index d9891f434cc..b739ef693ce 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
@@ -83,33 +84,39 @@ let
${config.system.extraSystemBuilderCmds}
'';
+ # Handle assertions
+
+ failed = map (x: x.message) (filter (x: !x.assertion) config.assertions);
+
+ showWarnings = res: fold (w: x: builtins.trace "^[[1;31mwarning: ${w}^[[0m" x) res config.warnings;
# Putting it all together. This builds a store path containing
# symlinks to the various parts of the built configuration (the
# kernel, systemd units, init scripts, etc.) as well as a script
# `switch-to-configuration' that activates the configuration and
# makes it bootable.
- system = pkgs.stdenv.mkDerivation {
- name = "nixos-${config.system.nixosVersion}";
- preferLocalBuild = true;
- buildCommand = systemBuilder;
+ system = showWarnings (
+ if [] == failed then pkgs.stdenv.mkDerivation {
+ name = "nixos-${config.system.nixosVersion}";
+ preferLocalBuild = true;
+ buildCommand = systemBuilder;
- inherit (pkgs) utillinux coreutils;
- systemd = config.systemd.package;
+ inherit (pkgs) utillinux coreutils;
+ systemd = config.systemd.package;
- inherit children;
- kernelParams = config.boot.kernelParams;
- installBootLoader =
- config.system.build.installBootLoader
- or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
- activationScript = config.system.activationScripts.script;
- nixosVersion = config.system.nixosVersion;
+ inherit children;
+ kernelParams = config.boot.kernelParams;
+ installBootLoader =
+ config.system.build.installBootLoader
+ or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
+ activationScript = config.system.activationScripts.script;
+ nixosVersion = config.system.nixosVersion;
- configurationName = config.boot.loader.grub.configurationName;
+ configurationName = config.boot.loader.grub.configurationName;
- # Needed by switch-to-configuration.
- perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
- };
+ # Needed by switch-to-configuration.
+ perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
+ } else throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failed)}");
in
diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix
index 4cfd8a0b618..9beb7fabce1 100644
--- a/nixos/modules/system/boot/kernel.nix
+++ b/nixos/modules/system/boot/kernel.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -191,6 +191,7 @@ in
"ehci_hcd"
"ehci_pci"
"ohci_hcd"
+ "ohci_pci"
"xhci_hcd"
"usbhid"
"hid_generic"
@@ -218,37 +219,26 @@ in
# Create /etc/modules-load.d/nixos.conf, which is read by
# systemd-modules-load.service to load required kernel modules.
- # FIXME: ensure that systemd-modules-load.service is restarted if
- # this file changes.
environment.etc = singleton
{ target = "modules-load.d/nixos.conf";
source = kernelModulesConf;
};
- # Sigh. This overrides systemd's systemd-modules-load.service
- # just so we can set a restart trigger. Also make
- # multi-user.target pull it in so that it gets started if it
- # failed earlier.
systemd.services."systemd-modules-load" =
- { description = "Load Kernel Modules";
- wantedBy = [ "sysinit.target" "multi-user.target" ];
- before = [ "sysinit.target" "shutdown.target" ];
- 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 7e739173f9a..241cfc7e836 100644
--- a/nixos/modules/system/boot/loader/efi.nix
+++ b/nixos/modules/system/boot/loader/efi.nix
@@ -1,6 +1,6 @@
-{ pkgs, ... }:
+{ lib, ... }:
-with pkgs.lib;
+with lib;
{
options.boot.loader.efi = {
diff --git a/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix b/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix
index 9855c8c19dd..4b5e84f53c1 100644
--- a/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix
+++ b/nixos/modules/system/boot/loader/generations-dir/generations-dir.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index ef6ff71ed77..0cc060db8f9 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -25,7 +25,7 @@ let
inherit (cfg)
version extraConfig extraPerEntryConfig extraEntries
extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
- default devices;
+ default devices explicitBootRoot;
path = (makeSearchPath "bin" [
pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils
]) + ":" + (makeSearchPath "sbin" [
@@ -133,11 +133,8 @@ in
chainloader (hd0,1)+1
# GRUB 2 example
- menuentry "Windows7" {
- title Windows7
- insmod ntfs
- set root='(hd1,1)'
- chainloader +1
+ menuentry "Windows 7" {
+ chainloader (hd0,4)+1
}
'';
description = ''
@@ -212,6 +209,15 @@ in
'';
};
+ explicitBootRoot = mkOption {
+ default = "";
+ type = types.str;
+ description = ''
+ The relative path of /boot within the parent volume. Leave empty
+ if /boot is not a btrfs subvolume.
+ '';
+ };
+
};
};
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index a83733db63b..c3aa8518b8b 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -39,6 +39,7 @@ my $configurationLimit = int(get("configurationLimit"));
my $copyKernels = get("copyKernels") eq "true";
my $timeout = int(get("timeout"));
my $defaultEntry = int(get("default"));
+my $explicitBootRoot = get("explicitBootRoot");
$ENV{'PATH'} = get("path");
die "unsupported GRUB version\n" if $grubVersion != 1 && $grubVersion != 2;
@@ -61,6 +62,10 @@ if (stat("/")->dev != stat("/boot")->dev) {
$copyKernels = 1;
}
+if ($explicitBootRoot ne "") {
+ $bootRoot = $explicitBootRoot;
+}
+
# Generate the header.
my $conf .= "# Automatically generated. DO NOT EDIT THIS FILE!\n";
diff --git a/nixos/modules/system/boot/loader/grub/memtest.nix b/nixos/modules/system/boot/loader/grub/memtest.nix
index afe194e672a..94e5a14174b 100644
--- a/nixos/modules/system/boot/loader/grub/memtest.nix
+++ b/nixos/modules/system/boot/loader/grub/memtest.nix
@@ -1,8 +1,8 @@
# This module adds Memtest86+ to the GRUB boot menu.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
memtest86 = pkgs.memtest86plus;
diff --git a/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix b/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix
index 7edc3077637..e7a481e90a7 100644
--- a/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix
+++ b/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.boot.loader.gummiboot;
@@ -54,6 +54,8 @@ in {
}
];
+ boot.loader.grub.enable = mkDefault false;
+
system = {
build.installBootLoader = gummibootBuilder;
diff --git a/nixos/modules/system/boot/loader/init-script/init-script.nix b/nixos/modules/system/boot/loader/init-script/init-script.nix
index 4b0fcd85b4b..3b33d42b4ae 100644
--- a/nixos/modules/system/boot/loader/init-script/init-script.nix
+++ b/nixos/modules/system/boot/loader/init-script/init-script.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
index 5bc856c3df0..d3f32418a64 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
+++ b/nixos/modules/system/boot/loader/raspberrypi/raspberrypi.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/system/boot/luksroot.nix b/nixos/modules/system/boot/luksroot.nix
index 117c526fcd3..c923cc49c44 100644
--- a/nixos/modules/system/boot/luksroot.nix
+++ b/nixos/modules/system/boot/luksroot.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
luks = config.boot.initrd.luks;
diff --git a/nixos/modules/system/boot/modprobe.nix b/nixos/modules/system/boot/modprobe.nix
index f694fd29dd0..7b214cd1e1f 100644
--- a/nixos/modules/system/boot/modprobe.nix
+++ b/nixos/modules/system/boot/modprobe.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
diff --git a/nixos/modules/system/boot/shutdown.nix b/nixos/modules/system/boot/shutdown.nix
index 44cadcd64a7..11041066e07 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;
{
@@ -13,7 +13,7 @@ with pkgs.lib;
unitConfig = {
DefaultDependencies = false;
- ConditionVirtualization = "!systemd-nspawn";
+ ConditionPathExists = "/dev/rtc";
};
serviceConfig = {
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index d0f4576f811..7adb932aba7 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -58,13 +58,14 @@ echo
mkdir -p /etc
touch /etc/fstab # to shut up mount
touch /etc/mtab # to shut up mke2fs
+touch /etc/initrd-release
mkdir -p /proc
-mount -t proc none /proc
+mount -t proc proc /proc
mkdir -p /sys
-mount -t sysfs none /sys
-mount -t devtmpfs -o "size=@devSize@" none /dev
+mount -t sysfs sysfs /sys
+mount -t devtmpfs -o "size=@devSize@" devtmpfs /dev
mkdir -p /run
-mount -t tmpfs -o "mode=0755,size=@runSize@" none /run
+mount -t tmpfs -o "mode=0755,size=@runSize@" tmpfs /run
# Process the kernel command line.
@@ -139,8 +140,6 @@ mkdir -p /dev/.mdadm
systemd-udevd --daemon
udevadm trigger --action=add
udevadm settle || true
-modprobe scsi_wait_scan || true
-udevadm settle || true
# Load boot-time keymap before any LVM/LUKS initialization
@@ -206,7 +205,7 @@ checkFS() {
# does (minutes versus seconds).
if test -z "@checkJournalingFS@" -a \
\( "$fsType" = ext3 -o "$fsType" = ext4 -o "$fsType" = reiserfs \
- -o "$fsType" = xfs -o "$fsType" = jfs \)
+ -o "$fsType" = xfs -o "$fsType" = jfs -o "$fsType" = f2fs \)
then
return 0
fi
@@ -347,8 +346,8 @@ exec 3>&-
udevadm control --exit || true
# Kill any remaining processes, just to be sure we're not taking any
-# with us into stage 2. unionfs-fuse mounts require the unionfs process.
-pkill -9 -v '(1|unionfs)'
+# with us into stage 2. But keep storage daemons like unionfs-fuse.
+pkill -9 -v -f '@'
if test -n "$debug1mounts"; then fail; fi
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index 8ed3aecb691..b6249b6c091 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -3,9 +3,9 @@
# the modules necessary to mount the root file system, then calls the
# init in the root file system to start the second boot stage.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -74,7 +74,7 @@ let
cp -v ${pkgs.lvm2}/sbin/dmsetup $out/bin/dmsetup
cp -v ${pkgs.lvm2}/sbin/lvm $out/bin/lvm
cp -v ${pkgs.lvm2}/lib/libdevmapper.so.*.* $out/lib
- cp -v ${pkgs.systemd}/lib/libsystemd-daemon.so.* $out/lib
+ cp -v ${pkgs.systemd}/lib/libsystemd.so.* $out/lib
# Add RAID mdadm tool.
cp -v ${pkgs.mdadm}/sbin/mdadm $out/bin/mdadm
@@ -344,5 +344,8 @@ in
(isYes "BLK_DEV_INITRD")
];
+ # Prevent systemd from waiting for the /dev/root symlink.
+ systemd.units."dev-root.device".text = "";
+
};
}
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index ee042992b17..eff2fb583ba 100644
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -36,9 +36,9 @@ mount -n -o remount,rw /
# stage 1, we need to do that here.
if [ ! -e /proc/1 ]; then
mkdir -m 0755 -p /proc
- mount -n -t proc none /proc
+ mount -n -t proc proc /proc
mkdir -m 0755 -p /dev
- mount -t devtmpfs none /dev
+ mount -t devtmpfs devtmpfs /dev
fi
@@ -84,7 +84,7 @@ done
mkdir -m 0755 /dev/shm
mount -t tmpfs -o "rw,nosuid,nodev,size=@devShmSize@" tmpfs /dev/shm
mkdir -m 0755 -p /dev/pts
-[ -e /proc/bus/usb ] && mount -t usbfs none /proc/bus/usb # UML doesn't have USB by default
+[ -e /proc/bus/usb ] && mount -t usbfs usbfs /proc/bus/usb # UML doesn't have USB by default
mkdir -m 01777 -p /tmp
mkdir -m 0755 -p /var /var/log /var/lib /var/db
mkdir -m 0755 -p /nix/var
@@ -96,28 +96,14 @@ mkdir -m 0755 -p /etc/nixos
# Miscellaneous boot time cleanup.
rm -rf /var/run /var/lock
-rm -f /etc/resolv.conf
-touch /etc/resolv.conf
rm -f /etc/{group,passwd,shadow}.lock
if test -n "@cleanTmpDir@"; then
echo -n "cleaning \`/tmp'..."
find /tmp -maxdepth 1 -mindepth 1 -print0 | xargs -0r rm -rf --one-file-system
echo " done"
-else
- # Get rid of ICE locks...
- rm -rf /tmp/.ICE-unix
fi
-# ... and ensure that it's owned by root.
-mkdir -m 1777 /tmp/.ICE-unix
-
-# This is a good time to clean up /nix/var/nix/chroots. Doing an `rm
-# -rf' on it isn't safe in general because it can contain bind mounts
-# to /nix/store and other places. But after rebooting these are all
-# gone, of course.
-rm -rf /nix/var/nix/chroots # recreated in activate-configuration.sh
-
# Also get rid of temporary GC roots.
rm -rf /nix/var/nix/gcroots/tmp /nix/var/nix/temproots
@@ -128,16 +114,17 @@ rm -rf /nix/var/nix/gcroots/tmp /nix/var/nix/temproots
if ! mountpoint -q /run; then
rm -rf /run
mkdir -m 0755 -p /run
- mount -t tmpfs -o "mode=0755,size=@runSize@" none /run
+ mount -t tmpfs -o "mode=0755,size=@runSize@" tmpfs /run
fi
# Create a ramfs on /run/keys to hold secrets that shouldn't be
# written to disk (generally used for NixOps, harmless elsewhere).
if ! mountpoint -q /run/keys; then
rm -rf /run/keys
- mkdir -m 0750 /run/keys
+ mkdir /run/keys
+ mount -t ramfs ramfs /run/keys
chown 0:96 /run/keys
- mount -t ramfs none /run/keys
+ chmod 0750 /run/keys
fi
mkdir -m 0755 -p /run/lock
@@ -155,6 +142,20 @@ if test -n "$resumeDevice"; then
fi
+# Use /etc/resolv.conf supplied by systemd-nspawn, if applicable.
+if [ -n "@useHostResolvConf@" -a -e /etc/resolv.conf ]; then
+ cat /etc/resolv.conf | resolvconf -m 1000 -a host
+else
+ touch /etc/resolv.conf
+fi
+
+
+# Create /var/setuid-wrappers as a tmpfs.
+rm -rf /var/setuid-wrappers
+mkdir -m 0755 -p /var/setuid-wrappers
+mount -t tmpfs -o "mode=0755" tmpfs /var/setuid-wrappers
+
+
# Run the script that performs all configuration activation that does
# not have to be done at boot time.
echo "running activation script..."
diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix
index aa0d7e0c138..f53c3b8b8e7 100644
--- a/nixos/modules/system/boot/stage-2.nix
+++ b/nixos/modules/system/boot/stage-2.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -19,11 +19,13 @@ let
isExecutable = true;
inherit (config.boot) devShmSize runSize cleanTmpDir;
inherit (config.nix) readOnlyStore;
+ inherit (config.networking) useHostResolvConf;
ttyGid = config.ids.gids.tty;
path =
[ pkgs.coreutils
pkgs.utillinux
pkgs.sysvtools
+ pkgs.openresolv
] ++ (optional config.boot.cleanTmpDir pkgs.findutils)
++ optional config.nix.readOnlyStore readonlyMountpoint;
postBootCommands = pkgs.writeText "local-cmds"
@@ -79,6 +81,7 @@ in
'';
};
+ # FIXME: should replace this with something that uses systemd-tmpfiles.
cleanTmpDir = mkOption {
type = types.bool;
default = false;
diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix
index 95837644e5c..a6183c47eb1 100644
--- a/nixos/modules/system/boot/systemd-unit-options.nix
+++ b/nixos/modules/system/boot/systemd-unit-options.nix
@@ -1,6 +1,6 @@
-{ config, pkgs }:
+{ config, lib }:
-with pkgs.lib;
+with lib;
let
@@ -28,7 +28,7 @@ let
in rec {
- unitOptions = {
+ sharedOptions = {
enable = mkOption {
default = true;
@@ -41,12 +41,37 @@ in rec {
'';
};
- baseUnit = mkOption {
- type = types.nullOr types.path;
- default = null;
- description = "Path to an upstream unit file on which the NixOS unit configuration will be based.";
+ 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.";
+ };
+
+ };
+
+ concreteUnitOptions = sharedOptions // {
+
+ text = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = "Text of this systemd unit.";
+ };
+
+ unit = mkOption {
+ internal = true;
+ description = "The generated unit.";
+ };
+
+ };
+
+ commonUnitOptions = sharedOptions // {
+
description = mkOption {
default = "";
type = types.str;
@@ -115,18 +140,6 @@ in rec {
'';
};
- requiredBy = mkOption {
- default = [];
- type = types.listOf types.str;
- description = "Units that require (i.e. depend on and need to go down with) this unit.";
- };
-
- wantedBy = mkOption {
- default = [];
- type = types.listOf types.str;
- description = "Units that want (i.e. depend on) this unit.";
- };
-
unitConfig = mkOption {
default = {};
example = { RequiresMountsFor = "/data"; };
@@ -152,7 +165,7 @@ in rec {
};
- serviceOptions = unitOptions // {
+ serviceOptions = commonUnitOptions // {
environment = mkOption {
default = {};
@@ -286,7 +299,7 @@ in rec {
};
- socketOptions = unitOptions // {
+ socketOptions = commonUnitOptions // {
listenStreams = mkOption {
default = [];
@@ -313,7 +326,7 @@ in rec {
};
- timerOptions = unitOptions // {
+ timerOptions = commonUnitOptions // {
timerConfig = mkOption {
default = {};
@@ -332,7 +345,7 @@ in rec {
};
- pathOptions = unitOptions // {
+ pathOptions = commonUnitOptions // {
pathConfig = mkOption {
default = {};
@@ -349,7 +362,7 @@ in rec {
};
- mountOptions = unitOptions // {
+ mountOptions = commonUnitOptions // {
what = mkOption {
example = "/dev/sda1";
@@ -393,7 +406,7 @@ in rec {
};
};
- automountOptions = unitOptions // {
+ automountOptions = commonUnitOptions // {
where = mkOption {
example = "/mnt";
@@ -417,4 +430,6 @@ in rec {
};
};
+ targetOptions = commonUnitOptions;
+
}
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index f5cb6507e72..761600f9e55 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
@@ -24,14 +24,13 @@ let
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"
@@ -41,6 +40,7 @@ let
"sigpwr.target"
"timers.target"
"paths.target"
+ "rpcbind.target"
# Rescue mode.
"rescue.target"
@@ -53,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"
@@ -65,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.
@@ -78,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"
@@ -91,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"
@@ -119,34 +136,57 @@ let
"final.target"
"kexec.target"
"systemd-kexec.service"
+ "systemd-update-utmp.service"
# Password entry.
"systemd-ask-password-console.path"
"systemd-ask-password-console.service"
"systemd-ask-password-wall.path"
"systemd-ask-password-wall.service"
+
+ # Slices / containers.
+ "slices.target"
+ "-.slice"
+ "system.slice"
+ "user.slice"
+ "machine.slice"
+ "systemd-machined.service"
+
+ # Temporary file creation / cleanup.
+ "systemd-tmpfiles-clean.service"
+ "systemd-tmpfiles-clean.timer"
+ "systemd-tmpfiles-setup.service"
+ "systemd-tmpfiles-setup-dev.service"
+
+ # Misc.
+ "systemd-sysctl.service"
]
++ optionals cfg.enableEmergencyMode [
"emergency.target"
"emergency.service"
- ]
-
- ++ optionals config.services.journald.enableHttpGateway [
- "systemd-journal-gatewayd.socket"
- "systemd-journal-gatewayd.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}";
@@ -178,7 +218,7 @@ let
serviceConfig = { name, config, ... }: {
config = mkMerge
- [ (mkIf (config.baseUnit == null) { # Default path for systemd services. Should be quite minimal.
+ [ { # Default path for systemd services. Should be quite minimal.
path =
[ pkgs.coreutils
pkgs.findutils
@@ -187,7 +227,7 @@ let
systemd
];
environment.PATH = config.path;
- })
+ }
(mkIf (config.preStart != "")
{ serviceConfig.ExecStartPre = makeJobScript "${name}-pre-start" ''
#! ${pkgs.stdenv.shell} -e
@@ -255,10 +295,7 @@ let
(if isList value then value else [value]))
as));
- commonUnitText = def:
- optionalString (def.baseUnit != null) ''
- .include ${def.baseUnit}
- '' + ''
+ commonUnitText = def: ''
[Unit]
${attrsToSection def.unitConfig}
'';
@@ -335,63 +372,92 @@ let
'';
};
- 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/
+ for fn in $i/etc/systemd/${type}/* $i/lib/systemd/${type}/*; do
+ if ! [[ "$fn" =~ .wants$ ]]; then
+ ln -s $fn $out/
+ fi
+ done
done
+ # Symlink all units defined by systemd.units. If these are also
+ # provided by systemd or systemd.packages, then add them as
+ # .d/overrides.conf, which makes them extend the
+ # upstream unit.
+ for i in ${toString (mapAttrsToList (n: v: v.unit) units)}; do
+ fn=$(basename $i/*)
+ if [ -e $out/$fn ]; then
+ if [ "$(readlink -f $i/$fn)" = /dev/null ]; then
+ ln -sfn /dev/null $out/$fn
+ else
+ mkdir $out/$fn.d
+ ln -s $i/$fn $out/$fn.d/overrides.conf
+ fi
+ else
+ ln -fs $i/$fn $out/
+ fi
+ done
+
+ # Created .wants and .requires symlinks from the wantedBy and
+ # requiredBy options.
${concatStrings (mapAttrsToList (name: unit:
concatMapStrings (name2: ''
mkdir -p $out/'${name2}.wants'
ln -sfn '../${name}' $out/'${name2}.wants'/
- '') unit.wantedBy) cfg.units)}
+ '') 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/
-
- ${ optionalString config.services.journald.enableHttpGateway ''
- ln -s ../systemd-journal-gatewayd.service $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/
''}
''; # */
@@ -414,37 +480,7 @@ 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.";
- };
- };
+ { options = concreteUnitOptions;
config = {
unit = mkDefault (makeUnit name config);
};
@@ -460,7 +496,7 @@ in
systemd.targets = mkOption {
default = {};
type = types.attrsOf types.optionSet;
- options = [ unitOptions unitConfig ];
+ options = [ targetOptions unitConfig ];
description = "Definition of systemd target units.";
};
@@ -583,7 +619,7 @@ in
default = false;
type = types.bool;
description = ''
- Enable journal http gateway
+ Whether to enable the HTTP gateway to the journal.
'';
};
@@ -610,6 +646,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.";
+ };
+
};
@@ -617,11 +688,19 @@ in
config = {
- system.build.units = units;
+ warnings = concatLists (mapAttrsToList (name: service:
+ optional (service.serviceConfig.Type or "" == "oneshot" && service.serviceConfig.Restart or "no" != "no")
+ "Service ‘${name}.service’ with ‘Type=oneshot’ must have ‘Restart=no’") cfg.services);
+
+ system.build.units = cfg.units;
environment.systemPackages = [ systemd ];
- environment.etc."systemd/system".source = units;
+ environment.etc."systemd/system".source =
+ generateUnits "system" cfg.units upstreamSystemUnits upstreamSystemWants;
+
+ environment.etc."systemd/user".source =
+ generateUnits "user" cfg.user.units upstreamUserUnits [];
environment.etc."systemd/system.conf".text =
''
@@ -685,9 +764,14 @@ in
(v: let n = escapeSystemdPath v.where;
in nameValuePair "${n}.automount" (automountToUnit n v)) cfg.automounts);
- system.requiredKernelConfig = map config.lib.kernelConfig.isEnabled [
- "CGROUPS" "AUTOFS4_FS" "DEVTMPFS"
- ];
+ systemd.user.units =
+ mapAttrs' (n: v: nameValuePair "${n}.service" (serviceToUnit n v)) cfg.user.services;
+
+ system.requiredKernelConfig = map config.lib.kernelConfig.isEnabled
+ [ "DEVTMPFS" "CGROUPS" "INOTIFY_USER" "SIGNALFD" "TIMERFD" "EPOLL" "NET"
+ "SYSFS" "PROC_FS" "FHANDLE" "DMIID" "AUTOFS4_FS" "TMPFS_POSIX_ACL"
+ "TMPFS_XATTR" "SECCOMP"
+ ];
environment.shellAliases =
{ start = "systemctl start";
@@ -708,43 +792,27 @@ in
})
(filterAttrs (name: service: service.startAt != "") cfg.services);
- # FIXME: These are borrowed from upstream systemd.
- systemd.services."systemd-update-utmp" =
- { description = "Update UTMP about System Reboot/Shutdown";
- wantedBy = [ "sysinit.target" ];
- after = [ "systemd-remount-fs.service" ];
- before = [ "sysinit.target" "shutdown.target" ];
- conflicts = [ "shutdown.target" ];
- unitConfig = {
- DefaultDependencies = false;
- RequiresMountsFor = "/var/log";
- };
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = true;
- ExecStart = "${systemd}/lib/systemd/systemd-update-utmp reboot";
- ExecStop = "${systemd}/lib/systemd/systemd-update-utmp shutdown";
- };
- restartIfChanged = false;
+ systemd.sockets.systemd-journal-gatewayd.wantedBy =
+ optional config.services.journald.enableHttpGateway "sockets.target";
+
+ # Provide the systemd-user PAM service, required to run systemd
+ # user instances.
+ security.pam.services.systemd-user =
+ { # Ensure that pam_systemd gets included. This is special-cased
+ # in systemd to provide XDG_RUNTIME_DIR.
+ startSession = true;
};
- systemd.services."systemd-random-seed" =
- { description = "Load/Save Random Seed";
- wantedBy = [ "sysinit.target" "multi-user.target" ];
- after = [ "systemd-remount-fs.service" ];
- before = [ "sysinit.target" "shutdown.target" ];
- conflicts = [ "shutdown.target" ];
- unitConfig = {
- DefaultDependencies = false;
- RequiresMountsFor = "/var/lib";
- };
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = true;
- ExecStart = "${systemd}/lib/systemd/systemd-random-seed load";
- ExecStop = "${systemd}/lib/systemd/systemd-random-seed save";
- };
- };
+ environment.etc."tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf";
+
+ environment.etc."tmpfiles.d/nixos.conf".text =
+ ''
+ # This file is created automatically and should not be modified.
+ # Please change the option ‘systemd.tmpfiles.rules’ instead.
+ ${concatStringsSep "\n" cfg.tmpfiles.rules}
+ '';
+
+ systemd.services."user@".restartIfChanged = false;
};
}
diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix
index e9c03df2ba3..22d55a9e246 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
diff --git a/nixos/modules/system/upstart/upstart.nix b/nixos/modules/system/upstart/upstart.nix
index aa5c8dfe64b..5c046130407 100644
--- a/nixos/modules/system/upstart/upstart.nix
+++ b/nixos/modules/system/upstart/upstart.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
-with import ../boot/systemd-unit-options.nix { inherit config pkgs; };
+with lib;
+with import ../boot/systemd-unit-options.nix { inherit config lib; };
let
@@ -93,7 +93,7 @@ let
if job.daemonType == "fork" || job.daemonType == "daemon" then { Type = "forking"; GuessMainPID = true; } else
if job.daemonType == "none" then { } else
throw "invalid daemon type `${job.daemonType}'")
- // optionalAttrs (!job.task && job.respawn)
+ // optionalAttrs (!job.task && !(job.script == "" && job.exec == "") && job.respawn)
{ Restart = "always"; }
// optionalAttrs job.task
{ Type = "oneshot"; RemainAfterExit = false; };
diff --git a/nixos/modules/tasks/cpu-freq.nix b/nixos/modules/tasks/cpu-freq.nix
index 705ec93a136..a8c63c13428 100644
--- a/nixos/modules/tasks/cpu-freq.nix
+++ b/nixos/modules/tasks/cpu-freq.nix
@@ -1,6 +1,11 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
+
+let
+ cpupower = config.boot.kernelPackages.cpupower;
+ cfg = config.powerManagement;
+in
{
###### interface
@@ -23,31 +28,27 @@ with pkgs.lib;
###### implementation
- config = mkIf (config.powerManagement.cpuFreqGovernor != null) {
+ config = mkIf (!config.boot.isContainer && config.powerManagement.cpuFreqGovernor != null) {
- environment.systemPackages = [ pkgs.cpufrequtils ];
+ boot.kernelModules = [ "acpi-cpufreq" "speedstep-lib" "pcc-cpufreq"
+ "cpufreq_${cfg.cpuFreqGovernor}"
+ ];
- jobs.cpufreq =
- { description = "CPU Frequency Governor Setup";
+ environment.systemPackages = [ cpupower ];
- after = [ "systemd-modules-load.service" ];
- wantedBy = [ "multi-user.target" ];
-
- 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 ];
+ unitConfig.ConditionVirtualization = false;
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = "yes";
+ ExecStart = "${cpupower}/bin/cpupower frequency-set -g ${cfg.cpuFreqGovernor}";
+ SuccessExitStatus = "0 237";
};
- };
+ };
+ };
}
diff --git a/nixos/modules/tasks/encrypted-devices.nix b/nixos/modules/tasks/encrypted-devices.nix
new file mode 100644
index 00000000000..e80762a170c
--- /dev/null
+++ b/nixos/modules/tasks/encrypted-devices.nix
@@ -0,0 +1,69 @@
+{ config, pkgs, modulesPath, ... }:
+
+with pkgs.lib;
+
+let
+ fileSystems = attrValues config.fileSystems ++ config.swapDevices;
+ encDevs = filter (dev: dev.encrypted.enable) fileSystems;
+ keyedEncDevs = filter (dev: dev.encrypted.keyFile != null) encDevs;
+ isIn = needle: haystack: filter (p: p == needle) haystack != [];
+ anyEncrypted =
+ fold (j: v: v || j.encrypted.enable) false encDevs;
+
+ encryptedFSOptions = {
+
+ encrypted = {
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = "The block device is backed by an encrypted one, adds this device as a initrd luks entry";
+ };
+
+ blkDev = mkOption {
+ default = null;
+ example = "/dev/sda1";
+ type = types.uniq (types.nullOr types.string);
+ description = "Location of the backing encrypted device";
+ };
+
+ label = mkOption {
+ default = null;
+ example = "rootfs";
+ type = types.uniq (types.nullOr types.string);
+ description = "Label of the backing encrypted device";
+ };
+
+ keyFile = mkOption {
+ default = null;
+ example = "/root/.swapkey";
+ type = types.uniq (types.nullOr types.string);
+ description = "File system location of keyfile";
+ };
+ };
+ };
+in
+
+{
+
+ options = {
+ fileSystems = mkOption {
+ options = [encryptedFSOptions];
+ };
+ swapDevices = mkOption {
+ options = [encryptedFSOptions];
+ };
+ };
+
+ config = mkIf anyEncrypted {
+ boot.initrd = {
+ luks = {
+ devices =
+ map (dev: { name = dev.encrypted.label; device = dev.encrypted.blkDev; } ) encDevs;
+ cryptoModules = [ "aes" "sha256" "sha1" "xts" ];
+ };
+ postMountCommands =
+ concatMapStrings (dev: "cryptsetup luksOpen --key-file ${dev.encrypted.keyFile} ${dev.encrypted.label};\n") keyedEncDevs;
+ };
+ };
+}
+
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index f9b40b8366a..d350bc1b5d0 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
@@ -187,6 +187,8 @@ in
let
mountPoint' = escapeSystemdPath fs.mountPoint;
device' = escapeSystemdPath fs.device;
+ # -F needed to allow bare block device without partitions
+ mkfsOpts = optional ((builtins.substring 0 3 fs.fsType) == "ext") "-F";
in nameValuePair "mkfs-${device'}"
{ description = "Initialisation of Filesystem ${fs.device}";
wantedBy = [ "${mountPoint'}.mount" ];
@@ -201,7 +203,7 @@ in
type=$(blkid -p -s TYPE -o value "${fs.device}" || true)
if [ -z "$type" ]; then
echo "creating ${fs.fsType} filesystem on ${fs.device}..."
- mkfs.${fs.fsType} "${fs.device}"
+ mkfs.${fs.fsType} ${concatStringsSep " " mkfsOpts} "${fs.device}"
fi
'';
unitConfig.RequiresMountsFor = [ "${dirOf fs.device}" ];
diff --git a/nixos/modules/tasks/filesystems/btrfs.nix b/nixos/modules/tasks/filesystems/btrfs.nix
index d95a32e2e3f..d0a2ac645e0 100644
--- a/nixos/modules/tasks/filesystems/btrfs.nix
+++ b/nixos/modules/tasks/filesystems/btrfs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/tasks/filesystems/f2fs.nix b/nixos/modules/tasks/filesystems/f2fs.nix
new file mode 100644
index 00000000000..8655107360c
--- /dev/null
+++ b/nixos/modules/tasks/filesystems/f2fs.nix
@@ -0,0 +1,21 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+ inInitrd = any (fs: fs == "f2fs") config.boot.initrd.supportedFilesystems;
+in
+{
+ config = mkIf (any (fs: fs == "f2fs") config.boot.supportedFilesystems) {
+
+ system.fsPackages = [ pkgs.f2fs-tools ];
+
+ boot.initrd.availableKernelModules = mkIf inInitrd [ "f2fs" ];
+
+ boot.initrd.extraUtilsCommands = mkIf inInitrd ''
+ mkdir -p $out/bin $out/lib
+ cp -v ${pkgs.f2fs-tools}/sbin/fsck.f2fs $out/bin
+ cp -pdv ${pkgs.f2fs-tools}/lib/lib*.so.* $out/lib
+ '';
+ };
+}
diff --git a/nixos/modules/tasks/filesystems/nfs.nix b/nixos/modules/tasks/filesystems/nfs.nix
index 2b720a93b89..e8c3d8ab56d 100644
--- a/nixos/modules/tasks/filesystems/nfs.nix
+++ b/nixos/modules/tasks/filesystems/nfs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/tasks/filesystems/reiserfs.nix b/nixos/modules/tasks/filesystems/reiserfs.nix
index f8c6a700004..a3bfb3fed8e 100644
--- a/nixos/modules/tasks/filesystems/reiserfs.nix
+++ b/nixos/modules/tasks/filesystems/reiserfs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/tasks/filesystems/vfat.nix b/nixos/modules/tasks/filesystems/vfat.nix
index 5ca72f142b7..4cfe6e208f7 100644
--- a/nixos/modules/tasks/filesystems/vfat.nix
+++ b/nixos/modules/tasks/filesystems/vfat.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/tasks/filesystems/xfs.nix b/nixos/modules/tasks/filesystems/xfs.nix
index 6800696a05a..5225b62a88c 100644
--- a/nixos/modules/tasks/filesystems/xfs.nix
+++ b/nixos/modules/tasks/filesystems/xfs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index 32e3da6a273..d7deb44c407 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
#
# todo:
# - crontab for scrubs, etc
@@ -6,11 +6,12 @@
# - /etc/zfs/zpool.cache handling
-with pkgs.lib;
+with lib;
let
cfgSpl = config.boot.spl;
+ cfgZfs = config.boot.zfs;
cfgSnapshots = config.services.zfs.autoSnapshot;
inInitrd = any (fs: fs == "zfs") config.boot.initrd.supportedFilesystems;
@@ -21,8 +22,11 @@ let
kernel = config.boot.kernelPackages;
+ splPkg = if cfgZfs.useGit then kernel.spl_git else kernel.spl;
+ zfsPkg = if cfgZfs.useGit then kernel.zfs_git else kernel.zfs;
+
autosnapPkg = pkgs.zfstools.override {
- zfs = config.boot.kernelPackages.zfs;
+ zfs = zfsPkg;
};
zfsAutoSnap = "${autosnapPkg}/bin/zfs-auto-snapshot";
@@ -47,6 +51,17 @@ in
'';
};
+ boot.zfs.useGit = mkOption {
+ type = types.bool;
+ default = false;
+ example = true;
+ description = ''
+ Use the git version of the SPL and ZFS packages.
+ Note that these are unreleased versions, with less testing, and therefore
+ may be more unstable.
+ '';
+ };
+
services.zfs.autoSnapshot = {
enable = mkOption {
default = false;
@@ -111,7 +126,7 @@ in
(mkIf enableZfs {
boot = {
kernelModules = [ "spl" "zfs" ] ;
- extraModulePackages = [ kernel.zfs kernel.spl ];
+ extraModulePackages = [ splPkg zfsPkg ];
extraModprobeConfig = mkIf (cfgSpl.hostid != "") ''
options spl spl_hostid=${cfgSpl.hostid}
'';
@@ -121,10 +136,10 @@ in
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 -v ${zfsPkg}/sbin/zfs $out/bin
+ cp -v ${zfsPkg}/sbin/zdb $out/bin
+ cp -v ${zfsPkg}/sbin/zpool $out/bin
+ cp -pdv ${zfsPkg}/lib/lib*.so* $out/lib
cp -pdv ${pkgs.zlib}/lib/lib*.so* $out/lib
'';
postDeviceCommands =
@@ -139,7 +154,7 @@ in
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
- ExecStart = "${kernel.zfs}/sbin/zpool import -f -a";
+ ExecStart = "${zfsPkg}/sbin/zpool import -f -a";
};
restartIfChanged = false;
};
@@ -151,15 +166,15 @@ in
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
- ExecStart = "${kernel.zfs}/sbin/zfs mount -a";
- ExecStop = "${kernel.zfs}/sbin/zfs umount -a";
+ ExecStart = "${zfsPkg}/sbin/zfs mount -a";
+ ExecStop = "${zfsPkg}/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.
+ system.fsPackages = [ zfsPkg ]; # XXX: needed? zfs doesn't have (need) a fsck
+ environment.systemPackages = [ zfsPkg ];
+ services.udev.packages = [ zfsPkg ]; # to hook zvol naming, etc.
})
(mkIf enableAutoSnapshots {
diff --git a/nixos/modules/tasks/kbd.nix b/nixos/modules/tasks/kbd.nix
index 1083fb784fc..03c42404e5d 100644
--- a/nixos/modules/tasks/kbd.nix
+++ b/nixos/modules/tasks/kbd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -52,19 +52,7 @@ in
# /dev/tty0 to prevent putting the X server in non-raw mode, and
# it has a restart trigger.
systemd.services."systemd-vconsole-setup" =
- { description = "Setup Virtual Console";
- wantedBy = [ "sysinit.target" "multi-user.target" ];
- before = [ "sysinit.target" "shutdown.target" ];
- 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 0e0272388c7..d56a8a2f63a 100644
--- a/nixos/modules/tasks/lvm.nix
+++ b/nixos/modules/tasks/lvm.nix
@@ -1,10 +1,12 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
+
+with lib;
{
###### implementation
- config = {
+ config = mkIf (!config.boot.isContainer) {
environment.systemPackages = [ pkgs.lvm2 ];
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index 548685377a9..9cc8b154324 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
@@ -191,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.";
diff --git a/nixos/modules/tasks/scsi-link-power-management.nix b/nixos/modules/tasks/scsi-link-power-management.nix
index 071a8086598..a74023dec21 100644
--- a/nixos/modules/tasks/scsi-link-power-management.nix
+++ b/nixos/modules/tasks/scsi-link-power-management.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
###### interface
diff --git a/nixos/modules/tasks/trackpoint.nix b/nixos/modules/tasks/trackpoint.nix
new file mode 100644
index 00000000000..4be2c3eb4c4
--- /dev/null
+++ b/nixos/modules/tasks/trackpoint.nix
@@ -0,0 +1,66 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+ ###### interface
+
+ options = {
+
+ hardware.trackpoint = {
+
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Enable sensitivity and speed configuration for trackpoints.
+ '';
+ };
+
+ sensitivity = mkOption {
+ default = 128;
+ example = 255;
+ type = types.int;
+ description = ''
+ Configure the trackpoint sensitivity. By default, the kernel
+ configures 128.
+ '';
+ };
+
+ speed = mkOption {
+ default = 97;
+ example = 255;
+ type = types.int;
+ description = ''
+ Configure the trackpoint sensitivity. By default, the kernel
+ configures 97.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.hardware.trackpoint.enable {
+
+ jobs.trackpoint =
+ { description = "Initialize trackpoint";
+
+ startOn = "started udev";
+
+ task = true;
+
+ script = ''
+ echo -n ${toString config.hardware.trackpoint.sensitivity} \
+ > /sys/devices/platform/i8042/serio1/sensitivity
+ echo -n ${toString config.hardware.trackpoint.speed} \
+ > /sys/devices/platform/i8042/serio1/speed
+ '';
+ };
+
+ };
+
+}
diff --git a/nixos/modules/testing/service-runner.nix b/nixos/modules/testing/service-runner.nix
index 6f17ed77dad..dfe8b430e04 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 28494e1c7b2..9100a433cd6 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 99d6f927ef0..9e64327c3ab 100644
--- a/nixos/modules/virtualisation/amazon-image.nix
+++ b/nixos/modules/virtualisation/amazon-image.nix
@@ -1,168 +1,183 @@
-{ config, pkgs, ... }:
-
-with pkgs.lib;
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ cfg = config.ec2;
+in
{
imports = [ ../profiles/headless.nix ./ec2-data.nix ];
- system.build.amazonImage =
- pkgs.vmTools.runInLinuxVM (
- pkgs.runCommand "amazon-image"
- { preVM =
- ''
- mkdir $out
- diskImage=$out/nixos.img
- ${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "4G"
- mv closure xchg/
- '';
- buildInputs = [ pkgs.utillinux pkgs.perl ];
- exportReferencesGraph =
- [ "closure" config.system.build.toplevel ];
- }
- ''
- # Create an empty filesystem and mount it.
- ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda
- ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda
- mkdir /mnt
- mount /dev/vda /mnt
+ options = {
+ ec2 = {
+ hvm = mkOption {
+ default = false;
+ description = ''
+ Whether the EC2 instance is a HVM instance.
+ '';
+ };
+ };
+ };
- # The initrd expects these directories to exist.
- mkdir /mnt/dev /mnt/proc /mnt/sys
+ config = {
+ system.build.amazonImage =
+ pkgs.vmTools.runInLinuxVM (
+ pkgs.runCommand "amazon-image"
+ { preVM =
+ ''
+ mkdir $out
+ diskImage=$out/nixos.img
+ ${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "4G"
+ mv closure xchg/
+ '';
+ buildInputs = [ pkgs.utillinux pkgs.perl ];
+ exportReferencesGraph =
+ [ "closure" config.system.build.toplevel ];
+ }
+ ''
+ # Create an empty filesystem and mount it.
+ ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda
+ ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda
+ mkdir /mnt
+ mount /dev/vda /mnt
- mount -o bind /proc /mnt/proc
+ # The initrd expects these directories to exist.
+ mkdir /mnt/dev /mnt/proc /mnt/sys
- # Copy all paths in the closure to the filesystem.
- storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
+ mount -o bind /proc /mnt/proc
- mkdir -p /mnt/nix/store
- echo "copying everything (will take a while)..."
- cp -prd $storePaths /mnt/nix/store/
+ # Copy all paths in the closure to the filesystem.
+ storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
- # Register the paths in the Nix database.
- printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
- chroot /mnt ${config.nix.package}/bin/nix-store --load-db
+ mkdir -p /mnt/nix/store
+ echo "copying everything (will take a while)..."
+ cp -prd $storePaths /mnt/nix/store/
- # Create the system profile to allow nixos-rebuild to work.
- chroot /mnt ${config.nix.package}/bin/nix-env \
- -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
+ # Register the paths in the Nix database.
+ printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
+ chroot /mnt ${config.nix.package}/bin/nix-store --load-db
- # `nixos-rebuild' requires an /etc/NIXOS.
- mkdir -p /mnt/etc
- touch /mnt/etc/NIXOS
+ # Create the system profile to allow nixos-rebuild to work.
+ chroot /mnt ${config.nix.package}/bin/nix-env \
+ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
- # `switch-to-configuration' requires a /bin/sh
- mkdir -p /mnt/bin
- ln -s ${config.system.build.binsh}/bin/sh /mnt/bin/sh
+ # `nixos-rebuild' requires an /etc/NIXOS.
+ mkdir -p /mnt/etc
+ touch /mnt/etc/NIXOS
- # Install a configuration.nix.
- mkdir -p /mnt/etc/nixos
- cp ${./amazon-config.nix} /mnt/etc/nixos/configuration.nix
+ # `switch-to-configuration' requires a /bin/sh
+ mkdir -p /mnt/bin
+ ln -s ${config.system.build.binsh}/bin/sh /mnt/bin/sh
- # Generate the GRUB menu.
- chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
+ # Install a configuration.nix.
+ mkdir -p /mnt/etc/nixos
+ cp ${./amazon-config.nix} /mnt/etc/nixos/configuration.nix
- umount /mnt/proc
- umount /mnt
- ''
- );
+ # Generate the GRUB menu.
+ chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
- fileSystems."/".device = "/dev/disk/by-label/nixos";
+ umount /mnt/proc
+ umount /mnt
+ ''
+ );
- boot.initrd.kernelModules = [ "xen-blkfront" ];
- boot.kernelModules = [ "xen-netfront" ];
+ fileSystems."/".device = "/dev/disk/by-label/nixos";
- # Generate a GRUB menu. Amazon's pv-grub uses this to boot our kernel/initrd.
- boot.loader.grub.version = 1;
- boot.loader.grub.device = "nodev";
- boot.loader.grub.timeout = 0;
- boot.loader.grub.extraPerEntryConfig = "root (hd0)";
+ boot.initrd.kernelModules = [ "xen-blkfront" ];
+ boot.kernelModules = [ "xen-netfront" ];
- boot.initrd.postDeviceCommands =
- ''
- # Force udev to exit to prevent random "Device or resource busy
- # while trying to open /dev/xvda" errors from fsck.
- udevadm control --exit || true
- kill -9 -1
- '';
+ # Generate a GRUB menu. Amazon's pv-grub uses this to boot our kernel/initrd.
+ boot.loader.grub.version = 1;
+ boot.loader.grub.device = if cfg.hvm then "/dev/xvda" else "nodev";
+ boot.loader.grub.timeout = 0;
+ boot.loader.grub.extraPerEntryConfig = "root (hd0${lib.optionalString cfg.hvm ",0"})";
- # Mount all formatted ephemeral disks and activate all swap devices.
- # We cannot do this with the ‘fileSystems’ and ‘swapDevices’ options
- # because the set of devices is dependent on the instance type
- # (e.g. "m1.large" has one ephemeral filesystem and one swap device,
- # while "m1.large" has two ephemeral filesystems and no swap
- # devices). Also, put /tmp and /var on /disk0, since it has a lot
- # more space than the root device. Similarly, "move" /nix to /disk0
- # by layering a unionfs-fuse mount on top of it so we have a lot more space for
- # Nix operations.
- boot.initrd.postMountCommands =
- ''
- diskNr=0
- diskForUnionfs=
- for device in /dev/xvd[abcde]*; do
- if [ "$device" = /dev/xvda -o "$device" = /dev/xvda1 ]; then continue; fi
- fsType=$(blkid -o value -s TYPE "$device" || true)
- if [ "$fsType" = swap ]; then
- echo "activating swap device $device..."
- swapon "$device" || true
- elif [ "$fsType" = ext3 ]; then
- mp="/disk$diskNr"
- diskNr=$((diskNr + 1))
- echo "mounting $device on $mp..."
- if mountFS "$device" "$mp" "" ext3; then
- if [ -z "$diskForUnionfs" ]; then diskForUnionfs="$mp"; fi
- fi
- else
- echo "skipping unknown device type $device"
- fi
- done
+ boot.initrd.postDeviceCommands =
+ ''
+ # Force udev to exit to prevent random "Device or resource busy
+ # while trying to open /dev/xvda" errors from fsck.
+ udevadm control --exit || true
+ kill -9 -1
+ '';
- if [ -n "$diskForUnionfs" ]; then
- mkdir -m 755 -p $targetRoot/$diskForUnionfs/root
+ # Mount all formatted ephemeral disks and activate all swap devices.
+ # We cannot do this with the ‘fileSystems’ and ‘swapDevices’ options
+ # because the set of devices is dependent on the instance type
+ # (e.g. "m1.large" has one ephemeral filesystem and one swap device,
+ # while "m1.large" has two ephemeral filesystems and no swap
+ # devices). Also, put /tmp and /var on /disk0, since it has a lot
+ # more space than the root device. Similarly, "move" /nix to /disk0
+ # by layering a unionfs-fuse mount on top of it so we have a lot more space for
+ # Nix operations.
+ boot.initrd.postMountCommands =
+ ''
+ diskNr=0
+ diskForUnionfs=
+ for device in /dev/xvd[abcde]*; do
+ if [ "$device" = /dev/xvda -o "$device" = /dev/xvda1 ]; then continue; fi
+ fsType=$(blkid -o value -s TYPE "$device" || true)
+ if [ "$fsType" = swap ]; then
+ echo "activating swap device $device..."
+ swapon "$device" || true
+ elif [ "$fsType" = ext3 ]; then
+ mp="/disk$diskNr"
+ diskNr=$((diskNr + 1))
+ echo "mounting $device on $mp..."
+ if mountFS "$device" "$mp" "" ext3; then
+ if [ -z "$diskForUnionfs" ]; then diskForUnionfs="$mp"; fi
+ fi
+ else
+ echo "skipping unknown device type $device"
+ fi
+ done
- mkdir -m 1777 -p $targetRoot/$diskForUnionfs/root/tmp $targetRoot/tmp
- mount --bind $targetRoot/$diskForUnionfs/root/tmp $targetRoot/tmp
+ if [ -n "$diskForUnionfs" ]; then
+ mkdir -m 755 -p $targetRoot/$diskForUnionfs/root
- if [ ! -e $targetRoot/.ebs ]; then
- mkdir -m 755 -p $targetRoot/$diskForUnionfs/root/var $targetRoot/var
- mount --bind $targetRoot/$diskForUnionfs/root/var $targetRoot/var
+ mkdir -m 1777 -p $targetRoot/$diskForUnionfs/root/tmp $targetRoot/tmp
+ mount --bind $targetRoot/$diskForUnionfs/root/tmp $targetRoot/tmp
- mkdir -p /unionfs-chroot/ro-nix
- mount --rbind $targetRoot/nix /unionfs-chroot/ro-nix
+ if [ ! -e $targetRoot/.ebs ]; then
+ mkdir -m 755 -p $targetRoot/$diskForUnionfs/root/var $targetRoot/var
+ mount --bind $targetRoot/$diskForUnionfs/root/var $targetRoot/var
- mkdir -m 755 -p $targetRoot/$diskForUnionfs/root/nix
- mkdir -p /unionfs-chroot/rw-nix
- mount --rbind $targetRoot/$diskForUnionfs/root/nix /unionfs-chroot/rw-nix
+ mkdir -p /unionfs-chroot/ro-nix
+ mount --rbind $targetRoot/nix /unionfs-chroot/ro-nix
- unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768 /rw-nix=RW:/ro-nix=RO $targetRoot/nix
- fi
- fi
- '';
+ mkdir -m 755 -p $targetRoot/$diskForUnionfs/root/nix
+ mkdir -p /unionfs-chroot/rw-nix
+ mount --rbind $targetRoot/$diskForUnionfs/root/nix /unionfs-chroot/rw-nix
- boot.initrd.extraUtilsCommands =
- ''
- # We need swapon in the initrd.
- cp ${pkgs.utillinux}/sbin/swapon $out/bin
- '';
+ unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768 /rw-nix=RW:/ro-nix=RO $targetRoot/nix
+ fi
+ fi
+ '';
- # Don't put old configurations in the GRUB menu. The user has no
- # way to select them anyway.
- boot.loader.grub.configurationLimit = 0;
+ boot.initrd.extraUtilsCommands =
+ ''
+ # We need swapon in the initrd.
+ cp ${pkgs.utillinux}/sbin/swapon $out/bin
+ '';
- # Allow root logins only using the SSH key that the user specified
- # at instance creation time.
- services.openssh.enable = true;
- services.openssh.permitRootLogin = "without-password";
+ # Don't put old configurations in the GRUB menu. The user has no
+ # way to select them anyway.
+ boot.loader.grub.configurationLimit = 0;
- # Force getting the hostname from EC2.
- networking.hostName = mkDefault "";
+ # Allow root logins only using the SSH key that the user specified
+ # at instance creation time.
+ services.openssh.enable = true;
+ services.openssh.permitRootLogin = "without-password";
- # Always include cryptsetup so that Charon can use it.
- environment.systemPackages = [ pkgs.cryptsetup ];
+ # Force getting the hostname from EC2.
+ networking.hostName = mkDefault "";
- boot.initrd.supportedFilesystems = [ "unionfs-fuse" ];
+ # Always include cryptsetup so that Charon can use it.
+ environment.systemPackages = [ pkgs.cryptsetup ];
- # Prevent logging in as root without a password. This doesn't really matter,
- # since the only PAM services that allow logging in with a null
- # password are local ones that are inaccessible on EC2 machines.
- security.initialRootPassword = mkDefault "!";
+ boot.initrd.supportedFilesystems = [ "unionfs-fuse" ];
+
+ # Prevent logging in as root without a password. This doesn't really matter,
+ # since the only PAM services that allow logging in with a null
+ # password are local ones that are inaccessible on EC2 machines.
+ security.initialRootPassword = mkDefault "!";
+ };
}
diff --git a/nixos/modules/virtualisation/container-config.nix b/nixos/modules/virtualisation/container-config.nix
index 21e64c8c095..b81f97f2b4e 100644
--- a/nixos/modules/virtualisation/container-config.nix
+++ b/nixos/modules/virtualisation/container-config.nix
@@ -6,33 +6,21 @@ with lib;
config = mkIf config.boot.isContainer {
- # Provide a login prompt on /var/lib/login.socket. On the host,
- # you can connect to it by running ‘socat
- # unix:/var/lib/login.socket -,echo=0,raw’.
- systemd.sockets.login =
- { description = "Login Socket";
- wantedBy = [ "sockets.target" ];
- socketConfig =
- { ListenStream = "/var/lib/login.socket";
- SocketMode = "0666";
- Accept = true;
- };
- };
+ # Disable some features that are not useful in a container.
+ sound.enable = mkDefault false;
+ services.udisks2.enable = mkDefault false;
- systemd.services."login@" =
- { description = "Login %i";
- environment.TERM = "linux";
- serviceConfig =
- { Type = "simple";
- StandardInput = "socket";
- ExecStart = "${pkgs.socat}/bin/socat -t0 - exec:${pkgs.shadow}/bin/login,pty,setsid,setpgid,stderr,ctty";
- TimeoutStopSec = 1; # FIXME
- };
- };
+ networking.useHostResolvConf = true;
- # Also 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.
+ # Containers should be light-weight, so start sshd on demand.
+ services.openssh.startWhenNeeded = mkDefault true;
+
+ # Shut up warnings about not having a boot loader.
+ system.build.installBootLoader = "${pkgs.coreutils}/bin/true";
+
+ # Provide a root login prompt on /var/lib/root-login.socket that
+ # doesn't ask for a password. This socket can only be used by root
+ # on the host.
systemd.sockets.root-login =
{ description = "Root Login Socket";
wantedBy = [ "sockets.target" ];
@@ -52,6 +40,7 @@ with lib;
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
@@ -82,6 +71,7 @@ with lib;
eval "command=($c)"
exec "''${command[@]}"
'';
+ restartIfChanged = false;
};
systemd.services.container-startup-done =
@@ -96,6 +86,7 @@ with lib;
'';
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
+ restartIfChanged = false;
};
};
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index c53bd7d3509..d0d04d9a1e5 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -1,19 +1,9 @@
-{ 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";
@@ -23,6 +13,30 @@ let
inherit (pkgs) socat;
};
+ # The container's init script, a small wrapper around the regular
+ # NixOS stage-2 init script.
+ containerInit = pkgs.writeScript "container-init"
+ ''
+ #! ${pkgs.stdenv.shell} -e
+
+ # Initialise the container side of the veth pair.
+ if [ "$PRIVATE_NETWORK" = 1 ]; then
+ ip link set host0 name eth0
+ ip link set dev eth0 up
+ if [ -n "$HOST_ADDRESS" ]; then
+ ip route add $HOST_ADDRESS dev eth0
+ ip route add default via $HOST_ADDRESS
+ fi
+ if [ -n "$LOCAL_ADDRESS" ]; then
+ ip addr add $LOCAL_ADDRESS dev eth0
+ fi
+ fi
+
+ exec "$1"
+ '';
+
+ system = config.nixpkgs.system;
+
in
{
@@ -68,7 +82,7 @@ in
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
+ ve-container-name
on the host. If this option is not set, then the
container shares the network interfaces of the host,
and can bind to any port on any interface.
@@ -99,10 +113,10 @@ in
config = mkMerge
[ (mkIf options.config.isDefined {
path = (import ../../lib/eval-config.nix {
+ inherit system;
modules =
let extraConfig =
{ boot.isContainer = true;
- security.initialRootPassword = mkDefault "!";
networking.hostName = mkDefault name;
networking.useDHCP = false;
};
@@ -173,50 +187,35 @@ in
"/nix/var/nix/profiles/per-container/$INSTANCE" \
"/nix/var/nix/gcroots/per-container/$INSTANCE"
- SYSTEM_PATH=/nix/var/nix/profiles/system
- 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"
'';
restartIfChanged = false;
@@ -252,14 +250,13 @@ in
''
#! ${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";
+
+ serviceConfig.EnvironmentFile = "-/etc/containers/%i.conf";
};
# Generate a configuration file in /etc/containers for each
@@ -289,6 +286,8 @@ in
${cfg.localAddress} ${name}.containers
'') config.containers);
+ networking.dhcpcd.denyInterfaces = [ "ve-*" ];
+
environment.systemPackages = [ nixos-container ];
};
diff --git a/nixos/modules/virtualisation/ec2-data.nix b/nixos/modules/virtualisation/ec2-data.nix
index 5133a98cd96..246d3506531 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 5fca115b819..d55b7420243 100644
--- a/nixos/modules/virtualisation/google-compute-image.nix
+++ b/nixos/modules/virtualisation/google-compute-image.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diskSize = "100G";
in
@@ -114,11 +114,6 @@ in
# Always include cryptsetup so that NixOps can use it.
environment.systemPackages = [ pkgs.cryptsetup ];
- # 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 = mkDefault "!";
-
# Configure default metadata hostnames
networking.extraHosts = ''
169.254.169.254 metadata.google.internal metadata
diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix
index 6d36fd4caa0..d7d700d8841 100644
--- a/nixos/modules/virtualisation/libvirtd.nix
+++ b/nixos/modules/virtualisation/libvirtd.nix
@@ -1,8 +1,8 @@
# Systemd services for libvirtd.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/virtualisation/nixos-container.pl b/nixos/modules/virtualisation/nixos-container.pl
index d7e8c7339b6..5083abd8448 100644
--- a/nixos/modules/virtualisation/nixos-container.pl
+++ b/nixos/modules/virtualisation/nixos-container.pl
@@ -9,6 +9,9 @@ use Getopt::Long qw(:config gnu_getopt);
my $socat = '@socat@/bin/socat';
+# Ensure a consistent umask.
+umask 0022;
+
# Parse the command line.
sub showHelp {
@@ -28,7 +31,7 @@ EOF
}
my $ensureUniqueName = 0;
-my $extraConfig = "";
+my $extraConfig;
GetOptions(
"help" => sub { showHelp() },
@@ -59,12 +62,11 @@ sub writeNixOSConfig {
my ($nixosConfigFile) = @_;
my $nixosConfig = <",
@@ -203,7 +205,7 @@ elsif ($action eq "update") {
}
elsif ($action eq "login") {
- exec($socat, "unix:$root/var/lib/login.socket", "-,echo=0,raw");
+ exec("machinectl", "login", "--", $containerName);
}
elsif ($action eq "root-login") {
@@ -212,18 +214,22 @@ elsif ($action eq "root-login") {
elsif ($action eq "run") {
shift @ARGV; shift @ARGV;
- open(SOCAT, "|-", $socat, "unix:$root/var/lib/run-command.socket", "-");
+ my $pid = open(SOCAT, "|-", $socat, "-t0", "-", "unix:$root/var/lib/run-command.socket") or die "$0: cannot start $socat: $!\n";
print SOCAT join(' ', map { "'$_'" } @ARGV), "\n";
+ flush SOCAT;
+ waitpid($pid, 0);
close(SOCAT);
}
elsif ($action eq "set-root-password") {
# FIXME: don't get password from the command line.
my $password = $ARGV[2] or die "$0: no password given\n";
- open(SOCAT, "|-", $socat, "unix:$root/var/lib/run-command.socket", "-");
+ my $pid = open(SOCAT, "|-", $socat, "-t0", "-", "unix:$root/var/lib/run-command.socket") or die "$0: cannot start $socat: $!\n";
print SOCAT "passwd\n";
print SOCAT "$password\n";
print SOCAT "$password\n";
+ flush SOCAT;
+ waitpid($pid, 0);
close(SOCAT);
}
diff --git a/nixos/modules/virtualisation/nova-image.nix b/nixos/modules/virtualisation/nova-image.nix
index 5c9481b7127..2523dacc0b5 100644
--- a/nixos/modules/virtualisation/nova-image.nix
+++ b/nixos/modules/virtualisation/nova-image.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
{
imports = [ ../profiles/qemu-guest.nix ../profiles/headless.nix ./ec2-data.nix ];
diff --git a/nixos/modules/virtualisation/nova.nix b/nixos/modules/virtualisation/nova.nix
index e0d25183574..8795b5b52d5 100644
--- a/nixos/modules/virtualisation/nova.nix
+++ b/nixos/modules/virtualisation/nova.nix
@@ -1,8 +1,8 @@
# Module for Nova, a.k.a. OpenStack Compute.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index a866b513f0f..bccf6583e47 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -7,9 +7,9 @@
# the VM in the host. On the other hand, the root filesystem is a
# read/writable disk image persistent across VM reboots.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
@@ -65,7 +65,7 @@ let
${if cfg.useBootLoader then ''
-drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \
-drive index=1,id=drive2,file=${bootDisk}/disk.img,if=virtio,readonly \
- -boot menu=on
+ -boot menu=on \
'' else ''
-drive file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \
-kernel ${config.system.build.toplevel}/kernel \
@@ -386,7 +386,7 @@ in
# When building a regular system configuration, override whatever
# video driver the host uses.
- hardware.opengl.videoDrivers = mkVMOverride [ "vesa" ];
+ services.xserver.videoDrivers = mkVMOverride [ "vesa" ];
services.xserver.defaultDepth = mkVMOverride 0;
services.xserver.resolutions = mkVMOverride [ { x = 1024; y = 768; } ];
services.xserver.monitorSection =
@@ -399,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
deleted file mode 100644
index d375bddf2e6..00000000000
--- a/nixos/modules/virtualisation/run-in-netns.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#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 b06ae94438e..b3847daf12c 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
@@ -54,7 +54,7 @@ optionalAttrs (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) # ugly...
serviceConfig.ExecStart = "@${kernel.virtualboxGuestAdditions}/sbin/VBoxService VBoxService --foreground";
};
- hardware.opengl.videoDrivers = mkOverride 50 [ "virtualbox" ];
+ services.xserver.videoDrivers = mkOverride 50 [ "virtualbox" ];
services.xserver.config =
''
diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix
index 8323325dabf..594b3e93ffe 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 =
@@ -107,9 +107,4 @@ with pkgs.lib;
boot.loader.grub.device = "/dev/sda";
services.virtualbox.enable = true;
-
- # 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 = mkDefault "!";
}
diff --git a/nixos/modules/virtualisation/xen-dom0.nix b/nixos/modules/virtualisation/xen-dom0.nix
index 40f6929be4f..566059472c9 100644
--- a/nixos/modules/virtualisation/xen-dom0.nix
+++ b/nixos/modules/virtualisation/xen-dom0.nix
@@ -1,8 +1,8 @@
# Xen hypervisor (Dom0) support.
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix
index 741ab62bbc0..f59f71b0d6f 100644
--- a/nixos/release-combined.nix
+++ b/nixos/release-combined.nix
@@ -1,6 +1,6 @@
-{ nixpkgs ? { outPath = ./..; revCount = 5678; shortRev = "gfedcba"; }
-, officialRelease ? false
+{ nixpkgs ? { outPath = ./..; revCount = 56789; shortRev = "gfedcba"; }
, stableBranch ? false
+, supportedSystems ? [ "x86_64-linux" "i686-linux" ]
}:
let
@@ -18,15 +18,13 @@ let
in rec {
nixos = removeMaintainers (import ./release.nix {
- inherit officialRelease stableBranch;
+ inherit stableBranch;
nixpkgs = nixpkgsSrc;
});
nixpkgs = builtins.removeAttrs (removeMaintainers (import ../pkgs/top-level/release.nix {
- inherit officialRelease;
+ inherit supportedSystems;
nixpkgs = nixpkgsSrc;
- # Only do Linux builds.
- supportedSystems = [ "x86_64-linux" "i686-linux" ];
})) [ "unstable" ];
tested = pkgs.releaseTools.aggregate {
@@ -45,8 +43,11 @@ in rec {
(all nixos.ova)
# (all nixos.tests.efi-installer.simple)
+ (all nixos.tests.containers)
(all nixos.tests.firefox)
(all nixos.tests.firewall)
+ (all nixos.tests.gnome3)
+ #(all nixos.tests.installer.efi)
(all nixos.tests.installer.grub1)
(all nixos.tests.installer.lvm)
(all nixos.tests.installer.separateBoot)
@@ -60,7 +61,8 @@ in rec {
(all nixos.tests.openssh)
(all nixos.tests.printing)
(all nixos.tests.proxy)
- (all nixos.tests.udisks)
+ (all nixos.tests.simple)
+ (all nixos.tests.udisks2)
(all nixos.tests.xfce)
nixpkgs.tarball
diff --git a/nixos/release.nix b/nixos/release.nix
index b98976c2cce..e5eadb57fe6 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -1,18 +1,17 @@
-{ nixpkgs ? { outPath = ./..; revCount = 5678; shortRev = "gfedcba"; }
-, officialRelease ? false
+{ nixpkgs ? { outPath = ./..; revCount = 56789; shortRev = "gfedcba"; }
, stableBranch ? false
+, supportedSystems ? [ "x86_64-linux" "i686-linux" ]
}:
let
version = builtins.readFile ../.version;
versionSuffix =
- if officialRelease then ""
- else (if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
+ (if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
- systems = [ "x86_64-linux" "i686-linux" ];
+ forAllSystems = pkgs.lib.genAttrs supportedSystems;
- forAllSystems = pkgs.lib.genAttrs systems;
+ callTest = fn: args: forAllSystems (system: import fn ({ inherit system; } // args));
pkgs = import nixpkgs { system = "x86_64-linux"; };
@@ -207,14 +206,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 (if v.makeCoverageReport or false then v.report else v.test))])
- (import ./tests { inherit nixpkgs system; });
- in fold recursiveUpdate {} (map testsFor systems);
+ # Run the tests for each platform. You can run a test by doing
+ # e.g. ‘nix-build -A tests.login.x86_64-linux’, or equivalently,
+ # ‘nix-build tests/login.nix -A result’.
+ tests.avahi = callTest tests/avahi.nix {};
+ tests.bittorrent = callTest tests/bittorrent.nix {};
+ tests.containers = callTest tests/containers.nix {};
+ tests.firefox = callTest tests/firefox.nix {};
+ tests.firewall = callTest tests/firewall.nix {};
+ tests.gnome3 = callTest tests/gnome3.nix {};
+ tests.installer.efi = forAllSystems (system: (import tests/installer.nix { inherit system; }).efi.test);
+ tests.installer.grub1 = forAllSystems (system: (import tests/installer.nix { inherit system; }).grub1.test);
+ tests.installer.lvm = forAllSystems (system: (import tests/installer.nix { inherit system; }).lvm.test);
+ tests.installer.rebuildCD = forAllSystems (system: (import tests/installer.nix { inherit system; }).rebuildCD.test);
+ tests.installer.separateBoot = forAllSystems (system: (import tests/installer.nix { inherit system; }).separateBoot.test);
+ tests.installer.simple = forAllSystems (system: (import tests/installer.nix { inherit system; }).simple.test);
+ tests.influxdb = callTest tests/influxdb.nix {};
+ tests.ipv6 = callTest tests/ipv6.nix {};
+ tests.jenkins = callTest tests/jenkins.nix {};
+ tests.kde4 = callTest tests/kde4.nix {};
+ tests.latestKernel.login = callTest tests/login.nix { latestKernel = true; };
+ tests.login = callTest tests/login.nix {};
+ tests.logstash = callTest tests/logstash.nix {};
+ tests.misc = callTest tests/misc.nix {};
+ tests.mumble = callTest tests/mumble.nix {};
+ tests.munin = callTest tests/munin.nix {};
+ tests.mysql = callTest tests/mysql.nix {};
+ tests.mysqlReplication = callTest tests/mysql-replication.nix {};
+ tests.nat = callTest tests/nat.nix {};
+ tests.nfs3 = callTest tests/nfs.nix { version = 3; };
+ tests.openssh = callTest tests/openssh.nix {};
+ tests.printing = callTest tests/printing.nix {};
+ tests.proxy = callTest tests/proxy.nix {};
+ tests.quake3 = callTest tests/quake3.nix {};
+ tests.runInMachine = callTest tests/run-in-machine.nix {};
+ tests.simple = callTest tests/simple.nix {};
+ tests.tomcat = callTest tests/tomcat.nix {};
+ tests.udisks2 = callTest tests/udisks2.nix {};
+ tests.xfce = callTest tests/xfce.nix {};
+
}
diff --git a/nixos/tests/avahi.nix b/nixos/tests/avahi.nix
index d95361dcd83..b6f18087c56 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,18 +16,18 @@ with pkgs;
};
};
- # Test whether `avahi-daemon' and `libnss-mdns' work as expected.
testScript =
'' startAll;
# mDNS.
$one->waitForUnit("network.target");
+ $two->waitForUnit("network.target");
+
$one->succeed("avahi-resolve-host-name one.local | tee out >&2");
$one->succeed("test \"`cut -f1 < out`\" = one.local");
$one->succeed("avahi-resolve-host-name two.local | tee out >&2");
$one->succeed("test \"`cut -f1 < out`\" = two.local");
- $two->waitForUnit("network.target");
$two->succeed("avahi-resolve-host-name one.local | tee out >&2");
$two->succeed("test \"`cut -f1 < out`\" = one.local");
$two->succeed("avahi-resolve-host-name two.local | tee out >&2");
diff --git a/nixos/tests/bittorrent.nix b/nixos/tests/bittorrent.nix
index f84b65699d3..b58657a5ecd 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
@@ -42,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 =
@@ -79,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
@@ -108,4 +109,4 @@ in
$client2->succeed("cmp /tmp/test.tar.bz2 ${file}");
'';
-}
+})
diff --git a/nixos/tests/containers.nix b/nixos/tests/containers.nix
index 06b793ed7ac..8ad9cd6e0d7 100644
--- a/nixos/tests/containers.nix
+++ b/nixos/tests/containers.nix
@@ -1,8 +1,6 @@
# Test for NixOS' container support.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
machine =
{ config, pkgs, ... }:
@@ -27,7 +25,7 @@
testScript =
''
- $machine->succeed("nixos-container list") =~ /webserver/;
+ $machine->succeed("nixos-container list") =~ /webserver/ or die;
# Start the webserver container.
$machine->succeed("nixos-container start webserver");
@@ -67,7 +65,7 @@
$machine->succeed("nixos-container start $id1");
# Execute commands via the root shell.
- $machine->succeed("nixos-container run $id1 -- uname") =~ /Linux/;
+ $machine->succeed("nixos-container run $id1 -- uname") =~ /Linux/ or die;
$machine->succeed("nixos-container set-root-password $id1 foobar");
# Destroy the containers.
diff --git a/nixos/tests/default.nix b/nixos/tests/default.nix
deleted file mode 100644
index d2eb6a99962..00000000000
--- a/nixos/tests/default.nix
+++ /dev/null
@@ -1,46 +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);
- containers = makeTest (import ./containers.nix);
- firefox = makeTest (import ./firefox.nix);
- firewall = makeTest (import ./firewall.nix);
- installer = makeTests (import ./installer.nix);
- efi-installer = makeTests (import ./efi-installer.nix);
- gnome3 = makeTest (import ./gnome3.nix);
- ipv6 = makeTest (import ./ipv6.nix);
- jenkins = makeTest (import ./jenkins.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);
- mumble = makeTest (import ./mumble.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);
- rabbitmq = makeTest (import ./rabbitmq.nix);
- simple = makeTest (import ./simple.nix);
- #subversion = makeTest (import ./subversion.nix);
- tomcat = makeTest (import ./tomcat.nix);
- udisks = makeTest (import ./udisks.nix);
- #trac = makeTest (import ./trac.nix);
- xfce = makeTest (import ./xfce.nix);
- runInMachine.test = import ./run-in-machine.nix { inherit system; };
-}
diff --git a/nixos/tests/efi-installer.nix b/nixos/tests/efi-installer.nix
deleted file mode 100644
index 990f2b84a6c..00000000000
--- a/nixos/tests/efi-installer.nix
+++ /dev/null
@@ -1,126 +0,0 @@
-# !!! Merge into normal install tests once all livecds are EFIable
-{ pkgs, system, ... }:
-
-with pkgs.lib;
-with import ../lib/qemu-flags.nix;
-
-let
-
- # Build the ISO. This is the regular installation CD but with test
- # instrumentation.
- iso =
- (import ../lib/eval-config.nix {
- inherit system;
- modules =
- [ ../modules/installer/cd-dvd/installation-cd-minimal.nix
- ../modules/testing/test-instrumentation.nix
- { key = "serial";
-
- # The test cannot access the network, so any sources we
- # need must be included in the ISO.
- isoImage.storeContents =
- [ pkgs.glibcLocales
- pkgs.sudo
- pkgs.docbook5
- pkgs.docbook5_xsl
- pkgs.grub
- pkgs.perlPackages.XMLLibXML
- pkgs.unionfs-fuse
- pkgs.gummiboot
- pkgs.libxslt
- ];
- }
- ];
- }).config.system.build.isoImage;
-
-
- # The config to install
- config = builtins.toFile "configuration.nix" ''
- { pkgs, ... }: {
- imports = [ ./hardware-configuration.nix ];
- boot.loader.grub.enable = false;
- boot.loader.efi.canTouchEfiVariables = true;
- boot.loader.gummiboot.enable = true;
- fonts.enableFontConfig = false;
- }
- '';
-
- biosDir = pkgs.runCommand "ovmf-bios" {} ''
- mkdir $out
- ln -s ${pkgs.OVMF}/FV/OVMF.fd $out/bios.bin
- '';
-
-in {
- simple = {
- inherit iso;
- nodes = {};
- testScript = ''
- createDisk("harddisk", 4 * 1024);
-
- my $machine = createMachine({ hda => "harddisk",
- hdaInterface => "scsi",
- cdrom => glob("${iso}/iso/*.iso"),
- qemuFlags => '-L ${biosDir} ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"}'});
- $machine->start;
-
- # Make sure that we get a login prompt etc.
- $machine->succeed("echo hello");
- $machine->waitForUnit("rogue");
- $machine->waitForUnit("nixos-manual");
-
- # Partition the disk.
- $machine->succeed(
- "sgdisk -Z /dev/sda",
- "sgdisk -n 1:0:+256M -N 2 -t 1:ef00 -t 2:8300 -c 1:boot -c 2:root /dev/sda",
- "mkfs.vfat -n BOOT /dev/sda1",
- "mkfs.ext3 -L nixos /dev/sda2",
- "mount LABEL=nixos /mnt",
- "mkdir /mnt/boot",
- "mount LABEL=BOOT /mnt/boot",
- );
-
- # Create the NixOS configuration.
- $machine->succeed(
- "nixos-generate-config --root /mnt",
- );
-
- $machine->succeed("cat /mnt/etc/nixos/hardware-configuration.nix >&2");
-
- $machine->copyFileFromHost(
- "${config}",
- "/mnt/etc/nixos/configuration.nix");
-
- # Perform the installation.
- $machine->succeed("nixos-install >&2");
-
- # Do it again to make sure it's idempotent.
- $machine->succeed("nixos-install >&2");
-
- $machine->shutdown;
-
- # Now see if we can boot the installation.
- my $machine = createMachine({ #hda => "harddisk",
-# hdaInterface => "virtio",
-# !!! OVMF doesn't boot from virtio http://www.mail-archive.com/edk2-devel@lists.sourceforge.net/msg01501.html
- qemuFlags => '-L ${biosDir} ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} -m 512 -hda ' . Cwd::abs_path('harddisk')});
-
- # Did /boot get mounted, if appropriate?
- $machine->waitForUnit("local-fs.target");
- $machine->succeed("test -e /boot/efi");
-
- $machine->succeed("nix-env -i coreutils >&2");
- $machine->succeed("type -tP ls | tee /dev/stderr") =~ /.nix-profile/
- or die "nix-env failed";
-
- $machine->succeed("nixos-rebuild switch >&2");
-
- $machine->shutdown;
-
- my $machine = createMachine({ #hda => "harddisk",
-# hdaInterface => "virtio",
- qemuFlags => '-L ${biosDir} ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} -hda ' . Cwd::abs_path('harddisk')});
- $machine->waitForUnit("network.target");
- $machine->shutdown;
- '';
- };
-}
diff --git a/nixos/tests/firefox.nix b/nixos/tests/firefox.nix
index d6599be13c9..b42d473b802 100644
--- a/nixos/tests/firefox.nix
+++ b/nixos/tests/firefox.nix
@@ -1,6 +1,4 @@
-{ pkgs, ... }:
-
-{
+import ./make-test.nix ({ pkgs, ... }: {
machine =
{ config, pkgs, ... }:
@@ -18,4 +16,4 @@
$machine->screenshot("screen");
'';
-}
+})
diff --git a/nixos/tests/firewall.nix b/nixos/tests/firewall.nix
index 15653dedf3c..d10e10b1d91 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 =
diff --git a/nixos/tests/gnome3.nix b/nixos/tests/gnome3.nix
index 98a76137842..f1a6ce63331 100644
--- a/nixos/tests/gnome3.nix
+++ b/nixos/tests/gnome3.nix
@@ -1,6 +1,4 @@
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
machine =
{ config, pkgs, ... }:
diff --git a/nixos/tests/gnome3_12.nix b/nixos/tests/gnome3_12.nix
new file mode 100644
index 00000000000..92a1919b8cb
--- /dev/null
+++ b/nixos/tests/gnome3_12.nix
@@ -0,0 +1,30 @@
+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;
+ environment.gnome3.packageSet = pkgs.gnome3_12;
+ };
+
+ testScript =
+ ''
+ $machine->waitForX;
+ $machine->sleep(15);
+
+ # Check that logging in has given the user ownership of devices.
+ $machine->succeed("getfacl /dev/snd/timer | grep -q alice");
+
+ $machine->succeed("su - alice -c 'DISPLAY=:0.0 gnome-terminal &'");
+ $machine->waitForWindow(qr/Terminal/);
+ $machine->sleep(10);
+ $machine->screenshot("screen");
+ '';
+
+}
diff --git a/nixos/tests/influxdb.nix b/nixos/tests/influxdb.nix
new file mode 100644
index 00000000000..278b264170f
--- /dev/null
+++ b/nixos/tests/influxdb.nix
@@ -0,0 +1,34 @@
+# This test runs influxdb and checks if influxdb is up and running
+
+import ./make-test.nix {
+ nodes = {
+ one = { config, pkgs, ... }: {
+ services.influxdb.enable = true;
+ };
+ };
+
+ testScript = ''
+ startAll;
+
+ $one->waitForUnit("influxdb.service");
+
+ # Check if admin interface is avalible
+ $one->waitUntilSucceeds("curl -f 127.0.0.1:8083");
+
+ # create database
+ $one->succeed(q~
+ curl -X POST 'http://localhost:8086/db?u=root&p=root' \
+ -d '{"name": "test"}'
+ ~);
+
+ # write some points and run simple query
+ $one->succeed(q~
+ curl -X POST 'http://localhost:8086/db/test/series?u=root&p=root' \
+ -d '[{"name":"foo","columns":["val"],"points":[[6666]]}]'
+ ~);
+ $one->succeed(q~
+ curl -G 'http://localhost:8086/db/test/series?u=root&p=root' \
+ --data-urlencode 'q=select * from foo limit 1' | grep 6666
+ ~);
+ '';
+}
diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix
index b0c0aa328f0..98e8142a0df 100644
--- a/nixos/tests/installer.nix
+++ b/nixos/tests/installer.nix
@@ -1,7 +1,8 @@
-{ pkgs, system, ... }:
+{ system ? builtins.currentSystem }:
-with pkgs.lib;
+with import ../lib/testing.nix { inherit system; };
with import ../lib/qemu-flags.nix;
+with pkgs.lib;
let
@@ -26,6 +27,7 @@ let
pkgs.grub
pkgs.perlPackages.XMLLibXML
pkgs.unionfs-fuse
+ pkgs.gummiboot
];
}
];
@@ -33,7 +35,7 @@ let
# The configuration to install.
- config = { fileSystems, testChannel, grubVersion, grubDevice }: pkgs.writeText "configuration.nix"
+ makeConfig = { testChannel, useEFI, grubVersion, grubDevice }: pkgs.writeText "configuration.nix"
''
{ config, pkgs, modulesPath, ... }:
@@ -42,27 +44,22 @@ let
];
- boot.loader.grub.version = ${toString grubVersion};
- ${optionalString (grubVersion == 1) ''
- boot.loader.grub.splashImage = null;
+ ${if useEFI then ''
+ boot.loader.efi.canTouchEfiVariables = true;
+ boot.loader.gummiboot.enable = true;
+ '' else ''
+ boot.loader.grub.version = ${toString grubVersion};
+ ${optionalString (grubVersion == 1) ''
+ boot.loader.grub.splashImage = null;
+ ''}
+ boot.loader.grub.device = "${grubDevice}";
+ boot.loader.grub.extraConfig = "serial; terminal_output.serial";
''}
- boot.loader.grub.device = "${grubDevice}";
- boot.loader.grub.extraConfig = "serial; terminal_output.serial";
environment.systemPackages = [ ${optionalString testChannel "pkgs.rlwrap"} ];
}
'';
- rootFS =
- ''
- fileSystems."/".device = "/dev/disk/by-label/nixos";
- '';
-
- bootFS =
- ''
- fileSystems."/boot".device = "/dev/disk/by-label/boot";
- '';
-
# Configuration of a web server that simulates the Nixpkgs channel
# distribution server.
@@ -86,20 +83,33 @@ let
channelContents = [ pkgs.rlwrap ];
+ efiBios = pkgs.runCommand "ovmf-bios" {} ''
+ mkdir $out
+ ln -s ${pkgs.OVMF}/FV/OVMF.fd $out/bios.bin
+ '';
+
+
# The test script boots the CD, installs NixOS on an empty hard
# disk, and then reboot from the hard disk. It's parameterized with
# a test script fragment `createPartitions', which must create
- # partitions and filesystems, and a configuration.nix fragment
- # `fileSystems'.
- testScriptFun = { createPartitions, fileSystems, testChannel, grubVersion, grubDevice }:
- let iface = if grubVersion == 1 then "scsi" else "virtio"; in
+ # partitions and filesystems.
+ testScriptFun = { createPartitions, testChannel, useEFI, grubVersion, grubDevice }:
+ let
+ # FIXME: OVMF doesn't boot from virtio http://www.mail-archive.com/edk2-devel@lists.sourceforge.net/msg01501.html
+ iface = if useEFI || grubVersion == 1 then "scsi" else "virtio";
+ qemuFlags =
+ (if iso.system == "x86_64-linux" then "-m 512 " else "-m 384 ") +
+ (optionalString (iso.system == "x86_64-linux") "-cpu kvm64 ") +
+ (optionalString useEFI ''-L ${efiBios} -hda ''${\(Cwd::abs_path('harddisk'))} '');
+ hdFlags = optionalString (!useEFI)
+ ''hda => "harddisk", hdaInterface => "${iface}", '';
+ in
''
createDisk("harddisk", 4 * 1024);
- my $machine = createMachine({ hda => "harddisk",
- hdaInterface => "${iface}",
+ my $machine = createMachine({ ${hdFlags}
cdrom => glob("${iso}/iso/*.iso"),
- qemuFlags => '${optionalString testChannel (toString (qemuNICFlags 1 1 2))} ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"}'});
+ qemuFlags => "${qemuFlags} " . '${optionalString testChannel (toString (qemuNICFlags 1 1 2))}' });
$machine->start;
${optionalString testChannel ''
@@ -119,9 +129,10 @@ let
#$machine->waitForUnit('getty@tty2');
$machine->waitForUnit("rogue");
$machine->waitForUnit("nixos-manual");
- $machine->waitForUnit("dhcpcd");
${optionalString testChannel ''
+ $machine->waitForUnit("dhcpcd");
+
# Allow the machine to talk to the fake nixos.org.
$machine->succeed(
"rm /etc/hosts",
@@ -136,6 +147,9 @@ let
or die "bad `hello' output";
''}
+ # Wait for hard disks to appear in /dev
+ $machine->succeed("udevadm settle");
+
# Partition the disk.
${createPartitions}
@@ -147,32 +161,43 @@ let
$machine->succeed("cat /mnt/etc/nixos/hardware-configuration.nix >&2");
$machine->copyFileFromHost(
- "${ config { inherit fileSystems testChannel grubVersion grubDevice; } }",
+ "${ makeConfig { inherit testChannel useEFI grubVersion grubDevice; } }",
"/mnt/etc/nixos/configuration.nix");
# Perform the installation.
- $machine->succeed("nixos-install >&2");
+ $machine->succeed("nixos-install < /dev/null >&2");
# Do it again to make sure it's idempotent.
- $machine->succeed("nixos-install >&2");
+ $machine->succeed("nixos-install < /dev/null >&2");
+
+ $machine->succeed("umount /mnt/boot || true");
+ $machine->succeed("umount /mnt");
+ $machine->succeed("sync");
$machine->shutdown;
# Now see if we can boot the installation.
- my $machine = createMachine({ hda => "harddisk", hdaInterface => "${iface}" });
+ $machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
- # Did /boot get mounted, if appropriate?
+ # Did /boot get mounted?
$machine->waitForUnit("local-fs.target");
- $machine->succeed("test -e /boot/grub");
+
+ ${if useEFI then ''
+ $machine->succeed("test -e /boot/efi");
+ '' else ''
+ $machine->succeed("test -e /boot/grub");
+ ''}
# Did the swap device get activated?
$machine->waitForUnit("swap.target");
$machine->succeed("cat /proc/swaps | grep -q /dev");
+ # Check whether the channel works.
$machine->succeed("nix-env -i coreutils >&2");
$machine->succeed("type -tP ls | tee /dev/stderr") =~ /.nix-profile/
or die "nix-env failed";
+ # Check whether nixos-rebuild works.
$machine->succeed("nixos-rebuild switch >&2");
# Test nixos-option.
@@ -184,17 +209,19 @@ let
# And just to be sure, check that the machine still boots after
# "nixos-rebuild switch".
- my $machine = createMachine({ hda => "harddisk", hdaInterface => "${iface}" });
+ $machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
$machine->waitForUnit("network.target");
$machine->shutdown;
'';
- makeTest = { createPartitions, fileSystems, testChannel ? false, grubVersion ? 2, grubDevice ? "/dev/vda" }:
- { inherit iso;
+ makeInstallerTest =
+ { createPartitions, testChannel ? false, useEFI ? false, grubVersion ? 2, grubDevice ? "/dev/vda" }:
+ makeTest {
+ inherit iso;
nodes = if testChannel then { inherit webserver; } else { };
testScript = testScriptFun {
- inherit createPartitions fileSystems testChannel grubVersion grubDevice;
+ inherit createPartitions testChannel useEFI grubVersion grubDevice;
};
};
@@ -206,7 +233,7 @@ in {
# The (almost) simplest partitioning scheme: a swap partition and
# one big filesystem partition.
- simple = makeTest
+ simple = makeInstallerTest
{ createPartitions =
''
$machine->succeed(
@@ -220,12 +247,11 @@ in {
"mount LABEL=nixos /mnt",
);
'';
- fileSystems = rootFS;
testChannel = true;
};
# Same as the previous, but now with a separate /boot partition.
- separateBoot = makeTest
+ separateBoot = makeInstallerTest
{ createPartitions =
''
$machine->succeed(
@@ -243,12 +269,11 @@ in {
"mount LABEL=boot /mnt/boot",
);
'';
- fileSystems = rootFS + bootFS;
};
# Create two physical LVM partitions combined into one volume group
# that contains the logical swap and root partitions.
- lvm = makeTest
+ lvm = makeInstallerTest
{ createPartitions =
''
$machine->succeed(
@@ -268,11 +293,9 @@ in {
"mount LABEL=nixos /mnt",
);
'';
- fileSystems = rootFS;
};
- /*
- swraid = makeTest
+ swraid = makeInstallerTest
{ createPartitions =
''
$machine->succeed(
@@ -302,12 +325,10 @@ in {
"mdadm -W /dev/md1",
);
'';
- fileSystems = rootFS + bootFS;
};
- */
# Test a basic install using GRUB 1.
- grub1 = makeTest
+ grub1 = makeInstallerTest
{ createPartitions =
''
$machine->succeed(
@@ -322,13 +343,31 @@ in {
);
'';
- fileSystems = rootFS;
grubVersion = 1;
grubDevice = "/dev/sda";
};
+ # Test an EFI install.
+ efi = makeInstallerTest
+ { createPartitions =
+ ''
+ $machine->succeed(
+ "sgdisk -Z /dev/sda",
+ "sgdisk -n 1:0:+256M -n 2:0:+1024M -N 3 -t 1:ef00 -t 2:8200 -t 3:8300 -c 1:boot -c 2:swap -c 3:root /dev/sda",
+ "mkfs.vfat -n BOOT /dev/sda1",
+ "mkswap /dev/sda2 -L swap",
+ "swapon -L swap",
+ "mkfs.ext3 -L nixos /dev/sda3",
+ "mount LABEL=nixos /mnt",
+ "mkdir /mnt/boot",
+ "mount LABEL=BOOT /mnt/boot",
+ );
+ '';
+ useEFI = true;
+ };
+
# Rebuild the CD configuration with a little modification.
- rebuildCD =
+ rebuildCD = makeTest
{ inherit iso;
nodes = { };
testScript =
diff --git a/nixos/tests/ipv6.nix b/nixos/tests/ipv6.nix
index 48c20d7f5c9..eb15363d3c3 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, ... }: { };
diff --git a/nixos/tests/jenkins.nix b/nixos/tests/jenkins.nix
index 40223482791..ad7ea78ac49 100644
--- a/nixos/tests/jenkins.nix
+++ b/nixos/tests/jenkins.nix
@@ -2,9 +2,9 @@
# 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
-{ pkgs, ... }:
-{
+import ./make-test.nix {
+
nodes = {
master =
@@ -36,6 +36,6 @@
print $slave->execute("sudo -u jenkins groups");
$slave->mustSucceed("sudo -u jenkins groups | grep jenkins | grep users");
- $slave->mustFail("systemctl status jenkins.service");
+ $slave->mustFail("systemctl is-enabled jenkins.service");
'';
}
diff --git a/nixos/tests/kde4.nix b/nixos/tests/kde4.nix
index 3fb35bbab09..99a82a6b95d 100644
--- a/nixos/tests/kde4.nix
+++ b/nixos/tests/kde4.nix
@@ -1,13 +1,11 @@
-{ pkgs, ... }:
-
-{
+import ./make-test.nix ({ pkgs, ... }: {
machine =
{ config, pkgs, ... }:
{ imports = [ ./common/user-account.nix ];
- virtualisation.memorySize = 768;
+ virtualisation.memorySize = 1024;
services.xserver.enable = true;
@@ -64,4 +62,4 @@
$machine->screenshot("screen");
'';
-}
+})
diff --git a/nixos/tests/kexec.nix b/nixos/tests/kexec.nix
index b8da332b919..b09287682c0 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 ed7d9786717..44c53c231c8 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 ee309d39f87..e6aba7a1012 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 00000000000..285ca5b71d6
--- /dev/null
+++ b/nixos/tests/make-test.nix
@@ -0,0 +1,5 @@
+f: { system ? builtins.currentSystem, ... } @ args:
+
+with import ../lib/testing.nix { inherit system; };
+
+makeTest (if builtins.isFunction f then f (args // { inherit pkgs; }) else f)
diff --git a/nixos/tests/misc.nix b/nixos/tests/misc.nix
index d355d705a24..e33581b4d2d 100644
--- a/nixos/tests/misc.nix
+++ b/nixos/tests/misc.nix
@@ -1,15 +1,25 @@
# Miscellaneous small tests that don't warrant their own VM run.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
machine =
- { config, pkgs, ... }:
- { swapDevices = pkgs.lib.mkOverride 0
+ { config, lib, pkgs, ... }:
+ with lib;
+ { swapDevices = mkOverride 0
[ { device = "/root/swapfile"; size = 128; } ];
- environment.variables.EDITOR = pkgs.lib.mkOverride 0 "emacs";
- services.nixosManual.enable = pkgs.lib.mkOverride 0 true;
+ environment.variables.EDITOR = mkOverride 0 "emacs";
+ services.nixosManual.enable = mkOverride 0 true;
+ systemd.tmpfiles.rules = [ "d /tmp 1777 root root 10d" ];
+ fileSystems = mkVMOverride { "/tmp2" =
+ { device = "none";
+ fsType = "tmpfs";
+ options = "mode=1777,noauto";
+ };
+ };
+ systemd.automounts = singleton
+ { wantedBy = [ "multi-user.target" ];
+ where = "/tmp2";
+ };
};
testScript =
@@ -63,7 +73,30 @@
# Test whether hostname (and by extension nss_myhostname) works.
subtest "hostname", sub {
$machine->succeed('[ "`hostname`" = machine ]');
- $machine->succeed('[ "`hostname -s`" = machine ]');
+ #$machine->succeed('[ "`hostname -s`" = machine ]');
+ };
+
+ # Test whether systemd-udevd automatically loads modules for our hardware.
+ subtest "udev-auto-load", sub {
+ $machine->waitForUnit('systemd-udev-settle.service');
+ $machine->succeed('lsmod | grep psmouse');
+ };
+
+ # Test whether systemd-tmpfiles-clean works.
+ subtest "tmpfiles", sub {
+ $machine->succeed('touch /tmp/foo');
+ $machine->succeed('systemctl start systemd-tmpfiles-clean');
+ $machine->succeed('[ -e /tmp/foo ]');
+ $machine->succeed('date -s "@$(($(date +%s) + 1000000))"'); # move into the future
+ $machine->succeed('systemctl start systemd-tmpfiles-clean');
+ $machine->fail('[ -e /tmp/foo ]');
+ };
+
+ # Test whether automounting works.
+ subtest "automount", sub {
+ $machine->fail("grep '/tmp2 tmpfs' /proc/mounts");
+ $machine->succeed("touch /tmp2/x");
+ $machine->succeed("grep '/tmp2 tmpfs' /proc/mounts");
};
'';
diff --git a/nixos/tests/mpich.nix b/nixos/tests/mpich.nix
index d57512ebdfe..13cd0960d07 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
index 10658eb5f02..68ab8b642b0 100644
--- a/nixos/tests/mumble.nix
+++ b/nixos/tests/mumble.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+import ./make-test.nix (
let
client = { config, pkgs, ... }: {
@@ -28,7 +28,9 @@ in
$client1->execute("mumble mumble://client1\@server/test &");
$client2->execute("mumble mumble://client2\@server/test &");
- $server->sleep(10); # Wait for Mumble UI to pop up
+ $client1->waitForWindow(qr/Mumble/);
+ $client2->waitForWindow(qr/Mumble/);
+ $server->sleep(3); # Wait some more for the Mumble UI
# cancel client audio configuration
$client1->sendKeys("esc");
@@ -52,4 +54,4 @@ in
$client1->screenshot("screen1");
$client2->screenshot("screen2");
'';
-}
+})
diff --git a/nixos/tests/munin.nix b/nixos/tests/munin.nix
index 66ae1c0d87f..acc4b949ab5 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 44586322600..7d0cf6d85a1 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 =
@@ -58,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 bceeb8beabc..566d03baf36 100644
--- a/nixos/tests/mysql.nix
+++ b/nixos/tests/mysql.nix
@@ -1,6 +1,5 @@
-{ pkgs, ... }:
+import ./make-test.nix {
-{
nodes = {
master =
{ pkgs, config, ... }:
diff --git a/nixos/tests/nat.nix b/nixos/tests/nat.nix
index 259ab99d301..02981469e10 100644
--- a/nixos/tests/nat.nix
+++ b/nixos/tests/nat.nix
@@ -4,9 +4,7 @@
# router connected to both that performs Network Address Translation
# for the client.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
nodes =
{ client =
diff --git a/nixos/tests/nfs.nix b/nixos/tests/nfs.nix
index 7bc99aef3b5..864d05626b6 100644
--- a/nixos/tests/nfs.nix
+++ b/nixos/tests/nfs.nix
@@ -1,6 +1,4 @@
-{ version }:
-
-{ pkgs, ... }:
+import ./make-test.nix ({ version, ... }:
let
@@ -84,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 49d92fbde90..0b9714c275d 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 7126e7255ef..120ecaad881 100644
--- a/nixos/tests/partition.nix
+++ b/nixos/tests/partition.nix
@@ -1,4 +1,4 @@
-{ pkgs, system, ... }:
+import ./make-test.nix ({ pkgs, ... }:
with pkgs.lib;
@@ -24,6 +24,14 @@ let
btrfs / --data=0 --metadata=1 --label=root btrfs.1 btrfs.2
'';
+ ksF2fs = pkgs.writeText "ks-f2fs" ''
+ clearpart --all --initlabel --drives=vdb
+
+ part swap --recommended --label=swap --fstype=swap --ondisk=vdb
+ part /boot --recommended --label=boot --fstype=f2fs --ondisk=vdb
+ part / --recommended --label=root --fstype=f2fs --ondisk=vdb
+ '';
+
ksRaid = pkgs.writeText "ks-raid" ''
clearpart --all --initlabel --drives=vdb,vdc
@@ -193,6 +201,16 @@ in {
remountAndCheck;
};
+ parttest "f2fs filesystem", sub {
+ $machine->succeed("modprobe f2fs");
+ kickstart("${ksF2fs}");
+ ensurePartition("swap", "swap");
+ ensurePartition("boot", "f2fs");
+ ensurePartition("root", "f2fs");
+ remoteAndCheck;
+ ensureMountPoint("/mnt/boot", "f2fs");
+ };
+
parttest "RAID1 with XFS", sub {
kickstart("${ksRaid}");
ensurePartition("swap1", "swap");
@@ -224,4 +242,4 @@ in {
ensureMountPoint("/mnt/boot");
};
'';
-}
+})
diff --git a/nixos/tests/phabricator.nix b/nixos/tests/phabricator.nix
new file mode 100644
index 00000000000..8a8c6cb784c
--- /dev/null
+++ b/nixos/tests/phabricator.nix
@@ -0,0 +1,66 @@
+import ./make-test.nix ({ pkgs, ... }: {
+
+ nodes = {
+ storage =
+ { config, pkgs, ... }:
+ { services.nfs.server.enable = true;
+ services.nfs.server.exports = ''
+ /repos 192.168.1.0/255.255.255.0(rw,no_root_squash)
+ '';
+ services.nfs.server.createMountPoints = true;
+ };
+
+ webserver =
+ { config, pkgs, ... }:
+ { fileSystems = pkgs.lib.mkVMOverride
+ [ { mountPoint = "/repos";
+ device = "storage:/repos";
+ fsType = "nfs";
+ }
+ ];
+ networking.firewall.enable = false;
+ networking.useDHCP = false;
+
+ services = {
+ httpd = {
+ enable = true;
+ adminAddr = "root@localhost";
+ virtualHosts = [{
+ hostName = "phabricator.local";
+ extraSubservices = [{serviceType = "phabricator";}];
+ }];
+ };
+
+ mysql = {
+ enable = true;
+ package = pkgs.mysql;
+ };
+ };
+
+ environment.systemPackages = [ pkgs.php ];
+ };
+
+ client =
+ { config, pkgs, ... }:
+ { imports = [ ./common/x11.nix ];
+ services.xserver.desktopManager.kde4.enable = true;
+ };
+ };
+
+ testScript =
+ ''
+ startAll;
+
+ $client->waitForX;
+
+ $webserver->waitForUnit("mysql");
+ $webserver->waitForUnit("httpd");
+ $webserver->execute("cd /nix/store; less >/repos/log1");
+
+ $client->sleep(30); # loading takes a long time
+ $client->execute("konqueror http://webserver/ &");
+ $client->sleep(90); # loading takes a long time
+
+ $client->screenshot("screen");
+ '';
+})
diff --git a/nixos/tests/printing.nix b/nixos/tests/printing.nix
index b5ca0f25e21..16f9812d93b 100644
--- a/nixos/tests/printing.nix
+++ b/nixos/tests/printing.nix
@@ -1,17 +1,15 @@
# Test printing via CUPS.
-{ pkgs, ... }:
-
-{
+import ./make-test.nix ({pkgs, ... }: {
nodes = {
server =
{ config, pkgs, ... }:
{ services.printing.enable = true;
+ services.printing.listenAddresses = [ "*:631" ];
services.printing.cupsdConf =
''
- Listen server:631
Order allow,deny
Allow from all
@@ -88,4 +86,4 @@
}
'';
-}
+})
diff --git a/nixos/tests/proxy.nix b/nixos/tests/proxy.nix
index dd64ca02e16..88dbdb2720f 100644
--- a/nixos/tests/proxy.nix
+++ b/nixos/tests/proxy.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+import ./make-test.nix (
let
@@ -90,4 +90,4 @@ in
$client->succeed("curl --fail http://proxy/");
'';
-}
+})
diff --git a/nixos/tests/quake3.nix b/nixos/tests/quake3.nix
index 2ebac84ca06..3ff12fd57c0 100644
--- a/nixos/tests/quake3.nix
+++ b/nixos/tests/quake3.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+import ./make-test.nix (
let
@@ -79,4 +79,4 @@ rec {
$server->stopJob("quake3-server");
'';
-}
+})
diff --git a/nixos/tests/rabbitmq.nix b/nixos/tests/rabbitmq.nix
index 271661f0682..ffcdde9d87f 100644
--- a/nixos/tests/rabbitmq.nix
+++ b/nixos/tests/rabbitmq.nix
@@ -1,8 +1,7 @@
-{ pkgs, ... }:
+# This test runs rabbitmq and checks if rabbitmq is up and running.
-# 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;
@@ -11,8 +10,8 @@
testScript = ''
startAll;
-
+
$one->waitForUnit("rabbitmq.service");
$one->waitUntilSucceeds("su -s ${pkgs.stdenv.shell} rabbitmq -c \"rabbitmqctl status\"");
'';
-}
+})
diff --git a/nixos/tests/run-in-machine.nix b/nixos/tests/run-in-machine.nix
index 8efe26c1708..7f6e6a6dc57 100644
--- a/nixos/tests/run-in-machine.nix
+++ b/nixos/tests/run-in-machine.nix
@@ -2,7 +2,9 @@
with import ../lib/testing.nix { inherit system; };
-runInMachine {
- drv = pkgs.patchelf;
- machine = { config, pkgs, ... }: { services.sshd.enable = true; };
+{
+ test = runInMachine {
+ drv = pkgs.hello;
+ machine = { config, pkgs, ... }: { /* services.sshd.enable = true; */ };
+ };
}
diff --git a/nixos/tests/simple.nix b/nixos/tests/simple.nix
index eee13a10133..e21b919cdf8 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 49450c78f3b..e6746dc0828 100644
--- a/nixos/tests/subversion.nix
+++ b/nixos/tests/subversion.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+import ./make-test.nix (
let
@@ -114,4 +114,4 @@ in
$webserver->stopJob("httpd");
'';
-}
+})
diff --git a/nixos/tests/tomcat.nix b/nixos/tests/tomcat.nix
index 6ec21a72192..3b0b1bb7911 100644
--- a/nixos/tests/tomcat.nix
+++ b/nixos/tests/tomcat.nix
@@ -1,6 +1,5 @@
-{ pkgs, ... }:
+import ./make-test.nix {
-{
nodes = {
server =
{ pkgs, config, ... }:
@@ -25,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 e0d256f5701..3f17dafaca1 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
deleted file mode 100644
index e3e3f740d07..00000000000
--- a/nixos/tests/udisks.nix
+++ /dev/null
@@ -1,56 +0,0 @@
-{ 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/;
- $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 ]");
- '';
-
-}
\ No newline at end of file
diff --git a/nixos/tests/udisks2.nix b/nixos/tests/udisks2.nix
new file mode 100644
index 00000000000..e0c57d7c34d
--- /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 50ce54c918b..ded37943e51 100644
--- a/nixos/tests/xfce.nix
+++ b/nixos/tests/xfce.nix
@@ -1,6 +1,4 @@
-{ pkgs, ... }:
-
-{
+import ./make-test.nix {
machine =
{ config, pkgs, ... }:
diff --git a/pkgs/applications/audio/ardour/default.nix b/pkgs/applications/audio/ardour/default.nix
index 4315a5a7547..88bc7399c65 100644
--- a/pkgs/applications/audio/ardour/default.nix
+++ b/pkgs/applications/audio/ardour/default.nix
@@ -6,7 +6,7 @@
, perl, pkgconfig, python, serd, sord, sratom, suil }:
let
- tag = "3.5.357";
+ tag = "3.5.380";
in
stdenv.mkDerivation rec {
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
src = fetchgit {
url = git://git.ardour.org/ardour/ardour.git;
rev = "refs/tags/${tag}";
- sha256 = "1e026fb9a6ad4179d52c4b578cc3861bdfd3629b9e7b7a7341d431c7d3692c42";
+ sha256 = "dbcbb2d9143e196d079c27b15266e47d24b81cb7591fe64b717f3485965ded7b";
};
buildInputs =
@@ -28,9 +28,9 @@ stdenv.mkDerivation rec {
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
+ printf '#include "libs/ardour/ardour/revision.h"\nnamespace ARDOUR { const char* revision = \"${tag}-g2f6065b\"; }\n' > libs/ardour/revision.cc
# Note the different version number
- sed -i '33i rev = \"3.5-357-gce4d125\"' wscript
+ sed -i '33i rev = \"3.5-380-g2f6065b\"' wscript
sed 's|/usr/include/libintl.h|${glibc}/include/libintl.h|' -i wscript
sed -e 's|^#!/usr/bin/perl.*$|#!${perl}/bin/perl|g' -i tools/fmt-bindings
sed -e 's|^#!/usr/bin/env.*$|#!${perl}/bin/perl|g' -i tools/*.pl
diff --git a/pkgs/applications/audio/audacious/default.nix b/pkgs/applications/audio/audacious/default.nix
index d838d29e8be..409a831727b 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/cantata/default.nix b/pkgs/applications/audio/cantata/default.nix
new file mode 100644
index 00000000000..31d5240529f
--- /dev/null
+++ b/pkgs/applications/audio/cantata/default.nix
@@ -0,0 +1,104 @@
+{ stdenv, fetchurl, cmake
+, withQt4 ? true, qt4
+, withQt5 ? false, qt5
+
+# I'm unable to make KDE work here, crashes at runtime so I simply
+# make Qt4 the default until someone who wants KDE can figure it out.
+, withKDE4 ? false, kde4
+
+# Cantata doesn't build with cdparanoia enabled so we disable that
+# default for now until I (or someone else) figure it out.
+, withCdda ? false, cdparanoia
+, withCddb ? false, libcddb
+, withLame ? false, lame
+, withMusicbrainz ? false, libmusicbrainz5
+
+, withTaglib ? true, taglib, taglib_extras
+, withReplaygain ? true, ffmpeg, speex, mpg123
+, withMtp ? true, libmtp
+, withOnlineServices ? true
+, withDevices ? true, udisks2
+, withDynamic ? true
+, withHttpServer ? true
+, withStreams ? true
+}:
+
+# One and only one front-end.
+assert withQt5 -> withQt4 == false && withKDE4 == false;
+assert withQt4 -> withQt5 == false && withKDE4 == false;
+assert withKDE4 -> withQt4 == false && withQt5 == false;
+assert withQt4 || withQt5 || withKDE4;
+
+# Inter-dependencies.
+assert withCddb -> withCdda && withTaglib;
+assert withCdda -> withCddb && withMusicbrainz;
+assert withLame -> withCdda && withTaglib;
+assert withMtp -> withTaglib;
+assert withMusicbrainz -> withCdda && withTaglib;
+assert withOnlineServices -> withTaglib;
+assert withReplaygain -> withTaglib;
+
+let
+ version = "1.3.4";
+ pname = "cantata";
+ fstat = x: fn: "-DENABLE_" + fn + "=" + (if x then "ON" else "OFF");
+ fstats = x: map (fstat x);
+in
+
+stdenv.mkDerivation rec {
+ name = "${pname}-${version}";
+
+ src = fetchurl {
+ inherit name;
+ url = "https://drive.google.com/uc?export=download&id=0Bzghs6gQWi60WTYtaXk3c1IzNVU";
+ sha256 = "0ris41v44nwd68f3zis9n9lyyc089dyhlxp37rrzflanrc6glpwq";
+ };
+
+ buildInputs =
+ [ cmake ]
+ ++ stdenv.lib.optional withQt4 qt4
+ ++ stdenv.lib.optional withQt5 qt5
+ ++ stdenv.lib.optional withKDE4 kde4.kdelibs
+ ++ stdenv.lib.optionals withTaglib [ taglib taglib_extras ]
+ ++ stdenv.lib.optionals withReplaygain [ ffmpeg speex mpg123 ]
+ ++ stdenv.lib.optional withCdda cdparanoia
+ ++ stdenv.lib.optional withCddb libcddb
+ ++ stdenv.lib.optional withLame lame
+ ++ stdenv.lib.optional withMtp libmtp
+ ++ stdenv.lib.optional withMusicbrainz libmusicbrainz5
+ ++ stdenv.lib.optional (withTaglib && !withKDE4 && withDevices) udisks2;
+
+ unpackPhase = "tar -xvf $src";
+ sourceRoot = "cantata-1.3.4";
+
+ # Qt4 is implicit when KDE is switched off.
+ cmakeFlags = stdenv.lib.flatten [
+ (fstats withKDE4 [ "KDE" "KWALLET" ])
+ (fstat withQt5 "QT5")
+ (fstats withTaglib [ "TAGLIB" "TAGLIB_EXTRAS" ])
+ (fstats withReplaygain [ "FFMPEG" "MPG123" "SPEEXDSP" ])
+ (fstat withCdda "CDPARANOIA")
+ (fstat withCddb "CDDB")
+ (fstat withLame "LAME")
+ (fstat withMtp "MTP")
+ (fstat withMusicbrainz "MUSICBRAINZ")
+ (fstat withOnlineServices "ONLINE_SERVICES")
+ (fstat withDynamic "DYNAMIC")
+ (fstat withDevices "DEVICES_SUPPORT")
+ (fstat withHttpServer "HTTP_SERVER")
+ (fstat withStreams "STREAMS")
+ "-DENABLE_HTTPS_SUPPORT=ON"
+ "-DENABLE_UDISKS2=ON"
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "http://code.google.com/p/cantata/";
+ description = "A graphical client for MPD.";
+ license = licenses.gpl3;
+
+ # Technically Cantata can run on Windows so if someone wants to
+ # bother figuring that one out, be my guest.
+ platforms = platforms.linux;
+ maintainers = [ maintainers.fuuzetsu ];
+ };
+}
diff --git a/pkgs/applications/audio/clementine/default.nix b/pkgs/applications/audio/clementine/default.nix
index 4352e2e133a..82f24b05f72 100644
--- a/pkgs/applications/audio/clementine/default.nix
+++ b/pkgs/applications/audio/clementine/default.nix
@@ -1,8 +1,10 @@
{ stdenv, fetchurl, boost, cmake, gettext, gstreamer, gst_plugins_base
, liblastfm, qt4, taglib, fftw, glew, qjson, sqlite, libgpod, libplist
, usbmuxd, libmtp, gvfs, libcdio, protobuf, libspotify, qca2, pkgconfig
-, sparsehash }:
+, sparsehash, config }:
+let withSpotify = config.clementine.spotify or false;
+in
stdenv.mkDerivation {
name = "clementine-1.2.1";
@@ -27,7 +29,6 @@ stdenv.mkDerivation {
liblastfm
libmtp
libplist
- libspotify
pkgconfig
protobuf
qca2
@@ -37,7 +38,7 @@ stdenv.mkDerivation {
sqlite
taglib
usbmuxd
- ];
+ ] ++ stdenv.lib.optional withSpotify libspotify;
meta = with stdenv.lib; {
homepage = "http://www.clementine-player.org";
@@ -45,5 +46,7 @@ stdenv.mkDerivation {
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = [ maintainers.ttuegel ];
+ # libspotify is unfree
+ hydraPlatforms = optional (!withSpotify) platforms.linux;
};
}
diff --git a/pkgs/applications/audio/drumkv1/default.nix b/pkgs/applications/audio/drumkv1/default.nix
index 39f6ae0ded4..ab8027e2371 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.4.1";
+ version = "0.4.2";
src = fetchurl {
url = "mirror://sourceforge/drumkv1/${name}.tar.gz";
- sha256 = "0wxbn5qm3dn9spwbm618flgrwvls7bipg0nhgn0lv4za2g823g56";
+ sha256 = "18rvfgblynlmklk25azmppibn1bdjid97hipa323gnzmxgq0rfjq";
};
buildInputs = [ jackaudio libsndfile lv2 qt4 ];
diff --git a/pkgs/applications/audio/fldigi/default.nix b/pkgs/applications/audio/fldigi/default.nix
new file mode 100644
index 00000000000..e78095a9c5d
--- /dev/null
+++ b/pkgs/applications/audio/fldigi/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, hamlib, fltk13, libjpeg, libpng, portaudio, libsndfile,
+ libsamplerate, pulseaudio, libXinerama, gettext, pkgconfig, alsaLib }:
+
+stdenv.mkDerivation rec {
+ version = "3.21.82";
+ pname = "fldigi";
+ name = "${pname}-${version}";
+
+ src = fetchurl {
+ url = "http://www.w1hkj.com/downloads/${pname}/${name}.tar.gz";
+ sha256 = "1q2fc1zm9kfsjir4g6fh95vmjdq984iyxfcs6q4gjqy1znhqcyqs";
+ };
+
+ buildInputs = [ libXinerama gettext hamlib fltk13 libjpeg libpng portaudio
+ libsndfile libsamplerate pulseaudio pkgconfig alsaLib ];
+
+ meta = {
+ description = "Digital modem program";
+ homepage = http://www.w1hkj.com/Fldigi.html;
+ license = stdenv.lib.licenses.gpl3Plus;
+ maintainers = with stdenv.lib.maintainers; [ relrod ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/ladspa-plugins/ladspah.nix b/pkgs/applications/audio/ladspa-plugins/ladspah.nix
index 30ba34af16c..8c4d8a8c1ed 100644
--- a/pkgs/applications/audio/ladspa-plugins/ladspah.nix
+++ b/pkgs/applications/audio/ladspa-plugins/ladspah.nix
@@ -1,28 +1,17 @@
-{ stdenv, fetchurl, builderDefs }:
+{ runCommand, fetchurl }:
+
+let
-let
src = fetchurl {
url = http://www.ladspa.org/ladspa_sdk/ladspa.h.txt;
sha256 = "1b908csn85ng9sz5s5d1mqk711cmawain2z8px2ajngihdrynb67";
};
+
in
- let localDefs = builderDefs.passthru.function {
- buildInputs = [];
- inherit src;
- };
- in with localDefs;
-let
- copyFile = fullDepEntry ("
- mkdir -p \$out/include
- cp ${src} \$out/include/ladspa.h
- ") [minInit defEnsureDir];
-in
-stdenv.mkDerivation {
- name = "ladspa.h";
- builder = writeScript "ladspa.h-builder"
- (textClosure localDefs [copyFile]);
- meta = {
- description = "LADSPA format audio plugins";
- inherit src;
- };
-}
+
+runCommand "ladspa.h"
+ { meta.description = "LADSPA format audio plugins"; }
+ ''
+ mkdir -p $out/include
+ cp ${src} $out/include/ladspa.h
+ ''
diff --git a/pkgs/applications/audio/minimodem/default.nix b/pkgs/applications/audio/minimodem/default.nix
new file mode 100644
index 00000000000..6f2bf8cdb1c
--- /dev/null
+++ b/pkgs/applications/audio/minimodem/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, pkgconfig, fftw, fftwSinglePrec, alsaLib, libsndfile, pulseaudio }:
+
+stdenv.mkDerivation rec {
+ version = "0.19";
+ pname = "minimodem";
+ name = "${pname}-${version}";
+
+ src = fetchurl {
+ url = "http://www.whence.com/${pname}/${name}.tar.gz";
+ sha256 = "003xyqjq59wcjafrdv1b8w34xsn4nvzz51wwd7mqddajh0g4dz4g";
+ };
+
+ buildInputs = [ pkgconfig fftw fftwSinglePrec alsaLib libsndfile pulseaudio ];
+
+ meta = {
+ description = "General-purpose software audio FSK modem";
+ longDescription = ''
+ Minimodem is a command-line program which decodes (or generates) audio
+ modem tones at any specified baud rate, using various framing protocols. It
+ acts a general-purpose software FSK modem, and includes support for various
+ standard FSK protocols such as Bell103, Bell202, RTTY, NOAA SAME, and
+ Caller-ID.
+ '';
+ homepage = http://www.whence.com/minimodem/;
+ license = stdenv.lib.licenses.gpl3Plus;
+ platforms = with stdenv.lib.platforms; linux;
+ maintainers = with stdenv.lib.maintainers; [ relrod ];
+ };
+}
diff --git a/pkgs/applications/audio/moc/default.nix b/pkgs/applications/audio/moc/default.nix
index 5356d4ce298..c5a33796ca5 100644
--- a/pkgs/applications/audio/moc/default.nix
+++ b/pkgs/applications/audio/moc/default.nix
@@ -1,17 +1,17 @@
-{ stdenv, fetchurl, ncurses, pkgconfig, alsaLib, flac, libmad, speex, ffmpeg_0_10, libvorbis, mpc, libsndfile, jackaudio, db, libmodplug, timidity, libid3tag, libtool }:
+{ stdenv, fetchurl, ncurses, pkgconfig, alsaLib, flac, libmad, speex, ffmpeg, libvorbis, mpc, libsndfile, jackaudio, db, libmodplug, timidity, libid3tag, libtool }:
stdenv.mkDerivation rec {
name = "moc-${version}";
- version = "2.5.0-beta1";
+ version = "2.5.0-beta2";
src = fetchurl {
url = "http://ftp.daper.net/pub/soft/moc/unstable/moc-${version}.tar.bz2";
- sha256 = "076816da9c6d1e61a386a1dda5f63ee2fc84bc31e9011ef70acc1d391d4c46a6";
+ sha256 = "486d50584c3fb0067b8c03af54e44351633a7740b18dc3b7358322051467034c";
};
configurePhase = "./configure prefix=$out";
- buildInputs = [ ncurses pkgconfig alsaLib flac libmad speex ffmpeg_0_10 libvorbis mpc libsndfile jackaudio db libmodplug timidity libid3tag libtool ];
+ buildInputs = [ ncurses pkgconfig alsaLib flac libmad speex ffmpeg 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/ncmpc/default.nix b/pkgs/applications/audio/ncmpc/default.nix
index 6db80f39e2c..3b1b3154eda 100755
--- a/pkgs/applications/audio/ncmpc/default.nix
+++ b/pkgs/applications/audio/ncmpc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, glib, ncurses, mpd_clientlib }:
+{ stdenv, fetchurl, pkgconfig, glib, ncurses, mpd_clientlib, libintlOrEmpty }:
stdenv.mkDerivation rec {
version = "0.21";
@@ -9,7 +9,10 @@ stdenv.mkDerivation rec {
sha256 = "648e846e305c867cb937dcb467393c2f5a30bf460bdf77b63de7af69fba1fd07";
};
- buildInputs = [ pkgconfig glib ncurses mpd_clientlib ];
+ buildInputs = [ pkgconfig glib ncurses mpd_clientlib ]
+ ++ libintlOrEmpty;
+
+ NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lintl";
meta = with stdenv.lib; {
description = "Curses-based interface for MPD (music player daemon)";
diff --git a/pkgs/applications/audio/pamixer/default.nix b/pkgs/applications/audio/pamixer/default.nix
new file mode 100644
index 00000000000..acdda1799d0
--- /dev/null
+++ b/pkgs/applications/audio/pamixer/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchgit, pulseaudio, boost }:
+
+let
+ tag = "1.1";
+in
+
+stdenv.mkDerivation rec {
+
+ name = "pamixer-${tag}";
+
+ src = fetchgit {
+ url = git://github.com/cdemoulins/pamixer;
+ rev = "refs/tags/${tag}";
+ sha256 = "03r0sbfj85wp6yxa87pjg69ivmk0mxxa2nykr8gf2c607igmb034";
+ };
+
+ buildInputs = [ pulseaudio boost ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp pamixer $out/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "pamixer is like amixer but for pulseaudio.";
+ longDescription = "Features:
+ - Get the current volume of the default sink, the default source or a selected one by his id
+ - Set the volume for the default sink, the default source or any other device
+ - List the sinks
+ - List the sources
+ - Increase / Decrease the volume for a device
+ - Mute or unmute a device";
+ homepage = https://github.com/cdemoulins/pamixer;
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ maintainers = [ maintainers._1126 ];
+ };
+}
diff --git a/pkgs/applications/audio/qmmp/default.nix b/pkgs/applications/audio/qmmp/default.nix
index 122b7ed7867..a18ef97dd60 100644
--- a/pkgs/applications/audio/qmmp/default.nix
+++ b/pkgs/applications/audio/qmmp/default.nix
@@ -28,11 +28,11 @@
# handle that.
stdenv.mkDerivation rec {
- name = "qmmp-0.7.5";
+ name = "qmmp-0.7.6";
src = fetchurl {
url = "http://qmmp.ylsoftware.com/files/${name}.tar.bz2";
- sha256 = "0ryg4hns5zi9swn2q4vxjya3i4drdqfzycngwzd6fdl176lswrk0";
+ sha256 = "1hq08ii06lyfg516jrvxdfcjj509gvglvdlsr96aqi1fh8v4k5p9";
};
buildInputs =
diff --git a/pkgs/applications/audio/qtractor/default.nix b/pkgs/applications/audio/qtractor/default.nix
index c70842c399a..a15cf255040 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.6.0";
+ version = "0.6.1";
name = "qtractor-${version}";
src = fetchurl {
url = "mirror://sourceforge/qtractor/${name}.tar.gz";
- sha256 = "0aw6g0biqzysnsk5vd6wx3q1khyav6krhjz7bzk0v7d2160bn40r";
+ sha256 = "09lyz1pn2dadr1ii2msyv3n13kq3mbgpcwcyfm0brm01c2fnh6wc";
};
buildInputs =
diff --git a/pkgs/applications/audio/quodlibet/default.nix b/pkgs/applications/audio/quodlibet/default.nix
index ea8ae88f022..38c679d7a3e 100644
--- a/pkgs/applications/audio/quodlibet/default.nix
+++ b/pkgs/applications/audio/quodlibet/default.nix
@@ -75,7 +75,7 @@ buildPythonPackage {
& internet radio, and all major audio formats.
'';
- maintainer = [ stdenv.lib.maintainers.coroa ];
+ maintainers = [ stdenv.lib.maintainers.coroa ];
homepage = http://code.google.com/p/quodlibet/;
};
}
diff --git a/pkgs/applications/audio/samplv1/default.nix b/pkgs/applications/audio/samplv1/default.nix
index f1d3be317d1..c201536ed34 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.4.1";
+ version = "0.4.2";
src = fetchurl {
url = "mirror://sourceforge/samplv1/${name}.tar.gz";
- sha256 = "1cx3qs9vrdwmym2qsghqq53bshnjqgpqypsilr1m2i1cpfnfrr6x";
+ sha256 = "1vr6jbqnsgdq3v2h1ndp4pirnil3119dqwlq0k0kdscmcskvb9j4";
};
buildInputs = [ jackaudio libsndfile lv2 qt4 ];
diff --git a/pkgs/applications/audio/setbfree/default.nix b/pkgs/applications/audio/setbfree/default.nix
new file mode 100644
index 00000000000..0d5b6929753
--- /dev/null
+++ b/pkgs/applications/audio/setbfree/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, alsaLib, freetype, ftgl, jackaudio, libX11, lv2
+, mesa, pkgconfig, ttf_bitstream_vera
+}:
+
+stdenv.mkDerivation rec {
+ name = "setbfree-${version}";
+ version = "0.7.5";
+
+ src = fetchurl {
+ url = "https://github.com/pantherb/setBfree/archive/v${version}.tar.gz";
+ sha256 = "1chlmgwricc6l4kyg35vc9v8f1n8psr28iihn4a9q2prj1ihqcbc";
+ };
+
+ patchPhase = ''
+ sed 's#/usr/local#$(out)#g' -i common.mak
+ sed 's#/usr/share/fonts/truetype/ttf-bitstream-vera#${ttf_bitstream_vera}/share/fonts/truetype#g' \
+ -i b_synth/Makefile
+ '';
+
+ buildInputs = [
+ alsaLib freetype ftgl jackaudio libX11 lv2 mesa pkgconfig
+ ttf_bitstream_vera
+ ];
+
+ meta = with stdenv.lib; {
+ description = "A DSP tonewheel organ emulator";
+ homepage = http://setbfree.org;
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.goibhniu ];
+ };
+}
diff --git a/pkgs/applications/audio/spotify/default.nix b/pkgs/applications/audio/spotify/default.nix
index 874cc321f8b..59bea8fc194 100644
--- a/pkgs/applications/audio/spotify/default.nix
+++ b/pkgs/applications/audio/spotify/default.nix
@@ -1,24 +1,64 @@
{ fetchurl, stdenv, dpkg, xlibs, qt4, alsaLib, makeWrapper, openssl, freetype
, glib, pango, cairo, atk, gdk_pixbuf, gtk, cups, nspr, nss, libpng, GConf
-, libgcrypt, chromium, sqlite, gst_plugins_base, gstreamer, udev }:
+, libgcrypt, chromium, sqlite, gst_plugins_base, gstreamer, udev, fontconfig
+, dbus, expat }:
assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
let
- version = "0.9.4.183";
+ version = if stdenv.system == "i686-linux"
+ then "0.9.4.183.g644e24e.428"
+ else "0.9.10.17.g4129e1c.78";
+
qt4webkit =
if stdenv.system == "i686-linux" then
fetchurl {
- name = "libqtwebkit4_2.2_i386.deb";
- url = http://mirrors.us.kernel.org/ubuntu/pool/main/q/qtwebkit-source/libqtwebkit4_2.2~2011week36-0ubuntu1_i386.deb;
+ name = "libqtwebkit4_2.3.2_i386.deb";
+ url = http://ie.archive.ubuntu.com/ubuntu/pool/main/q/qtwebkit-source/libqtwebkit4_2.3.2-0ubuntu7_i386.deb;
sha256 = "0hi6cwx2b2cwa4nv5phqqw526lc8p9x7kjkcza9x47ny3npw2924";
}
else
fetchurl {
- name = "libqtwebkit4_2.2_amd64.deb";
- url = http://ie.archive.ubuntu.com/ubuntu/pool/main/q/qtwebkit-source/libqtwebkit4_2.2~2011week36-0ubuntu1_amd64.deb;
- sha256 = "0bvy6qz9y19ck391z8c049v07y4vdyvgykpxi7x1nvn078p1imiw";
+ name = "libqtwebkit4_2.3.2_amd64.deb";
+ url = http://ie.archive.ubuntu.com/ubuntu/pool/main/q/qtwebkit-source/libqtwebkit4_2.3.2-0ubuntu7_amd64.deb;
+ sha256 = "0sac88avfivwkfhmd6fik7ili8fdznqas6741dbspf9mfnawbwch";
};
+
+ deps = [
+ alsaLib
+ atk
+ cairo
+ cups
+ dbus
+ expat
+ fontconfig
+ freetype
+ GConf
+ gdk_pixbuf
+ glib
+ gst_plugins_base
+ gstreamer
+ gtk
+ libgcrypt
+ libpng
+ nss
+ pango
+ qt4
+ sqlite
+ stdenv.gcc.gcc
+ xlibs.libX11
+ xlibs.libXcomposite
+ xlibs.libXdamage
+ xlibs.libXext
+ xlibs.libXfixes
+ xlibs.libXi
+ xlibs.libXrandr
+ xlibs.libXrender
+ xlibs.libXrender
+ xlibs.libXScrnSaver
+ #xlibs.libXss
+ ];
+
in
stdenv.mkDerivation {
@@ -27,13 +67,13 @@ stdenv.mkDerivation {
src =
if stdenv.system == "i686-linux" then
fetchurl {
- url = "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}.g644e24e.428-1_i386.deb";
+ url = "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}-1_i386.deb";
sha256 = "1wl6v5x8vm74h5lxp8fhvmih8l122aadsf1qxvpk0k3y6mbx0ifa";
}
else if stdenv.system == "x86_64-linux" then
fetchurl {
- url = "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}.g644e24e.428-1_amd64.deb";
- sha256 = "1yniln6iswrrrny01qr2w5zcvam0vnrvy9mwbnk9i14i2ch0f3fx";
+ url = "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}-1_amd64.deb";
+ sha256 = "1a4vn2ij3nghnc0fq3nsyb95gwhaw4zabdq6jd52hxz8iv31pn1z";
}
else throw "Spotify not supported on this platform.";
@@ -51,34 +91,51 @@ stdenv.mkDerivation {
# Work around Spotify referring to a specific minor version of
# OpenSSL.
mkdir $out/lib
- ln -s ${openssl}/lib/libssl.so $out/lib/libssl.so.0.9.8
- ln -s ${openssl}/lib/libcrypto.so $out/lib/libcrypto.so.0.9.8
+
ln -s ${nss}/lib/libnss3.so $out/lib/libnss3.so.1d
ln -s ${nss}/lib/libnssutil3.so $out/lib/libnssutil3.so.1d
ln -s ${nss}/lib/libsmime3.so $out/lib/libsmime3.so.1d
+
+ ${if stdenv.system == "x86_64-linux" then ''
+ ln -s ${openssl}/lib/libssl.so $out/lib/libssl.so.1.0.0
+ ln -s ${openssl}/lib/libcrypto.so $out/lib/libcrypto.so.1.0.0
+ ln -s ${nspr}/lib/libnspr4.so $out/lib/libnspr4.so
+ ln -s ${nspr}/lib/libplc4.so $out/lib/libplc4.so
+ '' else ''
+ ln -s ${openssl}/lib/libssl.so $out/lib/libssl.so.0.9.8
+ ln -s ${openssl}/lib/libcrypto.so $out/lib/libcrypto.so.0.9.8
ln -s ${nspr}/lib/libnspr4.so $out/lib/libnspr4.so.0d
ln -s ${nspr}/lib/libplc4.so $out/lib/libplc4.so.0d
+ ''}
# Work around Spotify trying to open libudev.so.0 (which we don't have)
ln -s ${udev}/lib/libudev.so.1 $out/lib/libudev.so.0
mkdir -p $out/bin
+ rpath="$out/spotify-client/Data:$out/lib:$out/spotify-client:${stdenv.gcc.gcc}/lib64"
+
ln -s $out/spotify-client/spotify $out/bin/spotify
+
patchelf \
--interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
- --set-rpath $out/spotify-client/Data:$out/lib:$out/spotify-client:${stdenv.lib.makeLibraryPath [ xlibs.libXScrnSaver xlibs.libX11 qt4 alsaLib stdenv.gcc.gcc freetype glib pango cairo atk gdk_pixbuf gtk GConf cups sqlite xlibs.libXdamage ]}:${stdenv.gcc.gcc}/lib64 \
- $out/spotify-client/spotify
+ --set-rpath $rpath $out/spotify-client/spotify
+
+ patchelf \
+ --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ --set-rpath $rpath $out/spotify-client/Data/SpotifyHelper
dpkg-deb -x ${qt4webkit} ./
mkdir -p $out/lib/
cp -v usr/lib/*/* $out/lib/
preload=$out/libexec/spotify/libpreload.so
+ librarypath="${stdenv.lib.makeLibraryPath deps}:$out/lib"
mkdir -p $out/libexec/spotify
gcc -shared ${./preload.c} -o $preload -ldl -DOUT=\"$out\" -fPIC
- wrapProgram $out/bin/spotify --set LD_PRELOAD $preload --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ GConf libpng cups libgcrypt sqlite gst_plugins_base gstreamer xlibs.libXdamage ]}:$out/lib"
+ wrapProgram $out/bin/spotify --set LD_PRELOAD $preload --prefix LD_LIBRARY_PATH : "$librarypath"
+ wrapProgram $out/spotify-client/Data/SpotifyHelper --set LD_PRELOAD $preload --prefix LD_LIBRARY_PATH : "$librarypath"
# Desktop file
mkdir -p "$out/share/applications/"
diff --git a/pkgs/applications/audio/synthv1/default.nix b/pkgs/applications/audio/synthv1/default.nix
index 4037b88ecb7..d1c2230cf16 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.4.1";
+ version = "0.4.2";
src = fetchurl {
url = "mirror://sourceforge/synthv1/${name}.tar.gz";
- sha256 = "1j1x8n3rlwrh373wqmm6mj3cgyk3apvnpqygx1700fl4cf249agl";
+ sha256 = "1r4fszbzwd0yfcch0mcsmh7781zw1317hiljn85w79721fs2m8hc";
};
buildInputs = [ qt4 jackaudio lv2 ];
diff --git a/pkgs/applications/display-managers/slim/default.nix b/pkgs/applications/display-managers/slim/default.nix
index bf2c34b9318..26500939db8 100644
--- a/pkgs/applications/display-managers/slim/default.nix
+++ b/pkgs/applications/display-managers/slim/default.nix
@@ -5,7 +5,7 @@ stdenv.mkDerivation rec {
name = "slim-1.3.6";
src = fetchurl {
- url = "http://download.berlios.de/slim/${name}.tar.gz";
+ url = "mirror://sourceforge/slim.berlios/${name}.tar.gz";
sha256 = "1pqhk22jb4aja4hkrm7rjgbgzjyh7i4zswdgf5nw862l2znzxpi1";
};
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
NIX_CFLAGS_LINK = "-lXmu";
meta = {
- homepage = http://slim.berlios.de;
+ homepage = http://sourceforge.net/projects/slim.berlios/; # berlios shut down; I found no replacement yet
platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/editors/codeblocks/default.nix b/pkgs/applications/editors/codeblocks/default.nix
new file mode 100644
index 00000000000..1bf4bb1f8e6
--- /dev/null
+++ b/pkgs/applications/editors/codeblocks/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, autoconf, automake, libtool, pkgconfig, file, zip, wxGTK, gtk
+, contribPlugins ? false, hunspell, gamin, boost
+}:
+
+with { inherit (stdenv.lib) optionalString optional optionals; };
+
+stdenv.mkDerivation rec {
+ name = "${pname}-${stdenv.lib.optionalString contribPlugins "full-"}${version}";
+ version = "13.12";
+ pname = "codeblocks";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/codeblocks/Sources/${version}/codeblocks_${version}-1.tar.gz";
+ sha256 = "044njhps4cm1ijfdyr5f9wjyd0vblhrz9b4603ma52wcdq25093p";
+ };
+
+ buildInputs = [ automake autoconf libtool pkgconfig file zip wxGTK gtk ]
+ ++ optionals contribPlugins [ hunspell gamin boost ];
+ enableParallelBuilding = true;
+ patches = [ ./writable-projects.patch ];
+ preConfigure = "substituteInPlace ./configure --replace /usr/bin/file ${file}/bin/file";
+ postConfigure = optionalString stdenv.isLinux "substituteInPlace libtool --replace ldconfig ${stdenv.gcc.libc}/sbin/ldconfig";
+ configureFlags = [ "--enable-pch=no" ]
+ ++ optional contribPlugins "--with-contrib-plugins";
+
+ meta = with stdenv.lib; {
+ maintainers = [ maintainers.linquize ];
+ platforms = platforms.all;
+ description = "The open source, cross platform, free C, C++ and Fortran IDE";
+ longDescription =
+ ''
+ Code::Blocks is a free C, C++ and Fortran IDE built to meet the most demanding needs of its users.
+ It is designed to be very extensible and fully configurable.
+ Finally, an IDE with all the features you need, having a consistent look, feel and operation across platforms.
+ '';
+ homepage = http://www.codeblocks.org;
+ license = licenses.gpl3;
+ };
+}
diff --git a/pkgs/applications/editors/codeblocks/writable-projects.patch b/pkgs/applications/editors/codeblocks/writable-projects.patch
new file mode 100644
index 00000000000..3b6364a52a1
--- /dev/null
+++ b/pkgs/applications/editors/codeblocks/writable-projects.patch
@@ -0,0 +1,18 @@
+diff --git a/src/plugins/scriptedwizard/wiz.cpp b/src/plugins/scriptedwizard/wiz.cpp
+index 0eb4b27..7d469fe 100644
+--- a/src/plugins/scriptedwizard/wiz.cpp
++++ b/src/plugins/scriptedwizard/wiz.cpp
+@@ -785,6 +785,13 @@ void Wiz::CopyFiles(cbProject* theproject, const wxString& prjdir, const wxStri
+ }
+ }
+ if (do_copy) wxCopyFile(srcfile, dstfile, true);
++ // Noticed! Files in Nix Store are readonly, so make the copied file writable
++ if (do_copy)
++ {
++ struct stat statbuf;
++ if (!::stat(dstfile.mb_str(), &statbuf))
++ ::chmod(dstfile.mb_str(), statbuf.st_mode | 0200);
++ }
+
+ // and add it to the project
+ fname.MakeRelativeTo(prjdir);
diff --git a/pkgs/applications/editors/eclipse/default.nix b/pkgs/applications/editors/eclipse/default.nix
index 3759ed8f35f..24ba2461027 100644
--- a/pkgs/applications/editors/eclipse/default.nix
+++ b/pkgs/applications/editors/eclipse/default.nix
@@ -176,6 +176,22 @@ in {
};
};
+ eclipse_cpp_43 = buildEclipse {
+ name = "eclipse-cpp-4.3.2";
+ description = "Eclipse IDE for C/C++ Developers";
+ src =
+ if stdenv.system == "x86_64-linux" then
+ fetchurl {
+ url = http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/technology/epp/downloads/release/kepler/SR2/eclipse-cpp-kepler-SR2-linux-gtk-x86_64.tar.gz;
+ sha256 = "16zhjm6bx78263b1clg75kfiliahkhwg0k116vp9fj039nlpc30l";
+ }
+ else
+ fetchurl {
+ url = http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/technology/epp/downloads/release/kepler/SR2/eclipse-cpp-kepler-SR2-linux-gtk.tar.gz;
+ sha256 = "0d6jlj7hwz8blx6csrlyi2h2prql0wckbh7ihwjmgclwpcpj84g6";
+ };
+ };
+
eclipse_sdk_421 = buildEclipse {
name = "eclipse-sdk-4.2.1";
description = "Eclipse Classic";
diff --git a/pkgs/applications/editors/emacs-24/macport.nix b/pkgs/applications/editors/emacs-24/macport.nix
new file mode 100644
index 00000000000..4c599916d94
--- /dev/null
+++ b/pkgs/applications/editors/emacs-24/macport.nix
@@ -0,0 +1,101 @@
+{ stdenv, fetchurl, ncurses, pkgconfig, texinfo, libxml2, gnutls
+}:
+
+stdenv.mkDerivation rec {
+ emacsName = "emacs-24.3";
+ name = "${emacsName}-mac-4.8";
+
+ #builder = ./builder.sh;
+
+ src = fetchurl {
+ url = "mirror://gnu/emacs/${emacsName}.tar.xz";
+ sha256 = "1385qzs3bsa52s5rcncbrkxlydkw0ajzrvfxgv8rws5fx512kakh";
+ };
+
+ macportSrc = fetchurl {
+ url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${name}.tar.gz";
+ sha256 = "194y341zrpjp75mc3099kjc0inr1d379wwsnav257bwsc967h8yx";
+ };
+
+ buildInputs = [ ncurses pkgconfig texinfo libxml2 gnutls ];
+
+ postUnpack = ''
+ mv $emacsName $name
+ tar xzf $macportSrc
+ mv $name $emacsName
+ '';
+
+ preConfigure = ''
+ patch -p0 < patch-mac
+
+ # The search for 'tputs' will fail because it's in ncursesw within the
+ # ncurses package, yet Emacs' configure script only looks in ncurses.
+ # Further, we need to make sure that the -L option occurs before mention
+ # of the library, so that it finds it within the Nix store.
+ sed -i 's/tinfo ncurses/tinfo ncursesw/' configure
+ ncurseslib=$(echo ${ncurses}/lib | sed 's#/#\\/#g')
+ sed -i "s/OLIBS=\$LIBS/OLIBS=\"-L$ncurseslib \$LIBS\"/" configure
+ sed -i 's/LIBS="\$LIBS_TERMCAP \$LIBS"/LIBS="\$LIBS \$LIBS_TERMCAP"/' configure
+
+ configureFlagsArray=(
+ LDFLAGS=-L${ncurses}/lib
+ --with-xml2=yes
+ --with-gnutls=yes
+ --with-mac
+ --enable-mac-app=$out/Applications
+ )
+ makeFlagsArray=(
+ CFLAGS=-O3
+ LDFLAGS="-O3 -L${ncurses}/lib"
+ );
+ '';
+
+ postInstall = ''
+ cat >$out/share/emacs/site-lisp/site-start.el <auto/config.log <<_ACEOF
++cat >config.log <<_ACEOF
+ This file contains any messages produced by compilers while
+ running configure, to aid debugging if configure makes a mistake.
+
+@@ -2262,7 +2262,7 @@ generated by GNU Autoconf 2.69. Invocation command line was
+ $ $0 $@
+
+ _ACEOF
+-exec 5>>auto/config.log
++exec 5>>config.log
+ {
+ cat <<_ASUNAME
+ ## --------- ##
+@@ -5377,10 +5377,7 @@ $as_echo "no" >&6; }
+ fi
+
+ if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
+- if test "x$MACOSX" = "xyes"; then
+- MZSCHEME_LIBS="-framework Racket"
+- MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
+- elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
++ if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
+ MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
+ MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libracket3m.a"; then
+@@ -5716,23 +5713,6 @@ $as_echo ">>> too old; need Perl version 5.003_01 or later <<<" >&6; }
+ fi
+
+ if test "x$MACOSX" = "xyes"; then
+- dir=/System/Library/Perl
+- darwindir=$dir/darwin
+- if test -d $darwindir; then
+- PERL=/usr/bin/perl
+- else
+- dir=/System/Library/Perl/5.8.1
+- darwindir=$dir/darwin-thread-multi-2level
+- if test -d $darwindir; then
+- PERL=/usr/bin/perl
+- fi
+- fi
+- if test -n "$PERL"; then
+- PERL_DIR="$dir"
+- PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE"
+- PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a"
+- PERL_LIBS="-L$darwindir/CORE -lperl"
+- fi
+ PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
+ PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'`
+ fi
+@@ -5926,10 +5906,6 @@ __:
+ eof
+ eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
+ rm -f -- "${tmp_mkf}"
+- if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
+- "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
+- vi_cv_path_python_plibs="-framework Python"
+- else
+ if test "${vi_cv_var_python_version}" = "1.4"; then
+ vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
+ else
+@@ -5937,7 +5913,6 @@ eof
+ fi
+ vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
+ vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
+- fi
+
+ fi
+
+@@ -6004,13 +5979,6 @@ rm -f core conftest.err conftest.$ac_objext \
+ $as_echo "no" >&6; }
+ fi
+
+- if test -n "$MACSDK"; then
+- PYTHON_CFLAGS=
+- PYTHON_LIBS=-framework Python
+- PYTHON_CONFDIR=
+- PYTHON_GETPATH_CFLAGS=
+- fi
+-
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compile and link flags for Python are sane" >&5
+ $as_echo_n "checking if compile and link flags for Python are sane... " >&6; }
+ cflags_save=$CFLAGS
+@@ -6853,11 +6821,7 @@ $as_echo "$tclver - OK" >&6; };
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of Tcl include" >&5
+ $as_echo_n "checking for location of Tcl include... " >&6; }
+- if test "x$MACOSX" != "xyes"; then
+ tclinc="$tclloc/include $tclloc/include/tcl $tclloc/include/tcl$tclver /usr/local/include /usr/local/include/tcl$tclver /usr/include /usr/include/tcl$tclver"
+- else
+- tclinc="/System/Library/Frameworks/Tcl.framework/Headers"
+- fi
+ TCL_INC=
+ for try in $tclinc; do
+ if test -f "$try/tcl.h"; then
+@@ -6875,12 +6839,8 @@ $as_echo "" >&6; }
+ if test -z "$SKIP_TCL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for location of tclConfig.sh script" >&5
+ $as_echo_n "checking for location of tclConfig.sh script... " >&6; }
+- if test "x$MACOSX" != "xyes"; then
+ tclcnf=`echo $tclinc | sed s/include/lib/g`
+ tclcnf="$tclcnf `echo $tclinc | sed s/include/lib64/g`"
+- else
+- tclcnf="/System/Library/Frameworks/Tcl.framework"
+- fi
+ for try in $tclcnf; do
+ if test -f $try/tclConfig.sh; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $try/tclConfig.sh" >&5
+@@ -7050,10 +7010,6 @@ $as_echo "$rubyhdrdir" >&6; }
+ if test -f "$rubylibdir/$librubya"; then
+ librubyarg="$librubyarg"
+ RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
+- elif test -d "/System/Library/Frameworks/Ruby.framework"; then
+- RUBY_LIBS="-framework Ruby"
+- RUBY_CFLAGS="-DRUBY_VERSION=$rubyversion"
+- librubyarg=
+ fi
+
+ if test "X$librubyarg" != "X"; then
+@@ -14061,7 +14017,7 @@ fi
+
+ _ACEOF
+ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+-exec 5>>auto/config.log
++exec 5>>config.log
+ {
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+@@ -14653,7 +14609,7 @@ if test "$no_create" != yes; then
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+- exec 5>>auto/config.log
++ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
diff --git a/pkgs/applications/editors/vim/python_framework.patch b/pkgs/applications/editors/vim/python_framework.patch
new file mode 100644
index 00000000000..b7c7cee6cd9
--- /dev/null
+++ b/pkgs/applications/editors/vim/python_framework.patch
@@ -0,0 +1,23 @@
+diff --git a/src/auto/configure b/src/auto/configure
+index a9755a0..4a0e2a4 100755
+--- a/auto/configure
++++ b/auto/configure
+@@ -5638,10 +5638,6 @@ __:
+ eof
+ eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`"
+ rm -f -- "${tmp_mkf}"
+- if test "x$MACOSX" = "xyes" && ${vi_cv_path_python} -c \
+- "import sys; sys.exit(${vi_cv_var_python_version} < 2.3)"; then
+- vi_cv_path_python_plibs="-framework Python"
+- else
+ if test "${vi_cv_var_python_version}" = "1.4"; then
+ vi_cv_path_python_plibs="${PYTHON_CONFDIR}/libModules.a ${PYTHON_CONFDIR}/libPython.a ${PYTHON_CONFDIR}/libObjects.a ${PYTHON_CONFDIR}/libParser.a"
+ else
+@@ -5649,7 +5645,6 @@ eof
+ fi
+ vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}"
+ vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//`
+- fi
+
+ fi
+
diff --git a/pkgs/applications/editors/vim/qvim.nix b/pkgs/applications/editors/vim/qvim.nix
index 15a147319a1..2357e23bf01 100644
--- a/pkgs/applications/editors/vim/qvim.nix
+++ b/pkgs/applications/editors/vim/qvim.nix
@@ -61,7 +61,17 @@ composableDerivation {
// edf { name = "tcl"; enable = { nativeBuildInputs = [tcl]; }; } #Include Tcl interpreter.
// edf { name = "ruby"; feat = "rubyinterp"; enable = { nativeBuildInputs = [ruby]; };} #Include Ruby interpreter.
- // edf { name = "lua" ; feat = "luainterp"; enable = { nativeBuildInputs = [lua]; configureFlags = ["--with-lua-prefix=${args.lua}"];};}
+ // edf {
+ name = "lua";
+ feat = "luainterp";
+ enable = {
+ nativeBuildInputs = [lua];
+ configureFlags = [
+ "--with-lua-prefix=${args.lua}"
+ "--enable-luainterp"
+ ];
+ };
+ }
// edf { name = "cscope"; } #Include cscope interface.
// edf { name = "workshop"; } #Include Sun Visual Workshop support.
// edf { name = "netbeans"; } #Disable NetBeans integration support.
@@ -76,6 +86,7 @@ composableDerivation {
;
cfg = {
+ luaSupport = config.vim.lua or true;
pythonSupport = config.vim.python or true;
rubySupport = config.vim.ruby or true;
nlsSupport = config.vim.nls or false;
diff --git a/pkgs/applications/graphics/ImageMagick/default.nix b/pkgs/applications/graphics/ImageMagick/default.nix
index 35659cbfe6f..64b1f5b3b2c 100644
--- a/pkgs/applications/graphics/ImageMagick/default.nix
+++ b/pkgs/applications/graphics/ImageMagick/default.nix
@@ -18,14 +18,14 @@
}:
let
- version = "6.8.8-7";
+ version = "6.8.9-0";
in
stdenv.mkDerivation rec {
name = "ImageMagick-${version}";
src = fetchurl {
url = "mirror://imagemagick/${name}.tar.xz";
- sha256 = "1x5jkbrlc10rx7vm344j7xrs74c80xk3n1akqx8w5c194fj56mza";
+ sha256 = "1lapn2798fkc2wn81slpms5p21kq4dsyg45khsk7n8p69cvrmw2b";
};
enableParallelBuilding = true;
diff --git a/pkgs/applications/graphics/darktable/default.nix b/pkgs/applications/graphics/darktable/default.nix
index d4983ca04d8..c4e2a7534af 100644
--- a/pkgs/applications/graphics/darktable/default.nix
+++ b/pkgs/applications/graphics/darktable/default.nix
@@ -9,12 +9,12 @@
assert stdenv ? glibc;
stdenv.mkDerivation rec {
- version = "1.4.1";
+ version = "1.4.2";
name = "darktable-${version}";
src = fetchurl {
url = "mirror://sourceforge/darktable/darktable/1.2/darktable-${version}.tar.xz";
- sha256 = "1pkixhiyyjx5wx4dlkvabga9glcx374f1ic2kxmzzdprfm6kkqfd";
+ sha256 = "02875rnabw5m9aqfls59901889iyxkmm4xk445fvh1v06dp1lcf1";
};
buildInputs =
diff --git a/pkgs/applications/graphics/dia/default.nix b/pkgs/applications/graphics/dia/default.nix
index ab421cee158..c7582fd6c33 100644
--- a/pkgs/applications/graphics/dia/default.nix
+++ b/pkgs/applications/graphics/dia/default.nix
@@ -1,11 +1,11 @@
-{stdenv, fetchurl_gnome, gtk, pkgconfig, perl, perlXMLParser, libxml2, gettext
+{stdenv, fetchurlGnome, gtk, pkgconfig, perl, perlXMLParser, libxml2, gettext
, python, libxml2Python, docbook5, docbook_xsl, libxslt, intltool, libart_lgpl
, withGNOME ? false, libgnomeui }:
stdenv.mkDerivation rec {
name = src.pkgname;
- src = fetchurl_gnome {
+ src = fetchurlGnome {
project = "dia";
major = "0"; minor = "97"; patchlevel = "2"; extension = "xz";
sha256 = "1qgawm7rrf4wd1yc0fp39ywv8gbz4ry1s16k00dzg5w6p67lfqd7";
diff --git a/pkgs/applications/graphics/feh/default.nix b/pkgs/applications/graphics/feh/default.nix
index 4f52e6dec0f..d23f42fdbf9 100644
--- a/pkgs/applications/graphics/feh/default.nix
+++ b/pkgs/applications/graphics/feh/default.nix
@@ -1,22 +1,23 @@
-{ stdenv, makeWrapper, fetchurl, x11, imlib2, libjpeg, libpng, giblib
+{ stdenv, makeWrapper, fetchurl, x11, imlib2, libjpeg, libpng
, libXinerama, curl }:
stdenv.mkDerivation rec {
- name = "feh-2.10";
+ name = "feh-2.12";
src = fetchurl {
url = "http://feh.finalrewind.org/${name}.tar.bz2";
- sha256 = "10ya8j0mxlni08qli3gdkyjhy54g4d2q2kc0hhragmzd9s42ly5w";
+ sha256 = "0ckhidmsms2l5jycp0qf71jzmb3bpbhjq3bcgfpvfvszah7pmq30";
};
- buildInputs = [makeWrapper x11 imlib2 giblib libjpeg libpng libXinerama curl ];
+ buildInputs = [makeWrapper x11 imlib2 libjpeg libpng libXinerama curl];
preBuild = ''
makeFlags="PREFIX=$out"
'';
postInstall = ''
- wrapProgram "$out/bin/feh" --prefix PATH : "${libjpeg}/bin"
+ wrapProgram "$out/bin/feh" --prefix PATH : "${libjpeg}/bin" \
+ --add-flags '--theme=feh'
'';
meta = {
diff --git a/pkgs/applications/graphics/freecad/cmake.patch b/pkgs/applications/graphics/freecad/cmake.patch
index e54e16da977..62efaf1e29d 100644
--- a/pkgs/applications/graphics/freecad/cmake.patch
+++ b/pkgs/applications/graphics/freecad/cmake.patch
@@ -1,7 +1,27 @@
-diff -ru freecad-0.13.1830.orig/CMakeLists.txt freecad-0.13.1830/CMakeLists.txt
---- freecad-0.13.1830.orig/CMakeLists.txt 2013-02-02 18:09:17.000000000 +0100
-+++ freecad-0.13.1830/CMakeLists.txt 2014-02-15 10:16:00.939725500 +0100
-@@ -321,7 +321,7 @@
+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)
diff --git a/pkgs/applications/graphics/geeqie/default.nix b/pkgs/applications/graphics/geeqie/default.nix
index ff1e5052054..44ca66ac5b9 100644
--- a/pkgs/applications/graphics/geeqie/default.nix
+++ b/pkgs/applications/graphics/geeqie/default.nix
@@ -35,13 +35,14 @@ stdenv.mkDerivation rec {
description = "Geeqie, a lightweight GTK+ based image viewer";
longDescription =
- '' Geeqie is a lightweight GTK+ based image viewer for Unix like
- operating systems. It features: EXIF, IPTC and XMP metadata
- browsing and editing interoperability; easy integration with other
- software; geeqie works on files and directories, there is no need to
- import images; fast preview for many raw image formats; tools for
- image comparison, sorting and managing photo collection. Geeqie was
- initially based on GQview.
+ ''
+ Geeqie is a lightweight GTK+ based image viewer for Unix like
+ operating systems. It features: EXIF, IPTC and XMP metadata
+ browsing and editing interoperability; easy integration with other
+ software; geeqie works on files and directories, there is no need to
+ import images; fast preview for many raw image formats; tools for
+ image comparison, sorting and managing photo collection. Geeqie was
+ initially based on GQview.
'';
license = "GPLv2+";
diff --git a/pkgs/applications/graphics/gimp/2.8.nix b/pkgs/applications/graphics/gimp/2.8.nix
index 0f8d6d45f12..aca4d822c82 100644
--- a/pkgs/applications/graphics/gimp/2.8.nix
+++ b/pkgs/applications/graphics/gimp/2.8.nix
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
name = "gimp-2.8.10";
src = fetchurl {
- url = "ftp://ftp.gimp.org/pub/gimp/v2.8/${name}.tar.bz2";
+ url = "http://download.gimp.org/pub/gimp/v2.8/${name}.tar.bz2";
sha256 = "1rha8yx0pplfjziqczjrxxp16vsvpmb5ziq3c218s4w9z4cqpzg7";
};
diff --git a/pkgs/applications/graphics/meshlab/default.nix b/pkgs/applications/graphics/meshlab/default.nix
index 7151fc7af5c..4e2075ff471 100644
--- a/pkgs/applications/graphics/meshlab/default.nix
+++ b/pkgs/applications/graphics/meshlab/default.nix
@@ -12,6 +12,12 @@ stdenv.mkDerivation rec {
# buildPhase gets removed from the 'meshlab' binary
dontPatchELF = true;
+ # Patches are from the Arch Linux package
+ patchPhase = ''
+ patch -Np0 -i "${./qt-4.8.patch}"
+ patch -Np1 -i "${./gcc-4.7.patch}"
+ '';
+
buildPhase = ''
mkdir -p "$out/include"
cp -r vcglib "$out/include"
diff --git a/pkgs/applications/graphics/meshlab/gcc-4.7.patch b/pkgs/applications/graphics/meshlab/gcc-4.7.patch
new file mode 100644
index 00000000000..07dc1a08aff
--- /dev/null
+++ b/pkgs/applications/graphics/meshlab/gcc-4.7.patch
@@ -0,0 +1,38 @@
+diff --git a/meshlab/src/meshlabplugins/decorate_base/colorhistogram.h b/meshlab/src/meshlabplugins/decorate_base/colorhistogram.h
+index 2351b2a..90c6d76 100644
+--- a/meshlab/src/meshlabplugins/decorate_base/colorhistogram.h
++++ b/meshlab/src/meshlabplugins/decorate_base/colorhistogram.h
+@@ -40,7 +40,7 @@ public:
+
+ //! Reset histogram data.
+ void Clear() {
+- this->::Clear();
++ Histogram::Clear();
+ CV.clear();
+ }
+ /*
+diff --git a/vcglib/wrap/gl/trimesh.h b/vcglib/wrap/gl/trimesh.h
+index 5d40404..ab9d0aa 100644
+--- a/vcglib/wrap/gl/trimesh.h
++++ b/vcglib/wrap/gl/trimesh.h
+@@ -1003,7 +1003,7 @@ void Crease(MESH_TYPE &m, typename MESH_TYPE::scalar_type angleRad)
+ }
+ }
+
+- m.vert.math::Swap(newvert);
++ m.vert.math.Swap(newvert);
+ m.vn=m.vert.size();
+ }
+
+diff --git a/vcglib/wrap/ply/plystuff.h b/vcglib/wrap/ply/plystuff.h
+index 3e41e63..4af9508 100644
+--- a/vcglib/wrap/ply/plystuff.h
++++ b/vcglib/wrap/ply/plystuff.h
+@@ -75,6 +75,7 @@ using namespace vcg;
+ #define pb_close _close
+ #define DIR_SEP "\\"
+ #else
++#include
+ #define pb_mkdir(n) mkdir(n,0755)
+ #define pb_access access
+ #define pb_stat stat
diff --git a/pkgs/applications/graphics/meshlab/qt-4.8.patch b/pkgs/applications/graphics/meshlab/qt-4.8.patch
new file mode 100644
index 00000000000..abfd77d6f25
--- /dev/null
+++ b/pkgs/applications/graphics/meshlab/qt-4.8.patch
@@ -0,0 +1,54 @@
+diff -Nur meshlab.orig/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp meshlab/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp
+--- meshlab.orig/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp 2011-01-25 18:51:28.000000000 +1100
++++ meshlab/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Raytracer/RayTracer.cpp 2012-01-07 11:47:12.836800072 +1100
+@@ -7,6 +7,12 @@
+ #include "SyntopiaCore/Logging/Logging.h"
+ #include "SyntopiaCore/Misc/MiniParser.h"
+
++#ifdef Q_WS_MAC
++#include
++#else
++#include
++#endif
++
+ using namespace SyntopiaCore::Math;
+ using namespace SyntopiaCore::Misc;
+
+diff -Nur meshlab.orig/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Sphere.h meshlab/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Sphere.h
+--- meshlab.orig/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Sphere.h 2011-01-25 18:51:28.000000000 +1100
++++ meshlab/src/external/structuresynth/ssynth/SyntopiaCore/GLEngine/Sphere.h 2012-01-07 11:45:26.795586149 +1100
+@@ -3,6 +3,12 @@
+ #include "SyntopiaCore/Math/Vector3.h"
+ #include "Object3D.h"
+
++#ifdef Q_WS_MAC
++#include
++#else
++#include
++#endif
++
+ namespace SyntopiaCore {
+ namespace GLEngine {
+
+diff -Nur meshlab.orig/src/external/structuresynth/structuresynth.pro meshlab/src/external/structuresynth/structuresynth.pro
+--- meshlab.orig/src/external/structuresynth/structuresynth.pro 2011-01-25 18:49:34.000000000 +1100
++++ meshlab/src/external/structuresynth/structuresynth.pro 2012-01-07 11:51:46.695981995 +1100
+@@ -113,6 +113,7 @@
+ ssynth/StructureSynth/Model/Rendering/TemplateRenderer.cpp
+ CONFIG+=opengl
+ QT+=xml opengl script
++unix:LIBS += -lGLU
+ macx:DESTDIR = ../lib/macx
+ win32-g++:DESTDIR = ../lib/win32-gcc
+ win32-msvc2005:DESTDIR = ../lib/win32-msvc2005
+diff -Nur meshlab.orig/src/meshlab/meshlab.pro meshlab/src/meshlab/meshlab.pro
+--- meshlab.orig/src/meshlab/meshlab.pro 2011-02-15 20:39:47.000000000 +1100
++++ meshlab/src/meshlab/meshlab.pro 2012-01-07 11:57:18.055586086 +1100
+@@ -85,6 +85,7 @@
+ QT += xmlpatterns
+ QT += network
+ QT += script
++unix:LIBS += -lGLU
+
+
+ # the following line is needed to avoid mismatch between
diff --git a/pkgs/applications/graphics/mirage/default.nix b/pkgs/applications/graphics/mirage/default.nix
index 67b91fd6857..def22804bb6 100644
--- a/pkgs/applications/graphics/mirage/default.nix
+++ b/pkgs/applications/graphics/mirage/default.nix
@@ -5,7 +5,7 @@ buildPythonPackage rec {
name = "mirage-0.9.5.2";
src = fetchurl {
- url = "http://download.berlios.de/mirageiv/${name}.tar.bz2";
+ url = "mirror://sourceforge/mirageiv/${name}.tar.bz2";
sha256 = "d214a1b6d99d1d1e83da5848a2cef181f6781e0990e93f7ebff5880b0c43f43c";
};
@@ -22,7 +22,7 @@ buildPythonPackage rec {
meta = {
description = "Simple image viewer written in PyGTK";
- homepage = http://mirageiv.berlios.de/;
+ homepage = http://mirageiv.sourceforge.net/;
license = "GPLv2";
};
diff --git a/pkgs/applications/graphics/potrace/default.nix b/pkgs/applications/graphics/potrace/default.nix
new file mode 100644
index 00000000000..81af6db9a4c
--- /dev/null
+++ b/pkgs/applications/graphics/potrace/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, zlib }:
+
+let version = "1.11"; in
+
+stdenv.mkDerivation {
+ name = "potrace-${version}";
+
+ src = fetchurl {
+ url = "http://potrace.sourceforge.net/download/potrace-${version}.tar.gz";
+ sha256 = "1bbyl7jgigawmwc8r14znv8lb6lrcxh8zpvynrl6s800dr4yp9as";
+ };
+
+ buildInputs = [ zlib ];
+
+ meta = {
+ homepage = http://potrace.sourceforge.net/;
+ description = "A tool for tracing a bitmap, which means, transforming a bitmap into a smooth, scalable image";
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.pSub ];
+ license = "GPL2";
+ };
+}
diff --git a/pkgs/applications/graphics/sane/config.nix b/pkgs/applications/graphics/sane/config.nix
new file mode 100644
index 00000000000..fc1cd81ebc6
--- /dev/null
+++ b/pkgs/applications/graphics/sane/config.nix
@@ -0,0 +1,27 @@
+{ stdenv }:
+
+{ paths }:
+
+with stdenv.lib;
+let installSanePath = path: ''
+ find "${path}/lib/sane" -not -type d -maxdepth 1 | while read backend; do
+ ln -s $backend $out/lib/sane/$(basename $backend)
+ done
+
+ find "${path}/etc/sane.d" -not -type d -maxdepth 1 | while read conf; do
+ ln -s $conf $out/etc/sane.d/$(basename $conf)
+ done
+
+ find "${path}/etc/sane.d/dll.d" -not -type d -maxdepth 1 | while read conf; do
+ ln -s $conf $out/etc/sane.d/dll.d/$(basename $conf)
+ done
+ '';
+in
+stdenv.mkDerivation {
+ name = "sane-config";
+ phases = "installPhase";
+
+ installPhase = ''
+ mkdir -p $out/etc/sane.d $out/etc/sane.d/dll.d $out/lib/sane
+ '' + concatMapStrings installSanePath paths;
+}
diff --git a/pkgs/applications/misc/arbtt/default.nix b/pkgs/applications/misc/arbtt/default.nix
index 92b8cb4f295..b5ecf8fa1d1 100644
--- a/pkgs/applications/misc/arbtt/default.nix
+++ b/pkgs/applications/misc/arbtt/default.nix
@@ -1,21 +1,27 @@
-{ cabal, binary, bytestringProgress, deepseq, filepath
-, libXScrnSaver, parsec, pcreLight, strict, terminalProgressBar
-, time, transformers, utf8String, X11
+{ cabal, aeson, binary, bytestringProgress, deepseq, filepath
+, HUnit, libXScrnSaver, parsec, pcreLight, processExtras, strict
+, tasty, tastyGolden, tastyHunit, terminalProgressBar, time
+, transformers, utf8String, X11
}:
cabal.mkDerivation (self: {
pname = "arbtt";
- version = "0.7";
- sha256 = "05q31fsyrbkcx0mlf2r91zgmpma5sl2a7100h7qsa882sijc2ybn";
+ version = "0.8";
+ sha256 = "0anjcg8ikd3jxc5rb3k215wj7ar4kg2plv8sdr8hv64758xkc5q9";
isLibrary = false;
isExecutable = true;
buildDepends = [
- binary bytestringProgress deepseq filepath parsec pcreLight strict
- terminalProgressBar time transformers utf8String X11
+ aeson binary bytestringProgress deepseq filepath parsec pcreLight
+ strict terminalProgressBar time transformers utf8String X11
+ ];
+ testDepends = [
+ binary deepseq HUnit parsec pcreLight processExtras tasty
+ tastyGolden tastyHunit time transformers utf8String
];
extraLibraries = [ libXScrnSaver ];
+ jailbreak = true;
meta = {
- homepage = "http://www.joachim-breitner.de/projects#arbtt";
+ homepage = "http://arbtt.nomeata.de/";
description = "Automatic Rule-Based Time Tracker";
license = "GPL";
platforms = self.ghc.meta.platforms;
diff --git a/pkgs/applications/misc/avrdudess/default.nix b/pkgs/applications/misc/avrdudess/default.nix
new file mode 100644
index 00000000000..64bca952ff5
--- /dev/null
+++ b/pkgs/applications/misc/avrdudess/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, unzip, mono, avrgcclibc, avrdude, gtk, xdg_utils }:
+
+stdenv.mkDerivation rec {
+ name = "avrdudess-2.2.20140102";
+
+ src = fetchurl {
+ url = "http://blog.zakkemble.co.uk/download/avrdudess_20140102.zip";
+ sha256 = "18llpvjsfhypzijrvfbzmcg3g141f307mzsrg11wcdxh9syxqak6";
+ };
+
+ buildInputs = [ unzip ];
+
+ phases = [ "buildPhase" ];
+
+ buildPhase = ''
+ mkdir -p "$out/avrdudess"
+ mkdir -p "$out/bin"
+
+ unzip "$src" -d "$out/avrdudess"
+
+ cat >> "$out/bin/avrdudess" << __EOF__
+ #!${stdenv.shell}
+ export LD_LIBRARY_PATH="${gtk}/lib:${mono}/lib"
+ # We need PATH from user env for xdg-open to find its tools, which
+ # typically depend on the currently running desktop environment.
+ export PATH="${avrgcclibc}/bin:${avrdude}/bin:${xdg_utils}/bin:\$PATH"
+
+ # avrdudess must have its resource files in its current working directory
+ cd $out/avrdudess && exec ${mono}/bin/mono "$out/avrdudess/avrdudess.exe" "\$@"
+ __EOF__
+
+ chmod a+x "$out/bin/"*
+ '';
+
+ meta = with stdenv.lib; {
+ description = "GUI for AVRDUDE (AVR microcontroller programmer)";
+ homepage = https://github.com/zkemble/AVRDUDESS;
+ license = licenses.gpl3;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.bjornfor ];
+ };
+}
diff --git a/pkgs/applications/misc/bitcoin/default.nix b/pkgs/applications/misc/bitcoin/default.nix
index 1785526d14a..118b56c55b0 100644
--- a/pkgs/applications/misc/bitcoin/default.nix
+++ b/pkgs/applications/misc/bitcoin/default.nix
@@ -1,26 +1,39 @@
-{ fetchurl, stdenv, openssl, db, 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 db 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 2e9cf46bf86..930a48a617f 100644
--- a/pkgs/applications/misc/blender/default.nix
+++ b/pkgs/applications/misc/blender/default.nix
@@ -1,35 +1,35 @@
{ stdenv, fetchurl, SDL, boost, cmake, ffmpeg, gettext, glew
-, ilmbase, jackaudio, libXi, libjpeg, libpng, libsamplerate, libsndfile
+, ilmbase, libXi, libjpeg, libpng, libsamplerate, libsndfile
, libtiff, mesa, openal, opencolorio, openexr, openimageio, openjpeg, python
, zlib
+, jackaudioSupport ? false, jackaudio
}:
stdenv.mkDerivation rec {
- name = "blender-2.70";
+ name = "blender-2.70a";
src = fetchurl {
url = "http://download.blender.org/source/${name}.tar.gz";
- sha256 = "0j73yfpavcrzg5v54kcha7sig6179g5ykrlhih8d288pnb5c7596";
+ sha256 = "1rgkijn1nirj3jwh058zv6piw8q4j5wwjapgbvh2hh6fpbj84bgb";
};
- buildInputs = [
- SDL boost cmake ffmpeg gettext glew ilmbase jackaudio libXi
- libjpeg libpng libsamplerate libsndfile libtiff mesa openal
- opencolorio openexr openimageio openjpeg python zlib
- ];
+ buildInputs =
+ [ SDL boost cmake ffmpeg gettext glew ilmbase jackaudio libXi
+ libjpeg libpng libsamplerate libsndfile libtiff mesa openal
+ opencolorio openexr openimageio openjpeg python zlib
+ ] ++ stdenv.lib.optional jackaudioSupport jackaudio;
-
- cmakeFlags = [
- "-DOPENEXR_INC=${openexr}/include/OpenEXR"
- "-DWITH_OPENCOLLADA=OFF"
- "-DWITH_CODEC_FFMPEG=ON"
- "-DWITH_CODEC_SNDFILE=ON"
- "-DWITH_JACK=ON"
- "-DWITH_INSTALL_PORTABLE=OFF"
- "-DPYTHON_LIBRARY=python${python.majorVersion}m"
- "-DPYTHON_LIBPATH=${python}/lib"
- "-DPYTHON_INCLUDE_DIR=${python}/include/python${python.majorVersion}m"
- ];
+ cmakeFlags =
+ [ "-DOPENEXR_INC=${openexr}/include/OpenEXR"
+ "-DWITH_OPENCOLLADA=OFF"
+ "-DWITH_CODEC_FFMPEG=ON"
+ "-DWITH_CODEC_SNDFILE=ON"
+ "-DWITH_INSTALL_PORTABLE=OFF"
+ "-DPYTHON_LIBRARY=python${python.majorVersion}m"
+ "-DPYTHON_LIBPATH=${python}/lib"
+ "-DPYTHON_INCLUDE_DIR=${python}/include/python${python.majorVersion}m"
+ "-DPYTHON_VERSION=${python.majorVersion}"
+ ] ++ stdenv.lib.optional jackaudioSupport "-DWITH_JACK=ON";
NIX_CFLAGS_COMPILE = "-I${ilmbase}/include/OpenEXR -I${python}/include/${python.libPrefix}m";
@@ -43,6 +43,5 @@ stdenv.mkDerivation rec {
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = [ maintainers.goibhniu ];
-
};
}
diff --git a/pkgs/applications/misc/cdrtools/default.nix b/pkgs/applications/misc/cdrtools/default.nix
index 94af2ee58f5..455ff8d46b8 100644
--- a/pkgs/applications/misc/cdrtools/default.nix
+++ b/pkgs/applications/misc/cdrtools/default.nix
@@ -1,6 +1,6 @@
{stdenv, fetchurl}:
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
name = "cdrtools-2.01";
configurePhase = "prefix=$out";
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
'';
src = fetchurl {
- url = ftp://ftp.berlios.de/pub/cdrecord/cdrtools-2.01.tar.bz2;
+ url = "mirror://sourceforge/cdrtools/${name}.tar.bz2";
md5 = "d44a81460e97ae02931c31188fe8d3fd";
};
@@ -24,6 +24,6 @@ stdenv.mkDerivation {
meta = {
description = "Highly portable CD/DVD/BluRay command line recording software (deprecated; use cdrkit instead)";
- homepage = http://cdrecord.berlios.de/old/private/cdrecord.html;
+ homepage = http://sourceforge.net/projects/cdrtools/; # berlios shut down; I found no better link
};
}
diff --git a/pkgs/applications/misc/dmenu/default.nix b/pkgs/applications/misc/dmenu/default.nix
index 048514ad4aa..3fecddcb316 100644
--- a/pkgs/applications/misc/dmenu/default.nix
+++ b/pkgs/applications/misc/dmenu/default.nix
@@ -19,6 +19,10 @@ stdenv.mkDerivation rec {
patches = optional enableXft xftPatch;
+ postPatch = ''
+ sed -ri -e 's!\<(dmenu|stest)\>!'"$out/bin"'/&!g' dmenu_run
+ '';
+
preConfigure = [ ''sed -i "s@PREFIX = /usr/local@PREFIX = $out@g" config.mk'' ];
meta = {
diff --git a/pkgs/applications/misc/fbreader/default.nix b/pkgs/applications/misc/fbreader/default.nix
index 612285c697c..2b193ef42cd 100644
--- a/pkgs/applications/misc/fbreader/default.nix
+++ b/pkgs/applications/misc/fbreader/default.nix
@@ -30,6 +30,6 @@ stdenv.mkDerivation {
homepage = http://www.fbreader.org/;
license = licenses.gpl3;
platforms = platforms.linux; # possibly also on unix general
- maintainer = [ maintainers.coroa ];
+ maintainers = [ maintainers.coroa ];
};
}
diff --git a/pkgs/applications/misc/fetchmail/default.nix b/pkgs/applications/misc/fetchmail/default.nix
index eb01baf44dd..57d677395b4 100644
--- a/pkgs/applications/misc/fetchmail/default.nix
+++ b/pkgs/applications/misc/fetchmail/default.nix
@@ -7,7 +7,7 @@ stdenv.mkDerivation {
name="fetchmail-${version}";
src = fetchurl {
- url = "http://download.berlios.de/fetchmail/fetchmail-${version}.tar.bz2";
+ url = "mirror://sourceforge/fetchmail.berlios/fetchmail-${version}.tar.bz2";
sha256 = "08rafrs1dlr11myr0p99kg4k80qyy0fa63gg3ac88zn49174lwhw";
};
diff --git a/pkgs/applications/misc/galculator/default.nix b/pkgs/applications/misc/galculator/default.nix
new file mode 100644
index 00000000000..010f75a575e
--- /dev/null
+++ b/pkgs/applications/misc/galculator/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl
+, intltool, pkgconfig, gtk
+ }:
+
+stdenv.mkDerivation rec {
+
+ name = "galculator-${version}";
+ version = "2.1.3";
+
+ src = fetchurl {
+ url = "http://downloads.sourceforge.net/galculator/${name}.tar.gz";
+ sha256 = "12m7dldjk10lpkdxk7zpk98n32ci65zmxidghihb7n1m3rhp3q17";
+ };
+
+ buildInputs = [ intltool pkgconfig gtk ];
+
+ meta = {
+ description = "A GTK 2/3 algebraic and RPN calculator";
+ longDescription = ''
+ galculator is a GTK 2 / GTK 3 based calculator. Its main features include:
+
+ - Algebraic, RPN (Reverse Polish Notation), Formula Entry and Paper modes;
+ - Basic and Scientific Modes
+ - Decimal, hexadecimal, octal and binary number base
+ - Radiant, degree and grad support
+ - User defined constants and functions
+ - A bunch of common functions
+ - Binary arithmetic of configurable bit length and signedness
+ - Quad-precision floating point arithmetic, and 112-bit binary arithmetic
+ '';
+ homepage = http://galculator.sourceforge.net/;
+ license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = [ stdenv.lib.maintainers.AndersonTorres ];
+ };
+}
diff --git a/pkgs/applications/misc/get_iplayer/default.nix b/pkgs/applications/misc/get_iplayer/default.nix
index 308b181fe88..08fad5a021d 100644
--- a/pkgs/applications/misc/get_iplayer/default.nix
+++ b/pkgs/applications/misc/get_iplayer/default.nix
@@ -1,6 +1,6 @@
{stdenv, fetchurl, flvstreamer, ffmpeg, makeWrapper, perl, buildPerlPackage, perlPackages, vlc, rtmpdump}:
buildPerlPackage {
- name = "get_iplayer-2.83";
+ name = "get_iplayer-2.86";
buildInputs = [makeWrapper perl];
propagatedBuildInputs = with perlPackages; [HTMLParser HTTPCookies LWP];
@@ -12,12 +12,12 @@ buildPerlPackage {
mkdir -p $out/bin
cp get_iplayer $out/bin
sed -i 's|^update_script|#update_script|' $out/bin/get_iplayer
- wrapProgram $out/bin/get_iplayer --suffix PATH : ${ffmpeg}/bin:${flvstreamer}/bin:${vlc}/bin:${rtmpdump}/bin
+ wrapProgram $out/bin/get_iplayer --suffix PATH : ${ffmpeg}/bin:${flvstreamer}/bin:${vlc}/bin:${rtmpdump}/bin --prefix PERL5LIB : $PERL5LIB
'';
src = fetchurl {
- url = ftp://ftp.infradead.org/pub/get_iplayer/get_iplayer-2.83.tar.gz;
- sha256 = "169zji0rr3z5ng6r4cyzvs89779m4iklln9gsqpryvm81ipalfga";
+ url = ftp://ftp.infradead.org/pub/get_iplayer/get_iplayer-2.86.tar.gz;
+ sha256 = "0zhcw0ikxrrz1jayx7jjgxmdf7gzk4pmzfvpraxmv64xwzgc1sc1";
};
}
diff --git a/pkgs/applications/misc/gnuradio/default.nix b/pkgs/applications/misc/gnuradio/default.nix
index 7e67682f17f..1a0dea586d0 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.2.1";
+ version = "3.7.3";
src = fetchurl {
url = "http://gnuradio.org/releases/gnuradio/${name}.tar.gz";
- sha256 = "101wr19nxfc5x7i4s10vgrypaa0vj2pkg8b2vn5j5s9iv8gpwswc";
+ sha256 = "0caj7dqppav53nhn0ima106hpsn0sakw57v1ihac9fk7ka0x2w8w";
};
buildInputs = [
diff --git a/pkgs/applications/misc/keepassx/2.0.nix b/pkgs/applications/misc/keepassx/2.0.nix
index 6d54032bb38..1a79af7cb57 100644
--- a/pkgs/applications/misc/keepassx/2.0.nix
+++ b/pkgs/applications/misc/keepassx/2.0.nix
@@ -1,7 +1,7 @@
{ stdenv, fetchurl, cmake, libgcrypt, qt4, xlibs, ... }:
stdenv.mkDerivation {
- name = "keepassx-2.0alpha5";
+ name = "keepassx2-2.0alpha5";
src = fetchurl {
url = "https://github.com/keepassx/keepassx/archive/2.0-alpha5.tar.gz";
sha256 = "1vxj306zhrr38mvsy3vpjlg6d0xwlcvsi3l69nhhwzkccsc4smfm";
diff --git a/pkgs/applications/misc/mupdf/default.nix b/pkgs/applications/misc/mupdf/default.nix
index ef7571f5d14..a89735c093f 100644
--- a/pkgs/applications/misc/mupdf/default.nix
+++ b/pkgs/applications/misc/mupdf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, zlib, freetype, libjpeg, jbig2dec, openjpeg
+{ stdenv, fetchurl, fetchpatch, pkgconfig, zlib, freetype, libjpeg, jbig2dec, openjpeg
, libX11, libXext }:
stdenv.mkDerivation rec {
name = "mupdf-1.3";
@@ -8,23 +8,53 @@ stdenv.mkDerivation rec {
sha256 = "0y247nka5gkr1ajn47jrlp5rcnf6h4ff7dfsprma3h4wxqdv7a5b";
};
- patches = [(fetchurl {
+ patches = [(fetchpatch {
name = "CVE-2014-2013.patch";
url = "http://git.ghostscript.com/?p=mupdf.git;a=commitdiff_plain;"
+ "h=60dabde18d7fe12b19da8b509bdfee9cc886aafc";
- sha256 = "1walj3wir9x50i6lph33bx14c8593r9xrn08gkd3v7r6d15lmjps";
+ sha256 = "0p721f3g2djz9fy6rcgj83c20f5k257wg2d0yvvmp02m7sp06l0g";
})];
buildInputs = [ pkgconfig zlib freetype libjpeg jbig2dec openjpeg libX11 libXext ];
enableParallelBuilding = true;
+ my_soname = "libmupdf.so.1.3";
+ my_soname_js_none = "libmupdf-js-none.so.1.3";
preBuild = ''
- export makeFlags="prefix=$out build=release"
+ export makeFlags="prefix=$out build=release XCFLAGS=-fpic"
export NIX_CFLAGS_COMPILE=" $NIX_CFLAGS_COMPILE -I$(echo ${openjpeg}/include/openjpeg-*) "
+
+ # Copied from Gentoo ebuild
+ rm -rf thirdparty
+ sed -e "\$a\$(MUPDF_LIB): \$(MUPDF_JS_NONE_LIB)" \
+ -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname} -Wl,--no-undefined -o \$@ \$^ \$(MUPDF_JS_NONE_LIB) \$(LIBS)" \
+ -e "/^MUPDF_LIB :=/s:=.*:= \$(OUT)/${my_soname}:" \
+ -e "\$a\$(MUPDF_JS_NONE_LIB):" \
+ -e "\$a\\\t\$(QUIET_LINK) \$(CC) \$(LDFLAGS) --shared -Wl,-soname -Wl,${my_soname_js_none} -Wl,--no-undefined -o \$@ \$^ \$(LIBS)" \
+ -e "/^MUPDF_JS_NONE_LIB :=/s:=.*:= \$(OUT)/${my_soname_js_none}:" \
+ -i Makefile
+
+ sed -e "s/libopenjpeg1/libopenjp2/" -i Makerules
'';
postInstall = ''
+ ln -s ${my_soname} $out/lib/libmupdf.so
+
+ mkdir -p "$out/lib/pkgconfig"
+ cat >"$out/lib/pkgconfig/mupdf.pc" < $out/share/applications/mupdf.desktop <=7,\
+ from distutils.core import setup, Extension, Command
+ from distutils.command.install_data import install_data
+
++import matplotlib
++matplotlib.use('Agg')
+ from ocrolib import default
++
+ modeldir = "models/"
+ modelfiles = default.installable
+ modelprefix = "http://iupr1.cs.uni-kl.de/~tmb/ocropus-models/"
diff --git a/pkgs/applications/misc/posterazor/default.nix b/pkgs/applications/misc/posterazor/default.nix
new file mode 100644
index 00000000000..0cad2fbd2cd
--- /dev/null
+++ b/pkgs/applications/misc/posterazor/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, cmake, unzip, pkgconfig, libXpm, fltk13, freeimage }:
+
+stdenv.mkDerivation rec {
+ name = "posterazor-1.5";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/posterazor/1.5/PosteRazor-1.5-Source.zip";
+ sha256 = "0xy313d2j57s4wy2y3hjapbjr5zfaki0lhkfz6nw2p9gylcmwmjy";
+ };
+
+ buildInputs = [ cmake unzip pkgconfig libXpm fltk13 freeimage ];
+
+ unpackPhase = ''
+ unzip $src -d posterazor
+ cd posterazor/src
+ '';
+
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=667328
+ patchPhase = ''
+ sed "s/\(#define CASESENSITIVESTRCMP strcasecmp\)/#include \n\1/" -i FlPosteRazorDialog.cpp
+ '';
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp PosteRazor $out/bin
+ '';
+
+ meta = {
+ homepage = "http://posterazor.sourceforge.net/";
+ description = "The PosteRazor cuts a raster image into pieces which can afterwards be printed out and assembled to a poster";
+ maintainers = [ stdenv.lib.maintainers.madjar ];
+ platforms = stdenv.lib.platforms.all;
+ };
+}
diff --git a/pkgs/applications/misc/qtbitcointrader/default.nix b/pkgs/applications/misc/qtbitcointrader/default.nix
new file mode 100644
index 00000000000..38606d79873
--- /dev/null
+++ b/pkgs/applications/misc/qtbitcointrader/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, qt4 }:
+
+let
+ version = "1.07.98";
+in
+stdenv.mkDerivation {
+ name = "qtbitcointrader-${version}";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/bitcointrader/SRC/QtBitcoinTrader-${version}.tar.gz";
+ sha256 = "1irz17q71fx64dfkmgajlyva7d1wifv4bxgb2iwz7d69rvhzaqzx";
+ };
+
+ buildInputs = [ qt4 ];
+
+ postUnpack = "sourceRoot=\${sourceRoot}/src";
+
+ configurePhase = ''
+ qmake \
+ PREFIX=$out \
+ DESKTOPDIR=$out/share/applications \
+ ICONDIR=$out/share/pixmaps \
+ QtBitcoinTrader_Desktop.pro
+ '';
+
+ meta = {
+ description = "Secure bitcoin trading client";
+ homepage = http://qtopentrader.com;
+ license = stdenv.lib.licenses.lgpl21Plus;
+ platforms = stdenv.lib.platforms.linux; # arbitrary choice
+ maintainers = [ stdenv.lib.maintainers.emery ];
+ };
+}
\ No newline at end of file
diff --git a/pkgs/applications/misc/rxvt_unicode/default.nix b/pkgs/applications/misc/rxvt_unicode/default.nix
index 2e3ef9f0d10..7392123673a 100644
--- a/pkgs/applications/misc/rxvt_unicode/default.nix
+++ b/pkgs/applications/misc/rxvt_unicode/default.nix
@@ -1,19 +1,20 @@
{ stdenv, fetchurl, perlSupport, libX11, libXt, libXft, ncurses, perl,
- fontconfig, freetype, pkgconfig, libXrender, gdkPixbufSupport, gdk_pixbuf }:
+ fontconfig, freetype, pkgconfig, libXrender, gdkPixbufSupport, gdk_pixbuf,
+ unicode3Support }:
let
name = "rxvt-unicode";
- version = "9.16";
+ version = "9.20";
n = "${name}-${version}";
in
stdenv.mkDerivation (rec {
- name = "${n}${if perlSupport then "-with-perl" else ""}";
+ name = "${n}${if perlSupport then "-with-perl" else ""}${if unicode3Support then "-with-unicode3" else ""}";
src = fetchurl {
url = "http://dist.schmorp.de/rxvt-unicode/Attic/rxvt-unicode-${version}.tar.bz2";
- sha256 = "0x28wyslqnhn2q11y4hncqdl07wgh5ypywl92fq0jxycr36ibfvn";
+ sha256 = "e73e13fe64b59fd3c8e6e20c00f149d388741f141b8155e4700d3ed40aa94b4e";
};
buildInputs =
@@ -24,12 +25,15 @@ stdenv.mkDerivation (rec {
outputs = [ "out" "terminfo" ];
- patches = [ ./rxvt-unicode-9.06-font-width.patch ];
+ patches = [
+ ./rxvt-unicode-9.06-font-width.patch
+ ./rxvt-unicode-256-color-resources.patch
+ ];
preConfigure =
''
mkdir -p $terminfo/share/terminfo
- configureFlags="--with-terminfo=$terminfo/share/terminfo --enable-256-color ${if perlSupport then "--enable-perl" else "--disable-perl"}";
+ configureFlags="--with-terminfo=$terminfo/share/terminfo --enable-256-color ${if perlSupport then "--enable-perl" else "--disable-perl"} ${if unicode3Support then "--enable-unicode3" else "--disable-unicode3"}";
export TERMINFO=$terminfo/share/terminfo # without this the terminfo won't be compiled by tic, see man tic
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${freetype}/include/freetype2"
NIX_LDFLAGS="$NIX_LDFLAGS -lfontconfig -lXrender "
diff --git a/pkgs/applications/misc/rxvt_unicode/rxvt-unicode-256-color-resources.patch b/pkgs/applications/misc/rxvt_unicode/rxvt-unicode-256-color-resources.patch
new file mode 100644
index 00000000000..c8d2acfbdc5
--- /dev/null
+++ b/pkgs/applications/misc/rxvt_unicode/rxvt-unicode-256-color-resources.patch
@@ -0,0 +1,255 @@
+diff --git a/src/xdefaults.C b/src/xdefaults.C
+index 23b6822..382f3b1 100644
+--- a/src/xdefaults.C
++++ b/src/xdefaults.C
+@@ -155,6 +155,250 @@ optList[] = {
+ RSTRG (Rs_color + minCOLOR + 5, "color5", "color"),
+ RSTRG (Rs_color + minCOLOR + 6, "color6", "color"),
+ RSTRG (Rs_color + minCOLOR + 7, "color7", "color"),
++ // 88 xterm colors
++ RSTRG (Rs_color + minCOLOR + 16, "color16", "color"),
++ RSTRG (Rs_color + minCOLOR + 17, "color17", "color"),
++ RSTRG (Rs_color + minCOLOR + 18, "color18", "color"),
++ RSTRG (Rs_color + minCOLOR + 19, "color19", "color"),
++ RSTRG (Rs_color + minCOLOR + 20, "color20", "color"),
++ RSTRG (Rs_color + minCOLOR + 21, "color21", "color"),
++ RSTRG (Rs_color + minCOLOR + 22, "color22", "color"),
++ RSTRG (Rs_color + minCOLOR + 23, "color23", "color"),
++ RSTRG (Rs_color + minCOLOR + 24, "color24", "color"),
++ RSTRG (Rs_color + minCOLOR + 25, "color25", "color"),
++ RSTRG (Rs_color + minCOLOR + 26, "color26", "color"),
++ RSTRG (Rs_color + minCOLOR + 27, "color27", "color"),
++ RSTRG (Rs_color + minCOLOR + 28, "color28", "color"),
++ RSTRG (Rs_color + minCOLOR + 29, "color29", "color"),
++ RSTRG (Rs_color + minCOLOR + 30, "color30", "color"),
++ RSTRG (Rs_color + minCOLOR + 31, "color31", "color"),
++ RSTRG (Rs_color + minCOLOR + 32, "color32", "color"),
++ RSTRG (Rs_color + minCOLOR + 33, "color33", "color"),
++ RSTRG (Rs_color + minCOLOR + 34, "color34", "color"),
++ RSTRG (Rs_color + minCOLOR + 35, "color35", "color"),
++ RSTRG (Rs_color + minCOLOR + 36, "color36", "color"),
++ RSTRG (Rs_color + minCOLOR + 37, "color37", "color"),
++ RSTRG (Rs_color + minCOLOR + 38, "color38", "color"),
++ RSTRG (Rs_color + minCOLOR + 39, "color39", "color"),
++ RSTRG (Rs_color + minCOLOR + 40, "color40", "color"),
++ RSTRG (Rs_color + minCOLOR + 41, "color41", "color"),
++ RSTRG (Rs_color + minCOLOR + 42, "color42", "color"),
++ RSTRG (Rs_color + minCOLOR + 43, "color43", "color"),
++ RSTRG (Rs_color + minCOLOR + 44, "color44", "color"),
++ RSTRG (Rs_color + minCOLOR + 45, "color45", "color"),
++ RSTRG (Rs_color + minCOLOR + 46, "color46", "color"),
++ RSTRG (Rs_color + minCOLOR + 47, "color47", "color"),
++ RSTRG (Rs_color + minCOLOR + 48, "color48", "color"),
++ RSTRG (Rs_color + minCOLOR + 49, "color49", "color"),
++ RSTRG (Rs_color + minCOLOR + 50, "color50", "color"),
++ RSTRG (Rs_color + minCOLOR + 51, "color51", "color"),
++ RSTRG (Rs_color + minCOLOR + 52, "color52", "color"),
++ RSTRG (Rs_color + minCOLOR + 53, "color53", "color"),
++ RSTRG (Rs_color + minCOLOR + 54, "color54", "color"),
++ RSTRG (Rs_color + minCOLOR + 55, "color55", "color"),
++ RSTRG (Rs_color + minCOLOR + 56, "color56", "color"),
++ RSTRG (Rs_color + minCOLOR + 57, "color57", "color"),
++ RSTRG (Rs_color + minCOLOR + 58, "color58", "color"),
++ RSTRG (Rs_color + minCOLOR + 59, "color59", "color"),
++ RSTRG (Rs_color + minCOLOR + 60, "color60", "color"),
++ RSTRG (Rs_color + minCOLOR + 61, "color61", "color"),
++ RSTRG (Rs_color + minCOLOR + 62, "color62", "color"),
++ RSTRG (Rs_color + minCOLOR + 63, "color63", "color"),
++ RSTRG (Rs_color + minCOLOR + 64, "color64", "color"),
++ RSTRG (Rs_color + minCOLOR + 65, "color65", "color"),
++ RSTRG (Rs_color + minCOLOR + 66, "color66", "color"),
++ RSTRG (Rs_color + minCOLOR + 67, "color67", "color"),
++ RSTRG (Rs_color + minCOLOR + 68, "color68", "color"),
++ RSTRG (Rs_color + minCOLOR + 69, "color69", "color"),
++ RSTRG (Rs_color + minCOLOR + 70, "color70", "color"),
++ RSTRG (Rs_color + minCOLOR + 71, "color71", "color"),
++ RSTRG (Rs_color + minCOLOR + 72, "color72", "color"),
++ RSTRG (Rs_color + minCOLOR + 73, "color73", "color"),
++ RSTRG (Rs_color + minCOLOR + 74, "color74", "color"),
++ RSTRG (Rs_color + minCOLOR + 75, "color75", "color"),
++ RSTRG (Rs_color + minCOLOR + 76, "color76", "color"),
++ RSTRG (Rs_color + minCOLOR + 77, "color77", "color"),
++ RSTRG (Rs_color + minCOLOR + 78, "color78", "color"),
++ RSTRG (Rs_color + minCOLOR + 79, "color79", "color"),
++ RSTRG (Rs_color + minCOLOR + 80, "color80", "color"),
++ RSTRG (Rs_color + minCOLOR + 81, "color81", "color"),
++ RSTRG (Rs_color + minCOLOR + 82, "color82", "color"),
++ RSTRG (Rs_color + minCOLOR + 83, "color83", "color"),
++ RSTRG (Rs_color + minCOLOR + 84, "color84", "color"),
++ RSTRG (Rs_color + minCOLOR + 85, "color85", "color"),
++ RSTRG (Rs_color + minCOLOR + 86, "color86", "color"),
++ RSTRG (Rs_color + minCOLOR + 87, "color87", "color"),
++#if USE_256_COLORS
++ // 256 xterm colors
++ RSTRG (Rs_color + minCOLOR + 88, "color88", "color"),
++ RSTRG (Rs_color + minCOLOR + 89, "color89", "color"),
++ RSTRG (Rs_color + minCOLOR + 90, "color90", "color"),
++ RSTRG (Rs_color + minCOLOR + 91, "color91", "color"),
++ RSTRG (Rs_color + minCOLOR + 92, "color92", "color"),
++ RSTRG (Rs_color + minCOLOR + 93, "color93", "color"),
++ RSTRG (Rs_color + minCOLOR + 94, "color94", "color"),
++ RSTRG (Rs_color + minCOLOR + 95, "color95", "color"),
++ RSTRG (Rs_color + minCOLOR + 96, "color96", "color"),
++ RSTRG (Rs_color + minCOLOR + 97, "color97", "color"),
++ RSTRG (Rs_color + minCOLOR + 98, "color98", "color"),
++ RSTRG (Rs_color + minCOLOR + 99, "color99", "color"),
++ RSTRG (Rs_color + minCOLOR + 100, "color100", "color"),
++ RSTRG (Rs_color + minCOLOR + 101, "color101", "color"),
++ RSTRG (Rs_color + minCOLOR + 102, "color102", "color"),
++ RSTRG (Rs_color + minCOLOR + 103, "color103", "color"),
++ RSTRG (Rs_color + minCOLOR + 104, "color104", "color"),
++ RSTRG (Rs_color + minCOLOR + 105, "color105", "color"),
++ RSTRG (Rs_color + minCOLOR + 106, "color106", "color"),
++ RSTRG (Rs_color + minCOLOR + 107, "color107", "color"),
++ RSTRG (Rs_color + minCOLOR + 108, "color108", "color"),
++ RSTRG (Rs_color + minCOLOR + 109, "color109", "color"),
++ RSTRG (Rs_color + minCOLOR + 110, "color110", "color"),
++ RSTRG (Rs_color + minCOLOR + 111, "color111", "color"),
++ RSTRG (Rs_color + minCOLOR + 112, "color112", "color"),
++ RSTRG (Rs_color + minCOLOR + 113, "color113", "color"),
++ RSTRG (Rs_color + minCOLOR + 114, "color114", "color"),
++ RSTRG (Rs_color + minCOLOR + 115, "color115", "color"),
++ RSTRG (Rs_color + minCOLOR + 116, "color116", "color"),
++ RSTRG (Rs_color + minCOLOR + 117, "color117", "color"),
++ RSTRG (Rs_color + minCOLOR + 118, "color118", "color"),
++ RSTRG (Rs_color + minCOLOR + 119, "color119", "color"),
++ RSTRG (Rs_color + minCOLOR + 120, "color120", "color"),
++ RSTRG (Rs_color + minCOLOR + 121, "color121", "color"),
++ RSTRG (Rs_color + minCOLOR + 122, "color122", "color"),
++ RSTRG (Rs_color + minCOLOR + 123, "color123", "color"),
++ RSTRG (Rs_color + minCOLOR + 124, "color124", "color"),
++ RSTRG (Rs_color + minCOLOR + 125, "color125", "color"),
++ RSTRG (Rs_color + minCOLOR + 126, "color126", "color"),
++ RSTRG (Rs_color + minCOLOR + 127, "color127", "color"),
++ RSTRG (Rs_color + minCOLOR + 128, "color128", "color"),
++ RSTRG (Rs_color + minCOLOR + 129, "color129", "color"),
++ RSTRG (Rs_color + minCOLOR + 130, "color130", "color"),
++ RSTRG (Rs_color + minCOLOR + 131, "color131", "color"),
++ RSTRG (Rs_color + minCOLOR + 132, "color132", "color"),
++ RSTRG (Rs_color + minCOLOR + 133, "color133", "color"),
++ RSTRG (Rs_color + minCOLOR + 134, "color134", "color"),
++ RSTRG (Rs_color + minCOLOR + 135, "color135", "color"),
++ RSTRG (Rs_color + minCOLOR + 136, "color136", "color"),
++ RSTRG (Rs_color + minCOLOR + 137, "color137", "color"),
++ RSTRG (Rs_color + minCOLOR + 138, "color138", "color"),
++ RSTRG (Rs_color + minCOLOR + 139, "color139", "color"),
++ RSTRG (Rs_color + minCOLOR + 140, "color140", "color"),
++ RSTRG (Rs_color + minCOLOR + 141, "color141", "color"),
++ RSTRG (Rs_color + minCOLOR + 142, "color142", "color"),
++ RSTRG (Rs_color + minCOLOR + 143, "color143", "color"),
++ RSTRG (Rs_color + minCOLOR + 144, "color144", "color"),
++ RSTRG (Rs_color + minCOLOR + 145, "color145", "color"),
++ RSTRG (Rs_color + minCOLOR + 146, "color146", "color"),
++ RSTRG (Rs_color + minCOLOR + 147, "color147", "color"),
++ RSTRG (Rs_color + minCOLOR + 148, "color148", "color"),
++ RSTRG (Rs_color + minCOLOR + 149, "color149", "color"),
++ RSTRG (Rs_color + minCOLOR + 150, "color150", "color"),
++ RSTRG (Rs_color + minCOLOR + 151, "color151", "color"),
++ RSTRG (Rs_color + minCOLOR + 152, "color152", "color"),
++ RSTRG (Rs_color + minCOLOR + 153, "color153", "color"),
++ RSTRG (Rs_color + minCOLOR + 154, "color154", "color"),
++ RSTRG (Rs_color + minCOLOR + 155, "color155", "color"),
++ RSTRG (Rs_color + minCOLOR + 156, "color156", "color"),
++ RSTRG (Rs_color + minCOLOR + 157, "color157", "color"),
++ RSTRG (Rs_color + minCOLOR + 158, "color158", "color"),
++ RSTRG (Rs_color + minCOLOR + 159, "color159", "color"),
++ RSTRG (Rs_color + minCOLOR + 160, "color160", "color"),
++ RSTRG (Rs_color + minCOLOR + 161, "color161", "color"),
++ RSTRG (Rs_color + minCOLOR + 162, "color162", "color"),
++ RSTRG (Rs_color + minCOLOR + 163, "color163", "color"),
++ RSTRG (Rs_color + minCOLOR + 164, "color164", "color"),
++ RSTRG (Rs_color + minCOLOR + 165, "color165", "color"),
++ RSTRG (Rs_color + minCOLOR + 166, "color166", "color"),
++ RSTRG (Rs_color + minCOLOR + 167, "color167", "color"),
++ RSTRG (Rs_color + minCOLOR + 168, "color168", "color"),
++ RSTRG (Rs_color + minCOLOR + 169, "color169", "color"),
++ RSTRG (Rs_color + minCOLOR + 170, "color170", "color"),
++ RSTRG (Rs_color + minCOLOR + 171, "color171", "color"),
++ RSTRG (Rs_color + minCOLOR + 172, "color172", "color"),
++ RSTRG (Rs_color + minCOLOR + 173, "color173", "color"),
++ RSTRG (Rs_color + minCOLOR + 174, "color174", "color"),
++ RSTRG (Rs_color + minCOLOR + 175, "color175", "color"),
++ RSTRG (Rs_color + minCOLOR + 176, "color176", "color"),
++ RSTRG (Rs_color + minCOLOR + 177, "color177", "color"),
++ RSTRG (Rs_color + minCOLOR + 178, "color178", "color"),
++ RSTRG (Rs_color + minCOLOR + 179, "color179", "color"),
++ RSTRG (Rs_color + minCOLOR + 180, "color180", "color"),
++ RSTRG (Rs_color + minCOLOR + 181, "color181", "color"),
++ RSTRG (Rs_color + minCOLOR + 182, "color182", "color"),
++ RSTRG (Rs_color + minCOLOR + 183, "color183", "color"),
++ RSTRG (Rs_color + minCOLOR + 184, "color184", "color"),
++ RSTRG (Rs_color + minCOLOR + 185, "color185", "color"),
++ RSTRG (Rs_color + minCOLOR + 186, "color186", "color"),
++ RSTRG (Rs_color + minCOLOR + 187, "color187", "color"),
++ RSTRG (Rs_color + minCOLOR + 188, "color188", "color"),
++ RSTRG (Rs_color + minCOLOR + 189, "color189", "color"),
++ RSTRG (Rs_color + minCOLOR + 190, "color190", "color"),
++ RSTRG (Rs_color + minCOLOR + 191, "color191", "color"),
++ RSTRG (Rs_color + minCOLOR + 192, "color192", "color"),
++ RSTRG (Rs_color + minCOLOR + 193, "color193", "color"),
++ RSTRG (Rs_color + minCOLOR + 194, "color194", "color"),
++ RSTRG (Rs_color + minCOLOR + 195, "color195", "color"),
++ RSTRG (Rs_color + minCOLOR + 196, "color196", "color"),
++ RSTRG (Rs_color + minCOLOR + 197, "color197", "color"),
++ RSTRG (Rs_color + minCOLOR + 198, "color198", "color"),
++ RSTRG (Rs_color + minCOLOR + 199, "color199", "color"),
++ RSTRG (Rs_color + minCOLOR + 200, "color200", "color"),
++ RSTRG (Rs_color + minCOLOR + 201, "color201", "color"),
++ RSTRG (Rs_color + minCOLOR + 202, "color202", "color"),
++ RSTRG (Rs_color + minCOLOR + 203, "color203", "color"),
++ RSTRG (Rs_color + minCOLOR + 204, "color204", "color"),
++ RSTRG (Rs_color + minCOLOR + 205, "color205", "color"),
++ RSTRG (Rs_color + minCOLOR + 206, "color206", "color"),
++ RSTRG (Rs_color + minCOLOR + 207, "color207", "color"),
++ RSTRG (Rs_color + minCOLOR + 208, "color208", "color"),
++ RSTRG (Rs_color + minCOLOR + 209, "color209", "color"),
++ RSTRG (Rs_color + minCOLOR + 210, "color210", "color"),
++ RSTRG (Rs_color + minCOLOR + 211, "color211", "color"),
++ RSTRG (Rs_color + minCOLOR + 212, "color212", "color"),
++ RSTRG (Rs_color + minCOLOR + 213, "color213", "color"),
++ RSTRG (Rs_color + minCOLOR + 214, "color214", "color"),
++ RSTRG (Rs_color + minCOLOR + 215, "color215", "color"),
++ RSTRG (Rs_color + minCOLOR + 216, "color216", "color"),
++ RSTRG (Rs_color + minCOLOR + 217, "color217", "color"),
++ RSTRG (Rs_color + minCOLOR + 218, "color218", "color"),
++ RSTRG (Rs_color + minCOLOR + 219, "color219", "color"),
++ RSTRG (Rs_color + minCOLOR + 220, "color220", "color"),
++ RSTRG (Rs_color + minCOLOR + 221, "color221", "color"),
++ RSTRG (Rs_color + minCOLOR + 222, "color222", "color"),
++ RSTRG (Rs_color + minCOLOR + 223, "color223", "color"),
++ RSTRG (Rs_color + minCOLOR + 224, "color224", "color"),
++ RSTRG (Rs_color + minCOLOR + 225, "color225", "color"),
++ RSTRG (Rs_color + minCOLOR + 226, "color226", "color"),
++ RSTRG (Rs_color + minCOLOR + 227, "color227", "color"),
++ RSTRG (Rs_color + minCOLOR + 228, "color228", "color"),
++ RSTRG (Rs_color + minCOLOR + 229, "color229", "color"),
++ RSTRG (Rs_color + minCOLOR + 230, "color230", "color"),
++ RSTRG (Rs_color + minCOLOR + 231, "color231", "color"),
++ RSTRG (Rs_color + minCOLOR + 232, "color232", "color"),
++ RSTRG (Rs_color + minCOLOR + 233, "color233", "color"),
++ RSTRG (Rs_color + minCOLOR + 234, "color234", "color"),
++ RSTRG (Rs_color + minCOLOR + 235, "color235", "color"),
++ RSTRG (Rs_color + minCOLOR + 236, "color236", "color"),
++ RSTRG (Rs_color + minCOLOR + 237, "color237", "color"),
++ RSTRG (Rs_color + minCOLOR + 238, "color238", "color"),
++ RSTRG (Rs_color + minCOLOR + 239, "color239", "color"),
++ RSTRG (Rs_color + minCOLOR + 240, "color240", "color"),
++ RSTRG (Rs_color + minCOLOR + 241, "color241", "color"),
++ RSTRG (Rs_color + minCOLOR + 242, "color242", "color"),
++ RSTRG (Rs_color + minCOLOR + 243, "color243", "color"),
++ RSTRG (Rs_color + minCOLOR + 244, "color244", "color"),
++ RSTRG (Rs_color + minCOLOR + 245, "color245", "color"),
++ RSTRG (Rs_color + minCOLOR + 246, "color246", "color"),
++ RSTRG (Rs_color + minCOLOR + 247, "color247", "color"),
++ RSTRG (Rs_color + minCOLOR + 248, "color248", "color"),
++ RSTRG (Rs_color + minCOLOR + 249, "color249", "color"),
++ RSTRG (Rs_color + minCOLOR + 250, "color250", "color"),
++ RSTRG (Rs_color + minCOLOR + 251, "color251", "color"),
++ RSTRG (Rs_color + minCOLOR + 252, "color252", "color"),
++ RSTRG (Rs_color + minCOLOR + 253, "color253", "color"),
++ RSTRG (Rs_color + minCOLOR + 254, "color254", "color"),
++ RSTRG (Rs_color + minCOLOR + 255, "color255", "color"),
++#endif
+ RSTRG (Rs_color + minBrightCOLOR + 0, "color8", "color"),
+ RSTRG (Rs_color + minBrightCOLOR + 1, "color9", "color"),
+ RSTRG (Rs_color + minBrightCOLOR + 2, "color10", "color"),
diff --git a/pkgs/applications/misc/spacefm/default.nix b/pkgs/applications/misc/spacefm/default.nix
index e1f98fceace..7dbe723d9eb 100644
--- a/pkgs/applications/misc/spacefm/default.nix
+++ b/pkgs/applications/misc/spacefm/default.nix
@@ -15,9 +15,9 @@ in stdenv.mkDerivation rec {
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/taskwarrior/default.nix b/pkgs/applications/misc/taskwarrior/default.nix
index dc1fce1d64c..998c34e5610 100644
--- a/pkgs/applications/misc/taskwarrior/default.nix
+++ b/pkgs/applications/misc/taskwarrior/default.nix
@@ -1,17 +1,17 @@
-{stdenv, fetchurl, cmake}:
+{ stdenv, fetchurl, cmake, libuuid }:
stdenv.mkDerivation rec {
name = "taskwarrior-${version}";
- version = "2.2.0";
+ version = "2.3.0";
enableParallelBuilding = true;
src = fetchurl {
url = "http://www.taskwarrior.org/download/task-${version}.tar.gz";
- sha256 = "057fh50qp9bd5s08rw51iybpamn55v5nhn3s6ds89g76hp95vqir";
+ sha256 = "0wxcfq0n96vmcbwrlk2x377k8cc5k4i64ca6p02y74g6168ji6ib";
};
- nativeBuildInputs = [ cmake ];
+ nativeBuildInputs = [ cmake libuuid ];
meta = {
description = "GTD (getting things done) implementation";
diff --git a/pkgs/applications/misc/vifm/default.nix b/pkgs/applications/misc/vifm/default.nix
index 4af565d717a..5abf57ae1fc 100644
--- a/pkgs/applications/misc/vifm/default.nix
+++ b/pkgs/applications/misc/vifm/default.nix
@@ -2,17 +2,16 @@
let
name = "vifm-${version}";
- version = "0.7.6";
+ version = "0.7.7";
in stdenv.mkDerivation {
inherit name;
src = fetchurl {
- url="mirror://sourceforge/project/vifm/vifm/${name}.tar.bz2";
- sha256 ="03v50hmgfvrci5fz31zmklmp6ix7qpqnhvm6639wbk3g5mcrh5w6";
+ url = "mirror://sourceforge/project/vifm/vifm/${name}.tar.bz2";
+ sha256 = "1lflmkd5q7qqi9d44py0y41pcx5bsadkihn3gc0x5cka04f2gh0d";
};
- #phaseNames = ["doConfigure" "doMakeInstall"];
buildInputs = [ utillinux ncurses file libX11 ];
meta = {
diff --git a/pkgs/applications/misc/xca/default.nix b/pkgs/applications/misc/xca/default.nix
index fb6b011f30a..0bc2170340c 100644
--- a/pkgs/applications/misc/xca/default.nix
+++ b/pkgs/applications/misc/xca/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, which, openssl, qt4, libtool }:
+{ stdenv, fetchurl, pkgconfig, which, openssl, qt4, libtool, gcc, makeWrapper }:
stdenv.mkDerivation rec {
name = "xca-${version}";
@@ -15,7 +15,12 @@ stdenv.mkDerivation rec {
prefix=$out ./configure ${openssl} ${libtool}
'';
- buildInputs = [ openssl qt4 libtool ];
+ postInstall = ''
+ wrapProgram "$out/bin/xca" \
+ --prefix LD_LIBRARY_PATH : "${qt4}/lib:${gcc.gcc}/lib:${gcc.gcc}/lib64:${openssl}/lib:${libtool}/lib"
+ '';
+
+ buildInputs = [ openssl qt4 libtool gcc makeWrapper ];
nativeBuildInputs = [ pkgconfig ];
meta = with stdenv.lib; {
diff --git a/pkgs/applications/misc/xmobar/default.nix b/pkgs/applications/misc/xmobar/default.nix
index a7aeed339e2..acd0568772a 100644
--- a/pkgs/applications/misc/xmobar/default.nix
+++ b/pkgs/applications/misc/xmobar/default.nix
@@ -1,5 +1,6 @@
-{ cabal, alsaCore, alsaMixer, filepath, HTTP, libXrandr, mtl
-, parsec, regexCompat, stm, time, utf8String, wirelesstools, X11
+{ cabal, alsaCore, alsaMixer, dbus, filepath, hinotify, HTTP
+, libmpd, libXrandr, mtl, parsec, regexCompat, stm, time
+, timezoneOlson, timezoneSeries, utf8String, wirelesstools, X11
, X11Xft
}:
@@ -10,11 +11,12 @@ cabal.mkDerivation (self: {
isLibrary = false;
isExecutable = true;
buildDepends = [
- alsaCore alsaMixer filepath HTTP mtl parsec regexCompat stm time
- utf8String X11 X11Xft
+ alsaCore alsaMixer dbus filepath hinotify HTTP libmpd mtl parsec
+ regexCompat stm time timezoneOlson timezoneSeries utf8String X11
+ X11Xft
];
extraLibraries = [ libXrandr wirelesstools ];
- configureFlags = "-fwith_xft -fwith_iwlib -fwith_alsa";
+ configureFlags = "-fall_extensions";
meta = {
homepage = "http://projects.haskell.org/xmobar/";
description = "A Minimalistic Text Based Status Bar";
diff --git a/pkgs/applications/misc/zathura/default.nix b/pkgs/applications/misc/zathura/default.nix
index f943bff7bf0..1a4ab3d772c 100644
--- a/pkgs/applications/misc/zathura/default.nix
+++ b/pkgs/applications/misc/zathura/default.nix
@@ -1,4 +1,4 @@
-{ callPackage, pkgs, fetchurl }:
+{ callPackage, pkgs, fetchurl, useMupdf }:
rec {
inherit (pkgs) stdenv;
@@ -12,6 +12,10 @@ rec {
zathura_pdf_poppler = callPackage ./pdf-poppler { };
+ zathura_pdf_mupdf = callPackage ./pdf-mupdf {
+ gtk = pkgs.gtk3;
+ };
+
zathura_djvu = callPackage ./djvu {
gtk = pkgs.gtk3;
};
@@ -27,9 +31,9 @@ rec {
name = "zathura-${zathura_core.version}";
plugins_path = stdenv.lib.makeSearchPath "lib" [
- zathura_pdf_poppler
zathura_djvu
zathura_ps
+ (if useMupdf then zathura_pdf_mupdf else zathura_pdf_poppler)
];
builder = ./builder.sh;
diff --git a/pkgs/applications/misc/zathura/pdf-mupdf/config.patch b/pkgs/applications/misc/zathura/pdf-mupdf/config.patch
new file mode 100644
index 00000000000..c7d172c9263
--- /dev/null
+++ b/pkgs/applications/misc/zathura/pdf-mupdf/config.patch
@@ -0,0 +1,17 @@
+--- zathura-pdf-mupdf-0.2.6/config.mk
++++ zathura-pdf-mupdf-0.2.6/config.mk
+@@ -32,10 +32,11 @@
+ OPENSSL_INC ?= $(shell pkg-config --cflags libcrypto)
+ OPENSSL_LIB ?= $(shell pkg-config --libs libcrypto)
+
+-MUPDF_LIB ?= -lmupdf -lmupdf-js-none
++MUPDF_INC ?= $(shell pkg-config --cflags mupdf)
++MUPDF_LIB ?= $(shell pkg-config --libs mupdf)
+
+-INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC}
+-LIBS = ${GTK_LIB} ${GIRARA_LIB} ${MUPDF_LIB} ${OPENSSL_LIB} -ljbig2dec -lopenjp2 -ljpeg
++INCS = ${GTK_INC} ${GIRARA_INC} ${OPENSSL_INC} ${ZATHURA_INC} ${MUPDF_INC}
++LIBS = ${GTK_LIB} ${GIRARA_LIB} ${OPENSSL_LIB} ${MUPDF_LIB} -ljbig2dec -ljpeg
+
+ # flags
+ CFLAGS += -std=c99 -fPIC -pedantic -Wall -Wno-format-zero-length $(INCS)
diff --git a/pkgs/applications/misc/zathura/pdf-mupdf/default.nix b/pkgs/applications/misc/zathura/pdf-mupdf/default.nix
new file mode 100644
index 00000000000..4e585d852a2
--- /dev/null
+++ b/pkgs/applications/misc/zathura/pdf-mupdf/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, pkgconfig, zathura_core, gtk, girara, mupdf, openssl, openjpeg, libjpeg, jbig2dec }:
+
+stdenv.mkDerivation rec {
+ version = "0.2.6";
+ name = "zathura-pdf-mupdf-${version}";
+
+ src = fetchurl {
+ url = "http://pwmt.org/projects/zathura/plugins/download/${name}.tar.gz";
+ sha256 = "5df94b6f906008b5f3bca770a552da6d2917d6b8d3e4b3049cb7001302041b20";
+ };
+
+ buildInputs = [ pkgconfig zathura_core gtk girara openssl mupdf openjpeg libjpeg jbig2dec ];
+
+ makeFlags = "PREFIX=$(out) PLUGINDIR=$(out)/lib";
+
+ preConfigure = "patch -p1 < ${./config.patch}";
+
+ meta = {
+ homepage = http://pwmt.org/projects/zathura/;
+ description = "A zathura PDF plugin (mupdf)";
+ longDescription = ''
+ The zathura-pdf-mupdf plugin adds PDF support to zathura by
+ using the mupdf rendering library.
+ '';
+ license = stdenv.lib.licenses.zlib;
+ platforms = stdenv.lib.platforms.linux;
+# maintainers = [ ];
+ };
+}
diff --git a/pkgs/applications/misc/zathura/pdf-poppler/default.nix b/pkgs/applications/misc/zathura/pdf-poppler/default.nix
index ce4894e6c0f..6625bf47194 100644
--- a/pkgs/applications/misc/zathura/pdf-poppler/default.nix
+++ b/pkgs/applications/misc/zathura/pdf-poppler/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, zathura_core, girara, poppler, gettext }:
+{ stdenv, fetchurl, pkgconfig, zathura_core, girara, poppler }:
stdenv.mkDerivation rec {
version = "0.2.5";
@@ -9,16 +9,16 @@ stdenv.mkDerivation rec {
sha256 = "1b0chsds8iwjm4g629p6a67nb6wgra65pw2vvngd7g35dmcjgcv0";
};
- buildInputs = [ pkgconfig poppler gettext zathura_core girara ];
+ buildInputs = [ pkgconfig poppler zathura_core girara ];
makeFlags = "PREFIX=$(out) PLUGINDIR=$(out)/lib";
meta = {
homepage = http://pwmt.org/projects/zathura/;
- description = "A zathura PDF plugin";
+ description = "A zathura PDF plugin (poppler)";
longDescription = ''
The zathura-pdf-poppler plugin adds PDF support to zathura by
- using the poppler rendering engine.
+ using the poppler rendering library.
'';
license = stdenv.lib.licenses.zlib;
platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/applications/networking/bittorrentsync/default.nix b/pkgs/applications/networking/bittorrentsync/default.nix
index c260b75c9fe..abb94a32bd7 100644
--- a/pkgs/applications/networking/bittorrentsync/default.nix
+++ b/pkgs/applications/networking/bittorrentsync/default.nix
@@ -5,15 +5,15 @@ let
else if stdenv.system == "i686-linux" then "i386"
else throw "Bittorrent Sync for: ${stdenv.system} not supported!";
- sha256 = if stdenv.system == "x86_64-linux" then "1x95pag8ncjx3svm4424fjk5nmbdg8m87fsxy9sc63ba3qs9645j"
- else if stdenv.system == "i686-linux" then "0l8d85ib6kbpz5sh9v0qga03i4xph61iiy9xlhazm9h30d5a6l8v"
+ sha256 = if stdenv.system == "x86_64-linux" then "1xba0wv45w4kg84i5sywkfk44vj9wxkr7f1vga2mpz86j8vq25iy"
+ else if stdenv.system == "i686-linux" then "10ml1wclix9236zcb4mh60hdm9vvfaarlb62z7fdrwk6ikqbm7fk"
else throw "Bittorrent Sync for: ${stdenv.system} not supported!";
libPath = stdenv.lib.makeLibraryPath [ stdenv.gcc.libc ];
in
stdenv.mkDerivation rec {
name = "btsync-${version}";
- version = "1.3.77";
+ version = "1.3.94";
src = fetchurl {
url = "http://syncapp.bittorrent.com/${version}/btsync_${arch}-${version}.tar.gz";
diff --git a/pkgs/applications/networking/browsers/chromium/browser.nix b/pkgs/applications/networking/browsers/chromium/browser.nix
new file mode 100644
index 00000000000..a4b99bc5802
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/browser.nix
@@ -0,0 +1,40 @@
+{ stdenv, mkChromiumDerivation }:
+
+with stdenv.lib;
+
+mkChromiumDerivation (base: rec {
+ name = "chromium-browser";
+ packageName = "chromium";
+ buildTargets = [ "chrome" ];
+
+ installPhase = ''
+ ensureDir "$libExecPath"
+ cp -v "$buildPath/"*.pak "$libExecPath/"
+ cp -v "$buildPath/icudtl.dat" "$libExecPath/"
+ cp -vR "$buildPath/locales" "$buildPath/resources" "$libExecPath/"
+ cp -v $buildPath/libffmpegsumo.so "$libExecPath/"
+
+ cp -v "$buildPath/chrome" "$libExecPath/$packageName"
+
+ mkdir -vp "$out/share/man/man1"
+ cp -v "$buildPath/chrome.1" "$out/share/man/man1/$packageName.1"
+
+ for icon_file in chrome/app/theme/chromium/product_logo_*[0-9].png; do
+ num_and_suffix="''${icon_file##*logo_}"
+ icon_size="''${num_and_suffix%.*}"
+ expr "$icon_size" : "^[0-9][0-9]*$" || continue
+ logo_output_prefix="$out/share/icons/hicolor"
+ logo_output_path="$logo_output_prefix/''${icon_size}x''${icon_size}/apps"
+ mkdir -vp "$logo_output_path"
+ cp -v "$icon_file" "$logo_output_path/$packageName.png"
+ done
+ '';
+
+ meta = {
+ description = "An open source web browser from Google";
+ homepage = http://www.chromium.org/;
+ maintainers = with maintainers; [ goibhniu chaoflow aszlig wizeman ];
+ license = licenses.bsd3;
+ platforms = platforms.linux;
+ };
+})
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
new file mode 100644
index 00000000000..69e54e25c37
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -0,0 +1,206 @@
+{ stdenv, fetchurl, ninja, which
+
+# default dependencies
+, bzip2, flac, speex, icu, libopus
+, libevent, expat, libjpeg, snappy
+, libpng, libxml2, libxslt
+, xdg_utils, yasm, minizip, libwebp
+, libusb1, libexif, pciutils
+
+, python, pythonPackages, perl, pkgconfig
+, nspr, udev, krb5
+, utillinux, alsaLib
+, gcc, bison, gperf
+, glib, gtk, dbus_glib
+, libXScrnSaver, libXcursor, libXtst, mesa
+, protobuf, speechd, libXdamage
+
+# optional dependencies
+, libgcrypt ? null # gnomeSupport || cupsSupport
+
+# package customization
+, enableSELinux ? false, libselinux ? null
+, enableNaCl ? false
+, useOpenSSL ? false, nss ? null, openssl ? null
+, gnomeSupport ? false, gnome ? null
+, gnomeKeyringSupport ? false, libgnome_keyring3 ? null
+, proprietaryCodecs ? true
+, cupsSupport ? false
+, pulseSupport ? false, pulseaudio ? null
+
+, source
+, plugins
+}:
+
+buildFun:
+
+with stdenv.lib;
+
+let
+ # The additional attributes for creating derivations based on the chromium
+ # source tree.
+ extraAttrs = buildFun base;
+
+ mkGypFlags =
+ let
+ sanitize = value:
+ if value == true then "1"
+ else if value == false then "0"
+ else "${value}";
+ toFlag = key: value: "-D${key}=${sanitize value}";
+ in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs));
+
+ gypFlagsUseSystemLibs = {
+ use_system_bzip2 = true;
+ use_system_flac = true;
+ use_system_libevent = true;
+ use_system_libexpat = true;
+ use_system_libexif = true;
+ use_system_libjpeg = true;
+ use_system_libpng = true;
+ use_system_libwebp = true;
+ use_system_libxml = true;
+ use_system_opus = true;
+ use_system_snappy = true;
+ use_system_speex = true;
+ use_system_ssl = useOpenSSL;
+ use_system_stlport = true;
+ use_system_xdg_utils = true;
+ use_system_yasm = true;
+ use_system_zlib = false;
+ use_system_protobuf = true;
+
+ use_system_harfbuzz = false;
+ use_system_icu = false; # Doesn't support ICU 52 yet.
+ use_system_libusb = false; # http://crbug.com/266149
+ use_system_skia = false;
+ use_system_sqlite = false; # http://crbug.com/22208
+ use_system_v8 = false;
+ };
+
+ opusWithCustomModes = libopus.override {
+ withCustomModes = !versionOlder source.version "35.0.0.0";
+ };
+
+ defaultDependencies = [
+ bzip2 flac speex icu opusWithCustomModes
+ libevent expat libjpeg snappy
+ libpng libxml2 libxslt
+ xdg_utils yasm minizip libwebp
+ libusb1 libexif
+ ];
+
+ # build paths and release info
+ packageName = extraAttrs.packageName or extraAttrs.name;
+ buildType = "Release";
+ buildPath = "out/${buildType}";
+ libExecPath = "$out/libexec/${packageName}";
+
+ base = rec {
+ name = "${packageName}-${version}";
+ inherit (source) version;
+ inherit packageName buildType buildPath;
+ src = source;
+
+ buildInputs = defaultDependencies ++ [
+ which
+ python perl pkgconfig
+ nspr udev
+ (if useOpenSSL then openssl else nss)
+ utillinux alsaLib
+ gcc bison gperf krb5
+ glib gtk dbus_glib
+ libXScrnSaver libXcursor libXtst mesa
+ pciutils protobuf speechd libXdamage
+ pythonPackages.gyp pythonPackages.ply pythonPackages.jinja2
+ ] ++ optional gnomeKeyringSupport libgnome_keyring3
+ ++ optionals gnomeSupport [ gnome.GConf libgcrypt ]
+ ++ optional enableSELinux libselinux
+ ++ optional cupsSupport libgcrypt
+ ++ optional pulseSupport pulseaudio;
+
+ # XXX: Wait for https://crbug.com/239107 and https://crbug.com/239181 to
+ # be fixed, then try again to unbundle everything into separate
+ # derivations.
+ prePatch = ''
+ cp -dsr --no-preserve=mode "${source.main}"/* .
+ cp -dsr --no-preserve=mode "${source.sandbox}" sandbox
+ cp -dr "${source.bundled}" third_party
+ chmod -R u+w third_party
+
+ # Hardcode source tree root in all gyp files
+ find -iname '*.gyp*' \( -type f -o -type l \) \
+ -exec sed -i -e 's|<(DEPTH)|'"$(pwd)"'|g' {} + \
+ -exec chmod u+w {} +
+ '';
+
+ postPatch = let
+ toPatch = if versionOlder source.version "36.0.0.0"
+ then "content/browser/browser_main_loop.cc"
+ else "sandbox/linux/suid/client/setuid_sandbox_client.cc";
+ in ''
+ sed -i -e '/base::FilePath exe_dir/,/^ *} *$/c \
+ sandbox_binary = base::FilePath(getenv("CHROMIUM_SANDBOX_BINARY_PATH"));
+ ' ${toPatch}
+ '';
+
+ gypFlags = mkGypFlags (gypFlagsUseSystemLibs // {
+ linux_use_gold_binary = false;
+ linux_use_gold_flags = false;
+ proprietary_codecs = false;
+ use_gnome_keyring = gnomeKeyringSupport;
+ use_gconf = gnomeSupport;
+ use_gio = gnomeSupport;
+ use_pulseaudio = pulseSupport;
+ linux_link_pulseaudio = pulseSupport;
+ disable_nacl = !enableNaCl;
+ use_openssl = useOpenSSL;
+ selinux = enableSELinux;
+ use_cups = cupsSupport;
+ linux_sandbox_chrome_path="${libExecPath}/${packageName}";
+ werror = "";
+
+ # Google API keys, see:
+ # http://www.chromium.org/developers/how-tos/api-keys
+ # Note: These are for NixOS/nixpkgs use ONLY. For your own distribution,
+ # please get your own set of keys.
+ google_api_key = "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI";
+ google_default_client_id = "404761575300.apps.googleusercontent.com";
+ google_default_client_secret = "9rIFQjfnkykEmqb6FfjJQD1D";
+
+ } // optionalAttrs proprietaryCodecs {
+ # enable support for the H.264 codec
+ proprietary_codecs = true;
+ ffmpeg_branding = "Chrome";
+ } // optionalAttrs (stdenv.system == "x86_64-linux") {
+ target_arch = "x64";
+ python_arch = "x86-64";
+ } // optionalAttrs (stdenv.system == "i686-linux") {
+ target_arch = "ia32";
+ python_arch = "ia32";
+ } // (extraAttrs.gypFlags or {}));
+
+ configurePhase = ''
+ # This is to ensure expansion of $out.
+ libExecPath="${libExecPath}"
+ python build/linux/unbundle/replace_gyp_files.py ${gypFlags}
+ python build/gyp_chromium -f ninja --depth "$(pwd)" ${gypFlags}
+ '';
+
+ buildPhase = let
+ CC = "${gcc}/bin/gcc";
+ CXX = "${gcc}/bin/g++";
+ in ''
+ CC="${CC}" CC_host="${CC}" \
+ CXX="${CXX}" CXX_host="${CXX}" \
+ LINK_host="${CXX}" \
+ "${ninja}/bin/ninja" -C "${buildPath}" \
+ -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \
+ ${concatStringsSep " " (extraAttrs.buildTargets or [])}
+ '';
+ };
+
+# Remove some extraAttrs we supplied to the base attributes already.
+in stdenv.mkDerivation (base // removeAttrs extraAttrs [
+ "name" "gypFlags" "buildTargets"
+])
diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix
index 213e75ee6ef..44fd3c69e53 100644
--- a/pkgs/applications/networking/browsers/chromium/default.nix
+++ b/pkgs/applications/networking/browsers/chromium/default.nix
@@ -1,287 +1,86 @@
-{ stdenv, fetchurl, makeWrapper, ninja, which
-
-# default dependencies
-, bzip2, flac, speex
-, libevent, expat, libjpeg
-, libpng, libxml2, libxslt
-, xdg_utils, yasm, zlib
-, libusb1, libexif, pciutils
-
-, python, pythonPackages, perl, pkgconfig
-, nspr, udev, krb5
-, utillinux, alsaLib
-, gcc, bison, gperf
-, glib, gtk, dbus_glib
-, libXScrnSaver, libXcursor, libXtst, mesa
-, protobuf, speechd, libXdamage
-
-# optional dependencies
-, libgcrypt ? null # gnomeSupport || cupsSupport
+{ newScope, stdenv, makeWrapper, makeDesktopItem
# package customization
, channel ? "stable"
-, enableSELinux ? false, libselinux ? null
+, enableSELinux ? false
, enableNaCl ? false
-, useOpenSSL ? false, nss ? null, openssl ? null
-, gnomeSupport ? false, gconf ? null
-, gnomeKeyringSupport ? false, libgnome_keyring ? null
+, useOpenSSL ? false
+, gnomeSupport ? false
+, gnomeKeyringSupport ? false
, proprietaryCodecs ? true
+, enablePepperFlash ? false
+, enablePepperPDF ? false
, cupsSupport ? false
-, pulseSupport ? false, pulseaudio ? null
+, pulseSupport ? false
}:
-with stdenv.lib;
-
let
- src = with getAttr channel (import ./sources.nix); stdenv.mkDerivation {
- name = "chromium-source-${version}";
+ callPackage = newScope chromium;
- src = fetchurl {
- inherit url sha256;
+ chromium = {
+ source = callPackage ./source {
+ inherit channel;
+ # XXX: common config
+ inherit useOpenSSL;
};
- buildInputs = [ python ]; # cannot patch shebangs otherwise
+ mkChromiumDerivation = callPackage ./common.nix {
+ inherit enableSELinux enableNaCl useOpenSSL gnomeSupport
+ gnomeKeyringSupport proprietaryCodecs cupsSupport
+ pulseSupport;
+ };
- phases = [ "unpackPhase" "patchPhase" "installPhase" ];
+ browser = callPackage ./browser.nix { };
+ sandbox = callPackage ./sandbox.nix { };
- opensslPatches = optional useOpenSSL openssl.patches;
-
- prePatch = "patchShebangs .";
-
- patches = singleton ./sandbox_userns_31.patch;
-
- postPatch = ''
- 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 ''
- 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" ];
- installPhase = ''
- ensureDir "$out" "$sandbox" "$bundled" "$main"
-
- header "copying browser main sources to $main"
- find . -mindepth 1 -maxdepth 1 \
- \! -path ./sandbox \
- \! -path ./third_party \
- \! -path ./build \
- \! -path ./tools \
- \! -name '.*' \
- -print | xargs cp -rt "$main"
- stopNest
-
- header "copying sandbox components to $sandbox"
- cp -rt "$sandbox" sandbox/*
- stopNest
-
- header "copying third party sources to $bundled"
- cp -rt "$bundled" third_party/*
- stopNest
-
- header "copying build requisites to $out"
- cp -rt "$out" build tools
- stopNest
-
- rm -rf "$out/tools/gyp" # XXX: Don't even copy it in the first place.
- '';
-
- passthru = {
- inherit version;
+ plugins = callPackage ./plugins.nix {
+ inherit enablePepperFlash enablePepperPDF;
};
};
- mkGypFlags =
- let
- sanitize = value:
- if value == true then "1"
- else if value == false then "0"
- else "${value}";
- toFlag = key: value: "-D${key}=${sanitize value}";
- in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs));
-
- gypFlagsUseSystemLibs = {
- use_system_bzip2 = true;
- use_system_flac = true;
- use_system_libevent = true;
- use_system_libexpat = true;
- use_system_libexif = true;
- use_system_libjpeg = true;
- use_system_libpng = false; # PNG dlopen() version conflict
- use_system_libusb = true;
- use_system_libxml = true;
- use_system_speex = true;
- use_system_ssl = useOpenSSL;
- use_system_stlport = true;
- use_system_xdg_utils = true;
- use_system_yasm = true;
- use_system_zlib = false; # http://crbug.com/143623
- use_system_protobuf = true;
-
- use_system_harfbuzz = false;
- use_system_icu = false;
- use_system_libwebp = false; # http://crbug.com/133161
- use_system_skia = false;
- use_system_sqlite = false; # http://crbug.com/22208
- use_system_v8 = false;
+ desktopItem = makeDesktopItem {
+ name = "chromium";
+ exec = "chromium";
+ icon = "${chromium.browser}/share/icons/hicolor/48x48/apps/chromium.png";
+ comment = "An open source web browser from Google";
+ desktopName = "Chromium";
+ genericName = "Web browser";
+ mimeType = stdenv.lib.concatStringsSep ";" [
+ "text/html"
+ "text/xml"
+ "application/xhtml+xml"
+ "x-scheme-handler/http"
+ "x-scheme-handler/https"
+ "x-scheme-handler/ftp"
+ "x-scheme-handler/mailto"
+ "x-scheme-handler/webcal"
+ ];
+ categories = "Network;WebBrowser";
};
- defaultDependencies = [
- bzip2 flac speex
- libevent expat libjpeg
- libpng libxml2 libxslt
- xdg_utils yasm zlib
- libusb1 libexif
- ];
+in stdenv.mkDerivation {
+ name = "chromium-${channel}-${chromium.browser.version}";
- sandbox = import ./sandbox.nix {
- inherit stdenv;
- src = src.sandbox;
- binary = "${packageName}_sandbox";
- };
+ buildInputs = [ makeWrapper ];
- # build paths and release info
- packageName = "chromium";
- buildType = "Release";
- buildPath = "out/${buildType}";
- libExecPath = "$out/libexec/${packageName}";
- sandboxPath = "${sandbox}/bin/${packageName}_sandbox";
-
-in stdenv.mkDerivation rec {
- name = "${packageName}-${src.version}";
- inherit packageName src;
-
- buildInputs = defaultDependencies ++ [
- which makeWrapper
- python perl pkgconfig
- nspr udev
- (if useOpenSSL then openssl else nss)
- utillinux alsaLib
- gcc bison gperf krb5
- glib gtk dbus_glib
- libXScrnSaver libXcursor libXtst mesa
- pciutils protobuf speechd libXdamage
- pythonPackages.gyp
- ] ++ optional gnomeKeyringSupport libgnome_keyring
- ++ optionals gnomeSupport [ gconf libgcrypt ]
- ++ optional enableSELinux libselinux
- ++ optional cupsSupport libgcrypt
- ++ optional pulseSupport pulseaudio;
-
- prePatch = ''
- # XXX: Figure out a way how to split these properly.
- #cpflags="-dsr --no-preserve=mode"
- cpflags="-dr"
- cp $cpflags "${src.main}"/* .
- cp $cpflags "${src.bundled}" third_party
- cp $cpflags "${src.sandbox}" sandbox
- chmod -R u+w . # XXX!
- '';
-
- postPatch = ''
- sed -i -e '/base::FilePath exe_dir/,/^ *} *$/c \
- sandbox_binary = \
- base::FilePath("'"${sandboxPath}"'");
- ' content/browser/browser_main_loop.cc
- '';
-
- gypFlags = mkGypFlags (gypFlagsUseSystemLibs // {
- linux_use_gold_binary = false;
- linux_use_gold_flags = false;
- proprietary_codecs = false;
- use_gnome_keyring = gnomeKeyringSupport;
- use_gconf = gnomeSupport;
- use_gio = gnomeSupport;
- use_pulseaudio = pulseSupport;
- disable_nacl = !enableNaCl;
- use_openssl = useOpenSSL;
- selinux = enableSELinux;
- use_cups = cupsSupport;
- linux_sandbox_path="${sandboxPath}";
- linux_sandbox_chrome_path="${libExecPath}/${packageName}";
- werror = "";
-
- # Google API keys, see http://www.chromium.org/developers/how-tos/api-keys.
- # Note: These are for NixOS/nixpkgs use ONLY. For your own distribution,
- # please get your own set of keys.
- google_api_key = "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI";
- google_default_client_id = "404761575300.apps.googleusercontent.com";
- google_default_client_secret = "9rIFQjfnkykEmqb6FfjJQD1D";
-
- } // optionalAttrs proprietaryCodecs {
- # enable support for the H.264 codec
- proprietary_codecs = true;
- ffmpeg_branding = "Chrome";
- } // optionalAttrs (stdenv.system == "x86_64-linux") {
- target_arch = "x64";
- python_arch = "x86-64";
- } // optionalAttrs (stdenv.system == "i686-linux") {
- target_arch = "ia32";
- python_arch = "ia32";
- });
-
- configurePhase = ''
- python build/gyp_chromium -f ninja --depth "$(pwd)" ${gypFlags}
- '';
-
- buildPhase = let
- CC = "${gcc}/bin/gcc";
- CXX = "${gcc}/bin/g++";
+ buildCommand = let
+ browserBinary = "${chromium.browser}/libexec/chromium/chromium";
+ sandboxBinary = "${chromium.sandbox}/bin/chromium-sandbox";
in ''
- CC="${CC}" CC_host="${CC}" \
- CXX="${CXX}" CXX_host="${CXX}" \
- LINK_host="${CXX}" \
- "${ninja}/bin/ninja" -C "${buildPath}" \
- -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \
- chrome ${optionalString (!enableSELinux) "chrome_sandbox"}
+ ensureDir "$out/bin" "$out/share/applications"
+
+ ln -s "${chromium.browser}/share" "$out/share"
+ makeWrapper "${browserBinary}" "$out/bin/chromium" \
+ --set CHROMIUM_SANDBOX_BINARY_PATH "${sandboxBinary}" \
+ --add-flags "${chromium.plugins.flagsEnabled}"
+
+ ln -s "${chromium.browser}/share/icons" "$out/share/icons"
+ cp -v "${desktopItem}/share/applications/"* "$out/share/applications"
'';
- installPhase = ''
- ensureDir "${libExecPath}"
- cp -v "${buildPath}/"*.pak "${libExecPath}/"
- ${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}/"
-
- cp -v "${buildPath}/chrome" "${libExecPath}/${packageName}"
-
- mkdir -vp "$out/bin"
- makeWrapper "${libExecPath}/${packageName}" "$out/bin/${packageName}"
-
- mkdir -vp "$out/share/man/man1"
- cp -v "${buildPath}/chrome.1" "$out/share/man/man1/${packageName}.1"
-
- for icon_file in chrome/app/theme/chromium/product_logo_*[0-9].png; do
- num_and_suffix="''${icon_file##*logo_}"
- icon_size="''${num_and_suffix%.*}"
- expr "$icon_size" : "^[0-9][0-9]*$" || continue
- logo_output_prefix="$out/share/icons/hicolor"
- logo_output_path="$logo_output_prefix/''${icon_size}x''${icon_size}/apps"
- mkdir -vp "$logo_output_path"
- cp -v "$icon_file" "$logo_output_path/${packageName}.png"
- done
- '';
+ inherit (chromium.browser) meta packageName;
passthru = {
- inherit sandbox;
- };
-
- meta = {
- description = "An open source web browser from Google";
- homepage = http://www.chromium.org/;
- maintainers = with maintainers; [ goibhniu chaoflow aszlig wizeman ];
- license = licenses.bsd3;
- platforms = platforms.linux;
+ mkDerivation = chromium.mkChromiumDerivation;
};
}
diff --git a/pkgs/applications/networking/browsers/chromium/plugins.nix b/pkgs/applications/networking/browsers/chromium/plugins.nix
new file mode 100644
index 00000000000..f760b06fe24
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/plugins.nix
@@ -0,0 +1,78 @@
+{ stdenv
+, enablePepperFlash ? false
+, enablePepperPDF ? false
+
+, source
+}:
+
+with stdenv.lib;
+
+let
+ plugins = stdenv.mkDerivation {
+ name = "chromium-binary-plugins";
+
+ # XXX: Only temporary and has to be version-specific
+ src = source.plugins;
+
+ phases = [ "unpackPhase" "patchPhase" "checkPhase" "installPhase" ];
+ outputs = [ "pdf" "flash" ];
+
+ unpackCmd = let
+ chan = if source.channel == "dev" then "chrome-unstable"
+ else if source.channel == "stable" then "chrome"
+ else "chrome-${source.channel}";
+ in ''
+ ensureDir plugins
+ ar p "$src" data.tar.lzma | tar xJ -C plugins --strip-components=4 \
+ ./opt/google/${chan}/PepperFlash \
+ ./opt/google/${chan}/libpdf.so
+ '';
+
+ doCheck = true;
+ checkPhase = ''
+ ! find -iname '*.so' -exec ldd {} + | grep 'not found'
+ '';
+
+ patchPhase = let
+ rpaths = [ stdenv.gcc.gcc ];
+ mkrpath = p: "${makeSearchPath "lib64" p}:${makeSearchPath "lib" p}";
+ in ''
+ for sofile in PepperFlash/libpepflashplayer.so libpdf.so; do
+ chmod +x "$sofile"
+ patchelf --set-rpath "${mkrpath rpaths}" "$sofile"
+ done
+ '';
+
+ installPhase = let
+ pdfName = "Chrome PDF Viewer";
+ pdfDescription = "Portable Document Format";
+ pdfMimeTypes = concatStringsSep ";" [
+ "application/pdf"
+ "application/x-google-chrome-print-preview-pdf"
+ ];
+ pdfInfo = "#${pdfName}#${pdfDescription};${pdfMimeTypes}";
+ in ''
+ install -vD libpdf.so "$pdf/lib/libpdf.so"
+ ensureDir "$pdf/nix-support"
+ echo "--register-pepper-plugins='$pdf/lib/libpdf.so${pdfInfo}'" \
+ > "$pdf/nix-support/chromium-flags"
+
+ flashVersion="$(
+ sed -n -r 's/.*"version": "([^"]+)",.*/\1/p' PepperFlash/manifest.json
+ )"
+
+ install -vD PepperFlash/libpepflashplayer.so \
+ "$flash/lib/libpepflashplayer.so"
+ ensureDir "$flash/nix-support"
+ echo "--ppapi-flash-path='$flash/lib/libpepflashplayer.so'" \
+ "--ppapi-flash-version=$flashVersion" \
+ > "$flash/nix-support/chromium-flags"
+ '';
+
+ passthru.flagsEnabled = let
+ enabledPlugins = optional enablePepperFlash plugins.flash
+ ++ optional enablePepperPDF plugins.pdf;
+ getFlags = plugin: "$(< ${plugin}/nix-support/chromium-flags)";
+ in concatStringsSep " " (map getFlags enabledPlugins);
+ };
+in plugins
diff --git a/pkgs/applications/networking/browsers/chromium/sandbox.nix b/pkgs/applications/networking/browsers/chromium/sandbox.nix
index b43385e8633..b470ed63325 100644
--- a/pkgs/applications/networking/browsers/chromium/sandbox.nix
+++ b/pkgs/applications/networking/browsers/chromium/sandbox.nix
@@ -1,12 +1,13 @@
-{ stdenv, src, binary }:
+{ stdenv, source }:
stdenv.mkDerivation {
- name = "chromium-sandbox-${src.version}";
- inherit src;
+ name = "chromium-sandbox-${source.version}";
+ src = source.sandbox;
patchPhase = ''
sed -i -e '/#include.*base_export/c \
#define BASE_EXPORT __attribute__((visibility("default")))
+ /#include/s|sandbox/linux|'"$(pwd)"'/linux|
' linux/suid/*.[hc]
'';
@@ -15,6 +16,6 @@ stdenv.mkDerivation {
'';
installPhase = ''
- install -svD sandbox "$out/bin/${binary}"
+ install -svD sandbox "$out/bin/chromium-sandbox"
'';
}
diff --git a/pkgs/applications/networking/browsers/chromium/source/default.nix b/pkgs/applications/networking/browsers/chromium/source/default.nix
new file mode 100644
index 00000000000..2c7e7277b81
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/source/default.nix
@@ -0,0 +1,79 @@
+{ stdenv, fetchurl, python
+, channel ? "stable"
+, useOpenSSL # XXX
+}:
+
+with stdenv.lib;
+
+with (import ./update.nix {
+ inherit (stdenv) system;
+}).getChannel channel;
+
+stdenv.mkDerivation {
+ name = "chromium-source-${version}";
+
+ src = fetchurl main;
+
+ buildInputs = [ python ]; # cannot patch shebangs otherwise
+
+ phases = [ "unpackPhase" "patchPhase" "installPhase" ];
+
+ opensslPatches = optional useOpenSSL openssl.patches;
+
+ prePatch = "patchShebangs .";
+
+ patches = if (versionOlder version "36.0.0.0")
+ then singleton ./sandbox_userns_31.patch
+ else singleton ./sandbox_userns_36.patch;
+
+ postPatch = ''
+ 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 -e '/not RunGN/,+1d' -e '/import.*depot/d' 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 ''
+ cat $opensslPatches | patch -p1 -d third_party/openssl/openssl
+ '' + optionalString (!versionOlder version "34.0.0.0") ''
+ '';
+
+ outputs = [ "out" "sandbox" "bundled" "main" ];
+ installPhase = ''
+ ensureDir "$out" "$sandbox" "$bundled" "$main"
+
+ header "copying browser main sources to $main"
+ find . -mindepth 1 -maxdepth 1 \
+ \! -path ./sandbox \
+ \! -path ./third_party \
+ \! -path ./build \
+ \! -path ./tools \
+ \! -name '.*' \
+ -print | xargs cp -rt "$main"
+ stopNest
+
+ header "copying sandbox components to $sandbox"
+ cp -rt "$sandbox" sandbox/*
+ stopNest
+
+ header "copying third party sources to $bundled"
+ cp -rt "$bundled" third_party/*
+ stopNest
+
+ header "copying build requisites to $out"
+ cp -rt "$out" build tools
+ stopNest
+
+ rm -rf "$out/tools/gyp" # XXX: Don't even copy it in the first place.
+ '';
+
+ preferLocalBuild = true;
+
+ passthru = {
+ inherit version channel;
+ plugins = fetchurl binary;
+ };
+}
diff --git a/pkgs/applications/networking/browsers/chromium/sandbox_userns_31.patch b/pkgs/applications/networking/browsers/chromium/source/sandbox_userns_31.patch
similarity index 100%
rename from pkgs/applications/networking/browsers/chromium/sandbox_userns_31.patch
rename to pkgs/applications/networking/browsers/chromium/source/sandbox_userns_31.patch
diff --git a/pkgs/applications/networking/browsers/chromium/source/sandbox_userns_36.patch b/pkgs/applications/networking/browsers/chromium/source/sandbox_userns_36.patch
new file mode 100644
index 00000000000..8338aa65482
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/source/sandbox_userns_36.patch
@@ -0,0 +1,274 @@
+commit c66c07a2ebcd1b68f412a5a2945fef15b3ba567c
+Author: aszlig
+Date: Thu May 16 14:17:56 2013 +0200
+
+ zygote: Add support for user namespaces on Linux.
+
+ The implementation is done by patching the Zygote host to execute the sandbox
+ binary with CLONE_NEWUSER and setting the uid and gid mapping so that the child
+ process is using uid 0 and gid 0 which map to the current user of the parent.
+ Afterwards, the sandbox will continue as if it was called as a setuid binary.
+
+ In addition, this adds new_user_namespace as an option in process_util in order
+ to set the UID and GID mapping correctly. The reason for this is that just
+ passing CLONE_NEWUSER to clone_flags doesn't help in LaunchProcess(), because
+ without setting the mappings exec*() will clear the process's capability sets.
+
+ If the kernel doesn't support unprivileged user namespaces and the sandbox
+ binary doesn't have the setuid flag, the Zygote main process will run without a
+ sandbox. This is to mimic the behaviour if no SUID sandbox binary path is set.
+
+ Signed-off-by: aszlig
+
+diff --git a/base/process/launch.cc b/base/process/launch.cc
+index 81748f5..930f20f 100644
+--- a/base/process/launch.cc
++++ b/base/process/launch.cc
+@@ -26,6 +26,7 @@ LaunchOptions::LaunchOptions()
+ #if defined(OS_LINUX)
+ , clone_flags(0)
+ , allow_new_privs(false)
++ , new_user_namespace(false)
+ #endif // OS_LINUX
+ #if defined(OS_CHROMEOS)
+ , ctrl_terminal_fd(-1)
+diff --git a/base/process/launch.h b/base/process/launch.h
+index 9e39fba..00e4c79 100644
+--- a/base/process/launch.h
++++ b/base/process/launch.h
+@@ -115,6 +115,9 @@ struct BASE_EXPORT LaunchOptions {
+ // By default, child processes will have the PR_SET_NO_NEW_PRIVS bit set. If
+ // true, then this bit will not be set in the new child process.
+ bool allow_new_privs;
++
++ // If true, start the process in a new user namespace.
++ bool new_user_namespace;
+ #endif // defined(OS_LINUX)
+
+ #if defined(OS_CHROMEOS)
+diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
+index fe4da1a..7f118b8 100644
+--- a/base/process/launch_posix.cc
++++ b/base/process/launch_posix.cc
+@@ -40,6 +40,10 @@
+
+ #if defined(OS_LINUX)
+ #include
++#include
++#if !defined(CLONE_NEWUSER)
++#define CLONE_NEWUSER 0x10000000
++#endif
+ #endif
+
+ #if defined(OS_CHROMEOS)
+@@ -301,13 +305,23 @@ bool LaunchProcess(const std::vector& argv,
+
+ pid_t pid;
+ #if defined(OS_LINUX)
+- if (options.clone_flags) {
++ int map_pipe_fd[2];
++ int flags = options.clone_flags;
++
++ if (options.new_user_namespace) {
++ flags |= CLONE_NEWUSER;
++ if (pipe(map_pipe_fd) < 0) {
++ DPLOG(ERROR) << "user namespace pipe";
++ return false;
++ }
++ }
++
++ if (options.clone_flags || options.new_user_namespace) {
+ // Signal handling in this function assumes the creation of a new
+ // process, so we check that a thread is not being created by mistake
+ // and that signal handling follows the process-creation rules.
+- RAW_CHECK(
+- !(options.clone_flags & (CLONE_SIGHAND | CLONE_THREAD | CLONE_VM)));
+- pid = syscall(__NR_clone, options.clone_flags, 0, 0, 0);
++ RAW_CHECK(!(flags & (CLONE_SIGHAND | CLONE_THREAD | CLONE_VM)));
++ pid = syscall(__NR_clone, flags, 0, 0, 0);
+ } else
+ #endif
+ {
+@@ -328,6 +342,21 @@ bool LaunchProcess(const std::vector& argv,
+ // DANGER: no calls to malloc or locks are allowed from now on:
+ // http://crbug.com/36678
+
++#if defined(OS_LINUX)
++ if (options.new_user_namespace) {
++ // Close the write end of the pipe so we get an EOF when the parent closes
++ // the FD. This is to avoid race conditions when the UID/GID mappings are
++ // written _after_ execvp().
++ close(map_pipe_fd[1]);
++
++ char dummy;
++ if (HANDLE_EINTR(read(map_pipe_fd[0], &dummy, 1)) != 0) {
++ RAW_LOG(ERROR, "Unexpected input in uid/gid mapping pipe.");
++ _exit(127);
++ }
++ }
++#endif
++
+ // DANGER: fork() rule: in the child, if you don't end up doing exec*(),
+ // you call _exit() instead of exit(). This is because _exit() does not
+ // call any previously-registered (in the parent) exit handlers, which
+@@ -451,6 +480,40 @@ bool LaunchProcess(const std::vector& argv,
+ _exit(127);
+ } else {
+ // Parent process
++#if defined(OS_LINUX)
++ if (options.new_user_namespace) {
++ // We need to write UID/GID mapping here to map the current user outside
++ // the namespace to the root user inside the namespace in order to
++ // correctly "fool" the child process.
++ char buf[256];
++ int map_fd, map_len;
++
++ snprintf(buf, sizeof(buf), "/proc/%d/uid_map", pid);
++ map_fd = open(buf, O_RDWR);
++ DPCHECK(map_fd >= 0);
++ snprintf(buf, sizeof(buf), "0 %d 1", geteuid());
++ map_len = strlen(buf);
++ if (write(map_fd, buf, map_len) != map_len) {
++ RAW_LOG(WARNING, "Can't write to uid_map.");
++ }
++ close(map_fd);
++
++ snprintf(buf, sizeof(buf), "/proc/%d/gid_map", pid);
++ map_fd = open(buf, O_RDWR);
++ DPCHECK(map_fd >= 0);
++ snprintf(buf, sizeof(buf), "0 %d 1", getegid());
++ map_len = strlen(buf);
++ if (write(map_fd, buf, map_len) != map_len) {
++ RAW_LOG(WARNING, "Can't write to gid_map.");
++ }
++ close(map_fd);
++
++ // Close the pipe on the parent, so the child can continue doing the
++ // execvp() call.
++ close(map_pipe_fd[1]);
++ }
++#endif
++
+ if (options.wait) {
+ // While this isn't strictly disk IO, waiting for another process to
+ // finish is the sort of thing ThreadRestrictions is trying to prevent.
+diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc
+index 94bdc16..3398615 100644
+--- a/content/browser/zygote_host/zygote_host_impl_linux.cc
++++ b/content/browser/zygote_host/zygote_host_impl_linux.cc
+@@ -143,6 +143,9 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) {
+ // A non empty sandbox_cmd means we want a SUID sandbox.
+ using_suid_sandbox_ = !sandbox_cmd.empty();
+
++ bool userns_sandbox = false;
++ const std::vector cmd_line_unwrapped(cmd_line.argv());
++
+ // Start up the sandbox host process and get the file descriptor for the
+ // renderers to talk to it.
+ const int sfd = RenderSandboxHostLinux::GetInstance()->GetRendererSocket();
+@@ -162,11 +165,24 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) {
+ dummy_fd.reset(socket(AF_UNIX, SOCK_DGRAM, 0));
+ CHECK_GE(dummy_fd.get(), 0);
+ fds_to_map.push_back(std::make_pair(dummy_fd.get(), kZygoteIdFd));
++ userns_sandbox = sandbox_client->IsNoSuid();
+ }
+
+ base::ProcessHandle process = -1;
+ options.fds_to_remap = &fds_to_map;
++ if (userns_sandbox)
++ options.new_user_namespace = true;
+ base::LaunchProcess(cmd_line.argv(), options, &process);
++
++ if (process == -1 && userns_sandbox) {
++ LOG(ERROR) << "User namespace sandbox failed to start, running without "
++ << "sandbox! You need at least kernel 3.8.0 with CONFIG_USER_NS "
++ << "enabled in order to use the sandbox without setuid bit.";
++ using_suid_sandbox_ = false;
++ options.new_user_namespace = false;
++ base::LaunchProcess(cmd_line_unwrapped, options, &process);
++ }
++
+ CHECK(process != -1) << "Failed to launch zygote process";
+ dummy_fd.reset();
+
+diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc
+index cc28a6f..e8f665a 100644
+--- a/content/zygote/zygote_main_linux.cc
++++ b/content/zygote/zygote_main_linux.cc
+@@ -389,6 +389,13 @@ static bool EnterSuidSandbox(sandbox::SetuidSandboxClient* setuid_sandbox) {
+ CHECK(CreateInitProcessReaper());
+ }
+
++ // Don't set non-dumpable, as it causes trouble when the host tries to find
++ // the zygote process (XXX: Not quite sure why this happens with user
++ // namespaces). Fortunately, we also have the seccomp filter sandbox which
++ // should disallow the use of ptrace.
++ if (setuid_sandbox->IsNoSuid())
++ return true;
++
+ #if !defined(OS_OPENBSD)
+ // Previously, we required that the binary be non-readable. This causes the
+ // kernel to mark the process as non-dumpable at startup. The thinking was
+diff --git a/sandbox/linux/suid/client/setuid_sandbox_client.cc b/sandbox/linux/suid/client/setuid_sandbox_client.cc
+index 3300cb4..4bfa516 100644
+--- a/sandbox/linux/suid/client/setuid_sandbox_client.cc
++++ b/sandbox/linux/suid/client/setuid_sandbox_client.cc
+@@ -212,6 +212,10 @@ bool SetuidSandboxClient::IsInNewNETNamespace() const {
+ return env_->HasVar(kSandboxNETNSEnvironmentVarName);
+ }
+
++bool SetuidSandboxClient::IsNoSuid() const {
++ return env_->HasVar(kSandboxNoSuidVarName);
++}
++
+ bool SetuidSandboxClient::IsSandboxed() const {
+ return sandboxed_;
+ }
+@@ -267,8 +271,7 @@ void SetuidSandboxClient::PrependWrapper(base::CommandLine* cmd_line,
+ "LinuxSUIDSandboxDevelopment.";
+ }
+
+- if (access(sandbox_binary.c_str(), X_OK) != 0 || (st.st_uid != 0) ||
+- ((st.st_mode & S_ISUID) == 0) || ((st.st_mode & S_IXOTH)) == 0) {
++ if (access(sandbox_binary.c_str(), X_OK) != 0) {
+ LOG(FATAL) << "The SUID sandbox helper binary was found, but is not "
+ "configured correctly. Rather than run without sandboxing "
+ "I'm aborting now. You need to make sure that "
+@@ -284,6 +287,12 @@ void SetuidSandboxClient::PrependWrapper(base::CommandLine* cmd_line,
+ options->allow_new_privs = true;
+ UnsetExpectedEnvironmentVariables(&options->environ);
+ }
++
++ if (!((st.st_uid == 0) &&
++ (st.st_mode & S_ISUID) &&
++ (st.st_mode & S_IXOTH))) {
++ env_->SetVar(kSandboxNoSuidVarName, "1");
++ }
+ }
+
+ void SetuidSandboxClient::SetupLaunchEnvironment() {
+diff --git a/sandbox/linux/suid/client/setuid_sandbox_client.h b/sandbox/linux/suid/client/setuid_sandbox_client.h
+index 332c63b..4f603f8 100644
+--- a/sandbox/linux/suid/client/setuid_sandbox_client.h
++++ b/sandbox/linux/suid/client/setuid_sandbox_client.h
+@@ -70,6 +70,8 @@ class SANDBOX_EXPORT SetuidSandboxClient {
+ bool IsInNewPIDNamespace() const;
+ // Did the setuid helper create a new network namespace ?
+ bool IsInNewNETNamespace() const;
++ // Is sandboxed without SUID binary ?
++ bool IsNoSuid() const;
+ // Are we done and fully sandboxed ?
+ bool IsSandboxed() const;
+
+diff --git a/sandbox/linux/suid/common/sandbox.h b/sandbox/linux/suid/common/sandbox.h
+index 9345287..2db659e 100644
+--- a/sandbox/linux/suid/common/sandbox.h
++++ b/sandbox/linux/suid/common/sandbox.h
+@@ -15,6 +15,7 @@ static const char kAdjustOOMScoreSwitch[] = "--adjust-oom-score";
+
+ static const char kSandboxDescriptorEnvironmentVarName[] = "SBX_D";
+ static const char kSandboxHelperPidEnvironmentVarName[] = "SBX_HELPER_PID";
++static const char kSandboxNoSuidVarName[] = "SBX_NO_SUID";
+
+ static const long kSUIDSandboxApiNumber = 1;
+ static const char kSandboxEnvironmentApiRequest[] = "SBX_CHROME_API_RQ";
diff --git a/pkgs/applications/networking/browsers/chromium/source/sources.nix b/pkgs/applications/networking/browsers/chromium/source/sources.nix
new file mode 100644
index 00000000000..bd5ded3f4c6
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/source/sources.nix
@@ -0,0 +1,21 @@
+# This file is autogenerated from update.sh in the parent directory.
+{
+ dev = {
+ version = "36.0.1964.2";
+ sha256 = "0yrp1553pl0310h5pkfh2x27xhfrrxrpc25zad36f3k73iwmbg4c";
+ sha256bin32 = "02brz6lj7vfyyapc942dhdw7z26ksvnm7xqryfxn49y1rkd26xrf";
+ sha256bin64 = "0ibry2bfjcqnihwb8ykyl48qk25bzfxmw948sm70xnrmwbkv42ny";
+ };
+ beta = {
+ version = "35.0.1916.86";
+ sha256 = "0pjgpif8fiq14fk05pxs3js0pcg2jwmw0fklcci11rzq6rcm7r2g";
+ sha256bin32 = "1js71l88hqfli6c342iigwddxrqrzlx5fcazfxwlps4bdwgig6f8";
+ sha256bin64 = "1sqavz6lh0ryf8jlw8jcfwk265spxs70bhigcgcqsd6647fbdqsr";
+ };
+ stable = {
+ version = "35.0.1916.114";
+ sha256 = "1bvpkwjchkzx1qfc93hd8md6sz5sd7pl55xc8b8m3iakbp0csvsn";
+ sha256bin32 = "0zm5770cv9dld37xall9lpl9faa0bgjcp8hjx6l1ivfhs6lxbxxa";
+ sha256bin64 = "18p302aj2d7xdza9kf438vbz3wqh8db7v2dq5d9b4b3ak6w9ld03";
+ };
+}
diff --git a/pkgs/applications/networking/browsers/chromium/source/update.nix b/pkgs/applications/networking/browsers/chromium/source/update.nix
new file mode 100644
index 00000000000..de45d409937
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/source/update.nix
@@ -0,0 +1,120 @@
+{ system ? builtins.currentSystem }:
+
+let
+ inherit (import {
+ inherit system;
+ }) lib writeText stdenv;
+
+ sources = if builtins.pathExists ./sources.nix
+ then import ./sources.nix
+ else null;
+
+ bucketURL = "http://commondatastorage.googleapis.com/"
+ + "chromium-browser-official";
+
+ debURL = "https://dl.google.com/linux/chrome/deb/pool/main/g";
+
+ # Untrusted mirrors, don't try to update from them!
+ debMirrors = [
+ "http://95.31.35.30/chrome/pool/main/g"
+ "http://mirror.pcbeta.com/google/chrome/deb/pool/main/g"
+ ];
+
+ tryChannel = channel: let
+ chan = builtins.getAttr channel sources;
+ in if sources != null then ''
+ oldver="${chan.version}";
+ echo -n "Checking if $oldver ($channel) is up to date..." >&2;
+ if [ "x$(get_newest_ver "$version" "$oldver")" != "x$oldver" ];
+ then
+ echo " no, getting sha256 for new version $version:" >&2;
+ sha256="$(prefetch_sha "$channel" "$version")" || return 1;
+ else
+ echo " yes, keeping old sha256." >&2;
+ sha256="${chan.sha256}";
+ ${if (chan ? sha256bin32 && chan ? sha256bin64) then ''
+ sha256="$sha256.${chan.sha256bin32}.${chan.sha256bin64}";
+ '' else ''
+ sha256="$sha256.$(prefetch_deb_sha "$channel" "$version")";
+ ''}
+ fi;
+ '' else ''
+ sha256="$(prefetch_sha "$channel" "$version")" || return 1;
+ '';
+
+ caseChannel = channel: ''
+ ${channel}) ${tryChannel channel};;
+ '';
+
+in rec {
+ getChannel = channel: let
+ chanAttrs = builtins.getAttr channel sources;
+ in {
+ inherit (chanAttrs) version;
+
+ main = {
+ url = "${bucketURL}/chromium-${chanAttrs.version}.tar.xz";
+ inherit (chanAttrs) sha256;
+ };
+
+ binary = let
+ pname = if channel == "dev"
+ then "google-chrome-unstable"
+ else "google-chrome-${channel}";
+ arch = if stdenv.is64bit then "amd64" else "i386";
+ relpath = "${pname}/${pname}_${chanAttrs.version}-1_${arch}.deb";
+ in lib.optionalAttrs (chanAttrs ? sha256bin64) {
+ urls = map (url: "${url}/${relpath}") ([ debURL ] ++ debMirrors);
+ sha256 = if stdenv.is64bit
+ then chanAttrs.sha256bin64
+ else chanAttrs.sha256bin32;
+ };
+ };
+
+ updateHelpers = writeText "update-helpers.sh" ''
+
+ prefetch_main_sha()
+ {
+ nix-prefetch-url "${bucketURL}/chromium-$2.tar.xz";
+ }
+
+ prefetch_deb_sha()
+ {
+ channel="$1";
+ version="$2";
+
+ case "$1" in
+ dev) pname="google-chrome-unstable";;
+ *) pname="google-chrome-$channel";;
+ esac;
+
+ deb_pre="${debURL}/$pname/$pname";
+
+ deb32=$(nix-prefetch-url "''${deb_pre}_$version-1_i386.deb");
+ deb64=$(nix-prefetch-url "''${deb_pre}_$version-1_amd64.deb");
+
+ echo "$deb32.$deb64";
+ return 0;
+ }
+
+ prefetch_sha()
+ {
+ echo "$(prefetch_main_sha "$@").$(prefetch_deb_sha "$@")";
+ return 0;
+ }
+
+ get_sha256()
+ {
+ channel="$1";
+ version="$2";
+
+ case "$channel" in
+ ${lib.concatMapStrings caseChannel [ "stable" "dev" "beta" ]}
+ esac;
+
+ sha_insert "$version" "$sha256";
+ echo "$sha256";
+ return 0;
+ }
+ '';
+}
diff --git a/pkgs/applications/networking/browsers/chromium/sources.nix b/pkgs/applications/networking/browsers/chromium/sources.nix
deleted file mode 100644
index 49b5e2b4221..00000000000
--- a/pkgs/applications/networking/browsers/chromium/sources.nix
+++ /dev/null
@@ -1,18 +0,0 @@
-# This file is autogenerated from update.sh in the same directory.
-{
- dev = {
- version = "35.0.1883.0";
- url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-35.0.1883.0.tar.xz";
- sha256 = "0qbv6prxl18y5824pfd13ng9798g561gzb6nypwp502hqr45jvb6";
- };
- beta = {
- version = "34.0.1847.60";
- url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-34.0.1847.60.tar.xz";
- sha256 = "1na5d6z4a0wkabn7cj62vyiv3mmvcb6qdvrkyy6fj79h7gk2hb7k";
- };
- stable = {
- 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/chromium/update.sh b/pkgs/applications/networking/browsers/chromium/update.sh
index 0c4881bb396..e82d22f34fd 100755
--- a/pkgs/applications/networking/browsers/chromium/update.sh
+++ b/pkgs/applications/networking/browsers/chromium/update.sh
@@ -3,16 +3,9 @@
channels_url="http://omahaproxy.appspot.com/all?csv=1";
history_url="http://omahaproxy.appspot.com/history";
bucket_url="http://commondatastorage.googleapis.com/chromium-browser-official/";
-output_file="$(cd "$(dirname "$0")" && pwd)/sources.nix";
+base_path="$(cd "$(dirname "$0")" && pwd)/source";
-nix_getattr()
-{
- input_file="$1";
- attr="$2";
-
- var="$(nix-instantiate --eval-only -A "$attr" "$output_file")";
- echo "$var" | tr -d '\\"';
-}
+source "$(nix-build --no-out-link "$base_path/update.nix" -A updateHelpers)";
### poor mans key/value-store :-) ###
@@ -53,39 +46,6 @@ get_newest_ver()
fi;
}
-if [ -e "$output_file" ];
-then
- get_sha256()
- {
- channel="$1";
- version="$2";
- url="$3";
-
- oldver="$(nix_getattr "$output_file" "$channel.version")";
-
- echo -n "Checking if $oldver ($channel) is up to date..." >&2;
-
- if [ "x$(get_newest_ver "$version" "$oldver")" != "x$oldver" ];
- then
- echo " no, getting sha256 for new version $version:" >&2;
- sha256="$(nix-prefetch-url "$url")" || return 1;
- else
- echo " yes, keeping old sha256." >&2;
- sha256="$(nix_getattr "$output_file" "$channel.sha256")" \
- || return 1;
- fi;
-
- sha_insert "$version" "$sha256";
- echo "$sha256";
- return 0;
- }
-else
- get_sha256()
- {
- nix-prefetch-url "$3";
- }
-fi;
-
fetch_filtered_history()
{
curl -s "$history_url" | sed -nr 's/^'"linux,$1"',([^,]+).*$/\1/p';
@@ -99,9 +59,8 @@ get_prev_sha256()
for version in $(fetch_filtered_history "$channel");
do
[ "x$version" = "x$current_version" ] && continue;
- url="${bucket_url%/}/chromium-$version.tar.xz";
- sha256="$(get_sha256 "$channel" "$version" "$url")" || continue;
- echo "$sha256:$version:$url";
+ sha256="$(get_sha256 "$channel" "$version")" || continue;
+ echo "$sha256:$version";
return 0;
done;
}
@@ -113,34 +72,39 @@ get_channel_exprs()
channel="${chline%%,*}";
version="${chline##*,}";
- url="${bucket_url%/}/chromium-$version.tar.xz";
-
echo -n "Checking if sha256 of version $version is cached..." >&2;
if sha256="$(sha_lookup "$version")";
then
echo " yes: $sha256" >&2;
else
echo " no." >&2;
- sha256="$(get_sha256 "$channel" "$version" "$url")";
+ sha256="$(get_sha256 "$channel" "$version")";
if [ $? -ne 0 ];
then
echo "Whoops, failed to fetch $version, trying previous" \
"versions:" >&2;
- sha_ver_url="$(get_prev_sha256 "$channel" "$version")";
- sha256="${sha_ver_url%%:*}";
- ver_url="${sha_ver_url#*:}";
- version="${ver_url%%:*}";
- url="${ver_url#*:}";
+ sha_ver="$(get_prev_sha256 "$channel" "$version")";
+ sha256="${sha_ver%:*}";
+ version="${sha_ver#*:}";
fi;
fi;
sha_insert "$version" "$sha256";
+ main="${sha256%%.*}";
+ deb="${sha256#*.}";
+ deb32="${deb%.*}";
+ deb64="${deb#*.}";
+
echo " $channel = {";
echo " version = \"$version\";";
- echo " url = \"$url\";";
- echo " sha256 = \"$sha256\";";
+ echo " sha256 = \"$main\";";
+ if [ "x${deb#*[a-z0-9].[a-z0-9]}" != "x$deb" ];
+ then
+ echo " sha256bin32 = \"$deb32\";";
+ echo " sha256bin64 = \"$deb64\";";
+ fi;
echo " };";
done;
}
@@ -151,8 +115,8 @@ omaha="$(curl -s "$channels_url")";
versions="$(echo "$omaha" | sed -nr -e 's/^linux,([^,]+,[^,]+).*$/\1/p')";
channel_exprs="$(get_channel_exprs "$versions")";
-cat > "$output_file" <<-EOF
-# This file is autogenerated from update.sh in the same directory.
+cat > "$base_path/sources.nix" <<-EOF
+# This file is autogenerated from update.sh in the parent directory.
{
$channel_exprs
}
diff --git a/pkgs/applications/networking/browsers/conkeror/default.nix b/pkgs/applications/networking/browsers/conkeror/default.nix
index 79402c31f8b..cd96c0a6be8 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-20140212";
+ name = "conkeror-1.0pre-20140509";
src = fetchgit {
url = git://repo.or.cz/conkeror.git;
- rev = "07064d76d10e0978c6de535e21f4597d44560fbd";
- sha256 = "b03a7debee8583ff7a3f2d95474f60e956f0e24dbd1a8fd22412de1d6627f322";
+ rev = "eaf02dccf979d824667d177544103af000ae40bf";
+ sha256 = "1896db59d260f34a459402cb0c252b636aab9bf0378ae663a6d039f15af5b350";
};
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 00000000000..0cf23f38b0f
--- /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 dcdbe724194..40b875c8c57 100644
--- a/pkgs/applications/networking/browsers/dwb/default.nix
+++ b/pkgs/applications/networking/browsers/dwb/default.nix
@@ -2,15 +2,15 @@
m4, glib_networking, gsettings_desktop_schemas }:
stdenv.mkDerivation {
- name = "dwb-2014-03-27";
+ name = "dwb-2014-06-03";
src = fetchgit {
url = "https://bitbucket.org/portix/dwb.git";
- rev = "4566d58575fbf687ebe9e3414996c45697b62787";
- sha256 = "145sq2wv0s0n32cwpwgy59ff6ppcv80ialak7nnj1rpqicfqb72h";
+ rev = "d00af56c1e60978060f1b2077f3d49995b98c54f";
+ sha256 = "02bs9nbgk8ghaxywhqd8mii4lik748dssn551m00i1305p6q1cjj";
};
- buildInputs = [ pkgconfig makeWrapper gsettings_desktop_schemas 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=''
diff --git a/pkgs/applications/networking/browsers/firefox/default.nix b/pkgs/applications/networking/browsers/firefox/default.nix
index b45fb4bbae7..0c1a974ec69 100644
--- a/pkgs/applications/networking/browsers/firefox/default.nix
+++ b/pkgs/applications/networking/browsers/firefox/default.nix
@@ -17,19 +17,14 @@ assert stdenv.gcc ? libc && stdenv.gcc.libc != null;
rec {
- firefoxVersion = "27.0.1";
+ firefoxVersion = "29.0.1";
- xulVersion = "27.0.1"; # this attribute is used by other packages
+ xulVersion = "29.0.1"; # this attribute is used by other packages
src = fetchurl {
- urls = [
- # It is better to use this url for official releases, to take load off Mozilla's ftp server.
- "http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.bz2"
- # 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"
- ];
- sha256 = "13qd53yf8dn9m03p4x5ml9h3mys60nba5nz82lcvaq7ycp1pl1bn";
+ url = "http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.bz2";
+ sha1 = "2819ef63403de2bcfff5496bd21a3b8cb5dfce82";
};
commonConfigureFlags =
@@ -41,7 +36,7 @@ rec {
"--with-system-libevent"
"--with-system-libvpx"
"--with-system-png"
- "--with-system-icu"
+ # "--with-system-icu" # causes ‘ar: invalid option -- 'L'’ in Firefox 28.0
"--enable-system-ffi"
"--enable-system-hunspell"
"--enable-system-pixman"
@@ -56,6 +51,7 @@ rec {
"--disable-necko-wifi" # maybe we want to enable this at some point
"--disable-installer"
"--disable-updater"
+ "--disable-pulseaudio"
] ++ (if debugBuild then [ "--enable-debug" "--enable-profiling"]
else [ "--disable-debug" "--enable-release"
"--enable-optimize" "--enable-strip" ]);
diff --git a/pkgs/applications/networking/browsers/lynx/default.nix b/pkgs/applications/networking/browsers/lynx/default.nix
index b0f9b69012c..74c9574c7d6 100644
--- a/pkgs/applications/networking/browsers/lynx/default.nix
+++ b/pkgs/applications/networking/browsers/lynx/default.nix
@@ -5,11 +5,11 @@
assert sslSupport -> openssl != null;
stdenv.mkDerivation {
- name = "lynx-2.8.7";
+ name = "lynx-2.8.8";
src = fetchurl {
- url = http://lynx.isc.org/lynx2.8.7/lynx2.8.7.tar.bz2;
- sha256 = "1baxwpdvak6nalr943g22z67r1d3fbibbkqvkvvar9xlvrs9gv20";
+ url = http://lynx.isc.org/lynx2.8.8/lynx2.8.8.tar.bz2;
+ sha256 = "1rxysl08acqll5b87368f04kckl8sggy1qhnq59gsxyny1ffg039";
};
configureFlags = if sslSupport then "--with-ssl=${openssl}" else "";
diff --git a/pkgs/applications/networking/browsers/midori/default.nix b/pkgs/applications/networking/browsers/midori/default.nix
index db9e1c24cb5..11a17709ade 100644
--- a/pkgs/applications/networking/browsers/midori/default.nix
+++ b/pkgs/applications/networking/browsers/midori/default.nix
@@ -4,7 +4,7 @@
}:
let
- version = "0.5.7";
+ version = "0.5.8";
in
stdenv.mkDerivation rec {
name = "midori-${version}";
@@ -19,9 +19,11 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "${meta.homepage}/downloads/midori_${version}_all_.tar.bz2";
- sha256 = "0k8bppicgzm97g5x8ahvpw9wvg2f1mq093qp8biwr858m0mbnx98";
+ sha256 = "10ckm98rfqfbwr84b8mc1ssgj84wjgkr4dadvx2l7c64sigi66dg";
};
+ sourceRoot = ".";
+
buildInputs = [
cmake pkgconfig intltool vala makeWrapper
webkitgtk librsvg libnotify
@@ -32,9 +34,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 a78ab7d27f7..378e32c0afb 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-11/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-11/default.nix
@@ -36,7 +36,7 @@
let
# -> http://get.adobe.com/flashplayer/
- version = "11.2.202.350";
+ version = "11.2.202.359";
src =
if stdenv.system == "x86_64-linux" then
@@ -47,7 +47,7 @@ let
else rec {
inherit version;
url = "http://fpdownload.macromedia.com/get/flashplayer/pdc/${version}/install_flash_player_11_linux.x86_64.tar.gz";
- sha256 = "0f5y05c0acvdzd7a7qi93kd17byazf9swm6gml5rph5bc25aw77l";
+ sha256 = "13myq6f999qy1jbgm73gxnadrxdvasi2jiffdyxmwpbwglhhrpka";
}
else if stdenv.system == "i686-linux" then
if debug then {
@@ -58,7 +58,7 @@ let
} else rec {
inherit version;
url = "http://fpdownload.macromedia.com/get/flashplayer/pdc/${version}/install_flash_player_11_linux.i386.tar.gz";
- sha256 = "0nsrj56xbpn8r4365zby8qbc38cl2anb5ky0h7jwyh7xyrs9xmml";
+ sha256 = "04wh18jbscp7m3drvsxxhp2vjnhww69vw0pgr23hx81ry0ccvb8m";
}
else throw "Flash Player is not supported on this platform";
@@ -88,7 +88,7 @@ stdenv.mkDerivation {
meta = {
description = "Adobe Flash Player browser plugin";
homepage = http://www.adobe.com/products/flashplayer/;
- maintainer = with stdenv.lib.maintainers; [ wizeman ];
+ maintainers = with stdenv.lib.maintainers; [ wizeman ];
license = "unfree";
};
}
diff --git a/pkgs/applications/networking/browsers/uzbl/default.nix b/pkgs/applications/networking/browsers/uzbl/default.nix
index 4c6458d909f..318b9576392 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 = [ gsettings_desktop_schemas webkit pygtk ];
}
diff --git a/pkgs/applications/networking/browsers/vimprobable2/default.nix b/pkgs/applications/networking/browsers/vimprobable2/default.nix
index f723e3791f3..8e1e00795d2 100644
--- a/pkgs/applications/networking/browsers/vimprobable2/default.nix
+++ b/pkgs/applications/networking/browsers/vimprobable2/default.nix
@@ -2,11 +2,11 @@
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
diff --git a/pkgs/applications/networking/cluster/spark/default.nix b/pkgs/applications/networking/cluster/spark/default.nix
index 61f2d0c6e20..1e9fe918a2e 100644
--- a/pkgs/applications/networking/cluster/spark/default.nix
+++ b/pkgs/applications/networking/cluster/spark/default.nix
@@ -2,16 +2,16 @@
stdenv.mkDerivation rec {
name = "spark-${version}";
- version = "0.9.0";
+ version = "0.9.1";
src = fetchurl {
- url = "http://d3kbcqa49mib13.cloudfront.net/${name}-incubating-bin-cdh4.tgz";
- sha256 = "0dgirq2ws25accijijanqij6d1mwxkrcqkmq1xsslfpz26svs1w1";
+ url = "http://d3kbcqa49mib13.cloudfront.net/${name}-bin-cdh4.tgz";
+ sha256 = "1k3954srx3km3ckmfi6wn8rldrljxc039g0pf5m3azgkmaz0gld5";
};
unpackPhase = ''tar zxf $src'';
- untarDir = "spark-${version}-incubating-bin-cdh4";
+ untarDir = "${name}-bin-cdh4";
installPhase = ''
set -x
mkdir -p $out/lib $out/bin
@@ -118,10 +118,11 @@ stdenv.mkDerivation rec {
phases = "unpackPhase installPhase";
meta = {
- description = "Spark cluster computing";
- homepage = "http://spark.incubator.apache.org";
- license = stdenv.lib.licenses.asl20;
- platforms = stdenv.lib.platforms.all;
- maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ description = "Lightning-fast cluster computing";
+ homepage = "http://spark.apache.org";
+ license = stdenv.lib.licenses.asl20;
+ platforms = stdenv.lib.platforms.all;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ repositories.git = git://git.apache.org/spark.git;
};
}
diff --git a/pkgs/applications/networking/dropbox-cli/default.nix b/pkgs/applications/networking/dropbox-cli/default.nix
index 6af15211a52..5262c121bb2 100644
--- a/pkgs/applications/networking/dropbox-cli/default.nix
+++ b/pkgs/applications/networking/dropbox-cli/default.nix
@@ -1,31 +1,30 @@
-{ stdenv, coreutils, fetchurl, python, dropbox }:
-
+{ stdenv, pkgconfig, fetchurl, python, dropbox }:
+let
+ version = "1.6.2";
+in
stdenv.mkDerivation {
- # 1.6.0 because it's the only version mentioned in the script
- name = "dropbox-cli-1.6.0";
+ name = "dropbox-cli-${version}";
src = fetchurl {
- # Note: dropbox doesn't version this file. Annoying.
- url = "https://linux.dropbox.com/packages/dropbox.py";
- sha256 = "0505k0xrhbmsv7g5phxxnz5wbff6m5gdsqyxkhd95wdi9d71c43c";
+ url = "https://linux.dropbox.com/packages/nautilus-dropbox-${version}.tar.bz2";
+ sha256 = "1r1kqvnf5a0skby6rr8bmxg128z97fz4gb1n7zlc1vyhqw4k3mb3";
};
- buildInputs = [ coreutils python ];
+ buildInputs = [ pkgconfig python ];
- phases = "installPhase fixupPhase";
+ phases = "unpackPhase installPhase";
installPhase = ''
- mkdir -pv $out/bin/
- cp $src $out/bin/dropbox-cli
- '';
+ ensureDir "$out/bin/" "$out/share/applications"
+ cp data/dropbox.desktop "$out/share/applications"
+ substitute "dropbox.in" "$out/bin/dropbox" \
+ --replace '@PACKAGE_VERSION@' ${version} \
+ --replace '@DESKTOP_FILE_DIR@' "$out/share/applications" \
+ --replace '@IMAGEDATA16@' '"too-lazy-to-fix"' \
+ --replace '@IMAGEDATA64@' '"too-lazy-to-fix"'
- fixupPhase = ''
- substituteInPlace $out/bin/dropbox-cli \
- --replace "/usr/bin/python" ${python}/bin/python \
- --replace "use dropbox help" "use dropbox-cli help" \
- --replace "~/.dropbox-dist/dropboxd" ${dropbox}/bin/dropbox
-
- chmod +x $out/bin/dropbox-cli
+ chmod +x "$out/bin/"*
+ patchShebangs "$out/bin"
'';
meta = {
diff --git a/pkgs/applications/networking/esniper/default.nix b/pkgs/applications/networking/esniper/default.nix
index 0a9703d5e34..766ec0c17fc 100644
--- a/pkgs/applications/networking/esniper/default.nix
+++ b/pkgs/applications/networking/esniper/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, openssl, curl, coreutils, gawk, bash, which }:
stdenv.mkDerivation {
- name = "esniper-2.29.0";
+ name = "esniper-2.30.0";
src = fetchurl {
- url = "mirror://sourceforge/esniper/esniper-2-29-0.tgz";
- sha256 = "052jfbzm0a88h3hss2vg1vfdrhibjwhbcdnwsbkk5i1z0jj16xxc";
+ url = "mirror://sourceforge/esniper/esniper-2-30-0.tgz";
+ sha256 = "1p85d5qfr3f35xfj5555ck4wwk5hqkh65ivam1527p8dwcz00wpl";
};
buildInputs = [ openssl curl ];
diff --git a/pkgs/applications/networking/ftp/filezilla/default.nix b/pkgs/applications/networking/ftp/filezilla/default.nix
index a8b4cfaf926..e88cf5b3f73 100644
--- a/pkgs/applications/networking/ftp/filezilla/default.nix
+++ b/pkgs/applications/networking/ftp/filezilla/default.nix
@@ -1,13 +1,13 @@
{ stdenv, fetchurl, dbus, gnutls, wxGTK28, libidn, tinyxml, gettext
, pkgconfig, xdg_utils, gtk2, sqlite }:
-let version = "3.7.3"; in
+let version = "3.8.0"; in
stdenv.mkDerivation {
name = "filezilla-${version}";
src = fetchurl {
url = "mirror://sourceforge/project/filezilla/FileZilla_Client/${version}/FileZilla_${version}_src.tar.bz2";
- sha256 = "0hn043jjb7qh040dgyhffp9jrrmca1xxbc998vyqyg83lrq2j09b";
+ sha256 = "02635sh88zvmqhqs7yx982dmfa1qd0rhk4z1fqvgh5pr2ac1r74d";
};
configureFlags = [
diff --git a/pkgs/applications/networking/instant-messengers/hipchat/default.nix b/pkgs/applications/networking/instant-messengers/hipchat/default.nix
index c0f76602b2b..6da12905f56 100644
--- a/pkgs/applications/networking/instant-messengers/hipchat/default.nix
+++ b/pkgs/applications/networking/instant-messengers/hipchat/default.nix
@@ -1,59 +1,96 @@
-{ stdenv
-, fetchurl
-, libtool
-, libXext
-, libSM
-, libICE
-, libX11
-, libXft
-, libXau
-, libXdmcp
-, libXrender
-, freetype
-, fontconfig
-, openssl
-}:
+{ stdenv, fetchurl, libtool, xlibs, freetype, fontconfig, openssl, glib
+, mesa, gstreamer, gst_plugins_base, dbus, alsaLib, zlib, libuuid
+, libxml2, libxslt, sqlite, libogg, libvorbis, xz, libcanberra
+, makeWrapper, libredirect, xkeyboard_config }:
let
- version = "1.94.407";
+
+ version = "2.2.1107";
rpath = stdenv.lib.makeSearchPath "lib" [
stdenv.glibc
- stdenv.gcc.gcc
libtool
- libXext
- libSM
- libICE
- libX11
- libXft
- libXau
- libXdmcp
- libXrender
+ xlibs.libXext
+ xlibs.libSM
+ xlibs.libICE
+ xlibs.libX11
+ xlibs.libXft
+ xlibs.libXau
+ xlibs.libXdmcp
+ xlibs.libXrender
+ xlibs.libXfixes
+ xlibs.libXcomposite
+ xlibs.libxcb
+ xlibs.libXi
freetype
fontconfig
openssl
- ];
+ glib
+ mesa
+ gstreamer
+ gst_plugins_base
+ dbus
+ alsaLib
+ zlib
+ libuuid
+ libxml2
+ libxslt
+ sqlite
+ libogg
+ libvorbis
+ xz
+ libcanberra
+ ] + ":${stdenv.gcc.gcc}/lib${stdenv.lib.optionalString stdenv.is64bit "64"}";
- src = fetchurl {
- url = "http://downloads.hipchat.com/linux/arch/hipchat-${version}-i686.pkg.tar.xz";
- sha256 = "0kyjpa2ir066zqkvs1zmnx6kvl8v4jfl8h7bw110cgigwmiplk7k";
- };
-in stdenv.mkDerivation {
+ src =
+ if stdenv.system == "x86_64-linux" then
+ fetchurl {
+ url = "http://downloads.hipchat.com/linux/arch/x86_64/hipchat-${version}-x86_64.pkg.tar.xz";
+ sha256 = "0lf780pxbh40m2i48cki072lrm75924cz3zgkmaxddmar3y13bwa";
+ }
+ else if stdenv.system == "i686-linux" then
+ fetchurl {
+ url = "http://downloads.hipchat.com/linux/arch/i686/hipchat-${version}-i686.pkg.tar.xz";
+ sha256 = "1k33670rpigdpy9jcacryc1i05ykp5yffcplmbm5q29ng54cn0zv";
+ }
+ else
+ throw "HipChat is not supported on ${stdenv.system}";
+
+in
+
+stdenv.mkDerivation {
name = "hipchat-${version}";
+ inherit src;
+
+ buildInputs = [ makeWrapper ];
+
buildCommand = ''
tar xf ${src}
- mkdir -p $out
- mv opt/HipChat/lib $out
- mv opt/HipChat/bin $out
+
+ mkdir -p $out/libexec/hipchat/bin
+ d=$out/libexec/hipchat/lib
+ rm -rfv opt/HipChat/lib/{libstdc++*,libz*,libuuid*,libxml2*,libxslt*,libsqlite*,libogg*,libvorbis*,liblzma*,libcanberra.*,libcanberra-*}
+ mv opt/HipChat/lib/ $d
mv usr/share $out
+
patchShebangs $out/bin
- for file in $(find $out/lib -type f); do
- patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 $file || true
- patchelf --set-rpath ${rpath}:$out/lib $file || true
+
+ for file in $(find $d -type f); do
+ patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" $file || true
+ patchelf --set-rpath ${rpath}:\$ORIGIN $file || true
done
+
substituteInPlace $out/share/applications/hipchat.desktop \
--replace /opt/HipChat/bin $out/bin
+
+ makeWrapper $d/hipchat.bin $out/bin/hipchat \
+ --set HIPCHAT_LD_LIBRARY_PATH '"$LD_LIBRARY_PATH"' \
+ --set HIPCHAT_QT_PLUGIN_PATH '"$QT_PLUGIN_PATH"' \
+ --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
+ --set NIX_REDIRECTS /usr/share/X11/xkb=${xkeyboard_config}/share/X11/xkb
+
+ mv opt/HipChat/bin/linuxbrowserlaunch $out/libexec/hipchat/bin/
'';
meta = {
diff --git a/pkgs/applications/networking/instant-messengers/pidgin-plugins/sipe/default.nix b/pkgs/applications/networking/instant-messengers/pidgin-plugins/sipe/default.nix
index 9c787867e5a..b387ed350af 100644
--- a/pkgs/applications/networking/instant-messengers/pidgin-plugins/sipe/default.nix
+++ b/pkgs/applications/networking/instant-messengers/pidgin-plugins/sipe/default.nix
@@ -1,19 +1,20 @@
{ stdenv, fetchurl, pidgin, intltool, libxml2 }:
-let version = "1.12.0"; in
+let version = "1.18.1"; in
stdenv.mkDerivation {
name = "pidgin-sipe-${version}";
-
+
src = fetchurl {
url = "mirror://sourceforge/sipe/pidgin-sipe-${version}.tar.gz";
- sha256 = "12ki6n360v2ja961fzw4mwpgb8jdp9k21y5mbiab151867c862r6";
+ sha256 = "18ch7jpi7ki7xlpahi88xrnmnhc6dcq4hafm0z6d5nfjfp8ldal5";
};
- meta = {
+ meta = with stdenv.lib; {
description = "SIPE plugin for Pidgin IM";
homepage = http://sipe.sourceforge.net/;
- license = "GPLv2";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
};
postInstall = "find $out -ls; ln -s \$out/lib/purple-2 \$out/share/pidgin-sipe";
diff --git a/pkgs/applications/networking/instant-messengers/sflphone/default.nix b/pkgs/applications/networking/instant-messengers/sflphone/default.nix
index 2401d796bfd..a31a682abf8 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/teamspeak/server.nix b/pkgs/applications/networking/instant-messengers/teamspeak/server.nix
new file mode 100644
index 00000000000..7a57cb8ad62
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/teamspeak/server.nix
@@ -0,0 +1,99 @@
+{ stdenv, fetchurl, makeWrapper }:
+
+let
+
+ version = "3.0.10.3";
+
+ arch = if stdenv.is64bit then "amd64" else "x86";
+
+ libDir = if stdenv.is64bit then "lib64" else "lib";
+in
+
+stdenv.mkDerivation {
+ name = "teamspeak-server-${version}";
+
+ src = fetchurl {
+ urls = [
+ "http://dl.4players.de/ts/releases/${version}/teamspeak3-server_linux-${arch}-${version}.tar.gz"
+ "http://teamspeak.gameserver.gamed.de/ts3/releases/${version}/teamspeak3-server_linux-${arch}-${version}.tar.gz"
+ ];
+ sha256 = if stdenv.is64bit
+ then "9606dd5c0c3677881b1aab833cb99f4f12ba08cc77ef4a97e9e282d9e10b0702"
+ else "8b8921e0df04bf74068a51ae06d744f25d759a8c267864ceaf7633eb3f81dbe5";
+ };
+
+ buildInputs = [ makeWrapper ];
+
+ buildPhase =
+ ''
+ mv ts3server_linux_${arch} ts3server
+ echo "patching ts3server"
+ patchelf \
+ --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ --set-rpath $(cat $NIX_GCC/nix-support/orig-gcc)/${libDir} \
+ --force-rpath \
+ ts3server
+ '';
+
+ installPhase =
+ ''
+ # Delete unecessary libraries - these are provided by nixos.
+ #rm *.so*
+
+ # Install files.
+ mkdir -p $out/lib/teamspeak
+ mv * $out/lib/teamspeak/
+
+ # Make a symlink to the binary from bin.
+ mkdir -p $out/bin/
+ ln -s $out/lib/teamspeak/ts3server $out/bin/ts3server
+
+ wrapProgram $out/lib/teamspeak/ts3server --prefix LD_LIBRARY_PATH : $out/lib/teamspeak
+ '';
+
+ dontStrip = true;
+ dontPatchELF = true;
+
+ meta = {
+ description = "TeamSpeak voice communication server";
+ homepage = http://teamspeak.com/;
+ license = stdenv.lib.licenses.unfreeRedistributable;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.arobyn ];
+ };
+}
+
+/*
+License issues:
+Date: Mon, 10 Dec 2007 19:55:16 -0500
+From: TeamSpeak Sales
+To: 'Marc Weber'
+Subject: RE: teamspeak on nix?
+
+Yes, that would be fine. As long as you are not renting servers or selling
+TeamSpeak then you are more than welcome to distribute it.
+
+Thank you,
+
+TeamSpeak Sales Team
+________________________________
+e-Mail: sales@tritoncia.com
+TeamSpeak: http://www.TeamSpeak.com
+Account Login: https://sales.TritonCIA.com/users
+
+
+
+-----Original Message-----
+From: Marc Weber [mailto:marco-oweber@gmx.de]
+Sent: Monday, December 10, 2007 5:03 PM
+To: sales@tritoncia.com
+Subject: teamspeak on nix?
+
+Hello,
+
+nix is very young software distribution system (http://nix.cs.uu.nl/)
+I'd like to ask wether you permit us to add teamspeak (server/ client?)
+
+Sincerly
+Marc Weber (small nix contributor)
+*/
diff --git a/pkgs/applications/networking/irc/chatzilla/default.nix b/pkgs/applications/networking/irc/chatzilla/default.nix
index 5d16c979f6a..2010d064f0d 100644
--- a/pkgs/applications/networking/irc/chatzilla/default.nix
+++ b/pkgs/applications/networking/irc/chatzilla/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchurl, unzip, xulrunner, makeWrapper }:
stdenv.mkDerivation rec {
- name = "chatzilla-0.9.88";
-
+ name = "chatzilla-0.9.90.1";
+
src = fetchurl {
# Obtained from http://chatzilla.rdmsoft.com/xulrunner/.
- url = "http://chatzilla.rdmsoft.com/xulrunner/download/${name}-xr.zip";
- sha256 = "041jpjl7wnbhqm2f8bf2pwp6igjapmy74swac94h54n644wl5nz0";
+ url = "http://chatzilla.rdmsoft.com/xulrunner/download/${name}.en-US.xulapp";
+ sha256 = "0z38jig91h10cb14rvs30rpg2pgn3v890nyxyy8lxzbv5ncxmngw";
};
buildInputs = [ unzip makeWrapper ];
@@ -17,10 +17,14 @@ stdenv.mkDerivation rec {
makeWrapper ${xulrunner}/bin/xulrunner $out/bin/chatzilla \
--add-flags $out/libexec/chatzilla/application.ini
+
+ sed -i $out/libexec/chatzilla/application.ini -e 's/.*MaxVersion.*/MaxVersion=99.*/'
'';
meta = {
homepage = http://chatzilla.hacksrus.com/;
description = "Stand-alone version of Chatzilla, an IRC client";
+ maintainers = [ stdenv.lib.maintainers.eelco ];
+ platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/networking/irc/weechat/devel.nix b/pkgs/applications/networking/irc/weechat/devel.nix
new file mode 100644
index 00000000000..0ad05089c62
--- /dev/null
+++ b/pkgs/applications/networking/irc/weechat/devel.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchgit, ncurses, openssl, perl, python, aspell, gnutls
+, zlib, curl , pkgconfig, libgcrypt, ruby, lua5, tcl, guile
+, pythonPackages, cacert, cmake, makeWrapper }:
+
+stdenv.mkDerivation rec {
+ rev = "70d2b0ad8eb7854932d24c007a05b8627f751205";
+ version = "1.0-rev${rev}";
+ name = "weechat-${version}";
+
+ src = fetchgit {
+ inherit rev;
+ url = "git://github.com/weechat/weechat.git";
+ sha256 = "1k7kcrq46anq87r14sq3vrhij8acn6id7zxyhn0qnjj2wqgrjp5i";
+ };
+
+ buildInputs =
+ [ ncurses perl python openssl aspell gnutls zlib curl pkgconfig
+ libgcrypt ruby lua5 tcl guile pythonPackages.pycrypto makeWrapper
+ cacert cmake
+ ];
+
+ postInstall = ''
+ wrapProgram "$out/bin/weechat" \
+ --prefix PYTHONPATH : "$PYTHONPATH" \
+ --prefix PYTHONPATH : "$out/lib/${python.libPrefix}/site-packages"
+ '';
+
+ meta = {
+ homepage = http://www.weechat.org/;
+ description = "A fast, light and extensible chat client";
+ license = stdenv.lib.licenses.gpl3;
+ maintainers = with stdenv.lib.maintainers; [ garbas the-kenny ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/networking/jmeter/default.nix b/pkgs/applications/networking/jmeter/default.nix
index ddb7b63fc6f..2d5e6b66bf0 100644
--- a/pkgs/applications/networking/jmeter/default.nix
+++ b/pkgs/applications/networking/jmeter/default.nix
@@ -1,10 +1,10 @@
{ fetchurl, stdenv, ant }:
stdenv.mkDerivation rec {
- name = "jmeter-2.10";
+ name = "jmeter-2.11";
src = fetchurl {
url = "http://ftp.unicamp.br/pub/apache//jmeter/binaries/apache-${name}.tgz";
- sha256 = "1ygm0h02sllh4mfl5imj46v80wnbs1x7n88gfjm523ixmgsa0fvy";
+ sha256 = "1fr3sw06qncb6yygcf2lbnkxma4v1dbigpf39ajrm0isxbpyv944";
};
installPhase = ''
diff --git a/pkgs/applications/networking/mailreaders/mutt/default.nix b/pkgs/applications/networking/mailreaders/mutt/default.nix
index 97722a51bb5..dbd5a41afd3 100644
--- a/pkgs/applications/networking/mailreaders/mutt/default.nix
+++ b/pkgs/applications/networking/mailreaders/mutt/default.nix
@@ -15,14 +15,14 @@ assert sslSupport -> openssl != null;
assert saslSupport -> cyrus_sasl != null;
let
- version = "1.5.22";
+ version = "1.5.23";
in
stdenv.mkDerivation rec {
name = "mutt-${version}";
src = fetchurl {
- url = "ftp://ftp.mutt.org/mutt/devel/${name}.tar.gz";
- sha256 = "19zk81spnb0gc8y5mwmcfn33g77wv1xz5bmgic8aan07xn8fislg";
+ url = "mirror://sourceforge/mutt/${name}.tar.gz";
+ sha256 = "0dzx4qk50pjfsb6cs5jahng96a52k12f7pm0sc78iqdrawg71w1s";
};
buildInputs = [
diff --git a/pkgs/applications/networking/mailreaders/sylpheed/default.nix b/pkgs/applications/networking/mailreaders/sylpheed/default.nix
index 31e65a857df..70d01f5df3e 100644
--- a/pkgs/applications/networking/mailreaders/sylpheed/default.nix
+++ b/pkgs/applications/networking/mailreaders/sylpheed/default.nix
@@ -10,12 +10,14 @@ with stdenv.lib;
assert sslSupport -> openssl != null;
assert gpgSupport -> gpgme != null;
+let version = "3.4.1"; in
+
stdenv.mkDerivation {
- name = "sylpheed-3.2.0";
+ name = "sylpheed-${version}";
src = fetchurl {
- url = http://sylpheed.sraoss.jp/sylpheed/v3.2/sylpheed-3.2.0.tar.bz2;
- sha256 = "1cdjwn1f8rgcxzfxj7j7qvacmaw4zfhnip81q4n5lj5d6rj7rssa";
+ url = "http://sylpheed.sraoss.jp/sylpheed/v3.4/sylpheed-${version}.tar.bz2";
+ sha256 = "11wpifvn8a0p4dqmvi7r61imqkgm6rjjp3h057c344vny37livbx";
};
buildInputs =
diff --git a/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix b/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix
new file mode 100644
index 00000000000..c801c0f69b0
--- /dev/null
+++ b/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix
@@ -0,0 +1,266 @@
+{ stdenv, fetchurl, config
+, gconf
+, alsaLib
+, at_spi2_atk
+, atk
+, cairo
+, cups
+, curl
+, dbus_glib
+, dbus_libs
+, fontconfig
+, freetype
+, gdk_pixbuf
+, glib
+, glibc
+, gst_plugins_base
+, gstreamer
+, gtk
+, kerberos
+, libX11
+, libXScrnSaver
+, libXext
+, libXinerama
+, libXrender
+, libXt
+, libcanberra
+, libgnome
+, libgnomeui
+, mesa
+, nspr
+, nss
+, pango
+}:
+
+let
+ version = "24.5.0";
+
+ sources = [
+ { locale = "ar"; arch = "linux-i686"; sha256 = "a5d7a95ed93277c5e7191f868df343d1a1d14e6c692cac1e6069fd9ee7177273"; }
+ { locale = "ar"; arch = "linux-x86_64"; sha256 = "b3100ead31d208968edd5b8545b641d0db9692d31a63e07fa9c391dca61de8a4"; }
+ { locale = "ast"; arch = "linux-i686"; sha256 = "059ed2a01afabebc7bd28cc79841debcaaa0bf015f28145c719396d4e612f535"; }
+ { locale = "ast"; arch = "linux-x86_64"; sha256 = "75874c6fcabb21332095562b9f86b7c6b668efdfb09904b83fa20743e1740790"; }
+ { locale = "be"; arch = "linux-i686"; sha256 = "7eda8e02a15284a0e6814072a0212457a25bcfef5058e1c376fc22facb2970f1"; }
+ { locale = "be"; arch = "linux-x86_64"; sha256 = "9fb0150098810b152ecf95e0826a3bac1dbffdfd2f8f2ce400841cb4981e3f3d"; }
+ { locale = "bg"; arch = "linux-i686"; sha256 = "6929e9c0580e62cffb3bfffb1398f35b7ac59dcc3d76a4a5c49a20cfb72e6d60"; }
+ { locale = "bg"; arch = "linux-x86_64"; sha256 = "19e2098131a6e280f1f8e8bae7c623ebe1081b0ea0dea81ebbaea51111774729"; }
+ { locale = "bn-BD"; arch = "linux-i686"; sha256 = "30f95bf5d5974ab417ff5a24fad78687b88b3f16e2337a3a4a22dd4f1d670c7a"; }
+ { locale = "bn-BD"; arch = "linux-x86_64"; sha256 = "85000f577549ccf35b2a43dc3a79264b78d100dce1e0cfd3418a0ec1f87cff90"; }
+ { locale = "br"; arch = "linux-i686"; sha256 = "ef31dbfc1cc4528ee762e384d5e12fb6383f57ea34d4d1625975a2341d5004da"; }
+ { locale = "br"; arch = "linux-x86_64"; sha256 = "d2f8330081a203477c6fc6007230f3893290c17aab4ba9e8ed591ddc337dd73c"; }
+ { locale = "ca"; arch = "linux-i686"; sha256 = "86be66b6f8075cd85470e60a1e278fb7992fbd130b6481f0ebc21e9ad46c647f"; }
+ { locale = "ca"; arch = "linux-x86_64"; sha256 = "a2b19e3ce3a747e4b1e5b52d463e3f5822e8e120a7e043d83057746552fa9867"; }
+ { locale = "cs"; arch = "linux-i686"; sha256 = "632ece525a79537acad192f8ec37fbb1e3423bcf64b1af5d18da34f1410ffbae"; }
+ { locale = "cs"; arch = "linux-x86_64"; sha256 = "f45e4701d4b81e4a5a052b5759616540317b9e89e241dc97ad1ffc39b18abaed"; }
+ { locale = "da"; arch = "linux-i686"; sha256 = "9befe92c296b57c7a7b97ecb6eb23803c93949056177df72bc111c6e18d497f0"; }
+ { locale = "da"; arch = "linux-x86_64"; sha256 = "343ef548a102a63a96b1a10745ff7866f30ac6524d4f7a2ced1be3cb3bd9f64c"; }
+ { locale = "de"; arch = "linux-i686"; sha256 = "010c9225f56a3d9f552f77502daf2e70e88e45f85b39f183907741ad773cf811"; }
+ { locale = "de"; arch = "linux-x86_64"; sha256 = "ed60c8dd0abda8c8cabdf34fcb96d39463cde9cdf1247af44438da7586490120"; }
+ { locale = "el"; arch = "linux-i686"; sha256 = "03affa186bb66fabd9b61d0e53cb7f75aa13702a58fd2dd551e6da1b6e9cfd87"; }
+ { locale = "el"; arch = "linux-x86_64"; sha256 = "d60419e5ebeec445e8efc8d9db59d093060be86af140605c8019a8f24680c4bb"; }
+ { locale = "en-GB"; arch = "linux-i686"; sha256 = "e1b6c1f3f30ea522410f947c9cf331e3d580a1620af63401186d435707a041d8"; }
+ { locale = "en-GB"; arch = "linux-x86_64"; sha256 = "6d873704a2cbeb2549dd2e55b8c915292b7167ce2f5022defd3bb2c0ad29da58"; }
+ { locale = "en-US"; arch = "linux-i686"; sha256 = "6441f90eda22808c37bca023748efee7735cf9b18b1d21ce75878c10da8baad7"; }
+ { locale = "en-US"; arch = "linux-x86_64"; sha256 = "a54afdf7dcadb94bfe2bc6ea3d6232d311568a74ed3fd93becff9cd57063ff0c"; }
+ { locale = "es-AR"; arch = "linux-i686"; sha256 = "989f400b587a75160a4ef1b6913819e0bd2c8b0689753b233943e61412bdba4d"; }
+ { locale = "es-AR"; arch = "linux-x86_64"; sha256 = "c294e1a4173dd14222d0edba31c529a3f9005412de728b1a17602e2a89c84af8"; }
+ { locale = "es-ES"; arch = "linux-i686"; sha256 = "f6eac1108efaaa0c5f34c4856e7db5236c60b8aba7c99558b32b4e60f1df3dea"; }
+ { locale = "es-ES"; arch = "linux-x86_64"; sha256 = "74132bc1e0fbe03c462399860168928bb1bca20ee1b0bf9a80262538ce320f57"; }
+ { locale = "et"; arch = "linux-i686"; sha256 = "09fea4be7480ae51d7d68bc4b044c4d4a79e405893c4952ae083a8f417b99b85"; }
+ { locale = "et"; arch = "linux-x86_64"; sha256 = "c8c5d621d975cfeb22695e589dd69a360d1b1dc6a4d0f52afc3b778835fbdb55"; }
+ { locale = "eu"; arch = "linux-i686"; sha256 = "19af889a9205d99080aa1a0afc7c75d0c43a970f864d4cefb956cc37c618b7d7"; }
+ { locale = "eu"; arch = "linux-x86_64"; sha256 = "0074802e84cab6ad21de7d960709ba15531705f4ff60bf141a917edb5295c201"; }
+ { locale = "fi"; arch = "linux-i686"; sha256 = "ae301f557be17b60290ee0910053fc99ab367fd6a68b4f0c27e1e80316fea95d"; }
+ { locale = "fi"; arch = "linux-x86_64"; sha256 = "567009788743148001e842418bfa520275ae6ed39857fd99da90ea37f6635008"; }
+ { locale = "fr"; arch = "linux-i686"; sha256 = "0491d2760611a5709c23df1a3ae618b4bc069c4af5ce2b2b7ae491bac390c058"; }
+ { locale = "fr"; arch = "linux-x86_64"; sha256 = "64e4cfe3e899cbd71ac3c3b6052d742bae4215704eeffb51f27c93f98ec7f3cb"; }
+ { locale = "fy-NL"; arch = "linux-i686"; sha256 = "9d72a5fdc02ce45030bf44d7d8b31274cfb3579efc93d064824e6909fef2ed81"; }
+ { locale = "fy-NL"; arch = "linux-x86_64"; sha256 = "f04d7404ce637abd3d807484422970852db0253da3da0a0654f3bea213f352a3"; }
+ { locale = "ga-IE"; arch = "linux-i686"; sha256 = "853112a5c6fda45afed60a9c9f2d5f9fe972d21b092ae83cc4a3796f1be90b91"; }
+ { locale = "ga-IE"; arch = "linux-x86_64"; sha256 = "36b0cef0ba9e483b13ce5f9fd12e7bc11e2bd0270b5b34e5b2690e79248724b5"; }
+ { locale = "gd"; arch = "linux-i686"; sha256 = "fcb07754340c2558e94ce44ac6e1577fb4cd155577b6bece74ceb61b2bf204b1"; }
+ { locale = "gd"; arch = "linux-x86_64"; sha256 = "cc842860d7abfc114c0db47d832508a70ea1ff0bc726fc58ccb875c245689d2b"; }
+ { locale = "gl"; arch = "linux-i686"; sha256 = "325e8a27d49b1748ac7b5c2070d32df0d66c8d9b1b651136d500d2bb4bfefe14"; }
+ { locale = "gl"; arch = "linux-x86_64"; sha256 = "dd4c6aad88ac32d6175320bd82026ae6b1c4f7b44fe04904743c7e7e3d270642"; }
+ { locale = "he"; arch = "linux-i686"; sha256 = "cbf801085b4a7a3b2ac84790b176fbea8e254b13776bd19413d4c5b6522645ea"; }
+ { locale = "he"; arch = "linux-x86_64"; sha256 = "9d60e3a8b5756bc3d3a9148dee458c28bed9bf1fac29587bd7e95318a78f59d8"; }
+ { locale = "hr"; arch = "linux-i686"; sha256 = "4361a3dc02a0dc8a26716a96aa47f0c529e0942658fcd16b472d03ae1f0f50d7"; }
+ { locale = "hr"; arch = "linux-x86_64"; sha256 = "b23b33c823ee55daa5a3f90a9f1f616fb8ea67be912182b6118521541f7039fa"; }
+ { locale = "hu"; arch = "linux-i686"; sha256 = "3d2e37fbdd5af291bc90666460258b61e4b499007ad9bba5e6e48b3b3f9cb068"; }
+ { locale = "hu"; arch = "linux-x86_64"; sha256 = "a7b904317bcf046f9139c415f1c453b66e355b31291211dc8dac76200902ac11"; }
+ { locale = "hy-AM"; arch = "linux-i686"; sha256 = "8802522b5db21a9230ae856f90013d80a466a8c2caed35079318ece7028120cd"; }
+ { locale = "hy-AM"; arch = "linux-x86_64"; sha256 = "43e899856a625d8dea84c79c0c7d1dfa15f286da628cec9f99c351139de1831e"; }
+ { locale = "id"; arch = "linux-i686"; sha256 = "6ff994c056189d13a0c36cde5925e45ba3ba52ccab61486b338a1753eafc09c8"; }
+ { locale = "id"; arch = "linux-x86_64"; sha256 = "287e89ba01280eb778b1cf1f2fd9859610b46f2abfe369fe54d4af8cc1f675ac"; }
+ { locale = "is"; arch = "linux-i686"; sha256 = "5ee6ea3e48d526af3ef29ef374b40a0cafb299d32c1d6af4684382b8b171f88c"; }
+ { locale = "is"; arch = "linux-x86_64"; sha256 = "aae33e6b2e75a9db69d17d356bc49e026bf39199cd1612ce42aa41a102a1ac03"; }
+ { locale = "it"; arch = "linux-i686"; sha256 = "3a54ac3fc738e02c8ed9b7a730624497fab15dee4f9f82e84a526dd5600e300a"; }
+ { locale = "it"; arch = "linux-x86_64"; sha256 = "cc99d99214e6d847fc885af036783fe3c1b2a55b04c758bbb2fd5bd0a39463ff"; }
+ { locale = "ja"; arch = "linux-i686"; sha256 = "804485d204392b52b4bfdbb28804f729614c53fa692a89e58f97161c89809bf0"; }
+ { locale = "ja"; arch = "linux-x86_64"; sha256 = "8bdce5e6f97c2747ff209acee7fad24f2dc0e07801ee30754370bb0450d383f7"; }
+ { locale = "ko"; arch = "linux-i686"; sha256 = "61ab133865b2c62ea88154917ddf1383a3157b96ac3b073568e392036874f5d7"; }
+ { locale = "ko"; arch = "linux-x86_64"; sha256 = "695ef59b94626f03151c8bd68ea799b0ae5e879a57f8185af5557799211bda1f"; }
+ { locale = "lt"; arch = "linux-i686"; sha256 = "014e8604790af3fa4af504986b86dc0de4bd2e53267548c01bb85e48bc90ffc5"; }
+ { locale = "lt"; arch = "linux-x86_64"; sha256 = "8c803b613526d39618c8e82d9f981293ebb6799136697488ef4d10eb2a485808"; }
+ { locale = "nb-NO"; arch = "linux-i686"; sha256 = "bfc828d3882588a9909fef1d6731a6bc1636eaf53342a57d56e3fbc975133869"; }
+ { locale = "nb-NO"; arch = "linux-x86_64"; sha256 = "f25bc7dacd28fd2c907565ab608d504abcc2896118e4cd8813de28c75d26c569"; }
+ { locale = "nl"; arch = "linux-i686"; sha256 = "cb94f869fa63215686465bb29a8c05f80611cd60a82d7cbded6ddf55577172e1"; }
+ { locale = "nl"; arch = "linux-x86_64"; sha256 = "ecb185013de3d55cfafaa156821308453a90a123b99d122ea4ef7a29e7d7fab5"; }
+ { locale = "nn-NO"; arch = "linux-i686"; sha256 = "8719216b8cc0293d8aa23c04e2d663dfef515a7bc1b6e06a5f03bed3d6fb3b6a"; }
+ { locale = "nn-NO"; arch = "linux-x86_64"; sha256 = "f6617cf98b49d28ae7fa8e7d022587c6ed8138c758ff088c5abc78f7bdd52613"; }
+ { locale = "pa-IN"; arch = "linux-i686"; sha256 = "b0e57d139f359850558f40bad00b2c4e69da8e9d73ec9aa7d180b9f33d970449"; }
+ { locale = "pa-IN"; arch = "linux-x86_64"; sha256 = "2efcfe4b366f7ff5dc95c45cb229aeed316315fe4554651e5d0239985cd64fdb"; }
+ { locale = "pl"; arch = "linux-i686"; sha256 = "3d579ed8e18d98c446a5f069d6d2e94a3ee234c75feffbaf99f561ef7bd45a2e"; }
+ { locale = "pl"; arch = "linux-x86_64"; sha256 = "04090e4b4b412f79d1879340c36e36c65e4f23fde5dc545b4d855c8497ca47f7"; }
+ { locale = "pt-BR"; arch = "linux-i686"; sha256 = "9d202dd10b626ed9753ac5e243c14f6b1eee76e8edd40389f56003c4e8816c83"; }
+ { locale = "pt-BR"; arch = "linux-x86_64"; sha256 = "3b82124d8956e83657b30347ef3b5e44cf3813c1b02998b197c817c6528423c0"; }
+ { locale = "pt-PT"; arch = "linux-i686"; sha256 = "65ebb88e9e544c38a9d85a70a1920ed9c6ec03452762f98cb2fe104912074b44"; }
+ { locale = "pt-PT"; arch = "linux-x86_64"; sha256 = "fba7f18daee4832b9851615a0597dbde98a5271c5882d56ab4c1e0cb6d8c4783"; }
+ { locale = "rm"; arch = "linux-i686"; sha256 = "e0ffc4b23cbf4a92768eff507335dffb92fad26d02662adf77e0ccff4f4b6c8b"; }
+ { locale = "rm"; arch = "linux-x86_64"; sha256 = "555e30eaa6942543c7b1cd3569a6480016be5826a474a76c2ba8e2078d6d5b83"; }
+ { locale = "ro"; arch = "linux-i686"; sha256 = "38bf63ae8365fbe1ca88b683d94c21cd5620a7397b3b344c0e4e938287311ec3"; }
+ { locale = "ro"; arch = "linux-x86_64"; sha256 = "328cb7395e61924240f8e29399bf1d64179bce5bb911595cda422b741d9b6f34"; }
+ { locale = "ru"; arch = "linux-i686"; sha256 = "8df9749d8dbe4218910026a8e4c4145b1f155903e577a16758d15eefbc2715f9"; }
+ { locale = "ru"; arch = "linux-x86_64"; sha256 = "99cd036facc18242e5ab5df00a480e5c7c779b50fa95eac191bbebfa7343a270"; }
+ { locale = "si"; arch = "linux-i686"; sha256 = "4ce33a17b148329334e596186d274b9c262a779e7190f9777dd0673df12f7b4c"; }
+ { locale = "si"; arch = "linux-x86_64"; sha256 = "c22cd896e651b2e664128411710a80a33471319951f5aff3cfc86ff86de39a86"; }
+ { locale = "sk"; arch = "linux-i686"; sha256 = "30351a15f43f905bf69e578d9ce14506ade61e805e34097f81bf8ac50f1f9ee9"; }
+ { locale = "sk"; arch = "linux-x86_64"; sha256 = "c8930d6ebff4f7429af5daf72648651162543fa000acad0fb63179c2c3f150e6"; }
+ { locale = "sl"; arch = "linux-i686"; sha256 = "10c61d7e3bc592f23811d5a06fcdc892a088cbef7fc3298e8ed9937dc7518b37"; }
+ { locale = "sl"; arch = "linux-x86_64"; sha256 = "81483f6bdc85eb244904d3a8328d81391be24ea2ae7604cb00bbf922025afd89"; }
+ { locale = "sq"; arch = "linux-i686"; sha256 = "8ac202a6eb0a3f08e9c34502b26b0cf1a85ab43850658cce7042f0afd5f9f50a"; }
+ { locale = "sq"; arch = "linux-x86_64"; sha256 = "23fc8634b6dfa984c530292f7f01f9a2d43b196a8092f93cc435abd7a8d131de"; }
+ { locale = "sr"; arch = "linux-i686"; sha256 = "9c96c0935b7a0124059caea758ba3319cc3a5977e542965f663d2daa54f5a32e"; }
+ { locale = "sr"; arch = "linux-x86_64"; sha256 = "2d64f970c70f34bd726296b8aa2db243c245d2c36167a36de7032ae17fc1ccb2"; }
+ { locale = "sv-SE"; arch = "linux-i686"; sha256 = "1b0d6476248896b9224c5c69a944084677df45e273508bf8d629eb14b57662a9"; }
+ { locale = "sv-SE"; arch = "linux-x86_64"; sha256 = "05977173bdd460eab1ff5a7065067b4074417297e38dbc70c6cceedca0c933b5"; }
+ { locale = "ta-LK"; arch = "linux-i686"; sha256 = "3ef8950e8aa9f130aa66a1ad2cfdd21c2ba9572ef3e0d868d7a8fbf1ef8e3291"; }
+ { locale = "ta-LK"; arch = "linux-x86_64"; sha256 = "be101ca34d96577ccc6ba715235eefa9dd065f04a651e9a35786f9edb6278a98"; }
+ { locale = "tr"; arch = "linux-i686"; sha256 = "d5b35faa3e0e09af778aebec4b33f39bbce98465a39edb2da15197671b777abe"; }
+ { locale = "tr"; arch = "linux-x86_64"; sha256 = "995c1abcd5357cfda831d07ad6e0b762fbabda61601a58122acc2e8942fb944a"; }
+ { locale = "uk"; arch = "linux-i686"; sha256 = "6c5b0df0a1448fcf1cebc8d82072d5653cb0432e2f787179526bae4cef774352"; }
+ { locale = "uk"; arch = "linux-x86_64"; sha256 = "86f3ce21bc863eb8f3e0099d9386e0f38ad8b2c8e29a79e47bfda37acecd991f"; }
+ { locale = "vi"; arch = "linux-i686"; sha256 = "0a21d13abb629549df74d956cc1c5f99c879980fbee2d269e1532610aebb404c"; }
+ { locale = "vi"; arch = "linux-x86_64"; sha256 = "29cbf72f4990eb55d30a85a767d01c8077ab89af69eba3b7299d43871aaa165e"; }
+ { locale = "xpi"; arch = "linux-i686"; sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; }
+ { locale = "xpi"; arch = "linux-x86_64"; sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; }
+ { locale = "zh-CN"; arch = "linux-i686"; sha256 = "1527b8e9f245c96d0104f0b7d5c8dc696036fbb80067d14a1eee9a423ddd9368"; }
+ { locale = "zh-CN"; arch = "linux-x86_64"; sha256 = "ae294571b8433b646b5d65a0cb1ab7f42295b17369f5ec82c2383c654df28e20"; }
+ { locale = "zh-TW"; arch = "linux-i686"; sha256 = "98e5c8f912d1a03f5c0a2f14b63f350823d15f1253e15a318b61227ba82fec0e"; }
+ { locale = "zh-TW"; arch = "linux-x86_64"; sha256 = "49ee58ad3978113e10de520eb094fc9c0f4d740ca6c0a0e07d5743e313163d0f"; }
+ ];
+
+ arch = if stdenv.system == "i686-linux"
+ then "linux-i686"
+ else "linux-x86_64";
+
+ isPrefixOf = prefix: string:
+ builtins.substring 0 (builtins.stringLength prefix) string == prefix;
+
+ sourceMatches = locale: source:
+ (isPrefixOf source.locale locale) && source.arch == arch;
+
+ systemLocale = config.i18n.defaultLocale or "en-US";
+
+ defaultSource = stdenv.lib.findFirst (sourceMatches "en-US") {} sources;
+
+ source = stdenv.lib.findFirst (sourceMatches systemLocale) defaultSource sources;
+
+in
+
+stdenv.mkDerivation {
+ name = "thunderbird-bin-${version}";
+
+ src = fetchurl {
+ url = "http://download-installer.cdn.mozilla.net/pub/thunderbird/releases/${version}/${source.arch}/${source.locale}/thunderbird-${version}.tar.bz2";
+ inherit (source) sha256;
+ };
+
+ phases = "unpackPhase installPhase";
+
+ libPath = stdenv.lib.makeLibraryPath
+ [ stdenv.gcc.gcc
+ gconf
+ alsaLib
+ at_spi2_atk
+ atk
+ cairo
+ cups
+ curl
+ dbus_glib
+ dbus_libs
+ fontconfig
+ freetype
+ gdk_pixbuf
+ glib
+ glibc
+ gst_plugins_base
+ gstreamer
+ gtk
+ kerberos
+ libX11
+ libXScrnSaver
+ libXext
+ libXinerama
+ libXrender
+ libXt
+ libcanberra
+ libgnome
+ libgnomeui
+ mesa
+ nspr
+ nss
+ pango
+ ] + ":" + stdenv.lib.makeSearchPath "lib64" [
+ stdenv.gcc.gcc
+ ];
+
+ installPhase =
+ ''
+ mkdir -p "$prefix/usr/lib/thunderbird-bin-${version}"
+ cp -r * "$prefix/usr/lib/thunderbird-bin-${version}"
+
+ mkdir -p "$out/bin"
+ ln -s "$prefix/usr/lib/thunderbird-bin-${version}/thunderbird" "$out/bin/"
+
+ for executable in \
+ thunderbird mozilla-xremote-client thunderbird-bin plugin-container \
+ updater
+ do
+ patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ "$out/usr/lib/thunderbird-bin-${version}/$executable"
+ done
+
+ for executable in \
+ thunderbird mozilla-xremote-client thunderbird-bin plugin-container \
+ updater libxul.so
+ do
+ patchelf --set-rpath "$libPath" \
+ "$out/usr/lib/thunderbird-bin-${version}/$executable"
+ done
+
+ # Create a desktop item.
+ mkdir -p $out/share/applications
+ cat > $out/share/applications/thunderbird.desktop <
+Date: Sun, 13 Apr 2014 15:17:24 +0200
+Subject: [PATCH] Lookup dumpcap in PATH
+
+NixOS patch: Look for dumpcap in PATH first, because there may be a
+dumpcap setuid-wrapper that we want to use instead of the default
+non-setuid dumpcap binary.
+
+Also change execv() to execvp() because we've set argv[0] to "dumpcap"
+and have to enable PATH lookup. Wireshark is not a setuid program, so
+looking in PATH is not a security issue.
+---
+ capture_sync.c | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/capture_sync.c b/capture_sync.c
+index eb05fae..efb5675 100644
+--- a/capture_sync.c
++++ b/capture_sync.c
+@@ -326,8 +326,18 @@ init_pipe_args(int *argc) {
+ argv = (char **)g_malloc(sizeof (char *));
+ *argv = NULL;
+
+- /* take Wireshark's absolute program path and replace "Wireshark" with "dumpcap" */
+- exename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "dumpcap", progfile_dir);
++ /*
++ * NixOS patch: Look for dumpcap in PATH first, because there may be a
++ * dumpcap setuid-wrapper that we want to use instead of the default
++ * non-setuid dumpcap binary.
++ */
++ if (system("command -v dumpcap >/dev/null") == 0) {
++ /* Found working dumpcap */
++ exename = g_strdup_printf("dumpcap");
++ } else {
++ /* take Wireshark's absolute program path and replace "Wireshark" with "dumpcap" */
++ exename = g_strdup_printf("%s" G_DIR_SEPARATOR_S "dumpcap", progfile_dir);
++ }
+
+ /* Make that the first argument in the argument list (argv[0]). */
+ argv = sync_pipe_add_arg(argv, argc, exename);
+@@ -649,7 +659,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi
+ */
+ dup2(sync_pipe[PIPE_WRITE], 2);
+ ws_close(sync_pipe[PIPE_READ]);
+- execv(argv[0], argv);
++ execvp(argv[0], argv);
+ g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
+ argv[0], g_strerror(errno));
+ sync_pipe_errmsg_to_parent(2, errmsg, "");
+@@ -879,7 +889,7 @@ sync_pipe_open_command(char** argv, int *data_read_fd,
+ dup2(sync_pipe[PIPE_WRITE], 2);
+ ws_close(sync_pipe[PIPE_READ]);
+ ws_close(sync_pipe[PIPE_WRITE]);
+- execv(argv[0], argv);
++ execvp(argv[0], argv);
+ g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
+ argv[0], g_strerror(errno));
+ sync_pipe_errmsg_to_parent(2, errmsg, "");
+--
+1.9.0
+
diff --git a/pkgs/applications/networking/sync/rsync/default.nix b/pkgs/applications/networking/sync/rsync/default.nix
index 5447b21009f..6a5c574f638 100644
--- a/pkgs/applications/networking/sync/rsync/default.nix
+++ b/pkgs/applications/networking/sync/rsync/default.nix
@@ -6,30 +6,38 @@
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;
- patches = [] ++ stdenv.lib.optional enableCopyDevicesPatch "./patches/copy-devices.diff";
+ patches = [(fetchurl {
+ url = "https://git.samba.org/?p=rsync.git;a=commitdiff_plain;h=0dedfbce2c1b851684ba658861fe9d620636c56a";
+ sha256 = "1jpwwdf07naqxc8fv1lspc95jgk50j5j3wvf037bjay2qzpwjmvf";
+ name = "CVE-2014-2855.patch";
+ })]
+ ++ stdenv.lib.optional enableCopyDevicesPatch "./patches/copy-devices.diff";
buildInputs = stdenv.lib.optional enableACLs acl;
nativeBuildInputs = [perl];
+ configureFlags = "--with-nobody-group=nogroup";
+
meta = {
homepage = http://samba.anu.edu.au/rsync/;
description = "A fast incremental file transfer utility";
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/syncthing/default.nix b/pkgs/applications/networking/syncthing/default.nix
index 50bc61eeeff..28603daa9c6 100644
--- a/pkgs/applications/networking/syncthing/default.nix
+++ b/pkgs/applications/networking/syncthing/default.nix
@@ -2,29 +2,25 @@
stdenv.mkDerivation rec {
name = "syncthing-${version}";
- version = "0.7.1";
+ version = "0.8.11";
src = fetchgit {
url = "git://github.com/calmh/syncthing.git";
rev = "refs/tags/v${version}";
- sha256 = "1rja837kimiq15km8cridbm5yxvkm6mkvkwywdi76qf9rm0pcjl1";
+ sha256 = "16dl9sqwhv0n1602pmi10d5j7z2196ijhvz4rfx7732210qbkpnn";
};
buildInputs = [ go ];
+ patches = [ ./upnp.patch ];
+
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"
+ for a in auto buffers cid discover files lamport protocol scanner \
+ logger beacon config xdr upnp model osutil versioner; do
+ cp -r "./$a" "./dependencies/src/github.com/calmh/syncthing"
+ done
export GOPATH="`pwd`/Godeps/_workspace:`pwd`/dependencies"
diff --git a/pkgs/applications/networking/syncthing/upnp.patch b/pkgs/applications/networking/syncthing/upnp.patch
new file mode 100644
index 00000000000..f4164b4f6bc
--- /dev/null
+++ b/pkgs/applications/networking/syncthing/upnp.patch
@@ -0,0 +1,28 @@
+Trying to fix upnp for miniupnpd:
+https://github.com/calmh/syncthing/issues/211
+
+diff --git a/upnp/upnp.go b/upnp/upnp.go
+index 9de719a..9c85b23 100644
+--- a/upnp/upnp.go
++++ b/upnp/upnp.go
+@@ -60,14 +60,12 @@ func Discover() (*IGD, error) {
+ return nil, err
+ }
+
+- search := []byte(`
+-M-SEARCH * HTTP/1.1
+-Host: 239.255.255.250:1900
+-St: urn:schemas-upnp-org:device:InternetGatewayDevice:1
+-Man: "ssdp:discover"
+-Mx: 3
+-
+-`)
++ search := []byte("M-SEARCH * HTTP/1.1\r\n" +
++"Host: 239.255.255.250:1900\r\n" +
++"St: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n" +
++"Man: \"ssdp:discover\"\r\n" +
++"Mx: 3\r\n" +
++"\r\n")
+
+ _, err = socket.WriteTo(search, ssdp)
+ if err != nil {
diff --git a/pkgs/applications/networking/znc/default.nix b/pkgs/applications/networking/znc/default.nix
index dbf886de978..fdd02aac0b5 100644
--- a/pkgs/applications/networking/znc/default.nix
+++ b/pkgs/applications/networking/znc/default.nix
@@ -7,11 +7,11 @@
with stdenv.lib;
stdenv.mkDerivation rec {
- name = "znc-1.2";
+ name = "znc-1.4";
src = fetchurl {
url = "http://znc.in/releases/${name}.tar.gz";
- sha256 = "07bh306wl5494sqsgz4a526wvyrylkc8vpnbr5pkxwjg90mcv8nr";
+ sha256 = "0lkv58pq4d5lzcyx8v8anzinx0sx0zw0js4jij13jb8qxp88zsc6";
};
buildInputs = [ openssl pkgconfig ]
diff --git a/pkgs/applications/office/gnumeric/default.nix b/pkgs/applications/office/gnumeric/default.nix
index 0ae27e322b7..014aa5bf0fd 100644
--- a/pkgs/applications/office/gnumeric/default.nix
+++ b/pkgs/applications/office/gnumeric/default.nix
@@ -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/hledger-irr/default.nix b/pkgs/applications/office/hledger-irr/default.nix
index 430b93011a3..303c6486381 100644
--- a/pkgs/applications/office/hledger-irr/default.nix
+++ b/pkgs/applications/office/hledger-irr/default.nix
@@ -2,8 +2,8 @@
cabal.mkDerivation (self: {
pname = "hledger-irr";
- version = "0.1.1.3";
- sha256 = "0vjf478b9msmgr1nxyy8pgc9mvn61i768ypcr5gbinsnsr9kxqsm";
+ version = "0.1.1.4";
+ sha256 = "0nqd8br86d71dpwq7p8956q74pgqdimid42xikp9zvf632x2s8ax";
isLibrary = false;
isExecutable = true;
buildDepends = [ Cabal hledgerLib statistics time ];
diff --git a/pkgs/applications/office/keepnote/default.nix b/pkgs/applications/office/keepnote/default.nix
index 514b8fd3151..419d761b095 100644
--- a/pkgs/applications/office/keepnote/default.nix
+++ b/pkgs/applications/office/keepnote/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchurl, buildPythonPackage, pythonPackages, pygtk }:
buildPythonPackage {
- name = "keepnote-0.6.5";
+ name = "keepnote-0.7.8";
namePrefix = "";
src = fetchurl {
- url = http://rasm.ods.org/keepnote/download/keepnote-0.6.5.tar.gz;
- sha256 = "0kipcy90r50z4m9p8pyy9wi4dknsiwdrgy974xgakris2rh4lafw";
+ url = "http://keepnote.org/download/keepnote-0.7.8.tar.gz";
+ sha256 = "0nhkkv1n0lqf3zn17pxg5cgryv1wwlj4hfmhixwd76rcy8gs45dh";
};
propagatedBuildInputs = [ pythonPackages.sqlite3 pygtk ];
diff --git a/pkgs/applications/office/ledger/2.6.3.nix b/pkgs/applications/office/ledger/2.6.3.nix
index ca71ceeca66..69015dfb2d7 100644
--- a/pkgs/applications/office/ledger/2.6.3.nix
+++ b/pkgs/applications/office/ledger/2.6.3.nix
@@ -1,7 +1,7 @@
{ stdenv, fetchurl, emacs, gmp, pcre, expat }:
stdenv.mkDerivation rec {
- name = "ledger-2.6.3";
+ name = "ledger2-2.6.3";
src = fetchurl {
url = "https://github.com/downloads/ledger/ledger/${name}.tar.gz";
diff --git a/pkgs/applications/office/ledger/3.0.nix b/pkgs/applications/office/ledger/3.0.nix
index 1afa3a979e3..21f77ea1ea4 100644
--- a/pkgs/applications/office/ledger/3.0.nix
+++ b/pkgs/applications/office/ledger/3.0.nix
@@ -1,28 +1,28 @@
-{ stdenv, fetchgit, cmake, boost, gmp, mpfr, libedit, python, texinfo }:
+{ stdenv, fetchgit, cmake, boost, gmp, mpfr, libedit, python
+, texinfo, gnused }:
let
- rev = "3b5f496536";
+ rev = "a0c5addbbd";
in
+
stdenv.mkDerivation {
- name = "ledger3-2013.12.${rev}";
+ name = "ledger-3.0.2.${rev}";
src = fetchgit {
- url = "https://github.com/ledger/ledger.git";
+ url = "git://github.com/ledger/ledger.git";
inherit rev;
- sha256 = "0r36zsdsyy6aylfcwyqra4796y4abi3b27wv5fvk3g2bmyzqzx4j";
+ sha256 = "1yr4i8gpby67j4vl7xk109dwb14z8a424nwgva8rbms8115w4ps5";
};
- buildInputs = [ cmake boost gmp mpfr libedit python texinfo ];
+ buildInputs = [ cmake boost gmp mpfr libedit python texinfo gnused ];
- # Tests on Darwin are failing
- doCheck = !stdenv.isDarwin;
enableParallelBuilding = true;
# Skip byte-compiling of emacs-lisp files because this is currently
# broken in ledger...
postInstall = ''
mkdir -p $out/share/emacs/site-lisp/
- cp -v $src/lisp/*.el $out/share/emacs/site-lisp/
+ cp -v "$src/lisp/"*.el $out/share/emacs/site-lisp/
'';
meta = {
@@ -38,6 +38,6 @@ stdenv.mkDerivation {
'';
platforms = stdenv.lib.platforms.all;
- maintainers = with stdenv.lib.maintainers; [ simons the-kenny ];
+ maintainers = with stdenv.lib.maintainers; [ simons the-kenny jwiegley ];
};
}
diff --git a/pkgs/applications/office/libreoffice/default.nix b/pkgs/applications/office/libreoffice/default.nix
index 5918f0612ce..f4da232c747 100644
--- a/pkgs/applications/office/libreoffice/default.nix
+++ b/pkgs/applications/office/libreoffice/default.nix
@@ -257,6 +257,7 @@ stdenv.mkDerivation rec {
neon nspr nss openldap openssl ORBit2 pam perl pkgconfigUpstream poppler
python3 sablotron saneBackends tcsh unzip vigra which zip zlib
mdds bluez5 glibc libmspub libixion liborcus liblangtag
+ libxshmfence
];
meta = with stdenv.lib; {
diff --git a/pkgs/applications/office/zotero/default.nix b/pkgs/applications/office/zotero/default.nix
index 4afd250a549..5b311956da9 100644
--- a/pkgs/applications/office/zotero/default.nix
+++ b/pkgs/applications/office/zotero/default.nix
@@ -3,7 +3,7 @@
assert (stdenv.system == "x86_64-linux" || stdenv.system == "i686-linux");
let
- version = "4.0.19";
+ version = "4.0.20";
arch = if stdenv.system == "x86_64-linux"
then "linux-x86_64"
else "linux-i686";
@@ -14,8 +14,8 @@ stdenv.mkDerivation {
src = fetchurl {
url = "https://download.zotero.org/standalone/${version}/Zotero-${version}_${arch}.tar.bz2";
sha256 = if stdenv.system == "x86_64-linux"
- then "0xihvk7ms1vvzmxvpw8hs15pl1vvmf3zd72nwyaqhg469kwcz9s1"
- else "1z4q8nzl90snb03ywk0cp64nv3cgasj9fvbcw2d4bgl2zlgwzpy9";
+ then "0d7813k3h60fpxabdwiw83g5zfy9knxc9irgxxz60z31vd14zi0x"
+ else "0nj4mj22bkn2nwbkfs40kg4br6h6gcf718v9lfnvs13cyhx0wapc";
};
# Strip the bundled xulrunner
diff --git a/pkgs/applications/science/electronics/pulseview/default.nix b/pkgs/applications/science/electronics/pulseview/default.nix
new file mode 100644
index 00000000000..07724d93254
--- /dev/null
+++ b/pkgs/applications/science/electronics/pulseview/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pkgconfig, cmake, glib, qt4, boost, libsigrok
+, libsigrokdecode, libserialport, libzip, udev, libusb1, libftdi
+}:
+
+stdenv.mkDerivation rec {
+ name = "pulseview-0.2.0";
+
+ src = fetchurl {
+ url = "http://sigrok.org/download/source/pulseview/${name}.tar.gz";
+ sha256 = "1pf1dgwd9j586nqmni6gqf3qxrsmawcmi9wzqfzqkjci18xd7dgy";
+ };
+
+ buildInputs = [ pkgconfig cmake glib qt4 boost libsigrok
+ libsigrokdecode libserialport libzip udev libusb1 libftdi
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Qt-based LA/scope/MSO GUI for sigrok (a signal analysis software suite)";
+ homepage = http://sigrok.org/;
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.bjornfor ];
+ };
+}
diff --git a/pkgs/applications/science/electronics/qfsm/default.nix b/pkgs/applications/science/electronics/qfsm/default.nix
index 0f24784e9e5..160c530e722 100644
--- a/pkgs/applications/science/electronics/qfsm/default.nix
+++ b/pkgs/applications/science/electronics/qfsm/default.nix
@@ -18,7 +18,6 @@ stdenv.mkDerivation rec {
description = "Graphical editor for finite state machines";
homepage = "http://qfsm.sourceforge.net/";
license = stdenv.lib.licenses.gpl3Plus;
- maintainers = [ stdenv.lib.maintainers.simons ];
- platforms = stdenv.lib.platforms.linux;
+ broken = true;
};
}
diff --git a/pkgs/applications/science/electronics/tkgate/1.x.nix b/pkgs/applications/science/electronics/tkgate/1.x.nix
index 7c04c85fdb7..1feac0b31c1 100644
--- a/pkgs/applications/science/electronics/tkgate/1.x.nix
+++ b/pkgs/applications/science/electronics/tkgate/1.x.nix
@@ -1,7 +1,9 @@
-{ stdenv, fetchurl, tcl, tk, libX11, libiconvOrLibc, which, yacc, flex, imake, xproto, gccmakedep }:
-
-assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
+{ stdenv, fetchurl, tcl, tk, libX11, glibc, which, yacc, flex, imake, xproto, gccmakedep }:
+let
+ libiconvInc = stdenv.lib.optionalString stdenv.isLinux "${glibc}/include";
+ libiconvLib = stdenv.lib.optionalString stdenv.isLinux "${glibc}/lib";
+in
stdenv.mkDerivation rec {
name = "tkgate-1.8.7";
@@ -10,13 +12,13 @@ stdenv.mkDerivation rec {
sha256 = "1pqywkidfpdbj18i03h97f4cimld4fb3mqfy8jjsxs12kihm18fs";
};
- buildInputs = [ tcl tk libX11 libiconvOrLibc which yacc flex imake xproto gccmakedep ];
+ buildInputs = [ tcl tk libX11 which yacc flex imake xproto gccmakedep ];
patchPhase = ''
sed -i config.h \
-e 's|.*#define.*TKGATE_TCLTK_VERSIONS.*|#define TKGATE_TCLTK_VERSIONS "8.5"|' \
- -e 's|.*#define.*TKGATE_INCDIRS.*|#define TKGATE_INCDIRS "${tcl}/include ${tk}/include ${libiconvOrLibc}/include ${libX11}/include"|' \
- -e 's|.*#define.*TKGATE_LIBDIRS.*|#define TKGATE_LIBDIRS "${tcl}/lib ${tk}/lib ${libiconvOrLibc}/lib ${libX11}/lib"|' \
+ -e 's|.*#define.*TKGATE_INCDIRS.*|#define TKGATE_INCDIRS "${tcl}/include ${tk}/include ${libiconvInc} ${libX11}/include"|' \
+ -e 's|.*#define.*TKGATE_LIBDIRS.*|#define TKGATE_LIBDIRS "${tcl}/lib ${tk}/lib ${libiconvLib} ${libX11}/lib"|' \
\
-e '20 i #define TCL_LIBRARY "${tcl}/lib"' \
-e '20 i #define TK_LIBRARY "${tk}/lib/${tk.libPrefix}"' \
@@ -33,6 +35,6 @@ stdenv.mkDerivation rec {
homepage = "http://www.tkgate.org/";
license = "GPLv2+";
maintainers = [ stdenv.lib.maintainers.simons ];
- platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/science/electronics/tkgate/2.x.nix b/pkgs/applications/science/electronics/tkgate/2.x.nix
index 756fe7052d8..25c6a309cf3 100644
--- a/pkgs/applications/science/electronics/tkgate/2.x.nix
+++ b/pkgs/applications/science/electronics/tkgate/2.x.nix
@@ -1,7 +1,9 @@
-{ stdenv, fetchurl, tcl, tk, libX11, libiconvOrLibc }:
-
-assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
+{ stdenv, fetchurl, tcl, tk, libX11, glibc }:
+let
+ libiconvInc = stdenv.lib.optionalString stdenv.isLinux "${glibc}/include";
+ libiconvLib = stdenv.lib.optionalString stdenv.isLinux "${glibc}/lib";
+in
stdenv.mkDerivation rec {
name = "tkgate-2.0-b10";
@@ -16,8 +18,8 @@ stdenv.mkDerivation rec {
patchPhase = ''
sed -i configure \
- -e 's|TKGATE_INCDIRS=.*|TKGATE_INCDIRS="${tcl}/include ${tk}/include ${libiconvOrLibc}/include"|' \
- -e 's|TKGATE_LIBDIRS=.*|TKGATE_LIBDIRS="${tcl}/lib ${tk}/lib ${libiconvOrLibc}/lib"|'
+ -e 's|TKGATE_INCDIRS=.*|TKGATE_INCDIRS="${tcl}/include ${tk}/include ${libiconvInc}"|' \
+ -e 's|TKGATE_LIBDIRS=.*|TKGATE_LIBDIRS="${tcl}/lib ${tk}/lib ${libiconvLib}"|'
sed -i options.h \
-e 's|.* #define TCL_LIBRARY .*|#define TCL_LIBRARY "${tcl}/${tcl.libdir}"|' \
-e 's|.* #define TK_LIBRARY .*|#define TK_LIBRARY "${tk}/lib/${tk.libPrefix}"|'
@@ -27,7 +29,6 @@ stdenv.mkDerivation rec {
description = "Event driven digital circuit simulator with a TCL/TK-based graphical editor";
homepage = "http://www.tkgate.org/";
license = "GPLv2+";
- maintainers = [ stdenv.lib.maintainers.simons ];
- platforms = stdenv.lib.platforms.linux;
+ broken = true;
};
}
diff --git a/pkgs/applications/science/geometry/tetgen/default.nix b/pkgs/applications/science/geometry/tetgen/default.nix
index a43ec3b0eb9..d14fa08bbb5 100644
--- a/pkgs/applications/science/geometry/tetgen/default.nix
+++ b/pkgs/applications/science/geometry/tetgen/default.nix
@@ -4,8 +4,8 @@ stdenv.mkDerivation rec {
name = "tetgen-1.4.3";
src = fetchurl {
- url = http://tetgen.berlios.de/files/tetgen1.4.3.tar.gz;
- sha256 = "159i0vdjz7abb8bycz47ax4fqlzc82kv19sygqnrkr86qm4g43wy";
+ url = "${meta.homepage}/files/tetgen1.4.3.tar.gz";
+ sha256 = "0d70vjqdapmy1ghlsxjlvl5z9yp310zw697bapc4zxmp0sxi29wm";
};
installPhase = ''
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Quality Tetrahedral Mesh Generator and 3D Delaunay Triangulator";
- homepage = "http://tetgen.berlios.de/";
+ homepage = "http://tetgen.org/";
license = "MIT";
};
}
diff --git a/pkgs/applications/science/logic/abc/default.nix b/pkgs/applications/science/logic/abc/default.nix
new file mode 100644
index 00000000000..a8076b9e29e
--- /dev/null
+++ b/pkgs/applications/science/logic/abc/default.nix
@@ -0,0 +1,27 @@
+{ fetchhg, stdenv, readline }:
+
+stdenv.mkDerivation rec {
+ name = "abc-verifier-${version}";
+ version = "140509"; # YYMMDD
+
+ src = fetchhg {
+ url = "https://bitbucket.org/alanmi/abc";
+ tag = "03e221443d71e49e56cbc37f1907ee3b0ff3e7c9";
+ sha256 = "0ahrqg718y7xpv939f6x8w1kqh7wsja4pw8hca7j67j0qjdgb4lm";
+ };
+
+ buildInputs = [ readline ];
+ enableParallelBuilding = true;
+ installPhase = ''
+ mkdir -p $out/bin
+ mv abc $out/bin
+ '';
+
+ meta = {
+ description = "Sequential Logic Synthesis and Formal Verification";
+ homepage = "www.eecs.berkeley.edu/~alanmi/abc/abc.htm";
+ license = stdenv.lib.licenses.mit;
+ platforms = stdenv.lib.platforms.unix;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ };
+}
diff --git a/pkgs/applications/science/logic/alt-ergo/default.nix b/pkgs/applications/science/logic/alt-ergo/default.nix
new file mode 100644
index 00000000000..2a95d0cd65b
--- /dev/null
+++ b/pkgs/applications/science/logic/alt-ergo/default.nix
@@ -0,0 +1,23 @@
+{ fetchurl, stdenv, ocaml, ocamlPackages, gmp }:
+
+stdenv.mkDerivation rec {
+ name = "alt-ergo-${version}";
+ version = "0.95.2";
+
+ src = fetchurl {
+ url = "http://alt-ergo.ocamlpro.com/download_manager.php?target=${name}.tar.gz";
+ name = "${name}.tar.gz";
+ sha256 = "1b7f0rh3jgm67g0x2m3wv7gnnqmz9cjlrfm136z56ihlkhsd8v2s";
+ };
+
+ buildInputs = with ocamlPackages;
+ [ ocaml findlib ocamlgraph zarith lablgtk gmp ];
+
+ meta = {
+ description = "Alt-Ergo is a high-performance theorem prover and SMT solver";
+ homepage = "http://alt-ergo.ocamlpro.com/";
+ license = stdenv.lib.licenses.cecill-c; # LGPL-2 compatible
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ };
+}
diff --git a/pkgs/applications/science/logic/coq/default.nix b/pkgs/applications/science/logic/coq/default.nix
index aa3ba878eb5..678ec6a4b04 100644
--- a/pkgs/applications/science/logic/coq/default.nix
+++ b/pkgs/applications/science/logic/coq/default.nix
@@ -3,7 +3,7 @@
{stdenv, fetchurl, pkgconfig, ocaml, findlib, camlp5, ncurses, lablgtk ? null}:
let
- version = "8.4pl3";
+ version = "8.4pl4";
buildIde = lablgtk != null;
ideFlags = if buildIde then "-lablgtkdir ${lablgtk}/lib/ocaml/*/site-lib/lablgtk2 -coqide opt" else "";
idePath = if buildIde then ''
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = "http://coq.inria.fr/distrib/V${version}/files/coq-${version}.tar.gz";
- sha256 = "0f7v3j4zsrhpswdh47bb30vwgsr0ck79jkkz01a5a74qgxiksn4p";
+ sha256 = "00bzf4kfbd0g279jrr8ynzvb9wqcly3wi577bkrxivhrg2msxhq6";
};
buildInputs = [ pkgconfig ocaml findlib camlp5 ncurses lablgtk ];
@@ -55,6 +55,6 @@ stdenv.mkDerivation {
homepage = "http://coq.inria.fr";
license = "LGPL";
maintainers = with stdenv.lib.maintainers; [ roconnor thoughtpolice ];
- platforms = stdenv.lib.platforms.linux;
+ platforms = stdenv.lib.platforms.unix;
};
}
diff --git a/pkgs/applications/science/logic/hol_light/default.nix b/pkgs/applications/science/logic/hol_light/default.nix
index 54c7174bde7..3e6440ea977 100644
--- a/pkgs/applications/science/logic/hol_light/default.nix
+++ b/pkgs/applications/science/logic/hol_light/default.nix
@@ -1,19 +1,20 @@
-{stdenv, fetchsvn, writeScript, ocaml, findlib, camlp5}:
+{ stdenv, fetchsvn, writeScript, ocaml, findlib, camlp5 }:
let
start_script = ''
#!/bin/sh
cd "$out/lib/hol_light"
- exec ${ocaml}/bin/ocaml -I "camlp5 -where" -init make.ml
+ exec ${ocaml}/bin/ocaml -I \`${camlp5}/bin/camlp5 -where\` -init make.ml
'';
in
+stdenv.mkDerivation rec {
+ name = "hol_light-${version}";
+ version = "189";
-stdenv.mkDerivation {
- name = "hol_light-20140112";
src = fetchsvn {
url = http://hol-light.googlecode.com/svn/trunk;
- rev = "179";
- sha256 = "1j402s7142fj09bjijrkargwx03fvbdwmn0hgzzmi6s4p1y7gww0";
+ rev = version;
+ sha256 = "1v10l64rs7da2kag3wlb651i09pn83icy9n5z84j8h1iwlxzajdh";
};
buildInputs = [ ocaml findlib camlp5 ];
@@ -27,16 +28,9 @@ stdenv.mkDerivation {
meta = {
description = "Interactive theorem prover based on Higher-Order Logic";
- longDescription = ''
- HOL Light is a computer program to help users prove interesting
- mathematical theorems completely formally in Higher-Order Logic. It sets
- a very exacting standard of correctness, but provides a number of
- automated tools and pre-proved mathematical theorems (e.g., about
- arithmetic, basic set theory and real analysis) to save the user work.
- It is also fully programmable, so users can extend it with new theorems
- and inference rules without compromising its soundness.
- '';
- homepage = http://www.cl.cam.ac.uk/~jrh13/hol-light/;
- license = stdenv.lib.licenses.bsd2;
+ homepage = http://www.cl.cam.ac.uk/~jrh13/hol-light/;
+ license = stdenv.lib.licenses.bsd2;
+ platforms = stdenv.lib.platforms.unix;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
};
}
diff --git a/pkgs/applications/science/logic/ltl2ba/default.nix b/pkgs/applications/science/logic/ltl2ba/default.nix
new file mode 100644
index 00000000000..cdadd18ac9f
--- /dev/null
+++ b/pkgs/applications/science/logic/ltl2ba/default.nix
@@ -0,0 +1,24 @@
+{ fetchurl, stdenv }:
+
+stdenv.mkDerivation rec {
+ name = "ltl2ba-${version}";
+ version = "1.1";
+
+ src = fetchurl {
+ url = "http://www.lsv.ens-cachan.fr/~gastin/ltl2ba/${name}.tar.gz";
+ sha256 = "16z0gc7a9dkarwn0l6rvg5jdhw1q4qyn4501zlchy0zxqddz0sx6";
+ };
+
+ installPhase = ''
+ mkdir -p $out/bin
+ mv ltl2ba $out/bin
+ '';
+
+ meta = {
+ description = "fast translation from LTL formulae to Buchi automata";
+ homepage = "http://www.lsv.ens-cachan.fr/~gastin/ltl2ba";
+ license = stdenv.lib.licenses.gpl2Plus;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ };
+}
diff --git a/pkgs/applications/science/logic/tptp/default.nix b/pkgs/applications/science/logic/tptp/default.nix
index 68d1cca7e73..ef00b135c27 100644
--- a/pkgs/applications/science/logic/tptp/default.nix
+++ b/pkgs/applications/science/logic/tptp/default.nix
@@ -11,15 +11,19 @@ let
(builtins.attrNames (builtins.removeAttrs x helperArgNames));
sourceInfo = rec {
baseName="TPTP";
- version="5.4.0";
+ version="6.0.0";
name="${baseName}-${version}";
- url="http://www.cs.miami.edu/~tptp/TPTP/Distribution/TPTP-v${version}.tgz";
- hash="0rvrmh3vw4bk7mj29bx1pi76g2bsqyc13gsnpa1cbjs5pzyhm780";
+ urls=
+ [
+ "http://www.cs.miami.edu/~tptp/TPTP/Distribution/TPTP-v${version}.tgz"
+ "http://www.cs.miami.edu/~tptp/TPTP/Archive/TPTP-v${version}/TPTP-v${version}.tgz"
+ ];
+ hash="0jnjkqdz937c7mkxvh9wc3byw5h1k19jss058fbzdxxc2hkwq1af";
};
in
rec {
src = a.fetchurl {
- url = sourceInfo.url;
+ urls = sourceInfo.urls;
sha256 = sourceInfo.hash;
};
diff --git a/pkgs/applications/science/logic/verifast/default.nix b/pkgs/applications/science/logic/verifast/default.nix
new file mode 100644
index 00000000000..a2959892ddb
--- /dev/null
+++ b/pkgs/applications/science/logic/verifast/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, gtk, gdk_pixbuf, atk, pango, glib, cairo, freetype
+, fontconfig, libxml2, gnome2 }:
+
+let
+ libPath = stdenv.lib.makeLibraryPath
+ [ stdenv.gcc.libc stdenv.gcc.gcc gtk gdk_pixbuf atk pango glib cairo
+ freetype fontconfig libxml2 gnome2.gtksourceview
+ ];
+
+ patchLib = x: extra: "patchelf --set-rpath ${libPath}:${extra} ${x}";
+ patchExe = x: extra: ''
+ patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+ --set-rpath ${libPath}:${extra} ${x}
+ '';
+in
+stdenv.mkDerivation rec {
+ name = "verifast-${version}";
+ version = "13.11.14";
+
+ src = fetchurl {
+ url = "http://people.cs.kuleuven.be/~bart.jacobs/verifast/verifast-13.11.14.tar.gz";
+ sha256 = "1ahay7achjsfz59d3b6vl1v91gr5j34vb494isqw3fsw5l8jd9p7";
+ };
+
+ dontStrip = true;
+ installPhase = ''
+ mkdir -p $out/bin
+ cp -R bin $out/libexec
+
+ ${patchLib "$out/libexec/libz3-gmp.so" "$out/libexec"}
+ ${patchExe "$out/libexec/vfide-core" "$out/libexec"}
+ ${patchExe "$out/libexec/verifast-core" "$out/libexec"}
+
+ ln -s $out/libexec/verifast-core $out/bin/verifast
+ ln -s $out/libexec/vfide-core $out/bin/vfide
+ '';
+
+ phases = "unpackPhase installPhase";
+
+ meta = {
+ description = "Verification for C and Java programs via separation logic";
+ homepage = "http://people.cs.kuleuven.be/~bart.jacobs/verifast/";
+ license = stdenv.lib.licenses.msrla;
+ platforms = [ "i686-linux" ];
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ };
+}
diff --git a/pkgs/applications/science/logic/why3/default.nix b/pkgs/applications/science/logic/why3/default.nix
new file mode 100644
index 00000000000..71ff1cc7fb4
--- /dev/null
+++ b/pkgs/applications/science/logic/why3/default.nix
@@ -0,0 +1,22 @@
+{ fetchurl, stdenv, ocaml, ocamlPackages, coq }:
+
+stdenv.mkDerivation rec {
+ name = "why3-${version}";
+ version = "0.83";
+
+ src = fetchurl {
+ url = "https://gforge.inria.fr/frs/download.php/33490/${name}.tar.gz";
+ sha256 = "1jcs5vj91ppbgh4q4hch89b63wgakjhg35pm3r4jwhp377lnggya";
+ };
+
+ buildInputs = with ocamlPackages;
+ [ coq ocaml findlib lablgtk ocamlgraph zarith ];
+
+ meta = {
+ description = "why is a software verification platform";
+ homepage = "http://why3.lri.fr/";
+ license = stdenv.lib.licenses.lgpl21;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ };
+}
diff --git a/pkgs/applications/science/logic/yices/default.nix b/pkgs/applications/science/logic/yices/default.nix
new file mode 100644
index 00000000000..5a1a4ef1992
--- /dev/null
+++ b/pkgs/applications/science/logic/yices/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl }:
+
+let
+ libPath = stdenv.lib.makeLibraryPath [ stdenv.gcc.libc ];
+in
+stdenv.mkDerivation rec {
+ name = "yices-${version}";
+ version = "2.2.1";
+
+ src =
+ if stdenv.system == "i686-linux"
+ then fetchurl {
+ url = "http://yices.csl.sri.com/cgi-bin/yices2-newdownload.cgi?file=yices-2.2.1-i686-pc-linux-gnu-static-gmp.tar.gz&accept=I+accept";
+ name = "yices-${version}-i686.tar.gz";
+ sha256 = "12jzk3kqlbqa5x6rl92cpzj7dch7gm7fnbj72wifvwgdj4zyhrra";
+ }
+ else fetchurl {
+ url = "http://yices.csl.sri.com/cgi-bin/yices2-newdownload.cgi?file=yices-2.2.1-x86_64-unknown-linux-gnu-static-gmp.tar.gz&accept=I+accept";
+ name = "yices-${version}-x86_64.tar.gz";
+ sha256 = "0fpmihf6ykcg4qbsimkamgcwp4sl1xyxmz7q28ily91rd905ijaj";
+ };
+
+ buildPhase = false;
+ installPhase = ''
+ mkdir -p $out/bin $out/lib $out/include
+ cd bin && mv * $out/bin && cd ..
+ cd lib && mv * $out/lib && cd ..
+ cd include && mv * $out/include && cd ..
+
+ patchelf --set-rpath ${libPath} $out/lib/libyices.so.${version}
+ '';
+
+ meta = {
+ description = "Yices is a high-performance theorem prover and SMT solver";
+ homepage = "http://yices.csl.sri.com";
+ license = stdenv.lib.licenses.unfreeRedistributable;
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+ };
+}
diff --git a/pkgs/applications/science/logic/z3/default.nix b/pkgs/applications/science/logic/z3/default.nix
index eeef03eb161..7a87cb5e8be 100644
--- a/pkgs/applications/science/logic/z3/default.nix
+++ b/pkgs/applications/science/logic/z3/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Z3 is a high-performance theorem prover and SMT solver";
homepage = "http://z3.codeplex.com";
- license = stdenv.lib.licenses.unfreeRedistributable;
+ license = stdenv.lib.licenses.msrla;
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 4a58c15941c..edba65146a6 100644
--- a/pkgs/applications/science/math/R/default.nix
+++ b/pkgs/applications/science/math/R/default.nix
@@ -2,6 +2,7 @@
, libjpeg, libpng, libtiff, ncurses, pango, pcre, perl, readline, tcl
, texLive, tk, xz, zlib, less, texinfo, graphviz, icu, pkgconfig, bison
, imake, which, jdk, atlas
+, withRecommendedPackages ? true
}:
stdenv.mkDerivation rec {
@@ -23,6 +24,7 @@ stdenv.mkDerivation rec {
preConfigure = ''
configureFlagsArray=(
--disable-lto
+ --with${stdenv.lib.optionalString (!withRecommendedPackages) "out"}-recommended-packages
--with-blas="-L${atlas}/lib -lf77blas -latlas"
--with-lapack="-L${liblapack}/lib -llapack"
--with-readline
@@ -36,6 +38,7 @@ stdenv.mkDerivation rec {
--with-system-pcre
--with-system-xz
--with-ICU
+ --enable-R-shlib
AR=$(type -p ar)
AWK=$(type -p gawk)
CC=$(type -p gcc)
@@ -81,7 +84,7 @@ stdenv.mkDerivation rec {
user-defined recursive functions and input and output facilities.
'';
- platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = stdenv.lib.platforms.linux;
maintainers = [ stdenv.lib.maintainers.simons ];
};
}
diff --git a/pkgs/applications/science/math/sage/default.nix b/pkgs/applications/science/math/sage/default.nix
new file mode 100644
index 00000000000..ced8b6f95bb
--- /dev/null
+++ b/pkgs/applications/science/math/sage/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, m4, perl, gfortran, texLive, ffmpeg, tk
+, imagemagick, liblapack
+}:
+
+stdenv.mkDerivation rec {
+ name = "sage-6.1.1";
+
+ src = fetchurl {
+ url = "http://mirrors.xmission.com/sage/src/sage-6.1.1.tar.gz";
+ sha256 = "0kbzs0l9q7y34jv3f8rd1c2mrjsjkdgaw6mfdwjlpg9g4gghmq5y";
+ };
+
+ buildInputs = [ m4 perl gfortran texLive ffmpeg tk imagemagick liblapack ];
+
+ enableParallelBuilding = true;
+
+ preConfigure = ''
+ export SAGE_NUM_THREADS=$NIX_BUILD_CORES
+ sed -i 's/if ! [ -d "$HOME" ]/if [ -d "$HOME" ]/' src/bin/sage-env
+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
+ sed -i "s/ld_version = try_run('ld -v')/ld_version = 'Apple'/" \
+ build/pkgs/atlas/configuration.py
+ '';
+
+ meta = {
+ homepage = http://www.scilab.org/;
+ description = "Scientific software package for numerical computations (Matlab lookalike)";
+ # see http://www.scilab.org/legal
+ license = "SciLab";
+ };
+}
diff --git a/pkgs/applications/science/math/sloane/default.nix b/pkgs/applications/science/math/sloane/default.nix
index 1e318bd8a79..2e7768e2d95 100644
--- a/pkgs/applications/science/math/sloane/default.nix
+++ b/pkgs/applications/science/math/sloane/default.nix
@@ -1,12 +1,17 @@
-{ cabal, ansiTerminal, cmdargs, HTTP, terminalSize, url }:
+{ cabal, ansiTerminal, cmdargs, filepath, HTTP, network
+, stringsearch, terminalSize, time, zlib
+}:
cabal.mkDerivation (self: {
pname = "sloane";
- version = "1.6";
- sha256 = "0my3j53bda3s8zxnm6is1align4k082wwsfg2y1i75js5z9kwmzy";
+ version = "1.7.1";
+ sha256 = "0d6k33rhp1ixrwdfwy31m39kbk8z81biwzwmkp01fvpgwm96p3va";
isLibrary = false;
isExecutable = true;
- buildDepends = [ ansiTerminal cmdargs HTTP terminalSize url ];
+ buildDepends = [
+ ansiTerminal cmdargs filepath HTTP network stringsearch
+ terminalSize time zlib
+ ];
postInstall = ''
mkdir -p $out/share/man/man1
cp sloane.1 $out/share/man/man1/
@@ -16,6 +21,6 @@ cabal.mkDerivation (self: {
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 ];
+ maintainers = [ 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 00000000000..a0ee505dc97
--- /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 00000000000..8265acf6e4a
--- /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 00000000000..b3a56643448
--- /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/version-management/arch/default.nix b/pkgs/applications/version-management/arch/default.nix
index 350b842a095..3dd8b9f860d 100644
--- a/pkgs/applications/version-management/arch/default.nix
+++ b/pkgs/applications/version-management/arch/default.nix
@@ -4,7 +4,7 @@ stdenv.mkDerivation rec {
name = "tla-1.3.5";
src = fetchurl {
- url = "mirror://gnu/gnu-arch/" + name + ".tar.gz";
+ url = "ftp://ftp.gnu.org/old-gnu/gnu-arch/" + name + ".tar.gz";
sha256 = "01mfzj1i6p4s8191cgd5850hds1zls88hkf9rb6qx1vqjv585aj0";
};
diff --git a/pkgs/applications/version-management/darcs/default.nix b/pkgs/applications/version-management/darcs/default.nix
index 8ec65e50adf..b564242c946 100644
--- a/pkgs/applications/version-management/darcs/default.nix
+++ b/pkgs/applications/version-management/darcs/default.nix
@@ -20,14 +20,12 @@ cabal.mkDerivation (self: {
mkdir -p $out/etc/bash_completion.d
mv contrib/darcs_completion $out/etc/bash_completion.d/darcs
'';
+ jailbreak = true;
meta = {
homepage = http://darcs.net/;
description = "A distributed, interactive, smart revision control system";
license = "GPL";
- # FIXME: this gives an infinite recursion in the "darcs" attribute
- # in all-packages.nix.
- #platforms = self.ghc.meta.platforms;
- platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ];
+ platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.andres ];
};
})
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 8a1201815ae..fb7232794c5 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,22 @@
}:
stdenv.mkDerivation rec {
- name = "cgit-0.10.1";
+ name = "cgit-${version}";
+ version = "0.10.1";
src = fetchurl {
url = "http://git.zx2c4.com/cgit/snapshot/${name}.tar.xz";
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.
+ # cgit is tightly coupled with git and needs a git source tree to build.
# IMPORTANT: Remember to check which git version cgit needs on every version
- # bump.
+ # bump (look in the Makefile).
+ # 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 = [
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 dcf76160ec6..191b24304bf 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
@@ -8,16 +8,16 @@
, 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
+, SHA, shakespeare, 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.20140405";
- sha256 = "0nbfnv9z2jhx2jr2nma0y1znvbaa09rv1drl6wk27j6xsbiq3p3k";
+ version = "5.20140517";
+ sha256 = "150xf6664rfdljswc270m2pqvia4sywph4rrrbky6izy6a0vq680";
isLibrary = false;
isExecutable = true;
buildDepends = [
@@ -28,10 +28,10 @@ cabal.mkDerivation (self: {
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
+ random regexTdfa SafeSemaphore securemem SHA shakespeare 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
diff --git a/pkgs/applications/version-management/git-and-tools/git-bz/default.nix b/pkgs/applications/version-management/git-and-tools/git-bz/default.nix
index 5e6b9fdc243..3a2270cf972 100644
--- a/pkgs/applications/version-management/git-and-tools/git-bz/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git-bz/default.nix
@@ -49,5 +49,6 @@ stdenv.mkDerivation {
platforms = stdenv.lib.platforms.linux;
maintainers = [ stdenv.lib.maintainers.pierron ];
+ broken = true;
};
}
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 00000000000..846752f5bfe
--- /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 649b0a7e4a2..f95b5a493a6 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.9.2";
+ version = "1.9.4";
svn = subversionClient.override { perlBindings = true; };
@@ -21,10 +21,10 @@ stdenv.mkDerivation {
src = fetchurl {
url = "https://www.kernel.org/pub/software/scm/git/git-${version}.tar.xz";
- sha256 = "1x4rb06vw4ckdflmn01r5l9spvn7cng4i5mm3sbd0n8cz0n6xz13";
+ sha256 = "1shxa49lsxn81qpfi60wh7rn5ci4zjgljvr0qczdmnqzd8w1zyvb";
};
- 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
@@ -36,7 +36,9 @@ stdenv.mkDerivation {
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 stdenv.isSunOS then " INSTALL=install NO_INET_NTOP= NO_INET_PTON=" else "");
+ + (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...
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 fd9011130e3..6f2fe890cfa 100644
--- a/pkgs/applications/version-management/git-and-tools/tig/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/tig/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl, ncurses, asciidoc, xmlto, docbook_xsl, docbook_xml_dtd_45 }:
stdenv.mkDerivation rec {
- name = "tig-1.2.1";
+ name = "tig-2.0.2";
src = fetchurl {
url = "http://jonas.nitro.dk/tig/releases/${name}.tar.gz";
- sha256 = "0i19lc6dd3vdpkdd8q07xii2c4mcpiwmg55av81jyhx0y82x425p";
+ sha256 = "0gi7iqiij37b0d3izxymxaw5ns2mv1y7qfic0fhl7xj4s2rz075r";
};
buildInputs = [ ncurses asciidoc xmlto docbook_xsl ];
diff --git a/pkgs/applications/video/aegisub/default.nix b/pkgs/applications/video/aegisub/default.nix
index 9bbc7c9e739..41b25401367 100644
--- a/pkgs/applications/video/aegisub/default.nix
+++ b/pkgs/applications/video/aegisub/default.nix
@@ -4,6 +4,7 @@
, mesa
, libass, fftw, ffms
, ffmpeg, pkgconfig, zlib # Undocumented (?) dependencies
+, icu, boost, intltool # New dependencies
, spellChecking ? true, hunspell ? null
, automationSupport ? true, lua ? null
, openalSupport ? false, openal ? null
@@ -21,15 +22,17 @@ assert portaudioSupport -> (portaudio != null);
stdenv.mkDerivation rec {
name = "aegisub-${version}";
- version = "3.0.4";
+ version = "3.1.3";
src = fetchurl {
url = "http://ftp.aegisub.org/pub/releases/${name}.tar.xz";
- md5 = "0f22d63ed4c502f3801795fa623a4f41";
+ sha256 = "0n2y5cggayr8246p2cvrz0ajlhhvmzcgsp7nljnm21jypk15pspg";
};
+ nativeBuildInputs = [ intltool ];
+
buildInputs = with stdenv.lib;
- [ libX11 gettext wxGTK libiconv fontconfig freetype mesa libass fftw ffms ffmpeg pkgconfig zlib ]
+ [ libX11 gettext wxGTK libiconv fontconfig freetype mesa libass fftw ffms ffmpeg pkgconfig zlib icu boost ]
++ optional spellChecking hunspell
++ optional automationSupport lua
++ optional openalSupport openal
@@ -38,13 +41,13 @@ stdenv.mkDerivation rec {
++ optional portaudioSupport portaudio
;
- NIX_LDFLAGS = "-liconv -lavutil -lavformat -lavcodec -lswscale -lz -lm";
+ NIX_LDFLAGS = "-liconv -lavutil -lavformat -lavcodec -lswscale -lz -lm -lGL";
- preConfigure = "cd aegisub";
+ configureFlags = "--with-boost-libdir=${boost}/lib/";
- postInstall = "ln -s $out/bin/aegisub-3.0 $out/bin/aegisub";
+ postInstall = "ln -s $out/bin/aegisub-* $out/bin/aegisub";
- meta = {
+ meta = with stdenv.lib; {
description = "An advanced subtitle editor";
longDescription = ''
Aegisub is a free, cross-platform open source tool for creating and
@@ -53,12 +56,12 @@ stdenv.mkDerivation rec {
built-in real-time video preview.
'';
homepage = http://www.aegisub.org/;
- license = stdenv.lib.licenses.bsd3;
+ license = 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;
+ maintainers = [ maintainers.AndersonTorres ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/video/cc1394/default.nix b/pkgs/applications/video/cc1394/default.nix
index df131f0e485..d555e1b7885 100644
--- a/pkgs/applications/video/cc1394/default.nix
+++ b/pkgs/applications/video/cc1394/default.nix
@@ -33,5 +33,6 @@ stdenv.mkDerivation rec {
license = "BSD";
maintainers = [ stdenv.lib.maintainers.viric ];
platforms = stdenv.lib.platforms.linux;
+ hydraPlatforms = []; # because libdc1394avt is broken
};
}
diff --git a/pkgs/applications/video/gnash/default.nix b/pkgs/applications/video/gnash/default.nix
index ef40d614a39..2e8b7e63cb8 100644
--- a/pkgs/applications/video/gnash/default.nix
+++ b/pkgs/applications/video/gnash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ stdenv, fetchurl, fetchpatch
, SDL, SDL_mixer, gstreamer, gst_plugins_base, gst_plugins_good
, gst_ffmpeg, speex
, libogg, libxml2, libjpeg, mesa, libpng, libungif, libtool
@@ -11,9 +11,9 @@
assert stdenv ? glibc;
let version = "0.8.10";
- patch_CVE = fetchurl {
+ patch_CVE = fetchpatch {
url = "http://git.savannah.gnu.org/cgit/gnash.git/patch/?id=bb4dc77eecb6ed1b967e3ecbce3dac6c5e6f1527";
- sha256 = "1g7ymbq9vxi0mwcgs2dpyd2sf30gaam7blza0ywiwj32f5wk62v1";
+ sha256 = "0ghnki5w7xf3qwfl1x6vhijpd6q608niyxrvh0g8dw5xavkvallk";
name = "CVE-2012-1175.patch";
};
in
diff --git a/pkgs/applications/video/handbrake/default.nix b/pkgs/applications/video/handbrake/default.nix
new file mode 100644
index 00000000000..297da6738ee
--- /dev/null
+++ b/pkgs/applications/video/handbrake/default.nix
@@ -0,0 +1,100 @@
+# Handbrake normally uses its own copies of the libraries it uses, for better
+# control over library patches.
+#
+# This derivation patches HB so it doesn't do that. The relevant patches
+# are added to the Nix packages and proposed upstream instead. In several cases
+# upstream already incorporated these patches.
+# This has the benefits of providing improvements to other packages,
+# making licenses more clear and reducing compile time/install size.
+#
+# For compliance, the unfree codec faac is optionally spliced out.
+#
+# Only tested on Linux
+#
+# TODO: package and use libappindicator
+
+{ stdenv, config, fetchurl,
+ python, pkgconfig, yasm,
+ autoconf, automake, libtool, m4,
+ libass, libsamplerate, fribidi, libxml2, bzip2,
+ libogg, libtheora, libvorbis, libdvdcss, a52dec, fdk_aac,
+ lame, faac, ffmpeg, libdvdread, libdvdnav, libbluray,
+ mp4v2, mpeg2dec, x264, libmkv,
+ fontconfig, freetype,
+ glib, gtk, webkitgtk, intltool, libnotify,
+ gst_all_1, dbus_glib, udev,
+ useGtk ? true,
+ useWebKitGtk ? false # This prevents ghb from starting in my tests
+}:
+
+stdenv.mkDerivation rec {
+ version = "0.9.9";
+ name = "handbrake-${version}";
+
+ # ToDo: doesn't work (yet)
+ allowUnfree = false; # config.allowUnfree or false;
+
+ buildInputsX = stdenv.lib.optionals useGtk [
+ glib gtk intltool libnotify
+ gst_all_1.gstreamer gst_all_1.gst-plugins-base dbus_glib udev
+ ] ++ stdenv.lib.optionals useWebKitGtk [ webkitgtk ];
+
+ # Did not test compiling with it
+ unfreeInputs = stdenv.lib.optional allowUnfree faac;
+
+ nativeBuildInputs = [ python pkgconfig yasm autoconf automake libtool m4 ];
+ buildInputs = [
+ fribidi fontconfig freetype
+ libass libsamplerate libxml2 bzip2
+ libogg libtheora libvorbis libdvdcss a52dec libmkv fdk_aac
+ lame ffmpeg libdvdread libdvdnav libbluray mp4v2 mpeg2dec x264
+ ] ++ buildInputsX ++ unfreeInputs;
+
+
+ src = fetchurl {
+ name = "HandBrake-${version}.tar.bz2";
+ url = "http://handbrake.fr/rotation.php?file=HandBrake-${version}.tar.bz2";
+ sha256 = "1crmm1c32vx60jfl2bqzg59q4qqx6m83b08snp7h1njc21sdf7d7";
+ };
+
+ patches = stdenv.lib.optional (! allowUnfree) ./disable-unfree.patch;
+
+ preConfigure = ''
+ # Fake wget to prevent downloads
+ mkdir wget
+ echo "#!/bin/sh" > wget/wget
+ echo "echo ===== Not fetching \$*" >> wget/wget
+ echo "exit 1" >> wget/wget
+ chmod +x wget/wget
+ export PATH=$PATH:$PWD/wget
+
+ # Force using nixpkgs dependencies
+ sed -i '/MODULES += contrib/d' make/include/main.defs
+ sed -i '/PKG_CONFIG_PATH=/d' gtk/module.rules
+
+ # disable faac if non-free
+ if [ -z "$allowUnfree" ]; then
+ rm libhb/encfaac.c
+ fi
+ '';
+
+ configureFlags = "--enable-fdk-aac ${if useGtk then "--disable-gtk-update-checks" else "--disable-gtk"}";
+
+ preBuild = ''
+ cd build
+ '';
+
+ meta = {
+ homepage = http://handbrake.fr/;
+ description = "A tool for ripping DVDs into video files";
+ longDescription = ''
+ Handbrake is a versatile transcoding DVD ripper. This package
+ provides the cli HandbrakeCLI and the GTK+ version ghb.
+ The faac library is disabled if you're compiling free-only.
+ '';
+ license = stdenv.lib.licenses.gpl2;
+ maintainers = [ stdenv.lib.maintainers.wmertens ];
+ # Not tested on anything else
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/video/handbrake/disable-unfree.patch b/pkgs/applications/video/handbrake/disable-unfree.patch
new file mode 100644
index 00000000000..30edcb81c09
--- /dev/null
+++ b/pkgs/applications/video/handbrake/disable-unfree.patch
@@ -0,0 +1,101 @@
+diff -ru HandBrake-0.9.9-orig/gtk/configure.ac HandBrake-0.9.9/gtk/configure.ac
+--- HandBrake-0.9.9-orig/gtk/configure.ac 2014-05-02 22:50:00.047305795 +0200
++++ HandBrake-0.9.9/gtk/configure.ac 2014-05-02 22:48:57.119304020 +0200
+@@ -203,7 +203,7 @@
+ ;;
+ esac
+
+-HB_LIBS="-lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil -ldvdnav -ldvdread -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheoraenc -ltheoradec -lz -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype -lxml2"
++HB_LIBS="-lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil -ldvdnav -ldvdread -lmp3lame -lmpeg2 -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheoraenc -ltheoradec -lz -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype -lxml2"
+
+ if test "x$use_fdk_aac" = "xyes" ; then
+ HB_LIBS+=" -lfdk-aac"
+diff -ru HandBrake-0.9.9-orig/gtk/src/preset_xlat.c HandBrake-0.9.9/gtk/src/preset_xlat.c
+--- HandBrake-0.9.9-orig/gtk/src/preset_xlat.c 2014-05-02 22:50:00.043305794 +0200
++++ HandBrake-0.9.9/gtk/src/preset_xlat.c 2014-05-02 22:42:20.987292846 +0200
+@@ -260,7 +260,6 @@
+
+ static value_map_t acodec_xlat[] =
+ {
+- {"AAC (faac)", "faac"},
+ {"AC3 Passthru", "ac3"},
+ {"MP3 (lame)", "lame"},
+ {"Vorbis (vorbis)", "vorbis"},
+diff -ru HandBrake-0.9.9-orig/gtk/src/presets.c HandBrake-0.9.9/gtk/src/presets.c
+--- HandBrake-0.9.9-orig/gtk/src/presets.c 2014-05-02 22:50:00.043305794 +0200
++++ HandBrake-0.9.9/gtk/src/presets.c 2014-05-02 22:42:41.283293419 +0200
+@@ -2029,8 +2029,6 @@
+
+ static value_map_t acodec_xlat_compat[] =
+ {
+- {"AAC (CoreAudio)", "faac"},
+- {"HE-AAC (CoreAudio)", "faac"},
+ {"AC3 (ffmpeg)", "ac3"},
+ {"AC3", "ac3"},
+ {"MP3 Passthru", "mp3pass"},
+diff -ru HandBrake-0.9.9-orig/libhb/common.c HandBrake-0.9.9/libhb/common.c
+--- HandBrake-0.9.9-orig/libhb/common.c 2014-05-02 22:50:00.047305795 +0200
++++ HandBrake-0.9.9/libhb/common.c 2014-05-02 22:37:24.679284489 +0200
+@@ -126,7 +126,6 @@
+ { "AAC (CoreAudio)", "ca_aac", HB_ACODEC_CA_AAC, HB_MUX_MP4|HB_MUX_MKV },
+ { "HE-AAC (CoreAudio)", "ca_haac", HB_ACODEC_CA_HAAC, HB_MUX_MP4|HB_MUX_MKV },
+ #endif
+- { "AAC (faac)", "faac", HB_ACODEC_FAAC, HB_MUX_MP4|HB_MUX_MKV },
+ #ifdef USE_FDK_AAC
+ { "AAC (FDK)", "fdk_aac", HB_ACODEC_FDK_AAC, HB_MUX_MP4|HB_MUX_MKV },
+ { "HE-AAC (FDK)", "fdk_haac", HB_ACODEC_FDK_HAAC, HB_MUX_MP4|HB_MUX_MKV },
+diff -ru HandBrake-0.9.9-orig/libhb/common.h HandBrake-0.9.9/libhb/common.h
+--- HandBrake-0.9.9-orig/libhb/common.h 2014-05-02 22:50:00.047305795 +0200
++++ HandBrake-0.9.9/libhb/common.h 2014-05-02 22:39:37.839288245 +0200
+@@ -945,7 +945,6 @@
+ extern hb_work_object_t hb_decavcodeca;
+ extern hb_work_object_t hb_decavcodecv;
+ extern hb_work_object_t hb_declpcm;
+-extern hb_work_object_t hb_encfaac;
+ extern hb_work_object_t hb_enclame;
+ extern hb_work_object_t hb_encvorbis;
+ extern hb_work_object_t hb_muxer;
+diff -ru HandBrake-0.9.9-orig/libhb/hb.c HandBrake-0.9.9/libhb/hb.c
+--- HandBrake-0.9.9-orig/libhb/hb.c 2014-05-02 22:50:00.047305795 +0200
++++ HandBrake-0.9.9/libhb/hb.c 2014-05-02 22:39:02.287287242 +0200
+@@ -487,7 +487,6 @@
+ hb_register( &hb_decavcodeca );
+ hb_register( &hb_decavcodecv );
+ hb_register( &hb_declpcm );
+- hb_register( &hb_encfaac );
+ hb_register( &hb_enclame );
+ hb_register( &hb_encvorbis );
+ hb_register( &hb_muxer );
+@@ -588,7 +587,6 @@
+ hb_register( &hb_decavcodeca );
+ hb_register( &hb_decavcodecv );
+ hb_register( &hb_declpcm );
+- hb_register( &hb_encfaac );
+ hb_register( &hb_enclame );
+ hb_register( &hb_encvorbis );
+ hb_register( &hb_muxer );
+diff -ru HandBrake-0.9.9-orig/libhb/module.defs HandBrake-0.9.9/libhb/module.defs
+--- HandBrake-0.9.9-orig/libhb/module.defs 2014-05-02 22:50:00.047305795 +0200
++++ HandBrake-0.9.9/libhb/module.defs 2014-05-02 22:39:25.727287903 +0200
+@@ -95,7 +95,7 @@
+ LIBHB.lib = $(LIBHB.build/)hb.lib
+
+ LIBHB.dll.libs = $(foreach n, \
+- a52 ass avcodec avformat avutil avresample dvdnav dvdread faac \
++ a52 ass avcodec avformat avutil avresample dvdnav dvdread \
+ fontconfig freetype mkv mpeg2 mp3lame mp4v2 \
+ ogg samplerate swscale theora vorbis vorbisenc x264 xml2 bluray, \
+ $(CONTRIB.build/)lib/lib$(n).a )
+Only in HandBrake-0.9.9: libhb-orig
+diff -ru HandBrake-0.9.9orig/test/module.defs HandBrake-0.9.9/test/module.defs
+--- HandBrake-0.9.9-orig/test/module.defs 2014-05-02 23:15:10.575348401 +0200
++++ HandBrake-0.9.9/test/module.defs 2014-05-02 23:17:00.523351502 +0200
+@@ -14,7 +14,7 @@
+ TEST.libs = $(LIBHB.a)
+
+ TEST.GCC.l = \
+- a52 ass avcodec avformat avutil avresample dvdnav dvdread faac \
++ a52 ass avcodec avformat avutil avresample dvdnav dvdread \
+ fontconfig freetype fribidi mkv mpeg2 mp3lame mp4v2 ogg \
+ samplerate swscale theoraenc theoradec vorbis vorbisenc x264 \
+ bluray xml2 bz2 z
diff --git a/pkgs/applications/video/lxdvdrip/default.nix b/pkgs/applications/video/lxdvdrip/default.nix
index 9323a1cbd32..1b3acd2c2ff 100644
--- a/pkgs/applications/video/lxdvdrip/default.nix
+++ b/pkgs/applications/video/lxdvdrip/default.nix
@@ -1,10 +1,10 @@
{ stdenv, fetchurl, libdvdread }:
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
name = "lxdvdrip-1.76";
src = fetchurl {
- url = http://download.berlios.de/lxdvdrip/lxdvdrip-1.76.tgz;
+ url = "mirror://sourceforge/lxdvdrip/${name}.tgz";
sha256 = "0vgslc7dapfrbgslnaicc8bggdccyrvcgjv1dwi19qswhh7jkzj6";
};
@@ -22,7 +22,7 @@ stdenv.mkDerivation {
meta = {
description = "Command line tool to make a copy from a video DVD for private use";
- homepage = http://lxdvdrip.berlios.de/;
+ homepage = http://sourceforge.net/projects/lxdvdrip;
license = "GPLv2";
};
}
diff --git a/pkgs/applications/video/miro/default.nix b/pkgs/applications/video/miro/default.nix
index 14aeca62a71..7572bedc1e0 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,8 +22,7 @@ buildPythonPackage rec {
patches = [ ./gconf.patch ];
postPatch = ''
- sed -i -e '2i import os; os.environ["GST_PLUGIN_PATH"] = \\\
- '"'$GST_PLUGIN_PATH'" miro.real
+ patch -p1 -d .. < "${./youtube-feeds.patch}"
sed -i -e 's/\$(shell which python)/python/' Makefile
sed -i -e 's|/usr/bin/||' -e 's|/usr||' \
@@ -55,11 +54,15 @@ buildPythonPackage rec {
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_SCHEMAS_PATH:$out/share"
'';
buildInputs = [
- pkgconfig pyrex096 ffmpeg boost glib pygobject gtk2 webkit_gtk2 libsoup
- pygtk taglib
+ pkgconfig pyrex096 ffmpeg boost glib pygobject gtk2 webkitgtk2 libsoup
+ pygtk taglib gsettings_desktop_schemas
];
propagatedBuildInputs = [
diff --git a/pkgs/applications/video/miro/youtube-feeds.patch b/pkgs/applications/video/miro/youtube-feeds.patch
new file mode 100644
index 00000000000..1527fa6a5b6
--- /dev/null
+++ b/pkgs/applications/video/miro/youtube-feeds.patch
@@ -0,0 +1,15 @@
+diff --git a/lib/flashscraper.py b/lib/flashscraper.py
+index 323dbe4..d203b78 100644
+--- a/lib/flashscraper.py
++++ b/lib/flashscraper.py
+@@ -134,9 +134,7 @@ def _youtube_callback_step2(info, video_id, callback):
+ # strip url= from url=xxxxxx, strip trailer. Strip duplicate params.
+ for fmt, stream_map_data in zip(fmt_list, stream_map):
+ stream_map = cgi.parse_qs(stream_map_data)
+- url_base = stream_map['url'][0]
+- sig_part = '&signature=' + stream_map['sig'][0]
+- fmt_url_map[fmt] = url_base + sig_part
++ fmt_url_map[fmt] = stream_map['url'][0]
+
+ title = params.get("title", ["No title"])[0]
+ try:
diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix
index b37a8a87630..be796f8e0de 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
@@ -48,24 +49,23 @@ assert cacaSupport -> libcaca != null;
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.7";
-
in
stdenv.mkDerivation rec {
name = "mpv-${version}";
+ version = "0.3.8";
src = fetchurl {
url = "https://github.com/mpv-player/mpv/archive/v${version}.tar.gz";
- sha256 = "1qmwmjvgdwh88l2caw2xy1d2h1cdg2w1hl4q5iwx2c0q7a99h41m";
+ sha256 = "0k77rq17mslpvvgr4mvkj9bd5s1yhsigwvzym8blr1brxkj9pk3b";
};
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 = {
@@ -127,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
index 947d2517808..7f53aa07db6 100644
--- a/pkgs/applications/video/pitivi/default.nix
+++ b/pkgs/applications/video/pitivi/default.nix
@@ -1,7 +1,7 @@
{ stdenv, fetchurl, pkgconfig, intltool, itstool, makeWrapper
, pythonPackages, gst, clutter-gst, clutter-gtk
, gobjectIntrospection, clutter, gtk3, librsvg
-, gnome_icon_theme, gnome_icon_theme_symbolic
+, gnome_icon_theme, gnome_icon_theme_symbolic, gnome3
}:
let
@@ -39,20 +39,18 @@ in stdenv.mkDerivation rec {
python pygobject3 pyxdg numpy pycairo sqlite3
]);
- postInstall = with stdenv.lib; with gst; let
+ preFixup = with stdenv.lib; with gst; let
libraryPath = makeLibraryPath [
gstreamer gst-editing-services
clutter-gst clutter-gtk clutter gtk3
- ];
-
- xdgDataDirs = makeSearchPath "share" [
- gtk3 gnome_icon_theme gnome_icon_theme_symbolic
+ 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:${xdgDataDirs}:$out/share"
+ --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/subtitleeditor/default.nix b/pkgs/applications/video/subtitleeditor/default.nix
new file mode 100644
index 00000000000..c1c11357ca0
--- /dev/null
+++ b/pkgs/applications/video/subtitleeditor/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchurl, desktop_file_utils, enchant, gnome, gstreamer, gstreamermm,
+ gst_plugins_base, gst_plugins_good, intltool, hicolor_icon_theme,
+ libsigcxx, libxmlxx, makeWrapper, xdg_utils, pkgconfig } :
+
+let
+ ver_maj = "0.41";
+ ver_min = "0";
+in
+
+stdenv.mkDerivation rec {
+ name = "subtitle-editor-${ver_maj}.${ver_min}";
+
+ buildInputs = [
+ desktop_file_utils enchant gnome.gtk gnome.gtkmm gstreamer gstreamermm
+ gst_plugins_base gst_plugins_good intltool hicolor_icon_theme libsigcxx libxmlxx
+ makeWrapper xdg_utils pkgconfig
+ ];
+
+ src = fetchurl {
+ url = "http://download.gna.org/subtitleeditor/${ver_maj}/subtitleeditor-${ver_maj}.${ver_min}.tar.gz";
+ md5 = "3c21ccd8296001dcb1a02c62396db1b6";
+ };
+
+ doCheck = true;
+
+ postInstall = ''
+ wrapProgram "$out/bin/subtitleeditor" --prefix \
+ GST_PLUGIN_SYSTEM_PATH ":" "$GST_PLUGIN_SYSTEM_PATH" \
+ '';
+
+
+ meta = {
+ description = "GTK+2 application to edit video subtitles";
+ longDescription = ''
+ Subtitle Editor is a GTK+2 tool to edit subtitles for GNU/Linux/*BSD. It can be
+ used for new subtitles or as a tool to transform, edit, correct and refine
+ existing subtitle. This program also shows sound waves, which makes it easier
+ to synchronise subtitles to voices.
+ '';
+ homepage = http://home.gna.org/subtitleeditor;
+ license = stdenv.lib.licenses.gpl3;
+ maintainers = stdenv.lib.maintainers.plcplc;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/video/xbmc/default.nix b/pkgs/applications/video/xbmc/default.nix
index e645bbcf284..94da757867e 100644
--- a/pkgs/applications/video/xbmc/default.nix
+++ b/pkgs/applications/video/xbmc/default.nix
@@ -3,17 +3,17 @@
, boost, avahi, libdvdcss, lame, autoreconfHook
, gettext, pcre, yajl, fribidi, which
, openssl, gperf, tinyxml2, taglib, libssh, swig, jre
-, libX11, xproto, inputproto
+, libX11, xproto, inputproto, libxml2
, libXt, libXmu, libXext, xextproto
, libXinerama, libXrandr, randrproto
-, libXtst, libXfixes, fixesproto
+, libXtst, libXfixes, fixesproto, systemd
, SDL, SDL_image, SDL_mixer, alsaLib
, mesa, glew, fontconfig, freetype, ftgl
, libjpeg, jasper, libpng, libtiff
, ffmpeg, libmpeg2, libsamplerate, libmad
-, libogg, libvorbis, flac
-, lzo, libcdio, libmodplug, libass
-, sqlite, mysql, nasm
+, libogg, libvorbis, flac, libxslt
+, lzo, libcdio, libmodplug, libass, libbluray
+, sqlite, mysql, nasm, gnutls, libva
, curl, bzip2, zip, unzip, glxinfo, xdpyinfo
, dbus_libs ? null, dbusSupport ? true
, udev, udevSupport ? true
@@ -23,7 +23,7 @@
# TODO: would be nice to have nfsSupport (needs libnfs library)
# TODO: librtmp
, libvdpau ? null, vdpauSupport ? true
-, pulseaudio ? null, pulseSupport ? false
+, pulseaudio ? null, pulseSupport ? true
}:
assert dbusSupport -> dbus_libs != null;
@@ -34,18 +34,18 @@ assert vdpauSupport -> libvdpau != null && ffmpeg.vdpauSupport;
assert pulseSupport -> pulseaudio != null;
stdenv.mkDerivation rec {
- name = "xbmc-12.3";
+ name = "xbmc-13.0";
src = fetchurl {
- url = "http://mirrors.xbmc.org/releases/source/${name}.tar.gz";
- sha256 = "0wyy9rsl11px4mh0fyq75n29905ldiqp8yraz6jxxvrls1hcj59y";
+ url = "https://github.com/xbmc/xbmc/archive/13.0-Gotham.tar.gz";
+ sha256 = "096hin8qp1864ypyw9xysy13niwf79bgfgivxi7w7mh2dagn0mjx";
};
buildInputs = [
- makeWrapper
+ makeWrapper libxml2 gnutls
pkgconfig cmake gnumake yasm pythonFull
boost libmicrohttpd autoreconfHook
- gettext pcre yajl fribidi
+ gettext pcre yajl fribidi libva
openssl gperf tinyxml2 taglib libssh swig jre
libX11 xproto inputproto which
libXt libXmu libXext xextproto
@@ -55,8 +55,8 @@ stdenv.mkDerivation rec {
mesa glew fontconfig freetype ftgl
libjpeg jasper libpng libtiff
ffmpeg libmpeg2 libsamplerate libmad
- libogg libvorbis flac
- lzo libcdio libmodplug libass
+ libogg libvorbis flac libxslt systemd
+ lzo libcdio libmodplug libass libbluray
sqlite mysql nasm avahi libdvdcss lame
curl bzip2 zip unzip glxinfo xdpyinfo
]
@@ -89,6 +89,7 @@ stdenv.mkDerivation rec {
--prefix PATH ":" "${glxinfo}/bin" \
--prefix PATH ":" "${xdpyinfo}/bin" \
--prefix LD_LIBRARY_PATH ":" "${curl}/lib" \
+ --prefix LD_LIBRARY_PATH ":" "${systemd}/lib" \
--prefix LD_LIBRARY_PATH ":" "${libvdpau}/lib"
done
'';
diff --git a/pkgs/applications/virtualization/8086tiny/builder.sh b/pkgs/applications/virtualization/8086tiny/builder.sh
index 36c381becec..7cff2589abe 100644
--- a/pkgs/applications/virtualization/8086tiny/builder.sh
+++ b/pkgs/applications/virtualization/8086tiny/builder.sh
@@ -6,14 +6,23 @@ mkdir -p ./$name $out/bin $out/share/$name $out/share/doc/$name/images
cd $name
tar xf $src
make 8086tiny
+if [ $bios ]; then
+ cd bios_source
+ nasm -f bin bios.asm -o bios
+ cd ..
+fi
-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
+install -m 755 8086tiny $out/bin
+install -m 644 fd.img $out/share/$name/8086tiny-floppy.img
+install -m 644 bios_source/bios.asm $out/share/$name/8086tiny-bios-src.asm
+install -m 644 docs/8086tiny.css $out/share/doc/$name
+install -m 644 docs/doc.html $out/share/doc/$name
for i in docs/images/*.gif
do
- install $i $out/share/doc/$name/images
+ install -m 644 $i $out/share/doc/$name/images
done
+if [ $bios ]; then
+ install -m 644 bios_source/bios $out/share/$name/8086tiny-bios
+else
+ install -m 644 bios $out/share/$name/8086tiny-bios
+fi
diff --git a/pkgs/applications/virtualization/8086tiny/default.nix b/pkgs/applications/virtualization/8086tiny/default.nix
index 8e5108b4410..a16f052f622 100644
--- a/pkgs/applications/virtualization/8086tiny/default.nix
+++ b/pkgs/applications/virtualization/8086tiny/default.nix
@@ -1,32 +1,32 @@
{ stdenv, fetchurl
-, localBios ? false, nasm ? null
+, localBios ? true, nasm ? null
, sdlSupport ? true, SDL ? null
}:
-
assert sdlSupport -> (SDL != null);
-
stdenv.mkDerivation rec {
name = "8086tiny-${version}";
- version = "1.20";
+ version = "1.25";
src = fetchurl {
- url ="http://www.megalith.co.uk/8086tiny/downloads/8086tiny_120.tar.bz2";
- sha256 = "0yapnr8wvlx7h1q1w98yfy2vsbf0rlp4wd99r3xb0b7l70b36mpw";
+ url ="http://www.megalith.co.uk/8086tiny/downloads/8086tiny_125.tar.bz2";
+ sha256 = "0kmq4iiwhi2grjwq43ljjk1b1f1v1x9gzrgrgq2fzfsj7m7s6ris";
};
buildInputs = with stdenv.lib;
optionals localBios [ nasm ]
++ optionals sdlSupport [ SDL ];
-
+
+ bios = localBios;
+
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 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 :)
'';
diff --git a/pkgs/applications/virtualization/docker/default.nix b/pkgs/applications/virtualization/docker/default.nix
index 40385d9d36a..d951fe124c9 100644
--- a/pkgs/applications/virtualization/docker/default.nix
+++ b/pkgs/applications/virtualization/docker/default.nix
@@ -3,11 +3,11 @@ btrfsProgs, iptables, bash}:
stdenv.mkDerivation rec {
name = "docker-${version}";
- version = "0.9.1";
+ version = "0.10.0";
src = fetchurl {
url = "https://github.com/dotcloud/docker/archive/v${version}.tar.gz";
- sha256 = "0m4s21dxd1bj08xrmi7iw77djj3cpxvjsin12p6v6v1qnigm18ww";
+ sha256 = "14gmx119hd3j0c6rbks2mm83hk46s5wnnyvj8rhn25h0yp39pm5q";
};
phases = ["unpackPhase" "preBuild" "buildPhase" "installPhase"];
diff --git a/pkgs/applications/virtualization/qemu/cve-2014-0150.patch b/pkgs/applications/virtualization/qemu/cve-2014-0150.patch
new file mode 100644
index 00000000000..a086b369321
--- /dev/null
+++ b/pkgs/applications/virtualization/qemu/cve-2014-0150.patch
@@ -0,0 +1,14 @@
+
+diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
+index 439477b..33bd233 100644
+--- a/hw/net/virtio-net.c
++++ b/hw/net/virtio-net.c
+ -677,7 +677,7 static int virtio_net_handle_mac(VirtIONet *n, uint8_t cmd,
+ goto error;
+ }
+
+- if (in_use + mac_data.entries <= MAC_TABLE_ENTRIES) {
++ if (mac_data.entries <= MAC_TABLE_ENTRIES - in_use) {
+ s = iov_to_buf(iov, iov_cnt, 0, &macs[in_use * ETH_ALEN],
+ mac_data.entries * ETH_ALEN);
+ if (s != mac_data.entries * ETH_ALEN) {
diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix
index af2e1efb59e..176d196b064 100644
--- a/pkgs/applications/virtualization/qemu/default.nix
+++ b/pkgs/applications/virtualization/qemu/default.nix
@@ -7,16 +7,18 @@
, x86Only ? false
}:
-let n = "qemu-1.7.0"; in
+let n = "qemu-2.0.0"; in
stdenv.mkDerivation rec {
name = n + (if x86Only then "-x86-only" else "");
src = fetchurl {
url = "http://wiki.qemu.org/download/${n}.tar.bz2";
- sha256 = "050kq9mz8c2jcshm7nn7dldypsk8jr590ybnlw2wc51dbyl37wri";
+ sha256 = "0frsahiw56jr4cqr9m6s383lyj4ar9hfs2wp3y4yr76krah1mk30";
};
+ patches = [ ./cve-2014-0150.patch ];
+
buildInputs =
[ python zlib pkgconfig glib ncurses perl pixman attr libcap
vde2 alsaLib texinfo libuuid flex bison makeWrapper
diff --git a/pkgs/applications/virtualization/qemu/linux-img/default.nix b/pkgs/applications/virtualization/qemu/linux-img/default.nix
deleted file mode 100644
index 58a2b29c259..00000000000
--- a/pkgs/applications/virtualization/qemu/linux-img/default.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{ stdenv, fetchurl }:
-
-stdenv.mkDerivation rec {
- name = "qemu-linux-image-0.2";
-
- src = fetchurl {
- url = http://wiki.qemu.org/download/linux-0.2.img.bz2;
- sha256 = "08xlwy1908chpc4fsqy2v13zi25dapk0ybrd43fj95v67kdj5hj1";
- };
-
- unpackPhase = "true";
-
- installPhase =
- ''
- mkdir -p $out/share/qemu-images
- bunzip2 < $src > $out/share/qemu-images/linux-0.2.img
- '';
-
- meta = {
- description = "QEMU sample Linux disk image";
- };
-}
diff --git a/pkgs/applications/virtualization/virt-manager/default.nix b/pkgs/applications/virtualization/virt-manager/default.nix
index dba0d11b425..9df6967704a 100644
--- a/pkgs/applications/virtualization/virt-manager/default.nix
+++ b/pkgs/applications/virtualization/virt-manager/default.nix
@@ -52,7 +52,7 @@ buildPythonPackage rec {
--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"
+ --prefix XDG_DATA_DIRS : "$out/share:${gsettings_desktop_schemas}/share:${gtk3}/share:$GSETTINGS_SCHEMAS_PATH:\$XDG_DATA_DIRS"
done
${glib}/bin/glib-compile-schemas "$out"/share/glib-2.0/schemas
diff --git a/pkgs/applications/virtualization/virt-viewer/default.nix b/pkgs/applications/virtualization/virt-viewer/default.nix
index d2e608ba3fa..a5d7c775412 100644
--- a/pkgs/applications/virtualization/virt-viewer/default.nix
+++ b/pkgs/applications/virtualization/virt-viewer/default.nix
@@ -1,50 +1,40 @@
-x@{builderDefsPackage
- , gnome, gtk, glib, libxml2, pkgconfig, libvirt, gtkvnc, cyrus_sasl, libtasn1
- , gnupg, libgcrypt, perl, nettle, yajl, libcap_ng
- , ...}:
-builderDefsPackage
-(a :
-let
- helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
- ["gnome"];
+{ stdenv, fetchurl, pkgconfig, intltool, glib, libxml2, gtk3, gtkvnc, gmp
+, libgcrypt, gnupg, cyrus_sasl, spiceSupport ? true, spice_gtk, shared_mime_info
+, libvirt, libcap_ng, yajl
+}:
- buildInputs = (map (n: builtins.getAttr n x)
- (builtins.attrNames (builtins.removeAttrs x helperArgNames)))
- ++ [gnome.libglade];
- sourceInfo = rec {
+with stdenv.lib;
+
+let sourceInfo = rec {
baseName="virt-viewer";
- version="0.2.0";
+ version="0.6.0";
name="${baseName}-${version}";
url="http://virt-manager.org/download/sources/${baseName}/${name}.tar.gz";
- hash="0lhkmp4kn0s2z8241lqf2fdi55jg9iclr5hjw3m4wzaznpiajwlp";
- };
-in
-rec {
- src = a.fetchurl {
+ hash="0svalnr6k8rjadysnxixygk3bdx04asmwx75bhrbljyicba216v6";
+}; in
+
+stdenv.mkDerivation {
+ inherit (sourceInfo) name version;
+
+ src = fetchurl {
url = sourceInfo.url;
sha256 = sourceInfo.hash;
};
- inherit (sourceInfo) name version;
- inherit buildInputs;
+ buildInputs = [
+ pkgconfig intltool glib libxml2 gtk3 gtkvnc gmp libgcrypt gnupg cyrus_sasl
+ shared_mime_info libvirt libcap_ng yajl
+ ] ++ optional spiceSupport spice_gtk;
- /* doConfigure should be removed if not needed */
- phaseNames = ["doConfigure" "doMakeInstall"];
-
meta = {
description = "A viewer for remote virtual machines";
- maintainers = with a.lib.maintainers;
- [
- raskin
- ];
- platforms = with a.lib.platforms;
- linux;
- license = a.lib.licenses.gpl2;
+ maintainers = maintainers.raskin;
+ platforms = platforms.linux;
+ license = licenses.gpl2;
};
passthru = {
updateInfo = {
downloadPage = "http://virt-manager.org/download.html";
};
};
-}) x
-
+}
diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix
index 266ab11a39f..682e7159ac8 100644
--- a/pkgs/applications/virtualization/virtualbox/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/default.nix
@@ -11,7 +11,7 @@ with stdenv.lib;
let
- version = "4.3.10"; # changes ./guest-additions as well
+ version = "4.3.12"; # 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 = "93012";
+ extpackRevision = "93733";
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.3.10/SHA256SUMS
- sha256 = "ec3f2a98373d5e228acb4756ac07f44212c4d53f6b83deee81b791abb0d2608a";
+ sha256 = "f931ce41b2cc9500dc43aba004630cf7bb7050ba737eae38827e91062f072d1f";
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,7 +56,7 @@ in stdenv.mkDerivation {
src = fetchurl {
url = "http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}.tar.bz2";
- sha256 = "739835aee3274a663b23eeb748bd0430e8a5d8ba2f4d0eae5dc47ff2c485e23b";
+ sha256 = "db84ddf47d1ecd316ec46417595f0252e3ec2f67e35e1e17320aba87b7c2934f";
};
buildInputs =
diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
index 5fc75590417..f168c0d5725 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 = "247e15e9a205dcd4761f6cb547ceca2a61e8d6905c1930870939fd323f4cd1ae";
+ sha256 = "c76dd5ec86f61ad72263ab6d2405723b06badfc2fae57f83ffa5de96f553400d";
};
KERN_DIR = "${kernel.dev}/lib/modules/*/build";
diff --git a/pkgs/applications/window-managers/awesome/default.nix b/pkgs/applications/window-managers/awesome/default.nix
index b8e1257c5bc..26987565636 100644
--- a/pkgs/applications/window-managers/awesome/default.nix
+++ b/pkgs/applications/window-managers/awesome/default.nix
@@ -5,7 +5,7 @@
, which, dbus, nettools, git, asciidoc, doxygen }:
let
- version = "3.5.2";
+ version = "3.5.5";
in
stdenv.mkDerivation rec {
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "http://awesome.naquadah.org/download/awesome-${version}.tar.xz";
- sha256 = "11iya03yzr8sa3snmywlw22ayg0d3dcy49pi8fz0bycf5aq6b38q";
+ sha256 = "0iwd4pjvq0akm9dbipbl4m4fm24m017l06arasr445v2qkbxnc5z";
};
meta = with stdenv.lib; {
@@ -46,6 +46,7 @@ stdenv.mkDerivation rec {
xlibs.libXau
xlibs.libXdmcp
xlibs.libxcb
+ xlibs.libxshmfence
xlibs.xcbutil
xlibs.xcbutilimage
xlibs.xcbutilkeysyms
@@ -53,8 +54,8 @@ stdenv.mkDerivation rec {
xlibs.xcbutilwm
];
- AWESOME_IGNORE_LGI = 1;
-
+ LD_LIBRARY_PATH = "${cairo}/lib:${pango}/lib:${gobjectIntrospection}/lib";
+ GI_TYPELIB_PATH = "${pango}/lib/girepository-1.0";
LUA_CPATH = "${lgi}/lib/lua/5.1/?.so";
LUA_PATH = "${lgi}/share/lua/5.1/?.lua;${lgi}/share/lua/5.1/lgi/?.lua";
@@ -63,7 +64,7 @@ stdenv.mkDerivation rec {
--set LUA_CPATH '"${lgi}/lib/lua/5.1/?.so"' \
--set LUA_PATH '"${lgi}/share/lua/5.1/?.lua;${lgi}/share/lua/5.1/lgi/?.lua"' \
--set GI_TYPELIB_PATH "${pango}/lib/girepository-1.0" \
- --set LD_LIBRARY_PATH "${cairo}/lib:${pango}/lib:${gobjectIntrospection}/lib" \
+ --prefix LD_LIBRARY_PATH : "${cairo}/lib:${pango}/lib:${gobjectIntrospection}/lib" \
--prefix PATH : "${compton}/bin:${unclutter}/bin:${procps}/bin:${iproute}/sbin:${coreutils}/bin:${curl}/bin:${alsaUtils}/bin:${findutils}/bin:${rxvt_unicode}/bin"
wrapProgram $out/bin/awesome-client \
diff --git a/pkgs/applications/window-managers/herbstluftwm/default.nix b/pkgs/applications/window-managers/herbstluftwm/default.nix
index 3ce50a82915..7c4cb4934c9 100644
--- a/pkgs/applications/window-managers/herbstluftwm/default.nix
+++ b/pkgs/applications/window-managers/herbstluftwm/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkgconfig, glib, libX11, libXinerama }:
+{ stdenv, fetchurl, pkgconfig, glib, libX11, libXext, libXinerama }:
stdenv.mkDerivation rec {
- name = "herbstluftwm-0.5.2";
+ name = "herbstluftwm-0.6.2";
src = fetchurl {
url = "http://herbstluftwm.org/tarballs/${name}.tar.gz";
- sha256 = "15crb77gw8p1h721r3dcgn0m1n03qk0g81rrnaqw8p7hz44k6gf5";
+ sha256 = "1b7h2zi0i9j17k1z62qw5zq7j9i8gv33pmcxnfiilzzfg8wmr7x8";
};
patchPhase = ''
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
config.mk
'';
- buildInputs = [ pkgconfig glib libX11 libXinerama ];
+ buildInputs = [ pkgconfig glib libX11 libXext libXinerama ];
meta = {
description = "A manual tiling window manager for X";
diff --git a/pkgs/applications/window-managers/jwm/default.nix b/pkgs/applications/window-managers/jwm/default.nix
index 57e6ecf1749..73c5e5df81a 100644
--- a/pkgs/applications/window-managers/jwm/default.nix
+++ b/pkgs/applications/window-managers/jwm/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchurl, libX11, libXext, libXinerama, libXpm, libXft, freetype,
fontconfig }:
-stdenv.mkDerivation {
- name = "jwm-2.0.1";
+stdenv.mkDerivation rec {
+ name = "jwm-2.2.2";
src = fetchurl {
- url = http://www.joewing.net/programs/jwm/releases/jwm-2.0.1.tar.bz2;
- sha256 = "1ix5y00cmg3cyazl0adzgv49140zxaf2dpngyg1dyy4ma6ysdmnw";
+ url = "http://www.joewing.net/programs/jwm/releases/${name}.tar.xz";
+ sha256 = "0nhyy78c6imk85d47bakk460x0cfhkyghqq82zghmb00dhwiryln";
};
buildInputs = [ libX11 libXext libXinerama libXpm libXft freetype
diff --git a/pkgs/applications/window-managers/xmonad/xmonad-contrib.nix b/pkgs/applications/window-managers/xmonad/xmonad-contrib.nix
index 5c00ddf0fd1..ca2e9e34e14 100644
--- a/pkgs/applications/window-managers/xmonad/xmonad-contrib.nix
+++ b/pkgs/applications/window-managers/xmonad/xmonad-contrib.nix
@@ -4,8 +4,8 @@
cabal.mkDerivation (self: {
pname = "xmonad-contrib";
- version = "0.11.2";
- sha256 = "0qlc732m6mhvx7g10r69hk5x460kjv2r04s91cnn5yfiia1qfpai";
+ version = "0.11.3";
+ sha256 = "14h9vr33yljymswj50wbimav263y9abdcgi07mvfis0zd08rxqxa";
buildDepends = [
extensibleExceptions mtl random utf8String X11 X11Xft xmonad
];
diff --git a/pkgs/build-support/build-fhs-chrootenv/default.nix b/pkgs/build-support/build-fhs-chrootenv/default.nix
index 8756c4835b2..e807a04628a 100644
--- a/pkgs/build-support/build-fhs-chrootenv/default.nix
+++ b/pkgs/build-support/build-fhs-chrootenv/default.nix
@@ -3,8 +3,10 @@ bashInteractive, xz, shadow, gawk, less, 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
+ ];
# 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-fhs-chrootenv/init.sh.in b/pkgs/build-support/build-fhs-chrootenv/init.sh.in
index 2dfa95219c8..5b0ab94bc4e 100644
--- a/pkgs/build-support/build-fhs-chrootenv/init.sh.in
+++ b/pkgs/build-support/build-fhs-chrootenv/init.sh.in
@@ -36,9 +36,9 @@ rm $chrootenvDest/etc/pam.d
ln -s ../host-etc/static/pam.d $chrootenvDest/etc/pam.d
# Symlink Font stuff
-mkdir $chrootenvDest/etc/fonts
+mkdir -p $chrootenvDest/etc/fonts
ln -s ../../host-etc/static/fonts/fonts.conf $chrootenvDest/etc/fonts
-mkdir $chrootenvDest/etc/fonts/conf.d
+mkdir -p $chrootenvDest/etc/fonts/conf.d
ln -s ../../../host-etc/static/fonts/conf.d/00-nixos.conf $chrootenvDest/etc/fonts/conf.d
# Create root folder
diff --git a/pkgs/build-support/build-fhs-chrootenv/load.sh.in b/pkgs/build-support/build-fhs-chrootenv/load.sh.in
index 8d3f464186b..6089fa27585 100644
--- a/pkgs/build-support/build-fhs-chrootenv/load.sh.in
+++ b/pkgs/build-support/build-fhs-chrootenv/load.sh.in
@@ -3,4 +3,4 @@
chrootenvDest=/run/chrootenv/@name@
# Enter the LFS chroot environment
-chroot $chrootenvDest /usr/bin/env -i PS1="$PS1" TERM="$TERM" DISPLAY="$DISPLAY" HOME="/root" PATH="/bin:/sbin" /bin/bash --login
+sudo chroot --userspec "$USER:${GROUPS[0]}" --groups "${GROUPS[0]}" $chrootenvDest /usr/bin/env -i PS1="$PS1" TERM="$TERM" DISPLAY="$DISPLAY" HOME="$HOME" PATH="/bin:/sbin" XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" /bin/bash --login
diff --git a/pkgs/build-support/build-fhs-chrootenv/mount.sh.in b/pkgs/build-support/build-fhs-chrootenv/mount.sh.in
index 68459cca256..225d9dbc4f7 100644
--- a/pkgs/build-support/build-fhs-chrootenv/mount.sh.in
+++ b/pkgs/build-support/build-fhs-chrootenv/mount.sh.in
@@ -17,7 +17,7 @@ mount --bind /home $chrootenvDest/home
# Bind mount state directories
mount --bind /var $chrootenvDest/var
-mount --bind /run $chrootenvDest/run
+mount --rbind /run $chrootenvDest/run
# Bind mount the host system's /etc
mount --bind /etc $chrootenvDest/host-etc
diff --git a/pkgs/build-support/build-fhs-chrootenv/umount.sh.in b/pkgs/build-support/build-fhs-chrootenv/umount.sh.in
index 29d631fbd90..5089141c0aa 100644
--- a/pkgs/build-support/build-fhs-chrootenv/umount.sh.in
+++ b/pkgs/build-support/build-fhs-chrootenv/umount.sh.in
@@ -2,5 +2,5 @@
chrootenvDest=/run/chrootenv/@name@
-# Unmount all bind mounts
-umount $chrootenvDest/{dev/pts,dev/shm,dev,nix/store,proc,sys,host-etc,home,var,run}
+# Unmount all (r)bind mounts
+umount -l $chrootenvDest/{dev/pts,dev/shm,dev,nix/store,proc,sys,host-etc,home,var,run}
diff --git a/pkgs/build-support/builder-defs/builder-defs.nix b/pkgs/build-support/builder-defs/builder-defs.nix
index e22aa6bc66e..5c9ec402d4b 100644
--- a/pkgs/build-support/builder-defs/builder-defs.nix
+++ b/pkgs/build-support/builder-defs/builder-defs.nix
@@ -545,11 +545,11 @@ let inherit (builtins) head tail trace; in
mkdir -p $out/share/texmf/fonts/enc/${retrievedName}
mkdir -p $out/share/texmf/fonts/map/${retrievedName}
- cp *.ttf $out/share/fonts/truetype/public/${retrievedName} || echo No TrueType fonts
- cp *.otf $out/share/fonts/opentype/public/${retrievedName} || echo No OpenType fonts
- cp *.{pfm,afm,pfb} $out/share/fonts/type1/public/${retrievedName} || echo No Type1 Fonts
- cp *.enc $out/share/texmf/fonts/enc/${retrievedName} || echo No fontenc data
- cp *.map $out/share/texmf/fonts/map/${retrievedName} || echo No fontmap data
+ find -name '*.ttf' -exec cp {} $out/share/fonts/truetype/public/${retrievedName} \;
+ find -name '*.otf' -exec cp {} $out/share/fonts/opentype/public/${retrievedName} \;
+ find -name '*.pfm' -o -name '*.afm' -o -name '*.pfb' -exec cp {} $out/share/fonts/type1/public/${retrievedName} \;
+ find -name '*.enc' -exec cp {} $out/share/texmf/fonts/enc/${retrievedName} \;
+ find -name '*.map' -exec cp {} $out/share/texmf/fonts/map/${retrievedName} \;
'') ["minInit" "defEnsureDir"];
simplyShare = shareName: fullDepEntry (''
diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix
index 5e028863b06..bc73d1f73a2 100644
--- a/pkgs/build-support/cabal/default.nix
+++ b/pkgs/build-support/cabal/default.nix
@@ -1,12 +1,14 @@
# generic builder for Cabal packages
{ stdenv, fetchurl, lib, pkgconfig, ghc, Cabal, jailbreakCabal, glibcLocales
-, gnugrep, coreutils
+, gnugrep, coreutils, hscolour
, enableLibraryProfiling ? false
, enableSharedLibraries ? false
, enableSharedExecutables ? false
, enableStaticLibraries ? true
, enableCheckPhase ? stdenv.lib.versionOlder "7.4" ghc.version
+, enableHyperlinkSource ? true
+, extension ? (self : super : {})
}:
let
@@ -49,6 +51,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs;
propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs;
doCheck = enableCheckPhase && x.doCheck;
+ hyperlinkSource = enableHyperlinkSource && x.hyperlinkSource;
};
defaults =
@@ -91,6 +94,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
buildInputs = [ghc Cabal] ++ self.extraBuildInputs;
extraBuildInputs = self.buildTools ++
(optionals self.doCheck self.testDepends) ++
+ (optional self.hyperlinkSource hscolour) ++
(if self.pkgconfigDepends == [] then [] else [pkgconfig]) ++
(if self.isLibrary then [] else self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends);
@@ -133,14 +137,15 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
jailbreak = false;
# pass the '--enable-split-objs' flag to cabal in the configure stage
- enableSplitObjs = !( stdenv.isDarwin # http://hackage.haskell.org/trac/ghc/ticket/4013
- || versionOlder "7.6.99" ghc.version # -fsplit-ojbs is broken in 7.7 snapshot
- );
+ enableSplitObjs = !stdenv.isDarwin; # http://hackage.haskell.org/trac/ghc/ticket/4013
# pass the '--enable-tests' flag to cabal in the configure stage
# and run any regression test suites the package might have
doCheck = enableCheckPhase;
+ # pass the '--hyperlink-source' flag to ./Setup haddock
+ hyperlinkSource = enableHyperlinkSource;
+
# abort the build if the configure phase detects that the package
# depends on multiple versions of the same build input
strictConfigurePhase = true;
@@ -195,9 +200,12 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
done
done
- ${optionalString self.enableSharedExecutables ''
+ ${optionalString (self.enableSharedExecutables && self.stdenv.isLinux) ''
configureFlags+=" --ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.ghc.name}/${self.pname}-${self.version}";
''}
+ ${optionalString (self.enableSharedExecutables && self.stdenv.isDarwin) ''
+ configureFlags+=" --ghc-option=-optl=-Wl,-headerpad_max_install_names";
+ ''}
echo "configure flags: $extraConfigureFlags $configureFlags"
./Setup configure --verbose --prefix="$out" --libdir='$prefix/lib/$compiler' \
@@ -220,7 +228,8 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
./Setup build ${self.buildTarget}
export GHC_PACKAGE_PATH=$(${ghc.GHCPackages})
- test -n "$noHaddock" || ./Setup haddock --html --hoogle
+ test -n "$noHaddock" || ./Setup haddock --html --hoogle \
+ ${optionalString self.hyperlinkSource "--hyperlink-source"}
eval "$postBuild"
'';
@@ -257,6 +266,13 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
ln -s $out/nix-support/propagated-native-build-inputs $out/nix-support/propagated-user-env-packages
fi
+ ${optionalString (self.enableSharedExecutables && self.isExecutable && self.stdenv.isDarwin) ''
+ for exe in $out/bin/* ; do
+ install_name_tool -add_rpath \
+ $out/lib/${ghc.ghc.name}/${self.pname}-${self.version} $exe
+ done
+ ''}
+
eval "$postInstall"
'';
@@ -264,5 +280,8 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
# in Cabal derivations.
inherit stdenv ghc;
};
- in stdenv.mkDerivation (postprocess ((rec { f = defaults f // args f; }).f)) ;
+ in
+ stdenv.mkDerivation (postprocess (let super = defaults self // args self;
+ self = super // extension self super;
+ in self));
}
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git
index 6e79f82eae8..d4819574acb 100755
--- a/pkgs/build-support/fetchgit/nix-prefetch-git
+++ b/pkgs/build-support/fetchgit/nix-prefetch-git
@@ -217,6 +217,8 @@ clone_user_rev() {
fi;;
esac
+ echo "git revision is $(cd $dir && git rev-parse $rev)"
+
# Allow doing additional processing before .git removal
eval "$NIX_PREFETCH_GIT_CHECKOUT_HOOK"
if test -z "$leaveDotGit"; then
diff --git a/pkgs/build-support/fetchhg/builder.sh b/pkgs/build-support/fetchhg/builder.sh
index 73ec7ec0b36..9699fb69b7f 100644
--- a/pkgs/build-support/fetchhg/builder.sh
+++ b/pkgs/build-support/fetchhg/builder.sh
@@ -1,9 +1,9 @@
source $stdenv/setup
-
header "getting $url${tag:+ ($tag)} into $out"
-hg clone --insecure ${tag:+-r "$tag"} "$url" "$out"
+hg clone --insecure "$url" hg-clone
-rm -rf "$out/.hg"
+hg archive -q -y ${tag:+-r "$tag"} --cwd hg-clone $out
+rm -f $out/.hg_archival.txt
stopNest
diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix
new file mode 100644
index 00000000000..768d173934d
--- /dev/null
+++ b/pkgs/build-support/fetchpatch/default.nix
@@ -0,0 +1,22 @@
+# This function downloads and normalizes a patch/diff file.
+# This is primarily useful for dynamically generated patches,
+# such as GitHub's or cgit's, where the non-significant content parts
+# often change with updating of git or cgit.
+# stripLen acts as the -p parameter when applying a patch.
+
+{ fetchurl, patchutils }:
+{ stripLen ? 0, ... }@args:
+
+fetchurl ({
+ postFetch = ''
+ tmpfile="$TMPDIR/${args.sha256}"
+ "${patchutils}/bin/lsdiff" "$out" \
+ | sort -u | sed -e 's/[*?]/\\&/g' \
+ | xargs -I{} \
+ "${patchutils}/bin/filterdiff" \
+ --include={} \
+ --strip=${toString stripLen} \
+ --clean "$out" > "$tmpfile"
+ mv "$tmpfile" "$out"
+ '';
+} // args)
diff --git a/pkgs/build-support/fetchurl/builder.sh b/pkgs/build-support/fetchurl/builder.sh
index 402fe0cba5b..0c6e16551b4 100644
--- a/pkgs/build-support/fetchurl/builder.sh
+++ b/pkgs/build-support/fetchurl/builder.sh
@@ -17,12 +17,16 @@ curl="curl \
$NIX_CURL_FLAGS"
+downloadedFile="$out"
+if [ -n "$downloadToTemp" ]; then downloadedFile="$TMPDIR/file"; fi
+
+
tryDownload() {
local url="$1"
echo
header "trying $url"
success=
- if $curl --fail "$url" --output "$out"; then
+ if $curl --fail "$url" --output "$downloadedFile"; then
success=1
fi
stopNest
@@ -30,6 +34,8 @@ tryDownload() {
finish() {
+ set +o noglob
+ runHook postFetch
stopNest
exit 0
}
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix
index af4a6700153..c74131a9e60 100644
--- a/pkgs/build-support/fetchurl/default.nix
+++ b/pkgs/build-support/fetchurl/default.nix
@@ -61,6 +61,17 @@ in
, sha1 ? ""
, sha256 ? ""
+, recursiveHash ? false
+
+, # Shell code executed after the file has been fetched
+ # successfully. This can do things like check or transform the file.
+ postFetch ? ""
+
+, # Whether to download to a temporary path rather than $out. Useful
+ # in conjunction with postFetch. The location of the temporary file
+ # is communicated to postFetch via $downloadedFile.
+ downloadToTemp ? false
+
, # If set, don't download the file, but write a list of all possible
# URLs (resulting from resolving mirror:// URLs) to $out.
showURLs ? false
@@ -87,7 +98,7 @@ stdenv.mkDerivation {
builder = ./builder.sh;
- buildInputs = [curl];
+ buildInputs = [ curl ];
urls = urls_;
@@ -101,7 +112,9 @@ stdenv.mkDerivation {
outputHash = if outputHash != "" then outputHash else
if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
- inherit curlOpts showURLs mirrorsFile impureEnvVars;
+ outputHashMode = if recursiveHash then "recursive" else "flat";
+
+ inherit curlOpts showURLs mirrorsFile impureEnvVars postFetch downloadToTemp;
# Doing the download on a remote machine just duplicates network
# traffic, so don't do that.
diff --git a/pkgs/build-support/fetchurl/mirrors.nix b/pkgs/build-support/fetchurl/mirrors.nix
index c4841c50d94..eb3b8a105cd 100644
--- a/pkgs/build-support/fetchurl/mirrors.nix
+++ b/pkgs/build-support/fetchurl/mirrors.nix
@@ -180,11 +180,17 @@ rec {
];
# Fedora (please only add full mirrors that carry old Fedora distributions as well).
+ # See: https://mirrors.fedoraproject.org/publiclist (but not all carry old content).
fedora = [
+ http://archives.fedoraproject.org/pub/archive/fedora/
+ http://fedora.osuosl.org/
http://ftp.nluug.nl/pub/os/Linux/distr/fedora/
http://ftp.funet.fi/pub/mirrors/ftp.redhat.com/pub/fedora/
- http://download.fedora.redhat.com/pub/fedora/
- http://archives.fedoraproject.org/pub/archive/fedora/
+ http://fedora.bhs.mirrors.ovh.net/
+ http://mirror.csclub.uwaterloo.ca/fedora/
+ http://ftp.linux.cz/pub/linux/fedora/
+ http://ftp.heanet.ie/pub/fedora/
+ http://mirror.1000mbps.com/fedora/
];
# Old SUSE distributions. Unfortunately there is no master site,
diff --git a/pkgs/build-support/fetchzip/default.nix b/pkgs/build-support/fetchzip/default.nix
new file mode 100644
index 00000000000..7c6e16a0589
--- /dev/null
+++ b/pkgs/build-support/fetchzip/default.nix
@@ -0,0 +1,44 @@
+# This function downloads and unpacks an archive file, such as a zip
+# or tar file. This is primarily useful for dynamically generated
+# archives, such as GitHub's /archive URLs, where the unpacked content
+# of the zip file doesn't change, but the zip file itself may
+# (e.g. due to minor changes in the compression algorithm, or changes
+# in timestamps).
+
+{ lib, fetchurl, unzip }:
+
+{ # Optionally move the contents of the unpacked tree up one level.
+ stripRoot ? true
+, url
+, ... } @ args:
+
+fetchurl ({
+ # Remove the extension, because otherwise unpackPhase will get
+ # confused. FIXME: fix unpackPhase.
+ name = args.name or lib.removeSuffix ".zip" (lib.removeSuffix ".tar.gz" (baseNameOf url));
+
+ recursiveHash = true;
+
+ downloadToTemp = true;
+
+ postFetch =
+ ''
+ export PATH=${unzip}/bin:$PATH
+ mkdir $out
+ cd $out
+ renamed="$TMPDIR/${baseNameOf url}"
+ mv "$downloadedFile" "$renamed"
+ unpackFile "$renamed"
+ ''
+ # FIXME: handle zip files that contain a single regular file.
+ + lib.optionalString stripRoot ''
+ shopt -s dotglob
+ if [ "$(ls -d $out/* | wc -l)" != 1 ]; then
+ echo "error: zip file must contain a single directory."
+ exit 1
+ fi
+ fn=$(cd "$out" && echo *)
+ mv $out/$fn/* "$out/"
+ rmdir "$out/$fn"
+ '';
+} // args)
diff --git a/pkgs/build-support/gcc-cross-wrapper/builder.sh b/pkgs/build-support/gcc-cross-wrapper/builder.sh
index 2dfa315d168..1d7d1046d36 100644
--- a/pkgs/build-support/gcc-cross-wrapper/builder.sh
+++ b/pkgs/build-support/gcc-cross-wrapper/builder.sh
@@ -26,6 +26,10 @@ if test -z "$nativeLibc"; then
fi
fi
+ if [ -n "$osxMinVersion" ]; then
+ cflagsCompile="$cflagsCompile -mmacosx-version-min=$osxMinVersion"
+ fi
+
echo "$cflagsCompile -B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
echo "-L$libc/lib -rpath $libc/lib -rpath-link $libc/lib" > $out/nix-support/libc-ldflags
diff --git a/pkgs/build-support/gcc-cross-wrapper/default.nix b/pkgs/build-support/gcc-cross-wrapper/default.nix
index b2e30be10ef..d3494b83a87 100644
--- a/pkgs/build-support/gcc-cross-wrapper/default.nix
+++ b/pkgs/build-support/gcc-cross-wrapper/default.nix
@@ -46,6 +46,7 @@ stdenv.mkDerivation {
addFlags = ./add-flags;
inherit nativeTools nativeLibc nativePrefix gcc libc binutils;
crossConfig = if cross != null then cross.config else null;
+ osxMinVersion = cross.osxMinVersion or null;
gccLibs = if gcc != null then gccLibs else null;
name = chosenName;
langC = if nativeTools then true else gcc.langC;
diff --git a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh
index a7be09283ee..433d36ced43 100644
--- a/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh
+++ b/pkgs/build-support/gcc-cross-wrapper/setup-hook.sh
@@ -75,6 +75,9 @@ fi
# native compilations.
doCheck=""
+# Don't strip foreign binaries with native "strip" tool.
+dontStrip=1
+
# Add the output as an rpath.
if test "$NIX_NO_SELF_RPATH" != "1"; then
export NIX_CROSS_LDFLAGS="-rpath $out/lib -rpath-link $out/lib $NIX_CROSS_LDFLAGS"
diff --git a/pkgs/build-support/grsecurity/default.nix b/pkgs/build-support/grsecurity/default.nix
new file mode 100644
index 00000000000..a9c60a2afbd
--- /dev/null
+++ b/pkgs/build-support/grsecurity/default.nix
@@ -0,0 +1,154 @@
+{ grsecOptions, lib, pkgs }:
+
+with lib;
+
+let
+ cfg = {
+ stable = grsecOptions.stable or false;
+ vserver = grsecOptions.vserver or false;
+ testing = grsecOptions.testing or false;
+ config = {
+ mode = "auto";
+ sysctl = false;
+ denyChrootChmod = false;
+ restrictProc = false;
+ restrictProcWithGroup = true;
+ unrestrictProcGid = 121; # Ugh, an awful hack. See grsecurity NixOS gid
+ disableRBAC = false;
+ verboseVersion = false;
+ kernelExtraConfig = "";
+ } // grsecOptions.config;
+ };
+
+ vals = rec {
+
+ mkKernel = kernel: patch:
+ assert patch.kversion == kernel.version;
+ { inherit kernel patch;
+ inherit (patch) grversion revision;
+ };
+
+ test-patch = with pkgs.kernelPatches; grsecurity_unstable;
+ stable-patch = with pkgs.kernelPatches;
+ if cfg.vserver then grsecurity_vserver else grsecurity_stable;
+
+ grKernel = if (cfg.stable || cfg.vserver)
+ then mkKernel pkgs.linux_3_2 stable-patch
+ else mkKernel pkgs.linux_3_14 test-patch;
+
+ ## -- 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 ''
+ 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}
+ ${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
+ '';
+ };
+
+ mkGrsecKern = grkern:
+ 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;
+ features.grsecurity = true;
+ })) (args: grsecurityOverrider args grkern));
+
+ mkGrsecPkg = grkern: pkgs.linuxPackagesFor grkern (mkGrsecPkg grkern);
+
+ ## -- Kernel packages ------------------------------------------------------
+
+ grsecKernel = mkGrsecKern grKernel;
+ grsecPackage = mkGrsecPkg grsecKernel;
+ };
+in vals
diff --git a/pkgs/build-support/grsecurity/flavors.nix b/pkgs/build-support/grsecurity/flavors.nix
new file mode 100644
index 00000000000..57d52e7cf94
--- /dev/null
+++ b/pkgs/build-support/grsecurity/flavors.nix
@@ -0,0 +1,32 @@
+let
+ mkOpts = ver: prio: sys: virt: swvirt: hwvirt:
+ { config.priority = prio;
+ config.system = sys;
+ config.virtualisationConfig = virt;
+ config.hardwareVirtualisation = hwvirt;
+ config.virtualisationSoftware = swvirt;
+ } // builtins.listToAttrs [ { name = ver; value = true; } ];
+in
+{
+ # Stable kernels
+ linux_grsec_stable_desktop =
+ mkOpts "stable" "performance" "desktop" "host" "kvm" true;
+ linux_grsec_stable_server =
+ mkOpts "stable" "security" "server" "host" "kvm" true;
+ linux_grsec_stable_server_xen =
+ mkOpts "stable" "security" "server" "guest" "xen" true;
+
+ # Stable+vserver kernels - server versions only
+ linux_grsec_vserver_server =
+ mkOpts "vserver" "security" "server" "host" "kvm" true;
+ linux_grsec_vserver_server_xen =
+ mkOpts "vserver" "security" "server" "guest" "xen" true;
+
+ # Testing kernels
+ linux_grsec_testing_desktop =
+ mkOpts "testing" "performance" "desktop" "host" "kvm" true;
+ linux_grsec_testing_server =
+ mkOpts "testing" "security" "server" "host" "kvm" true;
+ linux_grsec_testing_server_xen =
+ mkOpts "testing" "security" "server" "guest" "xen" true;
+}
\ No newline at end of file
diff --git a/pkgs/build-support/libredirect/default.nix b/pkgs/build-support/libredirect/default.nix
new file mode 100644
index 00000000000..a8a497d46d7
--- /dev/null
+++ b/pkgs/build-support/libredirect/default.nix
@@ -0,0 +1,14 @@
+{ stdenv }:
+
+stdenv.mkDerivation {
+ name = "libredirect-0";
+
+ unpackPhase = "cp ${./libredirect.c} libredirect.c";
+
+ buildPhase =
+ ''
+ gcc -Wall -std=c99 -O3 -shared libredirect.c -o libredirect.so -fPIC -ldl
+ '';
+
+ installPhase = "mkdir -p $out/lib; cp libredirect.so $out/lib";
+}
diff --git a/pkgs/build-support/libredirect/libredirect.c b/pkgs/build-support/libredirect/libredirect.c
new file mode 100644
index 00000000000..4afed3add75
--- /dev/null
+++ b/pkgs/build-support/libredirect/libredirect.c
@@ -0,0 +1,104 @@
+#define _GNU_SOURCE
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define MAX_REDIRECTS 128
+
+static int nrRedirects = 0;
+static char * from[MAX_REDIRECTS];
+static char * to[MAX_REDIRECTS];
+
+// FIXME: might run too late.
+static void init() __attribute__((constructor));
+
+static void init()
+{
+ char * spec = getenv("NIX_REDIRECTS");
+ if (!spec) return;
+
+ unsetenv("NIX_REDIRECTS");
+
+ char * spec2 = malloc(strlen(spec) + 1);
+ strcpy(spec2, spec);
+
+ char * pos = spec2, * eq;
+ while ((eq = strchr(pos, '='))) {
+ *eq = 0;
+ from[nrRedirects] = pos;
+ pos = eq + 1;
+ to[nrRedirects] = pos;
+ nrRedirects++;
+ if (nrRedirects == MAX_REDIRECTS) break;
+ char * end = strchr(pos, ':');
+ if (!end) break;
+ *end = 0;
+ pos = end + 1;
+ }
+
+}
+
+static const char * rewrite(const char * path, char * buf)
+{
+ for (int n = 0; n < nrRedirects; ++n) {
+ int len = strlen(from[n]);
+ if (strncmp(path, from[n], len) != 0) continue;
+ if (snprintf(buf, PATH_MAX, "%s%s", to[n], path + len) >= PATH_MAX)
+ abort();
+ return buf;
+ }
+
+ return path;
+}
+
+/* The following set of Glibc library functions is very incomplete -
+ it contains only what we needed for programs in Nixpkgs. Just add
+ more functions as needed. */
+
+int open(const char * path, int flags, ...)
+{
+ int (*open_real) (const char *, int, mode_t) = dlsym(RTLD_NEXT, "open");
+ mode_t mode = 0;
+ if (flags & O_CREAT) {
+ va_list ap;
+ va_start(ap, flags);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+ }
+ char buf[PATH_MAX];
+ return open_real(rewrite(path, buf), flags, mode);
+}
+
+int open64(const char * path, int flags, ...)
+{
+ int (*open64_real) (const char *, int, mode_t) = dlsym(RTLD_NEXT, "open64");
+ mode_t mode = 0;
+ if (flags & O_CREAT) {
+ va_list ap;
+ va_start(ap, flags);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+ }
+ char buf[PATH_MAX];
+ return open64_real(rewrite(path, buf), flags, mode);
+}
+
+FILE * fopen(const char * path, const char * mode)
+{
+ FILE * (*fopen_real) (const char *, const char *) = dlsym(RTLD_NEXT, "fopen");
+ char buf[PATH_MAX];
+ return fopen_real(rewrite(path, buf), mode);
+}
+
+int __xstat(int ver, const char * path, struct stat * st)
+{
+ int (*__xstat_real) (int ver, const char *, struct stat *) = dlsym(RTLD_NEXT, "__xstat");
+ char buf[PATH_MAX];
+ return __xstat_real(ver, rewrite(path, buf), st);
+}
diff --git a/pkgs/build-support/release/default.nix b/pkgs/build-support/release/default.nix
index 6288935ec2a..d36707dc60f 100644
--- a/pkgs/build-support/release/default.nix
+++ b/pkgs/build-support/release/default.nix
@@ -31,6 +31,16 @@ rec {
doCoverageAnalysis = true;
} // args);
+ clangAnalysis = args: nixBuild (
+ { inherit clangAnalyzer;
+ doClangAnalysis = true;
+ } // args);
+
+ coverityAnalysis = args: nixBuild (
+ { inherit cov-build xz;
+ doCoverityAnalysis = true;
+ } // args);
+
gcovReport = args: import ./gcov-report.nix (
{ inherit runCommand lcov rsync;
} // args);
diff --git a/pkgs/build-support/release/maven-build.nix b/pkgs/build-support/release/maven-build.nix
index 6b47bb9cae9..f7ea07baccb 100644
--- a/pkgs/build-support/release/maven-build.nix
+++ b/pkgs/build-support/release/maven-build.nix
@@ -70,7 +70,7 @@ stdenv.mkDerivation ( rec {
'';
mvnAssembly = ''
- mvn assembly:assembly -Dmaven.test.skip.exec=true ${mvnFlags}
+ mvn assembly:assembly -Dmaven.test.skip=true ${mvnFlags}
'';
mvnRelease = ''
diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix
index 8ebae24c673..b80c9242ed2 100644
--- a/pkgs/build-support/release/nix-build.nix
+++ b/pkgs/build-support/release/nix-build.nix
@@ -8,6 +8,8 @@
{ buildOutOfSourceTree ? false
, preConfigure ? null
, doCoverageAnalysis ? false
+, doClangAnalysis ? false
+, doCoverityAnalysis ? false
, lcovFilter ? []
, lcovExtraTraceFiles ? []
, src, stdenv
@@ -18,6 +20,9 @@
, buildInputs ? []
, ... } @ args:
+let
+ doingAnalysis = doCoverageAnalysis || doClangAnalysis || doCoverityAnalysis;
+in
stdenv.mkDerivation (
{
@@ -25,8 +30,8 @@ stdenv.mkDerivation (
doCheck = true;
# When doing coverage analysis, we don't care about the result.
- dontInstall = doCoverageAnalysis;
- useTempPrefix = doCoverageAnalysis;
+ dontInstall = doingAnalysis;
+ useTempPrefix = doingAnalysis;
showBuildStats = true;
@@ -37,6 +42,29 @@ stdenv.mkDerivation (
if test -e $origSrc/nix-support/hydra-release-name; then
cp $origSrc/nix-support/hydra-release-name $out/nix-support/hydra-release-name
fi
+
+ # Package up Coverity analysis results
+ if [ ! -z "${toString doCoverityAnalysis}" ]; then
+ if [ -d "_coverity_$name/cov-int" ]; then
+ mkdir -p $out/tarballs
+ NAME=`cat $out/nix-support/hydra-release-name`
+ cd _coverity_$name
+ tar caf $out/tarballs/$NAME-coverity-int.xz cov-int
+ echo "file cov-build $out/tarballs/$NAME-coverity-int.xz" >> $out/nix-support/hydra-build-products
+ fi
+ fi
+
+ # Package up Clang analysis results
+ if [ ! -z "${toString doClangAnalysis}" ]; then
+ if [ ! -z "`ls _clang_analyze_$name`" ]; then
+ cd _clang_analyze_$name && mv * $out/analysis
+ else
+ mkdir -p $out/analysis
+ echo "No bugs found." >> $out/analysis/index.html
+ fi
+
+ echo "report analysis $out/analysis" >> $out/nix-support/hydra-build-products
+ fi
'';
failureHook = (stdenv.lib.optionalString (failureHook != null) failureHook) +
@@ -64,11 +92,33 @@ stdenv.mkDerivation (
src=$(findTarballs $src | head -1)
'';
+ preHook = ''
+ # Perform Coverity Analysis
+ if [ ! -z "${toString doCoverityAnalysis}" ]; then
+ shopt -s expand_aliases
+ mkdir _coverity_$name
+ alias make="cov-build --dir _coverity_$name/cov-int make"
+ fi
+
+ # Perform Clang Analysis
+ if [ ! -z "${toString doClangAnalysis}" ]; then
+ shopt -s expand_aliases
+ alias make="scan-build -o _clang_analyze_$name --html-title='Scan results for $name' make"
+ fi
+ '';
+
+ # Clean up after analysis
+ postBuild = ''
+ if [ ! -z "${toString (doCoverityAnalysis || doClangAnalysis)}" ]; then
+ unalias make
+ fi
+ '';
+
initPhase = ''
mkdir -p $out/nix-support
echo "$system" > $out/nix-support/system
- if [ -z "${toString doCoverageAnalysis}" ]; then
+ if [ -z "${toString doingAnalysis}" ]; then
for i in $outputs; do
if [ "$i" = out ]; then j=none; else j="$i"; fi
mkdir -p ''${!i}/nix-support
@@ -79,7 +129,12 @@ stdenv.mkDerivation (
prePhases = ["initPhase"] ++ prePhases;
- buildInputs = buildInputs ++ stdenv.lib.optional doCoverageAnalysis args.makeGCOVReport;
+ buildInputs =
+ buildInputs ++
+ (stdenv.lib.optional doCoverageAnalysis args.makeGCOVReport) ++
+ (stdenv.lib.optional doClangAnalysis args.clangAnalyzer) ++
+ (stdenv.lib.optional doCoverityAnalysis args.cov-build) ++
+ (stdenv.lib.optional doCoverityAnalysis args.xz);
lcovFilter = ["/nix/store/*"] ++ lcovFilter;
diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix
index 274cd05024b..a717561d8da 100644
--- a/pkgs/build-support/vm/default.nix
+++ b/pkgs/build-support/vm/default.nix
@@ -1117,6 +1117,18 @@ rec {
packages = commonCentOSPackages;
};
+ rhel7x86_64 = {
+ name = "rhel-7rc-x86_64";
+ fullName = "RHEL 7 rc (x86_64)";
+ packagesList = fetchurl {
+ url = http://ftp.redhat.com/redhat/rhel/rc/7/Server/x86_64/os/repodata/81f41fc6206a8477235dc7b5099ffe0867f71802415d66d6c0a213a41cae27c3-primary.xml.gz;
+ sha256 = "1hr7mqfa84x2q3b6cpa108cgfrq8zsghkdf7blipg13a4331zx41";
+ };
+ urlPrefix = http://ftp.redhat.com/redhat/rhel/rc/7/Server/x86_64/os ;
+ archs = ["noarch" "x86_64"];
+ packages = commonRHELPackages;
+ };
+
};
@@ -1373,7 +1385,7 @@ rec {
})
(fetchurl {
url = mirror://ubuntu/dists/quantal/universe/binary-i386/Packages.bz2;
- sha256 = "323036e81c8bf409f71d3bc5cf37cfba72fe1d0fc82e9b5418d4d0cb516646e1";
+ sha256 = "9933ce12e7830b9c68a4aead08b86fcbb8d6ef0ea1fd133f0cf9d7126ad8c9bd";
})
];
urlPrefix = mirror://ubuntu;
@@ -1390,7 +1402,7 @@ rec {
})
(fetchurl {
url = mirror://ubuntu/dists/quantal/universe/binary-amd64/Packages.bz2;
- sha256 = "c762bd4ed063326577a62ff783cf9720e772b03d4a2aa38048918ee6287b96ce";
+ sha256 = "329a98312248c98092f8b91f232fc68fd3e6e2337ea4f348b3785465ae8dae17";
})
];
urlPrefix = mirror://ubuntu;
@@ -1407,7 +1419,7 @@ rec {
})
(fetchurl {
url = mirror://ubuntu/dists/raring/universe/binary-i386/Packages.bz2;
- sha256 = "1db19982fc3689b00a918e2cdbb936dfccebbac2ed82f81bb0164a3d51039012";
+ sha256 = "c1a59dd9132654194f4470932fd0f1582496465d8f96909b22accaf9f404024a";
})
];
urlPrefix = mirror://ubuntu;
@@ -1424,7 +1436,7 @@ rec {
})
(fetchurl {
url = mirror://ubuntu/dists/raring/universe/binary-amd64/Packages.bz2;
- sha256 = "0caf561bad359e8a82a987a076c0f1cb7a43412a5de053c105b160477c192978";
+ sha256 = "8aba137ae18540a12de03a564c11496431a150ab2d4d1e93e2b4b691fa2a4850";
})
];
urlPrefix = mirror://ubuntu;
@@ -1441,7 +1453,7 @@ rec {
})
(fetchurl {
url = mirror://ubuntu/dists/saucy/universe/binary-i386/Packages.bz2;
- sha256 = "84ff81ef23bcece68bfc3dd4b0b1fd38e5b81ac90ad48b4e4210396b425da500";
+ sha256 = "897f64c19a742ac8524c17c1b5ec31b33ec8ab20c85463010d8bf04f5d14aa0f";
})
];
urlPrefix = mirror://ubuntu;
@@ -1458,7 +1470,41 @@ rec {
})
(fetchurl {
url = mirror://ubuntu/dists/saucy/universe/binary-amd64/Packages.bz2;
- sha256 = "06ec77f2f5d6ee70ffb805affe3a6b3e8d5b6463fbfe42ba6588295c7e1f65bc";
+ sha256 = "a899ce5513ce8540ce9b8da4c1cd85b16b231900881b3aa559f7ac3182cdbfc8";
+ })
+ ];
+ urlPrefix = mirror://ubuntu;
+ packages = commonDebPackages ++ [ "diffutils" "libc-bin" ];
+ };
+
+ ubuntu1404i386 = {
+ name = "ubuntu-14.04-trusty-i386";
+ fullName = "Ubuntu 14.04 Trusty (i386)";
+ packagesLists =
+ [ (fetchurl {
+ url = mirror://ubuntu/dists/trusty/main/binary-i386/Packages.bz2;
+ sha256 = "fdfc38663915c5cef3029872deb8c3bf52b98092073058086e2f1db0c71ebeb4";
+ })
+ (fetchurl {
+ url = mirror://ubuntu/dists/trusty/universe/binary-i386/Packages.bz2;
+ sha256 = "2afcf259332d88c5e02f5446c4926edd567ef1a00ce24ca7cb400cbf44e2a90f";
+ })
+ ];
+ urlPrefix = mirror://ubuntu;
+ packages = commonDebPackages ++ [ "diffutils" "libc-bin" ];
+ };
+
+ ubuntu1404x86_64 = {
+ name = "ubuntu-14.04-trusty-amd64";
+ fullName = "Ubuntu 14.04 Trusty (amd64)";
+ packagesList =
+ [ (fetchurl {
+ url = mirror://ubuntu/dists/trusty/main/binary-amd64/Packages.bz2;
+ sha256 = "7095917eb8e4ac9161bc3b2ceeaf86e9265aae7b855a0e15d72096ecb05f1fc2";
+ })
+ (fetchurl {
+ url = mirror://ubuntu/dists/trusty/universe/binary-amd64/Packages.bz2;
+ sha256 = "558637eeb8e340b871653e2060effe36e064677eca4eae62d9e4138dd402a610";
})
];
urlPrefix = mirror://ubuntu;
@@ -1510,22 +1556,22 @@ rec {
};
debian60i386 = {
- name = "debian-6.0.8-squeeze-i386";
- fullName = "Debian 6.0.8 Squeeze (i386)";
+ name = "debian-6.0.9-squeeze-i386";
+ fullName = "Debian 6.0.9 Squeeze (i386)";
packagesList = fetchurl {
url = mirror://debian/dists/squeeze/main/binary-i386/Packages.bz2;
- sha256 = "c850339aaf46a4ed4abc7c1789c29ea58c3a152aa173ee004578fda86b28391f";
+ sha256 = "1fb9afa9b2d007939e066c031fc60f6626b78105ce42fe8cdeab7124a0dbf477";
};
urlPrefix = mirror://debian;
packages = commonDebianPackages;
};
debian60x86_64 = {
- name = "debian-6.0.8-squeeze-amd64";
- fullName = "Debian 6.0.8 Squeeze (amd64)";
+ name = "debian-6.0.9-squeeze-amd64";
+ fullName = "Debian 6.0.9 Squeeze (amd64)";
packagesList = fetchurl {
url = mirror://debian/dists/squeeze/main/binary-amd64/Packages.bz2;
- sha256 = "1506ab7de3ad5a2c706183536d2ee88589d7cb922d9e0de36ac062d464082dda";
+ sha256 = "cee46e56f35342c17795d1923b6c7e545f626e8d568fd48f91d5e0eb92ea329e";
};
urlPrefix = mirror://debian;
packages = commonDebianPackages;
@@ -1536,22 +1582,22 @@ rec {
debian70x86_64 = debian7x86_64;
debian7i386 = {
- name = "debian-7.4-wheezy-i386";
- fullName = "Debian 7.4 Wheezy (i386)";
+ name = "debian-7.5-wheezy-i386";
+ fullName = "Debian 7.5 Wheezy (i386)";
packagesList = fetchurl {
url = mirror://debian/dists/wheezy/main/binary-i386/Packages.bz2;
- sha256 = "9f19822c82e25cd149f82b0d16fdbc00d1080db7f34e41de456498dc7c54f2b4";
+ sha256 = "c4896c30c9a483354714d50f19d0779b72a218ce4f817f9ec8554f9664137993";
};
urlPrefix = mirror://debian;
packages = commonDebianPackages;
};
debian7x86_64 = {
- name = "debian-7.4-wheezy-amd64";
- fullName = "Debian 7.4 Wheezy (amd64)";
+ name = "debian-7.5-wheezy-amd64";
+ fullName = "Debian 7.5 Wheezy (amd64)";
packagesList = fetchurl {
url = mirror://debian/dists/wheezy/main/binary-amd64/Packages.bz2;
- sha256 = "160ee0917693bc2e8f69b233c220857f35a70d906540d99d2779def576daf5f7";
+ sha256 = "f3b78aac7d2bdfc3896fdd2087affd0e16bafbf35945106b196483f5fb303d52";
};
urlPrefix = mirror://debian;
packages = commonDebianPackages;
@@ -1606,6 +1652,28 @@ rec {
"unzip"
];
+ commonRHELPackages = [
+ "autoconf"
+ "automake"
+ "basesystem"
+ "bzip2"
+ "curl"
+ "diffutils"
+ "findutils"
+ "gawk"
+ "gcc-c++"
+ "gzip"
+ "make"
+ "patch"
+ "perl"
+ "pkgconfig"
+ "procps-ng"
+ "rpm"
+ "rpm-build"
+ "tar"
+ "unzip"
+ ];
+
/* Common packages for openSUSE images. */
commonOpenSUSEPackages = [
"aaa_base"
diff --git a/pkgs/build-support/vm/windows/bootstrap.nix b/pkgs/build-support/vm/windows/bootstrap.nix
index 47afce5b5a3..e3b44d1b6ab 100644
--- a/pkgs/build-support/vm/windows/bootstrap.nix
+++ b/pkgs/build-support/vm/windows/bootstrap.nix
@@ -1,6 +1,6 @@
{ stdenv, fetchurl, vmTools, writeScript, writeText, runCommand, makeInitrd
, python, perl, coreutils, dosfstools, gzip, mtools, netcat, openssh, qemu
-, samba, socat, vde2, cdrkit, pathsFromGraph
+, samba, socat, vde2, cdrkit, pathsFromGraph, gnugrep
}:
{ isoFile, productKey, arch ? null }:
@@ -10,7 +10,7 @@ with stdenv.lib;
let
controller = import ./controller {
inherit stdenv writeScript vmTools makeInitrd;
- inherit samba vde2 openssh socat netcat coreutils gzip;
+ inherit samba vde2 openssh socat netcat coreutils gzip gnugrep;
};
mkCygwinImage = import ./cygwin-iso {
diff --git a/pkgs/build-support/vm/windows/controller/default.nix b/pkgs/build-support/vm/windows/controller/default.nix
index fe4b5b7f6c2..0beaf401758 100644
--- a/pkgs/build-support/vm/windows/controller/default.nix
+++ b/pkgs/build-support/vm/windows/controller/default.nix
@@ -1,5 +1,5 @@
{ stdenv, writeScript, vmTools, makeInitrd
-, samba, vde2, openssh, socat, netcat, coreutils, gzip
+, samba, vde2, openssh, socat, netcat, coreutils, gnugrep, gzip
}:
{ sshKey
@@ -86,6 +86,7 @@ let
# Print a dot every 10 seconds only to shorten line length.
${coreutils}/bin/sleep 10
done
+ ${coreutils}/bin/touch /xchg/waiting_done
echo " success."
# Loop forever, because this VM is going to be killed.
${loopForever}
@@ -123,6 +124,7 @@ let
echo -n .
${coreutils}/bin/sleep 1
done
+ ${coreutils}/bin/touch /xchg/waiting_done
echo " success."
${openssh}/bin/ssh \
@@ -145,6 +147,7 @@ let
];
controllerQemuArgs = concatStringsSep " " (maybeKvm64 ++ [
+ "-pidfile $CTRLVM_PIDFILE"
"-nographic"
"-no-reboot"
"-virtfs local,path=/nix/store,security_model=none,mount_tag=store"
@@ -160,6 +163,7 @@ let
cygwinQemuArgs = concatStringsSep " " (maybeKvm64 ++ [
"-monitor unix:$MONITOR_SOCKET,server,nowait"
+ "-pidfile $WINVM_PIDFILE"
"-nographic"
"-net nic,vlan=0,macaddr=52:54:00:12:01:01"
"-net vde,vlan=0,sock=$QEMU_VDE_SOCKET"
@@ -181,42 +185,73 @@ let
QEMU_VDE_SOCKET="$(pwd)/vde.ctl"
MONITOR_SOCKET="$(pwd)/monitor"
+ WINVM_PIDFILE="$(pwd)/winvm.pid"
+ CTRLVM_PIDFILE="$(pwd)/ctrlvm.pid"
${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 ''
+ vmExec = ''
${vmTools.qemuProg} ${controllerQemuArgs} &
- ${vmTools.qemuProg} ${cygwinQemuArgs}${bgBoth}
- '' else ''
${vmTools.qemuProg} ${cygwinQemuArgs} &
- ${vmTools.qemuProg} ${controllerQemuArgs}${bgBoth}
+ echo -n "Waiting for VMs to start up..."
+ timeout=60
+ while ! test -e "$WINVM_PIDFILE" -a -e "$CTRLVM_PIDFILE"; do
+ timeout=$(($timeout - 1))
+ echo -n .
+ if test $timeout -le 0; then
+ echo " timed out."
+ exit 1
+ fi
+ ${coreutils}/bin/sleep 1
+ done
+ echo " done."
'';
+ checkDropOut = ''
+ if ! test -e "$XCHG_DIR/waiting_done" &&
+ ! kill -0 $(< "$WINVM_PIDFILE"); then
+ echo "Windows VM has dropped out early, bailing out!" >&2
+ exit 1
+ fi
+ '';
+
+ toMonitor = "${socat}/bin/socat - UNIX-CONNECT:$MONITOR_SOCKET";
+
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 %-
-
+ echo -n "Waiting for memory dump to finish..."
+ while ! echo info migrate | ${toMonitor} | \
+ ${gnugrep}/bin/grep -qi '^migration *status: *complete'; do
+ ${coreutils}/bin/sleep 1
+ echo -n .
+ done
+ echo " done."
+ echo quit | ${toMonitor}
+ wait $(< "$WINVM_PIDFILE")
eval "$postVM"
exit 0
'' else if installMode then ''
+ wait $(< "$WINVM_PIDFILE")
eval "$postVM"
exit 0
'' else ''
+ while kill -0 $(< "$CTRLVM_PIDFILE"); do
+ ${checkDropOut}
+ done
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")
'';
diff --git a/pkgs/build-support/vm/windows/default.nix b/pkgs/build-support/vm/windows/default.nix
index f9b44d450d9..f9f1d75c70d 100644
--- a/pkgs/build-support/vm/windows/default.nix
+++ b/pkgs/build-support/vm/windows/default.nix
@@ -5,6 +5,7 @@ let
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;
+ inherit (pkgs) gnugrep;
};
builder = ''
diff --git a/pkgs/data/documentation/man-pages/default.nix b/pkgs/data/documentation/man-pages/default.nix
index f384aa512eb..5fc0b4752bc 100644
--- a/pkgs/data/documentation/man-pages/default.nix
+++ b/pkgs/data/documentation/man-pages/default.nix
@@ -1,11 +1,11 @@
{ stdenv, fetchurl }:
stdenv.mkDerivation rec {
- name = "man-pages-3.63";
+ name = "man-pages-3.64";
src = fetchurl {
url = "mirror://kernel/linux/docs/man-pages/${name}.tar.xz";
- sha256 = "06iw95d3xpr9y5kbf889g4zvqlp7z68yabk3sjylbjdzapyqhgz6";
+ sha256 = "1p9zk130c852gqci6dyw57yaqx4v871n8n82kkccdpj7y63xr4bl";
};
preBuild =
diff --git a/pkgs/data/fonts/eb-garamond/default.nix b/pkgs/data/fonts/eb-garamond/default.nix
new file mode 100644
index 00000000000..99c9b53217e
--- /dev/null
+++ b/pkgs/data/fonts/eb-garamond/default.nix
@@ -0,0 +1,50 @@
+x@{builderDefsPackage
+ , unzip
+ , ...}:
+builderDefsPackage
+(a :
+let
+ helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
+ [];
+
+ buildInputs = map (n: builtins.getAttr n x)
+ (builtins.attrNames (builtins.removeAttrs x helperArgNames));
+ sourceInfo = rec {
+ version="0.016";
+ name="EBGaramond";
+ url="https://bitbucket.org/georgd/eb-garamond/downloads/${name}-${version}.zip";
+ hash="0y630khn5zh70al3mm84fs767ac94ffyz1w70zzhrhambx07pdx0";
+ };
+in
+rec {
+ src = a.fetchurl {
+ url = sourceInfo.url;
+ sha256 = sourceInfo.hash;
+ };
+
+ name = "eb-garamond-${sourceInfo.version}";
+ inherit buildInputs;
+
+ phaseNames = ["doUnpack" "installFonts"];
+
+ # This will clean up if/when 8263996 lands.
+ doUnpack = a.fullDepEntry (''
+ unzip ${src}
+ cd ${sourceInfo.name}*
+ mv {ttf,otf}/* .
+ '') ["addInputs"];
+
+ meta = with a.lib; {
+ description = "Digitization of the Garamond shown on the Egenolff-Berner specimen";
+ maintainers = with maintainers; [ relrod ];
+ platforms = platforms.all;
+ license = licenses.ofl;
+ homepage = http://www.georgduffner.at/ebgaramond/;
+ };
+ passthru = {
+ updateInfo = {
+ downloadPage = "https://github.com/georgd/EB-Garamond/releases";
+ };
+ };
+}) x
+
diff --git a/pkgs/data/fonts/lohit-fonts/default.nix b/pkgs/data/fonts/lohit-fonts/default.nix
new file mode 100644
index 00000000000..707d52c8baa
--- /dev/null
+++ b/pkgs/data/fonts/lohit-fonts/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+ name = "lohit-fonts-20140220";
+ src = fetchurl {
+ url = https://fedorahosted.org/releases/l/o/lohit/lohit-ttf-20140220.tar.gz;
+ sha256 = "1rmgr445hw1n851ywy28csfvswz1i6hnc8mzp88qw2xk9j4dn32d";
+ };
+
+ installPhase = ''
+ mkdir -p $out/share/fonts/truetype
+ cp *.ttf $out/share/fonts/truetype
+ '';
+
+ meta = with stdenv.lib; {
+ homepage = https://fedorahosted.org/lohit/;
+ description = "Fonts for 21 Indian languages";
+ license = licenses.ofl;
+ maintainers = [ maintainers.ttuegel ];
+ platforms = platforms.all;
+ };
+}
diff --git a/pkgs/data/fonts/nafees/default.nix b/pkgs/data/fonts/nafees/default.nix
new file mode 100644
index 00000000000..aa0c1dbd77b
--- /dev/null
+++ b/pkgs/data/fonts/nafees/default.nix
@@ -0,0 +1,59 @@
+{stdenv, fetchurl, unzip}:
+
+stdenv.mkDerivation rec {
+ name = "nafees";
+
+ srcs = [(fetchurl {
+ url = "http://www.cle.org.pk/Downloads/localization/fonts/NafeesNastaleeq/Nafees_Nastaleeq_v1.02.zip";
+ sha256 = "1h1k5d74pg2gs782910v7i9rz2633wdacy34ds7ybxbpjiz6pqix";
+ })
+
+ (fetchurl {
+ url = "http://www.cle.org.pk/Downloads/localization/fonts/NafeesRiqa/Nafees_Riqa_v1.0.zip";
+ sha256 = "1liismsyaj69y40vs9a9db4l95n25n8vnjnx7sbk70nxppwngd8i";
+ })
+
+ (fetchurl {
+ url = "http://www.cle.org.pk/Downloads/localization/fonts/NafeesNaskh/Nafees_Naskh_v2.01.zip";
+ sha256 = "1qbbj6w6bvrlymv7z6ld609yhp0l2f27z14180w5n8kzzl720vly";
+ })
+
+ (fetchurl {
+ url = "http://www.cle.org.pk/Downloads/localization/fonts/NafeesTahreerNaskh/Nafees_Tahreer_Naskh_v1.0.zip";
+ sha256 = "006l87drbi4zh52kpvn8wl9wbwm9srfn406rzsnf4gv0spzhqrxl";
+ })
+ (fetchurl {
+ url = "http://www.cle.org.pk/Downloads/localization/fonts/NafeesPakistaniNaskh/Nafees_Pakistani_Naskh_v2.01.zip";
+ sha256 = "1i5ip60gq1cgc9fc96kvlahdpia8dxdgcisglvbm2d212bz0s5nb";
+ })
+];
+
+ buildInputs = [unzip];
+
+ sourceRoot = ".";
+
+ installPhase = ''
+ mkdir -p $out/share/fonts/truetype
+ cp *.ttf $out/share/fonts/truetype
+ # cp $riqa/*.ttf $out/share/fonts/truetype
+ '';
+
+ meta = {
+ description = "OpenType Urdu font from the Center for Research in Urdu Language Processing";
+
+ longDescription = '' The Nafees font family is developed according
+ to calligraphic rules, following the style of Syed Nafees
+ Al-Hussaini (Nafees Raqam) one of the finest calligraphers of
+ Pakistan '';
+
+ homepage = "http://www.cle.org.pk/software/localization.htm";
+
+ # Used to be GPLv2. The license distributed with the fonts looks
+ # more like a modified BSD, but still contains the GPLv2 embedded
+ # font exception, and some not-for-resale language.
+ license = "unknown";
+
+ platforms = stdenv.lib.platforms.all;
+ maintainers = [ "Daniel Bergey " ];
+ };
+}
diff --git a/pkgs/data/fonts/poly/default.nix b/pkgs/data/fonts/poly/default.nix
new file mode 100644
index 00000000000..63006fdd4f8
--- /dev/null
+++ b/pkgs/data/fonts/poly/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+ name = "poly";
+
+ regular = fetchurl {
+ # Finally a mirror that has a sha256 that doesn't change.
+ url = "https://googlefontdirectory.googlecode.com/hg-history/d7441308e589c9fa577f920fc4152fa32477a267/poly/src/Poly-Regular.otf";
+ sha256 = "1mxp2lvki6b1h7r9xcj1ld0g4z5y3dmsal85xam4yr764zpjzaiw";
+ };
+
+ italic = fetchurl {
+ # Finally a mirror that has a sha256 that doesn't change.
+ url = "https://googlefontdirectory.googlecode.com/hg-history/d7441308e589c9fa577f920fc4152fa32477a267/poly/src/Poly-Italic.otf";
+ sha256 = "1chzcy3kyi7wpr4iq4aj1v24fq1wwph1v5z96dimlqcrnvm66h2l";
+ };
+
+ buildInputs = [unzip];
+
+ sourceRoot = ".";
+
+ unpackPhase = "true";
+
+ installPhase = ''
+ mkdir -p $out/share/fonts/opentype
+ cp ${regular} $out/share/fonts/opentype/Poly-Regular.otf
+ cp ${italic} $out/share/fonts/opentype/Poly-Italic.otf
+ '';
+
+ meta = {
+ description = "Medium contrast serif font.";
+ longDescription = ''
+ With short ascenders and a very high x-height, Poly is efficient in small
+ sizes. Thanks to its careful balance between the x-height and glyph widths,
+ it allows more economy and legibility than standard web serifs, even in
+ small sizes. The aglutinative language for which it was designed contains
+ very long words. The goal was to develop a typeface that would tolerate
+ cramped tracking and that would increase the number of letters on a single
+ line. Poly is a Unicode typeface family that supports Open Type features
+ and languages that use the Latin script and its variants.
+ '';
+ homepage = http://www.fontsquirrel.com/fonts/poly;
+ license = stdenv.lib.licenses.ofl;
+ maintainers = with stdenv.lib.maintainers; [ relrod ];
+ platforms = with stdenv.lib.platforms; linux;
+ };
+}
diff --git a/pkgs/data/fonts/source-code-pro/default.nix b/pkgs/data/fonts/source-code-pro/default.nix
new file mode 100644
index 00000000000..d48fbed696c
--- /dev/null
+++ b/pkgs/data/fonts/source-code-pro/default.nix
@@ -0,0 +1,42 @@
+x@{builderDefsPackage
+ , unzip
+ , ...}:
+builderDefsPackage
+(a :
+let
+ helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
+ [];
+
+ buildInputs = map (n: builtins.getAttr n x)
+ (builtins.attrNames (builtins.removeAttrs x helperArgNames));
+ sourceInfo = rec {
+ version="1.017";
+ name="SourceCodePro";
+ url="mirror://sourceforge/sourcecodepro.adobe/${name}_FontsOnly-${version}.zip";
+ hash="07xjfxin883a3g3admdddxxqyzigihbsnmik0zpjii09cdlb8dl1";
+ };
+in
+rec {
+ src = a.fetchurl {
+ url = sourceInfo.url;
+ sha256 = sourceInfo.hash;
+ };
+
+ name = "${sourceInfo.name}-${sourceInfo.version}";
+ inherit buildInputs;
+
+ phaseNames = ["doUnpack" "installFonts"];
+
+ doUnpack = a.fullDepEntry (''
+ unzip ${src}
+ cd ${sourceInfo.name}*/OTF/
+ '') ["addInputs"];
+
+ meta = {
+ description = "A set of monospaced OpenType fonts designed for coding environments";
+ maintainers = with a.lib.maintainers; [ relrod ];
+ platforms = with a.lib.platforms; all;
+ homepage = "http://blog.typekit.com/2012/09/24/source-code-pro/";
+ license = "OFL";
+ };
+}) x
diff --git a/pkgs/data/misc/tzdata/default.nix b/pkgs/data/misc/tzdata/default.nix
index da043da0967..afee316d0bf 100644
--- a/pkgs/data/misc/tzdata/default.nix
+++ b/pkgs/data/misc/tzdata/default.nix
@@ -1,6 +1,6 @@
{ stdenv, fetchurl }:
-let version = "2013g"; in
+let version = "2014b"; in
stdenv.mkDerivation rec {
name = "tzdata-${version}";
@@ -8,22 +8,27 @@ stdenv.mkDerivation rec {
srcs =
[ (fetchurl {
url = "http://www.iana.org/time-zones/repository/releases/tzdata${version}.tar.gz";
- sha256 = "0krsgncjnk64g3xshj5xd3znskcx9wwy20g1wmm2lwycincx7kdn";
+ sha256 = "1d8w5g7fy8nrdj092cwmxdxw6rk3bzwpxqpz6l5sra2kqbhg7qfi";
})
(fetchurl {
url = "http://www.iana.org/time-zones/repository/releases/tzcode${version}.tar.gz";
- sha256 = "0ysqm72xm9vcykqg9zgry69w6gr3i6b6mpbvgfmwyrdvb6s5ihy7";
+ sha256 = "12x7ahbjxc3sj4ykcvx5c7kw1nbn6ywm8wzq6303y3l8qyqd7nmm";
})
];
sourceRoot = ".";
+ outputs = [ "out" "lib" ];
- makeFlags = "TOPDIR=$(out) TZDIR=$(out)/share/zoneinfo ETCDIR=$(TMPDIR)/etc LIBDIR=$(TMPDIR)/lib MANDIR=$(TMPDIR)/man AWK=awk";
+ makeFlags = "TOPDIR=$(out) TZDIR=$(out)/share/zoneinfo ETCDIR=$(TMPDIR)/etc LIBDIR=$(lib)/lib MANDIR=$(TMPDIR)/man AWK=awk CFLAGS=-DHAVE_LINK=0";
postInstall =
''
- mv $out/share/zoneinfo-posix $out/share/zoneinfo/posix
+ rm $out/share/zoneinfo-posix
+ ln -s . $out/share/zoneinfo/posix
mv $out/share/zoneinfo-leaps $out/share/zoneinfo/right
+
+ ensureDir "$lib/include"
+ cp tzfile.h "$lib/include/tzfile.h"
'';
meta = {
diff --git a/pkgs/desktops/cinnamon/automount-plugin.patch b/pkgs/desktops/cinnamon/automount-plugin.patch
new file mode 100644
index 00000000000..3d90da99f08
--- /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 00000000000..6eced78ed11
--- /dev/null
+++ b/pkgs/desktops/cinnamon/cinnamon-control-center.nix
@@ -0,0 +1,41 @@
+
+{ 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 ];
+
+ broken = true;
+ };
+}
diff --git a/pkgs/desktops/cinnamon/cinnamon-desktop.nix b/pkgs/desktops/cinnamon/cinnamon-desktop.nix
index d3cf04e835d..8ead149fc2b 100644
--- a/pkgs/desktops/cinnamon/cinnamon-desktop.nix
+++ b/pkgs/desktops/cinnamon/cinnamon-desktop.nix
@@ -36,6 +36,7 @@ stdenv.mkDerivation {
platforms = stdenv.lib.platforms.linux;
maintainers = [ stdenv.lib.maintainers.roelof ];
+
+ broken = true;
};
}
-
diff --git a/pkgs/desktops/cinnamon/cinnamon-session.nix b/pkgs/desktops/cinnamon/cinnamon-session.nix
index 534fa11f046..d84438b7bd1 100644
--- a/pkgs/desktops/cinnamon/cinnamon-session.nix
+++ b/pkgs/desktops/cinnamon/cinnamon-session.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation {
gtk3 dbus_glib upower json_glib
intltool systemd xorg.xtrans
makeWrapper
- cinnamon-desktop/*gschemas*/
+ cinnamon-desktop /*gschemas*/
];
preBuild = "patchShebangs ./scripts";
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
postFixup = ''
rm $out/share/icons/hicolor/icon-theme.cache
- for f in "$out"/bin/*; do
+ for f in "$out/bin/"*; do
wrapProgram "$f" --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
done
'';
@@ -43,6 +43,7 @@ stdenv.mkDerivation {
platforms = stdenv.lib.platforms.linux;
maintainers = [ stdenv.lib.maintainers.roelof ];
+
+ broken = true;
};
}
-
diff --git a/pkgs/desktops/cinnamon/cinnamon-settings-daemon.nix b/pkgs/desktops/cinnamon/cinnamon-settings-daemon.nix
new file mode 100644
index 00000000000..ca220fd9d85
--- /dev/null
+++ b/pkgs/desktops/cinnamon/cinnamon-settings-daemon.nix
@@ -0,0 +1,53 @@
+
+{ 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 ];
+
+ broken = true;
+ };
+}
diff --git a/pkgs/desktops/cinnamon/cinnamon-translations.nix b/pkgs/desktops/cinnamon/cinnamon-translations.nix
index a68a905f92e..91a7acdef82 100644
--- a/pkgs/desktops/cinnamon/cinnamon-translations.nix
+++ b/pkgs/desktops/cinnamon/cinnamon-translations.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
installPhase =
''
mkdir -pv $out/share/cinnamon/locale
- cp -av mo-export/* $out/share/cinnamon/locale/
+ cp -av "mo-export/"* $out/share/cinnamon/locale/
'';
meta = {
@@ -22,6 +22,7 @@ stdenv.mkDerivation {
platforms = stdenv.lib.platforms.linux;
maintainers = [ stdenv.lib.maintainers.roelof ];
+
+ broken = true;
};
}
-
diff --git a/pkgs/desktops/cinnamon/cjs.nix b/pkgs/desktops/cinnamon/cjs.nix
index 3747262cdf4..5d584761565 100644
--- a/pkgs/desktops/cinnamon/cjs.nix
+++ b/pkgs/desktops/cinnamon/cjs.nix
@@ -36,5 +36,7 @@ stdenv.mkDerivation rec {
platforms = stdenv.lib.platforms.linux;
maintainers = [ stdenv.lib.maintainers.roelof ];
+
+ broken = true;
};
}
diff --git a/pkgs/desktops/cinnamon/dpms.patch b/pkgs/desktops/cinnamon/dpms.patch
new file mode 100644
index 00000000000..a73f33dc618
--- /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 00000000000..6398306a76a
--- /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 00000000000..f67d961ff58
--- /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
++
++#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/xxx/csd-keyboard-xkb.h b/plugins/keyboard/xxx/csd-keyboard-xkb.h
+--- a/plugins/keyboard/xxx/csd-keyboard-xkb.h 1970-01-01 01:00:00.000000000 +0100
++++ b/plugins/keyboard/xxx/csd-keyboard-xkb.h 2013-08-25 16:36:02.000000000 +0100
+@@ -0,0 +1,39 @@
++/* -*- 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/xxx/delayed-dialog.c b/plugins/keyboard/xxx/delayed-dialog.c
+--- a/plugins/keyboard/xxx/delayed-dialog.c 1970-01-01 01:00:00.000000000 +0100
++++ b/plugins/keyboard/xxx/delayed-dialog.c 2013-08-25 16:36:02.000000000 +0100
+@@ -0,0 +1,128 @@
++/*
++ * 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/xxx/delayed-dialog.h b/plugins/keyboard/xxx/delayed-dialog.h
+--- a/plugins/keyboard/xxx/delayed-dialog.h 1970-01-01 01:00:00.000000000 +0100
++++ b/plugins/keyboard/xxx/delayed-dialog.h 2013-08-25 16:36:02.000000000 +0100
+@@ -0,0 +1,32 @@
++/*
++ * 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/xxx/gkbd-configuration.c b/plugins/keyboard/xxx/gkbd-configuration.c
+--- a/plugins/keyboard/xxx/gkbd-configuration.c 1970-01-01 01:00:00.000000000 +0100
++++ b/plugins/keyboard/xxx/gkbd-configuration.c 2013-08-25 16:36:02.000000000 +0100
+@@ -0,0 +1,350 @@
++/*
++ * Copyright (C) 2010 Canonical Ltd.
++ *
++ * Authors: Jan Arne Petersen