2020-10-27 00:29:36 +00:00
|
|
|
{ stdenv, croc }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "croc-test-local-relay";
|
2023-03-04 12:14:45 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ croc ];
|
|
|
|
|
2020-10-27 00:29:36 +00:00
|
|
|
buildCommand = ''
|
2023-03-04 12:14:45 +00:00
|
|
|
HOME=$(mktemp -d)
|
|
|
|
# start a local relay
|
|
|
|
croc relay --ports 11111,11112 &
|
|
|
|
# start sender in background
|
|
|
|
MSG="See you later, alligator!"
|
|
|
|
croc --relay localhost:11111 send --code correct-horse-battery-staple --text "$MSG" &
|
|
|
|
# wait for things to settle
|
|
|
|
sleep 1
|
|
|
|
MSG2=$(croc --relay localhost:11111 --yes correct-horse-battery-staple)
|
|
|
|
# compare
|
|
|
|
[ "$MSG" = "$MSG2" ] && touch $out
|
2020-10-27 00:29:36 +00:00
|
|
|
'';
|
2023-03-04 12:14:45 +00:00
|
|
|
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
timeout = 300;
|
|
|
|
broken = stdenv.isDarwin;
|
|
|
|
};
|
2020-10-27 00:29:36 +00:00
|
|
|
}
|