go-sendxmpp: init at 0.14.1 (#420727)
This commit is contained in:
commit
84ad8e2e9c
@ -1250,7 +1250,7 @@ in
|
|||||||
privoxy = runTest ./privoxy.nix;
|
privoxy = runTest ./privoxy.nix;
|
||||||
prometheus = import ./prometheus { inherit runTest; };
|
prometheus = import ./prometheus { inherit runTest; };
|
||||||
prometheus-exporters = handleTest ./prometheus-exporters.nix { };
|
prometheus-exporters = handleTest ./prometheus-exporters.nix { };
|
||||||
prosody = handleTest ./xmpp/prosody.nix { };
|
prosody = runTest ./xmpp/prosody.nix;
|
||||||
prosody-mysql = handleTest ./xmpp/prosody-mysql.nix { };
|
prosody-mysql = handleTest ./xmpp/prosody-mysql.nix { };
|
||||||
proxy = runTest ./proxy.nix;
|
proxy = runTest ./proxy.nix;
|
||||||
prowlarr = runTest ./prowlarr.nix;
|
prowlarr = runTest ./prowlarr.nix;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ let
|
|||||||
cert =
|
cert =
|
||||||
pkgs:
|
pkgs:
|
||||||
pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
|
pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
|
||||||
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=example.com/CN=muc.example.com/CN=matrix.example.com' -days 36500
|
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=example.com/CN=muc.example.com/CN=matrix.example.com' -addext "subjectAltName = DNS:example.com,DNS:muc.example.com,DNS:matrix.example.com" -days 36500
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp key.pem cert.pem $out
|
cp key.pem cert.pem $out
|
||||||
'';
|
'';
|
||||||
@ -14,7 +14,18 @@ in
|
|||||||
maintainers = [ ];
|
maintainers = [ ];
|
||||||
};
|
};
|
||||||
nodes = {
|
nodes = {
|
||||||
client =
|
client-a =
|
||||||
|
{ nodes, pkgs, ... }:
|
||||||
|
{
|
||||||
|
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
||||||
|
networking.extraHosts = ''
|
||||||
|
${nodes.server.networking.primaryIPAddress} example.com
|
||||||
|
'';
|
||||||
|
|
||||||
|
imports = [ ./go-sendxmpp-listen.nix ];
|
||||||
|
};
|
||||||
|
|
||||||
|
client-b =
|
||||||
{ nodes, pkgs, ... }:
|
{ nodes, pkgs, ... }:
|
||||||
{
|
{
|
||||||
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
||||||
@ -28,6 +39,7 @@ in
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
server =
|
server =
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
@ -310,7 +322,18 @@ in
|
|||||||
ejabberd_prefix + "register cthon98 example.com nothunter2",
|
ejabberd_prefix + "register cthon98 example.com nothunter2",
|
||||||
)
|
)
|
||||||
server.fail(ejabberd_prefix + "register asdf wrong.domain")
|
server.fail(ejabberd_prefix + "register asdf wrong.domain")
|
||||||
client.succeed("send-message")
|
|
||||||
|
for machine in client_a, client_b:
|
||||||
|
machine.systemctl("start network-online.target")
|
||||||
|
machine.wait_for_unit("network-online.target")
|
||||||
|
|
||||||
|
client_a.wait_for_unit("go-sendxmpp-listen")
|
||||||
|
client_b.succeed("send-message")
|
||||||
|
|
||||||
|
client_a.wait_until_succeeds(
|
||||||
|
"journalctl -o cat -u go-sendxmpp-listen.service | grep 'cthon98@example.com: Hello, this is dog.'"
|
||||||
|
)
|
||||||
|
|
||||||
server.succeed(
|
server.succeed(
|
||||||
ejabberd_prefix + "unregister cthon98 example.com",
|
ejabberd_prefix + "unregister cthon98 example.com",
|
||||||
ejabberd_prefix + "unregister azurediamond example.com",
|
ejabberd_prefix + "unregister azurediamond example.com",
|
||||||
|
|||||||
22
nixos/tests/xmpp/go-sendxmpp-listen.nix
Normal file
22
nixos/tests/xmpp/go-sendxmpp-listen.nix
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
systemd.services.go-sendxmpp-listen = {
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
requires = [ "network-online.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = ''
|
||||||
|
${lib.getExe pkgs.go-sendxmpp} --username azurediamond@example.com --password hunter2 --listen
|
||||||
|
'';
|
||||||
|
Environment = [
|
||||||
|
"HOME=/var/lib/go-sendxmpp/"
|
||||||
|
];
|
||||||
|
DynamicUser = true;
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = "5s";
|
||||||
|
StateDirectory = "go-sendxmpp";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -1,9 +1,11 @@
|
|||||||
|
{ ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cert =
|
cert =
|
||||||
pkgs:
|
pkgs:
|
||||||
pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
|
pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
|
||||||
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -days 365 \
|
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -days 365 \
|
||||||
-subj '/C=GB/CN=example.com' -addext "subjectAltName = DNS:example.com,DNS:uploads.example.com,DNS:conference.example.com"
|
-subj '/C=GB/CN=example.com/CN=uploads.example.com/CN=conference.example.com' -addext "subjectAltName = DNS:example.com,DNS:uploads.example.com,DNS:conference.example.com"
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp key.pem cert.pem $out
|
cp key.pem cert.pem $out
|
||||||
'';
|
'';
|
||||||
@ -29,10 +31,21 @@ let
|
|||||||
prosodyctl deluser azurediamond@example.com
|
prosodyctl deluser azurediamond@example.com
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
import ../make-test-python.nix {
|
{
|
||||||
name = "prosody";
|
name = "prosody";
|
||||||
nodes = {
|
nodes = {
|
||||||
client =
|
client-a =
|
||||||
|
{ nodes, pkgs, ... }:
|
||||||
|
{
|
||||||
|
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
||||||
|
networking.extraHosts = ''
|
||||||
|
${nodes.server.networking.primaryIPAddress} example.com
|
||||||
|
'';
|
||||||
|
|
||||||
|
imports = [ ./go-sendxmpp-listen.nix ];
|
||||||
|
};
|
||||||
|
|
||||||
|
client-b =
|
||||||
{
|
{
|
||||||
nodes,
|
nodes,
|
||||||
pkgs,
|
pkgs,
|
||||||
@ -93,7 +106,18 @@ import ../make-test-python.nix {
|
|||||||
server.succeed('prosodyctl status | grep "Prosody is running"')
|
server.succeed('prosodyctl status | grep "Prosody is running"')
|
||||||
|
|
||||||
server.succeed("create-prosody-users")
|
server.succeed("create-prosody-users")
|
||||||
client.succeed("send-message")
|
|
||||||
|
for machine in client_a, client_b:
|
||||||
|
machine.systemctl("start network-online.target")
|
||||||
|
machine.wait_for_unit("network-online.target")
|
||||||
|
|
||||||
|
client_a.wait_for_unit("go-sendxmpp-listen")
|
||||||
|
client_b.succeed("send-message")
|
||||||
|
|
||||||
|
client_a.wait_until_succeeds(
|
||||||
|
"journalctl -o cat -u go-sendxmpp-listen.service | grep 'cthon98@example.com: Hello, this is dog.'"
|
||||||
|
)
|
||||||
|
|
||||||
server.succeed("delete-prosody-users")
|
server.succeed("delete-prosody-users")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
39
pkgs/by-name/go/go-sendxmpp/package.nix
Normal file
39
pkgs/by-name/go/go-sendxmpp/package.nix
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
buildGoModule,
|
||||||
|
fetchFromGitLab,
|
||||||
|
lib,
|
||||||
|
nix-update-script,
|
||||||
|
testers,
|
||||||
|
}:
|
||||||
|
|
||||||
|
buildGoModule (finalAttrs: {
|
||||||
|
pname = "go-sendxmpp";
|
||||||
|
version = "0.14.1";
|
||||||
|
|
||||||
|
src = fetchFromGitLab {
|
||||||
|
domain = "salsa.debian.org";
|
||||||
|
owner = "mdosch";
|
||||||
|
repo = "go-sendxmpp";
|
||||||
|
tag = "v${finalAttrs.version}";
|
||||||
|
hash = "sha256-nQ2URhkOp0mb4u4IG3wzGIdhP6svDVMctbu2CHQXj2Y=";
|
||||||
|
};
|
||||||
|
|
||||||
|
vendorHash = "sha256-aMhUsYsQvnhEVkWbjbh84bbStQ4b/0ZHEvzEhXSlFyw=";
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
tests.version = testers.testVersion {
|
||||||
|
package = finalAttrs.finalPackage;
|
||||||
|
};
|
||||||
|
updateScript = nix-update-script { };
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Tool to send messages or files to an XMPP contact or MUC";
|
||||||
|
homepage = "https://salsa.debian.org/mdosch/go-sendxmpp";
|
||||||
|
license = lib.licenses.bsd2;
|
||||||
|
maintainers = with lib.maintainers; [
|
||||||
|
jpds
|
||||||
|
];
|
||||||
|
mainProgram = "go-sendxmpp";
|
||||||
|
};
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user