mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-29 09:04:17 +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
112 lines
3.3 KiB
Nix
112 lines
3.3 KiB
Nix
let
|
|
cert =
|
|
pkgs:
|
|
pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
|
|
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=example.com/CN=uploads.example.com/CN=conference.example.com' -days 36500
|
|
mkdir -p $out
|
|
cp key.pem cert.pem $out
|
|
'';
|
|
createUsers =
|
|
pkgs:
|
|
pkgs.writeScriptBin "create-prosody-users" ''
|
|
#!${pkgs.bash}/bin/bash
|
|
set -e
|
|
|
|
# Creates and set password for the 2 xmpp test users.
|
|
#
|
|
# Doing that in a bash script instead of doing that in the test
|
|
# script allow us to easily provision the users when running that
|
|
# test interactively.
|
|
|
|
prosodyctl register cthon98 example.com nothunter2
|
|
prosodyctl register azurediamond example.com hunter2
|
|
'';
|
|
delUsers =
|
|
pkgs:
|
|
pkgs.writeScriptBin "delete-prosody-users" ''
|
|
#!${pkgs.bash}/bin/bash
|
|
set -e
|
|
|
|
# Deletes the test users.
|
|
#
|
|
# Doing that in a bash script instead of doing that in the test
|
|
# script allow us to easily provision the users when running that
|
|
# test interactively.
|
|
|
|
prosodyctl deluser cthon98@example.com
|
|
prosodyctl deluser azurediamond@example.com
|
|
'';
|
|
in
|
|
import ../make-test-python.nix {
|
|
name = "prosody";
|
|
nodes = {
|
|
client =
|
|
{
|
|
nodes,
|
|
pkgs,
|
|
config,
|
|
...
|
|
}:
|
|
{
|
|
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
|
console.keyMap = "fr-bepo";
|
|
networking.extraHosts = ''
|
|
${nodes.server.config.networking.primaryIPAddress} example.com
|
|
${nodes.server.config.networking.primaryIPAddress} conference.example.com
|
|
${nodes.server.config.networking.primaryIPAddress} uploads.example.com
|
|
'';
|
|
environment.systemPackages = [
|
|
(pkgs.callPackage ./xmpp-sendmessage.nix { connectTo = "example.com"; })
|
|
];
|
|
};
|
|
server =
|
|
{ config, pkgs, ... }:
|
|
{
|
|
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
|
console.keyMap = "fr-bepo";
|
|
networking.extraHosts = ''
|
|
${config.networking.primaryIPAddress} example.com
|
|
${config.networking.primaryIPAddress} conference.example.com
|
|
${config.networking.primaryIPAddress} uploads.example.com
|
|
'';
|
|
networking.firewall.enable = false;
|
|
environment.systemPackages = [
|
|
(createUsers pkgs)
|
|
(delUsers pkgs)
|
|
];
|
|
services.prosody = {
|
|
enable = true;
|
|
ssl.cert = "${cert pkgs}/cert.pem";
|
|
ssl.key = "${cert pkgs}/key.pem";
|
|
virtualHosts.example = {
|
|
domain = "example.com";
|
|
enabled = true;
|
|
ssl.cert = "${cert pkgs}/cert.pem";
|
|
ssl.key = "${cert pkgs}/key.pem";
|
|
};
|
|
muc = [
|
|
{
|
|
domain = "conference.example.com";
|
|
}
|
|
];
|
|
uploadHttp = {
|
|
domain = "uploads.example.com";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript =
|
|
{ nodes, ... }:
|
|
''
|
|
# Check with sqlite storage
|
|
start_all()
|
|
server.wait_for_unit("prosody.service")
|
|
server.succeed('prosodyctl status | grep "Prosody is running"')
|
|
|
|
server.succeed("create-prosody-users")
|
|
client.succeed("send-message")
|
|
server.succeed("delete-prosody-users")
|
|
'';
|
|
}
|