Skip to content

Commit

Permalink
Merge branch 'master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
vcunat committed Feb 3, 2017
2 parents 787c1ad + 5b75929 commit adab4cd
Show file tree
Hide file tree
Showing 143 changed files with 3,266 additions and 1,850 deletions.
6 changes: 3 additions & 3 deletions doc/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="chap-packageconfig">

<title><filename>~/.nixpkgs/config.nix</filename>: global configuration</title>
<title>Global configuration</title>

<para>Nix packages can be configured to allow or deny certain options.</para>

<para>To apply the configuration edit
<filename>~/.nixpkgs/config.nix</filename> and set it like
<filename>~/.config/nixpkgs/config.nix</filename> and set it like

<programlisting>
{
Expand Down Expand Up @@ -89,7 +89,7 @@ packages via <literal>packageOverrides</literal></title>

<para>You can define a function called
<varname>packageOverrides</varname> in your local
<filename>~/.nixpkgs/config.nix</filename> to overide nix packages. It
<filename>~/.config/nixpkgs/config.nix</filename> to overide nix packages. It
must be a function that takes pkgs as an argument and return modified
set of packages.

Expand Down
2 changes: 1 addition & 1 deletion doc/functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
evaluation-per-function application incurs a performance penalty,
which can become a problem if many overrides are used.
It is only intended for ad-hoc customisation, such as in
<filename>~/.nixpkgs/config.nix</filename>.
<filename>~/.config/nixpkgs/config.nix</filename>.
</para>
</warning>

Expand Down
8 changes: 4 additions & 4 deletions doc/languages-frameworks/haskell.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ its normal core packages:
mtl-2.2.1

This function allows users to define their own development environment by means
of an override. After adding the following snippet to `~/.nixpkgs/config.nix`,
of an override. After adding the following snippet to `~/.config/nixpkgs/config.nix`,

{
packageOverrides = super: let self = super.pkgs; in
Expand Down Expand Up @@ -522,7 +522,7 @@ file with `cabal2nix`:
$ cd ~/src/foo && cabal2nix . >default.nix
$ cd ~/src/bar && cabal2nix . >default.nix

Then edit your `~/.nixpkgs/config.nix` file to register those builds in the
Then edit your `~/.config/nixpkgs/config.nix` file to register those builds in the
default Haskell package set:

{
Expand Down Expand Up @@ -554,7 +554,7 @@ Every Haskell package set takes a function called `overrides` that you can use
to manipulate the package as much as you please. One useful application of this
feature is to replace the default `mkDerivation` function with one that enables
library profiling for all packages. To accomplish that, add configure the
following snippet in your `~/.nixpkgs/config.nix` file:
following snippet in your `~/.config/nixpkgs/config.nix` file:

{
packageOverrides = super: let self = super.pkgs; in
Expand Down Expand Up @@ -583,7 +583,7 @@ The first step is to generate Nix build instructions with `cabal2nix`:

$ cabal2nix cabal://ghc-events-0.4.3.0 >~/.nixpkgs/ghc-events-0.4.3.0.nix

Then add the override in `~/.nixpkgs/config.nix`:
Then add the override in `~/.config/nixpkgs/config.nix`:

{
packageOverrides = super: let self = super.pkgs; in
Expand Down
2 changes: 1 addition & 1 deletion doc/languages-frameworks/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ If you get the following error:
could not create '/nix/store/6l1bvljpy8gazlsw2aw9skwwp4pmvyxw-python-2.7.8/etc':
Permission denied

This is a [known bug](https://bitbucket.org/pypa/setuptools/issue/130/install_data-doesnt-respect-prefix) in setuptools.
This is a [known bug](https://github.com/pypa/setuptools/issues/130) in setuptools.
Setuptools `install_data` does not respect `--prefix`. An example of such package using the feature is `pkgs/tools/X11/xpra/default.nix`.
As workaround install it as an extra `preInstall` step:

Expand Down
4 changes: 2 additions & 2 deletions doc/overlays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ first one present is considered, and all the rest are ignored:

<listitem>

<para>In the directory pointed by the environment variable
<varname>NIXPKGS_OVERLAYS</varname>.</para>
<para>In the directory pointed to by the Nix search path entry
<literal>&lt;nixpkgs-overlays></literal>.</para>
</listitem>

<listitem>
Expand Down
2 changes: 1 addition & 1 deletion doc/package-notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ packageOverrides = pkgs: {
</screen>

to your Nixpkgs configuration
(<filename>~/.nixpkgs/config.nix</filename>) and install it by
(<filename>~/.config/nixpkgs/config.nix</filename>) and install it by
running <command>nix-env -f '&lt;nixpkgs&gt;' -iA
myEclipse</command> and afterward run Eclipse as usual. It is
possible to find out which plugins are available for installation
Expand Down
8 changes: 4 additions & 4 deletions lib/customisation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ rec {
the original derivation attributes.
`overrideDerivation' allows certain "ad-hoc" customisation
scenarios (e.g. in ~/.nixpkgs/config.nix). For instance, if you
want to "patch" the derivation returned by a package function in
Nixpkgs to build another version than what the function itself
provides, you can do something like this:
scenarios (e.g. in ~/.config/nixpkgs/config.nix). For instance,
if you want to "patch" the derivation returned by a package
function in Nixpkgs to build another version than what the
function itself provides, you can do something like this:
mySed = overrideDerivation pkgs.gnused (oldAttrs: {
name = "sed-4.2.2-pre";
Expand Down
2 changes: 2 additions & 0 deletions lib/maintainers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@
roblabla = "Robin Lambertz <robinlambertz+dev@gmail.com>";
roconnor = "Russell O'Connor <roconnor@theorem.ca>";
romildo = "José Romildo Malaquias <malaquias@gmail.com>";
rongcuid = "Rongcui Dong <rongcuid@outlook.com>";
ronny = "Ronny Pfannschmidt <nixos@ronnypfannschmidt.de>";
rszibele = "Richard Szibele <richard_szibele@hotmail.com>";
rushmorem = "Rushmore Mushambi <rushmore@webenchanter.com>";
Expand Down Expand Up @@ -518,6 +519,7 @@
wyvie = "Elijah Rum <elijahrum@gmail.com>";
yarr = "Dmitry V. <savraz@gmail.com>";
yochai = "Yochai <yochai@titat.info>";
yorickvp = "Yorick van Pelt <yorickvanpelt@gmail.com>";
yurrriq = "Eric Bailey <eric@ericb.me>";
z77z = "Marco Maggesi <maggesi@math.unifi.it>";
zagy = "Christian Zagrodnick <cz@flyingcircus.io>";
Expand Down
2 changes: 1 addition & 1 deletion lib/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ rec {
# Type-check the remaining definitions, and merge them.
mergedValue = foldl' (res: def:
if type.check def.value then res
else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.name}.")
else throw "The option value `${showOption loc}' in `${def.file}' is not a ${type.description}.")
(type.merge loc defsFinal) defsFinal;

isDefined = defsFinal != [];
Expand Down
5 changes: 5 additions & 0 deletions lib/tests/modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ set -- config.enable ./declare-enable.nix ./define-enable.nix ./define-loaOfSub-
checkConfigError 'The option .* defined in .* does not exist.' "$@"
checkConfigOutput "true" "$@" ./define-module-check.nix

# Check coerced value.
checkConfigOutput "\"42\"" config.value ./declare-coerced-value.nix
checkConfigOutput "\"24\"" config.value ./declare-coerced-value.nix ./define-value-string.nix
checkConfigError 'The option value .* in .* is not a string or integer.' config.value ./declare-coerced-value.nix ./define-value-list.nix

cat <<EOF
====== module tests ======
$pass Pass
Expand Down
10 changes: 10 additions & 0 deletions lib/tests/modules/declare-coerced-value.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ lib, ... }:

{
options = {
value = lib.mkOption {
default = 42;
type = lib.types.coercedTo lib.types.int builtins.toString lib.types.str;
};
};
}
3 changes: 3 additions & 0 deletions lib/tests/modules/define-value-list.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
value = [];
}
3 changes: 3 additions & 0 deletions lib/tests/modules/define-value-string.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
value = "24";
}
22 changes: 22 additions & 0 deletions lib/types.nix
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,28 @@ rec {
functor = (defaultFunctor name) // { wrapped = [ t1 t2 ]; };
};

coercedTo = coercedType: coerceFunc: finalType:
assert coercedType.getSubModules == null;
mkOptionType rec {
name = "coercedTo";
description = "${finalType.description} or ${coercedType.description}";
check = x: finalType.check x || coercedType.check x;
merge = loc: defs:
let
coerceVal = val:
if finalType.check val then val
else let
coerced = coerceFunc val;
in assert finalType.check coerced; coerced;

in finalType.merge loc (map (def: def // { value = coerceVal def.value; }) defs);
getSubOptions = finalType.getSubOptions;
getSubModules = finalType.getSubModules;
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
typeMerge = t1: t2: null;
functor = (defaultFunctor name) // { wrapped = finalType; };
};

# Obsolete alternative to configOf. It takes its option
# declarations from the ‘options’ attribute of containing option
# declaration.
Expand Down
20 changes: 20 additions & 0 deletions nixos/doc/manual/configuration/ipv6-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,25 @@ boot.kernel.sysctl."net.ipv6.conf.eth0.disable_ipv6" = true;
</programlisting>
</para>

<para>As with IPv4 networking interfaces are automatically configured via
DHCPv6. You can configure an interface manually:

<programlisting>
networking.interfaces.eth0.ip6 = [ { address = "fe00:aa:bb:cc::2"; prefixLength = 64; } ];
</programlisting>
</para>

<para>For configuring a gateway, optionally with explicitly specified interface:

<programlisting>
networking.defaultGateway6 = {
address = "fe00::1";
interface = "enp0s3";
}
</programlisting>
</para>

<para>See <xref linkend='sec-ipv4' /> for similar examples and additional information.
</para>

</section>
3 changes: 2 additions & 1 deletion nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@
./services/security/frandom.nix
./services/security/haka.nix
./services/security/haveged.nix
./services/security/hologram.nix
./services/security/hologram-server.nix
./services/security/hologram-agent.nix
./services/security/munge.nix
./services/security/oauth2_proxy.nix
./services/security/physlock.nix
Expand Down
4 changes: 2 additions & 2 deletions nixos/modules/services/editors/emacs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,10 @@ https://nixos.org/nixpkgs/manual/#sec-modify-via-packageOverrides
<para>
If you are not on NixOS or want to install this particular
Emacs only for yourself, you can do so by adding it to your
<filename>~/.nixpkgs/config.nix</filename>
<filename>~/.config/nixpkgs/config.nix</filename>
(see <link xlink:href="http://nixos.org/nixpkgs/manual/#sec-modify-via-packageOverrides">Nixpkgs manual</link>):
<example>
<title>Custom Emacs in <filename>~/.nixpkgs/system.nix</filename></title>
<title>Custom Emacs in <filename>~/.config/nixpkgs/config.nix</filename></title>
<programlisting><![CDATA[
{
packageOverrides = super: let self = super.pkgs; in {
Expand Down
20 changes: 13 additions & 7 deletions nixos/modules/services/networking/asterisk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let
allConfFiles =
cfg.confFiles //
builtins.listToAttrs (map (x: { name = x;
value = builtins.readFile (pkgs.asterisk + "/etc/asterisk/" + x); })
value = builtins.readFile (cfg.package + "/etc/asterisk/" + x); })
defaultConfFiles);

asteriskEtc = pkgs.stdenv.mkDerivation
Expand All @@ -38,7 +38,7 @@ let
asteriskConf = ''
[directories]
astetcdir => /etc/asterisk
astmoddir => ${pkgs.asterisk}/lib/asterisk/modules
astmoddir => ${cfg.package}/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
Expand All @@ -47,7 +47,7 @@ let
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
astsbindir => ${pkgs.asterisk}/sbin
astsbindir => ${cfg.package}/sbin
'';
extraConf = cfg.extraConfig;

Expand Down Expand Up @@ -197,11 +197,17 @@ in
Additional command line arguments to pass to Asterisk.
'';
};
package = mkOption {
type = types.package;
default = pkgs.asterisk;
defaultText = "pkgs.asterisk";
description = "The Asterisk package to use.";
};
};
};

config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.asterisk ];
environment.systemPackages = [ cfg.package ];

environment.etc.asterisk.source = asteriskEtc;

Expand Down Expand Up @@ -234,7 +240,7 @@ in
# TODO: Make exceptions for /var directories that likely should be updated
if [ ! -e "$d" ]; then
mkdir -p "$d"
cp --recursive ${pkgs.asterisk}/"$d"/* "$d"/
cp --recursive ${cfg.package}/"$d"/* "$d"/
chown --recursive ${asteriskUser}:${asteriskGroup} "$d"
find "$d" -type d | xargs chmod 0755
fi
Expand All @@ -247,8 +253,8 @@ in
# FIXME: This doesn't account for arguments with spaces
argString = concatStringsSep " " cfg.extraArguments;
in
"${pkgs.asterisk}/bin/asterisk -U ${asteriskUser} -C /etc/asterisk/asterisk.conf ${argString} -F";
ExecReload = ''${pkgs.asterisk}/bin/asterisk -x "core reload"
"${cfg.package}/bin/asterisk -U ${asteriskUser} -C /etc/asterisk/asterisk.conf ${argString} -F";
ExecReload = ''${cfg.package}/bin/asterisk -x "core reload"
'';
Type = "forking";
PIDFile = "/var/run/asterisk/asterisk.pid";
Expand Down
57 changes: 57 additions & 0 deletions nixos/modules/services/security/hologram-agent.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{pkgs, config, lib, ...}:

with lib;

let
cfg = config.services.hologram-agent;

cfgFile = pkgs.writeText "hologram-agent.json" (builtins.toJSON {
host = cfg.dialAddress;
});
in {
options = {
services.hologram-agent = {
enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the Hologram agent for AWS instance credentials";
};

dialAddress = mkOption {
type = types.str;
default = "localhost:3100";
description = "Hologram server and port.";
};

httpPort = mkOption {
type = types.str;
default = "80";
description = "Port for metadata service to listen on.";
};

};
};

config = mkIf cfg.enable {
networking.interfaces.dummy0 = {
ipAddress = "169.254.169.254";
prefixLength = 32;
};

systemd.services.hologram-agent = {
description = "Provide EC2 instance credentials to machines outside of EC2";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
requires = [ "network-link-dummy0.service" "network-addresses-dummy0.service" ];
preStart = ''
/run/current-system/sw/bin/rm -fv /var/run/hologram.sock
'';
serviceConfig = {
ExecStart = "${pkgs.hologram.bin}/bin/hologram-agent -debug -conf ${cfgFile} -port ${cfg.httpPort}";
};
};

};

meta.maintainers = with lib.maintainers; [ nand0p ];
}

0 comments on commit adab4cd

Please sign in to comment.