daemon tests for gotosocial
This commit is contained in:
parent
7f4a5a35ca
commit
ccd37ee169
7 changed files with 201 additions and 129 deletions
18
package.nix
18
package.nix
|
|
@ -10,6 +10,7 @@
|
|||
rustHooks,
|
||||
rustPackages,
|
||||
versionCheckHook,
|
||||
writeScript,
|
||||
}: lib.callWith' rustPackages ({
|
||||
rustPlatform,
|
||||
cargo,
|
||||
|
|
@ -37,12 +38,29 @@ in {
|
|||
cp -r --reflink=auto "$dynixCommand/"* "$out/"
|
||||
mkdir -p "$modules"
|
||||
cp -r --reflink=auto "$dynixModules/"* "$modules/"
|
||||
install -Dm a=rx "$dynixTestingClient" "$out/libexec/dynix-testing-client.py"
|
||||
'';
|
||||
|
||||
#
|
||||
# SUB-DERIVATONS
|
||||
#
|
||||
|
||||
dynixTestingClient = writeScript "dynix-testing-client.py" ''
|
||||
#!/usr/bin/env python3
|
||||
import socket, sys, os, json
|
||||
try:
|
||||
sockpath = sys.argv[1]
|
||||
except IndexError:
|
||||
sockpath = f"{os.environ['XDG_RUNTIME_DIR']}/dynix.sock"
|
||||
sock = socket.socket(family=socket.AF_UNIX)
|
||||
sock.connect(sockpath)
|
||||
sock.sendall(sys.stdin.buffer.read())
|
||||
sock.settimeout(20)
|
||||
reply = json.loads(sock.recv(256).decode("utf-8"))
|
||||
print(json.dumps(reply, indent=2))
|
||||
sys.exit(reply["status"])
|
||||
'';
|
||||
|
||||
dynixCommand = stdenv.mkDerivation {
|
||||
pname = "${self.pname}-command";
|
||||
inherit (self) version;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue