mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-27 08:04:14 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
88 lines
2.6 KiB
Nix
88 lines
2.6 KiB
Nix
{
|
|
system ? builtins.currentSystem,
|
|
config ? { },
|
|
pkgs ? import ../.. { inherit system config; },
|
|
# bool: whether to use networkd in the tests
|
|
networkd ? false,
|
|
}@args:
|
|
|
|
# Test whether `avahi-daemon' and `libnss-mdns' work as expected.
|
|
import ./make-test-python.nix {
|
|
name = "avahi";
|
|
meta = with pkgs.lib.maintainers; {
|
|
maintainers = [ ];
|
|
};
|
|
|
|
nodes =
|
|
let
|
|
cfg =
|
|
{ ... }:
|
|
{
|
|
services.avahi = {
|
|
enable = true;
|
|
nssmdns4 = true;
|
|
publish.addresses = true;
|
|
publish.domain = true;
|
|
publish.enable = true;
|
|
publish.userServices = true;
|
|
publish.workstation = true;
|
|
extraServiceFiles.ssh = "${pkgs.avahi}/etc/avahi/services/ssh.service";
|
|
};
|
|
}
|
|
// pkgs.lib.optionalAttrs (networkd) {
|
|
networking = {
|
|
useNetworkd = true;
|
|
useDHCP = false;
|
|
};
|
|
};
|
|
in
|
|
{
|
|
one = cfg;
|
|
two = cfg;
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
# mDNS.
|
|
one.wait_for_unit("network.target")
|
|
two.wait_for_unit("network.target")
|
|
|
|
one.succeed("avahi-resolve-host-name one.local | tee out >&2")
|
|
one.succeed('test "`cut -f1 < out`" = one.local')
|
|
one.succeed("avahi-resolve-host-name two.local | tee out >&2")
|
|
one.succeed('test "`cut -f1 < out`" = two.local')
|
|
|
|
two.succeed("avahi-resolve-host-name one.local | tee out >&2")
|
|
two.succeed('test "`cut -f1 < out`" = one.local')
|
|
two.succeed("avahi-resolve-host-name two.local | tee out >&2")
|
|
two.succeed('test "`cut -f1 < out`" = two.local')
|
|
|
|
# Basic DNS-SD.
|
|
one.succeed("avahi-browse -r -t _workstation._tcp | tee out >&2")
|
|
one.succeed("test `wc -l < out` -gt 0")
|
|
two.succeed("avahi-browse -r -t _workstation._tcp | tee out >&2")
|
|
two.succeed("test `wc -l < out` -gt 0")
|
|
|
|
# More DNS-SD.
|
|
one.execute('avahi-publish -s "This is a test" _test._tcp 123 one=1 >&2 &')
|
|
one.sleep(5)
|
|
two.succeed("avahi-browse -r -t _test._tcp | tee out >&2")
|
|
two.succeed("test `wc -l < out` -gt 0")
|
|
|
|
# NSS-mDNS.
|
|
one.succeed("getent hosts one.local >&2")
|
|
one.succeed("getent hosts two.local >&2")
|
|
two.succeed("getent hosts one.local >&2")
|
|
two.succeed("getent hosts two.local >&2")
|
|
|
|
# extra service definitions
|
|
one.succeed("avahi-browse -r -t _ssh._tcp | tee out >&2")
|
|
one.succeed("test `wc -l < out` -gt 0")
|
|
two.succeed("avahi-browse -r -t _ssh._tcp | tee out >&2")
|
|
two.succeed("test `wc -l < out` -gt 0")
|
|
|
|
one.log(one.execute("systemd-analyze security avahi-daemon.service | grep -v ✓")[1])
|
|
'';
|
|
} args
|