mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-16 23:20:56 +03:00

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-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev 0128fbb0a5
result/bin/apply-formatting $NIXPKGS_PATH
93 lines
3 KiB
Nix
93 lines
3 KiB
Nix
import ./make-test-python.nix (
|
|
{ pkgs, ... }:
|
|
|
|
let
|
|
port = 10004;
|
|
tcpPort = 10005;
|
|
httpPort = 10080;
|
|
tcpStreamPort = 10006;
|
|
bufferSize = 742;
|
|
in
|
|
{
|
|
name = "snapcast";
|
|
meta = with pkgs.lib.maintainers; {
|
|
maintainers = [ hexa ];
|
|
};
|
|
|
|
nodes = {
|
|
server = {
|
|
services.snapserver = {
|
|
enable = true;
|
|
port = port;
|
|
tcp.port = tcpPort;
|
|
http.port = httpPort;
|
|
openFirewall = true;
|
|
buffer = bufferSize;
|
|
streams = {
|
|
mpd = {
|
|
type = "pipe";
|
|
location = "/run/snapserver/mpd";
|
|
query.mode = "create";
|
|
};
|
|
bluetooth = {
|
|
type = "pipe";
|
|
location = "/run/snapserver/bluetooth";
|
|
};
|
|
tcp = {
|
|
type = "tcp";
|
|
location = "127.0.0.1:${toString tcpStreamPort}";
|
|
};
|
|
meta = {
|
|
type = "meta";
|
|
location = "/mpd/bluetooth/tcp";
|
|
};
|
|
};
|
|
};
|
|
environment.systemPackages = [ pkgs.snapcast ];
|
|
};
|
|
client = {
|
|
environment.systemPackages = [ pkgs.snapcast ];
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
import json
|
|
|
|
get_rpc_version = {"id": "1", "jsonrpc": "2.0", "method": "Server.GetRPCVersion"}
|
|
|
|
start_all()
|
|
|
|
server.wait_for_unit("snapserver.service")
|
|
server.wait_until_succeeds("ss -ntl | grep -q ${toString port}")
|
|
server.wait_until_succeeds("ss -ntl | grep -q ${toString tcpPort}")
|
|
server.wait_until_succeeds("ss -ntl | grep -q ${toString httpPort}")
|
|
server.wait_until_succeeds("ss -ntl | grep -q ${toString tcpStreamPort}")
|
|
|
|
with subtest("check that pipes are created"):
|
|
server.succeed("test -p /run/snapserver/mpd")
|
|
server.succeed("test -p /run/snapserver/bluetooth")
|
|
|
|
with subtest("test tcp json-rpc"):
|
|
server.succeed(f"echo '{json.dumps(get_rpc_version)}' | nc -w 1 localhost ${toString tcpPort}")
|
|
|
|
with subtest("test http json-rpc"):
|
|
server.succeed(
|
|
"curl --fail http://localhost:${toString httpPort}/jsonrpc -d '{json.dumps(get_rpc_version)}'"
|
|
)
|
|
|
|
with subtest("test a ipv6 connection"):
|
|
server.execute("systemd-run --unit=snapcast-local-client snapclient -h ::1 -p ${toString port}")
|
|
server.wait_until_succeeds(
|
|
"journalctl -o cat -u snapserver.service | grep -q 'Hello from'"
|
|
)
|
|
server.wait_until_succeeds("journalctl -o cat -u snapcast-local-client | grep -q 'buffer: ${toString bufferSize}'")
|
|
|
|
with subtest("test a connection"):
|
|
client.execute("systemd-run --unit=snapcast-client snapclient -h server -p ${toString port}")
|
|
server.wait_until_succeeds(
|
|
"journalctl -o cat -u snapserver.service | grep -q 'Hello from'"
|
|
)
|
|
client.wait_until_succeeds("journalctl -o cat -u snapcast-client | grep -q 'buffer: ${toString bufferSize}'")
|
|
'';
|
|
}
|
|
)
|