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 20, 2021
2 parents ba7ede8 + 34a05e2 commit 0a0c0a9
Show file tree
Hide file tree
Showing 138 changed files with 7,731 additions and 2,346 deletions.
16 changes: 16 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3357,6 +3357,12 @@
githubId = 10799507;
name = "Karl Fischer";
};
fitzgibbon = {
name = "Niall FitzGibbon";
email = "fitzgibbon.niall@gmail.com";
github = "fitzgibbon";
githubId = 617048;
};
Flakebi = {
email = "flakebi@t-online.de";
github = "Flakebi";
Expand Down Expand Up @@ -11465,6 +11471,16 @@
github = "pulsation";
githubId = 1838397;
};
ydlr = {
name = "ydlr";
email = "ydlr@ydlr.io";
github = "ydlr";
githubId = 58453832;
keys = [{
longkeyid = "rsa4096/0x43AB44130A29AD9D";
fingerprint = "FD0A C425 9EF5 4084 F99F 9B47 2ACC 9749 7C68 FAD4";
}];
};
zane = {
name = "Zane van Iperen";
email = "zane@zanevaniperen.com";
Expand Down
8 changes: 8 additions & 0 deletions maintainers/team-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ with lib.maintainers; {
scope = "Maintain Cinnamon desktop environment and applications made by the LinuxMint team.";
};

chia = {
members = [
atemu
lourkeur
];
scope = "Maintain the Chia blockchain and its dependencies";
};

deshaw = {
# Verify additions to this team with at least one already existing member of the team.
members = [
Expand Down
7 changes: 7 additions & 0 deletions nixos/lib/build-vms.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ rec {
[ ../modules/virtualisation/qemu-vm.nix
../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs
{ key = "no-manual"; documentation.nixos.enable = false; }
{ key = "no-revision";
# Make the revision metadata constant, in order to avoid needless retesting.
# The human version (e.g. 21.05-pre) is left as is, because it is useful
# for external modules that test with e.g. nixosTest and rely on that
# version number.
config.system.nixos.revision = "constant-nixos-revision";
}
{ key = "nodes"; _module.args.nodes = nodes; }
] ++ optional minimal ../modules/testing/minimal-kernel.nix;
};
Expand Down
33 changes: 27 additions & 6 deletions nixos/lib/test-driver/test-driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from queue import Queue, Empty
from typing import Tuple, Any, Callable, Dict, Iterator, Optional, List, Iterable
from xml.sax.saxutils import XMLGenerator
from colorama import Style
import queue
import io
import _thread
Expand Down Expand Up @@ -151,6 +152,8 @@ def __init__(self) -> None:
self.xml.startDocument()
self.xml.startElement("logfile", attrs={})

self._print_serial_logs = True

def close(self) -> None:
self.xml.endElement("logfile")
self.xml.endDocument()
Expand All @@ -174,15 +177,21 @@ def log(self, message: str, attributes: Dict[str, str] = {}) -> None:
self.drain_log_queue()
self.log_line(message, attributes)

def enqueue(self, message: Dict[str, str]) -> None:
self.queue.put(message)
def log_serial(self, message: str, machine: str) -> None:
self.enqueue({"msg": message, "machine": machine, "type": "serial"})
if self._print_serial_logs:
eprint(Style.DIM + "{} # {}".format(machine, message) + Style.RESET_ALL)

def enqueue(self, item: Dict[str, str]) -> None:
self.queue.put(item)

def drain_log_queue(self) -> None:
try:
while True:
item = self.queue.get_nowait()
attributes = {"machine": item["machine"], "type": "serial"}
self.log_line(self.sanitise(item["msg"]), attributes)
msg = self.sanitise(item["msg"])
del item["msg"]
self.log_line(msg, item)
except Empty:
pass

Expand Down Expand Up @@ -327,6 +336,9 @@ def is_up(self) -> bool:
def log(self, msg: str) -> None:
self.logger.log(msg, {"machine": self.name})

def log_serial(self, msg: str) -> None:
self.logger.log_serial(msg, self.name)

def nested(self, msg: str, attrs: Dict[str, str] = {}) -> _GeneratorContextManager:
my_attrs = {"machine": self.name}
my_attrs.update(attrs)
Expand Down Expand Up @@ -784,8 +796,7 @@ def process_serial_output() -> None:
# Ignore undecodable bytes that may occur in boot menus
line = _line.decode(errors="ignore").replace("\r", "").rstrip()
self.last_lines.put(line)
eprint("{} # {}".format(self.name, line))
self.logger.enqueue({"msg": line, "machine": self.name})
self.log_serial(line)

_thread.start_new_thread(process_serial_output, ())

Expand Down Expand Up @@ -927,6 +938,16 @@ def run_tests() -> None:
machine.execute("sync")


def serial_stdout_on() -> None:
global log
log._print_serial_logs = True


def serial_stdout_off() -> None:
global log
log._print_serial_logs = False


@contextmanager
def subtest(name: str) -> Iterator[None]:
with log.nested(name):
Expand Down
2 changes: 1 addition & 1 deletion nixos/lib/testing-python.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rec {
name = "nixos-test-driver";

nativeBuildInputs = [ makeWrapper ];
buildInputs = [ (python3.withPackages (p: [ p.ptpython ])) ];
buildInputs = [ (python3.withPackages (p: [ p.ptpython p.colorama ])) ];
checkInputs = with python3Packages; [ pylint black mypy ];

dontUnpack = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ in
'';
};

enable = mkEnableOption "Whether to enable Kubernetes addon manager.";
enable = mkEnableOption "Kubernetes addon manager.";
};

###### implementation
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/services/databases/clickhouse.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ with lib;
User = "clickhouse";
Group = "clickhouse";
ConfigurationDirectory = "clickhouse-server";
AmbientCapabilities = "CAP_SYS_NICE";
StateDirectory = "clickhouse";
LogsDirectory = "clickhouse";
ExecStart = "${pkgs.clickhouse}/bin/clickhouse-server --config-file=${pkgs.clickhouse}/etc/clickhouse-server/config.xml";
Expand Down
135 changes: 40 additions & 95 deletions nixos/modules/services/network-filesystems/netatalk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,10 @@
with lib;

let

cfg = config.services.netatalk;

extmapFile = pkgs.writeText "extmap.conf" cfg.extmap;

afpToString = x: if builtins.typeOf x == "bool"
then boolToString x
else toString x;

volumeConfig = name:
let vol = getAttr name cfg.volumes; in
"[${name}]\n " + (toString (
map
(key: "${key} = ${afpToString (getAttr key vol)}\n")
(attrNames vol)
));

afpConf = ''[Global]
extmap file = ${extmapFile}
afp port = ${toString cfg.port}
${cfg.extraConfig}
${if cfg.homes.enable then ''[Homes]
${optionalString (cfg.homes.path != "") "path = ${cfg.homes.path}"}
basedir regex = ${cfg.homes.basedirRegex}
${cfg.homes.extraConfig}
'' else ""}
${toString (map volumeConfig (attrNames cfg.volumes))}
'';

afpConfFile = pkgs.writeText "afp.conf" afpConf;

in

{
settingsFormat = pkgs.formats.ini { };
afpConfFile = settingsFormat.generate "afp.conf" cfg.settings;
in {
options = {
services.netatalk = {

Expand All @@ -51,61 +18,24 @@ in
description = "TCP port to be used for AFP.";
};

extraConfig = mkOption {
type = types.lines;
default = "";
example = "uam list = uams_guest.so";
description = ''
Lines of configuration to add to the <literal>[Global]</literal> section.
See <literal>man apf.conf</literal> for more information.
'';
};

homes = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable sharing of the UNIX server user home directories.";
};

path = mkOption {
type = types.str;
default = "";
example = "afp-data";
description = "Share not the whole user home but this subdirectory path.";
};

basedirRegex = mkOption {
example = "/home";
type = types.str;
description = "Regex which matches the parent directory of the user homes.";
};

extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Lines of configuration to add to the <literal>[Homes]</literal> section.
See <literal>man apf.conf</literal> for more information.
'';
};
};

volumes = mkOption {
settings = mkOption {
inherit (settingsFormat) type;
default = { };
type = types.attrsOf (types.attrsOf types.unspecified);
description =
''
Set of AFP volumes to export.
See <literal>man apf.conf</literal> for more information.
'';
example = literalExample ''
{ srv =
{ path = "/srv";
"read only" = true;
"hosts allow" = "10.1.0.0/16 10.2.1.100 2001:0db8:1234::/48";
};
}
example = {
Global = { "uam list" = "uams_guest.so"; };
Homes = {
path = "afp-data";
"basedir regex" = "/home";
};
example-volume = {
path = "/srv/volume";
"read only" = true;
};
};
description = ''
Configuration for Netatalk. See
<citerefentry><refentrytitle>afp.conf</refentrytitle>
<manvolnum>5</manvolnum></citerefentry>.
'';
};

Expand All @@ -114,18 +44,33 @@ in
default = "";
description = ''
File name extension mappings.
See <literal>man extmap.conf</literal> for more information.
See <citerefentry><refentrytitle>extmap.conf</refentrytitle>
<manvolnum>5</manvolnum></citerefentry>. for more information.
'';
};

};
};

imports = (map (option:
mkRemovedOptionModule [ "services" "netatalk" option ]
"This option was removed in favor of `services.netatalk.settings`.") [
"extraConfig"
"homes"
"volumes"
]);

config = mkIf cfg.enable {

services.netatalk.settings.Global = {
"afp port" = toString cfg.port;
"extmap file" = "${pkgs.writeText "extmap.conf" cfg.extmap}";
};

systemd.services.netatalk = {
description = "Netatalk AFP fileserver for Macintosh clients";
unitConfig.Documentation = "man:afp.conf(5) man:netatalk(8) man:afpd(8) man:cnid_metad(8) man:cnid_dbd(8)";
unitConfig.Documentation =
"man:afp.conf(5) man:netatalk(8) man:afpd(8) man:cnid_metad(8) man:cnid_dbd(8)";
after = [ "network.target" "avahi-daemon.service" ];
wantedBy = [ "multi-user.target" ];

Expand All @@ -135,12 +80,12 @@ in
Type = "forking";
GuessMainPID = "no";
PIDFile = "/run/lock/netatalk";
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -m 0755 -p /var/lib/netatalk/CNID";
ExecStart = "${pkgs.netatalk}/sbin/netatalk -F ${afpConfFile}";
ExecStart = "${pkgs.netatalk}/sbin/netatalk -F ${afpConfFile}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
ExecStop = "${pkgs.coreutils}/bin/kill -TERM $MAINPID";
ExecStop = "${pkgs.coreutils}/bin/kill -TERM $MAINPID";
Restart = "always";
RestartSec = 1;
StateDirectory = [ "netatalk/CNID" ];
};

};
Expand Down
22 changes: 19 additions & 3 deletions nixos/modules/services/networking/nsd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ let

mkZoneFileName = name: if name == "." then "root" else name;

# replaces include: directives for keys with fake keys for nsd-checkconf
injectFakeKeys = keys: concatStrings
(mapAttrsToList
(keyName: keyOptions: ''
fakeKey="$(${pkgs.bind}/bin/tsig-keygen -a ${escapeShellArgs [ keyOptions.algorithm keyName ]} | grep -oP "\s*secret \"\K.*(?=\";)")"
sed "s@^\s*include:\s*\"${stateDir}/private/${keyName}\"\$@secret: $fakeKey@" -i $out/nsd.conf
'')
keys);

nsdEnv = pkgs.buildEnv {
name = "nsd-env";

Expand All @@ -34,17 +43,24 @@ let
echo "|- checking zone '$out/zones/$zoneFile'"
${nsdPkg}/sbin/nsd-checkzone "$zoneFile" "$zoneFile" || {
if grep -q \\\\\\$ "$zoneFile"; then
echo zone "$zoneFile" contains escaped dollar signes \\\$
echo Escaping them is not needed any more. Please make shure \
to unescape them where they prefix a variable name
echo zone "$zoneFile" contains escaped dollar signs \\\$
echo Escaping them is not needed any more. Please make sure \
to unescape them where they prefix a variable name.
fi
exit 1
}
done
echo "checking configuration file"
# Save original config file including key references...
cp $out/nsd.conf{,.orig}
# ...inject mock keys into config
${injectFakeKeys cfg.keys}
# ...do the checkconf
${nsdPkg}/sbin/nsd-checkconf $out/nsd.conf
# ... and restore original config file.
mv $out/nsd.conf{.orig,}
'';
};

Expand Down
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ in
openarena = handleTest ./openarena.nix {};
openldap = handleTest ./openldap.nix {};
opensmtpd = handleTest ./opensmtpd.nix {};
opensmtpd-rspamd = handleTest ./opensmtpd-rspamd.nix {};
openssh = handleTest ./openssh.nix {};
openstack-image-metadata = (handleTestOn ["x86_64-linux"] ./openstack-image.nix {}).metadata or {};
openstack-image-userdata = (handleTestOn ["x86_64-linux"] ./openstack-image.nix {}).userdata or {};
Expand Down
Loading

0 comments on commit 0a0c0a9

Please sign in to comment.