Skip to content

Commit

Permalink
Merge staging-next into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored May 7, 2021
2 parents 48a78a5 + 1ae6d3d commit 307b861
Show file tree
Hide file tree
Showing 70 changed files with 873 additions and 595 deletions.
8 changes: 6 additions & 2 deletions nixos/doc/manual/configuration/ipv6-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@

<para>
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:
automatically assign IPv6 addresses to all interfaces, and Privacy
Extensions (RFC 4946) are enabled by default. You can adjust the default
for this by setting <xref linkend="opt-networking.tempAddresses"/>.
This option may be overridden on a per-interface basis by
<xref linkend="opt-networking.interfaces._name_.tempAddress"/>.
You can disable IPv6 support globally by setting:
<programlisting>
<xref linkend="opt-networking.enableIPv6"/> = false;
</programlisting>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,22 @@ let
description = ''
Number of tasks to perform simultaneously.
A task is a single derivation build or an evaluation.
A task is a single derivation build, an evaluation or an effect run.
At minimum, you need 2 concurrent tasks for <literal>x86_64-linux</literal>
in your cluster, to allow for import from derivation.
<literal>concurrentTasks</literal> can be around the CPU core count or lower if memory is
the bottleneck.
The optimal value depends on the resource consumption characteristics of your workload,
including memory usage and in-task parallelism. This is typically determined empirically.
When scaling, it is generally better to have a double-size machine than two machines,
because each split of resources causes inefficiencies; particularly with regards
to build latency because of extra downloads.
'';
type = types.int;
default = 4;
type = types.either types.ints.positive (types.enum [ "auto" ]);
default = "auto";
};
workDirectory = mkOption {
description = ''
Expand Down Expand Up @@ -186,7 +193,18 @@ in
# even shortly after the previous lookup. This *also* applies to the daemon.
narinfo-cache-negative-ttl = 0
'';
services.hercules-ci-agent.tomlFile =
format.generate "hercules-ci-agent.toml" cfg.settings;
services.hercules-ci-agent = {
tomlFile =
format.generate "hercules-ci-agent.toml" cfg.settings;

settings.labels = {
agent.source =
if options.services.hercules-ci-agent.package.highestPrio == (lib.modules.mkOptionDefault { }).priority
then "nixpkgs"
else lib.mkOptionDefault "override";
pkgs.version = pkgs.lib.version;
lib.version = lib.version;
};
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,23 @@ in
# Trusted user allows simplified configuration and better performance
# when operating in a cluster.
nix.trustedUsers = [ config.systemd.services.hercules-ci-agent.serviceConfig.User ];
services.hercules-ci-agent.settings.nixUserIsTrusted = true;
services.hercules-ci-agent = {
settings = {
nixUserIsTrusted = true;
labels =
let
mkIfNotNull = x: mkIf (x != null) x;
in
{
nixos.configurationRevision = mkIfNotNull config.system.configurationRevision;
nixos.release = config.system.nixos.release;
nixos.label = mkIfNotNull config.system.nixos.label;
nixos.codeName = config.system.nixos.codeName;
nixos.tags = config.system.nixos.tags;
nixos.systemName = mkIfNotNull config.system.name;
};
};
};

users.users.hercules-ci-agent = {
home = cfg.settings.baseDirectory;
Expand Down
19 changes: 5 additions & 14 deletions nixos/modules/services/databases/couchdb.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,17 @@ with lib;

let
cfg = config.services.couchdb;
useVersion2 = strings.versionAtLeast (strings.getVersion cfg.package) "2.0";
configFile = pkgs.writeText "couchdb.ini" (
''
[couchdb]
database_dir = ${cfg.databaseDir}
uri_file = ${cfg.uriFile}
view_index_dir = ${cfg.viewIndexDir}
'' + (if cfg.adminPass != null then
''
'' + (optionalString (cfg.adminPass != null) ''
[admins]
${cfg.adminUser} = ${cfg.adminPass}
'' else
"") + (if useVersion2 then
''
'' + ''
[chttpd]
'' else
''
[httpd]
'') +
''
port = ${toString cfg.port}
Expand All @@ -30,8 +23,7 @@ let
[log]
file = ${cfg.logFile}
'');
executable = if useVersion2 then "${cfg.package}/bin/couchdb"
else ''${cfg.package}/bin/couchdb -a ${configFile} -a ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig} -a ${cfg.configFile}'';
executable = "${cfg.package}/bin/couchdb";

in {

Expand Down Expand Up @@ -177,8 +169,7 @@ in {

environment.systemPackages = [ cfg.package ];

services.couchdb.configFile = mkDefault
(if useVersion2 then "/var/lib/couchdb/local.ini" else "/var/lib/couchdb/couchdb.ini");
services.couchdb.configFile = mkDefault "/var/lib/couchdb/local.ini";

systemd.tmpfiles.rules = [
"d '${dirOf cfg.uriFile}' - ${cfg.user} ${cfg.group} - -"
Expand All @@ -195,7 +186,7 @@ in {
touch ${cfg.configFile}
'';

environment = mkIf useVersion2 {
environment = {
# we are actually specifying 4 configuration files:
# 1. the preinstalled default.ini
# 2. the module configuration
Expand Down
96 changes: 62 additions & 34 deletions nixos/modules/tasks/network-interfaces.nix
Original file line number Diff line number Diff line change
Expand Up @@ -144,33 +144,20 @@ let
};

tempAddress = mkOption {
type = types.enum [ "default" "enabled" "disabled" ];
default = if cfg.enableIPv6 then "default" else "disabled";
defaultText = literalExample ''if cfg.enableIPv6 then "default" else "disabled"'';
type = types.enum (lib.attrNames tempaddrValues);
default = cfg.tempAddresses;
defaultText = literalExample ''config.networking.tempAddresses'';
description = ''
When IPv6 is enabled with SLAAC, this option controls the use of
temporary address (aka privacy extensions). This is used to reduce tracking.
The three possible values are:
<itemizedlist>
<listitem>
<para>
<literal>"default"</literal> to generate temporary addresses and use
them by default;
</para>
</listitem>
<listitem>
<para>
<literal>"enabled"</literal> to generate temporary addresses but keep
using the standard EUI-64 ones by default;
</para>
</listitem>
<listitem>
<para>
<literal>"disabled"</literal> to completely disable temporary addresses.
</para>
</listitem>
</itemizedlist>
temporary address (aka privacy extensions) on this
interface. This is used to reduce tracking.
See also the global option
<xref linkend="opt-networking.tempAddresses"/>, which
applies to all interfaces where this is not set.
Possible values are:
${tempaddrDoc}
'';
};

Expand Down Expand Up @@ -366,6 +353,32 @@ let

isHexString = s: all (c: elem c hexChars) (stringToCharacters (toLower s));

tempaddrValues = {
disabled = {
sysctl = "0";
description = "completely disable IPv6 temporary addresses";
};
enabled = {
sysctl = "1";
description = "generate IPv6 temporary addresses but still use EUI-64 addresses as source addresses";
};
default = {
sysctl = "2";
description = "generate IPv6 temporary addresses and use these as source addresses in routing";
};
};
tempaddrDoc = ''
<itemizedlist>
${concatStringsSep "\n" (mapAttrsToList (name: { description, ... }: ''
<listitem>
<para>
<literal>"${name}"</literal> to ${description};
</para>
</listitem>
'') tempaddrValues)}
</itemizedlist>
'';

in

{
Expand Down Expand Up @@ -1039,6 +1052,21 @@ in
'';
};

networking.tempAddresses = mkOption {
default = if cfg.enableIPv6 then "default" else "disabled";
type = types.enum (lib.attrNames tempaddrValues);
description = ''
Whether to enable IPv6 Privacy Extensions for interfaces not
configured explicitly in
<xref linkend="opt-networking.interfaces._name_.tempAddress" />.
This sets the ipv6.conf.*.use_tempaddr sysctl for all
interfaces. Possible values are:
${tempaddrDoc}
'';
};

};


Expand Down Expand Up @@ -1098,7 +1126,7 @@ in
// listToAttrs (forEach interfaces
(i: let
opt = i.tempAddress;
val = { disabled = 0; enabled = 1; default = 2; }.${opt};
val = tempaddrValues.${opt}.sysctl;
in nameValuePair "net.ipv6.conf.${replaceChars ["."] ["/"] i.name}.use_tempaddr" val));

# Capabilities won't work unless we have at-least a 4.3 Linux
Expand Down Expand Up @@ -1203,9 +1231,11 @@ in
(pkgs.writeTextFile rec {
name = "ipv6-privacy-extensions.rules";
destination = "/etc/udev/rules.d/98-${name}";
text = ''
text = let
sysctl-value = tempaddrValues.${cfg.tempAddresses}.sysctl;
in ''
# enable and prefer IPv6 privacy addresses by default
ACTION=="add", SUBSYSTEM=="net", RUN+="${pkgs.bash}/bin/sh -c 'echo 2 > /proc/sys/net/ipv6/conf/%k/use_tempaddr'"
ACTION=="add", SUBSYSTEM=="net", RUN+="${pkgs.bash}/bin/sh -c 'echo ${sysctl-value} > /proc/sys/net/ipv6/conf/%k/use_tempaddr'"
'';
})
(pkgs.writeTextFile rec {
Expand All @@ -1214,15 +1244,13 @@ in
text = concatMapStrings (i:
let
opt = i.tempAddress;
val = if opt == "disabled" then 0 else 1;
msg = if opt == "disabled"
then "completely disable IPv6 privacy addresses"
else "enable IPv6 privacy addresses but prefer EUI-64 addresses";
val = tempaddrValues.${opt}.sysctl;
msg = tempaddrValues.${opt}.description;
in
''
# override to ${msg} for ${i.name}
ACTION=="add", SUBSYSTEM=="net", RUN+="${pkgs.procps}/bin/sysctl net.ipv6.conf.${replaceChars ["."] ["/"] i.name}.use_tempaddr=${toString val}"
'') (filter (i: i.tempAddress != "default") interfaces);
ACTION=="add", SUBSYSTEM=="net", RUN+="${pkgs.procps}/bin/sysctl net.ipv6.conf.${replaceChars ["."] ["/"] i.name}.use_tempaddr=${val}"
'') (filter (i: i.tempAddress != cfg.tempAddresses) interfaces);
})
] ++ lib.optional (cfg.wlanInterfaces != {})
(pkgs.writeTextFile {
Expand Down
38 changes: 0 additions & 38 deletions nixos/tests/couchdb.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ with lib;
};

nodes = {
couchdb1 = makeNode pkgs.couchdb testuser testpass;
couchdb2 = makeNode pkgs.couchdb2 testuser testpass;
couchdb3 = makeNode pkgs.couchdb3 testuser testpass;
};

Expand All @@ -41,42 +39,6 @@ with lib;
in ''
start_all()
couchdb1.wait_for_unit("couchdb.service")
couchdb1.wait_until_succeeds(
"${curlJqCheck "" "GET" "" ".couchdb" "Welcome"}"
)
couchdb1.wait_until_succeeds(
"${curlJqCheck "" "GET" "_all_dbs" ". | length" "2"}"
)
couchdb1.succeed("${curlJqCheck testlogin "PUT" "foo" ".ok" "true"}")
couchdb1.succeed(
"${curlJqCheck "" "GET" "_all_dbs" ". | length" "3"}"
)
couchdb1.succeed(
"${curlJqCheck testlogin "DELETE" "foo" ".ok" "true"}"
)
couchdb1.succeed(
"${curlJqCheck "" "GET" "_all_dbs" ". | length" "2"}"
)
couchdb2.wait_for_unit("couchdb.service")
couchdb2.wait_until_succeeds(
"${curlJqCheck "" "GET" "" ".couchdb" "Welcome"}"
)
couchdb2.wait_until_succeeds(
"${curlJqCheck "" "GET" "_all_dbs" ". | length" "0"}"
)
couchdb2.succeed("${curlJqCheck testlogin "PUT" "foo" ".ok" "true"}")
couchdb2.succeed(
"${curlJqCheck "" "GET" "_all_dbs" ". | length" "1"}"
)
couchdb2.succeed(
"${curlJqCheck testlogin "DELETE" "foo" ".ok" "true"}"
)
couchdb2.succeed(
"${curlJqCheck "" "GET" "_all_dbs" ". | length" "0"}"
)
couchdb3.wait_for_unit("couchdb.service")
couchdb3.wait_until_succeeds(
"${curlJqCheck testlogin "GET" "" ".couchdb" "Welcome"}"
Expand Down
Loading

0 comments on commit 307b861

Please sign in to comment.