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
60 lines
1.8 KiB
Nix
60 lines
1.8 KiB
Nix
let
|
|
gopherRoot = "/tmp/gopher";
|
|
gopherHost = "gopherd";
|
|
gopherClient = "client";
|
|
fileContent = "Hello Gopher!\n";
|
|
fileName = "file.txt";
|
|
in
|
|
import ./make-test-python.nix (
|
|
{ ... }:
|
|
{
|
|
name = "spacecookie";
|
|
nodes = {
|
|
${gopherHost} = {
|
|
systemd.services.spacecookie = {
|
|
preStart = ''
|
|
mkdir -p ${gopherRoot}/directory
|
|
printf "%s" "${fileContent}" > ${gopherRoot}/${fileName}
|
|
'';
|
|
};
|
|
|
|
services.spacecookie = {
|
|
enable = true;
|
|
openFirewall = true;
|
|
settings = {
|
|
root = gopherRoot;
|
|
hostname = gopherHost;
|
|
};
|
|
};
|
|
};
|
|
|
|
${gopherClient} = { };
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
# with daemon type notify, the unit being started
|
|
# should also mean the port is open
|
|
${gopherHost}.wait_for_unit("spacecookie.service")
|
|
${gopherClient}.wait_for_unit("network.target")
|
|
|
|
fileResponse = ${gopherClient}.succeed("curl -f -s gopher://${gopherHost}/0/${fileName}")
|
|
|
|
# the file response should return our created file exactly
|
|
if not (fileResponse == "${builtins.replaceStrings [ "\n" ] [ "\\n" ] fileContent}"):
|
|
raise Exception("Unexpected file response")
|
|
|
|
# sanity check on the directory listing: we serve a directory and a file
|
|
# via gopher, so the directory listing should have exactly two entries,
|
|
# one with gopher file type 0 (file) and one with file type 1 (directory).
|
|
dirResponse = ${gopherClient}.succeed("curl -f -s gopher://${gopherHost}")
|
|
dirEntries = [l[0] for l in dirResponse.split("\n") if len(l) > 0]
|
|
dirEntries.sort()
|
|
|
|
if not (["0", "1"] == dirEntries):
|
|
raise Exception("Unexpected directory response")
|
|
'';
|
|
}
|
|
)
|