diff --git a/.gitignore b/.gitignore
index d43399383a0..16aaf68b70b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,5 @@ result-*
/doc/manual.html
/doc/manual.pdf
.version-suffix
+
+.DS_Store
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000000..6fa426d36de
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,5 @@
+language: python
+python: "3.4"
+before_install: ./maintainers/scripts/travis-nox-review-pr.sh nix
+install: ./maintainers/scripts/travis-nox-review-pr.sh nox
+script: ./maintainers/scripts/travis-nox-review-pr.sh build
diff --git a/.version b/.version
index d3a61dbd830..eab81229314 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-14.10
\ No newline at end of file
+14.11
\ No newline at end of file
diff --git a/default.nix b/default.nix
index c1b9bfd39f9..e0df520721c 100644
--- a/default.nix
+++ b/default.nix
@@ -1,6 +1,6 @@
-if ! builtins ? nixVersion || builtins.compareVersions "1.6" builtins.nixVersion == 1 then
+if ! builtins ? nixVersion || builtins.compareVersions "1.7" builtins.nixVersion == 1 then
- abort "This version of Nixpkgs requires Nix >= 1.6, please upgrade!"
+ abort "This version of Nixpkgs requires Nix >= 1.7, please upgrade!"
else
diff --git a/doc/Makefile b/doc/Makefile
deleted file mode 100644
index 3c2e8cb21b0..00000000000
--- a/doc/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# You may need to override this.
-docbookxsl = $(HOME)/.nix-profile/xml/xsl/docbook
-dblatex = dblatex
-
-XMLLINT = xmllint --catalogs
-XSLTPROC = xsltproc --catalogs \
- --param section.autolabel 1 \
- --param section.label.includes.component.label 1 \
- --param html.stylesheet \'style.css\' \
- --param xref.with.number.and.title 1 \
- --param toc.section.depth 3 \
- --param admon.style \'\' \
- --param callout.graphics.extension \'.gif\'
-
-NEWS_OPTS = \
- --stringparam generate.toc "article nop" \
- --stringparam section.autolabel.max.depth 0 \
- --stringparam header.rule 0
-
-all: NEWS.html NEWS.txt manual.html manual.pdf
-
-NEWS.html: release-notes.xml
- $(XSLTPROC) --nonet --xinclude --output $@ $(NEWS_OPTS) \
- $(docbookxsl)/html/docbook.xsl release-notes.xml
-
-NEWS.txt: release-notes.xml
- $(XSLTPROC) --nonet --xinclude quote-literals.xsl release-notes.xml | \
- $(XSLTPROC) --nonet --output $@.tmp.html $(NEWS_OPTS) \
- $(docbookxsl)/html/docbook.xsl -
- LANG=en_US w3m -dump $@.tmp.html > $@
- rm $@.tmp.html
-
-manual.html: *.xml
- $(XSLTPROC) --nonet --xinclude --output manual.html \
- $(docbookxsl)/html/docbook.xsl manual.xml
-
-manual.pdf: *.xml
- $(dblatex) \
- -P doc.collab.show=0 \
- -P latex.output.revhistory=0 \
- manual.xml
diff --git a/doc/contributing.xml b/doc/contributing.xml
new file mode 100644
index 00000000000..bcea404baee
--- /dev/null
+++ b/doc/contributing.xml
@@ -0,0 +1,21 @@
+
+
+Contributing
+
+If you make modifications to the manual, it's important to build the manual before contributing:
+
+
+
+ $ git clone git://github.com/NixOS/nixpkgs.git
+
+ $ cd nixpkgs/pkgs/top-level
+
+ $ nix-build -A tarball release.nix
+
+ Inside the built derivation you shall see manual/index.html file.
+
+
+
+
diff --git a/doc/default.nix b/doc/default.nix
new file mode 100644
index 00000000000..1e8974d6026
--- /dev/null
+++ b/doc/default.nix
@@ -0,0 +1,42 @@
+with import ./.. { };
+with lib;
+
+stdenv.mkDerivation {
+ name = "nixpkgs-manual";
+
+ sources = sourceFilesBySuffices ./. [".xml"];
+
+ buildInputs = [ libxml2 libxslt ];
+
+ xsltFlags = ''
+ --param section.autolabel 1
+ --param section.label.includes.component.label 1
+ --param html.stylesheet 'style.css'
+ --param xref.with.number.and.title 1
+ --param toc.section.depth 3
+ --param admon.style '''
+ --param callout.graphics.extension '.gif'
+ '';
+
+ buildCommand = ''
+ ln -s $sources/*.xml . # */
+
+ echo ${nixpkgsVersion} > .version
+
+ xmllint --noout --nonet --xinclude --noxincludenode \
+ --relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
+ manual.xml
+
+ dst=$out/share/doc/nixpkgs
+ mkdir -p $dst
+ xsltproc $xsltFlags --nonet --xinclude \
+ --output $dst/manual.html \
+ ${docbook5_xsl}/xml/xsl/docbook/xhtml/docbook.xsl \
+ ./manual.xml
+
+ cp ${./style.css} $dst/style.css
+
+ mkdir -p $out/nix-support
+ echo "doc manual $dst manual.html" >> $out/nix-support/hydra-build-products
+ '';
+}
diff --git a/doc/language-support.xml b/doc/language-support.xml
index f5e89df57fc..5e49121e695 100644
--- a/doc/language-support.xml
+++ b/doc/language-support.xml
@@ -233,6 +233,22 @@ twisted = buildPythonPackage {
+Ruby
+ For example, to package yajl-ruby package, use gem-nix:
+
+
+ $ nix-env -i gem-nix
+ $ gem-nix --no-user-install --nix-file=pkgs/development/interpreters/ruby/generated.nix yajl-ruby
+ $ nix-build -A rubyLibs.yajl-ruby
+
+
+
+
+Go
+ To extract dependency information from a Go package in automated way use go2nix.
+
+
+
Java
Ant-based Java packages are typically built from source as follows:
@@ -314,6 +330,90 @@ Runtime) instead of the OpenJRE.
+Lua
+
+
+ Lua packages are built by the buildLuaPackage function. This function is
+ implemented
+ in
+ pkgs/development/lua-modules/generic/default.nix
+ and works similarly to buildPerlPackage. (See
+ for details.)
+
+
+
+ Lua packages are defined
+ in pkgs/top-level/lua-packages.nix.
+ Most of them are simple. For example:
+
+
+fileSystem = buildLuaPackage {
+ name = "filesystem-1.6.2";
+ src = fetchurl {
+ url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_2.tar.gz";
+ sha256 = "1n8qdwa20ypbrny99vhkmx8q04zd2jjycdb5196xdhgvqzk10abz";
+ };
+ meta = {
+ homepage = "https://github.com/keplerproject/luafilesystem";
+ hydraPlatforms = stdenv.lib.platforms.linux;
+ maintainers = with maintainers; [ flosse ];
+ };
+};
+
+
+
+
+ Though, more complicated package should be placed in a seperate file in
+ pkgs/development/lua-modules.
+
+
+ Lua packages accept additional parameter disabled, which defines
+ the condition of disabling package from luaPackages. For example, if package has
+ disabled assigned to lua.luaversion != "5.1",
+ it will not be included in any luaPackages except lua51Packages, making it
+ only be built for lua 5.1.
+
+
+
+
+Coq
+
+ Coq libraries should be installed in
+ $(out)/lib/coq/${coq.coq-version}/user-contrib/.
+ Such directories are automatically added to the
+ $COQPATH environment variable by the hook defined
+ in the Coq derivation.
+
+
+ Some libraries require OCaml and sometimes also Camlp5. The exact
+ versions that were used to build Coq are saved in the
+ coq.ocaml and coq.camlp5
+ attributes.
+
+
+ Here is a simple package example. It is a pure Coq library, thus it
+ only depends on Coq. Its makefile has been
+ generated using coq_makefile so we only have to
+ set the $COQLIB variable at install time.
+
+
+{stdenv, fetchurl, coq}:
+stdenv.mkDerivation {
+ src = fetchurl {
+ url = http://coq.inria.fr/pylons/contribs/files/Karatsuba/v8.4/Karatsuba.tar.gz;
+ sha256 = "0ymfpv4v49k4fm63nq6gcl1hbnnxrvjjp7yzc4973n49b853c5b1";
+ };
+
+ name = "coq-karatsuba";
+
+ buildInputs = [ coq ];
+
+ installFlags = "COQLIB=$(out)/lib/coq/${coq.coq-version}/";
+}
+
+
+
+
+
diff --git a/nixos/doc/manual/administration/store-corruption.xml b/nixos/doc/manual/administration/store-corruption.xml
new file mode 100644
index 00000000000..0160cb45358
--- /dev/null
+++ b/nixos/doc/manual/administration/store-corruption.xml
@@ -0,0 +1,37 @@
+
+
+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
+tendency to replace un-synced files with zero bytes.) NixOS tries
+hard to prevent this from happening: it performs a
+sync before switching to a new configuration, and
+Nix’s database is fully transactional. If corruption still occurs,
+you may be able to fix it automatically.
+
+If the corruption is in a path in the closure of the NixOS
+system configuration, you can fix it by doing
+
+
+$ nixos-rebuild switch --repair
+
+
+This will cause Nix to check every path in the closure, and if its
+cryptographic hash differs from the hash recorded in Nix’s database,
+the path is rebuilt or redownloaded.
+
+You can also scan the entire Nix store for corrupt paths:
+
+
+$ nix-store --verify --check-contents --repair
+
+
+Any corrupt paths will be redownloaded if they’re available in a
+binary cache; otherwise, they cannot be repaired.
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/administration/troubleshooting.xml b/nixos/doc/manual/administration/troubleshooting.xml
new file mode 100644
index 00000000000..351fb188331
--- /dev/null
+++ b/nixos/doc/manual/administration/troubleshooting.xml
@@ -0,0 +1,18 @@
+
+
+Troubleshooting
+
+This chapter describes solutions to common problems you might
+encounter when you manage your NixOS system.
+
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/administration/user-sessions.xml b/nixos/doc/manual/administration/user-sessions.xml
new file mode 100644
index 00000000000..05e2c1a9b29
--- /dev/null
+++ b/nixos/doc/manual/administration/user-sessions.xml
@@ -0,0 +1,53 @@
+
+
+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
+loginctl allows querying and manipulating user
+sessions. For instance, to list all user sessions:
+
+
+$ loginctl
+ SESSION UID USER SEAT
+ c1 500 eelco seat0
+ c3 0 root seat0
+ c4 500 alice
+
+
+This shows that two users are logged in locally, while another is
+logged in remotely. (“Seats” are essentially the combinations of
+displays and input devices attached to the system; usually, there is
+only one seat.) To get information about a session:
+
+
+$ loginctl session-status c3
+c3 - root (0)
+ Since: Tue, 2013-01-08 01:17:56 CET; 4min 42s ago
+ Leader: 2536 (login)
+ Seat: seat0; vc3
+ TTY: /dev/tty3
+ Service: login; type tty; class user
+ State: online
+ CGroup: name=systemd:/user/root/c3
+ ├─ 2536 /nix/store/10mn4xip9n7y9bxqwnsx7xwx2v2g34xn-shadow-4.1.5.1/bin/login --
+ ├─10339 -bash
+ └─10355 w3m nixos.org
+
+
+This shows that the user is logged in on virtual console 3. It also
+lists the processes belonging to this session. Since systemd keeps
+track of this, you can terminate a session in a way that ensures that
+all the session’s processes are gone:
+
+
+$ loginctl terminate-session c3
+
+
+
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/configuration.xml b/nixos/doc/manual/configuration.xml
deleted file mode 100644
index 98686a19f1e..00000000000
--- a/nixos/doc/manual/configuration.xml
+++ /dev/null
@@ -1,1528 +0,0 @@
-
-
-Configuring NixOS
-
-This chapter describes how to configure various aspects of a
-NixOS machine through the configuration file
-/etc/nixos/configuration.nix. As described in
-, changes to this file only take
-effect after you run nixos-rebuild.
-
-
-
-
-Configuration syntax
-
-The basics
-
-The NixOS configuration file
-/etc/nixos/configuration.nix is actually a
-Nix expression, which is the Nix package
-manager’s purely functional language for describing how to build
-packages and configurations. This means you have all the expressive
-power of that language at your disposal, including the ability to
-abstract over common patterns, which is very useful when managing
-complex systems. The syntax and semantics of the Nix language are
-fully described in the Nix
-manual, but here we give a short overview of the most important
-constructs useful in NixOS configuration files.
-
-The NixOS configuration file generally looks like this:
-
-
-{ config, pkgs, ... }:
-
-{ option definitions
-}
-
-
-The first line ({ config, pkgs, ... }:) denotes
-that this is actually a function that takes at least the two arguments
- config and pkgs. (These are
-explained later.) The function returns a set of
-option definitions ({ ... }). These definitions have the
-form name =
-value, where
-name is the name of an option and
-value is its value. For example,
-
-
-{ config, pkgs, ... }:
-
-{ services.httpd.enable = true;
- services.httpd.adminAddr = "alice@example.org";
- services.httpd.documentRoot = "/webroot";
-}
-
-
-defines a configuration with three option definitions that together
-enable the Apache HTTP Server with /webroot as
-the document root.
-
-Sets can be nested, and in fact dots in option names are
-shorthand for defining a set containing another set. For instance,
- defines a set named
-services that contains a set named
-httpd, which in turn contains an option definition
-named enable with value true.
-This means that the example above can also be written as:
-
-
-{ config, pkgs, ... }:
-
-{ services = {
- httpd = {
- enable = true;
- adminAddr = "alice@example.org";
- documentRoot = "/webroot";
- };
- };
-}
-
-
-which may be more convenient if you have lots of option definitions
-that share the same prefix (such as
-services.httpd).
-
-NixOS checks your option definitions for correctness. For
-instance, if you try to define an option that doesn’t exist (that is,
-doesn’t have a corresponding option declaration),
-nixos-rebuild will give an error like:
-
-The option `services.httpd.enabl' defined in `/etc/nixos/configuration.nix' does not exist.
-
-Likewise, values in option definitions must have a correct type. For
-instance, must be a Boolean
-(true or false). Trying to give
-it a value of another type, such as a string, will cause an error:
-
-The option value `services.httpd.enable' in `/etc/nixos/configuration.nix' is not a boolean.
-
-
-
-
-Options have various types of values. The most important are:
-
-
-
- Strings
-
- Strings are enclosed in double quotes, e.g.
-
-
-networking.hostName = "dexter";
-
-
- Special characters can be escaped by prefixing them with a
- backslash (e.g. \").
-
- Multi-line strings can be enclosed in double
- single quotes, e.g.
-
-
-networking.extraHosts =
- ''
- 127.0.0.2 other-localhost
- 10.0.0.1 server
- '';
-
-
- The main difference is that preceding whitespace is
- automatically stripped from each line, and that characters like
- " and \ are not special
- (making it more convenient for including things like shell
- code).
-
-
-
-
- Booleans
-
- These can be true or
- false, e.g.
-
-
-networking.firewall.enable = true;
-networking.firewall.allowPing = false;
-
-
-
-
-
-
- Integers
-
- For example,
-
-
-boot.kernel.sysctl."net.ipv4.tcp_keepalive_time" = 60;
-
-
- (Note that here the attribute name
- net.ipv4.tcp_keepalive_time is enclosed in
- quotes to prevent it from being interpreted as a set named
- net containing a set named
- ipv4, and so on. This is because it’s not a
- NixOS option but the literal name of a Linux kernel
- setting.)
-
-
-
-
- Sets
-
- Sets were introduced above. They are name/value pairs
- enclosed in braces, as in the option definition
-
-
-fileSystems."/boot" =
- { device = "/dev/sda1";
- fsType = "ext4";
- options = "rw,data=ordered,relatime";
- };
-
-
-
-
-
-
- Lists
-
- The important thing to note about lists is that list
- elements are separated by whitespace, like this:
-
-
-boot.kernelModules = [ "fuse" "kvm-intel" "coretemp" ];
-
-
- List elements can be any other type, e.g. sets:
-
-
-swapDevices = [ { device = "/dev/disk/by-label/swap"; } ];
-
-
-
-
-
-
- Packages
-
- Usually, the packages you need are already part of the Nix
- Packages collection, which is a set that can be accessed through
- the function argument pkgs. Typical uses:
-
-
-environment.systemPackages =
- [ pkgs.thunderbird
- pkgs.emacs
- ];
-
-postgresql.package = pkgs.postgresql90;
-
-
- The latter option definition changes the default PostgreSQL
- package used by NixOS’s PostgreSQL service to 9.0. For more
- information on packages, including how to add new ones, see
- .
-
-
-
-
-
-
-
-
-
-
-Abstractions
-
-If you find yourself repeating yourself over and over, it’s time
-to abstract. Take, for instance, this Apache HTTP Server configuration:
-
-
-{
- services.httpd.virtualHosts =
- [ { hostName = "example.org";
- documentRoot = "/webroot";
- adminAddr = "alice@example.org";
- enableUserDir = true;
- }
- { hostName = "example.org";
- documentRoot = "/webroot";
- adminAddr = "alice@example.org";
- enableUserDir = true;
- enableSSL = true;
- sslServerCert = "/root/ssl-example-org.crt";
- sslServerKey = "/root/ssl-example-org.key";
- }
- ];
-}
-
-
-It defines two virtual hosts with nearly identical configuration; the
-only difference is that the second one has SSL enabled. To prevent
-this duplication, we can use a let:
-
-
-let
- exampleOrgCommon =
- { hostName = "example.org";
- documentRoot = "/webroot";
- adminAddr = "alice@example.org";
- enableUserDir = true;
- };
-in
-{
- services.httpd.virtualHosts =
- [ exampleOrgCommon
- (exampleOrgCommon // {
- enableSSL = true;
- sslServerCert = "/root/ssl-example-org.crt";
- sslServerKey = "/root/ssl-example-org.key";
- })
- ];
-}
-
-
-The let exampleOrgCommon =
-... defines a variable named
-exampleOrgCommon. The //
-operator merges two attribute sets, so the configuration of the second
-virtual host is the set exampleOrgCommon extended
-with the SSL options.
-
-You can write a let wherever an expression is
-allowed. Thus, you also could have written:
-
-
-{
- services.httpd.virtualHosts =
- let exampleOrgCommon = ...; in
- [ exampleOrgCommon
- (exampleOrgCommon // { ... })
- ];
-}
-
-
-but not { let exampleOrgCommon =
-...; in ...;
-} since attributes (as opposed to attribute values) are not
-expressions.
-
-Functions provide another method of
-abstraction. For instance, suppose that we want to generate lots of
-different virtual hosts, all with identical configuration except for
-the host name. This can be done as follows:
-
-
-{
- services.httpd.virtualHosts =
- let
- makeVirtualHost = name:
- { hostName = name;
- documentRoot = "/webroot";
- adminAddr = "alice@example.org";
- };
- in
- [ (makeVirtualHost "example.org")
- (makeVirtualHost "example.com")
- (makeVirtualHost "example.gov")
- (makeVirtualHost "example.nl")
- ];
-}
-
-
-Here, makeVirtualHost is a function that takes a
-single argument name and returns the configuration
-for a virtual host. That function is then called for several names to
-produce the list of virtual host configurations.
-
-We can further improve on this by using the function
-map, which applies another function to every
-element in a list:
-
-
-{
- services.httpd.virtualHosts =
- let
- makeVirtualHost = ...;
- in map makeVirtualHost
- [ "example.org" "example.com" "example.gov" "example.nl" ];
-}
-
-
-(The function map is called a
-higher-order function because it takes another
-function as an argument.)
-
-What if you need more than one argument, for instance, if we
-want to use a different documentRoot for each
-virtual host? Then we can make makeVirtualHost a
-function that takes a set as its argument, like this:
-
-
-{
- services.httpd.virtualHosts =
- let
- makeVirtualHost = { name, root }:
- { hostName = name;
- documentRoot = root;
- adminAddr = "alice@example.org";
- };
- in map makeVirtualHost
- [ { name = "example.org"; root = "/sites/example.org"; }
- { name = "example.com"; root = "/sites/example.com"; }
- { name = "example.gov"; root = "/sites/example.gov"; }
- { name = "example.nl"; root = "/sites/example.nl"; }
- ];
-}
-
-
-But in this case (where every root is a subdirectory of
-/sites named after the virtual host), it would
-have been shorter to define makeVirtualHost as
-
-makeVirtualHost = name:
- { hostName = name;
- documentRoot = "/sites/${name}";
- adminAddr = "alice@example.org";
- };
-
-
-Here, the construct
-${...} allows the result
-of an expression to be spliced into a string.
-
-
-
-
-Modularity
-
-The NixOS configuration mechanism is modular. If your
-configuration.nix becomes too big, you can split
-it into multiple files. Likewise, if you have multiple NixOS
-configurations (e.g. for different computers) with some commonality,
-you can move the common configuration into a shared file.
-
-Modules have exactly the same syntax as
-configuration.nix. In fact,
-configuration.nix is itself a module. You can
-use other modules by including them from
-configuration.nix, e.g.:
-
-
-{ config, pkgs, ... }:
-
-{ imports = [ ./vpn.nix ./kde.nix ];
- services.httpd.enable = true;
- environment.systemPackages = [ pkgs.emacs ];
- ...
-}
-
-
-Here, we include two modules from the same directory,
-vpn.nix and kde.nix. The
-latter might look like this:
-
-
-{ config, pkgs, ... }:
-
-{ services.xserver.enable = true;
- services.xserver.displayManager.kdm.enable = true;
- services.xserver.desktopManager.kde4.enable = true;
- environment.systemPackages = [ pkgs.kde4.kscreensaver ];
-}
-
-
-Note that both configuration.nix and
-kde.nix define the option
-. When multiple modules
-define an option, NixOS will try to merge the
-definitions. In the case of
-, that’s easy: the lists of
-packages can simply be concatenated. The value in
-configuration.nix is merged last, so for
-list-type options, it will appear at the end of the merged list. If
-you want it to appear first, you can use mkBefore:
-
-
-boot.kernelModules = mkBefore [ "kvm-intel" ];
-
-
-This causes the kvm-intel kernel module to be
-loaded before any other kernel modules.
-
-For other types of options, a merge may not be possible. For
-instance, if two modules define
-,
-nixos-rebuild will give an error:
-
-
-The unique option `services.httpd.adminAddr' is defined multiple times, in `/etc/nixos/httpd.nix' and `/etc/nixos/configuration.nix'.
-
-
-When that happens, it’s possible to force one definition take
-precedence over the others:
-
-
-services.httpd.adminAddr = pkgs.lib.mkForce "bob@example.org";
-
-
-
-
-When using multiple modules, you may need to access
-configuration values defined in other modules. This is what the
-config function argument is for: it contains the
-complete, merged system configuration. That is,
-config is the result of combining the
-configurations returned by every moduleIf you’re
-wondering how it’s possible that the (indirect)
-result of a function is passed as an
-input to that same function: that’s because Nix
-is a “lazy” language — it only computes values when they are needed.
-This works as long as no individual configuration value depends on
-itself.. For example, here is a module that adds
-some packages to only if
- is set to
-true somewhere else:
-
-
-{ config, pkgs, ... }:
-
-{ environment.systemPackages =
- if config.services.xserver.enable then
- [ pkgs.firefox
- pkgs.thunderbird
- ]
- else
- [ ];
-}
-
-
-
-
-With multiple modules, it may not be obvious what the final
-value of a configuration option is. The command
- allows you to find out:
-
-
-$ nixos-option services.xserver.enable
-true
-
-$ nixos-option boot.kernelModules
-[ "tun" "ipv6" "loop" ... ]
-
-
-Interactive exploration of the configuration is possible using
-nix-repl,
-a read-eval-print loop for Nix expressions. It’s not installed by
-default; run nix-env -i nix-repl to get it. A
-typical use:
-
-
-$ nix-repl '<nixos>'
-
-nix-repl> config.networking.hostName
-"mandark"
-
-nix-repl> map (x: x.hostName) config.services.httpd.virtualHosts
-[ "example.org" "example.gov" ]
-
-
-
-
-
-
-
-Syntax summary
-
-Below is a summary of the most important syntactic constructs in
-the Nix expression language. It’s not complete. In particular, there
-are many other built-in functions. See the Nix
-manual for the rest.
-
-
-
-
-
-
-
- Example
- Description
-
-
-
-
-
- Basic values
-
-
- "Hello world"
- A string
-
-
- "${pkgs.bash}/bin/sh"
- A string containing an expression (expands to "/nix/store/hash-bash-version/bin/sh")
-
-
- true, false
- Booleans
-
-
- 123
- An integer
-
-
- ./foo.png
- A path (relative to the containing Nix expression)
-
-
-
- Compound values
-
-
- { x = 1; y = 2; }
- An set with attributes names x and y
-
-
- { foo.bar = 1; }
- A nested set, equivalent to { foo = { bar = 1; }; }
-
-
- rec { x = "bla"; y = x + "bar"; }
- A recursive set, equivalent to { x = "foo"; y = "foobar"; }
-
-
- [ "foo" "bar" ]
- A list with two elements
-
-
-
- Operators
-
-
- "foo" + "bar"
- String concatenation
-
-
- 1 + 2
- Integer addition
-
-
- "foo" == "f" + "oo"
- Equality test (evaluates to true)
-
-
- "foo" != "bar"
- Inequality test (evaluates to true)
-
-
- !true
- Boolean negation
-
-
- { x = 1; y = 2; }.x
- Attribute selection (evaluates to 1)
-
-
- { x = 1; y = 2; }.z or 3
- Attribute selection with default (evaluates to 3)
-
-
- { x = 1; y = 2; } // { z = 3; }
- Merge two sets (attributes in the right-hand set taking precedence)
-
-
-
- Control structures
-
-
- if 1 + 1 == 2 then "yes!" else "no!"
- Conditional expression
-
-
- assert 1 + 1 == 2; "yes!"
- Assertion check (evaluates to "yes!")
-
-
- let x = "foo"; y = "bar"; in x + y
- Variable definition
-
-
- with pkgs.lib; head [ 1 2 3 ]
- Add all attributes from the given set to the scope
- (evaluates to 1)
-
-
-
- Functions (lambdas)
-
-
- x: x + 1
- A function that expects an integer and returns it increased by 1
-
-
- (x: x + 1) 100
- A function call (evaluates to 101)
-
-
- let inc = x: x + 1; in inc (inc (inc 100))
- A function bound to a variable and subsequently called by name (evaluates to 103)
-
-
- { x, y }: x + y
- A function that expects a set with required attributes
- x and y and concatenates
- them
-
-
- { x, y ? "bar" }: x + y
- A function that expects a set with required attribute
- x and optional y, using
- "bar" as default value for
- y
-
-
- { x, y, ... }: x + y
- A function that expects a set with required attributes
- x and y and ignores any
- other attributes
-
-
- { x, y } @ args: x + y
- A function that expects a set with required attributes
- x and y, and binds the
- whole set to args
-
-
-
- Built-in functions
-
-
- import ./foo.nix
- Load and return Nix expression in given file
-
-
- map (x: x + x) [ 1 2 3 ]
- Apply a function to every element of a list (evaluates to [ 2 4 6 ])
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Package management
-
-This section describes how to add additional packages to your
-system. NixOS has two distinct styles of package management:
-
-
-
- Declarative, where you declare
- what packages you want in your
- configuration.nix. Every time you run
- nixos-rebuild, NixOS will ensure that you get a
- consistent set of binaries corresponding to your
- specification.
-
- Ad hoc, where you install,
- upgrade and uninstall packages via the nix-env
- command. This style allows mixing packages from different Nixpkgs
- versions. It’s the only choice for non-root
- users.
-
-
-
-
-
-The next two sections describe these two styles.
-
-
-Declarative package management
-
-With declarative package management, you specify which packages
-you want on your system by setting the option
-. For instance, adding the
-following line to configuration.nix enables the
-Mozilla Thunderbird email application:
-
-
-environment.systemPackages = [ pkgs.thunderbird ];
-
-
-The effect of this specification is that the Thunderbird package from
-Nixpkgs will be built or downloaded as part of the system when you run
-nixos-rebuild switch.
-
-You can get a list of the available packages as follows:
-
-$ nix-env -qaP '*' --description
-nixos.pkgs.firefox firefox-23.0 Mozilla Firefox - the browser, reloaded
-...
-
-
-The first column in the output is the attribute
-name, such as
-nixos.pkgs.thunderbird. (The
-nixos prefix allows distinguishing between
-different channels that you might have.)
-
-To “uninstall” a package, simply remove it from
- and run
-nixos-rebuild switch.
-
-
-Customising packages
-
-Some packages in Nixpkgs have options to enable or disable
-optional functionality or change other aspects of the package. For
-instance, the Firefox wrapper package (which provides Firefox with a
-set of plugins such as the Adobe Flash player) has an option to enable
-the Google Talk plugin. It can be set in
-configuration.nix as follows:
-
-
-nixpkgs.config.firefox.enableGoogleTalkPlugin = true;
-
-
-
-Unfortunately, Nixpkgs currently lacks a way to query
-available configuration options.
-
-Apart from high-level options, it’s possible to tweak a package
-in almost arbitrary ways, such as changing or disabling dependencies
-of a package. For instance, the Emacs package in Nixpkgs by default
-has a dependency on GTK+ 2. If you want to build it against GTK+ 3,
-you can specify that as follows:
-
-
-environment.systemPackages = [ (pkgs.emacs.override { gtk = pkgs.gtk3; }) ];
-
-
-The function override performs the call to the Nix
-function that produces Emacs, with the original arguments amended by
-the set of arguments specified by you. So here the function argument
-gtk gets the value pkgs.gtk3,
-causing Emacs to depend on GTK+ 3. (The parentheses are necessary
-because in Nix, function application binds more weakly than list
-construction, so without them,
-environment.systemPackages would be a list with two
-elements.)
-
-Even greater customisation is possible using the function
-overrideDerivation. While the
-override mechanism above overrides the arguments of
-a package function, overrideDerivation allows
-changing the result of the function. This
-permits changing any aspect of the package, such as the source code.
-For instance, if you want to override the source code of Emacs, you
-can say:
-
-
-environment.systemPackages =
- [ (pkgs.lib.overrideDerivation pkgs.emacs (attrs: {
- name = "emacs-25.0-pre";
- src = /path/to/my/emacs/tree;
- }))
- ];
-
-
-Here, overrideDerivation takes the Nix derivation
-specified by pkgs.emacs and produces a new
-derivation in which the original’s name and
-src attribute have been replaced by the given
-values. The original attributes are accessible via
-attrs.
-
-The overrides shown above are not global. They do not affect
-the original package; other packages in Nixpkgs continue to depend on
-the original rather than the customised package. This means that if
-another package in your system depends on the original package, you
-end up with two instances of the package. If you want to have
-everything depend on your customised instance, you can apply a
-global override as follows:
-
-
-nixpkgs.config.packageOverrides = pkgs:
- { emacs = pkgs.emacs.override { gtk = pkgs.gtk3; };
- };
-
-
-The effect of this definition is essentially equivalent to modifying
-the emacs attribute in the Nixpkgs source tree.
-Any package in Nixpkgs that depends on emacs will
-be passed your customised instance. (However, the value
-pkgs.emacs in
-nixpkgs.config.packageOverrides refers to the
-original rather than overridden instance, to prevent an infinite
-recursion.)
-
-
-
-Adding custom packages
-
-It’s possible that a package you need is not available in NixOS.
-In that case, you can do two things. First, you can clone the Nixpkgs
-repository, add the package to your clone, and (optionally) submit a
-patch or pull request to have it accepted into the main Nixpkgs
-repository. This is described in detail in the Nixpkgs manual.
-In short, you clone Nixpkgs:
-
-
-$ git clone git://github.com/NixOS/nixpkgs.git
-$ cd nixpkgs
-
-
-Then you write and test the package as described in the Nixpkgs
-manual. Finally, you add it to
-environment.systemPackages, e.g.
-
-
-environment.systemPackages = [ pkgs.my-package ];
-
-
-and you run nixos-rebuild, specifying your own
-Nixpkgs tree:
-
-
-$ nixos-rebuild switch -I nixpkgs=/path/to/my/nixpkgs
-
-
-
-The second possibility is to add the package outside of the
-Nixpkgs tree. For instance, here is how you specify a build of the
-GNU Hello
-package directly in configuration.nix:
-
-
-environment.systemPackages =
- let
- my-hello = with pkgs; stdenv.mkDerivation rec {
- name = "hello-2.8";
- src = fetchurl {
- url = "mirror://gnu/hello/${name}.tar.gz";
- sha256 = "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6";
- };
- };
- in
- [ my-hello ];
-
-
-Of course, you can also move the definition of
-my-hello into a separate Nix expression, e.g.
-
-environment.systemPackages = [ (import ./my-hello.nix) ];
-
-where my-hello.nix contains:
-
-with import <nixpkgs> {}; # bring all of Nixpkgs into scope
-
-stdenv.mkDerivation rec {
- name = "hello-2.8";
- src = fetchurl {
- url = "mirror://gnu/hello/${name}.tar.gz";
- sha256 = "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6";
- };
-}
-
-
-This allows testing the package easily:
-
-$ nix-build my-hello.nix
-$ ./result/bin/hello
-Hello, world!
-
-
-
-
-
-
-
-
-
-Ad hoc package management
-
-With the command nix-env, you can install and
-uninstall packages from the command line. For instance, to install
-Mozilla Thunderbird:
-
-
-$ nix-env -iA nixos.pkgs.thunderbird
-
-If you invoke this as root, the package is installed in the Nix
-profile /nix/var/nix/profiles/default and visible
-to all users of the system; otherwise, the package ends up in
-/nix/var/nix/profiles/per-user/username/profile
-and is not visible to other users. The flag
-specifies the package by its attribute name; without it, the package
-is installed by matching against its package name
-(e.g. thunderbird). The latter is slower because
-it requires matching against all available Nix packages, and is
-ambiguous if there are multiple matching packages.
-
-Packages come from the NixOS channel. You typically upgrade a
-package by updating to the latest version of the NixOS channel:
-
-$ nix-channel --update nixos
-
-and then running nix-env -i again. Other packages
-in the profile are not affected; this is the
-crucial difference with the declarative style of package management,
-where running nixos-rebuild switch causes all
-packages to be updated to their current versions in the NixOS channel.
-You can however upgrade all packages for which there is a newer
-version by doing:
-
-$ nix-env -u '*'
-
-
-
-A package can be uninstalled using the
-flag:
-
-$ nix-env -e thunderbird
-
-
-
-Finally, you can roll back an undesirable
-nix-env action:
-
-$ nix-env --rollback
-
-
-
-nix-env has many more flags. For details,
-see the
-nix-env1
-manpage or the Nix manual.
-
-
-
-
-
-
-
-
-
-User management
-
-NixOS supports both declarative and imperative styles of user
-management. In the declarative style, users are specified in
-configuration.nix. For instance, the following
-states that a user account named alice shall exist:
-
-
-users.extraUsers.alice =
- { createHome = true;
- home = "/home/alice";
- description = "Alice Foobar";
- extraGroups = [ "wheel" ];
- useDefaultShell = true;
- openssh.authorizedKeys.keys = [ "ssh-dss AAAAB3Nza... alice@foobar" ];
- };
-
-
-Note that alice is a member of the
-wheel group, which allows her to use
-sudo to execute commands as
-root. Also note the SSH public key that allows
-remote logins with the corresponding private key. Users created in
-this way do not have a password by default, so they cannot log in via
-mechanisms that require a password. However, you can use the
-passwd program to set a password, which is retained
-across invocations of nixos-rebuild.
-
-A user ID (uid) is assigned automatically. You can also specify
-a uid manually by adding
-
-
- uid = 1000;
-
-
-to the user specification.
-
-Groups can be specified similarly. The following states that a
-group named students shall exist:
-
-
-users.extraGroups.students.gid = 1000;
-
-
-As with users, the group ID (gid) is optional and will be assigned
-automatically if it’s missing.
-
-Currently declarative user management is not perfect:
-nixos-rebuild does not know how to realise certain
-configuration changes. This includes removing a user or group, and
-removing group membership from a user.
-
-In the imperative style, users and groups are managed by
-commands such as useradd,
-groupmod and so on. For instance, to create a user
-account named alice:
-
-
-$ useradd -m alice
-
-The flag causes the creation of a home directory
-for the new user, which is generally what you want. The user does not
-have an initial password and therefore cannot log in. A password can
-be set using the passwd utility:
-
-
-$ passwd alice
-Enter new UNIX password: ***
-Retype new UNIX password: ***
-
-
-A user can be deleted using userdel:
-
-
-$ userdel -r alice
-
-The flag deletes the user’s home directory.
-Accounts can be modified using usermod. Unix
-groups can be managed using groupadd,
-groupmod and groupdel.
-
-
-
-
-
-
-File systems
-
-You can define file systems using the
- configuration option. For instance, the
-following definition causes NixOS to mount the Ext4 file system on
-device /dev/disk/by-label/data onto the mount
-point /data:
-
-
-fileSystems."/data" =
- { device = "/dev/disk/by-label/data";
- fsType = "ext4";
- };
-
-
-Mount points are created automatically if they don’t already exist.
-For , it’s best to use the topology-independent
-device aliases in /dev/disk/by-label and
-/dev/disk/by-uuid, as these don’t change if the
-topology changes (e.g. if a disk is moved to another IDE
-controller).
-
-You can usually omit the file system type
-(), since mount can usually
-detect the type and load the necessary kernel module automatically.
-However, if the file system is needed at early boot (in the initial
-ramdisk) and is not ext2, ext3
-or ext4, then it’s best to specify
- to ensure that the kernel module is
-available.
-
-LUKS-encrypted file systems
-
-NixOS supports file systems that are encrypted using
-LUKS (Linux Unified Key Setup). For example,
-here is how you create an encrypted Ext4 file system on the device
-/dev/sda2:
-
-
-$ cryptsetup luksFormat /dev/sda2
-
-WARNING!
-========
-This will overwrite data on /dev/sda2 irrevocably.
-
-Are you sure? (Type uppercase yes): YES
-Enter LUKS passphrase: ***
-Verify passphrase: ***
-
-$ cryptsetup luksOpen /dev/sda2 crypted
-Enter passphrase for /dev/sda2: ***
-
-$ mkfs.ext4 /dev/mapper/crypted
-
-
-To ensure that this file system is automatically mounted at boot time
-as /, add the following to
-configuration.nix:
-
-
-boot.initrd.luks.devices = [ { device = "/dev/sda2"; name = "crypted"; } ];
-fileSystems."/".device = "/dev/mapper/crypted";
-
-
-
-
-
-
-
-
-
-
-
-X Window System
-
-The X Window System (X11) provides the basis of NixOS’ graphical
-user interface. It can be enabled as follows:
-
-services.xserver.enable = true;
-
-The X server will automatically detect and use the appropriate video
-driver from a set of X.org drivers (such as vesa
-and intel). You can also specify a driver
-manually, e.g.
-
-services.xserver.videoDrivers = [ "r128" ];
-
-to enable X.org’s xf86-video-r128 driver.
-
-You also need to enable at least one desktop or window manager.
-Otherwise, you can only log into a plain undecorated
-xterm window. Thus you should pick one or more of
-the following lines:
-
-services.xserver.desktopManager.kde4.enable = true;
-services.xserver.desktopManager.xfce.enable = true;
-services.xserver.windowManager.xmonad.enable = true;
-services.xserver.windowManager.twm.enable = true;
-services.xserver.windowManager.icewm.enable = true;
-
-
-
-NixOS’s default display manager (the
-program that provides a graphical login prompt and manages the X
-server) is SLiM. You can select KDE’s kdm instead:
-
-services.xserver.displayManager.kdm.enable = true;
-
-
-
-The X server is started automatically at boot time. If you
-don’t want this to happen, you can set:
-
-services.xserver.autorun = false;
-
-The X server can then be started manually:
-
-$ systemctl start display-manager.service
-
-
-
-
-NVIDIA graphics cards
-
-NVIDIA provides a proprietary driver for its graphics cards that
-has better 3D performance than the X.org drivers. It is not enabled
-by default because it’s not free software. You can enable it as follows:
-
-services.xserver.videoDrivers = [ "nvidia" ];
-
-You may need to reboot after enabling this driver to prevent a clash
-with other kernel modules.
-
-On 64-bit systems, if you want full acceleration for 32-bit
-programs such as Wine, you should also set the following:
-
-services.xserver.driSupport32Bit = true;
-
-
-
-
-
-
-Touchpads
-
-Support for Synaptics touchpads (found in many laptops such as
-the Dell Latitude series) can be enabled as follows:
-
-services.xserver.synaptics.enable = true;
-
-The driver has many options (see ). For
-instance, the following enables two-finger scrolling:
-
-services.xserver.synaptics.twoFingerScroll = true;
-
-
-
-
-
-
-
-
-
-
-
-Networking
-
-Secure shell access
-
-Secure shell (SSH) access to your machine can be enabled by
-setting:
-
-
-services.openssh.enable = true;
-
-
-By default, root logins using a password are disallowed. They can be
-disabled entirely by setting
-services.openssh.permitRootLogin to
-"no".
-
-You can declaratively specify authorised RSA/DSA public keys for
-a user as follows:
-
-
-
-users.extraUsers.alice.openssh.authorizedKeys.keys =
- [ "ssh-dss AAAAB3NzaC1kc3MAAACBAPIkGWVEt4..." ];
-
-
-
-
-
-
-
-IPv4 configuration
-
-By default, NixOS uses DHCP (specifically,
-dhcpcd) to automatically configure network
-interfaces. However, you can configure an interface manually as
-follows:
-
-
-networking.interfaces.eth0 = { ipAddress = "192.168.1.2"; prefixLength = 24; };
-
-
-(The network prefix can also be specified using the option
-subnetMask,
-e.g. "255.255.255.0", but this is deprecated.)
-Typically you’ll also want to set a default gateway and set of name
-servers:
-
-
-networking.defaultGateway = "192.168.1.1";
-networking.nameservers = [ "8.8.8.8" ];
-
-
-
-
-Statically configured interfaces are set up by the systemd
-service
-interface-name-cfg.service.
-The default gateway and name server configuration is performed by
-network-setup.service.
-
-The host name is set using :
-
-
-networking.hostName = "cartman";
-
-
-The default host name is nixos. Set it to the
-empty string ("") to allow the DHCP server to
-provide the host name.
-
-
-
-
-IPv6 configuration
-
-IPv6 is enabled by default. Stateless address autoconfiguration
-is used to automatically assign IPv6 addresses to all interfaces. You
-can disable IPv6 support globally by setting:
-
-
-networking.enableIPv6 = false;
-
-
-
-
-
-
-
-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 is enabled by default. It can be
-disabled as follows:
-
-
-networking.firewall.enable = false;
-
-
-If the firewall is enabled, you can open specific TCP ports to the
-outside world:
-
-
-networking.firewall.allowedTCPPorts = [ 80 443 ];
-
-
-Note that TCP port 22 (ssh) is opened automatically if the SSH daemon
-is enabled (). UDP
-ports can be opened through
-. Also of
-interest is
-
-
-networking.firewall.allowPing = true;
-
-
-to allow the machine to respond to ping requests. (ICMPv6 pings are
-always allowed.)
-
-
-
-
-Wireless networks
-
-
-NixOS will start wpa_supplicant for you if you enable this setting:
-
-
-networking.wireless.enable = true;
-
-
-NixOS currently does not generate wpa_supplicant's
-configuration file, /etc/wpa_supplicant.conf. You should edit this file
-yourself to define wireless networks, WPA keys and so on (see
-wpa_supplicant.conf(5)).
-
-
-
-If you are using WPA2 the wpa_passphrase tool might be useful
-to generate the wpa_supplicant.conf.
-
-
-$ wpa_passphrase ESSID PSK > /etc/wpa_supplicant.conf
-
-After you have edited the wpa_supplicant.conf,
-you need to restart the wpa_supplicant service.
-
-
-$ systemctl restart wpa_supplicant.service
-
-
-
-
-
-
-Ad-hoc configuration
-
-You can use to specify
-shell commands to be run at the end of
-network-setup.service. This is useful for doing
-network configuration not covered by the existing NixOS modules. For
-instance, to statically configure an IPv6 address:
-
-
-networking.localCommands =
- ''
- ip -6 addr add 2001:610:685:1::1/64 dev eth0
- '';
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Linux kernel
-
-You can override the Linux kernel and associated packages using
-the option . For instance, this
-selects the Linux 3.10 kernel:
-
-boot.kernelPackages = pkgs.linuxPackages_3_10;
-
-Note that this not only replaces the kernel, but also packages that
-are specific to the kernel version, such as the NVIDIA video drivers.
-This ensures that driver packages are consistent with the
-kernel.
-
-The default Linux kernel configuration should be fine for most
-users. You can see the configuration of your current kernel in
-/run/booted-system/kernel-modules/config. If you
-want to change the kernel configuration, you can use the
- feature (see ). For instance, to enable
-support for the kernel debugger KGDB:
-
-
-nixpkgs.config.packageOverrides = pkgs:
- { linux_3_4 = pkgs.linux_3_4.override {
- extraConfig =
- ''
- KGDB y
- '';
- };
- };
-
-
-extraConfig takes a list of Linux kernel
-configuration options, one per line. The name of the option should
-not include the prefix CONFIG_. The option value
-is typically y, n or
-m (to build something as a kernel module).
-
-Kernel modules for hardware devices are generally loaded
-automatically by udev. You can force a module to
-be loaded via , e.g.
-
-boot.kernelModules = [ "fuse" "kvm-intel" "coretemp" ];
-
-If the module is required early during the boot (e.g. to mount the
-root file system), you can use
-:
-
-boot.initrd.extraKernelModules = [ "cifs" ];
-
-This causes the specified modules and their dependencies to be added
-to the initial ramdark.
-
-Kernel runtime parameters can be set through
-, e.g.
-
-boot.kernel.sysctl."net.ipv4.tcp_keepalive_time" = 120;
-
-sets the kernel’s TCP keepalive time to 120 seconds. To see the
-available parameters, run sysctl -a.
-
-
-
-
-
-
-
-
diff --git a/nixos/doc/manual/configuration/abstractions.xml b/nixos/doc/manual/configuration/abstractions.xml
new file mode 100644
index 00000000000..cbd54bca62f
--- /dev/null
+++ b/nixos/doc/manual/configuration/abstractions.xml
@@ -0,0 +1,166 @@
+
+
+Abstractions
+
+If you find yourself repeating yourself over and over, it’s time
+to abstract. Take, for instance, this Apache HTTP Server configuration:
+
+
+{
+ services.httpd.virtualHosts =
+ [ { hostName = "example.org";
+ documentRoot = "/webroot";
+ adminAddr = "alice@example.org";
+ enableUserDir = true;
+ }
+ { hostName = "example.org";
+ documentRoot = "/webroot";
+ adminAddr = "alice@example.org";
+ enableUserDir = true;
+ enableSSL = true;
+ sslServerCert = "/root/ssl-example-org.crt";
+ sslServerKey = "/root/ssl-example-org.key";
+ }
+ ];
+}
+
+
+It defines two virtual hosts with nearly identical configuration; the
+only difference is that the second one has SSL enabled. To prevent
+this duplication, we can use a let:
+
+
+let
+ exampleOrgCommon =
+ { hostName = "example.org";
+ documentRoot = "/webroot";
+ adminAddr = "alice@example.org";
+ enableUserDir = true;
+ };
+in
+{
+ services.httpd.virtualHosts =
+ [ exampleOrgCommon
+ (exampleOrgCommon // {
+ enableSSL = true;
+ sslServerCert = "/root/ssl-example-org.crt";
+ sslServerKey = "/root/ssl-example-org.key";
+ })
+ ];
+}
+
+
+The let exampleOrgCommon =
+... defines a variable named
+exampleOrgCommon. The //
+operator merges two attribute sets, so the configuration of the second
+virtual host is the set exampleOrgCommon extended
+with the SSL options.
+
+You can write a let wherever an expression is
+allowed. Thus, you also could have written:
+
+
+{
+ services.httpd.virtualHosts =
+ let exampleOrgCommon = ...; in
+ [ exampleOrgCommon
+ (exampleOrgCommon // { ... })
+ ];
+}
+
+
+but not { let exampleOrgCommon =
+...; in ...;
+} since attributes (as opposed to attribute values) are not
+expressions.
+
+Functions provide another method of
+abstraction. For instance, suppose that we want to generate lots of
+different virtual hosts, all with identical configuration except for
+the host name. This can be done as follows:
+
+
+{
+ services.httpd.virtualHosts =
+ let
+ makeVirtualHost = name:
+ { hostName = name;
+ documentRoot = "/webroot";
+ adminAddr = "alice@example.org";
+ };
+ in
+ [ (makeVirtualHost "example.org")
+ (makeVirtualHost "example.com")
+ (makeVirtualHost "example.gov")
+ (makeVirtualHost "example.nl")
+ ];
+}
+
+
+Here, makeVirtualHost is a function that takes a
+single argument name and returns the configuration
+for a virtual host. That function is then called for several names to
+produce the list of virtual host configurations.
+
+We can further improve on this by using the function
+map, which applies another function to every
+element in a list:
+
+
+{
+ services.httpd.virtualHosts =
+ let
+ makeVirtualHost = ...;
+ in map makeVirtualHost
+ [ "example.org" "example.com" "example.gov" "example.nl" ];
+}
+
+
+(The function map is called a
+higher-order function because it takes another
+function as an argument.)
+
+What if you need more than one argument, for instance, if we
+want to use a different documentRoot for each
+virtual host? Then we can make makeVirtualHost a
+function that takes a set as its argument, like this:
+
+
+{
+ services.httpd.virtualHosts =
+ let
+ makeVirtualHost = { name, root }:
+ { hostName = name;
+ documentRoot = root;
+ adminAddr = "alice@example.org";
+ };
+ in map makeVirtualHost
+ [ { name = "example.org"; root = "/sites/example.org"; }
+ { name = "example.com"; root = "/sites/example.com"; }
+ { name = "example.gov"; root = "/sites/example.gov"; }
+ { name = "example.nl"; root = "/sites/example.nl"; }
+ ];
+}
+
+
+But in this case (where every root is a subdirectory of
+/sites named after the virtual host), it would
+have been shorter to define makeVirtualHost as
+
+makeVirtualHost = name:
+ { hostName = name;
+ documentRoot = "/sites/${name}";
+ adminAddr = "alice@example.org";
+ };
+
+
+Here, the construct
+${...} allows the result
+of an expression to be spliced into a string.
+
+
diff --git a/nixos/doc/manual/configuration/ad-hoc-network-config.xml b/nixos/doc/manual/configuration/ad-hoc-network-config.xml
new file mode 100644
index 00000000000..26a572ba1fb
--- /dev/null
+++ b/nixos/doc/manual/configuration/ad-hoc-network-config.xml
@@ -0,0 +1,24 @@
+
+
+Ad-Hoc Configuration
+
+You can use to specify
+shell commands to be run at the end of
+network-setup.service. This is useful for doing
+network configuration not covered by the existing NixOS modules. For
+instance, to statically configure an IPv6 address:
+
+
+networking.localCommands =
+ ''
+ ip -6 addr add 2001:610:685:1::1/64 dev eth0
+ '';
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/ad-hoc-packages.xml b/nixos/doc/manual/configuration/ad-hoc-packages.xml
new file mode 100644
index 00000000000..e237e20c4ff
--- /dev/null
+++ b/nixos/doc/manual/configuration/ad-hoc-packages.xml
@@ -0,0 +1,63 @@
+
+
+Ad-Hoc Package Management
+
+With the command nix-env, you can install and
+uninstall packages from the command line. For instance, to install
+Mozilla Thunderbird:
+
+
+$ nix-env -iA nixos.pkgs.thunderbird
+
+If you invoke this as root, the package is installed in the Nix
+profile /nix/var/nix/profiles/default and visible
+to all users of the system; otherwise, the package ends up in
+/nix/var/nix/profiles/per-user/username/profile
+and is not visible to other users. The flag
+specifies the package by its attribute name; without it, the package
+is installed by matching against its package name
+(e.g. thunderbird). The latter is slower because
+it requires matching against all available Nix packages, and is
+ambiguous if there are multiple matching packages.
+
+Packages come from the NixOS channel. You typically upgrade a
+package by updating to the latest version of the NixOS channel:
+
+$ nix-channel --update nixos
+
+and then running nix-env -i again. Other packages
+in the profile are not affected; this is the
+crucial difference with the declarative style of package management,
+where running nixos-rebuild switch causes all
+packages to be updated to their current versions in the NixOS channel.
+You can however upgrade all packages for which there is a newer
+version by doing:
+
+$ nix-env -u '*'
+
+
+
+A package can be uninstalled using the
+flag:
+
+$ nix-env -e thunderbird
+
+
+
+Finally, you can roll back an undesirable
+nix-env action:
+
+$ nix-env --rollback
+
+
+
+nix-env has many more flags. For details,
+see the
+nix-env1
+manpage or the Nix manual.
+
+
diff --git a/nixos/doc/manual/configuration/adding-custom-packages.xml b/nixos/doc/manual/configuration/adding-custom-packages.xml
new file mode 100644
index 00000000000..c1789fcbc04
--- /dev/null
+++ b/nixos/doc/manual/configuration/adding-custom-packages.xml
@@ -0,0 +1,84 @@
+
+
+Adding Custom Packages
+
+It’s possible that a package you need is not available in NixOS.
+In that case, you can do two things. First, you can clone the Nixpkgs
+repository, add the package to your clone, and (optionally) submit a
+patch or pull request to have it accepted into the main Nixpkgs
+repository. This is described in detail in the Nixpkgs manual.
+In short, you clone Nixpkgs:
+
+
+$ git clone git://github.com/NixOS/nixpkgs.git
+$ cd nixpkgs
+
+
+Then you write and test the package as described in the Nixpkgs
+manual. Finally, you add it to
+environment.systemPackages, e.g.
+
+
+environment.systemPackages = [ pkgs.my-package ];
+
+
+and you run nixos-rebuild, specifying your own
+Nixpkgs tree:
+
+
+$ nixos-rebuild switch -I nixpkgs=/path/to/my/nixpkgs
+
+
+
+The second possibility is to add the package outside of the
+Nixpkgs tree. For instance, here is how you specify a build of the
+GNU Hello
+package directly in configuration.nix:
+
+
+environment.systemPackages =
+ let
+ my-hello = with pkgs; stdenv.mkDerivation rec {
+ name = "hello-2.8";
+ src = fetchurl {
+ url = "mirror://gnu/hello/${name}.tar.gz";
+ sha256 = "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6";
+ };
+ };
+ in
+ [ my-hello ];
+
+
+Of course, you can also move the definition of
+my-hello into a separate Nix expression, e.g.
+
+environment.systemPackages = [ (import ./my-hello.nix) ];
+
+where my-hello.nix contains:
+
+with import <nixpkgs> {}; # bring all of Nixpkgs into scope
+
+stdenv.mkDerivation rec {
+ name = "hello-2.8";
+ src = fetchurl {
+ url = "mirror://gnu/hello/${name}.tar.gz";
+ sha256 = "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6";
+ };
+}
+
+
+This allows testing the package easily:
+
+$ nix-build my-hello.nix
+$ ./result/bin/hello
+Hello, world!
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/config-file.xml b/nixos/doc/manual/configuration/config-file.xml
new file mode 100644
index 00000000000..2a58ff25941
--- /dev/null
+++ b/nixos/doc/manual/configuration/config-file.xml
@@ -0,0 +1,213 @@
+
+
+NixOS Configuration File
+
+The NixOS configuration file generally looks like this:
+
+
+{ config, pkgs, ... }:
+
+{ option definitions
+}
+
+
+The first line ({ config, pkgs, ... }:) denotes
+that this is actually a function that takes at least the two arguments
+ config and pkgs. (These are
+explained later.) The function returns a set of
+option definitions ({ ... }). These definitions have the
+form name =
+value, where
+name is the name of an option and
+value is its value. For example,
+
+
+{ config, pkgs, ... }:
+
+{ services.httpd.enable = true;
+ services.httpd.adminAddr = "alice@example.org";
+ services.httpd.documentRoot = "/webroot";
+}
+
+
+defines a configuration with three option definitions that together
+enable the Apache HTTP Server with /webroot as
+the document root.
+
+Sets can be nested, and in fact dots in option names are
+shorthand for defining a set containing another set. For instance,
+ defines a set named
+services that contains a set named
+httpd, which in turn contains an option definition
+named enable with value true.
+This means that the example above can also be written as:
+
+
+{ config, pkgs, ... }:
+
+{ services = {
+ httpd = {
+ enable = true;
+ adminAddr = "alice@example.org";
+ documentRoot = "/webroot";
+ };
+ };
+}
+
+
+which may be more convenient if you have lots of option definitions
+that share the same prefix (such as
+services.httpd).
+
+NixOS checks your option definitions for correctness. For
+instance, if you try to define an option that doesn’t exist (that is,
+doesn’t have a corresponding option declaration),
+nixos-rebuild will give an error like:
+
+The option `services.httpd.enabl' defined in `/etc/nixos/configuration.nix' does not exist.
+
+Likewise, values in option definitions must have a correct type. For
+instance, must be a Boolean
+(true or false). Trying to give
+it a value of another type, such as a string, will cause an error:
+
+The option value `services.httpd.enable' in `/etc/nixos/configuration.nix' is not a boolean.
+
+
+
+
+Options have various types of values. The most important are:
+
+
+
+ Strings
+
+ Strings are enclosed in double quotes, e.g.
+
+
+networking.hostName = "dexter";
+
+
+ Special characters can be escaped by prefixing them with a
+ backslash (e.g. \").
+
+ Multi-line strings can be enclosed in double
+ single quotes, e.g.
+
+
+networking.extraHosts =
+ ''
+ 127.0.0.2 other-localhost
+ 10.0.0.1 server
+ '';
+
+
+ The main difference is that preceding whitespace is
+ automatically stripped from each line, and that characters like
+ " and \ are not special
+ (making it more convenient for including things like shell
+ code).
+
+
+
+
+ Booleans
+
+ These can be true or
+ false, e.g.
+
+
+networking.firewall.enable = true;
+networking.firewall.allowPing = false;
+
+
+
+
+
+
+ Integers
+
+ For example,
+
+
+boot.kernel.sysctl."net.ipv4.tcp_keepalive_time" = 60;
+
+
+ (Note that here the attribute name
+ net.ipv4.tcp_keepalive_time is enclosed in
+ quotes to prevent it from being interpreted as a set named
+ net containing a set named
+ ipv4, and so on. This is because it’s not a
+ NixOS option but the literal name of a Linux kernel
+ setting.)
+
+
+
+
+ Sets
+
+ Sets were introduced above. They are name/value pairs
+ enclosed in braces, as in the option definition
+
+
+fileSystems."/boot" =
+ { device = "/dev/sda1";
+ fsType = "ext4";
+ options = "rw,data=ordered,relatime";
+ };
+
+
+
+
+
+
+ Lists
+
+ The important thing to note about lists is that list
+ elements are separated by whitespace, like this:
+
+
+boot.kernelModules = [ "fuse" "kvm-intel" "coretemp" ];
+
+
+ List elements can be any other type, e.g. sets:
+
+
+swapDevices = [ { device = "/dev/disk/by-label/swap"; } ];
+
+
+
+
+
+
+ Packages
+
+ Usually, the packages you need are already part of the Nix
+ Packages collection, which is a set that can be accessed through
+ the function argument pkgs. Typical uses:
+
+
+environment.systemPackages =
+ [ pkgs.thunderbird
+ pkgs.emacs
+ ];
+
+postgresql.package = pkgs.postgresql90;
+
+
+ The latter option definition changes the default PostgreSQL
+ package used by NixOS’s PostgreSQL service to 9.0. For more
+ information on packages, including how to add new ones, see
+ .
+
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/config-syntax.xml b/nixos/doc/manual/configuration/config-syntax.xml
new file mode 100644
index 00000000000..87847f8451e
--- /dev/null
+++ b/nixos/doc/manual/configuration/config-syntax.xml
@@ -0,0 +1,27 @@
+
+
+Configuration Syntax
+
+The NixOS configuration file
+/etc/nixos/configuration.nix is actually a
+Nix expression, which is the Nix package
+manager’s purely functional language for describing how to build
+packages and configurations. This means you have all the expressive
+power of that language at your disposal, including the ability to
+abstract over common patterns, which is very useful when managing
+complex systems. The syntax and semantics of the Nix language are
+fully described in the Nix
+manual, but here we give a short overview of the most important
+constructs useful in NixOS configuration files.
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/configuration.xml b/nixos/doc/manual/configuration/configuration.xml
new file mode 100644
index 00000000000..8fde0dc7e61
--- /dev/null
+++ b/nixos/doc/manual/configuration/configuration.xml
@@ -0,0 +1,32 @@
+
+
+Configuration
+
+
+
+This chapter describes how to configure various aspects of a
+NixOS machine through the configuration file
+/etc/nixos/configuration.nix. As described in
+, changes to this file only take
+effect after you run nixos-rebuild.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/customizing-packages.xml b/nixos/doc/manual/configuration/customizing-packages.xml
new file mode 100644
index 00000000000..6ee7a95dc6f
--- /dev/null
+++ b/nixos/doc/manual/configuration/customizing-packages.xml
@@ -0,0 +1,92 @@
+
+
+Customising Packages
+
+Some packages in Nixpkgs have options to enable or disable
+optional functionality or change other aspects of the package. For
+instance, the Firefox wrapper package (which provides Firefox with a
+set of plugins such as the Adobe Flash player) has an option to enable
+the Google Talk plugin. It can be set in
+configuration.nix as follows:
+
+
+nixpkgs.config.firefox.enableGoogleTalkPlugin = true;
+
+
+
+Unfortunately, Nixpkgs currently lacks a way to query
+available configuration options.
+
+Apart from high-level options, it’s possible to tweak a package
+in almost arbitrary ways, such as changing or disabling dependencies
+of a package. For instance, the Emacs package in Nixpkgs by default
+has a dependency on GTK+ 2. If you want to build it against GTK+ 3,
+you can specify that as follows:
+
+
+environment.systemPackages = [ (pkgs.emacs.override { gtk = pkgs.gtk3; }) ];
+
+
+The function override performs the call to the Nix
+function that produces Emacs, with the original arguments amended by
+the set of arguments specified by you. So here the function argument
+gtk gets the value pkgs.gtk3,
+causing Emacs to depend on GTK+ 3. (The parentheses are necessary
+because in Nix, function application binds more weakly than list
+construction, so without them,
+environment.systemPackages would be a list with two
+elements.)
+
+Even greater customisation is possible using the function
+overrideDerivation. While the
+override mechanism above overrides the arguments of
+a package function, overrideDerivation allows
+changing the result of the function. This
+permits changing any aspect of the package, such as the source code.
+For instance, if you want to override the source code of Emacs, you
+can say:
+
+
+environment.systemPackages =
+ [ (pkgs.lib.overrideDerivation pkgs.emacs (attrs: {
+ name = "emacs-25.0-pre";
+ src = /path/to/my/emacs/tree;
+ }))
+ ];
+
+
+Here, overrideDerivation takes the Nix derivation
+specified by pkgs.emacs and produces a new
+derivation in which the original’s name and
+src attribute have been replaced by the given
+values. The original attributes are accessible via
+attrs.
+
+The overrides shown above are not global. They do not affect
+the original package; other packages in Nixpkgs continue to depend on
+the original rather than the customised package. This means that if
+another package in your system depends on the original package, you
+end up with two instances of the package. If you want to have
+everything depend on your customised instance, you can apply a
+global override as follows:
+
+
+nixpkgs.config.packageOverrides = pkgs:
+ { emacs = pkgs.emacs.override { gtk = pkgs.gtk3; };
+ };
+
+
+The effect of this definition is essentially equivalent to modifying
+the emacs attribute in the Nixpkgs source tree.
+Any package in Nixpkgs that depends on emacs will
+be passed your customised instance. (However, the value
+pkgs.emacs in
+nixpkgs.config.packageOverrides refers to the
+original rather than overridden instance, to prevent an infinite
+recursion.)
+
+
diff --git a/nixos/doc/manual/configuration/declarative-packages.xml b/nixos/doc/manual/configuration/declarative-packages.xml
new file mode 100644
index 00000000000..6de38b452e2
--- /dev/null
+++ b/nixos/doc/manual/configuration/declarative-packages.xml
@@ -0,0 +1,43 @@
+
+
+Declarative Package Management
+
+With declarative package management, you specify which packages
+you want on your system by setting the option
+. For instance, adding the
+following line to configuration.nix enables the
+Mozilla Thunderbird email application:
+
+
+environment.systemPackages = [ pkgs.thunderbird ];
+
+
+The effect of this specification is that the Thunderbird package from
+Nixpkgs will be built or downloaded as part of the system when you run
+nixos-rebuild switch.
+
+You can get a list of the available packages as follows:
+
+$ nix-env -qaP '*' --description
+nixos.pkgs.firefox firefox-23.0 Mozilla Firefox - the browser, reloaded
+...
+
+
+The first column in the output is the attribute
+name, such as
+nixos.pkgs.thunderbird. (The
+nixos prefix allows distinguishing between
+different channels that you might have.)
+
+To “uninstall” a package, simply remove it from
+ and run
+nixos-rebuild switch.
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/file-systems.xml b/nixos/doc/manual/configuration/file-systems.xml
new file mode 100644
index 00000000000..d1b324af3f1
--- /dev/null
+++ b/nixos/doc/manual/configuration/file-systems.xml
@@ -0,0 +1,40 @@
+
+
+File Systems
+
+You can define file systems using the
+ configuration option. For instance, the
+following definition causes NixOS to mount the Ext4 file system on
+device /dev/disk/by-label/data onto the mount
+point /data:
+
+
+fileSystems."/data" =
+ { device = "/dev/disk/by-label/data";
+ fsType = "ext4";
+ };
+
+
+Mount points are created automatically if they don’t already exist.
+For , it’s best to use the topology-independent
+device aliases in /dev/disk/by-label and
+/dev/disk/by-uuid, as these don’t change if the
+topology changes (e.g. if a disk is moved to another IDE
+controller).
+
+You can usually omit the file system type
+(), since mount can usually
+detect the type and load the necessary kernel module automatically.
+However, if the file system is needed at early boot (in the initial
+ramdisk) and is not ext2, ext3
+or ext4, then it’s best to specify
+ to ensure that the kernel module is
+available.
+
+
+
+
diff --git a/nixos/doc/manual/configuration/firewall.xml b/nixos/doc/manual/configuration/firewall.xml
new file mode 100644
index 00000000000..87406c28c2f
--- /dev/null
+++ b/nixos/doc/manual/configuration/firewall.xml
@@ -0,0 +1,38 @@
+
+
+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 is enabled by default. It can be
+disabled as follows:
+
+
+networking.firewall.enable = false;
+
+
+If the firewall is enabled, you can open specific TCP ports to the
+outside world:
+
+
+networking.firewall.allowedTCPPorts = [ 80 443 ];
+
+
+Note that TCP port 22 (ssh) is opened automatically if the SSH daemon
+is enabled (). UDP
+ports can be opened through
+. Also of
+interest is
+
+
+networking.firewall.allowPing = true;
+
+
+to allow the machine to respond to ping requests. (ICMPv6 pings are
+always allowed.)
+
+
diff --git a/nixos/doc/manual/configuration/ipv4-config.xml b/nixos/doc/manual/configuration/ipv4-config.xml
new file mode 100644
index 00000000000..053501b1736
--- /dev/null
+++ b/nixos/doc/manual/configuration/ipv4-config.xml
@@ -0,0 +1,44 @@
+
+
+IPv4 Configuration
+
+By default, NixOS uses DHCP (specifically,
+dhcpcd) to automatically configure network
+interfaces. However, you can configure an interface manually as
+follows:
+
+
+networking.interfaces.eth0.ip4 = [ { address = "192.168.1.2"; prefixLength = 24; } ];
+
+
+Typically you’ll also want to set a default gateway and set of name
+servers:
+
+
+networking.defaultGateway = "192.168.1.1";
+networking.nameservers = [ "8.8.8.8" ];
+
+
+
+
+Statically configured interfaces are set up by the systemd
+service
+interface-name-cfg.service.
+The default gateway and name server configuration is performed by
+network-setup.service.
+
+The host name is set using :
+
+
+networking.hostName = "cartman";
+
+
+The default host name is nixos. Set it to the
+empty string ("") to allow the DHCP server to
+provide the host name.
+
+
diff --git a/nixos/doc/manual/configuration/ipv6-config.xml b/nixos/doc/manual/configuration/ipv6-config.xml
new file mode 100644
index 00000000000..592bf20e545
--- /dev/null
+++ b/nixos/doc/manual/configuration/ipv6-config.xml
@@ -0,0 +1,19 @@
+
+
+IPv6 Configuration
+
+IPv6 is enabled by default. Stateless address autoconfiguration
+is used to automatically assign IPv6 addresses to all interfaces. You
+can disable IPv6 support globally by setting:
+
+
+networking.enableIPv6 = false;
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/linux-kernel.xml b/nixos/doc/manual/configuration/linux-kernel.xml
new file mode 100644
index 00000000000..8fe2f5255df
--- /dev/null
+++ b/nixos/doc/manual/configuration/linux-kernel.xml
@@ -0,0 +1,69 @@
+
+
+Linux Kernel
+
+You can override the Linux kernel and associated packages using
+the option . For instance, this
+selects the Linux 3.10 kernel:
+
+boot.kernelPackages = pkgs.linuxPackages_3_10;
+
+Note that this not only replaces the kernel, but also packages that
+are specific to the kernel version, such as the NVIDIA video drivers.
+This ensures that driver packages are consistent with the
+kernel.
+
+The default Linux kernel configuration should be fine for most users. You can see the configuration of your current kernel with the following command:
+
+cat /proc/config.gz | gunzip
+
+If you want to change the kernel configuration, you can use the
+ feature (see ). For instance, to enable
+support for the kernel debugger KGDB:
+
+
+nixpkgs.config.packageOverrides = pkgs:
+ { linux_3_4 = pkgs.linux_3_4.override {
+ extraConfig =
+ ''
+ KGDB y
+ '';
+ };
+ };
+
+
+extraConfig takes a list of Linux kernel
+configuration options, one per line. The name of the option should
+not include the prefix CONFIG_. The option value
+is typically y, n or
+m (to build something as a kernel module).
+
+Kernel modules for hardware devices are generally loaded
+automatically by udev. You can force a module to
+be loaded via , e.g.
+
+boot.kernelModules = [ "fuse" "kvm-intel" "coretemp" ];
+
+If the module is required early during the boot (e.g. to mount the
+root file system), you can use
+:
+
+boot.initrd.extraKernelModules = [ "cifs" ];
+
+This causes the specified modules and their dependencies to be added
+to the initial ramdark.
+
+Kernel runtime parameters can be set through
+, e.g.
+
+boot.kernel.sysctl."net.ipv4.tcp_keepalive_time" = 120;
+
+sets the kernel’s TCP keepalive time to 120 seconds. To see the
+available parameters, run sysctl -a.
+
+
diff --git a/nixos/doc/manual/configuration/luks-file-systems.xml b/nixos/doc/manual/configuration/luks-file-systems.xml
new file mode 100644
index 00000000000..45475dbcd44
--- /dev/null
+++ b/nixos/doc/manual/configuration/luks-file-systems.xml
@@ -0,0 +1,42 @@
+
+
+LUKS-Encrypted File Systems
+
+NixOS supports file systems that are encrypted using
+LUKS (Linux Unified Key Setup). For example,
+here is how you create an encrypted Ext4 file system on the device
+/dev/sda2:
+
+
+$ cryptsetup luksFormat /dev/sda2
+
+WARNING!
+========
+This will overwrite data on /dev/sda2 irrevocably.
+
+Are you sure? (Type uppercase yes): YES
+Enter LUKS passphrase: ***
+Verify passphrase: ***
+
+$ cryptsetup luksOpen /dev/sda2 crypted
+Enter passphrase for /dev/sda2: ***
+
+$ mkfs.ext4 /dev/mapper/crypted
+
+
+To ensure that this file system is automatically mounted at boot time
+as /, add the following to
+configuration.nix:
+
+
+boot.initrd.luks.devices = [ { device = "/dev/sda2"; name = "crypted"; } ];
+fileSystems."/".device = "/dev/mapper/crypted";
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/modularity.xml b/nixos/doc/manual/configuration/modularity.xml
new file mode 100644
index 00000000000..d95091bd162
--- /dev/null
+++ b/nixos/doc/manual/configuration/modularity.xml
@@ -0,0 +1,143 @@
+
+
+Modularity
+
+The NixOS configuration mechanism is modular. If your
+configuration.nix becomes too big, you can split
+it into multiple files. Likewise, if you have multiple NixOS
+configurations (e.g. for different computers) with some commonality,
+you can move the common configuration into a shared file.
+
+Modules have exactly the same syntax as
+configuration.nix. In fact,
+configuration.nix is itself a module. You can
+use other modules by including them from
+configuration.nix, e.g.:
+
+
+{ config, pkgs, ... }:
+
+{ imports = [ ./vpn.nix ./kde.nix ];
+ services.httpd.enable = true;
+ environment.systemPackages = [ pkgs.emacs ];
+ ...
+}
+
+
+Here, we include two modules from the same directory,
+vpn.nix and kde.nix. The
+latter might look like this:
+
+
+{ config, pkgs, ... }:
+
+{ services.xserver.enable = true;
+ services.xserver.displayManager.kdm.enable = true;
+ services.xserver.desktopManager.kde4.enable = true;
+ environment.systemPackages = [ pkgs.kde4.kscreensaver ];
+}
+
+
+Note that both configuration.nix and
+kde.nix define the option
+. When multiple modules
+define an option, NixOS will try to merge the
+definitions. In the case of
+, that’s easy: the lists of
+packages can simply be concatenated. The value in
+configuration.nix is merged last, so for
+list-type options, it will appear at the end of the merged list. If
+you want it to appear first, you can use mkBefore:
+
+
+boot.kernelModules = mkBefore [ "kvm-intel" ];
+
+
+This causes the kvm-intel kernel module to be
+loaded before any other kernel modules.
+
+For other types of options, a merge may not be possible. For
+instance, if two modules define
+,
+nixos-rebuild will give an error:
+
+
+The unique option `services.httpd.adminAddr' is defined multiple times, in `/etc/nixos/httpd.nix' and `/etc/nixos/configuration.nix'.
+
+
+When that happens, it’s possible to force one definition take
+precedence over the others:
+
+
+services.httpd.adminAddr = pkgs.lib.mkForce "bob@example.org";
+
+
+
+
+When using multiple modules, you may need to access
+configuration values defined in other modules. This is what the
+config function argument is for: it contains the
+complete, merged system configuration. That is,
+config is the result of combining the
+configurations returned by every moduleIf you’re
+wondering how it’s possible that the (indirect)
+result of a function is passed as an
+input to that same function: that’s because Nix
+is a “lazy” language — it only computes values when they are needed.
+This works as long as no individual configuration value depends on
+itself.. For example, here is a module that adds
+some packages to only if
+ is set to
+true somewhere else:
+
+
+{ config, pkgs, ... }:
+
+{ environment.systemPackages =
+ if config.services.xserver.enable then
+ [ pkgs.firefox
+ pkgs.thunderbird
+ ]
+ else
+ [ ];
+}
+
+
+
+
+With multiple modules, it may not be obvious what the final
+value of a configuration option is. The command
+ allows you to find out:
+
+
+$ nixos-option services.xserver.enable
+true
+
+$ nixos-option boot.kernelModules
+[ "tun" "ipv6" "loop" ... ]
+
+
+Interactive exploration of the configuration is possible using
+nix-repl,
+a read-eval-print loop for Nix expressions. It’s not installed by
+default; run nix-env -i nix-repl to get it. A
+typical use:
+
+
+$ nix-repl '<nixos>'
+
+nix-repl> config.networking.hostName
+"mandark"
+
+nix-repl> map (x: x.hostName) config.services.httpd.virtualHosts
+[ "example.org" "example.gov" ]
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/network-manager.xml b/nixos/doc/manual/configuration/network-manager.xml
new file mode 100644
index 00000000000..e65060021b4
--- /dev/null
+++ b/nixos/doc/manual/configuration/network-manager.xml
@@ -0,0 +1,27 @@
+
+
+NetworkManager
+
+To facilitate network configuration, some desktop environments
+use NetworkManager. You can enable NetworkManager by setting:
+
+
+services.networkmanager.enable = true;
+
+
+Some desktop managers (e.g., GNOME) enable NetworkManager
+automatically for you.
+
+All users that should have permission to change network settings
+must belong to the networkmanager group.
+
+services.networkmanager and
+services.wireless can not be enabled at the same time:
+you can still connect to the wireless networks using
+NetworkManager.
+
+
diff --git a/nixos/doc/manual/configuration/networking.xml b/nixos/doc/manual/configuration/networking.xml
new file mode 100644
index 00000000000..5f08bc1f127
--- /dev/null
+++ b/nixos/doc/manual/configuration/networking.xml
@@ -0,0 +1,22 @@
+
+
+Networking
+
+This section describes how to configure networking components on
+your NixOS machine.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/package-mgmt.xml b/nixos/doc/manual/configuration/package-mgmt.xml
new file mode 100644
index 00000000000..73c1722da02
--- /dev/null
+++ b/nixos/doc/manual/configuration/package-mgmt.xml
@@ -0,0 +1,34 @@
+
+
+Package Management
+
+This section describes how to add additional packages to your
+system. NixOS has two distinct styles of package management:
+
+
+
+ Declarative, where you declare
+ what packages you want in your
+ configuration.nix. Every time you run
+ nixos-rebuild, NixOS will ensure that you get a
+ consistent set of binaries corresponding to your
+ specification.
+
+ Ad hoc, where you install,
+ upgrade and uninstall packages via the nix-env
+ command. This style allows mixing packages from different Nixpkgs
+ versions. It’s the only choice for non-root
+ users.
+
+
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/ssh.xml b/nixos/doc/manual/configuration/ssh.xml
new file mode 100644
index 00000000000..7c928baaf89
--- /dev/null
+++ b/nixos/doc/manual/configuration/ssh.xml
@@ -0,0 +1,32 @@
+
+
+Secure Shell Access
+
+Secure shell (SSH) access to your machine can be enabled by
+setting:
+
+
+services.openssh.enable = true;
+
+
+By default, root logins using a password are disallowed. They can be
+disabled entirely by setting
+services.openssh.permitRootLogin to
+"no".
+
+You can declaratively specify authorised RSA/DSA public keys for
+a user as follows:
+
+
+
+users.extraUsers.alice.openssh.authorizedKeys.keys =
+ [ "ssh-dss AAAAB3NzaC1kc3MAAACBAPIkGWVEt4..." ];
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/summary.xml b/nixos/doc/manual/configuration/summary.xml
new file mode 100644
index 00000000000..9bb5e35e16b
--- /dev/null
+++ b/nixos/doc/manual/configuration/summary.xml
@@ -0,0 +1,191 @@
+
+
+Syntax Summary
+
+Below is a summary of the most important syntactic constructs in
+the Nix expression language. It’s not complete. In particular, there
+are many other built-in functions. See the Nix
+manual for the rest.
+
+
+
+
+
+
+
+ Example
+ Description
+
+
+
+
+
+ Basic values
+
+
+ "Hello world"
+ A string
+
+
+ "${pkgs.bash}/bin/sh"
+ A string containing an expression (expands to "/nix/store/hash-bash-version/bin/sh")
+
+
+ true, false
+ Booleans
+
+
+ 123
+ An integer
+
+
+ ./foo.png
+ A path (relative to the containing Nix expression)
+
+
+
+ Compound values
+
+
+ { x = 1; y = 2; }
+ An set with attributes names x and y
+
+
+ { foo.bar = 1; }
+ A nested set, equivalent to { foo = { bar = 1; }; }
+
+
+ rec { x = "bla"; y = x + "bar"; }
+ A recursive set, equivalent to { x = "foo"; y = "foobar"; }
+
+
+ [ "foo" "bar" ]
+ A list with two elements
+
+
+
+ Operators
+
+
+ "foo" + "bar"
+ String concatenation
+
+
+ 1 + 2
+ Integer addition
+
+
+ "foo" == "f" + "oo"
+ Equality test (evaluates to true)
+
+
+ "foo" != "bar"
+ Inequality test (evaluates to true)
+
+
+ !true
+ Boolean negation
+
+
+ { x = 1; y = 2; }.x
+ Attribute selection (evaluates to 1)
+
+
+ { x = 1; y = 2; }.z or 3
+ Attribute selection with default (evaluates to 3)
+
+
+ { x = 1; y = 2; } // { z = 3; }
+ Merge two sets (attributes in the right-hand set taking precedence)
+
+
+
+ Control structures
+
+
+ if 1 + 1 == 2 then "yes!" else "no!"
+ Conditional expression
+
+
+ assert 1 + 1 == 2; "yes!"
+ Assertion check (evaluates to "yes!")
+
+
+ let x = "foo"; y = "bar"; in x + y
+ Variable definition
+
+
+ with pkgs.lib; head [ 1 2 3 ]
+ Add all attributes from the given set to the scope
+ (evaluates to 1)
+
+
+
+ Functions (lambdas)
+
+
+ x: x + 1
+ A function that expects an integer and returns it increased by 1
+
+
+ (x: x + 1) 100
+ A function call (evaluates to 101)
+
+
+ let inc = x: x + 1; in inc (inc (inc 100))
+ A function bound to a variable and subsequently called by name (evaluates to 103)
+
+
+ { x, y }: x + y
+ A function that expects a set with required attributes
+ x and y and concatenates
+ them
+
+
+ { x, y ? "bar" }: x + y
+ A function that expects a set with required attribute
+ x and optional y, using
+ "bar" as default value for
+ y
+
+
+ { x, y, ... }: x + y
+ A function that expects a set with required attributes
+ x and y and ignores any
+ other attributes
+
+
+ { x, y } @ args: x + y
+ A function that expects a set with required attributes
+ x and y, and binds the
+ whole set to args
+
+
+
+ Built-in functions
+
+
+ import ./foo.nix
+ Load and return Nix expression in given file
+
+
+ map (x: x + x) [ 1 2 3 ]
+ Apply a function to every element of a list (evaluates to [ 2 4 6 ])
+
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/configuration/user-mgmt.xml b/nixos/doc/manual/configuration/user-mgmt.xml
new file mode 100644
index 00000000000..40362fbbb23
--- /dev/null
+++ b/nixos/doc/manual/configuration/user-mgmt.xml
@@ -0,0 +1,89 @@
+
+
+User Management
+
+NixOS supports both declarative and imperative styles of user
+management. In the declarative style, users are specified in
+configuration.nix. For instance, the following
+states that a user account named alice shall exist:
+
+
+users.extraUsers.alice =
+ { isNormalUser = true;
+ home = "/home/alice";
+ description = "Alice Foobar";
+ extraGroups = [ "wheel" "networkmanager" ];
+ openssh.authorizedKeys.keys = [ "ssh-dss AAAAB3Nza... alice@foobar" ];
+ };
+
+
+Note that alice is a member of the
+wheel and networkmanager groups,
+which allows her to use sudo to execute commands as
+root and to configure the network, respectively.
+Also note the SSH public key that allows remote logins with the
+corresponding private key. Users created in this way do not have a
+password by default, so they cannot log in via mechanisms that require
+a password. However, you can use the passwd program
+to set a password, which is retained across invocations of
+nixos-rebuild.
+
+If you set users.mutableUsers 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 users.extraUsers 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.
+
+A user ID (uid) is assigned automatically. You can also specify
+a uid manually by adding
+
+
+ uid = 1000;
+
+
+to the user specification.
+
+Groups can be specified similarly. The following states that a
+group named students shall exist:
+
+
+users.extraGroups.students.gid = 1000;
+
+
+As with users, the group ID (gid) is optional and will be assigned
+automatically if it’s missing.
+
+In the imperative style, users and groups are managed by
+commands such as useradd,
+groupmod and so on. For instance, to create a user
+account named alice:
+
+
+$ useradd -m alice
+
+The flag causes the creation of a home directory
+for the new user, which is generally what you want. The user does not
+have an initial password and therefore cannot log in. A password can
+be set using the passwd utility:
+
+
+$ passwd alice
+Enter new UNIX password: ***
+Retype new UNIX password: ***
+
+
+A user can be deleted using userdel:
+
+
+$ userdel -r alice
+
+The flag deletes the user’s home directory.
+Accounts can be modified using usermod. Unix
+groups can be managed using groupadd,
+groupmod and groupdel.
+
+
diff --git a/nixos/doc/manual/configuration/wireless.xml b/nixos/doc/manual/configuration/wireless.xml
new file mode 100644
index 00000000000..373a9168cc8
--- /dev/null
+++ b/nixos/doc/manual/configuration/wireless.xml
@@ -0,0 +1,41 @@
+
+
+Wireless Networks
+
+For a desktop installation using NetworkManager (e.g., GNOME),
+you just have to make sure the user is in the
+networkmanager group and you can skip the rest of this
+section on wireless networks.
+
+
+NixOS will start wpa_supplicant for you if you enable this setting:
+
+
+networking.wireless.enable = true;
+
+
+NixOS currently does not generate wpa_supplicant's
+configuration file, /etc/wpa_supplicant.conf. You should edit this file
+yourself to define wireless networks, WPA keys and so on (see
+wpa_supplicant.conf(5)).
+
+
+
+If you are using WPA2 the wpa_passphrase tool might be useful
+to generate the wpa_supplicant.conf.
+
+
+$ wpa_passphrase ESSID PSK > /etc/wpa_supplicant.conf
+
+After you have edited the wpa_supplicant.conf,
+you need to restart the wpa_supplicant service.
+
+
+$ systemctl restart wpa_supplicant.service
+
+
+
diff --git a/nixos/doc/manual/configuration/x-windows.xml b/nixos/doc/manual/configuration/x-windows.xml
new file mode 100644
index 00000000000..95e66f0c70c
--- /dev/null
+++ b/nixos/doc/manual/configuration/x-windows.xml
@@ -0,0 +1,113 @@
+
+
+X Window System
+
+The X Window System (X11) provides the basis of NixOS’ graphical
+user interface. It can be enabled as follows:
+
+services.xserver.enable = true;
+
+The X server will automatically detect and use the appropriate video
+driver from a set of X.org drivers (such as vesa
+and intel). You can also specify a driver
+manually, e.g.
+
+services.xserver.videoDrivers = [ "r128" ];
+
+to enable X.org’s xf86-video-r128 driver.
+
+You also need to enable at least one desktop or window manager.
+Otherwise, you can only log into a plain undecorated
+xterm window. Thus you should pick one or more of
+the following lines:
+
+services.xserver.desktopManager.kde4.enable = true;
+services.xserver.desktopManager.xfce.enable = true;
+services.xserver.windowManager.xmonad.enable = true;
+services.xserver.windowManager.twm.enable = true;
+services.xserver.windowManager.icewm.enable = true;
+
+
+
+NixOS’s default display manager (the
+program that provides a graphical login prompt and manages the X
+server) is SLiM. You can select KDE’s kdm instead:
+
+services.xserver.displayManager.kdm.enable = true;
+
+
+
+The X server is started automatically at boot time. If you
+don’t want this to happen, you can set:
+
+services.xserver.autorun = false;
+
+The X server can then be started manually:
+
+$ systemctl start display-manager.service
+
+
+
+
+NVIDIA Graphics Cards
+
+NVIDIA provides a proprietary driver for its graphics cards that
+has better 3D performance than the X.org drivers. It is not enabled
+by default because it’s not free software. You can enable it as follows:
+
+services.xserver.videoDrivers = [ "nvidia" ];
+
+You may need to reboot after enabling this driver to prevent a clash
+with other kernel modules.
+
+On 64-bit systems, if you want full acceleration for 32-bit
+programs such as Wine, you should also set the following:
+
+hardware.opengl.driSupport32Bit = true;
+
+
+
+
+
+AMD Graphics Cards
+
+AMD provides a proprietary driver for its graphics cards that
+has better 3D performance than the X.org drivers. It is not enabled
+by default because it’s not free software. You can enable it as follows:
+
+services.xserver.videoDrivers = [ "ati_unfree" ];
+
+You will need to reboot after enabling this driver to prevent a clash
+with other kernel modules.
+
+On 64-bit systems, if you want full acceleration for 32-bit
+programs such as Wine, you should also set the following:
+
+hardware.opengl.driSupport32Bit = true;
+
+
+
+
+
+Touchpads
+
+Support for Synaptics touchpads (found in many laptops such as
+the Dell Latitude series) can be enabled as follows:
+
+services.xserver.synaptics.enable = true;
+
+The driver has many options (see ). For
+instance, the following enables two-finger scrolling:
+
+services.xserver.synaptics.twoFingerScroll = true;
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/containers.xml b/nixos/doc/manual/containers.xml
deleted file mode 100644
index 2530d519521..00000000000
--- a/nixos/doc/manual/containers.xml
+++ /dev/null
@@ -1,242 +0,0 @@
-
-
-Containers
-
-NixOS allows you to easily run other NixOS instances as
-containers. Containers are a light-weight
-approach to virtualisation that runs software in the container at the
-same speed as in the host system. NixOS containers share the Nix store
-of the host, making container creation very efficient.
-
-Currently, NixOS containers are not perfectly isolated
-from the host system. This means that a user with root access to the
-container can do things that affect the host. So you should not give
-container root access to untrusted users.
-
-NixOS containers can be created in two ways: imperatively, using
-the command nixos-container, and declaratively, by
-specifying them in your configuration.nix. The
-declarative approach implies that containers get upgraded along with
-your host system when you run nixos-rebuild, which
-is often not what you want. By contrast, in the imperative approach,
-containers are configured and updated independently from the host
-system.
-
-
-Imperative container management
-
-We’ll cover imperative container management using
-nixos-container first. You create a container with
-identifier foo as follows:
-
-
-$ nixos-container create foo
-
-
-This creates the container’s root directory in
-/var/lib/containers/foo and a small configuration
-file in /etc/containers/foo.conf. It also builds
-the container’s initial system configuration and stores it in
-/nix/var/nix/profiles/per-container/foo/system. You
-can modify the initial configuration of the container on the command
-line. For instance, to create a container that has
-sshd running, with the given public key for
-root:
-
-
-$ nixos-container create foo --config 'services.openssh.enable = true; \
- users.extraUsers.root.openssh.authorizedKeys.keys = ["ssh-dss AAAAB3N…"];'
-
-
-
-
-Creating a container does not start it. To start the container,
-run:
-
-
-$ nixos-container start foo
-
-
-This command will return as soon as the container has booted and has
-reached multi-user.target. On the host, the
-container runs within a systemd unit called
-container@container-name.service.
-Thus, if something went wrong, you can get status info using
-systemctl:
-
-
-$ systemctl status container@foo
-
-
-
-
-If the container has started succesfully, you can log in as
-root using the root-login operation:
-
-
-$ nixos-container root-login foo
-[root@foo:~]#
-
-
-Note that only root on the host can do this (since there is no
-authentication). You can also get a regular login prompt using the
-login operation, which is available to all users on
-the host:
-
-
-$ nixos-container login foo
-foo login: alice
-Password: ***
-
-
-With nixos-container run, you can execute arbitrary
-commands in the container:
-
-
-$ nixos-container run foo -- uname -a
-Linux foo 3.4.82 #1-NixOS SMP Thu Mar 20 14:44:05 UTC 2014 x86_64 GNU/Linux
-
-
-
-
-There are several ways to change the configuration of the
-container. First, on the host, you can edit
-/var/lib/container/name/etc/nixos/configuration.nix,
-and run
-
-
-$ nixos-container update foo
-
-
-This will build and activate the new configuration. You can also
-specify a new configuration on the command line:
-
-
-$ nixos-container update foo --config 'services.httpd.enable = true; \
- services.httpd.adminAddr = "foo@example.org";'
-
-$ curl http://$(nixos-container show-ip foo)/
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">…
-
-
-However, note that this will overwrite the container’s
-/etc/nixos/configuration.nix.
-
-Alternatively, you can change the configuration from within the
-container itself by running nixos-rebuild switch
-inside the container. Note that the container by default does not have
-a copy of the NixOS channel, so you should run nix-channel
---update first.
-
-Containers can be stopped and started using
-nixos-container stop and nixos-container
-start, respectively, or by using
-systemctl on the container’s service unit. To
-destroy a container, including its file system, do
-
-
-$ nixos-container destroy foo
-
-
-
-
-
-
-
-Declarative container specification
-
-You can also specify containers and their configuration in the
-host’s configuration.nix. For example, the
-following specifies that there shall be a container named
-database running PostgreSQL:
-
-
-containers.database =
- { config =
- { config, pkgs, ... }:
- { services.postgresql.enable = true;
- services.postgresql.package = pkgs.postgresql92;
- };
- };
-
-
-If you run nixos-rebuild switch, the container will
-be built and started. If the container was already running, it will be
-updated in place, without rebooting.
-
-By default, declarative containers share the network namespace
-of the host, meaning that they can listen on (privileged)
-ports. However, they cannot change the network configuration. You can
-give a container its own network as follows:
-
-
-containers.database =
- { privateNetwork = true;
- hostAddress = "192.168.100.10";
- localAddress = "192.168.100.11";
- };
-
-
-This gives the container a private virtual Ethernet interface with IP
-address 192.168.100.11, which is hooked up to a
-virtual Ethernet interface on the host with IP address
-192.168.100.10. (See the next section for details
-on container networking.)
-
-To disable the container, just remove it from
-configuration.nix and run nixos-rebuild
-switch. Note that this will not delete the root directory of
-the container in /var/lib/containers.
-
-
-
-
-Networking
-
-When you create a container using nixos-container
-create, it gets it own private IPv4 address in the range
-10.233.0.0/16. You can get the container’s IPv4
-address as follows:
-
-
-$ nixos-container show-ip foo
-10.233.4.2
-
-$ ping -c1 10.233.4.2
-64 bytes from 10.233.4.2: icmp_seq=1 ttl=64 time=0.106 ms
-
-
-
-
-Networking is implemented using a pair of virtual Ethernet
-devices. The network interface in the container is called
-eth0, while the matching interface in the host is
-called ve-container-name
-(e.g., ve-foo). The container has its own network
-namespace and the CAP_NET_ADMIN capability, so it
-can perform arbitrary network configuration such as setting up
-firewall rules, without affecting or having access to the host’s
-network.
-
-By default, containers cannot talk to the outside network. If
-you want that, you should set up Network Address Translation (NAT)
-rules on the host to rewrite container traffic to use your external
-IP address. This can be accomplished using the following configuration
-on the host:
-
-
-networking.nat.enable = true;
-networking.nat.internalInterfaces = ["ve-+"];
-networking.nat.externalInterface = "eth0";
-
-where eth0 should be replaced with the desired
-external interface. Note that ve-+ is a wildcard
-that matches all container interfaces.
-
-
-
-
-
-
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix
index a79a77f40df..68248081af6 100644
--- a/nixos/doc/manual/default.nix
+++ b/nixos/doc/manual/default.nix
@@ -1,16 +1,26 @@
{ pkgs, options, version, revision }:
+with pkgs;
with pkgs.lib;
let
# Remove invisible and internal options.
- options' = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options);
+ optionsList = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options);
+
+ # Replace functions by the string
+ substFunction = x:
+ if builtins.isAttrs x then mapAttrs (name: substFunction) x
+ else if builtins.isList x then map substFunction x
+ else if builtins.isFunction x then ""
+ else x;
# Clean up declaration sites to not refer to the NixOS source tree.
- options'' = flip map options' (opt: opt // {
+ optionsList' = flip map optionsList (opt: opt // {
declarations = map (fn: stripPrefix fn) opt.declarations;
- });
+ }
+ // optionalAttrs (opt ? example) { example = substFunction opt.example; }
+ // optionalAttrs (opt ? default) { default = substFunction opt.default; });
prefix = toString ../../..;
@@ -20,87 +30,147 @@ let
else
fn;
- optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML options''));
+ # Convert the list of options into an XML file and a JSON file. The builtin
+ # unsafeDiscardStringContext is used to prevent the realisation of the store
+ # paths which are used in options definitions.
+ optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML optionsList'));
+ optionsJSON = builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON optionsList'));
- optionsDocBook = pkgs.runCommand "options-db.xml" {} ''
- if grep /nixpkgs/nixos/modules ${optionsXML}; then
+ # Tools-friendly version of the list of NixOS options.
+ options' = stdenv.mkDerivation {
+ name = "options";
+
+ buildCommand = ''
+ # Export list of options in different format.
+ dst=$out/share/doc/nixos
+ mkdir -p $dst
+
+ cp ${optionsJSON} $dst/options.json
+ cp ${optionsXML} $dst/options.xml
+
+ mkdir -p $out/nix-support
+ echo "file json $dst/options.json" >> $out/nix-support/hydra-build-products
+ echo "file xml $dst/options.xml" >> $out/nix-support/hydra-build-products
+ ''; # */
+
+ meta.description = "List of NixOS options in various formats.";
+ };
+
+ optionsDocBook = runCommand "options-db.xml" {} ''
+ optionsXML=${options'}/share/doc/nixos/options.xml
+ if grep /nixpkgs/nixos/modules $optionsXML; then
echo "The manual appears to depend on the location of Nixpkgs, which is bad"
echo "since this prevents sharing via the NixOS channel. This is typically"
echo "caused by an option default that refers to a relative path (see above"
echo "for hints about the offending path)."
exit 1
fi
- ${pkgs.libxslt}/bin/xsltproc \
+ ${libxslt}/bin/xsltproc \
--stringparam revision '${revision}' \
- -o $out ${./options-to-docbook.xsl} ${optionsXML}
+ -o $out ${./options-to-docbook.xsl} $optionsXML
'';
+ sources = sourceFilesBySuffices ./. [".xml"];
+
+ copySources =
+ ''
+ cp -prd $sources/* . # */
+ chmod -R u+w .
+ cp ${../../modules/services/databases/postgresql.xml} configuration/postgresql.xml
+ ln -s ${optionsDocBook} options-db.xml
+ echo "${version}" > version
+ '';
+
in rec {
+ # Tools-friendly version of the list of NixOS options.
+ options = options';
+
# Generate the NixOS manual.
- manual = pkgs.stdenv.mkDerivation {
+ manual = stdenv.mkDerivation {
name = "nixos-manual";
- sources = sourceFilesBySuffices ./. [".xml"];
+ inherit sources;
- buildInputs = [ pkgs.libxml2 pkgs.libxslt ];
-
- xsltFlags = ''
- --param section.autolabel 1
- --param section.label.includes.component.label 1
- --param html.stylesheet 'style.css'
- --param xref.with.number.and.title 1
- --param toc.section.depth 3
- --param admon.style '''
- --param callout.graphics.extension '.gif'
- '';
+ buildInputs = [ libxml2 libxslt ];
buildCommand = ''
- ln -s $sources/*.xml . # */
- ln -s ${optionsDocBook} options-db.xml
- echo "${version}" > version
+ ${copySources}
# Check the validity of the manual sources.
xmllint --noout --nonet --xinclude --noxincludenode \
- --relaxng ${pkgs.docbook5}/xml/rng/docbook/docbook.rng \
+ --relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
manual.xml
# Generate the HTML manual.
dst=$out/share/doc/nixos
- ensureDir $dst
- xsltproc $xsltFlags --nonet --xinclude \
- --output $dst/manual.html \
- ${pkgs.docbook5_xsl}/xml/xsl/docbook/xhtml/docbook.xsl \
- ./manual.xml
+ mkdir -p $dst
+ xsltproc \
+ --param section.autolabel 1 \
+ --param section.label.includes.component.label 1 \
+ --stringparam html.stylesheet style.css \
+ --param xref.with.number.and.title 1 \
+ --param toc.section.depth 3 \
+ --stringparam admon.style "" \
+ --stringparam callout.graphics.extension .gif \
+ --param chunk.section.depth 0 \
+ --param chunk.first.sections 1 \
+ --param use.id.as.filename 1 \
+ --stringparam generate.toc "book toc chapter toc appendix toc" \
+ --nonet --xinclude --output $dst/ \
+ ${docbook5_xsl}/xml/xsl/docbook/xhtml/chunkfast.xsl ./manual.xml
mkdir -p $dst/images/callouts
- cp ${pkgs.docbook5_xsl}/xml/xsl/docbook/images/callouts/*.gif $dst/images/callouts/
+ cp ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.gif $dst/images/callouts/
cp ${./style.css} $dst/style.css
mkdir -p $out/nix-support
echo "nix-build out $out" >> $out/nix-support/hydra-build-products
- echo "doc manual $dst manual.html" >> $out/nix-support/hydra-build-products
+ echo "doc manual $dst" >> $out/nix-support/hydra-build-products
''; # */
meta.description = "The NixOS manual in HTML format";
};
- # Generate the NixOS manpages.
- manpages = pkgs.stdenv.mkDerivation {
- name = "nixos-manpages";
+ manualPDF = stdenv.mkDerivation {
+ name = "nixos-manual-pdf";
- sources = sourceFilesBySuffices ./. [".xml"];
+ inherit sources;
- buildInputs = [ pkgs.libxml2 pkgs.libxslt ];
+ buildInputs = [ libxml2 libxslt dblatex tetex ];
buildCommand = ''
- ln -s $sources/*.xml . # */
- ln -s ${optionsDocBook} options-db.xml
+ # TeX needs a writable font cache.
+ export VARTEXFONTS=$TMPDIR/texfonts
+
+ ${copySources}
+
+ dst=$out/share/doc/nixos
+ mkdir -p $dst
+ xmllint --xinclude manual.xml | dblatex -o $dst/manual.pdf - \
+ -P doc.collab.show=0 \
+ -P latex.output.revhistory=0
+
+ mkdir -p $out/nix-support
+ echo "doc-pdf manual $dst/manual.pdf" >> $out/nix-support/hydra-build-products
+ ''; # */
+ };
+
+ # Generate the NixOS manpages.
+ manpages = stdenv.mkDerivation {
+ name = "nixos-manpages";
+
+ inherit sources;
+
+ buildInputs = [ libxml2 libxslt ];
+
+ buildCommand = ''
+ ${copySources}
# Check the validity of the manual sources.
xmllint --noout --nonet --xinclude --noxincludenode \
- --relaxng ${pkgs.docbook5}/xml/rng/docbook/docbook.rng \
+ --relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
./man-pages.xml
# Generate manpages.
@@ -109,7 +179,7 @@ in rec {
--param man.output.in.separate.dir 1 \
--param man.output.base.dir "'$out/share/man/'" \
--param man.endnotes.are.numbered 0 \
- ${pkgs.docbook5_xsl}/xml/xsl/docbook/manpages/docbook.xsl \
+ ${docbook5_xsl}/xml/xsl/docbook/manpages/docbook.xsl \
./man-pages.xml
'';
};
diff --git a/nixos/doc/manual/development.xml b/nixos/doc/manual/development.xml
deleted file mode 100644
index 2f0c2a7aa8d..00000000000
--- a/nixos/doc/manual/development.xml
+++ /dev/null
@@ -1,1119 +0,0 @@
-
-
-Development
-
-This chapter describes how you can modify and extend
-NixOS.
-
-
-
-
-
-
-Getting the sources
-
-By default, NixOS’s nixos-rebuild command
-uses the NixOS and Nixpkgs sources provided by the
-nixos-unstable channel (kept in
-/nix/var/nix/profiles/per-user/root/channels/nixos).
-To modify NixOS, however, you should check out the latest sources from
-Git. This is done using the following command:
-
-
-$ nixos-checkout /my/sources
-
-
-or
-
-
-$ mkdir -p /my/sources
-$ cd /my/sources
-$ nix-env -i git
-$ git clone git://github.com/NixOS/nixpkgs.git
-
-
-This will check out the latest NixOS sources to
-/my/sources/nixpkgs/nixos
-and the Nixpkgs sources to
-/my/sources/nixpkgs.
-(The NixOS source tree lives in a subdirectory of the Nixpkgs
-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:
-
-
-$ nixos-rebuild switch -I nixpkgs=/my/sources/nixpkgs
-
-
-
-
-If you want nix-env to use the expressions in
-/my/sources, use nix-env -f
-/my/sources/nixpkgs, or change
-the default by adding a symlink in
-~/.nix-defexpr:
-
-
-$ ln -s /my/sources/nixpkgs ~/.nix-defexpr/nixpkgs
-
-
-You may want to delete the symlink
-~/.nix-defexpr/channels_root to prevent root’s
-NixOS channel from clashing with your own tree.
-
-
-
-
-
-
-
-
-
-
-Writing NixOS modules
-
-NixOS has a modular system for declarative configuration. This
-system combines multiple modules to produce the
-full system configuration. One of the modules that constitute the
-configuration is /etc/nixos/configuration.nix.
-Most of the others live in the nixos/modules
-subdirectory of the Nixpkgs tree.
-
-Each NixOS module is a file that handles one logical aspect of
-the configuration, such as a specific kind of hardware, a service, or
-network settings. A module configuration does not have to handle
-everything from scratch; it can use the functionality provided by
-other modules for its implementation. Thus a module can
-declare options that can be used by other
-modules, and conversely can define options
-provided by other modules in its own implementation. For example, the
-module pam.nix
-declares the option that allows
-other modules (e.g. sshd.nix)
-to define PAM services; and it defines the option
- (declared by etc.nix)
-to cause files to be created in
-/etc/pam.d.
-
-In , we saw the following structure
-of NixOS modules:
-
-
-{ config, pkgs, ... }:
-
-{ option definitions
-}
-
-
-This is actually an abbreviated form of module
-that only defines options, but does not declare any. The structure of
-full NixOS modules is shown in .
-
-Structure of NixOS modules
-
-{ config, pkgs, ... }:
-
-{
- imports =
- [ paths of other modules
- ];
-
- options = {
- option declarations
- };
-
- config = {
- option definitions
- };
-}
-
-
-The meaning of each part is as follows.
-
-
-
- This line makes the current Nix expression a function. The
- variable pkgs contains Nixpkgs, while
- config contains the full system configuration.
- This line can be omitted if there is no reference to
- pkgs and config inside the
- module.
-
-
-
- This list enumerates the paths to other NixOS modules that
- should be included in the evaluation of the system configuration.
- A default set of modules is defined in the file
- modules/module-list.nix. These don't need to
- be added in the import list.
-
-
-
- The attribute options is a nested set of
- option declarations (described below).
-
-
-
- The attribute config is a nested set of
- option definitions (also described
- below).
-
-
-
-
-
- shows a module that handles
-the regular update of the “locate” database, an index of all files in
-the file system. This module declares two options that can be defined
-by other modules (typically the user’s
-configuration.nix):
- (whether the database should
-be updated) and (when the
-update should be done). It implements its functionality by defining
-two options declared by other modules:
- (the set of all systemd services)
-and (the list of
-commands to be executed periodically by cron).
-
-NixOS module for the “locate” service
-
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-let locatedb = "/var/cache/locatedb"; in
-
-{
- options = {
-
- services.locate = {
-
- enable = mkOption {
- type = types.bool;
- default = false;
- description = ''
- If enabled, NixOS will periodically update the database of
- files used by the locate command.
- '';
- };
-
- period = mkOption {
- type = types.str;
- default = "15 02 * * *";
- description = ''
- This option defines (in the format used by cron) when the
- locate database is updated. The default is to update at
- 02:15 at night every day.
- '';
- };
-
- };
-
- };
-
- config = {
-
- systemd.services.update-locatedb =
- { description = "Update Locate Database";
- path = [ pkgs.su ];
- script =
- ''
- mkdir -m 0755 -p $(dirname ${locatedb})
- exec updatedb --localuser=nobody --output=${locatedb} --prunepaths='/tmp /var/tmp /media /run'
- '';
- };
-
- services.cron.systemCronJobs = optional config.services.locate.enable
- "${config.services.locate.period} root ${config.systemd.package}/bin/systemctl start update-locatedb.service";
-
- };
-}
-
-
-Option declarations
-
-An option declaration specifies the name, type and description
-of a NixOS configuration option. It is illegal to define an option
-that hasn’t been declared in any module. A option declaration
-generally looks like this:
-
-
-options = {
- name = mkOption {
- type = type specification;
- default = default value;
- example = example value;
- description = "Description for use in the NixOS manual.";
- };
-};
-
-
-
-
-The function mkOption accepts the following arguments.
-
-
-
-
- type
-
- The type of the option (see below). It may be omitted,
- but that’s not advisable since it may lead to errors that are
- hard to diagnose.
-
-
-
-
- default
-
- The default value used if no value is defined by any
- module. A default is not required; in that case, if the option
- value is ever used, an error will be thrown.
-
-
-
-
- example
-
- An example value that will be shown in the NixOS manual.
-
-
-
-
- description
-
- A textual description of the option, in DocBook format,
- that will be included in the NixOS manual.
-
-
-
-
-
-
-
-Here is a non-exhaustive list of option types:
-
-
-
-
- types.bool
-
- A Boolean.
-
-
-
-
- types.int
-
- An integer.
-
-
-
-
- types.str
-
- A string.
-
-
-
-
- types.lines
-
- A string. If there are multiple definitions, they are
- concatenated, with newline characters in between.
-
-
-
-
- types.path
-
- A path, defined as anything that, when coerced to a
- string, starts with a slash. This includes derivations.
-
-
-
-
- types.listOf t
-
- A list of elements of type t
- (e.g., types.listOf types.str is a list of
- strings). Multiple definitions are concatenated together.
-
-
-
-
- types.attrsOf t
-
- A set of elements of type t
- (e.g., types.attrsOf types.int is a set of
- name/value pairs, the values being integers).
-
-
-
-
- types.nullOr t
-
- Either the value null or something of
- type t.
-
-
-
-
-
-You can also create new types using the function
-mkOptionType. See
-lib/types.nix in Nixpkgs for details.
-
-
-
-
-Option definitions
-
-Option definitions are generally straight-forward bindings of values to option names, like
-
-
-config = {
- services.httpd.enable = true;
-};
-
-
-However, sometimes you need to wrap an option definition or set of
-option definitions in a property to achieve
-certain effects:
-
-Delaying conditionals
-
-If a set of option definitions is conditional on the value of
-another option, you may need to use mkIf.
-Consider, for instance:
-
-
-config = if config.services.httpd.enable then {
- environment.systemPackages = [ ... ];
- ...
-} else {};
-
-
-This definition will cause Nix to fail with an “infinite recursion”
-error. Why? Because the value of
- depends on the value
-being constructed here. After all, you could also write the clearly
-circular and contradictory:
-
-config = if config.services.httpd.enable then {
- services.httpd.enable = false;
-} else {
- services.httpd.enable = true;
-};
-
-
-The solution is to write:
-
-
-config = mkIf config.services.httpd.enable {
- environment.systemPackages = [ ... ];
- ...
-};
-
-
-The special function mkIf causes the evaluation of
-the conditional to be “pushed down” into the individual definitions,
-as if you had written:
-
-
-config = {
- environment.systemPackages = if config.services.httpd.enable then [ ... ] else [];
- ...
-};
-
-
-
-
-
-
-Setting priorities
-
-A module can override the definitions of an option in other
-modules by setting a priority. All option
-definitions that do not have the lowest priority value are discarded.
-By default, option definitions have priority 1000. You can specify an
-explicit priority by using mkOverride, e.g.
-
-
-services.openssh.enable = mkOverride 10 false;
-
-
-This definition causes all other definitions with priorities above 10
-to be discarded. The function mkForce is
-equal to mkOverride 50.
-
-
-
-Merging configurations
-
-In conjunction with mkIf, it is sometimes
-useful for a module to return multiple sets of option definitions, to
-be merged together as if they were declared in separate modules. This
-can be done using mkMerge:
-
-
-config = mkMerge
- [ # Unconditional stuff.
- { environment.systemPackages = [ ... ];
- }
- # Conditional stuff.
- (mkIf config.services.bla.enable {
- environment.systemPackages = [ ... ];
- })
- ];
-
-
-
-
-
-
-
-
-
-Important options
-
-NixOS has many options, but some are of particular importance to
-module writers.
-
-
-
-
-
-
- This set defines files in /etc. A
- typical use is:
-
-environment.etc."os-release".text =
- ''
- NAME=NixOS
- ...
- '';
-
- which causes a file named /etc/os-release
- to be created with the given contents.
-
-
-
-
-
-
- A set of shell script fragments that must be executed
- whenever the configuration is activated (i.e., at boot time, or
- after running nixos-rebuild switch). For instance,
-
-system.activationScripts.media =
- ''
- mkdir -m 0755 -p /media
- '';
-
- causes the directory /media to be created.
- Activation scripts must be idempotent. They should not start
- background processes such as daemons; use
- for that.
-
-
-
-
-
-
- This is the set of systemd services. Example:
-
-systemd.services.dhcpcd =
- { description = "DHCP Client";
- wantedBy = [ "multi-user.target" ];
- after = [ "systemd-udev-settle.service" ];
- path = [ dhcpcd pkgs.nettools pkgs.openresolv ];
- serviceConfig =
- { Type = "forking";
- PIDFile = "/run/dhcpcd.pid";
- ExecStart = "${dhcpcd}/sbin/dhcpcd --config ${dhcpcdConf}";
- Restart = "always";
- };
- };
-
- which creates the systemd unit
- dhcpcd.service. The option
- determined which other units pull this
- one in; multi-user.target is the default
- target of the system, so dhcpcd.service will
- always be started. The option
- provides the main
- command for the service; it’s also possible to provide pre-start
- actions, stop scripts, and so on.
-
-
-
-
-
-
-
- If your service requires special UIDs or GIDs, you can
- define them with these options. See for details.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Building specific parts of NixOS
-
-With the command nix-build, you can build
-specific parts of your NixOS configuration. This is done as follows:
-
-
-$ cd /path/to/nixpkgs/nixos
-$ nix-build -A config.option
-
-where option is a NixOS option with type
-“derivation” (i.e. something that can be built). Attributes of
-interest include:
-
-
-
-
- system.build.toplevel
-
- The top-level option that builds the entire NixOS system.
- Everything else in your configuration is indirectly pulled in by
- this option. This is what nixos-rebuild
- builds and what /run/current-system points
- to afterwards.
-
- A shortcut to build this is:
-
-
-$ nix-build -A system
-
-
-
-
-
- system.build.manual.manual
- The NixOS manual.
-
-
-
- system.build.etc
- A tree of symlinks that form the static parts of
- /etc.
-
-
-
- system.build.initialRamdisk
- system.build.kernel
-
- The initial ramdisk and kernel of the system. This allows
- a quick way to test whether the kernel and the initial ramdisk
- boot correctly, by using QEMU’s and
- options:
-
-
-$ nix-build -A config.system.build.initialRamdisk -o initrd
-$ nix-build -A config.system.build.kernel -o kernel
-$ qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/null
-
-
-
-
-
-
-
- system.build.nixos-rebuild
- system.build.nixos-install
- system.build.nixos-generate-config
-
- These build the corresponding NixOS commands.
-
-
-
-
- systemd.units.unit-name.unit
-
- This builds the unit with the specified name. Note that
- since unit names contain dots
- (e.g. httpd.service), you need to put them
- between quotes, like this:
-
-
-$ nix-build -A 'config.systemd.units."httpd.service".unit'
-
-
- You can also test individual units, without rebuilding the whole
- system, by putting them in
- /run/systemd/system:
-
-
-$ cp $(nix-build -A 'config.systemd.units."httpd.service".unit')/httpd.service \
- /run/systemd/system/tmp-httpd.service
-$ systemctl daemon-reload
-$ systemctl start tmp-httpd.service
-
-
- Note that the unit must not have the same name as any unit in
- /etc/systemd/system since those take
- precedence over /run/systemd/system.
- That’s why the unit is installed as
- tmp-httpd.service here.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Building your own NixOS CD
-
-Building a NixOS CD is as easy as configuring your own computer. The
-idea is to use another module which will replace
-your configuration.nix to configure the system that
-would be installed on the CD.
-
-Default CD/DVD configurations are available
-inside nixos/modules/installer/cd-dvd. To build them
-you have to set NIXOS_CONFIG before
-running nix-build to build the ISO.
-
-
-$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix
-
-
-
-Before burning your CD/DVD, you can check the content of the image by mounting anywhere like
-suggested by the following command:
-
-
-$ mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso
-
-
-
-
-
-
-
-
-
-
-Testing the installer
-
-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
-$ 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
-
-
-
-
-
-
-
-
-
-
-
-
-NixOS tests
-
-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 '<nixpkgs/nixos/tests/login.nix>'
-
-
-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 login.nix -A driver
-$ ./result/bin/nixos-run-vms
-
-
-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
-particularly useful when developing or debugging a test:
-
-
-$ nix-build tests/ -A nfs.driver
-$ ./result/bin/nixos-test-driver
-starting VDE switch for network 1
->
-
-
-You can then take any Perl statement, e.g.
-
-
-> startAll
-> $machine->succeed("touch /tmp/foo")
-
-
-The function testScript executes the entire test
-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).
-
-
-
-
-
-
-
diff --git a/nixos/doc/manual/development/building-nixos.xml b/nixos/doc/manual/development/building-nixos.xml
new file mode 100644
index 00000000000..21c5bfe6a5b
--- /dev/null
+++ b/nixos/doc/manual/development/building-nixos.xml
@@ -0,0 +1,32 @@
+
+
+Building Your Own NixOS CD
+
+Building a NixOS CD is as easy as configuring your own computer. The
+idea is to use another module which will replace
+your configuration.nix to configure the system that
+would be installed on the CD.
+
+Default CD/DVD configurations are available
+inside nixos/modules/installer/cd-dvd. To build them
+you have to set NIXOS_CONFIG before
+running nix-build to build the ISO.
+
+
+$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix
+
+
+
+Before burning your CD/DVD, you can check the content of the image by mounting anywhere like
+suggested by the following command:
+
+
+$ mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso
+
+
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/development/building-parts.xml b/nixos/doc/manual/development/building-parts.xml
new file mode 100644
index 00000000000..cb8dee039c8
--- /dev/null
+++ b/nixos/doc/manual/development/building-parts.xml
@@ -0,0 +1,113 @@
+
+
+Building Specific Parts of NixOS
+
+With the command nix-build, you can build
+specific parts of your NixOS configuration. This is done as follows:
+
+
+$ cd /path/to/nixpkgs/nixos
+$ nix-build -A config.option
+
+where option is a NixOS option with type
+“derivation” (i.e. something that can be built). Attributes of
+interest include:
+
+
+
+
+ system.build.toplevel
+
+ The top-level option that builds the entire NixOS system.
+ Everything else in your configuration is indirectly pulled in by
+ this option. This is what nixos-rebuild
+ builds and what /run/current-system points
+ to afterwards.
+
+ A shortcut to build this is:
+
+
+$ nix-build -A system
+
+
+
+
+
+ system.build.manual.manual
+ The NixOS manual.
+
+
+
+ system.build.etc
+ A tree of symlinks that form the static parts of
+ /etc.
+
+
+
+ system.build.initialRamdisk
+ system.build.kernel
+
+ The initial ramdisk and kernel of the system. This allows
+ a quick way to test whether the kernel and the initial ramdisk
+ boot correctly, by using QEMU’s and
+ options:
+
+
+$ nix-build -A config.system.build.initialRamdisk -o initrd
+$ nix-build -A config.system.build.kernel -o kernel
+$ qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/null
+
+
+
+
+
+
+
+ system.build.nixos-rebuild
+ system.build.nixos-install
+ system.build.nixos-generate-config
+
+ These build the corresponding NixOS commands.
+
+
+
+
+ systemd.units.unit-name.unit
+
+ This builds the unit with the specified name. Note that
+ since unit names contain dots
+ (e.g. httpd.service), you need to put them
+ between quotes, like this:
+
+
+$ nix-build -A 'config.systemd.units."httpd.service".unit'
+
+
+ You can also test individual units, without rebuilding the whole
+ system, by putting them in
+ /run/systemd/system:
+
+
+$ cp $(nix-build -A 'config.systemd.units."httpd.service".unit')/httpd.service \
+ /run/systemd/system/tmp-httpd.service
+$ systemctl daemon-reload
+$ systemctl start tmp-httpd.service
+
+
+ Note that the unit must not have the same name as any unit in
+ /etc/systemd/system since those take
+ precedence over /run/systemd/system.
+ That’s why the unit is installed as
+ tmp-httpd.service here.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/development/development.xml b/nixos/doc/manual/development/development.xml
new file mode 100644
index 00000000000..747159c4427
--- /dev/null
+++ b/nixos/doc/manual/development/development.xml
@@ -0,0 +1,20 @@
+
+
+Development
+
+
+This chapter describes how you can modify and extend
+NixOS.
+
+
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/development/nixos-tests.xml b/nixos/doc/manual/development/nixos-tests.xml
new file mode 100644
index 00000000000..a98da993330
--- /dev/null
+++ b/nixos/doc/manual/development/nixos-tests.xml
@@ -0,0 +1,19 @@
+
+
+NixOS Tests
+
+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.
+
+
+
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/development/option-declarations.xml b/nixos/doc/manual/development/option-declarations.xml
new file mode 100644
index 00000000000..6d93dc5c009
--- /dev/null
+++ b/nixos/doc/manual/development/option-declarations.xml
@@ -0,0 +1,141 @@
+
+
+Option Declarations
+
+An option declaration specifies the name, type and description
+of a NixOS configuration option. It is illegal to define an option
+that hasn’t been declared in any module. A option declaration
+generally looks like this:
+
+
+options = {
+ name = mkOption {
+ type = type specification;
+ default = default value;
+ example = example value;
+ description = "Description for use in the NixOS manual.";
+ };
+};
+
+
+
+
+The function mkOption accepts the following arguments.
+
+
+
+
+ type
+
+ The type of the option (see below). It may be omitted,
+ but that’s not advisable since it may lead to errors that are
+ hard to diagnose.
+
+
+
+
+ default
+
+ The default value used if no value is defined by any
+ module. A default is not required; in that case, if the option
+ value is ever used, an error will be thrown.
+
+
+
+
+ example
+
+ An example value that will be shown in the NixOS manual.
+
+
+
+
+ description
+
+ A textual description of the option, in DocBook format,
+ that will be included in the NixOS manual.
+
+
+
+
+
+
+
+Here is a non-exhaustive list of option types:
+
+
+
+
+ types.bool
+
+ A Boolean.
+
+
+
+
+ types.int
+
+ An integer.
+
+
+
+
+ types.str
+
+ A string.
+
+
+
+
+ types.lines
+
+ A string. If there are multiple definitions, they are
+ concatenated, with newline characters in between.
+
+
+
+
+ types.path
+
+ A path, defined as anything that, when coerced to a
+ string, starts with a slash. This includes derivations.
+
+
+
+
+ types.listOf t
+
+ A list of elements of type t
+ (e.g., types.listOf types.str is a list of
+ strings). Multiple definitions are concatenated together.
+
+
+
+
+ types.attrsOf t
+
+ A set of elements of type t
+ (e.g., types.attrsOf types.int is a set of
+ name/value pairs, the values being integers).
+
+
+
+
+ types.nullOr t
+
+ Either the value null or something of
+ type t.
+
+
+
+
+
+You can also create new types using the function
+mkOptionType. See
+lib/types.nix in Nixpkgs for details.
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/development/option-def.xml b/nixos/doc/manual/development/option-def.xml
new file mode 100644
index 00000000000..4e267ecfd1e
--- /dev/null
+++ b/nixos/doc/manual/development/option-def.xml
@@ -0,0 +1,112 @@
+
+
+Option Definitions
+
+Option definitions are generally straight-forward bindings of values to option names, like
+
+
+config = {
+ services.httpd.enable = true;
+};
+
+
+However, sometimes you need to wrap an option definition or set of
+option definitions in a property to achieve
+certain effects:
+
+Delaying Conditionals
+
+If a set of option definitions is conditional on the value of
+another option, you may need to use mkIf.
+Consider, for instance:
+
+
+config = if config.services.httpd.enable then {
+ environment.systemPackages = [ ... ];
+ ...
+} else {};
+
+
+This definition will cause Nix to fail with an “infinite recursion”
+error. Why? Because the value of
+ depends on the value
+being constructed here. After all, you could also write the clearly
+circular and contradictory:
+
+config = if config.services.httpd.enable then {
+ services.httpd.enable = false;
+} else {
+ services.httpd.enable = true;
+};
+
+
+The solution is to write:
+
+
+config = mkIf config.services.httpd.enable {
+ environment.systemPackages = [ ... ];
+ ...
+};
+
+
+The special function mkIf causes the evaluation of
+the conditional to be “pushed down” into the individual definitions,
+as if you had written:
+
+
+config = {
+ environment.systemPackages = if config.services.httpd.enable then [ ... ] else [];
+ ...
+};
+
+
+
+
+
+
+Setting Priorities
+
+A module can override the definitions of an option in other
+modules by setting a priority. All option
+definitions that do not have the lowest priority value are discarded.
+By default, option definitions have priority 1000. You can specify an
+explicit priority by using mkOverride, e.g.
+
+
+services.openssh.enable = mkOverride 10 false;
+
+
+This definition causes all other definitions with priorities above 10
+to be discarded. The function mkForce is
+equal to mkOverride 50.
+
+
+
+Merging Configurations
+
+In conjunction with mkIf, it is sometimes
+useful for a module to return multiple sets of option definitions, to
+be merged together as if they were declared in separate modules. This
+can be done using mkMerge:
+
+
+config = mkMerge
+ [ # Unconditional stuff.
+ { environment.systemPackages = [ ... ];
+ }
+ # Conditional stuff.
+ (mkIf config.services.bla.enable {
+ environment.systemPackages = [ ... ];
+ })
+ ];
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/development/running-nixos-tests.xml b/nixos/doc/manual/development/running-nixos-tests.xml
new file mode 100644
index 00000000000..d9be761eb01
--- /dev/null
+++ b/nixos/doc/manual/development/running-nixos-tests.xml
@@ -0,0 +1,77 @@
+
+
+Running Tests
+
+You can run tests using nix-build. For
+example, to run the test login.nix,
+you just do:
+
+
+$ nix-build '<nixpkgs/nixos/tests/login.nix>'
+
+
+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 login.nix -A driver
+$ ./result/bin/nixos-run-vms
+
+
+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
+particularly useful when developing or debugging a test:
+
+
+$ nix-build tests/ -A nfs.driver
+$ ./result/bin/nixos-test-driver
+starting VDE switch for network 1
+>
+
+
+You can then take any Perl statement, e.g.
+
+
+> startAll
+> $machine->succeed("touch /tmp/foo")
+
+
+The function testScript executes the entire test
+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).
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/development/sources.xml b/nixos/doc/manual/development/sources.xml
new file mode 100644
index 00000000000..992a07af981
--- /dev/null
+++ b/nixos/doc/manual/development/sources.xml
@@ -0,0 +1,95 @@
+
+
+Getting the Sources
+
+By default, NixOS’s nixos-rebuild command
+uses the NixOS and Nixpkgs sources provided by the
+nixos-unstable channel (kept in
+/nix/var/nix/profiles/per-user/root/channels/nixos).
+To modify NixOS, however, you should check out the latest sources from
+Git. This is done using the following command:
+
+
+$ nixos-checkout /my/sources
+
+
+or
+
+
+$ mkdir -p /my/sources
+$ cd /my/sources
+$ nix-env -i git
+$ git clone git://github.com/NixOS/nixpkgs.git
+
+
+This will check out the latest NixOS sources to
+/my/sources/nixpkgs/nixos
+and the Nixpkgs sources to
+/my/sources/nixpkgs.
+(The NixOS source tree lives in a subdirectory of the Nixpkgs
+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:
+
+
+$ nixos-rebuild switch -I nixpkgs=/my/sources/nixpkgs
+
+
+
+
+If you want nix-env to use the expressions in
+/my/sources, use nix-env -f
+/my/sources/nixpkgs, or change
+the default by adding a symlink in
+~/.nix-defexpr:
+
+
+$ ln -s /my/sources/nixpkgs ~/.nix-defexpr/nixpkgs
+
+
+You may want to delete the symlink
+~/.nix-defexpr/channels_root to prevent root’s
+NixOS channel from clashing with your own tree.
+
+
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/development/testing-installer.xml b/nixos/doc/manual/development/testing-installer.xml
new file mode 100644
index 00000000000..87e40e32617
--- /dev/null
+++ b/nixos/doc/manual/development/testing-installer.xml
@@ -0,0 +1,27 @@
+
+
+Testing the Installer
+
+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
+$ 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
+
+
+
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/development/writing-modules.xml b/nixos/doc/manual/development/writing-modules.xml
new file mode 100644
index 00000000000..9cf29e5dc57
--- /dev/null
+++ b/nixos/doc/manual/development/writing-modules.xml
@@ -0,0 +1,175 @@
+
+
+Writing NixOS Modules
+
+NixOS has a modular system for declarative configuration. This
+system combines multiple modules to produce the
+full system configuration. One of the modules that constitute the
+configuration is /etc/nixos/configuration.nix.
+Most of the others live in the nixos/modules
+subdirectory of the Nixpkgs tree.
+
+Each NixOS module is a file that handles one logical aspect of
+the configuration, such as a specific kind of hardware, a service, or
+network settings. A module configuration does not have to handle
+everything from scratch; it can use the functionality provided by
+other modules for its implementation. Thus a module can
+declare options that can be used by other
+modules, and conversely can define options
+provided by other modules in its own implementation. For example, the
+module pam.nix
+declares the option that allows
+other modules (e.g. sshd.nix)
+to define PAM services; and it defines the option
+ (declared by etc.nix)
+to cause files to be created in
+/etc/pam.d.
+
+In , we saw the following structure
+of NixOS modules:
+
+
+{ config, pkgs, ... }:
+
+{ option definitions
+}
+
+
+This is actually an abbreviated form of module
+that only defines options, but does not declare any. The structure of
+full NixOS modules is shown in .
+
+Structure of NixOS Modules
+
+{ config, pkgs, ... }:
+
+{
+ imports =
+ [ paths of other modules
+ ];
+
+ options = {
+ option declarations
+ };
+
+ config = {
+ option definitions
+ };
+}
+
+
+The meaning of each part is as follows.
+
+
+
+ This line makes the current Nix expression a function. The
+ variable pkgs contains Nixpkgs, while
+ config contains the full system configuration.
+ This line can be omitted if there is no reference to
+ pkgs and config inside the
+ module.
+
+
+
+ This list enumerates the paths to other NixOS modules that
+ should be included in the evaluation of the system configuration.
+ A default set of modules is defined in the file
+ modules/module-list.nix. These don't need to
+ be added in the import list.
+
+
+
+ The attribute options is a nested set of
+ option declarations (described below).
+
+
+
+ The attribute config is a nested set of
+ option definitions (also described
+ below).
+
+
+
+
+
+ shows a module that handles
+the regular update of the “locate” database, an index of all files in
+the file system. This module declares two options that can be defined
+by other modules (typically the user’s
+configuration.nix):
+ (whether the database should
+be updated) and (when the
+update should be done). It implements its functionality by defining
+two options declared by other modules:
+ (the set of all systemd services)
+and (the list of
+commands to be executed periodically by cron).
+
+NixOS Module for the “locate” Service
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let locatedb = "/var/cache/locatedb"; in
+
+{
+ options = {
+
+ services.locate = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ If enabled, NixOS will periodically update the database of
+ files used by the locate command.
+ '';
+ };
+
+ period = mkOption {
+ type = types.str;
+ default = "15 02 * * *";
+ description = ''
+ This option defines (in the format used by cron) when the
+ locate database is updated. The default is to update at
+ 02:15 at night every day.
+ '';
+ };
+
+ };
+
+ };
+
+ config = {
+
+ systemd.services.update-locatedb =
+ { description = "Update Locate Database";
+ path = [ pkgs.su ];
+ script =
+ ''
+ mkdir -m 0755 -p $(dirname ${locatedb})
+ exec updatedb --localuser=nobody --output=${locatedb} --prunepaths='/tmp /var/tmp /media /run'
+ '';
+ };
+
+ services.cron.systemCronJobs = optional config.services.locate.enable
+ "${config.services.locate.period} root ${config.systemd.package}/bin/systemctl start update-locatedb.service";
+
+ };
+}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/development/writing-nixos-tests.xml b/nixos/doc/manual/development/writing-nixos-tests.xml
new file mode 100644
index 00000000000..bbb655eed2a
--- /dev/null
+++ b/nixos/doc/manual/development/writing-nixos-tests.xml
@@ -0,0 +1,251 @@
+
+
+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/).
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/installation.xml b/nixos/doc/manual/installation.xml
deleted file mode 100644
index 3da5e300977..00000000000
--- a/nixos/doc/manual/installation.xml
+++ /dev/null
@@ -1,562 +0,0 @@
-
-
-Installing NixOS
-
-
-
-
-
-
-Obtaining NixOS
-
-NixOS ISO images can be downloaded from the NixOS
-homepage. These can be burned onto a CD. It is also possible
-to copy them onto a USB stick and install NixOS from there. For
-details, see the NixOS
-Wiki.
-
-As an alternative to installing NixOS yourself, you can get a
-running NixOS system through several other means:
-
-
-
- Using virtual appliances in Open Virtualization Format (OVF)
- that can be imported into VirtualBox. These are available from
- the NixOS
- homepage.
-
-
- Using AMIs for Amazon’s EC2. To find one for your region
- and instance type, please refer to the list
- of most recent AMIs.
-
-
- Using NixOps, the NixOS-based cloud deployment tool, which
- allows you to provision VirtualBox and EC2 NixOS instances from
- declarative specifications. Check out the NixOps
- homepage for details.
-
-
-
-
-
-
-
-
-
-
-
-
-Installation
-
-
-
- Boot from the CD.
-
- The CD contains a basic NixOS installation. (It
- also contains Memtest86+, useful if you want to test new hardware.)
- When it’s finished booting, it should have detected most of your
- hardware and brought up networking (check
- ifconfig). Networking is necessary for the
- installer, since it will download lots of stuff (such as source
- tarballs or Nixpkgs channel binaries). It’s best if you have a DHCP
- server on your network. Otherwise configure networking manually
- using ifconfig.
-
- The NixOS manual is available on virtual console 8
- (press Alt+F8 to access).
-
- Login as root and the empty
- password.
-
- If you downloaded the graphical ISO image, you can
- run start display-manager to start KDE.
-
- The NixOS installer doesn’t do any partitioning or
- formatting yet, so you need to that yourself. Use the following
- commands:
-
-
-
- For partitioning:
- fdisk.
-
- For initialising Ext4 partitions:
- mkfs.ext4. It is recommended that you assign a
- unique symbolic label to the file system using the option
- , since this
- makes the file system configuration independent from device
- changes. For example:
-
-
-$ mkfs.ext4 -L nixos /dev/sda1
-
-
-
- For creating swap partitions:
- mkswap. Again it’s recommended to assign a
- label to the swap partition: .
-
- For creating LVM volumes, the LVM commands, e.g.,
-
-
-$ pvcreate /dev/sda1 /dev/sdb1
-$ vgcreate MyVolGroup /dev/sda1 /dev/sdb1
-$ lvcreate --size 2G --name bigdisk MyVolGroup
-$ lvcreate --size 1G --name smalldisk MyVolGroup
-
-
-
- For creating software RAID devices, use
- mdadm.
-
-
-
-
-
- Mount the target file system on which NixOS should
- be installed on /mnt, e.g.
-
-
-$ mount /dev/disk/by-label/nixos /mnt
-
-
-
-
- If your machine has a limited amount of memory, you
- may want to activate swap devices now (swapon
- device). The installer (or
- rather, the build actions that it may spawn) may need quite a bit of
- RAM, depending on your configuration.
-
-
-
- You now need to create a file
- /mnt/etc/nixos/configuration.nix that
- specifies the intended configuration of the system. This is
- because NixOS has a declarative configuration
- model: you create or edit a description of the desired
- configuration of your system, and then NixOS takes care of making
- it happen. The syntax of the NixOS configuration file is
- described in , while a
- list of available configuration options appears in . A minimal example is shown in .
-
- The command nixos-generate-config can
- generate an initial configuration file for you:
-
-
-$ nixos-generate-config --root /mnt
-
- You should then edit
- /mnt/etc/nixos/configuration.nix to suit your
- needs:
-
-
-$ nano /mnt/etc/nixos/configuration.nix
-
-
- The vim text editor is also available.
-
- You must set the option
- to specify on which disk
- the GRUB boot loader is to be installed. Without it, NixOS cannot
- boot.
-
- Another critical option is ,
- specifying the file systems that need to be mounted by NixOS.
- However, you typically don’t need to set it yourself, because
- nixos-generate-config sets it automatically in
- /mnt/etc/nixos/hardware-configuration.nix
- from your currently mounted file systems. (The configuration file
- hardware-configuration.nix is included from
- configuration.nix and will be overwritten by
- future invocations of nixos-generate-config;
- thus, you generally should not modify it.)
-
- Depending on your hardware configuration or type of
- file system, you may need to set the option
- to include the kernel
- modules that are necessary for mounting the root file system,
- otherwise the installed system will not be able to boot. (If this
- happens, boot from the CD again, mount the target file system on
- /mnt, fix
- /mnt/etc/nixos/configuration.nix and rerun
- nixos-install.) In most cases,
- nixos-generate-config will figure out the
- required modules.
-
- Examples of real-world NixOS configuration files can be
- found at .
-
-
-
- Do the installation:
-
-
-$ nixos-install
-
- Cross fingers. If this fails due to a temporary problem (such as
- 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.
-
- 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:
-
-
-$ reboot
-
-
-
-
-
- You should now be able to boot into the installed NixOS.
- The GRUB boot menu shows a list of available
- configurations (initially just one). Every time you
- change the NixOS configuration (see ), a new item appears in the menu.
- This allows you to easily roll back to another configuration if
- something goes wrong.
-
- You should log in and change the root
- password with passwd.
-
- You’ll probably want to create some user accounts as well,
- which can be done with useradd:
-
-
-$ useradd -c 'Eelco Dolstra' -m eelco
-$ passwd eelco
-
-
-
- You may also want to install some software. For instance,
-
-
-$ nix-env -qa \*
-
- shows what packages are available, and
-
-
-$ nix-env -i w3m
-
- install the w3m browser.
-
-
-
-
-
-To summarise, shows a
-typical sequence of commands for installing NixOS on an empty hard
-drive (here /dev/sda). shows a corresponding configuration Nix expression.
-
-Commands for installing NixOS on /dev/sda
-
-$ fdisk /dev/sda # (or whatever device you want to install on)
-$ mkfs.ext4 -L nixos /dev/sda1
-$ mkswap -L swap /dev/sda2
-$ swapon /dev/sda2
-$ mount /dev/disk/by-label/nixos /mnt
-$ nixos-generate-config --root /mnt
-$ nano /mnt/etc/nixos/configuration.nix
-$ nixos-install
-$ reboot
-
-
-NixOS configuration
-
-{ config, pkgs, ... }:
-
-{
- imports =
- [ # Include the results of the hardware scan.
- ./hardware-configuration.nix
- ];
-
- boot.loader.grub.device = "/dev/sda";
-
- # Note: setting fileSystems is generally not
- # necessary, since nixos-generate-config figures them out
- # automatically in hardware-configuration.nix.
- #fileSystems."/".device = "/dev/disk/by-label/nixos";
-
- # Enable the OpenSSH server.
- services.sshd.enable = true;
-}
-
-
-
-
-UEFI Installation
-
-NixOS can also be installed on UEFI systems. The procedure
-is by and large the same as a BIOS installation, with the following
-changes:
-
-
-
- You should boot the live CD in UEFI mode (consult your
- specific hardware's documentation for instructions).
-
-
- Instead of fdisk, you should use
- gdisk to partition your disks. You will need to
- have a separate partition for /boot with
- partition code EF00, and it should be formatted as a
- vfat filesystem.
-
-
- You must set to
- true. nixos-generate-config
- should do this automatically for new configurations when booted in
- UEFI mode.
-
-
- You may want to look at the options starting with
- and
- as well.
-
-
- To see console messages during early boot, add "fbcon"
- to your .
-
-
-
-
-
-
-
-
-Booting from a USB stick
-
-For systems without CD drive, the NixOS livecd can be booted from
-a usb stick. For non-UEFI installations,
-unetbootin
-will work. For UEFI installations, you should mount the ISO, copy its contents
-verbatim to your drive, then either:
-
-
-
- Change the label of the disk partition to the label of the ISO
- (visible with the blkid command), or
-
-
- Edit loader/entries/nixos-livecd.conf on the drive
- and change the root= field in the options
- line to point to your drive (see the documentation on root=
- in
- the kernel documentation for more details).
-
-
-
-
-
-
-
-
-
-
-
-
-Changing the configuration
-
-The file /etc/nixos/configuration.nix
-contains the current configuration of your machine. Whenever you’ve
-changed something to that file, you should do
-
-
-$ nixos-rebuild switch
-
-to build the new configuration, make it the default configuration for
-booting, and try to realise the configuration in the running system
-(e.g., by restarting system services).
-
-These commands must be executed as root, so you should
-either run them from a root shell or by prefixing them with
-sudo -i.
-
-You can also do
-
-
-$ nixos-rebuild test
-
-to build the configuration and switch the running system to it, but
-without making it the boot default. So if (say) the configuration
-locks up your machine, you can just reboot to get back to a working
-configuration.
-
-There is also
-
-
-$ nixos-rebuild boot
-
-to build the configuration and make it the boot default, but not
-switch to it now (so it will only take effect after the next
-reboot).
-
-You can make your configuration show up in a different submenu
-of the GRUB 2 boot screen by giving it a different profile
-name, e.g.
-
-
-$ nixos-rebuild switch -p test
-
-which causes the new configuration (and previous ones created using
--p test) to show up in the GRUB submenu “NixOS -
-Profile 'test'”. This can be useful to separate test configurations
-from “stable” configurations.
-
-Finally, you can do
-
-
-$ nixos-rebuild build
-
-to build the configuration but nothing more. This is useful to see
-whether everything compiles cleanly.
-
-If you have a machine that supports hardware virtualisation, you
-can also test the new configuration in a sandbox by building and
-running a QEMU virtual machine that contains the
-desired configuration. Just do
-
-
-$ nixos-rebuild build-vm
-$ ./result/bin/run-*-vm
-
-
-The VM does not have any data from your host system, so your existing
-user accounts and home directories will not be available. You can
-forward ports on the host to the guest. For instance, the following
-will forward host port 2222 to guest port 22 (SSH):
-
-
-$ QEMU_NET_OPTS="hostfwd=tcp::2222-:22" ./result/bin/run-*-vm
-
-
-allowing you to log in via SSH (assuming you have set the appropriate
-passwords or SSH authorized keys):
-
-
-$ ssh -p 2222 localhost
-
-
-
-
-
-
-
-
-
-
-
-Upgrading NixOS
-
-The best way to keep your NixOS installation up to date is to
-use one of the NixOS channels. A channel is a
-Nix mechanism for distributing Nix expressions and associated
-binaries. The NixOS channels are updated automatically from NixOS’s
-Git repository after certain tests have passed and all packages have
-been built. These channels are:
-
-
-
- Stable channels, such as 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
- not from 3.4.x to
- 3.11.x (a major change that has the
- potential to break things). Stable channels are generally
- maintained until the next stable branch is created.
-
-
- The unstable channel, nixos-unstable.
- This corresponds to NixOS’s main development branch, and may thus
- see radical changes between channel updates. It’s not recommended
- for production systems.
-
-
-
-To see what channels are available, go to . (Note that the URIs of the
-various channels redirect to a directory that contains the channel’s
-latest version and includes ISO images and VirtualBox
-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 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:
-
-
-$ nix-channel --list | grep nixos
-nixos https://nixos.org/channels/nixos-unstable
-
-
-To switch to a different NixOS channel, do
-
-
-$ nix-channel --add http://nixos.org/channels/channel-name nixos
-
-
-(Be sure to include the nixos parameter at the
-end.) For instance, to use the NixOS 14.04 stable channel:
-
-
-$ nix-channel --add http://nixos.org/channels/nixos-14.04 nixos
-
-
-But it you want to live on the bleeding edge:
-
-
-$ nix-channel --add http://nixos.org/channels/nixos-unstable nixos
-
-
-
-
-You can then upgrade NixOS to the latest version in your chosen
-channel by running
-
-
-$ nixos-rebuild switch --upgrade
-
-
-which is equivalent to the more verbose nix-channel --update
-nixos; nixos-rebuild switch.
-
-It is generally safe to switch back and forth between
-channels. The only exception is that a newer NixOS may also have a
-newer Nix version, which may involve an upgrade of Nix’s database
-schema. This cannot be undone easily, so in that case you will not be
-able to go back to your original channel.
-
-
-
-
diff --git a/nixos/doc/manual/installation/changing-config.xml b/nixos/doc/manual/installation/changing-config.xml
new file mode 100644
index 00000000000..aa31742434e
--- /dev/null
+++ b/nixos/doc/manual/installation/changing-config.xml
@@ -0,0 +1,90 @@
+
+
+Changing the Configuration
+
+The file /etc/nixos/configuration.nix
+contains the current configuration of your machine. Whenever you’ve
+changed something to that file, you should do
+
+
+$ nixos-rebuild switch
+
+to build the new configuration, make it the default configuration for
+booting, and try to realise the configuration in the running system
+(e.g., by restarting system services).
+
+These commands must be executed as root, so you should
+either run them from a root shell or by prefixing them with
+sudo -i.
+
+You can also do
+
+
+$ nixos-rebuild test
+
+to build the configuration and switch the running system to it, but
+without making it the boot default. So if (say) the configuration
+locks up your machine, you can just reboot to get back to a working
+configuration.
+
+There is also
+
+
+$ nixos-rebuild boot
+
+to build the configuration and make it the boot default, but not
+switch to it now (so it will only take effect after the next
+reboot).
+
+You can make your configuration show up in a different submenu
+of the GRUB 2 boot screen by giving it a different profile
+name, e.g.
+
+
+$ nixos-rebuild switch -p test
+
+which causes the new configuration (and previous ones created using
+-p test) to show up in the GRUB submenu “NixOS -
+Profile 'test'”. This can be useful to separate test configurations
+from “stable” configurations.
+
+Finally, you can do
+
+
+$ nixos-rebuild build
+
+to build the configuration but nothing more. This is useful to see
+whether everything compiles cleanly.
+
+If you have a machine that supports hardware virtualisation, you
+can also test the new configuration in a sandbox by building and
+running a QEMU virtual machine that contains the
+desired configuration. Just do
+
+
+$ nixos-rebuild build-vm
+$ ./result/bin/run-*-vm
+
+
+The VM does not have any data from your host system, so your existing
+user accounts and home directories will not be available. You can
+forward ports on the host to the guest. For instance, the following
+will forward host port 2222 to guest port 22 (SSH):
+
+
+$ QEMU_NET_OPTS="hostfwd=tcp::2222-:22" ./result/bin/run-*-vm
+
+
+allowing you to log in via SSH (assuming you have set the appropriate
+passwords or SSH authorized keys):
+
+
+$ ssh -p 2222 localhost
+
+
+
+
+
diff --git a/nixos/doc/manual/installation/installation.xml b/nixos/doc/manual/installation/installation.xml
new file mode 100644
index 00000000000..ee61bedc418
--- /dev/null
+++ b/nixos/doc/manual/installation/installation.xml
@@ -0,0 +1,21 @@
+
+
+Installation
+
+
+
+This section describes how to obtain, install, and configure
+NixOS for first-time use.
+
+
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/installation/installing-uefi.xml b/nixos/doc/manual/installation/installing-uefi.xml
new file mode 100644
index 00000000000..dbd5606c4a5
--- /dev/null
+++ b/nixos/doc/manual/installation/installing-uefi.xml
@@ -0,0 +1,51 @@
+
+
+UEFI Installation
+
+NixOS can also be installed on UEFI systems. The procedure
+is by and large the same as a BIOS installation, with the following
+changes:
+
+
+
+ You should boot the live CD in UEFI mode (consult your
+ specific hardware's documentation for instructions). You may find
+ the rEFInd
+ boot manager useful.
+
+
+ Instead of fdisk, you should use
+ gdisk to partition your disks. You will need to
+ have a separate partition for /boot with
+ partition code EF00, and it should be formatted as a
+ vfat filesystem.
+
+
+ You must set to
+ true. nixos-generate-config
+ should do this automatically for new configurations when booted in
+ UEFI mode.
+
+
+ After having mounted your installation partition to
+ /mnt, you must mount the boot partition
+ to /mnt/boot.
+
+
+ You may want to look at the options starting with
+ and
+ as well.
+
+
+ To see console messages during early boot, add "fbcon"
+ to your .
+
+
+
+
+
diff --git a/nixos/doc/manual/installation/installing-usb.xml b/nixos/doc/manual/installation/installing-usb.xml
new file mode 100644
index 00000000000..97e3d2eaa1c
--- /dev/null
+++ b/nixos/doc/manual/installation/installing-usb.xml
@@ -0,0 +1,30 @@
+
+
+Booting from a USB Drive
+
+For systems without CD drive, the NixOS livecd can be booted from
+a usb stick. For non-UEFI installations,
+unetbootin
+will work. For UEFI installations, you should mount the ISO, copy its contents
+verbatim to your drive, then either:
+
+
+
+ Change the label of the disk partition to the label of the ISO
+ (visible with the blkid command), or
+
+
+ Edit loader/entries/nixos-livecd.conf on the drive
+ and change the root= field in the options
+ line to point to your drive (see the documentation on root=
+ in
+ the kernel documentation for more details).
+
+
+
+
+
diff --git a/nixos/doc/manual/installation/installing.xml b/nixos/doc/manual/installation/installing.xml
new file mode 100644
index 00000000000..b140c56fbee
--- /dev/null
+++ b/nixos/doc/manual/installation/installing.xml
@@ -0,0 +1,264 @@
+
+
+Installing NixOS
+
+
+
+ Boot from the CD.
+
+ The CD contains a basic NixOS installation. (It
+ also contains Memtest86+, useful if you want to test new hardware.)
+ When it’s finished booting, it should have detected most of your
+ hardware and brought up networking (check
+ ifconfig). Networking is necessary for the
+ installer, since it will download lots of stuff (such as source
+ tarballs or Nixpkgs channel binaries). It’s best if you have a DHCP
+ server on your network. Otherwise configure networking manually
+ using ifconfig.
+
+ The NixOS manual is available on virtual console 8
+ (press Alt+F8 to access).
+
+ Login as root and the empty
+ password.
+
+ If you downloaded the graphical ISO image, you can
+ run start display-manager to start KDE.
+
+ The NixOS installer doesn’t do any partitioning or
+ formatting yet, so you need to that yourself. Use the following
+ commands:
+
+
+
+ For partitioning:
+ fdisk.
+
+ For initialising Ext4 partitions:
+ mkfs.ext4. It is recommended that you assign a
+ unique symbolic label to the file system using the option
+ , since this
+ makes the file system configuration independent from device
+ changes. For example:
+
+
+$ mkfs.ext4 -L nixos /dev/sda1
+
+
+
+ For creating swap partitions:
+ mkswap. Again it’s recommended to assign a
+ label to the swap partition: .
+
+ For creating LVM volumes, the LVM commands, e.g.,
+
+
+$ pvcreate /dev/sda1 /dev/sdb1
+$ vgcreate MyVolGroup /dev/sda1 /dev/sdb1
+$ lvcreate --size 2G --name bigdisk MyVolGroup
+$ lvcreate --size 1G --name smalldisk MyVolGroup
+
+
+
+ For creating software RAID devices, use
+ mdadm.
+
+
+
+
+
+ Mount the target file system on which NixOS should
+ be installed on /mnt, e.g.
+
+
+$ mount /dev/disk/by-label/nixos /mnt
+
+
+
+
+ If your machine has a limited amount of memory, you
+ may want to activate swap devices now (swapon
+ device). The installer (or
+ rather, the build actions that it may spawn) may need quite a bit of
+ RAM, depending on your configuration.
+
+
+
+ You now need to create a file
+ /mnt/etc/nixos/configuration.nix that
+ specifies the intended configuration of the system. This is
+ because NixOS has a declarative configuration
+ model: you create or edit a description of the desired
+ configuration of your system, and then NixOS takes care of making
+ it happen. The syntax of the NixOS configuration file is
+ described in , while a
+ list of available configuration options appears in . A minimal example is shown in .
+
+ The command nixos-generate-config can
+ generate an initial configuration file for you:
+
+
+$ nixos-generate-config --root /mnt
+
+ You should then edit
+ /mnt/etc/nixos/configuration.nix to suit your
+ needs:
+
+
+$ nano /mnt/etc/nixos/configuration.nix
+
+
+ The vim text editor is also available.
+
+ You must set the option
+ to specify on which disk
+ the GRUB boot loader is to be installed. Without it, NixOS cannot
+ boot.
+
+ Another critical option is ,
+ specifying the file systems that need to be mounted by NixOS.
+ However, you typically don’t need to set it yourself, because
+ nixos-generate-config sets it automatically in
+ /mnt/etc/nixos/hardware-configuration.nix
+ from your currently mounted file systems. (The configuration file
+ hardware-configuration.nix is included from
+ configuration.nix and will be overwritten by
+ future invocations of nixos-generate-config;
+ thus, you generally should not modify it.)
+
+ Depending on your hardware configuration or type of
+ file system, you may need to set the option
+ to include the kernel
+ modules that are necessary for mounting the root file system,
+ otherwise the installed system will not be able to boot. (If this
+ happens, boot from the CD again, mount the target file system on
+ /mnt, fix
+ /mnt/etc/nixos/configuration.nix and rerun
+ nixos-install.) In most cases,
+ nixos-generate-config will figure out the
+ required modules.
+
+ Examples of real-world NixOS configuration files can be
+ found at .
+
+
+
+ Do the installation:
+
+
+$ nixos-install
+
+ Cross fingers. If this fails due to a temporary problem (such as
+ 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.
+
+ 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:
+
+
+$ reboot
+
+
+
+
+
+ You should now be able to boot into the installed NixOS. The GRUB boot menu shows a list
+ of available configurations (initially just one). Every time
+ you change the NixOS configuration (seeChanging
+ Configuration ), a new item appears in the menu. This allows you to
+ easily roll back to another configuration if something goes wrong.
+
+ You should log in and change the root
+ password with passwd.
+
+ You’ll probably want to create some user accounts as well,
+ which can be done with useradd:
+
+
+$ useradd -c 'Eelco Dolstra' -m eelco
+$ passwd eelco
+
+
+
+ You may also want to install some software. For instance,
+
+
+$ nix-env -qa \*
+
+ shows what packages are available, and
+
+
+$ nix-env -i w3m
+
+ install the w3m browser.
+
+
+
+
+
+To summarise, shows a
+typical sequence of commands for installing NixOS on an empty hard
+drive (here /dev/sda). shows a corresponding configuration Nix expression.
+
+Commands for Installing NixOS on /dev/sda
+
+$ fdisk /dev/sda # (or whatever device you want to install on)
+$ mkfs.ext4 -L nixos /dev/sda1
+$ mkswap -L swap /dev/sda2
+$ swapon /dev/sda2
+$ mount /dev/disk/by-label/nixos /mnt
+$ nixos-generate-config --root /mnt
+$ nano /mnt/etc/nixos/configuration.nix
+$ nixos-install
+$ reboot
+
+
+NixOS Configuration
+
+{ config, pkgs, ... }:
+
+{
+ imports =
+ [ # Include the results of the hardware scan.
+ ./hardware-configuration.nix
+ ];
+
+ boot.loader.grub.device = "/dev/sda";
+
+ # Note: setting fileSystems is generally not
+ # necessary, since nixos-generate-config figures them out
+ # automatically in hardware-configuration.nix.
+ #fileSystems."/".device = "/dev/disk/by-label/nixos";
+
+ # Enable the OpenSSH server.
+ services.sshd.enable = true;
+}
+
+
+
+
+
+
diff --git a/nixos/doc/manual/installation/obtaining.xml b/nixos/doc/manual/installation/obtaining.xml
new file mode 100644
index 00000000000..ceeeb5c0ac0
--- /dev/null
+++ b/nixos/doc/manual/installation/obtaining.xml
@@ -0,0 +1,44 @@
+
+
+Obtaining NixOS
+
+NixOS ISO images can be downloaded from the NixOS
+homepage. These can be burned onto a CD. It is also possible
+to copy them onto a USB stick and install NixOS from there. For
+details, see the NixOS
+Wiki.
+
+As an alternative to installing NixOS yourself, you can get a
+running NixOS system through several other means:
+
+
+
+ Using virtual appliances in Open Virtualization Format (OVF)
+ that can be imported into VirtualBox. These are available from
+ the NixOS
+ homepage.
+
+
+ Using AMIs for Amazon’s EC2. To find one for your region
+ and instance type, please refer to the list
+ of most recent AMIs.
+
+
+ Using NixOps, the NixOS-based cloud deployment tool, which
+ allows you to provision VirtualBox and EC2 NixOS instances from
+ declarative specifications. Check out the NixOps
+ homepage for details.
+
+
+
+
+
+
diff --git a/nixos/doc/manual/installation/upgrading.xml b/nixos/doc/manual/installation/upgrading.xml
new file mode 100644
index 00000000000..ed71a7e23a3
--- /dev/null
+++ b/nixos/doc/manual/installation/upgrading.xml
@@ -0,0 +1,90 @@
+
+
+Upgrading NixOS
+
+The best way to keep your NixOS installation up to date is to
+use one of the NixOS channels. A channel is a
+Nix mechanism for distributing Nix expressions and associated
+binaries. The NixOS channels are updated automatically from NixOS’s
+Git repository after certain tests have passed and all packages have
+been built. These channels are:
+
+
+
+ Stable channels, such as 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
+ not from 3.4.x to
+ 3.11.x (a major change that has the
+ potential to break things). Stable channels are generally
+ maintained until the next stable branch is created.
+
+
+ The unstable channel, nixos-unstable.
+ This corresponds to NixOS’s main development branch, and may thus
+ see radical changes between channel updates. It’s not recommended
+ for production systems.
+
+
+
+To see what channels are available, go to . (Note that the URIs of the
+various channels redirect to a directory that contains the channel’s
+latest version and includes ISO images and VirtualBox
+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 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:
+
+
+$ nix-channel --list | grep nixos
+nixos https://nixos.org/channels/nixos-unstable
+
+
+To switch to a different NixOS channel, do
+
+
+$ nix-channel --add http://nixos.org/channels/channel-name nixos
+
+
+(Be sure to include the nixos parameter at the
+end.) For instance, to use the NixOS 14.04 stable channel:
+
+
+$ nix-channel --add http://nixos.org/channels/nixos-14.04 nixos
+
+
+But it you want to live on the bleeding edge:
+
+
+$ nix-channel --add http://nixos.org/channels/nixos-unstable nixos
+
+
+
+
+You can then upgrade NixOS to the latest version in your chosen
+channel by running
+
+
+$ nixos-rebuild switch --upgrade
+
+
+which is equivalent to the more verbose nix-channel --update
+nixos; nixos-rebuild switch.
+
+It is generally safe to switch back and forth between
+channels. The only exception is that a newer NixOS may also have a
+newer Nix version, which may involve an upgrade of Nix’s database
+schema. This cannot be undone easily, so in that case you will not be
+able to go back to your original channel.
+
+
diff --git a/nixos/doc/manual/man-nixos-option.xml b/nixos/doc/manual/man-nixos-option.xml
index 7952847d4db..2875336c67e 100644
--- a/nixos/doc/manual/man-nixos-option.xml
+++ b/nixos/doc/manual/man-nixos-option.xml
@@ -17,11 +17,6 @@
nixos-option
-
-
-
-
-
option.name
@@ -31,50 +26,13 @@
This command evaluates the configuration specified in
/etc/nixos/configuration.nix and returns the properties
-of the option name given as argument. By default, it returns the value of
-the option.
+of the option name given as argument.
When the option name is not an option, the command prints the list of
attributes contained in the attribute set.
-Options
-
-This command accepts the following options:
-
-
-
-
- ,
-
- Returns the value of the option. This is the default operation
- if no other options are defined.
-
-
-
-
- ,
-
- Return the default value, the example and the description of the
- option when available.
-
-
-
-
- ,
-
- Return the locations where the option is declared and where it
- is defined. This is extremely useful to find sources of errors in
- your configuration.
-
-
-
-
-
-
-
-
Environment
@@ -103,27 +61,21 @@ grub
initScript
$ nixos-option boot.loader.grub.enable
-true
+Value:
+true
-Prints option information:
+Default:
+true
-$ nixos-option -d networking.hostName
-Default: "nixos"
Description:
-The name of the machine. Leave it empty if you want to obtain
-it from a DHCP server (if using DHCP).
+Whether to enable the GNU GRUB boot loader.
-Find the locations which are declaring and defining an option:
-
-$ nixos-option -l hardware.firmware
Declared by:
- /mnt/data/nix-sources/nixos/modules/services/hardware/udev.nix
+ "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix"
Defined by:
- /path/to/nixpkgs/nixos/modules/system/boot/kernel.nix
- /path/to/nixpkgs/nixos/modules/hardware/network/rt73.nix
- /path/to/nixpkgs/nixos/modules/hardware/network/intel-3945abg.nix
- /path/to/nixpkgs/nixos/modules/hardware/network/intel-2200bg.nix
+ "/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/system/boot/loader/grub/grub.nix"
+
diff --git a/nixos/doc/manual/manual.xml b/nixos/doc/manual/manual.xml
index 8d7c28dee73..a3ad76209ac 100644
--- a/nixos/doc/manual/manual.xml
+++ b/nixos/doc/manual/manual.xml
@@ -1,34 +1,14 @@
-
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ version="5.0"
+ xml:id="NixOSManual">
+
-
NixOS Manual
Version
-
-
-
- Eelco
- Dolstra
-
-
-
-
-
- Nicolas
- Pierron
-
-
-
-
- 2007-2013
- Eelco Dolstra
-
-
-
Preface
@@ -48,19 +28,14 @@
-
-
-
-
+
+
+
-
-
-
-
-
+
- Configuration options
+ Configuration Options
diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl
index bb65a49217f..e81a1dc356e 100644
--- a/nixos/doc/manual/options-to-docbook.xsl
+++ b/nixos/doc/manual/options-to-docbook.xsl
@@ -202,4 +202,10 @@
+
+
+ λ
+
+
+
diff --git a/nixos/doc/manual/release-notes/release-notes.xml b/nixos/doc/manual/release-notes/release-notes.xml
new file mode 100644
index 00000000000..9034dba1fb5
--- /dev/null
+++ b/nixos/doc/manual/release-notes/release-notes.xml
@@ -0,0 +1,17 @@
+
+
+Release Notes
+
+
+This section lists the release notes for each stable version of NixOS.
+
+
+
+
+
+
+
diff --git a/nixos/doc/manual/release-notes/rl-1310.xml b/nixos/doc/manual/release-notes/rl-1310.xml
new file mode 100644
index 00000000000..234fb5a643f
--- /dev/null
+++ b/nixos/doc/manual/release-notes/rl-1310.xml
@@ -0,0 +1,11 @@
+
+
+Release 13.10 (“Aardvark”, 2013/10/31)
+
+This is the first stable release branch of NixOS.
+
+
\ No newline at end of file
diff --git a/nixos/doc/manual/release-notes.xml b/nixos/doc/manual/release-notes/rl-1404.xml
similarity index 83%
rename from nixos/doc/manual/release-notes.xml
rename to nixos/doc/manual/release-notes/rl-1404.xml
index 52e88bb4c86..74af1ed1274 100644
--- a/nixos/doc/manual/release-notes.xml
+++ b/nixos/doc/manual/release-notes/rl-1404.xml
@@ -1,34 +1,8 @@
-
-
-Release notes
-
-
-
-
-
-Release 14.10 (“Caterpillar”, 2014/10/??)
-
-When upgrading from a previous release, please be aware of the
-following incompatible changes:
-
-
-
- The host side of a container virtual Ethernet pair
- is now called ve-container-name
- rather than c-container-name.
-
-
-
-
-
-
-
-
-
-
-
+
Release 14.04 (“Baboon”, 2014/04/30)
@@ -183,16 +157,4 @@ networking.firewall.enable = false;
-
-
-
-
-
-
-Release 13.10 (“Aardvark”, 2013/10/31)
-
-This is the first stable release branch of NixOS.
-
-
-
-
+
\ No newline at end of file
diff --git a/nixos/doc/manual/release-notes/rl-1411.xml b/nixos/doc/manual/release-notes/rl-1411.xml
new file mode 100644
index 00000000000..74cf8323e69
--- /dev/null
+++ b/nixos/doc/manual/release-notes/rl-1411.xml
@@ -0,0 +1,22 @@
+
+
+Release 14.11 (“Caterpillar”, 2014/11/??)
+
+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.
+
+
+
+
+
+
diff --git a/nixos/doc/manual/running.xml b/nixos/doc/manual/running.xml
deleted file mode 100644
index e1a358df2aa..00000000000
--- a/nixos/doc/manual/running.xml
+++ /dev/null
@@ -1,369 +0,0 @@
-
-
-Running NixOS
-
-This chapter describes various aspects of managing a running
-NixOS system, such as how to use the systemd
-service manager.
-
-
-
-
-Service management
-
-In NixOS, all system services are started and monitored using
-the systemd program. Systemd is the “init” process of the system
-(i.e. PID 1), the parent of all other processes. It manages a set of
-so-called “units”, which can be things like system services
-(programs), but also mount points, swap files, devices, targets
-(groups of units) and more. Units can have complex dependencies; for
-instance, one unit can require that another unit must be successfully
-started before the first unit can be started. When the system boots,
-it starts a unit named default.target; the
-dependencies of this unit cause all system services to be started,
-file systems to be mounted, swap files to be activated, and so
-on.
-
-The command systemctl is the main way to
-interact with systemd. Without any arguments, it
-shows the status of active units:
-
-
-$ systemctl
--.mount loaded active mounted /
-swapfile.swap loaded active active /swapfile
-sshd.service loaded active running SSH Daemon
-graphical.target loaded active active Graphical Interface
-...
-
-
-
-
-You can ask for detailed status information about a unit, for
-instance, the PostgreSQL database service:
-
-
-$ systemctl status postgresql.service
-postgresql.service - PostgreSQL Server
- Loaded: loaded (/nix/store/pn3q73mvh75gsrl8w7fdlfk3fq5qm5mw-unit/postgresql.service)
- Active: active (running) since Mon, 2013-01-07 15:55:57 CET; 9h ago
- Main PID: 2390 (postgres)
- CGroup: name=systemd:/system/postgresql.service
- ├─2390 postgres
- ├─2418 postgres: writer process
- ├─2419 postgres: wal writer process
- ├─2420 postgres: autovacuum launcher process
- ├─2421 postgres: stats collector process
- └─2498 postgres: zabbix zabbix [local] idle
-
-Jan 07 15:55:55 hagbard postgres[2394]: [1-1] LOG: database system was shut down at 2013-01-07 15:55:05 CET
-Jan 07 15:55:57 hagbard postgres[2390]: [1-1] LOG: database system is ready to accept connections
-Jan 07 15:55:57 hagbard postgres[2420]: [1-1] LOG: autovacuum launcher started
-Jan 07 15:55:57 hagbard systemd[1]: Started PostgreSQL Server.
-
-
-Note that this shows the status of the unit (active and running), all
-the processes belonging to the service, as well as the most recent log
-messages from the service.
-
-
-
-Units can be stopped, started or restarted:
-
-
-$ systemctl stop postgresql.service
-$ systemctl start postgresql.service
-$ systemctl restart postgresql.service
-
-
-These operations are synchronous: they wait until the service has
-finished starting or stopping (or has failed). Starting a unit will
-cause the dependencies of that unit to be started as well (if
-necessary).
-
-
-
-
-
-
-
-
-Rebooting and shutting down
-
-The system can be shut down (and automatically powered off) by
-doing:
-
-
-$ shutdown
-
-
-This is equivalent to running systemctl
-poweroff.
-
-To reboot the system, run
-
-
-$ reboot
-
-
-which is equivalent to systemctl reboot.
-Alternatively, you can quickly reboot the system using
-kexec, which bypasses the BIOS by directly loading
-the new kernel into memory:
-
-
-$ systemctl kexec
-
-
-
-
-The machine can be suspended to RAM (if supported) using
-systemctl suspend, and suspended to disk using
-systemctl hibernate.
-
-These commands can be run by any user who is logged in locally,
-i.e. on a virtual console or in X11; otherwise, the user is asked for
-authentication.
-
-
-
-
-
-
-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
-loginctl allows querying and manipulating user
-sessions. For instance, to list all user sessions:
-
-
-$ loginctl
- SESSION UID USER SEAT
- c1 500 eelco seat0
- c3 0 root seat0
- c4 500 alice
-
-
-This shows that two users are logged in locally, while another is
-logged in remotely. (“Seats” are essentially the combinations of
-displays and input devices attached to the system; usually, there is
-only one seat.) To get information about a session:
-
-
-$ loginctl session-status c3
-c3 - root (0)
- Since: Tue, 2013-01-08 01:17:56 CET; 4min 42s ago
- Leader: 2536 (login)
- Seat: seat0; vc3
- TTY: /dev/tty3
- Service: login; type tty; class user
- State: online
- CGroup: name=systemd:/user/root/c3
- ├─ 2536 /nix/store/10mn4xip9n7y9bxqwnsx7xwx2v2g34xn-shadow-4.1.5.1/bin/login --
- ├─10339 -bash
- └─10355 w3m nixos.org
-
-
-This shows that the user is logged in on virtual console 3. It also
-lists the processes belonging to this session. Since systemd keeps
-track of this, you can terminate a session in a way that ensures that
-all the session’s processes are gone:
-
-
-$ loginctl terminate-session c3
-
-
-
-
-
-
-
-
-
-Control groups
-
-To keep track of the processes in a running system, systemd uses
-control groups (cgroups). A control group is a
-set of processes used to allocate resources such as CPU, memory or I/O
-bandwidth. There can be multiple control group hierarchies, allowing
-each kind of resource to be managed independently.
-
-The command systemd-cgls lists all control
-groups in the systemd hierarchy, which is what
-systemd uses to keep track of the processes belonging to each service
-or user session:
-
-
-$ systemd-cgls
-├─user
-│ └─eelco
-│ └─c1
-│ ├─ 2567 -:0
-│ ├─ 2682 kdeinit4: kdeinit4 Running...
-│ ├─ ...
-│ └─10851 sh -c less -R
-└─system
- ├─httpd.service
- │ ├─2444 httpd -f /nix/store/3pyacby5cpr55a03qwbnndizpciwq161-httpd.conf -DNO_DETACH
- │ └─...
- ├─dhcpcd.service
- │ └─2376 dhcpcd --config /nix/store/f8dif8dsi2yaa70n03xir8r653776ka6-dhcpcd.conf
- └─ ...
-
-
-Similarly, systemd-cgls cpu shows the cgroups in
-the CPU hierarchy, which allows per-cgroup CPU scheduling priorities.
-By default, every systemd service gets its own CPU cgroup, while all
-user sessions are in the top-level CPU cgroup. This ensures, for
-instance, that a thousand run-away processes in the
-httpd.service cgroup cannot starve the CPU for one
-process in the postgresql.service cgroup. (By
-contrast, it they were in the same cgroup, then the PostgreSQL process
-would get 1/1001 of the cgroup’s CPU time.) You can limit a service’s
-CPU share in configuration.nix:
-
-
-systemd.services.httpd.serviceConfig.CPUShares = 512;
-
-
-By default, every cgroup has 1024 CPU shares, so this will halve the
-CPU allocation of the httpd.service cgroup.
-
-There also is a memory hierarchy that
-controls memory allocation limits; by default, all processes are in
-the top-level cgroup, so any service or session can exhaust all
-available memory. Per-cgroup memory limits can be specified in
-configuration.nix; for instance, to limit
-httpd.service to 512 MiB of RAM (excluding swap)
-and 640 MiB of RAM (including swap):
-
-
-systemd.services.httpd.serviceConfig.MemoryLimit = "512M";
-systemd.services.httpd.serviceConfig.ControlGroupAttribute = [ "memory.memsw.limit_in_bytes 640M" ];
-
-
-
-
-The command systemd-cgtop shows a
-continuously updated list of all cgroups with their CPU and memory
-usage.
-
-
-
-
-
-
-Logging
-
-System-wide logging is provided by systemd’s
-journal, which subsumes traditional logging
-daemons such as syslogd and klogd. Log entries are kept in binary
-files in /var/log/journal/. The command
-journalctl allows you to see the contents of the
-journal. For example,
-
-
-$ journalctl -b
-
-
-shows all journal entries since the last reboot. (The output of
-journalctl is piped into less by
-default.) You can use various options and match operators to restrict
-output to messages of interest. For instance, to get all messages
-from PostgreSQL:
-
-
-$ journalctl -u postgresql.service
--- Logs begin at Mon, 2013-01-07 13:28:01 CET, end at Tue, 2013-01-08 01:09:57 CET. --
-...
-Jan 07 15:44:14 hagbard postgres[2681]: [2-1] LOG: database system is shut down
--- Reboot --
-Jan 07 15:45:10 hagbard postgres[2532]: [1-1] LOG: database system was shut down at 2013-01-07 15:44:14 CET
-Jan 07 15:45:13 hagbard postgres[2500]: [1-1] LOG: database system is ready to accept connections
-
-
-Or to get all messages since the last reboot that have at least a
-“critical” severity level:
-
-
-$ journalctl -b -p crit
-Dec 17 21:08:06 mandark sudo[3673]: pam_unix(sudo:auth): auth could not identify password for [alice]
-Dec 29 01:30:22 mandark kernel[6131]: [1053513.909444] CPU6: Core temperature above threshold, cpu clock throttled (total events = 1)
-
-
-
-
-The system journal is readable by root and by users in the
-wheel and systemd-journal
-groups. All users have a private journal that can be read using
-journalctl.
-
-
-
-
-
-
-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
-different location in the Nix store (/nix/store).
-You should periodically run Nix’s garbage
-collector to remove old, unreferenced packages. This is
-easy:
-
-
-$ nix-collect-garbage
-
-
-Alternatively, you can use a systemd unit that does the same in the
-background:
-
-
-$ systemctl start nix-gc.service
-
-
-You can tell NixOS in configuration.nix to run
-this unit automatically at certain points in time, for instance, every
-night at 03:15:
-
-
-nix.gc.automatic = true;
-nix.gc.dates = "03:15";
-
-
-
-
-The commands above do not remove garbage collector roots, such
-as old system configurations. Thus they do not remove the ability to
-roll back to previous configurations. The following command deletes
-old roots, removing the ability to roll back to them:
-
-$ nix-collect-garbage -d
-
-You can also do this for specific profiles, e.g.
-
-$ nix-env -p /nix/var/nix/profiles/per-user/eelco/profile --delete-generations old
-
-Note that NixOS system configurations are stored in the profile
-/nix/var/nix/profiles/system.
-
-Another way to reclaim disk space (often as much as 40% of the
-size of the Nix store) is to run Nix’s store optimiser, which seeks
-out identical files in the store and replaces them with hard links to
-a single copy.
-
-$ nix-store --optimise
-
-Since this command needs to read the entire Nix store, it can take
-quite a while to finish.
-
-
-
-
-
diff --git a/nixos/doc/manual/style.css b/nixos/doc/manual/style.css
index e2204c159e2..3118b37ead1 100644
--- a/nixos/doc/manual/style.css
+++ b/nixos/doc/manual/style.css
@@ -262,7 +262,6 @@ table.simplelist
margin-bottom: 1em;
}
-div.affiliation
-{
- font-style: italic;
-}
\ No newline at end of file
+div.navheader table, div.navfooter table {
+ box-shadow: none;
+}
diff --git a/nixos/doc/manual/troubleshooting.xml b/nixos/doc/manual/troubleshooting.xml
deleted file mode 100644
index c7d65112b64..00000000000
--- a/nixos/doc/manual/troubleshooting.xml
+++ /dev/null
@@ -1,199 +0,0 @@
-
-
-Troubleshooting
-
-
-
-
-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
-can add these parameters in the GRUB boot menu by pressing “e” to
-modify the selected boot entry and editing the line starting with
-linux. The following are some useful kernel command
-line parameters that are recognised by the NixOS boot scripts or by
-systemd:
-
-
-
- boot.shell_on_fail
- Start a root shell if something goes wrong in
- stage 1 of the boot process (the initial ramdisk). This is
- disabled by default because there is no authentication for the
- root shell.
-
-
- boot.debug1
- Start an interactive shell in stage 1 before
- anything useful has been done. That is, no modules have been
- loaded and no file systems have been mounted, except for
- /proc and
- /sys.
-
-
- boot.trace
- Print every shell command executed by the stage 1
- and 2 boot scripts.
-
-
- single
- Boot into rescue mode (a.k.a. single user mode).
- This will cause systemd to start nothing but the unit
- rescue.target, which runs
- sulogin to prompt for the root password and
- start a root login shell. Exiting the shell causes the system to
- continue with the normal boot process.
-
-
- systemd.log_level=debug systemd.log_target=console
- Make systemd very verbose and send log messages to
- the console instead of the journal.
-
-
-
-
-For more parameters recognised by systemd, see
-systemd1.
-
-If no login prompts or X11 login screens appear (e.g. due to
-hanging dependencies), you can press Alt+ArrowUp. If you’re lucky,
-this will start rescue mode (described above). (Also note that since
-most units have a 90-second timeout before systemd gives up on them,
-the agetty login prompts should appear eventually
-unless something is very wrong.)
-
-
-
-
-
-
-Maintenance mode
-
-You can enter rescue mode by running:
-
-
-$ systemctl rescue
-
-This will eventually give you a single-user root shell. Systemd will
-stop (almost) all system services. To get out of maintenance mode,
-just exit from the rescue shell.
-
-
-
-
-
-
-Rolling back configuration changes
-
-After running nixos-rebuild to switch to a
-new configuration, you may find that the new configuration doesn’t
-work very well. In that case, there are several ways to return to a
-previous configuration.
-
-First, the GRUB boot manager allows you to boot into any
-previous configuration that hasn’t been garbage-collected. These
-configurations can be found under the GRUB submenu “NixOS - All
-configurations”. This is especially useful if the new configuration
-fails to boot. After the system has booted, you can make the selected
-configuration the default for subsequent boots:
-
-
-$ /run/current-system/bin/switch-to-configuration boot
-
-
-
-Second, you can switch to the previous configuration in a running
-system:
-
-
-$ nixos-rebuild switch --rollback
-
-This is equivalent to running:
-
-
-$ /nix/var/nix/profiles/system-N-link/bin/switch-to-configuration switch
-
-where N is the number of the NixOS system
-configuration. To get a list of the available configurations, do:
-
-
-$ ls -l /nix/var/nix/profiles/system-*-link
-...
-lrwxrwxrwx 1 root root 78 Aug 12 13:54 /nix/var/nix/profiles/system-268-link -> /nix/store/202b...-nixos-13.07pre4932_5a676e4-4be1055
-
-
-
-
-
-
-
-
-
-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
-tendency to replace un-synced files with zero bytes.) NixOS tries
-hard to prevent this from happening: it performs a
-sync before switching to a new configuration, and
-Nix’s database is fully transactional. If corruption still occurs,
-you may be able to fix it automatically.
-
-If the corruption is in a path in the closure of the NixOS
-system configuration, you can fix it by doing
-
-
-$ nixos-rebuild switch --repair
-
-
-This will cause Nix to check every path in the closure, and if its
-cryptographic hash differs from the hash recorded in Nix’s database,
-the path is rebuilt or redownloaded.
-
-You can also scan the entire Nix store for corrupt paths:
-
-
-$ nix-store --verify --check-contents --repair
-
-
-Any corrupt paths will be redownloaded if they’re available in a
-binary cache; otherwise, they cannot be repaired.
-
-
-
-
-
-
-Nix network issues
-
-Nix uses a so-called binary cache to
-optimise building a package from source into downloading it as a
-pre-built binary. That is, whenever a command like
-nixos-rebuild needs a path in the Nix store, Nix
-will try to download that path from the Internet rather than build it
-from source. The default binary cache is
-http://cache.nixos.org/. If this cache is unreachable, Nix
-operations may take a long time due to HTTP connection timeouts. You
-can disable the use of the binary cache by adding , e.g.
-
-
-$ nixos-rebuild switch --option use-binary-caches false
-
-
-If you have an alternative binary cache at your disposal, you can use
-it instead:
-
-
-$ nixos-rebuild switch --option binary-caches http://my-cache.example.org/
-
-
-
-
-
-
-
-
diff --git a/nixos/lib/build-vms.nix b/nixos/lib/build-vms.nix
index 498c0a37783..50b3b424166 100644
--- a/nixos/lib/build-vms.nix
+++ b/nixos/lib/build-vms.nix
@@ -48,10 +48,11 @@ rec {
let
interfacesNumbered = zipTwoLists config.virtualisation.vlans (range 1 255);
interfaces = flip map interfacesNumbered ({ first, second }:
- nameValuePair "eth${toString second}"
- { ipAddress = "192.168.${toString first}.${toString m.second}";
- subnetMask = "255.255.255.0";
- });
+ nameValuePair "eth${toString second}" { ip4 =
+ [ { address = "192.168.${toString first}.${toString m.second}";
+ prefixLength = 24;
+ } ];
+ });
in
{ key = "ip-address";
config =
@@ -60,7 +61,7 @@ rec {
networking.interfaces = listToAttrs interfaces;
networking.primaryIPAddress =
- optionalString (interfaces != []) (head interfaces).value.ipAddress;
+ optionalString (interfaces != []) (head (head interfaces).value.ip4).address;
# Put the IP addresses of all VMs in this machine's
# /etc/hosts file. If a machine has multiple
diff --git a/nixos/lib/make-iso9660-image.sh b/nixos/lib/make-iso9660-image.sh
index 89b681ed2cd..675b5bb3514 100644
--- a/nixos/lib/make-iso9660-image.sh
+++ b/nixos/lib/make-iso9660-image.sh
@@ -78,7 +78,7 @@ done
cat pathlist | sed -e 's/=\(.*\)=\(.*\)=/\\=\1=\2\\=/' | tee pathlist.safer
-ensureDir $out/iso
+mkdir -p $out/iso
genCommand="genisoimage -iso-level 4 -r -J $bootFlags -hide-rr-moved -graft-points -path-list pathlist.safer ${volumeID:+-V $volumeID}"
if test -z "$compressImage"; then
$genCommand -o $out/iso/$isoName
@@ -87,5 +87,5 @@ else
fi
-ensureDir $out/nix-support
+mkdir -p $out/nix-support
echo $system > $out/nix-support/system
diff --git a/nixos/lib/make-system-tarball.nix b/nixos/lib/make-system-tarball.nix
index 8fed9a34882..3bd891fdbc2 100644
--- a/nixos/lib/make-system-tarball.nix
+++ b/nixos/lib/make-system-tarball.nix
@@ -15,6 +15,9 @@
# store path whose closure will be copied, and `symlink' is a
# symlink to `object' that will be added to the tarball.
storeContents ? []
+
+ # Extra tar arguments
+, extraArgs ? ""
}:
stdenv.mkDerivation {
@@ -22,7 +25,7 @@ stdenv.mkDerivation {
builder = ./make-system-tarball.sh;
buildInputs = [perl xz];
- inherit fileName pathsFromGraph;
+ inherit fileName pathsFromGraph extraArgs;
# !!! should use XML.
sources = map (x: x.source) contents;
diff --git a/nixos/lib/make-system-tarball.sh b/nixos/lib/make-system-tarball.sh
index aadd0f6428c..2eb668115a6 100644
--- a/nixos/lib/make-system-tarball.sh
+++ b/nixos/lib/make-system-tarball.sh
@@ -48,11 +48,11 @@ for ((n = 0; n < ${#objects[*]}; n++)); do
fi
done
-ensureDir $out/tarball
+mkdir -p $out/tarball
-tar cvJf $out/tarball/$fileName.tar.xz *
+tar cvJf $out/tarball/$fileName.tar.xz * $extraArgs
-ensureDir $out/nix-support
+mkdir -p $out/nix-support
echo $system > $out/nix-support/system
echo "file system-tarball $out/tarball/$fileName.tar.xz" > $out/nix-support/hydra-build-products
diff --git a/nixos/lib/test-driver/Machine.pm b/nixos/lib/test-driver/Machine.pm
index e2bd3393d87..85c2bfa88e1 100644
--- a/nixos/lib/test-driver/Machine.pm
+++ b/nixos/lib/test-driver/Machine.pm
@@ -482,7 +482,7 @@ sub screenshot {
my $name = basename($filename);
$self->nest("making screenshot ‘$name’", sub {
$self->sendMonitorCommand("screendump $tmp");
- system("convert $tmp ${filename}") == 0
+ system("pnmtopng $tmp > ${filename}") == 0
or die "cannot convert screenshot";
unlink $tmp;
}, { image => $name } );
diff --git a/nixos/lib/test-driver/log2html.xsl b/nixos/lib/test-driver/log2html.xsl
index 8e907d85ffa..0485412b4c8 100644
--- a/nixos/lib/test-driver/log2html.xsl
+++ b/nixos/lib/test-driver/log2html.xsl
@@ -9,8 +9,8 @@
-
-
+
+
Log File
diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix
index 942a2158b15..73b55ed6c06 100644
--- a/nixos/lib/testing.nix
+++ b/nixos/lib/testing.nix
@@ -27,7 +27,7 @@ rec {
cp ${./test-driver/Logger.pm} $libDir/Logger.pm
wrapProgram $out/bin/nixos-test-driver \
- --prefix PATH : "${pkgs.qemu_kvm}/bin:${pkgs.vde2}/bin:${imagemagick}/bin:${coreutils}/bin" \
+ --prefix PATH : "${qemu_kvm}/bin:${vde2}/bin:${netpbm}/bin:${coreutils}/bin" \
--prefix PERL5LIB : "${lib.makePerlPath [ perlPackages.TermReadLineGnu perlPackages.XMLWriter perlPackages.IOTty ]}:$out/lib/perl5/site_perl"
'';
};
@@ -37,11 +37,11 @@ rec {
# `driver' is the script that runs the network.
runTests = driver:
stdenv.mkDerivation {
- name = "vm-test-run";
+ name = "vm-test-run-${driver.testName}";
requiredSystemFeatures = [ "kvm" "nixos-test" ];
- buildInputs = [ pkgs.libxslt ];
+ buildInputs = [ libxslt ];
buildCommand =
''
@@ -53,6 +53,8 @@ rec {
xsltproc --output $out/log.html ${./test-driver/log2html.xsl} $out/log.xml
ln -s ${./test-driver/logfile.css} $out/logfile.css
ln -s ${./test-driver/treebits.js} $out/treebits.js
+ ln -s ${jquery}/js/jquery.min.js $out/
+ ln -s ${jquery-ui}/js/jquery-ui.min.js $out/
touch $out/nix-support/hydra-build-products
echo "report testlog $out log.html" >> $out/nix-support/hydra-build-products
@@ -68,9 +70,10 @@ rec {
makeTest =
- { testScript, makeCoverageReport ? false, ... } @ t:
+ { testScript, makeCoverageReport ? false, name ? "unnamed", ... } @ t:
let
+ testDriverName = "nixos-test-driver-${name}";
nodes = buildVirtualNetwork (
t.nodes or (if t ? machine then { machine = t.machine; } else { }));
@@ -88,10 +91,11 @@ rec {
# 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"
+ driver = runCommand testDriverName
{ buildInputs = [ makeWrapper];
testScript = testScript';
preferLocalBuild = true;
+ testName = name;
}
''
mkdir -p $out/bin
@@ -115,7 +119,7 @@ rec {
report = releaseTools.gcovReport { coverageRuns = [ test ]; };
- in (if makeCoverageReport then report else test) // { inherit driver test; };
+ in (if makeCoverageReport then report else test) // { inherit nodes driver test; };
runInMachine =
@@ -149,7 +153,7 @@ rec {
startAll;
$client->waitForUnit("multi-user.target");
${preBuild}
- $client->succeed("env -i ${pkgs.bash}/bin/bash ${buildrunner} /tmp/xchg/saved-env >&2");
+ $client->succeed("env -i ${bash}/bin/bash ${buildrunner} /tmp/xchg/saved-env >&2");
${postBuild}
$client->succeed("sync"); # flush all data before pulling the plug
'';
diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix
index 35c56e8c32b..7b8be2050c1 100644
--- a/nixos/lib/utils.nix
+++ b/nixos/lib/utils.nix
@@ -5,6 +5,7 @@ rec {
# Escape a path according to the systemd rules, e.g. /dev/xyzzy
# becomes dev-xyzzy. FIXME: slow.
escapeSystemdPath = s:
- replaceChars ["/" "-" " "] ["-" "\\x2d" "\\x20"] (substring 1 (stringLength s) s);
+ replaceChars ["/" "-" " "] ["-" "\\x2d" "\\x20"]
+ (if hasPrefix "/" s then substring 1 (stringLength s) s else s);
}
diff --git a/nixos/maintainers/scripts/azure/create-azure.sh b/nixos/maintainers/scripts/azure/create-azure.sh
new file mode 100755
index 00000000000..f87a88404f6
--- /dev/null
+++ b/nixos/maintainers/scripts/azure/create-azure.sh
@@ -0,0 +1,11 @@
+#! /bin/sh -e
+
+BUCKET_NAME=${BUCKET_NAME:-nixos}
+export NIX_PATH=nixpkgs=../../../..
+export NIXOS_CONFIG=$(dirname $(readlink -f $0))/../../../modules/virtualisation/azure-image.nix
+export TIMESTAMP=$(date +%Y%m%d%H%M)
+
+nix-build '' \
+ -A config.system.build.azureImage --argstr system x86_64-linux -o azure --option extra-binary-caches http://hydra.nixos.org -j 10
+
+azure vm image create nixos-test --location "West Europe" --md5-skip -v --os Linux azure/disk.vhd
diff --git a/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix b/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix
index d9feba164a7..530769cec5b 100644
--- a/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix
+++ b/nixos/maintainers/scripts/ec2/amazon-hvm-install-config.nix
@@ -19,7 +19,8 @@ in
{
imports = [ ./amazon-base-config.nix ];
ec2.hvm = true;
- boot.loader.grub.device = lib.mkOverride 0 "nodev";
+ boot.loader.grub.device = lib.mkOverride 0 "/dev/xvdg";
+ boot.kernelParams = [ "console=ttyS0" ];
boot.initrd.extraUtilsCommands = ''
cp -v ${pkgs.gawk}/bin/gawk $out/bin/gawk
diff --git a/nixos/maintainers/scripts/ec2/create-ebs-amis.py b/nixos/maintainers/scripts/ec2/create-ebs-amis.py
index 14607b9a367..62525651ae0 100755
--- a/nixos/maintainers/scripts/ec2/create-ebs-amis.py
+++ b/nixos/maintainers/scripts/ec2/create-ebs-amis.py
@@ -19,8 +19,17 @@ parser.add_argument('--key', dest='key_name', action='store_true', help='Keypair
args = parser.parse_args()
instance_type = "m3.medium" if args.hvm else "m1.small"
-ebs_size = 8 if args.hvm else 20
+if args.hvm:
+ virtualization_type = "hvm"
+ root_block = "/dev/sda1"
+ image_type = 'hvm'
+else:
+ virtualization_type = "paravirtual"
+ root_block = "/dev/sda"
+ image_type = 'ebs'
+
+ebs_size = 20
# Start a NixOS machine in the given region.
f = open("ebs-creator-config.nix", "w")
@@ -76,10 +85,6 @@ if args.hvm:
m.upload_file("./amazon-hvm-config.nix", "/mnt/etc/nixos/configuration.nix")
m.upload_file("./amazon-hvm-install-config.nix", "/mnt/etc/nixos/amazon-hvm-install-config.nix")
m.run_command("NIXOS_CONFIG=/etc/nixos/amazon-hvm-install-config.nix nixos-install")
- m.run_command('nix-env -iA nixos.pkgs.grub')
- m.run_command('cp /nix/store/*-grub-0.97*/lib/grub/i386-pc/* /mnt/boot/grub')
- m.run_command('echo "(hd1) /dev/xvdg" > device.map')
- m.run_command('echo -e "root (hd1,0)\nsetup (hd1)" | grub --device-map=device.map --batch')
else:
m.upload_file("./amazon-base-config.nix", "/mnt/etc/nixos/configuration.nix")
m.run_command("nixos-install")
@@ -87,7 +92,7 @@ else:
m.run_command("umount /mnt")
if args.hvm:
- ami_name = "nixos-{0}-x86_64-ebs-hvm".format(version)
+ ami_name = "nixos-{0}-x86_64-hvm".format(version)
description = "NixOS {0} (x86_64; EBS root; hvm)".format(version)
else:
ami_name = "nixos-{0}-x86_64-ebs".format(version)
@@ -102,58 +107,40 @@ def check():
m.connect()
volume = m._conn.get_all_volumes([], filters={'attachment.instance-id': m.resource_id, 'attachment.device': "/dev/sdg"})[0]
-if args.hvm:
- instance = m._conn.run_instances( image_id="ami-5f491f36"
- , instance_type=instance_type
- , key_name=args.key_name
- , placement=m.zone
- , security_groups=["eelco-test"]).instances[0]
- nixops.util.check_wait(lambda: instance.update() == 'running', max_tries=120)
- instance.stop()
- nixops.util.check_wait(lambda: instance.update() == 'stopped', max_tries=120)
- old_root_volume = m._conn.get_all_volumes([], filters={'attachment.instance-id': instance.id, 'attachment.device': "/dev/sda1"})[0]
- old_root_volume.detach()
- volume.detach()
- nixops.util.check_wait(lambda: volume.update() == 'available', max_tries=120)
- nixops.util.check_wait(lambda: old_root_volume.update() == 'available', max_tries=120)
- volume.attach(instance.id, '/dev/sda1')
- nixops.util.check_wait(lambda: volume.update() == 'in-use', max_tries=120)
- ami_id = m._conn.create_image(instance.id, ami_name, description)
- time.sleep(5)
- image = m._conn.get_all_images([ami_id])[0]
- nixops.util.check_wait(lambda: image.update() == 'available', max_tries=120)
- instance.terminate()
+# Create a snapshot.
+snapshot = volume.create_snapshot(description=description)
+print >> sys.stderr, "created snapshot {0}".format(snapshot.id)
-else:
- # Create a snapshot.
- snapshot = volume.create_snapshot(description=description)
- print >> sys.stderr, "created snapshot {0}".format(snapshot.id)
+nixops.util.check_wait(check, max_tries=120)
- nixops.util.check_wait(check, max_tries=120)
+m._conn.create_tags([snapshot.id], {'Name': ami_name})
- m._conn.create_tags([snapshot.id], {'Name': ami_name})
+if not args.keep: depl.destroy_resources()
- if not args.keep: depl.destroy_resources()
+# Register the image.
+aki = m._conn.get_all_images(filters={'manifest-location': 'ec2*pv-grub-hd0_1.03-x86_64*'})[0]
+print >> sys.stderr, "using kernel image {0} - {1}".format(aki.id, aki.location)
- # Register the image.
- aki = m._conn.get_all_images(filters={'manifest-location': '*pv-grub-hd0_1.03-x86_64*'})[0]
- print >> sys.stderr, "using kernel image {0} - {1}".format(aki.id, aki.location)
+block_map = BlockDeviceMapping()
+block_map[root_block] = BlockDeviceType(snapshot_id=snapshot.id, delete_on_termination=True, size=ebs_size, volume_type="gp2")
+block_map['/dev/sdb'] = BlockDeviceType(ephemeral_name="ephemeral0")
+block_map['/dev/sdc'] = BlockDeviceType(ephemeral_name="ephemeral1")
+block_map['/dev/sdd'] = BlockDeviceType(ephemeral_name="ephemeral2")
+block_map['/dev/sde'] = BlockDeviceType(ephemeral_name="ephemeral3")
- block_map = BlockDeviceMapping()
- block_map['/dev/sda'] = BlockDeviceType(snapshot_id=snapshot.id, delete_on_termination=True)
- block_map['/dev/sdb'] = BlockDeviceType(ephemeral_name="ephemeral0")
- block_map['/dev/sdc'] = BlockDeviceType(ephemeral_name="ephemeral1")
- block_map['/dev/sdd'] = BlockDeviceType(ephemeral_name="ephemeral2")
- block_map['/dev/sde'] = BlockDeviceType(ephemeral_name="ephemeral3")
-
- ami_id = m._conn.register_image(
+common_args = dict(
name=ami_name,
description=description,
architecture="x86_64",
- root_device_name="/dev/sda",
- kernel_id=aki.id,
- block_device_map=block_map)
+ root_device_name=root_block,
+ block_device_map=block_map,
+ virtualization_type=virtualization_type,
+ delete_root_volume_on_termination=True
+ )
+if not args.hvm:
+ common_args['kernel_id']=aki.id
+ami_id = m._conn.register_image(**common_args)
print >> sys.stderr, "registered AMI {0}".format(ami_id)
@@ -197,17 +184,12 @@ test_depl.nix_exprs = [os.path.abspath("./ebs-test.nix")]
test_depl.deploy(create_only=True)
test_depl.machines['machine'].run_command("nixos-version")
-if args.hvm:
- image_type = 'hvm'
-else:
- image_type = 'ebs'
-
# Log the AMI ID.
f = open("{0}.{1}.ami-id".format(args.region, image_type), "w")
f.write("{0}".format(ami_id))
f.close()
-for dest in [ 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', 'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'sa-east-1']:
+for dest in [ 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', 'eu-central-1', 'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'sa-east-1']:
if args.region != dest:
print >> sys.stderr, "copying image from region {0} to {1}".format(args.region, dest)
conn = boto.ec2.connect_to_region(dest)
diff --git a/nixos/maintainers/scripts/gce/create-gce.sh b/nixos/maintainers/scripts/gce/create-gce.sh
index 8bf36f33c7d..fc476fb6e40 100755
--- a/nixos/maintainers/scripts/gce/create-gce.sh
+++ b/nixos/maintainers/scripts/gce/create-gce.sh
@@ -1,5 +1,6 @@
#! /bin/sh -e
+BUCKET_NAME=${BUCKET_NAME:-nixos}
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)
@@ -8,7 +9,7 @@ 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)
+if ! gsutil ls gs://${BUCKET_NAME}/$(basename $img); then
+ gsutil cp $img gs://${BUCKET_NAME}/$(basename $img)
fi
-gcutil addimage $(basename $img .raw.tar.gz | sed 's|\.|-|' | sed 's|_|-|') gs://nixos/$(basename $img)
+gcloud compute images create $(basename $img .raw.tar.gz | sed 's|\.|-|' | sed 's|_|-|') --source-uri gs://${BUCKET_NAME}/$(basename $img)
diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix
index cf70ca264d6..2d7549aab6d 100644
--- a/nixos/modules/config/fonts/fontconfig.nix
+++ b/nixos/modules/config/fonts/fontconfig.nix
@@ -27,9 +27,11 @@ with lib;
config = mkIf config.fonts.enableFontConfig {
- # Bring in the default (upstream) fontconfig configuration.
+ # Fontconfig 2.10 backward compatibility
+
+ # Bring in the default (upstream) fontconfig configuration, only for fontconfig 2.10
environment.etc."fonts/fonts.conf".source =
- pkgs.makeFontsConf { fontDirectories = config.fonts.fonts; };
+ pkgs.makeFontsConf { fontconfig = pkgs.fontconfig_210; fontDirectories = config.fonts.fonts; };
environment.etc."fonts/conf.d/00-nixos.conf".text =
''
@@ -47,10 +49,26 @@ with lib;
'';
- # FIXME: This variable is no longer needed, but we'll keep it
- # around for a while for applications linked against old
- # fontconfig builds.
- environment.variables.FONTCONFIG_FILE = "/etc/fonts/fonts.conf";
+ # Versioned fontconfig > 2.10. Only specify font directories.
+
+ environment.etc."fonts/${pkgs.fontconfig.configVersion}/conf.d/00-nixos.conf".text =
+ ''
+
+
+
+
+
+
+
+ hintslight
+
+
+
+
+ ${concatStringsSep "\n" (map (font: "${font}") config.fonts.fonts)}
+
+
+ '';
environment.systemPackages = [ pkgs.fontconfig ];
diff --git a/nixos/modules/config/fonts/fonts.nix b/nixos/modules/config/fonts/fonts.nix
index 49b1e1d42a3..baf5b7713f5 100644
--- a/nixos/modules/config/fonts/fonts.nix
+++ b/nixos/modules/config/fonts/fonts.nix
@@ -11,16 +11,8 @@ with lib;
# TODO: find another name for it.
fonts = mkOption {
type = types.listOf types.path;
- example = [ pkgs.dejavu_fonts ];
+ example = literalExample "[ pkgs.dejavu_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"
- ];
};
};
diff --git a/nixos/modules/config/gtk-exe-env.nix b/nixos/modules/config/gtk-exe-env.nix
new file mode 100644
index 00000000000..b565072e3a7
--- /dev/null
+++ b/nixos/modules/config/gtk-exe-env.nix
@@ -0,0 +1,41 @@
+{ config, pkgs, lib, ... }:
+
+{
+ imports = [
+ ];
+
+ options = {
+ gtkPlugins = lib.mkOption {
+ type = lib.types.listOf lib.types.path;
+ default = [];
+ description = ''
+ Plugin packages for GTK+ such as input methods.
+ '';
+ };
+ };
+
+ config = {
+ environment.variables = if builtins.length config.gtkPlugins > 0
+ then
+ let
+ paths = [ pkgs.gtk2 pkgs.gtk3 ] ++ config.gtkPlugins;
+ env = pkgs.buildEnv {
+ name = "gtk-exe-env";
+
+ inherit paths;
+
+ postBuild = lib.concatStringsSep "\n"
+ (map (d: d.gtkExeEnvPostBuild or "") paths);
+
+ ignoreCollisions = true;
+ };
+ in {
+ GTK_EXE_PREFIX = builtins.toString env;
+ GTK_PATH = [
+ "${env}/lib/gtk-2.0"
+ "${env}/lib/gtk-3.0"
+ ];
+ }
+ else {};
+ };
+}
diff --git a/nixos/modules/config/ldap.nix b/nixos/modules/config/ldap.nix
index 8171f460385..1a01533c585 100644
--- a/nixos/modules/config/ldap.nix
+++ b/nixos/modules/config/ldap.nix
@@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
-with lib;
with pkgs;
+with lib;
let
@@ -217,9 +217,7 @@ in
systemd.services = mkIf cfg.daemon.enable {
nslcd = {
- wantedBy = [ "nss-user-lookup.target" ];
- before = [ "nss-user-lookup.target" ];
- after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
preStart = ''
mkdir -p /run/nslcd
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix
index 43717697ebd..136a5bda745 100644
--- a/nixos/modules/config/networking.nix
+++ b/nixos/modules/config/networking.nix
@@ -7,6 +7,9 @@ with lib;
let
cfg = config.networking;
+ dnsmasqResolve = config.services.dnsmasq.enable &&
+ config.services.dnsmasq.resolveLocalQueries;
+ hasLocalResolver = config.services.bind.enable || dnsmasqResolve;
in
@@ -14,7 +17,7 @@ in
options = {
- networking.extraHosts = pkgs.lib.mkOption {
+ networking.extraHosts = lib.mkOption {
type = types.lines;
default = "";
example = "192.168.0.1 lanlocalhost";
@@ -23,7 +26,7 @@ in
'';
};
- networking.dnsSingleRequest = pkgs.lib.mkOption {
+ networking.dnsSingleRequest = lib.mkOption {
type = types.bool;
default = false;
description = ''
@@ -74,9 +77,12 @@ in
'' + optionalString cfg.dnsSingleRequest ''
# only send one DNS request at a time
resolv_conf_options='single-request'
- '' + optionalString config.services.bind.enable ''
+ '' + optionalString hasLocalResolver ''
# This hosts runs a full-blown DNS resolver.
name_servers='127.0.0.1'
+ '' + optionalString dnsmasqResolve ''
+ dnsmasq_conf=/etc/dnsmasq-conf.conf
+ dnsmasq_resolv=/etc/dnsmasq-resolv.conf
'';
};
diff --git a/nixos/modules/config/nsswitch.nix b/nixos/modules/config/nsswitch.nix
index 45695d9cb89..549e731f3b0 100644
--- a/nixos/modules/config/nsswitch.nix
+++ b/nixos/modules/config/nsswitch.nix
@@ -35,29 +35,27 @@ in
config = {
- environment.etc =
- [ # Name Service Switch configuration file. Required by the C library.
- # !!! Factor out the mdns stuff. The avahi module should define
- # an option used by this module.
- { source = pkgs.writeText "nsswitch.conf"
- ''
- passwd: files ldap
- group: files ldap
- shadow: files ldap
- hosts: files ${optionalString nssmdns "mdns_minimal [NOTFOUND=return]"} dns ${optionalString nssmdns "mdns"} ${optionalString nsswins "wins"} myhostname
- networks: files dns
- ethers: files
- services: files
- protocols: files
- '';
- target = "nsswitch.conf";
- }
- ];
+ # Name Service Switch configuration file. Required by the C
+ # library. !!! Factor out the mdns stuff. The avahi module
+ # should define an option used by this module.
+ environment.etc."nsswitch.conf".text =
+ ''
+ passwd: files ldap
+ group: files ldap
+ shadow: files ldap
+ hosts: files ${optionalString nssmdns "mdns_minimal [NOTFOUND=return]"} dns ${optionalString nssmdns "mdns"} ${optionalString nsswins "wins"} myhostname mymachines
+ networks: files dns
+ ethers: files
+ services: files
+ protocols: files
+ '';
- # Use nss-myhostname to ensure that our hostname always resolves to
- # a valid IP address. It returns all locally configured IP
- # addresses, or ::1 and 127.0.0.2 as fallbacks.
- system.nssModules = [ pkgs.systemd ];
+ # Systemd provides nss-myhostname to ensure that our hostname
+ # always resolves to a valid IP address. It returns all locally
+ # configured IP addresses, or ::1 and 127.0.0.2 as
+ # fallbacks. Systemd also provides nss-mymachines to return IP
+ # addresses of local containers.
+ system.nssModules = [ config.systemd.package ];
};
}
diff --git a/nixos/modules/config/power-management.nix b/nixos/modules/config/power-management.nix
index 17f3ed00b9b..32a7987617a 100644
--- a/nixos/modules/config/power-management.nix
+++ b/nixos/modules/config/power-management.nix
@@ -35,7 +35,9 @@ in
powerUpCommands = mkOption {
type = types.lines;
default = "";
- example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda";
+ example = literalExample ''
+ "''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"
+ '';
description =
''
Commands executed when the machine powers up. That is,
@@ -47,7 +49,9 @@ in
powerDownCommands = mkOption {
type = types.lines;
default = "";
- example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda";
+ example = literalExample ''
+ "''${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"
+ '';
description =
''
Commands executed when the machine powers down. That is,
diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix
index 9802b898a5d..8b38489a8c1 100644
--- a/nixos/modules/config/pulseaudio.nix
+++ b/nixos/modules/config/pulseaudio.nix
@@ -1,7 +1,7 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, pkgs_i686, ... }:
-with lib;
with pkgs;
+with lib;
let
@@ -10,10 +10,16 @@ let
systemWide = cfg.enable && cfg.systemWide;
nonSystemWide = cfg.enable && !cfg.systemWide;
- uid = config.ids.uids.pulseaudio;
- gid = config.ids.gids.pulseaudio;
+ # Forces 32bit pulseaudio and alsaPlugins to be built/supported for apps
+ # using 32bit alsa on 64bit linux.
+ enable32BitAlsaPlugins = stdenv.isx86_64 && (pkgs_i686.alsaLib != null && pkgs_i686.pulseaudio != null);
- stateDir = "/run/pulse";
+ ids = config.ids;
+
+ uid = ids.uids.pulseaudio;
+ gid = ids.gids.pulseaudio;
+
+ stateDir = "/var/run/pulse";
# Create pulse/client.conf even if PulseAudio is disabled so
# that we can disable the autospawn feature in programs that
@@ -26,21 +32,25 @@ let
# Write an /etc/asound.conf that causes all ALSA applications to
# be re-routed to the PulseAudio server through ALSA's Pulse
# plugin.
- alsaConf = writeText "asound.conf" ''
+ alsaConf = writeText "asound.conf" (''
pcm_type.pulse {
- lib ${alsaPlugins}/lib/alsa-lib/libasound_module_pcm_pulse.so
+ libs.native = ${pkgs.alsaPlugins}/lib/alsa-lib/libasound_module_pcm_pulse.so ;
+ ${lib.optionalString enable32BitAlsaPlugins
+ "libs.32Bit = ${pkgs_i686.alsaPlugins}/lib/alsa-lib/libasound_module_pcm_pulse.so ;"}
}
pcm.!default {
type pulse
hint.description "Default Audio Device (via PulseAudio)"
}
ctl_type.pulse {
- lib ${alsaPlugins}/lib/alsa-lib/libasound_module_ctl_pulse.so
+ libs.native = ${alsaPlugins}/lib/alsa-lib/libasound_module_ctl_pulse.so ;
+ ${lib.optionalString enable32BitAlsaPlugins
+ "libs.32Bit = ${pkgs_i686.alsaPlugins}/lib/alsa-lib/libasound_module_ctl_pulse.so ;"}
}
ctl.!default {
type pulse
}
- '';
+ '');
in {
@@ -69,8 +79,7 @@ in {
};
configFile = mkOption {
- type = types.uniq types.path;
- default = "${cfg.package}/etc/pulse/default.pa";
+ type = types.path;
description = ''
The path to the configuration the PulseAudio server
should use. By default, the "default.pa" configuration
@@ -80,12 +89,12 @@ in {
package = mkOption {
type = types.package;
- default = pulseaudio;
- example = literalExample "pulseaudio.override { jackaudioSupport = true; }";
+ default = pulseaudioFull;
+ example = literalExample "pkgs.pulseaudioFull";
description = ''
- The PulseAudio derivation to use. This can be used to enable
- features (such as JACK support) that are not enabled in the
- default PulseAudio in Nixpkgs.
+ The PulseAudio derivation to use. This can be used to disable
+ features (such as JACK support, Bluetooth) that are enabled in the
+ pulseaudioFull package in Nixpkgs.
'';
};
@@ -110,10 +119,14 @@ in {
target = "pulse/client.conf";
source = clientConf;
};
+
+ hardware.pulseaudio.configFile = mkDefault "${cfg.package}/etc/pulse/default.pa";
}
(mkIf cfg.enable {
- environment.systemPackages = [ cfg.package ];
+ environment.systemPackages = [
+ cfg.package
+ ] ++ lib.optionals enable32BitAlsaPlugins [ pkgs_i686.pulseaudio ];
environment.etc = singleton {
target = "asound.conf";
@@ -138,6 +151,8 @@ in {
group = "pulse";
extraGroups = [ "audio" ];
description = "PulseAudio system service user";
+ home = stateDir;
+ createHome = true;
};
users.extraGroups.pulse.gid = gid;
@@ -147,10 +162,6 @@ in {
wantedBy = [ "sound.target" ];
before = [ "sound.target" ];
environment.PULSE_RUNTIME_PATH = stateDir;
- preStart = ''
- 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/qt-plugin-env.nix b/nixos/modules/config/qt-plugin-env.nix
new file mode 100644
index 00000000000..c5986560416
--- /dev/null
+++ b/nixos/modules/config/qt-plugin-env.nix
@@ -0,0 +1,37 @@
+{ config, pkgs, lib, ... }:
+
+{
+ imports = [
+ ];
+
+ options = {
+ qtPlugins = lib.mkOption {
+ type = lib.types.listOf lib.types.path;
+ default = [];
+ description = ''
+ Plugin packages for Qt such as input methods.
+ '';
+ };
+ };
+
+ config = {
+ environment.variables = if builtins.length config.qtPlugins > 0
+ then
+ let
+ paths = [ pkgs.qt48 ] ++ config.qtPlugins;
+ env = pkgs.buildEnv {
+ name = "qt-plugin-env";
+
+ inherit paths;
+
+ postBuild = lib.concatStringsSep "\n"
+ (map (d: d.qtPluginEnvPostBuild or "") paths);
+
+ ignoreCollisions = true;
+ };
+ in {
+ QT_PLUGIN_PATH = [ (builtins.toString env) ];
+ }
+ else {};
+ };
+}
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index cc079cdc585..e5b342afcc4 100644
--- a/nixos/modules/config/shells-environment.nix
+++ b/nixos/modules/config/shells-environment.nix
@@ -9,6 +9,23 @@ let
cfg = config.environment;
+ exportedEnvVars =
+ let
+ absoluteVariables =
+ mapAttrs (n: toList) cfg.variables;
+
+ suffixedVariables =
+ flip mapAttrs cfg.profileRelativeEnvVars (envVar: listSuffixes:
+ concatMap (profile: map (suffix: "${profile}${suffix}") listSuffixes) cfg.profiles
+ );
+
+ allVariables =
+ zipAttrsWith (n: concatLists) [ absoluteVariables suffixedVariables ];
+
+ exportVariables =
+ mapAttrsToList (n: v: ''export ${n}="${concatStringsSep ":" v}"'') allVariables;
+ in
+ concatStringsSep "\n" exportVariables;
in
{
@@ -49,22 +66,15 @@ in
type = types.listOf types.string;
};
- environment.profileVariables = mkOption {
- default = (p: {});
+ environment.profileRelativeEnvVars = mkOption {
+ type = types.attrsOf (types.listOf types.str);
+ example = { PATH = [ "/bin" "/sbin" ]; MANPATH = [ "/man" "/share/man" ]; };
description = ''
- A function which given a profile path should give back
- a set of environment variables for that profile.
+ Attribute set of environment variable. Each attribute maps to a list
+ of relative paths. Each relative path is appended to the each profile
+ of to form the content of the
+ corresponding environment variable.
'';
- # !!! this should be of the following type:
- #type = types.functionTo (types.attrsOf (types.optionSet envVar));
- # and envVar should be changed to something more like environOpts.
- # Having unique `value' _or_ multiple `list' is much more useful
- # than just sticking everything together with ':' unconditionally.
- # Anyway, to have this type mentioned above
- # types.optionSet needs to be transformed into a type constructor
- # (it has a !!! mark on that in nixpkgs)
- # for now we hack all this to be
- type = types.functionTo (types.attrsOf (types.listOf types.string));
};
# !!! isn't there a better way?
@@ -122,7 +132,9 @@ in
environment.binsh = mkOption {
default = "${config.system.build.binsh}/bin/sh";
- example = "\${pkgs.dash}/bin/dash";
+ example = literalExample ''
+ "''${pkgs.dash}/bin/dash"
+ '';
type = types.path;
description = ''
The shell executable that is linked system-wide to
@@ -163,10 +175,7 @@ in
system.build.setEnvironment = pkgs.writeText "set-environment"
''
- ${concatStringsSep "\n" (
- (mapAttrsToList (n: v: ''export ${n}="${concatStringsSep ":" v}"'')
- # This line is a kind of a hack because of !!! note above
- (zipAttrsWith (const concatLists) ([ (mapAttrs (n: v: [ v ]) cfg.variables) ] ++ map cfg.profileVariables cfg.profiles))))}
+ ${exportedEnvVars}
${cfg.extraInit}
diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix
index ac1c32387c5..1dc7ebb96af 100644
--- a/nixos/modules/config/swap.nix
+++ b/nixos/modules/config/swap.nix
@@ -1,7 +1,7 @@
{ config, lib, pkgs, utils, ... }:
-with lib;
with utils;
+with lib;
{
diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix
index 54236021919..3b6ccd380c7 100644
--- a/nixos/modules/config/sysctl.nix
+++ b/nixos/modules/config/sysctl.nix
@@ -6,8 +6,12 @@ let
sysctlOption = mkOptionType {
name = "sysctl option value";
- check = x: isBool x || isString x || isInt x || isNull x;
- merge = args: defs: (last defs).value; # FIXME: hacky way to allow overriding in configuration.nix.
+ check = val:
+ let
+ checkType = x: isBool x || isString x || isInt x || isNull x;
+ in
+ checkType val || (val._type or "" == "override" && checkType val.content);
+ merge = loc: defs: mergeOneOption loc (filterOverrides defs);
};
in
diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix
index 2ea998bbb63..f3e86bfd201 100644
--- a/nixos/modules/config/system-path.nix
+++ b/nixos/modules/config/system-path.nix
@@ -63,7 +63,7 @@ in
systemPackages = mkOption {
type = types.listOf types.path;
default = [];
- example = "[ pkgs.icecat3 pkgs.thunderbird ]";
+ example = literalExample "[ pkgs.firefox pkgs.thunderbird ]";
description = ''
The set of packages that appear in
/run/current-system/sw. These packages are
@@ -110,6 +110,7 @@ in
"/man"
"/sbin"
"/share/emacs"
+ "/share/vim-plugins"
"/share/org"
"/share/info"
"/share/terminfo"
diff --git a/nixos/modules/config/unix-odbc-drivers.nix b/nixos/modules/config/unix-odbc-drivers.nix
index b725e6cae73..98929392ace 100644
--- a/nixos/modules/config/unix-odbc-drivers.nix
+++ b/nixos/modules/config/unix-odbc-drivers.nix
@@ -27,7 +27,7 @@ with lib;
environment.etc."odbcinst.ini".text =
let inis = config.environment.unixODBCDrivers;
- in pkgs.lib.concatStringsSep "\n" inis;
+ in lib.concatStringsSep "\n" inis;
};
diff --git a/nixos/modules/config/update-users-groups.pl b/nixos/modules/config/update-users-groups.pl
new file mode 100644
index 00000000000..abcb082af8e
--- /dev/null
+++ b/nixos/modules/config/update-users-groups.pl
@@ -0,0 +1,239 @@
+use strict;
+use File::Path qw(make_path);
+use File::Slurp;
+use JSON;
+
+make_path("/var/lib/nixos", { mode => 0755 });
+
+
+sub hashPassword {
+ my ($password) = @_;
+ my $salt = "";
+ my @chars = ('.', '/', 0..9, 'A'..'Z', 'a'..'z');
+ $salt .= $chars[rand 64] for (1..8);
+ return crypt($password, '$6$' . $salt . '$');
+}
+
+
+# Functions for allocating free GIDs/UIDs. FIXME: respect ID ranges in
+# /etc/login.defs.
+sub allocId {
+ my ($used, $idMin, $idMax, $up, $getid) = @_;
+ my $id = $up ? $idMin : $idMax;
+ while ($id >= $idMin && $id <= $idMax) {
+ if (!$used->{$id} && !defined &$getid($id)) {
+ $used->{$id} = 1;
+ return $id;
+ }
+ $used->{$id} = 1;
+ if ($up) { $id++; } else { $id--; }
+ }
+ die "$0: out of free UIDs or GIDs\n";
+}
+
+my (%gidsUsed, %uidsUsed);
+
+sub allocGid {
+ return allocId(\%gidsUsed, 400, 499, 0, sub { my ($gid) = @_; getgrgid($gid) });
+}
+
+sub allocUid {
+ my ($isSystemUser) = @_;
+ my ($min, $max, $up) = $isSystemUser ? (400, 499, 0) : (1000, 29999, 1);
+ return allocId(\%uidsUsed, $min, $max, $up, sub { my ($uid) = @_; getpwuid($uid) });
+}
+
+
+# Read the declared users/groups.
+my $spec = decode_json(read_file($ARGV[0]));
+
+# Don't allocate UIDs/GIDs that are already in use.
+foreach my $g (@{$spec->{groups}}) {
+ $gidsUsed{$g->{gid}} = 1 if defined $g->{gid};
+}
+
+foreach my $u (@{$spec->{groups}}) {
+ $uidsUsed{$u->{u}} = 1 if defined $u->{uid};
+}
+
+# Read the current /etc/group.
+sub parseGroup {
+ chomp;
+ my @f = split(':', $_, -4);
+ my $gid = $f[2] eq "" ? undef : int($f[2]);
+ $gidsUsed{$gid} = 1 if defined $gid;
+ return ($f[0], { name => $f[0], password => $f[1], gid => $gid, members => $f[3] });
+}
+
+my %groupsCur = -f "/etc/group" ? map { parseGroup } read_file("/etc/group") : ();
+
+# Read the current /etc/passwd.
+sub parseUser {
+ chomp;
+ my @f = split(':', $_, -7);
+ my $uid = $f[2] eq "" ? undef : int($f[2]);
+ $uidsUsed{$uid} = 1 if defined $uid;
+ return ($f[0], { name => $f[0], fakePassword => $f[1], uid => $uid,
+ gid => $f[3], description => $f[4], home => $f[5], shell => $f[6] });
+}
+
+my %usersCur = -f "/etc/passwd" ? map { parseUser } read_file("/etc/passwd") : ();
+
+# Read the groups that were created declaratively (i.e. not by groups)
+# in the past. These must be removed if they are no longer in the
+# current spec.
+my $declGroupsFile = "/var/lib/nixos/declarative-groups";
+my %declGroups;
+$declGroups{$_} = 1 foreach split / /, -e $declGroupsFile ? read_file($declGroupsFile) : "";
+
+# Idem for the users.
+my $declUsersFile = "/var/lib/nixos/declarative-users";
+my %declUsers;
+$declUsers{$_} = 1 foreach split / /, -e $declUsersFile ? read_file($declUsersFile) : "";
+
+
+# Generate a new /etc/group containing the declared groups.
+my %groupsOut;
+foreach my $g (@{$spec->{groups}}) {
+ my $name = $g->{name};
+ my $existing = $groupsCur{$name};
+
+ my %members = map { ($_, 1) } @{$g->{members}};
+
+ if (defined $existing) {
+ $g->{gid} = $existing->{gid} if !defined $g->{gid};
+ if ($g->{gid} != $existing->{gid}) {
+ warn "warning: not applying GID change of group ‘$name’\n";
+ $g->{gid} = $existing->{gid};
+ }
+ $g->{password} = $existing->{password}; # do we want this?
+ if ($spec->{mutableUsers}) {
+ # Merge in non-declarative group members.
+ foreach my $uname (split /,/, $existing->{members} // "") {
+ $members{$uname} = 1 if !defined $declUsers{$uname};
+ }
+ }
+ } else {
+ $g->{gid} = allocGid if !defined $g->{gid};
+ $g->{password} = "x";
+ }
+
+ $g->{members} = join ",", sort(keys(%members));
+ $groupsOut{$name} = $g;
+}
+
+# Update the persistent list of declarative groups.
+write_file($declGroupsFile, join(" ", sort(keys %groupsOut)));
+
+# Merge in the existing /etc/group.
+foreach my $name (keys %groupsCur) {
+ my $g = $groupsCur{$name};
+ next if defined $groupsOut{$name};
+ if (!$spec->{mutableUsers} || defined $declGroups{$name}) {
+ print STDERR "removing group ‘$name’\n";
+ } else {
+ $groupsOut{$name} = $g;
+ }
+}
+
+
+# Rewrite /etc/group. FIXME: acquire lock.
+my @lines = map { join(":", $_->{name}, $_->{password}, $_->{gid}, $_->{members}) . "\n" }
+ (sort { $a->{gid} <=> $b->{gid} } values(%groupsOut));
+write_file("/etc/group.tmp", @lines);
+rename("/etc/group.tmp", "/etc/group") or die;
+system("nscd --invalidate group");
+
+# Generate a new /etc/passwd containing the declared users.
+my %usersOut;
+foreach my $u (@{$spec->{users}}) {
+ my $name = $u->{name};
+
+ # Resolve the gid of the user.
+ if ($u->{group} =~ /^[0-9]$/) {
+ $u->{gid} = $u->{group};
+ } elsif (defined $groupsOut{$u->{group}}) {
+ $u->{gid} = $groupsOut{$u->{group}}->{gid} // die;
+ } else {
+ warn "warning: user ‘$name’ has unknown group ‘$u->{group}’\n";
+ $u->{gid} = 65534;
+ }
+
+ my $existing = $usersCur{$name};
+ if (defined $existing) {
+ $u->{uid} = $existing->{uid} if !defined $u->{uid};
+ if ($u->{uid} != $existing->{uid}) {
+ warn "warning: not applying UID change of user ‘$name’\n";
+ $u->{uid} = $existing->{uid};
+ }
+ } else {
+ $u->{uid} = allocUid($u->{isSystemUser}) if !defined $u->{uid};
+
+ # Create a home directory.
+ if ($u->{createHome}) {
+ make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home};
+ chown $u->{uid}, $u->{gid}, $u->{home};
+ }
+ }
+
+ if (defined $u->{passwordFile}) {
+ if (-e $u->{passwordFile}) {
+ $u->{hashedPassword} = read_file($u->{passwordFile});
+ chomp $u->{hashedPassword};
+ } else {
+ warn "warning: password file ‘$u->{passwordFile}’ does not exist\n";
+ }
+ } elsif (defined $u->{password}) {
+ $u->{hashedPassword} = hashPassword($u->{password});
+ }
+
+ $u->{fakePassword} = $existing->{fakePassword} // "x";
+ $usersOut{$name} = $u;
+}
+
+# Update the persistent list of declarative users.
+write_file($declUsersFile, join(" ", sort(keys %usersOut)));
+
+# Merge in the existing /etc/passwd.
+foreach my $name (keys %usersCur) {
+ my $u = $usersCur{$name};
+ next if defined $usersOut{$name};
+ if (!$spec->{mutableUsers} || defined $declUsers{$name}) {
+ print STDERR "removing user ‘$name’\n";
+ } else {
+ $usersOut{$name} = $u;
+ }
+}
+
+# Rewrite /etc/passwd. FIXME: acquire lock.
+@lines = map { join(":", $_->{name}, $_->{fakePassword}, $_->{uid}, $_->{gid}, $_->{description}, $_->{home}, $_->{shell}) . "\n" }
+ (sort { $a->{uid} <=> $b->{uid} } (values %usersOut));
+write_file("/etc/passwd.tmp", @lines);
+rename("/etc/passwd.tmp", "/etc/passwd") or die;
+system("nscd --invalidate passwd");
+
+
+# Rewrite /etc/shadow to add new accounts or remove dead ones.
+my @shadowNew;
+my %shadowSeen;
+
+foreach my $line (-f "/etc/shadow" ? read_file("/etc/shadow") : ()) {
+ chomp $line;
+ my ($name, $hashedPassword, @rest) = split(':', $line, -9);
+ my $u = $usersOut{$name};;
+ next if !defined $u;
+ $hashedPassword = $u->{hashedPassword} if defined $u->{hashedPassword} && !$spec->{mutableUsers}; # FIXME
+ push @shadowNew, join(":", $name, $hashedPassword, @rest) . "\n";
+ $shadowSeen{$name} = 1;
+}
+
+foreach my $u (values %usersOut) {
+ next if defined $shadowSeen{$u->{name}};
+ my $hashedPassword = "!";
+ $hashedPassword = $u->{hashedPassword} if defined $u->{hashedPassword};
+ # FIXME: set correct value for sp_lstchg.
+ push @shadowNew, join(":", $u->{name}, $hashedPassword, "1::::::") . "\n";
+}
+
+write_file("/etc/shadow.tmp", { perms => 0600 }, @shadowNew);
+rename("/etc/shadow.tmp", "/etc/shadow") or die;
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix
index 5de81a77342..773f9b412af 100644
--- a/nixos/modules/config/users-groups.nix
+++ b/nixos/modules/config/users-groups.nix
@@ -7,9 +7,6 @@ let
ids = config.ids;
cfg = config.users;
- nonUidUsers = filterAttrs (n: u: u.createUser && u.uid == null) cfg.extraUsers;
- nonGidGroups = filterAttrs (n: g: g.gid == null) cfg.extraGroups;
-
passwordDescription = ''
The options hashedPassword,
password and passwordFile
@@ -55,10 +52,8 @@ let
type = with types; nullOr int;
default = null;
description = ''
- 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).
+ The account UID. If the UID is null, a free UID is picked on
+ activation.
'';
};
@@ -67,8 +62,7 @@ let
default = false;
description = ''
Indicates if the user is a system user or not. This option
- only has an effect if is
- true and is
+ only has an effect if is
, in which case it determines whether
the user's UID is allocated in the range for system users
(below 500) or in the range for normal users (starting at
@@ -76,6 +70,21 @@ let
'';
};
+ isNormalUser = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Indicates whether this is an account for a “real” user. This
+ automatically sets to
+ users, to
+ true, to
+ /home/username,
+ to true,
+ and to
+ false.
+ '';
+ };
+
group = mkOption {
type = types.str;
default = "nogroup";
@@ -100,6 +109,36 @@ let
description = "The path to the user's shell.";
};
+ subUidRanges = mkOption {
+ type = types.listOf types.optionSet;
+ default = [];
+ example = [
+ { startUid = 1000; count = 1; }
+ { startUid = 100001; count = 65534; }
+ ];
+ options = [ subordinateUidRange ];
+ description = ''
+ Subordinate user ids that user is allowed to use.
+ They are set into /etc/subuid and are used
+ by newuidmap for user namespaces.
+ '';
+ };
+
+ subGidRanges = mkOption {
+ type = types.listOf types.optionSet;
+ default = [];
+ example = [
+ { startGid = 100; count = 1; }
+ { startGid = 1001; count = 999; }
+ ];
+ options = [ subordinateGidRange ];
+ description = ''
+ Subordinate group ids that user is allowed to use.
+ They are set into /etc/subgid and are used
+ by newgidmap for user namespaces.
+ '';
+ };
+
createHome = mkOption {
type = types.bool;
default = false;
@@ -145,29 +184,27 @@ let
type = with types; uniq (nullOr string);
default = null;
description = ''
- The path to a file that contains the user's password. The password
+ The full path to a file that contains the user's password. The password
file is read on each system activation. The file should contain
exactly one line, which should be the password in an encrypted form
that is suitable for the chpasswd -e command.
${passwordDescription}
'';
};
-
- createUser = mkOption {
- type = types.bool;
- default = true;
- description = ''
- Indicates if the user should be created automatically as a local user.
- Set this to false if the user for instance is an LDAP user. NixOS will
- then not modify any of the basic properties for the user account.
- '';
- };
};
- config = {
- name = mkDefault name;
- shell = mkIf config.useDefaultShell (mkDefault cfg.defaultUserShell);
- };
+ config = mkMerge
+ [ { name = mkDefault name;
+ shell = mkIf config.useDefaultShell (mkDefault cfg.defaultUserShell);
+ }
+ (mkIf config.isNormalUser {
+ group = mkDefault "users";
+ createHome = mkDefault true;
+ home = mkDefault "/home/${name}";
+ useDefaultShell = mkDefault true;
+ isSystemUser = mkDefault false;
+ })
+ ];
};
@@ -187,10 +224,8 @@ let
type = with types; nullOr int;
default = null;
description = ''
- The group GID. If the mutableUsers option
- is false, the GID cannot be null. Otherwise, the GID might be
- null, in which case a free GID is picked on activation (by the
- groupadd command).
+ The group GID. If the GID is null, a free GID is picked on
+ activation.
'';
};
@@ -211,83 +246,47 @@ let
};
- getGroup = gname:
- let
- groups = mapAttrsToList (n: g: g) (
- filterAttrs (n: g: g.name == gname) cfg.extraGroups
- );
- in
- if length groups == 1 then head groups
- else if groups == [] then throw "Group ${gname} not defined"
- else throw "Group ${gname} has multiple definitions";
+ subordinateUidRange = {
+ startUid = mkOption {
+ type = types.int;
+ description = ''
+ Start of the range of subordinate user ids that user is
+ allowed to use.
+ '';
+ };
+ count = mkOption {
+ type = types.int;
+ default = 1;
+ description = ''Count of subordinate user ids'';
+ };
+ };
- getUser = uname:
- let
- users = mapAttrsToList (n: u: u) (
- filterAttrs (n: u: u.name == uname) cfg.extraUsers
- );
- in
- if length users == 1 then head users
- else if users == [] then throw "User ${uname} not defined"
- else throw "User ${uname} has multiple definitions";
+ subordinateGidRange = {
+ startGid = mkOption {
+ type = types.int;
+ description = ''
+ Start of the range of subordinate group ids that user is
+ allowed to use.
+ '';
+ };
+ count = mkOption {
+ type = types.int;
+ default = 1;
+ description = ''Count of subordinate group ids'';
+ };
+ };
- mkGroupEntry = gname:
- let
- g = getGroup gname;
- users = mapAttrsToList (n: u: u.name) (
- filterAttrs (n: u: elem g.name u.extraGroups) cfg.extraUsers
- );
- in concatStringsSep ":" [
- g.name "x" (toString g.gid)
- (concatStringsSep "," (users ++ (filter (u: !(elem u users)) g.members)))
- ];
+ mkSubuidEntry = user: concatStrings (
+ map (range: "${user.name}:${toString range.startUid}:${toString range.count}\n")
+ user.subUidRanges);
- mkPasswdEntry = uname: let u = getUser uname; in
- concatStringsSep ":" [
- u.name "x" (toString u.uid)
- (toString (getGroup u.group).gid)
- u.description u.home u.shell
- ];
+ subuidFile = concatStrings (map mkSubuidEntry (attrValues cfg.extraUsers));
- sortOn = a: sort (as1: as2: lessThan (getAttr a as1) (getAttr a as2));
+ mkSubgidEntry = user: concatStrings (
+ map (range: "${user.name}:${toString range.startGid}:${toString range.count}\n")
+ user.subGidRanges);
- groupFile = pkgs.writeText "group" (
- concatStringsSep "\n" (map (g: mkGroupEntry g.name) (
- let f = g: g.gid != null; in
- sortOn "gid" (filter f (attrValues cfg.extraGroups))
- ))
- );
-
- passwdFile = pkgs.writeText "passwd" (
- concatStringsSep "\n" (map (u: mkPasswdEntry u.name) (
- let f = u: u.createUser && (u.uid != null); in
- sortOn "uid" (filter f (attrValues cfg.extraUsers))
- ))
- );
-
- # If mutableUsers is true, this script adds all users/groups defined in
- # users.extra{Users,Groups} to /etc/{passwd,group} iff there isn't any
- # existing user/group with the same name in those files.
- # If mutableUsers is false, the /etc/{passwd,group} files will simply be
- # replaced with the users/groups defined in the NixOS configuration.
- # The merging procedure could certainly be improved, and instead of just
- # keeping the lines as-is from /etc/{passwd,group} they could be combined
- # in some way with the generated content from the NixOS configuration.
- merger = src: pkgs.writeScript "merger" ''
- #!${pkgs.bash}/bin/bash
-
- PATH=${pkgs.gawk}/bin:${pkgs.gnugrep}/bin:$PATH
-
- ${if !cfg.mutableUsers
- then ''cp ${src} $1.tmp''
- else ''awk -F: '{ print "^"$1":.*" }' $1 | egrep -vf - ${src} | cat $1 - > $1.tmp''
- }
-
- # set mtime to +1, otherwise change might go unnoticed (vipw/vigr only looks at mtime)
- touch -m -t $(date -d @$(($(stat -c %Y $1)+1)) +%Y%m%d%H%M.%S) $1.tmp
-
- mv -f $1.tmp $1
- '';
+ subgidFile = concatStrings (map mkSubgidEntry (attrValues cfg.extraUsers));
idsAreUnique = set: idAttr: !(fold (name: args@{ dup, acc }:
let
@@ -302,6 +301,21 @@ let
uidsAreUnique = idsAreUnique (filterAttrs (n: u: u.uid != null) cfg.extraUsers) "uid";
gidsAreUnique = idsAreUnique (filterAttrs (n: g: g.gid != null) cfg.extraGroups) "gid";
+ spec = pkgs.writeText "users-groups.json" (builtins.toJSON {
+ inherit (cfg) mutableUsers;
+ users = mapAttrsToList (n: u:
+ { inherit (u)
+ name uid group description home shell createHome isSystemUser
+ password passwordFile hashedPassword;
+ }) cfg.extraUsers;
+ groups = mapAttrsToList (n: g:
+ { inherit (g) name gid;
+ members = g.members ++ (mapAttrsToList (n: u: u.name) (
+ filterAttrs (n: u: elem g.name u.extraGroups) cfg.extraUsers
+ ));
+ }) cfg.extraGroups;
+ });
+
in {
###### interface
@@ -404,7 +418,7 @@ in {
uid = ids.uids.root;
description = "System administrator";
home = "/root";
- shell = cfg.defaultUserShell;
+ shell = mkDefault cfg.defaultUserShell;
group = "root";
extraGroups = [ "grsecurity" ];
hashedPassword = mkDefault config.security.initialRootPassword;
@@ -438,81 +452,29 @@ in {
grsecurity.gid = ids.gids.grsecurity;
};
- system.activationScripts.users =
- let
- mkhomeUsers = filterAttrs (n: u: u.createHome) cfg.extraUsers;
- setpwUsers = filterAttrs (n: u: u.createUser) cfg.extraUsers;
- pwFile = u: if !(isNull u.hashedPassword)
- then pkgs.writeTextFile { name = "password-file"; text = u.hashedPassword; }
- else if !(isNull u.password)
- then pkgs.runCommand "password-file" { pw = u.password; } ''
- echo -n "$pw" | ${pkgs.mkpasswd}/bin/mkpasswd -s > $out
- '' else u.passwordFile;
- setpw = n: u: ''
- setpw=yes
- ${optionalString cfg.mutableUsers ''
- test "$(getent shadow '${u.name}' | cut -d: -f2)" != "x" && setpw=no
- ''}
- if [ "$setpw" == "yes" ]; then
- ${if !(isNull (pwFile u))
- then ''
- echo -n "${u.name}:" | cat - "${pwFile u}" | \
- ${pkgs.shadow}/sbin/chpasswd -e
- ''
- else "passwd -l '${u.name}' &>/dev/null"
- }
- fi
- '';
- mkhome = n: u: ''
- uid="$(id -u ${u.name})"
- gid="$(id -g ${u.name})"
- h="${u.home}"
- test -a "$h" || mkdir -p "$h" || true
- test "$(stat -c %u "$h")" = $uid || chown $uid "$h" || true
- test "$(stat -c %g "$h")" = $gid || chgrp $gid "$h" || true
- '';
- groupadd = n: g: ''
- if [ -z "$(getent group "${g.name}")" ]; then
- ${pkgs.shadow}/sbin/groupadd "${g.name}"
- fi
- '';
- useradd = n: u: ''
- if ! id "${u.name}" &>/dev/null; then
- ${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
- '';
- in stringAfter [ "etc" ] ''
- touch /etc/group
- touch /etc/passwd
- VISUAL=${merger groupFile} ${pkgs.shadow}/sbin/vigr &>/dev/null
- VISUAL=${merger passwdFile} ${pkgs.shadow}/sbin/vipw &>/dev/null
- ${pkgs.shadow}/sbin/grpconv
- ${pkgs.shadow}/sbin/pwconv
- ${concatStrings (mapAttrsToList groupadd nonGidGroups)}
- ${concatStrings (mapAttrsToList useradd nonUidUsers)}
- ${concatStrings (mapAttrsToList mkhome mkhomeUsers)}
- ${concatStrings (mapAttrsToList setpw setpwUsers)}
+ system.activationScripts.users = stringAfter [ "etc" ]
+ ''
+ ${pkgs.perl}/bin/perl -w \
+ -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl \
+ -I${pkgs.perlPackages.JSON}/lib/perl5/site_perl \
+ ${./update-users-groups.pl} ${spec}
'';
# for backwards compatibility
system.activationScripts.groups = stringAfter [ "users" ] "";
+ environment.etc."subuid" = {
+ text = subuidFile;
+ mode = "0644";
+ };
+ environment.etc."subgid" = {
+ text = subgidFile;
+ mode = "0644";
+ };
+
assertions = [
{ assertion = !cfg.enforceIdUniqueness || (uidsAreUnique && gidsAreUnique);
- message = "uids and gids must be unique!";
- }
- { assertion = cfg.mutableUsers || (nonUidUsers == {});
- 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";
+ message = "UIDs and GIDs must be unique!";
}
];
diff --git a/nixos/modules/config/vpnc.nix b/nixos/modules/config/vpnc.nix
new file mode 100644
index 00000000000..68d755232eb
--- /dev/null
+++ b/nixos/modules/config/vpnc.nix
@@ -0,0 +1,41 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.networking.vpnc;
+ mkServiceDef = name: value:
+ {
+ name = "vpnc/${name}.conf";
+ value = { text = value; };
+ };
+
+in
+{
+ options = {
+ networking.vpnc = {
+ services = mkOption {
+ type = types.attrsOf types.str;
+ default = {};
+ example = {
+ test =
+ ''
+ IPSec gateway 192.168.1.1
+ IPSec ID someID
+ IPSec secret secretKey
+ Xauth username name
+ Xauth password pass
+ '';
+ };
+ description =
+ ''
+ The names of cisco VPNs and their associated definitions
+ '';
+ };
+ };
+ };
+
+ config.environment.etc = mapAttrs' mkServiceDef cfg.services;
+}
+
+
diff --git a/nixos/modules/hardware/network/intel-2100bg.nix b/nixos/modules/hardware/network/intel-2100bg.nix
index 1e0033eb414..89fdce415dd 100644
--- a/nixos/modules/hardware/network/intel-2100bg.nix
+++ b/nixos/modules/hardware/network/intel-2100bg.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
@@ -6,9 +6,9 @@
options = {
- networking.enableIntel2100BGFirmware = pkgs.lib.mkOption {
+ networking.enableIntel2100BGFirmware = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Turn on this option if you want firmware for the Intel
PRO/Wireless 2100BG to be loaded automatically. This is
@@ -21,7 +21,7 @@
###### implementation
- config = pkgs.lib.mkIf config.networking.enableIntel2100BGFirmware {
+ config = lib.mkIf config.networking.enableIntel2100BGFirmware {
hardware.enableAllFirmware = true;
diff --git a/nixos/modules/hardware/network/intel-2200bg.nix b/nixos/modules/hardware/network/intel-2200bg.nix
index ae5b69b7981..1b70057d135 100644
--- a/nixos/modules/hardware/network/intel-2200bg.nix
+++ b/nixos/modules/hardware/network/intel-2200bg.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
@@ -6,9 +6,9 @@
options = {
- networking.enableIntel2200BGFirmware = pkgs.lib.mkOption {
+ networking.enableIntel2200BGFirmware = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Turn on this option if you want firmware for the Intel
PRO/Wireless 2200BG to be loaded automatically. This is
@@ -21,7 +21,7 @@
###### implementation
- config = pkgs.lib.mkIf config.networking.enableIntel2200BGFirmware {
+ config = lib.mkIf config.networking.enableIntel2200BGFirmware {
hardware.enableAllFirmware = true;
diff --git a/nixos/modules/hardware/network/intel-3945abg.nix b/nixos/modules/hardware/network/intel-3945abg.nix
index 80baf260ab9..f4f19d20834 100644
--- a/nixos/modules/hardware/network/intel-3945abg.nix
+++ b/nixos/modules/hardware/network/intel-3945abg.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
@@ -6,9 +6,9 @@
options = {
- networking.enableIntel3945ABGFirmware = pkgs.lib.mkOption {
+ networking.enableIntel3945ABGFirmware = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
This option enables automatic loading of the firmware for the Intel
PRO/Wireless 3945ABG.
@@ -20,7 +20,7 @@
###### implementation
- config = pkgs.lib.mkIf config.networking.enableIntel3945ABGFirmware {
+ config = lib.mkIf config.networking.enableIntel3945ABGFirmware {
hardware.enableAllFirmware = true;
diff --git a/nixos/modules/hardware/network/ralink.nix b/nixos/modules/hardware/network/ralink.nix
index 92f34d8643b..0469ae3a1fb 100644
--- a/nixos/modules/hardware/network/ralink.nix
+++ b/nixos/modules/hardware/network/ralink.nix
@@ -1,4 +1,4 @@
-{pkgs, config, ...}:
+{pkgs, config, lib, ...}:
{
@@ -6,9 +6,9 @@
options = {
- networking.enableRalinkFirmware = pkgs.lib.mkOption {
+ networking.enableRalinkFirmware = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Turn on this option if you want firmware for the RT73 NIC.
'';
@@ -19,7 +19,7 @@
###### implementation
- config = pkgs.lib.mkIf config.networking.enableRalinkFirmware {
+ config = lib.mkIf config.networking.enableRalinkFirmware {
hardware.enableAllFirmware = true;
};
diff --git a/nixos/modules/hardware/network/rtl8192c.nix b/nixos/modules/hardware/network/rtl8192c.nix
index 3aefb7bdd60..deae6355492 100644
--- a/nixos/modules/hardware/network/rtl8192c.nix
+++ b/nixos/modules/hardware/network/rtl8192c.nix
@@ -1,4 +1,4 @@
-{pkgs, config, ...}:
+{pkgs, config, lib, ...}:
{
@@ -6,9 +6,9 @@
options = {
- networking.enableRTL8192cFirmware = pkgs.lib.mkOption {
+ networking.enableRTL8192cFirmware = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Turn on this option if you want firmware for the RTL8192c (and related) NICs.
'';
@@ -19,7 +19,7 @@
###### implementation
- config = pkgs.lib.mkIf config.networking.enableRTL8192cFirmware {
+ config = lib.mkIf config.networking.enableRTL8192cFirmware {
hardware.enableAllFirmware = true;
};
diff --git a/nixos/modules/hardware/network/smc-2632w/default.nix b/nixos/modules/hardware/network/smc-2632w/default.nix
index 318131be749..650011aca81 100644
--- a/nixos/modules/hardware/network/smc-2632w/default.nix
+++ b/nixos/modules/hardware/network/smc-2632w/default.nix
@@ -1,9 +1,9 @@
-{pkgs, config, ...}:
+{lib, config, ...}:
{
hardware = {
pcmcia = {
- firmware = [ (pkgs.lib.cleanSource ./firmware) ];
+ firmware = [ (lib.cleanSource ./firmware) ];
};
};
}
diff --git a/nixos/modules/hardware/opengl.nix b/nixos/modules/hardware/opengl.nix
index ab5c309bd42..1777c200dd1 100644
--- a/nixos/modules/hardware/opengl.nix
+++ b/nixos/modules/hardware/opengl.nix
@@ -46,7 +46,8 @@ in
description = ''
On 64-bit systems, whether to support Direct Rendering for
32-bit applications (such as Wine). This is currently only
- supported for the nvidia driver and for
+ supported for the nvidia and
+ ati_unfree drivers, as well as
Mesa.
'';
};
@@ -84,7 +85,7 @@ in
config = mkIf cfg.enable {
- assertions = pkgs.lib.singleton {
+ assertions = lib.singleton {
assertion = cfg.driSupport32Bit -> pkgs.stdenv.isx86_64;
message = "Option driSupport32Bit only makes sense on a 64-bit system.";
};
@@ -104,22 +105,9 @@ in
environment.sessionVariables.LD_LIBRARY_PATH =
[ "/run/opengl-driver/lib" "/run/opengl-driver-32/lib" ];
- # FIXME: move this into card-specific modules.
- hardware.opengl.package = mkDefault
- (if elem "ati_unfree" videoDrivers then
- kernelPackages.ati_drivers_x11
- else
- makePackage pkgs);
-
+ hardware.opengl.package = mkDefault (makePackage pkgs);
hardware.opengl.package32 = mkDefault (makePackage pkgs_i686);
- boot.extraModulePackages =
- optional (elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions ++
- optional (elem "ati_unfree" videoDrivers) kernelPackages.ati_drivers_x11;
-
- environment.etc =
- optionalAttrs (elem "ati_unfree" videoDrivers) {
- "ati".source = "${kernelPackages.ati_drivers_x11}/etc/ati";
- };
+ boot.extraModulePackages = optional (elem "virtualbox" videoDrivers) kernelPackages.virtualboxGuestAdditions;
};
}
diff --git a/nixos/modules/hardware/video/ati.nix b/nixos/modules/hardware/video/ati.nix
new file mode 100644
index 00000000000..033e49d2233
--- /dev/null
+++ b/nixos/modules/hardware/video/ati.nix
@@ -0,0 +1,37 @@
+# This module provides the proprietary ATI X11 / OpenGL drivers.
+
+{ config, lib, pkgs, pkgs_i686, ... }:
+
+with lib;
+
+let
+
+ drivers = config.services.xserver.videoDrivers;
+
+ enabled = elem "ati_unfree" drivers;
+
+ ati_x11 = config.boot.kernelPackages.ati_drivers_x11;
+
+in
+
+{
+
+ config = mkIf enabled {
+
+ services.xserver.drivers = singleton
+ { name = "fglrx"; modules = [ ati_x11 ]; libPath = [ "${ati_x11}/lib" ]; };
+
+ hardware.opengl.package = ati_x11;
+ hardware.opengl.package32 = pkgs_i686.linuxPackages.ati_drivers_x11.override { libsOnly = true; kernel = null; };
+
+ environment.systemPackages = [ ati_x11 ];
+
+ boot.extraModulePackages = [ ati_x11 ];
+
+ boot.blacklistedKernelModules = [ "radeon" ];
+
+ environment.etc."ati".source = "${ati_x11}/etc/ati";
+
+ };
+
+}
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-base.nix
index 4d87c20559d..0a39e8dde9d 100644
--- a/nixos/modules/installer/cd-dvd/installation-cd-base.nix
+++ b/nixos/modules/installer/cd-dvd/installation-cd-base.nix
@@ -42,6 +42,9 @@ with lib;
# Get a console as soon as the initrd loads fbcon on EFI boot.
boot.initrd.kernelModules = [ "fbcon" ];
+ # Add support for cow filesystems and their utilities
+ boot.supportedFilesystems = [ "zfs" "btrfs" ];
+
# 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 65aa1167089..b1e1d16c610 100644
--- a/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
+++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical.nix
@@ -11,6 +11,9 @@ with lib;
# Provide wicd for easy wireless configuration.
#networking.wicd.enable = true;
+ # Include gparted for partitioning disks
+ environment.systemPackages = [ pkgs.gparted ];
+
# KDE complains if power management is disabled (to be precise, if
# there is no power management backend such as upower).
powerManagement.enable = true;
@@ -27,4 +30,70 @@ with lib;
AutoLoginUser=root
AutoLoginPass=""
'';
+
+ # Custom kde-workspace adding some icons on the desktop
+
+ system.activationScripts.installerDesktop = let
+ openManual = pkgs.writeScript "nixos-manual.sh" ''
+ #!${pkgs.stdenv.shell}
+ cd ${config.system.build.manual.manual}/share/doc/nixos/
+ konqueror ./index.html
+ '';
+
+ desktopFile = pkgs.writeText "nixos-manual.desktop" ''
+ [Desktop Entry]
+ Version=1.0
+ Type=Application
+ Name=NixOS Manual
+ Exec=${openManual}
+ Icon=konqueror
+ '';
+
+ in ''
+ mkdir -p /root/Desktop
+ ln -sfT ${desktopFile} /root/Desktop/nixos-manual.desktop
+ ln -sfT ${pkgs.kde4.konsole}/share/applications/kde4/konsole.desktop /root/Desktop/konsole.desktop
+ ln -sfT ${pkgs.gparted}/share/applications/gparted.desktop /root/Desktop/gparted.desktop
+ '';
+
+ services.xserver.desktopManager.kde4.kdeWorkspacePackage = let
+ pkg = pkgs.kde4.kde_workspace;
+
+ plasmaInit = pkgs.writeText "00-defaultLayout.js" ''
+ loadTemplate("org.kde.plasma-desktop.defaultPanel")
+
+ for (var i = 0; i < screenCount; ++i) {
+ var desktop = new Activity
+ desktop.name = i18n("Desktop")
+ desktop.screen = i
+ desktop.wallpaperPlugin = 'image'
+ desktop.wallpaperMode = 'SingleImage'
+
+ var folderview = desktop.addWidget("folderview");
+ folderview.writeConfig("url", "desktop:/");
+
+ //Create more panels for other screens
+ if (i > 0){
+ var panel = new Panel
+ panel.screen = i
+ panel.location = 'bottom'
+ panel.height = screenGeometry(i).height > 1024 ? 35 : 27
+ var tasks = panel.addWidget("tasks")
+ tasks.writeConfig("showOnlyCurrentScreen", true);
+ }
+ }
+ '';
+
+ in
+ pkgs.stdenv.mkDerivation {
+ inherit (pkg) name meta;
+
+ buildCommand = ''
+ mkdir -p $out
+ cp -prf ${pkg}/* $out/
+ chmod a+w $out/share/apps/plasma-desktop/init
+ cp -f ${plasmaInit} $out/share/apps/plasma-desktop/init/00-defaultLayout.js
+ '';
+ };
+
}
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix
index 28c42d64f6f..22f31c46080 100644
--- a/nixos/modules/installer/cd-dvd/iso-image.nix
+++ b/nixos/modules/installer/cd-dvd/iso-image.nix
@@ -11,7 +11,7 @@ let
# The Grub image.
grubImage = pkgs.runCommand "grub_eltorito" {}
''
- ${pkgs.grub2}/bin/grub-mkimage -O i386-pc -o tmp biosdisk iso9660 help linux linux16 chain png jpeg echo gfxmenu reboot
+ ${pkgs.grub2}/bin/grub-mkimage -p /boot/grub -O i386-pc -o tmp biosdisk iso9660 help linux linux16 chain png jpeg echo gfxmenu reboot
cat ${pkgs.grub2}/lib/grub/*/cdboot.img tmp > $out
''; # */
@@ -113,11 +113,12 @@ in
};
isoImage.contents = mkOption {
- example =
+ example = literalExample ''
[ { source = pkgs.memtest86 + "/memtest.bin";
target = "boot/memtest.bin";
}
- ];
+ ]
+ '';
description = ''
This option lists files to be copied to fixed locations in the
generated ISO image.
@@ -125,7 +126,7 @@ in
};
isoImage.storeContents = mkOption {
- example = [pkgs.stdenv];
+ example = literalExample "[ pkgs.stdenv ]";
description = ''
This option lists additional derivations to be included in the
Nix store in the generated ISO image.
@@ -179,7 +180,6 @@ in
fileSystems."/" =
{ fsType = "tmpfs";
- device = "none";
options = "mode=0755";
};
@@ -192,6 +192,8 @@ in
noCheck = true;
};
+ # In stage 1, mount a tmpfs on top of /nix/store (the squashfs
+ # image) to make this a live CD.
fileSystems."/nix/.ro-store" =
{ fsType = "squashfs";
device = "/iso/nix-store.squashfs";
@@ -201,23 +203,20 @@ in
fileSystems."/nix/.rw-store" =
{ fsType = "tmpfs";
- device = "none";
options = "mode=0755";
neededForBoot = true;
};
+ fileSystems."/nix/store" =
+ { fsType = "unionfs-fuse";
+ device = "unionfs";
+ options = "allow_other,cow,nonempty,chroot=/mnt-root,max_files=32768,hide_meta_files,dirs=/nix/.rw-store=rw:/nix/.ro-store=ro";
+ };
+
boot.initrd.availableKernelModules = [ "squashfs" "iso9660" ];
boot.initrd.kernelModules = [ "loop" ];
- # 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 $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
# script and the top-level system configuration directory.
isoImage.storeContents =
@@ -313,8 +312,8 @@ in
'';
# Add vfat support to the initrd to enable people to copy the
- # contents of the CD to a bootable USB stick. Need unionfs-fuse for union mounts
- boot.initrd.supportedFilesystems = [ "vfat" "unionfs-fuse" ];
+ # contents of the CD to a bootable USB stick.
+ boot.initrd.supportedFilesystems = [ "vfat" ];
};
diff --git a/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix b/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
index c274970c553..7d3346e4ea1 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix
@@ -79,7 +79,6 @@ in
pkgs.jfsrec
# Some compression/archiver tools.
- pkgs.unrar
pkgs.unzip
pkgs.zip
pkgs.xz
@@ -152,7 +151,7 @@ in
# default root password is empty.
services.openssh.enable = true;
- jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
+ jobs.openssh.startOn = lib.mkOverride 50 "";
boot.loader.grub.enable = false;
boot.loader.generationsDir.enable = false;
diff --git a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix
index 0357bf80196..1156003d3f4 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix
@@ -109,7 +109,7 @@ in
# not be started by default on the installation CD because the
# default root password is empty.
services.openssh.enable = true;
- jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
+ jobs.openssh.startOn = lib.mkOverride 50 "";
# To be able to use the systemTarball to catch troubles.
boot.crashDump = {
diff --git a/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix b/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
index 3626308bff8..4ce7582c166 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix
@@ -70,7 +70,6 @@ in
pkgs.btrfsProgs
# Some compression/archiver tools.
- pkgs.unrar
pkgs.unzip
pkgs.zip
pkgs.xz
@@ -165,7 +164,7 @@ in
# not be started by default on the installation CD because the
# default root password is empty.
services.openssh.enable = true;
- jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
+ jobs.openssh.startOn = lib.mkOverride 50 "";
# cpufrequtils fails to build on non-pc
powerManagement.enable = false;
diff --git a/nixos/modules/installer/cd-dvd/system-tarball.nix b/nixos/modules/installer/cd-dvd/system-tarball.nix
index eaecbe1381f..c24fe97fba4 100644
--- a/nixos/modules/installer/cd-dvd/system-tarball.nix
+++ b/nixos/modules/installer/cd-dvd/system-tarball.nix
@@ -15,11 +15,12 @@ in
{
options = {
tarball.contents = mkOption {
- example =
+ example = literalExample ''
[ { source = pkgs.memtest86 + "/memtest.bin";
target = "boot/memtest.bin";
}
- ];
+ ]
+ '';
description = ''
This option lists files to be copied to fixed locations in the
generated ISO image.
@@ -27,7 +28,7 @@ in
};
tarball.storeContents = mkOption {
- example = [pkgs.stdenv];
+ example = literalExample "[ pkgs.stdenv ]";
description = ''
This option lists additional derivations to be included in the
Nix store in the generated ISO image.
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl
index 66a8152a3a6..e8f100d6498 100644
--- a/nixos/modules/installer/tools/nixos-generate-config.pl
+++ b/nixos/modules/installer/tools/nixos-generate-config.pl
@@ -20,6 +20,13 @@ sub uniq {
return @res;
}
+sub runCommand {
+ my ($cmd) = @_;
+ open FILE, "$cmd 2>&1 |" or die "Failed to execute: $cmd\n";
+ my @ret = ;
+ close FILE;
+ return ($?, @ret);
+}
# Process the command line.
my $outDir = "/etc/nixos";
@@ -304,10 +311,13 @@ foreach my $fs (read_file("/proc/self/mountinfo")) {
# Maybe this is a bind-mount of a filesystem we saw earlier?
if (defined $fsByDev{$fields[2]}) {
- my $path = $fields[3]; $path = "" if $path eq "/";
- my $base = $fsByDev{$fields[2]};
- $base = "" if $base eq "/";
- $fileSystems .= < 0) {
+ die "Btrfs subvol name for $mountPoint listed multiple times in mount\n"
+ } elsif ($#ids == 0) {
+ my ($status, @path_info) = runCommand("btrfs subvol list $rootDir$mountPoint");
+ if ($status != 0) {
+ die "Failed to find $mountPoint subvolume id from btrfs\n";
+ }
+ my @paths = join("", @path_info) =~ m/ID $ids[0] [^\n]* path ([^\n]*)/;
+ if ($#paths > 0) {
+ die "Btrfs returned multiple paths for a single subvolume id, mountpoint $mountPoint\n";
+ } elsif ($#paths != 0) {
+ die "Btrfs did not return a path for the subvolume at $mountPoint\n";
+ }
+ push @extraOptions, "subvol=$paths[0]";
+ }
+ }
+
# Emit the filesystem.
$fileSystems .= <
# * install the boot loader
+# Ensure a consistent umask.
+umask 0022
+
# Re-exec ourselves in a private mount namespace so that our bind
# mounts get cleaned up automatically.
if [ "$(id -u)" = 0 ]; then
@@ -30,6 +33,9 @@ while [ "$#" -gt 0 ]; do
absolute_path=$(readlink -m $given_path)
extraBuildFlags+=("$i" "/mnt$absolute_path")
;;
+ --root)
+ mountPoint="$1"; shift 1
+ ;;
--show-trace)
extraBuildFlags+=("$i")
;;
@@ -81,7 +87,7 @@ 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/
+cp -Lf /etc/resolv.conf /etc/hosts $mountPoint/etc/
if [ -n "$runChroot" ]; then
@@ -240,7 +246,7 @@ 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
+ chroot $mountPoint /var/setuid-wrappers/passwd
fi
diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh
index edc94d73208..96d09c3a605 100644
--- a/nixos/modules/installer/tools/nixos-option.sh
+++ b/nixos/modules/installer/tools/nixos-option.sh
@@ -11,9 +11,6 @@ usage () {
# Process Arguments #
#####################
-desc=false
-defs=false
-value=false
xml=false
verbose=false
@@ -24,14 +21,11 @@ for arg; do
if test -z "$argfun"; then
case $arg in
-*)
- longarg=""
sarg="$arg"
+ longarg=""
while test "$sarg" != "-"; do
case $sarg in
--*) longarg=$arg; sarg="--";;
- -d*) longarg="$longarg --description";;
- -v*) longarg="$longarg --value";;
- -l*) longarg="$longarg --lookup";;
-*) usage;;
esac
# remove the first letter option
@@ -42,9 +36,6 @@ for arg; do
esac
for larg in $longarg; do
case $larg in
- --description) desc=true;;
- --value) value=true;;
- --lookup) defs=true;;
--xml) xml=true;;
--verbose) verbose=true;;
--help) usage;;
@@ -67,16 +58,6 @@ for arg; do
fi
done
-if $xml; then
- value=true
- desc=true
- defs=true
-fi
-
-if ! $defs && ! $desc; then
- value=true
-fi
-
if $verbose; then
set -x
else
@@ -95,8 +76,7 @@ evalAttr(){
local prefix="$1"
local strict="$2"
local suffix="$3"
- echo "(import {}).$prefix${option:+.$option}${suffix:+.$suffix}" |
- evalNix ${strict:+--strict}
+ echo "(import {}).$prefix${option:+.$option}${suffix:+.$suffix}" | evalNix ${strict:+--strict}
}
evalOpt(){
@@ -189,35 +169,37 @@ EOF
fi
if test "$(evalOpt "_type" 2> /dev/null)" = '"option"'; then
- $value && evalCfg 1
+ echo "Value:"
+ evalCfg 1
- if $desc; then
- $value && echo;
+ echo
- if default=$(evalOpt "default" - 2> /dev/null); then
- echo "Default: $default"
- else
- echo "Default: "
- fi
- if example=$(evalOpt "example" - 2> /dev/null); then
- echo "Example: $example"
- fi
- echo "Description:"
- eval printf $(evalOpt "description")
+ echo "Default:"
+ if default=$(evalOpt "default" - 2> /dev/null); then
+ echo "$default"
+ else
+ echo ""
fi
-
- if $defs; then
- $desc || $value && echo;
-
- printPath () { echo " $1"; }
-
- echo "Declared by:"
- nixMap printPath "$(findSources "declarations")"
- echo ""
- echo "Defined by:"
- nixMap printPath "$(findSources "files")"
- echo ""
+ echo
+ if example=$(evalOpt "example" - 2> /dev/null); then
+ echo "Example:"
+ echo "$example"
+ echo
fi
+ echo "Description:"
+ echo
+ eval printf $(evalOpt "description")
+
+ echo $desc;
+
+ printPath () { echo " $1"; }
+
+ echo "Declared by:"
+ nixMap printPath "$(findSources "declarations")"
+ echo
+ echo "Defined by:"
+ nixMap printPath "$(findSources "files")"
+ echo
else
# echo 1>&2 "Warning: This value is not an option."
diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh
index d7b749573fa..5daa9ff9457 100644
--- a/nixos/modules/installer/tools/nixos-rebuild.sh
+++ b/nixos/modules/installer/tools/nixos-rebuild.sh
@@ -97,6 +97,16 @@ if [ -n "$upgrade" -a -z "$_NIXOS_REBUILD_REEXEC" ]; then
nix-channel --update nixos
fi
+# Make sure that we use the Nix package we depend on, not something
+# else from the PATH for nix-{env,instantiate,build}. This is
+# important, because NixOS defaults the architecture of the rebuilt
+# system to the architecture of the nix-* binaries used. So if on an
+# amd64 system the user has an i686 Nix package in her PATH, then we
+# would silently downgrade the whole system to be i686 NixOS on the
+# next reboot.
+if [ -z "$_NIXOS_REBUILD_REEXEC" ]; then
+ export PATH=@nix@/bin:$PATH
+fi
# Re-execute nixos-rebuild from the Nixpkgs tree.
if [ -z "$_NIXOS_REBUILD_REEXEC" -a -n "$canRun" ]; then
@@ -184,13 +194,13 @@ if [ -z "$rollback" ]; then
nix-env "${extraBuildFlags[@]}" -p "$profile" -f '' --set -A system
pathToConfig="$profile"
elif [ "$action" = test -o "$action" = build -o "$action" = dry-run ]; then
- nix-build '' -A system -K -k "${extraBuildFlags[@]}" > /dev/null
+ nix-build '' -A system -k "${extraBuildFlags[@]}" > /dev/null
pathToConfig=./result
elif [ "$action" = build-vm ]; then
- nix-build '' -A vm -K -k "${extraBuildFlags[@]}" > /dev/null
+ nix-build '' -A vm -k "${extraBuildFlags[@]}" > /dev/null
pathToConfig=./result
elif [ "$action" = build-vm-with-bootloader ]; then
- nix-build '' -A vmWithBootLoader -K -k "${extraBuildFlags[@]}" > /dev/null
+ nix-build '' -A vmWithBootLoader -k "${extraBuildFlags[@]}" > /dev/null
pathToConfig=./result
else
showSyntax
@@ -215,7 +225,10 @@ fi
# If we're not just building, then make the new configuration the boot
# default and/or activate it now.
if [ "$action" = switch -o "$action" = boot -o "$action" = test ]; then
- $pathToConfig/bin/switch-to-configuration "$action"
+ if ! $pathToConfig/bin/switch-to-configuration "$action"; then
+ echo "warning: error(s) occured while switching to the new configuration" >&2
+ exit 1
+ fi
fi
diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix
index 5ebf05e340f..2c796250a98 100644
--- a/nixos/modules/installer/tools/tools.nix
+++ b/nixos/modules/installer/tools/tools.nix
@@ -32,11 +32,13 @@ let
nixos-rebuild = makeProg {
name = "nixos-rebuild";
src = ./nixos-rebuild.sh;
+ nix = config.nix.package;
};
nixos-generate-config = makeProg {
name = "nixos-generate-config";
src = ./nixos-generate-config.pl;
+ path = [ pkgs.btrfsProgs ];
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
};
@@ -64,7 +66,7 @@ let
test -e "$out/chrome/content/jquery-1.5.2.js" ||
cp -f "$jquery" "$out/chrome/content/jquery-1.5.2.js"
'';
- gui = pkgs.lib.cleanSource "${modulesPath}/../gui";
+ gui = lib.cleanSource "${modulesPath}/../gui";
jquery = pkgs.fetchurl {
url = http://code.jquery.com/jquery-1.5.2.min.js;
sha256 = "8f0a19ee8c606b35a10904951e0a27da1896eafe33c6e88cb7bcbe455f05a24a";
diff --git a/nixos/modules/installer/virtualbox-demo.nix b/nixos/modules/installer/virtualbox-demo.nix
index f68f8dc40aa..49ec0899610 100644
--- a/nixos/modules/installer/virtualbox-demo.nix
+++ b/nixos/modules/installer/virtualbox-demo.nix
@@ -10,6 +10,9 @@ with lib;
../profiles/clone-config.nix
];
+ # FIXME: UUID detection is currently broken
+ boot.loader.grub.fsIdentifier = "provided";
+
# Allow mounting of shared folders.
users.extraUsers.demo.extraGroups = [ "vboxsf" ];
diff --git a/nixos/modules/misc/crashdump.nix b/nixos/modules/misc/crashdump.nix
index d68f38bae2f..773b5ac9da3 100644
--- a/nixos/modules/misc/crashdump.nix
+++ b/nixos/modules/misc/crashdump.nix
@@ -28,7 +28,7 @@ in
# We don't want to evaluate all of linuxPackages for the manual
# - some of it might not even evaluate correctly.
defaultText = "pkgs.linuxPackages";
- example = "pkgs.linuxPackages_2_6_25";
+ example = literalExample "pkgs.linuxPackages_2_6_25";
description = ''
This will override the boot.kernelPackages, and will add some
kernel configuration parameters for the crash dump to work.
diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix
index f1028a479df..22997b7a159 100644
--- a/nixos/modules/misc/ids.nix
+++ b/nixos/modules/misc/ids.nix
@@ -1,19 +1,19 @@
# This module defines the global list of uids and gids. We keep a
# central list to prevent id collisions.
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
options = {
- ids.uids = pkgs.lib.mkOption {
+ ids.uids = lib.mkOption {
internal = true;
description = ''
The user IDs used in NixOS.
'';
};
- ids.gids = pkgs.lib.mkOption {
+ ids.gids = lib.mkOption {
internal = true;
description = ''
The group IDs used in NixOS.
@@ -82,7 +82,7 @@
statsd = 69;
transmission = 70;
postgres = 71;
- smbguest = 74;
+ smbguest = 74; # unused
varnish = 75;
datadog = 76;
lighttpd = 77;
@@ -134,6 +134,29 @@
teamspeak = 124;
influxdb = 125;
nsd = 126;
+ gitolite = 127;
+ znc = 128;
+ polipo = 129;
+ mopidy = 130;
+ unifi = 131;
+ gdm = 132;
+ dhcpd = 133;
+ siproxd = 134;
+ mlmmj = 135;
+ neo4j = 136;
+ riemann = 137;
+ riemanndash = 138;
+ radvd = 139;
+ zookeeper = 140;
+ dnsmasq = 141;
+ uhub = 142;
+ yandexdisk = 143;
+ collectd = 144;
+ consul = 145;
+ mailpile = 146;
+ redmine = 147;
+ seeks = 148;
+ prosody = 149;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@@ -202,7 +225,7 @@
postgres = 71;
vboxusers = 72;
vboxsf = 73;
- smbguest = 74;
+ smbguest = 74; # unused
varnish = 75;
datadog = 76;
lighttpd = 77;
@@ -242,6 +265,22 @@
teamspeak = 124;
influxdb = 125;
nsd = 126;
+ firebird = 127;
+ znc = 128;
+ polipo = 129;
+ mopidy = 130;
+ docker = 131;
+ gdm = 132;
+ tss = 133;
+ siproxd = 134;
+ mlmmj = 135;
+ riemann = 137;
+ riemanndash = 138;
+ uhub = 142;
+ mailpile = 146;
+ redmine = 147;
+ seeks = 148;
+ prosody = 149;
# When adding a gid, make sure it doesn't match an existing uid. And don't use gids above 399!
diff --git a/nixos/modules/misc/lib.nix b/nixos/modules/misc/lib.nix
index 18fc68a6988..be8000ac029 100644
--- a/nixos/modules/misc/lib.nix
+++ b/nixos/modules/misc/lib.nix
@@ -1,11 +1,11 @@
-{ config, pkgs, ... }:
+{ config, lib, ... }:
{
options = {
- lib = pkgs.lib.mkOption {
+ lib = lib.mkOption {
default = {};
- type = pkgs.lib.types.attrsOf pkgs.lib.types.attrs;
+ type = lib.types.attrsOf lib.types.attrs;
description = ''
This option allows modules to define helper functions, constants, etc.
diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix
index 45da0df7967..f3ed2aaba09 100644
--- a/nixos/modules/misc/locate.nix
+++ b/nixos/modules/misc/locate.nix
@@ -3,12 +3,8 @@
with lib;
let
-
- locatedb = "/var/cache/locatedb";
-
-in
-
-{
+ cfg = config.services.locate;
+in {
###### interface
@@ -35,6 +31,31 @@ in
'';
};
+ extraFlags = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ description = ''
+ Extra flags to append to updatedb.
+ '';
+ };
+
+ output = mkOption {
+ type = types.path;
+ default = "/var/cache/locatedb";
+ description = ''
+ The database file to build.
+ '';
+ };
+
+ localuser = mkOption {
+ type = types.str;
+ default = "nobody";
+ description = ''
+ The user to search non-network directories as, using
+ su.
+ '';
+ };
+
};
};
@@ -48,8 +69,10 @@ in
path = [ pkgs.su ];
script =
''
- mkdir -m 0755 -p $(dirname ${locatedb})
- exec updatedb --localuser=nobody --output=${locatedb} --prunepaths='/tmp /var/tmp /media /run'
+ mkdir -m 0755 -p $(dirname ${toString cfg.output})
+ exec updatedb \
+ --localuser=${cfg.localuser} \
+ --output=${toString cfg.output} ${concatStringsSep " " cfg.extraFlags}
'';
serviceConfig.Nice = 19;
serviceConfig.IOSchedulingClass = "idle";
diff --git a/nixos/modules/misc/meta.nix b/nixos/modules/misc/meta.nix
new file mode 100644
index 00000000000..22622706f2c
--- /dev/null
+++ b/nixos/modules/misc/meta.nix
@@ -0,0 +1,63 @@
+{ config, lib, ... }:
+
+with lib;
+
+let
+ maintainer = mkOptionType {
+ name = "maintainer";
+ check = email: elem email (attrValues lib.maintainers);
+ merge = loc: defs: listToAttrs (singleton (nameValuePair (last defs).file (last defs).value));
+ };
+
+ listOfMaintainers = types.listOf maintainer // {
+ # Returns list of
+ # { "module-file" = [
+ # "maintainer1 "
+ # "maintainer2 " ];
+ # }
+ merge = loc: defs:
+ zipAttrs
+ (flatten (imap (n: def: imap (m: def':
+ maintainer.merge (loc ++ ["[${toString n}-${toString m}]"])
+ [{ inherit (def) file; value = def'; }]) def.value) defs));
+ };
+
+ docFile = types.path // {
+ # Returns tuples of
+ # { file = "module location"; value = ; }
+ merge = loc: defs: defs;
+ };
+in
+
+{
+ options = {
+ meta = {
+
+ maintainers = mkOption {
+ type = listOfMaintainers;
+ internal = true;
+ default = [];
+ example = [ lib.maintainers.all ];
+ description = ''
+ List of maintainers of each module. This option should be defined at
+ most once per module.
+ '';
+ };
+
+ doc = mkOption {
+ type = docFile;
+ internal = true;
+ example = "./meta.xml";
+ description = ''
+ Documentation prologe for the set of options of each module. This
+ option should be defined at most once per module.
+ '';
+ };
+
+ };
+ };
+
+ config = {
+ meta.maintainers = singleton lib.maintainers.pierron;
+ };
+}
diff --git a/nixos/modules/misc/passthru.nix b/nixos/modules/misc/passthru.nix
index b65f20d62f2..f3c9f6ba651 100644
--- a/nixos/modules/misc/passthru.nix
+++ b/nixos/modules/misc/passthru.nix
@@ -1,11 +1,11 @@
# This module allows you to export something from configuration
# Use case: export kernel source expression for ease of configuring
-{ config, pkgs, ... }:
+{ config, lib, ... }:
{
options = {
- passthru = pkgs.lib.mkOption {
+ passthru = lib.mkOption {
visible = false;
description = ''
This attribute set will be exported as a system attribute.
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
old mode 100644
new mode 100755
index 13f2656c287..d65691c4379
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -5,6 +5,7 @@
./config/fonts/fonts.nix
./config/fonts/ghostscript.nix
./config/gnu.nix
+ ./config/gtk-exe-env.nix
./config/i18n.nix
./config/krb5.nix
./config/ldap.nix
@@ -13,18 +14,20 @@
./config/nsswitch.nix
./config/power-management.nix
./config/pulseaudio.nix
+ ./config/qt-plugin-env.nix
./config/shells-environment.nix
- ./config/system-environment.nix
./config/swap.nix
./config/sysctl.nix
+ ./config/system-environment.nix
./config/system-path.nix
./config/timezone.nix
+ ./config/vpnc.nix
./config/unix-odbc-drivers.nix
./config/users-groups.nix
./config/zram.nix
./hardware/all-firmware.nix
- ./hardware/cpu/intel-microcode.nix
./hardware/cpu/amd-microcode.nix
+ ./hardware/cpu/intel-microcode.nix
./hardware/network/b43.nix
./hardware/network/intel-2100bg.nix
./hardware/network/intel-2200bg.nix
@@ -35,6 +38,7 @@
./hardware/pcmcia.nix
./hardware/video/bumblebee.nix
./hardware/video/nvidia.nix
+ ./hardware/video/ati.nix
./installer/tools/nixos-checkout.nix
./installer/tools/tools.nix
./misc/assertions.nix
@@ -43,6 +47,7 @@
./misc/ids.nix
./misc/lib.nix
./misc/locate.nix
+ ./misc/meta.nix
./misc/nixpkgs.nix
./misc/passthru.nix
./misc/version.nix
@@ -50,16 +55,20 @@
./programs/bash/bash.nix
./programs/bash/command-not-found.nix
./programs/blcr.nix
+ ./programs/dconf.nix
./programs/environment.nix
./programs/info.nix
+ ./programs/nano.nix
+ ./programs/screen.nix
./programs/shadow.nix
./programs/shell.nix
./programs/ssh.nix
./programs/ssmtp.nix
+ ./programs/uim.nix
./programs/venus.nix
./programs/wvdial.nix
+ ./programs/freetds.nix
./programs/zsh/zsh.nix
- ./programs/screen.nix
./rename.nix
./security/apparmor.nix
./security/apparmor-suid.nix
@@ -77,8 +86,10 @@
./services/amqp/activemq/default.nix
./services/amqp/rabbitmq.nix
./services/audio/alsa.nix
- ./services/audio/fuppes.nix
+ # Disabled as fuppes it does no longer builds.
+ # ./services/audio/fuppes.nix
./services/audio/mpd.nix
+ ./services/audio/mopidy.nix
./services/backup/almir.nix
./services/backup/bacula.nix
./services/backup/mysql-backup.nix
@@ -86,21 +97,24 @@
./services/backup/rsnapshot.nix
./services/backup/sitecopy-backup.nix
./services/backup/tarsnap.nix
+ ./services/computing/torque/server.nix
+ ./services/computing/torque/mom.nix
./services/continuous-integration/jenkins/default.nix
./services/continuous-integration/jenkins/slave.nix
./services/databases/4store-endpoint.nix
./services/databases/4store.nix
./services/databases/couchdb.nix
./services/databases/firebird.nix
+ ./services/databases/influxdb.nix
./services/databases/memcached.nix
+ ./services/databases/monetdb.nix
./services/databases/mongodb.nix
- ./services/databases/redis.nix
./services/databases/mysql.nix
+ ./services/databases/neo4j.nix
./services/databases/openldap.nix
./services/databases/postgresql.nix
+ ./services/databases/redis.nix
./services/databases/virtuoso.nix
- ./services/databases/monetdb.nix
- ./services/databases/influxdb.nix
./services/desktops/accountsservice.nix
./services/desktops/geoclue2.nix
./services/desktops/gnome3/at-spi2-core.nix
@@ -124,43 +138,59 @@
./services/hardware/pcscd.nix
./services/hardware/pommed.nix
./services/hardware/sane.nix
+ ./services/hardware/tcsd.nix
+ ./services/hardware/thinkfan.nix
./services/hardware/udev.nix
./services/hardware/udisks2.nix
./services/hardware/upower.nix
- ./services/hardware/thinkfan.nix
+ ./services/hardware/thermald.nix
./services/logging/klogd.nix
./services/logging/logcheck.nix
./services/logging/logrotate.nix
./services/logging/logstash.nix
- ./services/logging/syslogd.nix
./services/logging/rsyslogd.nix
+ ./services/logging/syslogd.nix
+ ./services/logging/syslog-ng.nix
./services/mail/dovecot.nix
./services/mail/freepops.nix
./services/mail/mail.nix
+ ./services/mail/mlmmj.nix
./services/mail/opensmtpd.nix
./services/mail/postfix.nix
./services/mail/spamassassin.nix
#./services/misc/autofs.nix
+ ./services/misc/cpuminer-cryptonight.nix
./services/misc/cgminer.nix
./services/misc/dictd.nix
./services/misc/disnix.nix
./services/misc/felix.nix
./services/misc/folding-at-home.nix
+ ./services/misc/gitolite.nix
./services/misc/gpsd.nix
+ ./services/misc/mesos-master.nix
+ ./services/misc/mesos-slave.nix
./services/misc/nix-daemon.nix
./services/misc/nix-gc.nix
- ./services/misc/nix-ssh-serve.nix
./services/misc/nixos-manual.nix
+ ./services/misc/nix-ssh-serve.nix
+ ./services/misc/phd.nix
+ ./services/misc/redmine.nix
./services/misc/rippled.nix
./services/misc/rogue.nix
+ ./services/misc/siproxd.nix
./services/misc/svnserve.nix
./services/misc/synergy.nix
+ ./services/misc/uhub.nix
+ ./services/misc/zookeeper.nix
./services/monitoring/apcupsd.nix
+ ./services/monitoring/collectd.nix
./services/monitoring/dd-agent.nix
./services/monitoring/graphite.nix
./services/monitoring/monit.nix
./services/monitoring/munin.nix
./services/monitoring/nagios.nix
+ ./services/monitoring/riemann.nix
+ ./services/monitoring/riemann-dash.nix
./services/monitoring/smartd.nix
./services/monitoring/statsd.nix
./services/monitoring/systemhealth.nix
@@ -173,34 +203,38 @@
./services/network-filesystems/openafs-client/default.nix
./services/network-filesystems/rsyncd.nix
./services/network-filesystems/samba.nix
+ ./services/network-filesystems/diod.nix
+ ./services/network-filesystems/yandex-disk.nix
./services/networking/amuled.nix
+ ./services/networking/atftpd.nix
./services/networking/avahi-daemon.nix
./services/networking/bind.nix
./services/networking/bitlbee.nix
./services/networking/btsync.nix
- ./services/networking/cjdns.nix
- ./services/networking/connman.nix
- ./services/networking/cntlm.nix
./services/networking/chrony.nix
+ ./services/networking/cjdns.nix
+ ./services/networking/cntlm.nix
+ ./services/networking/connman.nix
+ ./services/networking/consul.nix
./services/networking/ddclient.nix
./services/networking/dhcpcd.nix
./services/networking/dhcpd.nix
./services/networking/dnsmasq.nix
./services/networking/ejabberd.nix
./services/networking/firewall.nix
- ./services/networking/haproxy.nix
- ./services/networking/tcpcrypt.nix
./services/networking/flashpolicyd.nix
./services/networking/freenet.nix
./services/networking/git-daemon.nix
./services/networking/gnunet.nix
./services/networking/gogoclient.nix
./services/networking/gvpe.nix
+ ./services/networking/haproxy.nix
./services/networking/hostapd.nix
./services/networking/ifplugd.nix
./services/networking/iodined.nix
./services/networking/ircd-hybrid/default.nix
./services/networking/kippo.nix
+ ./services/networking/mailpile.nix
./services/networking/minidlna.nix
./services/networking/murmur.nix
./services/networking/nat.nix
@@ -212,29 +246,37 @@
./services/networking/ntpd.nix
./services/networking/oidentd.nix
./services/networking/openfire.nix
+ ./services/networking/openntpd.nix
./services/networking/openvpn.nix
+ ./services/networking/polipo.nix
./services/networking/prayer.nix
./services/networking/privoxy.nix
+ ./services/networking/prosody.nix
./services/networking/quassel.nix
+ ./services/networking/radicale.nix
./services/networking/radvd.nix
./services/networking/rdnssd.nix
./services/networking/rpcbind.nix
./services/networking/sabnzbd.nix
./services/networking/searx.nix
+ ./services/networking/seeks.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/supybot.nix
+ ./services/networking/syncthing.nix
+ ./services/networking/tcpcrypt.nix
./services/networking/teamspeak3.nix
./services/networking/tftpd.nix
./services/networking/unbound.nix
+ ./services/networking/unifi.nix
./services/networking/vsftpd.nix
./services/networking/wakeonlan.nix
./services/networking/websockify.nix
./services/networking/wicd.nix
./services/networking/wpa_supplicant.nix
./services/networking/xinetd.nix
+ ./services/networking/znc.nix
./services/printing/cupsd.nix
./services/scheduling/atd.nix
./services/scheduling/cron.nix
@@ -242,11 +284,12 @@
./services/search/elasticsearch.nix
./services/search/solr.nix
./services/security/clamav.nix
- ./services/security/haveged.nix
+ ./services/security/fail2ban.nix
./services/security/fprot.nix
./services/security/frandom.nix
- ./services/security/tor.nix
+ ./services/security/haveged.nix
./services/security/torify.nix
+ ./services/security/tor.nix
./services/security/torsocks.nix
./services/system/dbus.nix
./services/system/kerberos.nix
@@ -254,14 +297,14 @@
./services/system/uptimed.nix
./services/torrent/deluge.nix
./services/torrent/transmission.nix
- ./services/ttys/gpm.nix
./services/ttys/agetty.nix
+ ./services/ttys/gpm.nix
./services/ttys/kmscon.nix
./services/web-servers/apache-httpd/default.nix
./services/web-servers/fcgiwrap.nix
./services/web-servers/jboss/default.nix
- ./services/web-servers/lighttpd/default.nix
./services/web-servers/lighttpd/cgit.nix
+ ./services/web-servers/lighttpd/default.nix
./services/web-servers/lighttpd/gitweb.nix
./services/web-servers/nginx/default.nix
./services/web-servers/phpfpm.nix
@@ -272,26 +315,30 @@
./services/x11/desktop-managers/default.nix
./services/x11/display-managers/auto.nix
./services/x11/display-managers/default.nix
+ ./services/x11/display-managers/gdm.nix
./services/x11/display-managers/kdm.nix
- ./services/x11/display-managers/slim.nix
./services/x11/display-managers/lightdm.nix
+ ./services/x11/display-managers/slim.nix
./services/x11/hardware/multitouch.nix
./services/x11/hardware/synaptics.nix
./services/x11/hardware/wacom.nix
+ ./services/x11/redshift.nix
./services/x11/window-managers/awesome.nix
#./services/x11/window-managers/compiz.nix
./services/x11/window-managers/default.nix
+ ./services/x11/window-managers/fluxbox.nix
./services/x11/window-managers/icewm.nix
+ ./services/x11/window-managers/bspwm.nix
./services/x11/window-managers/metacity.nix
./services/x11/window-managers/none.nix
./services/x11/window-managers/twm.nix
./services/x11/window-managers/wmii.nix
./services/x11/window-managers/xmonad.nix
- ./services/x11/redshift.nix
./services/x11/xfs.nix
./services/x11/xserver.nix
./system/activation/activation-script.nix
./system/activation/top-level.nix
+ ./system/boot/emergency-mode.nix
./system/boot/kernel.nix
./system/boot/kexec.nix
./system/boot/loader/efi.nix
@@ -307,20 +354,23 @@
./system/boot/stage-1.nix
./system/boot/stage-2.nix
./system/boot/systemd.nix
+ ./system/boot/tmp.nix
./system/etc/etc.nix
./system/upstart/upstart.nix
./tasks/cpu-freq.nix
+ ./tasks/encrypted-devices.nix
./tasks/filesystems.nix
./tasks/filesystems/btrfs.nix
+ ./tasks/filesystems/cifs.nix
./tasks/filesystems/ext.nix
./tasks/filesystems/f2fs.nix
+ ./tasks/filesystems/jfs.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
@@ -330,8 +380,10 @@
./testing/service-runner.nix
./virtualisation/container-config.nix
./virtualisation/containers.nix
+ ./virtualisation/docker.nix
./virtualisation/libvirtd.nix
#./virtualisation/nova.nix
+ ./virtualisation/openvswitch.nix
./virtualisation/virtualbox-guest.nix
#./virtualisation/xen-dom0.nix
]
diff --git a/nixos/modules/profiles/all-hardware.nix b/nixos/modules/profiles/all-hardware.nix
index 511c118e2bf..6385ee69500 100644
--- a/nixos/modules/profiles/all-hardware.nix
+++ b/nixos/modules/profiles/all-hardware.nix
@@ -8,7 +8,7 @@
{
# The initrd has to contain any module that might be necessary for
- # mounting the CD/DVD.
+ # supporting the most important parts of HW like drives.
boot.initrd.availableKernelModules =
[ # SATA/PATA support.
"ahci"
@@ -43,7 +43,7 @@
"virtio_net" "virtio_pci" "virtio_blk" "virtio_balloon" "virtio_console"
# Keyboards
- "hid_apple"
+ "usbhid" "hid_apple" "hid_logitech_dj" "hid_lenovo_tpkbd" "hid_roccat"
];
# Include lots of firmware.
diff --git a/nixos/modules/profiles/base.nix b/nixos/modules/profiles/base.nix
index 562419b3fac..7a6f7657205 100644
--- a/nixos/modules/profiles/base.nix
+++ b/nixos/modules/profiles/base.nix
@@ -7,7 +7,6 @@
# Include some utilities that are useful for installing or repairing
# the system.
environment.systemPackages = [
- pkgs.subversion # for nixos-checkout
pkgs.w3m # needed for the manual anyway
pkgs.testdisk # useful for repairing boot problems
pkgs.mssys # for writing Microsoft boot sectors / MBRs
@@ -38,7 +37,6 @@
#pkgs.jfsrec # disabled because of Boost dependency
# Some compression/archiver tools.
- pkgs.unrar
pkgs.unzip
pkgs.zip
pkgs.dar # disk archiver
diff --git a/nixos/modules/profiles/demo.nix b/nixos/modules/profiles/demo.nix
index 605cc6aad1d..ef6fd77b5f8 100644
--- a/nixos/modules/profiles/demo.nix
+++ b/nixos/modules/profiles/demo.nix
@@ -4,12 +4,9 @@
imports = [ ./graphical.nix ];
users.extraUsers.demo =
- { description = "Demo user account";
- group = "users";
+ { isNormalUser = true;
+ description = "Demo user account";
extraGroups = [ "wheel" ];
- home = "/home/demo";
- createHome = true;
- useDefaultShell = true;
password = "demo";
uid = 1000;
};
diff --git a/nixos/modules/programs/blcr.nix b/nixos/modules/programs/blcr.nix
index e1e31b4a56a..804e1d01f12 100644
--- a/nixos/modules/programs/blcr.nix
+++ b/nixos/modules/programs/blcr.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, lib, ... }:
let
- inherit (pkgs.lib) mkOption mkIf;
+ inherit (lib) mkOption mkIf;
cfg = config.environment.blcr;
blcrPkg = config.boot.kernelPackages.blcr;
in
diff --git a/nixos/modules/programs/dconf.nix b/nixos/modules/programs/dconf.nix
new file mode 100644
index 00000000000..1b7e2079981
--- /dev/null
+++ b/nixos/modules/programs/dconf.nix
@@ -0,0 +1,34 @@
+{ config, lib, ... }:
+
+let
+ inherit (lib) mkOption mkIf types mapAttrsToList;
+ cfg = config.programs.dconf;
+
+ mkDconfProfile = name: path:
+ { source = path; target = "dconf/profile/${name}"; };
+
+in
+{
+ ###### interface
+
+ options = {
+ programs.dconf = {
+
+ profiles = mkOption {
+ type = types.attrsOf types.path;
+ default = {};
+ description = "Set of dconf profile files.";
+ internal = true;
+ };
+
+ };
+ };
+
+ ###### implementation
+
+ config = mkIf (cfg.profiles != {}) {
+ environment.etc =
+ (mapAttrsToList mkDconfProfile cfg.profiles);
+ };
+
+}
diff --git a/nixos/modules/programs/environment.nix b/nixos/modules/programs/environment.nix
index 2ff1db48757..d79aff5dc55 100644
--- a/nixos/modules/programs/environment.nix
+++ b/nixos/modules/programs/environment.nix
@@ -19,8 +19,8 @@ in
environment.variables =
{ LOCATE_PATH = "/var/cache/locatedb";
NIXPKGS_CONFIG = "/etc/nix/nixpkgs-config.nix";
- PAGER = "less -R";
- EDITOR = "nano";
+ PAGER = mkDefault "less -R";
+ EDITOR = mkDefault "nano";
};
environment.sessionVariables =
@@ -37,26 +37,23 @@ in
"/run/current-system/sw"
];
- # !!! fix environment.profileVariables definition and then move
- # most of these elsewhere
- environment.profileVariables = (i:
- { PATH = [ "${i}/bin" "${i}/sbin" "${i}/lib/kde4/libexec" ];
- MANPATH = [ "${i}/man" "${i}/share/man" ];
- INFOPATH = [ "${i}/info" "${i}/share/info" ];
- PKG_CONFIG_PATH = [ "${i}/lib/pkgconfig" ];
- TERMINFO_DIRS = [ "${i}/share/terminfo" ];
- PERL5LIB = [ "${i}/lib/perl5/site_perl" ];
- ALSA_PLUGIN_DIRS = [ "${i}/lib/alsa-lib" ];
- GST_PLUGIN_SYSTEM_PATH = [ "${i}/lib/gstreamer-0.10" ];
- KDEDIRS = [ "${i}" ];
- STRIGI_PLUGIN_PATH = [ "${i}/lib/strigi/" ];
- QT_PLUGIN_PATH = [ "${i}/lib/qt4/plugins" "${i}/lib/kde4/plugins" ];
- QTWEBKIT_PLUGIN_PATH = [ "${i}/lib/mozilla/plugins/" ];
- GTK_PATH = [ "${i}/lib/gtk-2.0" ];
- XDG_CONFIG_DIRS = [ "${i}/etc/xdg" ];
- XDG_DATA_DIRS = [ "${i}/share" ];
- MOZ_PLUGIN_PATH = [ "${i}/lib/mozilla/plugins" ];
- });
+ # TODO: move most of these elsewhere
+ environment.profileRelativeEnvVars =
+ { PATH = [ "/bin" "/sbin" "/lib/kde4/libexec" ];
+ MANPATH = [ "/man" "/share/man" ];
+ INFOPATH = [ "/info" "/share/info" ];
+ PKG_CONFIG_PATH = [ "/lib/pkgconfig" ];
+ TERMINFO_DIRS = [ "/share/terminfo" ];
+ PERL5LIB = [ "/lib/perl5/site_perl" ];
+ KDEDIRS = [ "" ];
+ STRIGI_PLUGIN_PATH = [ "/lib/strigi/" ];
+ QT_PLUGIN_PATH = [ "/lib/qt4/plugins" "/lib/kde4/plugins" ];
+ QTWEBKIT_PLUGIN_PATH = [ "/lib/mozilla/plugins/" ];
+ GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ];
+ XDG_CONFIG_DIRS = [ "/etc/xdg" ];
+ XDG_DATA_DIRS = [ "/share" ];
+ MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ];
+ };
environment.extraInit =
''
diff --git a/nixos/modules/programs/freetds.nix b/nixos/modules/programs/freetds.nix
new file mode 100644
index 00000000000..398fd104363
--- /dev/null
+++ b/nixos/modules/programs/freetds.nix
@@ -0,0 +1,61 @@
+# Global configuration for freetds environment.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.environment.freetds;
+
+in
+{
+ ###### interface
+
+ options = {
+
+ environment.freetds = mkOption {
+ type = types.attrsOf types.str;
+ default = {};
+ example = {
+ MYDATABASE =
+ ''
+ host = 10.0.2.100
+ port = 1433
+ tds version = 7.2
+ '';
+ };
+ description =
+ ''
+ Configure freetds database entries. Each attribute denotes
+ a section within freetds.conf, and the value (a string) is the config
+ content for that section. When at least one entry is configured
+ the global environment variables FREETDSCONF, FREETDS and SYBASE
+ will be configured to allow the programs that use freetds to find the
+ library and config.
+ '';
+
+ };
+
+ };
+
+ ###### implementation
+
+ config = mkIf (length (attrNames cfg) > 0) {
+
+ environment.variables.FREETDSCONF = "/etc/freetds.conf";
+ environment.variables.FREETDS = "/etc/freetds.conf";
+ environment.variables.SYBASE = "${pkgs.freetds}";
+
+ environment.etc."freetds.conf" = { text =
+ (concatStrings (mapAttrsToList (name: value:
+ ''
+ [${name}]
+ ${value}
+ ''
+ ) cfg));
+ };
+
+ };
+
+}
diff --git a/nixos/modules/programs/info.nix b/nixos/modules/programs/info.nix
index 30c25cf3420..253f9e87769 100644
--- a/nixos/modules/programs/info.nix
+++ b/nixos/modules/programs/info.nix
@@ -2,6 +2,8 @@
let
+ texinfo = pkgs.texinfoInteractive;
+
# Quick hack to make the `info' command work properly. `info' needs
# a "dir" file containing all the installed Info files, which we
# don't have (it would be impure to have a package installation
@@ -22,15 +24,15 @@ let
for i in $(IFS=:; echo $INFOPATH); do
for j in $i/*.info; do
- ${pkgs.texinfo}/bin/install-info --quiet $j $dir/dir
+ ${texinfo}/bin/install-info --quiet $j $dir/dir
done
done
- INFOPATH=$dir:$INFOPATH ${pkgs.texinfo}/bin/info "$@"
+ INFOPATH=$dir:$INFOPATH ${texinfo}/bin/info "$@"
''; # */
in
{
- environment.systemPackages = [ infoWrapper pkgs.texinfo ];
+ environment.systemPackages = [ infoWrapper texinfo ];
}
diff --git a/nixos/modules/programs/nano.nix b/nixos/modules/programs/nano.nix
new file mode 100644
index 00000000000..b8803eec7be
--- /dev/null
+++ b/nixos/modules/programs/nano.nix
@@ -0,0 +1,35 @@
+{ config, lib, ... }:
+
+let
+ cfg = config.programs.nano;
+in
+
+{
+ ###### interface
+
+ options = {
+ programs.nano = {
+
+ nanorc = lib.mkOption {
+ type = lib.types.lines;
+ default = "";
+ description = ''
+ The system-wide nano configuration.
+ See nanorc5.
+ '';
+ example = ''
+ set nowrap
+ set tabstospaces
+ set tabsize 4
+ '';
+ };
+ };
+ };
+
+ ###### implementation
+
+ config = lib.mkIf (cfg.nanorc != "") {
+ environment.etc."nanorc".text = cfg.nanorc;
+ };
+
+}
diff --git a/nixos/modules/programs/screen.nix b/nixos/modules/programs/screen.nix
index 1c63ebe6a11..f82338a69d2 100644
--- a/nixos/modules/programs/screen.nix
+++ b/nixos/modules/programs/screen.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, lib, ... }:
let
- inherit (pkgs.lib) mkOption mkIf types;
+ inherit (lib) mkOption mkIf types;
cfg = config.programs.screen;
in
diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix
index 5fcd2133a7e..5c2ea07c554 100644
--- a/nixos/modules/programs/shadow.nix
+++ b/nixos/modules/programs/shadow.nix
@@ -40,7 +40,7 @@ in
options = {
- users.defaultUserShell = pkgs.lib.mkOption {
+ users.defaultUserShell = lib.mkOption {
description = ''
This option defines the default shell assigned to user
accounts. This must not be a store path, since the path is
@@ -60,7 +60,7 @@ in
config = {
environment.systemPackages =
- pkgs.lib.optional config.users.mutableUsers pkgs.shadow;
+ lib.optional config.users.mutableUsers pkgs.shadow;
environment.etc =
[ { # /etc/login.defs: global configuration for pwdutils. You
@@ -83,7 +83,7 @@ in
security.pam.services =
{ chsh = { rootOK = true; };
chfn = { rootOK = true; };
- su = { rootOK = true; forwardXAuth = true; };
+ su = { rootOK = true; forwardXAuth = true; logFailures = true; };
passwd = {};
# Note: useradd, groupadd etc. aren't setuid root, so it
# doesn't really matter what the PAM config says as long as it
@@ -100,7 +100,9 @@ in
chgpasswd = { rootOK = true; };
};
- security.setuidPrograms = [ "passwd" "chfn" "su" "newgrp" ];
+ security.setuidPrograms = [ "passwd" "chfn" "su" "newgrp"
+ "newuidmap" "newgidmap" # new in shadow 4.2.x
+ ];
};
diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix
index fdb9dfd4b8c..ee9cb81a027 100644
--- a/nixos/modules/programs/ssh.nix
+++ b/nixos/modules/programs/ssh.nix
@@ -59,6 +59,13 @@ in
'';
};
+ package = mkOption {
+ default = pkgs.openssh;
+ description = ''
+ The package used for the openssh client and daemon.
+ '';
+ };
+
};
};
@@ -92,7 +99,7 @@ in
wantedBy = [ "default.target" ];
serviceConfig =
{ ExecStartPre = "${pkgs.coreutils}/bin/rm -f %t/ssh-agent";
- ExecStart = "${pkgs.openssh}/bin/ssh-agent -a %t/ssh-agent";
+ ExecStart = "${cfg.package}/bin/ssh-agent -a %t/ssh-agent";
StandardOutput = "null";
Type = "forking";
Restart = "on-failure";
diff --git a/nixos/modules/programs/uim.nix b/nixos/modules/programs/uim.nix
new file mode 100644
index 00000000000..fc25ba6f969
--- /dev/null
+++ b/nixos/modules/programs/uim.nix
@@ -0,0 +1,29 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ cfg = config.uim;
+in
+{
+ options = {
+ uim = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ example = true;
+ description = "enable UIM input method";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = [ pkgs.uim ];
+ gtkPlugins = [ pkgs.uim ];
+ qtPlugins = [ pkgs.uim ];
+ environment.variables.GTK_IM_MODULE = "uim";
+ environment.variables.QT_IM_MODULE = "uim";
+ environment.variables.XMODIFIERS = "@im=uim";
+ services.xserver.displayManager.sessionCommands = "uim-xim &";
+ };
+}
diff --git a/nixos/modules/programs/virtualbox.nix b/nixos/modules/programs/virtualbox.nix
index 10e657abd3c..1a190573e94 100644
--- a/nixos/modules/programs/virtualbox.nix
+++ b/nixos/modules/programs/virtualbox.nix
@@ -14,7 +14,8 @@ let virtualbox = config.boot.kernelPackages.virtualbox; in
services.udev.extraRules =
''
KERNEL=="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660", TAG+="systemd"
- KERNEL=="vboxnetctl", OWNER="root", GROUP="root", MODE="0600", TAG+="systemd"
+ KERNEL=="vboxdrvu", OWNER="root", GROUP="root", MODE="0666", TAG+="systemd"
+ KERNEL=="vboxnetctl", OWNER="root", GROUP="vboxusers", MODE="0660", TAG+="systemd"
SUBSYSTEM=="usb_device", ACTION=="add", RUN+="${virtualbox}/libexec/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN+="${virtualbox}/libexec/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
SUBSYSTEM=="usb_device", ACTION=="remove", RUN+="${virtualbox}/libexec/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor"
@@ -43,5 +44,5 @@ let virtualbox = config.boot.kernelPackages.virtualbox; in
'';
};
- networking.interfaces.vboxnet0 = { ipAddress = "192.168.56.1"; prefixLength = 24; };
+ networking.interfaces.vboxnet0.ip4 = [ { address = "192.168.56.1"; prefixLength = 24; } ];
}
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index 0ee2caa28ea..ea7d9763ce6 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -129,5 +129,8 @@ in zipModules ([]
++ obsolete' [ "boot" "loader" "grub" "bootDevice" ]
++ obsolete' [ "boot" "initrd" "luks" "enable" ]
++ obsolete' [ "programs" "bash" "enable" ]
+++ obsolete' [ "services" "samba" "defaultShare" ]
+++ obsolete' [ "services" "syslog-ng" "serviceName" ]
+++ obsolete' [ "services" "syslog-ng" "listenToJournal" ]
)
diff --git a/nixos/modules/security/ca.nix b/nixos/modules/security/ca.nix
index dd4b0c529e5..8e653cd4284 100644
--- a/nixos/modules/security/ca.nix
+++ b/nixos/modules/security/ca.nix
@@ -13,8 +13,9 @@ with lib;
];
environment.sessionVariables =
- { OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
- CURL_CA_BUNDLE = "/etc/ssl/certs/ca-bundle.crt";
+ { SSL_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
+ # FIXME: unneeded - remove eventually.
+ OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
GIT_SSL_CAINFO = "/etc/ssl/certs/ca-bundle.crt";
};
diff --git a/nixos/modules/security/grsecurity.nix b/nixos/modules/security/grsecurity.nix
index 3bd58218c99..3773d822b16 100644
--- a/nixos/modules/security/grsecurity.nix
+++ b/nixos/modules/security/grsecurity.nix
@@ -30,7 +30,7 @@ in
type = types.bool;
default = false;
description = ''
- Enable the stable grsecurity patch, based on Linux 3.2.
+ Enable the stable grsecurity patch, based on Linux 3.14.
'';
};
@@ -38,7 +38,7 @@ in
type = types.bool;
default = false;
description = ''
- Enable the testing grsecurity patch, based on Linux 3.13.
+ Enable the testing grsecurity patch, based on Linux 3.17.
'';
};
@@ -50,7 +50,7 @@ in
description = ''
grsecurity configuration mode. This specifies whether
grsecurity is auto-configured or otherwise completely
- manually configured. Can either by
+ manually configured. Can either be
custom or auto.
auto is recommended.
@@ -64,7 +64,7 @@ in
description = ''
grsecurity configuration priority. This specifies whether
the kernel configuration should emphasize speed or
- security. Can either by security or
+ security. Can either be security or
performance.
'';
};
@@ -76,7 +76,7 @@ in
description = ''
grsecurity system configuration. This specifies whether
the kernel configuration should be suitable for a Desktop
- or a Server. Can either by server or
+ or a Server. Can either be server or
desktop.
'';
};
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index 02340fd78e8..844a9da0eb4 100644
--- a/nixos/modules/security/pam.nix
+++ b/nixos/modules/security/pam.nix
@@ -126,12 +126,28 @@ let
description = "Whether to show the message of the day.";
};
+ makeHomeDir = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Whether to try to create home directories for users
+ with $HOMEs pointing to nonexistent
+ locations on session login.
+ '';
+ };
+
updateWtmp = mkOption {
default = false;
type = types.bool;
description = "Whether to update /var/log/wtmp.";
};
+ logFailures = mkOption {
+ default = false;
+ type = types.bool;
+ description = "Whether to log authentication failures in /var/log/faillog.";
+ };
+
text = mkOption {
type = types.nullOr types.lines;
description = "Contents of the PAM service file.";
@@ -159,6 +175,8 @@ let
# Authentication management.
${optionalString cfg.rootOK
"auth sufficient pam_rootok.so"}
+ ${optionalString cfg.logFailures
+ "auth required pam_tally.so"}
${optionalString (config.security.pam.enableSSHAgentAuth && cfg.sshAgentAuth)
"auth sufficient ${pkgs.pam_ssh_agent_auth}/libexec/pam_ssh_agent_auth.so file=~/.ssh/authorized_keys:~/.ssh/authorized_keys2:/etc/ssh/authorized_keys.d/%u"}
${optionalString cfg.usbAuth
@@ -189,7 +207,11 @@ let
session required pam_env.so envfile=${config.system.build.pamEnvironment}
session required pam_unix.so
${optionalString cfg.setLoginUid
- "session required pam_loginuid.so"}
+ "session ${
+ if config.boot.isContainer then "optional" else "required"
+ } pam_loginuid.so"}
+ ${optionalString cfg.makeHomeDir
+ "session required ${pkgs.pam}/lib/security/pam_mkhomedir.so silent skel=/etc/skel umask=0022"}
${optionalString cfg.updateWtmp
"session required ${pkgs.pam}/lib/security/pam_lastlog.so silent"}
${optionalString config.users.ldap.enable
diff --git a/nixos/modules/security/rngd.nix b/nixos/modules/security/rngd.nix
index c31e57e6f6f..4d8fabc7696 100644
--- a/nixos/modules/security/rngd.nix
+++ b/nixos/modules/security/rngd.nix
@@ -30,7 +30,8 @@ with lib;
description = "Hardware RNG Entropy Gatherer Daemon";
- serviceConfig.ExecStart = "${pkgs.rng_tools}/sbin/rngd -f";
+ serviceConfig.ExecStart = "${pkgs.rng_tools}/sbin/rngd -f -v" +
+ (if config.services.tcsd.enable then " --no-tpm=1" else "");
restartTriggers = [ pkgs.rng_tools ];
};
diff --git a/nixos/modules/security/setuid-wrappers.nix b/nixos/modules/security/setuid-wrappers.nix
index 4cdc1023baa..2a289dc402c 100644
--- a/nixos/modules/security/setuid-wrappers.nix
+++ b/nixos/modules/security/setuid-wrappers.nix
@@ -76,8 +76,7 @@ in
config = {
- security.setuidPrograms =
- [ "fusermount" "wodim" "cdrdao" "growisofs" ];
+ security.setuidPrograms = [ "fusermount" ];
system.activationScripts.setuid =
let
@@ -97,8 +96,7 @@ in
}:
''
- source=${if source != "" then source else "$(PATH=$SETUID_PATH type -tP ${program})"}
- if test -z "$source"; then
+ if ! source=${if source != "" then source else "$(PATH=$SETUID_PATH type -tP ${program})"}; then
# If we can't find the program, fall back to the
# system profile.
source=/nix/var/nix/profiles/default/bin/${program}
diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix
index cbd1628caae..4c6a1c26426 100644
--- a/nixos/modules/security/sudo.nix
+++ b/nixos/modules/security/sudo.nix
@@ -46,6 +46,14 @@ in
sudoers file.
'';
};
+
+ security.sudo.extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Extra configuration text appended to sudoers.
+ '';
+ };
};
@@ -55,7 +63,8 @@ in
security.sudo.configFile =
''
- # Don't edit this file. Set the NixOS option ‘security.sudo.configFile’ instead.
+ # Don't edit this file. Set the NixOS options ‘security.sudo.configFile’
+ # and security.sudo.extraConfig instead.
# Environment variables to keep for root and %wheel.
Defaults:root,%wheel env_keep+=TERMINFO_DIRS
@@ -69,6 +78,7 @@ in
# Users in the "wheel" group can do anything.
%wheel ALL=(ALL) ${if cfg.wheelNeedsPassword then "" else "NOPASSWD: ALL, "}SETENV: ALL
+ ${cfg.extraConfig}
'';
security.setuidPrograms = [ "sudo" "sudoedit" ];
diff --git a/nixos/modules/services/amqp/activemq/default.nix b/nixos/modules/services/amqp/activemq/default.nix
index f1f3d005f30..261f9761766 100644
--- a/nixos/modules/services/amqp/activemq/default.nix
+++ b/nixos/modules/services/amqp/activemq/default.nix
@@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
-with lib;
with pkgs;
+with lib;
let
@@ -12,7 +12,7 @@ let
phases = [ "installPhase" ];
buildInputs = [ jdk ];
installPhase = ''
- ensureDir $out/lib
+ mkdir -p $out/lib
source ${activemq}/lib/classpath.env
export CLASSPATH
ln -s "${./ActiveMQBroker.java}" ActiveMQBroker.java
diff --git a/nixos/modules/services/amqp/rabbitmq.nix b/nixos/modules/services/amqp/rabbitmq.nix
index bef15fb64b7..77487ec1ab9 100644
--- a/nixos/modules/services/amqp/rabbitmq.nix
+++ b/nixos/modules/services/amqp/rabbitmq.nix
@@ -4,6 +4,8 @@ with lib;
let
cfg = config.services.rabbitmq;
+ config_file = pkgs.writeText "rabbitmq.config" cfg.config;
+ config_file_wo_suffix = builtins.substring 0 ((builtins.stringLength config_file) - 7) config_file;
in {
###### interface
@@ -31,7 +33,6 @@ in {
'';
};
-
dataDir = mkOption {
type = types.path;
default = "/var/lib/rabbitmq";
@@ -40,6 +41,30 @@ in {
'';
};
+ cookie = mkOption {
+ default = "";
+ type = types.str;
+ description = ''
+ Erlang cookie is a string of arbitrary length which must
+ be the same for several nodes to be allowed to communicate.
+ Leave empty to generate automatically.
+ '';
+ };
+
+ config = mkOption {
+ default = "";
+ type = types.str;
+ description = ''
+ Verbatim configuration file contents.
+ See http://www.rabbitmq.com/configure.htm
+ '';
+ };
+
+ plugins = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = "The names of plugins to enable";
+ };
};
};
@@ -64,12 +89,17 @@ in {
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
+ path = [ pkgs.rabbitmq_server ];
+
environment = {
RABBITMQ_MNESIA_BASE = "${cfg.dataDir}/mnesia";
RABBITMQ_NODE_IP_ADDRESS = cfg.listenAddress;
RABBITMQ_SERVER_START_ARGS = "-rabbit error_logger tty -rabbit sasl_error_logger false";
SYS_PREFIX = "";
- };
+ RABBITMQ_ENABLED_PLUGINS_FILE = pkgs.writeText "enabled_plugins" ''
+ [ ${concatStringsSep "," cfg.plugins} ].
+ '';
+ } // optionalAttrs (cfg.config != "") { RABBITMQ_CONFIG_FILE = config_file_wo_suffix; };
serviceConfig = {
ExecStart = "${pkgs.rabbitmq_server}/sbin/rabbitmq-server";
@@ -81,7 +111,18 @@ in {
preStart = ''
mkdir -p ${cfg.dataDir} && chmod 0700 ${cfg.dataDir}
if [ "$(id -u)" = 0 ]; then chown rabbitmq:rabbitmq ${cfg.dataDir}; fi
+
+ ${optionalString (cfg.cookie != "") ''
+ echo -n ${cfg.cookie} > ${cfg.dataDir}/.erlang.cookie
+ chmod 400 ${cfg.dataDir}/.erlang.cookie
+ chown rabbitmq:rabbitmq ${cfg.dataDir}/.erlang.cookie
+ ''}
+
+ mkdir -p /var/log/rabbitmq && chmod 0700 /var/log/rabbitmq
+ chown rabbitmq:rabbitmq /var/log/rabbitmq
'';
+
+ postStart = mkBefore "until rabbitmqctl status; do sleep 1; done";
};
};
diff --git a/nixos/modules/services/audio/mopidy.nix b/nixos/modules/services/audio/mopidy.nix
new file mode 100644
index 00000000000..a7a7e8ae688
--- /dev/null
+++ b/nixos/modules/services/audio/mopidy.nix
@@ -0,0 +1,118 @@
+{ config, lib, pkgs, ... }:
+
+with pkgs;
+with lib;
+
+let
+
+ uid = config.ids.uids.mopidy;
+ gid = config.ids.gids.mopidy;
+ cfg = config.services.mopidy;
+
+ mopidyConf = writeText "mopidy.conf" cfg.configuration;
+
+ mopidyLauncher = stdenv.mkDerivation {
+ name = "mopidy-launcher";
+ phases = [ "installPhase" ];
+ buildInputs = [ makeWrapper python ];
+ installPhase = ''
+ mkdir -p $out/bin
+ ln -s ${mopidy}/bin/mopidy $out/bin/mopidy
+ wrapProgram $out/bin/mopidy \
+ --prefix PYTHONPATH : \
+ "${concatStringsSep ":" (map (p: "$(toPythonPath ${p})") cfg.extensionPackages)}"
+ '';
+ };
+
+in {
+
+ options = {
+
+ services.mopidy = {
+
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Whether to enable Mopidy, a music player daemon.
+ '';
+ };
+
+ dataDir = mkOption {
+ default = "/var/lib/mopidy";
+ type = types.str;
+ description = ''
+ The directory where Mopidy stores its state.
+ '';
+ };
+
+ extensionPackages = mkOption {
+ default = [];
+ type = types.listOf types.package;
+ example = literalExample "[ pkgs.mopidy-spotify ]";
+ description = ''
+ Mopidy extensions that should be loaded by the service.
+ '';
+ };
+
+ configuration = mkOption {
+ type = types.lines;
+ description = ''
+ The configuration that Mopidy should use.
+ '';
+ };
+
+ extraConfigFiles = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ description = ''
+ Extra config file read by Mopidy when the service starts.
+ Later files in the list overrides earlier configuration.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ systemd.services.mopidy = {
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" "sound.target" ];
+ description = "mopidy music player daemon";
+ preStart = "mkdir -p ${cfg.dataDir} && chown -R mopidy:mopidy ${cfg.dataDir}";
+ serviceConfig = {
+ ExecStart = "${mopidyLauncher}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)}";
+ User = "mopidy";
+ PermissionsStartOnly = true;
+ };
+ };
+
+ systemd.services.mopidy-scan = {
+ description = "mopidy local files scanner";
+ preStart = "mkdir -p ${cfg.dataDir} && chown -R mopidy:mopidy ${cfg.dataDir}";
+ serviceConfig = {
+ ExecStart = "${mopidyLauncher}/bin/mopidy --config ${concatStringsSep ":" ([mopidyConf] ++ cfg.extraConfigFiles)} local scan";
+ User = "mopidy";
+ PermissionsStartOnly = true;
+ Type = "oneshot";
+ };
+ };
+
+ users.extraUsers.mopidy = {
+ inherit uid;
+ group = "mopidy";
+ extraGroups = [ "audio" ];
+ description = "Mopidy daemon user";
+ home = "${cfg.dataDir}";
+ };
+
+ users.extraGroups.mopidy.gid = gid;
+
+ };
+
+}
diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix
index 53542e34b14..e6b525c4b1b 100644
--- a/nixos/modules/services/audio/mpd.nix
+++ b/nixos/modules/services/audio/mpd.nix
@@ -16,52 +16,76 @@ let
sticker_file "${cfg.dataDir}/sticker.sql"
log_file "syslog"
user "mpd"
+ ${if cfg.network.host != "any" then
+ "bind_to_address ${cfg.network.host}" else ""}
+ ${if cfg.network.port != 6600 then
+ "port ${toString cfg.network.port}" else ""}
${cfg.extraConfig}
- '';
+ '';
in {
###### interface
- options = {
+ options = {
- services.mpd = {
+ services.mpd = {
enable = mkOption {
default = false;
description = ''
Whether to enable MPD, the music player daemon.
- '';
- };
+ '';
+ };
musicDirectory = mkOption {
default = "${cfg.dataDir}/music";
description = ''
Extra configuration added to the end of MPD's
configuration file, mpd.conf.
- '';
- };
+ '';
+ };
extraConfig = mkOption {
- default = "";
+ default = "";
description = ''
Extra directives added to to the end of MPD's configuration file,
mpd.conf. Basic configuration like file location and uid/gid
is added automatically to the beginning of the file.
- '';
- };
+ '';
+ };
dataDir = mkOption {
default = "/var/lib/mpd";
description = ''
The directory where MPD stores its state, tag cache,
playlists etc.
- '';
- };
+ '';
+ };
- };
+ network = {
- };
+ host = mkOption {
+ default = "any";
+ description = ''
+ This setting sets the address for the daemon to listen on. Careful attention
+ should be paid if this is assigned to anything other then the default, any.
+ This setting can deny access to control of the daemon.
+ '';
+ };
+
+ port = mkOption {
+ default = 6600;
+ description = ''
+ This setting is the TCP port that is desired for the daemon to get assigned
+ to.
+ '';
+ };
+
+ };
+ };
+
+ };
###### implementation
diff --git a/nixos/modules/services/backup/rsnapshot.nix b/nixos/modules/services/backup/rsnapshot.nix
index 48ad7582b7e..fb25bd9dd1e 100644
--- a/nixos/modules/services/backup/rsnapshot.nix
+++ b/nixos/modules/services/backup/rsnapshot.nix
@@ -31,7 +31,7 @@ in
cronIntervals = mkOption {
default = {};
- example = { "hourly" = "0 * * * *"; "daily" = "50 21 * * *"; };
+ example = { hourly = "0 * * * *"; daily = "50 21 * * *"; };
type = types.attrsOf types.string;
description = ''
Periodicity at which intervals should be run by cron.
@@ -39,11 +39,20 @@ in
as retain options.
'';
};
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.rsnapshot;
+ example = literalExample "pkgs.rsnapshotGit";
+ description = ''
+ RSnapshot package to use.
+ '';
+ };
};
};
config = mkIf cfg.enable (let
- myRsnapshot = pkgs.rsnapshot.override { configFile = rsnapshotCfg; };
+ myRsnapshot = cfg.package.override { configFile = rsnapshotCfg; };
rsnapshotCfg = with pkgs; writeText "gen-rsnapshot.conf" (''
config_version 1.2
cmd_cp ${coreutils}/bin/cp
diff --git a/nixos/modules/services/backup/sitecopy-backup.nix b/nixos/modules/services/backup/sitecopy-backup.nix
index 5d3675fa3e9..5f2b4e76aee 100644
--- a/nixos/modules/services/backup/sitecopy-backup.nix
+++ b/nixos/modules/services/backup/sitecopy-backup.nix
@@ -73,7 +73,7 @@ in
touch ${stateDir}/sitecopy.secrets
chown root ${stateDir}/sitecopy.secrets
- ${pkgs.lib.concatStrings (map ( b: ''
+ ${lib.concatStrings (map ( b: ''
unset secrets
unset secret
secrets=`grep '^${b.server}' ${stateDir}/sitecopy.secrets | head -1`
diff --git a/nixos/modules/services/computing/torque/mom.nix b/nixos/modules/services/computing/torque/mom.nix
new file mode 100644
index 00000000000..83772539a7a
--- /dev/null
+++ b/nixos/modules/services/computing/torque/mom.nix
@@ -0,0 +1,63 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.torque.mom;
+ torque = pkgs.torque;
+
+ momConfig = pkgs.writeText "torque-mom-config" ''
+ $pbsserver ${cfg.serverNode}
+ $logevent 225
+ '';
+
+in
+{
+ options = {
+
+ services.torque.mom = {
+ enable = mkEnableOption "torque computing node";
+
+ serverNode = mkOption {
+ type = types.str;
+ description = "Hostname running pbs server.";
+ };
+
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = [ pkgs.torque ];
+
+ systemd.services.torque-mom-init = {
+ path = with pkgs; [ torque utillinux procps inetutils ];
+
+ script = ''
+ pbs_mkdirs -v aux
+ pbs_mkdirs -v mom
+ hostname > /var/spool/torque/server_name
+ cp -v ${momConfig} /var/spool/torque/mom_priv/config
+ '';
+
+ serviceConfig.Type = "oneshot";
+ unitConfig.ConditionPathExists = "!/var/spool/torque";
+ };
+
+ systemd.services.torque-mom = {
+ path = [ torque ];
+
+ wantedBy = [ "multi-user.target" ];
+ requires = [ "torque-mom-init.service" ];
+ after = [ "torque-mom-init.service" "network.target" ];
+
+ serviceConfig = {
+ Type = "forking";
+ ExecStart = "${torque}/bin/pbs_mom";
+ PIDFile = "/var/spool/torque/mom_priv/mom.lock";
+ };
+ };
+
+ };
+}
diff --git a/nixos/modules/services/computing/torque/server.nix b/nixos/modules/services/computing/torque/server.nix
new file mode 100644
index 00000000000..655d1500497
--- /dev/null
+++ b/nixos/modules/services/computing/torque/server.nix
@@ -0,0 +1,96 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ cfg = config.services.torque.server;
+ torque = pkgs.torque;
+in
+{
+ options = {
+
+ services.torque.server = {
+
+ enable = mkEnableOption "torque server";
+
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = [ pkgs.torque ];
+
+ systemd.services.torque-server-init = {
+ path = with pkgs; [ torque utillinux procps inetutils ];
+
+ script = ''
+ tmpsetup=$(mktemp -t torque-XXXX)
+ cp -p ${torque}/bin/torque.setup $tmpsetup
+ sed -i $tmpsetup -e 's/pbs_server -t create/pbs_server -f -t create/'
+
+ pbs_mkdirs -v aux
+ pbs_mkdirs -v server
+ hostname > /var/spool/torque/server_name
+ cp -prv ${torque}/var/spool/torque/* /var/spool/torque/
+ $tmpsetup root
+
+ sleep 1
+ rm -f $tmpsetup
+ kill $(pgrep pbs_server) 2>/dev/null
+ kill $(pgrep trqauthd) 2>/dev/null
+ '';
+
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ };
+
+ unitConfig = {
+ ConditionPathExists = "!/var/spool/torque";
+ };
+ };
+
+ systemd.services.trqauthd = {
+ path = [ torque ];
+
+ requires = [ "torque-server-init.service" ];
+ after = [ "torque-server-init.service" ];
+
+ serviceConfig = {
+ Type = "forking";
+ ExecStart = "${torque}/bin/trqauthd";
+ };
+ };
+
+ systemd.services.torque-server = {
+ path = [ torque ];
+
+ wantedBy = [ "multi-user.target" ];
+ wants = [ "torque-scheduler.service" "trqauthd.service" ];
+ before = [ "trqauthd.service" ];
+ requires = [ "torque-server-init.service" ];
+ after = [ "torque-server-init.service" "network.target" ];
+
+ serviceConfig = {
+ Type = "forking";
+ ExecStart = "${torque}/bin/pbs_server";
+ ExecStop = "${torque}/bin/qterm";
+ PIDFile = "/var/spool/torque/server_priv/server.lock";
+ };
+ };
+
+ systemd.services.torque-scheduler = {
+ path = [ torque ];
+
+ requires = [ "torque-server-init.service" ];
+ after = [ "torque-server-init.service" ];
+
+ serviceConfig = {
+ Type = "forking";
+ ExecStart = "${torque}/bin/pbs_sched";
+ PIDFile = "/var/spool/torque/sched_priv/sched.lock";
+ };
+ };
+
+ };
+}
diff --git a/nixos/modules/services/continuous-integration/jenkins/default.nix b/nixos/modules/services/continuous-integration/jenkins/default.nix
index b01b5c3245a..29a81f066ab 100644
--- a/nixos/modules/services/continuous-integration/jenkins/default.nix
+++ b/nixos/modules/services/continuous-integration/jenkins/default.nix
@@ -15,7 +15,7 @@ in {
user = mkOption {
default = "jenkins";
- type = with types; string;
+ type = types.str;
description = ''
User the jenkins server should execute under.
'';
@@ -23,16 +23,25 @@ in {
group = mkOption {
default = "jenkins";
- type = with types; string;
+ type = types.str;
description = ''
If the default user "jenkins" is configured then this is the primary
group of that user.
'';
};
+ extraGroups = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "wheel" "dialout" ];
+ description = ''
+ List of extra groups that the "jenkins" user should be a part of.
+ '';
+ };
+
home = mkOption {
default = "/var/lib/jenkins";
- type = with types; string;
+ type = types.path;
description = ''
The path to use as JENKINS_HOME. If the default user "jenkins" is configured then
this is the home of the "jenkins" user.
@@ -57,12 +66,21 @@ in {
environment = mkOption {
default = { NIX_REMOTE = "daemon"; };
- type = with types; attrsOf string;
+ type = with types; attrsOf str;
description = ''
Additional environment variables to be passed to the jenkins process.
The environment will always include JENKINS_HOME.
'';
};
+
+ extraOptions = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "--debug=9" "--httpListenAddress=localhost" ];
+ description = ''
+ Additional command line arguments to pass to Jenkins.
+ '';
+ };
};
};
@@ -78,6 +96,7 @@ in {
createHome = true;
home = cfg.home;
group = cfg.group;
+ extraGroups = cfg.extraGroups;
useDefaultShell = true;
uid = config.ids.uids.jenkins;
};
@@ -94,7 +113,7 @@ in {
path = cfg.packages;
script = ''
- ${pkgs.jdk}/bin/java -jar ${pkgs.jenkins} --httpPort=${toString cfg.port}
+ ${pkgs.jdk}/bin/java -jar ${pkgs.jenkins} --httpPort=${toString cfg.port} ${concatStringsSep " " cfg.extraOptions}
'';
postStart = ''
diff --git a/nixos/modules/services/continuous-integration/jenkins/slave.nix b/nixos/modules/services/continuous-integration/jenkins/slave.nix
index 5836d92a4fc..a0216caf2b5 100644
--- a/nixos/modules/services/continuous-integration/jenkins/slave.nix
+++ b/nixos/modules/services/continuous-integration/jenkins/slave.nix
@@ -23,7 +23,7 @@ in {
user = mkOption {
default = "jenkins";
- type = with types; string;
+ type = types.str;
description = ''
User the jenkins slave agent should execute under.
'';
@@ -31,7 +31,7 @@ in {
group = mkOption {
default = "jenkins";
- type = with types; string;
+ type = types.str;
description = ''
If the default slave agent user "jenkins" is configured then this is
the primary group of that user.
@@ -40,7 +40,7 @@ in {
home = mkOption {
default = "/var/lib/jenkins";
- type = with types; string;
+ type = types.path;
description = ''
The path to use as JENKINS_HOME. If the default user "jenkins" is configured then
this is the home of the "jenkins" user.
diff --git a/nixos/modules/services/databases/firebird.nix b/nixos/modules/services/databases/firebird.nix
index 83dd4951170..c874b218a5e 100644
--- a/nixos/modules/services/databases/firebird.nix
+++ b/nixos/modules/services/databases/firebird.nix
@@ -159,5 +159,7 @@ in
uid = config.ids.uids.firebird;
};
+ users.extraGroups.firebird.gid = config.ids.gids.firebird;
+
};
}
diff --git a/nixos/modules/services/databases/influxdb.nix b/nixos/modules/services/databases/influxdb.nix
index 61fe96d5d64..b57ccebae16 100644
--- a/nixos/modules/services/databases/influxdb.nix
+++ b/nixos/modules/services/databases/influxdb.nix
@@ -224,6 +224,11 @@ in
mkdir -m 0770 -p ${cfg.dataDir}
if [ "$(id -u)" = 0 ]; then chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}; fi
'';
+ postStart = mkBefore ''
+ until ${pkgs.curl}/bin/curl -s -o /dev/null 'http://${cfg.bindAddress}:${toString cfg.apiPort}/'; do
+ sleep 1;
+ done
+ '';
};
users.extraUsers = optional (cfg.user == "influxdb") {
diff --git a/nixos/modules/services/databases/mongodb.nix b/nixos/modules/services/databases/mongodb.nix
index fe82ca430e1..02e44ad8870 100644
--- a/nixos/modules/services/databases/mongodb.nix
+++ b/nixos/modules/services/databases/mongodb.nix
@@ -15,9 +15,11 @@ let
bind_ip = ${cfg.bind_ip}
${optionalString cfg.quiet "quiet = true"}
dbpath = ${cfg.dbpath}
- logpath = ${cfg.logpath}
- logappend = ${b2s cfg.logappend}
+ syslog = true
+ fork = true
+ pidfilepath = ${cfg.pidFile}
${optionalString (cfg.replSetName != "") "replSet = ${cfg.replSetName}"}
+ ${cfg.extraConfig}
'';
in
@@ -65,14 +67,9 @@ in
description = "Location where MongoDB stores its files";
};
- logpath = mkOption {
- default = "/var/log/mongodb/mongod.log";
- description = "Location where MongoDB stores its logfile";
- };
-
- logappend = mkOption {
- default = true;
- description = "Append logfile instead over overwriting";
+ pidFile = mkOption {
+ default = "/var/run/mongodb.pid";
+ description = "Location of MongoDB pid file";
};
replSetName = mkOption {
@@ -82,6 +79,14 @@ in
Otherwise, leave empty to run as single node.
'';
};
+
+ extraConfig = mkOption {
+ default = "";
+ example = ''
+ nojournal = true
+ '';
+ description = "MongoDB extra configuration";
+ };
};
};
@@ -99,22 +104,6 @@ in
environment.systemPackages = [ mongodb ];
- systemd.services.mongodb_init =
- { description = "MongoDB server initialisation";
-
- wantedBy = [ "mongodb.service" ];
- before = [ "mongodb.service" ];
-
- serviceConfig.Type = "oneshot";
-
- script = ''
- if ! test -e ${cfg.dbpath}; then
- install -d -m0700 -o ${cfg.user} ${cfg.dbpath}
- install -d -m0755 -o ${cfg.user} `dirname ${cfg.logpath}`
- fi
- '';
- };
-
systemd.services.mongodb =
{ description = "MongoDB server";
@@ -124,7 +113,20 @@ in
serviceConfig = {
ExecStart = "${mongodb}/bin/mongod --quiet --config ${mongoCnf}";
User = cfg.user;
+ PIDFile = cfg.pidFile;
+ Type = "forking";
+ TimeoutStartSec=120; # intial creating of journal can take some time
+ PermissionsStartOnly = true;
};
+
+ preStart = ''
+ if ! test -e ${cfg.dbpath}; then
+ install -d -m0700 -o ${cfg.user} ${cfg.dbpath}
+ fi
+ if ! test -e ${cfg.pidFile}; then
+ install -D -o ${cfg.user} /dev/null ${cfg.pidFile}
+ fi
+ '';
};
};
diff --git a/nixos/modules/services/databases/neo4j.nix b/nixos/modules/services/databases/neo4j.nix
new file mode 100644
index 00000000000..575034c93ab
--- /dev/null
+++ b/nixos/modules/services/databases/neo4j.nix
@@ -0,0 +1,149 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.neo4j;
+
+ serverConfig = pkgs.writeText "neo4j-server.properties" ''
+ org.neo4j.server.database.location=${cfg.dataDir}/data/graph.db
+ org.neo4j.server.webserver.address=${cfg.host}
+ org.neo4j.server.webserver.port=${toString cfg.port}
+ ${optionalString cfg.enableHttps ''
+ org.neo4j.server.webserver.https.enabled=true
+ org.neo4j.server.webserver.https.port=${toString cfg.httpsPort}
+ org.neo4j.server.webserver.https.cert.location=${cfg.cert}
+ org.neo4j.server.webserver.https.key.location=${cfg.key}
+ org.neo4j.server.webserver.https.keystore.location=${cfg.dataDir}/data/keystore
+ ''}
+ org.neo4j.server.webadmin.rrdb.location=${cfg.dataDir}/data/rrd
+ org.neo4j.server.webadmin.data.uri=/db/data/
+ org.neo4j.server.webadmin.management.uri=/db/manage/
+ org.neo4j.server.db.tuning.properties=${cfg.package}/share/neo4j/conf/neo4j.properties
+ org.neo4j.server.manage.console_engines=shell
+ ${cfg.extraServerConfig}
+ '';
+
+ loggingConfig = pkgs.writeText "logging.properties" cfg.loggingConfig;
+
+ wrapperConfig = pkgs.writeText "neo4j-wrapper.conf" ''
+ wrapper.java.additional=-Dorg.neo4j.server.properties=${serverConfig}
+ wrapper.java.additional=-Djava.util.logging.config.file=${loggingConfig}
+ wrapper.java.additional=-XX:+UseConcMarkSweepGC
+ wrapper.java.additional=-XX:+CMSClassUnloadingEnabled
+ wrapper.pidfile=${cfg.dataDir}/neo4j-server.pid
+ wrapper.name=neo4j
+ '';
+
+in {
+
+ ###### interface
+
+ options.services.neo4j = {
+ enable = mkOption {
+ description = "Whether to enable neo4j.";
+ default = false;
+ type = types.uniq types.bool;
+ };
+
+ package = mkOption {
+ description = "Neo4j package to use.";
+ default = pkgs.neo4j;
+ type = types.package;
+ };
+
+ host = mkOption {
+ description = "Neo4j listen address.";
+ default = "127.0.0.1";
+ type = types.str;
+ };
+
+ port = mkOption {
+ description = "Neo4j port to listen for HTTP traffic.";
+ default = 7474;
+ type = types.int;
+ };
+
+ enableHttps = mkOption {
+ description = "Enable https for Neo4j.";
+ default = false;
+ type = types.bool;
+ };
+
+ httpsPort = mkOption {
+ description = "Neo4j port to listen for HTTPS traffic.";
+ default = 7473;
+ type = types.int;
+ };
+
+ cert = mkOption {
+ description = "Neo4j https certificate.";
+ default = "${cfg.dataDir}/conf/ssl/neo4j.cert";
+ type = types.path;
+ };
+
+ key = mkOption {
+ description = "Neo4j https certificate key.";
+ default = "${cfg.dataDir}/conf/ssl/neo4j.key";
+ type = types.path;
+ };
+
+ dataDir = mkOption {
+ description = "Neo4j data directory.";
+ default = "/var/lib/neo4j";
+ type = types.path;
+ };
+
+ loggingConfig = mkOption {
+ description = "Neo4j logging configuration.";
+ default = ''
+ handlers=java.util.logging.ConsoleHandler
+ .level=INFO
+ org.neo4j.server.level=INFO
+
+ java.util.logging.ConsoleHandler.level=INFO
+ java.util.logging.ConsoleHandler.formatter=org.neo4j.server.logging.SimpleConsoleFormatter
+ java.util.logging.ConsoleHandler.filter=org.neo4j.server.logging.NeoLogFilter
+ '';
+ type = types.lines;
+ };
+
+ extraServerConfig = mkOption {
+ description = "Extra configuration for neo4j server.";
+ default = "";
+ type = types.lines;
+ };
+
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+ systemd.services.neo4j = {
+ description = "Neo4j Daemon";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+ environment = { NEO4J_INSTANCE = cfg.dataDir; };
+ serviceConfig = {
+ ExecStart = "${cfg.package}/bin/neo4j console";
+ User = "neo4j";
+ PermissionsStartOnly = true;
+ };
+ preStart = ''
+ mkdir -m 0700 -p ${cfg.dataDir}/{data/graph.db,conf}
+ ln -fs ${wrapperConfig} ${cfg.dataDir}/conf/neo4j-wrapper.conf
+ if [ "$(id -u)" = 0 ]; then chown -R neo4j ${cfg.dataDir}; fi
+ '';
+ };
+
+ environment.systemPackages = [ pkgs.neo4j ];
+
+ users.extraUsers = singleton {
+ name = "neo4j";
+ uid = config.ids.uids.neo4j;
+ description = "Neo4j daemon user";
+ home = cfg.dataDir;
+ };
+ };
+
+}
diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix
index c95238b3451..eae4c114fc1 100644
--- a/nixos/modules/services/databases/openldap.nix
+++ b/nixos/modules/services/databases/openldap.nix
@@ -68,7 +68,7 @@ in
users.extraUsers = optionalAttrs (cfg.user == "openldap") (singleton
{ name = "openldap";
- group = "openldap";
+ group = cfg.group;
uid = config.ids.uids.openldap;
});
diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix
index ad83cb553e1..de14c56f797 100644
--- a/nixos/modules/services/databases/postgresql.nix
+++ b/nixos/modules/services/databases/postgresql.nix
@@ -85,7 +85,7 @@ in
Defines how users authenticate themselves to the server. By
default, "trust" access to local users will always be granted
along with any other custom options. If you do not want this,
- set this option using "pkgs.lib.mkForce" to override this
+ set this option using "lib.mkForce" to override this
behaviour.
'';
};
@@ -225,14 +225,14 @@ in
# Wait for PostgreSQL to be ready to accept connections.
postStart =
''
- while ! psql postgres -c "" 2> /dev/null; do
+ while ! psql --port=${toString cfg.port} postgres -c "" 2> /dev/null; do
if ! kill -0 "$MAINPID"; then exit 1; fi
sleep 0.1
done
if test -e "${cfg.dataDir}/.first_startup"; then
${optionalString (cfg.initialScript != null) ''
- cat "${cfg.initialScript}" | psql postgres
+ cat "${cfg.initialScript}" | psql --port=${toString cfg.port} postgres
''}
rm -f "${cfg.dataDir}/.first_startup"
fi
diff --git a/nixos/modules/services/databases/postgresql.xml b/nixos/modules/services/databases/postgresql.xml
new file mode 100644
index 00000000000..e98b431bd60
--- /dev/null
+++ b/nixos/modules/services/databases/postgresql.xml
@@ -0,0 +1,77 @@
+
+
+PostgreSQL
+
+
+
+
+Source: modules/services/databases/postgresql.nix
+
+Upstream documentation:
+
+
+
+PostgreSQL is an advanced, free relational database.
+
+Configuring
+
+To enable PostgreSQL, add the following to your
+configuration.nix:
+
+
+services.postgresql.enable = true;
+services.postgresql.package = pkgs.postgresql93;
+
+
+Note that you are required to specify the desired version of
+PostgreSQL (e.g. pkgs.postgresql93). Since
+upgrading your PostgreSQL version requires a database dump and reload
+(see below), NixOS cannot provide a default value for
+ such as the most recent
+release of PostgreSQL.
+
+
+
+By default, PostgreSQL stores its databases in
+/var/db/postgresql. You can override this using
+, e.g.
+
+
+services.postgresql.dataDir = "/data/postgresql";
+
+
+
+
+
+
+
+Upgrading
+
+FIXME: document dump/upgrade/load cycle.
+
+
+
+
+Options
+
+FIXME: auto-generated list of module options.
+
+
+
+
+
diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix
index 2521e356bf3..b91c389e90a 100644
--- a/nixos/modules/services/databases/redis.nix
+++ b/nixos/modules/services/databases/redis.nix
@@ -38,86 +38,92 @@ in
services.redis = {
enable = mkOption {
+ type = types.bool;
default = false;
description = "Whether to enable the Redis server.";
};
package = mkOption {
+ type = types.package;
default = pkgs.redis;
description = "Which Redis derivation to use.";
- type = types.package;
};
user = mkOption {
+ type = types.str;
default = "redis";
description = "User account under which Redis runs.";
};
pidFile = mkOption {
+ type = types.path;
default = "/var/lib/redis/redis.pid";
description = "";
};
port = mkOption {
+ type = types.int;
default = 6379;
description = "The port for Redis to listen to.";
- type = with types; int;
};
bind = mkOption {
+ type = with types; nullOr str;
default = null; # All interfaces
description = "The IP interface to bind to.";
example = "127.0.0.1";
};
unixSocket = mkOption {
+ type = with types; nullOr path;
default = null;
description = "The path to the socket to bind to.";
example = "/var/run/redis.sock";
};
logLevel = mkOption {
+ type = types.str;
default = "notice"; # debug, verbose, notice, warning
example = "debug";
description = "Specify the server verbosity level, options: debug, verbose, notice, warning.";
- type = with types; string;
};
logfile = mkOption {
+ type = types.str;
default = "/dev/null";
description = "Specify the log file name. Also 'stdout' can be used to force Redis to log on the standard output.";
example = "/var/log/redis.log";
- type = with types; string;
};
syslog = mkOption {
+ type = types.bool;
default = true;
description = "Enable logging to the system logger.";
- type = with types; bool;
};
databases = mkOption {
+ type = types.int;
default = 16;
description = "Set the number of databases.";
- type = with types; int;
};
save = mkOption {
+ type = with types; listOf (listOf int);
default = [ [900 1] [300 10] [60 10000] ];
description = "The schedule in which data is persisted to disk, represented as a list of lists where the first element represent the amount of seconds and the second the number of changes.";
example = [ [900 1] [300 10] [60 10000] ];
};
dbFilename = mkOption {
+ type = types.str;
default = "dump.rdb";
description = "The filename where to dump the DB.";
- type = with types; string;
};
dbpath = mkOption {
+ type = types.path;
default = "/var/lib/redis";
description = "The DB will be written inside this directory, with the filename specified using the 'dbFilename' configuration.";
- type = with types; string;
};
slaveOf = mkOption {
@@ -135,46 +141,47 @@ in
};
requirePass = mkOption {
+ type = with types; nullOr str;
default = null;
description = "Password for database (STORED PLAIN TEXT, WORLD-READABLE IN NIX STORE)";
example = "letmein!";
};
appendOnly = mkOption {
+ type = types.bool;
default = false;
description = "By default data is only periodically persisted to disk, enable this option to use an append-only file for improved persistence.";
- type = with types; bool;
};
appendOnlyFilename = mkOption {
+ type = types.str;
default = "appendonly.aof";
description = "Filename for the append-only file (stored inside of dbpath)";
- type = with types; string;
};
appendFsync = mkOption {
+ type = types.str;
default = "everysec"; # no, always, everysec
description = "How often to fsync the append-only log, options: no, always, everysec.";
- type = with types; string;
};
slowLogLogSlowerThan = mkOption {
+ type = types.int;
default = 10000;
description = "Log queries whose execution take longer than X in milliseconds.";
example = 1000;
- type = with types; int;
};
slowLogMaxLen = mkOption {
+ type = types.int;
default = 128;
description = "Maximum number of items to keep in slow log.";
- type = with types; int;
};
extraConfig = mkOption {
+ type = types.lines;
default = "";
description = "Extra configuration options for redis.conf.";
- type = with types; string;
};
};
diff --git a/nixos/modules/services/desktops/gnome3/at-spi2-core.nix b/nixos/modules/services/desktops/gnome3/at-spi2-core.nix
index 615f272e7b9..6e4c59f4bb3 100644
--- a/nixos/modules/services/desktops/gnome3/at-spi2-core.nix
+++ b/nixos/modules/services/desktops/gnome3/at-spi2-core.nix
@@ -4,9 +4,6 @@
with lib;
-let
- gnome3 = config.environment.gnome3.packageSet;
-in
{
###### interface
@@ -33,9 +30,9 @@ in
config = mkIf config.services.gnome3.at-spi2-core.enable {
- environment.systemPackages = [ gnome3.at_spi2_core ];
+ environment.systemPackages = [ pkgs.at_spi2_core ];
- services.dbus.packages = [ gnome3.at_spi2_core ];
+ services.dbus.packages = [ pkgs.at_spi2_core ];
};
diff --git a/nixos/modules/services/desktops/gnome3/gnome-documents.nix b/nixos/modules/services/desktops/gnome3/gnome-documents.nix
index 2279ef48fb9..88bbdadfcbd 100644
--- a/nixos/modules/services/desktops/gnome3/gnome-documents.nix
+++ b/nixos/modules/services/desktops/gnome3/gnome-documents.nix
@@ -1,8 +1,8 @@
# GNOME Documents daemon.
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
-with pkgs.lib;
+with lib;
let
gnome3 = config.environment.gnome3.packageSet;
diff --git a/nixos/modules/services/desktops/gnome3/gnome-keyring.nix b/nixos/modules/services/desktops/gnome3/gnome-keyring.nix
index be14f1fcbc0..566c8a50e26 100644
--- a/nixos/modules/services/desktops/gnome3/gnome-keyring.nix
+++ b/nixos/modules/services/desktops/gnome3/gnome-keyring.nix
@@ -1,8 +1,8 @@
# GNOME Keyring daemon.
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
-with pkgs.lib;
+with lib;
let
gnome3 = config.environment.gnome3.packageSet;
diff --git a/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix b/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix
index a41fb0101f0..82d04c62c70 100644
--- a/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix
+++ b/nixos/modules/services/desktops/gnome3/gnome-online-accounts.nix
@@ -1,8 +1,8 @@
# GNOME Online Accounts daemon.
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
-with pkgs.lib;
+with lib;
let
gnome3 = config.environment.gnome3.packageSet;
diff --git a/nixos/modules/services/desktops/gnome3/gnome-online-miners.nix b/nixos/modules/services/desktops/gnome3/gnome-online-miners.nix
index 030d4bac6a7..6acd633b62c 100644
--- a/nixos/modules/services/desktops/gnome3/gnome-online-miners.nix
+++ b/nixos/modules/services/desktops/gnome3/gnome-online-miners.nix
@@ -1,8 +1,8 @@
# GNOME Online Miners daemon.
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
-with pkgs.lib;
+with lib;
let
gnome3 = config.environment.gnome3.packageSet;
diff --git a/nixos/modules/services/desktops/gnome3/gnome-user-share.nix b/nixos/modules/services/desktops/gnome3/gnome-user-share.nix
index 3b6c713f7be..e5c94cff7c8 100644
--- a/nixos/modules/services/desktops/gnome3/gnome-user-share.nix
+++ b/nixos/modules/services/desktops/gnome3/gnome-user-share.nix
@@ -1,8 +1,8 @@
# GNOME User Share daemon.
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
-with pkgs.lib;
+with lib;
let
gnome3 = config.environment.gnome3.packageSet;
diff --git a/nixos/modules/services/desktops/gnome3/gvfs.nix b/nixos/modules/services/desktops/gnome3/gvfs.nix
index 1a003ddd1ef..7e1382b161e 100644
--- a/nixos/modules/services/desktops/gnome3/gvfs.nix
+++ b/nixos/modules/services/desktops/gnome3/gvfs.nix
@@ -1,8 +1,8 @@
# gvfs backends
-{ config, pkgs, ... }:
+{ config, lib, ... }:
-with pkgs.lib;
+with lib;
let
gnome3 = config.environment.gnome3.packageSet;
diff --git a/nixos/modules/services/desktops/gnome3/seahorse.nix b/nixos/modules/services/desktops/gnome3/seahorse.nix
index 01e4a24f267..45925aaca9b 100644
--- a/nixos/modules/services/desktops/gnome3/seahorse.nix
+++ b/nixos/modules/services/desktops/gnome3/seahorse.nix
@@ -1,8 +1,8 @@
# Seahorse daemon.
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
-with pkgs.lib;
+with lib;
let
gnome3 = config.environment.gnome3.packageSet;
diff --git a/nixos/modules/services/desktops/gnome3/tracker.nix b/nixos/modules/services/desktops/gnome3/tracker.nix
index 670e585c6f5..8c5935a5ee3 100644
--- a/nixos/modules/services/desktops/gnome3/tracker.nix
+++ b/nixos/modules/services/desktops/gnome3/tracker.nix
@@ -1,8 +1,8 @@
# Tracker daemon.
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
-with pkgs.lib;
+with lib;
let
gnome3 = config.environment.gnome3.packageSet;
diff --git a/nixos/modules/services/hardware/acpid.nix b/nixos/modules/services/hardware/acpid.nix
index a710636c140..a20b1a1ee3a 100644
--- a/nixos/modules/services/hardware/acpid.nix
+++ b/nixos/modules/services/hardware/acpid.nix
@@ -6,7 +6,7 @@ let
acpiConfDir = pkgs.runCommand "acpi-events" {}
''
- ensureDir $out
+ mkdir -p $out
${
# Generate a configuration file for each event. (You can't have
# multiple events in one config file...)
@@ -16,7 +16,7 @@ let
echo "event=${event.event}" > $fn
echo "action=${pkgs.writeScript "${event.name}.sh" event.action}" >> $fn
'';
- in pkgs.lib.concatMapStrings f events
+ in lib.concatMapStrings f events
}
'';
diff --git a/nixos/modules/services/hardware/amd-hybrid-graphics.nix b/nixos/modules/services/hardware/amd-hybrid-graphics.nix
index d938867186d..087bd0e0409 100644
--- a/nixos/modules/services/hardware/amd-hybrid-graphics.nix
+++ b/nixos/modules/services/hardware/amd-hybrid-graphics.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
@@ -6,9 +6,9 @@
options = {
- hardware.amdHybridGraphics.disable = pkgs.lib.mkOption {
+ hardware.amdHybridGraphics.disable = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Completely disable the AMD graphics card and use the
integrated graphics processor instead.
@@ -20,7 +20,7 @@
###### implementation
- config = pkgs.lib.mkIf config.hardware.amdHybridGraphics.disable {
+ config = lib.mkIf config.hardware.amdHybridGraphics.disable {
systemd.services."amd-hybrid-graphics" = {
path = [ pkgs.bash ];
description = "Disable AMD Card";
diff --git a/nixos/modules/services/hardware/nvidia-optimus.nix b/nixos/modules/services/hardware/nvidia-optimus.nix
index 4c0ce794d4f..9fe4021c424 100644
--- a/nixos/modules/services/hardware/nvidia-optimus.nix
+++ b/nixos/modules/services/hardware/nvidia-optimus.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let kernel = config.boot.kernelPackages; in
@@ -8,9 +8,9 @@ let kernel = config.boot.kernelPackages; in
options = {
- hardware.nvidiaOptimus.disable = pkgs.lib.mkOption {
+ hardware.nvidiaOptimus.disable = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
Completely disable the NVIDIA graphics card and use the
integrated graphics processor instead.
@@ -22,7 +22,7 @@ let kernel = config.boot.kernelPackages; in
###### implementation
- config = pkgs.lib.mkIf config.hardware.nvidiaOptimus.disable {
+ config = lib.mkIf config.hardware.nvidiaOptimus.disable {
boot.blacklistedKernelModules = ["nouveau" "nvidia" "nvidiafb"];
boot.kernelModules = [ "bbswitch" ];
boot.extraModulePackages = [ kernel.bbswitch ];
diff --git a/nixos/modules/services/hardware/pommed.nix b/nixos/modules/services/hardware/pommed.nix
index 04db46999b0..a24557b40ba 100644
--- a/nixos/modules/services/hardware/pommed.nix
+++ b/nixos/modules/services/hardware/pommed.nix
@@ -4,30 +4,34 @@ with lib;
{
- options.services.hardware.pommed = {
- enable = mkOption {
- default = false;
- description = ''
- Whether to use the pommed tool to handle Apple laptop keyboard hotkeys.
- '';
+ options = {
+
+ services.hardware.pommed = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to use the pommed tool to handle Apple laptop keyboard hotkeys.
+ '';
+ };
+
+ configFile = mkOption {
+ type = types.path;
+ description = ''
+ The path to the pommed.conf file.
+ '';
+ };
};
- configFile = mkOption {
- default = "${pkgs.pommed}/etc/pommed.conf";
- description = ''
- The contents of the pommed.conf file.
- '';
- };
};
config = mkIf config.services.hardware.pommed.enable {
environment.systemPackages = [ pkgs.polkit ];
- environment.etc = [
- { source = config.services.hardware.pommed.configFile;
- target = "pommed.conf";
- }
- ];
+ environment.etc."pommed.conf".source = config.services.hardware.pommed.configFile;
+
+ services.hardware.pommed.configFile = "${pkgs.pommed}/etc/pommed.conf";
services.dbus.packages = [ pkgs.pommed ];
diff --git a/nixos/modules/services/hardware/tcsd.nix b/nixos/modules/services/hardware/tcsd.nix
new file mode 100644
index 00000000000..d7f6c188feb
--- /dev/null
+++ b/nixos/modules/services/hardware/tcsd.nix
@@ -0,0 +1,139 @@
+# tcsd daemon.
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+let
+
+ cfg = config.services.tcsd;
+
+ tcsdConf = pkgs.writeText "tcsd.conf" ''
+ port = 30003
+ num_threads = 10
+ system_ps_file = ${cfg.stateDir}/system.data
+ # This is the log of each individual measurement done by the system.
+ # By re-calculating the PCR registers based on this information, even
+ # finer details about the measured environment can be inferred than
+ # what is available directly from the PCR registers.
+ firmware_log_file = /sys/kernel/security/tpm0/binary_bios_measurements
+ kernel_log_file = /sys/kernel/security/ima/binary_runtime_measurements
+ #firmware_pcrs = 0,1,2,3,4,5,6,7
+ #kernel_pcrs = 10,11
+ platform_cred = ${cfg.platformCred}
+ conformance_cred = ${cfg.conformanceCred}
+ endorsement_cred = ${cfg.endorsementCred}
+ #remote_ops = create_key,random
+ #host_platform_class = server_12
+ #all_platform_classes = pc_11,pc_12,mobile_12
+ '';
+
+in
+{
+
+ ###### interface
+
+ options = {
+
+ services.tcsd = {
+
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Whether to enable tcsd, a Trusted Computing management service
+ that provides TCG Software Stack (TSS). The tcsd daemon is
+ the only portal to the Trusted Platform Module (TPM), a hardware
+ chip on the motherboard.
+ '';
+ };
+
+ user = mkOption {
+ default = "tss";
+ type = types.string;
+ description = "User account under which tcsd runs.";
+ };
+
+ group = mkOption {
+ default = "tss";
+ type = types.string;
+ description = "Group account under which tcsd runs.";
+ };
+
+ stateDir = mkOption {
+ default = "/var/lib/tpm";
+ type = types.path;
+ description = ''
+ The location of the system persistent storage file.
+ The system persistent storage file holds keys and data across
+ restarts of the TCSD and system reboots.
+ '';
+ };
+
+ platformCred = mkOption {
+ default = "${cfg.stateDir}/platform.cert";
+ type = types.path;
+ description = ''
+ Path to the platform credential for your TPM. Your TPM
+ manufacturer may have provided you with a set of credentials
+ (certificates) that should be used when creating identities
+ using your TPM. When a user of your TPM makes an identity,
+ this credential will be encrypted as part of that process.
+ See the 1.1b TPM Main specification section 9.3 for information
+ on this process. '';
+ };
+
+ conformanceCred = mkOption {
+ default = "${cfg.stateDir}/conformance.cert";
+ type = types.path;
+ description = ''
+ Path to the conformance credential for your TPM.
+ See also the platformCred option'';
+ };
+
+ endorsementCred = mkOption {
+ default = "${cfg.stateDir}/endorsement.cert";
+ type = types.path;
+ description = ''
+ Path to the endorsement credential for your TPM.
+ See also the platformCred option'';
+ };
+ };
+
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ environment.systemPackages = [ pkgs.trousers ];
+
+# system.activationScripts.tcsd =
+# ''
+# chown ${cfg.user}:${cfg.group} ${tcsdConf}
+# '';
+
+ systemd.services.tcsd = {
+ description = "TCSD";
+ after = [ "systemd-udev-settle.service" ];
+ wantedBy = [ "multi-user.target" ];
+ path = [ pkgs.trousers ];
+ preStart =
+ ''
+ mkdir -m 0700 -p ${cfg.stateDir}
+ chown -R ${cfg.user}:${cfg.group} ${cfg.stateDir}
+ '';
+ serviceConfig.ExecStart = "${pkgs.trousers}/sbin/tcsd -f -c ${tcsdConf}";
+ };
+
+ users.extraUsers = optionalAttrs (cfg.user == "tss") (singleton
+ { name = "tss";
+ group = "tss";
+ uid = config.ids.uids.nginx;
+ });
+
+ users.extraGroups = optionalAttrs (cfg.group == "tss") (singleton
+ { name = "tss";
+ gid = config.ids.gids.nginx;
+ });
+ };
+}
diff --git a/nixos/modules/services/hardware/thermald.nix b/nixos/modules/services/hardware/thermald.nix
new file mode 100644
index 00000000000..5233794a20c
--- /dev/null
+++ b/nixos/modules/services/hardware/thermald.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.thermald;
+in {
+ ###### interface
+ options = {
+ services.thermald = {
+ enable = mkOption {
+ default = false;
+ description = ''
+ Whether to enable thermald, the temperature management daemon.
+ '';
+ };
+ };
+ };
+
+ ###### implementation
+ config = mkIf cfg.enable {
+ systemd.services.thermald = {
+ description = "Thermal Daemon Service";
+ wantedBy = [ "multi-user.target" ];
+ script = "exec ${pkgs.thermald}/sbin/thermald --no-daemon --dbus-enable";
+ };
+ };
+}
diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix
index 068d14217a2..2a6f4cfb4e3 100644
--- a/nixos/modules/services/hardware/udev.nix
+++ b/nixos/modules/services/hardware/udev.nix
@@ -31,6 +31,7 @@ let
buildCommand = ''
mkdir -p $out
shopt -s nullglob
+ set +o pipefail
# Set a reasonable $PATH for programs called by udev rules.
echo 'ENV{PATH}="${udevPath}/bin:${udevPath}/sbin"' > $out/00-path.rules
@@ -168,7 +169,6 @@ in
hardware.firmware = mkOption {
type = types.listOf types.path;
default = [];
- example = [ "/root/my-firmware" ];
description = ''
List of directories containing firmware files. Such files
will be loaded automatically if the kernel asks for them
@@ -177,10 +177,10 @@ in
firmware file with the same name, the first path in the list
takes precedence. Note that you must rebuild your system if
you add files to any of these directories. For quick testing,
- put firmware files in /root/test-firmware and add that
- directory to the list.
- Note that you can also add firmware packages to this
- list as these are directories in the nix store.
+ put firmware files in /root/test-firmware
+ and add that directory to the list. Note that you can also
+ add firmware packages to this list as these are directories in
+ the nix store.
'';
apply = list: pkgs.buildEnv {
name = "firmware";
@@ -244,6 +244,11 @@ in
echo "regenerating udev hardware database..."
${config.systemd.package}/bin/udevadm hwdb --update && ln -sfn ${config.systemd.package} /var/lib/udev/prev-systemd
fi
+
+ # Allow the kernel to find our firmware.
+ if [ -e /sys/module/firmware_class/parameters/path ]; then
+ echo -n "${config.hardware.firmware}" > /sys/module/firmware_class/parameters/path
+ fi
'';
systemd.services.systemd-udevd =
diff --git a/nixos/modules/services/logging/logrotate.nix b/nixos/modules/services/logging/logrotate.nix
index 804f9a0847f..0186452de95 100644
--- a/nixos/modules/services/logging/logrotate.nix
+++ b/nixos/modules/services/logging/logrotate.nix
@@ -8,10 +8,6 @@ let
configFile = pkgs.writeText "logrotate.conf"
cfg.config;
- cronJob = ''
- 5 * * * * root ${pkgs.logrotate}/sbin/logrotate ${configFile}
- '';
-
in
{
options = {
@@ -25,6 +21,7 @@ in
config = mkOption {
default = "";
+ type = types.lines;
description = ''
The contents of the logrotate config file
'';
@@ -33,6 +30,16 @@ in
};
config = mkIf cfg.enable {
- services.cron.systemCronJobs = [ cronJob ];
+ systemd.services.logrotate = {
+ description = "Logrotate Service";
+ wantedBy = [ "multi-user.target" ];
+ startAt = "*-*-* *:05:00";
+
+ serviceConfig.Restart = "no";
+ serviceConfig.User = "root";
+ script = ''
+ exec ${pkgs.logrotate}/sbin/logrotate ${configFile}
+ '';
+ };
};
}
diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix
index c92c8113570..117ee1c900f 100644
--- a/nixos/modules/services/logging/logstash.nix
+++ b/nixos/modules/services/logging/logstash.nix
@@ -4,6 +4,16 @@ with lib;
let
cfg = config.services.logstash;
+ pluginPath = lib.concatStringsSep ":" cfg.plugins;
+ havePluginPath = lib.length cfg.plugins > 0;
+ ops = lib.optionalString;
+ verbosityFlag = {
+ debug = "--debug";
+ info = "--verbose";
+ warn = ""; # intentionally empty
+ error = "--quiet";
+ fatal = "--silent";
+ }."${cfg.logLevel}";
in
@@ -11,20 +21,69 @@ in
###### interface
options = {
+
services.logstash = {
+
enable = mkOption {
+ type = types.bool;
default = false;
- description = "Enable logstash";
+ description = "Enable logstash.";
+ };
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.logstash;
+ example = literalExample "pkgs.logstash";
+ description = "Logstash package to use.";
+ };
+
+ plugins = mkOption {
+ type = types.listOf types.path;
+ default = [ ];
+ example = literalExample "[ pkgs.logstash-contrib ]";
+ description = "The paths to find other logstash plugins in.";
+ };
+
+ logLevel = mkOption {
+ type = types.enum [ "debug" "info" "warn" "error" "fatal" ];
+ default = "warn";
+ description = "Logging verbosity level.";
+ };
+
+ watchdogTimeout = mkOption {
+ type = types.int;
+ default = 10;
+ description = "Set watchdog timeout value in seconds.";
+ };
+
+ filterWorkers = mkOption {
+ type = types.int;
+ default = 1;
+ description = "The quantity of filter workers to run.";
};
enableWeb = mkOption {
+ type = types.bool;
default = false;
- description = "Enable logstash web interface";
+ description = "Enable the logstash web interface.";
+ };
+
+ address = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ description = "Address on which to start webserver.";
+ };
+
+ port = mkOption {
+ type = types.str;
+ default = "9292";
+ description = "Port on which to start webserver.";
};
inputConfig = mkOption {
+ type = types.lines;
default = ''stdin { type => "example" }'';
- description = "Logstash input configuration";
+ description = "Logstash input configuration.";
example = ''
# Read from journal
pipe {
@@ -35,8 +94,9 @@ in
};
filterConfig = mkOption {
+ type = types.lines;
default = ''noop {}'';
- description = "logstash filter configuration";
+ description = "logstash filter configuration.";
example = ''
if [type] == "syslog" {
# Keep only relevant systemd fields
@@ -52,13 +112,15 @@ in
};
outputConfig = mkOption {
+ type = types.lines;
default = ''stdout { debug => true debug_format => "json"}'';
- description = "Logstash output configuration";
+ description = "Logstash output configuration.";
example = ''
redis { host => "localhost" data_type => "list" key => "logstash" codec => json }
elasticsearch { embedded => true }
'';
};
+
};
};
@@ -69,21 +131,28 @@ in
systemd.services.logstash = with pkgs; {
description = "Logstash Daemon";
wantedBy = [ "multi-user.target" ];
-
+ environment = { JAVA_HOME = jre; };
serviceConfig = {
- ExecStart = "${jre}/bin/java -jar ${logstash} agent -f ${writeText "logstash.conf" ''
- input {
- ${cfg.inputConfig}
- }
+ ExecStart =
+ "${cfg.package}/bin/logstash agent " +
+ "-w ${toString cfg.filterWorkers} " +
+ ops havePluginPath "--pluginpath ${pluginPath} " +
+ "${verbosityFlag} " +
+ "--watchdog-timeout ${toString cfg.watchdogTimeout} " +
+ "-f ${writeText "logstash.conf" ''
+ input {
+ ${cfg.inputConfig}
+ }
- filter {
- ${cfg.filterConfig}
- }
+ filter {
+ ${cfg.filterConfig}
+ }
- output {
- ${cfg.outputConfig}
- }
- ''} ${optionalString cfg.enableWeb "-- web"}";
+ output {
+ ${cfg.outputConfig}
+ }
+ ''} " +
+ ops cfg.enableWeb "-- web -a ${cfg.address} -p ${cfg.port}";
};
};
};
diff --git a/nixos/modules/services/logging/syslog-ng.nix b/nixos/modules/services/logging/syslog-ng.nix
new file mode 100644
index 00000000000..2bf6d1ff790
--- /dev/null
+++ b/nixos/modules/services/logging/syslog-ng.nix
@@ -0,0 +1,94 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.syslog-ng;
+
+ syslogngConfig = pkgs.writeText "syslog-ng.conf" ''
+ ${cfg.configHeader}
+ ${cfg.extraConfig}
+ '';
+
+ ctrlSocket = "/run/syslog-ng/syslog-ng.ctl";
+ pidFile = "/run/syslog-ng/syslog-ng.pid";
+ persistFile = "/var/syslog-ng/syslog-ng.persist";
+
+ syslogngOptions = [
+ "--foreground"
+ "--module-path=${concatStringsSep ":" (["${cfg.package}/lib/syslog-ng"] ++ cfg.extraModulePaths)}"
+ "--cfgfile=${syslogngConfig}"
+ "--control=${ctrlSocket}"
+ "--persist-file=${persistFile}"
+ "--pidfile=${pidFile}"
+ ];
+
+in {
+
+ options = {
+
+ services.syslog-ng = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable the syslog-ng daemon.
+ '';
+ };
+ package = mkOption {
+ type = types.package;
+ default = pkgs.syslogng;
+ description = ''
+ The package providing syslog-ng binaries.
+ '';
+ };
+ extraModulePaths = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = literalExample ''
+ [ "''${pkgs.syslogng_incubator}/lib/syslog-ng" ]
+ '';
+ description = ''
+ A list of paths that should be included in syslog-ng's
+ --module-path option. They should usually
+ end in /lib/syslog-ng
+ '';
+ };
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Configuration added to the end of syslog-ng.conf.
+ '';
+ };
+ configHeader = mkOption {
+ type = types.lines;
+ default = ''
+ @version: 3.6
+ @include "scl.conf"
+ '';
+ description = ''
+ The very first lines of the configuration file. Should usually contain
+ the syslog-ng version header.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ systemd.services.syslog-ng = {
+ description = "syslog-ng daemon";
+ preStart = "mkdir -p /{var,run}/syslog-ng";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "multi-user.target" ]; # makes sure hostname etc is set
+ serviceConfig = {
+ Type = "notify";
+ StandardOutput = "null";
+ Restart = "on-failure";
+ ExecStart = "${cfg.package}/sbin/syslog-ng ${concatStringsSep " " syslogngOptions}";
+ };
+ };
+ };
+
+}
diff --git a/nixos/modules/services/mail/mlmmj.nix b/nixos/modules/services/mail/mlmmj.nix
new file mode 100644
index 00000000000..637974f05cd
--- /dev/null
+++ b/nixos/modules/services/mail/mlmmj.nix
@@ -0,0 +1,128 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.mlmmj;
+ stateDir = "/var/lib/mlmmj";
+ spoolDir = "/var/spool/mlmmj";
+ listDir = domain: list: "${spoolDir}/${domain}/${list}";
+ listCtl = domain: list: "${listDir domain list}/control";
+ transport = domain: list: "${domain}--${list}@local.list.mlmmj mlmmj:${domain}/${list}";
+ virtual = domain: list: "${list}@${domain} ${domain}--${list}@local.list.mlmmj";
+ alias = domain: list: "${list}: \"|${pkgs.mlmmj}/mlmmj-receive -L ${listDir domain list}/\"";
+ subjectPrefix = list: "[${list}]";
+ listAddress = domain: list: "${list}@${domain}";
+ customHeaders = list: domain: [ "List-Id: ${list}" "Reply-To: ${list}@${domain}" ];
+ footer = domain: list: "To unsubscribe send a mail to ${list}+unsubscribe@${domain}";
+ createList = d: l: ''
+ ${pkgs.coreutils}/bin/mkdir -p ${listCtl d l}
+ echo ${listAddress d l} > ${listCtl d l}/listadress
+ echo "${lib.concatStringsSep "\n" (customHeaders d l)}" > ${listCtl d l}/customheaders
+ echo ${footer d l} > ${listCtl d l}/footer
+ echo ${subjectPrefix l} > ${listCtl d l}/prefix
+ '';
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.mlmmj = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Enable mlmmj";
+ };
+
+ user = mkOption {
+ type = types.str;
+ default = "mlmmj";
+ description = "mailinglist local user";
+ };
+
+ group = mkOption {
+ type = types.str;
+ default = "mlmmj";
+ description = "mailinglist local group";
+ };
+
+ listDomain = mkOption {
+ type = types.str;
+ default = "localhost";
+ description = "Set the mailing list domain";
+ };
+
+ mailLists = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = "The collection of hosted maillists";
+ };
+
+ };
+
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers = singleton {
+ name = cfg.user;
+ description = "mlmmj user";
+ home = stateDir;
+ createHome = true;
+ uid = config.ids.uids.mlmmj;
+ group = cfg.group;
+ useDefaultShell = true;
+ };
+
+ users.extraGroups = singleton {
+ name = cfg.group;
+ gid = config.ids.gids.mlmmj;
+ };
+
+ services.postfix = {
+ enable = true;
+ recipientDelimiter= "+";
+ extraMasterConf = ''
+ mlmmj unix - n n - - pipe flags=ORhu user=mlmmj argv=${pkgs.mlmmj}/bin/mlmmj-recieve -F -L ${spoolDir}/$nextHop
+ '';
+
+ extraAliases = concatMapStrings (alias cfg.listDomain) cfg.mailLists;
+
+ extraConfig = ''
+ transport = hash:${stateDir}/transports
+ virtual = hash:${stateDir}/virtuals
+ '';
+ };
+
+ environment.systemPackages = [ pkgs.mlmmj ];
+
+ system.activationScripts.mlmmj = ''
+ ${pkgs.coreutils}/bin/mkdir -p ${stateDir} ${spoolDir}/${cfg.listDomain}
+ ${pkgs.coreutils}/bin/chown -R ${cfg.user}:${cfg.group} ${spoolDir}
+ ${lib.concatMapStrings (createList cfg.listDomain) cfg.mailLists}
+ echo ${lib.concatMapStrings (virtual cfg.listDomain) cfg.mailLists} > ${stateDir}/virtuals
+ echo ${cfg.listDomain} mailman: > ${stateDir}/transports
+ echo ${lib.concatMapStrings (transport cfg.listDomain) cfg.mailLists} >> ${stateDir}/transports
+ '';
+
+ systemd.services."mlmmj-maintd" = {
+ description = "mlmmj maintenance daemon";
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig = {
+ User = cfg.user;
+ Group = cfg.group;
+ ExecStart = "${pkgs.mlmmj}/bin/mlmmj-maintd -F -d ${spoolDir}/${cfg.listDomain}";
+ };
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/misc/cpuminer-cryptonight.nix b/nixos/modules/services/misc/cpuminer-cryptonight.nix
new file mode 100644
index 00000000000..f31526f8d10
--- /dev/null
+++ b/nixos/modules/services/misc/cpuminer-cryptonight.nix
@@ -0,0 +1,66 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.cpuminer-cryptonight;
+
+ json = builtins.toJSON (
+ cfg // {
+ enable = null;
+ threads =
+ if cfg.threads == 0 then null else toString cfg.threads;
+ }
+ );
+
+ confFile = builtins.toFile "cpuminer.json" json;
+in
+{
+
+ options = {
+
+ services.cpuminer-cryptonight = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable the cpuminer cryptonight miner.
+ '';
+ };
+ url = mkOption {
+ type = types.string;
+ description = "URL of mining server";
+ };
+ user = mkOption {
+ type = types.string;
+ description = "Username for mining server";
+ };
+ pass = mkOption {
+ type = types.string;
+ default = "x";
+ description = "Password for mining server";
+ };
+ threads = mkOption {
+ type = types.int;
+ default = 0;
+ description = "Number of miner threads, defaults to available processors";
+ };
+ };
+
+ };
+
+ config = mkIf config.services.cpuminer-cryptonight.enable {
+
+ systemd.services.cpuminer-cryptonight = {
+ description = "Cryptonight cpuminer";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ serviceConfig = {
+ ExecStart = "${pkgs.cpuminer-multi}/bin/minerd --syslog --config=${confFile}";
+ User = "nobody";
+ };
+ };
+
+ };
+
+}
\ No newline at end of file
diff --git a/nixos/modules/services/misc/gitolite.nix b/nixos/modules/services/misc/gitolite.nix
new file mode 100644
index 00000000000..462b68aa0a1
--- /dev/null
+++ b/nixos/modules/services/misc/gitolite.nix
@@ -0,0 +1,86 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.gitolite;
+ pubkeyFile = pkgs.writeText "gitolite-admin.pub" cfg.adminPubkey;
+ hooks = lib.concatMapStrings (hook: "${hook} ") cfg.commonHooks;
+in
+{
+ options = {
+ services.gitolite = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable gitolite management under the
+ gitolite user. After
+ switching to a configuration with Gitolite enabled, you can
+ then run git clone
+ gitolite@host:gitolite-admin.git to manage it further.
+ '';
+ };
+
+ dataDir = mkOption {
+ type = types.str;
+ default = "/var/lib/gitolite";
+ description = ''
+ Gitolite home directory (used to store all the repositories).
+ '';
+ };
+
+ adminPubkey = mkOption {
+ type = types.str;
+ description = ''
+ Initial administrative public key for Gitolite. This should
+ be an SSH Public Key. Note that this key will only be used
+ once, upon the first initialization of the Gitolite user.
+ '';
+ };
+
+ commonHooks = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = ''
+ A list of custom git hooks that get copied to ~/.gitolite/hooks/common.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ users.extraUsers.gitolite = {
+ description = "Gitolite user";
+ home = cfg.dataDir;
+ createHome = true;
+ uid = config.ids.uids.gitolite;
+ useDefaultShell = true;
+ };
+
+ systemd.services."gitolite-init" = {
+ description = "Gitolite initialization";
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig.User = "gitolite";
+ serviceConfig.Type = "oneshot";
+ serviceConfig.RemainAfterExit = true;
+
+ path = [ pkgs.gitolite pkgs.git pkgs.perl pkgs.bash pkgs.openssh ];
+ script = ''
+ cd ${cfg.dataDir}
+ mkdir -p .gitolite/logs
+ if [ ! -d repositories ]; then
+ gitolite setup -pk ${pubkeyFile}
+ fi
+ if [ -n "${hooks}" ]; then
+ cp ${hooks} .gitolite/hooks/common/
+ chmod +x .gitolite/hooks/common/*
+ fi
+ gitolite setup # Upgrade if needed
+ '';
+ };
+
+ environment.systemPackages = [ pkgs.gitolite pkgs.git ];
+ };
+}
diff --git a/nixos/modules/services/misc/mesos-master.nix b/nixos/modules/services/misc/mesos-master.nix
new file mode 100644
index 00000000000..bdf88d427c5
--- /dev/null
+++ b/nixos/modules/services/misc/mesos-master.nix
@@ -0,0 +1,103 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.mesos.master;
+
+in {
+
+ options.services.mesos = {
+
+ master = {
+ enable = mkOption {
+ description = "Whether to enable the Mesos Master.";
+ default = false;
+ type = types.uniq types.bool;
+ };
+
+ port = mkOption {
+ description = "Mesos Master port";
+ default = 5050;
+ type = types.int;
+ };
+
+ zk = mkOption {
+ description = ''
+ ZooKeeper URL (used for leader election amongst masters).
+ May be one of:
+ zk://host1:port1,host2:port2,.../mesos
+ zk://username:password@host1:port1,host2:port2,.../mesos
+ '';
+ type = types.str;
+ };
+
+ workDir = mkOption {
+ description = "The Mesos work directory.";
+ default = "/var/lib/mesos/master";
+ type = types.str;
+ };
+
+ extraCmdLineOptions = mkOption {
+ description = ''
+ Extra command line options for Mesos Master.
+
+ See https://mesos.apache.org/documentation/latest/configuration/
+ '';
+ default = [ "" ];
+ type = types.listOf types.string;
+ example = [ "--credentials=VALUE" ];
+ };
+
+ quorum = mkOption {
+ description = ''
+ The size of the quorum of replicas when using 'replicated_log' based
+ registry. It is imperative to set this value to be a majority of
+ masters i.e., quorum > (number of masters)/2.
+
+ If 0 will fall back to --registry=in_memory.
+ '';
+ default = 0;
+ type = types.int;
+ };
+
+ logLevel = mkOption {
+ description = ''
+ The logging level used. Possible values:
+ 'INFO', 'WARNING', 'ERROR'
+ '';
+ default = "INFO";
+ type = types.str;
+ };
+
+ };
+
+
+ };
+
+
+ config = mkIf cfg.enable {
+ systemd.services.mesos-master = {
+ description = "Mesos Master";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+ serviceConfig = {
+ ExecStart = ''
+ ${pkgs.mesos}/bin/mesos-master \
+ --port=${toString cfg.port} \
+ --zk=${cfg.zk} \
+ ${if cfg.quorum == 0 then "--registry=in_memory" else "--registry=replicated_log --quorum=${cfg.quorum}"} \
+ --work_dir=${cfg.workDir} \
+ --logging_level=${cfg.logLevel} \
+ ${toString cfg.extraCmdLineOptions}
+ '';
+ PermissionsStartOnly = true;
+ };
+ preStart = ''
+ mkdir -m 0700 -p ${cfg.workDir}
+ '';
+ };
+ };
+
+}
+
diff --git a/nixos/modules/services/misc/mesos-slave.nix b/nixos/modules/services/misc/mesos-slave.nix
new file mode 100644
index 00000000000..e9a89816716
--- /dev/null
+++ b/nixos/modules/services/misc/mesos-slave.nix
@@ -0,0 +1,93 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.mesos.slave;
+
+in {
+
+ options.services.mesos = {
+ slave = {
+ enable = mkOption {
+ description = "Whether to enable the Mesos Slave.";
+ default = false;
+ type = types.uniq types.bool;
+ };
+
+ port = mkOption {
+ description = "Mesos Slave port";
+ default = 5051;
+ type = types.int;
+ };
+
+ master = mkOption {
+ description = ''
+ May be one of:
+ zk://host1:port1,host2:port2,.../path
+ zk://username:password@host1:port1,host2:port2,.../path
+ '';
+ type = types.str;
+ };
+
+ withHadoop = mkOption {
+ description = "Add the HADOOP_HOME to the slave.";
+ default = false;
+ type = types.bool;
+ };
+
+ workDir = mkOption {
+ description = "The Mesos work directory.";
+ default = "/var/lib/mesos/slave";
+ type = types.str;
+ };
+
+ extraCmdLineOptions = mkOption {
+ description = ''
+ Extra command line options for Mesos Slave.
+
+ See https://mesos.apache.org/documentation/latest/configuration/
+ '';
+ default = [ "" ];
+ type = types.listOf types.string;
+ example = [ "--gc_delay=3days" ];
+ };
+
+ logLevel = mkOption {
+ description = ''
+ The logging level used. Possible values:
+ 'INFO', 'WARNING', 'ERROR'
+ '';
+ default = "INFO";
+ type = types.str;
+ };
+
+ };
+
+ };
+
+
+ config = mkIf cfg.enable {
+ systemd.services.mesos-slave = {
+ description = "Mesos Slave";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+ serviceConfig = {
+ ExecStart = ''
+ ${pkgs.mesos}/bin/mesos-slave \
+ --port=${toString cfg.port} \
+ --master=${cfg.master} \
+ ${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \
+ --work_dir=${cfg.workDir} \
+ --logging_level=${cfg.logLevel} \
+ ${toString cfg.extraCmdLineOptions}
+ '';
+ PermissionsStartOnly = true;
+ };
+ preStart = ''
+ mkdir -m 0700 -p ${cfg.workDir}
+ '';
+ };
+ };
+
+}
\ No newline at end of file
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index 1ebd3c3643d..4b398979fba 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -22,14 +22,11 @@ let
nixConf =
let
- # Tricky: if we're using a chroot for builds, then we need
- # /bin/sh in the chroot (our own compromise to purity).
- # However, since /bin/sh is a symlink to some path in the
- # Nix store, which furthermore has runtime dependencies on
- # other paths in the store, we need the closure of /bin/sh
- # in `build-chroot-dirs' - otherwise any builder that uses
- # /bin/sh won't work.
- binshDeps = pkgs.writeReferencesToFile config.system.build.binsh;
+ # If we're using a chroot for builds, then provide /bin/sh in
+ # the chroot as a bind-mount to bash. This means we also need to
+ # include the entire closure of bash.
+ sh = pkgs.stdenv.shell;
+ binshDeps = pkgs.writeReferencesToFile sh;
in
pkgs.runCommand "nix.conf" {extraOptions = cfg.extraOptions; } ''
extraPaths=$(for i in $(cat ${binshDeps}); do if test -d $i; then echo $i; fi; done)
@@ -39,8 +36,9 @@ let
# /etc/nixos/configuration.nix. Do not edit it!
build-users-group = nixbld
build-max-jobs = ${toString (cfg.maxJobs)}
+ build-cores = ${toString (cfg.buildCores)}
build-use-chroot = ${if cfg.useChroot then "true" else "false"}
- build-chroot-dirs = ${toString cfg.chrootDirs} $(echo $extraPaths)
+ build-chroot-dirs = ${toString cfg.chrootDirs} /bin/sh=${sh} $(echo $extraPaths)
binary-caches = ${toString cfg.binaryCaches}
trusted-binary-caches = ${toString cfg.trustedBinaryCaches}
$extraOptions
@@ -77,6 +75,19 @@ in
";
};
+ buildCores = mkOption {
+ type = types.int;
+ default = 1;
+ example = 64;
+ description = ''
+ This option defines the maximum number of concurrent tasks during
+ one build. It affects, e.g., -j option for make. The default is 1.
+ Some builds may become non-deterministic with this option; use with
+ care! Packages will only be affected if enableParallelBuilding is
+ set for them.
+ '';
+ };
+
useChroot = mkOption {
type = types.bool;
default = false;
@@ -253,8 +264,6 @@ in
config = {
- nix.chrootDirs = [ "/bin" ];
-
environment.etc."nix/nix.conf".source = nixConf;
# List of machines for distributed Nix builds in the format
diff --git a/nixos/modules/services/misc/nix-ssh-serve.nix b/nixos/modules/services/misc/nix-ssh-serve.nix
index 80e7961b1f8..d70bd855c7f 100644
--- a/nixos/modules/services/misc/nix-ssh-serve.nix
+++ b/nixos/modules/services/misc/nix-ssh-serve.nix
@@ -1,32 +1,35 @@
{ config, lib, pkgs, ... }:
-let
- serveOnly = pkgs.writeScript "nix-store-serve" ''
- #!${pkgs.stdenv.shell}
- if [ "$SSH_ORIGINAL_COMMAND" != "nix-store --serve" ]; then
- echo 'Error: You are only allowed to run `nix-store --serve'\'''!' >&2
- exit 1
- fi
- exec /run/current-system/sw/bin/nix-store --serve
- '';
+with lib;
- inherit (lib) mkIf mkOption types;
-in {
+{
options = {
+
nix.sshServe = {
+
enable = mkOption {
- description = "Whether to enable serving the nix store over ssh.";
- default = false;
type = types.bool;
+ default = false;
+ description = "Whether to enable serving the Nix store as a binary cache via SSH.";
};
+
+ keys = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "ssh-dss AAAAB3NzaC1k... alice@example.org" ];
+ description = "A list of SSH public keys allowed to access the binary cache via SSH.";
+ };
+
};
+
};
config = mkIf config.nix.sshServe.enable {
+
users.extraUsers.nix-ssh = {
- description = "User for running nix-store --serve.";
+ description = "Nix SSH substituter user";
uid = config.ids.uids.nix-ssh;
- shell = pkgs.stdenv.shell;
+ useDefaultShell = true;
};
services.openssh.enable = true;
@@ -38,8 +41,11 @@ in {
PermitTTY no
PermitTunnel no
X11Forwarding no
- ForceCommand ${serveOnly}
+ ForceCommand ${config.nix.package}/bin/nix-store --serve
Match All
'';
+
+ users.extraUsers.nix-ssh.openssh.authorizedKeys.keys = config.nix.sshServe.keys;
+
};
}
diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix
index 808c5dcbdc6..c0d7885280a 100644
--- a/nixos/modules/services/misc/nixos-manual.nix
+++ b/nixos/modules/services/misc/nixos-manual.nix
@@ -28,7 +28,7 @@ let
options = eval.options;
};
- entry = "${manual.manual}/share/doc/nixos/manual.html";
+ entry = "${manual.manual}/share/doc/nixos/index.html";
help = pkgs.writeScriptBin "nixos-help"
''
diff --git a/nixos/modules/services/misc/phd.nix b/nixos/modules/services/misc/phd.nix
new file mode 100644
index 00000000000..e605ce5de16
--- /dev/null
+++ b/nixos/modules/services/misc/phd.nix
@@ -0,0 +1,52 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.phd;
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.phd = {
+
+ enable = mkOption {
+ default = false;
+ description = "
+ Enable daemons for phabricator.
+ ";
+ };
+
+ };
+
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ systemd.services.phd = {
+ path = [ pkgs.phabricator pkgs.php pkgs.mercurial pkgs.git pkgs.subversion ];
+
+ after = [ "httpd.service" ];
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig = {
+ ExecStart = "${pkgs.phabricator}/phabricator/bin/phd start";
+ ExecStop = "${pkgs.phabricator}/phabricator/bin/phd stop";
+ User = "wwwrun";
+ RestartSec = "30s";
+ Restart = "always";
+ StartLimitInterval = "1m";
+ };
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/misc/redmine.nix b/nixos/modules/services/misc/redmine.nix
new file mode 100644
index 00000000000..d7e64590f50
--- /dev/null
+++ b/nixos/modules/services/misc/redmine.nix
@@ -0,0 +1,222 @@
+{ config, lib, pkgs, ... }:
+
+# TODO: support non-postgresql
+
+with lib;
+
+let
+ cfg = config.services.redmine;
+
+ ruby = pkgs.ruby;
+ rubyLibs = pkgs.rubyLibs;
+
+ databaseYml = ''
+ production:
+ adapter: postgresql
+ database: ${cfg.databaseName}
+ host: ${cfg.databaseHost}
+ password: ${cfg.databasePassword}
+ username: ${cfg.databaseUsername}
+ encoding: utf8
+ '';
+
+ configurationYml = ''
+ default:
+ # Absolute path to the directory where attachments are stored.
+ # The default is the 'files' directory in your Redmine instance.
+ # Your Redmine instance needs to have write permission on this
+ # directory.
+ # Examples:
+ # attachments_storage_path: /var/redmine/files
+ # attachments_storage_path: D:/redmine/files
+ attachments_storage_path: ${cfg.stateDir}/files
+
+ # Absolute path to the SCM commands errors (stderr) log file.
+ # The default is to log in the 'log' directory of your Redmine instance.
+ # Example:
+ # scm_stderr_log_file: /var/log/redmine_scm_stderr.log
+ scm_stderr_log_file: ${cfg.stateDir}/redmine_scm_stderr.log
+
+ ${cfg.extraConfig}
+ '';
+
+ unpackTheme = unpack "theme";
+ unpackPlugin = unpack "plugin";
+ unpack = id: (name: source:
+ pkgs.stdenv.mkDerivation {
+ name = "redmine-${id}-${name}";
+ buildInputs = [ pkgs.unzip ];
+ buildCommand = ''
+ mkdir -p $out
+ cd $out
+ unpackFile ${source}
+ '';
+ });
+
+in {
+
+ options = {
+ services.redmine = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable the redmine service.
+ '';
+ };
+
+ stateDir = mkOption {
+ type = types.str;
+ default = "/var/redmine";
+ description = "The state directory, logs and plugins are stored here";
+ };
+
+ extraConfig = mkOption {
+ type = types.str;
+ default = "";
+ description = "Extra configuration in configuration.yml";
+ };
+
+ themes = mkOption {
+ type = types.attrsOf types.path;
+ default = {};
+ description = "Set of themes";
+ };
+
+ plugins = mkOption {
+ type = types.attrsOf types.path;
+ default = {};
+ description = "Set of plugins";
+ };
+
+ #databaseType = mkOption {
+ # type = types.str;
+ # default = "postgresql";
+ # description = "Type of database";
+ #};
+
+ databaseHost = mkOption {
+ type = types.str;
+ default = "127.0.0.1";
+ description = "Database hostname";
+ };
+
+ databasePassword = mkOption {
+ type = types.str;
+ default = "";
+ description = "Database user password";
+ };
+
+ databaseName = mkOption {
+ type = types.str;
+ default = "redmine";
+ description = "Database name";
+ };
+
+ databaseUsername = mkOption {
+ type = types.str;
+ default = "redmine";
+ description = "Database user";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+
+ assertions = [
+ { assertion = cfg.databasePassword != "";
+ message = "databasePassword must be set";
+ }
+ ];
+
+ users.extraUsers = [
+ { name = "redmine";
+ group = "redmine";
+ uid = config.ids.uids.redmine;
+ } ];
+
+ users.extraGroups = [
+ { name = "redmine";
+ gid = config.ids.gids.redmine;
+ } ];
+
+ systemd.services.redmine = {
+ after = [ "network.target" "postgresql.service" ];
+ wantedBy = [ "multi-user.target" ];
+ environment.RAILS_ENV = "production";
+ environment.RAILS_ETC = "${cfg.stateDir}/config";
+ environment.RAILS_LOG = "${cfg.stateDir}/log";
+ environment.RAILS_VAR = "${cfg.stateDir}/var";
+ environment.RAILS_CACHE = "${cfg.stateDir}/cache";
+ environment.RAILS_PLUGINS = "${cfg.stateDir}/plugins";
+ environment.RAILS_PUBLIC = "${cfg.stateDir}/public";
+ environment.RAILS_TMP = "${cfg.stateDir}/tmp";
+ environment.SCHEMA = "${cfg.stateDir}/cache/schema.db";
+ environment.HOME = "${pkgs.redmine}/share/redmine";
+ environment.REDMINE_LANG = "en";
+ environment.GEM_HOME = "${pkgs.redmine}/share/redmine/vendor/bundle/ruby/1.9.1";
+ environment.GEM_PATH = "${rubyLibs.bundler}/lib/ruby/gems/1.9";
+ path = with pkgs; [
+ imagemagickBig
+ subversion
+ mercurial
+ cvs
+ config.services.postgresql.package
+ bazaar
+ gitAndTools.git
+ # once we build binaries for darc enable it
+ #darcs
+ ];
+ preStart = ''
+ # TODO: use env vars
+ for i in plugins public/plugin_assets db files log config cache var/files tmp; do
+ mkdir -p ${cfg.stateDir}/$i
+ done
+
+ chown -R redmine:redmine ${cfg.stateDir}
+ chmod -R 755 ${cfg.stateDir}
+
+ rm -rf ${cfg.stateDir}/public/*
+ cp -R ${pkgs.redmine}/share/redmine/public/* ${cfg.stateDir}/public/
+ for theme in ${concatStringsSep " " (mapAttrsToList unpackTheme cfg.themes)}; do
+ ln -fs $theme/* ${cfg.stateDir}/public/themes/
+ done
+
+ rm -rf ${cfg.stateDir}/plugins/*
+ for plugin in ${concatStringsSep " " (mapAttrsToList unpackPlugin cfg.plugins)}; do
+ ln -fs $plugin/* ${cfg.stateDir}/plugins/''${plugin##*-redmine-plugin-}
+ done
+
+ ln -fs ${pkgs.writeText "database.yml" databaseYml} ${cfg.stateDir}/config/database.yml
+ ln -fs ${pkgs.writeText "configuration.yml" configurationYml} ${cfg.stateDir}/config/configuration.yml
+
+ if [ "${cfg.databaseHost}" = "127.0.0.1" ]; then
+ if ! test -e "${cfg.stateDir}/db-created"; then
+ psql postgres -c "CREATE ROLE redmine WITH LOGIN NOCREATEDB NOCREATEROLE NOCREATEUSER ENCRYPTED PASSWORD '${cfg.databasePassword}'"
+ ${config.services.postgresql.package}/bin/createdb --owner redmine redmine || true
+ touch "${cfg.stateDir}/db-created"
+ fi
+ fi
+
+ cd ${pkgs.redmine}/share/redmine/
+ ${ruby}/bin/rake db:migrate
+ ${ruby}/bin/rake redmine:plugins:migrate
+ ${ruby}/bin/rake redmine:load_default_data
+ ${ruby}/bin/rake generate_secret_token
+ '';
+
+ serviceConfig = {
+ PermissionsStartOnly = true; # preStart must be run as root
+ Type = "simple";
+ User = "redmine";
+ Group = "redmine";
+ TimeoutSec = "300";
+ WorkingDirectory = "${pkgs.redmine}/share/redmine";
+ ExecStart="${ruby}/bin/ruby ${pkgs.redmine}/share/redmine/script/rails server webrick -e production -P ${cfg.stateDir}/redmine.pid";
+ };
+
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/misc/siproxd.nix b/nixos/modules/services/misc/siproxd.nix
new file mode 100644
index 00000000000..9e8fb6c228f
--- /dev/null
+++ b/nixos/modules/services/misc/siproxd.nix
@@ -0,0 +1,180 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.siproxd;
+
+ conf = ''
+ daemonize = 0
+ rtp_proxy_enable = 1
+ user = siproxd
+ if_inbound = ${cfg.ifInbound}
+ if_outbound = ${cfg.ifOutbound}
+ sip_listen_port = ${toString cfg.sipListenPort}
+ rtp_port_low = ${toString cfg.rtpPortLow}
+ rtp_port_high = ${toString cfg.rtpPortHigh}
+ rtp_dscp = ${toString cfg.rtpDscp}
+ sip_dscp = ${toString cfg.sipDscp}
+ ${optionalString (cfg.hostsAllowReg != []) "hosts_allow_reg = ${concatStringsSep "," cfg.hostsAllowReg}"}
+ ${optionalString (cfg.hostsAllowSip != []) "hosts_allow_sip = ${concatStringsSep "," cfg.hostsAllowSip}"}
+ ${optionalString (cfg.hostsDenySip != []) "hosts_deny_sip = ${concatStringsSep "," cfg.hostsDenySip}"}
+ ${if (cfg.passwordFile != "") then "proxy_auth_pwfile = ${cfg.passwordFile}" else ""}
+ ${cfg.extraConfig}
+ '';
+
+ confFile = builtins.toFile "siproxd.conf" conf;
+
+in
+{
+ ##### interface
+
+ options = {
+
+ services.siproxd = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to enable the Siproxd SIP
+ proxy/masquerading daemon.
+ '';
+ };
+
+ ifInbound = mkOption {
+ type = types.str;
+ example = "eth0";
+ description = "Local network interface";
+ };
+
+ ifOutbound = mkOption {
+ type = types.str;
+ example = "ppp0";
+ description = "Public network interface";
+ };
+
+ hostsAllowReg = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "192.168.1.0/24" "192.168.2.0/24" ];
+ description = ''
+ Acess control list for incoming SIP registrations.
+ '';
+ };
+
+ hostsAllowSip = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "123.45.0.0/16" "123.46.0.0/16" ];
+ description = ''
+ Acess control list for incoming SIP traffic.
+ '';
+ };
+
+ hostsDenySip = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "10.0.0.0/8" "11.0.0.0/8" ];
+ description = ''
+ Acess control list for denying incoming
+ SIP registrations and traffic.
+ '';
+ };
+
+ sipListenPort = mkOption {
+ type = types.int;
+ default = 5060;
+ description = ''
+ Port to listen for incoming SIP messages.
+ '';
+ };
+
+ rtpPortLow = mkOption {
+ type = types.int;
+ default = 7070;
+ description = ''
+ Bottom of UDP port range for incoming and outgoing RTP traffic
+ '';
+ };
+
+ rtpPortHigh = mkOption {
+ type = types.int;
+ default = 7089;
+ description = ''
+ Top of UDP port range for incoming and outgoing RTP traffic
+ '';
+ };
+
+ rtpTimeout = mkOption {
+ type = types.int;
+ default = 300;
+ description = ''
+ Timeout for an RTP stream. If for the specified
+ number of seconds no data is relayed on an active
+ stream, it is considered dead and will be killed.
+ '';
+ };
+
+ rtpDscp = mkOption {
+ type = types.int;
+ default = 46;
+ description = ''
+ DSCP (differentiated services) value to be assigned
+ to RTP packets. Allows QOS aware routers to handle
+ different types traffic with different priorities.
+ '';
+ };
+
+ sipDscp = mkOption {
+ type = types.int;
+ default = 0;
+ description = ''
+ DSCP (differentiated services) value to be assigned
+ to SIP packets. Allows QOS aware routers to handle
+ different types traffic with different priorities.
+ '';
+ };
+
+ passwordFile = mkOption {
+ type = types.str;
+ default = "";
+ description = ''
+ Path to per-user password file.
+ '';
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Extra configuration to add to siproxd configuration.
+ '';
+ };
+
+ };
+
+ };
+
+ ##### implementation
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers = singleton {
+ name = "siproxyd";
+ uid = config.ids.uids.siproxd;
+ };
+
+ systemd.services.siproxd = {
+ description = "SIP proxy/masquerading daemon";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ serviceConfig = {
+ ExecStart = "${pkgs.siproxd}/sbin/siproxd -c ${confFile}";
+ };
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/misc/uhub.nix b/nixos/modules/services/misc/uhub.nix
new file mode 100644
index 00000000000..15071202b9c
--- /dev/null
+++ b/nixos/modules/services/misc/uhub.nix
@@ -0,0 +1,186 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.uhub;
+
+ uhubPkg = pkgs.uhub.override { tlsSupport = cfg.enableTLS; };
+
+ pluginConfig = ""
+ + optionalString cfg.plugins.authSqlite.enable ''
+ plugin ${uhubPkg.mod_auth_sqlite}/mod_auth_sqlite.so "file=${cfg.plugins.authSqlite.file}"
+ ''
+ + optionalString cfg.plugins.logging.enable ''
+ plugin ${uhubPkg.mod_logging}/mod_logging.so ${if cfg.plugins.logging.syslog then "syslog=true" else "file=${cfg.plugins.logging.file}"}
+ ''
+ + optionalString cfg.plugins.welcome.enable ''
+ plugin ${uhubPkg.mod_welcome}/mod_welcome.so "motd=${pkgs.writeText "motd.txt" cfg.plugins.welcome.motd} rules=${pkgs.writeText "rules.txt" cfg.plugins.welcome.rules}"
+ ''
+ + optionalString cfg.plugins.history.enable ''
+ plugin ${uhubPkg.mod_chat_history}/mod_chat_history.so "history_max=${toString cfg.plugins.history.max} history_default=${toString cfg.plugins.history.default} history_connect=${toString cfg.plugins.history.connect}"
+ '';
+
+ uhubConfigFile = pkgs.writeText "uhub.conf" ''
+ file_acl=${pkgs.writeText "users.conf" cfg.aclConfig}
+ file_plugins=${pkgs.writeText "plugins.conf" pluginConfig}
+ server_bind_addr=${cfg.address}
+ server_port=${toString cfg.port}
+ ${lib.optionalString cfg.enableTLS "tls_enable=yes"}
+ ${cfg.hubConfig}
+ '';
+
+in
+
+{
+ options = {
+
+ services.uhub = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the uhub ADC hub.";
+ };
+
+ port = mkOption {
+ type = types.int;
+ default = 1511;
+ description = "TCP port to bind the hub to.";
+ };
+
+ address = mkOption {
+ type = types.string;
+ default = "any";
+ description = "Address to bind the hub to.";
+ };
+
+ enableTLS = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable TLS support.";
+ };
+
+ hubConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Contents of uhub configuration file.";
+ };
+
+ aclConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Contents of user ACL configuration file.";
+ };
+
+ plugins = {
+
+ authSqlite = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the Sqlite authentication database plugin";
+ };
+ file = mkOption {
+ type = types.string;
+ example = "/var/db/uhub-users";
+ description = "Path to user database. Use the uhub-passwd utility to create the database and add/remove users.";
+ };
+ };
+
+ logging = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the logging plugin.";
+ };
+ file = mkOption {
+ type = types.string;
+ default = "";
+ description = "Path of log file.";
+ };
+ syslog = mkOption {
+ type = types.bool;
+ default = false;
+ description = "If true then the system log is used instead of writing to file.";
+ };
+ };
+
+ welcome = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the welcome plugin.";
+ };
+ motd = mkOption {
+ default = "";
+ type = types.lines;
+ description = ''
+ Welcome message displayed to clients after connecting
+ and with the !motd command.
+ '';
+ };
+ rules = mkOption {
+ default = "";
+ type = types.lines;
+ description = ''
+ Rules message, displayed to clients with the !rules command.
+ '';
+ };
+ };
+
+ history = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the history plugin.";
+ };
+ max = mkOption {
+ type = types.int;
+ default = 200;
+ description = "The maximum number of messages to keep in history";
+ };
+ default = mkOption {
+ type = types.int;
+ default = 10;
+ description = "When !history is provided without arguments, then this default number of messages are returned.";
+ };
+ connect = mkOption {
+ type = types.int;
+ default = 5;
+ description = "The number of chat history messages to send when users connect (0 = do not send any history).";
+ };
+ };
+
+ };
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ users = {
+ extraUsers = singleton {
+ name = "uhub";
+ uid = config.ids.uids.uhub;
+ };
+ extraGroups = singleton {
+ name = "uhub";
+ gid = config.ids.gids.uhub;
+ };
+ };
+
+ systemd.services.uhub = {
+ description = "high performance peer-to-peer hub for the ADC network";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ Type = "notify";
+ ExecStart = "${uhubPkg}/bin/uhub -c ${uhubConfigFile} -u uhub -g uhub -L";
+ ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
+ };
+ };
+ };
+
+}
\ No newline at end of file
diff --git a/nixos/modules/services/misc/zookeeper.nix b/nixos/modules/services/misc/zookeeper.nix
new file mode 100755
index 00000000000..47675b8876c
--- /dev/null
+++ b/nixos/modules/services/misc/zookeeper.nix
@@ -0,0 +1,145 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.zookeeper;
+
+ zookeeperConfig = ''
+ dataDir=${cfg.dataDir}
+ clientPort=${toString cfg.port}
+ autopurge.purgeInterval=${toString cfg.purgeInterval}
+ ${cfg.extraConf}
+ ${cfg.servers}
+ '';
+
+ configDir = pkgs.buildEnv {
+ name = "zookeeper-conf";
+ paths = [
+ (pkgs.writeTextDir "zoo.cfg" zookeeperConfig)
+ (pkgs.writeTextDir "log4j.properties" cfg.logging)
+ ];
+ };
+
+in {
+
+ options.services.zookeeper = {
+ enable = mkOption {
+ description = "Whether to enable Zookeeper.";
+ default = false;
+ type = types.uniq types.bool;
+ };
+
+ port = mkOption {
+ description = "Zookeeper Client port.";
+ default = 2181;
+ type = types.int;
+ };
+
+ id = mkOption {
+ description = "Zookeeper ID.";
+ default = 0;
+ type = types.int;
+ };
+
+ purgeInterval = mkOption {
+ description = ''
+ The time interval in hours for which the purge task has to be triggered. Set to a positive integer (1 and above) to enable the auto purging.
+ '';
+ default = 1;
+ type = types.int;
+ };
+
+ extraConf = mkOption {
+ description = "Extra configuration for Zookeeper.";
+ type = types.lines;
+ default = ''
+ initLimit=5
+ syncLimit=2
+ tickTime=2000
+ '';
+ };
+
+ servers = mkOption {
+ description = "All Zookeeper Servers.";
+ default = "";
+ type = types.lines;
+ example = ''
+ server.0=host0:2888:3888
+ server.1=host1:2888:3888
+ server.2=host2:2888:3888
+ '';
+ };
+
+ logging = mkOption {
+ description = "Zookeeper logging configuration.";
+ default = ''
+ zookeeper.root.logger=INFO, CONSOLE
+ log4j.rootLogger=INFO, CONSOLE
+ log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+ log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+ log4j.appender.CONSOLE.layout.ConversionPattern=[myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n
+ '';
+ type = types.lines;
+ };
+
+ dataDir = mkOption {
+ type = types.path;
+ default = "/var/lib/zookeeper";
+ description = ''
+ Data directory for Zookeeper
+ '';
+ };
+
+ extraCmdLineOptions = mkOption {
+ description = "Extra command line options for the Zookeeper launcher.";
+ default = [ "-Dcom.sun.management.jmxremote" "-Dcom.sun.management.jmxremote.local.only=true" ];
+ type = types.listOf types.string;
+ example = [ "-Djava.net.preferIPv4Stack=true" "-Dcom.sun.management.jmxremote" "-Dcom.sun.management.jmxremote.local.only=true" ];
+ };
+
+ preferIPv4 = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Add the -Djava.net.preferIPv4Stack=true flag to the Zookeeper server.
+ '';
+ };
+
+ };
+
+
+ config = mkIf cfg.enable {
+ systemd.services.zookeeper = {
+ description = "Zookeeper Daemon";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+ environment = { ZOOCFGDIR = configDir; };
+ serviceConfig = {
+ ExecStart = ''
+ ${pkgs.jre}/bin/java \
+ -cp "${pkgs.zookeeper}/lib/*:${pkgs.zookeeper}/${pkgs.zookeeper.name}.jar:${configDir}" \
+ ${toString cfg.extraCmdLineOptions} \
+ -Dzookeeper.datadir.autocreate=false \
+ ${optionalString cfg.preferIPv4 "-Djava.net.preferIPv4Stack=true"} \
+ org.apache.zookeeper.server.quorum.QuorumPeerMain \
+ ${configDir}/zoo.cfg
+ '';
+ User = "zookeeper";
+ PermissionsStartOnly = true;
+ };
+ preStart = ''
+ mkdir -m 0700 -p ${cfg.dataDir}
+ if [ "$(id -u)" = 0 ]; then chown zookeeper ${cfg.dataDir}; fi
+ echo "${toString cfg.id}" > ${cfg.dataDir}/myid
+ '';
+ };
+
+ users.extraUsers = singleton {
+ name = "zookeeper";
+ uid = config.ids.uids.zookeeper;
+ description = "Zookeeper daemon user";
+ home = cfg.dataDir;
+ };
+ };
+}
diff --git a/nixos/modules/services/monitoring/apcupsd.nix b/nixos/modules/services/monitoring/apcupsd.nix
index 6cc0c122ec6..ffa7be7dd30 100644
--- a/nixos/modules/services/monitoring/apcupsd.nix
+++ b/nixos/modules/services/monitoring/apcupsd.nix
@@ -161,6 +161,7 @@ in
# systemd kills it with SIGKILL.
TimeoutStopSec = 5;
};
+ unitConfig.Documentation = "man:apcupsd(8)";
};
# A special service to tell the UPS to power down/hibernate just before the
diff --git a/nixos/modules/services/monitoring/collectd.nix b/nixos/modules/services/monitoring/collectd.nix
new file mode 100644
index 00000000000..717c2c48168
--- /dev/null
+++ b/nixos/modules/services/monitoring/collectd.nix
@@ -0,0 +1,116 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ cfg = config.services.collectd;
+
+ conf = pkgs.writeText "collectd.conf" ''
+ BaseDir "${cfg.dataDir}"
+ PIDFile "${cfg.pidFile}"
+ AutoLoadPlugin ${if cfg.autoLoadPlugin then "true" else "false"}
+ Hostname ${config.networking.hostName}
+
+ LoadPlugin syslog
+
+ LogLevel "info"
+ NotifyLevel "OKAY"
+
+
+ ${concatMapStrings (f: ''
+ Include "${f}"
+ '') cfg.include}
+
+ ${cfg.extraConfig}
+ '';
+
+in {
+ options.services.collectd = with types; {
+ enable = mkOption {
+ default = false;
+ description = ''
+ Whether to enable collectd agent.
+ '';
+ type = bool;
+ };
+
+ user = mkOption {
+ default = "collectd";
+ description = ''
+ User under which to run collectd.
+ '';
+ type = nullOr str;
+ };
+
+ dataDir = mkOption {
+ default = "/var/lib/collectd";
+ description = ''
+ Data directory for collectd agent.
+ '';
+ type = path;
+ };
+
+ pidFile = mkOption {
+ default = "/var/run/collectd.pid";
+ description = ''
+ Location of collectd pid file.
+ '';
+ type = path;
+ };
+
+ autoLoadPlugin = mkOption {
+ default = false;
+ description = ''
+ Enable plugin autoloading.
+ '';
+ type = bool;
+ };
+
+ include = mkOption {
+ default = [];
+ description = ''
+ Additional paths to load config from.
+ '';
+ type = listOf str;
+ };
+
+ extraConfig = mkOption {
+ default = "";
+ description = ''
+ Extra configuration for collectd.
+ '';
+ type = lines;
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+ systemd.services.collectd = {
+ description = "Collectd Monitoring Agent";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+
+ serviceConfig = {
+ ExecStart = "${pkgs.collectd}/sbin/collectd -C ${conf} -P ${cfg.pidFile}";
+ Type = "forking";
+ PIDFile = cfg.pidFile;
+ User = optional (cfg.user!="root") cfg.user;
+ PermissionsStartOnly = true;
+ };
+
+ preStart = ''
+ mkdir -m 0700 -p ${cfg.dataDir}
+ install -D /dev/null ${cfg.pidFile}
+ if [ "$(id -u)" = 0 ]; then
+ chown -R ${cfg.user} ${cfg.dataDir};
+ chown ${cfg.user} ${cfg.pidFile}
+ fi
+ '';
+ };
+
+ users.extraUsers = optional (cfg.user == "collectd") {
+ name = "collectd";
+ uid = config.ids.uids.collectd;
+ };
+ };
+}
diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix
index dbfe0ee182a..bc716957e3f 100644
--- a/nixos/modules/services/monitoring/graphite.nix
+++ b/nixos/modules/services/monitoring/graphite.nix
@@ -8,6 +8,24 @@ let
dataDir = cfg.dataDir;
+ graphiteApiConfig = pkgs.writeText "graphite-api.yaml" ''
+ time_zone: ${config.time.timeZone}
+ search_index: ${dataDir}/index
+ ${optionalString (cfg.api.finders != []) ''finders:''}
+ ${concatMapStringsSep "\n" (f: " - " + f.moduleName) cfg.api.finders}
+ ${optionalString (cfg.api.functions != []) ''functions:''}
+ ${concatMapStringsSep "\n" (f: " - " + f) cfg.api.functions}
+ ${cfg.api.extraConfig}
+ '';
+
+ seyrenConfig = {
+ SEYREN_URL = cfg.seyren.seyrenUrl;
+ MONGO_URL = cfg.seyren.mongoUrl;
+ GRAPHITE_URL = cfg.seyren.graphiteUrl;
+ } // cfg.seyren.extraConfig;
+
+ pagerConfig = pkgs.writeText "alarms.yaml" cfg.pager.alerts;
+
configDir = pkgs.buildEnv {
name = "graphite-config";
paths = lists.filter (el: el != null) [
@@ -65,6 +83,80 @@ in {
};
};
+ api = {
+ enable = mkOption {
+ description = ''
+ Whether to enable graphite api. Graphite api is lightweight alternative
+ to graphite web, with api and without dashboard. It's advised to use
+ grafana as alternative dashboard and influxdb as alternative to
+ graphite carbon.
+
+ For more information visit
+
+ '';
+ default = false;
+ type = types.uniq types.bool;
+ };
+
+ finders = mkOption {
+ description = "List of finder plugins to load.";
+ default = [];
+ example = [ pkgs.python27Packages.graphite_influxdb ];
+ type = types.listOf types.package;
+ };
+
+ functions = mkOption {
+ description = "List of functions to load.";
+ default = [
+ "graphite_api.functions.SeriesFunctions"
+ "graphite_api.functions.PieFunctions"
+ ];
+ type = types.listOf types.str;
+ };
+
+ host = mkOption {
+ description = "Graphite web service listen address.";
+ default = "127.0.0.1";
+ type = types.str;
+ };
+
+ port = mkOption {
+ description = "Graphite api service port.";
+ default = 8080;
+ type = types.int;
+ };
+
+ package = mkOption {
+ description = "Package to use for graphite api.";
+ default = pkgs.python27Packages.graphite_api;
+ type = types.package;
+ };
+
+ extraConfig = mkOption {
+ description = "Extra configuration for graphite api.";
+ default = ''
+ whisper:
+ directories:
+ - ${dataDir}/whisper
+ '';
+ example = literalExample ''
+ allowed_origins:
+ - dashboard.example.com
+ cheat_times: true
+ influxdb:
+ host: localhost
+ port: 8086
+ user: influxdb
+ pass: influxdb
+ db: metrics
+ cache:
+ CACHE_TYPE: 'filesystem'
+ CACHE_DIR: '/tmp/graphite-api-cache'
+ '';
+ type = types.str;
+ };
+ };
+
carbon = {
config = mkOption {
description = "Content of carbon configuration file.";
@@ -172,122 +264,287 @@ in {
'';
};
};
+
+ seyren = {
+ enable = mkOption {
+ description = "Whether to enable seyren service.";
+ default = false;
+ type = types.uniq types.bool;
+ };
+
+ port = mkOption {
+ description = "Seyren listening port.";
+ default = 8081;
+ type = types.int;
+ };
+
+ seyrenUrl = mkOption {
+ default = "http://localhost:${toString cfg.seyren.port}/";
+ description = "Host where seyren is accessible.";
+ type = types.str;
+ };
+
+ graphiteUrl = mkOption {
+ default = "http://${cfg.web.host}:${toString cfg.web.port}";
+ description = "Host where graphite service runs.";
+ type = types.str;
+ };
+
+ mongoUrl = mkOption {
+ default = "mongodb://${config.services.mongodb.bind_ip}:27017/seyren";
+ description = "Mongodb connection string.";
+ type = types.str;
+ };
+
+ extraConfig = mkOption {
+ default = {};
+ description = ''
+ Extra seyren configuration. See
+
+ '';
+ type = types.attrsOf types.str;
+ example = literalExample ''
+ {
+ GRAPHITE_USERNAME = "user";
+ GRAPHITE_PASSWORD = "pass";
+ }
+ '';
+ };
+ };
+
+ pager = {
+ enable = mkOption {
+ description = ''
+ Whether to enable graphite-pager service. For more information visit
+
+ '';
+ default = false;
+ type = types.uniq types.bool;
+ };
+
+ redisUrl = mkOption {
+ description = "Redis connection string.";
+ default = "redis://localhost:${toString config.services.redis.port}/";
+ type = types.str;
+ };
+
+ graphiteUrl = mkOption {
+ description = "URL to your graphite service.";
+ default = "http://${cfg.web.host}:${toString cfg.web.port}";
+ type = types.str;
+ };
+
+ alerts = mkOption {
+ description = "Alerts configuration for graphite-pager.";
+ default = ''
+ alerts:
+ - target: constantLine(100)
+ warning: 90
+ critical: 200
+ name: Test
+ '';
+ example = literalExample ''
+ pushbullet_key: pushbullet_api_key
+ alerts:
+ - target: stats.seatgeek.app.deal_quality.venue_info_cache.hit
+ warning: .5
+ critical: 1
+ name: Deal quality venue cache hits
+ '';
+ type = types.lines;
+ };
+ };
};
###### implementation
- config = mkIf (cfg.carbon.enableAggregator || cfg.carbon.enableCache || cfg.carbon.enableRelay || cfg.web.enable) {
- systemd.services.carbonCache = {
- enable = cfg.carbon.enableCache;
- description = "Graphite Data Storage Backend";
- wantedBy = [ "multi-user.target" ];
- after = [ "network-interfaces.target" ];
- environment = carbonEnv;
- serviceConfig = {
- ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-cache"}";
- User = "graphite";
- Group = "graphite";
- PermissionsStartOnly = true;
- };
- restartTriggers = [
- pkgs.pythonPackages.carbon
- configDir
- ];
- preStart = ''
- mkdir -p ${cfg.dataDir}/whisper
- chmod 0700 ${cfg.dataDir}/whisper
- chown -R graphite:graphite ${cfg.dataDir}
- '';
- };
-
- systemd.services.carbonAggregator = {
- enable = cfg.carbon.enableAggregator;
- description = "Carbon Data Aggregator";
- wantedBy = [ "multi-user.target" ];
- after = [ "network-interfaces.target" ];
- environment = carbonEnv;
- serviceConfig = {
- ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-aggregator"}";
- User = "graphite";
- Group = "graphite";
- };
- restartTriggers = [
- pkgs.pythonPackages.carbon
- configDir
- ];
- };
-
- systemd.services.carbonRelay = {
- enable = cfg.carbon.enableRelay;
- description = "Carbon Data Relay";
- wantedBy = [ "multi-user.target" ];
- after = [ "network-interfaces.target" ];
- environment = carbonEnv;
- serviceConfig = {
- ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-relay"}";
- User = "graphite";
- Group = "graphite";
- };
- restartTriggers = [
- pkgs.pythonPackages.carbon
- configDir
- ];
- };
-
- systemd.services.graphiteWeb = {
- enable = cfg.web.enable;
- description = "Graphite Web Interface";
- wantedBy = [ "multi-user.target" ];
- after = [ "network-interfaces.target" ];
- path = [ pkgs.perl ];
- environment = {
- PYTHONPATH = "${pkgs.python27Packages.graphite_web}/lib/python2.7/site-packages";
- DJANGO_SETTINGS_MODULE = "graphite.settings";
- GRAPHITE_CONF_DIR = "/etc/graphite/";
- GRAPHITE_STORAGE_DIR = dataDir;
- };
- serviceConfig = {
- ExecStart = ''
- ${pkgs.python27Packages.waitress}/bin/waitress-serve \
- --host=${cfg.web.host} --port=${toString cfg.web.port} \
- --call django.core.handlers.wsgi:WSGIHandler'';
- User = "graphite";
- Group = "graphite";
- PermissionsStartOnly = true;
- };
- preStart = ''
- if ! test -e ${dataDir}/db-created; then
- mkdir -p ${dataDir}/{whisper/,log/webapp/}
- chmod 0700 ${dataDir}/{whisper/,log/webapp/}
-
- # populate database
- ${pkgs.python27Packages.graphite_web}/bin/manage-graphite.py syncdb --noinput
-
- # create index
- ${pkgs.python27Packages.graphite_web}/bin/build-index.sh
-
- touch ${dataDir}/db-created
-
+ config = mkMerge [
+ (mkIf cfg.carbon.enableCache {
+ systemd.services.carbonCache = {
+ description = "Graphite Data Storage Backend";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+ environment = carbonEnv;
+ serviceConfig = {
+ ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-cache"}";
+ User = "graphite";
+ Group = "graphite";
+ PermissionsStartOnly = true;
+ };
+ preStart = ''
+ mkdir -p ${cfg.dataDir}/whisper
+ chmod 0700 ${cfg.dataDir}/whisper
chown -R graphite:graphite ${cfg.dataDir}
- fi
- '';
- restartTriggers = [
- pkgs.python27Packages.graphite_web
+ '';
+ };
+ })
+
+ (mkIf cfg.carbon.enableAggregator {
+ systemd.services.carbonAggregator = {
+ enable = cfg.carbon.enableAggregator;
+ description = "Carbon Data Aggregator";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+ environment = carbonEnv;
+ serviceConfig = {
+ ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-aggregator"}";
+ User = "graphite";
+ Group = "graphite";
+ };
+ };
+ })
+
+ (mkIf cfg.carbon.enableRelay {
+ systemd.services.carbonRelay = {
+ description = "Carbon Data Relay";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+ environment = carbonEnv;
+ serviceConfig = {
+ ExecStart = "${pkgs.twisted}/bin/twistd ${carbonOpts "carbon-relay"}";
+ User = "graphite";
+ Group = "graphite";
+ };
+ };
+ })
+
+ (mkIf (cfg.carbon.enableCache || cfg.carbon.enableAggregator || cfg.carbon.enableRelay) {
+ environment.systemPackages = [
+ pkgs.pythonPackages.carbon
];
- };
+ })
- environment.systemPackages = [
- pkgs.pythonPackages.carbon
- pkgs.python27Packages.graphite_web
- pkgs.python27Packages.waitress
- ];
+ (mkIf cfg.web.enable {
+ systemd.services.graphiteWeb = {
+ 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";
+ GRAPHITE_CONF_DIR = configDir;
+ GRAPHITE_STORAGE_DIR = dataDir;
+ };
+ serviceConfig = {
+ ExecStart = ''
+ ${pkgs.python27Packages.waitress}/bin/waitress-serve \
+ --host=${cfg.web.host} --port=${toString cfg.web.port} \
+ --call django.core.handlers.wsgi:WSGIHandler'';
+ User = "graphite";
+ Group = "graphite";
+ PermissionsStartOnly = true;
+ };
+ preStart = ''
+ if ! test -e ${dataDir}/db-created; then
+ mkdir -p ${dataDir}/{whisper/,log/webapp/}
+ chmod 0700 ${dataDir}/{whisper/,log/webapp/}
- users.extraUsers = singleton {
- name = "graphite";
- uid = config.ids.uids.graphite;
- description = "Graphite daemon user";
- home = dataDir;
- };
- users.extraGroups.graphite.gid = config.ids.gids.graphite;
- };
+ # populate database
+ ${pkgs.python27Packages.graphite_web}/bin/manage-graphite.py syncdb --noinput
+
+ # create index
+ ${pkgs.python27Packages.graphite_web}/bin/build-index.sh
+
+ touch ${dataDir}/db-created
+
+ chown -R graphite:graphite ${cfg.dataDir}
+ fi
+ '';
+ };
+
+ environment.systemPackages = [ pkgs.python27Packages.graphite_web ];
+ })
+
+ (mkIf cfg.api.enable {
+ systemd.services.graphiteApi = {
+ description = "Graphite Api Interface";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" ];
+ environment = {
+ PYTHONPATH =
+ "${cfg.api.package}/lib/python2.7/site-packages:" +
+ concatMapStringsSep ":" (f: f + "/lib/python2.7/site-packages") cfg.api.finders;
+ GRAPHITE_API_CONFIG = graphiteApiConfig;
+ LD_LIBRARY_PATH = "${pkgs.cairo}/lib";
+ };
+ serviceConfig = {
+ ExecStart = ''
+ ${pkgs.python27Packages.waitress}/bin/waitress-serve \
+ --host=${cfg.api.host} --port=${toString cfg.api.port} \
+ graphite_api.app:app
+ '';
+ User = "graphite";
+ Group = "graphite";
+ PermissionsStartOnly = true;
+ };
+ preStart = ''
+ if ! test -e ${dataDir}/db-created; then
+ mkdir -p ${dataDir}/cache/
+ chmod 0700 ${dataDir}/cache/
+
+ touch ${dataDir}/db-created
+
+ chown -R graphite:graphite ${cfg.dataDir}
+ fi
+ '';
+ };
+ })
+
+ (mkIf cfg.seyren.enable {
+ systemd.services.seyren = {
+ description = "Graphite Alerting Dashboard";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" "mongodb.service" ];
+ environment = seyrenConfig;
+ serviceConfig = {
+ ExecStart = "${pkgs.seyren}/bin/seyren -httpPort ${toString cfg.seyren.port}";
+ WorkingDirectory = dataDir;
+ User = "graphite";
+ Group = "graphite";
+ };
+ preStart = ''
+ if ! test -e ${dataDir}/db-created; then
+ mkdir -p ${dataDir}
+ chown -R graphite:graphite ${dataDir}
+ fi
+ '';
+ };
+
+ services.mongodb.enable = mkDefault true;
+ })
+
+ (mkIf cfg.pager.enable {
+ systemd.services.graphitePager = {
+ description = "Graphite Pager Alerting Daemon";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network-interfaces.target" "redis.service" ];
+ environment = {
+ REDIS_URL = cfg.pager.redisUrl;
+ GRAPHITE_URL = cfg.pager.graphiteUrl;
+ };
+ serviceConfig = {
+ ExecStart = "${pkgs.pythonPackages.graphite_pager}/bin/graphite-pager --config ${pagerConfig}";
+ User = "graphite";
+ Group = "graphite";
+ };
+ };
+
+ services.redis.enable = mkDefault true;
+
+ environment.systemPackages = [ pkgs.pythonPackages.graphite_pager ];
+ })
+
+ # Disabled: Don't create this user unconditionally!
+ #
+ # {
+ # users.extraUsers = singleton {
+ # name = "graphite";
+ # uid = config.ids.uids.graphite;
+ # description = "Graphite daemon user";
+ # home = dataDir;
+ # };
+ # users.extraGroups.graphite.gid = config.ids.gids.graphite;
+ # }
+ ];
}
diff --git a/nixos/modules/services/monitoring/monit.nix b/nixos/modules/services/monitoring/monit.nix
index 2acc51c64a6..642fac3b3a0 100644
--- a/nixos/modules/services/monitoring/monit.nix
+++ b/nixos/modules/services/monitoring/monit.nix
@@ -1,9 +1,9 @@
# Monit system watcher
# http://mmonit.org/monit/
-{config, pkgs, ...}:
+{config, pkgs, lib, ...}:
-let inherit (pkgs.lib) mkOption mkIf;
+let inherit (lib) mkOption mkIf;
in
{
diff --git a/nixos/modules/services/monitoring/munin.nix b/nixos/modules/services/monitoring/munin.nix
index 966c2eca282..aab1c4b75ef 100644
--- a/nixos/modules/services/monitoring/munin.nix
+++ b/nixos/modules/services/monitoring/munin.nix
@@ -37,7 +37,7 @@ let
--set PATH "/run/current-system/sw/bin:/run/current-system/sw/sbin" \
--set MUNIN_LIBDIR "${pkgs.munin}/lib" \
--set MUNIN_PLUGSTATE "/var/run/munin"
-
+
# munin uses markers to tell munin-node-configure what a plugin can do
echo "#%# family=$family" >> $file
echo "#%# capabilities=$cap" >> $file
@@ -57,7 +57,7 @@ let
rundir /var/run/munin
${cronCfg.extraGlobalConfig}
-
+
${cronCfg.hosts}
'';
@@ -72,10 +72,10 @@ let
group root
host_name ${config.networking.hostName}
setsid 0
-
+
# wrapped plugins by makeWrapper being with dots
ignore_file ^\.
-
+
allow ^127\.0\.0\.1$
${nodeCfg.extraConfig}
@@ -97,7 +97,7 @@ in
See .
'';
};
-
+
extraConfig = mkOption {
default = "";
description = ''
@@ -118,7 +118,7 @@ in
Enable munin-cron. Takes care of all heavy lifting to collect data from
nodes and draws graphs to html. Runs munin-update, munin-limits,
munin-graphs and munin-html in that order.
-
+
HTML output is in /var/www/munin/, configure your
favourite webserver to serve static files.
'';
@@ -138,7 +138,7 @@ in
};
'';
};
-
+
extraGlobalConfig = mkOption {
default = "";
description = ''
@@ -160,7 +160,7 @@ in
'';
};
-
+
};
};
@@ -189,19 +189,18 @@ in
wantedBy = [ "multi-user.target" ];
path = [ pkgs.munin ];
environment.MUNIN_PLUGSTATE = "/var/run/munin";
+ preStart = ''
+ echo "updating munin plugins..."
+
+ mkdir -p /etc/munin/plugins
+ rm -rf /etc/munin/plugins/*
+ PATH="/run/current-system/sw/bin:/run/current-system/sw/sbin" ${pkgs.munin}/sbin/munin-node-configure --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${muninPlugins} --servicedir=/etc/munin/plugins 2>/dev/null | ${pkgs.bash}/bin/bash
+ '';
serviceConfig = {
ExecStart = "${pkgs.munin}/sbin/munin-node --config ${nodeConf} --servicedir /etc/munin/plugins/";
};
};
- system.activationScripts.munin-node = ''
- echo "updating munin plugins..."
-
- mkdir -p /etc/munin/plugins
- rm -rf /etc/munin/plugins/*
- PATH="/run/current-system/sw/bin:/run/current-system/sw/sbin" ${pkgs.munin}/sbin/munin-node-configure --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${muninPlugins} --servicedir=/etc/munin/plugins 2>/dev/null | ${pkgs.bash}/bin/bash
- '';
-
}) (mkIf cronCfg.enable {
services.cron.systemCronJobs = [
diff --git a/nixos/modules/services/monitoring/nagios.nix b/nixos/modules/services/monitoring/nagios.nix
index 97d153153a5..c1f7ba0eca7 100644
--- a/nixos/modules/services/monitoring/nagios.nix
+++ b/nixos/modules/services/monitoring/nagios.nix
@@ -12,7 +12,7 @@ let
nagiosObjectDefs = cfg.objectDefs;
nagiosObjectDefsDir = pkgs.runCommand "nagios-objects" {inherit nagiosObjectDefs;}
- "ensureDir $out; ln -s $nagiosObjectDefs $out/";
+ "mkdir -p $out; ln -s $nagiosObjectDefs $out/";
nagiosCfgFile = pkgs.writeText "nagios.cfg"
''
diff --git a/nixos/modules/services/monitoring/riemann-dash.nix b/nixos/modules/services/monitoring/riemann-dash.nix
new file mode 100644
index 00000000000..148dc046805
--- /dev/null
+++ b/nixos/modules/services/monitoring/riemann-dash.nix
@@ -0,0 +1,79 @@
+{ config, pkgs, lib, ... }:
+
+with pkgs;
+with lib;
+
+let
+
+ cfg = config.services.riemann-dash;
+
+ conf = writeText "config.rb" ''
+ riemann_base = "${cfg.dataDir}"
+ config.store[:ws_config] = "#{riemann_base}/config/config.json"
+ ${cfg.config}
+ '';
+
+ launcher = writeScriptBin "riemann-dash" ''
+ #!/bin/sh
+ exec ${rubyLibs.riemann_dash}/bin/riemann-dash ${conf}
+ '';
+
+in {
+
+ options = {
+
+ services.riemann-dash = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable the riemann-dash dashboard daemon.
+ '';
+ };
+ config = mkOption {
+ type = types.lines;
+ description = ''
+ Contents added to the end of the riemann-dash configuration file.
+ '';
+ };
+ dataDir = mkOption {
+ type = types.str;
+ default = "/var/riemann-dash";
+ description = ''
+ Location of the riemann-base dir. The dashboard configuration file is
+ is stored to this directory. The directory is created automatically on
+ service start, and owner is set to the riemanndash user.
+ '';
+ };
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ users.extraGroups.riemanndash.gid = config.ids.gids.riemanndash;
+
+ users.extraUsers.riemanndash = {
+ description = "riemann-dash daemon user";
+ uid = config.ids.uids.riemanndash;
+ group = "riemanndash";
+ };
+
+ systemd.services.riemann-dash = {
+ wantedBy = [ "multi-user.target" ];
+ wants = [ "riemann.service" ];
+ after = [ "riemann.service" ];
+ preStart = ''
+ mkdir -p ${cfg.dataDir}/config
+ chown -R riemanndash:riemanndash ${cfg.dataDir}
+ '';
+ serviceConfig = {
+ User = "riemanndash";
+ ExecStart = "${launcher}/bin/riemann-dash";
+ PermissionsStartOnly = true;
+ };
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/monitoring/riemann.nix b/nixos/modules/services/monitoring/riemann.nix
new file mode 100644
index 00000000000..a1935c29a04
--- /dev/null
+++ b/nixos/modules/services/monitoring/riemann.nix
@@ -0,0 +1,77 @@
+{ config, pkgs, lib, ... }:
+
+with pkgs;
+with lib;
+
+let
+
+ cfg = config.services.riemann;
+
+ classpath = concatStringsSep ":" (
+ cfg.extraClasspathEntries ++ [ "${riemann}/share/java/riemann.jar" ]
+ );
+
+ launcher = writeScriptBin "riemann" ''
+ #!/bin/sh
+ exec ${openjdk}/bin/java ${concatStringsSep "\n" cfg.extraJavaOpts} \
+ -cp ${classpath} \
+ riemann.bin ${writeText "riemann.config" cfg.config}
+ '';
+
+in {
+
+ options = {
+
+ services.riemann = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable the Riemann network monitoring daemon.
+ '';
+ };
+ config = mkOption {
+ type = types.lines;
+ description = ''
+ Contents of the Riemann configuration file.
+ '';
+ };
+ extraClasspathEntries = mkOption {
+ type = with types; listOf str;
+ default = [];
+ description = ''
+ Extra entries added to the Java classpath when running Riemann.
+ '';
+ };
+ extraJavaOpts = mkOption {
+ type = with types; listOf str;
+ default = [];
+ description = ''
+ Extra Java options used when launching Riemann.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+
+ users.extraGroups.riemann.gid = config.ids.gids.riemann;
+
+ users.extraUsers.riemann = {
+ description = "riemann daemon user";
+ uid = config.ids.uids.riemann;
+ group = "riemann";
+ };
+
+ systemd.services.riemann = {
+ wantedBy = [ "multi-user.target" ];
+ path = [ inetutils ];
+ serviceConfig = {
+ User = "riemann";
+ ExecStart = "${launcher}/bin/riemann";
+ };
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix
index 250035fe447..803bd9e9a65 100644
--- a/nixos/modules/services/monitoring/smartd.nix
+++ b/nixos/modules/services/monitoring/smartd.nix
@@ -62,7 +62,7 @@ in
enable = mkOption {
default = false;
type = types.bool;
- example = "true";
+ example = true;
description = ''
Run smartd from the smartmontools package. Note that e-mail
notifications will not be enabled unless you configure the list of
diff --git a/nixos/modules/services/monitoring/statsd.nix b/nixos/modules/services/monitoring/statsd.nix
index 74f3deb4c29..942ce72f6a3 100644
--- a/nixos/modules/services/monitoring/statsd.nix
+++ b/nixos/modules/services/monitoring/statsd.nix
@@ -8,13 +8,20 @@ let
configFile = pkgs.writeText "statsd.conf" ''
{
- host: "${cfg.host}",
+ address: "${cfg.host}",
port: "${toString cfg.port}",
mgmt_address: "${cfg.mgmt_address}",
mgmt_port: "${toString cfg.mgmt_port}",
- backends: [${concatMapStrings (el: ''"./backends/${el}",'') cfg.backends}],
- graphiteHost: "${cfg.graphiteHost}",
- graphitePort: "${toString cfg.graphitePort}",
+ backends: [${concatMapStringsSep "," (el: if (nixType el) == "string" then ''"./backends/${el}"'' else ''"${head el.names}"'') cfg.backends}],
+ ${optionalString (cfg.graphiteHost!=null) ''graphiteHost: "${cfg.graphiteHost}",''}
+ ${optionalString (cfg.graphitePort!=null) ''graphitePort: "${toString cfg.graphitePort}",''}
+ console: {
+ prettyprint: false
+ },
+ log: {
+ backend: "syslog"
+ },
+ automaticConfigReload: false${optionalString (cfg.extraConfig != null) ","}
${cfg.extraConfig}
}
'';
@@ -60,24 +67,26 @@ in
backends = mkOption {
description = "List of backends statsd will use for data persistance";
default = ["graphite"];
+ example = ["graphite" pkgs.nodePackages."statsd-influxdb-backend"];
+ type = types.listOf (types.either types.str types.package);
};
graphiteHost = mkOption {
description = "Hostname or IP of Graphite server";
- default = config.services.graphite.web.host;
- type = types.str;
+ default = null;
+ type = types.nullOr types.str;
};
graphitePort = mkOption {
description = "Port of Graphite server (i.e. carbon-cache).";
- default = 2003;
- type = types.uniq types.int;
+ default = null;
+ type = types.nullOr types.int;
};
extraConfig = mkOption {
- default = "";
description = "Extra configuration options for statsd";
- type = types.str;
+ default = "";
+ type = types.nullOr types.str;
};
};
@@ -95,6 +104,9 @@ in
systemd.services.statsd = {
description = "Statsd Server";
wantedBy = [ "multi-user.target" ];
+ environment = {
+ NODE_PATH=concatMapStringsSep ":" (el: "${el}/lib/node_modules") (filter (el: (nixType el) != "string") cfg.backends);
+ };
serviceConfig = {
ExecStart = "${pkgs.nodePackages.statsd}/bin/statsd ${configFile}";
User = "statsd";
diff --git a/nixos/modules/services/monitoring/systemhealth.nix b/nixos/modules/services/monitoring/systemhealth.nix
index b0e59595e13..20d1dadd3bf 100644
--- a/nixos/modules/services/monitoring/systemhealth.nix
+++ b/nixos/modules/services/monitoring/systemhealth.nix
@@ -13,7 +13,7 @@ let
};
buildInputs = [ python ];
installPhase = ''
- ensureDir $out/bin
+ mkdir -p $out/bin
# Make it work for kernels 3.x, not so different than 2.6
sed -i 's/2\.6/4.0/' system_health.py
cp system_health.py $out/bin
diff --git a/nixos/modules/services/monitoring/uptime.nix b/nixos/modules/services/monitoring/uptime.nix
index 553110d7b80..29616a085c8 100644
--- a/nixos/modules/services/monitoring/uptime.nix
+++ b/nixos/modules/services/monitoring/uptime.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let
- inherit (pkgs.lib) mkOption mkEnableOption mkIf mkMerge types optionalAttrs optional;
+ inherit (lib) mkOption mkEnableOption mkIf mkMerge types optionalAttrs optional;
cfg = config.services.uptime;
diff --git a/nixos/modules/services/network-filesystems/diod.nix b/nixos/modules/services/network-filesystems/diod.nix
new file mode 100644
index 00000000000..7de7acaa4a0
--- /dev/null
+++ b/nixos/modules/services/network-filesystems/diod.nix
@@ -0,0 +1,160 @@
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ cfg = config.services.diod;
+
+ diodBool = b: if b then "1" else "0";
+
+ diodConfig = pkgs.writeText "diod.conf" ''
+ allsquash = ${diodBool cfg.allsquash}
+ auth_required = ${diodBool cfg.authRequired}
+ exportall = ${diodBool cfg.exportall}
+ exportopts = "${concatStringsSep "," cfg.exportopts}"
+ exports = { ${concatStringsSep ", " (map (s: ''"${s}"'' ) cfg.exports)} }
+ listen = { ${concatStringsSep ", " (map (s: ''"${s}"'' ) cfg.listen)} }
+ logdest = "${cfg.logdest}"
+ nwthreads = ${toString cfg.nwthreads}
+ squashuser = "${cfg.squashuser}"
+ statfs_passthru = ${diodBool cfg.statfsPassthru}
+ userdb = ${diodBool cfg.userdb}
+ ${cfg.extraConfig}
+ '';
+in
+{
+ options = {
+ services.diod = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the diod 9P file server.";
+ };
+
+ listen = mkOption {
+ type = types.listOf types.str;
+ default = [ "0.0.0.0:564" ];
+ description = ''
+ [ "IP:PORT" [,"IP:PORT",...] ]
+ List the interfaces and ports that diod should listen on.
+ '';
+ };
+
+ exports = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ List the file systems that clients will be allowed to mount. All paths should
+ be fully qualified. The exports table can include two types of element:
+ a string element (as above),
+ or an alternate table element form { path="/path", opts="ro" }.
+ In the alternate form, the (optional) opts attribute is a comma-separated list
+ of export options. The two table element forms can be mixed in the exports
+ table. Note that although diod will not traverse file system boundaries for a
+ given mount due to inode uniqueness constraints, subdirectories of a file
+ system can be separately exported.
+ '';
+ };
+
+ exportall = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Export all file systems listed in /proc/mounts. If new file systems are mounted
+ after diod has started, they will become immediately mountable. If there is a
+ duplicate entry for a file system in the exports list, any options listed in
+ the exports entry will apply.
+ '';
+ };
+
+ exportopts = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Establish a default set of export options. These are overridden, not appended
+ to, by opts attributes in an "exports" entry.
+ '';
+ };
+
+ nwthreads = mkOption {
+ type = types.int;
+ default = 16;
+ description = ''
+ Sets the (fixed) number of worker threads created to handle 9P
+ requests for a unique aname.
+ '';
+ };
+
+ authRequired = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Allow clients to connect without authentication, i.e. without a valid MUNGE credential.
+ '';
+ };
+
+ userdb = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ This option disables password/group lookups. It allows any uid to attach and
+ assumes gid=uid, and supplementary groups contain only the primary gid.
+ '';
+ };
+
+ allsquash = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Remap all users to "nobody". The attaching user need not be present in the
+ password file.
+ '';
+ };
+
+ squashuser = mkOption {
+ type = types.str;
+ default = "nobody";
+ description = ''
+ Change the squash user. The squash user must be present in the password file.
+ '';
+ };
+
+ logdest = mkOption {
+ type = types.str;
+ default = "syslog:daemon:err";
+ description = ''
+ Set the destination for logging.
+ The value has the form of "syslog:facility:level" or "filename".
+ '';
+ };
+
+
+ statfsPassthru = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ This option configures statfs to return the host file system's type
+ rather than V9FS_MAGIC.
+ '';
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Extra configuration options for diod.conf.";
+ };
+ };
+ };
+
+ config = mkIf config.services.diod.enable {
+ environment.systemPackages = [ pkgs.diod ];
+
+ systemd.services.diod = {
+ description = "diod 9P file server";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ serviceConfig = {
+ ExecStart = "${pkgs.diod}/sbin/diod -f -c ${diodConfig}";
+ Capabilities = "cap_net_bind_service+=ep";
+ };
+ };
+ };
+}
diff --git a/nixos/modules/services/network-filesystems/nfsd.nix b/nixos/modules/services/network-filesystems/nfsd.nix
index 2217fec3b0f..893df51fc1f 100644
--- a/nixos/modules/services/network-filesystems/nfsd.nix
+++ b/nixos/modules/services/network-filesystems/nfsd.nix
@@ -56,6 +56,21 @@ in
default = false;
description = "Whether to create the mount points in the exports file at startup time.";
};
+
+ mountdPort = mkOption {
+ default = null;
+ example = 4002;
+ description = ''
+ Use fixed port for rpc.mountd, usefull if server is behind firewall.
+ '';
+ };
+
+ lockdPort = mkOption {
+ default = 0;
+ description = ''
+ Fix the lockd port number. This can help setting firewall rules for NFS.
+ '';
+ };
};
};
@@ -96,6 +111,9 @@ in
# Create a state directory required by NFSv4.
mkdir -p /var/lib/nfs/v4recovery
+ ${pkgs.procps}/sbin/sysctl -w fs.nfs.nlm_tcpport=${builtins.toString cfg.lockdPort}
+ ${pkgs.procps}/sbin/sysctl -w fs.nfs.nlm_udpport=${builtins.toString cfg.lockdPort}
+
rpc.nfsd \
${if cfg.hostName != null then "-H ${cfg.hostName}" else ""} \
${builtins.toString cfg.nproc}
@@ -138,7 +156,10 @@ in
restartTriggers = [ exports ];
serviceConfig.Type = "forking";
- serviceConfig.ExecStart = "@${pkgs.nfsUtils}/sbin/rpc.mountd rpc.mountd";
+ serviceConfig.ExecStart = ''
+ @${pkgs.nfsUtils}/sbin/rpc.mountd rpc.mountd \
+ ${if cfg.mountdPort != null then "-p ${toString cfg.mountdPort}" else ""}
+ '';
serviceConfig.Restart = "always";
};
diff --git a/nixos/modules/services/network-filesystems/openafs-client/default.nix b/nixos/modules/services/network-filesystems/openafs-client/default.nix
index b34ebc3663e..0297da9e865 100644
--- a/nixos/modules/services/network-filesystems/openafs-client/default.nix
+++ b/nixos/modules/services/network-filesystems/openafs-client/default.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let
- inherit (pkgs.lib) mkOption mkIf;
+ inherit (lib) mkOption mkIf;
cfg = config.services.openafsClient;
@@ -11,7 +11,7 @@ let
};
afsConfig = pkgs.runCommand "afsconfig" {} ''
- ensureDir $out
+ mkdir -p $out
echo ${cfg.cellName} > $out/ThisCell
cp ${cellServDB} $out/CellServDB
echo "/afs:${cfg.cacheDirectory}:${cfg.cacheSize}" > $out/cacheinfo
diff --git a/nixos/modules/services/network-filesystems/rsyncd.nix b/nixos/modules/services/network-filesystems/rsyncd.nix
index bc17add809b..19aa7efd2ff 100644
--- a/nixos/modules/services/network-filesystems/rsyncd.nix
+++ b/nixos/modules/services/network-filesystems/rsyncd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
-with pkgs.lib;
+with lib;
let
@@ -136,4 +136,4 @@ in
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 4218b965cd9..fd1e83d9f3e 100644
--- a/nixos/modules/services/network-filesystems/samba.nix
+++ b/nixos/modules/services/network-filesystems/samba.nix
@@ -6,9 +6,6 @@ let
cfg = config.services.samba;
- user = "smbguest";
- group = "smbguest";
-
logDir = "/var/log/samba";
privateDir = "/var/samba/private";
@@ -16,12 +13,6 @@ let
setupScript =
''
- if ! test -d /home/smbd ; then
- mkdir -p /home/smbd
- chown ${user} /home/smbd
- chmod a+rwx /home/smbd
- fi
-
if ! test -d /var/samba ; then
mkdir -p /var/samba/locks /var/samba/cores/nmbd /var/samba/cores/smbd /var/samba/cores/winbindd
fi
@@ -37,21 +28,15 @@ let
'';
configFile = pkgs.writeText "smb.conf"
+ (if cfg.configText != null then cfg.configText else
''
[ global ]
log file = ${logDir}/log.%m
private dir = ${privateDir}
${optionalString cfg.syncPasswordsByPam "pam password change = true"}
- ${if cfg.defaultShare.enable then ''
- [default]
- path = /home/smbd
- read only = ${if cfg.defaultShare.writeable then "no" else "yes"}
- guest ok = ${if cfg.defaultShare.guest then "yes" else "no"}
- ''else ""}
-
${cfg.extraConfig}
- '';
+ '');
# This may include nss_ldap, needed for samba if it has to use ldap.
nssModulesPath = config.system.nssModules.path;
@@ -149,19 +134,13 @@ in
";
};
- defaultShare = {
- enable = mkOption {
- description = "Whether to share /home/smbd as 'default'.";
- default = false;
- };
- writeable = mkOption {
- description = "Whether to allow write access to default share.";
- default = false;
- };
- guest = mkOption {
- description = "Whether to allow guest access to default share.";
- default = true;
- };
+ configText = mkOption {
+ type = types.nullOr types.lines;
+ default = null;
+ description = "
+ Verbatim contents of smb.conf. If null (default), use the
+ autogenerated file from NixOS instead.
+ ";
};
securityType = mkOption {
@@ -199,14 +178,6 @@ in
(mkIf config.services.samba.enable {
- users.extraUsers.smbguest = {
- description = "Samba service user";
- group = group;
- uid = config.ids.uids.smbguest;
- };
-
- users.extraGroups.smbguest.gid = config.ids.uids.smbguest;
-
system.nssModules = optional cfg.nsswins samba;
systemd = {
@@ -224,7 +195,7 @@ in
"samba-setup" = {
description = "Samba Setup Task";
script = setupScript;
- unitConfig.RequiresMountsFor = "/home/smbd /var/samba /var/log/samba";
+ unitConfig.RequiresMountsFor = "/var/samba /var/log/samba";
};
};
};
diff --git a/nixos/modules/services/network-filesystems/yandex-disk.nix b/nixos/modules/services/network-filesystems/yandex-disk.nix
new file mode 100644
index 00000000000..982b6ca5ea7
--- /dev/null
+++ b/nixos/modules/services/network-filesystems/yandex-disk.nix
@@ -0,0 +1,104 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.yandex-disk;
+
+ dir = "/var/lib/yandex-disk";
+
+ u = if cfg.user != null then cfg.user else "yandexdisk";
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.yandex-disk = {
+
+ enable = mkOption {
+ default = false;
+ description = "
+ Whether to enable Yandex-disk client. See https://disk.yandex.ru/
+ ";
+ };
+
+ username = mkOption {
+ default = "";
+ type = types.string;
+ description = ''
+ Your yandex.com login name.
+ '';
+ };
+
+ password = mkOption {
+ default = "";
+ type = types.string;
+ description = ''
+ Your yandex.com password. Warning: it will be world-readable in /nix/store.
+ '';
+ };
+
+ user = mkOption {
+ default = null;
+ description = ''
+ The user the yandex-disk daemon should run as.
+ '';
+ };
+
+ directory = mkOption {
+ default = "/home/Yandex.Disk";
+ description = "The directory to use for Yandex.Disk storage";
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers = mkIf (cfg.user == null) [ {
+ name = u;
+ uid = config.ids.uids.yandexdisk;
+ group = "nogroup";
+ home = dir;
+ } ];
+
+ systemd.services.yandex-disk = {
+ description = "Yandex-disk server";
+
+ after = [ "network.target" ];
+
+ wantedBy = [ "multi-user.target" ];
+
+ # FIXME: have to specify ${directory} here as well
+ unitConfig.RequiresMountsFor = dir;
+
+ script = ''
+ mkdir -p -m 700 ${dir}
+ chown ${u} ${dir}
+
+ if ! test -d "${cfg.directory}" ; then
+ mkdir -p -m 755 ${cfg.directory} ||
+ exit 1
+ fi
+
+ ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${u} \
+ -c '${pkgs.yandex-disk}/bin/yandex-disk token -p ${cfg.password} ${cfg.username} ${dir}/token'
+
+ ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${u} \
+ -c '${pkgs.yandex-disk}/bin/yandex-disk start --no-daemon -a ${dir}/token -d ${cfg.directory}'
+ '';
+
+ };
+ };
+
+}
+
diff --git a/nixos/modules/services/networking/atftpd.nix b/nixos/modules/services/networking/atftpd.nix
new file mode 100644
index 00000000000..47465ba948a
--- /dev/null
+++ b/nixos/modules/services/networking/atftpd.nix
@@ -0,0 +1,51 @@
+# NixOS module for atftpd TFTP server
+
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.atftpd;
+
+in
+
+{
+
+ options = {
+
+ services.atftpd = {
+
+ enable = mkOption {
+ default = false;
+ type = types.uniq types.bool;
+ description = ''
+ Whenever to enable the atftpd TFTP server.
+ '';
+ };
+
+ root = mkOption {
+ default = "/var/empty";
+ type = types.uniq types.string;
+ description = ''
+ Document root directory for the atftpd.
+ '';
+ };
+
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ systemd.services.atftpd = {
+ description = "atftpd TFTP server";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ # runs as nobody
+ serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address 0.0.0.0 ${cfg.root}";
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/btsync.nix b/nixos/modules/services/networking/btsync.nix
index 5d0e17c293e..7ddc9e1045e 100644
--- a/nixos/modules/services/networking/btsync.nix
+++ b/nixos/modules/services/networking/btsync.nix
@@ -57,7 +57,7 @@ let
''
{
"device_name": "${cfg.deviceName}",
- "storage_path": "/var/lib/btsync",
+ "storage_path": "/var/lib/btsync/",
"listening_port": ${toString cfg.listeningPort},
"use_gui": false,
diff --git a/nixos/modules/services/networking/cjdns-hosts.sh b/nixos/modules/services/networking/cjdns-hosts.sh
new file mode 100644
index 00000000000..8a2b47e5214
--- /dev/null
+++ b/nixos/modules/services/networking/cjdns-hosts.sh
@@ -0,0 +1,11 @@
+pubs=($pubs)
+hosts=($hosts)
+
+lines="''\n"
+for ((i = 0; i < ${#pubs[*]}; i++)); do
+ addr=$($cjdns/bin/publictoip6 ${pubs[i]})
+ lines="${lines}$addr ${hosts[i]}\n"
+done
+lines="${lines}''"
+
+echo -ne $lines > $out
diff --git a/nixos/modules/services/networking/cjdns.nix b/nixos/modules/services/networking/cjdns.nix
index 9306ffd5a18..9888419309c 100644
--- a/nixos/modules/services/networking/cjdns.nix
+++ b/nixos/modules/services/networking/cjdns.nix
@@ -1,56 +1,78 @@
-# You may notice the commented out sections in this file,
-# it would be great to configure cjdns from nix, but cjdns
-# reads its configuration from stdin, including the private
-# key and admin password, all nested in a JSON structure.
-#
-# Until a good method of storing the keys outside the nix
-# store and mixing them back into a string is devised
-# (without too much shell hackery), a skeleton of the
-# configuration building lies commented out.
-
{ config, lib, pkgs, ... }:
with lib;
let
+ pkg = pkgs.cjdns;
+
cfg = config.services.cjdns;
- /*
- # can't keep keys and passwords in the nix store,
- # but don't want to deal with this stdin quagmire.
+ connectToSubmodule =
+ { options, ... }:
+ { options =
+ { password = mkOption {
+ type = types.str;
+ description = "Authorized password to the opposite end of the tunnel.";
+ };
+ publicKey = mkOption {
+ type = types.str;
+ description = "Public key at the opposite end of the tunnel.";
+ };
+ hostname = mkOption {
+ default = "";
+ example = "foobar.hype";
+ type = types.str;
+ description = "Optional hostname to add to /etc/hosts; prevents reverse lookup failures.";
+ };
+ };
+ };
- cjdrouteConf = '' {
- "admin": {"bind": "${cfg.admin.bind}", "password": "\${CJDNS_ADMIN}" },
- "privateKey": "\${CJDNS_KEY}",
+ peers = mapAttrsToList (n: v: v) (cfg.ETHInterface.connectTo // cfg.UDPInterface.connectTo);
- "interfaces": {
- ''
+ pubs = toString (map (p: if p.hostname == "" then "" else p.publicKey) peers);
+ hosts = toString (map (p: if p.hostname == "" then "" else p.hostname) peers);
- + optionalString (cfg.interfaces.udp.bind.address != null) ''
- "UDPInterface": [ {
- "bind": "${cfg.interfaces.udp.bind.address}:"''
- ${if cfg.interfaces.upd.bind.port != null
- then ${toString cfg.interfaces.udp.bind.port}
- else ${RANDOM}
- fi)
- + '' } ]''
+ cjdnsHosts =
+ if hosts != "" then
+ import (pkgs.stdenv.mkDerivation {
+ name = "cjdns-hosts";
+ builder = ./cjdns-hosts.sh;
- + (if cfg.interfaces.eth.bind != null then ''
- "ETHInterface": [ {
- "bind": "${cfg.interfaces.eth.bind}",
- "beacon": ${toString cfg.interfaces.eth.beacon}
- } ]
- '' fi )
- + ''
- },
- "router": { "interface": { "type": "TUNInterface" }, },
- "security": [ { "setuser": "nobody" } ]
- }
- '';
+ inherit (pkgs) cjdns;
+ inherit pubs hosts;
+ })
+ else "";
+
+ # would be nice to merge 'cfg' with a //,
+ # but the json nesting is wacky.
+ cjdrouteConf = builtins.toJSON ( {
+ admin = {
+ bind = cfg.admin.bind;
+ password = "@CJDNS_ADMIN_PASSWORD@";
+ };
+ authorizedPasswords = map (p: { password = p; }) cfg.authorizedPasswords;
+ interfaces = {
+ ETHInterface = if (cfg.ETHInterface.bind != "") then [ cfg.ETHInterface ] else [ ];
+ UDPInterface = if (cfg.UDPInterface.bind != "") then [ cfg.UDPInterface ] else [ ];
+ };
+
+ privateKey = "@CJDNS_PRIVATE_KEY@";
+
+ resetAfterInactivitySeconds = 100;
+
+ router = {
+ interface = { type = "TUNInterface"; };
+ ipTunnel = {
+ allowedConnections = [];
+ outgoingConnections = [];
+ };
+ };
+
+ security = [ { exemptAngel = 1; setuser = "nobody"; } ];
+
+ });
- cjdrouteConfFile = pkgs.writeText "cjdroute.conf" cjdrouteConf
- */
in
{
@@ -60,148 +82,180 @@ in
enable = mkOption {
type = types.bool;
- default = false;
+ default = false;
description = ''
- Enable this option to start a instance of the
- cjdns network encryption and and routing engine.
- Configuration will be read from confFile.
+ Whether to enable the cjdns network encryption
+ and routing engine. A file at /etc/cjdns.keys will
+ be created if it does not exist to contain a random
+ secret key that your IPv6 address will be derived from.
'';
};
confFile = mkOption {
- default = "/etc/cjdroute.conf";
+ type = types.str;
+ default = "";
+ example = "/etc/cjdroute.conf";
description = ''
- Configuration file to pipe to cjdroute.
+ Ignore all other cjdns options and load configuration from this file.
'';
};
- /*
+ authorizedPasswords = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [
+ "snyrfgkqsc98qh1y4s5hbu0j57xw5s0"
+ "z9md3t4p45mfrjzdjurxn4wuj0d8swv"
+ "49275fut6tmzu354pq70sr5b95qq0vj"
+ ];
+ description = ''
+ Any remote cjdns nodes that offer these passwords on
+ connection will be allowed to route through this node.
+ '';
+ };
+
admin = {
bind = mkOption {
- default = "127.0.0.1:11234";
- description = ''
+ type = types.string;
+ default = "127.0.0.1:11234";
+ description = ''
Bind the administration port to this address and port.
- '';
- };
-
- passwordFile = mkOption {
- example = "/root/cjdns.adminPassword";
- description = ''
- File containing a password to the administration port.
- '';
- };
- };
-
- keyFile = mkOption {
- type = types.str;
- example = "/root/cjdns.key";
- description = ''
- Path to a file containing a cjdns private key on a single line.
- '';
- };
-
- passwordsFile = mkOption {
- type = types.str;
- default = null;
- example = "/root/cjdns.authorizedPasswords";
- description = ''
- A file containing a list of json dictionaries with passwords.
- For example:
- {"password": "s8xf5z7znl4jt05g922n3wpk75wkypk"},
- { "name": "nice guy",
- "password": "xhthk1mglz8tpjrbbvdlhyc092rhpx5"},
- {"password": "3qfxyhmrht7uwzq29pmhbdm9w4bnc8w"}
- '';
- };
-
- interfaces = {
- udp = {
- bind = {
- address = mkOption {
- default = "0.0.0.0";
- description = ''
- Address to bind UDP tunnels to; disable by setting to null;
- '';
- };
- port = mkOption {
- type = types.int;
- default = null;
- description = ''
- Port to bind UDP tunnels to.
- A port will be choosen at random if this is not set.
- This option is required to act as the server end of
- a tunnel.
- '';
- };
- };
- };
-
- eth = {
- bind = mkOption {
- default = null;
- example = "eth0";
- description = ''
- Bind to this device and operate with native wire format.
- '';
- };
-
- beacon = mkOption {
- default = 2;
- description = ''
- Auto-connect to other cjdns nodes on the same network.
- Options:
- 0 -- Disabled.
-
- 1 -- Accept beacons, this will cause cjdns to accept incoming
- beacon messages and try connecting to the sender.
-
- 2 -- Accept and send beacons, this will cause cjdns to broadcast
- messages on the local network which contain a randomly
- generated per-session password, other nodes which have this
- set to 1 or 2 will hear the beacon messages and connect
- automatically.
- '';
- };
-
- connectTo = mkOption {
- type = types.listOf types.str;
- default = [];
- description = ''
- Credentials for connecting look similar to UDP credientials
- except they begin with the mac address, for example:
- "01:02:03:04:05:06":{"password":"a","publicKey":"b"}
- '';
- };
+ '';
};
};
- */
+
+ UDPInterface = {
+ bind = mkOption {
+ type = types.string;
+ default = "";
+ example = "192.168.1.32:43211";
+ description = ''
+ Address and port to bind UDP tunnels to.
+ '';
+ };
+ connectTo = mkOption {
+ type = types.attrsOf ( types.submodule ( connectToSubmodule ) );
+ default = { };
+ example = {
+ "192.168.1.1:27313" = {
+ hostname = "homer.hype";
+ password = "5kG15EfpdcKNX3f2GSQ0H1HC7yIfxoCoImnO5FHM";
+ publicKey = "371zpkgs8ss387tmr81q04mp0hg1skb51hw34vk1cq644mjqhup0.k";
+ };
+ };
+ description = ''
+ Credentials for making UDP tunnels.
+ '';
+ };
+ };
+
+ ETHInterface = {
+ bind = mkOption {
+ default = "";
+ example = "eth0";
+ description = ''
+ Bind to this device for native ethernet operation.
+ '';
+ };
+
+ beacon = mkOption {
+ type = types.int;
+ default = 2;
+ description = ''
+ Auto-connect to other cjdns nodes on the same network.
+ Options:
+ 0: Disabled.
+ 1: Accept beacons, this will cause cjdns to accept incoming
+ beacon messages and try connecting to the sender.
+ 2: Accept and send beacons, this will cause cjdns to broadcast
+ messages on the local network which contain a randomly
+ generated per-session password, other nodes which have this
+ set to 1 or 2 will hear the beacon messages and connect
+ automatically.
+ '';
+ };
+
+ connectTo = mkOption {
+ type = types.attrsOf ( types.submodule ( connectToSubmodule ) );
+ default = { };
+ example = {
+ "01:02:03:04:05:06" = {
+ hostname = "homer.hype";
+ password = "5kG15EfpdcKNX3f2GSQ0H1HC7yIfxoCoImnO5FHM";
+ publicKey = "371zpkgs8ss387tmr81q04mp0hg1skb51hw34vk1cq644mjqhup0.k";
+ };
+ };
+ description = ''
+ Credentials for connecting look similar to UDP credientials
+ except they begin with the mac address.
+ '';
+ };
+ };
+
};
+
};
config = mkIf config.services.cjdns.enable {
boot.kernelModules = [ "tun" ];
- /*
- networking.firewall.allowedUDPPorts = mkIf (cfg.udp.bind.port != null) [
- cfg.udp.bind.port
- ];
- */
+ # networking.firewall.allowedUDPPorts = ...
systemd.services.cjdns = {
description = "encrypted networking for everybody";
wantedBy = [ "multi-user.target" ];
- wants = [ "network.target" ];
- before = [ "network.target" ];
- path = [ pkgs.cjdns ];
+ after = [ "network-interfaces.target" ];
+
+ script = (
+ if cfg.confFile != "" then "${pkg}/bin/cjdroute < ${cfg.confFile}" else
+ ''
+ source /etc/cjdns.keys
+ echo '${cjdrouteConf}' | sed \
+ -e "s/@CJDNS_ADMIN_PASSWORD@/$CJDNS_ADMIN_PASSWORD/g" \
+ -e "s/@CJDNS_PRIVATE_KEY@/$CJDNS_PRIVATE_KEY/g" \
+ | ${pkg}/bin/cjdroute
+ ''
+ );
serviceConfig = {
Type = "forking";
- ExecStart = ''
- ${pkgs.stdenv.shell} -c "${pkgs.cjdns}/sbin/cjdroute < ${cfg.confFile}"
- '';
- Restart = "on-failure";
+ Restart = "on-failure";
};
};
+
+ system.activationScripts.cjdns = if (cfg.confFile == "") then "" else ''
+ cjdnsWriteKeys() {
+ private=$1
+ ipv6=$2
+ public=$3
+
+ echo "CJDNS_PRIVATE_KEY=$1" >> /etc/cjdns.keys
+ echo -e "CJDNS_IPV6=$2\nCJDNS_PUBLIC_KEY=$3" > /etc/cjdns.public
+
+ chmod 600 /etc/cjdns.keys
+ chmod 444 /etc/cjdns.public
+ }
+
+ grep -q "CJDNS_PRIVATE_KEY=" /etc/cjdns.keys || \
+ cjdnsWriteKeys $(${pkg}/bin/makekeys)
+
+ grep -q "CJDNS_ADMIN_PASSWORD=" /etc/cjdns.keys || \
+ echo "CJDNS_ADMIN_PASSWORD=$(${pkgs.coreutils}/bin/head -c 96 /dev/urandom | ${pkgs.coreutils}/bin/tr -dc A-Za-z0-9)" \
+ >> /etc/cjdns.keys
+ '';
+
+ networking.extraHosts = "${cjdnsHosts}";
+
+ assertions = [
+ { assertion = ( cfg.ETHInterface.bind != "" || cfg.UDPInterface.bind != "" || cfg.confFile == "" );
+ message = "Neither cjdns.ETHInterface.bind nor cjdns.UDPInterface.bind defined.";
+ }
+ { assertion = config.networking.enableIPv6;
+ message = "networking.enableIPv6 must be enabled for CJDNS to work";
+ }
+ ];
+
};
-}
+
+}
\ No newline at end of file
diff --git a/nixos/modules/services/networking/connman.nix b/nixos/modules/services/networking/connman.nix
index 7ed1e4805d8..482b61997ae 100644
--- a/nixos/modules/services/networking/connman.nix
+++ b/nixos/modules/services/networking/connman.nix
@@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
-with lib;
with pkgs;
+with lib;
let
cfg = config.networking.connman;
diff --git a/nixos/modules/services/networking/consul.nix b/nixos/modules/services/networking/consul.nix
new file mode 100644
index 00000000000..ebc83681408
--- /dev/null
+++ b/nixos/modules/services/networking/consul.nix
@@ -0,0 +1,166 @@
+{ config, lib, pkgs, utils, ... }:
+
+with lib;
+let
+
+ dataDir = "/var/lib/consul";
+ cfg = config.services.consul;
+
+ configOptions = {
+ data_dir = dataDir;
+ rejoin_after_leave = true;
+ }
+ // (if cfg.webUi then { ui_dir = "${pkgs.consul.ui}"; } else { })
+ // cfg.extraConfig;
+
+ configFiles = [ "/etc/consul.json" "/etc/consul-addrs.json" ]
+ ++ cfg.extraConfigFiles;
+
+ devices = attrValues (filterAttrs (_: i: i != null) cfg.interface);
+ systemdDevices = flip map devices
+ (i: "sys-subsystem-net-devices-${utils.escapeSystemdPath i}.device");
+in
+{
+ options = {
+
+ services.consul = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enables the consul daemon.
+ '';
+ };
+
+ webUi = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enables the web interface on the consul http port.
+ '';
+ };
+
+ interface = {
+
+ advertise = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = ''
+ The name of the interface to pull the advertise_addr from.
+ '';
+ };
+
+ bind = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = ''
+ The name of the interface to pull the bind_addr from.
+ '';
+ };
+
+ };
+
+ forceIpv4 = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether we should force the interfaces to only pull ipv4 addresses.
+ '';
+ };
+
+ dropPrivileges = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Whether the consul agent should be run as a non-root consul user.
+ '';
+ };
+
+ extraConfig = mkOption {
+ default = { };
+ description = ''
+ Extra configuration options which are serialized to json and added
+ to the config.json file.
+ '';
+ };
+
+ extraConfigFiles = mkOption {
+ default = [ ];
+ type = types.listOf types.str;
+ description = ''
+ Additional configuration files to pass to consul
+ NOTE: These will not trigger the service to be restarted when altered.
+ '';
+ };
+
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers."consul" = {
+ description = "Consul agent daemon user";
+ uid = config.ids.uids.consul;
+ };
+
+ environment = {
+ etc."consul.json".text = builtins.toJSON configOptions;
+ systemPackages = with pkgs; [ consul ];
+ };
+
+ systemd.services.consul = {
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ] ++ systemdDevices;
+ bindsTo = systemdDevices;
+ restartTriggers = [ config.environment.etc."consul.json".source ];
+
+ serviceConfig = {
+ ExecStart = "@${pkgs.consul}/bin/consul consul agent"
+ + concatMapStrings (n: " -config-file ${n}") configFiles;
+ ExecStop = "${pkgs.consul}/bin/consul leave";
+ ExecReload = "${pkgs.consul}/bin/consul reload";
+ PermissionsStartOnly = true;
+ User = if cfg.dropPrivileges then "consul" else null;
+ };
+
+ path = with pkgs; [ iproute gnugrep gawk ];
+ preStart = ''
+ mkdir -m 0700 -p ${dataDir}
+ chown -R consul ${dataDir}
+
+ # Determine interface addresses
+ getAddrOnce () {
+ ip addr show dev "$1" \
+ | grep 'inet${optionalString (cfg.forceIpv4) " "}.*scope global' \
+ | awk -F '[ /\t]*' '{print $3}' | head -n 1
+ }
+ getAddr () {
+ ADDR="$(getAddrOnce $1)"
+ LEFT=60 # Die after 1 minute
+ while [ -z "$ADDR" ]; do
+ sleep 1
+ LEFT=$(expr $LEFT - 1)
+ if [ "$LEFT" -eq "0" ]; then
+ echo "Address lookup timed out"
+ exit 1
+ fi
+ ADDR="$(getAddrOnce $1)"
+ done
+ echo "$ADDR"
+ }
+ echo "{" > /etc/consul-addrs.json
+ ''
+ + concatStrings (flip mapAttrsToList cfg.interface (name: i:
+ optionalString (i != null) ''
+ echo " \"${name}_addr\": \"$(getAddr "${i}")\"," >> /etc/consul-addrs.json
+ ''))
+ + ''
+ echo " \"\": \"\"" >> /etc/consul-addrs.json
+ echo "}" >> /etc/consul-addrs.json
+ '';
+ };
+
+ };
+}
diff --git a/nixos/modules/services/networking/copy-com.nix b/nixos/modules/services/networking/copy-com.nix
new file mode 100644
index 00000000000..36bd29109b8
--- /dev/null
+++ b/nixos/modules/services/networking/copy-com.nix
@@ -0,0 +1,53 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.copy-com;
+
+in
+
+{
+ options = {
+
+ services.copy-com = {
+
+ enable = mkOption {
+ default = false;
+ description = "
+ Enable the copy.com client.
+
+ The first time copy.com is run, it needs to be configured. Before enabling run
+ copy_console manually.
+ ";
+ };
+
+ user = mkOption {
+ description = "The user for which copy should run.";
+ };
+
+ debug = mkOption {
+ default = false;
+ description = "Output more.";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = [ pkgs.postfix ];
+
+ systemd.services."copy-com-${cfg.user}" = {
+ description = "Copy.com Client";
+ after = [ "network.target" "local-fs.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ ExecStart = "${pkgs.copy-com}/bin/copy_console ${if cfg.debug then "-consoleOutput -debugToConsole=dirwatch,path-watch,csm_path,csm -debug -console" else ""}";
+ User = "${cfg.user}";
+ };
+
+ };
+ };
+
+}
+
diff --git a/nixos/modules/services/networking/ddclient.nix b/nixos/modules/services/networking/ddclient.nix
index c53cb68fb75..bb94a8dacfa 100644
--- a/nixos/modules/services/networking/ddclient.nix
+++ b/nixos/modules/services/networking/ddclient.nix
@@ -1,8 +1,8 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let
- inherit (pkgs.lib) mkOption mkIf singleton;
+ inherit (lib) mkOption mkIf singleton;
inherit (pkgs) ddclient;
diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix
index 5a353fc0942..15dbf80a987 100644
--- a/nixos/modules/services/networking/dhcpcd.nix
+++ b/nixos/modules/services/networking/dhcpcd.nix
@@ -6,10 +6,13 @@ let
dhcpcd = if !config.boot.isContainer then pkgs.dhcpcd else pkgs.dhcpcd.override { udev = null; };
+ cfg = config.networking.dhcpcd;
+
# Don't start dhcpcd on explicitly configured interfaces or on
- # interfaces that are part of a bridge.
+ # interfaces that are part of a bridge, bond or sit device.
ignoredInterfaces =
- map (i: i.name) (filter (i: i.ipAddress != null) (attrValues config.networking.interfaces))
+ map (i: i.name) (filter (i: i.ip4 != [ ] || i.ipAddress != null) (attrValues config.networking.interfaces))
+ ++ mapAttrsToList (i: _: i) config.networking.sits
++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bridges))
++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bonds))
++ config.networking.dhcpcd.denyInterfaces;
@@ -35,9 +38,12 @@ let
# Ignore peth* devices; on Xen, they're renamed physical
# Ethernet cards used for bridging. Likewise for vif* and tap*
# (Xen) and virbr* and vnet* (libvirt).
- denyinterfaces ${toString ignoredInterfaces} lo peth* vif* tap* tun* virbr* vnet* vboxnet*
+ denyinterfaces ${toString ignoredInterfaces} lo peth* vif* tap* tun* virbr* vnet* vboxnet* sit*
- ${config.networking.dhcpcd.extraConfig}
+ # Use the list of allowed interfaces if specified
+ ${optionalString (cfg.allowInterfaces != null) "allowinterfaces ${toString cfg.allowInterfaces}"}
+
+ ${cfg.extraConfig}
'';
# Hook for emitting ip-up/ip-down events.
@@ -58,7 +64,7 @@ let
# ${config.systemd.package}/bin/systemctl start ip-down.target
#fi
- ${config.networking.dhcpcd.runHook}
+ ${cfg.runHook}
'';
in
@@ -69,6 +75,18 @@ in
options = {
+ networking.dhcpcd.persistent = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whenever to leave interfaces configured on dhcpcd daemon
+ shutdown. Set to true if you have your root or store mounted
+ over the network or this machine accepts SSH connections
+ through DHCP interfaces and clients should be notified when
+ it shuts down.
+ '';
+ };
+
networking.dhcpcd.denyInterfaces = mkOption {
type = types.listOf types.str;
default = [];
@@ -80,6 +98,17 @@ in
'';
};
+ networking.dhcpcd.allowInterfaces = mkOption {
+ type = types.nullOr (types.listOf types.str);
+ default = null;
+ description = ''
+ Enable the DHCP client for any interface whose name matches
+ any of the shell glob patterns in this list. Any interface not
+ explicitly matched by this pattern will be denied. This pattern only
+ applies when non-null.
+ '';
+ };
+
networking.dhcpcd.extraConfig = mkOption {
type = types.lines;
default = "";
@@ -109,6 +138,9 @@ in
{ description = "DHCP Client";
wantedBy = [ "network.target" ];
+ # Work-around to deal with problems where the kernel would remove &
+ # re-create Wifi interfaces early during boot.
+ after = [ "network-interfaces.target" ];
# Stopping dhcpcd during a reconfiguration is undesirable
# because it brings down the network interfaces configured by
@@ -122,7 +154,7 @@ in
serviceConfig =
{ Type = "forking";
PIDFile = "/run/dhcpcd.pid";
- ExecStart = "@${dhcpcd}/sbin/dhcpcd dhcpcd --quiet --config ${dhcpcdConf}";
+ ExecStart = "@${dhcpcd}/sbin/dhcpcd dhcpcd --quiet ${optionalString cfg.persistent "--persistent"} --config ${dhcpcdConf}";
ExecReload = "${dhcpcd}/sbin/dhcpcd --rebind";
Restart = "always";
};
diff --git a/nixos/modules/services/networking/dhcpd.nix b/nixos/modules/services/networking/dhcpd.nix
index 89f686c2870..900df67b53a 100644
--- a/nixos/modules/services/networking/dhcpd.nix
+++ b/nixos/modules/services/networking/dhcpd.nix
@@ -13,12 +13,12 @@ let
default-lease-time 600;
max-lease-time 7200;
authoritative;
- ddns-update-style ad-hoc;
+ ddns-update-style interim;
log-facility local1; # see dhcpd.nix
${cfg.extraConfig}
- ${pkgs.lib.concatMapStrings
+ ${lib.concatMapStrings
(machine: ''
host ${machine.hostName} {
hardware ethernet ${machine.ethernetAddress};
@@ -108,22 +108,41 @@ in
config = mkIf config.services.dhcpd.enable {
- jobs.dhcpd =
+ users = {
+ extraUsers.dhcpd = {
+ uid = config.ids.uids.dhcpd;
+ description = "DHCP daemon user";
+ };
+ };
+
+ systemd.services.dhcpd =
{ description = "DHCP server";
- startOn = "started network-interfaces";
- stopOn = "stopping network-interfaces";
+ wantedBy = [ "multi-user.target" ];
- script =
+ after = [ "network.target" ];
+
+ path = [ pkgs.dhcp ];
+
+ preStart =
''
mkdir -m 755 -p ${stateDir}
touch ${stateDir}/dhcpd.leases
- exec ${pkgs.dhcp}/sbin/dhcpd -f -cf ${configFile} \
- -lf ${stateDir}/dhcpd.leases \
- ${toString cfg.interfaces}
+ mkdir -m 755 -p /run/dhcpd
+ chown dhcpd /run/dhcpd
'';
+
+ serviceConfig =
+ { ExecStart = "@${pkgs.dhcp}/sbin/dhcpd dhcpd"
+ + " -pf /run/dhcpd/dhcpd.pid -cf ${configFile}"
+ + " -lf ${stateDir}/dhcpd.leases -user dhcpd -group nogroup"
+ + " ${toString cfg.interfaces}";
+ Restart = "always";
+ Type = "forking";
+ PIDFile = "/run/dhcpd/dhcpd.pid";
+ };
};
};
diff --git a/nixos/modules/services/networking/dnsmasq.nix b/nixos/modules/services/networking/dnsmasq.nix
index 8e38b9d017a..5c68dd89fb1 100644
--- a/nixos/modules/services/networking/dnsmasq.nix
+++ b/nixos/modules/services/networking/dnsmasq.nix
@@ -6,9 +6,14 @@ let
cfg = config.services.dnsmasq;
dnsmasq = pkgs.dnsmasq;
- serversParam = concatMapStrings (s: "-S ${s} ") cfg.servers;
-
dnsmasqConf = pkgs.writeText "dnsmasq.conf" ''
+ ${optionalString cfg.resolveLocalQueries ''
+ conf-file=/etc/dnsmasq-conf.conf
+ resolv-file=/etc/dnsmasq-resolv.conf
+ ''}
+ ${flip concatMapStrings cfg.servers (server: ''
+ server=${server}
+ '')}
${cfg.extraConfig}
'';
@@ -29,11 +34,19 @@ in
'';
};
+ resolveLocalQueries = mkOption {
+ default = true;
+ description = ''
+ Whether dnsmasq should resolve local queries (i.e. add 127.0.0.1 to
+ /etc/resolv.conf)
+ '';
+ };
+
servers = mkOption {
default = [];
example = [ "8.8.8.8" "8.8.4.4" ];
description = ''
- The parameter to dnsmasq -S.
+ The DNS servers which dnsmasq should query.
'';
};
@@ -55,16 +68,35 @@ in
config = mkIf config.services.dnsmasq.enable {
- jobs.dnsmasq =
- { description = "dnsmasq daemon";
+ networking.nameservers =
+ optional cfg.resolveLocalQueries "127.0.0.1";
- startOn = "ip-up";
+ services.dbus.packages = [ dnsmasq ];
- daemonType = "daemon";
-
- exec = "${dnsmasq}/bin/dnsmasq -R ${serversParam} -o -C ${dnsmasqConf}";
+ users.extraUsers = singleton
+ { name = "dnsmasq";
+ uid = config.ids.uids.dnsmasq;
+ description = "Dnsmasq daemon user";
+ home = "/var/empty";
};
+ systemd.services.dnsmasq = {
+ description = "dnsmasq daemon";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ path = [ dnsmasq ];
+ preStart = ''
+ touch /etc/dnsmasq-{conf,resolv}.conf
+ dnsmasq --test
+ '';
+ serviceConfig = {
+ Type = "dbus";
+ BusName = "uk.org.thekelleys.dnsmasq";
+ ExecStart = "${dnsmasq}/bin/dnsmasq -k --enable-dbus --user=dnsmasq -C ${dnsmasqConf}";
+ ExecReload = "${dnsmasq}/bin/kill -HUP $MAINPID";
+ };
+ };
+
};
}
diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix
index 42914bfe5d6..68aac3d30de 100644
--- a/nixos/modules/services/networking/firewall.nix
+++ b/nixos/modules/services/networking/firewall.nix
@@ -37,6 +37,180 @@ let
}
'';
+ writeShScript = name: text: let dir = pkgs.writeScriptBin name ''
+ #! ${pkgs.stdenv.shell} -e
+ ${text}
+ ''; in "${dir}/bin/${name}";
+
+ startScript = writeShScript "firewall-start" ''
+ ${helpers}
+
+ # Flush the old firewall rules. !!! Ideally, updating the
+ # firewall would be atomic. Apparently that's possible
+ # with iptables-restore.
+ ip46tables -D INPUT -j nixos-fw 2> /dev/null || true
+ for chain in nixos-fw nixos-fw-accept nixos-fw-log-refuse nixos-fw-refuse FW_REFUSE; do
+ ip46tables -F "$chain" 2> /dev/null || true
+ ip46tables -X "$chain" 2> /dev/null || true
+ done
+
+
+ # The "nixos-fw-accept" chain just accepts packets.
+ ip46tables -N nixos-fw-accept
+ ip46tables -A nixos-fw-accept -j ACCEPT
+
+
+ # The "nixos-fw-refuse" chain rejects or drops packets.
+ ip46tables -N nixos-fw-refuse
+
+ ${if cfg.rejectPackets then ''
+ # Send a reset for existing TCP connections that we've
+ # somehow forgotten about. Send ICMP "port unreachable"
+ # for everything else.
+ ip46tables -A nixos-fw-refuse -p tcp ! --syn -j REJECT --reject-with tcp-reset
+ ip46tables -A nixos-fw-refuse -j REJECT
+ '' else ''
+ ip46tables -A nixos-fw-refuse -j DROP
+ ''}
+
+
+ # The "nixos-fw-log-refuse" chain performs logging, then
+ # jumps to the "nixos-fw-refuse" chain.
+ ip46tables -N nixos-fw-log-refuse
+
+ ${optionalString cfg.logRefusedConnections ''
+ ip46tables -A nixos-fw-log-refuse -p tcp --syn -j LOG --log-level info --log-prefix "rejected connection: "
+ ''}
+ ${optionalString (cfg.logRefusedPackets && !cfg.logRefusedUnicastsOnly) ''
+ ip46tables -A nixos-fw-log-refuse -m pkttype --pkt-type broadcast \
+ -j LOG --log-level info --log-prefix "rejected broadcast: "
+ ip46tables -A nixos-fw-log-refuse -m pkttype --pkt-type multicast \
+ -j LOG --log-level info --log-prefix "rejected multicast: "
+ ''}
+ ip46tables -A nixos-fw-log-refuse -m pkttype ! --pkt-type unicast -j nixos-fw-refuse
+ ${optionalString cfg.logRefusedPackets ''
+ ip46tables -A nixos-fw-log-refuse \
+ -j LOG --log-level info --log-prefix "rejected packet: "
+ ''}
+ ip46tables -A nixos-fw-log-refuse -j nixos-fw-refuse
+
+
+ # The "nixos-fw" chain does the actual work.
+ ip46tables -N nixos-fw
+
+ # Perform a reverse-path test to refuse spoofers
+ # For now, we just drop, as the raw table doesn't have a log-refuse yet
+ ${optionalString (kernelHasRPFilter && cfg.checkReversePath) ''
+ if ! ip46tables -A PREROUTING -t raw -m rpfilter --invert -j DROP; then
+ echo "<2>failed to initialise rpfilter support" >&2
+ fi
+ ''}
+
+ # Accept all traffic on the trusted interfaces.
+ ${flip concatMapStrings cfg.trustedInterfaces (iface: ''
+ ip46tables -A nixos-fw -i ${iface} -j nixos-fw-accept
+ '')}
+
+ # Accept packets from established or related connections.
+ ip46tables -A nixos-fw -m conntrack --ctstate ESTABLISHED,RELATED -j nixos-fw-accept
+
+ # Accept connections to the allowed TCP ports.
+ ${concatMapStrings (port:
+ ''
+ ip46tables -A nixos-fw -p tcp --dport ${toString port} -j nixos-fw-accept
+ ''
+ ) cfg.allowedTCPPorts
+ }
+
+ # Accept connections to the allowed TCP port ranges.
+ ${concatMapStrings (rangeAttr:
+ let range = toString rangeAttr.from + ":" + toString rangeAttr.to; in
+ ''
+ ip46tables -A nixos-fw -p tcp --dport ${range} -j nixos-fw-accept
+ ''
+ ) cfg.allowedTCPPortRanges
+ }
+
+ # Accept packets on the allowed UDP ports.
+ ${concatMapStrings (port:
+ ''
+ ip46tables -A nixos-fw -p udp --dport ${toString port} -j nixos-fw-accept
+ ''
+ ) cfg.allowedUDPPorts
+ }
+
+ # Accept packets on the allowed UDP port ranges.
+ ${concatMapStrings (rangeAttr:
+ let range = toString rangeAttr.from + ":" + toString rangeAttr.to; in
+ ''
+ ip46tables -A nixos-fw -p udp --dport ${range} -j nixos-fw-accept
+ ''
+ ) cfg.allowedUDPPortRanges
+ }
+
+ # Accept IPv4 multicast. Not a big security risk since
+ # probably nobody is listening anyway.
+ #iptables -A nixos-fw -d 224.0.0.0/4 -j nixos-fw-accept
+
+ # Optionally respond to ICMPv4 pings.
+ ${optionalString cfg.allowPing ''
+ iptables -w -A nixos-fw -p icmp --icmp-type echo-request ${optionalString (cfg.pingLimit != null)
+ "-m limit ${cfg.pingLimit} "
+ }-j nixos-fw-accept
+ ''}
+
+ # Accept all ICMPv6 messages except redirects and node
+ # information queries (type 139). See RFC 4890, section
+ # 4.4.
+ ${optionalString config.networking.enableIPv6 ''
+ ip6tables -A nixos-fw -p icmpv6 --icmpv6-type redirect -j DROP
+ ip6tables -A nixos-fw -p icmpv6 --icmpv6-type 139 -j DROP
+ ip6tables -A nixos-fw -p icmpv6 -j nixos-fw-accept
+ ''}
+
+ ${cfg.extraCommands}
+
+ # Reject/drop everything else.
+ ip46tables -A nixos-fw -j nixos-fw-log-refuse
+
+
+ # Enable the firewall.
+ ip46tables -A INPUT -j nixos-fw
+ '';
+
+ stopScript = writeShScript "firewall-stop" ''
+ ${helpers}
+
+ # Clean up in case reload fails
+ ip46tables -D INPUT -j nixos-drop 2>/dev/null || true
+
+ # Clean up after added ruleset
+ ip46tables -D INPUT -j nixos-fw 2>/dev/null || true
+
+ ${cfg.extraStopCommands}
+ '';
+
+ reloadScript = writeShScript "firewall-reload" ''
+ ${helpers}
+
+ # Create a unique drop rule
+ ip46tables -D INPUT -j nixos-drop 2>/dev/null || true
+ ip46tables -F nixos-drop 2>/dev/null || true
+ ip46tables -X nixos-drop 2>/dev/null || true
+ ip46tables -N nixos-drop
+ ip46tables -A nixos-drop -j DROP
+
+ # Don't allow traffic to leak out until the script has completed
+ ip46tables -A INPUT -j nixos-drop
+ if ${startScript}; then
+ ip46tables -D INPUT -j nixos-drop 2>/dev/null || true
+ else
+ echo "Failed to reload firewall... Stopping"
+ ${stopScript}
+ exit 1
+ fi
+ '';
+
kernelPackages = config.boot.kernelPackages;
kernelHasRPFilter = kernelPackages.kernel.features.netfilterRPFilter or false;
@@ -240,6 +414,18 @@ in
'';
};
+ networking.firewall.extraStopCommands = mkOption {
+ type = types.lines;
+ default = "";
+ example = "iptables -P INPUT ACCEPT";
+ description =
+ ''
+ Additional shell commands executed as part of the firewall
+ shutdown script. These are executed just after the removal
+ of the nixos input rule, or if the service enters a failed state.
+ '';
+ };
+
};
@@ -264,166 +450,28 @@ in
message = "This kernel does not support disabling conntrack helpers"; }
];
- systemd.services.firewall =
- { description = "Firewall";
+ systemd.services.firewall = {
+ description = "Firewall";
+ wantedBy = [ "network.target" ];
+ after = [ "network-interfaces.target" "systemd-modules-load.service" ];
- wantedBy = [ "network.target" ];
- after = [ "network-interfaces.target" "systemd-modules-load.service" ];
+ path = [ pkgs.iptables ];
- path = [ pkgs.iptables ];
+ # 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";
- # 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";
+ reloadIfChanged = true;
- serviceConfig.Type = "oneshot";
- serviceConfig.RemainAfterExit = true;
-
- script =
- ''
- ${helpers}
-
- # Flush the old firewall rules. !!! Ideally, updating the
- # firewall would be atomic. Apparently that's possible
- # with iptables-restore.
- ip46tables -D INPUT -j nixos-fw 2> /dev/null || true
- for chain in nixos-fw nixos-fw-accept nixos-fw-log-refuse nixos-fw-refuse FW_REFUSE; do
- ip46tables -F "$chain" 2> /dev/null || true
- ip46tables -X "$chain" 2> /dev/null || true
- done
-
-
- # The "nixos-fw-accept" chain just accepts packets.
- ip46tables -N nixos-fw-accept
- ip46tables -A nixos-fw-accept -j ACCEPT
-
-
- # The "nixos-fw-refuse" chain rejects or drops packets.
- ip46tables -N nixos-fw-refuse
-
- ${if cfg.rejectPackets then ''
- # Send a reset for existing TCP connections that we've
- # somehow forgotten about. Send ICMP "port unreachable"
- # for everything else.
- ip46tables -A nixos-fw-refuse -p tcp ! --syn -j REJECT --reject-with tcp-reset
- ip46tables -A nixos-fw-refuse -j REJECT
- '' else ''
- ip46tables -A nixos-fw-refuse -j DROP
- ''}
-
-
- # The "nixos-fw-log-refuse" chain performs logging, then
- # jumps to the "nixos-fw-refuse" chain.
- ip46tables -N nixos-fw-log-refuse
-
- ${optionalString cfg.logRefusedConnections ''
- ip46tables -A nixos-fw-log-refuse -p tcp --syn -j LOG --log-level info --log-prefix "rejected connection: "
- ''}
- ${optionalString (cfg.logRefusedPackets && !cfg.logRefusedUnicastsOnly) ''
- ip46tables -A nixos-fw-log-refuse -m pkttype --pkt-type broadcast \
- -j LOG --log-level info --log-prefix "rejected broadcast: "
- ip46tables -A nixos-fw-log-refuse -m pkttype --pkt-type multicast \
- -j LOG --log-level info --log-prefix "rejected multicast: "
- ''}
- ip46tables -A nixos-fw-log-refuse -m pkttype ! --pkt-type unicast -j nixos-fw-refuse
- ${optionalString cfg.logRefusedPackets ''
- ip46tables -A nixos-fw-log-refuse \
- -j LOG --log-level info --log-prefix "rejected packet: "
- ''}
- ip46tables -A nixos-fw-log-refuse -j nixos-fw-refuse
-
-
- # The "nixos-fw" chain does the actual work.
- ip46tables -N nixos-fw
-
- # Perform a reverse-path test to refuse spoofers
- # For now, we just drop, as the raw table doesn't have a log-refuse yet
- ${optionalString (kernelHasRPFilter && cfg.checkReversePath) ''
- if ! ip46tables -A PREROUTING -t raw -m rpfilter --invert -j DROP; then
- echo "<2>failed to initialise rpfilter support" >&2
- fi
- ''}
-
- # Accept all traffic on the trusted interfaces.
- ${flip concatMapStrings cfg.trustedInterfaces (iface: ''
- ip46tables -A nixos-fw -i ${iface} -j nixos-fw-accept
- '')}
-
- # Accept packets from established or related connections.
- ip46tables -A nixos-fw -m conntrack --ctstate ESTABLISHED,RELATED -j nixos-fw-accept
-
- # Accept connections to the allowed TCP ports.
- ${concatMapStrings (port:
- ''
- ip46tables -A nixos-fw -p tcp --dport ${toString port} -j nixos-fw-accept
- ''
- ) cfg.allowedTCPPorts
- }
-
- # Accept connections to the allowed TCP port ranges.
- ${concatMapStrings (rangeAttr:
- let range = toString rangeAttr.from + ":" + toString rangeAttr.to; in
- ''
- ip46tables -A nixos-fw -p tcp --dport ${range} -j nixos-fw-accept
- ''
- ) cfg.allowedTCPPortRanges
- }
-
- # Accept packets on the allowed UDP ports.
- ${concatMapStrings (port:
- ''
- ip46tables -A nixos-fw -p udp --dport ${toString port} -j nixos-fw-accept
- ''
- ) cfg.allowedUDPPorts
- }
-
- # Accept packets on the allowed UDP port ranges.
- ${concatMapStrings (rangeAttr:
- let range = toString rangeAttr.from + ":" + toString rangeAttr.to; in
- ''
- ip46tables -A nixos-fw -p udp --dport ${range} -j nixos-fw-accept
- ''
- ) cfg.allowedUDPPortRanges
- }
-
- # Accept IPv4 multicast. Not a big security risk since
- # probably nobody is listening anyway.
- #iptables -A nixos-fw -d 224.0.0.0/4 -j nixos-fw-accept
-
- # Optionally respond to ICMPv4 pings.
- ${optionalString cfg.allowPing ''
- iptables -w -A nixos-fw -p icmp --icmp-type echo-request ${optionalString (cfg.pingLimit != null)
- "-m limit ${cfg.pingLimit} "
- }-j nixos-fw-accept
- ''}
-
- # Accept all ICMPv6 messages except redirects and node
- # information queries (type 139). See RFC 4890, section
- # 4.4.
- ${optionalString config.networking.enableIPv6 ''
- ip6tables -A nixos-fw -p icmpv6 --icmpv6-type redirect -j DROP
- ip6tables -A nixos-fw -p icmpv6 --icmpv6-type 139 -j DROP
- ip6tables -A nixos-fw -p icmpv6 -j nixos-fw-accept
- ''}
-
- ${cfg.extraCommands}
-
- # Reject/drop everything else.
- ip46tables -A nixos-fw -j nixos-fw-log-refuse
-
-
- # Enable the firewall.
- ip46tables -A INPUT -j nixos-fw
- '';
-
- postStop =
- ''
- ${helpers}
- ip46tables -D INPUT -j nixos-fw || true
- #ip46tables -P INPUT ACCEPT
- '';
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ ExecStart = "@${startScript} firewall-start";
+ ExecReload = "@${reloadScript} firewall-reload";
+ ExecStop = "@${stopScript} firewall-stop";
};
+ };
};
diff --git a/nixos/modules/services/networking/gvpe.nix b/nixos/modules/services/networking/gvpe.nix
index 594a2e80f34..c633ffedef4 100644
--- a/nixos/modules/services/networking/gvpe.nix
+++ b/nixos/modules/services/networking/gvpe.nix
@@ -1,9 +1,9 @@
# GNU Virtual Private Ethernet
-{config, pkgs, ...}:
+{config, pkgs, lib, ...}:
let
- inherit (pkgs.lib) mkOption mkIf;
+ inherit (lib) mkOption mkIf;
cfg = config.services.gvpe;
diff --git a/nixos/modules/services/networking/ircd-hybrid/builder.sh b/nixos/modules/services/networking/ircd-hybrid/builder.sh
index b8cb836db95..f2c92878a4d 100644
--- a/nixos/modules/services/networking/ircd-hybrid/builder.sh
+++ b/nixos/modules/services/networking/ircd-hybrid/builder.sh
@@ -3,7 +3,7 @@ source $stdenv/setup
doSub() {
local src=$1
local dst=$2
- ensureDir $(dirname $dst)
+ mkdir -p $(dirname $dst)
substituteAll $src $dst
}
@@ -28,4 +28,4 @@ for i in $substFiles; do
fi
done
-ensureDir $out/bin
+mkdir -p $out/bin
diff --git a/nixos/modules/services/networking/ircd-hybrid/default.nix b/nixos/modules/services/networking/ircd-hybrid/default.nix
index a3d5b71740f..2c397f94d23 100644
--- a/nixos/modules/services/networking/ircd-hybrid/default.nix
+++ b/nixos/modules/services/networking/ircd-hybrid/default.nix
@@ -66,7 +66,7 @@ in
rsaKey = mkOption {
default = null;
- example = /root/certificates/irc.key;
+ example = literalExample "/root/certificates/irc.key";
description = "
IRCD server RSA key.
";
@@ -74,7 +74,7 @@ in
certificate = mkOption {
default = null;
- example = /root/certificates/irc.pem;
+ example = literalExample "/root/certificates/irc.pem";
description = "
IRCD server SSL certificate. There are some limitations - read manual.
";
diff --git a/nixos/modules/services/networking/mailpile.nix b/nixos/modules/services/networking/mailpile.nix
new file mode 100644
index 00000000000..e164d41483c
--- /dev/null
+++ b/nixos/modules/services/networking/mailpile.nix
@@ -0,0 +1,76 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.mailpile;
+
+ hostname = cfg.hostname;
+ port = cfg.port;
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.mailpile = {
+ enable = mkOption {
+ default = false;
+ description = "
+ Whether to enable Mailpile the mail client.
+ ";
+ };
+ hostname = mkOption {
+ default = "localhost";
+ description = "Listen to this hostname or ip.";
+ };
+ port = mkOption {
+ default = "33411";
+ description = "Listen on this port.";
+ };
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.mailpile.enable {
+
+ users.extraUsers.mailpile =
+ { uid = config.ids.uids.mailpile;
+ description = "Mailpile user";
+ createHome = true;
+ home = "/var/lib/mailpile";
+ };
+
+ users.extraGroups.mailpile =
+ { gid = config.ids.gids.mailpile;
+ };
+
+ systemd.services.mailpile =
+ {
+ description = "Mailpile server.";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ User = "mailpile";
+ ExecStart = "${pkgs.mailpile}/bin/mailpile --www ${hostname}:${port} --wait";
+ # mixed - first send SIGINT to main process,
+ # then after 2min send SIGKILL to whole group if neccessary
+ KillMode = "mixed";
+ KillSignal = "SIGINT"; # like Ctrl+C - safe mailpile shutdown
+ TimeoutSec = 120; # wait 2min untill SIGKILL
+ };
+ environment.MAILPILE_HOME = "/var/lib/mailpile/.local/share/Mailpile";
+ };
+
+ environment.systemPackages = [ pkgs.mailpile ];
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix
index e8d9d00cc0a..9d163e60d5e 100644
--- a/nixos/modules/services/networking/nat.nix
+++ b/nixos/modules/services/networking/nat.nix
@@ -12,6 +12,52 @@ let
dest = if cfg.externalIP == null then "-j MASQUERADE" else "-j SNAT --to-source ${cfg.externalIP}";
+ flushNat = ''
+ iptables -w -t nat -D PREROUTING -j nixos-nat-pre 2>/dev/null|| true
+ iptables -w -t nat -F nixos-nat-pre 2>/dev/null || true
+ iptables -w -t nat -X nixos-nat-pre 2>/dev/null || true
+ iptables -w -t nat -D POSTROUTING -j nixos-nat-post 2>/dev/null || true
+ iptables -w -t nat -F nixos-nat-post 2>/dev/null || true
+ iptables -w -t nat -X nixos-nat-post 2>/dev/null || true
+ '';
+
+ setupNat = ''
+ # Create subchain where we store rules
+ iptables -w -t nat -N nixos-nat-pre
+ iptables -w -t nat -N nixos-nat-post
+
+ # We can't match on incoming interface in POSTROUTING, so
+ # mark packets coming from the external interfaces.
+ ${concatMapStrings (iface: ''
+ iptables -w -t nat -A nixos-nat-pre \
+ -i '${iface}' -j MARK --set-mark 1
+ '') cfg.internalInterfaces}
+
+ # NAT the marked packets.
+ ${optionalString (cfg.internalInterfaces != []) ''
+ iptables -w -t nat -A nixos-nat-post -m mark --mark 1 \
+ -o ${cfg.externalInterface} ${dest}
+ ''}
+
+ # NAT packets coming from the internal IPs.
+ ${concatMapStrings (range: ''
+ iptables -w -t nat -A nixos-nat-post \
+ -s '${range}' -o ${cfg.externalInterface} ${dest}
+ '') cfg.internalIPs}
+
+ # NAT from external ports to internal ports.
+ ${concatMapStrings (fwd: ''
+ iptables -w -t nat -A nixos-nat-pre \
+ -i ${cfg.externalInterface} -p tcp \
+ --dport ${builtins.toString fwd.sourcePort} \
+ -j DNAT --to-destination ${fwd.destination}
+ '') cfg.forwardPorts}
+
+ # Append our chains to the nat tables
+ iptables -w -t nat -A PREROUTING -j nixos-nat-pre
+ iptables -w -t nat -A POSTROUTING -j nixos-nat-post
+ '';
+
in
{
@@ -75,6 +121,31 @@ in
'';
};
+ networking.nat.forwardPorts = mkOption {
+ type = types.listOf types.optionSet;
+ default = [];
+ example = [ { sourcePort = 8080; destination = "10.0.0.1:80"; } ];
+ options = {
+ sourcePort = mkOption {
+ type = types.int;
+ example = 8080;
+ description = "Source port of the external interface";
+ };
+
+ destination = mkOption {
+ type = types.str;
+ example = "10.0.0.1:80";
+ description = "Forward tcp connection to destination ip:port";
+ };
+ };
+
+ description =
+ ''
+ List of forwarded ports from the external interface to
+ internal destinations by using DNAT.
+ '';
+ };
+
};
@@ -84,49 +155,34 @@ in
environment.systemPackages = [ pkgs.iptables ];
- boot.kernelModules = [ "nf_nat_ftp" ];
-
- jobs.nat =
- { description = "Network Address Translation";
-
- startOn = "started network-interfaces";
-
- path = [ pkgs.iptables ];
-
- preStart =
- ''
- iptables -w -t nat -F PREROUTING
- iptables -w -t nat -F POSTROUTING
- iptables -w -t nat -X
-
- # We can't match on incoming interface in POSTROUTING, so
- # mark packets coming from the external interfaces.
- ${concatMapStrings (iface: ''
- iptables -w -t nat -A PREROUTING \
- -i '${iface}' -j MARK --set-mark 1
- '') cfg.internalInterfaces}
-
- # NAT the marked packets.
- ${optionalString (cfg.internalInterfaces != []) ''
- iptables -w -t nat -A POSTROUTING -m mark --mark 1 \
- -o ${cfg.externalInterface} ${dest}
- ''}
-
- # NAT packets coming from the internal IPs.
- ${concatMapStrings (range: ''
- iptables -w -t nat -A POSTROUTING \
- -s '${range}' -o ${cfg.externalInterface} ${dest}
- '') cfg.internalIPs}
-
- echo 1 > /proc/sys/net/ipv4/ip_forward
- '';
-
- postStop =
- ''
- iptables -w -t nat -F PREROUTING
- iptables -w -t nat -F POSTROUTING
- iptables -w -t nat -X
- '';
+ boot = {
+ kernelModules = [ "nf_nat_ftp" ];
+ kernel.sysctl = {
+ "net.ipv4.conf.all.forwarding" = mkOverride 99 true;
+ "net.ipv4.conf.default.forwarding" = mkOverride 99 true;
};
+ };
+
+ networking.firewall = mkIf config.networking.firewall.enable {
+ extraCommands = mkMerge [ (mkBefore flushNat) setupNat ];
+ extraStopCommands = flushNat;
+ };
+
+ systemd.services = mkIf (!config.networking.firewall.enable) { nat = {
+ description = "Network Address Translation";
+ wantedBy = [ "network.target" ];
+ after = [ "network-interfaces.target" "systemd-modules-load.service" ];
+ path = [ pkgs.iptables ];
+ unitConfig.ConditionCapability = "CAP_NET_ADMIN";
+
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ };
+
+ script = flushNat + setupNat;
+
+ postStop = flushNat;
+ }; };
};
}
diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index 54bdf19373d..bc1c95d3fd3 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
-with lib;
with pkgs;
+with lib;
let
cfg = config.networking.networkmanager;
@@ -151,7 +151,7 @@ in {
{ source = "${networkmanager_pptp}/etc/NetworkManager/VPN/nm-pptp-service.name";
target = "NetworkManager/VPN/nm-pptp-service.name";
}
- ] ++ pkgs.lib.optional (cfg.appendNameservers == [] || cfg.insertNameservers == [])
+ ] ++ optional (cfg.appendNameservers == [] || cfg.insertNameservers == [])
{ source = overrideNameserversScript;
target = "NetworkManager/dispatcher.d/02overridedns";
};
diff --git a/nixos/modules/services/networking/notbit.nix b/nixos/modules/services/networking/notbit.nix
index 3e8c956f191..2e1412ff7c8 100644
--- a/nixos/modules/services/networking/notbit.nix
+++ b/nixos/modules/services/networking/notbit.nix
@@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.notbit;
varDir = "/var/lib/notbit";
diff --git a/nixos/modules/services/networking/nsd.nix b/nixos/modules/services/networking/nsd.nix
index adfee1caec5..140b7ed2da3 100644
--- a/nixos/modules/services/networking/nsd.nix
+++ b/nixos/modules/services/networking/nsd.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
-with pkgs.lib;
+with lib;
let
cfg = config.services.nsd;
@@ -10,16 +10,16 @@ let
pidFile = stateDir + "/var/nsd.pid";
zoneFiles = pkgs.stdenv.mkDerivation {
- preferLocalBuild = true;
- name = "nsd-env";
- buildCommand = concatStringsSep "\n"
- [ "mkdir -p $out"
- (concatStrings (mapAttrsToList (zoneName: zoneOptions: ''
- cat > "$out/${zoneName}" <<_EOF_
- ${zoneOptions.data}
- _EOF_
- '') zoneConfigs))
- ];
+ preferLocalBuild = true;
+ name = "nsd-env";
+ buildCommand = concatStringsSep "\n"
+ [ "mkdir -p $out"
+ (concatStrings (mapAttrsToList (zoneName: zoneOptions: ''
+ cat > "$out/${zoneName}" <<_EOF_
+ ${zoneOptions.data}
+ _EOF_
+ '') zoneConfigs))
+ ];
};
configFile = pkgs.writeText "nsd.conf" ''
@@ -33,7 +33,6 @@ let
# the list of dynamically added zones.
zonelistfile: "${stateDir}/var/zone.list"
database: "${stateDir}/var/nsd.db"
- logfile: "${stateDir}/var/nsd.log"
pidfile: "${pidFile}"
xfrdfile: "${stateDir}/var/xfrd.state"
xfrdir: "${stateDir}/tmp"
@@ -105,21 +104,20 @@ let
zoneConfigFile = name: zone: ''
- zone:
- name: "${name}"
- zonefile: "${stateDir}/zones/${name}"
- ${maybeString "outgoing-interface: " zone.outgoingInterface}
- ${forEach " rrl-whitelist: " zone.rrlWhitelist}
+ zone:
+ name: "${name}"
+ zonefile: "${stateDir}/zones/${name}"
+ ${maybeString "outgoing-interface: " zone.outgoingInterface}
+ ${forEach " rrl-whitelist: " zone.rrlWhitelist}
- ${forEach " allow-notify: " zone.allowNotify}
- ${forEach " request-xfr: " zone.requestXFR}
- allow-axfr-fallback: ${yesOrNo zone.allowAXFRFallback}
+ ${forEach " allow-notify: " zone.allowNotify}
+ ${forEach " request-xfr: " zone.requestXFR}
+ allow-axfr-fallback: ${yesOrNo zone.allowAXFRFallback}
- ${forEach " notify: " zone.notify}
- notify-retry: ${toString zone.notifyRetry}
- ${forEach " provide-xfr: " zone.provideXFR}
-
- '';
+ ${forEach " notify: " zone.notify}
+ notify-retry: ${toString zone.notifyRetry}
+ ${forEach " provide-xfr: " zone.provideXFR}
+ '';
zoneConfigs = zoneConfigs' {} "" { children = cfg.zones; };
@@ -130,8 +128,8 @@ let
# fork -> pattern
else zipAttrsWith (name: head) (
- mapAttrsToList (name: child: zoneConfigs' (parent // zone // { children = {}; }) name child)
- zone.children
+ mapAttrsToList (name: child: zoneConfigs' (parent // zone // { children = {}; }) name child)
+ zone.children
);
# fighting infinite recursion
@@ -145,138 +143,135 @@ let
childConfig = x: v: { options.children = { type = types.attrsOf x; visible = v; }; };
- zoneOptionsRaw = types.submodule (
- { options, ... }:
- { options = {
- children = mkOption {
- default = {};
- description = ''
- Children zones inherit all options of their parents. Attributes
- defined in a child will overwrite the ones of its parent. Only
- leaf zones will be actually served. This way it's possible to
- define maybe zones which share most attributes without
- duplicating everything. This mechanism replaces nsd's patterns
- in a save and functional way.
- '';
- };
-
- allowNotify = mkOption {
- type = types.listOf types.str;
- default = [ ];
- example = [ "192.0.2.0/24 NOKEY" "10.0.0.1-10.0.0.5 my_tsig_key_name"
- "10.0.3.4&255.255.0.0 BLOCKED"
- ];
- description = ''
- Listed primary servers are allowed to notify this secondary server.
-
-
- either a plain IPv4/IPv6 address or range. Valid patters for ranges:
- * 10.0.0.0/24 # via subnet size
- * 10.0.0.0&255.255.255.0 # via subnet mask
- * 10.0.0.1-10.0.0.254 # via range
-
- A optional port number could be added with a '@':
- * 2001:1234::1@1234
-
-
- * will use the specified TSIG key
- * NOKEY no TSIG signature is required
- * BLOCKED notifies from non-listed or blocked IPs will be ignored
- * ]]>
- '';
- };
-
- requestXFR = mkOption {
- type = types.listOf types.str;
- default = [];
- example = [];
- description = ''
- Format: [AXFR|UDP] <ip-address> <key-name | NOKEY>
- '';
- };
-
- allowAXFRFallback = mkOption {
- type = types.bool;
- default = true;
- description = ''
- If NSD as secondary server should be allowed to AXFR if the primary
- server does not allow IXFR.
- '';
- };
-
- notify = mkOption {
- type = types.listOf types.str;
- default = [];
- example = [ "10.0.0.1@3721 my_key" "::5 NOKEY" ];
- description = ''
- This primary server will notify all given secondary servers about
- zone changes.
-
-
- a plain IPv4/IPv6 address with on optional port number (ip@port)
-
-
- * sign notifies with the specified key
- * NOKEY don't sign notifies
- ]]>
- '';
- };
-
- notifyRetry = mkOption {
- type = types.int;
- default = 5;
- description = ''
- Specifies the number of retries for failed notifies. Set this along with notify.
- '';
- };
-
- provideXFR = mkOption {
- type = types.listOf types.str;
- default = [];
- example = [ "192.0.2.0/24 NOKEY" "192.0.2.0/24 my_tsig_key_name" ];
- description = ''
- Allow these IPs and TSIG to transfer zones, addr TSIG|NOKEY|BLOCKED
- address range 192.0.2.0/24, 1.2.3.4&255.255.0.0, 3.0.2.20-3.0.2.40
- '';
- };
-
- outgoingInterface = mkOption {
- type = types.nullOr types.str;
- default = null;
- example = "2000::1@1234";
- description = ''
- This address will be used for zone-transfere requests if configured
- as a secondary server or notifications in case of a primary server.
- Supply either a plain IPv4 or IPv6 address with an optional port
- number (ip@port).
- '';
- };
-
- rrlWhitelist = mkOption {
- type = types.listOf types.str;
- default = [];
- description = ''
- Whitelists the given rrl-types.
- The RRL classification types are: nxdomain, error, referral, any,
- rrsig, wildcard, nodata, dnskey, positive, all
- '';
- };
-
- data = mkOption {
- type = types.str;
- default = "";
- example = "";
- description = ''
- The actual zone data. This is the content of your zone file.
- Use imports or pkgs.lib.readFile if you don't want this data in your config file.
- '';
- };
-
+ zoneOptionsRaw = types.submodule {
+ options = {
+ children = mkOption {
+ default = {};
+ description = ''
+ Children zones inherit all options of their parents. Attributes
+ defined in a child will overwrite the ones of its parent. Only
+ leaf zones will be actually served. This way it's possible to
+ define maybe zones which share most attributes without
+ duplicating everything. This mechanism replaces nsd's patterns
+ in a save and functional way.
+ '';
};
- }
- );
+
+ allowNotify = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "192.0.2.0/24 NOKEY" "10.0.0.1-10.0.0.5 my_tsig_key_name"
+ "10.0.3.4&255.255.0.0 BLOCKED"
+ ];
+ description = ''
+ Listed primary servers are allowed to notify this secondary server.
+
+
+ either a plain IPv4/IPv6 address or range. Valid patters for ranges:
+ * 10.0.0.0/24 # via subnet size
+ * 10.0.0.0&255.255.255.0 # via subnet mask
+ * 10.0.0.1-10.0.0.254 # via range
+
+ A optional port number could be added with a '@':
+ * 2001:1234::1@1234
+
+
+ * will use the specified TSIG key
+ * NOKEY no TSIG signature is required
+ * BLOCKED notifies from non-listed or blocked IPs will be ignored
+ * ]]>
+ '';
+ };
+
+ requestXFR = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [];
+ description = ''
+ Format: [AXFR|UDP] <ip-address> <key-name | NOKEY>
+ '';
+ };
+
+ allowAXFRFallback = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ If NSD as secondary server should be allowed to AXFR if the primary
+ server does not allow IXFR.
+ '';
+ };
+
+ notify = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "10.0.0.1@3721 my_key" "::5 NOKEY" ];
+ description = ''
+ This primary server will notify all given secondary servers about
+ zone changes.
+
+
+ a plain IPv4/IPv6 address with on optional port number (ip@port)
+
+
+ * sign notifies with the specified key
+ * NOKEY don't sign notifies
+ ]]>
+ '';
+ };
+
+ notifyRetry = mkOption {
+ type = types.int;
+ default = 5;
+ description = ''
+ Specifies the number of retries for failed notifies. Set this along with notify.
+ '';
+ };
+
+ provideXFR = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ example = [ "192.0.2.0/24 NOKEY" "192.0.2.0/24 my_tsig_key_name" ];
+ description = ''
+ Allow these IPs and TSIG to transfer zones, addr TSIG|NOKEY|BLOCKED
+ address range 192.0.2.0/24, 1.2.3.4&255.255.0.0, 3.0.2.20-3.0.2.40
+ '';
+ };
+
+ outgoingInterface = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "2000::1@1234";
+ description = ''
+ This address will be used for zone-transfere requests if configured
+ as a secondary server or notifications in case of a primary server.
+ Supply either a plain IPv4 or IPv6 address with an optional port
+ number (ip@port).
+ '';
+ };
+
+ rrlWhitelist = mkOption {
+ type = types.listOf types.str;
+ default = [];
+ description = ''
+ Whitelists the given rrl-types.
+ The RRL classification types are: nxdomain, error, referral, any,
+ rrsig, wildcard, nodata, dnskey, positive, all
+ '';
+ };
+
+ data = mkOption {
+ type = types.str;
+ default = "";
+ example = "";
+ description = ''
+ The actual zone data. This is the content of your zone file.
+ Use imports or pkgs.lib.readFile if you don't want this data in your config file.
+ '';
+ };
+ };
+ };
in
{
@@ -456,191 +451,162 @@ in
};
- ratelimit = mkOption {
- type = types.submodule (
- { options, ... }:
- { options = {
-
- enable = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Enable ratelimit capabilities.
- '';
- };
-
- size = mkOption {
- type = types.int;
- default = 1000000;
- description = ''
- Size of the hashtable. More buckets use more memory but lower
- the chance of hash hash collisions.
- '';
- };
-
- ratelimit = mkOption {
- type = types.int;
- default = 200;
- description = ''
- Max qps allowed from any query source.
- 0 means unlimited. With an verbosity of 2 blocked and
- unblocked subnets will be logged.
- '';
- };
-
- whitelistRatelimit = mkOption {
- type = types.int;
- default = 2000;
- description = ''
- Max qps allowed from whitelisted sources.
- 0 means unlimited. Set the rrl-whitelist option for specific
- queries to apply this limit instead of the default to them.
- '';
- };
-
- slip = mkOption {
- type = types.nullOr types.int;
- default = null;
- description = ''
- Number of packets that get discarded before replying a SLIP response.
- 0 disables SLIP responses. 1 will make every response a SLIP response.
- '';
- };
-
- ipv4PrefixLength = mkOption {
- type = types.nullOr types.int;
- default = null;
- description = ''
- IPv4 prefix length. Addresses are grouped by netblock.
- '';
- };
-
- ipv6PrefixLength = mkOption {
- type = types.nullOr types.int;
- default = null;
- description = ''
- IPv6 prefix length. Addresses are grouped by netblock.
- '';
- };
-
- };
- });
- default = {
+ ratelimit = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable ratelimit capabilities.
+ '';
+ };
+
+ size = mkOption {
+ type = types.int;
+ default = 1000000;
+ description = ''
+ Size of the hashtable. More buckets use more memory but lower
+ the chance of hash hash collisions.
+ '';
+ };
+
+ ratelimit = mkOption {
+ type = types.int;
+ default = 200;
+ description = ''
+ Max qps allowed from any query source.
+ 0 means unlimited. With an verbosity of 2 blocked and
+ unblocked subnets will be logged.
+ '';
+ };
+
+ whitelistRatelimit = mkOption {
+ type = types.int;
+ default = 2000;
+ description = ''
+ Max qps allowed from whitelisted sources.
+ 0 means unlimited. Set the rrl-whitelist option for specific
+ queries to apply this limit instead of the default to them.
+ '';
+ };
+
+ slip = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ Number of packets that get discarded before replying a SLIP response.
+ 0 disables SLIP responses. 1 will make every response a SLIP response.
+ '';
+ };
+
+ ipv4PrefixLength = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ IPv4 prefix length. Addresses are grouped by netblock.
+ '';
+ };
+
+ ipv6PrefixLength = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ IPv6 prefix length. Addresses are grouped by netblock.
+ '';
};
- example = {};
- description = ''
- '';
};
- remoteControl = mkOption {
- type = types.submodule (
- { config, options, ... }:
- { options = {
-
- enable = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Wheter to enable remote control via nsd-control(8).
- '';
- };
-
- interfaces = mkOption {
- type = types.listOf types.str;
- default = [ "127.0.0.1" "::1" ];
- description = ''
- Which interfaces NSD should bind to for remote control.
- '';
- };
-
- port = mkOption {
- type = types.int;
- default = 8952;
- description = ''
- Port number for remote control operations (uses TLS over TCP).
- '';
- };
-
- serverKeyFile = mkOption {
- type = types.path;
- default = "/etc/nsd/nsd_server.key";
- description = ''
- Path to the server private key, which is used by the server
- but not by nsd-control. This file is generated by nsd-control-setup.
- '';
- };
-
- serverCertFile = mkOption {
- type = types.path;
- default = "/etc/nsd/nsd_server.pem";
- description = ''
- Path to the server self signed certificate, which is used by the server
- but and by nsd-control. This file is generated by nsd-control-setup.
- '';
- };
-
- controlKeyFile = mkOption {
- type = types.path;
- default = "/etc/nsd/nsd_control.key";
- description = ''
- Path to the client private key, which is used by nsd-control
- but not by the server. This file is generated by nsd-control-setup.
- '';
- };
-
- controlCertFile = mkOption {
- type = types.path;
- default = "/etc/nsd/nsd_control.pem";
- description = ''
- Path to the client certificate signed with the server certificate.
- This file is used by nsd-control and generated by nsd-control-setup.
- '';
- };
-
- };
-
- });
- default = {
+ remoteControl = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Wheter to enable remote control via nsd-control(8).
+ '';
+ };
+
+ interfaces = mkOption {
+ type = types.listOf types.str;
+ default = [ "127.0.0.1" "::1" ];
+ description = ''
+ Which interfaces NSD should bind to for remote control.
+ '';
+ };
+
+ port = mkOption {
+ type = types.int;
+ default = 8952;
+ description = ''
+ Port number for remote control operations (uses TLS over TCP).
+ '';
+ };
+
+ serverKeyFile = mkOption {
+ type = types.path;
+ default = "/etc/nsd/nsd_server.key";
+ description = ''
+ Path to the server private key, which is used by the server
+ but not by nsd-control. This file is generated by nsd-control-setup.
+ '';
+ };
+
+ serverCertFile = mkOption {
+ type = types.path;
+ default = "/etc/nsd/nsd_server.pem";
+ description = ''
+ Path to the server self signed certificate, which is used by the server
+ but and by nsd-control. This file is generated by nsd-control-setup.
+ '';
+ };
+
+ controlKeyFile = mkOption {
+ type = types.path;
+ default = "/etc/nsd/nsd_control.key";
+ description = ''
+ Path to the client private key, which is used by nsd-control
+ but not by the server. This file is generated by nsd-control-setup.
+ '';
+ };
+
+ controlCertFile = mkOption {
+ type = types.path;
+ default = "/etc/nsd/nsd_control.pem";
+ description = ''
+ Path to the client certificate signed with the server certificate.
+ This file is used by nsd-control and generated by nsd-control-setup.
+ '';
};
- example = {};
- description = ''
- '';
};
keys = mkOption {
- type = types.attrsOf (types.submodule (
- { options, ... }:
- { options = {
-
- algorithm = mkOption {
- type = types.str;
- default = "hmac-sha256";
- description = ''
- Authentication algorithm for this key.
- '';
- };
-
- keyFile = mkOption {
- type = types.path;
- description = ''
- Path to the file which contains the actual base64 encoded
- key. The key will be copied into "${stateDir}/private" before
- NSD starts. The copied file is only accessibly by the NSD
- user.
- '';
- };
-
+ type = types.attrsOf (types.submodule {
+ options = {
+ algorithm = mkOption {
+ type = types.str;
+ default = "hmac-sha256";
+ description = ''
+ Authentication algorithm for this key.
+ '';
};
- }));
- default = {
- };
+
+ keyFile = mkOption {
+ type = types.path;
+ description = ''
+ Path to the file which contains the actual base64 encoded
+ key. The key will be copied into "${stateDir}/private" before
+ NSD starts. The copied file is only accessibly by the NSD
+ user.
+ '';
+ };
+ };
+ });
+ default = {};
example = {
- "tsig.example.org" = {
- algorithm = "hmac-md5";
- secret = "aaaaaabbbbbbccccccdddddd";
- };
+ "tsig.example.org" = {
+ algorithm = "hmac-md5";
+ secret = "aaaaaabbbbbbccccccdddddd";
+ };
};
description = ''
Define your TSIG keys here.
@@ -651,32 +617,32 @@ in
type = types.attrsOf zoneOptions;
default = {};
example = {
- "serverGroup1" = {
- provideXFR = [ "10.1.2.3 NOKEY" ];
- children = {
- "example.com." = {
- data = ''
- $ORIGIN example.com.
- $TTL 86400
- @ IN SOA a.ns.example.com. admin.example.com. (
- ...
- '';
- };
- "example.org." = {
- data = ''
- $ORIGIN example.org.
- $TTL 86400
- @ IN SOA a.ns.example.com. admin.example.com. (
- ...
- '';
- };
- };
+ "serverGroup1" = {
+ provideXFR = [ "10.1.2.3 NOKEY" ];
+ children = {
+ "example.com." = {
+ data = ''
+ $ORIGIN example.com.
+ $TTL 86400
+ @ IN SOA a.ns.example.com. admin.example.com. (
+ ...
+ '';
+ };
+ "example.org." = {
+ data = ''
+ $ORIGIN example.org.
+ $TTL 86400
+ @ IN SOA a.ns.example.com. admin.example.com. (
+ ...
+ '';
+ };
};
+ };
- "example.net." = {
- provideXFR = [ "10.3.2.1 NOKEY" ];
- data = ''...'';
- };
+ "example.net." = {
+ provideXFR = [ "10.3.2.1 NOKEY" ];
+ data = ''...'';
+ };
};
description = ''
Define your zones here. Zones can cascade other zones and therefore
@@ -695,23 +661,23 @@ in
# this is not working :(
nixpkgs.config.nsd = {
- ipv6 = cfg.ipv6;
- ratelimit = cfg.ratelimit.enable;
- rootServer = cfg.rootServer;
+ ipv6 = cfg.ipv6;
+ ratelimit = cfg.ratelimit.enable;
+ rootServer = cfg.rootServer;
};
users.extraGroups = singleton {
- name = username;
- gid = config.ids.gids.nsd;
+ name = username;
+ gid = config.ids.gids.nsd;
};
users.extraUsers = singleton {
- name = username;
- description = "NSD service user";
- home = stateDir;
- createHome = true;
- uid = config.ids.uids.nsd;
- group = username;
+ name = username;
+ description = "NSD service user";
+ home = stateDir;
+ createHome = true;
+ uid = config.ids.uids.nsd;
+ group = username;
};
systemd.services.nsd = {
@@ -720,10 +686,9 @@ in
after = [ "network.target" ];
serviceConfig = {
- Type = "forking";
PIDFile = pidFile;
Restart = "always";
- ExecStart = "${pkgs.nsd}/sbin/nsd -c ${configFile}";
+ ExecStart = "${pkgs.nsd}/sbin/nsd -d -c ${configFile}";
};
preStart = ''
diff --git a/nixos/modules/services/networking/openntpd.nix b/nixos/modules/services/networking/openntpd.nix
new file mode 100644
index 00000000000..bd8a7a04a2a
--- /dev/null
+++ b/nixos/modules/services/networking/openntpd.nix
@@ -0,0 +1,49 @@
+{ pkgs, lib, config, options, ... }:
+
+with lib;
+
+let
+ cfg = config.services.openntpd;
+
+ package = pkgs.openntpd.override {
+ privsepUser = "ntp";
+ privsepPath = "/var/empty";
+ };
+
+ cfgFile = pkgs.writeText "openntpd.conf" ''
+ ${concatStringsSep "\n" (map (s: "server ${s}") cfg.servers)}
+ '';
+in
+{
+ ###### interface
+
+ options.services.openntpd = {
+ enable = mkEnableOption "OpenNTP time synchronization server";
+
+ servers = mkOption {
+ default = config.services.ntp.servers;
+ type = types.listOf types.str;
+ inherit (options.services.ntp.servers) description;
+ };
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+ services.ntp.enable = mkForce false;
+
+ users.extraUsers = singleton {
+ name = "ntp";
+ uid = config.ids.uids.ntp;
+ description = "OpenNTP daemon user";
+ home = "/var/empty";
+ };
+
+ systemd.services.openntpd = {
+ description = "OpenNTP Server";
+ wantedBy = [ "ip-up.target" ];
+ partOf = [ "ip-up.target" ];
+ serviceConfig.ExecStart = "${package}/sbin/ntpd -d -f ${cfgFile}";
+ };
+ };
+}
diff --git a/nixos/modules/services/networking/polipo.nix b/nixos/modules/services/networking/polipo.nix
new file mode 100644
index 00000000000..51179d9120f
--- /dev/null
+++ b/nixos/modules/services/networking/polipo.nix
@@ -0,0 +1,114 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.polipo;
+
+ polipoConfig = pkgs.writeText "polipo.conf" ''
+ proxyAddress = ${cfg.proxyAddress}
+ proxyPort = ${toString cfg.proxyPort}
+ allowedClients = ${concatStringsSep ", " cfg.allowedClients}
+ ${optionalString (cfg.parentProxy != "") "parentProxy = ${cfg.parentProxy}" }
+ ${optionalString (cfg.socksParentProxy != "") "socksParentProxy = ${cfg.socksParentProxy}" }
+ ${config.services.polipo.extraConfig}
+ '';
+
+in
+
+{
+
+ options = {
+
+ services.polipo = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to run the polipo caching web proxy.";
+ };
+
+ proxyAddress = mkOption {
+ type = types.string;
+ default = "127.0.0.1";
+ description = "IP address on which Polipo will listen.";
+ };
+
+ proxyPort = mkOption {
+ type = types.int;
+ default = 8123;
+ description = "TCP port on which Polipo will listen.";
+ };
+
+ allowedClients = mkOption {
+ type = types.listOf types.string;
+ default = [ "127.0.0.1" "::1" ];
+ example = [ "127.0.0.1" "::1" "134.157.168.0/24" "2001:660:116::/48" ];
+ description = ''
+ List of IP addresses or network addresses that may connect to Polipo.
+ '';
+ };
+
+ parentProxy = mkOption {
+ type = types.string;
+ default = "";
+ example = "localhost:8124";
+ description = ''
+ Hostname and port number of an HTTP parent proxy;
+ it should have the form ‘host:port’.
+ '';
+ };
+
+ socksParentProxy = mkOption {
+ type = types.string;
+ default = "";
+ example = "localhost:9050";
+ description = ''
+ Hostname and port number of an SOCKS parent proxy;
+ it should have the form ‘host:port’.
+ '';
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Polio configuration. Contents will be added
+ verbatim to the configuration file.
+ '';
+ };
+
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers = singleton
+ { name = "polipo";
+ uid = config.ids.uids.polipo;
+ description = "Polipo caching proxy user";
+ home = "/var/cache/polipo";
+ createHome = true;
+ };
+
+ users.extraGroups = singleton
+ { name = "polipo";
+ gid = config.ids.gids.polipo;
+ members = [ "polipo" ];
+ };
+
+ systemd.services.polipo = {
+ description = "caching web proxy";
+ after = [ "network.target" "nss-lookup.target" ];
+ wantedBy = [ "multi-user.target"];
+ serviceConfig = {
+ ExecStart = "${pkgs.polipo}/bin/polipo -c ${polipoConfig}";
+ User = "polipo";
+ };
+ };
+
+ };
+
+}
\ No newline at end of file
diff --git a/nixos/modules/services/networking/privoxy.nix b/nixos/modules/services/networking/privoxy.nix
index 950112b2dab..94beb78ef5a 100644
--- a/nixos/modules/services/networking/privoxy.nix
+++ b/nixos/modules/services/networking/privoxy.nix
@@ -6,19 +6,18 @@ let
inherit (pkgs) privoxy;
- stateDir = "/var/spool/privoxy";
-
privoxyUser = "privoxy";
- privoxyFlags = "--no-daemon --user ${privoxyUser} ${privoxyCfg}";
+ cfg = config.services.privoxy;
- privoxyCfg = pkgs.writeText "privoxy.conf" ''
- listen-address ${config.services.privoxy.listenAddress}
- logdir ${config.services.privoxy.logDir}
- confdir ${privoxy}/etc
- filterfile default.filter
-
- ${config.services.privoxy.extraConfig}
+ confFile = pkgs.writeText "privoxy.conf" ''
+ user-manual ${privoxy}/share/doc/privoxy/user-manual
+ confdir ${privoxy}/etc/
+ listen-address ${cfg.listenAddress}
+ enable-edit-actions ${if (cfg.enableEditActions == true) then "1" else "0"}
+ ${concatMapStrings (f: "actionsfile ${f}\n") cfg.actionsFiles}
+ ${concatMapStrings (f: "filterfile ${f}\n") cfg.filterFiles}
+ ${cfg.extraConfig}
'';
in
@@ -32,27 +31,51 @@ in
services.privoxy = {
enable = mkOption {
+ type = types.bool;
default = false;
description = ''
- Whether to run the machine as a HTTP proxy server.
+ Whether to enable the Privoxy non-caching filtering proxy.
'';
};
listenAddress = mkOption {
+ type = types.str;
default = "127.0.0.1:8118";
description = ''
Address the proxy server is listening to.
'';
};
- logDir = mkOption {
- default = "/var/log/privoxy" ;
+ actionsFiles = mkOption {
+ type = types.listOf types.str;
+ example = [ "match-all.action" "default.action" "/etc/privoxy/user.action" ];
+ default = [ "match-all.action" "default.action" ];
description = ''
- Location for privoxy log files.
+ List of paths to Privoxy action files.
+ These paths may either be absolute or relative to the privoxy configuration directory.
+ '';
+ };
+
+ filterFiles = mkOption {
+ type = types.listOf types.str;
+ example = [ "default.filter" "/etc/privoxy/user.filter" ];
+ default = [ "default.filter" ];
+ description = ''
+ List of paths to Privoxy filter files.
+ These paths may either be absolute or relative to the privoxy configuration directory.
+ '';
+ };
+
+ enableEditActions = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether or not the web-based actions file editor may be used.
'';
};
extraConfig = mkOption {
+ type = types.lines;
default = "" ;
description = ''
Extra configuration. Contents will be added verbatim to the configuration file.
@@ -62,33 +85,22 @@ in
};
-
###### implementation
- config = mkIf config.services.privoxy.enable {
+ config = mkIf cfg.enable {
- environment.systemPackages = [ privoxy ];
-
users.extraUsers = singleton
{ name = privoxyUser;
uid = config.ids.uids.privoxy;
description = "Privoxy daemon user";
- home = stateDir;
};
- jobs.privoxy =
- { name = "privoxy";
-
- startOn = "startup";
-
- preStart =
- ''
- mkdir -m 0755 -p ${stateDir}
- chown ${privoxyUser} ${stateDir}
- '';
-
- exec = "${privoxy}/sbin/privoxy ${privoxyFlags}";
- };
+ systemd.services.privoxy = {
+ description = "Filtering web proxy";
+ after = [ "network.target" "nss-lookup.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig.ExecStart = "${privoxy}/sbin/privoxy --no-daemon --user ${privoxyUser} ${confFile}";
+ };
};
diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix
new file mode 100644
index 00000000000..f82f8bfddbb
--- /dev/null
+++ b/nixos/modules/services/networking/prosody.nix
@@ -0,0 +1,280 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.prosody;
+
+ sslOpts = { ... }: {
+
+ options = {
+
+ # TODO: require attribute
+ key = mkOption {
+ type = types.str;
+ description = "Path to the key file";
+ };
+
+ # TODO: require attribute
+ cert = mkOption {
+ type = types.str;
+ description = "Path to the certificate file";
+ };
+ };
+ };
+
+ moduleOpts = {
+
+ roster = mkOption {
+ default = true;
+ description = "Allow users to have a roster";
+ };
+
+ saslauth = mkOption {
+ default = true;
+ description = "Authentication for clients and servers. Recommended if you want to log in.";
+ };
+
+ tls = mkOption {
+ default = true;
+ description = "Add support for secure TLS on c2s/s2s connections";
+ };
+
+ dialback = mkOption {
+ default = true;
+ description = "s2s dialback support";
+ };
+
+ disco = mkOption {
+ default = true;
+ description = "Service discovery";
+ };
+
+ legacyauth = mkOption {
+ default = true;
+ description = "Legacy authentication. Only used by some old clients and bots";
+ };
+
+ version = mkOption {
+ default = true;
+ description = "Replies to server version requests";
+ };
+
+ uptime = mkOption {
+ default = true;
+ description = "Report how long server has been running";
+ };
+
+ time = mkOption {
+ default = true;
+ description = "Let others know the time here on this server";
+ };
+
+ ping = mkOption {
+ default = true;
+ description = "Replies to XMPP pings with pongs";
+ };
+
+ console = mkOption {
+ default = false;
+ description = "telnet to port 5582";
+ };
+
+ bosh = mkOption {
+ default = false;
+ description = "Enable BOSH clients, aka 'Jabber over HTTP'";
+ };
+
+ httpserver = mkOption {
+ default = false;
+ description = "Serve static files from a directory over HTTP";
+ };
+
+ websocket = mkOption {
+ default = false;
+ description = "Enable WebSocket support";
+ };
+
+ };
+
+ createSSLOptsStr = o:
+ if o ? key && o ? cert then
+ ''ssl = { key = "${o.key}"; certificate = "${o.cert}"; };''
+ else "";
+
+ vHostOpts = { ... }: {
+
+ options = {
+
+ # TODO: require attribute
+ domain = mkOption {
+ type = types.str;
+ description = "Domain name";
+ };
+
+ enabled = mkOption {
+ default = false;
+ description = "Whether to enable the virtual host";
+ };
+
+ ssl = mkOption {
+ description = "Paths to SSL files";
+ default = null;
+ options = [ sslOpts ];
+ };
+
+ extraConfig = mkOption {
+ default = '''';
+ description = "Additional virtual host specific configuration";
+ };
+
+ };
+
+ };
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.prosody = {
+
+ enable = mkOption {
+ default = false;
+ description = "Whether to enable the prosody server";
+ };
+
+ allowRegistration = mkOption {
+ default = false;
+ description = "Allow account creation";
+ };
+
+ modules = moduleOpts;
+
+ extraModules = mkOption {
+ description = "Enable custom modules";
+ default = [];
+ };
+
+ virtualHosts = mkOption {
+
+ description = "Define the virtual hosts";
+
+ type = types.loaOf types.optionSet;
+
+ example = {
+ myhost = {
+ domain = "my-xmpp-example-host.org";
+ enabled = true;
+ };
+ };
+
+ default = {
+ localhost = {
+ domain = "localhost";
+ enabled = true;
+ };
+ };
+
+ options = [ vHostOpts ];
+ };
+
+ ssl = mkOption {
+ description = "Paths to SSL files";
+ default = null;
+ options = [ sslOpts ];
+ };
+
+ admins = mkOption {
+ description = "List of administrators of the current host";
+ example = [ "admin1@example.com" "admin2@example.com" ];
+ default = [];
+ };
+
+ extraConfig = mkOption {
+ default = '''';
+ description = "Additional prosody configuration";
+ };
+
+ };
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.enable {
+
+ environment.systemPackages = [ pkgs.prosody ];
+
+ environment.etc."prosody/prosody.cfg.lua".text = ''
+
+ pidfile = "/var/lib/prosody/prosody.pid"
+
+
+ log = "*syslog"
+
+ data_path = "/var/lib/prosody"
+
+ allow_registration = ${ if cfg.allowRegistration then "true" else "false" };
+
+ ${ optionalString cfg.modules.console "console_enabled = true;" }
+
+ ${ optionalString (cfg.ssl != null) (createSSLOptsStr cfg.ssl) }
+
+ admins = { ${lib.concatStringsSep ", " (map (n: "\"${n}\"") cfg.admins) } };
+
+ modules_enabled = {
+
+ ${ lib.concatStringsSep "\n\ \ " (lib.mapAttrsToList
+ (name: val: optionalString val ''"${name}";'')
+ cfg.modules) }
+
+ ${ optionalString cfg.allowRegistration "\"register\"\;" }
+
+ ${ lib.concatStringsSep "\n" (map (x: "\"${x}\";") cfg.extraModules)}
+
+ "posix";
+ };
+
+ ${ cfg.extraConfig }
+
+ ${ lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: ''
+ VirtualHost "${v.domain}"
+ enabled = ${if v.enabled then "true" else "false"};
+ ${ optionalString (v.ssl != null) (createSSLOptsStr v.ssl) }
+ ${ v.extraConfig }
+ '') cfg.virtualHosts) }
+ '';
+
+ users.extraUsers.prosody = {
+ uid = config.ids.uids.prosody;
+ description = "Prosody user";
+ createHome = true;
+ group = "prosody";
+ home = "/var/lib/prosody";
+ };
+
+ users.extraGroups.prosody = {
+ gid = config.ids.gids.prosody;
+ };
+
+ systemd.services.prosody = {
+
+ description = "Prosody XMPP server";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ User = "prosody";
+ PIDFile = "/var/lib/prosody/prosody.pid";
+ ExecStart = "${pkgs.prosody}/bin/prosodyctl start";
+ };
+
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/radicale.nix b/nixos/modules/services/networking/radicale.nix
new file mode 100644
index 00000000000..fc9afc70aca
--- /dev/null
+++ b/nixos/modules/services/networking/radicale.nix
@@ -0,0 +1,48 @@
+{config, lib, pkgs, ...}:
+
+with lib;
+
+let
+
+ cfg = config.services.radicale;
+
+ confFile = pkgs.writeText "radicale.conf" cfg.config;
+
+in
+
+{
+
+ options = {
+
+ services.radicale.enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Enable Radicale CalDAV and CardDAV server
+ '';
+ };
+
+ services.radicale.config = mkOption {
+ type = types.string;
+ default = "";
+ description = ''
+ Radicale configuration, this will set the service
+ configuration file
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+
+ environment.systemPackages = [ pkgs.pythonPackages.radicale ];
+
+ jobs.radicale = {
+ description = "A Simple Calendar and Contact Server";
+ startOn = "started network-interfaces";
+ exec = "${pkgs.pythonPackages.radicale}/bin/radicale -C ${confFile} -d";
+ daemonType = "fork";
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/radvd.nix b/nixos/modules/services/networking/radvd.nix
index 08762c9c837..0199502163a 100644
--- a/nixos/modules/services/networking/radvd.nix
+++ b/nixos/modules/services/networking/radvd.nix
@@ -52,24 +52,32 @@ in
config = mkIf cfg.enable {
- environment.systemPackages = [ pkgs.radvd ];
+ users.extraUsers.radvd =
+ { uid = config.ids.uids.radvd;
+ description = "Router Advertisement Daemon User";
+ };
- jobs.radvd =
+ systemd.services.radvd =
{ description = "IPv6 Router Advertisement Daemon";
- startOn = "started network-interfaces";
+ wantedBy = [ "multi-user.target" ];
- preStart =
- ''
- # !!! Radvd only works if IPv6 forwarding is enabled. But
- # this should probably be done somewhere else (and not
- # necessarily for all interfaces).
- echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
- '';
+ after = [ "network.target" ];
- exec = "${pkgs.radvd}/sbin/radvd -m syslog -s -C ${confFile}";
+ path = [ pkgs.radvd ];
- daemonType = "fork";
+ preStart = ''
+ mkdir -m 755 -p /run/radvd
+ chown radvd /run/radvd
+ '';
+
+ serviceConfig =
+ { ExecStart = "@${pkgs.radvd}/sbin/radvd radvd"
+ + " -p /run/radvd/radvd.pid -m syslog -u radvd -C ${confFile}";
+ Restart = "always";
+ Type = "forking";
+ PIDFile = "/run/radvd/radvd.pid";
+ };
};
};
diff --git a/nixos/modules/services/networking/seeks.nix b/nixos/modules/services/networking/seeks.nix
new file mode 100644
index 00000000000..155ecbb98ef
--- /dev/null
+++ b/nixos/modules/services/networking/seeks.nix
@@ -0,0 +1,75 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.seeks;
+
+ confDir = cfg.confDir;
+
+ seeks = pkgs.seeks.override { seeks_confDir = confDir; };
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.seeks = {
+
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = "
+ Whether to enable the Seeks server.
+ ";
+ };
+
+ confDir = mkOption {
+ default = "";
+ type = types.str;
+ description = "
+ The Seeks server configuration. If it is not specified,
+ a default configuration is used (${seeks}/etc/seeks).
+ ";
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf config.services.seeks.enable {
+
+ users.extraUsers.seeks =
+ { uid = config.ids.uids.seeks;
+ description = "Seeks user";
+ createHome = true;
+ home = "/var/lib/seeks";
+ };
+
+ users.extraGroups.seeks =
+ { gid = config.ids.gids.seeks;
+ };
+
+ systemd.services.seeks =
+ {
+ description = "Seeks server, the p2p search engine.";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig = {
+ User = "seeks";
+ ExecStart = "${seeks}/bin/seeks";
+ };
+ };
+
+ environment.systemPackages = [ seeks ];
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/ssh/lshd.nix b/nixos/modules/services/networking/ssh/lshd.nix
index fca30a1fe49..81e523fd2a5 100644
--- a/nixos/modules/services/networking/ssh/lshd.nix
+++ b/nixos/modules/services/networking/ssh/lshd.nix
@@ -99,7 +99,6 @@ in
};
subsystems = mkOption {
- default = [ ["sftp" "${pkgs.lsh}/sbin/sftp-server"] ];
description = ''
List of subsystem-path pairs, where the head of the pair
denotes the subsystem name, and the tail denotes the path to
@@ -116,6 +115,8 @@ in
config = mkIf cfg.enable {
+ services.lshd.subsystems = [ ["sftp" "${pkgs.lsh}/sbin/sftp-server"] ];
+
jobs.lshd =
{ description = "GNU lshd SSH2 daemon";
diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix
index e4b29a0b909..fee1bace046 100644
--- a/nixos/modules/services/networking/ssh/sshd.nix
+++ b/nixos/modules/services/networking/ssh/sshd.nix
@@ -144,6 +144,36 @@ in
'';
};
+ listenAddresses = mkOption {
+ type = types.listOf types.optionSet;
+ default = [];
+ example = [ { addr = "192.168.3.1"; port = 22; } { addr = "0.0.0.0"; port = 64022; } ];
+ description = ''
+ List of addresses and ports to listen on (ListenAddress directive
+ in config). If port is not specified for address sshd will listen
+ on all ports specified by ports option.
+ NOTE: this will override default listening on all local addresses and port 22.
+ NOTE: setting this option won't automatically enable given ports
+ in firewall configuration.
+ '';
+ options = {
+ addr = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = ''
+ Host, IPv4 or IPv6 address to listen to.
+ '';
+ };
+ port = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ description = ''
+ Port to listen to.
+ '';
+ };
+ };
+ };
+
passwordAuthentication = mkOption {
type = types.bool;
default = true;
@@ -261,7 +291,7 @@ in
};
environment.etc = authKeysFiles ++ [
- { source = "${pkgs.openssh}/etc/ssh/moduli";
+ { source = "${cfgc.package}/etc/ssh/moduli";
target = "ssh/moduli";
}
{ source = knownHostsFile;
@@ -278,7 +308,7 @@ in
stopIfChanged = false;
- path = [ pkgs.openssh pkgs.gawk ];
+ path = [ cfgc.package pkgs.gawk ];
environment.LD_LIBRARY_PATH = nssModulesPath;
@@ -295,7 +325,7 @@ in
serviceConfig =
{ ExecStart =
- "${pkgs.openssh}/sbin/sshd " + (optionalString cfg.startWhenNeeded "-i ") +
+ "${cfgc.package}/sbin/sshd " + (optionalString cfg.startWhenNeeded "-i ") +
"-f ${pkgs.writeText "sshd_config" cfg.extraConfig}";
KillMode = "process";
} // (if cfg.startWhenNeeded then {
@@ -349,6 +379,10 @@ in
Port ${toString port}
'') cfg.ports}
+ ${concatMapStrings ({ port, addr }: ''
+ ListenAddress ${addr}${if port != null then ":" + toString port else ""}
+ '') cfg.listenAddresses}
+
${optionalString cfgc.setXAuthLocation ''
XAuthLocation ${pkgs.xorg.xauth}/bin/xauth
''}
@@ -360,7 +394,7 @@ in
''}
${optionalString cfg.allowSFTP ''
- Subsystem sftp ${pkgs.openssh}/libexec/sftp-server
+ Subsystem sftp ${cfgc.package}/libexec/sftp-server
''}
PermitRootLogin ${cfg.permitRootLogin}
@@ -383,6 +417,10 @@ in
assertion = (data.publicKey == null && data.publicKeyFile != null) ||
(data.publicKey != null && data.publicKeyFile == null);
message = "knownHost ${name} must contain either a publicKey or publicKeyFile";
+ })
+ ++ flip map cfg.listenAddresses ({ addr, port }: {
+ assertion = addr != null;
+ message = "addr must be specified in each listenAddresses entry";
});
};
diff --git a/nixos/modules/services/networking/teamspeak3.nix b/nixos/modules/services/networking/teamspeak3.nix
index 2d3478d52f8..b3656d73dec 100644
--- a/nixos/modules/services/networking/teamspeak3.nix
+++ b/nixos/modules/services/networking/teamspeak3.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
-with pkgs.lib;
+with lib;
let
ts3 = pkgs.teamspeak_server;
diff --git a/nixos/modules/services/networking/unbound.nix b/nixos/modules/services/networking/unbound.nix
index 415ff13bdda..73b10c1d561 100644
--- a/nixos/modules/services/networking/unbound.nix
+++ b/nixos/modules/services/networking/unbound.nix
@@ -6,8 +6,6 @@ let
cfg = config.services.unbound;
- username = "unbound";
-
stateDir = "/var/lib/unbound";
access = concatMapStrings (x: " access-control: ${x} allow\n") cfg.allowedAccess;
@@ -21,21 +19,13 @@ let
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
+ username: unbound
chroot: "${stateDir}"
- # logfile: "${stateDir}/unbound.log" #uncomment to use logfile.
- pidfile: "${stateDir}/unbound.pid"
- verbosity: 1 # uncomment and increase to get more logging.
+ pidfile: ""
${interfaces}
${access}
-
- ${forward}
-
${cfg.extraConfig}
+ ${forward}
'';
in
@@ -82,7 +72,7 @@ in
environment.systemPackages = [ pkgs.unbound ];
users.extraUsers = singleton {
- name = username;
+ name = "unbound";
uid = config.ids.uids.unbound;
description = "unbound daemon user";
home = stateDir;
@@ -96,8 +86,18 @@ in
wants = [" nss-lookup.target" ];
wantedBy = [ "multi-user.target" ];
- path = [ pkgs.unbound ];
- serviceConfig.ExecStart = "${pkgs.unbound}/sbin/unbound -d -c ${confFile}";
+ preStart = ''
+ mkdir -m 0755 -p ${stateDir}/dev/
+ cp ${confFile} ${stateDir}/unbound.conf
+ chown unbound ${stateDir}
+ touch ${stateDir}/dev/random
+ ${pkgs.utillinux}/bin/mount --bind -n /dev/random ${stateDir}/dev/random
+ '';
+
+ serviceConfig = {
+ ExecStart = "${pkgs.unbound}/sbin/unbound -d -c ${stateDir}/unbound.conf";
+ ExecStopPost="${pkgs.utillinux}/bin/umount ${stateDir}/dev/random";
+ };
};
};
diff --git a/nixos/modules/services/networking/unifi.nix b/nixos/modules/services/networking/unifi.nix
new file mode 100644
index 00000000000..634f760328f
--- /dev/null
+++ b/nixos/modules/services/networking/unifi.nix
@@ -0,0 +1,88 @@
+{ config, lib, pkgs, ... }:
+with lib;
+let
+ cfg = config.services.unifi;
+ stateDir = "/var/lib/unifi";
+ cmd = "@${pkgs.icedtea7_jre}/bin/java java -jar ${stateDir}/lib/ace.jar";
+in
+{
+
+ options = {
+
+ services.unifi.enable = mkOption {
+ type = types.uniq types.bool;
+ default = false;
+ description = ''
+ Whether or not to enable the unifi controller service.
+ '';
+ };
+
+ };
+
+ config = mkIf cfg.enable {
+
+ users.extraUsers.unifi = {
+ uid = config.ids.uids.unifi;
+ description = "UniFi controller daemon user";
+ home = "${stateDir}";
+ };
+
+ # We must create the binary directories as bind mounts instead of symlinks
+ # This is because the controller resolves all symlinks to absolute paths
+ # to be used as the working directory.
+ systemd.mounts = map ({ what, where }: {
+ bindsTo = [ "unifi.service" ];
+ requiredBy = [ "unifi.service" ];
+ before = [ "unifi.service" ];
+ options = "bind";
+ what = what;
+ where = where;
+ }) [
+ {
+ what = "${pkgs.unifi}/dl";
+ where = "${stateDir}/dl";
+ }
+ {
+ what = "${pkgs.unifi}/lib";
+ where = "${stateDir}/lib";
+ }
+ {
+ what = "${pkgs.mongodb}/bin";
+ where = "${stateDir}/bin";
+ }
+ ];
+
+ systemd.services.unifi = {
+ description = "UniFi controller daemon";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+
+ preStart = ''
+ # Ensure privacy of state
+ chown unifi "${stateDir}"
+ chmod 0700 "${stateDir}"
+
+ # Create the volatile webapps
+ mkdir -p "${stateDir}/webapps"
+ chown unifi "${stateDir}/webapps"
+ ln -s "${pkgs.unifi}/webapps/ROOT.war" "${stateDir}/webapps/ROOT.war"
+ '';
+
+ postStop = ''
+ rm "${stateDir}/webapps/ROOT.war"
+ '';
+
+ serviceConfig = {
+ Type = "simple";
+ ExecStart = "${cmd} start";
+ ExecStop = "${cmd} stop";
+ User = "unifi";
+ PermissionsStartOnly = true;
+ UMask = "0077";
+ WorkingDirectory = "${stateDir}";
+ };
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/networking/znc.nix b/nixos/modules/services/networking/znc.nix
new file mode 100644
index 00000000000..b39aea04521
--- /dev/null
+++ b/nixos/modules/services/networking/znc.nix
@@ -0,0 +1,317 @@
+{ config, lib, pkgs, ...}:
+
+with lib;
+
+let
+ cfg = config.services.znc;
+
+ defaultUser = "znc"; # Default user to own process.
+
+ # Default user and pass:
+ # un=znc
+ # pw=nixospass
+
+ defaultUserName = "znc";
+ defaultPassBlock = "
+
+ Method = sha256
+ Hash = e2ce303c7ea75c571d80d8540a8699b46535be6a085be3414947d638e48d9e93
+ Salt = l5Xryew4g*!oa(ECfX2o
+
+ ";
+
+ modules = pkgs.buildEnv {
+ name = "znc-modules";
+ paths = cfg.modulePackages;
+ };
+
+ # Keep znc.conf in nix store, then symlink or copy into `dataDir`, depending on `mutable`.
+ mkZncConf = confOpts: ''
+ // Also check http://en.znc.in/wiki/Configuration
+
+ AnonIPLimit = 10
+ ConnectDelay = 5
+ # Add `LoadModule = x` for each module...
+ ${concatMapStrings (n: "LoadModule = ${n}\n") confOpts.modules}
+ MaxBufferSize = 500
+ ProtectWebSessions = true
+ SSLCertFile = ${cfg.dataDir}/znc.pem
+ ServerThrottle = 30
+ Skin = dark-clouds
+ StatusPrefix = *
+ Version = 1.2
+
+
+ AllowIRC = true
+ AllowWeb = true
+ IPv4 = true
+ IPv6 = false
+ Port = ${if confOpts.useSSL then "+" else ""}${toString confOpts.port}
+ SSL = ${if confOpts.useSSL then "true" else "false"}
+
+
+
+ Admin = true
+ Allow = *
+ AltNick = ${confOpts.nick}_
+ AppendTimestamp = false
+ AutoClearChanBuffer = false
+ Buffer = 150
+ ChanModes = +stn
+ DenyLoadMod = false
+ DenySetBindHost = false
+ Ident = ident
+ JoinTries = 10
+ MaxJoins = 0
+ MaxNetworks = 1
+ MultiClients = true
+ Nick = ${confOpts.nick}
+ PrependTimestamp = true
+ QuitMsg = Quit
+ RealName = ${confOpts.nick}
+ TimestampFormat = [%H:%M:%S]
+ ${concatMapStrings (n: "LoadModule = ${n}\n") confOpts.userModules}
+
+ ${confOpts.passBlock}
+
+ ${confOpts.extraZncConf}
+ '';
+
+ zncConfFile = pkgs.writeTextFile {
+ name = "znc.conf";
+ text = if cfg.zncConf != ""
+ then cfg.zncConf
+ else mkZncConf cfg.confOptions;
+ };
+
+in
+
+{
+
+ ###### Interface
+
+ options = {
+ services.znc = {
+ enable = mkOption {
+ default = false;
+ example = true;
+ type = types.bool;
+ description = ''
+ Enable a ZNC service for a user.
+ '';
+ };
+
+ user = mkOption {
+ default = "znc";
+ example = "john";
+ type = types.string;
+ description = ''
+ The name of an existing user account to use to own the ZNC server process.
+ If not specified, a default user will be created to own the process.
+ '';
+ };
+
+ dataDir = mkOption {
+ default = "/var/lib/znc/";
+ example = "/home/john/.znc/";
+ type = types.path;
+ description = ''
+ The data directory. Used for configuration files and modules.
+ '';
+ };
+
+ zncConf = mkOption {
+ default = "";
+ example = "See: http://wiki.znc.in/Configuration";
+ type = types.lines;
+ description = ''
+ The contents of the `znc.conf` file to use when creating it.
+ If specified, `confOptions` will be ignored, and this value, as-is, will be used.
+ If left empty, a conf file with default values will be used.
+ Recommended to generate with `znc --makeconf` command.
+ '';
+ };
+
+ /* TODO: add to the documentation of the current module:
+
+ Values to use when creating a `znc.conf` file.
+
+ confOptions = {
+ modules = [ "log" ];
+ userName = "john";
+ nick = "johntron";
+ };
+ */
+ confOptions = {
+ modules = mkOption {
+ type = types.listOf types.string;
+ default = [ "partyline" "webadmin" "adminlog" "log" ];
+ example = [ "partyline" "webadmin" "adminlog" "log" ];
+ description = ''
+ A list of modules to include in the `znc.conf` file.
+ '';
+ };
+
+ userModules = mkOption {
+ type = types.listOf types.string;
+ default = [ ];
+ example = [ "fish" "push" ];
+ description = ''
+ A list of user modules to include in the `znc.conf` file.
+ '';
+ };
+
+ userName = mkOption {
+ default = defaultUserName;
+ example = "johntron";
+ type = types.string;
+ description = ''
+ The user name to use when generating the `znc.conf` file.
+ This is the user name used by the user logging into the ZNC web admin.
+ '';
+ };
+
+ nick = mkOption {
+ default = "znc-user";
+ example = "john";
+ type = types.string;
+ description = ''
+ The IRC nick to use when generating the `znc.conf` file.
+ '';
+ };
+
+ passBlock = mkOption {
+ default = defaultPassBlock;
+ example = "Must be the block generated by the `znc --makepass` command.";
+ type = types.string;
+ description = ''
+ The pass block to use when generating the `znc.conf` file.
+ This is the password used by the user logging into the ZNC web admin.
+ This is the block generated by the `znc --makepass` command.
+ !!! If not specified, please change this after starting the service. !!!
+ '';
+ };
+
+ port = mkOption {
+ default = 5000;
+ example = 5000;
+ type = types.int;
+ description = ''
+ Specifies the port on which to listen.
+ '';
+ };
+
+ useSSL = mkOption {
+ default = true;
+ example = true;
+ type = types.bool;
+ description = ''
+ Indicates whether the ZNC server should use SSL when listening on the specified port.
+ '';
+ };
+
+ extraZncConf = mkOption {
+ default = "";
+ type = types.lines;
+ description = ''
+ Extra config to `znc.conf` file
+ '';
+ };
+ };
+
+ modulePackages = mkOption {
+ type = types.listOf types.package;
+ default = [ ];
+ example = literalExample "[ pkgs.zncModules.fish pkgs.zncModules.push ]";
+ description = ''
+ A list of global znc module packages to add to znc.
+ '';
+ };
+
+ mutable = mkOption {
+ default = false;
+ example = true;
+ type = types.bool;
+ description = ''
+ Indicates whether to allow the contents of the `dataDir` directory to be changed
+ by the user at run-time.
+ If true, modifications to the ZNC configuration after its initial creation are not
+ overwritten by a NixOS system rebuild.
+ If false, the ZNC configuration is rebuilt by every system rebuild.
+ If the user wants to manage the ZNC service using the web admin interface, this value
+ should be set to true.
+ '';
+ };
+
+ extraFlags = mkOption {
+ default = [ ];
+ example = [ "--debug" ];
+ type = types.listOf types.str;
+ description = ''
+ Extra flags to use when executing znc command.
+ '';
+ };
+ };
+ };
+
+
+ ###### Implementation
+
+ config = mkIf cfg.enable {
+
+ systemd.services.znc = {
+ description = "ZNC Server";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.service" ];
+ serviceConfig = {
+ User = cfg.user;
+ Restart = "always";
+ ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
+ ExecStop = "${pkgs.coreutils}/bin/kill -INT $MAINPID";
+ };
+ preStart = ''
+ ${pkgs.coreutils}/bin/mkdir -p ${cfg.dataDir}/configs
+
+ # If mutable, regenerate conf file every time.
+ ${optionalString (!cfg.mutable) ''
+ ${pkgs.coreutils}/bin/echo "znc is set to be system-managed. Now deleting old znc.conf file to be regenerated."
+ ${pkgs.coreutils}/bin/rm -f ${cfg.dataDir}/configs/znc.conf
+ ''}
+
+ # Ensure essential files exist.
+ if [[ ! -f ${cfg.dataDir}/configs/znc.conf ]]; then
+ ${pkgs.coreutils}/bin/echo "No znc.conf file found in ${cfg.dataDir}. Creating one now."
+ ${pkgs.coreutils}/bin/cp --no-clobber ${zncConfFile} ${cfg.dataDir}/configs/znc.conf
+ ${pkgs.coreutils}/bin/chmod u+rw ${cfg.dataDir}/configs/znc.conf
+ ${pkgs.coreutils}/bin/chown ${cfg.user} ${cfg.dataDir}/configs/znc.conf
+ fi
+
+ if [[ ! -f ${cfg.dataDir}/znc.pem ]]; then
+ ${pkgs.coreutils}/bin/echo "No znc.pem file found in ${cfg.dataDir}. Creating one now."
+ ${pkgs.znc}/bin/znc --makepem --datadir ${cfg.dataDir}
+ fi
+
+ # Symlink modules
+ rm ${cfg.dataDir}/modules || true
+ ln -fs ${modules}/lib/znc ${cfg.dataDir}/modules
+ '';
+ script = "${pkgs.znc}/bin/znc --foreground --datadir ${cfg.dataDir} ${toString cfg.extraFlags}";
+ };
+
+ users.extraUsers = optional (cfg.user == defaultUser)
+ { name = defaultUser;
+ description = "ZNC server daemon owner";
+ group = defaultUser;
+ uid = config.ids.uids.znc;
+ home = cfg.dataDir;
+ createHome = true;
+ };
+
+ users.extraGroups = optional (cfg.user == defaultUser)
+ { name = defaultUser;
+ gid = config.ids.gids.znc;
+ members = [ defaultUser ];
+ };
+
+ };
+}
diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix
index d229c610669..8a8085cad28 100644
--- a/nixos/modules/services/printing/cupsd.nix
+++ b/nixos/modules/services/printing/cupsd.nix
@@ -35,7 +35,7 @@ let
bindir = pkgs.buildEnv {
name = "cups-progs";
paths = cfg.drivers;
- pathsToLink = [ "/lib/cups" "/share/cups" "/bin" ];
+ pathsToLink = [ "/lib/cups" "/share/cups" "/bin" "/etc/cups" ];
postBuild = cfg.bindirCmds;
};
@@ -89,6 +89,20 @@ in
'';
};
+ clientConf = mkOption {
+ type = types.lines;
+ default = "";
+ example =
+ ''
+ ServerName server.example.com
+ Encryption Never
+ '';
+ description = ''
+ The contents of the client configuration.
+ (client.conf)
+ '';
+ };
+
drivers = mkOption {
type = types.listOf types.path;
example = literalExample "[ pkgs.splix ]";
@@ -124,6 +138,14 @@ in
environment.systemPackages = [ cups ];
+ environment.variables.CUPS_SERVERROOT = "/etc/cups";
+
+ environment.etc = [
+ { source = pkgs.writeText "client.conf" cfg.clientConf;
+ target = "cups/client.conf";
+ }
+ ];
+
services.dbus.packages = [ cups ];
# Cups uses libusb to talk to printers, and does not use the
diff --git a/nixos/modules/services/scheduling/cron.nix b/nixos/modules/services/scheduling/cron.nix
index 5da71b12dd7..ded3010ec5a 100644
--- a/nixos/modules/services/scheduling/cron.nix
+++ b/nixos/modules/services/scheduling/cron.nix
@@ -15,7 +15,7 @@ let
MAILTO="${config.services.cron.mailto}"
''}
NIX_CONF_DIR=/etc/nix
- ${pkgs.lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)}
+ ${lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)}
'';
# Vixie cron requires build-time configuration for the sendmail path.
@@ -25,6 +25,10 @@ let
sendmailPath = "/var/setuid-wrappers/sendmail";
};
+ allFiles = map (f: "\"${f}\"") (
+ [ "${systemCronJobsFile}" ] ++ config.services.cron.cronFiles
+ );
+
in
{
@@ -71,6 +75,15 @@ in
'';
};
+ cronFiles = mkOption {
+ type = types.listOf types.path;
+ default = [];
+ description = ''
+ A list of extra crontab files that will be read and appended to the main
+ crontab file when the cron service starts.
+ '';
+ };
+
};
};
@@ -78,14 +91,7 @@ in
###### implementation
- config = mkIf config.services.cron.enable {
-
- environment.etc = singleton
- # The system-wide crontab.
- { source = systemCronJobsFile;
- target = "crontab";
- mode = "0600"; # Cron requires this.
- };
+ config = mkIf (config.services.cron.enable && allFiles != []) {
security.setuidPrograms = [ "crontab" ];
@@ -100,6 +106,10 @@ in
preStart =
''
+ rm -f /etc/crontab
+ cat ${toString allFiles} > /etc/crontab
+ chmod 0600 /etc/crontab
+
mkdir -m 710 -p /var/cron
# By default, allow all users to create a crontab. This
diff --git a/nixos/modules/services/scheduling/fcron.nix b/nixos/modules/services/scheduling/fcron.nix
index 346a64f2c3c..ade8c19329c 100644
--- a/nixos/modules/services/scheduling/fcron.nix
+++ b/nixos/modules/services/scheduling/fcron.nix
@@ -17,7 +17,7 @@ let
MAILTO="${config.services.cron.mailto}"
''}
NIX_CONF_DIR=/etc/nix
- ${pkgs.lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)}
+ ${lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)}
'';
allowdeny = target: users:
diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix
index eeae11dc4ff..12f163db463 100644
--- a/nixos/modules/services/search/elasticsearch.nix
+++ b/nixos/modules/services/search/elasticsearch.nix
@@ -21,6 +21,11 @@ let
];
};
+ esPlugins = pkgs.buildEnv {
+ name = "elasticsearch-plugins";
+ paths = cfg.plugins;
+ };
+
in {
###### interface
@@ -101,6 +106,12 @@ in {
example = [ "-Djava.net.preferIPv4Stack=true" ];
};
+ plugins = mkOption {
+ description = "Extra elasticsearch plugins";
+ default = [];
+ type = types.listOf types.package;
+ };
+
};
###### implementation
@@ -119,6 +130,15 @@ in {
preStart = ''
mkdir -m 0700 -p ${cfg.dataDir}
if [ "$(id -u)" = 0 ]; then chown -R elasticsearch ${cfg.dataDir}; fi
+
+ # Install plugins
+ rm ${cfg.dataDir}/plugins || true
+ ln -s ${esPlugins}/plugins ${cfg.dataDir}/plugins
+ '';
+ postStart = mkBefore ''
+ until ${pkgs.curl}/bin/curl -s -o /dev/null ${cfg.host}:${toString cfg.port}; do
+ sleep 1
+ done
'';
};
diff --git a/nixos/modules/services/security/clamav.nix b/nixos/modules/services/security/clamav.nix
index 057891a6047..a4d54301fc1 100644
--- a/nixos/modules/services/security/clamav.nix
+++ b/nixos/modules/services/security/clamav.nix
@@ -71,10 +71,10 @@ in
mkdir -m 0755 -p ${stateDir}
chown ${clamavUser}:${clamavGroup} ${stateDir}
'';
- exec = "${pkgs.clamav}/bin/freshclam --config-file=${pkgs.writeText "freshclam.conf" cfg.updater.config}";
+ exec = "${pkgs.clamav}/bin/freshclam --daemon --config-file=${pkgs.writeText "freshclam.conf" cfg.updater.config}";
};
};
};
-}
\ No newline at end of file
+}
diff --git a/nixos/modules/services/security/fail2ban.nix b/nixos/modules/services/security/fail2ban.nix
index af545016637..c40f41e07d4 100644
--- a/nixos/modules/services/security/fail2ban.nix
+++ b/nixos/modules/services/security/fail2ban.nix
@@ -25,17 +25,22 @@ in
options = {
services.fail2ban = {
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = "Whether to enable the fail2ban service.";
+ };
daemonConfig = mkOption {
default =
''
[Definition]
- loglevel = 3
+ loglevel = INFO
logtarget = SYSLOG
socket = /run/fail2ban/fail2ban.sock
pidfile = /run/fail2ban/fail2ban.pid
'';
- type = types.string;
+ type = types.lines;
description =
''
The contents of Fail2ban's main configuration file. It's
@@ -59,7 +64,7 @@ in
maxretry = 5
'';
};
- type = types.attrsOf types.string;
+ type = types.attrsOf types.lines;
description =
''
The configuration of each Fail2ban “jail”. A jail
@@ -80,7 +85,7 @@ in
###### implementation
- config = {
+ config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.fail2ban ];
@@ -101,12 +106,13 @@ in
preStart =
''
mkdir -p /run/fail2ban -m 0755
+ mkdir -p /var/lib/fail2ban
'';
serviceConfig =
{ ExecStart = "${pkgs.fail2ban}/bin/fail2ban-server -f";
ReadOnlyDirectories = "/";
- ReadWriteDirectories = "/run /var/tmp";
+ ReadWriteDirectories = "/run /var/tmp /var/lib";
CapabilityBoundingSet = "CAP_DAC_READ_SEARCH CAP_NET_ADMIN CAP_NET_RAW";
};
@@ -131,15 +137,14 @@ in
bantime = 600
findtime = 600
maxretry = 3
- backend = auto
- '';
+ backend = systemd
+ '';
# Block SSH if there are too many failing connection attempts.
services.fail2ban.jails.ssh-iptables =
''
filter = sshd
action = iptables[name=SSH, port=ssh, protocol=tcp]
- logpath = /var/log/warn
maxretry = 5
'';
diff --git a/nixos/modules/services/security/frandom.nix b/nixos/modules/services/security/frandom.nix
index 9aae7b33a43..2d43d12e541 100644
--- a/nixos/modules/services/security/frandom.nix
+++ b/nixos/modules/services/security/frandom.nix
@@ -1,4 +1,4 @@
-{pkgs, config, ...}:
+{lib, config, ...}:
let kernel = config.boot.kernelPackages;
in
@@ -9,9 +9,9 @@ in
options = {
- services.frandom.enable = pkgs.lib.mkOption {
+ services.frandom.enable = lib.mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = ''
enable the /dev/frandom device (a very fast random number generator)
'';
@@ -22,7 +22,7 @@ in
###### implementation
- config = pkgs.lib.mkIf config.services.frandom.enable {
+ config = lib.mkIf config.services.frandom.enable {
boot.kernelModules = [ "frandom" ];
boot.extraModulePackages = [ kernel.frandom ];
services.udev.packages = [ kernel.frandom ];
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index 8d02a6404ac..928f16c9448 100644
--- a/nixos/modules/services/system/dbus.nix
+++ b/nixos/modules/services/system/dbus.nix
@@ -14,7 +14,7 @@ let
name = "dbus-conf";
preferLocalBuild = true;
buildCommand = ''
- ensureDir $out
+ mkdir -p $out
cp -v ${pkgs.dbus.daemon}/etc/dbus-1/system.conf $out/system.conf
diff --git a/nixos/modules/services/system/kerberos.nix b/nixos/modules/services/system/kerberos.nix
index 8fb5debd20e..3a0171ca1b9 100644
--- a/nixos/modules/services/system/kerberos.nix
+++ b/nixos/modules/services/system/kerberos.nix
@@ -1,8 +1,8 @@
-{pkgs, config, ...}:
+{pkgs, config, lib, ...}:
let
- inherit (pkgs.lib) mkOption mkIf singleton;
+ inherit (lib) mkOption mkIf singleton;
inherit (pkgs) heimdal;
@@ -36,7 +36,7 @@ in
environment.systemPackages = [ heimdal ];
services.xinetd.enable = true;
- services.xinetd.services = pkgs.lib.singleton
+ services.xinetd.services = lib.singleton
{ name = "kerberos-adm";
flags = "REUSE NAMEINARGS";
protocol = "tcp";
diff --git a/nixos/modules/services/system/nscd.nix b/nixos/modules/services/system/nscd.nix
index 1ac82064a1f..0879d9b85bd 100644
--- a/nixos/modules/services/system/nscd.nix
+++ b/nixos/modules/services/system/nscd.nix
@@ -7,7 +7,7 @@ let
nssModulesPath = config.system.nssModules.path;
cfg = config.services.nscd;
- inherit (pkgs.lib) singleton;
+ inherit (lib) singleton;
cfgFile = pkgs.writeText "nscd.conf" cfg.config;
@@ -62,7 +62,7 @@ in
mkdir -m 0755 -p /var/db/nscd
'';
- restartTriggers = [ config.environment.etc.hosts.source ];
+ restartTriggers = [ config.environment.etc.hosts.source config.environment.etc."nsswitch.conf".source ];
serviceConfig =
{ ExecStart = "@${pkgs.glibc}/sbin/nscd nscd -f ${cfgFile}";
diff --git a/nixos/modules/services/system/uptimed.nix b/nixos/modules/services/system/uptimed.nix
index 61eecd5c9ba..ab46c508914 100644
--- a/nixos/modules/services/system/uptimed.nix
+++ b/nixos/modules/services/system/uptimed.nix
@@ -1,8 +1,8 @@
-{pkgs, config, ...}:
+{pkgs, config, lib, ...}:
let
- inherit (pkgs.lib) mkOption mkIf singleton;
+ inherit (lib) mkOption mkIf singleton;
inherit (pkgs) uptimed;
diff --git a/nixos/modules/services/ttys/agetty.nix b/nixos/modules/services/ttys/agetty.nix
index df21ebbd974..3958be33df2 100644
--- a/nixos/modules/services/ttys/agetty.nix
+++ b/nixos/modules/services/ttys/agetty.nix
@@ -66,6 +66,13 @@ with lib;
restartIfChanged = false;
};
+ systemd.services."console-getty" =
+ { serviceConfig.ExecStart = "@${pkgs.utillinux}/sbin/agetty agetty --noclear --login-program ${pkgs.shadow}/bin/login --keep-baud console 115200,38400,9600 $TERM";
+ serviceConfig.Restart = "always";
+ restartIfChanged = false;
+ enable = mkDefault config.boot.isContainer;
+ };
+
environment.etc = singleton
{ # Friendly greeting on the virtual consoles.
source = pkgs.writeText "issue" ''
diff --git a/nixos/modules/services/ttys/kmscon.nix b/nixos/modules/services/ttys/kmscon.nix
index 70555e5d882..7783a1ada71 100644
--- a/nixos/modules/services/ttys/kmscon.nix
+++ b/nixos/modules/services/ttys/kmscon.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let
- inherit (pkgs.lib) mkOption types mkIf optionalString;
+ inherit (lib) mkOption types mkIf optionalString;
cfg = config.services.kmscon;
diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index b8359d4756b..85458a2ab56 100644
--- a/nixos/modules/services/web-servers/apache-httpd/default.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/default.nix
@@ -80,7 +80,7 @@ let
# !!! should be in lib
writeTextInDir = name: text:
- pkgs.runCommand name {inherit text;} "ensureDir $out; echo -n \"$text\" > $out/$name";
+ pkgs.runCommand name {inherit text;} "mkdir -p $out; echo -n \"$text\" > $out/$name";
enableSSL = any (vhost: vhost.enableSSL) allHosts;
@@ -130,7 +130,7 @@ let
'';
- loggingConf = ''
+ loggingConf = (if mainCfg.logFormat != "none" then ''
ErrorLog ${mainCfg.logDir}/error_log
LogLevel notice
@@ -141,7 +141,9 @@ let
LogFormat "%{User-agent}i" agent
CustomLog ${mainCfg.logDir}/access_log ${mainCfg.logFormat}
- '';
+ '' else ''
+ ErrorLog /dev/null
+ '');
browserHacks = ''
@@ -194,7 +196,7 @@ let
) null ([ cfg ] ++ subservices);
documentRoot = if maybeDocumentRoot != null then maybeDocumentRoot else
- pkgs.runCommand "empty" {} "ensureDir $out";
+ pkgs.runCommand "empty" {} "mkdir -p $out";
documentRootConf = ''
DocumentRoot "${documentRoot}"
@@ -206,16 +208,12 @@ let
'';
- robotsTxt = pkgs.writeText "robots.txt" ''
- ${# If this is a vhost, the include the entries for the main server as well.
- if isMainServer then ""
- else concatMapStrings (svc: svc.robotsEntries) mainSubservices}
- ${concatMapStrings (svc: svc.robotsEntries) subservices}
- '';
-
- robotsConf = ''
- Alias /robots.txt ${robotsTxt}
- '';
+ robotsTxt =
+ concatStringsSep "\n" (filter (x: x != "") (
+ # If this is a vhost, the include the entries for the main server as well.
+ (if isMainServer then [] else [mainCfg.robotsEntries] ++ map (svc: svc.robotsEntries) mainSubservices)
+ ++ [cfg.robotsEntries]
+ ++ (map (svc: svc.robotsEntries) subservices)));
in ''
ServerName ${serverInfo.canonicalName}
@@ -243,7 +241,9 @@ let
CustomLog ${mainCfg.logDir}/access_log-${cfg.hostName} ${cfg.logFormat}
'' else ""}
- ${robotsConf}
+ ${optionalString (robotsTxt != "") ''
+ Alias /robots.txt ${pkgs.writeText "robots.txt" robotsTxt}
+ ''}
${if isMainServer || maybeDocumentRoot != null then documentRootConf else ""}
@@ -387,7 +387,7 @@ let
'';
- enablePHP = any (svc: svc.enablePHP) allSubservices;
+ enablePHP = mainCfg.enablePHP || any (svc: svc.enablePHP) allSubservices;
# Generate the PHP configuration file. Should probably be factored
@@ -421,7 +421,7 @@ in
package = mkOption {
type = types.package;
default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; };
- example = "pkgs.apacheHttpd_2_4";
+ example = literalExample "pkgs.apacheHttpd_2_4";
description = ''
Overridable attribute of the Apache HTTP Server package to use.
'';
@@ -531,6 +531,12 @@ in
'';
};
+ enablePHP = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the PHP module.";
+ };
+
phpOptions = mkOption {
type = types.lines;
default = "";
@@ -594,17 +600,17 @@ in
message = "SSL is enabled for HTTPD, but sslServerCert and/or sslServerKey haven't been specified."; }
];
- users.extraUsers = optional (mainCfg.user == "wwwrun")
+ users.extraUsers = optionalAttrs (mainCfg.user == "wwwrun") (singleton
{ name = "wwwrun";
- group = "wwwrun";
+ group = mainCfg.group;
description = "Apache httpd user";
uid = config.ids.uids.wwwrun;
- };
+ });
- users.extraGroups = optional (mainCfg.group == "wwwrun")
+ users.extraGroups = optionalAttrs (mainCfg.group == "wwwrun") (singleton
{ name = "wwwrun";
gid = config.ids.gids.wwwrun;
- };
+ });
environment.systemPackages = [httpd] ++ concatMap (svc: svc.extraPath) allSubservices;
diff --git a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix
index 7d59c13b957..d7bdd81b7eb 100644
--- a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix
@@ -72,11 +72,11 @@ let
# Unpack Mediawiki and put the config file in its root directory.
mediawikiRoot = pkgs.stdenv.mkDerivation rec {
- name= "mediawiki-1.20.8";
+ name= "mediawiki-1.23.3";
src = pkgs.fetchurl {
- url = "http://download.wikimedia.org/mediawiki/1.20/${name}.tar.gz";
- sha256 = "0yfmh5vnfbgpvicfqh7nh4hwdk4qbc6gfniv02vchkg5al0nn7ag";
+ url = "http://download.wikimedia.org/mediawiki/1.23/${name}.tar.gz";
+ sha256 = "0l6798jwjwk2khfnm84mgc65ij53a8pnv30wdnn15ys4ivia4bpf";
};
skins = config.skins;
@@ -90,12 +90,13 @@ let
installPhase =
''
- ensureDir $out
+ mkdir -p $out
cp -r * $out
cp ${mediawikiConfig} $out/LocalSettings.php
- sed -i 's|/bin/bash|${pkgs.stdenv.shell}|' \
- $out/maintenance/fuzz-tester.php \
- $out/bin/ulimit.sh \
+ sed -i \
+ -e 's|/bin/bash|${pkgs.bash}/bin/bash|g' \
+ -e 's|/usr/bin/timeout|${pkgs.coreutils}/bin/timeout|g' \
+ $out/includes/limit.sh \
$out/includes/GlobalFunctions.php
'';
};
@@ -103,7 +104,7 @@ let
mediawikiScripts = pkgs.runCommand "mediawiki-${config.id}-scripts"
{ buildInputs = [ pkgs.makeWrapper ]; }
''
- ensureDir $out/bin
+ mkdir -p $out/bin
for i in changePassword.php createAndPromote.php userOptions.php edit.php nukePage.php update.php; do
makeWrapper ${php}/bin/php $out/bin/mediawiki-${config.id}-$(basename $i .php) \
--add-flags ${mediawikiRoot}/maintenance/$i
@@ -130,6 +131,7 @@ in
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
+ ${concatMapStringsSep "\n" (u: "RewriteCond %{REQUEST_URI} !^${u.urlPath}") serverInfo.vhostConfig.servedDirs}
RewriteRule ${if config.enableUploads
then "!^/images"
else "^.*\$"
diff --git a/nixos/modules/services/web-servers/apache-httpd/mercurial.nix b/nixos/modules/services/web-servers/apache-httpd/mercurial.nix
index 755b595c783..6dd91be00a7 100644
--- a/nixos/modules/services/web-servers/apache-httpd/mercurial.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/mercurial.nix
@@ -1,15 +1,15 @@
-{ config, pkgs, serverInfo, ... }:
+{ config, pkgs, serverInfo, lib, ... }:
let
inherit (pkgs) mercurial;
- inherit (pkgs.lib) mkOption;
+ inherit (lib) mkOption;
urlPrefix = config.urlPrefix;
cgi = pkgs.stdenv.mkDerivation {
name = "mercurial-cgi";
buildCommand = ''
- ensureDir $out
+ mkdir -p $out
cp -v ${mercurial}/share/cgi-bin/hgweb.cgi $out
sed -i "s|/path/to/repo/or/config|$out/hgweb.config|" $out/hgweb.cgi
echo "
diff --git a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix
index b8e86334539..76f55a63e32 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
@@ -142,9 +142,19 @@ with lib;
type = types.str;
default = "common";
example = "combined";
- description = "
+ description = ''
Log format for Apache's log files. Possible values are: combined, common, referer, agent.
- ";
+ '';
+ };
+
+ robotsEntries = mkOption {
+ type = types.lines;
+ default = "";
+ example = "Disallow: /foo/";
+ description = ''
+ Specification of pages to be ignored by web crawlers. See for details.
+ '';
};
}
diff --git a/nixos/modules/services/web-servers/apache-httpd/phabricator.nix b/nixos/modules/services/web-servers/apache-httpd/phabricator.nix
index c7a9bdf68c5..e4e3aac8d41 100644
--- a/nixos/modules/services/web-servers/apache-httpd/phabricator.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/phabricator.nix
@@ -1,35 +1,30 @@
{ config, lib, pkgs, ... }:
+
+with lib;
+
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
- '';
- };
+ phabricatorRoot = pkgs.phabricator;
in {
+
enablePHP = true;
extraApacheModules = [ "mod_rewrite" ];
DocumentRoot = "${phabricatorRoot}/phabricator/webroot";
+
+ options = {
+ git = mkOption {
+ default = true;
+ description = "Enable git repositories.";
+ };
+ mercurial = mkOption {
+ default = true;
+ description = "Enable mercurial repositories.";
+ };
+ subversion = mkOption {
+ default = true;
+ description = "Enable subversion repositories.";
+ };
+ };
+
extraConfig = ''
DocumentRoot ${phabricatorRoot}/phabricator/webroot
@@ -38,4 +33,18 @@ in {
RewriteRule ^/favicon.ico - [L,QSA]
RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
'';
+
+ extraServerPath = [
+ "${pkgs.which}"
+ "${pkgs.diffutils}"
+ ] ++
+ (if config.mercurial then ["${pkgs.mercurial}"] else []) ++
+ (if config.subversion then ["${pkgs.subversion}"] else []) ++
+ (if config.git then ["${pkgs.git}"] else []);
+
+ startupScript = pkgs.writeScript "activatePhabricator" ''
+ mkdir -p /var/repo
+ chown wwwrun /var/repo
+ '';
+
}
diff --git a/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix b/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix
index 1b754cf025e..a883bb2b343 100644
--- a/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, serverInfo, ... }:
+{ config, pkgs, serverInfo, lib, ... }:
let
- extraWorkersProperties = pkgs.lib.optionalString (config ? extraWorkersProperties) config.extraWorkersProperties;
+ extraWorkersProperties = lib.optionalString (config ? extraWorkersProperties) config.extraWorkersProperties;
workersProperties = pkgs.writeText "workers.properties" ''
# Define list of workers that will be used
@@ -29,6 +29,14 @@ ${extraWorkersProperties}
'';
in
{
+
+ options = {
+ extraWorkersProperties = lib.mkOption {
+ default = "";
+ description = "Additional configuration for the workers.properties file.";
+ };
+ };
+
extraModules = [
{ name = "jk"; path = "${pkgs.tomcat_connectors}/modules/mod_jk.so"; }
];
diff --git a/nixos/modules/services/web-servers/lighttpd/cgit.nix b/nixos/modules/services/web-servers/lighttpd/cgit.nix
index dbff565bd8a..34b2fa600ad 100644
--- a/nixos/modules/services/web-servers/lighttpd/cgit.nix
+++ b/nixos/modules/services/web-servers/lighttpd/cgit.nix
@@ -29,7 +29,7 @@ in
cache-size=1000
scan-path=/srv/git
'';
- type = types.string;
+ type = types.lines;
description = ''
Verbatim contents of the cgit runtime configuration file. Documentation
(with cgitrc example file) is available in "man cgitrc". Or online:
@@ -44,6 +44,9 @@ in
# make the cgitrc manpage available
environment.systemPackages = [ pkgs.cgit ];
+ # declare module dependencies
+ services.lighttpd.enableModules = [ "mod_cgi" "mod_alias" "mod_setenv" ];
+
services.lighttpd.extraConfig = ''
$HTTP["url"] =~ "^/cgit" {
cgi.assign = (
diff --git a/nixos/modules/services/web-servers/lighttpd/default.nix b/nixos/modules/services/web-servers/lighttpd/default.nix
index 3ba934c72bf..06f310eeb93 100644
--- a/nixos/modules/services/web-servers/lighttpd/default.nix
+++ b/nixos/modules/services/web-servers/lighttpd/default.nix
@@ -8,12 +8,54 @@ let
cfg = config.services.lighttpd;
- needModRedirect = cfg.gitweb.enable;
- needModAlias = cfg.cgit.enable or cfg.gitweb.enable;
- needModSetenv = cfg.cgit.enable or cfg.gitweb.enable;
- needModCgi = cfg.cgit.enable or cfg.gitweb.enable;
- needModStatus = cfg.mod_status;
- needModUserdir = cfg.mod_userdir;
+ # List of known lighttpd modules, ordered by how the lighttpd documentation
+ # recommends them being imported:
+ # http://redmine.lighttpd.net/projects/1/wiki/Server_modulesDetails
+ #
+ # Some modules are always imported and should not appear in the config:
+ # disallowedModules = [ "mod_indexfile" "mod_dirlisting" "mod_staticfile" ];
+ #
+ # Get full module list: "ls -1 $lighttpd/lib/*.so"
+ allKnownModules = [
+ "mod_rewrite"
+ "mod_redirect"
+ "mod_alias"
+ "mod_access"
+ "mod_auth"
+ "mod_status"
+ "mod_simple_vhost"
+ "mod_evhost"
+ "mod_userdir"
+ "mod_secdownload"
+ "mod_fastcgi"
+ "mod_proxy"
+ "mod_cgi"
+ "mod_ssi"
+ "mod_compress"
+ "mod_usertrack"
+ "mod_expire"
+ "mod_rrdtool"
+ "mod_accesslog"
+ # Remaining list of modules, order assumed to be unimportant.
+ "mod_cml"
+ "mod_dirlisting"
+ "mod_evasive"
+ "mod_extforward"
+ "mod_flv_streaming"
+ "mod_magnet"
+ "mod_mysql_vhost"
+ "mod_rewrite"
+ "mod_scgi"
+ "mod_setenv"
+ "mod_trigger_b4_dl"
+ "mod_webdav"
+ ];
+
+ maybeModuleString = moduleName:
+ if elem moduleName cfg.enableModules then ''"${moduleName}"'' else "";
+
+ modulesIncludeString = concatStringsSep ",\n"
+ (filter (x: x != "") (map maybeModuleString allKnownModules));
configFile = if cfg.configText != "" then
pkgs.writeText "lighttpd.conf" ''
@@ -38,13 +80,7 @@ let
# been loaded already. So if two services were to put the same module in
# server.modules += (), that would break the lighttpd configuration.
server.modules = (
- ${optionalString needModRedirect ''"mod_redirect",''}
- ${optionalString needModAlias ''"mod_alias",''}
- ${optionalString needModSetenv ''"mod_setenv",''}
- ${optionalString needModCgi ''"mod_cgi",''}
- ${optionalString needModStatus ''"mod_status",''}
- ${optionalString needModUserdir ''"mod_userdir",''}
- "mod_accesslog"
+ ${modulesIncludeString}
)
# Logging (logs end up in systemd journal)
@@ -102,7 +138,7 @@ in
document-root = mkOption {
default = "/srv/www";
- type = types.str;
+ type = types.path;
description = ''
Document-root of the web server. Must be readable by the "lighttpd" user.
'';
@@ -117,6 +153,19 @@ in
'';
};
+ enableModules = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "mod_cgi" "mod_status" ];
+ description = ''
+ List of lighttpd modules to enable. Sub-services take care of
+ enabling modules as needed, so this option is mainly for when you
+ want to add custom stuff to
+ that depends on a
+ certain module.
+ '';
+ };
+
mod_status = mkOption {
default = false;
type = types.uniq types.bool;
@@ -128,7 +177,7 @@ in
configText = mkOption {
default = "";
- type = types.string;
+ type = types.lines;
example = ''...verbatim config file contents...'';
description = ''
Overridable config file contents to use for lighttpd. By default, use
@@ -138,7 +187,7 @@ in
extraConfig = mkOption {
default = "";
- type = types.string;
+ type = types.lines;
description = ''
These configuration lines will be appended to the generated lighttpd
config file. Note that this mechanism does not work when the manual
@@ -152,6 +201,26 @@ in
config = mkIf cfg.enable {
+ assertions = [
+ { assertion = all (x: elem x allKnownModules) cfg.enableModules;
+ message = ''
+ One (or more) modules in services.lighttpd.enableModules are
+ unrecognized.
+
+ Known modules: ${toString allKnownModules}
+
+ services.lighttpd.enableModules: ${toString cfg.enableModules}
+ '';
+ }
+ ];
+
+ services.lighttpd.enableModules = mkMerge
+ [ (mkIf cfg.mod_status [ "mod_status" ])
+ (mkIf cfg.mod_userdir [ "mod_userdir" ])
+ # always load mod_accesslog so that we can log to the journal
+ [ "mod_accesslog" ]
+ ];
+
systemd.services.lighttpd = {
description = "Lighttpd Web Server";
after = [ "network.target" ];
diff --git a/nixos/modules/services/web-servers/lighttpd/gitweb.nix b/nixos/modules/services/web-servers/lighttpd/gitweb.nix
index d49278be09a..ef7072ecba3 100644
--- a/nixos/modules/services/web-servers/lighttpd/gitweb.nix
+++ b/nixos/modules/services/web-servers/lighttpd/gitweb.nix
@@ -25,7 +25,7 @@ in
projectroot = mkOption {
default = "/srv/git";
- type = types.str;
+ type = types.path;
description = ''
Path to git projects (bare repositories) that should be served by
gitweb. Must not end with a slash.
@@ -34,7 +34,7 @@ in
extraConfig = mkOption {
default = "";
- type = types.str;
+ type = types.lines;
description = ''
Verbatim configuration text appended to the generated gitweb.conf file.
'';
@@ -44,6 +44,9 @@ in
config = mkIf cfg.enable {
+ # declare module dependencies
+ services.lighttpd.enableModules = [ "mod_cgi" "mod_redirect" "mod_alias" "mod_setenv" ];
+
services.lighttpd.extraConfig = ''
$HTTP["url"] =~ "^/gitweb" {
cgi.assign = (
diff --git a/nixos/modules/services/web-servers/tomcat.nix b/nixos/modules/services/web-servers/tomcat.nix
index 1de3d40165e..99460a48835 100644
--- a/nixos/modules/services/web-servers/tomcat.nix
+++ b/nixos/modules/services/web-servers/tomcat.nix
@@ -5,7 +5,7 @@ with lib;
let
cfg = config.services.tomcat;
- tomcat = pkgs.tomcat6;
+ tomcat = cfg.package;
in
{
@@ -21,6 +21,15 @@ in
description = "Whether to enable Apache Tomcat";
};
+ package = mkOption {
+ type = types.package;
+ default = pkgs.tomcat7;
+ example = lib.literalExample "pkgs.tomcat8";
+ description = ''
+ Which tomcat package to use.
+ '';
+ };
+
baseDir = mkOption {
default = "/var/tomcat";
description = "Location where Tomcat stores configuration files, webapplications and logfiles";
@@ -77,6 +86,11 @@ in
description = "Whether to enable logging per virtual host.";
};
+ jdk = mkOption {
+ default = pkgs.jdk;
+ description = "Which JDK to use.";
+ };
+
axis2 = {
enable = mkOption {
@@ -332,13 +346,13 @@ in
'';
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'
+ ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c 'CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${cfg.jdk} JAVA_OPTS="${cfg.javaOpts}" CATALINA_OPTS="${cfg.catalinaOpts}" ${tomcat}/bin/startup.sh'
'';
postStop =
''
echo "Stopping tomcat..."
- CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${tomcat}/bin/shutdown.sh
+ CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${cfg.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${tomcat}/bin/shutdown.sh
'';
};
diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix
index b82398ccf9d..ebdb2ad0649 100644
--- a/nixos/modules/services/x11/desktop-managers/default.nix
+++ b/nixos/modules/services/x11/desktop-managers/default.nix
@@ -17,7 +17,10 @@ in
# Note: the order in which desktop manager modules are imported here
# determines the default: later modules (if enabled) are preferred.
# E.g., if KDE is enabled, it supersedes xterm.
- imports = [ ./none.nix ./xterm.nix ./xfce.nix ./kde4.nix ./e17.nix ./gnome3.nix ./xbmc.nix ];
+ imports = [
+ ./none.nix ./xterm.nix ./xfce.nix ./kde4.nix
+ ./e17.nix ./e18.nix ./e19.nix ./gnome3.nix ./xbmc.nix
+ ];
options = {
diff --git a/nixos/modules/services/x11/desktop-managers/e18.nix b/nixos/modules/services/x11/desktop-managers/e18.nix
new file mode 100644
index 00000000000..faafd21b07d
--- /dev/null
+++ b/nixos/modules/services/x11/desktop-managers/e18.nix
@@ -0,0 +1,43 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+
+ xcfg = config.services.xserver;
+ cfg = xcfg.desktopManager.e18;
+ e18_enlightenment = pkgs.e18.enlightenment.override { set_freqset_setuid = true; };
+
+in
+
+{
+ options = {
+
+ services.xserver.desktopManager.e18.enable = mkOption {
+ default = false;
+ example = true;
+ description = "Enable the E18 desktop environment.";
+ };
+
+ };
+
+ config = mkIf (xcfg.enable && cfg.enable) {
+
+ environment.systemPackages = [
+ pkgs.e18.efl pkgs.e18.evas pkgs.e18.emotion pkgs.e18.elementary e18_enlightenment
+ pkgs.e18.terminology pkgs.e18.econnman
+ ];
+
+ services.xserver.desktopManager.session = [
+ { name = "E18";
+ start = ''
+ ${e18_enlightenment}/bin/enlightenment_start
+ waitPID=$!
+ '';
+ }];
+
+ security.setuidPrograms = [ "e18_freqset" ];
+
+ };
+
+}
diff --git a/nixos/modules/services/x11/desktop-managers/e19.nix b/nixos/modules/services/x11/desktop-managers/e19.nix
new file mode 100644
index 00000000000..dd9becb0f6c
--- /dev/null
+++ b/nixos/modules/services/x11/desktop-managers/e19.nix
@@ -0,0 +1,94 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+
+ xcfg = config.services.xserver;
+ cfg = xcfg.desktopManager.e19;
+ e19_enlightenment = pkgs.e19.enlightenment.override { set_freqset_setuid = true; };
+
+in
+
+{
+ options = {
+
+ services.xserver.desktopManager.e19.enable = mkOption {
+ default = false;
+ example = true;
+ description = "Enable the E19 desktop environment.";
+ };
+
+ };
+
+ config = mkIf (xcfg.enable && cfg.enable) {
+
+ environment.systemPackages = [
+ pkgs.e19.efl pkgs.e19.evas pkgs.e19.emotion pkgs.e19.elementary e19_enlightenment
+ pkgs.e19.terminology pkgs.e19.econnman
+ pkgs.xorg.xauth # used by kdesu
+ pkgs.gtk # To get GTK+'s themes.
+ pkgs.tango-icon-theme
+ pkgs.shared_mime_info
+ pkgs.gnome.gnomeicontheme
+ pkgs.xorg.xcursorthemes
+ ];
+
+ environment.pathsToLink = [ "/etc/enlightenment" "/etc/xdg" "/share/enlightenment" "/share/elementary" "/share/applications" "/share/locale" "/share/icons" "/share/themes" "/share/mime" "/share/desktop-directories" ];
+
+ services.xserver.desktopManager.session = [
+ { name = "E19";
+ start = ''
+ # Set GTK_DATA_PREFIX so that GTK+ can find the themes
+ export GTK_DATA_PREFIX=${config.system.path}
+ # find theme engines
+ export GTK_PATH=${config.system.path}/lib/gtk-3.0:${config.system.path}/lib/gtk-2.0
+ export XDG_MENU_PREFIX=enlightenment
+
+ # make available for D-BUS user services
+ #export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}:${config.system.path}/share:${pkgs.e19.efl}/share
+
+ # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
+ ${pkgs.xdg-user-dirs}/bin/xdg-user-dirs-update
+
+ ${e19_enlightenment}/bin/enlightenment_start
+ waitPID=$!
+ '';
+ }];
+
+ security.setuidPrograms = [ "e19_freqset" ];
+
+ environment.etc = singleton
+ { source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
+ target = "X11/xkb";
+ };
+
+ fonts.fonts = [ pkgs.dejavu_fonts pkgs.ubuntu_font_family ];
+
+ services.udisks2.enable = true;
+ services.upower.enable = config.powerManagement.enable;
+
+ #services.dbus.packages = [ pkgs.efl ]; # dbus-1 folder is not in /etc but in /share, so needs fixing first
+
+ systemd.user.services.efreet =
+ { enable = true;
+ description = "org.enlightenment.Efreet";
+ serviceConfig =
+ { ExecStart = "${pkgs.e19.efl}/bin/efreetd";
+ StandardOutput = "null";
+ };
+ };
+
+ systemd.user.services.ethumb =
+ { enable = true;
+ description = "org.enlightenment.Ethumb";
+ serviceConfig =
+ { ExecStart = "${pkgs.e19.efl}/bin/ethumbd";
+ StandardOutput = "null";
+ };
+ };
+
+
+ };
+
+}
diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix
index df50ca8c905..ccf10068683 100644
--- a/nixos/modules/services/x11/desktop-managers/gnome3.nix
+++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix
@@ -35,15 +35,24 @@ in {
description = "Enable Gnome 3 desktop manager.";
};
+ services.xserver.desktopManager.gnome3.sessionPath = mkOption {
+ default = [];
+ example = literalExample "[ pkgs.gnome3.gpaste ]";
+ description = "Additional list of packages to be added to the session search path.
+ Useful for gnome shell extensions or gsettings-conditionated autostart.";
+ apply = list: list ++ [ gnome3.gnome_shell ];
+ };
+
environment.gnome3.packageSet = mkOption {
- default = pkgs.gnome3;
- example = literalExample "pkgs.gnome3_12";
+ default = null;
+ example = literalExample "pkgs.gnome3_10";
description = "Which Gnome 3 package set to use.";
+ apply = p: if p == null then pkgs.gnome3 else p;
};
environment.gnome3.excludePackages = mkOption {
default = [];
- example = "[ pkgs.gnome3.totem ]";
+ example = literalExample "[ pkgs.gnome3.totem ]";
type = types.listOf types.package;
description = "Which packages gnome should exclude from the default environment";
};
@@ -69,11 +78,11 @@ in {
services.gnome3.tracker.enable = mkDefault true;
hardware.pulseaudio.enable = mkDefault true;
services.telepathy.enable = mkDefault true;
- networking.networkmanager.enable = true;
+ networking.networkmanager.enable = mkDefault true;
services.upower.enable = config.powerManagement.enable;
services.upower.package = gnome3.upower;
- fonts.fonts = [ pkgs.dejavu_fonts ];
+ fonts.fonts = [ pkgs.dejavu_fonts pkgs.cantarell_fonts ];
services.xserver.desktopManager.session = singleton
{ name = "gnome3";
@@ -86,10 +95,19 @@ 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)
+ ${concatMapStrings (p: ''
+ if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
+ export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
+ fi
+
+ if [ -d "${p}/lib/girepository-1.0" ]; then
+ export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
+ fi
+ '') cfg.sessionPath}
+
# Override default mimeapps
- export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${gnome3.gnome_shell}/share/gsettings-schemas/${gnome3.gnome_shell.name}:${gnome3.vino}/share/gsettings-schemas/${gnome3.vino.name}:${mimeAppsList}/share
+ export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${mimeAppsList}/share
# Let gnome-control-center find gnome-shell search providers
export GNOME_SEARCH_PROVIDERS_DIR=${config.system.path}/share/gnome-shell/search-providers/
@@ -123,7 +141,7 @@ in {
gnome3.gnome_settings_daemon
gnome3.gnome_shell
gnome3.gnome_themes_standard
- ] ++ (removePackagesByName [
+ ] ++ cfg.sessionPath ++ (removePackagesByName [
gnome3.baobab
gnome3.empathy
gnome3.eog
diff --git a/nixos/modules/services/x11/desktop-managers/kde4.nix b/nixos/modules/services/x11/desktop-managers/kde4.nix
index f74dd7e0444..5c783fdbced 100644
--- a/nixos/modules/services/x11/desktop-managers/kde4.nix
+++ b/nixos/modules/services/x11/desktop-managers/kde4.nix
@@ -7,6 +7,7 @@ let
xcfg = config.services.xserver;
cfg = xcfg.desktopManager.kde4;
xorg = pkgs.xorg;
+ kde_workspace = config.services.xserver.desktopManager.kde4.kdeWorkspacePackage;
# Disable Nepomuk and Strigi by default. As of KDE 4.7, they don't
# really work very well (e.g. searching files often fails to find
@@ -61,11 +62,18 @@ in
example = ["gstreamer" "vlc"];
description = "Which phonon multimedia backend kde should use";
};
+
+ kdeWorkspacePackage = mkOption {
+ internal = true;
+ default = pkgs.kde4.kde_workspace;
+ type = types.package;
+ description = "Custom kde-workspace, used for NixOS rebranding.";
+ };
};
environment.kdePackages = mkOption {
default = [];
- example = "[ pkgs.kde4.kdesdk ]";
+ example = literalExample "[ pkgs.kde4.kdesdk ]";
type = types.listOf types.package;
description = "This option is obsolete. Please use instead.";
};
@@ -108,13 +116,13 @@ in
fi
# Start KDE.
- exec ${pkgs.kde4.kdebase_workspace}/bin/startkde
+ exec ${kde_workspace}/bin/startkde
'';
};
security.setuidOwners = singleton
{ program = "kcheckpass";
- source = "${pkgs.kde4.kdebase_workspace}/lib/kde4/libexec/kcheckpass";
+ source = "${kde_workspace}/lib/kde4/libexec/kcheckpass";
owner = "root";
group = "root";
setuid = true;
@@ -124,7 +132,7 @@ in
[ pkgs.kde4.kdelibs
pkgs.kde4.kde_baseapps # Splitted kdebase
- pkgs.kde4.kde_workspace
+ kde_workspace
pkgs.kde4.kde_runtime
pkgs.kde4.konsole
pkgs.kde4.kate
@@ -146,8 +154,10 @@ in
pkgs.strigi # used by nepomuk
pkgs.mysql # used by akonadi
]
- ++ [ nepomukConfig ] ++ phononBackendPackages
- ++ config.environment.kdePackages;
+ ++ lib.optional config.hardware.pulseaudio.enable pkgs.kde4.kmix # Perhaps this should always be enabled
+ ++ lib.optional config.hardware.bluetooth.enable pkgs.kde4.bluedevil
+ ++ lib.optional config.networking.networkmanager.enable pkgs.kde4.plasma-nm
+ ++ [ nepomukConfig ] ++ phononBackendPackages;
environment.pathsToLink = [ "/share" ];
diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix
index a72eea76239..a31f66176cc 100644
--- a/nixos/modules/services/x11/desktop-managers/xfce.nix
+++ b/nixos/modules/services/x11/desktop-managers/xfce.nix
@@ -34,10 +34,6 @@ in
# Set GTK_DATA_PREFIX so that GTK+ can find the Xfce themes.
export GTK_DATA_PREFIX=${config.system.path}
- # Necessary to get xfce4-mixer to find GST's ALSA plugin.
- # Ugly.
- export GST_PLUGIN_PATH=${config.system.path}/lib
-
exec ${pkgs.stdenv.shell} ${pkgs.xfce.xinitrc}
'';
};
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix
index 3bf18bd58c8..899c5a91fb3 100644
--- a/nixos/modules/services/x11/display-managers/default.nix
+++ b/nixos/modules/services/x11/display-managers/default.nix
@@ -68,14 +68,14 @@ let
# Start PulseAudio if enabled.
${optionalString (config.hardware.pulseaudio.enable) ''
${optionalString (!config.hardware.pulseaudio.systemWide)
- "${pkgs.pulseaudio}/bin/pulseaudio --start"
+ "${config.hardware.pulseaudio.package}/bin/pulseaudio --start"
}
# Publish access credentials in the root window.
- ${pkgs.pulseaudio}/bin/pactl load-module module-x11-publish "display=$DISPLAY"
+ ${config.hardware.pulseaudio.package}/bin/pactl load-module module-x11-publish "display=$DISPLAY"
# Keep track of devices. Mostly useful for Phonon/KDE.
- ${pkgs.pulseaudio}/bin/pactl load-module module-device-manager "do_routing=1"
+ ${config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1"
''}
# Load X defaults.
@@ -169,7 +169,6 @@ in
xserverBin = mkOption {
type = types.path;
- default = "${xorg.xorgserver}/bin/X";
description = "Path to the X server used by display managers.";
};
@@ -251,14 +250,16 @@ in
execCmd = mkOption {
type = types.str;
- example = "${pkgs.slim}/bin/slim";
+ example = literalExample ''
+ "''${pkgs.slim}/bin/slim"
+ '';
description = "Command to start the display manager.";
};
environment = mkOption {
type = types.attrsOf types.unspecified;
default = {};
- example = { SLIM_CFGFILE = /etc/slim.conf; };
+ example = { SLIM_CFGFILE = "/etc/slim.conf"; };
description = "Additional environment variables needed by the display manager.";
};
@@ -278,4 +279,10 @@ in
};
+ config = {
+
+ services.xserver.displayManager.xserverBin = "${xorg.xorgserver}/bin/X";
+
+ };
+
}
diff --git a/nixos/modules/services/x11/display-managers/gdm.nix b/nixos/modules/services/x11/display-managers/gdm.nix
new file mode 100644
index 00000000000..080588df247
--- /dev/null
+++ b/nixos/modules/services/x11/display-managers/gdm.nix
@@ -0,0 +1,151 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.xserver.displayManager;
+ gnome3 = config.environment.gnome3.packageSet;
+ gdm = gnome3.gdm;
+
+in
+
+{
+
+ ###### interface
+
+ options = {
+
+ services.xserver.displayManager.gdm = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ example = true;
+ description = ''
+ Whether to enable GDM as the display manager.
+ GDM is very experimental and may render system unusable.
+ '';
+ };
+
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = mkIf cfg.gdm.enable {
+
+ services.xserver.displayManager.slim.enable = false;
+
+ users.extraUsers.gdm =
+ { name = "gdm";
+ uid = config.ids.uids.gdm;
+ group = "gdm";
+ home = "/run/gdm";
+ description = "GDM user";
+ };
+
+ users.extraGroups.gdm.gid = config.ids.gids.gdm;
+
+ services.xserver.displayManager.job =
+ {
+ environment = {
+ GDM_X_SERVER = "${cfg.xserverBin} ${cfg.xserverArgs}";
+ GDM_SESSIONS_DIR = "${cfg.session.desktops}";
+ XDG_CONFIG_DIRS = "${gnome3.gnome_settings_daemon}/etc/xdg";
+ };
+ execCmd = "exec ${gdm}/sbin/gdm";
+ };
+
+ # Because sd_login_monitor_new requires /run/systemd/machines
+ systemd.services.display-manager.wants = [ "systemd-machined.service" ];
+ systemd.services.display-manager.after = [ "systemd-machined.service" ];
+
+ systemd.services.display-manager.path = [ gnome3.gnome_shell gnome3.caribou ];
+
+ services.dbus.packages = [ gdm ];
+
+ programs.dconf.profiles.gdm = "${gdm}/share/dconf/profile/gdm";
+
+ # GDM LFS PAM modules, adapted somehow to NixOS
+ security.pam.services = {
+ gdm-launch-environment.text = ''
+ auth required pam_succeed_if.so audit quiet_success user = gdm
+ auth optional pam_permit.so
+
+ account required pam_succeed_if.so audit quiet_success user = gdm
+ account sufficient pam_unix.so
+
+ password required pam_deny.so
+
+ session required pam_succeed_if.so audit quiet_success user = gdm
+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
+ session optional ${pkgs.systemd}/lib/security/pam_systemd.so
+ session optional pam_keyinit.so force revoke
+ session optional pam_permit.so
+ '';
+
+ gdm.text = ''
+ auth requisite pam_nologin.so
+ auth required pam_env.so
+
+ auth required pam_succeed_if.so uid >= 1000 quiet
+ auth optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so
+ auth sufficient pam_unix.so nullok likeauth
+ auth required pam_deny.so
+
+ account sufficient pam_unix.so
+
+ password requisite pam_unix.so nullok sha512
+
+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
+ session required pam_unix.so
+ session required pam_loginuid.so
+ session optional ${pkgs.systemd}/lib/security/pam_systemd.so
+ session optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so auto_start
+ '';
+
+ gdm-password.text = ''
+ auth requisite pam_nologin.so
+ auth required pam_env.so envfile=${config.system.build.pamEnvironment}
+
+ auth required pam_succeed_if.so uid >= 1000 quiet
+ auth optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so
+ auth sufficient pam_unix.so nullok likeauth
+ auth required pam_deny.so
+
+ account sufficient pam_unix.so
+
+ password requisite pam_unix.so nullok sha512
+
+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
+ session required pam_unix.so
+ session required pam_loginuid.so
+ session optional ${pkgs.systemd}/lib/security/pam_systemd.so
+ session optional ${gnome3.gnome_keyring}/lib/security/pam_gnome_keyring.so auto_start
+ '';
+
+ gdm-autologin.text = ''
+ auth requisite pam_nologin.so
+
+ auth required pam_succeed_if.so uid >= 1000 quiet
+ auth required pam_permit.so
+
+ account sufficient pam_unix.so
+
+ password requisite pam_unix.so nullok sha512
+
+ session optional pam_keyinit.so revoke
+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
+ session required pam_unix.so
+ session required pam_loginuid.so
+ session optional ${pkgs.systemd}/lib/security/pam_systemd.so
+ '';
+
+ };
+
+ };
+
+}
diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix
index d459c59b048..98e3fd6d6a5 100644
--- a/nixos/modules/services/x11/display-managers/lightdm.nix
+++ b/nixos/modules/services/x11/display-managers/lightdm.nix
@@ -26,13 +26,12 @@ let
buildInputs = [ pkgs.makeWrapper ];
buildCommand = ''
- ensureDir $out/gtk-3.0/
+ mkdir -p $out/gtk-3.0/
- # This wrapper ensures that we actually get fonts
+ # This wrapper ensures that we actually get ?? (fonts should be OK now)
makeWrapper ${pkgs.lightdm_gtk_greeter}/sbin/lightdm-gtk-greeter \
$out/greeter \
--set XDG_DATA_DIRS ${pkgs.gnome2.gnome_icon_theme}/share \
- --set FONTCONFIG_FILE /etc/fonts/fonts.conf \
--set XDG_CONFIG_HOME $out/
# We need this to ensure that it actually tries to find icons from gnome-icon-theme
diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix
index 48feb12d044..c7fbfa85e33 100644
--- a/nixos/modules/services/x11/display-managers/slim.nix
+++ b/nixos/modules/services/x11/display-managers/slim.nix
@@ -19,6 +19,7 @@ let
reboot_cmd ${config.systemd.package}/sbin/shutdown -r now
${optionalString (cfg.defaultUser != null) ("default_user " + cfg.defaultUser)}
${optionalString cfg.autoLogin "auto_login yes"}
+ ${cfg.extraConfig}
'';
# Unpack the SLiM theme, or use the default.
@@ -27,7 +28,7 @@ let
unpackedTheme = pkgs.stdenv.mkDerivation {
name = "slim-theme";
buildCommand = ''
- ensureDir $out
+ mkdir -p $out
cd $out
unpackFile ${cfg.theme}
ln -s * default
@@ -89,6 +90,15 @@ in
'';
};
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Extra configuration options for SLiM login manager. Do not
+ add options that can be configured directly.
+ '';
+ };
+
};
};
diff --git a/nixos/modules/services/x11/hardware/synaptics.nix b/nixos/modules/services/x11/hardware/synaptics.nix
index f2227a34a20..d9e4bd817a5 100644
--- a/nixos/modules/services/x11/hardware/synaptics.nix
+++ b/nixos/modules/services/x11/hardware/synaptics.nix
@@ -25,12 +25,14 @@ in {
services.xserver.synaptics = {
enable = mkOption {
+ type = types.bool;
default = false;
example = true;
description = "Whether to enable touchpad support.";
};
dev = mkOption {
+ type = types.nullOr types.str;
default = null;
example = "/dev/input/event0";
description =
@@ -41,56 +43,74 @@ in {
};
accelFactor = mkOption {
+ type = types.nullOr types.string;
default = "0.001";
description = "Cursor acceleration (how fast speed increases from minSpeed to maxSpeed).";
};
minSpeed = mkOption {
+ type = types.nullOr types.string;
default = "0.6";
description = "Cursor speed factor for precision finger motion.";
};
maxSpeed = mkOption {
+ type = types.nullOr types.string;
default = "1.0";
description = "Cursor speed factor for highest-speed finger motion.";
};
twoFingerScroll = mkOption {
+ type = types.bool;
default = false;
description = "Whether to enable two-finger drag-scrolling.";
};
vertEdgeScroll = mkOption {
+ type = types.bool;
default = ! cfg.twoFingerScroll;
description = "Whether to enable vertical edge drag-scrolling.";
};
tapButtons = mkOption {
+ type = types.bool;
default = true;
example = false;
description = "Whether to enable tap buttons.";
};
buttonsMap = mkOption {
+ type = types.listOf types.int;
default = [1 2 3];
example = [1 3 2];
description = "Remap touchpad buttons.";
apply = map toString;
};
+ fingersMap = mkOption {
+ type = types.listOf types.int;
+ default = [1 2 3];
+ example = [1 3 2];
+ description = "Remap several-fingers taps.";
+ apply = map toString;
+ };
+
palmDetect = mkOption {
+ type = types.bool;
default = false;
example = true;
description = "Whether to enable palm detection (hardware support required)";
};
horizontalScroll = mkOption {
+ type = types.bool;
default = true;
example = false;
description = "Whether to enable horizontal scrolling (on touchpad)";
};
additionalOptions = mkOption {
+ type = types.str;
default = "";
example = ''
Option "RTCornerButton" "2"
@@ -120,13 +140,16 @@ in {
MatchIsTouchpad "on"
${optionalString (cfg.dev != null) ''MatchDevicePath "${cfg.dev}"''}
Driver "synaptics"
- Option "MinSpeed" "${cfg.minSpeed}"
- Option "MaxSpeed" "${cfg.maxSpeed}"
- Option "AccelFactor" "${cfg.accelFactor}"
+ ${optionalString (cfg.minSpeed != null) ''Option "MinSpeed" "${cfg.minSpeed}"''}
+ ${optionalString (cfg.maxSpeed != null) ''Option "MaxSpeed" "${cfg.maxSpeed}"''}
+ ${optionalString (cfg.accelFactor != null) ''Option "AccelFactor" "${cfg.accelFactor}"''}
${optionalString cfg.tapButtons tapConfig}
Option "ClickFinger1" "${builtins.elemAt cfg.buttonsMap 0}"
Option "ClickFinger2" "${builtins.elemAt cfg.buttonsMap 1}"
Option "ClickFinger3" "${builtins.elemAt cfg.buttonsMap 2}"
+ Option "TapButton1" "${builtins.elemAt cfg.fingersMap 0}"
+ Option "TapButton2" "${builtins.elemAt cfg.fingersMap 1}"
+ Option "TapButton3" "${builtins.elemAt cfg.fingersMap 2}"
Option "VertTwoFingerScroll" "${if cfg.twoFingerScroll then "1" else "0"}"
Option "HorizTwoFingerScroll" "${if cfg.twoFingerScroll then "1" else "0"}"
Option "VertEdgeScroll" "${if cfg.vertEdgeScroll then "1" else "0"}"
diff --git a/nixos/modules/services/x11/window-managers/afterstep.nix b/nixos/modules/services/x11/window-managers/afterstep.nix
new file mode 100644
index 00000000000..395dabb86b5
--- /dev/null
+++ b/nixos/modules/services/x11/window-managers/afterstep.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.windowManager.afterstep;
+in
+{
+ ###### interface
+ options = {
+ services.xserver.windowManager.afterstep.enable = mkOption {
+ default = false;
+ description = "Enable the Afterstep window manager.";
+ };
+ };
+
+ ###### implementation
+ config = mkIf cfg.enable {
+ services.xserver.windowManager.session = singleton {
+ name = "afterstep";
+ start = ''
+ ${pkgs.afterstep}/bin/afterstep &
+ waitPID=$!
+ '';
+ };
+ environment.systemPackages = [ pkgs.afterstep ];
+ };
+}
diff --git a/nixos/modules/services/x11/window-managers/bspwm.nix b/nixos/modules/services/x11/window-managers/bspwm.nix
new file mode 100644
index 00000000000..d234a432e9a
--- /dev/null
+++ b/nixos/modules/services/x11/window-managers/bspwm.nix
@@ -0,0 +1,29 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.windowManager.bspwm;
+in
+
+{
+ options = {
+ services.xserver.windowManager.bspwm.enable = mkOption {
+ type = types.bool;
+ default = false;
+ example = true;
+ description = "Enable the bspwm window manager.";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ services.xserver.windowManager.session = singleton {
+ name = "bspwm";
+ start = "
+ ${pkgs.sxhkd}/bin/sxhkd &
+ ${pkgs.bspwm}/bin/bspwm
+ ";
+ };
+ environment.systemPackages = [ pkgs.bspwm ];
+ };
+}
diff --git a/nixos/modules/services/x11/window-managers/default.nix b/nixos/modules/services/x11/window-managers/default.nix
index f27ba366141..4f2a2309b60 100644
--- a/nixos/modules/services/x11/window-managers/default.nix
+++ b/nixos/modules/services/x11/window-managers/default.nix
@@ -17,6 +17,8 @@ in
./xmonad.nix
./i3.nix
./herbstluftwm.nix
+ ./bspwm.nix
+ ./stumpwm.nix
];
options = {
@@ -59,4 +61,4 @@ in
config = {
services.xserver.displayManager.session = cfg.session;
};
-}
+}
\ No newline at end of file
diff --git a/nixos/modules/services/x11/window-managers/fluxbox.nix b/nixos/modules/services/x11/window-managers/fluxbox.nix
new file mode 100644
index 00000000000..4748ce99ccf
--- /dev/null
+++ b/nixos/modules/services/x11/window-managers/fluxbox.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.windowManager.fluxbox;
+in
+{
+ ###### interface
+ options = {
+ services.xserver.windowManager.fluxbox.enable = mkOption {
+ default = false;
+ description = "Enable the Fluxbox window manager.";
+ };
+ };
+
+ ###### implementation
+ config = mkIf cfg.enable {
+ services.xserver.windowManager.session = singleton {
+ name = "fluxbox";
+ start = ''
+ ${pkgs.fluxbox}/bin/startfluxbox &
+ waitPID=$!
+ '';
+ };
+ environment.systemPackages = [ pkgs.fluxbox ];
+ };
+}
diff --git a/nixos/modules/services/x11/window-managers/openbox.nix b/nixos/modules/services/x11/window-managers/openbox.nix
index 46b1945d33e..8fc759dda68 100644
--- a/nixos/modules/services/x11/window-managers/openbox.nix
+++ b/nixos/modules/services/x11/window-managers/openbox.nix
@@ -1,7 +1,7 @@
-{pkgs, config, ...}:
+{lib, pkgs, config, ...}:
let
- inherit (pkgs.lib) mkOption mkIf;
+ inherit (lib) mkOption mkIf;
cfg = config.services.xserver.windowManager.openbox;
in
diff --git a/nixos/modules/services/x11/window-managers/ratpoison.nix b/nixos/modules/services/x11/window-managers/ratpoison.nix
new file mode 100644
index 00000000000..c203c35cd1b
--- /dev/null
+++ b/nixos/modules/services/x11/window-managers/ratpoison.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.windowManager.ratpoison;
+in
+{
+ ###### interface
+ options = {
+ services.xserver.windowManager.ratpoison.enable = mkOption {
+ default = false;
+ description = "Enable the Ratpoison window manager.";
+ };
+ };
+
+ ###### implementation
+ config = mkIf cfg.enable {
+ services.xserver.windowManager.session = singleton {
+ name = "ratpoison";
+ start = ''
+ ${pkgs.ratpoison}/bin/ratpoison &
+ waitPID=$!
+ '';
+ };
+ environment.systemPackages = [ pkgs.ratpoison ];
+ };
+}
diff --git a/nixos/modules/services/x11/window-managers/stumpwm.nix b/nixos/modules/services/x11/window-managers/stumpwm.nix
new file mode 100644
index 00000000000..a876f13fd21
--- /dev/null
+++ b/nixos/modules/services/x11/window-managers/stumpwm.nix
@@ -0,0 +1,30 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.windowManager.stumpwm;
+in
+
+{
+ options = {
+ services.xserver.windowManager.stumpwm = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ example = true;
+ description = "Enable the stumpwm tiling window manager.";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ services.xserver.windowManager.session = singleton {
+ name = "stumpwm";
+ start = "
+ ${pkgs.stumpwm}/bin/stumpwm
+ ";
+ };
+ environment.systemPackages = [ pkgs.stumpwm ];
+ };
+}
diff --git a/nixos/modules/services/x11/window-managers/windowmaker.nix b/nixos/modules/services/x11/window-managers/windowmaker.nix
new file mode 100644
index 00000000000..27cedb7da0c
--- /dev/null
+++ b/nixos/modules/services/x11/window-managers/windowmaker.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.xserver.windowManager.windowmaker;
+in
+{
+ ###### interface
+ options = {
+ services.xserver.windowManager.windowmaker.enable = mkOption {
+ default = false;
+ description = "Enable the Windowmaker window manager.";
+ };
+ };
+
+ ###### implementation
+ config = mkIf cfg.enable {
+ services.xserver.windowManager.session = singleton {
+ name = "windowmaker";
+ start = ''
+ ${pkgs.windowmaker}/bin/wmaker &
+ waitPID=$!
+ '';
+ };
+ environment.systemPackages = [ pkgs.windowmaker ];
+ };
+}
diff --git a/nixos/modules/services/x11/window-managers/xmonad.nix b/nixos/modules/services/x11/window-managers/xmonad.nix
index 87eff38a028..74acfc21975 100644
--- a/nixos/modules/services/x11/window-managers/xmonad.nix
+++ b/nixos/modules/services/x11/window-managers/xmonad.nix
@@ -1,7 +1,7 @@
-{pkgs, config, ...}:
+{pkgs, lib, config, ...}:
let
- inherit (pkgs.lib) mkOption mkIf optionals literalExample;
+ inherit (lib) mkOption mkIf optionals literalExample;
cfg = config.services.xserver.windowManager.xmonad;
xmonadEnv = cfg.haskellPackages.ghcWithPackages(self: [
self.xmonad
@@ -48,7 +48,7 @@ in
enableContribAndExtras = mkOption {
default = false;
example = true;
- type = pkgs.lib.types.bool;
+ type = lib.types.bool;
description = "Enable xmonad-{contrib,extras} in Xmonad.";
};
};
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index 5f3e8003b45..f911d3c81f9 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -13,7 +13,6 @@ let
# 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 ]; };
unichrome = { modules = [ pkgs.xorgVideoUnichrome ]; };
virtualbox = { modules = [ kernelPackages.virtualboxGuestAdditions ]; driverName = "vboxvideo"; };
@@ -151,7 +150,7 @@ in
modules = mkOption {
type = types.listOf types.path;
default = [];
- example = [ pkgs.xf86_input_wacom ];
+ example = literalExample "[ pkgs.xf86_input_wacom ]";
description = "Packages to be added to the module search path of the X server.";
};
@@ -201,7 +200,7 @@ in
vaapiDrivers = mkOption {
type = types.listOf types.path;
default = [ ];
- example = "[ pkgs.vaapiIntel pkgs.vaapiVdpau ]";
+ example = literalExample "[ pkgs.vaapiIntel pkgs.vaapiVdpau ]";
description = ''
Packages providing libva acceleration drivers.
'';
@@ -400,8 +399,8 @@ in
services.xserver.drivers = flip concatMap cfg.videoDrivers (name:
let driver =
attrByPath [name]
- (if (hasAttr ("xf86video" + name) xorg)
- then { modules = [(getAttr ("xf86video" + name) xorg) ]; }
+ (if xorg ? ${"xf86video" + name}
+ then { modules = [xorg.${"xf86video" + name}]; }
else null)
knownVideoDrivers;
in optional (driver != null) ({ inherit name; driverName = name; } // driver));
@@ -444,8 +443,7 @@ in
pkgs.xterm
pkgs.xdg_utils
]
- ++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh
- ++ optional (elem "ati_unfree" cfg.videoDrivers) kernelPackages.ati_drivers_x11;
+ ++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh;
environment.pathsToLink =
[ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ];
@@ -460,13 +458,11 @@ in
restartIfChanged = false;
environment =
- { 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.
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;
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index b1bad956b4b..2e5a70b3aa5 100644
--- a/nixos/modules/system/activation/activation-script.nix
+++ b/nixos/modules/system/activation/activation-script.nix
@@ -66,6 +66,9 @@ in
PATH=$PATH:$i/bin:$i/sbin
done
+ _status=0
+ trap "_status=1" ERR
+
# Ensure a consistent umask.
umask 0022
@@ -84,6 +87,8 @@ in
# Prevent the current configuration from being garbage-collected.
ln -sfn /run/current-system /nix/var/nix/gcroots/current-system
+
+ exit $_status
'';
};
diff --git a/nixos/modules/system/boot/emergency-mode.nix b/nixos/modules/system/boot/emergency-mode.nix
new file mode 100644
index 00000000000..9cdab841619
--- /dev/null
+++ b/nixos/modules/system/boot/emergency-mode.nix
@@ -0,0 +1,37 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ systemd.enableEmergencyMode = mkOption {
+ default = true;
+ type = types.bool;
+ description = ''
+ Whether to enable emergency mode, which is an
+ sulogin shell started on the console if
+ mounting a filesystem fails. Since some machines (like EC2
+ instances) have no console of any kind, emergency mode doesn't
+ make sense, and it's better to continue with the boot insofar
+ as possible.
+ '';
+ };
+
+ };
+
+ ###### implementation
+
+ config = {
+
+ systemd.additionalUpstreamSystemUnits = optionals
+ config.systemd.enableEmergencyMode [
+ "emergency.target" "emergency.service"
+ ];
+
+ };
+
+}
\ No newline at end of file
diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix
index 9beb7fabce1..79b173a6ead 100644
--- a/nixos/modules/system/boot/kernel.nix
+++ b/nixos/modules/system/boot/kernel.nix
@@ -195,6 +195,7 @@ in
"xhci_hcd"
"usbhid"
"hid_generic"
+ "hid_apple" "hid_logitech_dj" "hid_lenovo_tpkbd" "hid_roccat"
# Unix domain sockets (needed by udev).
"unix"
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index 0cc060db8f9..3ea00e40c3b 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -6,7 +6,8 @@ let
cfg = config.boot.loader.grub;
- realGrub = if cfg.version == 1 then pkgs.grub else pkgs.grub2;
+ realGrub = if cfg.version == 1 then pkgs.grub
+ else pkgs.grub2.override { zfsSupport = cfg.zfsSupport; };
grub =
# Don't include GRUB if we're only generating a GRUB menu (e.g.,
@@ -25,11 +26,12 @@ let
inherit (cfg)
version extraConfig extraPerEntryConfig extraEntries
extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
- default devices explicitBootRoot;
+ default devices fsIdentifier;
path = (makeSearchPath "bin" [
- pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils
+ pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils pkgs.btrfsProgs
+ pkgs.utillinux
]) + ":" + (makeSearchPath "sbin" [
- pkgs.mdadm
+ pkgs.mdadm pkgs.utillinux
]);
});
@@ -209,12 +211,35 @@ in
'';
};
- explicitBootRoot = mkOption {
- default = "";
- type = types.str;
+ fsIdentifier = mkOption {
+ default = "uuid";
+ type = types.addCheck types.str
+ (type: type == "uuid" || type == "label" || type == "provided");
description = ''
- The relative path of /boot within the parent volume. Leave empty
- if /boot is not a btrfs subvolume.
+ Determines how grub will identify devices when generating the
+ configuration file. A value of uuid / label signifies that grub
+ will always resolve the uuid or label of the device before using
+ it in the configuration. A value of provided means that grub will
+ use the device name as show in df or
+ mount. Note, zfs zpools / datasets are ignored
+ and will always be mounted using their labels.
+ '';
+ };
+
+ zfsSupport = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Whether grub should be build against libzfs.
+ '';
+ };
+
+ enableCryptodisk = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Enable support for encrypted partitions. Grub should automatically
+ unlock the correct encrypted partition and look for filesystems.
'';
};
@@ -244,7 +269,8 @@ in
if cfg.devices == [] then
throw "You must set the option ‘boot.loader.grub.device’ to make the system bootable."
else
- "PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " +
+ "PERL5LIB=${makePerlPath (with pkgs.perlPackages; [ FileSlurp XMLLibXML XMLSAX ])} " +
+ (if cfg.enableCryptodisk then "GRUB_ENABLE_CRYPTODISK=y " else "") +
"${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
system.build.grub = grub;
@@ -260,6 +286,13 @@ in
${pkgs.coreutils}/bin/cp -pf "${v}" "/boot/${n}"
'') config.boot.loader.grub.extraFiles);
+ assertions = [{ assertion = !cfg.zfsSupport || cfg.version == 2;
+ message = "Only grub version 2 provides zfs support";}]
+ ++ flip map cfg.devices (dev: {
+ assertion = dev == "nodev" || hasPrefix "/" dev;
+ message = "Grub devices must be absolute paths, not ${dev}";
+ });
+
})
];
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index c3aa8518b8b..981b60c004c 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -1,10 +1,12 @@
use strict;
use warnings;
+use Class::Struct;
use XML::LibXML;
use File::Basename;
use File::Path;
use File::stat;
use File::Copy;
+use File::Slurp;
use POSIX;
use Cwd;
@@ -27,6 +29,14 @@ sub writeFile {
close FILE or die;
}
+sub runCommand {
+ my ($cmd) = @_;
+ open FILE, "$cmd 2>/dev/null |" or die "Failed to execute: $cmd\n";
+ my @ret = ;
+ close FILE;
+ return ($?, @ret);
+}
+
my $grub = get("grub");
my $grubVersion = int(get("version"));
my $extraConfig = get("extraConfig");
@@ -39,7 +49,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");
+my $fsIdentifier = get("fsIdentifier");
$ENV{'PATH'} = get("path");
die "unsupported GRUB version\n" if $grubVersion != 1 && $grubVersion != 2;
@@ -48,24 +58,151 @@ print STDERR "updating GRUB $grubVersion menu...\n";
mkpath("/boot/grub", 0, 0700);
-
# Discover whether /boot is on the same filesystem as / and
# /nix/store. If not, then all kernels and initrds must be copied to
-# /boot, and all paths in the GRUB config file must be relative to the
-# root of the /boot filesystem. `$bootRoot' is the path to be
-# prepended to paths under /boot.
-my $bootRoot = "/boot";
-if (stat("/")->dev != stat("/boot")->dev) {
- $bootRoot = "";
- $copyKernels = 1;
-} elsif (stat("/boot")->dev != stat("/nix/store")->dev) {
+# /boot.
+if (stat("/boot")->dev != stat("/nix/store")->dev) {
$copyKernels = 1;
}
-if ($explicitBootRoot ne "") {
- $bootRoot = $explicitBootRoot;
+# Discover information about the location of /boot
+struct(Fs => {
+ device => '$',
+ type => '$',
+ mount => '$',
+});
+sub PathInMount {
+ my ($path, $mount) = @_;
+ my @splitMount = split /\//, $mount;
+ my @splitPath = split /\//, $path;
+ if ($#splitPath < $#splitMount) {
+ return 0;
+ }
+ for (my $i = 0; $i <= $#splitMount; $i++) {
+ if ($splitMount[$i] ne $splitPath[$i]) {
+ return 0;
+ }
+ }
+ return 1;
}
+sub GetFs {
+ my ($dir) = @_;
+ my $bestFs = Fs->new(device => "", type => "", mount => "");
+ foreach my $fs (read_file("/proc/self/mountinfo")) {
+ chomp $fs;
+ my @fields = split / /, $fs;
+ my $mountPoint = $fields[4];
+ next unless -d $mountPoint;
+ my @mountOptions = split /,/, $fields[5];
+ # Skip the optional fields.
+ my $n = 6; $n++ while $fields[$n] ne "-"; $n++;
+ my $fsType = $fields[$n];
+ my $device = $fields[$n + 1];
+ my @superOptions = split /,/, $fields[$n + 2];
+
+ # Skip the read-only bind-mount on /nix/store.
+ next if $mountPoint eq "/nix/store" && (grep { $_ eq "rw" } @superOptions) && (grep { $_ eq "ro" } @mountOptions);
+
+ # Ensure this matches the intended directory
+ next unless PathInMount($dir, $mountPoint);
+
+ # Is it better than our current match?
+ if (length($mountPoint) > length($bestFs->mount)) {
+ $bestFs = Fs->new(device => $device, type => $fsType, mount => $mountPoint);
+ }
+ }
+ return $bestFs;
+}
+struct (Grub => {
+ path => '$',
+ search => '$',
+});
+my $driveid = 1;
+sub GrubFs {
+ my ($dir) = @_;
+ my $fs = GetFs($dir);
+ my $path = "/" . substr($dir, length($fs->mount));
+ my $search = "";
+
+ if ($grubVersion > 1) {
+ # ZFS is completely separate logic as zpools are always identified by a label
+ # or custom UUID
+ if ($fs->type eq 'zfs') {
+ my $sid = index($fs->device, '/');
+
+ if ($sid < 0) {
+ $search = '--label ' . $fs->device;
+ $path = '/@' . $path;
+ } else {
+ $search = '--label ' . substr($fs->device, 0, $sid);
+ $path = '/' . substr($fs->device, $sid) . '/@' . $path;
+ }
+ } else {
+ my %types = ('uuid' => '--fs-uuid', 'label' => '--label');
+
+ if ($fsIdentifier eq 'provided') {
+ # If the provided dev is identifying the partition using a label or uuid,
+ # we should get the label / uuid and do a proper search
+ my @matches = $fs->device =~ m/\/dev\/disk\/by-(label|uuid)\/(.*)/;
+ if ($#matches > 1) {
+ die "Too many matched devices"
+ } elsif ($#matches == 1) {
+ $search = "$types{$matches[0]} $matches[1]"
+ }
+ } else {
+ # Determine the identifying type
+ $search = $types{$fsIdentifier} . ' ';
+
+ # Based on the type pull in the identifier from the system
+ my ($status, @devInfo) = runCommand("blkid -o export @{[$fs->device]}");
+ if ($status != 0) {
+ die "Failed to get blkid info for @{[$fs->mount]} on @{[$fs->device]}";
+ }
+ my @matches = join("", @devInfo) =~ m/@{[uc $fsIdentifier]}=([^\n]*)/;
+ if ($#matches != 0) {
+ die "Couldn't find a $types{$fsIdentifier} for @{[$fs->device]}\n"
+ }
+ $search .= $matches[0];
+ }
+
+ # BTRFS is a special case in that we need to fix the referrenced path based on subvolumes
+ if ($fs->type eq 'btrfs') {
+ my ($status, @id_info) = runCommand("btrfs subvol show @{[$fs->mount]}");
+ if ($status != 0) {
+ die "Failed to retrieve subvolume info for @{[$fs->mount]}\n";
+ }
+ my @ids = join("", @id_info) =~ m/Object ID:[ \t\n]*([^ \t\n]*)/;
+ if ($#ids > 0) {
+ die "Btrfs subvol name for @{[$fs->device]} listed multiple times in mount\n"
+ } elsif ($#ids == 0) {
+ my ($status, @path_info) = runCommand("btrfs subvol list @{[$fs->mount]}");
+ if ($status != 0) {
+ die "Failed to find @{[$fs->mount]} subvolume id from btrfs\n";
+ }
+ my @paths = join("", @path_info) =~ m/ID $ids[0] [^\n]* path ([^\n]*)/;
+ if ($#paths > 0) {
+ die "Btrfs returned multiple paths for a single subvolume id, mountpoint @{[$fs->mount]}\n";
+ } elsif ($#paths != 0) {
+ die "Btrfs did not return a path for the subvolume at @{[$fs->mount]}\n";
+ }
+ $path = "/$paths[0]$path";
+ }
+ }
+ }
+ if (not $search eq "") {
+ $search = "search --set=drive$driveid " . $search;
+ $path = "(\$drive$driveid)$path";
+ $driveid += 1;
+ }
+ }
+ return Grub->new(path => $path, search => $search);
+}
+my $grubBoot = GrubFs("/boot");
+my $grubStore;
+if ($copyKernels == 0) {
+ $grubStore = GrubFs("/nix/store");
+}
# Generate the header.
my $conf .= "# Automatically generated. DO NOT EDIT THIS FILE!\n";
@@ -77,12 +214,17 @@ if ($grubVersion == 1) {
";
if ($splashImage) {
copy $splashImage, "/boot/background.xpm.gz" or die "cannot copy $splashImage to /boot\n";
- $conf .= "splashimage $bootRoot/background.xpm.gz\n";
+ $conf .= "splashimage " . $grubBoot->path . "/background.xpm.gz\n";
}
}
else {
+ if ($copyKernels == 0) {
+ $conf .= "
+ " . $grubStore->search;
+ }
$conf .= "
+ " . $grubBoot->search . "
if [ -s \$prefix/grubenv ]; then
load_env
fi
@@ -103,7 +245,7 @@ else {
set timeout=$timeout
fi
- if loadfont $bootRoot/grub/fonts/unicode.pf2; then
+ if loadfont " . $grubBoot->path . "/grub/fonts/unicode.pf2; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
@@ -117,7 +259,7 @@ else {
copy $splashImage, "/boot/background.png" or die "cannot copy $splashImage to /boot\n";
$conf .= "
insmod png
- if background_image $bootRoot/background.png; then
+ if background_image " . $grubBoot->path . "/background.png; then
set color_normal=white/black
set color_highlight=black/white
else
@@ -139,7 +281,7 @@ mkpath("/boot/kernels", 0, 0755) if $copyKernels;
sub copyToKernelsDir {
my ($path) = @_;
- return $path unless $copyKernels;
+ return $grubStore->path . substr($path, length("/nix/store")) unless $copyKernels;
$path =~ /\/nix\/store\/(.*)/ or die;
my $name = $1; $name =~ s/\//-/g;
my $dst = "/boot/kernels/$name";
@@ -152,7 +294,7 @@ sub copyToKernelsDir {
rename $tmp, $dst or die "cannot rename $tmp to $dst\n";
}
$copied{$dst} = 1;
- return "$bootRoot/kernels/$name";
+ return $grubBoot->path . "/kernels/$name";
}
sub addEntry {
@@ -179,6 +321,10 @@ sub addEntry {
$conf .= " " . ($xen ? "module" : "initrd") . " $initrd\n\n";
} else {
$conf .= "menuentry \"$name\" {\n";
+ $conf .= $grubBoot->search . "\n";
+ if ($copyKernels == 0) {
+ $conf .= $grubStore->search . "\n";
+ }
$conf .= " $extraPerEntryConfig\n" if $extraPerEntryConfig;
$conf .= " multiboot $xen $xenParams\n" if $xen;
$conf .= " " . ($xen ? "module" : "linux") . " $kernel $kernelParams\n";
@@ -196,7 +342,7 @@ addEntry("NixOS - Default", $defaultConfig);
$conf .= "$extraEntries\n" unless $extraEntriesBeforeNixOS;
# extraEntries could refer to @bootRoot@, which we have to substitute
-$conf =~ s/\@bootRoot\@/$bootRoot/g;
+$conf =~ s/\@bootRoot\@/$grubBoot->path/g;
# Emit submenus for all system profiles.
sub addProfile {
diff --git a/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix b/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix
index e7a481e90a7..003f72b37f9 100644
--- a/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix
+++ b/nixos/modules/system/boot/loader/gummiboot/gummiboot.nix
@@ -16,7 +16,7 @@ let
nix = config.nix.package;
- inherit (cfg) timeout;
+ timeout = if cfg.timeout != null then cfg.timeout else "";
inherit (efi) efiSysMountPoint canTouchEfiVariables;
};
diff --git a/nixos/modules/system/boot/luksroot.nix b/nixos/modules/system/boot/luksroot.nix
index c923cc49c44..70ff1d588a3 100644
--- a/nixos/modules/system/boot/luksroot.nix
+++ b/nixos/modules/system/boot/luksroot.nix
@@ -342,40 +342,39 @@ in
description = "Path where the ramfs used to update the LUKS key will be mounted in stage-1";
};
- storage = mkOption {
- type = types.optionSet;
- description = "Options related to the storing the salt";
+ /* TODO: Add to the documentation of the current module:
- options = {
- device = mkOption {
- default = /dev/sda1;
- type = types.path;
- description = ''
- An unencrypted device that will temporarily be mounted in stage-1.
- Must contain the current salt to create the challenge for this LUKS device.
- '';
- };
+ Options related to the storing the salt.
+ */
+ storage = {
+ device = mkOption {
+ default = "/dev/sda1";
+ type = types.path;
+ description = ''
+ An unencrypted device that will temporarily be mounted in stage-1.
+ Must contain the current salt to create the challenge for this LUKS device.
+ '';
+ };
- fsType = mkOption {
- default = "vfat";
- type = types.string;
- description = "The filesystem of the unencrypted device";
- };
+ fsType = mkOption {
+ default = "vfat";
+ type = types.string;
+ description = "The filesystem of the unencrypted device";
+ };
- mountPoint = mkOption {
- default = "/crypt-storage";
- type = types.string;
- description = "Path where the unencrypted device will be mounted in stage-1";
- };
+ mountPoint = mkOption {
+ default = "/crypt-storage";
+ type = types.string;
+ description = "Path where the unencrypted device will be mounted in stage-1";
+ };
- path = mkOption {
- default = "/crypt-storage/default";
- type = types.string;
- description = ''
- Absolute path of the salt on the unencrypted device with
- that device's root directory as "/".
- '';
- };
+ path = mkOption {
+ default = "/crypt-storage/default";
+ type = types.string;
+ description = ''
+ Absolute path of the salt on the unencrypted device with
+ that device's root directory as "/".
+ '';
};
};
};
diff --git a/nixos/modules/system/boot/modprobe.nix b/nixos/modules/system/boot/modprobe.nix
index 7b214cd1e1f..eaf8cf1ecd6 100644
--- a/nixos/modules/system/boot/modprobe.nix
+++ b/nixos/modules/system/boot/modprobe.nix
@@ -68,20 +68,20 @@ with lib;
config = mkIf (!config.boot.isContainer) {
- environment.etc = [
- { source = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf";
- target = "modprobe.d/ubuntu.conf";
- }
- { source = pkgs.writeText "modprobe.conf"
- ''
- ${flip concatMapStrings config.boot.blacklistedKernelModules (name: ''
- blacklist ${name}
- '')}
- ${config.boot.extraModprobeConfig}
- '';
- target = "modprobe.d/nixos.conf";
- }
- ];
+ environment.etc."modprobe.d/ubuntu.conf".source = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf";
+
+ environment.etc."modprobe.d/nixos.conf".text =
+ ''
+ ${flip concatMapStrings config.boot.blacklistedKernelModules (name: ''
+ blacklist ${name}
+ '')}
+ ${config.boot.extraModprobeConfig}
+ '';
+ environment.etc."modprobe.d/usb-load-ehci-first.conf".text =
+ ''
+ softdep uhci_hcd pre: ehci_hcd
+ softdep ohci_hcd pre: ehci_hcd
+ '';
environment.systemPackages = [ config.system.sbin.modprobe pkgs.kmod ];
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index 7adb932aba7..5a9beeeafa1 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -4,7 +4,8 @@ targetRoot=/mnt-root
console=tty1
export LD_LIBRARY_PATH=@extraUtils@/lib
-export PATH=@extraUtils@/bin:@extraUtils@/sbin
+export PATH=@extraUtils@/bin
+ln -s @extraUtils@/bin /bin
fail() {
@@ -167,9 +168,24 @@ if test -e /sys/power/tuxonice/resume; then
fi
fi
-if test -n "@resumeDevice@" -a -e /sys/power/resume -a -e /sys/power/disk; then
- echo "@resumeDevice@" > /sys/power/resume 2> /dev/null || echo "failed to resume..."
- echo shutdown > /sys/power/disk
+if test -e /sys/power/resume -a -e /sys/power/disk; then
+ if test -n "@resumeDevice@"; then
+ resumeDev="@resumeDevice@"
+ else
+ for sd in @resumeDevices@; do
+ # Try to detect resume device. According to Ubuntu bug:
+ # https://bugs.launchpad.net/ubuntu/+source/pm-utils/+bug/923326/comments/1
+ # When there are multiple swap devices, we can't know where will hibernate
+ # image reside. We can check all of them for swsuspend blkid.
+ if [ "$(udevadm info -q property "$sd" | sed -n 's/^ID_FS_TYPE=//p')" = "swsuspend" ]; then
+ resumeDev="$sd"
+ break
+ fi
+ done
+ fi
+ if test -n "$resumeDev"; then
+ echo "$resumeDev" > /sys/power/resume 2> /dev/null || echo "failed to resume..."
+ fi
fi
@@ -193,6 +209,9 @@ checkFS() {
# Don't check ROM filesystems.
if [ "$fsType" = iso9660 -o "$fsType" = udf ]; then return 0; fi
+ # Don't check resilient COWs as they validate the fs structures at mount time
+ if [ "$fsType" = btrfs -o "$fsType" = zfs ]; then return 0; fi
+
# If we couldn't figure out the FS type, then skip fsck.
if [ "$fsType" = auto ]; then
echo 'cannot check filesystem with type "auto"!'
@@ -262,6 +281,13 @@ mountFS() {
checkFS "$device" "$fsType"
+ # Create backing directories for unionfs-fuse.
+ if [ "$fsType" = unionfs-fuse ]; then
+ for i in $(IFS=:; echo ${options##*,dirs=}); do
+ mkdir -m 0700 -p /mnt-root"${i%=*}"
+ done
+ fi
+
echo "mounting $device on $mountPoint..."
mkdir -p "/mnt-root$mountPoint" || true
@@ -342,6 +368,14 @@ exec 3>&-
@postMountCommands@
+# Emit a udev rule for /dev/root to prevent systemd from complaining.
+eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=$targetRoot || true)
+if [ "$ROOT_MAJOR" -a "$ROOT_MINOR" -a "$ROOT_MAJOR" != 0 ]; then
+ mkdir -p /run/udev/rules.d
+ echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > /run/udev/rules.d/61-dev-root-link.rules
+fi
+
+
# Stop udevd.
udevadm control --exit || true
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index b6249b6c091..74087c0ce63 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -23,22 +23,6 @@ let
};
- needsCifsUtils = kernelPackages.kernel ? features
- && kernelPackages.kernel.features ? needsCifsUtils
- && kernelPackages.kernel.features.needsCifsUtils
- && any (fs: fs.fsType == "cifs") fileSystems;
-
- busybox =
- if needsCifsUtils
- then pkgs.busybox.override {
- extraConfig = ''
- CONFIG_FEATURE_MOUNT_CIFS n
- CONFIG_FEATURE_MOUNT_HELPERS y
- '';
- }
- else pkgs.busybox;
-
-
# Some additional utilities needed in stage 1, like mount, lvm, fsck
# etc. We don't want to bring in all of those packages, so we just
# copy what we need. Instead of using statically linked binaries,
@@ -50,7 +34,10 @@ let
doublePatchelf = pkgs.stdenv.isArm;
}
''
+ set +o pipefail
+
mkdir -p $out/bin $out/lib
+ ln -s $out/bin $out/sbin
# Copy what we need from Glibc.
cp -pv ${pkgs.glibc}/lib/ld*.so.? $out/lib
@@ -62,11 +49,10 @@ let
cp -pv ${pkgs.gcc.gcc}/lib*/libgcc_s.so.* $out/lib
# Copy BusyBox.
- cp -rvd ${busybox}/{bin,sbin} $out/
- chmod -R u+w $out
+ cp -pvd ${pkgs.busybox}/bin/* ${pkgs.busybox}/sbin/* $out/bin/
# Copy some utillinux stuff.
- cp -v ${pkgs.utillinux}/sbin/blkid $out/bin
+ cp -vf --remove-destination ${pkgs.utillinux}/sbin/blkid $out/bin
cp -pdv ${pkgs.utillinux}/lib/libblkid*.so.* $out/lib
cp -pdv ${pkgs.utillinux}/lib/libuuid*.so.* $out/lib
@@ -89,12 +75,7 @@ let
# Copy modprobe.
cp -v ${pkgs.kmod}/bin/kmod $out/bin/
- ln -s kmod $out/bin/modprobe
-
- # Maybe copy cifs utils
- ${optionalString needsCifsUtils ''
- cp -v ${pkgs.cifs_utils}/sbin/mount.cifs $out/bin
- ''}
+ ln -sf kmod $out/bin/modprobe
${config.boot.initrd.extraUtilsCommands}
@@ -140,7 +121,7 @@ let
udevRules = pkgs.stdenv.mkDerivation {
name = "udev-rules";
buildCommand = ''
- ensureDir $out
+ mkdir -p $out
echo 'ENV{LD_LIBRARY_PATH}="${extraUtils}/lib"' > $out/00-env.rules
@@ -202,6 +183,9 @@ let
inherit (config.boot.initrd) checkJournalingFS
preLVMCommands postDeviceCommands postMountCommands kernelModules;
+ resumeDevices = map (sd: if sd ? device then sd.device else "/dev/disk/by-label/${sd.label}")
+ (filter (sd: sd ? label || hasPrefix "/dev/" sd.device) config.swapDevices);
+
fsInfo =
let f = fs: [ fs.mountPoint (if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}") fs.fsType fs.options ];
in pkgs.writeText "initrd-fsinfo" (concatStringsSep "\n" (concatMap f fileSystems));
@@ -220,6 +204,18 @@ let
{ object = pkgs.writeText "mdadm.conf" config.boot.initrd.mdadmConf;
symlink = "/etc/mdadm.conf";
}
+ { object = pkgs.stdenv.mkDerivation {
+ name = "initrd-kmod-blacklist-ubuntu";
+ builder = pkgs.writeText "builder.sh" ''
+ source $stdenv/setup
+ target=$out
+
+ ${pkgs.perl}/bin/perl -0pe 's/## file: iwlwifi.conf(.+?)##/##/s;' $src > $out
+ '';
+ src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf";
+ };
+ symlink = "/etc/modprobe.d/ubuntu.conf";
+ }
];
};
@@ -229,13 +225,14 @@ in
options = {
boot.resumeDevice = mkOption {
- type = types.nullOr types.str;
- default = null;
- example = "8:2";
+ type = types.str;
+ default = "";
+ example = "/dev/sda3";
description = ''
- Device for manual resume attempt during boot, specified using
- the device's major and minor number as
- major:minor.
+ Device for manual resume attempt during boot. This should be used primarily
+ if you want to resume from file. Specify here the device where the file
+ resides. You should also use boot.kernelParams to specify
+ resume_offset.
'';
};
@@ -313,6 +310,13 @@ in
example = "xz";
};
+ boot.initrd.supportedFilesystems = mkOption {
+ default = [ ];
+ example = [ "btrfs" ];
+ type = types.listOf types.string;
+ description = "Names of supported filesystem types in the initial ramdisk.";
+ };
+
fileSystems = mkOption {
options.neededForBoot = mkOption {
default = false;
@@ -344,8 +348,7 @@ in
(isYes "BLK_DEV_INITRD")
];
- # Prevent systemd from waiting for the /dev/root symlink.
- systemd.units."dev-root.device".text = "";
+ boot.initrd.supportedFilesystems = map (fs: fs.fsType) fileSystems;
};
}
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index eff2fb583ba..6fff776f858 100644
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -29,7 +29,9 @@ setPath "@path@"
# Normally, stage 1 mounts the root filesystem read/writable.
# However, in some environments, stage 2 is executed directly, and the
# root is read-only. So make it writable here.
-mount -n -o remount,rw /
+if [ "$container" != systemd-nspawn ]; then
+ mount -n -o remount,rw none /
+fi
# Likewise, stage 1 mounts /proc, /dev and /sys, so if we don't have a
@@ -98,12 +100,6 @@ mkdir -m 0755 -p /etc/nixos
rm -rf /var/run /var/lock
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"
-fi
-
# Also get rid of temporary GC roots.
rm -rf /nix/var/nix/gcroots/tmp /nix/var/nix/temproots
@@ -186,4 +182,4 @@ echo "starting systemd..."
PATH=/run/current-system/systemd/lib/systemd \
MODULE_DIR=/run/booted-system/kernel-modules/lib/modules \
LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive \
- exec systemd --log-target=journal # --log-level=debug --log-target=console --crash-shell
+ exec systemd
diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix
index f53c3b8b8e7..6155bb37cc5 100644
--- a/nixos/modules/system/boot/stage-2.nix
+++ b/nixos/modules/system/boot/stage-2.nix
@@ -17,7 +17,7 @@ let
src = ./stage-2-init.sh;
shellDebug = "${pkgs.bashInteractive}/bin/bash";
isExecutable = true;
- inherit (config.boot) devShmSize runSize cleanTmpDir;
+ inherit (config.boot) devShmSize runSize;
inherit (config.nix) readOnlyStore;
inherit (config.networking) useHostResolvConf;
ttyGid = config.ids.gids.tty;
@@ -26,8 +26,7 @@ let
pkgs.utillinux
pkgs.sysvtools
pkgs.openresolv
- ] ++ (optional config.boot.cleanTmpDir pkgs.findutils)
- ++ optional config.nix.readOnlyStore readonlyMountpoint;
+ ] ++ optional config.nix.readOnlyStore readonlyMountpoint;
postBootCommands = pkgs.writeText "local-cmds"
''
${config.boot.postBootCommands}
@@ -81,15 +80,6 @@ in
'';
};
- # FIXME: should replace this with something that uses systemd-tmpfiles.
- cleanTmpDir = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Whether to delete all files in /tmp during boot.
- '';
- };
-
};
};
diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix
index a6183c47eb1..07f3cb9e952 100644
--- a/nixos/modules/system/boot/systemd-unit-options.nix
+++ b/nixos/modules/system/boot/systemd-unit-options.nix
@@ -6,8 +6,8 @@ let
checkService = v:
let assertValueOneOf = name: values: attr:
- let val = getAttr name attr;
- in optional ( hasAttr name attr && !elem val values) "Systemd service field `${name}' cannot have value `${val}'.";
+ let val = attr.${name};
+ in optional (attr ? ${name} && !elem val values) "Systemd service field `${name}' cannot have value `${val}'.";
checkType = assertValueOneOf "Type" ["simple" "forking" "oneshot" "dbus" "notify" "idle"];
checkRestart = assertValueOneOf "Restart" ["no" "on-success" "on-failure" "on-abort" "always"];
errors = concatMap (c: c v) [checkType checkRestart];
@@ -230,6 +230,15 @@ in rec {
'';
};
+ reload = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Shell commands executed when the service's main process
+ is reloaded.
+ '';
+ };
+
preStop = mkOption {
type = types.lines;
default = "";
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 51ebca7dd43..8a86149a9e1 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -10,15 +10,19 @@ let
systemd = cfg.package;
+
makeUnit = name: unit:
+ let
+ pathSafeName = lib.replaceChars ["@" "\\"] ["-" "-"] name;
+ in
if unit.enable then
- pkgs.runCommand "unit" { preferLocalBuild = true; inherit (unit) text; }
+ pkgs.runCommand "unit-${pathSafeName}" { preferLocalBuild = true; inherit (unit) text; }
''
mkdir -p $out
echo -n "$text" > $out/${shellEscape name}
''
else
- pkgs.runCommand "unit" { preferLocalBuild = true; }
+ pkgs.runCommand "unit-${pathSafeName}-disabled" { preferLocalBuild = true; }
''
mkdir -p $out
ln -s /dev/null $out/${shellEscape name}
@@ -81,6 +85,7 @@ let
"systemd-journal-flush.service"
"systemd-journal-gatewayd.socket"
"systemd-journal-gatewayd.service"
+ "systemd-journald-dev-log.socket"
"syslog.socket"
# SysV init compatibility.
@@ -162,10 +167,7 @@ let
"systemd-sysctl.service"
]
- ++ optionals cfg.enableEmergencyMode [
- "emergency.target"
- "emergency.service"
- ];
+ ++ cfg.additionalUpstreamSystemUnits;
upstreamSystemWants =
[ #"basic.target.wants"
@@ -248,6 +250,12 @@ let
${config.postStart}
'';
})
+ (mkIf (config.reload != "")
+ { serviceConfig.ExecReload = makeJobScript "${name}-reload" ''
+ #! ${pkgs.stdenv.shell} -e
+ ${config.reload}
+ '';
+ })
(mkIf (config.preStop != "")
{ serviceConfig.ExecStop = makeJobScript "${name}-pre-stop" ''
#! ${pkgs.stdenv.shell} -e
@@ -317,7 +325,9 @@ let
''
[Service]
${let env = cfg.globalEnvironment // def.environment;
- in concatMapStrings (n: "Environment=\"${n}=${getAttr n env}\"\n") (attrNames env)}
+ in concatMapStrings (n:
+ let s = "Environment=\"${n}=${env.${n}}\"\n";
+ in if stringLength s >= 2048 then throw "The value of the environment variable ‘${n}’ in systemd service ‘${name}.service’ is too long." else s) (attrNames env)}
${if def.reloadIfChanged then ''
X-ReloadIfChanged=true
'' else if !def.restartIfChanged then ''
@@ -635,19 +645,6 @@ in
'';
};
- systemd.enableEmergencyMode = mkOption {
- default = true;
- type = types.bool;
- description = ''
- Whether to enable emergency mode, which is an
- sulogin shell started on the console if
- mounting a filesystem fails. Since some machines (like EC2
- instances) have no console of any kind, emergency mode doesn't
- make sense, and it's better to continue with the boot insofar
- as possible.
- '';
- };
-
systemd.tmpfiles.rules = mkOption {
type = types.listOf types.str;
default = [];
@@ -690,6 +687,15 @@ in
description = "Definition of systemd per-user socket units.";
};
+ systemd.additionalUpstreamSystemUnits = mkOption {
+ default = [ ];
+ type = types.listOf types.str;
+ example = [ "debug-shell.service" "systemd-quotacheck.service" ];
+ description = ''
+ Additional units shipped with systemd that shall be enabled.
+ '';
+ };
+
};
@@ -749,7 +755,7 @@ in
# Make all journals readable to users in the wheel and adm
# groups, in addition to those in the systemd-journal group.
# Users can always read their own journals.
- ${pkgs.acl}/bin/setfacl -nm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal
+ ${pkgs.acl}/bin/setfacl -nm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal || true
'';
# Target for ‘charon send-keys’ to hook into.
@@ -824,5 +830,8 @@ in
systemd.services."user@".restartIfChanged = false;
+ systemd.services.systemd-remount-fs.restartIfChanged = false;
+ systemd.services.systemd-journal-flush.restartIfChanged = false;
+
};
}
diff --git a/nixos/modules/system/boot/tmp.nix b/nixos/modules/system/boot/tmp.nix
new file mode 100644
index 00000000000..5bf5e2eb2ec
--- /dev/null
+++ b/nixos/modules/system/boot/tmp.nix
@@ -0,0 +1,39 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ boot.cleanTmpDir = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to delete all files in /tmp during boot.
+ '';
+ };
+
+ boot.tmpOnTmpfs = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to mount a tmpfs on /tmp during boot.
+ '';
+ };
+
+ };
+
+ ###### implementation
+
+ config = {
+
+ systemd.additionalUpstreamSystemUnits = optional config.boot.tmpOnTmpfs "tmp.mount";
+
+ systemd.tmpfiles.rules = optional config.boot.cleanTmpDir "D! /tmp 1777 root root";
+
+ };
+
+}
\ No newline at end of file
diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix
index 22d55a9e246..b57b03bcf96 100644
--- a/nixos/modules/system/etc/etc.nix
+++ b/nixos/modules/system/etc/etc.nix
@@ -132,7 +132,7 @@ in
''
# Set up the statically computed bits of /etc.
echo "setting up /etc..."
- ${pkgs.perl}/bin/perl ${./setup-etc.pl} ${etc}/etc
+ ${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl ${./setup-etc.pl} ${etc}/etc
'';
};
diff --git a/nixos/modules/system/etc/setup-etc.pl b/nixos/modules/system/etc/setup-etc.pl
index 8ba9a370b27..d7e15eccefc 100644
--- a/nixos/modules/system/etc/setup-etc.pl
+++ b/nixos/modules/system/etc/setup-etc.pl
@@ -3,6 +3,7 @@ use File::Find;
use File::Copy;
use File::Path;
use File::Basename;
+use File::Slurp;
my $etc = $ARGV[0] or die;
my $static = "/etc/static";
@@ -46,35 +47,55 @@ sub cleanup {
find(\&cleanup, "/etc");
+# Use /etc/.clean to keep track of copied files.
+my @oldCopied = read_file("/etc/.clean", chomp => 1, err_mode => 'quiet');
+open CLEAN, ">>/etc/.clean";
+
+
# For every file in the etc tree, create a corresponding symlink in
# /etc to /etc/static. The indirection through /etc/static is to make
# switching to a new configuration somewhat more atomic.
+my %created;
+my @copied;
+
sub link {
my $fn = substr $File::Find::name, length($etc) + 1 or next;
my $target = "/etc/$fn";
File::Path::make_path(dirname $target);
+ $created{$fn} = 1;
if (-e "$_.mode") {
- open MODE, "<$_.mode";
- my $mode = ; chomp $mode;
- close MODE;
+ my $mode = read_file("$_.mode"); chomp $mode;
if ($mode eq "direct-symlink") {
atomicSymlink readlink("$static/$fn"), $target or warn;
} else {
- open UID, "<$_.uid";
- my $uid = ; chomp $uid;
- close UID;
- open GID, "<$_.gid";
- my $gid = ; chomp $gid;
- close GID;
-
+ my $uid = read_file("$_.uid"); chomp $uid;
+ my $gid = read_file("$_.gid"); chomp $gid;
copy "$static/$fn", "$target.tmp" or warn;
chown int($uid), int($gid), "$target.tmp" or warn;
chmod oct($mode), "$target.tmp" or warn;
rename "$target.tmp", $target or warn;
}
+ push @copied, $fn;
+ print CLEAN "$fn\n";
} elsif (-l "$_") {
atomicSymlink "$static/$fn", $target or warn;
}
}
find(\&link, $etc);
+
+
+# Delete files that were copied in a previous version but not in the
+# current.
+foreach my $fn (@oldCopied) {
+ if (!defined $created{$fn}) {
+ $fn = "/etc/$fn";
+ print STDERR "removing obsolete file ‘$fn’...\n";
+ unlink "$fn";
+ }
+}
+
+
+# Rewrite /etc/.clean.
+close CLEAN;
+write_file("/etc/.clean", map { "$_\n" } @copied);
diff --git a/nixos/modules/tasks/cpu-freq.nix b/nixos/modules/tasks/cpu-freq.nix
index a8c63c13428..70bbee8474e 100644
--- a/nixos/modules/tasks/cpu-freq.nix
+++ b/nixos/modules/tasks/cpu-freq.nix
@@ -30,9 +30,7 @@ in
config = mkIf (!config.boot.isContainer && config.powerManagement.cpuFreqGovernor != null) {
- boot.kernelModules = [ "acpi-cpufreq" "speedstep-lib" "pcc-cpufreq"
- "cpufreq_${cfg.cpuFreqGovernor}"
- ];
+ boot.kernelModules = [ "cpufreq_${cfg.cpuFreqGovernor}" ];
environment.systemPackages = [ cpupower ];
diff --git a/nixos/modules/tasks/encrypted-devices.nix b/nixos/modules/tasks/encrypted-devices.nix
index e56549149cb..0370e36fbec 100644
--- a/nixos/modules/tasks/encrypted-devices.nix
+++ b/nixos/modules/tasks/encrypted-devices.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, modulesPath, ... }:
+{ config, lib, ... }:
-with pkgs.lib;
+with lib;
let
fileSystems = attrValues config.fileSystems ++ config.swapDevices;
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index d350bc1b5d0..64a20034f3c 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -9,7 +9,7 @@ let
prioOption = prio: optionalString (prio !=null) " pri=${toString prio}";
- fileSystemOpts = { name, ... }: {
+ fileSystemOpts = { name, config, ... }: {
options = {
@@ -68,6 +68,7 @@ let
config = {
mountPoint = mkDefault name;
+ device = mkIf (config.fsType == "tmpfs") (mkDefault config.fsType);
};
};
@@ -124,13 +125,6 @@ in
description = "Names of supported filesystem types.";
};
- boot.initrd.supportedFilesystems = mkOption {
- default = [ ];
- example = [ "btrfs" ];
- type = types.listOf types.string;
- description = "Names of supported filesystem types in the initial ramdisk.";
- };
-
};
@@ -140,15 +134,11 @@ in
boot.supportedFilesystems = map (fs: fs.fsType) fileSystems;
- boot.initrd.supportedFilesystems =
- map (fs: fs.fsType)
- (filter (fs: fs.mountPoint == "/" || fs.neededForBoot) fileSystems);
-
# Add the mount helpers to the system path so that `mount' can find them.
system.fsPackages = [ pkgs.dosfstools ];
environment.systemPackages =
- [ pkgs.ntfs3g pkgs.cifs_utils pkgs.fuse ]
+ [ pkgs.ntfs3g pkgs.fuse ]
++ config.system.fsPackages;
environment.etc.fstab.text =
@@ -157,7 +147,9 @@ in
# Filesystems.
${flip concatMapStrings fileSystems (fs:
- (if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}")
+ (if fs.device != null then fs.device
+ else if fs.label != null then "/dev/disk/by-label/${fs.label}"
+ else throw "No device specified for mount point ‘${fs.mountPoint}’.")
+ " " + fs.mountPoint
+ " " + fs.fsType
+ " " + fs.options
diff --git a/nixos/modules/tasks/filesystems/cifs.nix b/nixos/modules/tasks/filesystems/cifs.nix
new file mode 100644
index 00000000000..c60f175db84
--- /dev/null
+++ b/nixos/modules/tasks/filesystems/cifs.nix
@@ -0,0 +1,25 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ inInitrd = any (fs: fs == "cifs") config.boot.initrd.supportedFilesystems;
+
+in
+
+{
+ config = {
+
+ system.fsPackages = [ pkgs.cifs_utils ];
+
+ boot.initrd.availableKernelModules = mkIf inInitrd
+ [ "cifs" "nls_utf8" "hmac" "md4" "ecb" "des_generic" "sha256" ];
+
+ boot.initrd.extraUtilsCommands = mkIf inInitrd
+ ''
+ cp -v ${pkgs.cifs_utils}/sbin/mount.cifs $out/bin
+ '';
+
+ };
+}
diff --git a/nixos/modules/tasks/filesystems/f2fs.nix b/nixos/modules/tasks/filesystems/f2fs.nix
index 8655107360c..1ed7b1b6a62 100644
--- a/nixos/modules/tasks/filesystems/f2fs.nix
+++ b/nixos/modules/tasks/filesystems/f2fs.nix
@@ -1,6 +1,6 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
-with pkgs.lib;
+with lib;
let
inInitrd = any (fs: fs == "f2fs") config.boot.initrd.supportedFilesystems;
diff --git a/nixos/modules/tasks/filesystems/jfs.nix b/nixos/modules/tasks/filesystems/jfs.nix
new file mode 100644
index 00000000000..b7091ce9b18
--- /dev/null
+++ b/nixos/modules/tasks/filesystems/jfs.nix
@@ -0,0 +1,19 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ inInitrd = any (fs: fs == "jfs") config.boot.initrd.supportedFilesystems;
+in
+{
+ config = mkIf (any (fs: fs == "jfs") config.boot.supportedFilesystems) {
+
+ system.fsPackages = [ pkgs.jfsutils ];
+
+ boot.initrd.kernelModules = mkIf inInitrd [ "jfs" ];
+
+ boot.initrd.extraUtilsCommands = mkIf inInitrd ''
+ cp -v ${pkgs.jfsutils}/sbin/fsck.jfs "$out/bin/"
+ '';
+ };
+}
diff --git a/nixos/modules/tasks/filesystems/nfs.nix b/nixos/modules/tasks/filesystems/nfs.nix
index e8c3d8ab56d..16752ce7e1b 100644
--- a/nixos/modules/tasks/filesystems/nfs.nix
+++ b/nixos/modules/tasks/filesystems/nfs.nix
@@ -24,9 +24,33 @@ let
Method = nsswitch
'';
+ cfg = config.services.nfs;
+
in
{
+ ###### interface
+
+ options = {
+
+ services.nfs = {
+ statdPort = mkOption {
+ default = null;
+ example = 4000;
+ description = ''
+ Use fixed port for rpc.statd, usefull if NFS server is behind firewall.
+ '';
+ };
+ lockdPort = mkOption {
+ default = null;
+ example = 4001;
+ description = ''
+ Use fixed port for NFS lock manager kernel module (lockd/nlockmgr),
+ usefull if NFS server is behind firewall.
+ '';
+ };
+ };
+ };
###### implementation
@@ -36,6 +60,10 @@ in
system.fsPackages = [ pkgs.nfsUtils ];
+ boot.extraModprobeConfig = mkIf (cfg.lockdPort != null) ''
+ options lockd nlm_udpport=${toString cfg.lockdPort} nlm_tcpport=${toString cfg.lockdPort}
+ '';
+
boot.kernelModules = [ "sunrpc" ];
boot.initrd.kernelModules = mkIf inInitrd [ "nfs" ];
@@ -60,7 +88,10 @@ in
'';
serviceConfig.Type = "forking";
- serviceConfig.ExecStart = "@${pkgs.nfsUtils}/sbin/rpc.statd rpc.statd --no-notify";
+ serviceConfig.ExecStart = ''
+ @${pkgs.nfsUtils}/sbin/rpc.statd rpc.statd --no-notify \
+ ${if cfg.statdPort != null then "-p ${toString statdPort}" else ""}
+ '';
serviceConfig.Restart = "always";
};
diff --git a/nixos/modules/tasks/filesystems/unionfs-fuse.nix b/nixos/modules/tasks/filesystems/unionfs-fuse.nix
index 177c97f85c7..fe195e0db0b 100644
--- a/nixos/modules/tasks/filesystems/unionfs-fuse.nix
+++ b/nixos/modules/tasks/filesystems/unionfs-fuse.nix
@@ -1,15 +1,22 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
- config = pkgs.lib.mkMerge [
- (pkgs.lib.mkIf (pkgs.lib.any (fs: fs == "unionfs-fuse") config.boot.initrd.supportedFilesystems) {
+ config = lib.mkMerge [
+
+ (lib.mkIf (lib.any (fs: fs == "unionfs-fuse") config.boot.initrd.supportedFilesystems) {
boot.initrd.kernelModules = [ "fuse" ];
-
+
boot.initrd.extraUtilsCommands = ''
cp -v ${pkgs.fuse}/lib/libfuse* $out/lib
+ cp -v ${pkgs.fuse}/sbin/mount.fuse $out/bin
cp -v ${pkgs.unionfs-fuse}/bin/unionfs $out/bin
+ substitute ${pkgs.unionfs-fuse}/sbin/mount.unionfs-fuse $out/bin/mount.unionfs-fuse \
+ --replace '${pkgs.bash}/bin/bash' /bin/sh \
+ --replace '${pkgs.fuse}/sbin' /bin \
+ --replace '${pkgs.unionfs-fuse}/bin' /bin
+ chmod +x $out/bin/mount.unionfs-fuse
'';
-
+
boot.initrd.postDeviceCommands = ''
# Hacky!!! fuse hard-codes the path to mount
mkdir -p /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.utillinux.name}/bin
@@ -17,8 +24,10 @@
ln -s $(which umount) /nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${pkgs.utillinux.name}/bin
'';
})
- (pkgs.lib.mkIf (pkgs.lib.any (fs: fs == "unionfs-fuse") config.boot.supportedFilesystems) {
+
+ (lib.mkIf (lib.any (fs: fs == "unionfs-fuse") config.boot.supportedFilesystems) {
system.fsPackages = [ pkgs.unionfs-fuse ];
})
+
];
}
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index d7deb44c407..eb72bfba33c 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -133,7 +133,7 @@ in
};
boot.initrd = mkIf inInitrd {
- kernelModules = [ "spl" "zfs" ] ;
+ kernelModules = [ "spl" "zfs" ];
extraUtilsCommands =
''
cp -v ${zfsPkg}/sbin/zfs $out/bin
@@ -148,9 +148,14 @@ in
'';
};
+ boot.loader.grub = mkIf inInitrd {
+ zfsSupport = true;
+ };
+
systemd.services."zpool-import" = {
description = "Import zpools";
after = [ "systemd-udev-settle.service" ];
+ wantedBy = [ "local-fs.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index 991f9f26145..22b52f77b14 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -1,14 +1,40 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, utils, ... }:
with lib;
+with utils;
let
cfg = config.networking;
interfaces = attrValues cfg.interfaces;
hasVirtuals = any (i: i.virtual) interfaces;
+ hasSits = cfg.sits != { };
hasBonds = cfg.bonds != { };
+ # We must escape interfaces due to the systemd interpretation
+ subsystemDevice = interface:
+ "sys-subsystem-net-devices-${escapeSystemdPath interface}.device";
+
+ addrOpts = v:
+ assert v == 4 || v == 6;
+ {
+ address = mkOption {
+ type = types.str;
+ description = ''
+ IPv${toString v} address of the interface. Leave empty to configure the
+ interface using DHCP.
+ '';
+ };
+
+ prefixLength = mkOption {
+ type = types.addCheck types.int (n: n >= 0 && n <= (if v == 4 then 32 else 128));
+ description = ''
+ Subnet mask of the interface, specified as the number of
+ bits in the prefix (${if v == 4 then "24" else "64"}).
+ '';
+ };
+ };
+
interfaceOpts = { name, ... }: {
options = {
@@ -19,10 +45,36 @@ let
description = "Name of the interface.";
};
+ ip4 = mkOption {
+ default = [ ];
+ example = [
+ { address = "10.0.0.1"; prefixLength = 16; }
+ { address = "192.168.1.1"; prefixLength = 24; }
+ ];
+ type = types.listOf types.optionSet;
+ options = addrOpts 4;
+ description = ''
+ List of IPv4 addresses that will be statically assigned to the interface.
+ '';
+ };
+
+ ip6 = mkOption {
+ default = [ ];
+ example = [
+ { address = "fdfd:b3f0:482::1"; prefixLength = 48; }
+ { address = "2001:1470:fffd:2098::e006"; prefixLength = 64; }
+ ];
+ type = types.listOf types.optionSet;
+ options = addrOpts 6;
+ description = ''
+ List of IPv6 addresses that will be statically assigned to the interface.
+ '';
+ };
+
ipAddress = mkOption {
default = null;
example = "10.0.0.1";
- type = types.nullOr (types.str);
+ type = types.nullOr types.str;
description = ''
IP address of the interface. Leave empty to configure the
interface using DHCP.
@@ -40,27 +92,23 @@ let
};
subnetMask = mkOption {
- default = "";
- example = "255.255.255.0";
- type = types.str;
+ default = null;
description = ''
- Subnet mask of the interface, specified as a bitmask.
- This is deprecated; use
- instead.
+ Defunct, supply the prefix length instead.
'';
};
ipv6Address = mkOption {
default = null;
example = "2001:1470:fffd:2098::e006";
- type = types.nullOr types.string;
+ type = types.nullOr types.str;
description = ''
IPv6 address of the interface. Leave empty to configure the
interface using NDP.
'';
};
- ipv6prefixLength = mkOption {
+ ipv6PrefixLength = mkOption {
default = 64;
example = 64;
type = types.int;
@@ -95,8 +143,6 @@ let
Whether this interface is virtual and should be created by tunctl.
This is mainly useful for creating bridges between a host a virtual
network such as VPN or a virtual machine.
-
- Defaults to tap device, unless interface contains "tun" in its name.
'';
};
@@ -108,6 +154,15 @@ let
'';
};
+ virtualType = mkOption {
+ default = null;
+ type = types.nullOr (types.addCheck types.str (v: v == "tun" || v == "tap"));
+ description = ''
+ The explicit type of interface to create. Accepts tun or tap strings.
+ Also accepts null to implicitly detect the type of device.
+ '';
+ };
+
proxyARP = mkOption {
default = false;
type = types.bool;
@@ -223,10 +278,10 @@ in
networking.interfaces = mkOption {
default = {};
example =
- { eth0 = {
- ipAddress = "131.211.84.78";
- subnetMask = "255.255.255.128";
- };
+ { eth0.ip4 = [ {
+ address = "131.211.84.78";
+ prefixLength = 25;
+ } ];
};
description = ''
The configuration for each network interface. If
@@ -290,10 +345,20 @@ in
interfaces = mkOption {
example = [ "enp4s0f0" "enp4s0f1" "wlan0" ];
- type = types.listOf types.string;
+ type = types.listOf types.str;
description = "The interfaces to bond together";
};
+ lacp_rate = mkOption {
+ default = null;
+ example = "fast";
+ type = types.nullOr types.str;
+ description = ''
+ Option specifying the rate in which we'll ask our link partner
+ to transmit LACPDU packets in 802.3ad mode.
+ '';
+ };
+
miimon = mkOption {
default = null;
example = 100;
@@ -309,7 +374,7 @@ in
mode = mkOption {
default = null;
example = "active-backup";
- type = types.nullOr types.string;
+ type = types.nullOr types.str;
description = ''
The mode which the bond will be running. The default mode for
the bonding driver is balance-rr, optimizing for throughput.
@@ -318,6 +383,76 @@ in
'';
};
+ xmit_hash_policy = mkOption {
+ default = null;
+ example = "layer2+3";
+ type = types.nullOr types.str;
+ description = ''
+ Selects the transmit hash policy to use for slave selection in
+ balance-xor, 802.3ad, and tlb modes.
+ '';
+ };
+
+ };
+ };
+
+ networking.sits = mkOption {
+ type = types.attrsOf types.optionSet;
+ default = { };
+ example = {
+ hurricane = {
+ remote = "10.0.0.1";
+ local = "10.0.0.22";
+ ttl = 255;
+ };
+ msipv6 = {
+ remote = "192.168.0.1";
+ dev = "enp3s0";
+ ttl = 127;
+ };
+ };
+ description = ''
+ This option allows you to define 6-to-4 interfaces which should be automatically created.
+ '';
+ options = {
+
+ remote = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "10.0.0.1";
+ description = ''
+ The address of the remote endpoint to forward traffic over.
+ '';
+ };
+
+ local = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "10.0.0.22";
+ description = ''
+ The address of the local endpoint which the remote
+ side should send packets to.
+ '';
+ };
+
+ ttl = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ example = 255;
+ description = ''
+ The time-to-live of the connection to the remote tunnel endpoint.
+ '';
+ };
+
+ dev = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "enp4s0f0";
+ description = ''
+ The underlying network device on which the tunnel resides.
+ '';
+ };
+
};
};
@@ -377,9 +512,16 @@ in
config = {
+ assertions =
+ flip map interfaces (i: {
+ assertion = i.subnetMask == null;
+ message = "The networking.interfaces.${i.name}.subnetMask option is defunct. Use prefixLength instead.";
+ });
+
boot.kernelModules = [ ]
++ optional cfg.enableIPv6 "ipv6"
++ optional hasVirtuals "tun"
+ ++ optional hasSits "sit"
++ optional hasBonds "bonding";
boot.extraModprobeConfig =
@@ -472,16 +614,22 @@ in
# network device, so it only gets started after the interface
# has appeared, and it's stopped when the interface
# disappears.
- configureInterface = i: nameValuePair "${i.name}-cfg"
- (let mask =
- if i.prefixLength != null then toString i.prefixLength else
- if i.subnetMask != "" then i.subnetMask else "32";
- staticIPv6 = cfg.enableIPv6 && i.ipv6Address != null;
+ configureInterface = i:
+ let
+ ips = i.ip4 ++ optionals cfg.enableIPv6 i.ip6
+ ++ optional (i.ipAddress != null) {
+ address = i.ipAddress;
+ prefixLength = i.prefixLength;
+ } ++ optional (cfg.enableIPv6 && i.ipv6Address != null) {
+ address = i.ipv6Address;
+ prefixLength = i.ipv6PrefixLength;
+ };
in
+ nameValuePair "${i.name}-cfg"
{ description = "Configuration of ${i.name}";
wantedBy = [ "network-interfaces.target" ];
- bindsTo = [ "sys-subsystem-net-devices-${i.name}.device" ];
- after = [ "sys-subsystem-net-devices-${i.name}.device" ];
+ bindsTo = [ (subsystemDevice i.name) ];
+ after = [ (subsystemDevice i.name) ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
path = [ pkgs.iproute pkgs.gawk ];
@@ -500,36 +648,32 @@ in
echo "setting MTU to ${toString i.mtu}..."
ip link set "${i.name}" mtu "${toString i.mtu}"
''
- + optionalString (i.ipAddress != null)
+
+ # Ip Setup
+ +
''
- cur=$(ip -4 -o a show dev "${i.name}" | awk '{print $4}')
- # Only do a flush/add if it's necessary. This is
+ curIps=$(ip -o a show dev "${i.name}" | awk '{print $4}')
+ # Only do an add if it's necessary. This is
# useful when the Nix store is accessed via this
# interface (e.g. in a QEMU VM test).
- if [ "$cur" != "${i.ipAddress}/${mask}" ]; then
- echo "configuring interface..."
- ip -4 addr flush dev "${i.name}"
- ip -4 addr add "${i.ipAddress}/${mask}" dev "${i.name}"
- restart_network_setup=true
- else
- echo "skipping configuring interface"
+ ''
+ + flip concatMapStrings (ips) (ip:
+ let
+ address = "${ip.address}/${toString ip.prefixLength}";
+ in
+ ''
+ echo "checking ip ${address}..."
+ if ! echo "$curIps" | grep "${address}" >/dev/null 2>&1; then
+ if out=$(ip addr add "${address}" dev "${i.name}" 2>&1); then
+ echo "added ip ${address}..."
+ restart_network_setup=true
+ elif ! echo "$out" | grep "File exists" >/dev/null 2>&1; then
+ echo "failed to add ${address}"
+ exit 1
+ fi
fi
- ''
- + optionalString (staticIPv6)
- ''
- # Only do a flush/add if it's necessary. This is
- # useful when the Nix store is accessed via this
- # interface (e.g. in a QEMU VM test).
- if ! ip -6 -o a show dev "${i.name}" | grep "${i.ipv6Address}/${toString i.ipv6prefixLength}"; then
- echo "configuring interface..."
- ip -6 addr flush dev "${i.name}"
- ip -6 addr add "${i.ipv6Address}/${toString i.ipv6prefixLength}" dev "${i.name}"
- restart_network_setup=true
- else
- echo "skipping configuring interface"
- fi
- ''
- + optionalString (i.ipAddress != null || staticIPv6)
+ '')
+ + optionalString (ips != [ ])
''
if [ restart_network_setup = true ]; then
# Ensure that the default gateway remains set.
@@ -546,28 +690,47 @@ in
''
echo 1 > /proc/sys/net/ipv6/conf/${i.name}/proxy_ndp
'';
- });
+ preStop =
+ ''
+ echo "releasing configured ip's..."
+ ''
+ + flip concatMapStrings (ips) (ip:
+ let
+ address = "${ip.address}/${toString ip.prefixLength}";
+ in
+ ''
+ echo -n "Deleting ${address}..."
+ ip addr del "${address}" dev "${i.name}" >/dev/null 2>&1 || echo -n " Failed"
+ echo ""
+ '');
+ };
- createTunDevice = i: nameValuePair "${i.name}"
+ createTunDevice = i: nameValuePair "${i.name}-netdev"
{ description = "Virtual Network Interface ${i.name}";
requires = [ "dev-net-tun.device" ];
after = [ "dev-net-tun.device" ];
- wantedBy = [ "network.target" ];
- requiredBy = [ "sys-subsystem-net-devices-${i.name}.device" ];
- serviceConfig =
- { Type = "oneshot";
- RemainAfterExit = true;
- ExecStart = "${pkgs.tunctl}/bin/tunctl -t '${i.name}' -u '${i.virtualOwner}'";
- ExecStop = "${pkgs.tunctl}/bin/tunctl -d '${i.name}'";
- };
+ wantedBy = [ "network.target" (subsystemDevice i.name) ];
+ path = [ pkgs.iproute ];
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ };
+ script = ''
+ ip tuntap add dev "${i.name}" \
+ ${optionalString (i.virtualType != null) "mode ${i.virtualType}"} \
+ user "${i.virtualOwner}"
+ '';
+ postStop = ''
+ ip link del ${i.name}
+ '';
};
- createBridgeDevice = n: v:
- let
- deps = map (i: "sys-subsystem-net-devices-${i}.device") v.interfaces;
+ createBridgeDevice = n: v: nameValuePair "${n}-netdev"
+ (let
+ deps = map subsystemDevice v.interfaces;
in
{ description = "Bridge Interface ${n}";
- wantedBy = [ "network.target" "sys-subsystem-net-devices-${n}.device" ];
+ wantedBy = [ "network.target" (subsystemDevice n) ];
bindsTo = deps;
after = deps;
serviceConfig.Type = "oneshot";
@@ -600,53 +763,60 @@ in
ip link set "${n}" down
brctl delbr "${n}"
'';
- };
+ });
- createBondDevice = n: v:
- let
- deps = map (i: "sys-subsystem-net-devices-${i}.device") v.interfaces;
+ createBondDevice = n: v: nameValuePair "${n}-netdev"
+ (let
+ deps = map subsystemDevice v.interfaces;
in
{ description = "Bond Interface ${n}";
- wantedBy = [ "network.target" "sys-subsystem-net-devices-${n}.device" ];
+ wantedBy = [ "network.target" (subsystemDevice n) ];
bindsTo = deps;
after = deps;
+ before = [ "${n}-cfg.service" ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
path = [ pkgs.ifenslave pkgs.iproute ];
script = ''
- # Remove Dead Interfaces
- ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}"
-
- ip link add "${n}" type bond
+ ip link add name "${n}" type bond
# !!! There must be a better way to wait for the interface
while [ ! -d /sys/class/net/${n} ]; do sleep 0.1; done;
+ # Ensure the link is down so that we can set options
+ ip link set "${n}" down
+
# Set the miimon and mode options
${optionalString (v.miimon != null)
- "echo ${toString v.miimon} > /sys/class/net/${n}/bonding/miimon"}
+ "echo \"${toString v.miimon}\" >/sys/class/net/${n}/bonding/miimon"}
${optionalString (v.mode != null)
- "echo \"${v.mode}\" > /sys/class/net/${n}/bonding/mode"}
+ "echo \"${v.mode}\" >/sys/class/net/${n}/bonding/mode"}
+ ${optionalString (v.lacp_rate != null)
+ "echo \"${v.lacp_rate}\" >/sys/class/net/${n}/bonding/lacp_rate"}
+ ${optionalString (v.xmit_hash_policy != null)
+ "echo \"${v.xmit_hash_policy}\" >/sys/class/net/${n}/bonding/xmit_hash_policy"}
- # Bring up the bridge and enslave the specified interfaces
+ # Bring up the bond and enslave the specified interfaces
ip link set "${n}" up
${flip concatMapStrings v.interfaces (i: ''
ifenslave "${n}" "${i}"
'')}
'';
postStop = ''
- ip link set "${n}" down
- ifenslave -d "${n}"
- ip link delete "${n}"
+ ${flip concatMapStrings v.interfaces (i: ''
+ ifenslave -d "${n}" "${i}" >/dev/null 2>&1 || true
+ '')}
+ ip link set "${n}" down >/dev/null 2>&1 || true
+ ip link del "${n}" >/dev/null 2>&1 || true
'';
- };
+ });
- createVlanDevice = n: v:
- let
- deps = [ "sys-subsystem-net-devices-${v.interface}.device" ];
+ createSitDevice = n: v: nameValuePair "${n}-netdev"
+ (let
+ deps = optional (v.dev != null) (subsystemDevice v.dev);
in
- { description = "Vlan Interface ${n}";
- wantedBy = [ "network.target" "sys-subsystem-net-devices-${n}.device" ];
+ { description = "6-to-4 Tunnel Interface ${n}";
+ wantedBy = [ "network.target" (subsystemDevice n) ];
bindsTo = deps;
after = deps;
serviceConfig.Type = "oneshot";
@@ -655,20 +825,47 @@ in
script = ''
# Remove Dead Interfaces
ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}"
- ip link add link "${v.interface}" "${n}" type vlan id "${toString v.id}"
+ ip link add name "${n}" type sit \
+ ${optionalString (v.remote != null) "remote \"${v.remote}\""} \
+ ${optionalString (v.local != null) "local \"${v.local}\""} \
+ ${optionalString (v.ttl != null) "ttl ${toString v.ttl}"} \
+ ${optionalString (v.dev != null) "dev \"${v.dev}\""}
ip link set "${n}" up
'';
postStop = ''
ip link delete "${n}"
'';
- };
+ });
+
+ createVlanDevice = n: v: nameValuePair "${n}-netdev"
+ (let
+ deps = [ (subsystemDevice v.interface) ];
+ in
+ { description = "Vlan Interface ${n}";
+ wantedBy = [ "network.target" (subsystemDevice n) ];
+ bindsTo = deps;
+ after = deps;
+ serviceConfig.Type = "oneshot";
+ serviceConfig.RemainAfterExit = true;
+ path = [ pkgs.iproute ];
+ script = ''
+ # Remove Dead Interfaces
+ ip link show "${n}" >/dev/null 2>&1 && ip link delete "${n}"
+ ip link add link "${v.interface}" name "${n}" type vlan id "${toString v.id}"
+ ip link set "${n}" up
+ '';
+ postStop = ''
+ ip link delete "${n}"
+ '';
+ });
in listToAttrs (
map configureInterface interfaces ++
map createTunDevice (filter (i: i.virtual) interfaces))
- // mapAttrs createBridgeDevice cfg.bridges
- // mapAttrs createBondDevice cfg.bonds
- // mapAttrs createVlanDevice cfg.vlans
+ // mapAttrs' createBridgeDevice cfg.bridges
+ // mapAttrs' createBondDevice cfg.bonds
+ // mapAttrs' createSitDevice cfg.sits
+ // mapAttrs' createVlanDevice cfg.vlans
// { "network-setup" = networkSetup; };
# Set the host and domain names in the activation script. Don't
diff --git a/nixos/modules/tasks/trackpoint.nix b/nixos/modules/tasks/trackpoint.nix
index 4be2c3eb4c4..5d1bb631b54 100644
--- a/nixos/modules/tasks/trackpoint.nix
+++ b/nixos/modules/tasks/trackpoint.nix
@@ -36,6 +36,14 @@ with lib;
configures 97.
'';
};
+
+ emulateWheel = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ Enable scrolling while holding the middle mouse button.
+ '';
+ };
};
@@ -44,23 +52,33 @@ with lib;
###### implementation
- config = mkIf config.hardware.trackpoint.enable {
+ config = mkMerge [
+ (mkIf config.hardware.trackpoint.enable {
+ services.udev.extraRules =
+ ''
+ ACTION=="add|change", SUBSYSTEM=="input", ATTR{name}=="TPPS/2 IBM TrackPoint", ATTR{device/speed}="${toString config.hardware.trackpoint.speed}", ATTR{device/sensitivity}="${toString config.hardware.trackpoint.sensitivity}"
+ '';
- 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
+ system.activationScripts.trackpoint =
+ ''
+ ${config.systemd.package}/bin/udevadm trigger --attr-match=name="TPPS/2 IBM TrackPoint"
'';
- };
-
- };
+ })
+ (mkIf config.hardware.trackpoint.emulateWheel {
+ services.xserver.config =
+ ''
+ Section "InputClass"
+ Identifier "Trackpoint Wheel Emulation"
+ MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device|Composite TouchPad / TrackPoint"
+ MatchDevicePath "/dev/input/event*"
+ Option "EmulateWheel" "true"
+ Option "EmulateWheelButton" "2"
+ Option "Emulate3Buttons" "false"
+ Option "XAxisMapping" "6 7"
+ Option "YAxisMapping" "4 5"
+ EndSection
+ '';
+ })
+ ];
}
diff --git a/nixos/modules/tasks/tty-backgrounds-combine.sh b/nixos/modules/tasks/tty-backgrounds-combine.sh
index 1e0d8758a6e..55c3a1ebfa8 100644
--- a/nixos/modules/tasks/tty-backgrounds-combine.sh
+++ b/nixos/modules/tasks/tty-backgrounds-combine.sh
@@ -3,7 +3,7 @@ source $stdenv/setup
ttys=($ttys)
themes=($themes)
-ensureDir $out
+mkdir -p $out
defaultName=$(cd $default && ls | grep -v default)
echo $defaultName
diff --git a/nixos/modules/testing/minimal-kernel.nix b/nixos/modules/testing/minimal-kernel.nix
index 0cbca71e132..a463cb803ad 100644
--- a/nixos/modules/testing/minimal-kernel.nix
+++ b/nixos/modules/testing/minimal-kernel.nix
@@ -1,7 +1,7 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
let
- configfile = builtins.storePath (builtins.toFile "config" (pkgs.lib.concatStringsSep "\n"
+ configfile = builtins.storePath (builtins.toFile "config" (lib.concatStringsSep "\n"
(map (builtins.getAttr "configLine") config.system.requiredKernelConfig))
);
diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix
index 9100a433cd6..54a376c9560 100644
--- a/nixos/modules/testing/test-instrumentation.nix
+++ b/nixos/modules/testing/test-instrumentation.nix
@@ -66,13 +66,22 @@ let kernel = config.boot.kernelPackages.kernel; in
# Panic if an error occurs in stage 1 (rather than waiting for
# user intervention).
boot.kernelParams =
- [ "console=tty1" "console=ttyS0" "panic=1" "boot.panic_on_fail" ];
+ [ "console=ttyS0" "panic=1" "boot.panic_on_fail" ];
# `xwininfo' is used by the test driver to query open windows.
environment.systemPackages = [ pkgs.xorg.xwininfo ];
# Log everything to the serial console.
- services.journald.console = "/dev/console";
+ services.journald.extraConfig =
+ ''
+ ForwardToConsole=yes
+ MaxLevelConsole=debug
+ '';
+
+ # Don't clobber the console with duplicate systemd messages.
+ systemd.extraConfig = "ShowStatus=no";
+
+ boot.consoleLogLevel = 7;
# Prevent tests from accessing the Internet.
networking.defaultGateway = mkOverride 150 "";
@@ -88,6 +97,9 @@ let kernel = config.boot.kernelPackages.kernel; in
networking.usePredictableInterfaceNames = false;
+ # Make it easy to log in as root when running the test interactively.
+ security.initialRootPassword = mkDefault "";
+
};
}
diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix
index 7d6109f212a..552d787b447 100644
--- a/nixos/modules/virtualisation/amazon-image.nix
+++ b/nixos/modules/virtualisation/amazon-image.nix
@@ -70,10 +70,10 @@ in
# 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
+ chroot /mnt ${config.nix.package}/bin/nix-store --load-db --option build-users-group ""
# Create the system profile to allow nixos-rebuild to work.
- chroot /mnt ${config.nix.package}/bin/nix-env \
+ chroot /mnt ${config.nix.package}/bin/nix-env --option build-users-group "" \
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
# `nixos-rebuild' requires an /etc/NIXOS.
@@ -172,7 +172,7 @@ in
boot.initrd.extraUtilsCommands =
''
# We need swapon in the initrd.
- cp ${pkgs.utillinux}/sbin/swapon $out/bin
+ cp --remove-destination ${pkgs.utillinux}/sbin/swapon $out/bin
'';
# Don't put old configurations in the GRUB menu. The user has no
diff --git a/nixos/modules/virtualisation/azure-config.nix b/nixos/modules/virtualisation/azure-config.nix
new file mode 100644
index 00000000000..5c9f18ef52a
--- /dev/null
+++ b/nixos/modules/virtualisation/azure-config.nix
@@ -0,0 +1,5 @@
+{ config, pkgs, modulesPath, ... }:
+
+{
+ imports = [ "${modulesPath}/virtualisation/azure-image.nix" ];
+}
diff --git a/nixos/modules/virtualisation/azure-image.nix b/nixos/modules/virtualisation/azure-image.nix
new file mode 100644
index 00000000000..ec7e8888c03
--- /dev/null
+++ b/nixos/modules/virtualisation/azure-image.nix
@@ -0,0 +1,125 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+ diskSize = "4096";
+in
+{
+ imports = [ ../profiles/headless.nix ];
+
+ system.build.azureImage =
+ pkgs.vmTools.runInLinuxVM (
+ pkgs.runCommand "azure-image"
+ { preVM =
+ ''
+ mkdir $out
+ diskImage=$out/$diskImageBase
+
+ cyl=$(((${diskSize}*1024*1024)/(512*63*255)))
+ size=$(($cyl*255*63*512))
+ roundedsize=$((($size/(1024*1024)+1)*(1024*1024)))
+ ${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage $roundedsize
+ mv closure xchg/
+ '';
+
+ postVM =
+ ''
+ mkdir -p $out
+ ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -O vpc $diskImage $out/disk.vhd
+ rm $diskImage
+ '';
+ diskImageBase = "nixos-${config.system.nixosVersion}-${pkgs.stdenv.system}.raw";
+ buildInputs = [ pkgs.utillinux pkgs.perl ];
+ exportReferencesGraph =
+ [ "closure" config.system.build.toplevel ];
+ }
+ ''
+ # Create partition table
+ ${pkgs.parted}/sbin/parted /dev/vda mklabel msdos
+ ${pkgs.parted}/sbin/parted /dev/vda mkpart primary ext4 1 ${diskSize}M
+ ${pkgs.parted}/sbin/parted /dev/vda print
+ . /sys/class/block/vda1/uevent
+ mknod /dev/vda1 b $MAJOR $MINOR
+
+ # Create an empty filesystem and mount it.
+ ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda1
+ ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1
+
+ mkdir /mnt
+ mount /dev/vda1 /mnt
+
+ # The initrd expects these directories to exist.
+ mkdir /mnt/dev /mnt/proc /mnt/sys
+
+ mount --bind /proc /mnt/proc
+ mount --bind /dev /mnt/dev
+ mount --bind /sys /mnt/sys
+
+ # Copy all paths in the closure to the filesystem.
+ storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
+
+ mkdir -p /mnt/nix/store
+ echo "copying everything (will take a while)..."
+ cp -prd $storePaths /mnt/nix/store/
+
+ # Register the paths in the Nix database.
+ printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
+ chroot /mnt ${config.nix.package}/bin/nix-store --load-db
+
+ # Create the system profile to allow nixos-rebuild to work.
+ chroot /mnt ${config.nix.package}/bin/nix-env \
+ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
+
+ # `nixos-rebuild' requires an /etc/NIXOS.
+ mkdir -p /mnt/etc
+ touch /mnt/etc/NIXOS
+
+ # `switch-to-configuration' requires a /bin/sh
+ mkdir -p /mnt/bin
+ ln -s ${config.system.build.binsh}/bin/sh /mnt/bin/sh
+
+ # Install a configuration.nix.
+ mkdir -p /mnt/etc/nixos /mnt/boot/grub
+ cp ${./azure-config.nix} /mnt/etc/nixos/configuration.nix
+
+ # Generate the GRUB menu.
+ ln -s vda /dev/sda
+ chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
+
+ umount /mnt/proc /mnt/dev /mnt/sys
+ umount /mnt
+ ''
+ );
+
+ fileSystems."/".device = "/dev/disk/by-label/nixos";
+
+ # Azure metadata is available as a CD-ROM drive.
+ fileSystems."/metadata".device = "/dev/sr0";
+
+ boot.kernelParams = [ "console=ttyS0" "earlyprintk=ttyS0" "rootdelay=300" "panic=1" "boot.panic_on_fail" ];
+ boot.initrd.kernelModules = [ "hv_vmbus" "hv_netvsc" "hv_utils" "hv_storvsc" ];
+
+ # Generate a GRUB menu.
+ boot.loader.grub.device = "/dev/sda";
+ boot.loader.grub.version = 2;
+ boot.loader.grub.timeout = 0;
+
+ # Don't put old configurations in the GRUB menu. The user has no
+ # way to select them anyway.
+ boot.loader.grub.configurationLimit = 0;
+
+ # Allow root logins only using the SSH key that the user specified
+ # at instance creation time.
+ services.openssh.enable = true;
+ services.openssh.permitRootLogin = "without-password";
+
+ # Force getting the hostname from Azure
+ networking.hostName = mkDefault "";
+
+ # Always include cryptsetup so that NixOps can use it.
+ environment.systemPackages = [ pkgs.cryptsetup ];
+
+ networking.usePredictableInterfaceNames = false;
+
+ users.extraUsers.root.openssh.authorizedKeys.keys = [ (builtins.readFile ) ];
+}
diff --git a/nixos/modules/virtualisation/container-config.nix b/nixos/modules/virtualisation/container-config.nix
index b81f97f2b4e..a7e8953827a 100644
--- a/nixos/modules/virtualisation/container-config.nix
+++ b/nixos/modules/virtualisation/container-config.nix
@@ -18,76 +18,7 @@ with lib;
# Shut up warnings about not having a boot loader.
system.build.installBootLoader = "${pkgs.coreutils}/bin/true";
- # Provide a root login prompt on /var/lib/root-login.socket that
- # doesn't ask for a password. This socket can only be used by root
- # on the host.
- systemd.sockets.root-login =
- { description = "Root Login Socket";
- wantedBy = [ "sockets.target" ];
- socketConfig =
- { ListenStream = "/var/lib/root-login.socket";
- SocketMode = "0600";
- Accept = true;
- };
- };
-
- systemd.services."root-login@" =
- { description = "Root Login %i";
- environment.TERM = "linux";
- serviceConfig =
- { Type = "simple";
- StandardInput = "socket";
- ExecStart = "${pkgs.socat}/bin/socat -t0 - \"exec:${pkgs.shadow}/bin/login -f root,pty,setsid,setpgid,stderr,ctty\"";
- TimeoutStopSec = 1; # FIXME
- };
- restartIfChanged = false;
- };
-
- # Provide a daemon on /var/lib/run-command.socket that reads a
- # command from stdin and executes it.
- systemd.sockets.run-command =
- { description = "Run Command Socket";
- wantedBy = [ "sockets.target" ];
- socketConfig =
- { ListenStream = "/var/lib/run-command.socket";
- SocketMode = "0600"; # only root can connect
- Accept = true;
- };
- };
-
- systemd.services."run-command@" =
- { description = "Run Command %i";
- environment.TERM = "linux";
- serviceConfig =
- { Type = "simple";
- StandardInput = "socket";
- TimeoutStopSec = 1; # FIXME
- };
- script =
- ''
- #! ${pkgs.stdenv.shell} -e
- source /etc/bashrc
- read c
- eval "command=($c)"
- exec "''${command[@]}"
- '';
- restartIfChanged = false;
- };
-
- systemd.services.container-startup-done =
- { description = "Container Startup Notification";
- wantedBy = [ "multi-user.target" ];
- after = [ "multi-user.target" ];
- script =
- ''
- if [ -p /var/lib/startup-done ]; then
- echo done > /var/lib/startup-done
- fi
- '';
- serviceConfig.Type = "oneshot";
- serviceConfig.RemainAfterExit = true;
- restartIfChanged = false;
- };
+ systemd.services.systemd-remount-fs.enable = false;
};
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index d0d04d9a1e5..3a603e0bbac 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -10,7 +10,7 @@ let
isExecutable = true;
src = ./nixos-container.pl;
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl";
- inherit (pkgs) socat;
+ inherit (pkgs) utillinux;
};
# The container's init script, a small wrapper around the regular
@@ -32,7 +32,10 @@ let
fi
fi
- exec "$1"
+ # Start the regular stage 1 script, passing the bind-mounted
+ # notification socket from the host to allow the container
+ # systemd to signal readiness to the host systemd.
+ NOTIFY_SOCKET=/var/lib/private/host-notify exec "$1"
'';
system = config.nixpkgs.system;
@@ -168,17 +171,23 @@ in
preStart =
''
- mkdir -p -m 0755 $root/var/lib
+ # Clean up existing machined registration and interfaces.
+ machinectl terminate "$INSTANCE" 2> /dev/null || true
- # Create a named pipe to get a signal when the container
- # has finished booting.
- rm -f $root/var/lib/startup-done
- mkfifo -m 0600 $root/var/lib/startup-done
+ if [ "$PRIVATE_NETWORK" = 1 ]; then
+ ip link del dev "ve-$INSTANCE" 2> /dev/null || true
+ fi
+
+
+ if [ "$PRIVATE_NETWORK" = 1 ]; then
+ ip link del dev "ve-$INSTANCE" 2> /dev/null || true
+ fi
'';
script =
''
mkdir -p -m 0755 "$root/etc" "$root/var/lib"
+ mkdir -p -m 0700 "$root/var/lib/private"
if ! [ -e "$root/etc/os-release" ]; then
touch "$root/etc/os-release"
fi
@@ -187,6 +196,8 @@ in
"/nix/var/nix/profiles/per-container/$INSTANCE" \
"/nix/var/nix/gcroots/per-container/$INSTANCE"
+ cp -f /etc/resolv.conf "$root/etc/resolv.conf"
+
if [ "$PRIVATE_NETWORK" = 1 ]; then
extraFlags+=" --network-veth"
fi
@@ -203,12 +214,16 @@ in
fi
''}
+ # Run systemd-nspawn without startup notification (we'll
+ # wait for the container systemd to signal readiness).
+ EXIT_ON_REBOOT=1 NOTIFY_SOCKET= \
exec ${config.systemd.package}/bin/systemd-nspawn \
--keep-unit \
-M "$INSTANCE" -D "$root" $extraFlags \
--bind-ro=/nix/store \
--bind-ro=/nix/var/nix/db \
--bind-ro=/nix/var/nix/daemon-socket \
+ --bind=/run/systemd/notify:/var/lib/private/host-notify \
--bind="/nix/var/nix/profiles/per-container/$INSTANCE:/nix/var/nix/profiles" \
--bind="/nix/var/nix/gcroots/per-container/$INSTANCE:/nix/var/nix/gcroots" \
--setenv PRIVATE_NETWORK="$PRIVATE_NETWORK" \
@@ -220,12 +235,6 @@ in
postStart =
''
- # This blocks until the container-startup-done service
- # writes something to this pipe. FIXME: it also hangs
- # until the start timeout expires if systemd-nspawn exits.
- read x < $root/var/lib/startup-done
- rm -f $root/var/lib/startup-done
-
if [ "$PRIVATE_NETWORK" = 1 ]; then
ifaceHost=ve-$INSTANCE
ip link set dev $ifaceHost up
@@ -240,23 +249,44 @@ in
preStop =
''
- machinectl poweroff "$INSTANCE"
+ machinectl poweroff "$INSTANCE" || true
'';
restartIfChanged = false;
#reloadIfChanged = true; # FIXME
- serviceConfig.ExecReload = pkgs.writeScript "reload-container"
- ''
- #! ${pkgs.stdenv.shell} -e
- SYSTEM_PATH=/nix/var/nix/profiles/system
- echo $SYSTEM_PATH/bin/switch-to-configuration test | \
- ${pkgs.socat}/bin/socat unix:$root/var/lib/run-command.socket -
- '';
+ serviceConfig = {
+ ExecReload = pkgs.writeScript "reload-container"
+ ''
+ #! ${pkgs.stdenv.shell} -e
+ ${nixos-container}/bin/nixos-container run "$INSTANCE" -- \
+ bash --login -c "/nix/var/nix/profiles/system/bin/switch-to-configuration test"
+ '';
- serviceConfig.SyslogIdentifier = "container %i";
+ SyslogIdentifier = "container %i";
- serviceConfig.EnvironmentFile = "-/etc/containers/%i.conf";
+ EnvironmentFile = "-/etc/containers/%i.conf";
+
+ Type = "notify";
+
+ NotifyAccess = "all";
+
+ # Note that on reboot, systemd-nspawn returns 133, so this
+ # unit will be restarted. On poweroff, it returns 0, so the
+ # unit won't be restarted.
+ RestartForceExitStatus = "133";
+ SuccessExitStatus = "133";
+
+ Restart = "on-failure";
+
+ # Hack: we don't want to kill systemd-nspawn, since we call
+ # "machinectl poweroff" in preStop to shut down the
+ # container cleanly. But systemd requires sending a signal
+ # (at least if we want remaining processes to be killed
+ # after the timeout). So send an ignored signal.
+ KillMode = "mixed";
+ KillSignal = "WINCH";
+ };
};
# Generate a configuration file in /etc/containers for each
@@ -290,5 +320,30 @@ in
environment.systemPackages = [ nixos-container ];
+ # Start containers at boot time.
+ systemd.services.all-containers =
+ { description = "All Containers";
+
+ wantedBy = [ "multi-user.target" ];
+
+ unitConfig.ConditionDirectoryNotEmpty = "/etc/containers";
+
+ serviceConfig.Type = "oneshot";
+
+ script =
+ ''
+ res=0
+ shopt -s nullglob
+ for i in /etc/containers/*.conf; do
+ AUTO_START=
+ source "$i"
+ if [ "$AUTO_START" = 1 ]; then
+ systemctl start "container@$(basename "$i" .conf).service" || res=1
+ fi
+ done
+ exit $res
+ ''; # */
+ };
+
};
}
diff --git a/nixos/modules/virtualisation/docker-image.nix b/nixos/modules/virtualisation/docker-image.nix
new file mode 100644
index 00000000000..13b861dc988
--- /dev/null
+++ b/nixos/modules/virtualisation/docker-image.nix
@@ -0,0 +1,67 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l;
+
+in {
+ # Create the tarball
+ system.build.dockerImage = import ../../lib/make-system-tarball.nix {
+ inherit (pkgs) stdenv perl xz pathsFromGraph;
+
+ contents = [];
+ extraArgs = "--owner=0";
+ storeContents = [
+ { object = config.system.build.toplevel + "/init";
+ symlink = "/bin/init";
+ }
+ ] ++ (pkgs2storeContents [ pkgs.stdenv ]);
+ };
+
+ boot.postBootCommands =
+ ''
+ # After booting, register the contents of the Nix store in the Nix
+ # database.
+ if [ -f /nix-path-registration ]; then
+ ${config.nix.package}/bin/nix-store --load-db < /nix-path-registration &&
+ rm /nix-path-registration
+ fi
+
+ # nixos-rebuild also requires a "system" profile and an
+ # /etc/NIXOS tag.
+ touch /etc/NIXOS
+ ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
+
+ # Set virtualisation to docker
+ echo "docker" > /run/systemd/container
+ '';
+
+
+ # docker image config
+ require = [
+ ../installer/cd-dvd/channel.nix
+ ../profiles/minimal.nix
+ ../profiles/clone-config.nix
+ ];
+
+ boot.isContainer = true;
+
+ # Iptables do not work in docker
+ networking.firewall.enable = false;
+
+ services.openssh.enable = true;
+
+ # Socket activated ssh presents problem in docker
+ services.openssh.startWhenNeeded = false;
+
+ # Allow the user to login as root without password
+ security.initialRootPassword = "";
+
+ # Some more help text.
+ services.mingetty.helpLine =
+ ''
+
+ Log in as "root" with an empty password.
+ '';
+}
diff --git a/nixos/modules/virtualisation/docker.nix b/nixos/modules/virtualisation/docker.nix
new file mode 100644
index 00000000000..1ce066cdc73
--- /dev/null
+++ b/nixos/modules/virtualisation/docker.nix
@@ -0,0 +1,110 @@
+# Systemd services for docker.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.virtualisation.docker;
+
+in
+
+{
+ ###### interface
+
+ options.virtualisation.docker = {
+ enable =
+ mkOption {
+ type = types.bool;
+ default = false;
+ description =
+ ''
+ This option enables docker, a daemon that manages
+ linux containers. Users in the "docker" group can interact with
+ the daemon (e.g. to start or stop containers) using the
+ docker command line tool.
+ '';
+ };
+ socketActivation =
+ mkOption {
+ type = types.bool;
+ default = false;
+ description =
+ ''
+ This option enables docker with socket activation. I.e. docker will
+ start when first called by client.
+
+ Note: This is false by default because systemd lower than 214 that
+ nixos uses so far, doesn't support SocketGroup option, so socket
+ created by docker has root group now. This will likely be changed
+ in future. So set this option explicitly to false if you wish.
+ '';
+ };
+ extraOptions =
+ mkOption {
+ type = types.str;
+ default = "";
+ description =
+ ''
+ The extra command-line options to pass to
+ docker daemon.
+ '';
+ };
+
+
+ };
+
+ ###### implementation
+
+ config = mkIf cfg.enable (mkMerge [
+ { environment.systemPackages = [ pkgs.docker ];
+ users.extraGroups.docker.gid = config.ids.gids.docker;
+ }
+ (mkIf cfg.socketActivation {
+
+ systemd.services.docker = {
+ description = "Docker Application Container Engine";
+ after = [ "network.target" "docker.socket" ];
+ requires = [ "docker.socket" ];
+ serviceConfig = {
+ ExecStart = "${pkgs.docker}/bin/docker --daemon=true --host=fd:// --group=docker ${cfg.extraOptions}";
+ # I'm not sure if that limits aren't too high, but it's what
+ # goes in config bundled with docker itself
+ LimitNOFILE = 1048576;
+ LimitNPROC = 1048576;
+ };
+ };
+
+ systemd.sockets.docker = {
+ description = "Docker Socket for the API";
+ wantedBy = [ "sockets.target" ];
+ socketConfig = {
+ ListenStream = "/var/run/docker.sock";
+ SocketMode = "0660";
+ SocketUser = "root";
+ SocketGroup = "docker";
+ };
+ };
+ })
+ (mkIf (!cfg.socketActivation) {
+
+ systemd.services.docker = {
+ description = "Docker Application Container Engine";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "network.target" ];
+ serviceConfig = {
+ ExecStart = "${pkgs.docker}/bin/docker --daemon=true --group=docker ${cfg.extraOptions}";
+ # I'm not sure if that limits aren't too high, but it's what
+ # goes in config bundled with docker itself
+ LimitNOFILE = 1048576;
+ LimitNPROC = 1048576;
+ };
+
+ # Presumably some containers are running we don't want to interrupt
+ restartIfChanged = false;
+ };
+ })
+ ]);
+
+}
diff --git a/nixos/modules/virtualisation/ec2-data.nix b/nixos/modules/virtualisation/ec2-data.nix
index 246d3506531..93a83a3e42a 100644
--- a/nixos/modules/virtualisation/ec2-data.nix
+++ b/nixos/modules/virtualisation/ec2-data.nix
@@ -22,21 +22,22 @@ with lib;
systemd.services."fetch-ec2-data" =
{ description = "Fetch EC2 Data";
- wantedBy = [ "multi-user.target" ];
+ wantedBy = [ "multi-user.target" "sshd.service" ];
before = [ "sshd.service" ];
- after = [ "network.target" ];
+ wants = [ "ip-up.target" ];
+ after = [ "ip-up.target" ];
- path = [ pkgs.curl pkgs.iproute ];
+ path = [ pkgs.wget pkgs.iproute ];
script =
''
ip route del blackhole 169.254.169.254/32 || true
- curl="curl --retry 3 --retry-delay 0 --fail"
+ wget="wget -q --retry-connrefused -O -"
echo "setting host name..."
${optionalString (config.networking.hostName == "") ''
- ${pkgs.nettools}/bin/hostname $($curl http://169.254.169.254/1.0/meta-data/hostname)
+ ${pkgs.nettools}/bin/hostname $($wget http://169.254.169.254/1.0/meta-data/hostname)
''}
# Don't download the SSH key if it has already been injected
@@ -44,7 +45,7 @@ with lib;
if ! [ -e /root/.ssh/authorized_keys ]; then
echo "obtaining SSH key..."
mkdir -p /root/.ssh
- $curl -o /root/key.pub http://169.254.169.254/1.0/meta-data/public-keys/0/openssh-key
+ $wget http://169.254.169.254/1.0/meta-data/public-keys/0/openssh-key > /root/key.pub
if [ $? -eq 0 -a -e /root/key.pub ]; then
if ! grep -q -f /root/key.pub /root/.ssh/authorized_keys; then
cat /root/key.pub >> /root/.ssh/authorized_keys
@@ -58,7 +59,7 @@ with lib;
# Extract the intended SSH host key for this machine from
# the supplied user data, if available. Otherwise sshd will
# generate one normally.
- $curl http://169.254.169.254/2011-01-01/user-data > /root/user-data || true
+ $wget http://169.254.169.254/2011-01-01/user-data > /root/user-data || true
key="$(sed 's/|/\n/g; s/SSH_HOST_DSA_KEY://; t; d' /root/user-data)"
key_pub="$(sed 's/SSH_HOST_DSA_KEY_PUB://; t; d' /root/user-data)"
if [ -n "$key" -a -n "$key_pub" -a ! -e /etc/ssh/ssh_host_dsa_key ]; then
diff --git a/nixos/modules/virtualisation/google-compute-image.nix b/nixos/modules/virtualisation/google-compute-image.nix
index d55b7420243..697423ac60b 100644
--- a/nixos/modules/virtualisation/google-compute-image.nix
+++ b/nixos/modules/virtualisation/google-compute-image.nix
@@ -119,21 +119,25 @@ in
169.254.169.254 metadata.google.internal metadata
'';
- systemd.services.fetch-root-authorized-keys =
- { description = "Fetch authorized_keys for root user";
+ networking.usePredictableInterfaceNames = false;
- wantedBy = [ "multi-user.target" ];
+ systemd.services.fetch-ssh-keys =
+ { description = "Fetch host keys and authorized_keys for root user";
+
+ wantedBy = [ "sshd.service" ];
before = [ "sshd.service" ];
- after = [ "network.target" ];
+ after = [ "network-online.target" ];
+ wants = [ "network-online.target" ];
- path = [ pkgs.curl ];
+ path = [ pkgs.wget ];
script =
''
+ wget="wget --retry-connrefused -t 6 --waitretry=10"
# Don't download the SSH key if it has already been downloaded
if ! [ -e /root/.ssh/authorized_keys ]; then
echo "obtaining SSH key..."
mkdir -p /root/.ssh
- curl -o /root/authorized-keys-metadata http://metadata/0.1/meta-data/authorized-keys
+ $wget -O /root/authorized-keys-metadata http://metadata/0.1/meta-data/authorized-keys
if [ $? -eq 0 -a -e /root/authorized-keys-metadata ]; then
cat /root/authorized-keys-metadata | cut -d: -f2- > /root/key.pub
if ! grep -q -f /root/key.pub /root/.ssh/authorized_keys; then
@@ -144,10 +148,26 @@ in
rm -f /root/key.pub /root/authorized-keys-metadata
fi
fi
+
+ echo "obtaining SSH private host key..."
+ $wget -O /root/ssh_host_ecdsa_key http://metadata/0.1/meta-data/attributes/ssh_host_ecdsa_key
+ if [ $? -eq 0 -a -e /root/ssh_host_ecdsa_key ]; then
+ mv -f /root/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key
+ echo "downloaded ssh_host_ecdsa_key"
+ chmod 600 /etc/ssh/ssh_host_ecdsa_key
+ fi
+
+ echo "obtaining SSH public host key..."
+ $wget -O /root/ssh_host_ecdsa_key.pub http://metadata/0.1/meta-data/attributes/ssh_host_ecdsa_key_pub
+ if [ $? -eq 0 -a -e /root/ssh_host_ecdsa_key.pub ]; then
+ mv -f /root/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
+ echo "downloaded ssh_host_ecdsa_key.pub"
+ chmod 644 /etc/ssh/ssh_host_ecdsa_key.pub
+ fi
'';
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
+ serviceConfig.StandardError = "journal+console";
+ serviceConfig.StandardOutput = "journal+console";
};
-
-
}
diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix
index d7d700d8841..2d03f0544b6 100644
--- a/nixos/modules/virtualisation/libvirtd.nix
+++ b/nixos/modules/virtualisation/libvirtd.nix
@@ -7,6 +7,7 @@ with lib;
let
cfg = config.virtualisation.libvirtd;
+ vswitch = config.virtualisation.vswitch;
configFile = pkgs.writeText "libvirtd.conf" ''
unix_sock_group = "libvirtd"
unix_sock_rw_perms = "0770"
@@ -56,6 +57,20 @@ in
'';
};
+ virtualisation.libvirtd.onShutdown =
+ mkOption {
+ type = types.enum ["shutdown" "suspend" ];
+ default = "suspend";
+ description =
+ ''
+ When shutting down / restarting the host what method should
+ be used to gracefully halt the guests. Setting to "shutdown"
+ will cause an ACPI shutdown of each guest. "suspend" will
+ attempt to save the state of the guests ready to restore on boot.
+ '';
+ };
+
+
};
@@ -73,12 +88,17 @@ in
{ description = "Libvirt Virtual Machine Management Daemon";
wantedBy = [ "multi-user.target" ];
- after = [ "systemd-udev-settle.service" ];
+ after = [ "systemd-udev-settle.service" ]
+ ++ optional vswitch.enable "vswitchd.service";
- path =
- [ pkgs.bridge_utils pkgs.dmidecode pkgs.dnsmasq
+ path = [
+ pkgs.bridge_utils
+ pkgs.dmidecode
+ pkgs.dnsmasq
pkgs.ebtables
- ] ++ optional cfg.enableKVM pkgs.qemu_kvm;
+ ]
+ ++ optional cfg.enableKVM pkgs.qemu_kvm
+ ++ optional vswitch.enable vswitch.package;
preStart =
''
@@ -109,12 +129,12 @@ in
# config file. But this path can unfortunately be garbage collected
# while still being used by the virtual machine. So update the
# emulator path on each startup to something valid (re-scan $PATH).
- for file in /etc/libvirt/qemu/*.xml; do
+ for file in /etc/libvirt/qemu/*.xml /etc/libvirt/lxc/*.xml; do
test -f "$file" || continue
# get (old) emulator path from config file
emulator=$(grep "^[[:space:]]*" "$file" | sed 's,^[[:space:]]*\(.*\).*,\1,')
# get a (definitely) working emulator path by re-scanning $PATH
- new_emulator=$(command -v $(basename "$emulator"))
+ new_emulator=$(PATH=${pkgs.libvirt}/libexec:$PATH command -v $(basename "$emulator"))
# write back
sed -i "s,^[[:space:]]*.*, $new_emulator ," "$file"
done
@@ -152,7 +172,12 @@ in
${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests start || true
'';
- postStop = "${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests stop";
+ postStop =
+ ''
+ export PATH=${pkgs.gettext}/bin:$PATH
+ export ON_SHUTDOWN=${cfg.onShutdown}
+ ${pkgs.libvirt}/etc/rc.d/init.d/libvirt-guests stop
+ '';
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
diff --git a/nixos/modules/virtualisation/nixos-container.pl b/nixos/modules/virtualisation/nixos-container.pl
index 5083abd8448..9ae5331786c 100644
--- a/nixos/modules/virtualisation/nixos-container.pl
+++ b/nixos/modules/virtualisation/nixos-container.pl
@@ -7,7 +7,7 @@ use File::Slurp;
use Fcntl ':flock';
use Getopt::Long qw(:config gnu_getopt);
-my $socat = '@socat@/bin/socat';
+my $nsenter = "@utillinux@/bin/nsenter";
# Ensure a consistent umask.
umask 0022;
@@ -17,25 +17,30 @@ umask 0022;
sub showHelp {
print < [--config ] [--ensure-unique-name]
+ nixos-container create [--system-path ] [--config ] [--ensure-unique-name] [--auto-start]
nixos-container destroy
nixos-container start
nixos-container stop
+ nixos-container status
nixos-container login
nixos-container root-login
nixos-container run -- args...
- nixos-container set-root-password
nixos-container show-ip
+ nixos-container show-host-key
EOF
exit 0;
}
+my $systemPath;
my $ensureUniqueName = 0;
+my $autoStart = 0;
my $extraConfig;
GetOptions(
"help" => sub { showHelp() },
"ensure-unique-name" => \$ensureUniqueName,
+ "auto-start" => \$autoStart,
+ "system-path=s" => \$systemPath,
"config=s" => \$extraConfig
) or exit 1;
@@ -122,17 +127,13 @@ if ($action eq "create") {
push @conf, "PRIVATE_NETWORK=1\n";
push @conf, "HOST_ADDRESS=$hostAddress\n";
push @conf, "LOCAL_ADDRESS=$localAddress\n";
+ push @conf, "AUTO_START=$autoStart\n";
write_file($confFile, \@conf);
close($lock);
print STDERR "host IP is $hostAddress, container IP is $localAddress\n";
- mkpath("$root/etc/nixos", 0, 0755);
-
- my $nixosConfigFile = "$root/etc/nixos/configuration.nix";
- writeNixOSConfig $nixosConfigFile;
-
# The per-container directory is restricted to prevent users on
# the host from messing with guest users who happen to have the
# same uid.
@@ -141,10 +142,21 @@ if ($action eq "create") {
$profileDir = "$profileDir/$containerName";
mkpath($profileDir, 0, 0755);
- system("nix-env", "-p", "$profileDir/system",
- "-I", "nixos-config=$nixosConfigFile", "-f", "",
- "--set", "-A", "system") == 0
- or die "$0: failed to build initial container configuration\n";
+ # Build/set the initial configuration.
+ if (defined $systemPath) {
+ system("nix-env", "-p", "$profileDir/system", "--set", $systemPath) == 0
+ or die "$0: failed to set initial container configuration\n";
+ } else {
+ mkpath("$root/etc/nixos", 0, 0755);
+
+ my $nixosConfigFile = "$root/etc/nixos/configuration.nix";
+ writeNixOSConfig $nixosConfigFile;
+
+ system("nix-env", "-p", "$profileDir/system",
+ "-I", "nixos-config=$nixosConfigFile", "-f", "",
+ "--set", "-A", "system") == 0
+ or die "$0: failed to build initial container configuration\n";
+ }
print "$containerName\n" if $ensureUniqueName;
exit 0;
@@ -152,8 +164,16 @@ if ($action eq "create") {
my $root = "/var/lib/containers/$containerName";
my $profileDir = "/nix/var/nix/profiles/per-container/$containerName";
+my $gcRootsDir = "/nix/var/nix/gcroots/per-container/$containerName";
my $confFile = "/etc/containers/$containerName.conf";
-die "$0: container ‘$containerName’ does not exist\n" if !-e $confFile;
+if (!-e $confFile) {
+ if ($action eq "destroy") {
+ exit 0;
+ } elsif ($action eq "status") {
+ print "gone\n";
+ }
+ die "$0: container ‘$containerName’ does not exist\n" ;
+}
sub isContainerRunning {
my $status = `systemctl show 'container\@$containerName'`;
@@ -165,14 +185,48 @@ sub stopContainer {
or die "$0: failed to stop container\n";
}
+# Return the PID of the init process of the container.
+sub getLeader {
+ my $s = `machinectl show "$containerName" -p Leader`;
+ chomp $s;
+ $s =~ /^Leader=(\d+)$/ or die "unable to get container's main PID\n";
+ return int($1);
+}
+
+# Run a command in the container.
+sub runInContainer {
+ my @args = @_;
+ my $leader = getLeader;
+ exec($nsenter, "-t", $leader, "-m", "-u", "-i", "-n", "-p", "--", @args);
+ die "cannot run ‘nsenter’: $!\n";
+}
+
+# Remove a directory while recursively unmounting all mounted filesystems within
+# that directory and unmounting/removing that directory afterwards as well.
+#
+# NOTE: If the specified path is a mountpoint, its contents will be removed,
+# only mountpoints underneath that path will be unmounted properly.
+sub safeRemoveTree {
+ my ($path) = @_;
+ system("find", $path, "-mindepth", "1", "-xdev",
+ "(", "-type", "d", "-exec", "mountpoint", "-q", "{}", ";", ")",
+ "-exec", "umount", "-fR", "{}", "+");
+ system("rm", "--one-file-system", "-rf", $path);
+ if (-e $path) {
+ system("umount", "-fR", $path);
+ system("rm", "--one-file-system", "-rf", $path);
+ }
+}
+
if ($action eq "destroy") {
die "$0: cannot destroy declarative container (remove it from your configuration.nix instead)\n"
unless POSIX::access($confFile, &POSIX::W_OK);
stopContainer if isContainerRunning;
- rmtree($profileDir) if -e $profileDir;
- rmtree($root) if -e $root;
+ safeRemoveTree($profileDir) if -e $profileDir;
+ safeRemoveTree($gcRootsDir) if -e $gcRootsDir;
+ safeRemoveTree($root) if -e $root;
unlink($confFile) or die;
}
@@ -185,6 +239,10 @@ elsif ($action eq "stop") {
stopContainer;
}
+elsif ($action eq "status") {
+ print isContainerRunning() ? "up" : "down", "\n";
+}
+
elsif ($action eq "update") {
my $nixosConfigFile = "$root/etc/nixos/configuration.nix";
@@ -209,28 +267,14 @@ elsif ($action eq "login") {
}
elsif ($action eq "root-login") {
- exec($socat, "unix:$root/var/lib/root-login.socket", "-,echo=0,raw");
+ runInContainer("su", "root", "-l");
}
elsif ($action eq "run") {
shift @ARGV; shift @ARGV;
- my $pid = open(SOCAT, "|-", $socat, "-t0", "-", "unix:$root/var/lib/run-command.socket") or die "$0: cannot start $socat: $!\n";
- print SOCAT join(' ', map { "'$_'" } @ARGV), "\n";
- flush SOCAT;
- waitpid($pid, 0);
- close(SOCAT);
-}
-
-elsif ($action eq "set-root-password") {
- # FIXME: don't get password from the command line.
- my $password = $ARGV[2] or die "$0: no password given\n";
- my $pid = open(SOCAT, "|-", $socat, "-t0", "-", "unix:$root/var/lib/run-command.socket") or die "$0: cannot start $socat: $!\n";
- print SOCAT "passwd\n";
- print SOCAT "$password\n";
- print SOCAT "$password\n";
- flush SOCAT;
- waitpid($pid, 0);
- close(SOCAT);
+ # Escape command.
+ my $s = join(' ', map { s/'/'\\''/g; "'$_'" } @ARGV);
+ runInContainer("su", "root", "-l", "-c", "exec " . $s);
}
elsif ($action eq "show-ip") {
@@ -239,6 +283,12 @@ elsif ($action eq "show-ip") {
print "$1\n";
}
+elsif ($action eq "show-host-key") {
+ my $fn = "$root/etc/ssh/ssh_host_ecdsa_key.pub";
+ exit 1 if ! -f $fn;
+ print read_file($fn);
+}
+
else {
die "$0: unknown action ‘$action’\n";
}
diff --git a/nixos/modules/virtualisation/openvswitch.nix b/nixos/modules/virtualisation/openvswitch.nix
new file mode 100644
index 00000000000..c1579d94657
--- /dev/null
+++ b/nixos/modules/virtualisation/openvswitch.nix
@@ -0,0 +1,117 @@
+# Systemd services for openvswitch
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.virtualisation.vswitch;
+
+in
+
+{
+
+ options = {
+
+ virtualisation.vswitch.enable = mkOption {
+ type = types.bool;
+ default = false;
+ description =
+ ''
+ Enable Open vSwitch. A configuration
+ daemon (ovs-server) will be started.
+ '';
+ };
+
+
+ virtualisation.vswitch.package = mkOption {
+ type = types.package;
+ default = pkgs.openvswitch;
+ description =
+ ''
+ Open vSwitch package to use.
+ '';
+ };
+
+ };
+
+ config = mkIf cfg.enable (let
+
+ # Where the communication sockets live
+ runDir = "/var/run/openvswitch";
+
+ # Where the config database live (can't be in nix-store)
+ stateDir = "/var/db/openvswitch";
+
+ # The path to the an initialized version of the database
+ db = pkgs.stdenv.mkDerivation {
+ name = "vswitch.db";
+ unpackPhase = "true";
+ buildPhase = "true";
+ buildInputs = with pkgs; [
+ cfg.package
+ ];
+ installPhase =
+ ''
+ ensureDir $out/
+ '';
+ };
+
+ in {
+
+ environment.systemPackages = [ cfg.package ];
+
+ boot.kernelModules = [ "tun" "openvswitch" ];
+
+ boot.extraModulePackages = [ cfg.package ];
+
+ systemd.services.ovsdb = {
+ description = "Open_vSwitch Database Server";
+ wantedBy = [ "multi-user.target" ];
+ after = [ "systemd-udev-settle.service" ];
+ wants = [ "vswitchd.service" ];
+ path = [ cfg.package ];
+ restartTriggers = [ db cfg.package ];
+ # Create the config database
+ preStart =
+ ''
+ mkdir -p ${runDir}
+ mkdir -p /var/db/openvswitch
+ chmod +w /var/db/openvswitch
+ if [[ ! -e /var/db/openvswitch/conf.db ]]; then
+ ${cfg.package}/bin/ovsdb-tool create \
+ "/var/db/openvswitch/conf.db" \
+ "${cfg.package}/share/openvswitch/vswitch.ovsschema"
+ fi
+ chmod -R +w /var/db/openvswitch
+ '';
+ serviceConfig.ExecStart =
+ ''
+ ${cfg.package}/bin/ovsdb-server \
+ --remote=punix:${runDir}/db.sock \
+ --private-key=db:Open_vSwitch,SSL,private_key \
+ --certificate=db:Open_vSwitch,SSL,certificate \
+ --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \
+ --unixctl=ovsdb.ctl.sock \
+ /var/db/openvswitch/conf.db
+ '';
+ serviceConfig.Restart = "always";
+ serviceConfig.RestartSec = 3;
+ postStart =
+ ''
+ ${cfg.package}/bin/ovs-vsctl --timeout 3 --retry --no-wait init
+ '';
+
+ };
+
+ systemd.services.vswitchd = {
+ description = "Open_vSwitch Daemon";
+ bindsTo = [ "ovsdb.service" ];
+ after = [ "ovsdb.service" ];
+ path = [ cfg.package ];
+ serviceConfig.ExecStart = ''${cfg.package}/bin/ovs-vswitchd'';
+ };
+
+ });
+
+}
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index bccf6583e47..a7610b3e11a 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -275,12 +275,10 @@ in
boot.loader.grub.device = mkVMOverride "/dev/vda";
- boot.initrd.supportedFilesystems = optional cfg.writableStore "unionfs-fuse";
-
boot.initrd.extraUtilsCommands =
''
# We need mke2fs in the initrd.
- cp ${pkgs.e2fsprogs}/sbin/mke2fs $out/bin
+ cp -vf --remove-destination ${pkgs.e2fsprogs}/sbin/mke2fs $out/bin
'';
boot.initrd.postDeviceCommands =
@@ -303,20 +301,6 @@ in
chmod 1777 $targetRoot/tmp
mkdir -p $targetRoot/boot
- ${optionalString cfg.writableStore ''
- mkdir -p /unionfs-chroot/ro-store
- mount --rbind $targetRoot/nix/store /unionfs-chroot/ro-store
-
- mkdir /unionfs-chroot/rw-store
- ${if cfg.writableStoreUseTmpfs then ''
- mount -t tmpfs -o "mode=755" none /unionfs-chroot/rw-store
- '' else ''
- mkdir $targetRoot/.nix-rw-store
- mount --bind $targetRoot/.nix-rw-store /unionfs-chroot/rw-store
- ''}
-
- unionfs -o allow_other,cow,nonempty,chroot=/unionfs-chroot,max_files=32768,hide_meta_files /rw-store=RW:/ro-store=RO $targetRoot/nix/store
- ''}
'';
# After booting, register the closure of the paths in
@@ -343,12 +327,13 @@ in
# configuration, where the regular value for the `fileSystems'
# attribute should be disregarded for the purpose of building a VM
# test image (since those filesystems don't exist in the VM).
- fileSystems = mkVMOverride
+ fileSystems = mkVMOverride (
{ "/".device = "/dev/vda";
- "/nix/store" =
+ ${if cfg.writableStore then "/nix/.ro-store" else "/nix/store"} =
{ device = "store";
fsType = "9p";
options = "trans=virtio,version=9p2000.L,msize=1048576,cache=loose";
+ neededForBoot = true;
};
"/tmp/xchg" =
{ device = "xchg";
@@ -362,6 +347,18 @@ in
options = "trans=virtio,version=9p2000.L,msize=1048576";
neededForBoot = true;
};
+ } // optionalAttrs cfg.writableStore
+ { "/nix/store" =
+ { fsType = "unionfs-fuse";
+ device = "unionfs";
+ options = "allow_other,cow,nonempty,chroot=/mnt-root,max_files=32768,hide_meta_files,dirs=/nix/.rw-store=rw:/nix/.ro-store=ro";
+ };
+ } // optionalAttrs (cfg.writableStore && cfg.writableStoreUseTmpfs)
+ { "/nix/.rw-store" =
+ { fsType = "tmpfs";
+ options = "mode=0755";
+ neededForBoot = true;
+ };
} // optionalAttrs cfg.useBootLoader
{ "/boot" =
{ device = "/dev/disk/by-label/boot";
@@ -369,7 +366,7 @@ in
options = "ro";
noCheck = true; # fsck fails on a r/o filesystem
};
- };
+ });
swapDevices = mkVMOverride [ ];
boot.initrd.luks.devices = mkVMOverride [];
@@ -379,14 +376,14 @@ in
system.build.vm = pkgs.runCommand "nixos-vm" { preferLocalBuild = true; }
''
- ensureDir $out/bin
+ mkdir -p $out/bin
ln -s ${config.system.build.toplevel} $out/system
ln -s ${pkgs.writeScript "run-nixos-vm" startVM} $out/bin/run-${vmName}-vm
'';
# When building a regular system configuration, override whatever
# video driver the host uses.
- services.xserver.videoDrivers = mkVMOverride [ "vesa" ];
+ services.xserver.videoDrivers = mkVMOverride [ "modesetting" ];
services.xserver.defaultDepth = mkVMOverride 0;
services.xserver.resolutions = mkVMOverride [ { x = 1024; y = 768; } ];
services.xserver.monitorSection =
diff --git a/nixos/modules/virtualisation/virtualbox-guest.nix b/nixos/modules/virtualisation/virtualbox-guest.nix
index b3847daf12c..a5a4db79787 100644
--- a/nixos/modules/virtualisation/virtualbox-guest.nix
+++ b/nixos/modules/virtualisation/virtualbox-guest.nix
@@ -11,7 +11,6 @@ let
in
-optionalAttrs (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) # ugly...
{
###### interface
@@ -33,6 +32,10 @@ optionalAttrs (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) # ugly...
###### implementation
config = mkIf cfg.enable {
+ assertions = [ {
+ assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64;
+ message = "Virtualbox not currently supported on ${pkgs.stdenv.system}";
+ } ];
environment.systemPackages = [ kernel.virtualboxGuestAdditions ];
diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix
index 594b3e93ffe..106b269d9e1 100644
--- a/nixos/modules/virtualisation/virtualbox-image.nix
+++ b/nixos/modules/virtualisation/virtualbox-image.nix
@@ -2,109 +2,132 @@
with lib;
-{
- system.build.virtualBoxImage =
- pkgs.vmTools.runInLinuxVM (
- pkgs.runCommand "virtualbox-image"
- { memSize = 768;
- preVM =
- ''
- mkdir $out
- diskImage=$out/image
- ${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "10G"
- mv closure xchg/
- '';
- postVM =
- ''
- echo "creating VirtualBox disk image..."
- ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -O vdi $diskImage $out/disk.vdi
- rm $diskImage
- '';
- buildInputs = [ pkgs.utillinux pkgs.perl ];
- exportReferencesGraph =
- [ "closure" config.system.build.toplevel ];
- }
- ''
- # Create a single / partition.
- ${pkgs.parted}/sbin/parted /dev/vda mklabel msdos
- ${pkgs.parted}/sbin/parted /dev/vda -- mkpart primary ext2 1M -1s
- . /sys/class/block/vda1/uevent
- mknod /dev/vda1 b $MAJOR $MINOR
+let
- # Create an empty filesystem and mount it.
- ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda1
- ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1
- mkdir /mnt
- mount /dev/vda1 /mnt
+ cfg = config.virtualbox;
- # The initrd expects these directories to exist.
- mkdir /mnt/dev /mnt/proc /mnt/sys
- mount --bind /proc /mnt/proc
- mount --bind /dev /mnt/dev
- mount --bind /sys /mnt/sys
+in {
- # Copy all paths in the closure to the filesystem.
- storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
+ options = {
+ virtualbox = {
+ baseImageSize = mkOption {
+ type = types.str;
+ default = "10G";
+ description = ''
+ The size of the VirtualBox base image. The size string should be on
+ a format the qemu-img command accepts.
+ '';
+ };
+ };
+ };
- echo "filling Nix store..."
- mkdir -p /mnt/nix/store
- set -f
- cp -prd $storePaths /mnt/nix/store/
-
- # Register the paths in the Nix database.
- printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
- chroot /mnt ${config.nix.package}/bin/nix-store --load-db
-
- # Create the system profile to allow nixos-rebuild to work.
- chroot /mnt ${config.nix.package}/bin/nix-env \
- -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
-
- # `nixos-rebuild' requires an /etc/NIXOS.
- mkdir -p /mnt/etc/nixos
- touch /mnt/etc/NIXOS
-
- # `switch-to-configuration' requires a /bin/sh
- mkdir -p /mnt/bin
- ln -s ${config.system.build.binsh}/bin/sh /mnt/bin/sh
-
- # Generate the GRUB menu.
- ln -s vda /dev/sda
- chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
-
- umount /mnt/proc /mnt/dev /mnt/sys
- umount /mnt
- ''
- );
-
- system.build.virtualBoxOVA = pkgs.runCommand "virtualbox-ova"
- { buildInputs = [ pkgs.linuxPackages.virtualbox ];
- vmName = "NixOS ${config.system.nixosVersion} (${pkgs.stdenv.system})";
- fileName = "nixos-${config.system.nixosVersion}-${pkgs.stdenv.system}.ova";
- }
- ''
- echo "creating VirtualBox VM..."
- export HOME=$PWD
- VBoxManage createvm --name "$vmName" --register \
- --ostype ${if pkgs.stdenv.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
- VBoxManage modifyvm "$vmName" \
- --memory 1536 --acpi on --vram 10 \
- --nictype1 virtio --nic1 nat \
- --audiocontroller ac97 --audio alsa \
- --rtcuseutc on \
- --usb on --mouse usbtablet
- VBoxManage storagectl "$vmName" --name SATA --add sata --portcount 4 --bootable on --hostiocache on
- VBoxManage storageattach "$vmName" --storagectl SATA --port 0 --device 0 --type hdd \
- --medium ${config.system.build.virtualBoxImage}/disk.vdi
-
- echo "exporting VirtualBox VM..."
- mkdir -p $out
- VBoxManage export "$vmName" --output "$out/$fileName"
- '';
-
- fileSystems."/".device = "/dev/disk/by-label/nixos";
-
- boot.loader.grub.version = 2;
- boot.loader.grub.device = "/dev/sda";
-
- services.virtualbox.enable = true;
+ config = {
+ system.build.virtualBoxImage =
+ pkgs.vmTools.runInLinuxVM (
+ pkgs.runCommand "virtualbox-image"
+ { memSize = 768;
+ preVM =
+ ''
+ mkdir $out
+ diskImage=$out/image
+ ${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "${cfg.baseImageSize}"
+ mv closure xchg/
+ '';
+ postVM =
+ ''
+ echo "creating VirtualBox disk image..."
+ ${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -O vdi $diskImage $out/disk.vdi
+ rm $diskImage
+ '';
+ buildInputs = [ pkgs.utillinux pkgs.perl ];
+ exportReferencesGraph =
+ [ "closure" config.system.build.toplevel ];
+ }
+ ''
+ # Create a single / partition.
+ ${pkgs.parted}/sbin/parted /dev/vda mklabel msdos
+ ${pkgs.parted}/sbin/parted /dev/vda -- mkpart primary ext2 1M -1s
+ . /sys/class/block/vda1/uevent
+ mknod /dev/vda1 b $MAJOR $MINOR
+
+ # Create an empty filesystem and mount it.
+ ${pkgs.e2fsprogs}/sbin/mkfs.ext4 -L nixos /dev/vda1
+ ${pkgs.e2fsprogs}/sbin/tune2fs -c 0 -i 0 /dev/vda1
+ mkdir /mnt
+ mount /dev/vda1 /mnt
+
+ # The initrd expects these directories to exist.
+ mkdir /mnt/dev /mnt/proc /mnt/sys
+ mount --bind /proc /mnt/proc
+ mount --bind /dev /mnt/dev
+ mount --bind /sys /mnt/sys
+
+ # Copy all paths in the closure to the filesystem.
+ storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
+
+ echo "filling Nix store..."
+ mkdir -p /mnt/nix/store
+ set -f
+ cp -prd $storePaths /mnt/nix/store/
+
+ mkdir -p /mnt/etc/nix
+ echo 'build-users-group = ' > /mnt/etc/nix/nix.conf
+
+ # Register the paths in the Nix database.
+ printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
+ chroot /mnt ${config.nix.package}/bin/nix-store --load-db
+
+ # Create the system profile to allow nixos-rebuild to work.
+ chroot /mnt ${config.nix.package}/bin/nix-env \
+ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
+
+ # `nixos-rebuild' requires an /etc/NIXOS.
+ mkdir -p /mnt/etc/nixos
+ touch /mnt/etc/NIXOS
+
+ # `switch-to-configuration' requires a /bin/sh
+ mkdir -p /mnt/bin
+ ln -s ${config.system.build.binsh}/bin/sh /mnt/bin/sh
+
+ # Generate the GRUB menu.
+ ln -s vda /dev/sda
+ chroot /mnt ${config.system.build.toplevel}/bin/switch-to-configuration boot
+
+ umount /mnt/proc /mnt/dev /mnt/sys
+ umount /mnt
+ ''
+ );
+
+ system.build.virtualBoxOVA = pkgs.runCommand "virtualbox-ova"
+ { buildInputs = [ pkgs.linuxPackages.virtualbox ];
+ vmName = "NixOS ${config.system.nixosVersion} (${pkgs.stdenv.system})";
+ fileName = "nixos-${config.system.nixosVersion}-${pkgs.stdenv.system}.ova";
+ }
+ ''
+ echo "creating VirtualBox VM..."
+ export HOME=$PWD
+ VBoxManage createvm --name "$vmName" --register \
+ --ostype ${if pkgs.stdenv.system == "x86_64-linux" then "Linux26_64" else "Linux26"}
+ VBoxManage modifyvm "$vmName" \
+ --memory 1536 --acpi on --vram 10 \
+ --nictype1 virtio --nic1 nat \
+ --audiocontroller ac97 --audio alsa \
+ --rtcuseutc on \
+ --usb on --mouse usbtablet
+ VBoxManage storagectl "$vmName" --name SATA --add sata --portcount 4 --bootable on --hostiocache on
+ VBoxManage storageattach "$vmName" --storagectl SATA --port 0 --device 0 --type hdd \
+ --medium ${config.system.build.virtualBoxImage}/disk.vdi
+
+ echo "exporting VirtualBox VM..."
+ mkdir -p $out
+ VBoxManage export "$vmName" --output "$out/$fileName"
+ '';
+
+ fileSystems."/".device = "/dev/disk/by-label/nixos";
+
+ boot.loader.grub.version = 2;
+ boot.loader.grub.device = "/dev/sda";
+
+ services.virtualbox.enable = true;
+ };
}
diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix
index f59f71b0d6f..5173c33cab7 100644
--- a/nixos/release-combined.nix
+++ b/nixos/release-combined.nix
@@ -1,3 +1,7 @@
+# This jobset defines the main NixOS channels (such as nixos-unstable
+# and nixos-14.04). The channel is updated every time the ‘tested’ job
+# succeeds, and all other jobs have finished (they may fail).
+
{ nixpkgs ? { outPath = ./..; revCount = 56789; shortRev = "gfedcba"; }
, stableBranch ? false
, supportedSystems ? [ "x86_64-linux" "i686-linux" ]
@@ -18,7 +22,7 @@ let
in rec {
nixos = removeMaintainers (import ./release.nix {
- inherit stableBranch;
+ inherit stableBranch supportedSystems;
nixpkgs = nixpkgsSrc;
});
@@ -30,33 +34,38 @@ in rec {
tested = pkgs.releaseTools.aggregate {
name = "nixos-${nixos.channel.version}";
meta = {
- description = "Release-critical builds for the NixOS unstable channel";
- maintainers = [ pkgs.lib.maintainers.eelco pkgs.lib.maintainers.shlevy ];
+ description = "Release-critical builds for the NixOS channel";
+ maintainers = [ pkgs.lib.maintainers.eelco ];
};
constituents =
- let all = x: [ x.x86_64-linux x.i686-linux ]; in
+ let all = x: map (system: x.${system}) supportedSystems; in
[ nixos.channel
+ (all nixos.dummy)
(all nixos.manual)
(all nixos.iso_minimal)
(all nixos.iso_graphical)
(all nixos.ova)
- # (all nixos.tests.efi-installer.simple)
- (all nixos.tests.containers)
+ #(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)
(all nixos.tests.installer.simple)
+ (all nixos.tests.installer.simpleLabels)
+ (all nixos.tests.installer.simpleProvided)
+ (all nixos.tests.installer.btrfsSimple)
+ (all nixos.tests.installer.btrfsSubvols)
+ (all nixos.tests.installer.btrfsSubvolDefault)
(all nixos.tests.ipv6)
(all nixos.tests.kde4)
(all nixos.tests.login)
(all nixos.tests.misc)
- (all nixos.tests.nat)
+ (all nixos.tests.nat.firewall)
+ (all nixos.tests.nat.standalone)
(all nixos.tests.nfs3)
(all nixos.tests.openssh)
(all nixos.tests.printing)
diff --git a/nixos/release-small.nix b/nixos/release-small.nix
new file mode 100644
index 00000000000..07cd672843e
--- /dev/null
+++ b/nixos/release-small.nix
@@ -0,0 +1,93 @@
+# This jobset is used to generate a NixOS channel that contains a
+# small subset of Nixpkgs, mostly useful for servers that need fast
+# security updates.
+
+{ nixpkgs ? { outPath = ./..; revCount = 56789; shortRev = "gfedcba"; }
+, stableBranch ? false
+, supportedSystems ? [ "x86_64-linux" ] # no i686-linux
+}:
+
+let
+
+ nixpkgsSrc = nixpkgs; # urgh
+
+ pkgs = import ./.. {};
+
+ lib = pkgs.lib;
+
+ nixos' = import ./release.nix {
+ inherit stableBranch supportedSystems;
+ nixpkgs = nixpkgsSrc;
+ };
+
+ nixpkgs' = builtins.removeAttrs (import ../pkgs/top-level/release.nix {
+ inherit supportedSystems;
+ nixpkgs = nixpkgsSrc;
+ }) [ "unstable" ];
+
+in rec {
+
+ nixos = {
+ inherit (nixos') channel manual iso_minimal dummy;
+ tests = {
+ inherit (nixos'.tests)
+ containers
+ firewall
+ ipv6
+ login
+ misc
+ nat
+ nfs3
+ openssh
+ proxy
+ simple;
+ installer = {
+ inherit (nixos'.tests.installer)
+ grub1
+ lvm
+ separateBoot
+ simple;
+ };
+ };
+ };
+
+ nixpkgs = {
+ inherit (nixpkgs')
+ apacheHttpd_2_2
+ apacheHttpd_2_4
+ cmake
+ cryptsetup
+ emacs
+ gettext
+ git
+ imagemagick
+ linux
+ mysql51
+ mysql55
+ nginx
+ nodejs
+ openjdk
+ openssh
+ php
+ postgresql92
+ postgresql93
+ python
+ rsyslog
+ stdenv
+ subversion
+ tarball
+ vim;
+ };
+
+ tested = pkgs.releaseTools.aggregate {
+ name = "nixos-${nixos.channel.version}";
+ meta = {
+ description = "Release-critical builds for the NixOS channel";
+ maintainers = [ lib.maintainers.eelco ];
+ };
+ constituents =
+ let all = x: map (system: x.${system}) supportedSystems; in
+ [ nixpkgs.tarball ] ++ lib.collect lib.isDerivation nixos;
+ };
+
+}
diff --git a/nixos/release.nix b/nixos/release.nix
index 8a8b77de5a5..cb79dd3a226 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -11,7 +11,9 @@ let
forAllSystems = pkgs.lib.genAttrs supportedSystems;
- callTest = fn: args: forAllSystems (system: import fn ({ inherit system; } // args));
+ scrubDrv = drv: let res = { inherit (drv) drvPath outPath type name system meta; outputName = "out"; out = res; }; in res;
+
+ callTest = fn: args: forAllSystems (system: scrubDrv (import fn ({ inherit system; } // args)));
pkgs = import nixpkgs { system = "x86_64-linux"; };
@@ -40,7 +42,7 @@ let
in
# Declare the ISO as a build product so that it shows up in Hydra.
- runCommand "nixos-iso-${config.system.nixosVersion}"
+ scrubDrv (runCommand "nixos-iso-${config.system.nixosVersion}"
{ meta = {
description = "NixOS installation CD (${description}) - ISO image for ${system}";
maintainers = map (x: lib.getAttr x lib.maintainers) maintainers;
@@ -51,7 +53,7 @@ let
''
mkdir -p $out/nix-support
echo "file iso" $iso/iso/*.iso* >> $out/nix-support/hydra-build-products
- ''; # */
+ ''); # */
makeSystemTarball =
@@ -78,6 +80,19 @@ let
};
+ makeClosure = module: buildFromConfig module (config: config.system.build.toplevel);
+
+
+ buildFromConfig = module: sel: forAllSystems (system: scrubDrv (sel (import ./lib/eval-config.nix {
+ inherit system;
+ modules = [ module versionModule ] ++ lib.singleton
+ ({ config, lib, ... }:
+ { fileSystems."/".device = lib.mkDefault "/dev/sda1";
+ boot.loader.grub.device = lib.mkDefault "/dev/sda";
+ });
+ }).config));
+
+
in rec {
channel =
@@ -112,8 +127,13 @@ in rec {
};
- manual = forAllSystems (system: (builtins.getAttr system iso_minimal).config.system.build.manual.manual);
- manpages = forAllSystems (system: (builtins.getAttr system iso_minimal).config.system.build.manual.manpages);
+ manual = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manual);
+ manualPDF = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manualPDF)).x86_64-linux;
+ manpages = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manpages);
+
+
+ # Build the initial ramdisk so Hydra can keep track of its size over time.
+ initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk);
iso_minimal = forAllSystems (system: makeIso {
@@ -136,12 +156,6 @@ in rec {
inherit system;
});
- iso_graphical_new_kernel = forAllSystems (system: makeIso {
- module = ./modules/installer/cd-dvd/installation-cd-graphical-new-kernel.nix;
- type = "graphical-new-kernel";
- inherit system;
- });
-
# A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF).
ova = forAllSystems (system:
@@ -160,7 +174,7 @@ in rec {
in
# Declare the OVA as a build product so that it shows up in Hydra.
- runCommand "nixos-ova-${config.system.nixosVersion}-${system}"
+ scrubDrv (runCommand "nixos-ova-${config.system.nixosVersion}-${system}"
{ meta = {
description = "NixOS VirtualBox appliance (${system})";
maintainers = lib.maintainers.eelco;
@@ -171,11 +185,24 @@ in rec {
mkdir -p $out/nix-support
fn=$(echo $ova/*.ova)
echo "file ova $fn" >> $out/nix-support/hydra-build-products
- '' # */
+ '') # */
);
+ # Ensure that all packages used by the minimal NixOS config end up in the channel.
+ dummy = forAllSystems (system: pkgs.runCommand "dummy"
+ { toplevel = (import lib/eval-config.nix {
+ inherit system;
+ modules = lib.singleton ({ config, pkgs, ... }:
+ { fileSystems."/".device = lib.mkDefault "/dev/sda1";
+ boot.loader.grub.device = lib.mkDefault "/dev/sda";
+ });
+ }).config.system.build.toplevel;
+ }
+ "mkdir $out; ln -s $toplevel $out/dummy");
+
+
# Provide a tarball that can be unpacked into an SD card, and easily
# boot that system from uboot (like for the sheevaplug).
# The pc variant helps preparing the expression for the system tarball
@@ -207,30 +234,37 @@ in rec {
# ‘nix-build tests/login.nix -A result’.
tests.avahi = callTest tests/avahi.nix {};
tests.bittorrent = callTest tests/bittorrent.nix {};
+ tests.blivet = callTest tests/blivet.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.installer.grub1 = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).grub1.test);
+ tests.installer.lvm = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).lvm.test);
+ tests.installer.rebuildCD = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).rebuildCD.test);
+ tests.installer.separateBoot = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).separateBoot.test);
+ tests.installer.simple = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).simple.test);
+ tests.installer.simpleLabels = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).simpleLabels.test);
+ tests.installer.simpleProvided = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).simpleProvided.test);
+ tests.installer.btrfsSimple = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).btrfsSimple.test);
+ tests.installer.btrfsSubvols = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).btrfsSubvols.test);
+ tests.installer.btrfsSubvolDefault = forAllSystems (system: scrubDrv (import tests/installer.nix { inherit system; }).btrfsSubvolDefault.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.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.nat.firewall = callTest tests/nat.nix { withFirewall = true; };
+ tests.nat.standalone = callTest tests/nat.nix { withFirewall = false; };
tests.nfs3 = callTest tests/nfs.nix { version = 3; };
+ tests.nsd = callTest tests/nsd.nix {};
tests.openssh = callTest tests/openssh.nix {};
tests.printing = callTest tests/printing.nix {};
tests.proxy = callTest tests/proxy.nix {};
@@ -241,4 +275,46 @@ in rec {
tests.udisks2 = callTest tests/udisks2.nix {};
tests.xfce = callTest tests/xfce.nix {};
+
+ /* Build a bunch of typical closures so that Hydra can keep track of
+ the evolution of closure sizes. */
+
+ closures = {
+
+ smallContainer = makeClosure ({ pkgs, ... }:
+ { boot.isContainer = true;
+ services.openssh.enable = true;
+ });
+
+ tinyContainer = makeClosure ({ pkgs, ... }:
+ { boot.isContainer = true;
+ imports = [ modules/profiles/minimal.nix ];
+ });
+
+ ec2 = makeClosure ({ pkgs, ... }:
+ { imports = [ modules/virtualisation/amazon-image.nix ];
+ });
+
+ kde = makeClosure ({ pkgs, ... }:
+ { services.xserver.enable = true;
+ services.xserver.displayManager.kdm.enable = true;
+ services.xserver.desktopManager.kde4.enable = true;
+ });
+
+ xfce = makeClosure ({ pkgs, ... }:
+ { services.xserver.enable = true;
+ services.xserver.desktopManager.xfce.enable = true;
+ });
+
+ # Linux/Apache/PostgreSQL/PHP stack.
+ lapp = makeClosure ({ pkgs, ... }:
+ { services.httpd.enable = true;
+ services.httpd.adminAddr = "foo@example.org";
+ services.postgresql.enable = true;
+ services.postgresql.package = pkgs.postgresql93;
+ environment.systemPackages = [ pkgs.php ];
+ });
+
+ };
+
}
diff --git a/nixos/tests/avahi.nix b/nixos/tests/avahi.nix
index b6f18087c56..3898ddb4e8e 100644
--- a/nixos/tests/avahi.nix
+++ b/nixos/tests/avahi.nix
@@ -1,6 +1,7 @@
# Test whether `avahi-daemon' and `libnss-mdns' work as expected.
import ./make-test.nix {
+ name = "avahi";
nodes = {
one =
diff --git a/nixos/tests/bittorrent.nix b/nixos/tests/bittorrent.nix
index b58657a5ecd..3500ad8ccc3 100644
--- a/nixos/tests/bittorrent.nix
+++ b/nixos/tests/bittorrent.nix
@@ -16,18 +16,19 @@ let
miniupnpdConf = nodes: pkgs.writeText "miniupnpd.conf"
''
ext_ifname=eth1
- listening_ip=${nodes.router.config.networking.interfaces.eth2.ipAddress}/24
+ listening_ip=${(pkgs.lib.head nodes.router.config.networking.interfaces.eth2.ip4).address}/24
allow 1024-65535 192.168.2.0/24 1024-65535
'';
in
{
+ name = "bittorrent";
nodes =
{ tracker =
{ config, pkgs, ... }:
- { environment.systemPackages = [ pkgs.transmission pkgs.bittorrent ];
+ { environment.systemPackages = [ pkgs.transmission pkgs.opentracker ];
# We need Apache on the tracker to serve the torrents.
services.httpd.enable = true;
@@ -52,7 +53,7 @@ in
{ environment.systemPackages = [ pkgs.transmission ];
virtualisation.vlans = [ 2 ];
networking.defaultGateway =
- nodes.router.config.networking.interfaces.eth2.ipAddress;
+ (pkgs.lib.head nodes.router.config.networking.interfaces.eth2.ip4).address;
networking.firewall.enable = false;
};
@@ -80,12 +81,12 @@ 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://${nodes.tracker.config.networking.interfaces.eth1.ipAddress}:6969/announce -o /tmp/test.torrent");
+ $tracker->succeed("transmission-create /tmp/data/test.tar.bz2 -t http://${(pkgs.lib.head nodes.tracker.config.networking.interfaces.eth1.ip4).address}:6969/announce -o /tmp/test.torrent");
$tracker->succeed("chmod 644 /tmp/test.torrent");
# Start the tracker. !!! use a less crappy tracker
$tracker->waitForUnit("network.target");
- $tracker->succeed("bittorrent-tracker --port 6969 --dfile /tmp/dstate >&2 &");
+ $tracker->succeed("opentracker -p 6969 >&2 &");
$tracker->waitForOpenPort(6969);
# Start the initial seeder.
diff --git a/nixos/tests/blivet.nix b/nixos/tests/blivet.nix
new file mode 100644
index 00000000000..acaf4fec614
--- /dev/null
+++ b/nixos/tests/blivet.nix
@@ -0,0 +1,85 @@
+import ./make-test.nix ({ pkgs, ... }: with pkgs.pythonPackages; rec {
+ name = "blivet";
+
+ machine = {
+ environment.systemPackages = [ pkgs.python blivet mock ];
+ boot.supportedFilesystems = [ "btrfs" "jfs" "reiserfs" "xfs" ];
+ virtualisation.memorySize = 768;
+ };
+
+ debugBlivet = false;
+ debugProgramCalls = false;
+
+ pythonTestRunner = pkgs.writeText "run-blivet-tests.py" ''
+ import sys
+ import logging
+
+ from unittest import TestLoader
+ from unittest.runner import TextTestRunner
+
+ ${pkgs.lib.optionalString debugProgramCalls ''
+ blivet_program_log = logging.getLogger("program")
+ blivet_program_log.setLevel(logging.DEBUG)
+ blivet_program_log.addHandler(logging.StreamHandler(sys.stderr))
+ ''}
+
+ ${pkgs.lib.optionalString debugBlivet ''
+ blivet_log = logging.getLogger("blivet")
+ blivet_log.setLevel(logging.DEBUG)
+ blivet_log.addHandler(logging.StreamHandler(sys.stderr))
+ ''}
+
+ runner = TextTestRunner(verbosity=2, failfast=False, buffer=False)
+ result = runner.run(TestLoader().discover('tests/', pattern='*_test.py'))
+ sys.exit(not result.wasSuccessful())
+ '';
+
+ blivetTest = pkgs.writeScript "blivet-test.sh" ''
+ #!${pkgs.stdenv.shell} -e
+
+ # Use the hosts temporary directory, because we have a tmpfs within the VM
+ # and we don't want to increase the memory size of the VM for no reason.
+ mkdir -p /tmp/xchg/bigtmp
+ TMPDIR=/tmp/xchg/bigtmp
+ export TMPDIR
+
+ mkPythonPath() {
+ nix-store -qR "$@" \
+ | sed -e 's|$|/lib/${pkgs.python.libPrefix}/site-packages|'
+ }
+
+ cp -Rd "${blivet.src}/tests" .
+
+ # Skip SELinux tests
+ rm -f tests/formats_test/selinux_test.py
+
+ # Race conditions in growing/shrinking during resync
+ rm -f tests/devicelibs_test/mdraid_*
+
+ # Deactivate small BTRFS device test, because it fails with newer btrfsprogs
+ sed -i -e '/^class *BTRFSAsRootTestCase3(/,/^[^ ]/ {
+ /^class *BTRFSAsRootTestCase3(/d
+ /^$/d
+ /^ /d
+ }' tests/devicelibs_test/btrfs_test.py
+
+ # How on earth can these tests ever work even upstream? O_o
+ sed -i -e '/def testDiskChunk[12]/,/^ *[^ ]/{n; s/^ */&return # /}' \
+ tests/partitioning_test.py
+
+ # fix hardcoded temporary directory
+ sed -i \
+ -e '1i import tempfile' \
+ -e 's|_STORE_FILE_PATH = .*|_STORE_FILE_PATH = tempfile.gettempdir()|' \
+ tests/loopbackedtestcase.py
+
+ PYTHONPATH=".:$(mkPythonPath "${blivet}" "${mock}" | paste -sd :)" \
+ python "${pythonTestRunner}"
+ '';
+
+ testScript = ''
+ $machine->waitForUnit("multi-user.target");
+ $machine->succeed("${blivetTest}");
+ $machine->execute("rm -rf /tmp/xchg/bigtmp");
+ '';
+})
diff --git a/nixos/tests/check-filesystems.nix b/nixos/tests/check-filesystems.nix
index 09401f9a3f4..71aa9649840 100644
--- a/nixos/tests/check-filesystems.nix
+++ b/nixos/tests/check-filesystems.nix
@@ -6,6 +6,8 @@
with import ../lib/build-vms.nix { inherit nixos nixpkgs system; };
rec {
+ name = "check-filesystems";
+
nodes = {
share = {pkgs, config, ...}: {
services.nfs.server.enable = true;
diff --git a/nixos/tests/common/user-account.nix b/nixos/tests/common/user-account.nix
index 0239a3c4d08..aa3a0b82bcd 100644
--- a/nixos/tests/common/user-account.nix
+++ b/nixos/tests/common/user-account.nix
@@ -1,11 +1,9 @@
{ pkgs, ... }:
{ users.extraUsers = pkgs.lib.singleton
- { name = "alice";
+ { isNormalUser = true;
+ name = "alice";
description = "Alice Foobar";
- home = "/home/alice";
- createHome = true;
- useDefaultShell = true;
password = "foobar";
uid = 1000;
};
diff --git a/nixos/tests/containers.nix b/nixos/tests/containers.nix
index 8ad9cd6e0d7..331324139a1 100644
--- a/nixos/tests/containers.nix
+++ b/nixos/tests/containers.nix
@@ -1,6 +1,7 @@
# Test for NixOS' container support.
import ./make-test.nix {
+ name = "containers";
machine =
{ config, pkgs, ... }:
@@ -34,7 +35,7 @@ import ./make-test.nix {
# multi-user.target, we should now be able to access it.
my $ip = $machine->succeed("nixos-container show-ip webserver");
chomp $ip;
- $machine->succeed("ping -c1 $ip");
+ #$machine->succeed("ping -c1 $ip"); # FIXME
$machine->succeed("curl --fail http://$ip/ > /dev/null");
# Stop the container.
@@ -55,23 +56,52 @@ import ./make-test.nix {
die if $id1 eq $id2;
+ # Put the root of $id2 into a bind mount.
+ $machine->succeed(
+ "mv /var/lib/containers/$id2 /id2-bindmount",
+ "mount --bind /id2-bindmount /var/lib/containers/$id1"
+ );
+
my $ip1 = $machine->succeed("nixos-container show-ip $id1");
chomp $ip1;
my $ip2 = $machine->succeed("nixos-container show-ip $id2");
chomp $ip2;
die if $ip1 eq $ip2;
+ # Create a directory and a file we can later check if it still exists
+ # after destruction of the container.
+ $machine->succeed(
+ "mkdir /nested-bindmount",
+ "echo important data > /nested-bindmount/dummy",
+ );
+
+ # Create a directory with a dummy file and bind-mount it into both
+ # containers.
+ foreach ($id1, $id2) {
+ my $importantPath = "/var/lib/containers/$_/very/important/data";
+ $machine->succeed(
+ "mkdir -p $importantPath",
+ "mount --bind /nested-bindmount $importantPath"
+ );
+ }
+
# Start one of them.
$machine->succeed("nixos-container start $id1");
# Execute commands via the root shell.
$machine->succeed("nixos-container run $id1 -- uname") =~ /Linux/ or die;
- $machine->succeed("nixos-container set-root-password $id1 foobar");
# Destroy the containers.
$machine->succeed("nixos-container destroy $id1");
$machine->succeed("nixos-container destroy $id2");
+ $machine->succeed(
+ # Check whether destruction of any container has killed important data
+ "grep -qF 'important data' /nested-bindmount/dummy",
+ # Ensure that the container path is gone
+ "test ! -e /var/lib/containers/$id1"
+ );
+
# Destroying a declarative container should fail.
$machine->fail("nixos-container destroy webserver");
'';
diff --git a/nixos/tests/firefox.nix b/nixos/tests/firefox.nix
index b42d473b802..77a6f6ac9e7 100644
--- a/nixos/tests/firefox.nix
+++ b/nixos/tests/firefox.nix
@@ -1,4 +1,5 @@
import ./make-test.nix ({ pkgs, ... }: {
+ name = "firefox";
machine =
{ config, pkgs, ... }:
diff --git a/nixos/tests/firewall.nix b/nixos/tests/firewall.nix
index d10e10b1d91..16922508c7c 100644
--- a/nixos/tests/firewall.nix
+++ b/nixos/tests/firewall.nix
@@ -1,6 +1,7 @@
# Test the firewall module.
import ./make-test.nix {
+ name = "firewall";
nodes =
{ walled =
diff --git a/nixos/tests/gnome3.nix b/nixos/tests/gnome3.nix
index f1a6ce63331..df30283e315 100644
--- a/nixos/tests/gnome3.nix
+++ b/nixos/tests/gnome3.nix
@@ -1,4 +1,5 @@
import ./make-test.nix {
+ name = "gnome3";
machine =
{ config, pkgs, ... }:
@@ -22,7 +23,7 @@ import ./make-test.nix {
$machine->succeed("su - alice -c 'DISPLAY=:0.0 gnome-terminal &'");
$machine->waitForWindow(qr/Terminal/);
- $machine->sleep(10);
+ $machine->sleep(20);
$machine->screenshot("screen");
'';
diff --git a/nixos/tests/gnome3_12.nix b/nixos/tests/gnome3_10.nix
similarity index 87%
rename from nixos/tests/gnome3_12.nix
rename to nixos/tests/gnome3_10.nix
index 92a1919b8cb..d081c8b5fc0 100644
--- a/nixos/tests/gnome3_12.nix
+++ b/nixos/tests/gnome3_10.nix
@@ -1,4 +1,5 @@
import ./make-test.nix {
+ name = "gnome3";
machine =
{ config, pkgs, ... }:
@@ -10,7 +11,7 @@ import ./make-test.nix {
services.xserver.displayManager.auto.enable = true;
services.xserver.displayManager.auto.user = "alice";
services.xserver.desktopManager.gnome3.enable = true;
- environment.gnome3.packageSet = pkgs.gnome3_12;
+ environment.gnome3.packageSet = pkgs.gnome3_10;
};
testScript =
@@ -23,7 +24,7 @@ import ./make-test.nix {
$machine->succeed("su - alice -c 'DISPLAY=:0.0 gnome-terminal &'");
$machine->waitForWindow(qr/Terminal/);
- $machine->sleep(10);
+ $machine->sleep(20);
$machine->screenshot("screen");
'';
diff --git a/nixos/tests/influxdb.nix b/nixos/tests/influxdb.nix
index 278b264170f..9f8ea061b96 100644
--- a/nixos/tests/influxdb.nix
+++ b/nixos/tests/influxdb.nix
@@ -1,6 +1,8 @@
# This test runs influxdb and checks if influxdb is up and running
import ./make-test.nix {
+ name = "influxdb";
+
nodes = {
one = { config, pkgs, ... }: {
services.influxdb.enable = true;
diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix
index 98e8142a0df..4ee0e064c10 100644
--- a/nixos/tests/installer.nix
+++ b/nixos/tests/installer.nix
@@ -6,13 +6,13 @@ with pkgs.lib;
let
- # Build the ISO. This is the regular installation CD but with test
- # instrumentation.
+ # Build the ISO. This is the regular minimal installation CD but
+ # with test instrumentation.
iso =
(import ../lib/eval-config.nix {
inherit system;
modules =
- [ ../modules/installer/cd-dvd/installation-cd-graphical.nix
+ [ ../modules/installer/cd-dvd/installation-cd-minimal.nix
../modules/testing/test-instrumentation.nix
{ key = "serial";
boot.loader.grub.timeout = mkOverride 0 0;
@@ -35,26 +35,28 @@ let
# The configuration to install.
- makeConfig = { testChannel, useEFI, grubVersion, grubDevice }: pkgs.writeText "configuration.nix"
- ''
+ makeConfig = { testChannel, grubVersion, grubDevice, grubIdentifier
+ , readOnly ? true, forceGrubReinstallCount ? 0 }:
+ pkgs.writeText "configuration.nix" ''
{ config, pkgs, modulesPath, ... }:
{ imports =
[ ./hardware-configuration.nix
+
];
- ${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.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.fsIdentifier = "${grubIdentifier}";
+
+ boot.loader.grub.configurationLimit = 100 + ${toString forceGrubReinstallCount};
+
+ ${optionalString (!readOnly) "nix.readOnlyStore = false;"}
environment.systemPackages = [ ${optionalString testChannel "pkgs.rlwrap"} ];
}
@@ -93,16 +95,14 @@ let
# disk, and then reboot from the hard disk. It's parameterized with
# a test script fragment `createPartitions', which must create
# partitions and filesystems.
- testScriptFun = { createPartitions, testChannel, useEFI, grubVersion, grubDevice }:
+ testScriptFun = { createPartitions, testChannel, grubVersion, grubDevice, grubIdentifier }:
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";
+ iface = if 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}", '';
+ (if iso.system == "x86_64-linux" then "-m 768 " else "-m 512 ") +
+ (optionalString (iso.system == "x86_64-linux") "-cpu kvm64 ");
+ hdFlags =''hda => "harddisk", hdaInterface => "${iface}", '';
in
''
createDisk("harddisk", 4 * 1024);
@@ -161,7 +161,7 @@ let
$machine->succeed("cat /mnt/etc/nixos/hardware-configuration.nix >&2");
$machine->copyFileFromHost(
- "${ makeConfig { inherit testChannel useEFI grubVersion grubDevice; } }",
+ "${ makeConfig { inherit testChannel grubVersion grubDevice grubIdentifier; } }",
"/mnt/etc/nixos/configuration.nix");
# Perform the installation.
@@ -182,11 +182,7 @@ let
# Did /boot get mounted?
$machine->waitForUnit("local-fs.target");
- ${if useEFI then ''
- $machine->succeed("test -e /boot/efi");
- '' else ''
- $machine->succeed("test -e /boot/grub");
- ''}
+ $machine->succeed("test -e /boot/grub");
# Did the swap device get activated?
$machine->waitForUnit("swap.target");
@@ -197,16 +193,30 @@ let
$machine->succeed("type -tP ls | tee /dev/stderr") =~ /.nix-profile/
or die "nix-env failed";
+ # We need to a writable nix-store on next boot
+ $machine->copyFileFromHost(
+ "${ makeConfig { inherit testChannel grubVersion grubDevice grubIdentifier; readOnly = false; forceGrubReinstallCount = 1; } }",
+ "/etc/nixos/configuration.nix");
+
# Check whether nixos-rebuild works.
$machine->succeed("nixos-rebuild switch >&2");
# Test nixos-option.
$machine->succeed("nixos-option boot.initrd.kernelModules | grep virtio_console");
- $machine->succeed("nixos-option -d boot.initrd.kernelModules | grep 'List of modules'");
- $machine->succeed("nixos-option -l boot.initrd.kernelModules | grep qemu-guest.nix");
+ $machine->succeed("nixos-option boot.initrd.kernelModules | grep 'List of modules'");
+ $machine->succeed("nixos-option boot.initrd.kernelModules | grep qemu-guest.nix");
$machine->shutdown;
+ # Check whether a writable store build works
+ $machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
+ $machine->waitForUnit("multi-user.target");
+ $machine->copyFileFromHost(
+ "${ makeConfig { inherit testChannel grubVersion grubDevice grubIdentifier; readOnly = false; forceGrubReinstallCount = 2; } }",
+ "/etc/nixos/configuration.nix");
+ $machine->succeed("nixos-rebuild boot >&2");
+ $machine->shutdown;
+
# And just to be sure, check that the machine still boots after
# "nixos-rebuild switch".
$machine = createMachine({ ${hdFlags} qemuFlags => "${qemuFlags}" });
@@ -215,13 +225,14 @@ let
'';
- makeInstallerTest =
- { createPartitions, testChannel ? false, useEFI ? false, grubVersion ? 2, grubDevice ? "/dev/vda" }:
+ makeInstallerTest = name:
+ { createPartitions, testChannel ? false, grubVersion ? 2, grubDevice ? "/dev/vda", grubIdentifier ? "uuid" }:
makeTest {
inherit iso;
+ name = "installer-" + name;
nodes = if testChannel then { inherit webserver; } else { };
testScript = testScriptFun {
- inherit createPartitions testChannel useEFI grubVersion grubDevice;
+ inherit createPartitions testChannel grubVersion grubDevice grubIdentifier;
};
};
@@ -233,7 +244,7 @@ in {
# The (almost) simplest partitioning scheme: a swap partition and
# one big filesystem partition.
- simple = makeInstallerTest
+ simple = makeInstallerTest "simple"
{ createPartitions =
''
$machine->succeed(
@@ -251,7 +262,7 @@ in {
};
# Same as the previous, but now with a separate /boot partition.
- separateBoot = makeInstallerTest
+ separateBoot = makeInstallerTest "separateBoot"
{ createPartitions =
''
$machine->succeed(
@@ -273,7 +284,7 @@ in {
# Create two physical LVM partitions combined into one volume group
# that contains the logical swap and root partitions.
- lvm = makeInstallerTest
+ lvm = makeInstallerTest "lvm"
{ createPartitions =
''
$machine->succeed(
@@ -295,7 +306,7 @@ in {
'';
};
- swraid = makeInstallerTest
+ swraid = makeInstallerTest "swraid"
{ createPartitions =
''
$machine->succeed(
@@ -328,7 +339,7 @@ in {
};
# Test a basic install using GRUB 1.
- grub1 = makeInstallerTest
+ grub1 = makeInstallerTest "grub1"
{ createPartitions =
''
$machine->succeed(
@@ -347,28 +358,10 @@ in {
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 = makeTest
{ inherit iso;
+ name = "rebuild-cd";
nodes = { };
testScript =
''
@@ -392,4 +385,103 @@ in {
$machine->shutdown;
'';
};
+
+ # Test using labels to identify volumes in grub
+ simpleLabels = makeInstallerTest "simpleLabels" {
+ createPartitions = ''
+ $machine->succeed(
+ "sgdisk -Z /dev/vda",
+ "sgdisk -n 1:0:+1M -n 2:0:+1G -N 3 -t 1:ef02 -t 2:8200 -t 3:8300 -c 3:root /dev/vda",
+ "mkswap /dev/vda2 -L swap",
+ "swapon -L swap",
+ "mkfs.ext4 -L root /dev/vda3",
+ "mount LABEL=root /mnt",
+ );
+ '';
+ grubIdentifier = "label";
+ };
+
+ # Test using the provided disk name within grub
+ # TODO: Fix udev so the symlinks are unneeded in /dev/disks
+ simpleProvided = makeInstallerTest "simpleProvided" {
+ createPartitions = ''
+ my $UUID = "\$(blkid -s UUID -o value /dev/vda2)";
+ $machine->succeed(
+ "sgdisk -Z /dev/vda",
+ "sgdisk -n 1:0:+1M -n 2:0:+100M -n 3:0:+1G -N 4 -t 1:ef02 -t 2:8300 -t 3:8200 -t 4:8300 -c 2:boot -c 4:root /dev/vda",
+ "mkswap /dev/vda3 -L swap",
+ "swapon -L swap",
+ "mkfs.ext4 -L boot /dev/vda2",
+ "mkfs.ext4 -L root /dev/vda4",
+ );
+ $machine->execute("ln -s ../../vda2 /dev/disk/by-uuid/$UUID");
+ $machine->execute("ln -s ../../vda4 /dev/disk/by-label/root");
+ $machine->succeed(
+ "mount /dev/disk/by-label/root /mnt",
+ "mkdir /mnt/boot",
+ "mount /dev/disk/by-uuid/$UUID /mnt/boot"
+ );
+ '';
+ grubIdentifier = "provided";
+ };
+
+ # Simple btrfs grub testing
+ btrfsSimple = makeInstallerTest "btrfsSimple" {
+ createPartitions = ''
+ $machine->succeed(
+ "sgdisk -Z /dev/vda",
+ "sgdisk -n 1:0:+1M -n 2:0:+1G -N 3 -t 1:ef02 -t 2:8200 -t 3:8300 -c 3:root /dev/vda",
+ "mkswap /dev/vda2 -L swap",
+ "swapon -L swap",
+ "mkfs.btrfs -L root /dev/vda3",
+ "mount LABEL=root /mnt",
+ );
+ '';
+ };
+
+ # Test to see if we can detect /boot and /nix on subvolumes
+ btrfsSubvols = makeInstallerTest "btrfsSubvols" {
+ createPartitions = ''
+ $machine->succeed(
+ "sgdisk -Z /dev/vda",
+ "sgdisk -n 1:0:+1M -n 2:0:+1G -N 3 -t 1:ef02 -t 2:8200 -t 3:8300 -c 3:root /dev/vda",
+ "mkswap /dev/vda2 -L swap",
+ "swapon -L swap",
+ "mkfs.btrfs -L root /dev/vda3",
+ "btrfs device scan",
+ "mount LABEL=root /mnt",
+ "btrfs subvol create /mnt/boot",
+ "btrfs subvol create /mnt/nixos",
+ "btrfs subvol create /mnt/nixos/default",
+ "umount /mnt",
+ "mount -o defaults,subvol=nixos/default LABEL=root /mnt",
+ "mkdir /mnt/boot",
+ "mount -o defaults,subvol=boot LABEL=root /mnt/boot",
+ );
+ '';
+ };
+
+ # Test to see if we can detect default and aux subvolumes correctly
+ btrfsSubvolDefault = makeInstallerTest "btrfsSubvolDefault" {
+ createPartitions = ''
+ $machine->succeed(
+ "sgdisk -Z /dev/vda",
+ "sgdisk -n 1:0:+1M -n 2:0:+1G -N 3 -t 1:ef02 -t 2:8200 -t 3:8300 -c 3:root /dev/vda",
+ "mkswap /dev/vda2 -L swap",
+ "swapon -L swap",
+ "mkfs.btrfs -L root /dev/vda3",
+ "btrfs device scan",
+ "mount LABEL=root /mnt",
+ "btrfs subvol create /mnt/badpath",
+ "btrfs subvol create /mnt/badpath/boot",
+ "btrfs subvol create /mnt/nixos",
+ "btrfs subvol set-default \$(btrfs subvol list /mnt | grep 'nixos' | awk '{print \$2}') /mnt",
+ "umount /mnt",
+ "mount -o defaults LABEL=root /mnt",
+ "mkdir -p /mnt/badpath/boot", # Help ensure the detection mechanism is actually looking up subvolumes
+ "mkdir /mnt/boot",
+ "mount -o defaults,subvol=badpath/boot LABEL=root /mnt/boot",
+ );
+ '';
+ };
}
diff --git a/nixos/tests/ipv6.nix b/nixos/tests/ipv6.nix
index eb15363d3c3..017511ea45c 100644
--- a/nixos/tests/ipv6.nix
+++ b/nixos/tests/ipv6.nix
@@ -2,6 +2,7 @@
# solicication/advertisement using radvd works.
import ./make-test.nix {
+ name = "ipv6";
nodes =
{ client = { config, pkgs, ... }: { };
@@ -36,6 +37,7 @@ import ./make-test.nix {
$client->waitForUnit("network.target");
$server->waitForUnit("network.target");
+ $server->waitForUnit("httpd.service");
# Wait until the given interface has a non-tentative address of
# the desired scope (i.e. has completed Duplicate Address
diff --git a/nixos/tests/jenkins.nix b/nixos/tests/jenkins.nix
index ad7ea78ac49..3f4a197ebcc 100644
--- a/nixos/tests/jenkins.nix
+++ b/nixos/tests/jenkins.nix
@@ -4,6 +4,7 @@
# 3. jenkins service not started on slave node
import ./make-test.nix {
+ name = "jenkins";
nodes = {
@@ -15,6 +16,8 @@ import ./make-test.nix {
services.jenkinsSlave.enable = true;
users.extraUsers.jenkins.extraGroups = [ "users" ];
+
+ systemd.services.jenkins.serviceConfig.TimeoutStartSec = "3min";
};
slave =
diff --git a/nixos/tests/kde4.nix b/nixos/tests/kde4.nix
index 99a82a6b95d..fcc5101feb3 100644
--- a/nixos/tests/kde4.nix
+++ b/nixos/tests/kde4.nix
@@ -1,4 +1,5 @@
import ./make-test.nix ({ pkgs, ... }: {
+ name = "kde4";
machine =
{ config, pkgs, ... }:
@@ -31,7 +32,7 @@ import ./make-test.nix ({ pkgs, ... }: {
pkgs.kde4.kdegraphics
pkgs.kde4.kdeutils
pkgs.kde4.kdegames
- pkgs.kde4.kdeedu
+ #pkgs.kde4.kdeedu
pkgs.kde4.kdeaccessibility
pkgs.kde4.kdeadmin
pkgs.kde4.kdenetwork
diff --git a/nixos/tests/kexec.nix b/nixos/tests/kexec.nix
index b09287682c0..0f0565a60e9 100644
--- a/nixos/tests/kexec.nix
+++ b/nixos/tests/kexec.nix
@@ -1,6 +1,7 @@
# Test whether fast reboots via kexec work.
import ./make-test.nix {
+ name = "kexec";
machine = { config, pkgs, ... }:
{ virtualisation.vlans = [ ]; };
diff --git a/nixos/tests/login.nix b/nixos/tests/login.nix
index 44c53c231c8..e8373219ca6 100644
--- a/nixos/tests/login.nix
+++ b/nixos/tests/login.nix
@@ -1,6 +1,7 @@
import ./make-test.nix ({ pkgs, latestKernel ? false, ... }:
{
+ name = "login";
machine =
{ config, pkgs, lib, ... }:
diff --git a/nixos/tests/logstash.nix b/nixos/tests/logstash.nix
index e6aba7a1012..7284cde7a33 100644
--- a/nixos/tests/logstash.nix
+++ b/nixos/tests/logstash.nix
@@ -2,6 +2,7 @@
# elasticsearch is started.
import ./make-test.nix {
+ name = "logstash";
nodes = {
one =
diff --git a/nixos/tests/misc.nix b/nixos/tests/misc.nix
index 8caef146ec8..e1830d95b41 100644
--- a/nixos/tests/misc.nix
+++ b/nixos/tests/misc.nix
@@ -1,6 +1,7 @@
# Miscellaneous small tests that don't warrant their own VM run.
import ./make-test.nix {
+ name = "misc";
machine =
{ config, lib, pkgs, ... }:
@@ -11,8 +12,7 @@ import ./make-test.nix {
services.nixosManual.enable = mkOverride 0 true;
systemd.tmpfiles.rules = [ "d /tmp 1777 root root 10d" ];
fileSystems = mkVMOverride { "/tmp2" =
- { device = "none";
- fsType = "tmpfs";
+ { fsType = "tmpfs";
options = "mode=1777,noauto";
};
};
diff --git a/nixos/tests/mpich.nix b/nixos/tests/mpich.nix
index 13cd0960d07..a4ef7b62426 100644
--- a/nixos/tests/mpich.nix
+++ b/nixos/tests/mpich.nix
@@ -1,6 +1,8 @@
# Simple example to showcase distributed tests using NixOS VMs.
import ./make-test.nix {
+ name = "mpich";
+
nodes = {
master =
{ config, pkgs, ... }: {
diff --git a/nixos/tests/mumble.nix b/nixos/tests/mumble.nix
index 68ab8b642b0..3759d73355d 100644
--- a/nixos/tests/mumble.nix
+++ b/nixos/tests/mumble.nix
@@ -7,6 +7,8 @@ let
};
in
{
+ name = "mumble";
+
nodes = {
server = { config, pkgs, ... }: {
services.murmur.enable = true;
@@ -28,21 +30,21 @@ in
$client1->execute("mumble mumble://client1\@server/test &");
$client2->execute("mumble mumble://client2\@server/test &");
- $client1->waitForWindow(qr/Mumble/);
- $client2->waitForWindow(qr/Mumble/);
- $server->sleep(3); # Wait some more for the Mumble UI
-
# cancel client audio configuration
+ $client1->waitForWindow(qr/Audio Tuning Wizard/);
+ $client2->waitForWindow(qr/Audio Tuning Wizard/);
$client1->sendKeys("esc");
$client2->sendKeys("esc");
- $server->sleep(1);
# cancel client cert configuration
+ $client1->waitForWindow(qr/Certificate Management/);
+ $client2->waitForWindow(qr/Certificate Management/);
$client1->sendKeys("esc");
$client2->sendKeys("esc");
- $server->sleep(1);
# accept server certificate
+ $client1->waitForWindow(qr/^Mumble$/);
+ $client2->waitForWindow(qr/^Mumble$/);
$client1->sendChars("y");
$client2->sendChars("y");
diff --git a/nixos/tests/munin.nix b/nixos/tests/munin.nix
index acc4b949ab5..1e51453df83 100644
--- a/nixos/tests/munin.nix
+++ b/nixos/tests/munin.nix
@@ -2,6 +2,7 @@
# machine.
import ./make-test.nix {
+ name = "munin";
nodes = {
one =
@@ -17,6 +18,7 @@ import ./make-test.nix {
'';
};
};
+ systemd.services.munin-node.serviceConfig.TimeoutStartSec = "3min";
};
};
diff --git a/nixos/tests/mysql-replication.nix b/nixos/tests/mysql-replication.nix
index 7d0cf6d85a1..5786fdbc58c 100644
--- a/nixos/tests/mysql-replication.nix
+++ b/nixos/tests/mysql-replication.nix
@@ -6,6 +6,8 @@ let
in
{
+ name = "mysql-replication";
+
nodes = {
master =
{ pkgs, config, ... }:
diff --git a/nixos/tests/mysql.nix b/nixos/tests/mysql.nix
index 566d03baf36..0a753b9b625 100644
--- a/nixos/tests/mysql.nix
+++ b/nixos/tests/mysql.nix
@@ -1,4 +1,5 @@
import ./make-test.nix {
+ name = "mysql";
nodes = {
master =
diff --git a/nixos/tests/nat.nix b/nixos/tests/nat.nix
index 02981469e10..c4d2614f785 100644
--- a/nixos/tests/nat.nix
+++ b/nixos/tests/nat.nix
@@ -3,76 +3,81 @@
# client on the inside network, a server on the outside network, and a
# router connected to both that performs Network Address Translation
# for the client.
+import ./make-test.nix ({ withFirewall, ... }:
+ let
+ unit = if withFirewall then "firewall" else "nat";
+ in
+ {
+ name = "nat${if withFirewall then "WithFirewall" else "Standalone"}";
-import ./make-test.nix {
+ nodes =
+ { client =
+ { config, pkgs, nodes, ... }:
+ { virtualisation.vlans = [ 1 ];
+ networking.firewall.allowPing = true;
+ networking.defaultGateway =
+ (pkgs.lib.head nodes.router.config.networking.interfaces.eth2.ip4).address;
+ };
- nodes =
- { client =
- { config, pkgs, nodes, ... }:
- { virtualisation.vlans = [ 1 ];
- networking.firewall.allowPing = true;
- networking.defaultGateway =
- nodes.router.config.networking.interfaces.eth2.ipAddress;
- };
+ router =
+ { config, pkgs, ... }:
+ { virtualisation.vlans = [ 2 1 ];
+ networking.firewall.enable = withFirewall;
+ networking.firewall.allowPing = true;
+ networking.nat.enable = true;
+ networking.nat.internalIPs = [ "192.168.1.0/24" ];
+ networking.nat.externalInterface = "eth1";
+ };
- router =
- { config, pkgs, ... }:
- { virtualisation.vlans = [ 2 1 ];
- networking.firewall.allowPing = true;
- networking.nat.enable = true;
- networking.nat.internalIPs = [ "192.168.1.0/24" ];
- networking.nat.externalInterface = "eth1";
- };
+ server =
+ { config, pkgs, ... }:
+ { virtualisation.vlans = [ 2 ];
+ networking.firewall.enable = false;
+ services.httpd.enable = true;
+ services.httpd.adminAddr = "foo@example.org";
+ services.vsftpd.enable = true;
+ services.vsftpd.anonymousUser = true;
+ };
+ };
- server =
- { config, pkgs, ... }:
- { virtualisation.vlans = [ 2 ];
- networking.firewall.enable = false;
- services.httpd.enable = true;
- services.httpd.adminAddr = "foo@example.org";
- services.vsftpd.enable = true;
- services.vsftpd.anonymousUser = true;
- };
- };
+ testScript =
+ { nodes, ... }:
+ ''
+ startAll;
- testScript =
- { nodes, ... }:
- ''
- startAll;
+ # The router should have access to the server.
+ $server->waitForUnit("network.target");
+ $server->waitForUnit("httpd");
+ $router->waitForUnit("network.target");
+ $router->succeed("curl --fail http://server/ >&2");
- # The router should have access to the server.
- $server->waitForUnit("network.target");
- $server->waitForUnit("httpd");
- $router->waitForUnit("network.target");
- $router->succeed("curl --fail http://server/ >&2");
+ # The client should be also able to connect via the NAT router.
+ $router->waitForUnit("${unit}");
+ $client->waitForUnit("network.target");
+ $client->succeed("curl --fail http://server/ >&2");
+ $client->succeed("ping -c 1 server >&2");
- # The client should be also able to connect via the NAT router.
- $router->waitForUnit("nat");
- $client->waitForUnit("network.target");
- $client->succeed("curl --fail http://server/ >&2");
- $client->succeed("ping -c 1 server >&2");
+ # Test whether passive FTP works.
+ $server->waitForUnit("vsftpd");
+ $server->succeed("echo Hello World > /home/ftp/foo.txt");
+ $client->succeed("curl -v ftp://server/foo.txt >&2");
- # Test whether passive FTP works.
- $server->waitForUnit("vsftpd");
- $server->succeed("echo Hello World > /home/ftp/foo.txt");
- $client->succeed("curl -v ftp://server/foo.txt >&2");
+ # Test whether active FTP works.
+ $client->succeed("curl -v -P - ftp://server/foo.txt >&2");
- # Test whether active FTP works.
- $client->succeed("curl -v -P - ftp://server/foo.txt >&2");
+ # Test ICMP.
+ $client->succeed("ping -c 1 router >&2");
+ $router->succeed("ping -c 1 client >&2");
- # Test ICMP.
- $client->succeed("ping -c 1 router >&2");
- $router->succeed("ping -c 1 client >&2");
+ # If we turn off NAT, the client shouldn't be able to reach the server.
+ $router->succeed("iptables -t nat -D PREROUTING -j nixos-nat-pre");
+ $router->succeed("iptables -t nat -D POSTROUTING -j nixos-nat-post");
+ $client->fail("curl --fail --connect-timeout 5 http://server/ >&2");
+ $client->fail("ping -c 1 server >&2");
- # If we turn off NAT, the client shouldn't be able to reach the server.
- $router->stopJob("nat");
- $client->fail("curl --fail --connect-timeout 5 http://server/ >&2");
- $client->fail("ping -c 1 server >&2");
-
- # And make sure that restarting the NAT job works.
- $router->succeed("systemctl start nat");
- $client->succeed("curl --fail http://server/ >&2");
- $client->succeed("ping -c 1 server >&2");
- '';
-
-}
+ # And make sure that reloading the NAT job works.
+ $router->succeed("systemctl restart ${unit}");
+ $client->succeed("curl --fail http://server/ >&2");
+ $client->succeed("ping -c 1 server >&2");
+ '';
+ })
diff --git a/nixos/tests/nfs.nix b/nixos/tests/nfs.nix
index 864d05626b6..61b2431c04c 100644
--- a/nixos/tests/nfs.nix
+++ b/nixos/tests/nfs.nix
@@ -17,6 +17,7 @@ let
in
{
+ name = "nfs";
nodes =
{ client1 = client;
diff --git a/nixos/tests/nsd.nix b/nixos/tests/nsd.nix
new file mode 100644
index 00000000000..c2331931cdd
--- /dev/null
+++ b/nixos/tests/nsd.nix
@@ -0,0 +1,83 @@
+let
+ common = { pkgs, ... }: {
+ networking.firewall.enable = false;
+ networking.useDHCP = false;
+ # for a host utility with IPv6 support
+ environment.systemPackages = [ pkgs.bind ];
+ };
+in import ./make-test.nix {
+ name = "nsd";
+
+ nodes = {
+ clientv4 = { lib, nodes, ... }: {
+ imports = [ common ];
+ networking.nameservers = lib.mkForce [
+ nodes.server.config.networking.interfaces.eth1.ipAddress
+ ];
+ networking.interfaces.eth1.ipAddress = "192.168.0.2";
+ networking.interfaces.eth1.prefixLength = 24;
+ };
+
+ clientv6 = { lib, nodes, ... }: {
+ imports = [ common ];
+ networking.nameservers = lib.mkForce [
+ nodes.server.config.networking.interfaces.eth1.ipv6Address
+ ];
+ networking.interfaces.eth1.ipv6Address = "dead:beef::2";
+ };
+
+ server = { lib, ... }: {
+ imports = [ common ];
+ networking.interfaces.eth1.ipAddress = "192.168.0.1";
+ networking.interfaces.eth1.prefixLength = 24;
+ networking.interfaces.eth1.ipv6Address = "dead:beef::1";
+ services.nsd.enable = true;
+ services.nsd.interfaces = lib.mkForce [];
+ services.nsd.zones."example.com.".data = ''
+ @ SOA ns.example.com noc.example.com 666 7200 3600 1209600 3600
+ ipv4 A 1.2.3.4
+ ipv6 AAAA abcd::eeff
+ deleg NS ns.example.com
+ ns A 192.168.0.1
+ ns AAAA dead:beef::1
+ '';
+ services.nsd.zones."deleg.example.com.".data = ''
+ @ SOA ns.example.com noc.example.com 666 7200 3600 1209600 3600
+ @ A 9.8.7.6
+ @ AAAA fedc::bbaa
+ '';
+ };
+ };
+
+ testScript = ''
+ startAll;
+
+ $clientv4->waitForUnit("network.target");
+ $clientv6->waitForUnit("network.target");
+ $server->waitForUnit("nsd.service");
+
+ sub assertHost {
+ my ($type, $rr, $query, $expected) = @_;
+ my $self = $type eq 4 ? $clientv4 : $clientv6;
+ my $out = $self->succeed("host -$type -t $rr $query");
+ $self->log("output: $out");
+ chomp $out;
+ die "DNS IPv$type query on $query gave '$out' instead of '$expected'"
+ if ($out !~ $expected);
+ }
+
+ foreach (4, 6) {
+ subtest "ipv$_", sub {
+ assertHost($_, "a", "example.com", qr/has no [^ ]+ record/);
+ assertHost($_, "aaaa", "example.com", qr/has no [^ ]+ record/);
+
+ assertHost($_, "soa", "example.com", qr/SOA.*?noc\.example\.com/);
+ assertHost($_, "a", "ipv4.example.com", qr/address 1.2.3.4$/);
+ assertHost($_, "aaaa", "ipv6.example.com", qr/address abcd::eeff$/);
+
+ assertHost($_, "a", "deleg.example.com", qr/address 9.8.7.6$/);
+ assertHost($_, "aaaa", "deleg.example.com", qr/address fedc::bbaa$/);
+ };
+ }
+ '';
+}
diff --git a/nixos/tests/openssh.nix b/nixos/tests/openssh.nix
index 0b9714c275d..692618c5a84 100644
--- a/nixos/tests/openssh.nix
+++ b/nixos/tests/openssh.nix
@@ -1,4 +1,22 @@
-import ./make-test.nix ({ pkgs, ... }: {
+import ./make-test.nix ({ pkgs, ... }:
+
+let
+ snakeOilPrivateKey = pkgs.writeText "privkey.snakeoil" ''
+ -----BEGIN EC PRIVATE KEY-----
+ MHcCAQEEIHQf/khLvYrQ8IOika5yqtWvI0oquHlpRLTZiJy5dRJmoAoGCCqGSM49
+ AwEHoUQDQgAEKF0DYGbBwbj06tA3fd/+yP44cvmwmHBWXZCKbS+RQlAKvLXMWkpN
+ r1lwMyJZoSGgBHoUahoYjTh9/sJL7XLJtA==
+ -----END EC PRIVATE KEY-----
+ '';
+
+ snakeOilPublicKey = pkgs.lib.concatStrings [
+ "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHA"
+ "yNTYAAABBBChdA2BmwcG49OrQN33f/sj+OHL5sJhwVl2Qim0vkUJQCry1zFpKTa"
+ "9ZcDMiWaEhoAR6FGoaGI04ff7CS+1yybQ= sakeoil"
+ ];
+
+in {
+ name = "openssh";
nodes = {
@@ -9,6 +27,9 @@ import ./make-test.nix ({ pkgs, ... }: {
services.openssh.enable = true;
security.pam.services.sshd.limits =
[ { domain = "*"; item = "memlock"; type = "-"; value = 1024; } ];
+ users.extraUsers.root.openssh.authorizedKeys.keys = [
+ snakeOilPublicKey
+ ];
};
client =
@@ -23,15 +44,25 @@ import ./make-test.nix ({ pkgs, ... }: {
$server->waitForUnit("sshd");
- $server->succeed("mkdir -m 700 /root/.ssh");
- $server->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys");
+ subtest "manual-authkey", sub {
+ $server->succeed("mkdir -m 700 /root/.ssh");
+ $server->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys");
- $client->succeed("mkdir -m 700 /root/.ssh");
- $client->copyFileFromHost("key", "/root/.ssh/id_dsa");
- $client->succeed("chmod 600 /root/.ssh/id_dsa");
+ $client->succeed("mkdir -m 700 /root/.ssh");
+ $client->copyFileFromHost("key", "/root/.ssh/id_dsa");
+ $client->succeed("chmod 600 /root/.ssh/id_dsa");
- $client->waitForUnit("network.target");
- $client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'echo hello world' >&2");
- $client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'ulimit -l' | grep 1024");
+ $client->waitForUnit("network.target");
+ $client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'echo hello world' >&2");
+ $client->succeed("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no server 'ulimit -l' | grep 1024");
+ };
+
+ subtest "configured-authkey", sub {
+ $client->succeed("cat ${snakeOilPrivateKey} > privkey.snakeoil");
+ $client->succeed("chmod 600 privkey.snakeoil");
+ $client->succeed("ssh -o UserKnownHostsFile=/dev/null" .
+ " -o StrictHostKeyChecking=no -i privkey.snakeoil" .
+ " server true");
+ };
'';
})
diff --git a/nixos/tests/partition.nix b/nixos/tests/partition.nix
index 120ecaad881..5e94b263d5b 100644
--- a/nixos/tests/partition.nix
+++ b/nixos/tests/partition.nix
@@ -63,9 +63,11 @@ let
logvol / --size=1000 --grow --fstype=ext4 --name=root --vgname=nixos
'';
in {
+ name = "partitiion";
+
machine = { config, pkgs, ... }: {
environment.systemPackages = [
- pkgs.pythonPackages.nixpart
+ pkgs.pythonPackages.nixpart0
pkgs.file pkgs.btrfsProgs pkgs.xfsprogs pkgs.lvm2
];
virtualisation.emptyDiskImages = [ 4096 4096 ];
@@ -207,7 +209,7 @@ in {
ensurePartition("swap", "swap");
ensurePartition("boot", "f2fs");
ensurePartition("root", "f2fs");
- remoteAndCheck;
+ remountAndCheck;
ensureMountPoint("/mnt/boot", "f2fs");
};
diff --git a/nixos/tests/phabricator.nix b/nixos/tests/phabricator.nix
index 8a8c6cb784c..0fe31f66502 100644
--- a/nixos/tests/phabricator.nix
+++ b/nixos/tests/phabricator.nix
@@ -1,4 +1,5 @@
import ./make-test.nix ({ pkgs, ... }: {
+ name = "phabricator";
nodes = {
storage =
@@ -31,9 +32,16 @@ import ./make-test.nix ({ pkgs, ... }: {
}];
};
+ phd = {
+ enable = true;
+ };
+
mysql = {
enable = true;
package = pkgs.mysql;
+ extraOptions = ''
+ sql_mode=STRICT_ALL_TABLES
+ '';
};
};
diff --git a/nixos/tests/printing.nix b/nixos/tests/printing.nix
index 16f9812d93b..a55e077c269 100644
--- a/nixos/tests/printing.nix
+++ b/nixos/tests/printing.nix
@@ -1,6 +1,7 @@
# Test printing via CUPS.
import ./make-test.nix ({pkgs, ... }: {
+ name = "printing";
nodes = {
diff --git a/nixos/tests/proxy.nix b/nixos/tests/proxy.nix
index 88dbdb2720f..01f0f3fe17a 100644
--- a/nixos/tests/proxy.nix
+++ b/nixos/tests/proxy.nix
@@ -14,6 +14,7 @@ let
in
{
+ name = "proxy";
nodes =
{ proxy =
diff --git a/nixos/tests/quake3.nix b/nixos/tests/quake3.nix
index 3ff12fd57c0..b16cb179982 100644
--- a/nixos/tests/quake3.nix
+++ b/nixos/tests/quake3.nix
@@ -13,6 +13,7 @@ let
in
rec {
+ name = "quake3";
makeCoverageReport = true;
diff --git a/nixos/tests/rabbitmq.nix b/nixos/tests/rabbitmq.nix
index ffcdde9d87f..3ef3f92764c 100644
--- a/nixos/tests/rabbitmq.nix
+++ b/nixos/tests/rabbitmq.nix
@@ -1,6 +1,7 @@
# This test runs rabbitmq and checks if rabbitmq is up and running.
import ./make-test.nix ({ pkgs, ... }: {
+ name = "rabbitmq";
nodes = {
one = { config, pkgs, ... }: {
diff --git a/nixos/tests/simple.nix b/nixos/tests/simple.nix
index e21b919cdf8..1cd9058f9e5 100644
--- a/nixos/tests/simple.nix
+++ b/nixos/tests/simple.nix
@@ -1,4 +1,5 @@
import ./make-test.nix {
+ name = "simple";
machine = { config, pkgs, ... }: { };
diff --git a/nixos/tests/subversion.nix b/nixos/tests/subversion.nix
index e6746dc0828..50277edbdd8 100644
--- a/nixos/tests/subversion.nix
+++ b/nixos/tests/subversion.nix
@@ -32,6 +32,7 @@ let
in
{
+ name = "subversion";
nodes =
{ webserver =
diff --git a/nixos/tests/tomcat.nix b/nixos/tests/tomcat.nix
index 3b0b1bb7911..f3ee3477b5a 100644
--- a/nixos/tests/tomcat.nix
+++ b/nixos/tests/tomcat.nix
@@ -1,4 +1,5 @@
import ./make-test.nix {
+ name = "tomcat";
nodes = {
server =
diff --git a/nixos/tests/trac.nix b/nixos/tests/trac.nix
index 3f17dafaca1..87a2d328b4a 100644
--- a/nixos/tests/trac.nix
+++ b/nixos/tests/trac.nix
@@ -1,4 +1,5 @@
import ./make-test.nix ({ pkgs, ... }: {
+ name = "trac";
nodes = {
storage =
diff --git a/nixos/tests/udisks2.nix b/nixos/tests/udisks2.nix
index e0c57d7c34d..1d2f79e4f6c 100644
--- a/nixos/tests/udisks2.nix
+++ b/nixos/tests/udisks2.nix
@@ -10,6 +10,7 @@ let
in
{
+ name = "udisks2";
machine =
{ config, pkgs, ... }:
diff --git a/nixos/tests/xfce.nix b/nixos/tests/xfce.nix
index ded37943e51..ced0c6b9826 100644
--- a/nixos/tests/xfce.nix
+++ b/nixos/tests/xfce.nix
@@ -1,4 +1,5 @@
import ./make-test.nix {
+ name = "xfce";
machine =
{ config, pkgs, ... }:
diff --git a/pkgs/applications/audio/a2jmidid/default.nix b/pkgs/applications/audio/a2jmidid/default.nix
index c5e35d8867c..38192311ccf 100644
--- a/pkgs/applications/audio/a2jmidid/default.nix
+++ b/pkgs/applications/audio/a2jmidid/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, dbus, jackaudio, pkgconfig, python }:
+{ stdenv, fetchurl, alsaLib, dbus, jack2, pkgconfig, python }:
stdenv.mkDerivation rec {
name = "a2jmidid-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "0pzm0qk5ilqhwz74pydg1jwrds27vm47185dakdrxidb5bv3b5ia";
};
- buildInputs = [ alsaLib dbus jackaudio pkgconfig python ];
+ buildInputs = [ alsaLib dbus jack2 pkgconfig python ];
configurePhase = "python waf configure --prefix=$out";
diff --git a/pkgs/applications/audio/abcde/default.nix b/pkgs/applications/audio/abcde/default.nix
index 031b0fe93b5..1978fcf1874 100644
--- a/pkgs/applications/audio/abcde/default.nix
+++ b/pkgs/applications/audio/abcde/default.nix
@@ -61,7 +61,7 @@ in
meta = {
homepage = "http://lly.org/~rcw/abcde/page/";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
description = "Command-line audio CD ripper";
longDescription = ''
diff --git a/pkgs/applications/audio/ardour/default.nix b/pkgs/applications/audio/ardour/default.nix
index 88bc7399c65..62b88cbe077 100644
--- a/pkgs/applications/audio/ardour/default.nix
+++ b/pkgs/applications/audio/ardour/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchgit, alsaLib, aubio, boost, cairomm, curl, fftw
-, fftwSinglePrec, flac, glibc, glibmm, gtk, gtkmm, jackaudio
+, fftwSinglePrec, flac, glibc, glibmm, gtk, gtkmm, jack2
, libgnomecanvas, libgnomecanvasmm, liblo, libmad, libogg, librdf
, librdf_raptor, librdf_rasqal, libsamplerate, libsigcxx, libsndfile
, libusb, libuuid, libxml2, libxslt, lilv, lv2, makeWrapper, pango
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
buildInputs =
[ alsaLib aubio boost cairomm curl fftw fftwSinglePrec flac glibc
- glibmm gtk gtkmm jackaudio libgnomecanvas libgnomecanvasmm liblo
+ glibmm gtk gtkmm jack2 libgnomecanvas libgnomecanvasmm liblo
libmad libogg librdf librdf_raptor librdf_rasqal libsamplerate
libsigcxx libsndfile libusb libuuid libxml2 libxslt lilv lv2
makeWrapper pango perl pkgconfig python serd sord sratom suil
@@ -47,6 +47,21 @@ stdenv.mkDerivation rec {
mkdir -pv $out/gtk2/engines
cp build/libs/clearlooks-newer/libclearlooks.so $out/gtk2/engines/
wrapProgram $out/bin/ardour3 --prefix GTK_PATH : $out/gtk2
+
+ # Install desktop file
+ mkdir -p "$out/share/applications"
+ cat > "$out/share/applications/ardour.desktop" << EOF
+ [Desktop Entry]
+ Name=Ardour 3
+ GenericName=Digital Audio Workstation
+ Comment=Multitrack harddisk recorder
+ Exec=$out/bin/ardour3
+ Icon=$out/share/ardour3/icons/ardour_icon_256px.png
+ Terminal=false
+ Type=Application
+ X-MultipleArgs=false
+ Categories=GTK;Audio;AudioVideoEditing;AudioVideo;Video;
+ EOF
'';
meta = with stdenv.lib; {
diff --git a/pkgs/applications/audio/audacious/default.nix b/pkgs/applications/audio/audacious/default.nix
index 409a831727b..49b02f46e9b 100644
--- a/pkgs/applications/audio/audacious/default.nix
+++ b/pkgs/applications/audio/audacious/default.nix
@@ -1,28 +1,29 @@
{ stdenv, fetchurl, pkgconfig, glib, gtk3, libmowgli, libmcs
, gettext, dbus_glib, libxml2, libmad, xlibs, alsaLib, libogg
, libvorbis, libcdio, libcddb, flac, ffmpeg, makeWrapper
+, mpg123, neon, faad2
}:
let
- version = "3.4.3";
+ version = "3.5.1";
in
stdenv.mkDerivation {
name = "audacious-${version}";
src = fetchurl {
url = "http://distfiles.audacious-media-player.org/audacious-${version}.tar.bz2";
- sha256 = "04lzwdr1lx6ghbfxzygvnbmdl420w6rm453ds5lyb0hlvzs58d0q";
+ sha256 = "01wmlvpp540gdjw759wif3byh98h3b3q6f5wawzp0b0ivqd0wf6z";
};
pluginsSrc = fetchurl {
url = "http://distfiles.audacious-media-player.org/audacious-plugins-${version}.tar.bz2";
- sha256 = "00r88q9fs9a0gicdmk2svcans7igcqgacrw303a5bn44is7pmrmy";
+ sha256 = "09lyvi15hbn3pvb2izyz2bm4021917mhcdrwxrn3q3sjvx337np6";
};
buildInputs =
[ gettext pkgconfig glib gtk3 libmowgli libmcs libxml2 dbus_glib
libmad xlibs.libXcomposite libogg libvorbis flac alsaLib libcdio
- libcddb ffmpeg makeWrapper
+ libcddb ffmpeg makeWrapper mpg123 neon faad2
];
# Here we build bouth audacious and audacious-plugins in one
diff --git a/pkgs/applications/audio/audacity/default.nix b/pkgs/applications/audio/audacity/default.nix
index 890497b0c99..7308d84e098 100644
--- a/pkgs/applications/audio/audacity/default.nix
+++ b/pkgs/applications/audio/audacity/default.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Sound editor with graphical UI";
homepage = http://audacity.sourceforge.net;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = with stdenv.lib.platforms; linux;
maintainers = with stdenv.lib.maintainers; [ the-kenny ];
};
diff --git a/pkgs/applications/audio/aumix/default.nix b/pkgs/applications/audio/aumix/default.nix
index 1e19a3ac5c3..41edd51e5f2 100644
--- a/pkgs/applications/audio/aumix/default.nix
+++ b/pkgs/applications/audio/aumix/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
the command line or a script.
'';
homepage = http://www.jpj.net/~trevor/aumix.html;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/applications/audio/beast/default.nix b/pkgs/applications/audio/beast/default.nix
index 61b11c05de7..340a83e7963 100644
--- a/pkgs/applications/audio/beast/default.nix
+++ b/pkgs/applications/audio/beast/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
];
meta = {
- description = "BEAST - the Bedevilled Sound Engine";
+ description = "A music composition and modular synthesis application";
homepage = http://beast.gtk.org;
license = ["GPL-2" "LGPL-2.1"];
};
diff --git a/pkgs/applications/audio/bristol/default.nix b/pkgs/applications/audio/bristol/default.nix
index 5eb4f0c4e9f..b27ac058602 100644
--- a/pkgs/applications/audio/bristol/default.nix
+++ b/pkgs/applications/audio/bristol/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, jackaudio, pkgconfig, pulseaudio, xlibs }:
+{ stdenv, fetchurl, alsaLib, jack2, pkgconfig, pulseaudio, xlibs }:
stdenv.mkDerivation rec {
name = "bristol-${version}";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
};
buildInputs = [
- alsaLib jackaudio pkgconfig pulseaudio xlibs.libX11 xlibs.libXext
+ alsaLib jack2 pkgconfig pulseaudio xlibs.libX11 xlibs.libXext
xlibs.xproto
];
diff --git a/pkgs/applications/audio/calf/default.nix b/pkgs/applications/audio/calf/default.nix
index 6ed4b7cce98..efab9202025 100644
--- a/pkgs/applications/audio/calf/default.nix
+++ b/pkgs/applications/audio/calf/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchurl, cairo, expat, fftwSinglePrec, fluidsynth, glib
-, gtk, jackaudio, ladspaH , libglade, lv2, pkgconfig }:
+, gtk, jack2, ladspaH , libglade, lv2, pkgconfig }:
stdenv.mkDerivation rec {
name = "calf-${version}";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
};
buildInputs = [
- cairo expat fftwSinglePrec fluidsynth glib gtk jackaudio ladspaH
+ cairo expat fftwSinglePrec fluidsynth glib gtk jack2 ladspaH
libglade lv2 pkgconfig
];
diff --git a/pkgs/applications/audio/cantata/default.nix b/pkgs/applications/audio/cantata/default.nix
index 31d5240529f..aade5636c16 100644
--- a/pkgs/applications/audio/cantata/default.nix
+++ b/pkgs/applications/audio/cantata/default.nix
@@ -39,7 +39,7 @@ assert withOnlineServices -> withTaglib;
assert withReplaygain -> withTaglib;
let
- version = "1.3.4";
+ version = "1.5.0";
pname = "cantata";
fstat = x: fn: "-DENABLE_" + fn + "=" + (if x then "ON" else "OFF");
fstats = x: map (fstat x);
@@ -50,8 +50,8 @@ stdenv.mkDerivation rec {
src = fetchurl {
inherit name;
- url = "https://drive.google.com/uc?export=download&id=0Bzghs6gQWi60WTYtaXk3c1IzNVU";
- sha256 = "0ris41v44nwd68f3zis9n9lyyc089dyhlxp37rrzflanrc6glpwq";
+ url = "https://drive.google.com/uc?export=download&id=0Bzghs6gQWi60c0pFbEtldEk1UnM";
+ sha256 = "0gnqfp3ps79d500hrivxj2xkkia042knhg86md6w8ycl3945611p";
};
buildInputs =
@@ -69,7 +69,7 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional (withTaglib && !withKDE4 && withDevices) udisks2;
unpackPhase = "tar -xvf $src";
- sourceRoot = "cantata-1.3.4";
+ sourceRoot = "${name}";
# Qt4 is implicit when KDE is switched off.
cmakeFlags = stdenv.lib.flatten [
diff --git a/pkgs/applications/audio/cd-discid/default.nix b/pkgs/applications/audio/cd-discid/default.nix
index c67830a94e7..1646f944a83 100644
--- a/pkgs/applications/audio/cd-discid/default.nix
+++ b/pkgs/applications/audio/cd-discid/default.nix
@@ -19,7 +19,7 @@ in
meta = {
homepage = http://lly.org/~rcw/cd-discid/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
description = "cd-discid, a command-line utility to retrieve a disc's CDDB ID";
longDescription = ''
diff --git a/pkgs/applications/audio/chuck/darwin-limits.patch b/pkgs/applications/audio/chuck/darwin-limits.patch
new file mode 100644
index 00000000000..3387f725544
--- /dev/null
+++ b/pkgs/applications/audio/chuck/darwin-limits.patch
@@ -0,0 +1,13 @@
+--- a/src/util_string.cpp 2014-10-27 22:52:11.875981552 +0100
++++ b/src/util_string.cpp 2014-10-27 22:54:18.613001994 +0100
+@@ -40,6 +40,10 @@
+ #include
+ #endif // __PLATFORM_LINUX__
+
++#ifdef __PLATFORM_MACOSX__
++#include
++#endif // __PLATFORM_MACOSX__
++
+ #include
+ using namespace std;
+
diff --git a/pkgs/applications/audio/chuck/default.nix b/pkgs/applications/audio/chuck/default.nix
new file mode 100644
index 00000000000..7725ba1e4c8
--- /dev/null
+++ b/pkgs/applications/audio/chuck/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, alsaLib, bison, flex, libsndfile, which }:
+
+stdenv.mkDerivation rec {
+ version = "1.3.4.0";
+ name = "chuck-${version}";
+
+ src = fetchurl {
+ url = "http://chuck.cs.princeton.edu/release/files/chuck-${version}.tgz";
+ sha256 = "0cwbk8b1i18nkh2nxwzk2prranw83lgglxw7ccnp6b0r2b2yfpmn";
+ };
+
+ buildInputs = [ bison flex libsndfile which ]
+ ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
+
+ patches = [ ./darwin-limits.patch ];
+
+ postPatch = ''
+ substituteInPlace src/makefile --replace "/usr/bin" "$out/bin"
+ substituteInPlace src/makefile.osx --replace "xcodebuild" "/usr/bin/xcodebuild"
+ substituteInPlace src/makefile.osx --replace "weak_framework" "framework"
+ '';
+
+ buildPhase =
+ stdenv.lib.optionals stdenv.isLinux ["make -C src linux-alsa"] ++
+ stdenv.lib.optionals stdenv.isDarwin ["make -C src osx"];
+
+ installPhase = ''
+ install -Dm755 ./src/chuck $out/bin/chuck
+ '';
+
+ meta = {
+ description = "Programming language for real-time sound synthesis and music creation";
+ homepage = http://chuck.cs.princeton.edu;
+ license = stdenv.lib.licenses.gpl2;
+ platforms = with stdenv.lib.platforms; linux ++ darwin;
+ maintainers = with stdenv.lib.maintainers; [ ftrvxmtrx ];
+ };
+}
diff --git a/pkgs/applications/audio/clementine/default.nix b/pkgs/applications/audio/clementine/default.nix
index 82f24b05f72..604c35f46ce 100644
--- a/pkgs/applications/audio/clementine/default.nix
+++ b/pkgs/applications/audio/clementine/default.nix
@@ -6,11 +6,11 @@
let withSpotify = config.clementine.spotify or false;
in
stdenv.mkDerivation {
- name = "clementine-1.2.1";
+ name = "clementine-1.2.3";
src = fetchurl {
- url = http://clementine-player.googlecode.com/files/clementine-1.2.1.tar.gz;
- sha256 = "0kk5cjmb8nirx0im3c0z91af2k72zxi6lwzm6rb57qihya5nwmfv";
+ url = https://github.com/clementine-player/Clementine/archive/1.2.3.tar.gz;
+ sha256 = "1gx1109i4pylz6x7gvp4rdzc6dvh0w6in6hfbygw01d08l26bxbx";
};
patches = [ ./clementine-1.2.1-include-paths.patch ];
@@ -40,6 +40,8 @@ stdenv.mkDerivation {
usbmuxd
] ++ stdenv.lib.optional withSpotify libspotify;
+ enableParallelBuilding = true;
+
meta = with stdenv.lib; {
homepage = "http://www.clementine-player.org";
description = "A multiplatform music player";
@@ -47,6 +49,6 @@ stdenv.mkDerivation {
platforms = platforms.linux;
maintainers = [ maintainers.ttuegel ];
# libspotify is unfree
- hydraPlatforms = optional (!withSpotify) platforms.linux;
+ hydraPlatforms = optionals (!withSpotify) platforms.linux;
};
}
diff --git a/pkgs/applications/audio/cmus/default.nix b/pkgs/applications/audio/cmus/default.nix
index 2ea37e2bd23..4f9c491a3a5 100644
--- a/pkgs/applications/audio/cmus/default.nix
+++ b/pkgs/applications/audio/cmus/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses pkgconfig alsaLib flac libmad ffmpeg libvorbis mpc mp4v2 ];
meta = {
- description = "cmus is a small, fast and powerful console music player for Linux and *BSD";
+ description = "Small, fast and powerful console music player for Linux and *BSD";
homepage = http://cmus.sourceforge.net;
license = stdenv.lib.licenses.gpl2;
};
diff --git a/pkgs/applications/audio/deadbeef/default.nix b/pkgs/applications/audio/deadbeef/default.nix
new file mode 100644
index 00000000000..ca8ce453e63
--- /dev/null
+++ b/pkgs/applications/audio/deadbeef/default.nix
@@ -0,0 +1,98 @@
+{ stdenv, fetchurl, intltool, pkgconfig
+# deadbeef can use either gtk2 or gtk3
+, gtk2Support ? true, gtk2 ? null
+, gtk3Support ? false, gtk3 ? null, gsettings_desktop_schemas ? null, makeWrapper ? null
+# input plugins
+, vorbisSupport ? true, libvorbis ? null
+, mp123Support ? true, libmad ? null
+, flacSupport ? true, flac ? null
+, wavSupport ? true, libsndfile ? null
+, cdaSupport ? true, libcdio ? null, libcddb ? null
+, aacSupport ? true, faad2 ? null
+, wavpackSupport ? false, wavpack ? null
+, ffmpegSupport ? false, ffmpeg ? null
+# misc plugins
+, zipSupport ? true, libzip ? null
+, artworkSupport ? true, imlib2 ? null
+, hotkeysSupport ? true, libX11 ? null
+, osdSupport ? true, dbus ? null
+# output plugins
+, alsaSupport ? true, alsaLib ? null
+, pulseSupport ? true, pulseaudio ? null
+# effect plugins
+, resamplerSupport ? true, libsamplerate ? null
+, overloadSupport ? true, zlib ? null
+# transports
+, remoteSupport ? true, curl ? null
+}:
+
+assert gtk2Support || gtk3Support;
+assert gtk2Support -> gtk2 != null;
+assert gtk3Support -> gtk3 != null && gsettings_desktop_schemas != null && makeWrapper != null;
+assert vorbisSupport -> libvorbis != null;
+assert mp123Support -> libmad != null;
+assert flacSupport -> flac != null;
+assert wavSupport -> libsndfile != null;
+assert cdaSupport -> (libcdio != null && libcddb != null);
+assert aacSupport -> faad2 != null;
+assert zipSupport -> libzip != null;
+assert ffmpegSupport -> ffmpeg != null;
+assert artworkSupport -> imlib2 != null;
+assert hotkeysSupport -> libX11 != null;
+assert osdSupport -> dbus != null;
+assert alsaSupport -> alsaLib != null;
+assert pulseSupport -> pulseaudio != null;
+assert resamplerSupport -> libsamplerate != null;
+assert overloadSupport -> zlib != null;
+assert wavpackSupport -> wavpack != null;
+assert remoteSupport -> curl != null;
+
+stdenv.mkDerivation rec {
+ name = "deadbeef-0.6.2";
+
+ src = fetchurl {
+ url = "http://garr.dl.sourceforge.net/project/deadbeef/${name}.tar.bz2";
+ sha256 = "06jfsqyakpvq0xhah7dlyvdzh5ym3hhb4yfczczw11ijd1kbjcrl";
+ };
+
+ buildInputs = with stdenv.lib;
+ optional gtk2Support gtk2
+ ++ optionals gtk3Support [gtk3 gsettings_desktop_schemas]
+ ++ optional vorbisSupport libvorbis
+ ++ optional mp123Support libmad
+ ++ optional flacSupport flac
+ ++ optional wavSupport libsndfile
+ ++ optionals cdaSupport [libcdio libcddb]
+ ++ optional aacSupport faad2
+ ++ optional zipSupport libzip
+ ++ optional ffmpegSupport ffmpeg
+ ++ optional artworkSupport imlib2
+ ++ optional hotkeysSupport libX11
+ ++ optional osdSupport dbus
+ ++ optional alsaSupport alsaLib
+ ++ optional pulseSupport pulseaudio
+ ++ optional resamplerSupport libsamplerate
+ ++ optional overloadSupport zlib
+ ++ optional wavpackSupport wavpack
+ ++ optional remoteSupport curl
+ ;
+
+ nativeBuildInputs = with stdenv.lib; [ intltool pkgconfig ]
+ ++ optional gtk3Support makeWrapper;
+
+ enableParallelBuilding = true;
+
+ postInstall = if !gtk3Support then "" else ''
+ wrapProgram "$out/bin/deadbeef" \
+ --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Ultimate Music Player for GNU/Linux";
+ homepage = http://deadbeef.sourceforge.net/;
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.abbradar ];
+ repositories.git = https://github.com/Alexey-Yakovenko/deadbeef;
+ };
+}
diff --git a/pkgs/applications/audio/distrho/default.nix b/pkgs/applications/audio/distrho/default.nix
index 809a02e1c7a..aa3a76c3af1 100644
--- a/pkgs/applications/audio/distrho/default.nix
+++ b/pkgs/applications/audio/distrho/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, alsaLib, fftwSinglePrec, freetype, jackaudio
+{ stdenv, fetchgit, alsaLib, fftwSinglePrec, freetype, jack2
, libxslt, lv2, pkgconfig, premake3, xlibs }:
let
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
'';
buildInputs = [
- alsaLib fftwSinglePrec freetype jackaudio pkgconfig premake3
+ alsaLib fftwSinglePrec freetype jack2 pkgconfig premake3
xlibs.libX11 xlibs.libXcomposite xlibs.libXcursor xlibs.libXext
xlibs.libXinerama xlibs.libXrender
];
diff --git a/pkgs/applications/audio/drumkv1/default.nix b/pkgs/applications/audio/drumkv1/default.nix
index ab8027e2371..a5dd037c774 100644
--- a/pkgs/applications/audio/drumkv1/default.nix
+++ b/pkgs/applications/audio/drumkv1/default.nix
@@ -1,15 +1,15 @@
-{ stdenv, fetchurl, jackaudio, libsndfile, lv2, qt4 }:
+{ stdenv, fetchurl, jack2, libsndfile, lv2, qt4 }:
stdenv.mkDerivation rec {
name = "drumkv1-${version}";
- version = "0.4.2";
+ version = "0.5.1";
src = fetchurl {
url = "mirror://sourceforge/drumkv1/${name}.tar.gz";
- sha256 = "18rvfgblynlmklk25azmppibn1bdjid97hipa323gnzmxgq0rfjq";
+ sha256 = "1cih4f22922ndk8yrcf955fvzkd8mh7qz1xcdyn3xybs7ackgarq";
};
- buildInputs = [ jackaudio libsndfile lv2 qt4 ];
+ buildInputs = [ jack2 libsndfile lv2 qt4 ];
meta = with stdenv.lib; {
description = "An old-school drum-kit sampler synthesizer with stereo fx";
diff --git a/pkgs/applications/audio/easytag/default.nix b/pkgs/applications/audio/easytag/default.nix
index c421dcc60cb..b4829a1bcf7 100644
--- a/pkgs/applications/audio/easytag/default.nix
+++ b/pkgs/applications/audio/easytag/default.nix
@@ -1,32 +1,34 @@
-{ stdenv, fetchurl, pkgconfig, intltool, gtk, glib, libid3tag, id3lib, taglib
-, libvorbis, libogg, flac
+{ stdenv, fetchurl, pkgconfig, intltool, gtk3, glib, libid3tag, id3lib, taglib
+, libvorbis, libogg, flac, itstool, libxml2, gsettings_desktop_schemas
+, makeWrapper, gnome_icon_theme
}:
stdenv.mkDerivation rec {
name = "easytag-${version}";
- version = "2.1.8";
+ version = "2.3.1";
src = fetchurl {
- url = "mirror://gnome/sources/easytag/2.1/${name}.tar.xz";
- sha256 = "1ab5iv0a83cdf07qzi81ydfk5apay06nxags9m07msqalz4pabqs";
+ url = "mirror://gnome/sources/easytag/2.3/${name}.tar.xz";
+ sha256 = "19cdx4hma4nl38m1zrc3mq9cjg6knw970abk5anhg7cvpc1371s7";
};
- preConfigure = ''
- # pkg-config v0.23 should be enough.
- sed -i -e '/_pkg_min_version=0.24/s/24/23/' \
- -e 's/have_mp3=no/have_mp3=yes/' \
- -e 's/ID3TAG_DEPS="id3tag"/ID3TAG_DEPS=""/' configure
+ preFixup = ''
+ wrapProgram $out/bin/easytag \
+ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH:$out/share"
'';
NIX_LDFLAGS = "-lid3tag -lz";
+ nativeBuildInputs = [ makeWrapper ];
buildInputs = [
- pkgconfig intltool gtk glib libid3tag id3lib taglib libvorbis libogg flac
+ pkgconfig intltool gtk3 glib libid3tag id3lib taglib libvorbis libogg flac
+ itstool libxml2 gsettings_desktop_schemas gnome_icon_theme
];
meta = {
description = "View and edit tags for various audio files";
homepage = "http://projects.gnome.org/easytag/";
license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
};
}
diff --git a/pkgs/applications/audio/espeak/default.nix b/pkgs/applications/audio/espeak/default.nix
index e1cf5fee1cc..0faf4841c71 100644
--- a/pkgs/applications/audio/espeak/default.nix
+++ b/pkgs/applications/audio/espeak/default.nix
@@ -1,10 +1,11 @@
-{stdenv, fetchurl, unzip, portaudio }:
+{ stdenv, fetchurl, unzip, portaudio }:
+
+stdenv.mkDerivation rec {
+ name = "espeak-1.48.04";
-stdenv.mkDerivation {
- name = "espeak-1.46.02";
src = fetchurl {
- url = mirror://sourceforge/espeak/espeak-1.46.02-source.zip;
- sha256 = "1fjlv5fm0gzvr5wzy1dp4nspw04k0bqv3jymha2p2qfjbfifp2zg";
+ url = "mirror://sourceforge/espeak/${name}-source.zip";
+ sha256 = "0n86gwh9pw0jqqpdz7mxggllfr8k0r7pc67ayy7w5z6z79kig6mz";
};
buildInputs = [ unzip portaudio ];
@@ -21,9 +22,10 @@ stdenv.mkDerivation {
makeFlags="PREFIX=$out DATADIR=$out/share/espeak-data"
'';
- meta = {
+ meta = with stdenv.lib; {
description = "Compact open source software speech synthesizer";
homepage = http://espeak.sourceforge.net/;
- license = "GPLv3+";
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/espeak/edit.nix b/pkgs/applications/audio/espeak/edit.nix
index eb34335721f..524a95bcca0 100644
--- a/pkgs/applications/audio/espeak/edit.nix
+++ b/pkgs/applications/audio/espeak/edit.nix
@@ -1,31 +1,57 @@
-{stdenv, fetchurl, unzip, portaudio, wxGTK}:
+{ stdenv, fetchurl, pkgconfig, unzip, portaudio, wxGTK, sox }:
+
+stdenv.mkDerivation rec {
+ name = "espeakedit-1.48.03";
-stdenv.mkDerivation {
- name = "espeakedit-1.46.02";
src = fetchurl {
- url = mirror://sourceforge/espeak/espeakedit-1.46.02.zip;
- sha256 = "1cc5r89sn8zz7b8wj4grx9xb7aqyi0ybj0li9hpy7hd67r56kqkl";
+ url = "mirror://sourceforge/espeak/${name}.zip";
+ sha256 = "0x8s7vpb7rw5x37yjzy1f98m4f2csdg89libb74fm36gn8ly0hli";
};
- buildInputs = [ unzip portaudio wxGTK ];
+ buildInputs = [ pkgconfig unzip portaudio wxGTK ];
- patchPhase = if portaudio.api_version == 19 then ''
+ # TODO:
+ # Uhm, seems like espeakedit still wants espeak-data/ in $HOME, even thought
+ # it should use $espeak/share/espeak-data. Have to contact upstream to get
+ # this fixed.
+ #
+ # Workaround:
+ # cp -r $(nix-build -A espeak)/share/espeak-data ~
+ # chmod +w ~/espeak-data
+
+ patches = [
+ ./espeakedit-fix-makefile.patch
+ ./espeakedit-configurable-sox-path.patch
+ ./espeakedit-configurable-path-espeak-data.patch
+ ];
+
+ postPatch = ''
+ # Disable -Wall flag because it's noisy
+ sed -i "s/-Wall//g" src/Makefile
+
+ # Fixup paths (file names from above espeak-configurable* patches)
+ for file in src/compiledata.cpp src/readclause.cpp src/speech.h; do
+ sed -e "s|@sox@|${sox}/bin/sox|" \
+ -e "s|@prefix@|$out|" \
+ -i "$file"
+ done
+ '' + stdenv.lib.optionalString (portaudio.api_version == 19) ''
cp src/portaudio19.h src/portaudio.h
- '' else "";
+ '';
buildPhase = ''
- cd src
- gcc -o espeakedit *.cpp `wx-config --cxxflags --libs`
+ make -C src
'';
installPhase = ''
- ensureDir $out/bin
- cp espeakedit $out/bin
+ mkdir -p "$out/bin"
+ cp src/espeakedit "$out/bin"
'';
- meta = {
+ meta = with stdenv.lib; {
description = "Phoneme editor for espeak";
homepage = http://espeak.sourceforge.net/;
- license = "GPLv3+";
+ license = licenses.gpl3Plus;
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/espeak/espeakedit-configurable-path-espeak-data.patch b/pkgs/applications/audio/espeak/espeakedit-configurable-path-espeak-data.patch
new file mode 100644
index 00000000000..e5c761a11b3
--- /dev/null
+++ b/pkgs/applications/audio/espeak/espeakedit-configurable-path-espeak-data.patch
@@ -0,0 +1,15 @@
+Don't hardcode /usr, use @prefix@.
+
+Author: Bjørn Forsman
+diff -uNr espeakedit-1.48.03.orig/src/speech.h espeakedit-1.48.03/src/speech.h
+--- espeakedit-1.48.03.orig/src/speech.h 2014-03-04 17:48:12.000000000 +0100
++++ espeakedit-1.48.03/src/speech.h 2014-07-22 18:21:40.860790719 +0200
+@@ -58,7 +58,7 @@
+
+ // will look for espeak_data directory here, and also in user's home directory
+ #ifndef PATH_ESPEAK_DATA
+- #define PATH_ESPEAK_DATA "/usr/share/espeak-data"
++ #define PATH_ESPEAK_DATA "@prefix@/share/espeak-data"
+ #endif
+
+ typedef unsigned short USHORT;
diff --git a/pkgs/applications/audio/espeak/espeakedit-configurable-sox-path.patch b/pkgs/applications/audio/espeak/espeakedit-configurable-sox-path.patch
new file mode 100644
index 00000000000..1c5dfc21941
--- /dev/null
+++ b/pkgs/applications/audio/espeak/espeakedit-configurable-sox-path.patch
@@ -0,0 +1,27 @@
+Make the path to 'sox' configurable by marking it '@sox@' (easy to match with sed).
+
+Author: Bjørn Forsman
+diff -uNr espeakedit-1.48.03.orig/src/compiledata.cpp espeakedit-1.48.03/src/compiledata.cpp
+--- espeakedit-1.48.03.orig/src/compiledata.cpp 2014-03-04 17:48:11.000000000 +0100
++++ espeakedit-1.48.03/src/compiledata.cpp 2014-07-22 16:38:50.261388452 +0200
+@@ -1884,7 +1884,7 @@
+ fname2 = msg;
+ }
+
+- sprintf(command,"sox \"%s%s.wav\" -r %d -c1 -t wav %s\n",path_source,fname2,samplerate_native, fname_temp);
++ sprintf(command,"@sox@ \"%s%s.wav\" -r %d -c1 -t wav %s\n",path_source,fname2,samplerate_native, fname_temp);
+ if(system(command) != 0)
+ {
+ failed = 1;
+diff -uNr espeakedit-1.48.03.orig/src/readclause.cpp espeakedit-1.48.03/src/readclause.cpp
+--- espeakedit-1.48.03.orig/src/readclause.cpp 2014-03-04 17:48:11.000000000 +0100
++++ espeakedit-1.48.03/src/readclause.cpp 2014-07-22 16:38:37.190440504 +0200
+@@ -892,7 +892,7 @@
+ if((fd_temp = mkstemp(fname_temp)) >= 0)
+ {
+ close(fd_temp);
+- sprintf(command,"sox \"%s\" -r %d -c1 -t wav %s\n", fname, samplerate, fname_temp);
++ sprintf(command,"@sox@ \"%s\" -r %d -c1 -t wav %s\n", fname, samplerate, fname_temp);
+ if(system(command) == 0)
+ {
+ fname = fname_temp;
diff --git a/pkgs/applications/audio/espeak/espeakedit-fix-makefile.patch b/pkgs/applications/audio/espeak/espeakedit-fix-makefile.patch
new file mode 100644
index 00000000000..9f8a65d2b0c
--- /dev/null
+++ b/pkgs/applications/audio/espeak/espeakedit-fix-makefile.patch
@@ -0,0 +1,26 @@
+Fix broken Makefile:
+
+* fix syntax error (missing '\' to continue line):
+ Makefile:19: *** recipe commences before first target. Stop.
+* Get portaudio library flags from pkg-config (to get -Lpath/to/portaudio/lib etc.)
+
+Author: Bjørn Forsman
+diff -uNr espeakedit-1.48.03.orig/src/Makefile espeakedit-1.48.03/src/Makefile
+--- espeakedit-1.48.03.orig/src/Makefile 2013-03-13 15:52:02.000000000 +0100
++++ espeakedit-1.48.03/src/Makefile 2014-07-22 15:34:17.524114822 +0200
+@@ -12,12 +12,11 @@
+
+ WX_LIBS = -pthread `wx-config --libs`
+
+-LIBS=-lstdc++ -lportaudio
++LIBS=-lstdc++ `pkg-config --libs portaudio-2.0`
+ #LIBS=-lstdc++ /usr/lib/x86_64-linux-gnu/libportaudio.so.2
+
+-CPPFLAGS = -Wall -g -fexceptions `wx-config --cflags`
+- -I/usr/include/wx-2.8 \
+- -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
++CPPFLAGS = -Wall -g -fexceptions `wx-config --cflags` \
++ -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES \
+ -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT
+
+ CXXFLAGS = -O2 -Wall -fexceptions `wx-config --cflags` \
diff --git a/pkgs/applications/audio/flac/default.nix b/pkgs/applications/audio/flac/default.nix
index 1c8dc56de61..cb3ec1da97c 100644
--- a/pkgs/applications/audio/flac/default.nix
+++ b/pkgs/applications/audio/flac/default.nix
@@ -10,12 +10,12 @@ stdenv.mkDerivation rec {
buildInputs = [ libogg ];
- doCheck = true; # takes lots of time but will be run rarely (small build-time closure)
+ #doCheck = true; # takes lots of time
meta = with stdenv.lib; {
homepage = http://xiph.org/flac/;
description = "Library and tools for encoding and decoding the FLAC lossless audio file format";
platforms = platforms.all;
- maintainers = maintainers.mornfall;
+ maintainers = [ maintainers.mornfall ];
};
}
diff --git a/pkgs/applications/audio/fldigi/default.nix b/pkgs/applications/audio/fldigi/default.nix
index e78095a9c5d..e0250055ccd 100644
--- a/pkgs/applications/audio/fldigi/default.nix
+++ b/pkgs/applications/audio/fldigi/default.nix
@@ -2,13 +2,13 @@
libsamplerate, pulseaudio, libXinerama, gettext, pkgconfig, alsaLib }:
stdenv.mkDerivation rec {
- version = "3.21.82";
+ version = "3.21.83";
pname = "fldigi";
name = "${pname}-${version}";
src = fetchurl {
url = "http://www.w1hkj.com/downloads/${pname}/${name}.tar.gz";
- sha256 = "1q2fc1zm9kfsjir4g6fh95vmjdq984iyxfcs6q4gjqy1znhqcyqs";
+ sha256 = "1fyg6dc6xnxb620rrhws60wj10lsgbwsmnhz8vc6ncspx8mx7019";
};
buildInputs = [ libXinerama gettext hamlib fltk13 libjpeg libpng portaudio
diff --git a/pkgs/applications/audio/fluidsynth/default.nix b/pkgs/applications/audio/fluidsynth/default.nix
index 89e95f62cd5..8cba482194e 100644
--- a/pkgs/applications/audio/fluidsynth/default.nix
+++ b/pkgs/applications/audio/fluidsynth/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, glib, jackaudio, libsndfile, pkgconfig
+{ stdenv, fetchurl, alsaLib, glib, jack2, libsndfile, pkgconfig
, pulseaudio }:
stdenv.mkDerivation rec {
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
"-framework CoreAudio";
buildInputs = [ glib libsndfile pkgconfig ]
- ++ stdenv.lib.optionals (!stdenv.isDarwin) [ alsaLib pulseaudio jackaudio ];
+ ++ stdenv.lib.optionals (!stdenv.isDarwin) [ alsaLib pulseaudio jack2 ];
meta = with stdenv.lib; {
description = "Real-time software synthesizer based on the SoundFont 2 specifications";
diff --git a/pkgs/applications/audio/freewheeling/am_path_sdl.patch b/pkgs/applications/audio/freewheeling/am_path_sdl.patch
new file mode 100644
index 00000000000..2bc3b4f45ac
--- /dev/null
+++ b/pkgs/applications/audio/freewheeling/am_path_sdl.patch
@@ -0,0 +1,40 @@
+--- code-r100/configure.ac 2014-09-25 23:44:41.059174904 +0200
++++ code-r100.new/configure.ac 2014-09-26 01:37:18.507017390 +0200
+@@ -44,6 +44,8 @@
+ [AC_MSG_ERROR(CONFIG: You need libxml2-dev installed.
+ http://www.xmlsoft.org/)])
+
++PKG_CHECK_MODULES([libxml], [libxml-2.0])
++
+ AC_CHECK_LIB([m], [sqrt], , [AC_MSG_ERROR(CORE: You need libm installed)])
+ AC_CHECK_LIB([pthread], [pthread_self], , [AC_MSG_ERROR(CORE: You need libpthread installed)])
+
+@@ -79,12 +81,12 @@
+ echo "--- Enabling USB LCD display --";
+ fi
+
+-#SDL_VERSION=1.2.4
+-#AM_PATH_SDL($SDL_VERSION,
+-# :,
+-# AC_MSG_ERROR([VIDEO: *** SDL version $SDL_VERSION not found!
+-# http://www.libsdl.org/])
+-#)
++SDL_VERSION=1.2.4
++AM_PATH_SDL($SDL_VERSION,
++ :,
++ AC_MSG_ERROR([VIDEO: *** SDL version $SDL_VERSION not found!
++ http://www.libsdl.org/])
++)
+
+ AC_CHECK_LIB([vorbis], [main], ,
+ [AC_MSG_ERROR(AUDIO: You need libvorbis-dev installed.
+@@ -95,6 +97,9 @@
+ AC_CHECK_LIB([vorbisenc], [main], ,
+ [AC_MSG_ERROR(AUDIO: You need libvorbis-dev installed.
+ http://www.xiph.org/ogg/vorbis/)])
++AC_CHECK_LIB([ogg], [main], ,
++ [AC_MSG_ERROR(AUDIO: You need libogg-dev installed.
++ http://www.xiph.org/ogg/)])
+
+ AC_CHECK_LIB([sndfile], [main], ,
+ [AC_MSG_ERROR(AUDIO: you need libsndfile installed.
diff --git a/pkgs/applications/audio/freewheeling/default.nix b/pkgs/applications/audio/freewheeling/default.nix
new file mode 100644
index 00000000000..a3f356e75c4
--- /dev/null
+++ b/pkgs/applications/audio/freewheeling/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchsvn, pkgconfig, autoconf, automake, gnutls, freetype
+, SDL, SDL_gfx, SDL_ttf, liblo, libxml2, alsaLib, jack2, libvorbis
+, libsndfile, libogg
+}:
+
+stdenv.mkDerivation {
+ name = "freewheeling-100";
+
+ src = fetchsvn {
+ url = svn://svn.code.sf.net/p/freewheeling/code;
+ rev = 100;
+ sha256 = "1m6z7p93xyha25qma9bazpzbp04pqdv5h3yrv6851775xsyvzksv";
+ };
+
+ buildInputs = [
+ pkgconfig autoconf automake gnutls freetype SDL SDL_gfx SDL_ttf
+ liblo libxml2 jack2 alsaLib libvorbis libsndfile libogg
+ ];
+
+ preConfigure = "autoreconf -vfi";
+
+ patches = [ ./am_path_sdl.patch ./xml.patch ];
+
+ meta = {
+ description = "A live looping instrument with JACK and MIDI support";
+ longDescription = ''
+ Freewheeling allows us to build repetitive grooves
+ by sampling and directing loops from within spirited improvisation.
+
+ It works because, down to the core, it's built around
+ improv. We leave mice and menus, and dive into our own process
+ of making sound.
+
+ Freewheeling runs under Mac OS X and Linux, and is open source
+ software, released under the GNU GPL license.
+ '' ;
+
+ version = "r100";
+ homepage = "http://freewheeling.sourceforge.net";
+ license = stdenv.lib.licenses.gpl2;
+ maintainers = [ stdenv.lib.maintainers.sepi ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/freewheeling/xml.patch b/pkgs/applications/audio/freewheeling/xml.patch
new file mode 100644
index 00000000000..fd9d4fb39fe
--- /dev/null
+++ b/pkgs/applications/audio/freewheeling/xml.patch
@@ -0,0 +1,13 @@
+--- code-r100/src/Makefile.am 2014-09-25 23:44:41.043174832 +0200
++++ code-r100.new/src/Makefile.am 2014-09-26 01:21:03.750015888 +0200
+@@ -24,7 +24,8 @@
+
+ fweelindir = $(datadir)/fweelin
+
+-FWEELIN_CFLAGS = -I. -g -Wall -Wno-write-strings -Wno-non-virtual-dtor -D_REENTRANT -DPTHREADS -DNDEBUG -DVERSION=\"$(VERSION)\" -DFWEELIN_DATADIR=\"$(fweelindir)\" -DADDON_DIR=\"/usr/local/lib/jack\" -I/usr/include/freetype2 -I/usr/include/libxml2 -funroll-loops -finline-functions -fomit-frame-pointer -ffast-math -fexpensive-optimizations -fstrict-aliasing -falign-loops=2 -falign-jumps=2 -falign-functions=2 -O9
++XML_CFLAGS = `xml2-config --cflags`
++FWEELIN_CFLAGS = -I. -g -Wall -Wno-write-strings -Wno-non-virtual-dtor -D_REENTRANT -DPTHREADS -DNDEBUG -DVERSION=\"$(VERSION)\" -DFWEELIN_DATADIR=\"$(fweelindir)\" -DADDON_DIR=\"/usr/local/lib/jack\" -I/usr/include/freetype2 $(XML_CFLAGS) -funroll-loops -finline-functions -fomit-frame-pointer -ffast-math -fexpensive-optimizations -fstrict-aliasing -falign-loops=2 -falign-jumps=2 -falign-functions=2 -O9
+
+ AM_CFLAGS = $(CFLAGS) $(FWEELIN_CFLAGS)
+-AM_CXXFLAGS = $(CFLAGS) $(CXXFLAGS) $(FWEELIN_CFLAGS)
++AM_CXXFLAGS = $(CFLAGS) $(CXXFLAGS) $(FWEELIN_CFLAGS) ${libxml2_CFLAGS}
diff --git a/pkgs/applications/audio/gmpc/default.nix b/pkgs/applications/audio/gmpc/default.nix
index 728155c02bd..a8f9480c7d3 100644
--- a/pkgs/applications/audio/gmpc/default.nix
+++ b/pkgs/applications/audio/gmpc/default.nix
@@ -1,5 +1,6 @@
{ stdenv, fetchurl, libtool, intltool, pkgconfig, glib
, gtk, curl, mpd_clientlib, libsoup, gob2, vala, libunique
+, libSM, libICE
}:
stdenv.mkDerivation rec {
@@ -22,7 +23,7 @@ stdenv.mkDerivation rec {
buildInputs = [
libtool intltool pkgconfig glib gtk curl mpd_clientlib libsoup
- libunique libmpd gob2 vala
+ libunique libmpd gob2 vala libSM libICE
];
meta = with stdenv.lib; {
diff --git a/pkgs/applications/audio/gmu/default.nix b/pkgs/applications/audio/gmu/default.nix
index e75be3e2c2b..f23ba66a3b5 100644
--- a/pkgs/applications/audio/gmu/default.nix
+++ b/pkgs/applications/audio/gmu/default.nix
@@ -30,6 +30,6 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://wejp.k.vu/projects/gmu;
description = "Open source music player for portable gaming consoles and handhelds";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/applications/audio/google-musicmanager/default.nix b/pkgs/applications/audio/google-musicmanager/default.nix
index 8cff94c25d9..107dcdce05c 100644
--- a/pkgs/applications/audio/google-musicmanager/default.nix
+++ b/pkgs/applications/audio/google-musicmanager/default.nix
@@ -4,8 +4,8 @@
assert stdenv.system == "x86_64-linux" || stdenv.system == "1686-linux";
stdenv.mkDerivation rec {
- debversion = "beta_1.0.84.1107-r0";
- version = "1.0.84.1107-beta-r0"; # friendly to nix-env version sorting algo
+ debversion = "beta_1.0.55.7425-r0";
+ version = "beta_1.0.55.7425-r0"; # friendly to nix-env version sorting algo
product = "google-musicmanager";
name = "${product}-${version}";
@@ -16,12 +16,12 @@ stdenv.mkDerivation rec {
src = if stdenv.system == "x86_64-linux"
then fetchurl {
- url = "http://dl.google.com/linux/musicmanager/deb/pool/main/g/${product}-beta/${product}-${debversion}_amd64.deb";
- sha256 = "0irlrspw508b1s9i5d1mddpp2x9w1ny3svf27gxf8pmwbiyd1cyi";
+ url = "http://dl.google.com/linux/musicmanager/deb/pool/main/g/google-musicmanager-beta/google-musicmanager-${version}_amd64.deb";
+ sha256 = "0efdce3970e2cf83eb7d8f6021f987a1517a41823784ada8e51f1649f8a49342";
}
else fetchurl {
- url = "http://dl.google.com/linux/musicmanager/deb/pool/main/g/${product}-beta/${product}-${debversion}_i386.deb";
- sha256 = "13pfsjvaygap6axrlbfhyk1h8377xmwi47x4af6j57qq6z7329rg";
+ url = "http://dl.google.com/linux/musicmanager/deb/pool/main/g/google-musicmanager-beta/google-musicmanager-${version}_i386.deb";
+ sha256 = "4cc8822ab90af97195c2edfa74cc8b4a736e763cc3382f741aa1de0f72ac211e";
};
unpackPhase = ''
diff --git a/pkgs/applications/audio/gpodder/default.nix b/pkgs/applications/audio/gpodder/default.nix
new file mode 100644
index 00000000000..de5ef055125
--- /dev/null
+++ b/pkgs/applications/audio/gpodder/default.nix
@@ -0,0 +1,73 @@
+{ pkgs, stdenv, fetchurl, python, buildPythonPackage, pythonPackages, mygpoclient, intltool,
+ ipodSupport ? true, libgpod, gpodderHome ? "", gpodderDownloadDir ? "",
+ gnome3, hicolor_icon_theme }:
+
+with pkgs.lib;
+
+let
+ inherit (pythonPackages) coverage feedparser minimock sqlite3 dbus pygtk eyeD3;
+
+in buildPythonPackage rec {
+ name = "gpodder-3.8.0";
+
+ src = fetchurl {
+ url = "http://gpodder.org/src/${name}.tar.gz";
+ sha256 = "0731f08f4270c81872b841b55200ae80feb4502706397d0085079471fb9a8fe4";
+ };
+
+ buildInputs = [
+ coverage feedparser minimock sqlite3 mygpoclient intltool
+ gnome3.gnome_icon_theme gnome3.gnome_icon_theme_symbolic
+ hicolor_icon_theme
+ ];
+
+ propagatedBuildInputs = [ feedparser dbus mygpoclient sqlite3 pygtk eyeD3 ]
+ ++ stdenv.lib.optional ipodSupport libgpod;
+
+ postPatch = "sed -ie 's/PYTHONPATH=src/PYTHONPATH=\$(PYTHONPATH):src/' makefile";
+
+ checkPhase = "make unittest";
+
+ preFixup = ''
+ wrapProgram $out/bin/gpodder \
+ ${optionalString (gpodderHome != "") "--set GPODDER_HOME ${gpodderHome}"} \
+ ${optionalString (gpodderDownloadDir != "") "--set GPODDER_DOWNLOAD_DIR ${gpodderDownloadDir}"} \
+ --prefix XDG_DATA_DIRS : "${gnome3.gnome_themes_standard}/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH"
+ '';
+
+ # The `wrapPythonPrograms` script in the postFixup phase breaks gpodder. The
+ # easiest way to fix this is to call wrapPythonPrograms and then to clean up
+ # the wrapped file.
+ postFixup = ''
+ wrapPythonPrograms
+
+ if test -e $out/nix-support/propagated-build-inputs; then
+ ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
+ fi
+
+ createBuildInputsPth build-inputs "$buildInputStrings"
+ for inputsfile in propagated-build-inputs propagated-native-build-inputs; do
+ if test -e $out/nix-support/$inputsfile; then
+ createBuildInputsPth $inputsfile "$(cat $out/nix-support/$inputsfile)"
+ fi
+ done
+
+ sed -i "$out/bin/..gpodder-wrapped-wrapped" -e '{
+ /import sys; sys.argv/d
+ }'
+ '';
+
+ installPhase = "DESTDIR=/ PREFIX=$out make install";
+
+ meta = {
+ description = "A podcatcher written in python";
+ longDescription = ''
+ gPodder downloads and manages free audio and video content (podcasts)
+ for you. Listen directly on your computer or on your mobile devices.
+ '';
+ homepage = "http://gpodder.org/";
+ license = "GPLv3";
+ platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+ maintainers = [ stdenv.lib.maintainers.skeidel ];
+ };
+}
diff --git a/pkgs/applications/audio/gtkpod/default.nix b/pkgs/applications/audio/gtkpod/default.nix
index 90e27c12ce3..9c08b2ab6d7 100644
--- a/pkgs/applications/audio/gtkpod/default.nix
+++ b/pkgs/applications/audio/gtkpod/default.nix
@@ -1,25 +1,40 @@
-{ stdenv, fetchurl, pkgconfig, libgpod, gtk, glib, gettext, perl, perlXMLParser
-, libglade, flex, libid3tag, libvorbis, intltool }:
+{ stdenv, fetchurl, pkgconfig, makeWrapper, intltool, libgpod, curl, flac,
+ gnome, gtk3, glib, gettext, perl, perlXMLParser, flex, libglade, libid3tag,
+ libvorbis, hicolor_icon_theme, gdk_pixbuf }:
-stdenv.mkDerivation {
- name = "gtkpod-1.0.0";
+stdenv.mkDerivation rec {
+ version = "2.1.4";
+ name = "gtkpod-${version}";
src = fetchurl {
- url = mirror://sourceforge/gtkpod/gtkpod-1.0.0.tar.gz;
- sha256 = "04jzybs55c27kyp7r9c58prcq0q4ssvj5iggva857f49s1ar826q";
+ url = "mirror://sourceforge/gtkpod/${name}.tar.gz";
+ sha256 = "ba12b35f3f24a155b68f0ffdaf4d3c5c7d1b8df04843a53306e1c83fc811dfaa";
};
- buildInputs = [ pkgconfig libgpod gettext perl perlXMLParser gtk libglade flex
- libid3tag libvorbis intltool ];
+ propagatedUserEnvPkgs = [ gnome.gnome_themes_standard ];
+
+ buildInputs = [ pkgconfig makeWrapper intltool curl gettext perl perlXMLParser
+ flex libgpod libid3tag flac libvorbis gtk3 gdk_pixbuf libglade gnome.anjuta
+ gnome.gdl gnome.gnome_icon_theme_symbolic gnome.gnome_icon_theme
+ hicolor_icon_theme ];
patchPhase = ''
sed -i 's/which/type -P/' scripts/*.sh
'';
- meta = {
+ preFixup = ''
+ wrapProgram "$out/bin/gtkpod" \
+ --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
+ --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gnome.gnome_themes_standard}/share:$out/share:$GSETTINGS_SCHEMAS_PATH"
+ '';
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
description = "GTK Manager for an Apple ipod";
homepage = http://gtkpod.sourceforge.net;
- license = "GPLv2+";
- platforms = with stdenv.lib.platforms; linux;
+ license = licenses.gpl2Plus;
+ platforms = platforms.linux;
+ maintainers = [ maintainers.skeidel ];
};
}
diff --git a/pkgs/applications/audio/guitarix/default.nix b/pkgs/applications/audio/guitarix/default.nix
index 44b0e9ef0d7..fd61c65dba2 100644
--- a/pkgs/applications/audio/guitarix/default.nix
+++ b/pkgs/applications/audio/guitarix/default.nix
@@ -1,19 +1,19 @@
-{ stdenv, fetchurl, avahi, boost, fftw, gettext, glib, glibmm, gtk
-, gtkmm, intltool, jackaudio, ladspaH, librdf, libsndfile, lv2
-, pkgconfig, python }:
+{ stdenv, fetchurl, avahi, boost, eigen, fftw, gettext, glib, glibmm, gtk
+, gtkmm, intltool, jack2, ladspaH, librdf, libsndfile, lilv, lv2
+, pkgconfig, python, serd, sord, sratom }:
stdenv.mkDerivation rec {
name = "guitarix-${version}";
- version = "0.28.3";
+ version = "0.31.0";
src = fetchurl {
url = "mirror://sourceforge/guitarix/guitarix2-${version}.tar.bz2";
- sha256 = "0ks5avylyicqfj9l1wf4gj62i8m6is2jmp0h11h5l2wbg3xiwxjd";
+ sha256 = "0n3swk4xahspf42qglikfmvcz8my43wmp6sp4ns7h4m8hr9lgfk6";
};
buildInputs = [
- avahi boost fftw gettext glib glibmm gtk gtkmm intltool jackaudio
- ladspaH librdf libsndfile lv2 pkgconfig python
+ avahi boost boost.lib eigen fftw gettext glib glibmm gtk gtkmm intltool
+ jack2 ladspaH librdf libsndfile lilv lv2 pkgconfig python serd sord sratom
];
configurePhase = "python waf configure --prefix=$out";
diff --git a/pkgs/applications/audio/hydrogen/default.nix b/pkgs/applications/audio/hydrogen/default.nix
index 74ff2a3407c..434f683bd5c 100644
--- a/pkgs/applications/audio/hydrogen/default.nix
+++ b/pkgs/applications/audio/hydrogen/default.nix
@@ -1,35 +1,19 @@
-{ stdenv, fetchurl, alsaLib, boost, glib, jackaudio, ladspaPlugins
-, libarchive, liblrdf , libsndfile, pkgconfig, qt4, scons, subversion }:
+{ stdenv, fetchurl, alsaLib, boost, cmake, glib, jack2, libarchive
+, liblrdf, libsndfile, pkgconfig, qt4 }:
stdenv.mkDerivation rec {
- version = "0.9.5.1";
+ version = "0.9.6.1";
name = "hydrogen-${version}";
src = fetchurl {
- url = "mirror://sourceforge/hydrogen/hydrogen-${version}.tar.gz";
- sha256 = "1fvyp6gfzcqcc90dmaqbm11p272zczz5pfz1z4lj33nfr7z0bqgb";
+ url = "https://github.com/hydrogen-music/hydrogen/archive/${version}.tar.gz";
+ sha256 = "0vxnaqfmcv7hhk0cj67imdcqngspnck7f0wfmvhfgfqa7x1xznll";
};
buildInputs = [
- alsaLib boost glib jackaudio ladspaPlugins libarchive liblrdf
- libsndfile pkgconfig qt4 scons subversion
+ alsaLib boost cmake glib jack2 libarchive liblrdf libsndfile pkgconfig qt4
];
- patches = [ ./scons-env.patch ];
-
- postPatch = ''
- sed -e 's#/usr/lib/ladspa#${ladspaPlugins}/lib/ladspa#' -i libs/hydrogen/src/preferences.cpp
- sed '/\/usr/d' -i libs/hydrogen/src/preferences.cpp
- sed "s#pkg_ver.rstrip().split('.')#pkg_ver.rstrip().split('.')[:3]#" -i Sconstruct
- '';
-
- # why doesn't scons find librdf?
- buildPhase = ''
- scons prefix=$out libarchive=1 lrdf=0 install
- '';
-
- installPhase = ":";
-
meta = with stdenv.lib; {
description = "Advanced drum machine";
homepage = http://www.hydrogen-music.org;
diff --git a/pkgs/applications/audio/hydrogen/scons-env.patch b/pkgs/applications/audio/hydrogen/scons-env.patch
deleted file mode 100644
index ebc17f67872..00000000000
--- a/pkgs/applications/audio/hydrogen/scons-env.patch
+++ /dev/null
@@ -1,28 +0,0 @@
---- hydrogen-0.9.5/Sconstruct 2011-03-15 13:22:35.000000000 +0100
-+++ hydrogen-0.9.5/Sconstruct 2011-04-17 16:06:54.000000000 +0200
-@@ -178,7 +178,7 @@
-
- includes.append( "libs/hydrogen/include" )
-
-- env = Environment( options = opts )
-+ env = Environment( options = opts, ENV = os.environ )
-
-
- #location of qt4.py
-@@ -298,7 +298,6 @@
-
- for N in glob.glob('./data/i18n/hydrogen.*'):
- env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data/i18n', source=N))
-- env.Alias(target="install", source=env.Install(dir= env['DESTDIR'] + env['prefix'] + '/share/hydrogen/data', source="./data/img"))
-
- #add every img in ./data/img to the install list.
- os.path.walk("./data/img/",install_images,env)
-@@ -379,7 +379,7 @@
-
- includes, a , b = get_platform_flags( opts )
-
--env = Environment(options = opts, CPPPATH = includes)
-+env = Environment(options = opts, ENV = os.environ)
-
-
- Help(opts.GenerateHelpText(env))
diff --git a/pkgs/applications/audio/id3v2/default.nix b/pkgs/applications/audio/id3v2/default.nix
index a7835f020d1..b96872c7ef0 100644
--- a/pkgs/applications/audio/id3v2/default.nix
+++ b/pkgs/applications/audio/id3v2/default.nix
@@ -23,6 +23,6 @@ stdenv.mkDerivation rec {
meta = {
description = "A command line editor for id3v2 tags";
homepage = http://id3v2.sourceforge.net/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
};
}
diff --git a/pkgs/applications/audio/ingen/default.nix b/pkgs/applications/audio/ingen/default.nix
index 73138cc269d..f6c0d9e9945 100644
--- a/pkgs/applications/audio/ingen/default.nix
+++ b/pkgs/applications/audio/ingen/default.nix
@@ -1,19 +1,19 @@
-{ stdenv, fetchsvn, boost, ganv, glibmm, gtk, gtkmm, jackaudio, lilv
+{ stdenv, fetchsvn, boost, ganv, glibmm, gtk, gtkmm, jack2, lilv
, lv2, pkgconfig, python, raul, serd, sord, sratom, suil
}:
stdenv.mkDerivation rec {
name = "ingen-svn-${rev}";
- rev = "5317";
+ rev = "5464";
src = fetchsvn {
url = "http://svn.drobilla.net/lad/trunk/ingen";
rev = rev;
- sha256 = "0zm3wbv9qsingjyr95nwin3khmnf3wq3fz2xa6p420dpcy6qnl4x";
+ sha256 = "1p5rsxwanpj3kj5yai7zqbharj2ldvn78x3p739vkgpr3dinp506";
};
buildInputs = [
- boost ganv glibmm gtk gtkmm jackaudio lilv lv2 pkgconfig python
+ boost boost.lib ganv glibmm gtk gtkmm jack2 lilv lv2 pkgconfig python
raul serd sord sratom suil
];
diff --git a/pkgs/applications/audio/jack-capture/default.nix b/pkgs/applications/audio/jack-capture/default.nix
index 3b8f0f652a8..2e6f6b0dd82 100644
--- a/pkgs/applications/audio/jack-capture/default.nix
+++ b/pkgs/applications/audio/jack-capture/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, jackaudio, libsndfile, pkgconfig }:
+{ stdenv, fetchurl, jack2, libsndfile, pkgconfig }:
stdenv.mkDerivation rec {
name = "jack_capture-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "0sk7b92my1v1g7rhkpl1c608rb0rdb28m9zqfll95kflxajd16zv";
};
- buildInputs = [ jackaudio libsndfile pkgconfig ];
+ buildInputs = [ jack2 libsndfile pkgconfig ];
buildPhase = "PREFIX=$out make jack_capture";
diff --git a/pkgs/applications/audio/jack-oscrolloscope/default.nix b/pkgs/applications/audio/jack-oscrolloscope/default.nix
index dbceb0a336c..7b4d12a5b87 100644
--- a/pkgs/applications/audio/jack-oscrolloscope/default.nix
+++ b/pkgs/applications/audio/jack-oscrolloscope/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL, jackaudio, mesa, pkgconfig }:
+{ stdenv, fetchurl, SDL, jack2, mesa, pkgconfig }:
stdenv.mkDerivation rec {
name = "jack_oscrolloscope-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "1pl55in0sj7h5r06n1v91im7d18pplvhbjhjm1fdl39zwnyxiash";
};
- buildInputs = [ SDL jackaudio mesa pkgconfig ];
+ buildInputs = [ SDL jack2 mesa pkgconfig ];
installPhase = ''
mkdir -p $out/bin
diff --git a/pkgs/applications/audio/jack-rack/default.nix b/pkgs/applications/audio/jack-rack/default.nix
index 1d1128e663d..8ac47c570df 100644
--- a/pkgs/applications/audio/jack-rack/default.nix
+++ b/pkgs/applications/audio/jack-rack/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkgconfig, jackaudio, ladspaH, gtk, alsaLib, libxml2, librdf }:
+{ stdenv, fetchurl, pkgconfig, jack2, ladspaH, gtk, alsaLib, libxml2, librdf }:
stdenv.mkDerivation rec {
name = "jack-rack-1.4.7";
src = fetchurl {
url = "mirror://sourceforge/jack-rack/${name}.tar.bz2";
sha256 = "1lmibx9gicagcpcisacj6qhq6i08lkl5x8szysjqvbgpxl9qg045";
};
- buildInputs = [ pkgconfig jackaudio ladspaH gtk alsaLib libxml2 librdf ];
+ buildInputs = [ pkgconfig jack2 ladspaH gtk alsaLib libxml2 librdf ];
meta = {
description = ''An effects "rack" for the JACK low latency audio API'';
diff --git a/pkgs/applications/audio/jackmeter/default.nix b/pkgs/applications/audio/jackmeter/default.nix
index 98fcb8943af..74d98184d9d 100644
--- a/pkgs/applications/audio/jackmeter/default.nix
+++ b/pkgs/applications/audio/jackmeter/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, jackaudio, pkgconfig }:
+{ stdenv, fetchurl, jack2, pkgconfig }:
stdenv.mkDerivation rec {
name = "jackmeter-0.4";
@@ -8,12 +8,12 @@ stdenv.mkDerivation rec {
sha256 = "1cnvgx3jv0yvxlqy0l9k285zgvazmh5k8m4l7lxckjfm5bn6hm1r";
};
- buildInputs = [ jackaudio pkgconfig ];
+ buildInputs = [ jack2 pkgconfig ];
meta = {
description = "Console jack loudness meter";
homepage = http://www.aelius.com/njh/jackmeter/;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.marcweber ];
platforms = stdenv.lib.platforms.linux;
};
diff --git a/pkgs/applications/audio/jalv/default.nix b/pkgs/applications/audio/jalv/default.nix
index 2baf69cef4f..bf01fe1a935 100644
--- a/pkgs/applications/audio/jalv/default.nix
+++ b/pkgs/applications/audio/jalv/default.nix
@@ -1,17 +1,17 @@
-{ stdenv, fetchurl, gtk, jackaudio, lilv, lv2, pkgconfig, python
+{ stdenv, fetchurl, gtk, jack2, lilv, lv2, pkgconfig, python
, serd, sord , sratom, suil }:
stdenv.mkDerivation rec {
name = "jalv-${version}";
- version = "1.4.4";
+ version = "1.4.6";
src = fetchurl {
url = "http://download.drobilla.net/${name}.tar.bz2";
- sha256 = "1iql1r52rmf87q6jkxhcxa3lpq7idzzg55ma91wphywyvh29q7lf";
+ sha256 = "1f1hcq74n3ziw8bk97mn5a1vgw028dxikv3fchaxd430pbbhqgl9";
};
buildInputs = [
- gtk jackaudio lilv lv2 pkgconfig python serd sord sratom suil
+ gtk jack2 lilv lv2 pkgconfig python serd sord sratom suil
];
configurePhase = "python waf configure --prefix=$out";
diff --git a/pkgs/applications/audio/kid3/default.nix b/pkgs/applications/audio/kid3/default.nix
new file mode 100644
index 00000000000..6a46681c12f
--- /dev/null
+++ b/pkgs/applications/audio/kid3/default.nix
@@ -0,0 +1,74 @@
+{ stdenv, fetchurl
+, pkgconfig, cmake, perl, ffmpeg
+, docbook_xml_dtd_45, docbook_xsl, libxslt
+, phonon, automoc4, chromaprint, id3lib
+, taglib, mp4v2, flac, libogg, libvorbis
+, qt, zlib, readline
+, makeWrapper
+}:
+
+stdenv.mkDerivation rec {
+
+ name = "kid3-${version}";
+ version = "3.1.1";
+
+ src = fetchurl {
+ url = "http://downloads.sourceforge.net/project/kid3/kid3/${version}/${name}.tar.gz";
+ sha256 = "0mr617k712zpd99rgsy313jrb6jcjn1malj4lirzqhp7307wsf34";
+ };
+
+ buildInputs = with stdenv.lib;
+ [ pkgconfig cmake perl ffmpeg docbook_xml_dtd_45 docbook_xsl libxslt
+ phonon automoc4 chromaprint id3lib taglib mp4v2 flac libogg libvorbis
+ qt zlib readline makeWrapper ];
+
+ cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" "-DWITH_APPS=Qt;CLI" ];
+ NIX_LDFLAGS = "-lm -lpthread";
+
+ preConfigure = ''
+ export DOCBOOKDIR="${docbook_xsl}/xml/xsl/docbook/"
+ '';
+
+ postInstall = ''
+ wrapProgram $out/bin/kid3-qt --prefix QT_PLUGIN_PATH : $out/lib/qt4/plugins
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A simple and powerful audio tag editor";
+ longDescription = ''
+ If you want to easily tag multiple MP3, Ogg/Vorbis, FLAC, MPC,
+ MP4/AAC, MP2, Opus, Speex, TrueAudio, WavPack, WMA, WAV and AIFF
+ files (e.g. full albums) without typing the same information
+ again and again and have control over both ID3v1 and ID3v2 tags,
+ then Kid3 is the program you are looking for.
+
+ With Kid3 you can:
+ - Edit ID3v1.1 tags;
+ - Edit all ID3v2.3 and ID3v2.4 frames;
+ - Convert between ID3v1.1, ID3v2.3 and ID3v2.4 tags
+ - Edit tags in MP3, Ogg/Vorbis, FLAC, MPC, MP4/AAC, MP2, Opus,
+ Speex, TrueAudio, WavPack, WMA, WAV, AIFF files and tracker
+ modules (MOD, S3M, IT, XM);
+ - Edit tags of multiple files, e.g. the artist, album, year and
+ genre of all files of an album typically have the same values
+ and can be set together;
+ - Generate tags from filenames;
+ - Generate tags from the contents of tag fields;
+ - Generate filenames from tags;
+ - Rename and create directories from tags;
+ - Generate playlist files;
+ - Automatically convert upper and lower case and replace strings;
+ - Import from gnudb.org, TrackType.org, MusicBrainz, Discogs,
+ Amazon and other sources of album data;
+ - Export tags as CSV, HTML, playlists, Kover XML and in other
+ formats;
+ - Edit synchronized lyrics and event timing codes, import and
+ export LRC files
+ '';
+ homepage = http://kid3.sourceforge.net/;
+ license = licenses.lgpl2Plus;
+ maintainers = [ maintainers.AndersonTorres ];
+ };
+}
+
+# TODO: Qt5 support
diff --git a/pkgs/applications/audio/lash/default.nix b/pkgs/applications/audio/lash/default.nix
index ad52e7b2d85..e42babf13ef 100644
--- a/pkgs/applications/audio/lash/default.nix
+++ b/pkgs/applications/audio/lash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, gtk, jackaudio, libuuid, libxml2
+{ stdenv, fetchurl, alsaLib, gtk, jack2, libuuid, libxml2
, makeWrapper, pkgconfig, readline }:
assert libuuid != null;
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
# http://permalink.gmane.org/gmane.linux.redhat.fedora.extras.cvs/822346
patches = [ ./socket.patch ./gcc-47.patch ];
- buildInputs = [ alsaLib gtk jackaudio libuuid libxml2 makeWrapper
+ buildInputs = [ alsaLib gtk jack2 libuuid libxml2 makeWrapper
pkgconfig readline ];
postInstall = ''
diff --git a/pkgs/applications/audio/lastwatch/default.nix b/pkgs/applications/audio/lastwatch/default.nix
index c09d397eefa..2cffb0ebacf 100644
--- a/pkgs/applications/audio/lastwatch/default.nix
+++ b/pkgs/applications/audio/lastwatch/default.nix
@@ -23,5 +23,6 @@ pythonPackages.buildPythonPackage rec {
homepage = "https://github.com/aszlig/LastWatch";
description = "An inotify-based last.fm audio scrobbler";
license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/audio/lingot/default.nix b/pkgs/applications/audio/lingot/default.nix
index 4b8ba4dbc24..4b07c84b0be 100644
--- a/pkgs/applications/audio/lingot/default.nix
+++ b/pkgs/applications/audio/lingot/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
meta = {
description = "Not a Guitar-Only tuner";
homepage = http://www.nongnu.org/lingot/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = with stdenv.lib.platforms; linux;
maintainers = with stdenv.lib.maintainers; [viric];
};
diff --git a/pkgs/applications/audio/linuxsampler/default.nix b/pkgs/applications/audio/linuxsampler/default.nix
index 1408a1775ee..2c4b26543eb 100644
--- a/pkgs/applications/audio/linuxsampler/default.nix
+++ b/pkgs/applications/audio/linuxsampler/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchsvn, alsaLib, asio, autoconf, automake, bison
-, jackaudio, libgig, libsndfile, libtool, lv2, pkgconfig }:
+, jack2, libgig, libsndfile, libtool, lv2, pkgconfig }:
stdenv.mkDerivation rec {
name = "linuxsampler-svn-${version}";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
'';
buildInputs = [
- alsaLib asio autoconf automake bison jackaudio libgig libsndfile
+ alsaLib asio autoconf automake bison jack2 libgig libsndfile
libtool lv2 pkgconfig
];
diff --git a/pkgs/applications/audio/lmms/default.nix b/pkgs/applications/audio/lmms/default.nix
index 5195ddd42a1..ee47d607c2b 100644
--- a/pkgs/applications/audio/lmms/default.nix
+++ b/pkgs/applications/audio/lmms/default.nix
@@ -1,21 +1,24 @@
-{ stdenv, fetchurl, SDL, alsaLib, cmake, fftwSinglePrec, jackaudio, libogg
-, libsamplerate, libsndfile, pkgconfig, pulseaudio, qt4
+{ stdenv, fetchurl, SDL, alsaLib, cmake, fftwSinglePrec, fluidsynth
+, fltk13, jack2, libvorbis , libsamplerate, libsndfile, pkgconfig
+, pulseaudio, qt4, freetype
}:
stdenv.mkDerivation rec {
name = "lmms-${version}";
- version = "0.4.15";
+ version = "1.0.3";
src = fetchurl {
- url = "mirror://sourceforge/lmms/${name}.tar.bz2";
- sha256 = "02q2gbsqwk3hf9kvzz58a5bxmlb4cfr2mzy41wdvbxxdm2pcl101";
+ url = "https://github.com/LMMS/lmms/archive/v${version}.tar.gz";
+ sha256 = "191mfld3gspnxlgwcszp9kls58kdwrplj0rfw4zqsz90zdbsjnx3";
};
buildInputs = [
- SDL alsaLib cmake fftwSinglePrec jackaudio libogg libsamplerate
- libsndfile pkgconfig pulseaudio qt4
+ SDL alsaLib cmake fftwSinglePrec fltk13 fluidsynth jack2
+ libsamplerate libsndfile libvorbis pkgconfig pulseaudio qt4
];
+ enableParallelBuilding = true;
+
meta = with stdenv.lib; {
description = "Linux MultiMedia Studio";
homepage = "http://lmms.sourceforge.net";
diff --git a/pkgs/applications/audio/mhwaveedit/default.nix b/pkgs/applications/audio/mhwaveedit/default.nix
index a8287b10a29..a1e81be3cb3 100644
--- a/pkgs/applications/audio/mhwaveedit/default.nix
+++ b/pkgs/applications/audio/mhwaveedit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL , alsaLib, gtk, jackaudio, ladspaH
+{ stdenv, fetchurl, SDL , alsaLib, gtk, jack2, ladspaH
, ladspaPlugins, libsamplerate, libsndfile, pkgconfig, pulseaudio }:
stdenv.mkDerivation rec {
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
};
buildInputs =
- [ SDL alsaLib gtk jackaudio ladspaH libsamplerate libsndfile
+ [ SDL alsaLib gtk jack2 ladspaH libsamplerate libsndfile
pkgconfig pulseaudio
];
diff --git a/pkgs/applications/audio/mikmod/default.nix b/pkgs/applications/audio/mikmod/default.nix
index a86e09278c3..f38ff469731 100644
--- a/pkgs/applications/audio/mikmod/default.nix
+++ b/pkgs/applications/audio/mikmod/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Tracker music player for the terminal";
homepage = http://mikmod.shlomifish.org/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [ viric ];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/audio/milkytracker/default.nix b/pkgs/applications/audio/milkytracker/default.nix
index 965c941113c..eadbaabcf56 100644
--- a/pkgs/applications/audio/milkytracker/default.nix
+++ b/pkgs/applications/audio/milkytracker/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, SDL, alsaLib, autoconf, automake, jackaudio, perl
+{ stdenv, fetchurl, SDL, alsaLib, autoconf, automake, jack2, perl
, zlib, zziplib
}:
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
export CPATH=${zlib}/lib
'';
- buildInputs = [ SDL alsaLib autoconf automake jackaudio perl zlib zziplib ];
+ buildInputs = [ SDL alsaLib autoconf automake jack2 perl zlib zziplib ];
meta = {
description = "Music tracker application, similar to Fasttracker II.";
diff --git a/pkgs/applications/audio/mixxx/default.nix b/pkgs/applications/audio/mixxx/default.nix
index b76eecc9e4a..e3422d4ba06 100644
--- a/pkgs/applications/audio/mixxx/default.nix
+++ b/pkgs/applications/audio/mixxx/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
buildPhase = ''
runHook preBuild
- ensureDir "$out"
+ mkdir -p "$out"
scons \
-j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \
$sconsFlags "prefix=$out"
diff --git a/pkgs/applications/audio/moc/default.nix b/pkgs/applications/audio/moc/default.nix
index c5a33796ca5..ec9b1dd47ae 100644
--- a/pkgs/applications/audio/moc/default.nix
+++ b/pkgs/applications/audio/moc/default.nix
@@ -1,21 +1,27 @@
-{ stdenv, fetchurl, ncurses, pkgconfig, alsaLib, flac, libmad, speex, ffmpeg, libvorbis, mpc, libsndfile, jackaudio, db, libmodplug, timidity, libid3tag, libtool }:
+{ stdenv, fetchurl, ncurses, pkgconfig, alsaLib, flac, libmad, speex, ffmpeg
+, libvorbis, mpc, libsndfile, jack2, db, libmodplug, timidity, libid3tag
+, libtool
+}:
stdenv.mkDerivation rec {
name = "moc-${version}";
- version = "2.5.0-beta2";
+ version = "2.5.0";
src = fetchurl {
- url = "http://ftp.daper.net/pub/soft/moc/unstable/moc-${version}.tar.bz2";
- sha256 = "486d50584c3fb0067b8c03af54e44351633a7740b18dc3b7358322051467034c";
+ url = "http://ftp.daper.net/pub/soft/moc/stable/moc-${version}.tar.bz2";
+ sha256 = "14b0g9jn12jzxsf292g64dc6frlxv99kaagsasmc8xmg80iab7nj";
};
- configurePhase = "./configure prefix=$out";
+ buildInputs = [
+ ncurses pkgconfig alsaLib flac libmad speex ffmpeg libvorbis
+ mpc libsndfile jack2 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.";
+ meta = with stdenv.lib; {
+ description = "An ncurses console audio player designed to be powerful and easy to use";
homepage = http://moc.daper.net/;
- license = stdenv.lib.licenses.gpl2;
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ pSub jagajaga ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/monkeys-audio/default.nix b/pkgs/applications/audio/monkeys-audio/default.nix
index 08aa7e017b2..d1c6ed6379a 100644
--- a/pkgs/applications/audio/monkeys-audio/default.nix
+++ b/pkgs/applications/audio/monkeys-audio/default.nix
@@ -14,6 +14,6 @@ stdenv.mkDerivation rec {
meta = with stdenv.lib; {
platforms = platforms.linux;
- maintainers = maintainers.mornfall;
+ maintainers = [ maintainers.mornfall ];
};
}
diff --git a/pkgs/applications/audio/mopidy-moped/default.nix b/pkgs/applications/audio/mopidy-moped/default.nix
new file mode 100644
index 00000000000..c50a1798b47
--- /dev/null
+++ b/pkgs/applications/audio/mopidy-moped/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pythonPackages, mopidy }:
+
+pythonPackages.buildPythonPackage rec {
+ name = "mopidy-moped-${version}";
+
+ version = "0.3.3";
+
+ src = fetchurl {
+ url = "https://github.com/martijnboland/moped/archive/v${version}.tar.gz";
+ sha256 = "19f3asqx7wmla53nhrxzdwj6qlkjv2rcwh34jxp27bz7nkhn0ihv";
+ };
+
+ propagatedBuildInputs = [ mopidy ];
+
+ doCheck = false;
+
+ meta = with stdenv.lib; {
+ homepage = https://github.com/martijnboland/moped;
+ description = "A web client for Mopidy";
+ license = licenses.mit;
+ maintainers = [ maintainers.rickynils ];
+ hydraPlatforms = [];
+ };
+}
diff --git a/pkgs/applications/audio/mopidy-spotify/default.nix b/pkgs/applications/audio/mopidy-spotify/default.nix
new file mode 100644
index 00000000000..6223ffb0d81
--- /dev/null
+++ b/pkgs/applications/audio/mopidy-spotify/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pythonPackages, mopidy }:
+
+pythonPackages.buildPythonPackage rec {
+ name = "mopidy-spotify-${version}";
+
+ version = "1.2.0";
+
+ src = fetchurl {
+ url = "https://github.com/mopidy/mopidy-spotify/archive/v${version}.tar.gz";
+ sha256 = "1fgxakylsx0nggis11v6bxfy8h3dl1n1v86liyfcj0xazb1mx69m";
+ };
+
+ propagatedBuildInputs = [ mopidy pythonPackages.pyspotify ];
+
+ doCheck = false;
+
+ meta = with stdenv.lib; {
+ homepage = http://www.mopidy.com/;
+ description = "Mopidy extension for playing music from Spotify.";
+ license = licenses.asl20;
+ maintainers = [ maintainers.rickynils ];
+ hydraPlatforms = [];
+ };
+}
diff --git a/pkgs/applications/audio/mopidy/default.nix b/pkgs/applications/audio/mopidy/default.nix
index 04393372cf3..a0a3af0e958 100644
--- a/pkgs/applications/audio/mopidy/default.nix
+++ b/pkgs/applications/audio/mopidy/default.nix
@@ -5,39 +5,33 @@
pythonPackages.buildPythonPackage rec {
name = "mopidy-${version}";
- version = "0.15.0";
+ version = "0.19.4";
src = fetchurl {
url = "https://github.com/mopidy/mopidy/archive/v${version}.tar.gz";
- sha256 = "1fpnddcx6343wgxzh10s035w21g8jmfh2kzgx32w0xsshpra3gn1";
+ sha256 = "13dyn9pgq0jns6915diizviqyn64yfysb08k77xsmxrr4bhm1156";
};
propagatedBuildInputs = with pythonPackages; [
- gst_python pygobject pykka pyspotify pylast cherrypy ws4py gst_plugins_base gst_plugins_good
+ gst_python pygobject pykka tornado gst_plugins_base gst_plugins_good
];
- # python zip complains about old timestamps
- preConfigure = ''
- find -print0 | xargs -0 touch
- '';
-
# There are no tests
doCheck = false;
postInstall = ''
- for p in $out/bin/mopidy $out/bin/mopidy-scan; do
- wrapProgram $p \
- --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH"
- done
+ wrapProgram $out/bin/mopidy \
+ --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH"
'';
- meta = {
+ meta = with stdenv.lib; {
homepage = http://www.mopidy.com/;
description = ''
- A music server which can play music from Spotify and from your
- local hard drive.
+ An extensible music server that plays music from local disk, Spotify,
+ SoundCloud, Google Play Music, and more.
'';
- maintainers = [ stdenv.lib.maintainers.rickynils ];
+ license = licenses.asl20;
+ maintainers = [ maintainers.rickynils ];
hydraPlatforms = [];
};
}
diff --git a/pkgs/applications/audio/mp3info/default.nix b/pkgs/applications/audio/mp3info/default.nix
index d5a8138a500..ede31ac9beb 100644
--- a/pkgs/applications/audio/mp3info/default.nix
+++ b/pkgs/applications/audio/mp3info/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
'';
meta = {
- description = "MP3Info, an MP3 technical info viewer and ID3 1.x tag editor";
+ description = "MP3 technical info viewer and ID3 1.x tag editor";
longDescription =
'' MP3Info is a little utility used to read and modify the ID3 tags of
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
homepage = http://www.ibiblio.org/mp3info/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.unix;
diff --git a/pkgs/applications/audio/mp3splt/default.nix b/pkgs/applications/audio/mp3splt/default.nix
new file mode 100644
index 00000000000..b1970a998d5
--- /dev/null
+++ b/pkgs/applications/audio/mp3splt/default.nix
@@ -0,0 +1,20 @@
+{ fetchurl, stdenv, libmp3splt, pkgconfig }:
+
+stdenv.mkDerivation rec {
+ name = "mp3splt-2.6.1";
+
+ src = fetchurl {
+ url = "http://prdownloads.sourceforge.net/mp3splt/${name}.tar.gz";
+ sha256 = "783a903fafbcf47f06673136a78b78d32a8e616a6ae06b79b459a32090dd14f7";
+ };
+
+ buildInputs = [ libmp3splt pkgconfig ];
+
+ meta = {
+ description = "utility to split mp3, ogg vorbis and FLAC files without decoding";
+ homepage = http://sourceforge.net/projects/mp3splt/;
+ license = "GPLv2";
+ maintainers = [ stdenv.lib.maintainers.bosu ];
+ platforms = stdenv.lib.platforms.unix;
+ };
+}
diff --git a/pkgs/applications/audio/mpc/default.nix b/pkgs/applications/audio/mpc/default.nix
index ae6d9e0c7e6..9224e21185b 100755
--- a/pkgs/applications/audio/mpc/default.nix
+++ b/pkgs/applications/audio/mpc/default.nix
@@ -1,16 +1,16 @@
{ stdenv, fetchurl, mpd_clientlib }:
stdenv.mkDerivation rec {
- version = "0.25";
+ version = "0.26";
name = "mpc-${version}";
src = fetchurl {
url = "http://www.musicpd.org/download/mpc/0/${name}.tar.xz";
- sha256 = "095gmik5vrnab5a1g92qiznn48w7499fr0gldp3s6xd26kvs9kvh";
+ sha256 = "0hp2qv6w2v902dhrmck5hg32s1ai6xiv9n61a3n6prfcfdqmywr0";
};
-
- buildInputs = [ mpd_clientlib ];
-
+
+ buildInputs = [ mpd_clientlib ];
+
preConfigure =
''
export LIBMPDCLIENT_LIBS=${mpd_clientlib}/lib/libmpdclient.so.${mpd_clientlib.majorVersion}.0.${mpd_clientlib.minorVersion}
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
meta = {
description = "A minimalist command line interface to MPD";
homepage = http://www.musicpd.org/clients/mpc/;
- license = "GPL2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.algorith ];
platforms = stdenv.lib.platforms.linux;
};
diff --git a/pkgs/applications/audio/mpc123/default.nix b/pkgs/applications/audio/mpc123/default.nix
index 2f00638961c..ac945bee7f7 100644
--- a/pkgs/applications/audio/mpc123/default.nix
+++ b/pkgs/applications/audio/mpc123/default.nix
@@ -22,9 +22,9 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://mpc123.sourceforge.net/;
- description = "mpc123, a Musepack (.mpc) audio player";
+ description = "A Musepack (.mpc) audio player";
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ ];
platforms = stdenv.lib.platforms.gnu; # arbitrary choice
diff --git a/pkgs/applications/audio/mpg321/default.nix b/pkgs/applications/audio/mpg321/default.nix
index ffec1a5736c..939c9f79e4d 100644
--- a/pkgs/applications/audio/mpg321/default.nix
+++ b/pkgs/applications/audio/mpg321/default.nix
@@ -11,9 +11,9 @@ stdenv.mkDerivation rec {
buildInputs = [libao libid3tag libmad zlib];
meta = {
- description = "mpg321, a command-line MP3 player";
+ description = "Command-line MP3 player";
homepage = http://mpg321.sourceforge.net/;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
maintainers = [ ];
platforms = stdenv.lib.platforms.gnu;
};
diff --git a/pkgs/applications/audio/musescore/default.nix b/pkgs/applications/audio/musescore/default.nix
new file mode 100644
index 00000000000..a0bb8789658
--- /dev/null
+++ b/pkgs/applications/audio/musescore/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, makeWrapper, cmake, qt4, pkgconfig, alsaLib, portaudio, jack2, libsndfile}:
+
+stdenv.mkDerivation rec {
+ name = "musescore-1.3";
+
+ src = fetchurl {
+ url = "http://ftp.osuosl.org/pub/musescore/releases/MuseScore-1.3/mscore-1.3.tar.bz2";
+ sha256 = "a0b60cc892ac0266c58fc6392be72c0a21c3aa7fd0b6e4f1dddad1c8b36be683";
+ };
+
+ buildInputs = [ makeWrapper cmake qt4 pkgconfig alsaLib portaudio jack2 libsndfile ];
+
+ configurePhase = ''
+ cd mscore;
+ mkdir build;
+ cd build;
+ cmake -DCMAKE_INSTALL_PREFIX=$out -DQT_PLUGINS_DIR=$out/lib/qt4/plugins -DCMAKE_BUILD_TYPE=Release ..'';
+
+ preBuild = ''make lrelease;'';
+
+ postInstall = ''
+ wrapProgram $out/bin/mscore --prefix QT_PLUGIN_PATH : $out/lib/qt4/plugins
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Qt-based score editor";
+ homepage = http://musescore.org/;
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.vandenoever ];
+ repositories.git = https://github.com/musescore/MuseScore;
+ };
+}
diff --git a/pkgs/applications/audio/ncmpc/default.nix b/pkgs/applications/audio/ncmpc/default.nix
index 3b1b3154eda..b5f84f536d0 100755
--- a/pkgs/applications/audio/ncmpc/default.nix
+++ b/pkgs/applications/audio/ncmpc/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchurl, pkgconfig, glib, ncurses, mpd_clientlib, libintlOrEmpty }:
stdenv.mkDerivation rec {
- version = "0.21";
+ version = "0.24";
name = "ncmpc-${version}";
src = fetchurl {
- url = "http://www.musicpd.org/download/ncmpc/0/ncmpc-${version}.tar.bz2";
- sha256 = "648e846e305c867cb937dcb467393c2f5a30bf460bdf77b63de7af69fba1fd07";
+ url = "http://www.musicpd.org/download/ncmpc/0/ncmpc-${version}.tar.xz";
+ sha256 = "1sf3nirs3mcx0r5i7acm9bsvzqzlh730m0yjg6jcyj8ln6r7cvqf";
};
buildInputs = [ pkgconfig glib ncurses mpd_clientlib ]
@@ -14,6 +14,11 @@ stdenv.mkDerivation rec {
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lintl";
+ configureFlags = [
+ "--enable-colors"
+ "--enable-lyrics-screen"
+ ];
+
meta = with stdenv.lib; {
description = "Curses-based interface for MPD (music player daemon)";
homepage = http://www.musicpd.org/clients/ncmpc/;
diff --git a/pkgs/applications/audio/ncmpcpp/beta.nix b/pkgs/applications/audio/ncmpcpp/beta.nix
new file mode 100644
index 00000000000..7398d2ded82
--- /dev/null
+++ b/pkgs/applications/audio/ncmpcpp/beta.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, ncurses, curl, taglib, fftw, mpd_clientlib, pkgconfig
+, boost, readline, libiconvOrEmpty }:
+
+stdenv.mkDerivation rec {
+ version = "0.6_beta5";
+ name = "ncmpcpp-${version}";
+
+ src = fetchurl {
+ url = "http://ncmpcpp.rybczak.net/stable/ncmpcpp-${version}.tar.bz2";
+ sha256 = "05h4mahnh39y9ab333whsgspj5mnbdkqfssgfi4r0zf1fvjwlwj6";
+ };
+
+ buildInputs = [ ncurses curl taglib fftw mpd_clientlib pkgconfig boost readline ]
+ ++ libiconvOrEmpty;
+
+ configureFlags = [
+ "BOOST_LIB_SUFFIX="
+ ];
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Curses-based interface for MPD (music player daemon)";
+ homepage = http://unkart.ovh.org/ncmpcpp/;
+ license = licenses.gpl2Plus;
+ maintainers = with maintainers; [ fpletz ];
+ platforms = platforms.all;
+ };
+}
+
diff --git a/pkgs/applications/audio/opus-tools/default.nix b/pkgs/applications/audio/opus-tools/default.nix
index 791763ced36..fb32674d3b4 100644
--- a/pkgs/applications/audio/opus-tools/default.nix
+++ b/pkgs/applications/audio/opus-tools/default.nix
@@ -1,10 +1,10 @@
{stdenv, fetchurl, libogg, libao, pkgconfig, libopus, flac}:
stdenv.mkDerivation rec {
- name = "opus-tools-0.1.8";
+ name = "opus-tools-0.1.9";
src = fetchurl {
url = "http://downloads.xiph.org/releases/opus/${name}.tar.gz";
- sha256 = "1xm2lhdz92n9zmk496lyagisyzja46kx8q340vay9i51krbqiqg4";
+ sha256 = "0fk4nknvl111k89j5yckmyrh6b2wvgyhrqfncp7rig3zikbkv1xi";
};
buildInputs = [ libogg libao pkgconfig libopus flac ];
@@ -12,6 +12,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Tools to work with opus encoded audio streams";
homepage = http://www.opus-codec.org/;
- license = "BSD";
+ license = stdenv.lib.licenses.bsd2;
+ maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
};
}
diff --git a/pkgs/applications/audio/opusfile/default.nix b/pkgs/applications/audio/opusfile/default.nix
index 50df35b974f..314ecc95c3f 100644
--- a/pkgs/applications/audio/opusfile/default.nix
+++ b/pkgs/applications/audio/opusfile/default.nix
@@ -1,10 +1,10 @@
{stdenv, fetchurl, pkgconfig, openssl, libogg, libopus}:
stdenv.mkDerivation rec {
- name = "opusfile-0.4";
+ name = "opusfile-0.6";
src = fetchurl {
url = "http://downloads.xiph.org/releases/opus/${name}.tar.gz";
- sha256 = "0h4iwyqgid0cibqwzckz3r94qfp09099nk1cx5nz6i3cf08yldlq";
+ sha256 = "19iys2kld75k0210b807i4illrdmj3cmmnrgxlc9y4vf6mxp2a14";
};
buildInputs = [ pkgconfig openssl libogg libopus ];
@@ -12,6 +12,7 @@ stdenv.mkDerivation rec {
meta = {
description = "High-level API for decoding and seeking in .opus files";
homepage = http://www.opus-codec.org/;
- license = "BSD";
+ license = stdenv.lib.licenses.bsd3;
+ maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
};
}
diff --git a/pkgs/applications/audio/pamixer/default.nix b/pkgs/applications/audio/pamixer/default.nix
index acdda1799d0..769af20c0ed 100644
--- a/pkgs/applications/audio/pamixer/default.nix
+++ b/pkgs/applications/audio/pamixer/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
sha256 = "03r0sbfj85wp6yxa87pjg69ivmk0mxxa2nykr8gf2c607igmb034";
};
- buildInputs = [ pulseaudio boost ];
+ buildInputs = [ pulseaudio boost boost.lib ];
installPhase = ''
mkdir -p $out/bin
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
'';
meta = with stdenv.lib; {
- description = "pamixer is like amixer but for pulseaudio.";
+ description = "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
diff --git a/pkgs/applications/audio/paprefs/default.nix b/pkgs/applications/audio/paprefs/default.nix
new file mode 100644
index 00000000000..f05c4068a60
--- /dev/null
+++ b/pkgs/applications/audio/paprefs/default.nix
@@ -0,0 +1,33 @@
+{ fetchurl, stdenv, pkgconfig, pulseaudio, gtkmm, libglademm
+, dbus_glib, gconfmm, intltool }:
+
+stdenv.mkDerivation rec {
+ name = "paprefs-0.9.10";
+
+ src = fetchurl {
+ url = "http://freedesktop.org/software/pulseaudio/paprefs/${name}.tar.xz";
+ sha256 = "1c5b3sb881szavly220q31g7rvpn94wr7ywlk00hqb9zaikml716";
+ };
+
+ buildInputs = [ pulseaudio gtkmm libglademm dbus_glib gconfmm ];
+
+ nativeBuildInputs = [ pkgconfig intltool ];
+
+ configureFlags = [ "--disable-lynx" ];
+
+ meta = with stdenv.lib; {
+ description = "PulseAudio Preferences";
+
+ longDescription = ''
+ PulseAudio Preferences (paprefs) is a simple GTK based configuration
+ dialog for the PulseAudio sound server.
+ '';
+
+ homepage = http://freedesktop.org/software/pulseaudio/paprefs/ ;
+
+ license = licenses.gpl2Plus;
+
+ maintainers = [ maintainers.abbradar ];
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/pavucontrol/default.nix b/pkgs/applications/audio/pavucontrol/default.nix
index 02a27bedb67..538e1cdf9d0 100644
--- a/pkgs/applications/audio/pavucontrol/default.nix
+++ b/pkgs/applications/audio/pavucontrol/default.nix
@@ -1,5 +1,5 @@
-{ fetchurl, stdenv, pkgconfig, pulseaudio, gtkmm3
-, libcanberra_gtk3, intltool, gettext }:
+{ fetchurl, stdenv, pkgconfig, intltool, pulseaudio, gtkmm3
+, libcanberra_gtk3 }:
stdenv.mkDerivation rec {
name = "pavucontrol-2.0";
@@ -9,12 +9,13 @@ stdenv.mkDerivation rec {
sha256 = "02s775m1531sshwlbvfddk3pz8zjmwkv1sgzggn386ja3gc9vwi2";
};
- buildInputs = [ pkgconfig pulseaudio gtkmm3 libcanberra_gtk3
- intltool gettext ];
+ buildInputs = [ pulseaudio gtkmm3 libcanberra_gtk3 ];
- configureFlags = "--disable-lynx";
+ nativeBuildInputs = [ pkgconfig intltool ];
- meta = {
+ configureFlags = [ "--disable-lynx" ];
+
+ meta = with stdenv.lib; {
description = "PulseAudio Volume Control";
longDescription = ''
@@ -25,9 +26,9 @@ stdenv.mkDerivation rec {
homepage = http://freedesktop.org/software/pulseaudio/pavucontrol/ ;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
- maintainers = [ ];
- platforms = stdenv.lib.platforms.gnu; # arbitrary choice
+ maintainers = [ maintainers.abbradar ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/audio/petrifoo/default.nix b/pkgs/applications/audio/petrifoo/default.nix
index 2e53a22bff3..197a0aa1bbe 100644
--- a/pkgs/applications/audio/petrifoo/default.nix
+++ b/pkgs/applications/audio/petrifoo/default.nix
@@ -1,23 +1,21 @@
-{ stdenv, fetchgit, alsaLib, cmake, gtk, jackaudio, libgnomecanvas
+{ stdenv, fetchurl, alsaLib, cmake, gtk, jack2, libgnomecanvas
, libpthreadstubs, libsamplerate, libsndfile, libtool, libxml2
, pkgconfig }:
stdenv.mkDerivation rec {
- name = "petri-foo";
+ name = "petri-foo-${version}";
+ version = "0.1.87";
- src = fetchgit {
- url = https://github.com/licnep/Petri-Foo.git;
- rev = "eef3b6efebe842d2fa18ed32b881fea4562b84e0";
- sha256 = "a20c3f1a633500a65c099c528c7dc2405daa60738b64d881bb8f2036ae59913c";
+ src = fetchurl {
+ url = "mirror://sourceforge/petri-foo/${name}.tar.bz2";
+ sha256 = "0b25iicgn8c42487fdw32ycfrll1pm2zjgy5djvgw6mfcaa4gizh";
};
buildInputs =
- [ alsaLib cmake gtk jackaudio libgnomecanvas libpthreadstubs
+ [ alsaLib cmake gtk jack2 libgnomecanvas libpthreadstubs
libsamplerate libsndfile libtool libxml2 pkgconfig
];
- dontUseCmakeBuildDir=true;
-
meta = with stdenv.lib; {
description = "MIDI controllable audio sampler";
longDescription = "a fork of Specimen";
diff --git a/pkgs/applications/audio/pianobar/default.nix b/pkgs/applications/audio/pianobar/default.nix
index a9f4b02fa08..a91f25126c1 100644
--- a/pkgs/applications/audio/pianobar/default.nix
+++ b/pkgs/applications/audio/pianobar/default.nix
@@ -21,6 +21,6 @@ stdenv.mkDerivation rec {
description = "A console front-end for Pandora.com";
homepage = "http://6xq.net/projects/pianobar/";
platforms = stdenv.lib.platforms.linux;
- license = stdenv.lib.licenses.unfree;
+ license = stdenv.lib.licenses.mit; # expat version
};
}
diff --git a/pkgs/applications/audio/picard/default.nix b/pkgs/applications/audio/picard/default.nix
index 1ce09a6dd88..235a81a6a32 100644
--- a/pkgs/applications/audio/picard/default.nix
+++ b/pkgs/applications/audio/picard/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchurl, pythonPackages, gettext, pyqt4
-, pkgconfig, libdiscid, libofa, ffmpeg, acoustidFingerprinter
+, pkgconfig, libdiscid, libofa, ffmpeg, chromaprint
}:
pythonPackages.buildPythonPackage rec {
@@ -9,14 +9,16 @@ pythonPackages.buildPythonPackage rec {
src = fetchurl {
url = "http://ftp.musicbrainz.org/pub/musicbrainz/picard/${name}.tar.gz";
- md5 = "d1086687b7f7b0d359a731b1a25e7b66";
+ sha256 = "0sbsf8hzxhxcnnjqvsd6mc23lmk7w33nln0f3w72f89mjgs6pxm6";
};
postPatch = let
- fpr = "${acoustidFingerprinter}/bin/acoustid_fpcalc";
+ discid = "${libdiscid}/lib/libdiscid.so.0";
+ fpr = "${chromaprint}/bin/fpcalc";
in ''
- sed -ri -e 's|(TextOption.*"acoustid_fpcalc"[^"]*")[^"]*|\1${fpr}|' \
- picard/ui/options/fingerprinting.py
+ substituteInPlace picard/disc.py --replace libdiscid.so.0 ${discid}
+ substituteInPlace picard/const.py \
+ --replace "FPCALC_NAMES = [" "FPCALC_NAMES = ['${fpr}',"
'';
buildInputs = [
@@ -46,9 +48,11 @@ pythonPackages.buildPythonPackage rec {
doCheck = false;
- meta = {
+ meta = with stdenv.lib; {
homepage = "http://musicbrainz.org/doc/MusicBrainz_Picard";
description = "The official MusicBrainz tagger";
- license = stdenv.lib.licenses.gpl2;
+ maintainers = with maintainers; [ emery ];
+ license = licenses.gpl2;
+ platforms = platforms.all;
};
}
diff --git a/pkgs/applications/audio/praat/default.nix b/pkgs/applications/audio/praat/default.nix
index b8a283125fc..86c68d087b7 100644
--- a/pkgs/applications/audio/praat/default.nix
+++ b/pkgs/applications/audio/praat/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
'';
installPhase = ''
- ensureDir $out/bin
+ mkdir -p $out/bin
cp praat $out/bin
'';
@@ -22,7 +22,7 @@ stdenv.mkDerivation {
meta = {
description = "Doing phonetics by computer";
homepage = http://www.fon.hum.uva.nl/praat/;
- license = "GPLv2+"; # Has some 3rd-party code in it though
+ license = stdenv.lib.licenses.gpl2Plus; # Has some 3rd-party code in it though
platforms = stdenv.lib.platforms.linux;
};
}
diff --git a/pkgs/applications/audio/projectm/default.nix b/pkgs/applications/audio/projectm/default.nix
index 2dd251ddd5b..508b6743cc3 100644
--- a/pkgs/applications/audio/projectm/default.nix
+++ b/pkgs/applications/audio/projectm/default.nix
@@ -2,7 +2,7 @@
, glew, ftgl, ttf_bitstream_vera
, withQt ? true, qt4
, withLibvisual ? false, libvisual, SDL
-, withJack ? false, jackaudio
+, withJack ? false, jack2
, withPulseAudio ? true, pulseaudio
}:
@@ -45,7 +45,7 @@ stdenv.mkDerivation {
[ glew ftgl ]
++ optional withQt qt4
++ optionals withLibvisual [ libvisual SDL ]
- ++ optional withJack jackaudio
+ ++ optional withJack jack2
++ optional withPulseAudio pulseaudio
;
}
diff --git a/pkgs/applications/audio/puredata/default.nix b/pkgs/applications/audio/puredata/default.nix
index d0394b72edd..9abca0cb014 100644
--- a/pkgs/applications/audio/puredata/default.nix
+++ b/pkgs/applications/audio/puredata/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchurl, autoreconfHook, gettext, makeWrapper
-, alsaLib, jackaudio, tk
+, alsaLib, jack2, tk
}:
stdenv.mkDerivation rec {
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ autoreconfHook gettext makeWrapper ];
- buildInputs = [ alsaLib jackaudio ];
+ buildInputs = [ alsaLib jack2 ];
configureFlags = ''
--enable-alsa
diff --git a/pkgs/applications/audio/qjackctl/default.nix b/pkgs/applications/audio/qjackctl/default.nix
index dcb2a1b48e6..9b87dd53bf6 100644
--- a/pkgs/applications/audio/qjackctl/default.nix
+++ b/pkgs/applications/audio/qjackctl/default.nix
@@ -1,17 +1,17 @@
-{ stdenv, fetchurl, qt4, alsaLib, jackaudio, dbus }:
+{ stdenv, fetchurl, qt4, alsaLib, jack2, dbus }:
stdenv.mkDerivation rec {
- version = "0.3.10";
+ version = "0.3.12";
name = "qjackctl-${version}";
# some dependencies such as killall have to be installed additionally
src = fetchurl {
url = "mirror://sourceforge/qjackctl/${name}.tar.gz";
- sha256 = "0ch14y3p0x5ss28cpnqcxp42zb2w07d3l1n2sbrkgiz58iy97paw";
+ sha256 = "14yvnc4k3hwsjflg8b2d04bc63pdl0gyqjc7vl6rdn29nbr23zwc";
};
- buildInputs = [ qt4 alsaLib jackaudio dbus ];
+ buildInputs = [ qt4 alsaLib jack2 dbus ];
configureFlags = "--enable-jack-version";
diff --git a/pkgs/applications/audio/qsynth/default.nix b/pkgs/applications/audio/qsynth/default.nix
index 05e6da223da..a5d0e7e621e 100644
--- a/pkgs/applications/audio/qsynth/default.nix
+++ b/pkgs/applications/audio/qsynth/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, fluidsynth, jackaudio, qt4 }:
+{ stdenv, fetchurl, alsaLib, fluidsynth, jack2, qt4 }:
stdenv.mkDerivation rec {
name = "qsynth-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "0wmq61cq93x2l00xwr871373mj3dwamz1dg6v62x7s8m1612ndrw";
};
- buildInputs = [ alsaLib fluidsynth jackaudio qt4 ];
+ buildInputs = [ alsaLib fluidsynth jack2 qt4 ];
meta = with stdenv.lib; {
description = "Fluidsynth GUI";
diff --git a/pkgs/applications/audio/qtractor/default.nix b/pkgs/applications/audio/qtractor/default.nix
index a15cf255040..561a72bb38b 100644
--- a/pkgs/applications/audio/qtractor/default.nix
+++ b/pkgs/applications/audio/qtractor/default.nix
@@ -1,18 +1,18 @@
-{ alsaLib, autoconf, automake, dssi, fetchurl, gtk, jackaudio
+{ alsaLib, autoconf, automake, dssi, fetchurl, gtk, jack2
, ladspaH, ladspaPlugins, liblo, libmad, libsamplerate, libsndfile
, libtool, libvorbis, pkgconfig, qt4, rubberband, stdenv }:
stdenv.mkDerivation rec {
- version = "0.6.1";
+ version = "0.6.3";
name = "qtractor-${version}";
src = fetchurl {
url = "mirror://sourceforge/qtractor/${name}.tar.gz";
- sha256 = "09lyz1pn2dadr1ii2msyv3n13kq3mbgpcwcyfm0brm01c2fnh6wc";
+ sha256 = "1lsmd83vhgfzb3bf02hi6xp5ryh08lz4h21agy7wm3acjqc6gsc2";
};
buildInputs =
- [ alsaLib autoconf automake dssi gtk jackaudio ladspaH
+ [ alsaLib autoconf automake dssi gtk jack2 ladspaH
ladspaPlugins liblo libmad libsamplerate libsndfile libtool
libvorbis pkgconfig qt4 rubberband
];
diff --git a/pkgs/applications/audio/rakarrack/default.nix b/pkgs/applications/audio/rakarrack/default.nix
index ba84fe5eaec..257a9967a5b 100644
--- a/pkgs/applications/audio/rakarrack/default.nix
+++ b/pkgs/applications/audio/rakarrack/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, alsaUtils, fltk, jackaudio, libXft,
+{ stdenv, fetchurl, alsaLib, alsaUtils, fltk, jack2, libXft,
libXpm, libjpeg, libpng, libsamplerate, libsndfile, zlib }:
stdenv.mkDerivation rec {
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
patches = [ ./fltk-path.patch ];
- buildInputs = [ alsaLib alsaUtils fltk jackaudio libXft libXpm libjpeg
+ buildInputs = [ alsaLib alsaUtils fltk jack2 libXft libXpm libjpeg
libpng libsamplerate libsndfile zlib ];
meta = with stdenv.lib; {
diff --git a/pkgs/applications/audio/samplv1/default.nix b/pkgs/applications/audio/samplv1/default.nix
index c201536ed34..c89f23f8a28 100644
--- a/pkgs/applications/audio/samplv1/default.nix
+++ b/pkgs/applications/audio/samplv1/default.nix
@@ -1,15 +1,15 @@
-{ stdenv, fetchurl, jackaudio, libsndfile, lv2, qt4 }:
+{ stdenv, fetchurl, jack2, libsndfile, lv2, qt4 }:
stdenv.mkDerivation rec {
name = "samplv1-${version}";
- version = "0.4.2";
+ version = "0.5.1";
src = fetchurl {
url = "mirror://sourceforge/samplv1/${name}.tar.gz";
- sha256 = "1vr6jbqnsgdq3v2h1ndp4pirnil3119dqwlq0k0kdscmcskvb9j4";
+ sha256 = "155qq7gxyqn7sh8bbyhjk40lxl157lb2h539j4gqgv5jphz8g6wy";
};
- buildInputs = [ jackaudio libsndfile lv2 qt4 ];
+ buildInputs = [ jack2 libsndfile lv2 qt4 ];
meta = with stdenv.lib; {
description = "An old-school all-digital polyphonic sampler synthesizer with stereo fx";
diff --git a/pkgs/applications/audio/seq24/default.nix b/pkgs/applications/audio/seq24/default.nix
index 9f168f54eaf..10376e02f43 100644
--- a/pkgs/applications/audio/seq24/default.nix
+++ b/pkgs/applications/audio/seq24/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, gtkmm, jackaudio, pkgconfig }:
+{ stdenv, fetchurl, alsaLib, gtkmm, jack2, pkgconfig }:
stdenv.mkDerivation rec {
name = "seq24-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "07n80zj95i80vjmsflnlbqx5vv90qmp5f6a0zap8d30849l4y258";
};
- buildInputs = [ alsaLib gtkmm jackaudio pkgconfig ];
+ buildInputs = [ alsaLib gtkmm jack2 pkgconfig ];
meta = with stdenv.lib; {
description = "minimal loop based midi sequencer";
diff --git a/pkgs/applications/audio/setbfree/default.nix b/pkgs/applications/audio/setbfree/default.nix
index 0d5b6929753..5119c384cf6 100644
--- a/pkgs/applications/audio/setbfree/default.nix
+++ b/pkgs/applications/audio/setbfree/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, freetype, ftgl, jackaudio, libX11, lv2
+{ stdenv, fetchurl, alsaLib, freetype, ftgl, jack2, libX11, lv2
, mesa, pkgconfig, ttf_bitstream_vera
}:
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
'';
buildInputs = [
- alsaLib freetype ftgl jackaudio libX11 lv2 mesa pkgconfig
+ alsaLib freetype ftgl jack2 libX11 lv2 mesa pkgconfig
ttf_bitstream_vera
];
diff --git a/pkgs/applications/audio/snd/default.nix b/pkgs/applications/audio/snd/default.nix
index 52cd2ad35ce..1b878deb316 100644
--- a/pkgs/applications/audio/snd/default.nix
+++ b/pkgs/applications/audio/snd/default.nix
@@ -4,17 +4,11 @@
}:
stdenv.mkDerivation rec {
- name = "snd-14.3";
-
- meta = {
- description = "Sound editor";
- homepage = http://ccrma.stanford.edu/software/snd;
- platforms = stdenv.lib.platforms.linux;
- };
+ name = "snd-15.0";
src = fetchurl {
url = "mirror://sourceforge/snd/${name}.tar.gz";
- sha256 = "04shk34pza507kvm40dc6sdz5jz533z4q2h7m9hgqvw1r3f57ms6";
+ sha256 = "1s1mswgxhvi0wjw0qscwh2jajihvgz86xffgbwl7qjkymqbh8gyj";
};
nativeBuildInputs = [ pkgconfig ];
@@ -23,4 +17,14 @@ stdenv.mkDerivation rec {
gtk2 alsaLib
fftw gsl
];
+
+ meta = {
+ description = "Sound editor";
+ homepage = http://ccrma.stanford.edu/software/snd;
+ platforms = stdenv.lib.platforms.linux;
+ license = stdenv.lib.licenses.free;
+ maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+ };
+
+
}
diff --git a/pkgs/applications/audio/sonic-visualiser/default.nix b/pkgs/applications/audio/sonic-visualiser/default.nix
index 7704397e6d0..42c39062042 100644
--- a/pkgs/applications/audio/sonic-visualiser/default.nix
+++ b/pkgs/applications/audio/sonic-visualiser/default.nix
@@ -1,6 +1,6 @@
# TODO add plugins having various licenses, see http://www.vamp-plugins.org/download.html
-{ stdenv, fetchurl, alsaLib, bzip2, fftw, jackaudio, libX11, liblo
+{ stdenv, fetchurl, alsaLib, bzip2, fftw, jack2, libX11, liblo
, libmad, libogg, librdf, librdf_raptor, librdf_rasqal, libsamplerate
, libsndfile, pkgconfig, pulseaudio, qt5, redland
, rubberband, serd, sord, vampSDK
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
sord
pkgconfig
# optional
- jackaudio
+ jack2
# portaudio
pulseaudio
libmad
diff --git a/pkgs/applications/audio/spotify/default.nix b/pkgs/applications/audio/spotify/default.nix
index 59bea8fc194..47919a7d7f8 100644
--- a/pkgs/applications/audio/spotify/default.nix
+++ b/pkgs/applications/audio/spotify/default.nix
@@ -8,14 +8,14 @@ assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
let
version = if stdenv.system == "i686-linux"
then "0.9.4.183.g644e24e.428"
- else "0.9.10.17.g4129e1c.78";
+ else "0.9.11.27.g2b1a638.81";
qt4webkit =
if stdenv.system == "i686-linux" then
fetchurl {
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";
+ sha256 = "0q4abhczx91ma57fjss0gn8j6nkfbfsbsh6kxhykzj88dih2s8rn";
}
else
fetchurl {
@@ -73,7 +73,7 @@ stdenv.mkDerivation {
else if stdenv.system == "x86_64-linux" then
fetchurl {
url = "http://repository.spotify.com/pool/non-free/s/spotify/spotify-client_${version}-1_amd64.deb";
- sha256 = "1a4vn2ij3nghnc0fq3nsyb95gwhaw4zabdq6jd52hxz8iv31pn1z";
+ sha256 = "0yfljiw01kssj3qaz8m0ppgrpjs6xrhzlr2wccp64bsnmin7g4sg";
}
else throw "Spotify not supported on this platform.";
@@ -148,8 +148,8 @@ stdenv.mkDerivation {
meta = {
homepage = https://www.spotify.com/;
- description = "Spotify for Linux allows you to play music from the Spotify music service";
- license = "unfree";
+ description = "Play music from the Spotify music service";
+ license = stdenv.lib.licenses.unfree;
maintainers = [ stdenv.lib.maintainers.eelco ];
};
}
diff --git a/pkgs/applications/audio/synthv1/default.nix b/pkgs/applications/audio/synthv1/default.nix
index d1c2230cf16..fd9d5e69f48 100644
--- a/pkgs/applications/audio/synthv1/default.nix
+++ b/pkgs/applications/audio/synthv1/default.nix
@@ -1,15 +1,15 @@
-{ stdenv, fetchurl, qt4, jackaudio, lv2 }:
+{ stdenv, fetchurl, qt4, jack2, lv2 }:
stdenv.mkDerivation rec {
name = "synthv1-${version}";
- version = "0.4.2";
+ version = "0.5.1";
src = fetchurl {
url = "mirror://sourceforge/synthv1/${name}.tar.gz";
- sha256 = "1r4fszbzwd0yfcch0mcsmh7781zw1317hiljn85w79721fs2m8hc";
+ sha256 = "16wcxrcjwp0qp2xgahhzvcs2k31sr6c9jsxyhivj4famj7a39pfw";
};
- buildInputs = [ qt4 jackaudio lv2 ];
+ buildInputs = [ qt4 jack2 lv2 ];
meta = with stdenv.lib; {
description = "An old-school 4-oscillator subtractive polyphonic synthesizer with stereo fx";
diff --git a/pkgs/applications/audio/transcode/default.nix b/pkgs/applications/audio/transcode/default.nix
new file mode 100644
index 00000000000..c414992a12d
--- /dev/null
+++ b/pkgs/applications/audio/transcode/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, flac, lame, zlib, libjpeg, libvorbis, libtheora, libxml2
+, lzo, libdvdread, pkgconfig, x264, libmpeg2, xvidcore }:
+
+stdenv.mkDerivation rec {
+ name = "transcode-1.1.7";
+ src = fetchurl {
+ url = "https://bitbucket.org/france/transcode-tcforge/downloads/${name}.tar.bz2";
+ sha256 = "1e4e72d8e0dd62a80b8dd90699f5ca64c9b0cb37a5c9325c184166a9654f0a92";
+ };
+
+ buildInputs = [ flac lame zlib libjpeg libvorbis libtheora libxml2 lzo
+ libdvdread pkgconfig x264 libmpeg2 xvidcore ];
+ configureFlags = "--disable-ffmpeg --disable-libavcodec --disable-libavformat
+ --enable-lzo --enable-ogg --enable-vorbis --enable-theora --enable-libxml2
+ --enable-x264 --enable-libmpeg2 --enable-xvid";
+
+ enableParallelBuilding = true;
+
+ meta = with stdenv.lib; {
+ description = "Suite of command line utilities for transcoding video and audio codecs, and for converting beween different container formats";
+ homepage = http://www.transcoding.org/;
+ license = licenses.lgpl2Plus;
+ platforms = platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/vimpc/default.nix b/pkgs/applications/audio/vimpc/default.nix
new file mode 100755
index 00000000000..3e365cae8e9
--- /dev/null
+++ b/pkgs/applications/audio/vimpc/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, autoconf, automake, mpd_clientlib, ncurses, pcre, pkgconfig, taglib }:
+
+stdenv.mkDerivation rec {
+ version = "0.09.0";
+ name = "vimpc-${version}";
+
+ src = fetchurl {
+ url = "https://github.com/boysetsfrog/vimpc/archive/v${version}.tar.gz";
+ sha256 = "13eb229a5e9eee491765ee89f7fe6a38140a41a01434b117da3869d725c15706";
+ };
+
+ buildInputs = [ autoconf
+ automake
+ mpd_clientlib
+ ncurses
+ pcre
+ pkgconfig
+ taglib
+ ];
+
+ preConfigure = "./autogen.sh";
+
+ postInstall = ''
+ mkdir -p $out/etc
+ cp doc/vimpcrc.example $out/etc
+ '';
+
+ meta = {
+ description = "A vi/vim inspired client for the Music Player Daemon (mpd).";
+ homepage = https://github.com/boysetsfrog/vimpc;
+ license = "GPL3";
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/audio/vmpk/default.nix b/pkgs/applications/audio/vmpk/default.nix
index 7fffa77b5a3..9a75fa5f383 100644
--- a/pkgs/applications/audio/vmpk/default.nix
+++ b/pkgs/applications/audio/vmpk/default.nix
@@ -1,5 +1,5 @@
{ stdenv, fetchurl, cmake, pkgconfig
-, qt4, jackaudio
+, qt4, jack2
}:
let
@@ -22,5 +22,5 @@ in stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake pkgconfig ];
- buildInputs = [ qt4 jackaudio ];
+ buildInputs = [ qt4 jack2 ];
}
diff --git a/pkgs/applications/audio/vorbis-tools/default.nix b/pkgs/applications/audio/vorbis-tools/default.nix
index 5db7cc30cf8..e4e5b7ff81a 100644
--- a/pkgs/applications/audio/vorbis-tools/default.nix
+++ b/pkgs/applications/audio/vorbis-tools/default.nix
@@ -16,6 +16,6 @@ stdenv.mkDerivation {
files, notably the `ogg123' player and the `oggenc' encoder.
'';
homepage = http://xiph.org/vorbis/;
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/applications/audio/xsynth-dssi/default.nix b/pkgs/applications/audio/xsynth-dssi/default.nix
index 0cfbfb4c9bd..85e7235400b 100644
--- a/pkgs/applications/audio/xsynth-dssi/default.nix
+++ b/pkgs/applications/audio/xsynth-dssi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, alsaLib, autoconf, automake, dssi, gtk, jackaudio,
+{ stdenv, fetchurl, alsaLib, autoconf, automake, dssi, gtk, jack2,
ladspaH, ladspaPlugins, liblo, pkgconfig }:
stdenv.mkDerivation rec {
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
sha256 = "00nwv2pqjbmxqdc6xdm0cljq6z05lv4y6bibmhz1kih9lm0lklnk";
};
- buildInputs = [ alsaLib autoconf automake dssi gtk jackaudio ladspaH
+ buildInputs = [ alsaLib autoconf automake dssi gtk jack2 ladspaH
ladspaPlugins liblo pkgconfig ];
installPhase = ''
diff --git a/pkgs/applications/audio/yoshimi/default.nix b/pkgs/applications/audio/yoshimi/default.nix
index df0b98cdd9e..ec168486f6d 100644
--- a/pkgs/applications/audio/yoshimi/default.nix
+++ b/pkgs/applications/audio/yoshimi/default.nix
@@ -1,21 +1,21 @@
{ stdenv, fetchurl, alsaLib, boost, cairo, cmake, fftwSinglePrec, fltk
-, jackaudio, libsndfile, mesa, minixml, pkgconfig, zlib
+, jack2, libsndfile, mesa, minixml, pkgconfig, zlib, xorg
}:
assert stdenv ? glibc;
stdenv.mkDerivation rec {
name = "yoshimi-${version}";
- version = "1.2.0";
+ version = "1.2.4";
src = fetchurl {
url = "mirror://sourceforge/yoshimi/${name}.tar.bz2";
- sha256 = "0p4v39kxxzzfvaazzxarx54i164ghpfxq0ljkavlgr8fnix5v3mx";
+ sha256 = "0wz2bc0x0h989schwzqjj6sx9hvzxkw4jrkflwhyrzjini1pvkxz";
};
buildInputs = [
- alsaLib boost cairo fftwSinglePrec fltk jackaudio libsndfile mesa
- minixml zlib
+ alsaLib boost boost.lib cairo fftwSinglePrec fltk jack2 libsndfile mesa
+ minixml zlib xorg.libpthreadstubs
];
nativeBuildInputs = [ cmake pkgconfig ];
diff --git a/pkgs/applications/audio/zynaddsubfx/default.nix b/pkgs/applications/audio/zynaddsubfx/default.nix
index cd30b5b3084..3a89b406742 100644
--- a/pkgs/applications/audio/zynaddsubfx/default.nix
+++ b/pkgs/applications/audio/zynaddsubfx/default.nix
@@ -1,17 +1,17 @@
-{ stdenv, fetchurl, alsaLib, cmake, jackaudio, fftw, fltk13, minixml
-, pkgconfig, zlib
+{ stdenv, fetchurl, alsaLib, cmake, jack2, fftw, fltk13, libjpeg
+, minixml, pkgconfig, zlib
}:
stdenv.mkDerivation rec {
name = "zynaddsubfx-${version}";
- version = "2.4.3";
+ version = "2.4.4";
src = fetchurl {
- url = "mirror://sourceforge/zynaddsubfx/ZynAddSubFX-${version}.tar.bz2";
- sha256 = "0kgmwyh4rhyqdfrdzhbzjjk2hzggkp9c4aac6sy3xv6cc1b5jjxq";
+ url = "mirror://sourceforge/zynaddsubfx/zynaddsubfx-${version}.tar.xz";
+ sha256 = "15byz08p5maf3v8l1zz11xan6s0qcfasjf1b81xc8rffh13x5f53";
};
- buildInputs = [ alsaLib jackaudio fftw fltk13 minixml zlib ];
+ buildInputs = [ alsaLib jack2 fftw fltk13 libjpeg minixml zlib ];
nativeBuildInputs = [ cmake pkgconfig ];
meta = with stdenv.lib; {
diff --git a/pkgs/applications/display-managers/slim/default.nix b/pkgs/applications/display-managers/slim/default.nix
index 26500939db8..42d2c777aea 100644
--- a/pkgs/applications/display-managers/slim/default.nix
+++ b/pkgs/applications/display-managers/slim/default.nix
@@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
cmakeFlags = [ "-DUSE_PAM=1" ];
+ NIX_CFLAGS_COMPILE = "-I${freetype}/include/freetype";
+
enableParallelBuilding = true;
buildInputs =
diff --git a/pkgs/applications/display-managers/slim/themes.nix b/pkgs/applications/display-managers/slim/themes.nix
new file mode 100644
index 00000000000..6bcacf8baf4
--- /dev/null
+++ b/pkgs/applications/display-managers/slim/themes.nix
@@ -0,0 +1,183 @@
+{ stdenv, fetchurl, slim }:
+
+# Inspired on aspell buildDict expression
+
+let
+ buildTheme =
+ {fullName, src, version ? "testing"}:
+
+ stdenv. mkDerivation rec {
+ name = "${fullName}-${version}";
+
+ inherit src;
+
+ buildInputs = [ slim ];
+
+ dontBuild = true;
+
+ installPhase = ''
+ install -dm755 $out/share/slim/themes/${name}
+ install -m644 * $out/share/slim/themes/${name}
+ '';
+
+ meta = {
+ description = "Slim theme for ${fullName}";
+ platforms = stdenv.lib.platforms.linux;
+ };
+ };
+
+in {
+
+ archlinuxSimple = buildTheme {
+ fullName = "archlinux-simple";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-archlinux-simple.tar.gz";
+ sha256 = "7d60d6782fa86302646fe67253467c04692d247f89bdbe87178f690f32b270db";
+ };
+ };
+
+ capernoited = buildTheme {
+ fullName = "capernoited";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-capernoited.tar.gz";
+ sha256 = "fb9163c6a2656d60f088dc4f2173aa7556a6794495122acfa7d3be7182f16b41";
+ };
+ };
+
+ debianMoreblue = buildTheme {
+ fullName = "debian-moreblue";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-debian-moreblue.tar.bz2";
+ sha256 = "5b76929827d4a4d604ddca4f42668cca3309b6f7bd659901021c6f49d6d2c481";
+ };
+ };
+
+ fingerprint = buildTheme {
+ fullName = "fingerprint";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-fingerprint.tar.gz";
+ sha256 = "48b703f84ce7b814cda0824f65cafebf695cd71a14166b481bb44616097d3144";
+ };
+ };
+
+ flat = buildTheme {
+ fullName = "flat";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-flat.tar.gz";
+ sha256 = "0092d531540f9da8ef07ad173e527c4ef9c088d04962d142be3c11f0c5c0c5e9";
+ };
+ };
+
+ flower2 = buildTheme {
+ fullName = "flower2";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-flower2.tar.gz";
+ sha256 = "840faf6459ffd6c2c363160c85cb98000717f9a425102976336f5d8f68ed95ee";
+ };
+ };
+
+ gentooSimple = buildTheme {
+ fullName = "gentoo-simple";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-gentoo-simple.tar.bz2";
+ sha256 = "27c8614cc930ca200acf81f1192febc102501744939d5cbe997141e37c96d8c2";
+ };
+ };
+
+ lake = buildTheme {
+ fullName = "lake";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-lake.tar.gz";
+ sha256 = "f7d662e37068a6c64cbf910adf3c192f1b50724baa427a8c9487cb9f7ed95851";
+ };
+ };
+
+ lunar = buildTheme {
+ fullName = "lunar-0.4";
+ version = "";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-lunar-0.4.tar.bz2";
+ sha256 = "1543eb45e4d664377e0dd4f7f954aba005823034ba9692624398b3d58be87d76";
+ };
+ };
+
+ mindlock = buildTheme {
+ fullName = "mindlock";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-mindlock.tar.gz";
+ sha256 = "99a6e6acd55bf55ece18a3f644299517b71c1adc49efd87ce2d7e654fb67033c";
+ };
+ };
+
+ parallelDimensions = buildTheme {
+ fullName = "parallel-dimensions";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-parallel-dimensions.tar.gz";
+ sha256 = "2b17c3e6d3967a6a0744e20e6e05c9d3938f4ef04c62d49ddbd416bc4743046f";
+ };
+ };
+
+ previous = buildTheme {
+ fullName = "previous";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-previous.tar.gz";
+ sha256 = "1f2a69f8fc0dc8ed8eb86a4c1d1087ba7be486973fb81efab52a63c661d726f8";
+ };
+ };
+
+ rainbow = buildTheme {
+ fullName = "rainbow";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-rainbow.tar.gz";
+ sha256 = "d83e3afdb05be50cff7da037bb31208b2c152539d1a009740b13857f5f910072";
+ };
+ };
+
+ rear-window = buildTheme {
+ fullName = "rear-window";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-rear-window.tar.gz";
+ sha256 = "0b123706ccb67e94f626c183530ec5732b209bab155bc661d6a3f5cd5ee39511";
+ };
+ };
+
+ scotlandRoad = buildTheme {
+ fullName = "scotland-road";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-scotland-road.tar.gz";
+ sha256 = "fd60a434496ed39b968ffa1e5457b36cd12f64a4e2ecedffc675f97ca3f3bba1";
+ };
+ };
+
+ subway = buildTheme {
+ fullName = "subway";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-subway.tar.gz";
+ sha256 = "0205568e3e157973b113a83b26d8829ce9962a85ef7eb8a33d3ae2f3f9292253";
+ };
+ };
+
+ wave = buildTheme {
+ fullName = "wave";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-wave.tar.gz";
+ sha256 = "be75676da5bf8670daa48379bb9cc1be0b9a5faa09adbea967dfd7125320b959";
+ };
+ };
+
+ zenwalk = buildTheme {
+ fullName = "zenwalk";
+ src = fetchurl {
+ url = "mirror://sourceforge/slim.berlios/slim-zenwalk.tar.gz";
+ sha256 = "f0f41d17ea505b0aa96a036e978fabaf673a51d3f81a919cb0d43364d4bc7a57";
+ };
+ };
+
+ nixosSlim = buildTheme {
+ fullName = "nixos-slim";
+ src = fetchurl {
+ url = "https://github.com/jagajaga/nixos-slim-theme/archive/1.1.tar.gz";
+ sha256 = "0cawq38l8rcgd35vpdx3i1wbs3wrkcrng1c9qch0l4qncw505hv6";
+ };
+ };
+}
diff --git a/pkgs/applications/editors/atom/default.nix b/pkgs/applications/editors/atom/default.nix
index 725b4520e69..2fa28f5e591 100644
--- a/pkgs/applications/editors/atom/default.nix
+++ b/pkgs/applications/editors/atom/default.nix
@@ -1,6 +1,6 @@
{ stdenv, fetchurl, buildEnv, makeDesktopItem, makeWrapper, zlib, glib, alsaLib
, dbus, gtk, atk, pango, freetype, fontconfig, libgnome_keyring3, gdk_pixbuf
-, cairo, cups, expat, libgpgerror, nspr, gconf, nss, xlibs
+, cairo, cups, expat, libgpgerror, nspr, gconf, nss, xlibs, libcap
}:
let
@@ -10,52 +10,35 @@ let
stdenv.gcc.gcc zlib glib dbus gtk atk pango freetype libgnome_keyring3
fontconfig gdk_pixbuf cairo cups expat libgpgerror alsaLib nspr gconf nss
xlibs.libXrender xlibs.libX11 xlibs.libXext xlibs.libXdamage xlibs.libXtst
- xlibs.libXcomposite xlibs.libXi xlibs.libXfixes
+ xlibs.libXcomposite xlibs.libXi xlibs.libXfixes xlibs.libXrandr
+ xlibs.libXcursor libcap
];
};
in stdenv.mkDerivation rec {
name = "atom-${version}";
- version = "0.99.0";
+ version = "0.139.0";
src = fetchurl {
- url = https://github.com/hotice/webupd8/raw/master/atom-linux64-0.99.0~git20140525.tar.xz;
- sha256 = "55c2415c96e1182ae1517751cbea1db64e9962683b384cfe5e182aec10aebecd";
- name = "${name}.tar.xz";
- };
-
- iconsrc = fetchurl {
- url = https://raw.githubusercontent.com/atom/atom/master/resources/atom.png;
- sha256 = "66dc0b432eed7bcd738b7c1b194e539178a83d427c78f103041981f2b840e030";
- };
-
- desktopItem = makeDesktopItem {
- name = "atom";
- exec = "atom";
- icon = iconsrc;
- comment = "A hackable text editor for the 21st Century";
- desktopName = "Atom";
- genericName = "Text editor";
- categories = "Development;TextEditor";
+ url = "https://github.com/atom/atom/releases/download/v${version}/atom-amd64.deb";
+ sha256 = "0732s4r9qx0sgsnz415z5r9685scly2084q80kz2xw0d2gfx04xr";
+ name = "${name}.deb";
};
buildInputs = [ atomEnv makeWrapper ];
- phases = [ "installPhase" ];
+ phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
- ensureDir $out/share/atom
- ensureDir $out/bin
- tar -C $out/share/atom -xvf $src
+ mkdir -p $out
+ ar p $src data.tar.gz | tar -C $out -xz ./usr
+ mv $out/usr/* $out/
+ rm -r $out/usr/
patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
$out/share/atom/atom
patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
$out/share/atom/resources/app/apm/node_modules/atom-package-manager/bin/node
- makeWrapper $out/share/atom/atom $out/bin/atom \
+ wrapProgram $out/bin/atom \
--prefix "LD_LIBRARY_PATH" : "${atomEnv}/lib:${atomEnv}/lib64"
-
- # Create a desktop item.
- mkdir -p "$out/share/applications"
- cp "${desktopItem}"/share/applications/* "$out/share/applications/"
'';
meta = with stdenv.lib; {
diff --git a/pkgs/applications/editors/bvi/default.nix b/pkgs/applications/editors/bvi/default.nix
index 84b810bf460..f3f44f769a9 100644
--- a/pkgs/applications/editors/bvi/default.nix
+++ b/pkgs/applications/editors/bvi/default.nix
@@ -1,18 +1,21 @@
{ stdenv, fetchurl, ncurses }:
-stdenv.mkDerivation {
- name = "bvi-1.3.2";
+stdenv.mkDerivation rec {
+ name = "bvi-${version}";
+ version = "1.4.0";
src = fetchurl {
- url = mirror://sourceforge/bvi/bvi-1.3.2.src.tar.gz;
- sha256 = "110wxqnyianqamxq4y53drqqxb9vp4k2fcvic45qggvlqkqhlfgz";
+ url = "mirror://sourceforge/bvi/${name}.src.tar.gz";
+ sha256 = "00pq9rv7s8inqxq2m3xshxi58691i3pxw9smibcrgh6768l3qnh1";
};
buildInputs = [ ncurses ];
- meta = {
+ meta = with stdenv.lib; {
description = "Hex editor with vim style keybindings";
homepage = http://bvi.sourceforge.net/download.html;
- license = "GPL2";
+ license = licenses.gpl2;
+ maintainers = with maintainers; [ pSub ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/editors/dhex/default.nix b/pkgs/applications/editors/dhex/default.nix
index 45b7de900e2..7a0e9e59d7e 100644
--- a/pkgs/applications/editors/dhex/default.nix
+++ b/pkgs/applications/editors/dhex/default.nix
@@ -12,9 +12,9 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses ];
installPhase = ''
- ensureDir $out/bin
- ensureDir $out/share/man/man1
- ensureDir $out/share/man/man5
+ mkdir -p $out/bin
+ mkdir -p $out/share/man/man1
+ mkdir -p $out/share/man/man5
cp dhex $out/bin
cp dhex.1 $out/share/man/man1
diff --git a/pkgs/applications/editors/eclipse/default.nix b/pkgs/applications/editors/eclipse/default.nix
index 24ba2461027..6073dc42c69 100644
--- a/pkgs/applications/editors/eclipse/default.nix
+++ b/pkgs/applications/editors/eclipse/default.nix
@@ -191,6 +191,23 @@ in {
sha256 = "0d6jlj7hwz8blx6csrlyi2h2prql0wckbh7ihwjmgclwpcpj84g6";
};
};
+
+ eclipse_cpp_44 = buildEclipse {
+ name = "eclipse-cpp-4.4";
+ 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/luna/R/eclipse-cpp-luna-R-linux-gtk-x86_64.tar.gz;
+ md5 = "b0a6ee33e8108a7ff4682ab911271b04";
+ }
+ else
+ fetchurl {
+ url = http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/technology/epp/downloads/release/luna/R/eclipse-cpp-luna-R-linux-gtk.tar.gz;
+ md5 = "5000f93cecf6ef9af112f0df6e8c87f3";
+ };
+ };
+
eclipse_sdk_421 = buildEclipse {
name = "eclipse-sdk-4.2.1";
@@ -238,4 +255,19 @@ in {
};
};
+ eclipse_sdk_44 = buildEclipse {
+ name = "eclipse-sdk-4.4";
+ description = "Eclipse Classic";
+ sources = {
+ "x86_64-linux" = fetchurl {
+ url = http://download.eclipse.org/eclipse/downloads/drops4/R-4.4-201406061215/eclipse-SDK-4.4-linux-gtk-x86_64.tar.gz;
+ sha256 = "14hdkijsjq0hhzi9ijpwjjkhz7wm0pry86l3dniy5snlh3l5bsb2";
+ };
+ "i686-linux" = fetchurl {
+ url = http://download.eclipse.org/eclipse/downloads/drops4/R-4.4-201406061215/eclipse-SDK-4.4-linux-gtk.tar.gz;
+ sha256 = "0hjc4zrsmik6vff851p0a4ydnx99840j2xrx8348kk6h0af8vx6z";
+ };
+ };
+ };
+
}
diff --git a/pkgs/applications/editors/ed/default.nix b/pkgs/applications/editors/ed/default.nix
index 88b539d29f5..bccd7754efb 100644
--- a/pkgs/applications/editors/ed/default.nix
+++ b/pkgs/applications/editors/ed/default.nix
@@ -1,11 +1,14 @@
{ fetchurl, stdenv }:
stdenv.mkDerivation rec {
- name = "ed-1.9";
+ name = "ed-1.10";
src = fetchurl {
- url = "mirror://gnu/ed/${name}.tar.gz";
- sha256 = "122syihsx2hwzj75mkf5a9ssiky2xby748kp4cc00wzhmp7p5cym";
+ # gnu only provides *.lz tarball, which is unfriendly for stdenv bootstrapping
+ #url = "mirror://gnu/ed/${name}.tar.gz";
+ url = "http://pkgs.fedoraproject.org/repo/extras/ed/${name}.tar.bz2"
+ + "/38204d4c690a17a989e802ba01b45e98/${name}.tar.bz2";
+ sha256 = "16qvshl8470f3znjfrrci3lzllqkzc6disk5kygzsg9hh4f6wysq";
};
/* FIXME: Tests currently fail on Darwin:
@@ -24,7 +27,7 @@ stdenv.mkDerivation rec {
};
meta = {
- description = "GNU ed, an implementation of the standard Unix editor";
+ description = "An implementation of the standard Unix editor";
longDescription = ''
GNU ed is a line-oriented text editor. It is used to create,
@@ -37,7 +40,7 @@ stdenv.mkDerivation rec {
full-screen editors such as GNU Emacs or GNU Moe.
'';
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
homepage = http://www.gnu.org/software/ed/;
diff --git a/pkgs/applications/editors/emacs-23/builder.sh b/pkgs/applications/editors/emacs-23/builder.sh
deleted file mode 100644
index d04e7a4fdd3..00000000000
--- a/pkgs/applications/editors/emacs-23/builder.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-source $stdenv/setup
-
-# This hook is supposed to be run on Linux. It patches the proper locations of
-# the crt{1,i,n}.o files into the build to ensure that Emacs is linked with
-# *our* versions, not the ones found in the system, as it would do by default.
-# On other platforms, this appears to be unnecessary.
-preConfigure() {
- case "${system}" in
- x86_64-linux) glibclibdir=lib64 ;;
- i686-linux) glibclibdir=lib ;;
- *) return;
- esac
-
- libc=$(cat ${NIX_GCC}/nix-support/orig-libc)
- echo "libc: $libc"
-
- for i in src/s/*.h src/m/*.h; do
- substituteInPlace $i \
- --replace /usr/${glibclibdir}/crt1.o $libc/${glibclibdir}/crt1.o \
- --replace /usr/${glibclibdir}/crti.o $libc/${glibclibdir}/crti.o \
- --replace /usr/${glibclibdir}/crtn.o $libc/${glibclibdir}/crtn.o \
- --replace /usr/lib/crt1.o $libc/${glibclibdir}/crt1.o \
- --replace /usr/lib/crti.o $libc/${glibclibdir}/crti.o \
- --replace /usr/lib/crtn.o $libc/${glibclibdir}/crtn.o
- done
-
- for i in Makefile.in ./src/Makefile.in ./lib-src/Makefile.in ./leim/Makefile.in; do
- substituteInPlace $i --replace /bin/pwd pwd
- done
-}
-
-preBuild="make bootstrap"
-
-genericBuild
diff --git a/pkgs/applications/editors/emacs-23/default.nix b/pkgs/applications/editors/emacs-23/default.nix
deleted file mode 100644
index ab5c8e49e7f..00000000000
--- a/pkgs/applications/editors/emacs-23/default.nix
+++ /dev/null
@@ -1,72 +0,0 @@
-{ stdenv, fetchurl, ncurses, x11, libXaw, libXpm, Xaw3d
-, pkgconfig, gtk, libXft, dbus, libpng, libjpeg, libungif
-, libtiff, librsvg, texinfo, gconf
-}:
-
-assert (gtk != null) -> (pkgconfig != null);
-assert (libXft != null) -> libpng != null; # probably a bug
-assert stdenv.isDarwin -> libXaw != null; # fails to link otherwise
-
-stdenv.mkDerivation rec {
- name = "emacs-23.4";
-
- builder = ./builder.sh;
-
- src = fetchurl {
- url = "mirror://gnu/emacs/${name}.tar.bz2";
- sha256 = "1fc8x5p38qihg7l6z2b1hjc534lnjb8gqpwgywlwg5s3csg6ymr6";
- };
-
- buildInputs =
- [ ncurses x11 texinfo libXaw Xaw3d libXpm libpng libjpeg libungif
- libtiff librsvg libXft gconf
- ]
- ++ stdenv.lib.optionals (gtk != null) [ gtk pkgconfig ]
- ++ stdenv.lib.optional stdenv.isLinux dbus;
-
- configureFlags =
- stdenv.lib.optionals (gtk != null) [ "--with-x-toolkit=gtk" "--with-xft"]
-
- # On NixOS, help Emacs find `crt*.o'.
- ++ stdenv.lib.optional (stdenv ? glibc)
- [ "--with-crt-dir=${stdenv.glibc}/lib" ];
-
- postInstall = ''
- cat >$out/share/emacs/site-lisp/site-start.el <addr <= (unsigned long)my_edata
+ && my_size <= sectp->size))
+ unexec_error ("my_edata is not in section %s", SECT_DATA);
+- if (!unexec_write (sectp->offset, (void *) sectp->addr, my_size))
++ if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size))
+ unexec_error ("cannot write section %s", SECT_DATA);
+ if (!unexec_copy (sectp->offset + my_size, old_file_offset + my_size,
+ sectp->size - my_size))
+@@ -880,6 +880,27 @@
+ if (!unexec_write (header_offset, sectp, sizeof (struct section)))
+ unexec_error ("cannot write section %.16s's header", sectp->sectname);
+ }
++ else if (strncmp (sectp->sectname, "__bss", 5) == 0
++ || strncmp (sectp->sectname, "__pu_bss", 8) == 0)
++ {
++ sectp->flags = S_REGULAR;
++
++ /* These sections are produced by GCC 4.6+.
++
++ FIXME: We possibly ought to clear uninitialized local
++ variables in statically linked libraries like for
++ SECT_BSS (__bss) above, but setting up the markers we
++ need in lastfile.c would be rather messy. See
++ darwin_output_aligned_bss () in gcc/config/darwin.c for
++ the root of the problem, keeping in mind that the
++ sections are numbered by their alignment in GCC 4.6, but
++ by log2(alignment) in GCC 4.7. */
++
++ if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size))
++ unexec_error ("cannot copy section %.16s", sectp->sectname);
++ if (!unexec_write (header_offset, sectp, sizeof (struct section)))
++ unexec_error ("cannot write section %.16s's header", sectp->sectname);
++ }
+ else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
+ || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0
+ || strncmp (sectp->sectname, "__got", 16) == 0
+@@ -891,6 +912,7 @@
+ || strncmp (sectp->sectname, "__program_vars", 16) == 0
+ || strncmp (sectp->sectname, "__mod_init_func", 16) == 0
+ || strncmp (sectp->sectname, "__mod_term_func", 16) == 0
++ || strncmp (sectp->sectname, "__static_data", 16) == 0
+ || strncmp (sectp->sectname, "__objc_", 7) == 0)
+ {
+ if (!unexec_copy (sectp->offset, old_file_offset, sectp->size))
diff --git a/pkgs/applications/editors/emacs-24/default.nix b/pkgs/applications/editors/emacs-24/default.nix
index 6ecee37d21e..8f954515b8f 100644
--- a/pkgs/applications/editors/emacs-24/default.nix
+++ b/pkgs/applications/editors/emacs-24/default.nix
@@ -9,22 +9,24 @@ assert (libXft != null) -> libpng != null; # probably a bug
assert stdenv.isDarwin -> libXaw != null; # fails to link otherwise
stdenv.mkDerivation rec {
- name = "emacs-24.3";
+ name = "emacs-24.4";
builder = ./builder.sh;
src = fetchurl {
url = "mirror://gnu/emacs/${name}.tar.xz";
- sha256 = "1385qzs3bsa52s5rcncbrkxlydkw0ajzrvfxgv8rws5fx512kakh";
+ sha256 = "1zflm6ac34s6v166p58ilxrxbxjm0q2wfc25f8y0mjml1lbr3qs7";
};
+ patches = [ ./darwin-new-sections.patch ];
+
buildInputs =
[ ncurses gconf libxml2 gnutls alsaLib pkgconfig texinfo ]
++ stdenv.lib.optional stdenv.isLinux dbus
++ stdenv.lib.optionals withX
[ x11 libXaw Xaw3d libXpm libpng libjpeg libungif libtiff librsvg libXft
- imagemagick gtk ]
- ++ stdenv.lib.optional stdenv.isDarwin cairo;
+ imagemagick gtk gconf ]
+ ++ stdenv.lib.optional (stdenv.isDarwin && withX) cairo;
configureFlags =
( if withX && withGTK then
@@ -33,10 +35,7 @@ stdenv.mkDerivation rec {
[ "--with-x-toolkit=lucid" "--with-xft" ]
else
[ "--with-x=no" "--with-xpm=no" "--with-jpeg=no" "--with-png=no"
- "--with-gif=no" "--with-tiff=no" ] ) )
- # On NixOS, help Emacs find `crt*.o'.
- ++ stdenv.lib.optional (stdenv ? glibc)
- [ "--with-crt-dir=${stdenv.glibc}/lib" ];
+ "--with-gif=no" "--with-tiff=no" ] ) );
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.isDarwin && withX)
"-I${cairo}/include/cairo";
diff --git a/pkgs/applications/editors/emacs-24/macport.nix b/pkgs/applications/editors/emacs-24/macport.nix
index 4c599916d94..b357d19b674 100644
--- a/pkgs/applications/editors/emacs-24/macport.nix
+++ b/pkgs/applications/editors/emacs-24/macport.nix
@@ -2,21 +2,23 @@
}:
stdenv.mkDerivation rec {
- emacsName = "emacs-24.3";
- name = "${emacsName}-mac-4.8";
+ emacsName = "emacs-24.4";
+ name = "${emacsName}-mac-5.0";
#builder = ./builder.sh;
src = fetchurl {
url = "mirror://gnu/emacs/${emacsName}.tar.xz";
- sha256 = "1385qzs3bsa52s5rcncbrkxlydkw0ajzrvfxgv8rws5fx512kakh";
+ sha256 = "1zflm6ac34s6v166p58ilxrxbxjm0q2wfc25f8y0mjml1lbr3qs7";
};
macportSrc = fetchurl {
url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${name}.tar.gz";
- sha256 = "194y341zrpjp75mc3099kjc0inr1d379wwsnav257bwsc967h8yx";
+ sha256 = "14ipkwmzv0b02sclhgp2xj0cvhl3gk40sc2l21s87621kk640dzv";
};
+ patches = [ ./darwin-new-sections.patch ];
+
buildInputs = [ ncurses pkgconfig texinfo libxml2 gnutls ];
postUnpack = ''
@@ -53,16 +55,13 @@ stdenv.mkDerivation rec {
postInstall = ''
cat >$out/share/emacs/site-lisp/site-start.el <
+-#else
+-# include
+-#endif
++#include
+
+ #if !defined(PY_VERSION_HEX) || PY_VERSION_HEX < 0x02050000
+ # undef PY_SSIZE_T_CLEAN
+ MACVIMGUI_LIBS1 = -framework Cocoa -framework Carbon
diff --git a/pkgs/applications/editors/vim/wrapper.nix b/pkgs/applications/editors/vim/wrapper.nix
deleted file mode 100644
index 72e86805053..00000000000
--- a/pkgs/applications/editors/vim/wrapper.nix
+++ /dev/null
@@ -1,32 +0,0 @@
-{ stdenv, makeWrapper, writeText, vim, vimrc }:
-
-let
-
- vimrcfile = writeText "vimrc" vimrc;
-
- p = builtins.parseDrvName vim.name;
-
-in stdenv.mkDerivation rec {
- name = "${p.name}-with-vimrc-${p.version}";
-
- buildInputs = [ makeWrapper vim vimrcfile ];
-
- phases = [ "installPhase" ];
-
- installPhase = ''
- mkdir -p $out
- cp -r ${vim}/* $out/
-
- chmod u+w $out/bin
- chmod u+w $out/share/vim
-
- ln -s ${vimrcfile} $out/share/vim/vimrc
- wrapProgram $out/bin/vim --set VIM "$out/share/vim"
- '';
-
- meta = with stdenv.lib; {
- description = "The most popular clone of the VI editor";
- homepage = http://www.vim.org;
- platforms = platforms.unix;
- };
-}
diff --git a/pkgs/applications/editors/wxhexeditor/default.nix b/pkgs/applications/editors/wxhexeditor/default.nix
new file mode 100644
index 00000000000..de423987c02
--- /dev/null
+++ b/pkgs/applications/editors/wxhexeditor/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, wxGTK, autoconf, automake, libtool, python, gettext, bash }:
+
+stdenv.mkDerivation rec {
+ name = "wxHexEditor-${version}";
+ version = "v0.22";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/wxhexeditor/${name}-src.tar.bz2";
+ sha256 = "15ir038g4lyw1q5bsay974hvj0nkg2yd9kccwxz808cd45fp411w";
+ };
+
+ buildInputs = [ wxGTK autoconf automake libtool python gettext ];
+
+ patchPhase = ''
+ substituteInPlace Makefile --replace "/usr/local" "$out"
+ substituteInPlace Makefile --replace "mhash; ./configure" "mhash; ./configure --prefix=$out"
+ substituteInPlace udis86/autogen.sh --replace "/bin/bash" "${bash}/bin/bash"
+ '';
+
+ buildPhase = ''
+ make OPTFLAGS="-fopenmp"
+
+ '';
+
+ meta = {
+ description = "Hex Editor / Disk Editor for Huge Files or Devices";
+ longDescription = ''
+ This is not an ordinary hex editor, but could work as low level disk editor too.
+ If you have problems with your HDD or partition, you can recover your data from HDD or
+ from partition via editing sectors in raw hex.
+ You can edit your partition tables or you could recover files from File System by hand
+ with help of wxHexEditor.
+ Or you might want to analyze your big binary files, partitions, devices... If you need
+ a good reverse engineer tool like a good hex editor, you welcome.
+ wxHexEditor could edit HDD/SDD disk devices or partitions in raw up to exabyte sizes.
+ '';
+ homepage = "http://www.wxhexeditor.org/";
+ license = stdenv.lib.licenses.gpl2;
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/editors/yi/yi-contrib.nix b/pkgs/applications/editors/yi/yi-contrib.nix
deleted file mode 100644
index c7d3f094016..00000000000
--- a/pkgs/applications/editors/yi/yi-contrib.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{ cabal, filepath, lens, mtl, split, time, transformersBase, yi }:
-
-cabal.mkDerivation (self: {
- pname = "yi-contrib";
- version = "0.8.1";
- sha256 = "0jsbga30x302mr708vj5y7cpc961vh85dshpq2zlrf44dh0kmpvf";
- buildDepends = [
- filepath lens mtl split time transformersBase yi
- ];
- meta = {
- homepage = "http://haskell.org/haskellwiki/Yi";
- description = "Add-ons to Yi, the Haskell-Scriptable Editor";
- license = "GPL";
- platforms = self.ghc.meta.platforms;
- };
-})
diff --git a/pkgs/applications/editors/yi/yi-custom-cabal/LICENSE b/pkgs/applications/editors/yi/yi-custom-cabal/LICENSE
new file mode 100644
index 00000000000..cf1ab25da03
--- /dev/null
+++ b/pkgs/applications/editors/yi/yi-custom-cabal/LICENSE
@@ -0,0 +1,24 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to
diff --git a/pkgs/applications/editors/yi/yi-custom-cabal/yi-custom.cabal b/pkgs/applications/editors/yi/yi-custom-cabal/yi-custom.cabal
new file mode 100644
index 00000000000..d9ffbb8e481
--- /dev/null
+++ b/pkgs/applications/editors/yi/yi-custom-cabal/yi-custom.cabal
@@ -0,0 +1,17 @@
+name: yi-custom
+version: 0.0.0.1
+category: Yi
+synopsis: Convenience wrapper for nix
+description: Convenience wrapper for nix
+license: PublicDomain
+license-file: LICENSE
+author: Mateusz Kowalczyk
+maintainer: fuuzetsu@fuuzetsu.co.uk
+Cabal-Version: >= 1.10
+build-type: Simple
+
+library
+ hs-source-dirs: .
+ default-language: Haskell2010
+ build-depends: base, yi
+ ghc-options: -threaded
diff --git a/pkgs/applications/editors/yi/yi-custom.nix b/pkgs/applications/editors/yi/yi-custom.nix
new file mode 100644
index 00000000000..3dbd4611998
--- /dev/null
+++ b/pkgs/applications/editors/yi/yi-custom.nix
@@ -0,0 +1,40 @@
+# This is a manually-written expression over an in-tree cabal file.
+# It's awkward but this way allows the package user to pass in
+# extraPackages without much extra hassle on their end, similarly how
+# the XMonad service handles it: the difference is that we don't have
+# anything like XMONAD_GHC…
+#
+# The idea is that the user changes their configs using any libraries
+# he likes and then builds it using this expression. Once that's done,
+# ‘reload’ and similar functions should all work as long as the user
+# doesn't need new libraries at which point they should add them to
+# extraPackages and rebuild from the expression.
+{ cabal, yi, extraPackages, makeWrapper, ghcWithPackages }:
+let
+ w = ghcWithPackages (self: [ yi ] ++ extraPackages self);
+ wrappedGhc = w.override { ignoreCollisions = true; };
+in
+cabal.mkDerivation (self: rec {
+ pname = "yi-custom";
+ version = "0.0.0.1";
+ src = ./yi-custom-cabal;
+ isLibrary = true;
+ buildDepends = [ yi ];
+ buildTools = [ makeWrapper ];
+ noHaddock = true;
+ doCheck = false;
+
+ postInstall = ''
+ makeWrapper ${yi}/bin/yi $out/bin/yi \
+ --set NIX_GHC ${wrappedGhc}/bin/ghc \
+ --set NIX_GHC_LIBDIR ${wrappedGhc}/lib/ghc-${self.ghc.version}
+ '';
+ meta = {
+ homepage = "http://haskell.org/haskellwiki/Yi";
+ description = "Wrapper over user-specified Haskell libraries for use in Yi config";
+ license = self.stdenv.lib.licenses.publicDomain;
+ platforms = self.ghc.meta.platforms;
+ maintainers = with self.stdenv.lib.maintainers; [ fuuzetsu ];
+ };
+
+})
\ No newline at end of file
diff --git a/pkgs/applications/editors/yi/yi.nix b/pkgs/applications/editors/yi/yi.nix
index e689bdff4f6..7b91d94f386 100644
--- a/pkgs/applications/editors/yi/yi.nix
+++ b/pkgs/applications/editors/yi/yi.nix
@@ -1,63 +1,39 @@
-{ cabal, alex, binary, Cabal, cautiousFile, concreteTyperep
-, dataDefault, derive, Diff, dlist, dyre, filepath, fingertree
-, glib, gtk, hashable, hint, HUnit, lens, mtl, pango, parsec
-, pointedlist, QuickCheck, random, regexBase, regexTdfa, safe
-, split, tasty, tastyHunit, tastyQuickcheck, time, transformersBase
-, uniplate, unixCompat, unorderedContainers, utf8String, vty
-, xdgBasedir
-, withPango ? true
+# This file was auto-generated by cabal2nix. Please do NOT edit manually!
-# User may need extra dependencies for their configuration file so we
-# want to specify it here to have them available when wrapping the
-# produced binary.
-, extraDepends ? [ ]
+{ cabal, binary, Cabal, cautiousFile, dataDefault, derive, dlist
+, dynamicState, dyre, filepath, glib, gtk, hashable, hint, HUnit
+, lens, mtl, ooPrototypes, pango, parsec, pointedlist, QuickCheck
+, random, regexBase, regexTdfa, safe, semigroups, split, tagged
+, tasty, tastyHunit, tastyQuickcheck, text, time, transformersBase
+, unixCompat, unorderedContainers, utf8String, vty, wordTrie
+, xdgBasedir, yiLanguage, yiRope
}:
cabal.mkDerivation (self: {
pname = "yi";
- version = "0.8.1";
- sha256 = "1hyqlydc0na9pkb3fkbp13c6vnp4f80z8237bvrv12wkk5syyn23";
+ version = "0.11.0";
+ sha256 = "1da5wnqx1z8d809dydqr97jh8n5g9phh06lvkgc32hib2rybh5yx";
isLibrary = true;
isExecutable = true;
buildDepends = [
- binary Cabal cautiousFile concreteTyperep dataDefault derive Diff
- dlist dyre filepath fingertree hashable hint lens mtl
+ binary Cabal cautiousFile dataDefault derive dlist dynamicState
+ dyre filepath glib gtk hashable hint lens mtl ooPrototypes pango
parsec pointedlist QuickCheck random regexBase regexTdfa safe
- split time transformersBase uniplate unixCompat unorderedContainers
- utf8String vty xdgBasedir
- ] ++ (if withPango then [ pango gtk glib ] else [ ]) ++ extraDepends;
- testDepends = [
- filepath HUnit QuickCheck tasty tastyHunit tastyQuickcheck
+ semigroups split tagged text time transformersBase unixCompat
+ unorderedContainers utf8String vty wordTrie xdgBasedir yiLanguage
+ yiRope
];
- buildTools = [ alex ];
- configureFlags = if withPango then "-fpango" else "-f-pango";
- doCheck = false;
-
- # https://ghc.haskell.org/trac/ghc/ticket/9170
- noHaddock = self.ghc.version == "7.6.3";
-
- # Allows Yi to find the libraries it needs at runtime.
- postInstall = ''
- mv $out/bin/yi $out/bin/.yi-wrapped
- cat - > $out/bin/yi < $out/zed/zed-bin
+ cp $NWPATH/nw.pak $out/zed/
+ cp nw/zed-linux $out/zed/zed
+ chmod +x $out/zed/zed*
+ cp Zed.desktop.tmpl Zed.svg Zed.png $out/zed
+ rm $out/zed/app.nw
+ '';
+
+ postFixup = ''
+ wrapProgram $out/zed/zed-bin \
+ --prefix NODE_PATH : ${node_env}/lib/node_modules
+ '';
+ };
+
+ zed_script = writeScript "zed.sh" ''
+ if [[ $1 == http://* ]] || [[ $1 == https://* ]]; then
+ PROJECT=$1
+ elif [ "" != "$1" ]; then
+ PROJECT=$(readlink -f $1)
+ fi
+ ${zed}/zed/zed-bin $PROJECT
+ '';
+
+in stdenv.mkDerivation rec {
+ inherit name version;
+
+ src = zed;
+
+ installPhase = ''
+ mkdir -p $out/bin
+ ln -s ${zed_script} $out/bin/zed
+ '';
+
+ meta = {
+ description = "Zed is a fully offline-capable, open source, keyboard-focused, text and code editor for power users";
+ license = stdenv.lib.licenses.mit;
+ homepage = http://zedapp.org/;
+ maintainers = [ stdenv.lib.maintainers.matejc ];
+ platforms = stdenv.lib.platforms.linux;
+ };
+}
diff --git a/pkgs/applications/editors/zed/node.nix b/pkgs/applications/editors/zed/node.nix
new file mode 100644
index 00000000000..f2c08fde0cd
--- /dev/null
+++ b/pkgs/applications/editors/zed/node.nix
@@ -0,0 +1,1509 @@
+{ self, fetchurl, fetchgit ? null, lib }:
+
+{
+ by-spec."accepts"."~1.1.0" =
+ self.by-version."accepts"."1.1.0";
+ by-version."accepts"."1.1.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-accepts-1.1.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/accepts/-/accepts-1.1.0.tgz";
+ name = "accepts-1.1.0.tgz";
+ sha1 = "43ba6d946374c80f91823eaec6bb43dc4955500b";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."accepts" or []);
+ deps = [
+ self.by-version."mime-types"."2.0.1"
+ self.by-version."negotiator"."0.4.7"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "accepts" ];
+ };
+ by-spec."asn1"."0.1.11" =
+ self.by-version."asn1"."0.1.11";
+ by-version."asn1"."0.1.11" = lib.makeOverridable self.buildNodePackage {
+ name = "node-asn1-0.1.11";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz";
+ name = "asn1-0.1.11.tgz";
+ sha1 = "559be18376d08a4ec4dbe80877d27818639b2df7";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."asn1" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "asn1" ];
+ };
+ by-spec."assert-plus"."0.1.2" =
+ self.by-version."assert-plus"."0.1.2";
+ by-version."assert-plus"."0.1.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-assert-plus-0.1.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz";
+ name = "assert-plus-0.1.2.tgz";
+ sha1 = "d93ffdbb67ac5507779be316a7d65146417beef8";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."assert-plus" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "assert-plus" ];
+ };
+ by-spec."async"."~0.9.0" =
+ self.by-version."async"."0.9.0";
+ by-version."async"."0.9.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-async-0.9.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/async/-/async-0.9.0.tgz";
+ name = "async-0.9.0.tgz";
+ sha1 = "ac3613b1da9bed1b47510bb4651b8931e47146c7";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."async" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "async" ];
+ };
+ by-spec."aws-sign2"."~0.5.0" =
+ self.by-version."aws-sign2"."0.5.0";
+ by-version."aws-sign2"."0.5.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-aws-sign2-0.5.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz";
+ name = "aws-sign2-0.5.0.tgz";
+ sha1 = "c57103f7a17fc037f02d7c2e64b602ea223f7d63";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."aws-sign2" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "aws-sign2" ];
+ };
+ by-spec."block-stream"."*" =
+ self.by-version."block-stream"."0.0.7";
+ by-version."block-stream"."0.0.7" = lib.makeOverridable self.buildNodePackage {
+ name = "node-block-stream-0.0.7";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/block-stream/-/block-stream-0.0.7.tgz";
+ name = "block-stream-0.0.7.tgz";
+ sha1 = "9088ab5ae1e861f4d81b176b4a8046080703deed";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."block-stream" or []);
+ deps = [
+ self.by-version."inherits"."2.0.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "block-stream" ];
+ };
+ by-spec."body-parser"."^1.6.3" =
+ self.by-version."body-parser"."1.8.1";
+ by-version."body-parser"."1.8.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-body-parser-1.8.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/body-parser/-/body-parser-1.8.1.tgz";
+ name = "body-parser-1.8.1.tgz";
+ sha1 = "f9f96d221c435c95d18aeaad2bcdea1371902aad";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."body-parser" or []);
+ deps = [
+ self.by-version."bytes"."1.0.0"
+ self.by-version."depd"."0.4.4"
+ self.by-version."iconv-lite"."0.4.4"
+ self.by-version."media-typer"."0.3.0"
+ self.by-version."on-finished"."2.1.0"
+ self.by-version."qs"."2.2.3"
+ self.by-version."raw-body"."1.3.0"
+ self.by-version."type-is"."1.5.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "body-parser" ];
+ };
+ "body-parser" = self.by-version."body-parser"."1.8.1";
+ by-spec."boom"."0.4.x" =
+ self.by-version."boom"."0.4.2";
+ by-version."boom"."0.4.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-boom-0.4.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/boom/-/boom-0.4.2.tgz";
+ name = "boom-0.4.2.tgz";
+ sha1 = "7a636e9ded4efcefb19cef4947a3c67dfaee911b";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."boom" or []);
+ deps = [
+ self.by-version."hoek"."0.9.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "boom" ];
+ };
+ by-spec."buffer-crc32"."0.2.3" =
+ self.by-version."buffer-crc32"."0.2.3";
+ by-version."buffer-crc32"."0.2.3" = lib.makeOverridable self.buildNodePackage {
+ name = "node-buffer-crc32-0.2.3";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.3.tgz";
+ name = "buffer-crc32-0.2.3.tgz";
+ sha1 = "bb54519e95d107cbd2400e76d0cab1467336d921";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."buffer-crc32" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "buffer-crc32" ];
+ };
+ by-spec."bytes"."1" =
+ self.by-version."bytes"."1.0.0";
+ by-version."bytes"."1.0.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-bytes-1.0.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/bytes/-/bytes-1.0.0.tgz";
+ name = "bytes-1.0.0.tgz";
+ sha1 = "3569ede8ba34315fab99c3e92cb04c7220de1fa8";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."bytes" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "bytes" ];
+ };
+ by-spec."bytes"."1.0.0" =
+ self.by-version."bytes"."1.0.0";
+ by-spec."combined-stream"."~0.0.4" =
+ self.by-version."combined-stream"."0.0.5";
+ by-version."combined-stream"."0.0.5" = lib.makeOverridable self.buildNodePackage {
+ name = "node-combined-stream-0.0.5";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/combined-stream/-/combined-stream-0.0.5.tgz";
+ name = "combined-stream-0.0.5.tgz";
+ sha1 = "29ed76e5c9aad07c4acf9ca3d32601cce28697a2";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."combined-stream" or []);
+ deps = [
+ self.by-version."delayed-stream"."0.0.5"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "combined-stream" ];
+ };
+ by-spec."commander"."~2.1.0" =
+ self.by-version."commander"."2.1.0";
+ by-version."commander"."2.1.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-commander-2.1.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/commander/-/commander-2.1.0.tgz";
+ name = "commander-2.1.0.tgz";
+ sha1 = "d121bbae860d9992a3d517ba96f56588e47c6781";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."commander" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "commander" ];
+ };
+ by-spec."cookie"."0.1.2" =
+ self.by-version."cookie"."0.1.2";
+ by-version."cookie"."0.1.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-cookie-0.1.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/cookie/-/cookie-0.1.2.tgz";
+ name = "cookie-0.1.2.tgz";
+ sha1 = "72fec3d24e48a3432073d90c12642005061004b1";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."cookie" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "cookie" ];
+ };
+ by-spec."cookie-signature"."1.0.5" =
+ self.by-version."cookie-signature"."1.0.5";
+ by-version."cookie-signature"."1.0.5" = lib.makeOverridable self.buildNodePackage {
+ name = "node-cookie-signature-1.0.5";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.5.tgz";
+ name = "cookie-signature-1.0.5.tgz";
+ sha1 = "a122e3f1503eca0f5355795b0711bb2368d450f9";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."cookie-signature" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "cookie-signature" ];
+ };
+ by-spec."cryptiles"."0.2.x" =
+ self.by-version."cryptiles"."0.2.2";
+ by-version."cryptiles"."0.2.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-cryptiles-0.2.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz";
+ name = "cryptiles-0.2.2.tgz";
+ sha1 = "ed91ff1f17ad13d3748288594f8a48a0d26f325c";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."cryptiles" or []);
+ deps = [
+ self.by-version."boom"."0.4.2"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "cryptiles" ];
+ };
+ by-spec."ctype"."0.5.2" =
+ self.by-version."ctype"."0.5.2";
+ by-version."ctype"."0.5.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-ctype-0.5.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz";
+ name = "ctype-0.5.2.tgz";
+ sha1 = "fe8091d468a373a0b0c9ff8bbfb3425c00973a1d";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."ctype" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "ctype" ];
+ };
+ by-spec."debug"."~2.0.0" =
+ self.by-version."debug"."2.0.0";
+ by-version."debug"."2.0.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-debug-2.0.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/debug/-/debug-2.0.0.tgz";
+ name = "debug-2.0.0.tgz";
+ sha1 = "89bd9df6732b51256bc6705342bba02ed12131ef";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."debug" or []);
+ deps = [
+ self.by-version."ms"."0.6.2"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "debug" ];
+ };
+ by-spec."delayed-stream"."0.0.5" =
+ self.by-version."delayed-stream"."0.0.5";
+ by-version."delayed-stream"."0.0.5" = lib.makeOverridable self.buildNodePackage {
+ name = "node-delayed-stream-0.0.5";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz";
+ name = "delayed-stream-0.0.5.tgz";
+ sha1 = "d4b1f43a93e8296dfe02694f4680bc37a313c73f";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."delayed-stream" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "delayed-stream" ];
+ };
+ by-spec."depd"."0.4.4" =
+ self.by-version."depd"."0.4.4";
+ by-version."depd"."0.4.4" = lib.makeOverridable self.buildNodePackage {
+ name = "node-depd-0.4.4";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/depd/-/depd-0.4.4.tgz";
+ name = "depd-0.4.4.tgz";
+ sha1 = "07091fae75f97828d89b4a02a2d4778f0e7c0662";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."depd" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "depd" ];
+ };
+ by-spec."destroy"."1.0.3" =
+ self.by-version."destroy"."1.0.3";
+ by-version."destroy"."1.0.3" = lib.makeOverridable self.buildNodePackage {
+ name = "node-destroy-1.0.3";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/destroy/-/destroy-1.0.3.tgz";
+ name = "destroy-1.0.3.tgz";
+ sha1 = "b433b4724e71fd8551d9885174851c5fc377e2c9";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."destroy" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "destroy" ];
+ };
+ by-spec."ee-first"."1.0.5" =
+ self.by-version."ee-first"."1.0.5";
+ by-version."ee-first"."1.0.5" = lib.makeOverridable self.buildNodePackage {
+ name = "node-ee-first-1.0.5";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/ee-first/-/ee-first-1.0.5.tgz";
+ name = "ee-first-1.0.5.tgz";
+ sha1 = "8c9b212898d8cd9f1a9436650ce7be202c9e9ff0";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."ee-first" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "ee-first" ];
+ };
+ by-spec."escape-html"."1.0.1" =
+ self.by-version."escape-html"."1.0.1";
+ by-version."escape-html"."1.0.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-escape-html-1.0.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/escape-html/-/escape-html-1.0.1.tgz";
+ name = "escape-html-1.0.1.tgz";
+ sha1 = "181a286ead397a39a92857cfb1d43052e356bff0";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."escape-html" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "escape-html" ];
+ };
+ by-spec."etag"."~1.3.0" =
+ self.by-version."etag"."1.3.0";
+ by-version."etag"."1.3.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-etag-1.3.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/etag/-/etag-1.3.0.tgz";
+ name = "etag-1.3.0.tgz";
+ sha1 = "c837debfbfe0baf7eb8e2f0bbb3d1d9cc3229697";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."etag" or []);
+ deps = [
+ self.by-version."buffer-crc32"."0.2.3"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "etag" ];
+ };
+ by-spec."express"."^4.8.3" =
+ self.by-version."express"."4.9.0";
+ by-version."express"."4.9.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-express-4.9.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/express/-/express-4.9.0.tgz";
+ name = "express-4.9.0.tgz";
+ sha1 = "9b2ea4ebce57c7ac710604c74f6c303ab344a7f3";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."express" or []);
+ deps = [
+ self.by-version."accepts"."1.1.0"
+ self.by-version."buffer-crc32"."0.2.3"
+ self.by-version."cookie-signature"."1.0.5"
+ self.by-version."debug"."2.0.0"
+ self.by-version."depd"."0.4.4"
+ self.by-version."escape-html"."1.0.1"
+ self.by-version."etag"."1.3.0"
+ self.by-version."finalhandler"."0.2.0"
+ self.by-version."fresh"."0.2.4"
+ self.by-version."media-typer"."0.3.0"
+ self.by-version."methods"."1.1.0"
+ self.by-version."on-finished"."2.1.0"
+ self.by-version."parseurl"."1.3.0"
+ self.by-version."path-to-regexp"."0.1.3"
+ self.by-version."proxy-addr"."1.0.1"
+ self.by-version."qs"."2.2.3"
+ self.by-version."range-parser"."1.0.2"
+ self.by-version."send"."0.9.1"
+ self.by-version."serve-static"."1.6.1"
+ self.by-version."type-is"."1.5.1"
+ self.by-version."vary"."1.0.0"
+ self.by-version."cookie"."0.1.2"
+ self.by-version."merge-descriptors"."0.0.2"
+ self.by-version."utils-merge"."1.0.0"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "express" ];
+ };
+ "express" = self.by-version."express"."4.9.0";
+ by-spec."finalhandler"."0.2.0" =
+ self.by-version."finalhandler"."0.2.0";
+ by-version."finalhandler"."0.2.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-finalhandler-0.2.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/finalhandler/-/finalhandler-0.2.0.tgz";
+ name = "finalhandler-0.2.0.tgz";
+ sha1 = "794082424b17f6a4b2a0eda39f9db6948ee4be8d";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."finalhandler" or []);
+ deps = [
+ self.by-version."debug"."2.0.0"
+ self.by-version."escape-html"."1.0.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "finalhandler" ];
+ };
+ by-spec."forever-agent"."~0.5.0" =
+ self.by-version."forever-agent"."0.5.2";
+ by-version."forever-agent"."0.5.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-forever-agent-0.5.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz";
+ name = "forever-agent-0.5.2.tgz";
+ sha1 = "6d0e09c4921f94a27f63d3b49c5feff1ea4c5130";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."forever-agent" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "forever-agent" ];
+ };
+ by-spec."form-data"."~0.1.0" =
+ self.by-version."form-data"."0.1.4";
+ by-version."form-data"."0.1.4" = lib.makeOverridable self.buildNodePackage {
+ name = "node-form-data-0.1.4";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz";
+ name = "form-data-0.1.4.tgz";
+ sha1 = "91abd788aba9702b1aabfa8bc01031a2ac9e3b12";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."form-data" or []);
+ deps = [
+ self.by-version."combined-stream"."0.0.5"
+ self.by-version."mime"."1.2.11"
+ self.by-version."async"."0.9.0"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "form-data" ];
+ };
+ by-spec."fresh"."0.2.4" =
+ self.by-version."fresh"."0.2.4";
+ by-version."fresh"."0.2.4" = lib.makeOverridable self.buildNodePackage {
+ name = "node-fresh-0.2.4";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/fresh/-/fresh-0.2.4.tgz";
+ name = "fresh-0.2.4.tgz";
+ sha1 = "3582499206c9723714190edd74b4604feb4a614c";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."fresh" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "fresh" ];
+ };
+ by-spec."fstream"."~0.1.28" =
+ self.by-version."fstream"."0.1.31";
+ by-version."fstream"."0.1.31" = lib.makeOverridable self.buildNodePackage {
+ name = "node-fstream-0.1.31";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/fstream/-/fstream-0.1.31.tgz";
+ name = "fstream-0.1.31.tgz";
+ sha1 = "7337f058fbbbbefa8c9f561a28cab0849202c988";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."fstream" or []);
+ deps = [
+ self.by-version."graceful-fs"."3.0.2"
+ self.by-version."inherits"."2.0.1"
+ self.by-version."mkdirp"."0.5.0"
+ self.by-version."rimraf"."2.2.8"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "fstream" ];
+ };
+ by-spec."graceful-fs"."~3.0.2" =
+ self.by-version."graceful-fs"."3.0.2";
+ by-version."graceful-fs"."3.0.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-graceful-fs-3.0.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.2.tgz";
+ name = "graceful-fs-3.0.2.tgz";
+ sha1 = "2cb5bf7f742bea8ad47c754caeee032b7e71a577";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."graceful-fs" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "graceful-fs" ];
+ };
+ by-spec."hawk"."~1.0.0" =
+ self.by-version."hawk"."1.0.0";
+ by-version."hawk"."1.0.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-hawk-1.0.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz";
+ name = "hawk-1.0.0.tgz";
+ sha1 = "b90bb169807285411da7ffcb8dd2598502d3b52d";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."hawk" or []);
+ deps = [
+ self.by-version."hoek"."0.9.1"
+ self.by-version."boom"."0.4.2"
+ self.by-version."cryptiles"."0.2.2"
+ self.by-version."sntp"."0.2.4"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "hawk" ];
+ };
+ by-spec."hoek"."0.9.x" =
+ self.by-version."hoek"."0.9.1";
+ by-version."hoek"."0.9.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-hoek-0.9.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz";
+ name = "hoek-0.9.1.tgz";
+ sha1 = "3d322462badf07716ea7eb85baf88079cddce505";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."hoek" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "hoek" ];
+ };
+ by-spec."http-signature"."~0.10.0" =
+ self.by-version."http-signature"."0.10.0";
+ by-version."http-signature"."0.10.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-http-signature-0.10.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/http-signature/-/http-signature-0.10.0.tgz";
+ name = "http-signature-0.10.0.tgz";
+ sha1 = "1494e4f5000a83c0f11bcc12d6007c530cb99582";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."http-signature" or []);
+ deps = [
+ self.by-version."assert-plus"."0.1.2"
+ self.by-version."asn1"."0.1.11"
+ self.by-version."ctype"."0.5.2"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "http-signature" ];
+ };
+ by-spec."iconv-lite"."0.4.4" =
+ self.by-version."iconv-lite"."0.4.4";
+ by-version."iconv-lite"."0.4.4" = lib.makeOverridable self.buildNodePackage {
+ name = "node-iconv-lite-0.4.4";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.4.tgz";
+ name = "iconv-lite-0.4.4.tgz";
+ sha1 = "e95f2e41db0735fc21652f7827a5ee32e63c83a8";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."iconv-lite" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "iconv-lite" ];
+ };
+ by-spec."inherits"."2" =
+ self.by-version."inherits"."2.0.1";
+ by-version."inherits"."2.0.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-inherits-2.0.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz";
+ name = "inherits-2.0.1.tgz";
+ sha1 = "b17d08d326b4423e568eff719f91b0b1cbdf69f1";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."inherits" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "inherits" ];
+ };
+ by-spec."inherits"."~2.0.0" =
+ self.by-version."inherits"."2.0.1";
+ by-spec."ipaddr.js"."0.1.2" =
+ self.by-version."ipaddr.js"."0.1.2";
+ by-version."ipaddr.js"."0.1.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-ipaddr.js-0.1.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/ipaddr.js/-/ipaddr.js-0.1.2.tgz";
+ name = "ipaddr.js-0.1.2.tgz";
+ sha1 = "6a1fd3d854f5002965c34d7bbcd9b4a8d4b0467e";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."ipaddr.js" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "ipaddr.js" ];
+ };
+ by-spec."json-stringify-safe"."~5.0.0" =
+ self.by-version."json-stringify-safe"."5.0.0";
+ by-version."json-stringify-safe"."5.0.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-json-stringify-safe-5.0.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz";
+ name = "json-stringify-safe-5.0.0.tgz";
+ sha1 = "4c1f228b5050837eba9d21f50c2e6e320624566e";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."json-stringify-safe" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "json-stringify-safe" ];
+ };
+ by-spec."media-typer"."0.3.0" =
+ self.by-version."media-typer"."0.3.0";
+ by-version."media-typer"."0.3.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-media-typer-0.3.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz";
+ name = "media-typer-0.3.0.tgz";
+ sha1 = "8710d7af0aa626f8fffa1ce00168545263255748";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."media-typer" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "media-typer" ];
+ };
+ by-spec."merge-descriptors"."0.0.2" =
+ self.by-version."merge-descriptors"."0.0.2";
+ by-version."merge-descriptors"."0.0.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-merge-descriptors-0.0.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/merge-descriptors/-/merge-descriptors-0.0.2.tgz";
+ name = "merge-descriptors-0.0.2.tgz";
+ sha1 = "c36a52a781437513c57275f39dd9d317514ac8c7";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."merge-descriptors" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "merge-descriptors" ];
+ };
+ by-spec."methods"."1.1.0" =
+ self.by-version."methods"."1.1.0";
+ by-version."methods"."1.1.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-methods-1.1.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/methods/-/methods-1.1.0.tgz";
+ name = "methods-1.1.0.tgz";
+ sha1 = "5dca4ee12df52ff3b056145986a8f01cbc86436f";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."methods" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "methods" ];
+ };
+ by-spec."mime"."1.2.11" =
+ self.by-version."mime"."1.2.11";
+ by-version."mime"."1.2.11" = lib.makeOverridable self.buildNodePackage {
+ name = "node-mime-1.2.11";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/mime/-/mime-1.2.11.tgz";
+ name = "mime-1.2.11.tgz";
+ sha1 = "58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."mime" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "mime" ];
+ };
+ by-spec."mime"."~1.2.11" =
+ self.by-version."mime"."1.2.11";
+ by-spec."mime"."~1.2.9" =
+ self.by-version."mime"."1.2.11";
+ by-spec."mime-db"."~1.0.1" =
+ self.by-version."mime-db"."1.0.1";
+ by-version."mime-db"."1.0.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-mime-db-1.0.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/mime-db/-/mime-db-1.0.1.tgz";
+ name = "mime-db-1.0.1.tgz";
+ sha1 = "35d99b0965967253bb30633a7d07a8de9975a952";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."mime-db" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "mime-db" ];
+ };
+ by-spec."mime-types"."~2.0.0" =
+ self.by-version."mime-types"."2.0.1";
+ by-version."mime-types"."2.0.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-mime-types-2.0.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/mime-types/-/mime-types-2.0.1.tgz";
+ name = "mime-types-2.0.1.tgz";
+ sha1 = "7f5b4712592e7dd46ca733fd1c5f5d71356de615";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."mime-types" or []);
+ deps = [
+ self.by-version."mime-db"."1.0.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "mime-types" ];
+ };
+ by-spec."mime-types"."~2.0.1" =
+ self.by-version."mime-types"."2.0.1";
+ by-spec."minimist"."0.0.8" =
+ self.by-version."minimist"."0.0.8";
+ by-version."minimist"."0.0.8" = lib.makeOverridable self.buildNodePackage {
+ name = "node-minimist-0.0.8";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz";
+ name = "minimist-0.0.8.tgz";
+ sha1 = "857fcabfc3397d2625b8228262e86aa7a011b05d";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."minimist" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "minimist" ];
+ };
+ by-spec."mkdirp"."0.5" =
+ self.by-version."mkdirp"."0.5.0";
+ by-version."mkdirp"."0.5.0" = lib.makeOverridable self.buildNodePackage {
+ name = "mkdirp-0.5.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz";
+ name = "mkdirp-0.5.0.tgz";
+ sha1 = "1d73076a6df986cd9344e15e71fcc05a4c9abf12";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."mkdirp" or []);
+ deps = [
+ self.by-version."minimist"."0.0.8"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "mkdirp" ];
+ };
+ by-spec."ms"."0.6.2" =
+ self.by-version."ms"."0.6.2";
+ by-version."ms"."0.6.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-ms-0.6.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/ms/-/ms-0.6.2.tgz";
+ name = "ms-0.6.2.tgz";
+ sha1 = "d89c2124c6fdc1353d65a8b77bf1aac4b193708c";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."ms" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "ms" ];
+ };
+ by-spec."nan"."~1.0.0" =
+ self.by-version."nan"."1.0.0";
+ by-version."nan"."1.0.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-nan-1.0.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/nan/-/nan-1.0.0.tgz";
+ name = "nan-1.0.0.tgz";
+ sha1 = "ae24f8850818d662fcab5acf7f3b95bfaa2ccf38";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."nan" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "nan" ];
+ };
+ by-spec."negotiator"."0.4.7" =
+ self.by-version."negotiator"."0.4.7";
+ by-version."negotiator"."0.4.7" = lib.makeOverridable self.buildNodePackage {
+ name = "node-negotiator-0.4.7";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/negotiator/-/negotiator-0.4.7.tgz";
+ name = "negotiator-0.4.7.tgz";
+ sha1 = "a4160f7177ec806738631d0d3052325da42abdc8";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."negotiator" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "negotiator" ];
+ };
+ by-spec."node-uuid"."~1.4.0" =
+ self.by-version."node-uuid"."1.4.1";
+ by-version."node-uuid"."1.4.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-node-uuid-1.4.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/node-uuid/-/node-uuid-1.4.1.tgz";
+ name = "node-uuid-1.4.1.tgz";
+ sha1 = "39aef510e5889a3dca9c895b506c73aae1bac048";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."node-uuid" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "node-uuid" ];
+ };
+ by-spec."oauth-sign"."~0.3.0" =
+ self.by-version."oauth-sign"."0.3.0";
+ by-version."oauth-sign"."0.3.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-oauth-sign-0.3.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz";
+ name = "oauth-sign-0.3.0.tgz";
+ sha1 = "cb540f93bb2b22a7d5941691a288d60e8ea9386e";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."oauth-sign" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "oauth-sign" ];
+ };
+ by-spec."on-finished"."2.1.0" =
+ self.by-version."on-finished"."2.1.0";
+ by-version."on-finished"."2.1.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-on-finished-2.1.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/on-finished/-/on-finished-2.1.0.tgz";
+ name = "on-finished-2.1.0.tgz";
+ sha1 = "0c539f09291e8ffadde0c8a25850fb2cedc7022d";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."on-finished" or []);
+ deps = [
+ self.by-version."ee-first"."1.0.5"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "on-finished" ];
+ };
+ by-spec."on-finished"."~2.1.0" =
+ self.by-version."on-finished"."2.1.0";
+ by-spec."options".">=0.0.5" =
+ self.by-version."options"."0.0.5";
+ by-version."options"."0.0.5" = lib.makeOverridable self.buildNodePackage {
+ name = "node-options-0.0.5";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/options/-/options-0.0.5.tgz";
+ name = "options-0.0.5.tgz";
+ sha1 = "9a3806378f316536d79038038ba90ccb724816c3";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."options" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "options" ];
+ };
+ by-spec."parseurl"."~1.3.0" =
+ self.by-version."parseurl"."1.3.0";
+ by-version."parseurl"."1.3.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-parseurl-1.3.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/parseurl/-/parseurl-1.3.0.tgz";
+ name = "parseurl-1.3.0.tgz";
+ sha1 = "b58046db4223e145afa76009e61bac87cc2281b3";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."parseurl" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "parseurl" ];
+ };
+ by-spec."path-to-regexp"."0.1.3" =
+ self.by-version."path-to-regexp"."0.1.3";
+ by-version."path-to-regexp"."0.1.3" = lib.makeOverridable self.buildNodePackage {
+ name = "node-path-to-regexp-0.1.3";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.3.tgz";
+ name = "path-to-regexp-0.1.3.tgz";
+ sha1 = "21b9ab82274279de25b156ea08fd12ca51b8aecb";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."path-to-regexp" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "path-to-regexp" ];
+ };
+ by-spec."proxy-addr"."1.0.1" =
+ self.by-version."proxy-addr"."1.0.1";
+ by-version."proxy-addr"."1.0.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-proxy-addr-1.0.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/proxy-addr/-/proxy-addr-1.0.1.tgz";
+ name = "proxy-addr-1.0.1.tgz";
+ sha1 = "c7c566d5eb4e3fad67eeb9c77c5558ccc39b88a8";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."proxy-addr" or []);
+ deps = [
+ self.by-version."ipaddr.js"."0.1.2"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "proxy-addr" ];
+ };
+ by-spec."punycode".">=0.2.0" =
+ self.by-version."punycode"."1.3.1";
+ by-version."punycode"."1.3.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-punycode-1.3.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/punycode/-/punycode-1.3.1.tgz";
+ name = "punycode-1.3.1.tgz";
+ sha1 = "710afe5123c20a1530b712e3e682b9118fe8058e";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."punycode" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "punycode" ];
+ };
+ by-spec."qs"."2.2.3" =
+ self.by-version."qs"."2.2.3";
+ by-version."qs"."2.2.3" = lib.makeOverridable self.buildNodePackage {
+ name = "node-qs-2.2.3";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/qs/-/qs-2.2.3.tgz";
+ name = "qs-2.2.3.tgz";
+ sha1 = "6139c1f47960eff5655e56aab0ef9f6dd16d4eeb";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."qs" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "qs" ];
+ };
+ by-spec."qs"."~0.6.0" =
+ self.by-version."qs"."0.6.6";
+ by-version."qs"."0.6.6" = lib.makeOverridable self.buildNodePackage {
+ name = "node-qs-0.6.6";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/qs/-/qs-0.6.6.tgz";
+ name = "qs-0.6.6.tgz";
+ sha1 = "6e015098ff51968b8a3c819001d5f2c89bc4b107";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."qs" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "qs" ];
+ };
+ by-spec."range-parser"."~1.0.0" =
+ self.by-version."range-parser"."1.0.2";
+ by-version."range-parser"."1.0.2" = lib.makeOverridable self.buildNodePackage {
+ name = "node-range-parser-1.0.2";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/range-parser/-/range-parser-1.0.2.tgz";
+ name = "range-parser-1.0.2.tgz";
+ sha1 = "06a12a42e5131ba8e457cd892044867f2344e549";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."range-parser" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "range-parser" ];
+ };
+ by-spec."range-parser"."~1.0.2" =
+ self.by-version."range-parser"."1.0.2";
+ by-spec."raw-body"."1.3.0" =
+ self.by-version."raw-body"."1.3.0";
+ by-version."raw-body"."1.3.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-raw-body-1.3.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/raw-body/-/raw-body-1.3.0.tgz";
+ name = "raw-body-1.3.0.tgz";
+ sha1 = "978230a156a5548f42eef14de22d0f4f610083d1";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."raw-body" or []);
+ deps = [
+ self.by-version."bytes"."1.0.0"
+ self.by-version."iconv-lite"."0.4.4"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "raw-body" ];
+ };
+ by-spec."request"."~2.34.0" =
+ self.by-version."request"."2.34.0";
+ by-version."request"."2.34.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-request-2.34.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/request/-/request-2.34.0.tgz";
+ name = "request-2.34.0.tgz";
+ sha1 = "b5d8b9526add4a2d4629f4d417124573996445ae";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."request" or []);
+ deps = [
+ self.by-version."qs"."0.6.6"
+ self.by-version."json-stringify-safe"."5.0.0"
+ self.by-version."forever-agent"."0.5.2"
+ self.by-version."node-uuid"."1.4.1"
+ self.by-version."mime"."1.2.11"
+ self.by-version."tough-cookie"."0.12.1"
+ self.by-version."form-data"."0.1.4"
+ self.by-version."tunnel-agent"."0.3.0"
+ self.by-version."http-signature"."0.10.0"
+ self.by-version."oauth-sign"."0.3.0"
+ self.by-version."hawk"."1.0.0"
+ self.by-version."aws-sign2"."0.5.0"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "request" ];
+ };
+ "request" = self.by-version."request"."2.34.0";
+ by-spec."rimraf"."2" =
+ self.by-version."rimraf"."2.2.8";
+ by-version."rimraf"."2.2.8" = lib.makeOverridable self.buildNodePackage {
+ name = "rimraf-2.2.8";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz";
+ name = "rimraf-2.2.8.tgz";
+ sha1 = "e439be2aaee327321952730f99a8929e4fc50582";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."rimraf" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "rimraf" ];
+ };
+ by-spec."send"."0.9.1" =
+ self.by-version."send"."0.9.1";
+ by-version."send"."0.9.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-send-0.9.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/send/-/send-0.9.1.tgz";
+ name = "send-0.9.1.tgz";
+ sha1 = "d93689f7c9ce36bd32f8ee572bb60bda032edc23";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."send" or []);
+ deps = [
+ self.by-version."debug"."2.0.0"
+ self.by-version."depd"."0.4.4"
+ self.by-version."destroy"."1.0.3"
+ self.by-version."escape-html"."1.0.1"
+ self.by-version."etag"."1.3.0"
+ self.by-version."fresh"."0.2.4"
+ self.by-version."mime"."1.2.11"
+ self.by-version."ms"."0.6.2"
+ self.by-version."on-finished"."2.1.0"
+ self.by-version."range-parser"."1.0.2"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "send" ];
+ };
+ by-spec."serve-static"."~1.6.1" =
+ self.by-version."serve-static"."1.6.1";
+ by-version."serve-static"."1.6.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-serve-static-1.6.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/serve-static/-/serve-static-1.6.1.tgz";
+ name = "serve-static-1.6.1.tgz";
+ sha1 = "2f257563afbe931d28cee4aa3dfeddc975a87193";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."serve-static" or []);
+ deps = [
+ self.by-version."escape-html"."1.0.1"
+ self.by-version."parseurl"."1.3.0"
+ self.by-version."send"."0.9.1"
+ self.by-version."utils-merge"."1.0.0"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "serve-static" ];
+ };
+ by-spec."sntp"."0.2.x" =
+ self.by-version."sntp"."0.2.4";
+ by-version."sntp"."0.2.4" = lib.makeOverridable self.buildNodePackage {
+ name = "node-sntp-0.2.4";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz";
+ name = "sntp-0.2.4.tgz";
+ sha1 = "fb885f18b0f3aad189f824862536bceeec750900";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."sntp" or []);
+ deps = [
+ self.by-version."hoek"."0.9.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "sntp" ];
+ };
+ by-spec."tar"."~0.1.19" =
+ self.by-version."tar"."0.1.20";
+ by-version."tar"."0.1.20" = lib.makeOverridable self.buildNodePackage {
+ name = "node-tar-0.1.20";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/tar/-/tar-0.1.20.tgz";
+ name = "tar-0.1.20.tgz";
+ sha1 = "42940bae5b5f22c74483699126f9f3f27449cb13";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."tar" or []);
+ deps = [
+ self.by-version."block-stream"."0.0.7"
+ self.by-version."fstream"."0.1.31"
+ self.by-version."inherits"."2.0.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "tar" ];
+ };
+ "tar" = self.by-version."tar"."0.1.20";
+ by-spec."tinycolor"."0.x" =
+ self.by-version."tinycolor"."0.0.1";
+ by-version."tinycolor"."0.0.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-tinycolor-0.0.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/tinycolor/-/tinycolor-0.0.1.tgz";
+ name = "tinycolor-0.0.1.tgz";
+ sha1 = "320b5a52d83abb5978d81a3e887d4aefb15a6164";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."tinycolor" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "tinycolor" ];
+ };
+ by-spec."tough-cookie".">=0.12.0" =
+ self.by-version."tough-cookie"."0.12.1";
+ by-version."tough-cookie"."0.12.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-tough-cookie-0.12.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/tough-cookie/-/tough-cookie-0.12.1.tgz";
+ name = "tough-cookie-0.12.1.tgz";
+ sha1 = "8220c7e21abd5b13d96804254bd5a81ebf2c7d62";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."tough-cookie" or []);
+ deps = [
+ self.by-version."punycode"."1.3.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "tough-cookie" ];
+ };
+ by-spec."tunnel-agent"."~0.3.0" =
+ self.by-version."tunnel-agent"."0.3.0";
+ by-version."tunnel-agent"."0.3.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-tunnel-agent-0.3.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz";
+ name = "tunnel-agent-0.3.0.tgz";
+ sha1 = "ad681b68f5321ad2827c4cfb1b7d5df2cfe942ee";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."tunnel-agent" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "tunnel-agent" ];
+ };
+ by-spec."type-is"."~1.5.1" =
+ self.by-version."type-is"."1.5.1";
+ by-version."type-is"."1.5.1" = lib.makeOverridable self.buildNodePackage {
+ name = "node-type-is-1.5.1";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/type-is/-/type-is-1.5.1.tgz";
+ name = "type-is-1.5.1.tgz";
+ sha1 = "5c1e62d874f79199fb16b34d16972dba376ccbed";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."type-is" or []);
+ deps = [
+ self.by-version."media-typer"."0.3.0"
+ self.by-version."mime-types"."2.0.1"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "type-is" ];
+ };
+ by-spec."utils-merge"."1.0.0" =
+ self.by-version."utils-merge"."1.0.0";
+ by-version."utils-merge"."1.0.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-utils-merge-1.0.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz";
+ name = "utils-merge-1.0.0.tgz";
+ sha1 = "0294fb922bb9375153541c4f7096231f287c8af8";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."utils-merge" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "utils-merge" ];
+ };
+ by-spec."vary"."~1.0.0" =
+ self.by-version."vary"."1.0.0";
+ by-version."vary"."1.0.0" = lib.makeOverridable self.buildNodePackage {
+ name = "node-vary-1.0.0";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/vary/-/vary-1.0.0.tgz";
+ name = "vary-1.0.0.tgz";
+ sha1 = "c5e76cec20d3820d8f2a96e7bee38731c34da1e7";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."vary" or []);
+ deps = [
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "vary" ];
+ };
+ by-spec."ws"."~0.4.32" =
+ self.by-version."ws"."0.4.32";
+ by-version."ws"."0.4.32" = lib.makeOverridable self.buildNodePackage {
+ name = "ws-0.4.32";
+ src = [
+ (fetchurl {
+ url = "http://registry.npmjs.org/ws/-/ws-0.4.32.tgz";
+ name = "ws-0.4.32.tgz";
+ sha1 = "787a6154414f3c99ed83c5772153b20feb0cec32";
+ })
+ ];
+ buildInputs =
+ (self.nativeDeps."ws" or []);
+ deps = [
+ self.by-version."commander"."2.1.0"
+ self.by-version."nan"."1.0.0"
+ self.by-version."tinycolor"."0.0.1"
+ self.by-version."options"."0.0.5"
+ ];
+ peerDependencies = [
+ ];
+ passthru.names = [ "ws" ];
+ };
+ "ws" = self.by-version."ws"."0.4.32";
+}
diff --git a/pkgs/applications/editors/zile/default.nix b/pkgs/applications/editors/zile/default.nix
index 4166bc1e9e3..48839246600 100644
--- a/pkgs/applications/editors/zile/default.nix
+++ b/pkgs/applications/editors/zile/default.nix
@@ -1,14 +1,14 @@
-{ fetchurl, stdenv, ncurses, boehmgc, perl, help2man }:
+{ fetchurl, stdenv, pkgconfig, ncurses, boehmgc, perl, help2man }:
stdenv.mkDerivation rec {
- name = "zile-2.4.9";
+ name = "zile-2.4.11";
src = fetchurl {
url = "mirror://gnu/zile/${name}.tar.gz";
- sha256 = "0j801c28ypm924rw3lqyb6khxyslg6ycrv16wmmwcam0mk3mj6f7";
+ sha256 = "1k593y1xzvlj52q0gyhcx2lllws4sg84b8r9pcginjb1vjypplhz";
};
- buildInputs = [ ncurses boehmgc ];
+ buildInputs = [ pkgconfig ncurses boehmgc ];
nativeBuildInputs = [ help2man perl ];
# `help2man' wants to run Zile, which fails when cross-compiling.
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
# XXX: Work around cross-compilation-unfriendly `gl_FUNC_FSTATAT' macro.
preConfigure = "export gl_cv_func_fstatat_zero_flag=yes";
- meta = {
+ meta = with stdenv.lib; {
description = "Lightweight Emacs clone";
longDescription = ''
@@ -45,8 +45,10 @@ stdenv.mkDerivation rec {
homepage = http://www.gnu.org/software/zile/;
- license = "GPLv3+";
+ license = licenses.gpl3Plus;
- maintainers = [ ];
+ maintainers = with maintainers; [ pSub ];
+
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/misc/qgis/default.nix b/pkgs/applications/gis/qgis/default.nix
similarity index 69%
rename from pkgs/applications/misc/qgis/default.nix
rename to pkgs/applications/gis/qgis/default.nix
index d6711c82968..82f1bc382d7 100644
--- a/pkgs/applications/misc/qgis/default.nix
+++ b/pkgs/applications/gis/qgis/default.nix
@@ -1,15 +1,16 @@
{ stdenv, fetchurl, gdal, cmake, qt4, flex, bison, proj, geos, x11, sqlite, gsl,
- pyqt4, qwt, fcgi, python, libspatialindex, libspatialite }:
+ pyqt4, qwt, fcgi, python, libspatialindex, libspatialite, sip }:
stdenv.mkDerivation rec {
- name = "qgis-1.8.0";
+ name = "qgis-2.4.0";
- buildInputs = [ gdal qt4 flex bison proj geos x11 sqlite gsl pyqt4 qwt
+ buildInputs = [ gdal qt4 flex bison proj geos x11 sqlite gsl pyqt4 sip qwt
fcgi libspatialindex libspatialite ];
nativeBuildInputs = [ cmake python ];
- enableParallelBuilding = true;
+ # fatal error: ui_qgsdelimitedtextsourceselectbase.h: No such file or directory
+ #enableParallelBuilding = true;
# To handle the lack of 'local' RPATH; required, as they call one of
# their built binaries requiring their libs, in the build process.
@@ -19,13 +20,15 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "http://qgis.org/downloads/${name}.tar.bz2";
- sha256 = "1aq32ch61bqsvh39lmrxah1fmh18cd3nqyi1l0sn6ssa3kwf82vh";
+ sha256 = "711b7d81ddff45b083a21f05c8aa5093a6a38a0ee42dfcc873234fcef1fcdd76";
+
+
};
meta = {
description = "User friendly Open Source Geographic Information System";
homepage = http://www.qgis.org;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
platforms = with stdenv.lib.platforms; linux;
maintainers = with stdenv.lib.maintainers; [viric];
};
diff --git a/pkgs/applications/gis/saga/default.nix b/pkgs/applications/gis/saga/default.nix
new file mode 100644
index 00000000000..a990e19dbc3
--- /dev/null
+++ b/pkgs/applications/gis/saga/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, gdal, wxGTK30, proj, libiodbc, lzma, jasper,
+ libharu, opencv, vigra, postgresql }:
+
+stdenv.mkDerivation rec {
+ name = "saga-2.1.2";
+
+ buildInputs = [ gdal wxGTK30 proj libharu opencv vigra postgresql libiodbc lzma jasper ];
+
+ enableParallelBuilding = true;
+
+ src = fetchurl {
+ url = "http://sourceforge.net/projects/saga-gis/files/SAGA%20-%202.1/SAGA%202.1.2/saga_2.1.2.tar.gz";
+ sha256 = "51885446f717191210c4b13f0c35a1c5194c9d696d4f9b8f594bc1014809b2f5";
+ };
+
+ meta = {
+ description = "SAGA - System for Automated Geoscientific Analyses";
+ homepage = http://www.saga-gis.org;
+ license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = [ stdenv.lib.maintainers.michelk ];
+ platforms = with stdenv.lib.platforms; linux;
+ broken = true;
+ };
+}
diff --git a/pkgs/applications/graphics/ImageMagick/default.nix b/pkgs/applications/graphics/ImageMagick/default.nix
index 64b1f5b3b2c..e75ce535f7f 100644
--- a/pkgs/applications/graphics/ImageMagick/default.nix
+++ b/pkgs/applications/graphics/ImageMagick/default.nix
@@ -18,14 +18,14 @@
}:
let
- version = "6.8.9-0";
+ version = "6.8.9-8";
in
stdenv.mkDerivation rec {
name = "ImageMagick-${version}";
src = fetchurl {
url = "mirror://imagemagick/${name}.tar.xz";
- sha256 = "1lapn2798fkc2wn81slpms5p21kq4dsyg45khsk7n8p69cvrmw2b";
+ sha256 = "1c792hbwi308lm9xkml319xaa4w3bz6hwy6i92jwrm7kqr4h8di7";
};
enableParallelBuilding = true;
diff --git a/pkgs/applications/graphics/alchemy/default.nix b/pkgs/applications/graphics/alchemy/default.nix
index ee8543f7039..263c411a8db 100644
--- a/pkgs/applications/graphics/alchemy/default.nix
+++ b/pkgs/applications/graphics/alchemy/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
};
installPhase = ''
- ensureDir $out/bin $out/share
+ mkdir -p $out/bin $out/share
cp -a . $out/share/alchemy
cat >> $out/bin/alchemy << EOF
#!/bin/sh
diff --git a/pkgs/applications/graphics/autopanosiftc/default.nix b/pkgs/applications/graphics/autopanosiftc/default.nix
index be3cfc5935c..6d26dafae62 100644
--- a/pkgs/applications/graphics/autopanosiftc/default.nix
+++ b/pkgs/applications/graphics/autopanosiftc/default.nix
@@ -13,6 +13,6 @@ stdenv.mkDerivation {
meta = {
homepage = http://hugin.sourceforge.net/;
description = "Implementation in C of the autopano-sift algorithm for automatically stitching panoramas";
- license = "GPLv2";
+ license = stdenv.lib.licenses.gpl2;
};
}
diff --git a/pkgs/applications/graphics/comical/default.nix b/pkgs/applications/graphics/comical/default.nix
index 68910e67e25..2796a5535a0 100644
--- a/pkgs/applications/graphics/comical/default.nix
+++ b/pkgs/applications/graphics/comical/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Viewer of CBR and CBZ files, often used to store scanned comics";
homepage = http://comical.sourceforge.net/;
- license = "GPLv2+";
+ license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
diff --git a/pkgs/applications/graphics/dia/default.nix b/pkgs/applications/graphics/dia/default.nix
index da683888063..e498533d63d 100644
--- a/pkgs/applications/graphics/dia/default.nix
+++ b/pkgs/applications/graphics/dia/default.nix
@@ -7,8 +7,8 @@ stdenv.mkDerivation rec {
src = fetchurlGnome {
project = "dia";
- major = "0"; minor = "97"; patchlevel = "2"; extension = "xz";
- sha256 = "1qgawm7rrf4wd1yc0fp39ywv8gbz4ry1s16k00dzg5w6p67lfqd7";
+ major = "0"; minor = "97"; patchlevel = "3"; extension = "xz";
+ sha256 = "0d3x6w0l6fwd0l8xx06y1h56xf8ss31yzia3a6xr9y28xx44x492";
};
correctPersistence = fetchurl {
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
configureFlags = stdenv.lib.optionalString withGNOME "--enable-gnome";
- patches = [ ./glib-top-level-header.patch ];
+ patches = [ ];
# This file should normally require a gtk-update-icon-cache -q /usr/share/icons/hicolor command
# It have no reasons to exist in a redistribuable package
diff --git a/pkgs/applications/graphics/dia/glib-top-level-header.patch b/pkgs/applications/graphics/dia/glib-top-level-header.patch
deleted file mode 100644
index 80460ae9d72..00000000000
--- a/pkgs/applications/graphics/dia/glib-top-level-header.patch
+++ /dev/null
@@ -1,471 +0,0 @@
-diff -Naur dia-0.97.2-orig/app/app_procs.c dia-0.97.2/app/app_procs.c
---- dia-0.97.2-orig/app/app_procs.c 2011-03-20 07:18:13.000000000 -0400
-+++ dia-0.97.2/app/app_procs.c 2012-07-15 10:49:08.192726306 -0400
-@@ -50,7 +50,7 @@
- #include
- #include
-
--#include
-+#include
-
- #include "intl.h"
- #include "app_procs.h"
-diff -Naur dia-0.97.2-orig/app/dia-win-remote.c dia-0.97.2/app/dia-win-remote.c
---- dia-0.97.2-orig/app/dia-win-remote.c 2010-08-03 11:35:35.000000000 -0400
-+++ dia-0.97.2/app/dia-win-remote.c 2012-07-15 10:49:08.159726316 -0400
-@@ -35,7 +35,7 @@
- #include
- #include
- #include
--#include
-+#include
-
- /**
- * PROTOTYPES:
-diff -Naur dia-0.97.2-orig/app/filedlg.c dia-0.97.2/app/filedlg.c
---- dia-0.97.2-orig/app/filedlg.c 2009-11-07 12:13:53.000000000 -0500
-+++ dia-0.97.2/app/filedlg.c 2012-07-15 10:49:08.227726294 -0400
-@@ -28,7 +28,7 @@
- #include
- #endif
- #include
--#include
-+#include
-
- #undef GTK_DISABLE_DEPRECATED /* gtk_file_chooser_dialog_new_with_backend */
- #include
-diff -Naur dia-0.97.2-orig/app/load_save.c dia-0.97.2/app/load_save.c
---- dia-0.97.2-orig/app/load_save.c 2011-09-25 07:55:11.000000000 -0400
-+++ dia-0.97.2/app/load_save.c 2012-07-15 10:49:08.203726303 -0400
-@@ -30,7 +30,7 @@
- #include
-
- #include
--#include /* g_access() and friends */
-+#include /* g_access() and friends */
- #include
-
- #ifndef W_OK
-diff -Naur dia-0.97.2-orig/app/sheets_dialog_callbacks.c dia-0.97.2/app/sheets_dialog_callbacks.c
---- dia-0.97.2-orig/app/sheets_dialog_callbacks.c 2009-11-07 12:13:53.000000000 -0500
-+++ dia-0.97.2/app/sheets_dialog_callbacks.c 2012-07-15 10:49:08.201726302 -0400
-@@ -44,7 +44,7 @@
- #endif
- #endif
-
--#include
-+#include
- #include
-
- #undef GTK_DISABLE_DEPRECATED /* GtkOptionMenu */
-diff -Naur dia-0.97.2-orig/ChangeLog.pre-git dia-0.97.2/ChangeLog.pre-git
---- dia-0.97.2-orig/ChangeLog.pre-git 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/ChangeLog.pre-git 2012-07-15 10:49:08.384726247 -0400
-@@ -4137,7 +4137,7 @@
- plug-ins/vdx/vdx-export.c plug-ins/vdx/vdx-import.c
- plug-ins/wmf/wmf.cpp plug-ins/wpg/wpg.c
- plug-ins/xfig/xfig-export.c plug-ins/xfig/xfig-import.c
-- plug-ins/xslt/xslt.c : use to match GLib's filename
-+ plug-ins/xslt/xslt.c : use to match GLib's filename
- encoding to the io functions used, that is: g_open, g_fopen, g_stat,
- g_unlink, g_mkdir, g_rename (, g_access, g_lstat, g_remove, g_freopen,
- g_chdir, g_rmdir). Also replace gzopen() with gzdopen(g_open(), ...)
-@@ -5995,7 +5995,7 @@
- Also special case strings starting with \tex - i.e. dont escape them -
- to keep the use-case of direct tex input.
-
-- * lib/debug.c : #include not just
-+ * lib/debug.c : #include
-
-
- 2006-01-14 Hans Breuer
-@@ -6207,7 +6207,7 @@
- * lib/makefile.msc : build debug.obj
-
- * plug-ins/makefile.msc : building pgf in the right alphabetical order
-- * plug-ins/pgf/render_pgf.c : include
-+ * plug-ins/pgf/render_pgf.c : include
-
- 2005-12-08 Lars Clausen
-
-diff -Naur dia-0.97.2-orig/lib/debug.c dia-0.97.2/lib/debug.c
---- dia-0.97.2-orig/lib/debug.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/lib/debug.c 2012-07-15 10:49:06.813726730 -0400
-@@ -21,7 +21,7 @@
- #include
-
- #include
--#include
-+#include
- #include
-
- #include "debug.h"
-diff -Naur dia-0.97.2-orig/lib/dia_dirs.c dia-0.97.2/lib/dia_dirs.c
---- dia-0.97.2-orig/lib/dia_dirs.c 2009-11-07 12:13:53.000000000 -0500
-+++ dia-0.97.2/lib/dia_dirs.c 2012-07-15 10:49:06.740726750 -0400
-@@ -30,7 +30,7 @@
- #include
- #include
- #endif
--#include
-+#include
-
- /** Get the name of a subdirectory of our data directory.
- * This function does not create the subdirectory, just make the correct name.
-diff -Naur dia-0.97.2-orig/lib/dia_xml.c dia-0.97.2/lib/dia_xml.c
---- dia-0.97.2-orig/lib/dia_xml.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/lib/dia_xml.c 2012-07-15 10:49:06.770726743 -0400
-@@ -25,7 +25,7 @@
- #include
-
- #include
--#include
-+#include
-
- #include
- #include
-diff -Naur dia-0.97.2-orig/objects/custom/shape_typeinfo.c dia-0.97.2/objects/custom/shape_typeinfo.c
---- dia-0.97.2-orig/objects/custom/shape_typeinfo.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/objects/custom/shape_typeinfo.c 2012-07-15 10:49:06.639726783 -0400
-@@ -27,8 +27,8 @@
- #include "custom_util.h"
- #include
- #include
--#include
--#include
-+#include
-+#include
- #include
-
- /*
-diff -Naur dia-0.97.2-orig/objects/SISSI/sissi.c dia-0.97.2/objects/SISSI/sissi.c
---- dia-0.97.2-orig/objects/SISSI/sissi.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/objects/SISSI/sissi.c 2012-07-15 10:49:06.570726804 -0400
-@@ -42,7 +42,7 @@
- #include "dia_xml_libxml.h"
-
- #include
--#include
-+#include
-
- #define DEFAULT_WIDTH 1.0
- #define DEFAULT_HEIGHT 1.0
-diff -Naur dia-0.97.2-orig/objects/standard/image.c dia-0.97.2/objects/standard/image.c
---- dia-0.97.2-orig/objects/standard/image.c 2009-11-07 12:13:53.000000000 -0500
-+++ dia-0.97.2/objects/standard/image.c 2012-07-15 10:49:06.683726770 -0400
-@@ -25,7 +25,7 @@
- #ifdef HAVE_UNIST_H
- #include
- #endif
--#include
-+#include
-
- #include "intl.h"
- #include "message.h"
-diff -Naur dia-0.97.2-orig/plug-ins/cairo/diacairo.c dia-0.97.2/plug-ins/cairo/diacairo.c
---- dia-0.97.2-orig/plug-ins/cairo/diacairo.c 2009-11-07 12:13:53.000000000 -0500
-+++ dia-0.97.2/plug-ins/cairo/diacairo.c 2012-07-15 10:49:06.433726846 -0400
-@@ -28,7 +28,7 @@
- #include
- #define G_LOG_DOMAIN "DiaCairo"
- #include
--#include
-+#include
-
- /*
- * To me the following looks rather suspicious. Why do we need to compile
-diff -Naur dia-0.97.2-orig/plug-ins/cairo/diacairo-renderer.c dia-0.97.2/plug-ins/cairo/diacairo-renderer.c
---- dia-0.97.2-orig/plug-ins/cairo/diacairo-renderer.c 2011-01-07 06:54:21.000000000 -0500
-+++ dia-0.97.2/plug-ins/cairo/diacairo-renderer.c 2012-07-15 10:49:06.435726846 -0400
-@@ -28,7 +28,7 @@
- #include
- #define G_LOG_DOMAIN "DiaCairo"
- #include
--#include
-+#include
-
- #ifdef HAVE_PANGOCAIRO_H
- #include
-diff -Naur dia-0.97.2-orig/plug-ins/cgm/cgm.c dia-0.97.2/plug-ins/cgm/cgm.c
---- dia-0.97.2-orig/plug-ins/cgm/cgm.c 2009-12-27 11:22:38.000000000 -0500
-+++ dia-0.97.2/plug-ins/cgm/cgm.c 2012-07-15 10:49:06.425726846 -0400
-@@ -31,7 +31,7 @@
- #include
- #include
-
--#include
-+#include
-
- #include "intl.h"
- #include "message.h"
-diff -Naur dia-0.97.2-orig/plug-ins/drs/dia-render-script.c dia-0.97.2/plug-ins/drs/dia-render-script.c
---- dia-0.97.2-orig/plug-ins/drs/dia-render-script.c 2009-11-07 12:13:53.000000000 -0500
-+++ dia-0.97.2/plug-ins/drs/dia-render-script.c 2012-07-15 10:49:06.427726848 -0400
-@@ -54,7 +54,7 @@
-
- #define G_LOG_DOMAIN "DiaRenderScript"
- #include
--#include
-+#include
-
- #include "intl.h"
- #include "filter.h"
-diff -Naur dia-0.97.2-orig/plug-ins/dxf/dxf-export.c dia-0.97.2/plug-ins/dxf/dxf-export.c
---- dia-0.97.2-orig/plug-ins/dxf/dxf-export.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/plug-ins/dxf/dxf-export.c 2012-07-15 10:49:06.421726850 -0400
-@@ -29,7 +29,7 @@
- #include
- #include
- #include
--#include
-+#include
-
- #include "autocad_pal.h"
-
-diff -Naur dia-0.97.2-orig/plug-ins/dxf/dxf-import.c dia-0.97.2/plug-ins/dxf/dxf-import.c
---- dia-0.97.2-orig/plug-ins/dxf/dxf-import.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/plug-ins/dxf/dxf-import.c 2012-07-15 10:49:06.419726851 -0400
-@@ -30,7 +30,7 @@
- #include
- #include
- #include
--#include
-+#include
-
- #include "intl.h"
- #include "message.h"
-diff -Naur dia-0.97.2-orig/plug-ins/hpgl/hpgl.c dia-0.97.2/plug-ins/hpgl/hpgl.c
---- dia-0.97.2-orig/plug-ins/hpgl/hpgl.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/plug-ins/hpgl/hpgl.c 2012-07-15 10:49:06.487726830 -0400
-@@ -37,7 +37,7 @@
- #include
-
- #include
--#include
-+#include
-
- #include "intl.h"
- #include "message.h"
-diff -Naur dia-0.97.2-orig/plug-ins/libart/export_png.c dia-0.97.2/plug-ins/libart/export_png.c
---- dia-0.97.2-orig/plug-ins/libart/export_png.c 2011-07-03 06:56:08.000000000 -0400
-+++ dia-0.97.2/plug-ins/libart/export_png.c 2012-07-15 10:49:06.415726849 -0400
-@@ -29,7 +29,7 @@
- #include
- #include
-
--#include
-+#include
- #include
-
- #include "intl.h"
-diff -Naur dia-0.97.2-orig/plug-ins/metapost/render_metapost.c dia-0.97.2/plug-ins/metapost/render_metapost.c
---- dia-0.97.2-orig/plug-ins/metapost/render_metapost.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/plug-ins/metapost/render_metapost.c 2012-07-15 10:49:06.396726857 -0400
-@@ -43,7 +43,7 @@
- #endif
- #include
-
--#include
-+#include
-
- #include "intl.h"
- #include "render_metapost.h"
-diff -Naur dia-0.97.2-orig/plug-ins/pgf/render_pgf.c dia-0.97.2/plug-ins/pgf/render_pgf.c
---- dia-0.97.2-orig/plug-ins/pgf/render_pgf.c 2011-01-07 07:11:34.000000000 -0500
-+++ dia-0.97.2/plug-ins/pgf/render_pgf.c 2012-07-15 10:49:06.445726842 -0400
-@@ -61,8 +61,8 @@
- #endif
- #include
-
--#include
--#include
-+#include
-+#include
-
- #include "intl.h"
- #include "render_pgf.h"
-diff -Naur dia-0.97.2-orig/plug-ins/postscript/paginate_psprint.c dia-0.97.2/plug-ins/postscript/paginate_psprint.c
---- dia-0.97.2-orig/plug-ins/postscript/paginate_psprint.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/plug-ins/postscript/paginate_psprint.c 2012-07-15 10:49:06.451726838 -0400
-@@ -31,7 +31,7 @@
- #include
- #include
-
--#include
-+#include
-
- #include "intl.h"
- #include "message.h"
-diff -Naur dia-0.97.2-orig/plug-ins/postscript/render_eps.c dia-0.97.2/plug-ins/postscript/render_eps.c
---- dia-0.97.2-orig/plug-ins/postscript/render_eps.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/plug-ins/postscript/render_eps.c 2012-07-15 10:49:06.451726838 -0400
-@@ -55,7 +55,7 @@
- #include
- #include
-
--#include
-+#include
-
- #include "intl.h"
- #include "render_eps.h"
-diff -Naur dia-0.97.2-orig/plug-ins/pstricks/render_pstricks.c dia-0.97.2/plug-ins/pstricks/render_pstricks.c
---- dia-0.97.2-orig/plug-ins/pstricks/render_pstricks.c 2011-01-07 07:11:34.000000000 -0500
-+++ dia-0.97.2/plug-ins/pstricks/render_pstricks.c 2012-07-15 10:49:06.410726853 -0400
-@@ -50,7 +50,7 @@
- #endif
- #include
-
--#include
-+#include
-
- #include "intl.h"
- #include "render_pstricks.h"
-diff -Naur dia-0.97.2-orig/plug-ins/python/pydia-render.c dia-0.97.2/plug-ins/python/pydia-render.c
---- dia-0.97.2-orig/plug-ins/python/pydia-render.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/plug-ins/python/pydia-render.c 2012-07-15 10:49:06.503726822 -0400
-@@ -21,7 +21,7 @@
-
- #include
- #include
--#include
-+#include
-
- #include
-
-diff -Naur dia-0.97.2-orig/plug-ins/shape/shape-export.c dia-0.97.2/plug-ins/shape/shape-export.c
---- dia-0.97.2-orig/plug-ins/shape/shape-export.c 2009-11-08 06:14:56.000000000 -0500
-+++ dia-0.97.2/plug-ins/shape/shape-export.c 2012-07-15 10:49:06.489726827 -0400
-@@ -40,7 +40,7 @@
- #include
- #endif
-
--#include
-+#include
-
- /* the dots per centimetre to render this diagram at */
- /* this matches the setting `100%' setting in dia. */
-diff -Naur dia-0.97.2-orig/plug-ins/svg/render_svg.c dia-0.97.2/plug-ins/svg/render_svg.c
---- dia-0.97.2-orig/plug-ins/svg/render_svg.c 2011-12-17 11:30:38.000000000 -0500
-+++ dia-0.97.2/plug-ins/svg/render_svg.c 2012-07-15 10:49:06.392726859 -0400
-@@ -30,7 +30,7 @@
- #endif
-
- #include
--#include
-+#include
-
- #include
- #include
-diff -Naur dia-0.97.2-orig/plug-ins/vdx/vdx-export.c dia-0.97.2/plug-ins/vdx/vdx-export.c
---- dia-0.97.2-orig/plug-ins/vdx/vdx-export.c 2009-12-27 11:22:38.000000000 -0500
-+++ dia-0.97.2/plug-ins/vdx/vdx-export.c 2012-07-15 10:55:17.066579728 -0400
-@@ -32,11 +32,12 @@
-
- #include
- #include
-+#include
- #include
- #include
- #include
- #include
--#include
-+#include
-
- #include "intl.h"
- #include "message.h"
-diff -Naur dia-0.97.2-orig/plug-ins/vdx/vdx-import.c dia-0.97.2/plug-ins/vdx/vdx-import.c
---- dia-0.97.2-orig/plug-ins/vdx/vdx-import.c 2009-12-27 11:22:38.000000000 -0500
-+++ dia-0.97.2/plug-ins/vdx/vdx-import.c 2012-07-15 10:49:06.466726836 -0400
-@@ -28,7 +28,7 @@
- #include
- #include
- #include
--#include
-+#include
- #include
- #include
- #include
-diff -Naur dia-0.97.2-orig/plug-ins/wmf/wmf.cpp dia-0.97.2/plug-ins/wmf/wmf.cpp
---- dia-0.97.2-orig/plug-ins/wmf/wmf.cpp 2011-03-13 09:07:48.000000000 -0400
-+++ dia-0.97.2/plug-ins/wmf/wmf.cpp 2012-07-15 10:49:06.482726831 -0400
-@@ -25,7 +25,7 @@
- #include
- #include
- #include
--#include
-+#include
-
- #include "intl.h"
- #include "message.h"
-diff -Naur dia-0.97.2-orig/plug-ins/wpg/wpg.c dia-0.97.2/plug-ins/wpg/wpg.c
---- dia-0.97.2-orig/plug-ins/wpg/wpg.c 2009-11-07 09:28:34.000000000 -0500
-+++ dia-0.97.2/plug-ins/wpg/wpg.c 2012-07-15 10:49:06.406726855 -0400
-@@ -40,7 +40,7 @@
- #include
-
- #include
--#include
-+#include
-
- #include "intl.h"
- #include "message.h"
-diff -Naur dia-0.97.2-orig/plug-ins/xfig/xfig-export.c dia-0.97.2/plug-ins/xfig/xfig-export.c
---- dia-0.97.2-orig/plug-ins/xfig/xfig-export.c 2011-12-17 11:30:38.000000000 -0500
-+++ dia-0.97.2/plug-ins/xfig/xfig-export.c 2012-07-15 10:49:06.400726856 -0400
-@@ -16,7 +16,7 @@
- #include
-
- #include
--#include
-+#include
-
- #include "intl.h"
- #include "message.h"
-diff -Naur dia-0.97.2-orig/plug-ins/xfig/xfig-import.c dia-0.97.2/plug-ins/xfig/xfig-import.c
---- dia-0.97.2-orig/plug-ins/xfig/xfig-import.c 2009-11-07 12:13:53.000000000 -0500
-+++ dia-0.97.2/plug-ins/xfig/xfig-import.c 2012-07-15 10:49:06.402726853 -0400
-@@ -40,7 +40,7 @@
- #include
-
- #include
--#include
-+#include
-
- #include "intl.h"
- #include "message.h"
-diff -Naur dia-0.97.2-orig/plug-ins/xslt/xslt.c dia-0.97.2/plug-ins/xslt/xslt.c
---- dia-0.97.2-orig/plug-ins/xslt/xslt.c 2009-11-07 12:13:53.000000000 -0500
-+++ dia-0.97.2/plug-ins/xslt/xslt.c 2012-07-15 10:49:06.440726844 -0400
-@@ -27,7 +27,7 @@
- #include
- #include
-
--#include
-+#include
-
- #include "filter.h"
- #include "intl.h"
-diff -Naur dia-0.97.2-orig/tests/test-boundingbox.c dia-0.97.2/tests/test-boundingbox.c
---- dia-0.97.2-orig/tests/test-boundingbox.c 2009-11-07 09:28:35.000000000 -0500
-+++ dia-0.97.2/tests/test-boundingbox.c 2012-07-15 10:49:06.986726677 -0400
-@@ -29,7 +29,7 @@
- #include
-
- #if GLIB_CHECK_VERSION(2,16,0)
--#include
-+#include
- #endif
- #include "dialib.h"
-
-diff -Naur dia-0.97.2-orig/tests/test-objects.c dia-0.97.2/tests/test-objects.c
---- dia-0.97.2-orig/tests/test-objects.c 2009-11-07 09:28:35.000000000 -0500
-+++ dia-0.97.2/tests/test-objects.c 2012-07-15 10:49:06.985726677 -0400
-@@ -29,7 +29,7 @@
- #include
-
- #if GLIB_CHECK_VERSION(2,16,0)
--#include
-+#include
- #endif
-
- #include "object.h"
diff --git a/pkgs/applications/graphics/djview/default.nix b/pkgs/applications/graphics/djview/default.nix
index f832513a824..4ded807cb29 100644
--- a/pkgs/applications/graphics/djview/default.nix
+++ b/pkgs/applications/graphics/djview/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
meta = {
homepage = http://djvu.sourceforge.net/djview4.html;
description = "A new portable DjVu viewer and browser plugin";
- license = "GPL2";
+ license = stdenv.lib.licenses.gpl2;
inherit (qt4.meta) platforms;
maintainers = [ stdenv.lib.maintainers.urkud ];
};
diff --git a/pkgs/applications/graphics/f-spot/default.nix b/pkgs/applications/graphics/f-spot/default.nix
index 8ecfc0df162..291f0adce58 100644
--- a/pkgs/applications/graphics/f-spot/default.nix
+++ b/pkgs/applications/graphics/f-spot/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
src = fetchurl {
url = http://tarballs.nixos.org/f-spot-0.0.10.tar.bz2;
- md5 = "19cc6e067ccc261b0502ff6189b79832";
+ sha256 = "1hgls6hzvxsnk09j9y6hq10qxsc92i864mdg3gk2cimbkbr0mh8b";
};
patches = [./dllmap.patch];
diff --git a/pkgs/applications/graphics/freecad/cmake.patch b/pkgs/applications/graphics/freecad/cmake.patch
deleted file mode 100644
index 62efaf1e29d..00000000000
--- a/pkgs/applications/graphics/freecad/cmake.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff -urN freecad-0.13.1830.old/cMake/FreeCadMacros.cmake freecad-0.13.1830/cMake/FreeCadMacros.cmake
---- freecad-0.13.1830.old/cMake/FreeCadMacros.cmake 2013-02-02 18:09:17.000000000 +0100
-+++ freecad-0.13.1830/cMake/FreeCadMacros.cmake 2014-04-20 10:52:17.293599913 +0200
-@@ -201,7 +201,7 @@
- #endmacro(fc_add_resources)
-
- MACRO (fc_add_resources outfiles )
-- QT4_EXTRACT_OPTIONS(rcc_files rcc_options ${ARGN})
-+ QT4_EXTRACT_OPTIONS(rcc_files rcc_options rcc_target ${ARGN})
-
- FOREACH (it ${rcc_files})
- GET_FILENAME_COMPONENT(outfilename ${it} NAME_WE)
-diff -urN freecad-0.13.1830.old/CMakeLists.txt freecad-0.13.1830/CMakeLists.txt
---- freecad-0.13.1830.old/CMakeLists.txt 2013-02-02 18:09:17.000000000 +0100
-+++ freecad-0.13.1830/CMakeLists.txt 2014-04-20 10:28:41.782536753 +0200
-@@ -314,14 +314,14 @@
- macro(fc_wrap_cpp outfiles )
- # get include dirs
- QT4_GET_MOC_FLAGS(moc_flags)
-- QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN})
-+ QT4_EXTRACT_OPTIONS(moc_files moc_options moc_target ${ARGN})
- # fixes bug 0000585: bug with boost 1.48
- SET(moc_options ${moc_options} -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
-
- foreach(it ${moc_files})
- get_filename_component(it ${it} ABSOLUTE)
- QT4_MAKE_OUTPUT_FILE(${it} moc_ cpp outfile)
-- QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}")
-+ QT4_CREATE_MOC_COMMAND(${it} ${outfile} "${moc_flags}" "${moc_options}" "")
- set(${outfiles} ${${outfiles}} ${outfile})
- add_file_dependencies(${it} ${outfile})
- endforeach(it)
diff --git a/pkgs/applications/graphics/freecad/default.nix b/pkgs/applications/graphics/freecad/default.nix
index 770a7ee8212..0235f892b8d 100644
--- a/pkgs/applications/graphics/freecad/default.nix
+++ b/pkgs/applications/graphics/freecad/default.nix
@@ -1,19 +1,19 @@
{ stdenv, fetchurl, cmake, coin3d, xercesc, ode, eigen, qt4, opencascade, gts
-, boost, zlib, python, swig, gfortran, soqt, libf2c , pyqt4, makeWrapper
-, matplotlib, pycollada }:
+, boost, zlib, python, swig, gfortran, soqt, libf2c, makeWrapper
+, matplotlib, pycollada, pyside, pysideShiboken }:
stdenv.mkDerivation rec {
name = "freecad-${version}";
- version = "0.13.1830";
+ version = "0.14.3702";
src = fetchurl {
url = "mirror://sourceforge/free-cad/${name}.tar.gz";
- sha256 = "04rgww5y32asn4sx5j4wh79ggvb479pq56xfcfj6gkg44mid23jm";
+ sha256 = "1jcx7d3mp2wxkd20qdvr4vlf7h5wb0jgab9dl63sicdz88swy97f";
};
buildInputs = [ cmake coin3d xercesc ode eigen qt4 opencascade gts boost
- zlib python swig gfortran soqt libf2c pyqt4 makeWrapper matplotlib
- pycollada
+ boost.lib zlib python swig gfortran soqt libf2c makeWrapper matplotlib
+ pycollada pyside pysideShiboken
];
enableParallelBuilding = true;
@@ -28,13 +28,13 @@ stdenv.mkDerivation rec {
--set COIN_GL_NO_CURRENT_CONTEXT_CHECK 1
'';
- patches = [ ./pythonpath.patch ./cmake.patch ];
+ patches = [ ./pythonpath.patch ];
- meta = {
- homepage = http://free-cad.sourceforge.net/;
- license = [ "GPLv2+" "LGPLv2+" ];
+ meta = with stdenv.lib; {
description = "General purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler";
- maintainers = with stdenv.lib.maintainers; [viric];
- platforms = with stdenv.lib.platforms; linux;
+ homepage = http://www.freecadweb.org/;
+ license = licenses.lgpl2Plus;
+ maintainers = [ maintainers.viric ];
+ platforms = platforms.linux;
};
}
diff --git a/pkgs/applications/graphics/gcolor2/default.nix b/pkgs/applications/graphics/gcolor2/default.nix
new file mode 100644
index 00000000000..0af750ec989
--- /dev/null
+++ b/pkgs/applications/graphics/gcolor2/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchurl, gtk, perl, perlXMLParser, pkgconfig } :
+
+let version = "0.4"; in
+stdenv.mkDerivation {
+ name = "gcolor2-${version}";
+ arch = if stdenv.system == "x86_64-linux" then "amd64" else "386";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/project/gcolor2/gcolor2/${version}/gcolor2-${version}.tar.bz2";
+ sha1 = "e410a52dcff3d5c6c3d448b68a026d04ccd744be";
+
+ };
+
+ preConfigure = ''
+ sed -i 's/\[:space:\]/[&]/g' configure
+ '';
+
+ # from https://github.com/PhantomX/slackbuilds/tree/master/gcolor2/patches
+ patches = if stdenv.system == "x86_64-linux" then
+ [ ./gcolor2-amd64.patch ] else
+ [ ];
+
+buildInputs = [ gtk perl perlXMLParser pkgconfig ];
+
+ meta = {
+ description = "Simple GTK+2 color selector";
+ homepage = http://gcolor2.sourceforge.net/;
+ license = stdenv.lib.licenses.gpl2Plus;
+ maintainers = with stdenv.lib.maintainers; [ notthemessiah ];
+ };
+}
diff --git a/pkgs/applications/graphics/gcolor2/gcolor2-amd64.patch b/pkgs/applications/graphics/gcolor2/gcolor2-amd64.patch
new file mode 100644
index 00000000000..cd06a8315f9
--- /dev/null
+++ b/pkgs/applications/graphics/gcolor2/gcolor2-amd64.patch
@@ -0,0 +1,46 @@
+diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN gcolor2-0.4.orig/src/callbacks.c gcolor2-0.4/src/callbacks.c
+--- gcolor2-0.4.orig/src/callbacks.c 2005-07-12 14:06:12.000000000 -0400
++++ gcolor2-0.4/src/callbacks.c 2007-02-17 19:19:38.000000000 -0500
+@@ -4,6 +4,9 @@
+
+ #include
+ #include
++#include
++#include
++#include
+
+ #include "callbacks.h"
+ #include "interface.h"
+@@ -172,6 +175,9 @@ void on_copy_color_to_clipboard_activate
+ gtk_clipboard_set_text (cb, hex, strlen (hex));
+ }
+
++void add_rgb_file (gchar *filename, gchar *type);
++gchar* get_system_file (void);
++
+ void on_show_system_colors_activate (GtkMenuItem *menuitem, gpointer user_data)
+ {
+ if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)))
+@@ -266,6 +272,8 @@ void on_save_button_clicked (GtkButton *
+ gtk_widget_destroy (savedialog);
+ }
+
++void add_list_color (gchar *spec, gchar *name, gchar *type, gboolean is_new_color);
++
+ void add_color_to_treeview ()
+ {
+ GtkTreeView *treeview;
+diff --exclude-from=/home/dang/bin/scripts/diffrc -up -ruN gcolor2-0.4.orig/src/main.c gcolor2-0.4/src/main.c
+--- gcolor2-0.4.orig/src/main.c 2005-07-11 10:55:49.000000000 -0400
++++ gcolor2-0.4/src/main.c 2007-02-17 19:18:23.000000000 -0500
+@@ -4,6 +4,10 @@
+
+ #include
+ #include
++#include
++#include
++#include
++#include
+
+ #include "interface.h"
+ #include "support.h"
diff --git a/pkgs/applications/graphics/geeqie/default.nix b/pkgs/applications/graphics/geeqie/default.nix
index 44ca66ac5b9..e914186ac81 100644
--- a/pkgs/applications/graphics/geeqie/default.nix
+++ b/pkgs/applications/graphics/geeqie/default.nix
@@ -1,26 +1,23 @@
-{ stdenv, fetchurl, pkgconfig, gtk, libpng, exiv2, lcms
-, intltool, gettext, libchamplain_0_6, fbida }:
+{ stdenv, fetchgit, pkgconfig, autoconf, automake, gtk, libpng, exiv2, lcms
+, intltool, gettext, libchamplain, fbida }:
stdenv.mkDerivation rec {
- name = "geeqie-1.1";
+ name = "geeqie-${version}";
+ version = "1.2";
- src = fetchurl {
- url = "mirror://sourceforge/geeqie/${name}.tar.gz";
- sha256 = "1kzy39z9505xkayyx7rjj2wda76xy3ch1s5z35zn8yli54ffhi2m";
+ src = fetchgit {
+ url = "git://gitorious.org/geeqie/geeqie.git";
+ rev = "refs/tags/v${version}";
+ sha256 = "1h9w0jrcqcp5jjgmks5pvpppnfxhcd1s3vqlyb3qyil2wfk8n8wp";
};
- preConfigure =
- # XXX: Trick to have Geeqie use the version we have.
- '' sed -i "configure" \
- -e 's/champlain-0.4/champlain-0.6/g ;
- s/champlain-gtk-0.4/champlain-gtk-0.6/g'
- '';
+ preConfigure = "./autogen.sh";
configureFlags = [ "--enable-gps" ];
buildInputs =
- [ pkgconfig gtk libpng exiv2 lcms intltool gettext
- libchamplain_0_6
+ [ pkgconfig autoconf automake gtk libpng exiv2 lcms intltool gettext
+ libchamplain
];
postInstall =
@@ -31,8 +28,8 @@ stdenv.mkDerivation rec {
-e '1 a export PATH=${exiv2}/bin:${fbida}/bin:$PATH'
'';
- meta = {
- description = "Geeqie, a lightweight GTK+ based image viewer";
+ meta = with stdenv.lib; {
+ description = "Lightweight GTK+ based image viewer";
longDescription =
''
@@ -45,11 +42,11 @@ stdenv.mkDerivation rec {
initially based on GQview.
'';
- license = "GPLv2+";
+ license = licenses.gpl2Plus;
homepage = http://geeqie.sourceforge.net;
- maintainers = [ ];
- platforms = stdenv.lib.platforms.gnu;
+ maintainers = with maintainers; [ pSub ];
+ platforms = platforms.gnu;
};
}
diff --git a/pkgs/applications/graphics/gimp/2.8.nix b/pkgs/applications/graphics/gimp/2.8.nix
index aca4d822c82..bd155c59c6b 100644
--- a/pkgs/applications/graphics/gimp/2.8.nix
+++ b/pkgs/applications/graphics/gimp/2.8.nix
@@ -4,11 +4,11 @@
, python, pygtk, libart_lgpl, libexif, gettext, xlibs, wrapPython }:
stdenv.mkDerivation rec {
- name = "gimp-2.8.10";
+ name = "gimp-2.8.14";
src = fetchurl {
url = "http://download.gimp.org/pub/gimp/v2.8/${name}.tar.bz2";
- sha256 = "1rha8yx0pplfjziqczjrxxp16vsvpmb5ziq3c218s4w9z4cqpzg7";
+ sha256 = "d82a958641c9c752d68e35f65840925c08e314cea90222ad845892a40e05b22d";
};
buildInputs =
diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix
index d1a084761e7..7139bc71f3c 100644
--- a/pkgs/applications/graphics/gimp/plugins/default.nix
+++ b/pkgs/applications/graphics/gimp/plugins/default.nix
@@ -83,6 +83,21 @@ rec {
};
};
+ focusblur = pluginDerivation rec {
+ /* menu:
+ Blur/Focus Blur
+ */
+ name = "focusblur-3.2.6";
+ buildInputs = [ gimp pkgconfig pkgs.fftwSinglePrec ] ++ gimp.nativeBuildInputs;
+ patches = [ ./patches/focusblur-glib.patch ];
+ postInstall = "fail";
+ installPhase = "installPlugins src/focusblur";
+ src = fetchurl {
+ url = "http://registry.gimp.org/files/${name}.tar.bz2";
+ sha256 = "1gqf3hchz7n7v5kpqkhqh8kwnxbsvlb5cr2w2n7ngrvl56f5xs1h";
+ };
+ };
+
resynthesizer = pluginDerivation {
/* menu:
Filters/Map/Resynthesize
@@ -221,7 +236,7 @@ rec {
homepage = http://lensfun.sebastiankraft.net/;
- license = "GPLv3+";
+ license = stdenv.lib.licenses.gpl3Plus;
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.gnu;
};
diff --git a/pkgs/applications/graphics/gimp/plugins/patches/focusblur-glib.patch b/pkgs/applications/graphics/gimp/plugins/patches/focusblur-glib.patch
new file mode 100644
index 00000000000..b1079ab3660
--- /dev/null
+++ b/pkgs/applications/graphics/gimp/plugins/patches/focusblur-glib.patch
@@ -0,0 +1,200 @@
+ls diff --git focusblur-3.2.6/src/aaa.h focusblur-3.2.6/src/aaa.h
+index 4a6d90b..c74cab2 100644
+--- focusblur-3.2.6/src/aaa.h
++++ focusblur-3.2.6/src/aaa.h
+@@ -19,8 +19,7 @@
+ #ifndef __AAA_H__
+ #define __AAA_H__
+
+-#include
+-#include
++#include
+
+
+ G_BEGIN_DECLS
+diff --git focusblur-3.2.6/src/brush.h focusblur-3.2.6/src/brush.h
+index 685b253..8778fec 100644
+--- focusblur-3.2.6/src/brush.h
++++ focusblur-3.2.6/src/brush.h
+@@ -22,7 +22,7 @@
+ #ifndef __FOCUSBLUR_BRUSH_H__
+ #define __FOCUSBLUR_BRUSH_H__
+
+-#include
++#include
+ #include "focusblurtypes.h"
+
+ G_BEGIN_DECLS
+diff --git focusblur-3.2.6/src/depthmap.h focusblur-3.2.6/src/depthmap.h
+index 78f5e99..baee540 100644
+--- focusblur-3.2.6/src/depthmap.h
++++ focusblur-3.2.6/src/depthmap.h
+@@ -22,7 +22,7 @@
+ #ifndef __FOCUSBLUR_DEPTHMAP_H__
+ #define __FOCUSBLUR_DEPTHMAP_H__
+
+-#include
++#include
+
+ #include "focusblurtypes.h"
+ #include "focusblurenums.h"
+diff --git focusblur-3.2.6/src/diffusion.h focusblur-3.2.6/src/diffusion.h
+index 07ffe4b..3c1e4b9 100644
+--- focusblur-3.2.6/src/diffusion.h
++++ focusblur-3.2.6/src/diffusion.h
+@@ -23,7 +23,7 @@
+ #define __FOCUSBLUR_DIFFUSION_H__
+
+
+-#include
++#include
+
+ #include "focusblur.h"
+ #include "focusblurtypes.h"
+diff --git focusblur-3.2.6/src/fftblur.h focusblur-3.2.6/src/fftblur.h
+index 124bcba..cd809fa 100644
+--- focusblur-3.2.6/src/fftblur.h
++++ focusblur-3.2.6/src/fftblur.h
+@@ -23,8 +23,7 @@
+ #define __FOCUSBLUR_FFTBLUR_H__
+
+
+-#include
+-#include
++#include
+ #include
+
+ #include "focusblurparam.h"
+diff --git focusblur-3.2.6/src/fftblurbuffer.h focusblur-3.2.6/src/fftblurbuffer.h
+index b34d682..42e6380 100644
+--- focusblur-3.2.6/src/fftblurbuffer.h
++++ focusblur-3.2.6/src/fftblurbuffer.h
+@@ -28,8 +28,7 @@
+ #endif
+ #include
+
+-#include