From a3a1cdd9e5166a7a28d92416e31cd0203f42e572 Mon Sep 17 00:00:00 2001 From: Per Stark Date: Wed, 18 Sep 2024 12:29:27 +0200 Subject: [PATCH] init new file: .aider.chat.history.md --- .aider.chat.history.md | 1489 +++++++++++++ .aider.input.history | 81 + .aider.tags.cache.v3/cache.db | Bin 0 -> 40960 bytes .direnv/bin/nix-direnv-reload | 19 + .../27ngl7fjjjyyp3qj6473nimn8mf6wmh8-source | 1 + .../2mx7dgmxwvdi802a4w0qzayi0ypgsaf7-source | 1 + .../2nnisw4pxbifisbkg58hrnis9ycs5ah1-source | 1 + .../4pr5px39qgxw4fdanjp34w0cjj552db1-source | 1 + .../6m45a85nxn2l4ssszk6m9njfi5jrwp4y-source | 1 + .../7bw9ki9cydb5lqpyll0869j7yfiahkxl-source | 1 + .../8kpx53qi52yhjai1vdw8zpa95iqa61bv-source | 1 + .../8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source | 1 + .../93465j6iyz56rmkx7h9d37z5xjjsbxz1-source | 1 + .../dlrwkbfzbag8f4xj2kbixalscj206j45-source | 1 + .../f2h5kmarn194yda41znm0r4ibwyg8z7i-source | 1 + .../g5v3sgqy6a0fsmas7mnapc196flrplix-source | 1 + .../hwsdv71bmaqvzbii5viryxc8slw4vr5v-source | 1 + .../i4ginw25yf2q0shnzvzjjwa58srbjhw7-source | 1 + .../i4nv0mdcx8iifh3r71qd0pbp8al8kp1z-source | 1 + .../ia8xy09wg9si4lbbxgzbyyg1n0qxg1vk-source | 1 + .../kiql8yfk0mf5kkxs3hzxvkryci22lba5-source | 1 + .../lhbcw63xdqclg2hrni4p7dc90nl996lk-source | 1 + .../lmizwzdnxg2933jbwb5d7iadlw1nk1za-source | 1 + .../lqkqmxm7drrgm45dfjjxbw0dk28hrci2-source | 1 + .../mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-source | 1 + .../r2ip1850igy8kciyaagw502s3c6ph1s4-source | 1 + .../sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source | 1 + .../v1wzqsqi3d9fhdl60n24sqhj7pr3yhin-source | 1 + .../xvyy5vh6cg7958a26p2bqyz6jg5wkz4g-source | 1 + .../yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source | 1 + ...e-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa | 1 + ...5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc | 1971 +++++++++++++++++ .envrc | 10 + .gitignore | 8 + Cargo.lock | 949 ++++++++ Cargo.toml | 24 + doc.rs | 103 + flake.lock | 658 ++++++ flake.nix | 51 + src/consumer.rs | 21 +- src/lib.rs | 1 + src/rabbitmq/mod.rs | 59 +- src/server.rs | 45 +- 43 files changed, 5419 insertions(+), 97 deletions(-) create mode 100644 .aider.chat.history.md create mode 100644 .aider.input.history create mode 100644 .aider.tags.cache.v3/cache.db create mode 100755 .direnv/bin/nix-direnv-reload create mode 120000 .direnv/flake-inputs/27ngl7fjjjyyp3qj6473nimn8mf6wmh8-source create mode 120000 .direnv/flake-inputs/2mx7dgmxwvdi802a4w0qzayi0ypgsaf7-source create mode 120000 .direnv/flake-inputs/2nnisw4pxbifisbkg58hrnis9ycs5ah1-source create mode 120000 .direnv/flake-inputs/4pr5px39qgxw4fdanjp34w0cjj552db1-source create mode 120000 .direnv/flake-inputs/6m45a85nxn2l4ssszk6m9njfi5jrwp4y-source create mode 120000 .direnv/flake-inputs/7bw9ki9cydb5lqpyll0869j7yfiahkxl-source create mode 120000 .direnv/flake-inputs/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source create mode 120000 .direnv/flake-inputs/8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source create mode 120000 .direnv/flake-inputs/93465j6iyz56rmkx7h9d37z5xjjsbxz1-source create mode 120000 .direnv/flake-inputs/dlrwkbfzbag8f4xj2kbixalscj206j45-source create mode 120000 .direnv/flake-inputs/f2h5kmarn194yda41znm0r4ibwyg8z7i-source create mode 120000 .direnv/flake-inputs/g5v3sgqy6a0fsmas7mnapc196flrplix-source create mode 120000 .direnv/flake-inputs/hwsdv71bmaqvzbii5viryxc8slw4vr5v-source create mode 120000 .direnv/flake-inputs/i4ginw25yf2q0shnzvzjjwa58srbjhw7-source create mode 120000 .direnv/flake-inputs/i4nv0mdcx8iifh3r71qd0pbp8al8kp1z-source create mode 120000 .direnv/flake-inputs/ia8xy09wg9si4lbbxgzbyyg1n0qxg1vk-source create mode 120000 .direnv/flake-inputs/kiql8yfk0mf5kkxs3hzxvkryci22lba5-source create mode 120000 .direnv/flake-inputs/lhbcw63xdqclg2hrni4p7dc90nl996lk-source create mode 120000 .direnv/flake-inputs/lmizwzdnxg2933jbwb5d7iadlw1nk1za-source create mode 120000 .direnv/flake-inputs/lqkqmxm7drrgm45dfjjxbw0dk28hrci2-source create mode 120000 .direnv/flake-inputs/mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-source create mode 120000 .direnv/flake-inputs/r2ip1850igy8kciyaagw502s3c6ph1s4-source create mode 120000 .direnv/flake-inputs/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source create mode 120000 .direnv/flake-inputs/v1wzqsqi3d9fhdl60n24sqhj7pr3yhin-source create mode 120000 .direnv/flake-inputs/xvyy5vh6cg7958a26p2bqyz6jg5wkz4g-source create mode 120000 .direnv/flake-inputs/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source create mode 120000 .direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa create mode 100644 .direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 doc.rs create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 src/lib.rs diff --git a/.aider.chat.history.md b/.aider.chat.history.md new file mode 100644 index 0000000..6f0b9f2 --- /dev/null +++ b/.aider.chat.history.md @@ -0,0 +1,1489 @@ + +# aider chat started at 2024-09-18 11:45:09 + +> Newer aider version v0.56.0 is available. To upgrade, run: +> /nix/store/30dxq7znh2rgb9n0nvdjhqw0qrfv99fq-python3-3.11.9/bin/python3.11 -m pip install --upgrade aider-chat +> Run pip install? (Y)es/(N)o [Yes]: n +> Add .aider* to .gitignore (recommended)? (Y)es/(N)o [Yes]: y +> Added .aider* to .gitignore +> /nix/store/j81sx35742arfnbgsx125j0lw25wbsll-aider-chat-0.54.0/bin/aider +> Aider v0.54.0 +> Main model: gpt-4o-2024-08-06 with diff edit format +> Weak model: gpt-4o-mini +> Git repo: .git with 0 files +> Repo-map: using 1024 tokens, auto refresh +> Use /help for help, run "aider --help" to see cmd line args + +# aider chat started at 2024-09-18 12:15:57 + +> /nix/store/j81sx35742arfnbgsx125j0lw25wbsll-aider-chat-0.54.0/bin/aider +> Aider v0.54.0 +> Main model: gpt-4o-2024-08-06 with diff edit format +> Weak model: gpt-4o-mini +> Git repo: .git with 0 files +> Repo-map: using 1024 tokens, auto refresh +> Use /help for help, run "aider --help" to see cmd line args + +#### /help +> /add Add files to the chat so aider can edit them or review them in detail +> /ask Ask questions about the code base without editing any files +> /chat-mode Switch to a new chat mode +> /clear Clear the chat history +> /clipboard Add image/text from the clipboard to the chat (optionally provide a name for the image) +> /code Ask for changes to your code +> /commit Commit edits to the repo made outside the chat (commit message optional) +> /diff Display the diff of changes since the last message +> /drop Remove files from the chat session to free up context space +> /exit Exit the application +> /git Run a git command +> /help Ask questions about aider +> /lint Lint and fix in-chat files or all dirty files if none in chat +> /ls List all known files and indicate which are included in the chat session +> /map Print out the current repository map +> /map-refresh Force a refresh of the repository map +> /model Switch to a new LLM +> /models Search the list of available models +> /quit Exit the application +> /read-only Add files to the chat that are for reference, not to be edited +> /reset Drop all files and clear the chat history +> /run Run a shell command and optionally add the output to the chat (alias: !) +> /test Run a shell command and add the output to the chat on non-zero exit code +> /tokens Report on the number of tokens used by the current chat context +> /undo Undo the last git commit if it was done by aider +> /voice Record and transcribe voice input +> /web Scrape a webpage, convert to markdown and send in a message +> Use `/help ` to ask questions about how to use aider. + +#### /models +> Please provide a partial model name to search for. + +#### /models gpt +> Models which match "gpt": +> - azure/global-standard/gpt-4o-2024-08-06 +> - azure/global-standard/gpt-4o-mini +> - azure/gpt-35-turbo +> - azure/gpt-35-turbo-0125 +> - azure/gpt-35-turbo-1106 +> - azure/gpt-35-turbo-16k +> - azure/gpt-35-turbo-16k-0613 +> - azure/gpt-4 +> - azure/gpt-4-0125-preview +> - azure/gpt-4-0613 +> - azure/gpt-4-1106-preview +> - azure/gpt-4-32k +> - azure/gpt-4-32k-0613 +> - azure/gpt-4-turbo +> - azure/gpt-4-turbo-2024-04-09 +> - azure/gpt-4-turbo-vision-preview +> - azure/gpt-4o +> - azure/gpt-4o-2024-08-06 +> - azure/gpt-4o-mini +> - chatgpt-4o-latest +> - deepinfra/jondurbin/airoboros-l2-70b-gpt4-1.4.1 +> - ft:gpt-3.5-turbo +> - ft:gpt-3.5-turbo-0125 +> - ft:gpt-3.5-turbo-0613 +> - ft:gpt-3.5-turbo-1106 +> - ft:gpt-4-0613 +> - ft:gpt-4o-2024-08-06 +> - ft:gpt-4o-mini-2024-07-18 +> - gpt-3.5-turbo +> - gpt-3.5-turbo-0125 +> - gpt-3.5-turbo-0301 +> - gpt-3.5-turbo-0613 +> - gpt-3.5-turbo-1106 +> - gpt-3.5-turbo-16k +> - gpt-3.5-turbo-16k-0613 +> - gpt-4 +> - gpt-4-0125-preview +> - gpt-4-0314 +> - gpt-4-0613 +> - gpt-4-1106-preview +> - gpt-4-1106-vision-preview +> - gpt-4-32k +> - gpt-4-32k-0314 +> - gpt-4-32k-0613 +> - gpt-4-turbo +> - gpt-4-turbo-2024-04-09 +> - gpt-4-turbo-preview +> - gpt-4-vision-preview +> - gpt-4o +> - gpt-4o-2024-05-13 +> - gpt-4o-2024-08-06 +> - gpt-4o-mini +> - gpt-4o-mini-2024-07-18 +> - openai/chatgpt-4o-latest +> - openai/ft:gpt-3.5-turbo +> - openai/ft:gpt-3.5-turbo-0125 +> - openai/ft:gpt-3.5-turbo-0613 +> - openai/ft:gpt-3.5-turbo-1106 +> - openai/ft:gpt-4-0613 +> - openai/ft:gpt-4o-2024-08-06 +> - openai/ft:gpt-4o-mini-2024-07-18 +> - openai/gpt-3.5-turbo +> - openai/gpt-3.5-turbo-0125 +> - openai/gpt-3.5-turbo-0301 +> - openai/gpt-3.5-turbo-0613 +> - openai/gpt-3.5-turbo-1106 +> - openai/gpt-3.5-turbo-16k +> - openai/gpt-3.5-turbo-16k-0613 +> - openai/gpt-4 +> - openai/gpt-4-0125-preview +> - openai/gpt-4-0314 +> - openai/gpt-4-0613 +> - openai/gpt-4-1106-preview +> - openai/gpt-4-1106-vision-preview +> - openai/gpt-4-32k +> - openai/gpt-4-32k-0314 +> - openai/gpt-4-32k-0613 +> - openai/gpt-4-turbo +> - openai/gpt-4-turbo-2024-04-09 +> - openai/gpt-4-turbo-preview +> - openai/gpt-4-vision-preview +> - openai/gpt-4o +> - openai/gpt-4o-2024-05-13 +> - openai/gpt-4o-2024-08-06 +> - openai/gpt-4o-mini +> - openai/gpt-4o-mini-2024-07-18 +> - openrouter/openai/gpt-3.5-turbo +> - openrouter/openai/gpt-3.5-turbo-16k +> - openrouter/openai/gpt-4 +> - openrouter/openai/gpt-4-vision-preview +> - openrouter/openai/gpt-4o +> - openrouter/openai/gpt-4o-2024-05-13 + +#### /models sonett +> No models match "sonett". + +#### /models sonnett +> No models match "sonnett". + +#### /models openrouter/anth +> Models which match "openrouter/anth": +> - openrouter/anthropic/claude-2 +> - openrouter/anthropic/claude-3-haiku +> - openrouter/anthropic/claude-3-haiku-20240307 +> - openrouter/anthropic/claude-3-opus +> - openrouter/anthropic/claude-3-sonnet +> - openrouter/anthropic/claude-3.5-sonnet +> - openrouter/anthropic/claude-3.5-sonnet:beta +> - openrouter/anthropic/claude-instant-v1 + +#### /model openrouter/anthropic/claude-3.5-sonnet +> Aider v0.54.0 +> Main model: openrouter/anthropic/claude-3.5-sonnet with diff edit format, infinite output +> Weak model: openrouter/anthropic/claude-3-haiku-20240307 +> Git repo: .git with 0 files +> Repo-map: using 1024 tokens, auto refresh + +#### /map-refresh + +#### /help +> /add Add files to the chat so aider can edit them or review them in detail +> /ask Ask questions about the code base without editing any files +> /chat-mode Switch to a new chat mode +> /clear Clear the chat history +> /clipboard Add image/text from the clipboard to the chat (optionally provide a name for the image) +> /code Ask for changes to your code +> /commit Commit edits to the repo made outside the chat (commit message optional) +> /diff Display the diff of changes since the last message +> /drop Remove files from the chat session to free up context space +> /exit Exit the application +> /git Run a git command +> /help Ask questions about aider +> /lint Lint and fix in-chat files or all dirty files if none in chat +> /ls List all known files and indicate which are included in the chat session +> /map Print out the current repository map +> /map-refresh Force a refresh of the repository map +> /model Switch to a new LLM +> /models Search the list of available models +> /quit Exit the application +> /read-only Add files to the chat that are for reference, not to be edited +> /reset Drop all files and clear the chat history +> /run Run a shell command and optionally add the output to the chat (alias: !) +> /test Run a shell command and add the output to the chat on non-zero exit code +> /tokens Report on the number of tokens used by the current chat context +> /undo Undo the last git commit if it was done by aider +> /voice Record and transcribe voice input +> /web Scrape a webpage, convert to markdown and send in a message +> Use `/help ` to ask questions about how to use aider. + +#### /map +> No repository map available. + +#### /git add . +> + +#### /map +> Repo-map can't include /nix/store/27ngl7fjjjyyp3qj6473nimn8mf6wmh8-source, it is not a normal file +> Repo-map can't include /nix/store/2mx7dgmxwvdi802a4w0qzayi0ypgsaf7-source, it is not a normal file +> Repo-map can't include /nix/store/2nnisw4pxbifisbkg58hrnis9ycs5ah1-source, it is not a normal file +> Repo-map can't include /nix/store/4pr5px39qgxw4fdanjp34w0cjj552db1-source, it is not a normal file +> Repo-map can't include /nix/store/6m45a85nxn2l4ssszk6m9njfi5jrwp4y-source, it is not a normal file +> Repo-map can't include /nix/store/7bw9ki9cydb5lqpyll0869j7yfiahkxl-source, it is not a normal file +> Repo-map can't include /nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source, it is not a normal file +> Repo-map can't include /nix/store/8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source, it is not a normal file +> Repo-map can't include /nix/store/93465j6iyz56rmkx7h9d37z5xjjsbxz1-source, it is not a normal file +> Repo-map can't include /nix/store/dlrwkbfzbag8f4xj2kbixalscj206j45-source, it is not a normal file +> Repo-map can't include /nix/store/f2h5kmarn194yda41znm0r4ibwyg8z7i-source, it is not a normal file +> Repo-map can't include /nix/store/g5v3sgqy6a0fsmas7mnapc196flrplix-source, it is not a normal file +> Repo-map can't include /nix/store/hwsdv71bmaqvzbii5viryxc8slw4vr5v-source, it is not a normal file +> Repo-map can't include /nix/store/i4ginw25yf2q0shnzvzjjwa58srbjhw7-source, it is not a normal file +> Repo-map can't include /nix/store/i4nv0mdcx8iifh3r71qd0pbp8al8kp1z-source, it is not a normal file +> Repo-map can't include /nix/store/ia8xy09wg9si4lbbxgzbyyg1n0qxg1vk-source, it is not a normal file +> Repo-map can't include /nix/store/kiql8yfk0mf5kkxs3hzxvkryci22lba5-source, it is not a normal file +> Repo-map can't include /nix/store/lhbcw63xdqclg2hrni4p7dc90nl996lk-source, it is not a normal file +> Repo-map can't include /nix/store/lmizwzdnxg2933jbwb5d7iadlw1nk1za-source, it is not a normal file +> Repo-map can't include /nix/store/lqkqmxm7drrgm45dfjjxbw0dk28hrci2-source, it is not a normal file +> Repo-map can't include /nix/store/mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-source, it is not a normal file +> Repo-map can't include /nix/store/r2ip1850igy8kciyaagw502s3c6ph1s4-source, it is not a normal file +> Repo-map can't include /nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source, it is not a normal file +> Repo-map can't include /nix/store/v1wzqsqi3d9fhdl60n24sqhj7pr3yhin-source, it is not a normal file +> Repo-map can't include /nix/store/xvyy5vh6cg7958a26p2bqyz6jg5wkz4g-source, it is not a normal file +> Repo-map can't include /nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source, it is not a normal file +> Here are summaries of some files present in my git repository. +Do not propose changes to these files, treat them as *read-only*. +If you need to edit any of these files, ask me to *add them to the chat* first. + +../../../../nix/store/27ngl7fjjjyyp3qj6473nimn8mf6wmh8-source + +../../../../nix/store/2mx7dgmxwvdi802a4w0qzayi0ypgsaf7-source + +../../../../nix/store/2nnisw4pxbifisbkg58hrnis9ycs5ah1-source + +../../../../nix/store/4pr5px39qgxw4fdanjp34w0cjj552db1-source + +../../../../nix/store/6m45a85nxn2l4ssszk6m9njfi5jrwp4y-source + +../../../../nix/store/7bw9ki9cydb5lqpyll0869j7yfiahkxl-source + +../../../../nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source + +../../../../nix/store/8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source + +../../../../nix/store/93465j6iyz56rmkx7h9d37z5xjjsbxz1-source + +../../../../nix/store/dlrwkbfzbag8f4xj2kbixalscj206j45-source + +../../../../nix/store/f2h5kmarn194yda41znm0r4ibwyg8z7i-source + +../../../../nix/store/g5v3sgqy6a0fsmas7mnapc196flrplix-source + +../../../../nix/store/hwsdv71bmaqvzbii5viryxc8slw4vr5v-source + +../../../../nix/store/i4ginw25yf2q0shnzvzjjwa58srbjhw7-source + +../../../../nix/store/i4nv0mdcx8iifh3r71qd0pbp8al8kp1z-source + +../../../../nix/store/ia8xy09wg9si4lbbxgzbyyg1n0qxg1vk-source + +../../../../nix/store/kiql8yfk0mf5kkxs3hzxvkryci22lba5-source + +../../../../nix/store/lhbcw63xdqclg2hrni4p7dc90nl996lk-source + +../../../../nix/store/lmizwzdnxg2933jbwb5d7iadlw1nk1za-source + +../../../../nix/store/lqkqmxm7drrgm45dfjjxbw0dk28hrci2-source + +../../../../nix/store/mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-source + +../../../../nix/store/r2ip1850igy8kciyaagw502s3c6ph1s4-source + +../../../../nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source + +../../../../nix/store/v1wzqsqi3d9fhdl60n24sqhj7pr3yhin-source + +../../../../nix/store/wvi4ddidwzcgcc0maq72p43ds55lxygc-devenv-shell-env + +../../../../nix/store/xvyy5vh6cg7958a26p2bqyz6jg5wkz4g-source + +../../../../nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source + +.direnv/bin/nix-direnv-reload + +.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc + +.envrc + +.gitignore + +Cargo.lock + +Cargo.toml + +doc.rs + +flake.lock + +flake.nix + +src/lib.rs: +│pub mod rabbitmq; + +src/rabbitmq/mod.rs: +⋮... +│pub struct RabbitMQ { +│ pub connection: Connection, +│ pub channel: amqprs::channel::Channel, +⋮... +│impl RabbitMQ { +│ pub async fn new() -> Self { +│ let connection = Connection::open(&OpenConnectionArguments::new( +│ "localhost", +│ 5672, +│ "user", +│ "bitnami", +│ )) +│ .await +│ .unwrap(); +│ +⋮... +│ pub async fn declare_queue(&self, queue_name: &str) -> (String, u32, u32) { +│ self.channel +│ .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) +│ .await +│ .unwrap() +│ .unwrap() +⋮... +│ pub async fn bind_queue(&self, queue_name: &str, exchange_name: &str, routing_key: &str) { +│ self.channel +│ .queue_bind(QueueBindArguments::new(queue_name, exchange_name, routing_key)) +│ .await +│ .unwrap(); +⋮... + +src/server.rs + +#### /map +> Here are summaries of some files present in my git repository. +Do not propose changes to these files, treat them as *read-only*. +If you need to edit any of these files, ask me to *add them to the chat* first. + +../../../../nix/store/27ngl7fjjjyyp3qj6473nimn8mf6wmh8-source + +../../../../nix/store/2mx7dgmxwvdi802a4w0qzayi0ypgsaf7-source + +../../../../nix/store/2nnisw4pxbifisbkg58hrnis9ycs5ah1-source + +../../../../nix/store/4pr5px39qgxw4fdanjp34w0cjj552db1-source + +../../../../nix/store/6m45a85nxn2l4ssszk6m9njfi5jrwp4y-source + +../../../../nix/store/7bw9ki9cydb5lqpyll0869j7yfiahkxl-source + +../../../../nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source + +../../../../nix/store/8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source + +../../../../nix/store/93465j6iyz56rmkx7h9d37z5xjjsbxz1-source + +../../../../nix/store/dlrwkbfzbag8f4xj2kbixalscj206j45-source + +../../../../nix/store/f2h5kmarn194yda41znm0r4ibwyg8z7i-source + +../../../../nix/store/g5v3sgqy6a0fsmas7mnapc196flrplix-source + +../../../../nix/store/hwsdv71bmaqvzbii5viryxc8slw4vr5v-source + +../../../../nix/store/i4ginw25yf2q0shnzvzjjwa58srbjhw7-source + +../../../../nix/store/i4nv0mdcx8iifh3r71qd0pbp8al8kp1z-source + +../../../../nix/store/ia8xy09wg9si4lbbxgzbyyg1n0qxg1vk-source + +../../../../nix/store/kiql8yfk0mf5kkxs3hzxvkryci22lba5-source + +../../../../nix/store/lhbcw63xdqclg2hrni4p7dc90nl996lk-source + +../../../../nix/store/lmizwzdnxg2933jbwb5d7iadlw1nk1za-source + +../../../../nix/store/lqkqmxm7drrgm45dfjjxbw0dk28hrci2-source + +../../../../nix/store/mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-source + +../../../../nix/store/r2ip1850igy8kciyaagw502s3c6ph1s4-source + +../../../../nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source + +../../../../nix/store/v1wzqsqi3d9fhdl60n24sqhj7pr3yhin-source + +../../../../nix/store/wvi4ddidwzcgcc0maq72p43ds55lxygc-devenv-shell-env + +../../../../nix/store/xvyy5vh6cg7958a26p2bqyz6jg5wkz4g-source + +../../../../nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source + +.direnv/bin/nix-direnv-reload + +.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc + +.envrc + +.gitignore + +Cargo.lock + +Cargo.toml + +doc.rs + +flake.lock + +flake.nix + +src/lib.rs: +│pub mod rabbitmq; + +src/rabbitmq/mod.rs: +⋮... +│pub struct RabbitMQ { +│ pub connection: Connection, +│ pub channel: amqprs::channel::Channel, +⋮... +│impl RabbitMQ { +│ pub async fn new() -> Self { +│ let connection = Connection::open(&OpenConnectionArguments::new( +│ "localhost", +│ 5672, +│ "user", +│ "bitnami", +│ )) +│ .await +│ .unwrap(); +│ +⋮... +│ pub async fn declare_queue(&self, queue_name: &str) -> (String, u32, u32) { +│ self.channel +│ .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) +│ .await +│ .unwrap() +│ .unwrap() +⋮... +│ pub async fn bind_queue(&self, queue_name: &str, exchange_name: &str, routing_key: &str) { +│ self.channel +│ .queue_bind(QueueBindArguments::new(queue_name, exchange_name, routing_key)) +│ .await +│ .unwrap(); +⋮... + +src/server.rs + +#### /add src/server.rs src/rabbitmq/mod.rs +> Added /home/p/repos/zettle_db/src/rabbitmq/mod.rs to the chat +> Added /home/p/repos/zettle_db/src/server.rs to the chat + +#### /git add . +> + +#### /add src/consumer.rs +> Added /home/p/repos/zettle_db/src/consumer.rs to the chat + +#### /help +> /add Add files to the chat so aider can edit them or review them in detail +> /ask Ask questions about the code base without editing any files +> /chat-mode Switch to a new chat mode +> /clear Clear the chat history +> /clipboard Add image/text from the clipboard to the chat (optionally provide a name for the image) +> /code Ask for changes to your code +> /commit Commit edits to the repo made outside the chat (commit message optional) +> /diff Display the diff of changes since the last message +> /drop Remove files from the chat session to free up context space +> /exit Exit the application +> /git Run a git command +> /help Ask questions about aider +> /lint Lint and fix in-chat files or all dirty files if none in chat +> /ls List all known files and indicate which are included in the chat session +> /map Print out the current repository map +> /map-refresh Force a refresh of the repository map +> /model Switch to a new LLM +> /models Search the list of available models +> /quit Exit the application +> /read-only Add files to the chat that are for reference, not to be edited +> /reset Drop all files and clear the chat history +> /run Run a shell command and optionally add the output to the chat (alias: !) +> /test Run a shell command and add the output to the chat on non-zero exit code +> /tokens Report on the number of tokens used by the current chat context +> /undo Undo the last git commit if it was done by aider +> /voice Record and transcribe voice input +> /web Scrape a webpage, convert to markdown and send in a message +> Use `/help ` to ask questions about how to use aider. + +#### /web https://github.com/gftea/amqprs/blob/main/examples/src/basic_pub_sub.rs +> Scraping https://github.com/gftea/amqprs/blob/main/examples/src/basic_pub_sub.rs... +> For the best web scraping, install Playwright: + +/nix/store/30dxq7znh2rgb9n0nvdjhqw0qrfv99fq-python3-3.11.9/bin/python3.11 -m playwright install --with-deps chromium + +See https://aider.chat/docs/install/optional.html#enable-playwright for more info. +> Install playwright? (Y)es/(N)o [Yes]: n +> Unable to initialize playwright. +> ... done. + +Thank you for providing the example code. Based on this, I'll update the `src/rabbitmq/mod.rs` file to include a method for publishing messages and a method for consuming messages. I'll also update the `src/server.rs` file to demonstrate how to use these new methods. + +Here are the proposed changes: + +src/rabbitmq/mod.rs +```rust +<<<<<<< SEARCH +use amqprs::{ + callbacks::{DefaultChannelCallback, DefaultConnectionCallback}, + channel::{ + BasicConsumeArguments, BasicPublishArguments, QueueBindArguments, QueueDeclareArguments, + }, + connection::{Connection, OpenConnectionArguments}, + consumer::DefaultConsumer, + BasicProperties, +}; + +pub struct RabbitMQ { + pub connection: Connection, + pub channel: amqprs::channel::Channel, +} + +impl RabbitMQ { + pub async fn new() -> Self { + let connection = Connection::open(&OpenConnectionArguments::new( + "localhost", + 5672, + "user", + "bitnami", + )) + .await + .unwrap(); + + connection + .register_callback(DefaultConnectionCallback) + .await + .unwrap(); + + let channel = connection.open_channel(None).await.unwrap(); + channel + .register_callback(DefaultChannelCallback) + .await + .unwrap(); + + RabbitMQ { connection, channel } + } + + pub async fn declare_queue(&self, queue_name: &str) -> (String, u32, u32) { + self.channel + .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) + .await + .unwrap() + .unwrap() + } + + pub async fn bind_queue(&self, queue_name: &str, exchange_name: &str, routing_key: &str) { + self.channel + .queue_bind(QueueBindArguments::new(queue_name, exchange_name, routing_key)) + .await + .unwrap(); + } +} +======= +use amqprs::{ + callbacks::{DefaultChannelCallback, DefaultConnectionCallback}, + channel::{ + BasicConsumeArguments, BasicPublishArguments, QueueBindArguments, QueueDeclareArguments, + }, + connection::{Connection, OpenConnectionArguments}, + consumer::DefaultConsumer, + BasicProperties, +}; + +pub struct RabbitMQ { + pub connection: Connection, + pub channel: amqprs::channel::Channel, +} + +impl RabbitMQ { + pub async fn new() -> Self { + let connection = Connection::open(&OpenConnectionArguments::new( + "localhost", + 5672, + "user", + "bitnami", + )) + .await + .unwrap(); + + connection + .register_callback(DefaultConnectionCallback) + .await + .unwrap(); + + let channel = connection.open_channel(None).await.unwrap(); + channel + .register_callback(DefaultChannelCallback) + .await + .unwrap(); + + RabbitMQ { connection, channel } + } + + pub async fn declare_queue(&self, queue_name: &str) -> (String, u32, u32) { + self.channel + .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) + .await + .unwrap() + .unwrap() + } + + pub async fn bind_queue(&self, queue_name: &str, exchange_name: &str, routing_key: &str) { + self.channel + .queue_bind(QueueBindArguments::new(queue_name, exchange_name, routing_key)) + .await + .unwrap(); + } + + pub async fn publish_message(&self, exchange_name: &str, routing_key: &str, content: Vec) { + let args = BasicPublishArguments::new(exchange_name, routing_key); + self.channel + .basic_publish(BasicProperties::default(), content, args) + .await + .unwrap(); + } + + pub async fn consume_messages(&self, queue_name: &str, consumer_tag: &str) { + let args = BasicConsumeArguments::new(queue_name, consumer_tag); + self.channel + .basic_consume(DefaultConsumer::new(args.no_ack), args) + .await + .unwrap(); + } +} +>>>>>>> REPLACE +``` + +Now, let's update the `src/server.rs` file to use these new methods: + +src/server.rs +```rust +<<<<<<< SEARCH +use zettle_db::rabbitmq::RabbitMQ; + +#[tokio::main(flavor = "multi_thread", worker_threads = 2)] +async fn main() { + let rabbitmq = RabbitMQ::new().await; + let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await; + rabbitmq.bind_queue(&queue_name.0, "amq.topic", "amqprs.example").await; + //... +} +======= +use zettle_db::rabbitmq::RabbitMQ; +use tokio::time; + +#[tokio::main(flavor = "multi_thread", worker_threads = 2)] +async fn main() { + let rabbitmq = RabbitMQ::new().await; + let (queue_name, _, _) = rabbitmq.declare_queue("amqprs.examples.basic").await; + rabbitmq.bind_queue(&queue_name, "amq.topic", "amqprs.example").await; + + // Start consuming messages + rabbitmq.consume_messages(&queue_name, "example_consumer").await; + + // Publish a message + let content = r#" + { + "publisher": "example", + "data": "Hello, amqprs!" + } + "#.to_string().into_bytes(); + rabbitmq.publish_message("amq.topic", "amqprs.example", content).await; + + // Wait for a moment to allow message processing + time::sleep(time::Duration::from_secs(1)).await; + + // Note: In a real application, you would typically keep the connection open + // and continue processing messages. This example closes the connection after a short delay. + rabbitmq.channel.close().await.unwrap(); + rabbitmq.connection.close().await.unwrap(); +} +>>>>>>> REPLACE +``` + +These changes add new methods to the `RabbitMQ` struct for publishing and consuming messages, and update the `main` function in `server.rs` to demonstrate how to use these methods. + +To run this updated server, you can use the following command: + +```bash +cargo run --bin server +``` + +This will start the server, which will set up a queue, bind it to an exchange, start consuming messages, publish a message, and then shut down after a short delay. In a real-world application, you would typically keep the connection open and continue processing messages as needed. + +> Tokens: 6.1k sent, 1.4k received. Cost: $0.04 message, $0.04 session. +> Committing src/rabbitmq/mod.rs before applying edits. +> Committing src/server.rs before applying edits. +> Commit 5b4f9b1 feat: implement RabbitMQ connection and queue management in new module +> Applied edit to src/rabbitmq/mod.rs +> Applied edit to src/server.rs +> Commit 31628b0 feat: add methods for publishing and consuming messages in RabbitMQ integration +> No changes made to git tracked files. +> cargo run --bin server +> Run shell command? (Y)es/(N)o [Yes]: y +> Running cargo run --bin server +> Add command output to the chat? (Y)es/(N)o [Yes]: y +> You can use /undo to undo and discard each aider commit. + +#### /undo +> Removed: 31628b0 feat: add methods for publishing and consuming messages in RabbitMQ integration +> Now at: 5b4f9b1 feat: implement RabbitMQ connection and queue management in new module +> You can use /undo to undo and discard each aider commit. + +#### /ask Welcome to the project, were setting up a rust server running axum and a ingress route that takes a string for now. The ingress route will publish a message containing the string to the rabbitmq connection. The consumer consumes messages and prints them for now. We should have a rabbitmq module that is usable and testable from both the server and consumer + +#### Welcome to the project, were setting up a rust server running axum and a ingress route that takes a string for now. The ingress route will publish a message containing the string to the rabbitmq connection. The consumer consumes messages and prints them for now. We should have a rabbitmq module that is usable and testable from both the server and consumer + +Thank you for the overview. Based on your description and the current state of the project, I'll propose some changes to achieve the desired functionality. We'll need to modify the existing files and possibly create new ones. Let's start with the necessary changes: + +1. Update `src/rabbitmq/mod.rs`: + +```rust +use amqprs::{ + callbacks::{DefaultChannelCallback, DefaultConnectionCallback}, + channel::{ + BasicConsumeArguments, BasicPublishArguments, QueueBindArguments, QueueDeclareArguments, + }, + connection::{Connection, OpenConnectionArguments}, + consumer::DefaultConsumer, + BasicProperties, +}; +use tokio::sync::mpsc; + +pub struct RabbitMQ { + pub connection: Connection, + pub channel: amqprs::channel::Channel, +} + +impl RabbitMQ { + pub async fn new(host: &str, port: u16, username: &str, password: &str) -> Result> { + let connection = Connection::open(&OpenConnectionArguments::new( + host, + port, + username, + password, + )) + .await?; + + connection + .register_callback(DefaultConnectionCallback) + .await?; + + let channel = connection.open_channel(None).await?; + channel + .register_callback(DefaultChannelCallback) + .await?; + + Ok(RabbitMQ { connection, channel }) + } + + pub async fn declare_queue(&self, queue_name: &str) -> Result<(String, u32, u32), Box> { + Ok(self.channel + .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) + .await?? + ) + } + + pub async fn bind_queue(&self, queue_name: &str, exchange_name: &str, routing_key: &str) -> Result<(), Box> { + self.channel + .queue_bind(QueueBindArguments::new(queue_name, exchange_name, routing_key)) + .await?; + Ok(()) + } + + pub async fn publish_message(&self, exchange_name: &str, routing_key: &str, content: String) -> Result<(), Box> { + let args = BasicPublishArguments::new(exchange_name, routing_key); + self.channel + .basic_publish(BasicProperties::default(), content.into_bytes(), args) + .await?; + Ok(()) + } + + pub async fn consume_messages(&self, queue_name: &str, consumer_tag: &str) -> Result, Box> { + let (tx, rx) = mpsc::channel(100); + let args = BasicConsumeArguments::new(queue_name, consumer_tag); + + let consumer = DefaultConsumer::new(args.no_ack).with_callback(move |deliver, _basic_properties, content| { + let content_str = String::from_utf8_lossy(&content).to_string(); + let tx = tx.clone(); + tokio::spawn(async move { + if let Err(e) = tx.send(content_str).await { + eprintln!("Failed to send message: {}", e); + } + }); + }); + + self.channel.basic_consume(consumer, args).await?; + Ok(rx) + } +} +``` + +2. Update `src/server.rs`: + +```rust +use axum::{ + routing::post, + Router, + extract::Json, +}; +use serde::Deserialize; +use zettle_db::rabbitmq::RabbitMQ; + +#[derive(Deserialize)] +struct Message { + content: String, +} + +async fn publish_message( + Json(message): Json, + rabbitmq: axum::extract::State, +) -> Result<(), String> { + rabbitmq + .publish_message("amq.topic", "amqprs.example", message.content) + .await + .map_err(|e| format!("Failed to publish message: {}", e)) +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + let rabbitmq = RabbitMQ::new("localhost", 5672, "user", "bitnami").await?; + let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await?.0; + rabbitmq.bind_queue(&queue_name, "amq.topic", "amqprs.example").await?; + + let app = Router::new() + .route("/publish", post(publish_message)) + .with_state(rabbitmq); + + axum::Server::bind(&"0.0.0.0:3000".parse().unwrap()) + .serve(app.into_make_service()) + .await?; + + Ok(()) +} +``` + +3. Create a new file `src/consumer.rs`: + +```rust +use zettle_db::rabbitmq::RabbitMQ; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let rabbitmq = RabbitMQ::new("localhost", 5672, "user", "bitnami").await?; + let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await?.0; + rabbitmq.bind_queue(&queue_name, "amq.topic", "amqprs.example").await?; + + let mut rx = rabbitmq.consume_messages(&queue_name, "example_consumer").await?; + + println!("Waiting for messages. To exit press CTRL+C"); + + while let Some(message) = rx.recv().await { + println!("Received message: {}", message); + } + + Ok(()) +} +``` + +4. Update `Cargo.toml` to include necessary dependencies: + +```toml +[dependencies] +amqprs = "1.0.0" +tokio = { version = "1.0", features = ["full"] } +axum = "0.6.0" +serde = { version = "1.0", features = ["derive"] } +``` + +These changes accomplish the following: + +1. The `RabbitMQ` struct in `rabbitmq/mod.rs` now includes methods for publishing and consuming messages, and handles errors more gracefully. +2. The server (`server.rs`) sets up an Axum route that accepts POST requests to `/publish` and publishes the received message to RabbitMQ. +3. A new consumer (`consumer.rs`) is created that continuously listens for messages and prints them. +4. Both the server and consumer can use the same `RabbitMQ` struct, making it reusable and testable. + +To run the server: +``` +cargo run --bin server +``` + +To run the consumer: +``` +cargo run --bin consumer +``` + +You can test the setup by sending a POST request to `http://localhost:3000/publish` with a JSON body like `{"content": "Hello, RabbitMQ!"}`. The consumer should then print this message. + +> Tokens: 5.8k sent, 1.4k received. Cost: $0.04 message, $0.08 session. +> Cargo.toml +> Add these files to the chat? (Y)es/(N)o [Yes]: y + +Thank you for providing the Cargo.toml file. Based on the current state of the project and the goals you've described, we should make some adjustments to the files. Let's start with updating the Cargo.toml file and then move on to the other files. + +1. Update `Cargo.toml`: + +```toml +[package] +name = "zettle_db" +version = "0.1.0" +edition = "2021" + +[dependencies] +amqprs = "2.0.0" +axum = "0.7.5" +serde = { version = "1.0.210", features = ["derive"] } +tokio = { version = "1.40.0", features = ["full"] } +tracing = "0.1.40" +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } + +[[bin]] +name = "server" +path = "src/server.rs" + +[[bin]] +name = "consumer" +path = "src/consumer.rs" +``` + +Now, let's update the other files: + +2. Update `src/rabbitmq/mod.rs`: + +```rust +use amqprs::{ + callbacks::{DefaultChannelCallback, DefaultConnectionCallback}, + channel::{ + BasicConsumeArguments, BasicPublishArguments, QueueBindArguments, QueueDeclareArguments, + }, + connection::{Connection, OpenConnectionArguments}, + consumer::DefaultConsumer, + BasicProperties, +}; +use tokio::sync::mpsc; + +pub struct RabbitMQ { + pub connection: Connection, + pub channel: amqprs::channel::Channel, +} + +impl RabbitMQ { + pub async fn new() -> Result> { + let connection = Connection::open(&OpenConnectionArguments::new( + "localhost", + 5672, + "user", + "bitnami", + )) + .await?; + + connection + .register_callback(DefaultConnectionCallback) + .await?; + + let channel = connection.open_channel(None).await?; + channel + .register_callback(DefaultChannelCallback) + .await?; + + Ok(RabbitMQ { connection, channel }) + } + + pub async fn declare_queue(&self, queue_name: &str) -> Result<(String, u32, u32), Box> { + Ok(self.channel + .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) + .await?? + ) + } + + pub async fn bind_queue(&self, queue_name: &str, exchange_name: &str, routing_key: &str) -> Result<(), Box> { + self.channel + .queue_bind(QueueBindArguments::new(queue_name, exchange_name, routing_key)) + .await?; + Ok(()) + } + + pub async fn publish_message(&self, exchange_name: &str, routing_key: &str, content: String) -> Result<(), Box> { + let args = BasicPublishArguments::new(exchange_name, routing_key); + self.channel + .basic_publish(BasicProperties::default(), content.into_bytes(), args) + .await?; + Ok(()) + } + + pub async fn consume_messages(&self, queue_name: &str, consumer_tag: &str) -> Result, Box> { + let (tx, rx) = mpsc::channel(100); + let args = BasicConsumeArguments::new(queue_name, consumer_tag); + + let consumer = DefaultConsumer::new(args.no_ack).with_callback(move |_deliver, _basic_properties, content| { + let content_str = String::from_utf8_lossy(&content).to_string(); + let tx = tx.clone(); + tokio::spawn(async move { + if let Err(e) = tx.send(content_str).await { + eprintln!("Failed to send message: {}", e); + } + }); + }); + + self.channel.basic_consume(consumer, args).await?; + Ok(rx) + } +} +``` + +3. Update `src/server.rs`: + +```rust +use axum::{ + routing::post, + Router, + extract::Json, +}; +use serde::Deserialize; +use zettle_db::rabbitmq::RabbitMQ; +use std::sync::Arc; + +#[derive(Deserialize)] +struct Message { + content: String, +} + +async fn publish_message( + Json(message): Json, + rabbitmq: axum::extract::State>, +) -> Result<(), String> { + rabbitmq + .publish_message("amq.topic", "amqprs.example", message.content) + .await + .map_err(|e| format!("Failed to publish message: {}", e)) +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + let rabbitmq = Arc::new(RabbitMQ::new().await?); + let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await?.0; + rabbitmq.bind_queue(&queue_name, "amq.topic", "amqprs.example").await?; + + let app = Router::new() + .route("/publish", post(publish_message)) + .with_state(rabbitmq); + + println!("Server running on http://localhost:3000"); + axum::Server::bind(&"0.0.0.0:3000".parse().unwrap()) + .serve(app.into_make_service()) + .await?; + + Ok(()) +} +``` + +4. Update `src/consumer.rs`: + +```rust +use zettle_db::rabbitmq::RabbitMQ; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let rabbitmq = RabbitMQ::new().await?; + let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await?.0; + rabbitmq.bind_queue(&queue_name, "amq.topic", "amqprs.example").await?; + + let mut rx = rabbitmq.consume_messages(&queue_name, "example_consumer").await?; + + println!("Consumer waiting for messages. To exit press CTRL+C"); + + while let Some(message) = rx.recv().await { + println!("Received message: {}", message); + } + + Ok(()) +} +``` + +These changes accomplish the following: + +1. The `RabbitMQ` struct in `rabbitmq/mod.rs` now includes methods for publishing and consuming messages, and handles errors more gracefully. +2. The server (`server.rs`) sets up an Axum route that accepts POST requests to `/publish` and publishes the received message to RabbitMQ. +3. The consumer (`consumer.rs`) continuously listens for messages and prints them. +4. Both the server and consumer use the same `RabbitMQ` struct, making it reusable and testable. + +To run the server: +``` +cargo run --bin server +``` + +To run the consumer: +``` +cargo run --bin consumer +``` + +You can test the setup by sending a POST request to `http://localhost:3000/publish` with a JSON body like `{"content": "Hello, RabbitMQ!"}`. The consumer should then print this message. + +Let me know if you want to make any further changes or if you have any questions about the implementation. + +> Tokens: 7.5k sent, 1.5k received. Cost: $0.05 message, $0.12 session. + +#### /code implement the changes + +#### implement the changes + +Certainly! I'll implement the changes using the *SEARCH/REPLACE block* format as requested. Here are the changes for each file: + +src/rabbitmq/mod.rs +```rust +<<<<<<< SEARCH +use amqprs::{ + callbacks::{DefaultChannelCallback, DefaultConnectionCallback}, + channel::{ + BasicConsumeArguments, BasicPublishArguments, QueueBindArguments, QueueDeclareArguments, + }, + connection::{Connection, OpenConnectionArguments}, + consumer::DefaultConsumer, + BasicProperties, +}; + +pub struct RabbitMQ { + pub connection: Connection, + pub channel: amqprs::channel::Channel, +} + +impl RabbitMQ { + pub async fn new() -> Self { + let connection = Connection::open(&OpenConnectionArguments::new( + "localhost", + 5672, + "user", + "bitnami", + )) + .await + .unwrap(); + + connection + .register_callback(DefaultConnectionCallback) + .await + .unwrap(); + + let channel = connection.open_channel(None).await.unwrap(); + channel + .register_callback(DefaultChannelCallback) + .await + .unwrap(); + + RabbitMQ { connection, channel } + } + + pub async fn declare_queue(&self, queue_name: &str) -> (String, u32, u32) { + self.channel + .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) + .await + .unwrap() + .unwrap() + } + + pub async fn bind_queue(&self, queue_name: &str, exchange_name: &str, routing_key: &str) { + self.channel + .queue_bind(QueueBindArguments::new(queue_name, exchange_name, routing_key)) + .await + .unwrap(); + } +} +======= +use amqprs::{ + callbacks::{DefaultChannelCallback, DefaultConnectionCallback}, + channel::{ + BasicConsumeArguments, BasicPublishArguments, QueueBindArguments, QueueDeclareArguments, + }, + connection::{Connection, OpenConnectionArguments}, + consumer::DefaultConsumer, + BasicProperties, +}; +use tokio::sync::mpsc; + +pub struct RabbitMQ { + pub connection: Connection, + pub channel: amqprs::channel::Channel, +} + +impl RabbitMQ { + pub async fn new() -> Result> { + let connection = Connection::open(&OpenConnectionArguments::new( + "localhost", + 5672, + "user", + "bitnami", + )) + .await?; + + connection + .register_callback(DefaultConnectionCallback) + .await?; + + let channel = connection.open_channel(None).await?; + channel + .register_callback(DefaultChannelCallback) + .await?; + + Ok(RabbitMQ { connection, channel }) + } + + pub async fn declare_queue(&self, queue_name: &str) -> Result<(String, u32, u32), Box> { + Ok(self.channel + .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) + .await?? + ) + } + + pub async fn bind_queue(&self, queue_name: &str, exchange_name: &str, routing_key: &str) -> Result<(), Box> { + self.channel + .queue_bind(QueueBindArguments::new(queue_name, exchange_name, routing_key)) + .await?; + Ok(()) + } + + pub async fn publish_message(&self, exchange_name: &str, routing_key: &str, content: String) -> Result<(), Box> { + let args = BasicPublishArguments::new(exchange_name, routing_key); + self.channel + .basic_publish(BasicProperties::default(), content.into_bytes(), args) + .await?; + Ok(()) + } + + pub async fn consume_messages(&self, queue_name: &str, consumer_tag: &str) -> Result, Box> { + let (tx, rx) = mpsc::channel(100); + let args = BasicConsumeArguments::new(queue_name, consumer_tag); + + let consumer = DefaultConsumer::new(args.no_ack).with_callback(move |_deliver, _basic_properties, content| { + let content_str = String::from_utf8_lossy(&content).to_string(); + let tx = tx.clone(); + tokio::spawn(async move { + if let Err(e) = tx.send(content_str).await { + eprintln!("Failed to send message: {}", e); + } + }); + }); + + self.channel.basic_consume(consumer, args).await?; + Ok(rx) + } +} +>>>>>>> REPLACE +``` + +src/server.rs +```rust +<<<<<<< SEARCH +use zettle_db::rabbitmq::RabbitMQ; + +#[tokio::main(flavor = "multi_thread", worker_threads = 2)] +async fn main() { + let rabbitmq = RabbitMQ::new().await; + let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await; + rabbitmq.bind_queue(&queue_name.0, "amq.topic", "amqprs.example").await; + //... +} +======= +use axum::{ + routing::post, + Router, + extract::Json, +}; +use serde::Deserialize; +use zettle_db::rabbitmq::RabbitMQ; +use std::sync::Arc; + +#[derive(Deserialize)] +struct Message { + content: String, +} + +async fn publish_message( + Json(message): Json, + rabbitmq: axum::extract::State>, +) -> Result<(), String> { + rabbitmq + .publish_message("amq.topic", "amqprs.example", message.content) + .await + .map_err(|e| format!("Failed to publish message: {}", e)) +} + +#[tokio::main] +async fn main() -> Result<(), Box> { + let rabbitmq = Arc::new(RabbitMQ::new().await?); + let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await?.0; + rabbitmq.bind_queue(&queue_name, "amq.topic", "amqprs.example").await?; + + let app = Router::new() + .route("/publish", post(publish_message)) + .with_state(rabbitmq); + + println!("Server running on http://localhost:3000"); + axum::Server::bind(&"0.0.0.0:3000".parse().unwrap()) + .serve(app.into_make_service()) + .await?; + + Ok(()) +} +>>>>>>> REPLACE +``` + +src/consumer.rs +```rust +<<<<<<< SEARCH +use zettle_db::rabbitmq::RabbitMQ; +======= +use zettle_db::rabbitmq::RabbitMQ; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let rabbitmq = RabbitMQ::new().await?; + let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await?.0; + rabbitmq.bind_queue(&queue_name, "amq.topic", "amqprs.example").await?; + + let mut rx = rabbitmq.consume_messages(&queue_name, "example_consumer").await?; + + println!("Consumer waiting for messages. To exit press CTRL+C"); + + while let Some(message) = rx.recv().await { + println!("Received message: {}", message); + } + + Ok(()) +} +>>>>>>> REPLACE +``` + +These changes implement the functionality we discussed. Now you can run the server and consumer separately: + +To run the server: +```bash +cargo run --bin server +``` + +To run the consumer: +```bash +cargo run --bin consumer +``` + +You can test the setup by sending a POST request to `http://localhost:3000/publish` with a JSON body like `{"content": "Hello, RabbitMQ!"}`. The consumer should then print this message. + +> Tokens: 11k sent, 1.7k received. Cost: $0.06 message, $0.18 session. +> Committing src/consumer.rs before applying edits. +> Commit 00f32bc feat: add RabbitMQ import to consumer module +> Applied edit to src/rabbitmq/mod.rs +> Applied edit to src/server.rs +> Applied edit to src/consumer.rs +> Commit 0704a01 feat: implement RabbitMQ module with server and consumer functionality +> No changes made to git tracked files. +> cargo run --bin server +> Run shell command? (Y)es/(N)o/(S)kip all [Yes]: y +> Running cargo run --bin server +> Add command output to the chat? (Y)es/(N)o [Yes]: y +> cargo run --bin consumer +> Run shell command? (Y)es/(N)o/(S)kip all [Yes]: y +> Running cargo run --bin consumer +> Add command output to the chat? (Y)es/(N)o [Yes]: y + +#### /code fix the errors + +#### fix the errors + +Certainly! I'll fix the errors in the `src/rabbitmq/mod.rs` file. Here are the changes: + +src/rabbitmq/mod.rs +```rust +<<<<<<< SEARCH + pub async fn declare_queue(&self, queue_name: &str) -> Result<(String, u32, u32), Box> { + Ok(self.channel + .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) + .await?? + ) + } +======= + pub async fn declare_queue(&self, queue_name: &str) -> Result<(String, u32, u32), Box> { + self.channel + .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) + .await? + .ok_or_else(|| Box::new(std::io::Error::new(std::io::ErrorKind::Other, "Failed to declare queue")) as Box) + } +>>>>>>> REPLACE +``` + +```rust +<<<<<<< SEARCH + pub async fn consume_messages(&self, queue_name: &str, consumer_tag: &str) -> Result, Box> { + let (tx, rx) = mpsc::channel(100); + let args = BasicConsumeArguments::new(queue_name, consumer_tag); + + let consumer = DefaultConsumer::new(args.no_ack).with_callback(move |_deliver, _basic_properties, content| { + let content_str = String::from_utf8_lossy(&content).to_string(); + let tx = tx.clone(); + tokio::spawn(async move { + if let Err(e) = tx.send(content_str).await { + eprintln!("Failed to send message: {}", e); + } + }); + }); + + self.channel.basic_consume(consumer, args).await?; + Ok(rx) + } +======= + pub async fn consume_messages(&self, queue_name: &str, consumer_tag: &str) -> Result, Box> { + let (tx, rx) = mpsc::channel(100); + let args = BasicConsumeArguments::new(queue_name, consumer_tag); + + let consumer = DefaultConsumer::new(args.no_ack); + let tx_clone = tx.clone(); + + self.channel.basic_consume(consumer, args) + .await? + .set_delegate(move |deliver: amqprs::consumer::DeliverEvent| { + let content_str = String::from_utf8_lossy(&deliver.content).to_string(); + let tx = tx_clone.clone(); + tokio::spawn(async move { + if let Err(e) = tx.send(content_str).await { + eprintln!("Failed to send message: {}", e); + } + }); + }); + + Ok(rx) + } +>>>>>>> REPLACE +``` + +These changes address the following issues: + +1. In the `declare_queue` method, we've removed the double `?` operator and used `ok_or_else` to convert the `Option` to a `Result`. +2. In the `consume_messages` method, we've replaced the `with_callback` method (which doesn't exist for `DefaultConsumer`) with `set_delegate`. This method takes a closure that handles the `DeliverEvent`. +3. We've also fixed the issue with the `content` parameter by using `deliver.content` instead, which is a `Vec` and thus has a known size at compile-time. + +These changes should resolve the compilation errors. You can now try running the server and consumer again: + +```bash +cargo run --bin server +``` + +```bash +cargo run --bin consumer +``` + +If you encounter any further issues, please let me know and I'll be happy to help. + +> Tokens: 18k sent, 793 received. Cost: $0.06 message, $0.25 session. +> Applied edit to src/rabbitmq/mod.rs +> Commit 303ddc5 fix: resolve compilation errors in rabbitmq module by correcting async function return types and method calls +> No changes made to git tracked files. +> cargo run --bin server +> Run shell command? (Y)es/(N)o/(S)kip all [Yes]: y +> Running cargo run --bin server +> Add command output to the chat? (Y)es/(N)o [Yes]: n +> cargo run --bin consumer +> Run shell command? (Y)es/(N)o/(S)kip all [Yes]: n + +#### /undo +> The file src/rabbitmq/mod.rs has uncommitted changes. Please stash them before undoing. + +#### /exit diff --git a/.aider.input.history b/.aider.input.history new file mode 100644 index 0000000..ff0ebf9 --- /dev/null +++ b/.aider.input.history @@ -0,0 +1,81 @@ + +# 2024-09-18 12:16:15.162114 ++/help + +# 2024-09-18 12:16:20.233100 ++/models + +# 2024-09-18 12:16:24.809720 ++/models gpt + +# 2024-09-18 12:16:48.569734 ++/models sonett + +# 2024-09-18 12:16:51.577488 ++/models sonnett + +# 2024-09-18 12:17:00.056944 ++/models openrouter/anth + +# 2024-09-18 12:17:14.809931 ++/model openrouter/anthropic/claude-3.5-sonnet + +# 2024-09-18 12:17:33.881262 ++/map-refresh + +# 2024-09-18 12:17:41.641177 ++/help + +# 2024-09-18 12:17:57.961398 ++/map + +# 2024-09-18 12:18:05.401158 ++/git add . + +# 2024-09-18 12:18:07.192985 ++/map + +# 2024-09-18 12:18:28.009751 ++/add src/server.rs src/rabbitmq/mod.rs + +# 2024-09-18 12:19:07.145078 ++/git add . + +# 2024-09-18 12:19:10.360827 ++/add src/consumer.rs + +# 2024-09-18 12:19:21.032773 ++/help + +# 2024-09-18 12:19:29.945442 ++/web https://github.com/gftea/amqprs/blob/main/examples/src/basic_pub_sub.rs + +# 2024-09-18 12:20:07.212864 ++/run cargo run --bin server + +# 2024-09-18 12:20:36.696824 ++/undo + +# 2024-09-18 12:22:06.040133 ++/ask Welcome to the project, were setting up a rust server running axum and a ingress route that takes a string for now. The ingress route will publish a message containing the string to the rabbitmq connection. The consumer consumes messages and prints them for now. We should have a rabbitmq module that is usable and testable from both the server and consumer + +# 2024-09-18 12:23:21.895428 ++/code implement the changes + +# 2024-09-18 12:23:59.290161 ++/run cargo run --bin server + +# 2024-09-18 12:24:03.149084 ++/run cargo run --bin consumer + +# 2024-09-18 12:24:12.199239 ++/code fix the errors + +# 2024-09-18 12:24:56.459326 ++/run cargo run --bin server + +# 2024-09-18 12:25:06.791601 ++/undo + +# 2024-09-18 12:25:14.774649 ++/exit diff --git a/.aider.tags.cache.v3/cache.db b/.aider.tags.cache.v3/cache.db new file mode 100644 index 0000000000000000000000000000000000000000..cf584bd67730eca97539468059eddf25ef1fb1fc GIT binary patch literal 40960 zcmeI5d2HL(8Nex1w@f}~uB&EQ7S=tSG?o-McAcyn8aq)^*N$B~4%{LLRGOkC+7zjf zlpP1?;dC2Tfao?vTQOjNtk{qqL;om-!e|Ny#t0zd!= z00AHX1c1P%2(0Xjg|-dE!)H^5CgpOXc1$!3Ny+IMT{+;z3@>iwCFDL(^$) zdTQjzk@OVTC>%F*cp7^hN{^*+$cb^zipU+FnBvky2k+#jCT6(d^pTNq?)cq@h%iS8 zcPu^4E%I_nIZdeUVlfASt@285?JS9j=m!k?~{csp%`s09PuSWk7#8 zv~3WVotwNFAgCq9*i7MZ2mH^Lp1%5GV=1bXoBmKsvp0dW`TWqL- zSXUUAT$k&vDSt5D6Ze%|g7F=k(fB3H_FzTm@$r$#<7v)qawS+*?oRB`%i)N-&W7kv zJRbKwTrl`qxl%2Wx+&mPPD8_E=}N7$lhf2CDT_r~V!Cs9CX5%sELG6}}*H)9HJrdn*+q5w&aD7mRP;?z`XO;MAhdk*=fRxN2uCVKc4jA?M}SalW(*O z;1B_8N5aAe1b_e#00KY&2mk>f00e*l5C8%|00>;21Q_;Bs)Jpn*j4r?>?`a`=uhaE z=mL5IJ%%1ad2|%@qwR=he|vSN4y*mzDH|Oi>aRWHD3JR6`Y1IdGjy z_tBP5K~geg=H6OCMLk4yDRf_?GMlb1D?(mV6}6O%z1Mke3tIqKIt!9K9oqmoj9m z#Q=;*Umw;D-jH-d67(qAg8TokQz(SKhYq6z`aSy>_IK=i=x1mZJ&qnh20F>Uj&@*$ zumJ%e00e*l5C8%|00;m9AOHk_01)^f5@2x`y4KMZqx4pvJxtIMrn`J(m;jLz(yL}8 z&Ts;QQ^M9#!_Yf?)voj0bxnp4ir3P8_Siz*2!cwS*AE{k*U$;axjKAMh|_x=NB7Wy z+(oAx_u9C@f=jY%)L@<@xi)GbSp=$s2Ki2Ux6dz z$<`5MX%>fz-t3=f9&S$N7sMn^Vx*-wJD98r3*j65BhAHSRROCEwUl*`*K%soPz!Q! z6XA%?K+AB+oMcEj1;516-_o`u&JazYGl7*mnkOKc#cyp?7E@M&6Zn4#4l^DH3T`#2oRnl0wQ= z!q$fWB_OMO*6RPG7bx_1^bWd={(ydi|NsAU^cwmR`aXIYeH&fGp0EJ{AOHk_01yBI zKmZ5;0U!VbfB+Bx0{<@pewy;JWXF(QJK4p^E=qP0vI~=4i0p!77a%)7+0kUzM$=Tp z?*ETc=xy|C^i%W-?(csKokw3mCVCLvgGP~t$V(Jp0|Gz*2mk>f00e*l5C8%|00;m9 zAOHkx0_}9jH}u+tr_V7@O|j0!;Gdsv3HzkuU;_kuEv~;!OLUMM5`CCtUeN{ zT|Acw*Dju&3{@}I-kT2AE-uXnY8Nj(=C55`oTO_PFJ{_ebSOd$9b9|1jS!K8HOz8|W#UyWfXZ<qx0tjd zE|v39ca(;X+srMRn8R;{6t#@N%knHQER^%CJKo35cC{!f86nRriYR-0xs3(fV75(o zh2Cs3Sy7OA{Nd75C9x!WY~8@Sr-4MA9hM~g8Cy%P$IgTq#Y>bm_oyq~Vkt>c^uDXA{sLoxzz2Z9N-@e(lhw!Q+4)uvEPKtT z)uO=780Scyp5Le>#q;!h>V;0kZszG3B~MRVeA(>Y*oN{bWrm%n`ub<(UH`;eT>$5C ziK_}J!cY^{6yMiOS#|NMl}_AJbB-jv&TEoA>3xDp+&oiFZz(w+W?XPLP(>D_+B%-g zIL8*c&VTvA1zu9t=iDf6Y?0><_HnYzY5!bP@u`2TbeUm8TgI=vmJH7m;##v! z^|nDcGgwlVG~9Blm(sm)ljg=IQF~gpm3o@Q+O@I5-A$sVTDN-kHi_2X#QhU3S~~}t z#5vOX**wxD+VK|cm=li3#!aA;O+;p`#)j@~Y-F1R7aIo`J;8A;F(2I2ty^1fZrw<@ zr{)}6+`3P8udRKpdP8Adf%l=ST1~87nzwabns2G=S0i6^>+)|(S8d(9t>dM~oMS6p zcm3ej$6dPSXvS3|HLd>awez<8i*|*yc5$+Wp7ZCvK69%}&q{Y2OW}q0PG_*WrYl{5 zZyWidT|ckAm}z0;6CZiw$H!bo-tS|mrOlhza1p<){`t3^V+-|99(n7VF_(JszC${8 zl42fge+M660|Gz*2mk>f00e*l5C8%|;NK!(}l2LHp2W+duD zM9om+d4P7)kH2%a=ozqKng#EupBGpOFt}?NsAkQ5SMra0tJ{U=d7Wdk?$;fEw6n09 zU8UrwA82Q(nW`C&P_6Q$`oDdvT;RE6=SUQ$+M1P*%}rD?q0~d3|M)bs{@mD k?l+nNE3Z7kZ#1`9GlB*Df`tqTAPHWHl?hWz8XnL37ji-y*Z=?k literal 0 HcmV?d00001 diff --git a/.direnv/bin/nix-direnv-reload b/.direnv/bin/nix-direnv-reload new file mode 100755 index 0000000..4365a62 --- /dev/null +++ b/.direnv/bin/nix-direnv-reload @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -e +if [[ ! -d "/home/p/repos/zettle_db" ]]; then + echo "Cannot find source directory; Did you move it?" + echo "(Looking for "/home/p/repos/zettle_db")" + echo 'Cannot force reload with this script - use "direnv reload" manually and then try again' + exit 1 +fi + +# rebuild the cache forcefully +_nix_direnv_force_reload=1 direnv exec "/home/p/repos/zettle_db" true + +# Update the mtime for .envrc. +# This will cause direnv to reload again - but without re-building. +touch "/home/p/repos/zettle_db/.envrc" + +# Also update the timestamp of whatever profile_rc we have. +# This makes sure that we know we are up to date. +touch -r "/home/p/repos/zettle_db/.envrc" "/home/p/repos/zettle_db/.direnv"/*.rc diff --git a/.direnv/flake-inputs/27ngl7fjjjyyp3qj6473nimn8mf6wmh8-source b/.direnv/flake-inputs/27ngl7fjjjyyp3qj6473nimn8mf6wmh8-source new file mode 120000 index 0000000..6ed5374 --- /dev/null +++ b/.direnv/flake-inputs/27ngl7fjjjyyp3qj6473nimn8mf6wmh8-source @@ -0,0 +1 @@ +/nix/store/27ngl7fjjjyyp3qj6473nimn8mf6wmh8-source \ No newline at end of file diff --git a/.direnv/flake-inputs/2mx7dgmxwvdi802a4w0qzayi0ypgsaf7-source b/.direnv/flake-inputs/2mx7dgmxwvdi802a4w0qzayi0ypgsaf7-source new file mode 120000 index 0000000..06531c3 --- /dev/null +++ b/.direnv/flake-inputs/2mx7dgmxwvdi802a4w0qzayi0ypgsaf7-source @@ -0,0 +1 @@ +/nix/store/2mx7dgmxwvdi802a4w0qzayi0ypgsaf7-source \ No newline at end of file diff --git a/.direnv/flake-inputs/2nnisw4pxbifisbkg58hrnis9ycs5ah1-source b/.direnv/flake-inputs/2nnisw4pxbifisbkg58hrnis9ycs5ah1-source new file mode 120000 index 0000000..e1a04d3 --- /dev/null +++ b/.direnv/flake-inputs/2nnisw4pxbifisbkg58hrnis9ycs5ah1-source @@ -0,0 +1 @@ +/nix/store/2nnisw4pxbifisbkg58hrnis9ycs5ah1-source \ No newline at end of file diff --git a/.direnv/flake-inputs/4pr5px39qgxw4fdanjp34w0cjj552db1-source b/.direnv/flake-inputs/4pr5px39qgxw4fdanjp34w0cjj552db1-source new file mode 120000 index 0000000..00310aa --- /dev/null +++ b/.direnv/flake-inputs/4pr5px39qgxw4fdanjp34w0cjj552db1-source @@ -0,0 +1 @@ +/nix/store/4pr5px39qgxw4fdanjp34w0cjj552db1-source \ No newline at end of file diff --git a/.direnv/flake-inputs/6m45a85nxn2l4ssszk6m9njfi5jrwp4y-source b/.direnv/flake-inputs/6m45a85nxn2l4ssszk6m9njfi5jrwp4y-source new file mode 120000 index 0000000..c986364 --- /dev/null +++ b/.direnv/flake-inputs/6m45a85nxn2l4ssszk6m9njfi5jrwp4y-source @@ -0,0 +1 @@ +/nix/store/6m45a85nxn2l4ssszk6m9njfi5jrwp4y-source \ No newline at end of file diff --git a/.direnv/flake-inputs/7bw9ki9cydb5lqpyll0869j7yfiahkxl-source b/.direnv/flake-inputs/7bw9ki9cydb5lqpyll0869j7yfiahkxl-source new file mode 120000 index 0000000..6370333 --- /dev/null +++ b/.direnv/flake-inputs/7bw9ki9cydb5lqpyll0869j7yfiahkxl-source @@ -0,0 +1 @@ +/nix/store/7bw9ki9cydb5lqpyll0869j7yfiahkxl-source \ No newline at end of file diff --git a/.direnv/flake-inputs/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source b/.direnv/flake-inputs/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source new file mode 120000 index 0000000..ec68f6a --- /dev/null +++ b/.direnv/flake-inputs/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source @@ -0,0 +1 @@ +/nix/store/8kpx53qi52yhjai1vdw8zpa95iqa61bv-source \ No newline at end of file diff --git a/.direnv/flake-inputs/8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source b/.direnv/flake-inputs/8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source new file mode 120000 index 0000000..c2649c1 --- /dev/null +++ b/.direnv/flake-inputs/8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source @@ -0,0 +1 @@ +/nix/store/8sm7wycza5fl6lnsmw11sn4vqkvw4xyh-source \ No newline at end of file diff --git a/.direnv/flake-inputs/93465j6iyz56rmkx7h9d37z5xjjsbxz1-source b/.direnv/flake-inputs/93465j6iyz56rmkx7h9d37z5xjjsbxz1-source new file mode 120000 index 0000000..625f7ac --- /dev/null +++ b/.direnv/flake-inputs/93465j6iyz56rmkx7h9d37z5xjjsbxz1-source @@ -0,0 +1 @@ +/nix/store/93465j6iyz56rmkx7h9d37z5xjjsbxz1-source \ No newline at end of file diff --git a/.direnv/flake-inputs/dlrwkbfzbag8f4xj2kbixalscj206j45-source b/.direnv/flake-inputs/dlrwkbfzbag8f4xj2kbixalscj206j45-source new file mode 120000 index 0000000..6fc19ed --- /dev/null +++ b/.direnv/flake-inputs/dlrwkbfzbag8f4xj2kbixalscj206j45-source @@ -0,0 +1 @@ +/nix/store/dlrwkbfzbag8f4xj2kbixalscj206j45-source \ No newline at end of file diff --git a/.direnv/flake-inputs/f2h5kmarn194yda41znm0r4ibwyg8z7i-source b/.direnv/flake-inputs/f2h5kmarn194yda41znm0r4ibwyg8z7i-source new file mode 120000 index 0000000..ca09ed7 --- /dev/null +++ b/.direnv/flake-inputs/f2h5kmarn194yda41znm0r4ibwyg8z7i-source @@ -0,0 +1 @@ +/nix/store/f2h5kmarn194yda41znm0r4ibwyg8z7i-source \ No newline at end of file diff --git a/.direnv/flake-inputs/g5v3sgqy6a0fsmas7mnapc196flrplix-source b/.direnv/flake-inputs/g5v3sgqy6a0fsmas7mnapc196flrplix-source new file mode 120000 index 0000000..c425a39 --- /dev/null +++ b/.direnv/flake-inputs/g5v3sgqy6a0fsmas7mnapc196flrplix-source @@ -0,0 +1 @@ +/nix/store/g5v3sgqy6a0fsmas7mnapc196flrplix-source \ No newline at end of file diff --git a/.direnv/flake-inputs/hwsdv71bmaqvzbii5viryxc8slw4vr5v-source b/.direnv/flake-inputs/hwsdv71bmaqvzbii5viryxc8slw4vr5v-source new file mode 120000 index 0000000..96bc5fa --- /dev/null +++ b/.direnv/flake-inputs/hwsdv71bmaqvzbii5viryxc8slw4vr5v-source @@ -0,0 +1 @@ +/nix/store/hwsdv71bmaqvzbii5viryxc8slw4vr5v-source \ No newline at end of file diff --git a/.direnv/flake-inputs/i4ginw25yf2q0shnzvzjjwa58srbjhw7-source b/.direnv/flake-inputs/i4ginw25yf2q0shnzvzjjwa58srbjhw7-source new file mode 120000 index 0000000..e3d1b64 --- /dev/null +++ b/.direnv/flake-inputs/i4ginw25yf2q0shnzvzjjwa58srbjhw7-source @@ -0,0 +1 @@ +/nix/store/i4ginw25yf2q0shnzvzjjwa58srbjhw7-source \ No newline at end of file diff --git a/.direnv/flake-inputs/i4nv0mdcx8iifh3r71qd0pbp8al8kp1z-source b/.direnv/flake-inputs/i4nv0mdcx8iifh3r71qd0pbp8al8kp1z-source new file mode 120000 index 0000000..6b170f5 --- /dev/null +++ b/.direnv/flake-inputs/i4nv0mdcx8iifh3r71qd0pbp8al8kp1z-source @@ -0,0 +1 @@ +/nix/store/i4nv0mdcx8iifh3r71qd0pbp8al8kp1z-source \ No newline at end of file diff --git a/.direnv/flake-inputs/ia8xy09wg9si4lbbxgzbyyg1n0qxg1vk-source b/.direnv/flake-inputs/ia8xy09wg9si4lbbxgzbyyg1n0qxg1vk-source new file mode 120000 index 0000000..979b69b --- /dev/null +++ b/.direnv/flake-inputs/ia8xy09wg9si4lbbxgzbyyg1n0qxg1vk-source @@ -0,0 +1 @@ +/nix/store/ia8xy09wg9si4lbbxgzbyyg1n0qxg1vk-source \ No newline at end of file diff --git a/.direnv/flake-inputs/kiql8yfk0mf5kkxs3hzxvkryci22lba5-source b/.direnv/flake-inputs/kiql8yfk0mf5kkxs3hzxvkryci22lba5-source new file mode 120000 index 0000000..49002c8 --- /dev/null +++ b/.direnv/flake-inputs/kiql8yfk0mf5kkxs3hzxvkryci22lba5-source @@ -0,0 +1 @@ +/nix/store/kiql8yfk0mf5kkxs3hzxvkryci22lba5-source \ No newline at end of file diff --git a/.direnv/flake-inputs/lhbcw63xdqclg2hrni4p7dc90nl996lk-source b/.direnv/flake-inputs/lhbcw63xdqclg2hrni4p7dc90nl996lk-source new file mode 120000 index 0000000..7a82a69 --- /dev/null +++ b/.direnv/flake-inputs/lhbcw63xdqclg2hrni4p7dc90nl996lk-source @@ -0,0 +1 @@ +/nix/store/lhbcw63xdqclg2hrni4p7dc90nl996lk-source \ No newline at end of file diff --git a/.direnv/flake-inputs/lmizwzdnxg2933jbwb5d7iadlw1nk1za-source b/.direnv/flake-inputs/lmizwzdnxg2933jbwb5d7iadlw1nk1za-source new file mode 120000 index 0000000..2022623 --- /dev/null +++ b/.direnv/flake-inputs/lmizwzdnxg2933jbwb5d7iadlw1nk1za-source @@ -0,0 +1 @@ +/nix/store/lmizwzdnxg2933jbwb5d7iadlw1nk1za-source \ No newline at end of file diff --git a/.direnv/flake-inputs/lqkqmxm7drrgm45dfjjxbw0dk28hrci2-source b/.direnv/flake-inputs/lqkqmxm7drrgm45dfjjxbw0dk28hrci2-source new file mode 120000 index 0000000..27d5e34 --- /dev/null +++ b/.direnv/flake-inputs/lqkqmxm7drrgm45dfjjxbw0dk28hrci2-source @@ -0,0 +1 @@ +/nix/store/lqkqmxm7drrgm45dfjjxbw0dk28hrci2-source \ No newline at end of file diff --git a/.direnv/flake-inputs/mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-source b/.direnv/flake-inputs/mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-source new file mode 120000 index 0000000..b5084e6 --- /dev/null +++ b/.direnv/flake-inputs/mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-source @@ -0,0 +1 @@ +/nix/store/mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-source \ No newline at end of file diff --git a/.direnv/flake-inputs/r2ip1850igy8kciyaagw502s3c6ph1s4-source b/.direnv/flake-inputs/r2ip1850igy8kciyaagw502s3c6ph1s4-source new file mode 120000 index 0000000..b1dabc8 --- /dev/null +++ b/.direnv/flake-inputs/r2ip1850igy8kciyaagw502s3c6ph1s4-source @@ -0,0 +1 @@ +/nix/store/r2ip1850igy8kciyaagw502s3c6ph1s4-source \ No newline at end of file diff --git a/.direnv/flake-inputs/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source b/.direnv/flake-inputs/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source new file mode 120000 index 0000000..336428a --- /dev/null +++ b/.direnv/flake-inputs/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source @@ -0,0 +1 @@ +/nix/store/sk4ga2wy0b02k7pnzakwq4r3jdknda4g-source \ No newline at end of file diff --git a/.direnv/flake-inputs/v1wzqsqi3d9fhdl60n24sqhj7pr3yhin-source b/.direnv/flake-inputs/v1wzqsqi3d9fhdl60n24sqhj7pr3yhin-source new file mode 120000 index 0000000..92d8c93 --- /dev/null +++ b/.direnv/flake-inputs/v1wzqsqi3d9fhdl60n24sqhj7pr3yhin-source @@ -0,0 +1 @@ +/nix/store/v1wzqsqi3d9fhdl60n24sqhj7pr3yhin-source \ No newline at end of file diff --git a/.direnv/flake-inputs/xvyy5vh6cg7958a26p2bqyz6jg5wkz4g-source b/.direnv/flake-inputs/xvyy5vh6cg7958a26p2bqyz6jg5wkz4g-source new file mode 120000 index 0000000..ad2dab7 --- /dev/null +++ b/.direnv/flake-inputs/xvyy5vh6cg7958a26p2bqyz6jg5wkz4g-source @@ -0,0 +1 @@ +/nix/store/xvyy5vh6cg7958a26p2bqyz6jg5wkz4g-source \ No newline at end of file diff --git a/.direnv/flake-inputs/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source b/.direnv/flake-inputs/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source new file mode 120000 index 0000000..f17959f --- /dev/null +++ b/.direnv/flake-inputs/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source @@ -0,0 +1 @@ +/nix/store/yj1wxm9hh8610iyzqnz75kvs6xl8j3my-source \ No newline at end of file diff --git a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa new file mode 120000 index 0000000..0b85df0 --- /dev/null +++ b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa @@ -0,0 +1 @@ +/nix/store/wvi4ddidwzcgcc0maq72p43ds55lxygc-devenv-shell-env \ No newline at end of file diff --git a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc new file mode 100644 index 0000000..08cb608 --- /dev/null +++ b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc @@ -0,0 +1,1971 @@ +unset shellHook +PATH=${PATH:-} +nix_saved_PATH="$PATH" +XDG_DATA_DIRS=${XDG_DATA_DIRS:-} +nix_saved_XDG_DATA_DIRS="$XDG_DATA_DIRS" +AR='ar' +export AR +AS='as' +export AS +BASH='/nix/store/a1s263pmsci9zykm5xcdf7x9rv26w6d5-bash-5.2p26/bin/bash' +CC='gcc' +export CC +CFLAGS='' +export CFLAGS +CONFIG_SHELL='/nix/store/a1s263pmsci9zykm5xcdf7x9rv26w6d5-bash-5.2p26/bin/bash' +export CONFIG_SHELL +CXX='g++' +export CXX +DEVENV_DOTFILE='/home/p/repos/zettle_db/.devenv' +export DEVENV_DOTFILE +DEVENV_PROFILE='/nix/store/asg56b2j2d6m1l3q6y7k1r75vwn8ma1a-devenv-profile' +export DEVENV_PROFILE +DEVENV_ROOT='/home/p/repos/zettle_db' +export DEVENV_ROOT +DEVENV_RUNTIME='/run/user/1000/devenv-7fbe46b' +export DEVENV_RUNTIME +DEVENV_STATE='/home/p/repos/zettle_db/.devenv/state' +export DEVENV_STATE +ERL_EPMD_ADDRESS='127.0.0.1' +export ERL_EPMD_ADDRESS +HOSTTYPE='x86_64' +HOST_PATH='/nix/store/ifzwv2xqwdnv1gz87rxkizi67py5p3vj-coreutils-9.4/bin:/nix/store/jg2i1qj5js5ckzvfq5b9p9j1gcv69750-findutils-4.9.0/bin:/nix/store/ksyif7fp4p0baafvdm5szd375s7qf6cz-diffutils-3.10/bin:/nix/store/237dff1igc3v09p9r23a37yw8dr04bv6-gnused-4.9/bin:/nix/store/avqi5nnx7qydr078ssgifc2hgzqipqgx-gnugrep-3.11/bin:/nix/store/2s1h0q7xhk33nsw90l0g53bxax0d19ih-gawk-5.2.2/bin:/nix/store/xwvgwr85gghbl66kj30sp19p2y1cypqv-gnutar-1.35/bin:/nix/store/vnfi66rm1dykn8gwwy5i4f48bhbk9x6x-gzip-1.13/bin:/nix/store/3bdjxil2cz8dkd6l5sf4qalla762m99d-bzip2-1.0.8-bin/bin:/nix/store/pg3wkw0as88676ib4ckbibrfwy5c5vzg-gnumake-4.4.1/bin:/nix/store/a1s263pmsci9zykm5xcdf7x9rv26w6d5-bash-5.2p26/bin:/nix/store/bf9rz7vvxannxp15wfi7x0bx5b68ky7z-patch-2.7.6/bin:/nix/store/jdg5lv2j7d765h8pn73qz72lilxrcb5x-xz-5.4.6-bin/bin:/nix/store/j3f0hag67n4piz2avqgf07gja8a2ifn6-file-5.45/bin' +export HOST_PATH +IFS=' +' +IN_NIX_SHELL='impure' +export IN_NIX_SHELL +LD='ld' +export LD +LINENO='76' +MACHTYPE='x86_64-pc-linux-gnu' +NIX_BINTOOLS='/nix/store/jsjfmx7r6cpyixxsg7bjl5cy3y8hw7k7-binutils-wrapper-2.41' +export NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' +export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES='8' +export NIX_BUILD_CORES +NIX_CC='/nix/store/ac1hb5dc2z4biwgy8mjrhlifffkkrvdq-gcc-wrapper-13.2.0' +export NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' +export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE=' -frandom-seed=wvi4ddidwz -isystem /nix/store/0glhx5lz5iphmz7dqfv5sa903z3adzpv-gnumake-4.4.1/include -isystem /nix/store/rmw2v7grbj340hh4q5pimc3asgybqs3a-gdb-14.2/include -isystem /nix/store/r97382g1m15djmj60if45sjjscc716az-valgrind-3.22.0-dev/include -isystem /nix/store/0glhx5lz5iphmz7dqfv5sa903z3adzpv-gnumake-4.4.1/include -isystem /nix/store/rmw2v7grbj340hh4q5pimc3asgybqs3a-gdb-14.2/include -isystem /nix/store/r97382g1m15djmj60if45sjjscc716az-valgrind-3.22.0-dev/include' +export NIX_CFLAGS_COMPILE +NIX_ENFORCE_NO_NATIVE='1' +export NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE='bindnow format fortify fortify3 pic relro stackprotector strictoverflow' +export NIX_HARDENING_ENABLE +NIX_LDFLAGS='-rpath /home/p/repos/zettle_db/outputs/out/lib -L/nix/store/rmw2v7grbj340hh4q5pimc3asgybqs3a-gdb-14.2/lib -L/nix/store/rmw2v7grbj340hh4q5pimc3asgybqs3a-gdb-14.2/lib -L/nix/store/rmw2v7grbj340hh4q5pimc3asgybqs3a-gdb-14.2/lib -L/nix/store/rmw2v7grbj340hh4q5pimc3asgybqs3a-gdb-14.2/lib' +export NIX_LDFLAGS +NIX_NO_SELF_RPATH='1' +NIX_PKG_CONFIG_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' +export NIX_PKG_CONFIG_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_STORE='/nix/store' +export NIX_STORE +NM='nm' +export NM +OBJCOPY='objcopy' +export OBJCOPY +OBJDUMP='objdump' +export OBJDUMP +OLDPWD='' +export OLDPWD +OPTERR='1' +OSTYPE='linux-gnu' +PATH='/nix/store/1vfx6idq7d7flgh4sl4gkgfny71jz0zl-process-compose-1.2.0/bin:/nix/store/gskgkz4dfyvzpfls0vfmpv5xqpq4pk5s-rabbitmq-server-3.12.13/bin:/nix/store/59wfdx425zq5d7kf7l08sm1920w5n02y-mold-wrapper-2.30.0/bin:/nix/store/9ykrmxj22as422wa7sfmm5jznwh87bvw-mold-2.30.0/bin:/nix/store/fpv9yd0mwm1lyph02j9bdyxbjz8vaxzy-glibc-2.39-5-bin/bin:/nix/store/ifzwv2xqwdnv1gz87rxkizi67py5p3vj-coreutils-9.4/bin:/nix/store/kjpxraccdifbs2is5vf05fq7fi87mwj8-rustc-wrapper-1.76.0/bin:/nix/store/5qai4l0gacgg1fxzwxplw9yl8jqnm6ba-cargo-1.76.0/bin:/nix/store/hmhk0hpk3d38pw8a3bk8ibvg8ssx6mfx-clippy-1.76.0/bin:/nix/store/95zfgz2mj6784dy8pvk5x5ay3cnszak9-rustfmt-1.76.0/bin:/nix/store/9yy1qvl2w9pwxdddvf2gmq903fjabqkx-rust-analyzer-2024-03-25/bin:/nix/store/0glhx5lz5iphmz7dqfv5sa903z3adzpv-gnumake-4.4.1/bin:/nix/store/87lkn79v00pwsr1agyhdiay666mcw7r5-ccls-0.20230717/bin:/nix/store/fyxva0kkcmaigwk4218l0zdy8z3s9sj3-pkg-config-wrapper-0.29.2/bin:/nix/store/rmw2v7grbj340hh4q5pimc3asgybqs3a-gdb-14.2/bin:/nix/store/78zxvxfy6klvwfc2s95y71y0b284fd6v-valgrind-3.22.0/bin:/nix/store/h2bmr5wl6a0jbrl06jz3a38y3fr9fi1m-devenv/bin:/nix/store/43n2dxi419b1jgv2bq1xg7y6n8k66xpb-patchelf-0.15.0/bin:/nix/store/ac1hb5dc2z4biwgy8mjrhlifffkkrvdq-gcc-wrapper-13.2.0/bin:/nix/store/a3mmr5jmrd0sjvmnc9vqvs388ppq1bnf-gcc-13.2.0/bin:/nix/store/jsjfmx7r6cpyixxsg7bjl5cy3y8hw7k7-binutils-wrapper-2.41/bin:/nix/store/hqvni28zpibl6jsqqimcvng6h6qm58xy-binutils-2.41/bin:/nix/store/ifzwv2xqwdnv1gz87rxkizi67py5p3vj-coreutils-9.4/bin:/nix/store/jg2i1qj5js5ckzvfq5b9p9j1gcv69750-findutils-4.9.0/bin:/nix/store/ksyif7fp4p0baafvdm5szd375s7qf6cz-diffutils-3.10/bin:/nix/store/237dff1igc3v09p9r23a37yw8dr04bv6-gnused-4.9/bin:/nix/store/avqi5nnx7qydr078ssgifc2hgzqipqgx-gnugrep-3.11/bin:/nix/store/2s1h0q7xhk33nsw90l0g53bxax0d19ih-gawk-5.2.2/bin:/nix/store/xwvgwr85gghbl66kj30sp19p2y1cypqv-gnutar-1.35/bin:/nix/store/vnfi66rm1dykn8gwwy5i4f48bhbk9x6x-gzip-1.13/bin:/nix/store/3bdjxil2cz8dkd6l5sf4qalla762m99d-bzip2-1.0.8-bin/bin:/nix/store/pg3wkw0as88676ib4ckbibrfwy5c5vzg-gnumake-4.4.1/bin:/nix/store/a1s263pmsci9zykm5xcdf7x9rv26w6d5-bash-5.2p26/bin:/nix/store/bf9rz7vvxannxp15wfi7x0bx5b68ky7z-patch-2.7.6/bin:/nix/store/jdg5lv2j7d765h8pn73qz72lilxrcb5x-xz-5.4.6-bin/bin:/nix/store/j3f0hag67n4piz2avqgf07gja8a2ifn6-file-5.45/bin' +export PATH +PKG_CONFIG='pkg-config' +export PKG_CONFIG +PKG_CONFIG_PATH='/nix/store/r97382g1m15djmj60if45sjjscc716az-valgrind-3.22.0-dev/lib/pkgconfig' +export PKG_CONFIG_PATH +PS4='+ ' +RABBITMQ_CONFIG_FILE='/nix/store/qgnfn019dmw8qy72l1sjwyahvd3x53g0-rabbitmq.conf' +export RABBITMQ_CONFIG_FILE +RABBITMQ_DATA_DIR='/home/p/repos/zettle_db/.devenv/state/rabbitmq' +export RABBITMQ_DATA_DIR +RABBITMQ_ENABLED_PLUGINS_FILE='/nix/store/215xr4jkh6hpy21h28n730ak2fq99v7k-enabled_plugins' +export RABBITMQ_ENABLED_PLUGINS_FILE +RABBITMQ_HOST='127.0.0.1' +export RABBITMQ_HOST +RABBITMQ_LOGS='-' +export RABBITMQ_LOGS +RABBITMQ_LOG_BASE='/home/p/repos/zettle_db/.devenv/state/rabbitmq/logs' +export RABBITMQ_LOG_BASE +RABBITMQ_MNESIA_BASE='/home/p/repos/zettle_db/.devenv/state/rabbitmq/mnesia' +export RABBITMQ_MNESIA_BASE +RABBITMQ_NODENAME='rabbit@localhost' +export RABBITMQ_NODENAME +RABBITMQ_PLUGINS_DIR='' +export RABBITMQ_PLUGINS_DIR +RANLIB='ranlib' +export RANLIB +READELF='readelf' +export READELF +RUSTDOCFLAGS='-C link-arg=-fuse-ld=mold' +export RUSTDOCFLAGS +RUSTFLAGS='-C link-arg=-fuse-ld=mold ' +export RUSTFLAGS +RUST_SRC_PATH='/nix/store/iwgsncx73v2rp4mh5dmw8wchaf3dkkzk-rust-lib-src' +export RUST_SRC_PATH +SIZE='size' +export SIZE +SOURCE_DATE_EPOCH='315532800' +export SOURCE_DATE_EPOCH +STRINGS='strings' +export STRINGS +STRIP='strip' +export STRIP +XDG_DATA_DIRS='/nix/store/1vfx6idq7d7flgh4sl4gkgfny71jz0zl-process-compose-1.2.0/share:/nix/store/5qai4l0gacgg1fxzwxplw9yl8jqnm6ba-cargo-1.76.0/share:/nix/store/0glhx5lz5iphmz7dqfv5sa903z3adzpv-gnumake-4.4.1/share:/nix/store/fyxva0kkcmaigwk4218l0zdy8z3s9sj3-pkg-config-wrapper-0.29.2/share:/nix/store/rmw2v7grbj340hh4q5pimc3asgybqs3a-gdb-14.2/share:/nix/store/43n2dxi419b1jgv2bq1xg7y6n8k66xpb-patchelf-0.15.0/share' +export XDG_DATA_DIRS +__structuredAttrs='' +export __structuredAttrs +_substituteStream_has_warned_replace_deprecation='false' +buildInputs='' +export buildInputs +buildPhase='{ echo "------------------------------------------------------------"; + echo " WARNING: the existence of this path is not guaranteed."; + echo " It is an internal implementation detail for pkgs.mkShell."; + echo "------------------------------------------------------------"; + echo; + # Record all build inputs as runtime dependencies + export; +} >> "$out" +' +export buildPhase +builder='/nix/store/a1s263pmsci9zykm5xcdf7x9rv26w6d5-bash-5.2p26/bin/bash' +export builder +cmakeFlags='' +export cmakeFlags +configureFlags='' +export configureFlags +defaultBuildInputs='' +defaultNativeBuildInputs='/nix/store/43n2dxi419b1jgv2bq1xg7y6n8k66xpb-patchelf-0.15.0 /nix/store/9la7flpks9z89djvmmblzzs4fqvhwgzg-update-autotools-gnu-config-scripts-hook /nix/store/h9lc1dpi14z7is86ffhl3ld569138595-audit-tmpdir.sh /nix/store/m54bmrhj6fqz8nds5zcj97w9s9bckc9v-compress-man-pages.sh /nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh /nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh /nix/store/jivxp510zxakaaic7qkrb7v1dd2rdbw9-multiple-outputs.sh /nix/store/ilaf1w22bxi6jsi45alhmvvdgy4ly3zs-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh /nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh /nix/store/wmknncrif06fqxa16hpdldhixk95nds0-strip.sh /nix/store/ac1hb5dc2z4biwgy8mjrhlifffkkrvdq-gcc-wrapper-13.2.0' +depsBuildBuild='' +export depsBuildBuild +depsBuildBuildPropagated='' +export depsBuildBuildPropagated +depsBuildTarget='' +export depsBuildTarget +depsBuildTargetPropagated='' +export depsBuildTargetPropagated +depsHostHost='' +export depsHostHost +depsHostHostPropagated='' +export depsHostHostPropagated +depsTargetTarget='' +export depsTargetTarget +depsTargetTargetPropagated='' +export depsTargetTargetPropagated +doCheck='' +export doCheck +doInstallCheck='' +export doInstallCheck +dontAddDisableDepTrack='1' +export dontAddDisableDepTrack +declare -a envBuildBuildHooks=() +declare -a envBuildHostHooks=() +declare -a envBuildTargetHooks=() +declare -a envHostHostHooks=('bintoolsWrapper_addLDVars' 'pkgConfigWrapper_addPkgConfigPath' 'ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' ) +declare -a envHostTargetHooks=('bintoolsWrapper_addLDVars' 'pkgConfigWrapper_addPkgConfigPath' 'ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' ) +declare -a envTargetTargetHooks=() +declare -a fixupOutputHooks=('if [ -z "${dontPatchELF-}" ]; then patchELF "$prefix"; fi' 'if [[ -z "${noAuditTmpdir-}" && -e "$prefix" ]]; then auditTmpdir "$prefix"; fi' 'if [ -z "${dontGzipMan-}" ]; then compressManPages "$prefix"; fi' '_moveLib64' '_moveSbin' '_moveSystemdUserUnits' 'patchShebangsAuto' '_pruneLibtoolFiles' '_doStrip' ) +guess='8' +hardeningDisable='' +export hardeningDisable +initialPath='/nix/store/ifzwv2xqwdnv1gz87rxkizi67py5p3vj-coreutils-9.4 /nix/store/jg2i1qj5js5ckzvfq5b9p9j1gcv69750-findutils-4.9.0 /nix/store/ksyif7fp4p0baafvdm5szd375s7qf6cz-diffutils-3.10 /nix/store/237dff1igc3v09p9r23a37yw8dr04bv6-gnused-4.9 /nix/store/avqi5nnx7qydr078ssgifc2hgzqipqgx-gnugrep-3.11 /nix/store/2s1h0q7xhk33nsw90l0g53bxax0d19ih-gawk-5.2.2 /nix/store/xwvgwr85gghbl66kj30sp19p2y1cypqv-gnutar-1.35 /nix/store/vnfi66rm1dykn8gwwy5i4f48bhbk9x6x-gzip-1.13 /nix/store/3bdjxil2cz8dkd6l5sf4qalla762m99d-bzip2-1.0.8-bin /nix/store/pg3wkw0as88676ib4ckbibrfwy5c5vzg-gnumake-4.4.1 /nix/store/a1s263pmsci9zykm5xcdf7x9rv26w6d5-bash-5.2p26 /nix/store/bf9rz7vvxannxp15wfi7x0bx5b68ky7z-patch-2.7.6 /nix/store/jdg5lv2j7d765h8pn73qz72lilxrcb5x-xz-5.4.6-bin /nix/store/j3f0hag67n4piz2avqgf07gja8a2ifn6-file-5.45' +mesonFlags='' +export mesonFlags +name='devenv-shell-env' +export name +nativeBuildInputs='/nix/store/1vfx6idq7d7flgh4sl4gkgfny71jz0zl-process-compose-1.2.0 /nix/store/gskgkz4dfyvzpfls0vfmpv5xqpq4pk5s-rabbitmq-server-3.12.13 /nix/store/59wfdx425zq5d7kf7l08sm1920w5n02y-mold-wrapper-2.30.0 /nix/store/kjpxraccdifbs2is5vf05fq7fi87mwj8-rustc-wrapper-1.76.0 /nix/store/5qai4l0gacgg1fxzwxplw9yl8jqnm6ba-cargo-1.76.0 /nix/store/hmhk0hpk3d38pw8a3bk8ibvg8ssx6mfx-clippy-1.76.0 /nix/store/95zfgz2mj6784dy8pvk5x5ay3cnszak9-rustfmt-1.76.0 /nix/store/9yy1qvl2w9pwxdddvf2gmq903fjabqkx-rust-analyzer-2024-03-25 /nix/store/v5lsd029lz5lfhamivbgqyp3zdv94ah2-stdenv-linux /nix/store/0glhx5lz5iphmz7dqfv5sa903z3adzpv-gnumake-4.4.1 /nix/store/87lkn79v00pwsr1agyhdiay666mcw7r5-ccls-0.20230717 /nix/store/fyxva0kkcmaigwk4218l0zdy8z3s9sj3-pkg-config-wrapper-0.29.2 /nix/store/rmw2v7grbj340hh4q5pimc3asgybqs3a-gdb-14.2 /nix/store/r97382g1m15djmj60if45sjjscc716az-valgrind-3.22.0-dev /nix/store/h2bmr5wl6a0jbrl06jz3a38y3fr9fi1m-devenv /nix/store/fyxva0kkcmaigwk4218l0zdy8z3s9sj3-pkg-config-wrapper-0.29.2' +export nativeBuildInputs +out='/home/p/repos/zettle_db/outputs/out' +export out +outputBin='out' +outputDev='out' +outputDevdoc='REMOVE' +outputDevman='out' +outputDoc='out' +outputInclude='out' +outputInfo='out' +outputLib='out' +outputMan='out' +outputs='out' +export outputs +patches='' +export patches +phases='buildPhase' +export phases +pkg='/nix/store/ac1hb5dc2z4biwgy8mjrhlifffkkrvdq-gcc-wrapper-13.2.0' +declare -a pkgsBuildBuild=() +declare -a pkgsBuildHost=('/nix/store/1vfx6idq7d7flgh4sl4gkgfny71jz0zl-process-compose-1.2.0' '/nix/store/gskgkz4dfyvzpfls0vfmpv5xqpq4pk5s-rabbitmq-server-3.12.13' '/nix/store/59wfdx425zq5d7kf7l08sm1920w5n02y-mold-wrapper-2.30.0' '/nix/store/kjpxraccdifbs2is5vf05fq7fi87mwj8-rustc-wrapper-1.76.0' '/nix/store/5qai4l0gacgg1fxzwxplw9yl8jqnm6ba-cargo-1.76.0' '/nix/store/hmhk0hpk3d38pw8a3bk8ibvg8ssx6mfx-clippy-1.76.0' '/nix/store/95zfgz2mj6784dy8pvk5x5ay3cnszak9-rustfmt-1.76.0' '/nix/store/9yy1qvl2w9pwxdddvf2gmq903fjabqkx-rust-analyzer-2024-03-25' '/nix/store/v5lsd029lz5lfhamivbgqyp3zdv94ah2-stdenv-linux' '/nix/store/0glhx5lz5iphmz7dqfv5sa903z3adzpv-gnumake-4.4.1' '/nix/store/87lkn79v00pwsr1agyhdiay666mcw7r5-ccls-0.20230717' '/nix/store/fyxva0kkcmaigwk4218l0zdy8z3s9sj3-pkg-config-wrapper-0.29.2' '/nix/store/rmw2v7grbj340hh4q5pimc3asgybqs3a-gdb-14.2' '/nix/store/r97382g1m15djmj60if45sjjscc716az-valgrind-3.22.0-dev' '/nix/store/78zxvxfy6klvwfc2s95y71y0b284fd6v-valgrind-3.22.0' '/nix/store/h2bmr5wl6a0jbrl06jz3a38y3fr9fi1m-devenv' '/nix/store/43n2dxi419b1jgv2bq1xg7y6n8k66xpb-patchelf-0.15.0' '/nix/store/9la7flpks9z89djvmmblzzs4fqvhwgzg-update-autotools-gnu-config-scripts-hook' '/nix/store/h9lc1dpi14z7is86ffhl3ld569138595-audit-tmpdir.sh' '/nix/store/m54bmrhj6fqz8nds5zcj97w9s9bckc9v-compress-man-pages.sh' '/nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh' '/nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh' '/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh' '/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh' '/nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh' '/nix/store/jivxp510zxakaaic7qkrb7v1dd2rdbw9-multiple-outputs.sh' '/nix/store/ilaf1w22bxi6jsi45alhmvvdgy4ly3zs-patch-shebangs.sh' '/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh' '/nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh' '/nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh' '/nix/store/wmknncrif06fqxa16hpdldhixk95nds0-strip.sh' '/nix/store/ac1hb5dc2z4biwgy8mjrhlifffkkrvdq-gcc-wrapper-13.2.0' '/nix/store/jsjfmx7r6cpyixxsg7bjl5cy3y8hw7k7-binutils-wrapper-2.41' ) +declare -a pkgsBuildTarget=() +declare -a pkgsHostHost=() +declare -a pkgsHostTarget=() +declare -a pkgsTargetTarget=() +declare -a postFixupHooks=('_makeSymlinksRelativeInAllOutputs' '_multioutPropagateDev' ) +declare -a postUnpackHooks=('_updateSourceDateEpochFromSourceRoot' ) +declare -a preConfigureHooks=('_multioutConfig' ) +preConfigurePhases=' updateAutotoolsGnuConfigScriptsPhase' +declare -a preFixupHooks=('_moveToShare' '_multioutDocs' '_multioutDevs' ) +preferLocalBuild='1' +export preferLocalBuild +prefix='/home/p/repos/zettle_db/outputs/out' +declare -a propagatedBuildDepFiles=('propagated-build-build-deps' 'propagated-native-build-inputs' 'propagated-build-target-deps' ) +propagatedBuildInputs='' +export propagatedBuildInputs +declare -a propagatedHostDepFiles=('propagated-host-host-deps' 'propagated-build-inputs' ) +propagatedNativeBuildInputs='' +export propagatedNativeBuildInputs +declare -a propagatedTargetDepFiles=('propagated-target-target-deps' ) +shell='/nix/store/a1s263pmsci9zykm5xcdf7x9rv26w6d5-bash-5.2p26/bin/bash' +export shell +shellHook=' + +export CARGO_INSTALL_ROOT=$('\''/nix/store/ifzwv2xqwdnv1gz87rxkizi67py5p3vj-coreutils-9.4/bin/realpath'\'' '\''--no-symlinks'\'' '\''/home/p/repos/zettle_db/.devenv/state/cargo-install'\'') +export PATH="$PATH:$CARGO_INSTALL_ROOT/bin" + +echo "run devenv up -d to start and monitor services" + +export PS1="\[\e[0;34m\](devenv)\[\e[0m\] ${PS1-}" + +# set path to locales on non-NixOS Linux hosts +if [ -z "${LOCALE_ARCHIVE-}" ]; then + export LOCALE_ARCHIVE=/nix/store/acpg83w1wh875vgnlh0va08wfggj35xh-glibc-locales-2.39-5/lib/locale/locale-archive +fi + + +# note what environments are active, but make sure we don'\''t repeat them +if [[ ! "${DIRENV_ACTIVE-}" =~ (^|:)"$PWD"(:|$) ]]; then + export DIRENV_ACTIVE="$PWD:${DIRENV_ACTIVE-}" +fi + +# devenv helper +if [ ! type -p direnv &>/dev/null && -f .envrc ]; then + echo "You have .envrc but direnv command is not installed." + echo "Please install direnv: https://direnv.net/docs/installation.html" +fi + +mkdir -p "$DEVENV_STATE" +if [ ! -L "$DEVENV_DOTFILE/profile" ] || [ "$(/nix/store/ifzwv2xqwdnv1gz87rxkizi67py5p3vj-coreutils-9.4/bin/readlink $DEVENV_DOTFILE/profile)" != "/nix/store/asg56b2j2d6m1l3q6y7k1r75vwn8ma1a-devenv-profile" ] +then + ln -snf /nix/store/asg56b2j2d6m1l3q6y7k1r75vwn8ma1a-devenv-profile "$DEVENV_DOTFILE/profile" +fi +unset HOST_PATH NIX_BUILD_CORES __structuredAttrs buildInputs buildPhase builder depsBuildBuild depsBuildBuildPropagated depsBuildTarget depsBuildTargetPropagated depsHostHost depsHostHostPropagated depsTargetTarget depsTargetTargetPropagated dontAddDisableDepTrack doCheck doInstallCheck nativeBuildInputs out outputs patches phases preferLocalBuild propagatedBuildInputs propagatedNativeBuildInputs shell shellHook stdenv strictDeps + +mkdir -p '\''/run/user/1000/devenv-7fbe46b'\'' +ln -snf '\''/run/user/1000/devenv-7fbe46b'\'' '\''/home/p/repos/zettle_db/.devenv'\''/run + +' +export shellHook +stdenv='/nix/store/v5lsd029lz5lfhamivbgqyp3zdv94ah2-stdenv-linux' +export stdenv +strictDeps='' +export strictDeps +system='x86_64-linux' +export system +declare -a unpackCmdHooks=('_defaultUnpack' ) +_accumFlagsArray () +{ + + local name; + if [ -n "$__structuredAttrs" ]; then + for name in "$@"; + do + local -n nameref="$name"; + flagsArray+=(${nameref+"${nameref[@]}"}); + done; + else + for name in "$@"; + do + local -n nameref="$name"; + case "$name" in + *Array) + flagsArray+=(${nameref+"${nameref[@]}"}) + ;; + *) + flagsArray+=(${nameref-}) + ;; + esac; + done; + fi +} +_activatePkgs () +{ + + local hostOffset targetOffset; + local pkg; + for hostOffset in "${allPlatOffsets[@]}"; + do + local pkgsVar="${pkgAccumVarVars[hostOffset + 1]}"; + for targetOffset in "${allPlatOffsets[@]}"; + do + (( hostOffset <= targetOffset )) || continue; + local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]"; + local pkgsSlice="${!pkgsRef}[@]"; + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; + do + activatePackage "$pkg" "$hostOffset" "$targetOffset"; + done; + done; + done +} +_addRpathPrefix () +{ + + if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then + export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}"; + fi +} +_addToEnv () +{ + + local depHostOffset depTargetOffset; + local pkg; + for depHostOffset in "${allPlatOffsets[@]}"; + do + local hookVar="${pkgHookVarVars[depHostOffset + 1]}"; + local pkgsVar="${pkgAccumVarVars[depHostOffset + 1]}"; + for depTargetOffset in "${allPlatOffsets[@]}"; + do + (( depHostOffset <= depTargetOffset )) || continue; + local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"; + if [[ -z "${strictDeps-}" ]]; then + local visitedPkgs=""; + for pkg in "${pkgsBuildBuild[@]}" "${pkgsBuildHost[@]}" "${pkgsBuildTarget[@]}" "${pkgsHostHost[@]}" "${pkgsHostTarget[@]}" "${pkgsTargetTarget[@]}"; + do + if [[ "$visitedPkgs" = *"$pkg"* ]]; then + continue; + fi; + runHook "${!hookRef}" "$pkg"; + visitedPkgs+=" $pkg"; + done; + else + local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"; + local pkgsSlice="${!pkgsRef}[@]"; + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; + do + runHook "${!hookRef}" "$pkg"; + done; + fi; + done; + done +} +_allFlags () +{ + + export system pname name version; + for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }'); + do + if (( "${NIX_DEBUG:-0}" >= 1 )); then + printf "@%s@ -> %q\n" "${varName}" "${!varName}" 1>&2; + fi; + args+=("--subst-var" "$varName"); + done +} +_assignFirst () +{ + + local varName="$1"; + local _var; + local REMOVE=REMOVE; + shift; + for _var in "$@"; + do + if [ -n "${!_var-}" ]; then + eval "${varName}"="${_var}"; + return; + fi; + done; + echo; + echo "error: _assignFirst: could not find a non-empty variable whose name to assign to ${varName}."; + echo " The following variables were all unset or empty:"; + echo " $*"; + if [ -z "${out:-}" ]; then + echo ' If you do not want an "out" output in your derivation, make sure to define'; + echo ' the other specific required outputs. This can be achieved by picking one'; + echo " of the above as an output."; + echo ' You do not have to remove "out" if you want to have a different default'; + echo ' output, because the first output is taken as a default.'; + echo; + fi; + return 1 +} +_callImplicitHook () +{ + + local def="$1"; + local hookName="$2"; + if declare -F "$hookName" > /dev/null; then + "$hookName"; + else + if type -p "$hookName" > /dev/null; then + source "$hookName"; + else + if [ -n "${!hookName:-}" ]; then + eval "${!hookName}"; + else + return "$def"; + fi; + fi; + fi +} +_defaultUnpack () +{ + + local fn="$1"; + local destination; + if [ -d "$fn" ]; then + destination="$(stripHash "$fn")"; + if [ -e "$destination" ]; then + echo "Cannot copy $fn to $destination: destination already exists!"; + echo "Did you specify two \"srcs\" with the same \"name\"?"; + return 1; + fi; + cp -pr --reflink=auto -- "$fn" "$destination"; + else + case "$fn" in + *.tar.xz | *.tar.lzma | *.txz) + ( XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn"; + true ) | tar xf - --warning=no-timestamp + ;; + *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) + tar xf "$fn" --warning=no-timestamp + ;; + *) + return 1 + ;; + esac; + fi +} +_doStrip () +{ + + local -ra flags=(dontStripHost dontStripTarget); + local -ra debugDirs=(stripDebugList stripDebugListTarget); + local -ra allDirs=(stripAllList stripAllListTarget); + local -ra stripCmds=(STRIP STRIP_FOR_TARGET); + local -ra ranlibCmds=(RANLIB RANLIB_FOR_TARGET); + stripDebugList=${stripDebugList[*]:-lib lib32 lib64 libexec bin sbin}; + stripDebugListTarget=${stripDebugListTarget[*]:-}; + stripAllList=${stripAllList[*]:-}; + stripAllListTarget=${stripAllListTarget[*]:-}; + local i; + for i in ${!stripCmds[@]}; + do + local -n flag="${flags[$i]}"; + local -n debugDirList="${debugDirs[$i]}"; + local -n allDirList="${allDirs[$i]}"; + local -n stripCmd="${stripCmds[$i]}"; + local -n ranlibCmd="${ranlibCmds[$i]}"; + if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null 1>&2; then + continue; + fi; + stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags[*]:--S -p}"; + stripDirs "$stripCmd" "$ranlibCmd" "$allDirList" "${stripAllFlags[*]:--s -p}"; + done +} +_eval () +{ + + if declare -F "$1" > /dev/null 2>&1; then + "$@"; + else + eval "$1"; + fi +} +_makeSymlinksRelative () +{ + + local symlinkTarget; + if [ "${dontRewriteSymlinks-}" ] || [ ! -e "$prefix" ]; then + return; + fi; + while IFS= read -r -d '' f; do + symlinkTarget=$(readlink "$f"); + if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then + continue; + fi; + if [ ! -e "$symlinkTarget" ]; then + echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)"; + fi; + echo "rewriting symlink $f to be relative to $prefix"; + ln -snrf "$symlinkTarget" "$f"; + done < <(find $prefix -type l -print0) +} +_makeSymlinksRelativeInAllOutputs () +{ + + local output; + for output in $(getAllOutputNames); + do + prefix="${!output}" _makeSymlinksRelative; + done +} +_moveLib64 () +{ + + if [ "${dontMoveLib64-}" = 1 ]; then + return; + fi; + if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then + return; + fi; + echo "moving $prefix/lib64/* to $prefix/lib"; + mkdir -p $prefix/lib; + shopt -s dotglob; + for i in $prefix/lib64/*; + do + mv --no-clobber "$i" $prefix/lib; + done; + shopt -u dotglob; + rmdir $prefix/lib64; + ln -s lib $prefix/lib64 +} +_moveSbin () +{ + + if [ "${dontMoveSbin-}" = 1 ]; then + return; + fi; + if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then + return; + fi; + echo "moving $prefix/sbin/* to $prefix/bin"; + mkdir -p $prefix/bin; + shopt -s dotglob; + for i in $prefix/sbin/*; + do + mv "$i" $prefix/bin; + done; + shopt -u dotglob; + rmdir $prefix/sbin; + ln -s bin $prefix/sbin +} +_moveSystemdUserUnits () +{ + + if [ "${dontMoveSystemdUserUnits:-0}" = 1 ]; then + return; + fi; + if [ ! -e "${prefix:?}/lib/systemd/user" ]; then + return; + fi; + local source="$prefix/lib/systemd/user"; + local target="$prefix/share/systemd/user"; + echo "moving $source/* to $target"; + mkdir -p "$target"; + ( shopt -s dotglob; + for i in "$source"/*; + do + mv "$i" "$target"; + done ); + rmdir "$source"; + ln -s "$target" "$source" +} +_moveToShare () +{ + + if [ -n "$__structuredAttrs" ]; then + if [ -z "${forceShare-}" ]; then + forceShare=(man doc info); + fi; + else + forceShare=(${forceShare:-man doc info}); + fi; + if [[ -z "$out" ]]; then + return; + fi; + for d in "${forceShare[@]}"; + do + if [ -d "$out/$d" ]; then + if [ -d "$out/share/$d" ]; then + echo "both $d/ and share/$d/ exist!"; + else + echo "moving $out/$d to $out/share/$d"; + mkdir -p $out/share; + mv $out/$d $out/share/; + fi; + fi; + done +} +_multioutConfig () +{ + + if [ "$(getAllOutputNames)" = "out" ] || [ -z "${setOutputFlags-1}" ]; then + return; + fi; + if [ -z "${shareDocName:-}" ]; then + local confScript="${configureScript:-}"; + if [ -z "$confScript" ] && [ -x ./configure ]; then + confScript=./configure; + fi; + if [ -f "$confScript" ]; then + local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")"; + fi; + if [ -z "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then + shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"; + fi; + fi; + prependToVar configureFlags --bindir="${!outputBin}"/bin --sbindir="${!outputBin}"/sbin --includedir="${!outputInclude}"/include --oldincludedir="${!outputInclude}"/include --mandir="${!outputMan}"/share/man --infodir="${!outputInfo}"/share/info --docdir="${!outputDoc}"/share/doc/"${shareDocName}" --libdir="${!outputLib}"/lib --libexecdir="${!outputLib}"/libexec --localedir="${!outputLib}"/share/locale; + prependToVar installFlags pkgconfigdir="${!outputDev}"/lib/pkgconfig m4datadir="${!outputDev}"/share/aclocal aclocaldir="${!outputDev}"/share/aclocal +} +_multioutDevs () +{ + + if [ "$(getAllOutputNames)" = "out" ] || [ -z "${moveToDev-1}" ]; then + return; + fi; + moveToOutput include "${!outputInclude}"; + moveToOutput lib/pkgconfig "${!outputDev}"; + moveToOutput share/pkgconfig "${!outputDev}"; + moveToOutput lib/cmake "${!outputDev}"; + moveToOutput share/aclocal "${!outputDev}"; + for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc; + do + echo "Patching '$f' includedir to output ${!outputInclude}"; + sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"; + done +} +_multioutDocs () +{ + + local REMOVE=REMOVE; + moveToOutput share/info "${!outputInfo}"; + moveToOutput share/doc "${!outputDoc}"; + moveToOutput share/gtk-doc "${!outputDevdoc}"; + moveToOutput share/devhelp/books "${!outputDevdoc}"; + moveToOutput share/man "${!outputMan}"; + moveToOutput share/man/man3 "${!outputDevman}" +} +_multioutPropagateDev () +{ + + if [ "$(getAllOutputNames)" = "out" ]; then + return; + fi; + local outputFirst; + for outputFirst in $(getAllOutputNames); + do + break; + done; + local propagaterOutput="$outputDev"; + if [ -z "$propagaterOutput" ]; then + propagaterOutput="$outputFirst"; + fi; + if [ -z "${propagatedBuildOutputs+1}" ]; then + local po_dirty="$outputBin $outputInclude $outputLib"; + set +o pipefail; + propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `; + set -o pipefail; + fi; + if [ -z "$propagatedBuildOutputs" ]; then + return; + fi; + mkdir -p "${!propagaterOutput}"/nix-support; + for output in $propagatedBuildOutputs; + do + echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs; + done +} +_overrideFirst () +{ + + if [ -z "${!1-}" ]; then + _assignFirst "$@"; + fi +} +_pruneLibtoolFiles () +{ + + if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then + return; + fi; + find "$prefix" -type f -name '*.la' -exec grep -q '^# Generated by .*libtool' {} \; -exec grep -q "^old_library=''" {} \; -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \; +} +_updateSourceDateEpochFromSourceRoot () +{ + + if [ -n "$sourceRoot" ]; then + updateSourceDateEpoch "$sourceRoot"; + fi +} +activatePackage () +{ + + local pkg="$1"; + local -r hostOffset="$2"; + local -r targetOffset="$3"; + (( hostOffset <= targetOffset )) || exit 1; + if [ -f "$pkg" ]; then + source "$pkg"; + fi; + if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then + addToSearchPath _PATH "$pkg/bin"; + fi; + if (( hostOffset <= -1 )); then + addToSearchPath _XDG_DATA_DIRS "$pkg/share"; + fi; + if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then + addToSearchPath _HOST_PATH "$pkg/bin"; + fi; + if [[ -f "$pkg/nix-support/setup-hook" ]]; then + source "$pkg/nix-support/setup-hook"; + fi +} +addEnvHooks () +{ + + local depHostOffset="$1"; + shift; + local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]"; + local pkgHookVar; + for pkgHookVar in "${!pkgHookVarsSlice}"; + do + eval "${pkgHookVar}s"'+=("$@")'; + done +} +addToSearchPath () +{ + + addToSearchPathWithCustomDelimiter ":" "$@" +} +addToSearchPathWithCustomDelimiter () +{ + + local delimiter="$1"; + local varName="$2"; + local dir="$3"; + if [[ -d "$dir" && "${!varName:+${delimiter}${!varName}${delimiter}}" != *"${delimiter}${dir}${delimiter}"* ]]; then + export "${varName}=${!varName:+${!varName}${delimiter}}${dir}"; + fi +} +appendToVar () +{ + + local -n nameref="$1"; + local useArray type; + if [ -n "$__structuredAttrs" ]; then + useArray=true; + else + useArray=false; + fi; + if declare -p "$1" 2> /dev/null | grep -q '^'; then + type="$(declare -p "$1")"; + if [[ "$type" =~ "declare -A" ]]; then + echo "appendToVar(): ERROR: trying to use appendToVar on an associative array, use variable+=([\"X\"]=\"Y\") instead." 1>&2; + return 1; + else + if [[ "$type" =~ "declare -a" ]]; then + useArray=true; + else + useArray=false; + fi; + fi; + fi; + shift; + if $useArray; then + nameref=(${nameref+"${nameref[@]}"} "$@"); + else + nameref="${nameref-} $*"; + fi +} +auditTmpdir () +{ + + local dir="$1"; + [ -e "$dir" ] || return 0; + echo "checking for references to $TMPDIR/ in $dir..."; + local i; + find "$dir" -type f -print0 | while IFS= read -r -d '' i; do + if [[ "$i" =~ .build-id ]]; then + continue; + fi; + if isELF "$i"; then + if { + printf :; + patchelf --print-rpath "$i" + } | grep -q -F ":$TMPDIR/"; then + echo "RPATH of binary $i contains a forbidden reference to $TMPDIR/"; + exit 1; + fi; + fi; + if isScript "$i"; then + if [ -e "$(dirname "$i")/.$(basename "$i")-wrapped" ]; then + if grep -q -F "$TMPDIR/" "$i"; then + echo "wrapper script $i contains a forbidden reference to $TMPDIR/"; + exit 1; + fi; + fi; + fi; + done +} +bintoolsWrapper_addLDVars () +{ + + local role_post; + getHostRoleEnvHook; + if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then + export NIX_LDFLAGS${role_post}+=" -L$1/lib64"; + fi; + if [[ -d "$1/lib" ]]; then + local -a glob=($1/lib/lib*); + if [ "${#glob[*]}" -gt 0 ]; then + export NIX_LDFLAGS${role_post}+=" -L$1/lib"; + fi; + fi +} +buildPhase () +{ + + runHook preBuild; + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then + echo "no Makefile or custom buildPhase, doing nothing"; + else + foundMakefile=1; + local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES}} SHELL=$SHELL); + _accumFlagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray; + echoCmd 'build flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + runHook postBuild +} +ccWrapper_addCVars () +{ + + local role_post; + getHostRoleEnvHook; + if [ -d "$1/include" ]; then + export NIX_CFLAGS_COMPILE${role_post}+=" -isystem $1/include"; + fi; + if [ -d "$1/Library/Frameworks" ]; then + export NIX_CFLAGS_COMPILE${role_post}+=" -iframework $1/Library/Frameworks"; + fi +} +checkPhase () +{ + + runHook preCheck; + if [[ -z "${foundMakefile:-}" ]]; then + echo "no Makefile or custom checkPhase, doing nothing"; + runHook postCheck; + return; + fi; + if [[ -z "${checkTarget:-}" ]]; then + if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then + checkTarget=check; + else + if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then + checkTarget=test; + fi; + fi; + fi; + if [[ -z "${checkTarget:-}" ]]; then + echo "no check/test target in ${makefile:-Makefile}, doing nothing"; + else + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL=$SHELL); + _accumFlagsArray makeFlags makeFlagsArray; + if [ -n "$__structuredAttrs" ]; then + flagsArray+=("${checkFlags[@]:-VERBOSE=y}"); + else + flagsArray+=(${checkFlags:-VERBOSE=y}); + fi; + _accumFlagsArray checkFlagsArray; + flagsArray+=(${checkTarget}); + echoCmd 'check flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + runHook postCheck +} +compressManPages () +{ + + local dir="$1"; + if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then + return; + fi; + echo "gzipping man pages under $dir/share/man/"; + find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | while IFS= read -r -d '' f; do + if gzip -c -n "$f" > "$f".gz; then + rm "$f"; + else + rm "$f".gz; + fi; + done; + find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | sort -z | while IFS= read -r -d '' f; do + local target; + target="$(readlink -f "$f")"; + if [ -f "$target".gz ]; then + ln -sf "$target".gz "$f".gz && rm "$f"; + fi; + done +} +configurePhase () +{ + + runHook preConfigure; + : "${configureScript=}"; + if [[ -z "$configureScript" && -x ./configure ]]; then + configureScript=./configure; + fi; + if [ -z "${dontFixLibtool:-}" ]; then + export lt_cv_deplibs_check_method="${lt_cv_deplibs_check_method-pass_all}"; + local i; + find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do + echo "fixing libtool script $i"; + fixLibtool "$i"; + done; + CONFIGURE_MTIME_REFERENCE=$(mktemp configure.mtime.reference.XXXXXX); + find . -executable -type f -name configure -exec grep -l 'GNU Libtool is free software; you can redistribute it and/or modify' {} \; -exec touch -r {} "$CONFIGURE_MTIME_REFERENCE" \; -exec sed -i s_/usr/bin/file_file_g {} \; -exec touch -r "$CONFIGURE_MTIME_REFERENCE" {} \;; + rm -f "$CONFIGURE_MTIME_REFERENCE"; + fi; + if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then + prependToVar configureFlags "${prefixKey:---prefix=}$prefix"; + fi; + if [[ -f "$configureScript" ]]; then + if [ -z "${dontAddDisableDepTrack:-}" ]; then + if grep -q dependency-tracking "$configureScript"; then + prependToVar configureFlags --disable-dependency-tracking; + fi; + fi; + if [ -z "${dontDisableStatic:-}" ]; then + if grep -q enable-static "$configureScript"; then + prependToVar configureFlags --disable-static; + fi; + fi; + if [ -z "${dontPatchShebangsInConfigure:-}" ]; then + patchShebangs --build "$configureScript"; + fi; + fi; + if [ -n "$configureScript" ]; then + local -a flagsArray; + _accumFlagsArray configureFlags configureFlagsArray; + echoCmd 'configure flags' "${flagsArray[@]}"; + $configureScript "${flagsArray[@]}"; + unset flagsArray; + else + echo "no configure script, doing nothing"; + fi; + runHook postConfigure +} +consumeEntire () +{ + + if IFS='' read -r -d '' "$1"; then + echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2; + return 1; + fi +} +distPhase () +{ + + runHook preDist; + local flagsArray=(); + _accumFlagsArray distFlags distFlagsArray; + flagsArray+=(${distTarget:-dist}); + echo 'dist flags: %q' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + if [ "${dontCopyDist:-0}" != 1 ]; then + mkdir -p "$out/tarballs"; + cp -pvd ${tarballs[*]:-*.tar.gz} "$out/tarballs"; + fi; + runHook postDist +} +dumpVars () +{ + + if [ "${noDumpEnvVars:-0}" != 1 ]; then + export 2> /dev/null >| "$NIX_BUILD_TOP/env-vars" || true; + fi +} +echoCmd () +{ + + printf "%s:" "$1"; + shift; + printf ' %q' "$@"; + echo +} +exitHandler () +{ + + exitCode="$?"; + set +e; + if [ -n "${showBuildStats:-}" ]; then + read -r -d '' -a buildTimes < <(times); + echo "build times:"; + echo "user time for the shell ${buildTimes[0]}"; + echo "system time for the shell ${buildTimes[1]}"; + echo "user time for all child processes ${buildTimes[2]}"; + echo "system time for all child processes ${buildTimes[3]}"; + fi; + if (( "$exitCode" != 0 )); then + runHook failureHook; + if [ -n "${succeedOnFailure:-}" ]; then + echo "build failed with exit code $exitCode (ignored)"; + mkdir -p "$out/nix-support"; + printf "%s" "$exitCode" > "$out/nix-support/failed"; + exit 0; + fi; + else + runHook exitHook; + fi; + return "$exitCode" +} +findInputs () +{ + + local -r pkg="$1"; + local -r hostOffset="$2"; + local -r targetOffset="$3"; + (( hostOffset <= targetOffset )) || exit 1; + local varVar="${pkgAccumVarVars[hostOffset + 1]}"; + local varRef="$varVar[$((targetOffset - hostOffset))]"; + local var="${!varRef}"; + unset -v varVar varRef; + local varSlice="$var[*]"; + case "${!varSlice-}" in + *" $pkg "*) + return 0 + ;; + esac; + unset -v varSlice; + eval "$var"'+=("$pkg")'; + if ! [ -e "$pkg" ]; then + echo "build input $pkg does not exist" 1>&2; + exit 1; + fi; + function mapOffset () + { + local -r inputOffset="$1"; + local -n outputOffset="$2"; + if (( inputOffset <= 0 )); then + outputOffset=$((inputOffset + hostOffset)); + else + outputOffset=$((inputOffset - 1 + targetOffset)); + fi + }; + local relHostOffset; + for relHostOffset in "${allPlatOffsets[@]}"; + do + local files="${propagatedDepFilesVars[relHostOffset + 1]}"; + local hostOffsetNext; + mapOffset "$relHostOffset" hostOffsetNext; + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue; + local relTargetOffset; + for relTargetOffset in "${allPlatOffsets[@]}"; + do + (( "$relHostOffset" <= "$relTargetOffset" )) || continue; + local fileRef="${files}[$relTargetOffset - $relHostOffset]"; + local file="${!fileRef}"; + unset -v fileRef; + local targetOffsetNext; + mapOffset "$relTargetOffset" targetOffsetNext; + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue; + [[ -f "$pkg/nix-support/$file" ]] || continue; + local pkgNext; + read -r -d '' pkgNext < "$pkg/nix-support/$file" || true; + for pkgNext in $pkgNext; + do + findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext"; + done; + done; + done +} +fixLibtool () +{ + + local search_path; + for flag in $NIX_LDFLAGS; + do + case $flag in + -L*) + search_path+=" ${flag#-L}" + ;; + esac; + done; + sed -i "$1" -e "s^eval \(sys_lib_search_path=\).*^\1'${search_path:-}'^" -e 's^eval sys_lib_.+search_path=.*^^' +} +fixupPhase () +{ + + local output; + for output in $(getAllOutputNames); + do + if [ -e "${!output}" ]; then + chmod -R u+w "${!output}"; + fi; + done; + runHook preFixup; + local output; + for output in $(getAllOutputNames); + do + prefix="${!output}" runHook fixupOutput; + done; + recordPropagatedDependencies; + if [ -n "${setupHook:-}" ]; then + mkdir -p "${!outputDev}/nix-support"; + substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook"; + fi; + if [ -n "${setupHooks:-}" ]; then + mkdir -p "${!outputDev}/nix-support"; + local hook; + for hook in ${setupHooks[@]}; + do + local content; + consumeEntire content < "$hook"; + substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook"; + unset -v content; + done; + unset -v hook; + fi; + if [ -n "${propagatedUserEnvPkgs:-}" ]; then + mkdir -p "${!outputBin}/nix-support"; + printWords $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages"; + fi; + runHook postFixup +} +genericBuild () +{ + + export GZIP_NO_TIMESTAMPS=1; + if [ -f "${buildCommandPath:-}" ]; then + source "$buildCommandPath"; + return; + fi; + if [ -n "${buildCommand:-}" ]; then + eval "$buildCommand"; + return; + fi; + if [ -z "${phases[*]:-}" ]; then + phases="${prePhases[*]:-} unpackPhase patchPhase ${preConfigurePhases[*]:-} configurePhase ${preBuildPhases[*]:-} buildPhase checkPhase ${preInstallPhases[*]:-} installPhase ${preFixupPhases[*]:-} fixupPhase installCheckPhase ${preDistPhases[*]:-} distPhase ${postPhases[*]:-}"; + fi; + for curPhase in ${phases[*]}; + do + runPhase "$curPhase"; + done +} +getAllOutputNames () +{ + + if [ -n "$__structuredAttrs" ]; then + echo "${!outputs[*]}"; + else + echo "$outputs"; + fi +} +getHostRole () +{ + + getRole "$hostOffset" +} +getHostRoleEnvHook () +{ + + getRole "$depHostOffset" +} +getRole () +{ + + case $1 in + -1) + role_post='_FOR_BUILD' + ;; + 0) + role_post='' + ;; + 1) + role_post='_FOR_TARGET' + ;; + *) + echo "binutils-wrapper-2.41: used as improper sort of dependency" 1>&2; + return 1 + ;; + esac +} +getTargetRole () +{ + + getRole "$targetOffset" +} +getTargetRoleEnvHook () +{ + + getRole "$depTargetOffset" +} +getTargetRoleWrapper () +{ + + case $targetOffset in + -1) + export NIX_BINTOOLS_WRAPPER_TARGET_BUILD_x86_64_unknown_linux_gnu=1 + ;; + 0) + export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu=1 + ;; + 1) + export NIX_BINTOOLS_WRAPPER_TARGET_TARGET_x86_64_unknown_linux_gnu=1 + ;; + *) + echo "binutils-wrapper-2.41: used as improper sort of dependency" 1>&2; + return 1 + ;; + esac +} +installCheckPhase () +{ + + runHook preInstallCheck; + if [[ -z "${foundMakefile:-}" ]]; then + echo "no Makefile or custom installCheckPhase, doing nothing"; + else + if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} "${installCheckTarget:-installcheck}" > /dev/null 2>&1; then + echo "no installcheck target in ${makefile:-Makefile}, doing nothing"; + else + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL=$SHELL); + _accumFlagsArray makeFlags makeFlagsArray installCheckFlags installCheckFlagsArray; + flagsArray+=(${installCheckTarget:-installcheck}); + echoCmd 'installcheck flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + fi; + runHook postInstallCheck +} +installPhase () +{ + + runHook preInstall; + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then + echo "no Makefile or custom installPhase, doing nothing"; + runHook postInstall; + return; + else + foundMakefile=1; + fi; + if [ -n "$prefix" ]; then + mkdir -p "$prefix"; + fi; + local flagsArray=(${enableParallelInstalling:+-j${NIX_BUILD_CORES}} SHELL=$SHELL); + _accumFlagsArray makeFlags makeFlagsArray installFlags installFlagsArray; + if [ -n "$__structuredAttrs" ]; then + flagsArray+=("${installTargets[@]:-install}"); + else + flagsArray+=(${installTargets:-install}); + fi; + echoCmd 'install flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + runHook postInstall +} +isELF () +{ + + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + read -r -n 4 -u "$fd" magic; + exec {fd}>&-; + if [ "$magic" = 'ELF' ]; then + return 0; + else + return 1; + fi +} +isMachO () +{ + + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + read -r -n 4 -u "$fd" magic; + exec {fd}>&-; + if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xcf") || "$magic" = $(echo -ne "\xcf\xfa\xed\xfe") ]]; then + return 0; + else + if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xce") || "$magic" = $(echo -ne "\xce\xfa\xed\xfe") ]]; then + return 0; + else + if [[ "$magic" = $(echo -ne "\xca\xfe\xba\xbe") || "$magic" = $(echo -ne "\xbe\xba\xfe\xca") ]]; then + return 0; + else + return 1; + fi; + fi; + fi +} +isScript () +{ + + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + read -r -n 2 -u "$fd" magic; + exec {fd}>&-; + if [[ "$magic" =~ \#! ]]; then + return 0; + else + return 1; + fi +} +mapOffset () +{ + + local -r inputOffset="$1"; + local -n outputOffset="$2"; + if (( inputOffset <= 0 )); then + outputOffset=$((inputOffset + hostOffset)); + else + outputOffset=$((inputOffset - 1 + targetOffset)); + fi +} +moveToOutput () +{ + + local patt="$1"; + local dstOut="$2"; + local output; + for output in $(getAllOutputNames); + do + if [ "${!output}" = "$dstOut" ]; then + continue; + fi; + local srcPath; + for srcPath in "${!output}"/$patt; + do + if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then + continue; + fi; + if [ "$dstOut" = REMOVE ]; then + echo "Removing $srcPath"; + rm -r "$srcPath"; + else + local dstPath="$dstOut${srcPath#${!output}}"; + echo "Moving $srcPath to $dstPath"; + if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then + rmdir "$srcPath" --ignore-fail-on-non-empty; + if [ -d "$srcPath" ]; then + mv -t "$dstPath" "$srcPath"/*; + rmdir "$srcPath"; + fi; + else + mkdir -p "$(readlink -m "$dstPath/..")"; + mv "$srcPath" "$dstPath"; + fi; + fi; + local srcParent="$(readlink -m "$srcPath/..")"; + if [ -n "$(find "$srcParent" -maxdepth 0 -type d -empty 2> /dev/null)" ]; then + echo "Removing empty $srcParent/ and (possibly) its parents"; + rmdir -p --ignore-fail-on-non-empty "$srcParent" 2> /dev/null || true; + fi; + done; + done +} +patchELF () +{ + + local dir="$1"; + [ -e "$dir" ] || return 0; + echo "shrinking RPATHs of ELF executables and libraries in $dir"; + local i; + while IFS= read -r -d '' i; do + if [[ "$i" =~ .build-id ]]; then + continue; + fi; + if ! isELF "$i"; then + continue; + fi; + echo "shrinking $i"; + patchelf --shrink-rpath "$i" || true; + done < <(find "$dir" -type f -print0) +} +patchPhase () +{ + + runHook prePatch; + local -a patchesArray; + if [ -n "$__structuredAttrs" ]; then + patchesArray=(${patches:+"${patches[@]}"}); + else + patchesArray=(${patches:-}); + fi; + for i in "${patchesArray[@]}"; + do + echo "applying patch $i"; + local uncompress=cat; + case "$i" in + *.gz) + uncompress="gzip -d" + ;; + *.bz2) + uncompress="bzip2 -d" + ;; + *.xz) + uncompress="xz -d" + ;; + *.lzma) + uncompress="lzma -d" + ;; + esac; + local -a flagsArray; + if [ -n "$__structuredAttrs" ]; then + flagsArray=("${patchFlags[@]:--p1}"); + else + flagsArray=(${patchFlags:--p1}); + fi; + $uncompress < "$i" 2>&1 | patch "${flagsArray[@]}"; + done; + runHook postPatch +} +patchShebangs () +{ + + local pathName; + local update; + while [[ $# -gt 0 ]]; do + case "$1" in + --host) + pathName=HOST_PATH; + shift + ;; + --build) + pathName=PATH; + shift + ;; + --update) + update=true; + shift + ;; + --) + shift; + break + ;; + -* | --*) + echo "Unknown option $1 supplied to patchShebangs" 1>&2; + return 1 + ;; + *) + break + ;; + esac; + done; + echo "patching script interpreter paths in $@"; + local f; + local oldPath; + local newPath; + local arg0; + local args; + local oldInterpreterLine; + local newInterpreterLine; + if [[ $# -eq 0 ]]; then + echo "No arguments supplied to patchShebangs" 1>&2; + return 0; + fi; + local f; + while IFS= read -r -d '' f; do + isScript "$f" || continue; + read -r oldInterpreterLine < "$f" || [ "$oldInterpreterLine" ]; + read -r oldPath arg0 args <<< "${oldInterpreterLine:2}"; + if [[ -z "${pathName:-}" ]]; then + if [[ -n $strictDeps && $f == "$NIX_STORE"* ]]; then + pathName=HOST_PATH; + else + pathName=PATH; + fi; + fi; + if [[ "$oldPath" == *"/bin/env" ]]; then + if [[ $arg0 == "-S" ]]; then + arg0=${args%% *}; + args=${args#* }; + newPath="$(PATH="${!pathName}" command -v "env" || true)"; + args="-S $(PATH="${!pathName}" command -v "$arg0" || true) $args"; + else + if [[ $arg0 == "-"* || $arg0 == *"="* ]]; then + echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" 1>&2; + exit 1; + else + newPath="$(PATH="${!pathName}" command -v "$arg0" || true)"; + fi; + fi; + else + if [[ -z $oldPath ]]; then + oldPath="/bin/sh"; + fi; + newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"; + args="$arg0 $args"; + fi; + newInterpreterLine="$newPath $args"; + newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}}; + if [[ -n "$oldPath" && ( "$update" == true || "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ) ]]; then + if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then + echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""; + escapedInterpreterLine=${newInterpreterLine//\\/\\\\}; + timestamp=$(stat --printf "%y" "$f"); + sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"; + touch --date "$timestamp" "$f"; + fi; + fi; + done < <(find "$@" -type f -perm -0100 -print0) +} +patchShebangsAuto () +{ + + if [[ -z "${dontPatchShebangs-}" && -e "$prefix" ]]; then + if [[ "$output" != out && "$output" = "$outputDev" ]]; then + patchShebangs --build "$prefix"; + else + patchShebangs --host "$prefix"; + fi; + fi +} +pkgConfigWrapper_addPkgConfigPath () +{ + + local role_post; + getHostRoleEnvHook; + addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/lib/pkgconfig"; + addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/share/pkgconfig" +} +prependToVar () +{ + + local -n nameref="$1"; + local useArray type; + if [ -n "$__structuredAttrs" ]; then + useArray=true; + else + useArray=false; + fi; + if declare -p "$1" 2> /dev/null | grep -q '^'; then + type="$(declare -p "$1")"; + if [[ "$type" =~ "declare -A" ]]; then + echo "prependToVar(): ERROR: trying to use prependToVar on an associative array." 1>&2; + return 1; + else + if [[ "$type" =~ "declare -a" ]]; then + useArray=true; + else + useArray=false; + fi; + fi; + fi; + shift; + if $useArray; then + nameref=("$@" ${nameref+"${nameref[@]}"}); + else + nameref="$* ${nameref-}"; + fi +} +printLines () +{ + + (( "$#" > 0 )) || return 0; + printf '%s\n' "$@" +} +printWords () +{ + + (( "$#" > 0 )) || return 0; + printf '%s ' "$@" +} +recordPropagatedDependencies () +{ + + declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated); + declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}"); + local propagatedInputsIndex; + for propagatedInputsIndex in "${!flatVars[@]}"; + do + local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]"; + local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}"; + [[ -n "${!propagatedInputsSlice}" ]] || continue; + mkdir -p "${!outputDev}/nix-support"; + printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile"; + done +} +runHook () +{ + + local hookName="$1"; + shift; + local hooksSlice="${hookName%Hook}Hooks[@]"; + local hook; + for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; + do + _eval "$hook" "$@"; + done; + return 0 +} +runOneHook () +{ + + local hookName="$1"; + shift; + local hooksSlice="${hookName%Hook}Hooks[@]"; + local hook ret=1; + for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"}; + do + if _eval "$hook" "$@"; then + ret=0; + break; + fi; + done; + return "$ret" +} +runPhase () +{ + + local curPhase="$*"; + if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then + return; + fi; + if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then + return; + fi; + if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then + return; + fi; + if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then + return; + fi; + if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then + return; + fi; + if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then + return; + fi; + if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then + return; + fi; + if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then + return; + fi; + if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then + return; + fi; + if [[ -n $NIX_LOG_FD ]]; then + echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" >&"$NIX_LOG_FD"; + fi; + showPhaseHeader "$curPhase"; + dumpVars; + local startTime=$(date +"%s"); + eval "${!curPhase:-$curPhase}"; + local endTime=$(date +"%s"); + showPhaseFooter "$curPhase" "$startTime" "$endTime"; + if [ "$curPhase" = unpackPhase ]; then + [ -n "${sourceRoot:-}" ] && chmod +x "${sourceRoot}"; + cd "${sourceRoot:-.}"; + fi +} +showPhaseFooter () +{ + + local phase="$1"; + local startTime="$2"; + local endTime="$3"; + local delta=$(( endTime - startTime )); + (( delta < 30 )) && return; + local H=$((delta/3600)); + local M=$((delta%3600/60)); + local S=$((delta%60)); + echo -n "$phase completed in "; + (( H > 0 )) && echo -n "$H hours "; + (( M > 0 )) && echo -n "$M minutes "; + echo "$S seconds" +} +showPhaseHeader () +{ + + local phase="$1"; + echo "Running phase: $phase" +} +stripDirs () +{ + + local cmd="$1"; + local ranlibCmd="$2"; + local paths="$3"; + local stripFlags="$4"; + local excludeFlags=(); + local pathsNew=; + [ -z "$cmd" ] && echo "stripDirs: Strip command is empty" 1>&2 && exit 1; + [ -z "$ranlibCmd" ] && echo "stripDirs: Ranlib command is empty" 1>&2 && exit 1; + local pattern; + if [ -n "${stripExclude:-}" ]; then + for pattern in "${stripExclude[@]}"; + do + excludeFlags+=(-a '!' '(' -name "$pattern" -o -wholename "$prefix/$pattern" ')'); + done; + fi; + local p; + for p in ${paths}; + do + if [ -e "$prefix/$p" ]; then + pathsNew="${pathsNew} $prefix/$p"; + fi; + done; + paths=${pathsNew}; + if [ -n "${paths}" ]; then + echo "stripping (with command $cmd and flags $stripFlags) in $paths"; + local striperr; + striperr="$(mktemp --tmpdir="$TMPDIR" 'striperr.XXXXXX')"; + find $paths -type f "${excludeFlags[@]}" -a '!' -path "$prefix/lib/debug/*" -print0 | xargs -r -0 -n1 -- realpath -z | sort -u -z | xargs -r -0 -n1 -P "$NIX_BUILD_CORES" -- $cmd $stripFlags 2> "$striperr" || exit_code=$?; + [[ "$exit_code" = 123 || -z "$exit_code" ]] || ( cat "$striperr" 1>&2 && exit 1 ); + rm "$striperr"; + find $paths -name '*.a' -type f -exec $ranlibCmd '{}' \; 2> /dev/null; + fi +} +stripHash () +{ + + local strippedName casematchOpt=0; + strippedName="$(basename -- "$1")"; + shopt -q nocasematch && casematchOpt=1; + shopt -u nocasematch; + if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then + echo "${strippedName:33}"; + else + echo "$strippedName"; + fi; + if (( casematchOpt )); then + shopt -s nocasematch; + fi +} +substitute () +{ + + local input="$1"; + local output="$2"; + shift 2; + if [ ! -f "$input" ]; then + echo "substitute(): ERROR: file '$input' does not exist" 1>&2; + return 1; + fi; + local content; + consumeEntire content < "$input"; + if [ -e "$output" ]; then + chmod +w "$output"; + fi; + substituteStream content "file '$input'" "$@" > "$output" +} +substituteAll () +{ + + local input="$1"; + local output="$2"; + local -a args=(); + _allFlags; + substitute "$input" "$output" "${args[@]}" +} +substituteAllInPlace () +{ + + local fileName="$1"; + shift; + substituteAll "$fileName" "$fileName" "$@" +} +substituteAllStream () +{ + + local -a args=(); + _allFlags; + substituteStream "$1" "$2" "${args[@]}" +} +substituteInPlace () +{ + + local -a fileNames=(); + for arg in "$@"; + do + if [[ "$arg" = "--"* ]]; then + break; + fi; + fileNames+=("$arg"); + shift; + done; + for file in "${fileNames[@]}"; + do + substitute "$file" "$file" "$@"; + done +} +substituteStream () +{ + + local var=$1; + local description=$2; + shift 2; + while (( "$#" )); do + local replace_mode="$1"; + case "$1" in + --replace) + if ! "$_substituteStream_has_warned_replace_deprecation"; then + echo "substituteStream(): WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. ($description)" 1>&2; + _substituteStream_has_warned_replace_deprecation=true; + fi; + replace_mode='--replace-warn' + ;& + --replace-quiet | --replace-warn | --replace-fail) + pattern="$2"; + replacement="$3"; + shift 3; + local savedvar; + savedvar="${!var}"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; + if [ "$pattern" != "$replacement" ]; then + if [ "${!var}" == "$savedvar" ]; then + if [ "$replace_mode" == --replace-warn ]; then + printf "substituteStream(): WARNING: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2; + else + if [ "$replace_mode" == --replace-fail ]; then + printf "substituteStream(): ERROR: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2; + return 1; + fi; + fi; + fi; + fi + ;; + --subst-var) + local varName="$2"; + shift 2; + if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then + echo "substituteStream(): ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2; + return 1; + fi; + if [ -z ${!varName+x} ]; then + echo "substituteStream(): ERROR: variable \$$varName is unset" 1>&2; + return 1; + fi; + pattern="@$varName@"; + replacement="${!varName}"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' + ;; + --subst-var-by) + pattern="@$2@"; + replacement="$3"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; + shift 3 + ;; + *) + echo "substituteStream(): ERROR: Invalid command line argument: $1" 1>&2; + return 1 + ;; + esac; + done; + printf "%s" "${!var}" +} +unpackFile () +{ + + curSrc="$1"; + echo "unpacking source archive $curSrc"; + if ! runOneHook unpackCmd "$curSrc"; then + echo "do not know how to unpack source archive $curSrc"; + exit 1; + fi +} +unpackPhase () +{ + + runHook preUnpack; + if [ -z "${srcs:-}" ]; then + if [ -z "${src:-}" ]; then + echo 'variable $src or $srcs should point to the source'; + exit 1; + fi; + srcs="$src"; + fi; + local -a srcsArray; + if [ -n "$__structuredAttrs" ]; then + srcsArray=("${srcs[@]}"); + else + srcsArray=($srcs); + fi; + local dirsBefore=""; + for i in *; + do + if [ -d "$i" ]; then + dirsBefore="$dirsBefore $i "; + fi; + done; + for i in "${srcsArray[@]}"; + do + unpackFile "$i"; + done; + : "${sourceRoot=}"; + if [ -n "${setSourceRoot:-}" ]; then + runOneHook setSourceRoot; + else + if [ -z "$sourceRoot" ]; then + for i in *; + do + if [ -d "$i" ]; then + case $dirsBefore in + *\ $i\ *) + + ;; + *) + if [ -n "$sourceRoot" ]; then + echo "unpacker produced multiple directories"; + exit 1; + fi; + sourceRoot="$i" + ;; + esac; + fi; + done; + fi; + fi; + if [ -z "$sourceRoot" ]; then + echo "unpacker appears to have produced no directories"; + exit 1; + fi; + echo "source root is $sourceRoot"; + if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then + chmod -R u+w -- "$sourceRoot"; + fi; + runHook postUnpack +} +updateAutotoolsGnuConfigScriptsPhase () +{ + + if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then + return; + fi; + for script in config.sub config.guess; + do + for f in $(find . -type f -name "$script"); + do + echo "Updating Autotools / GNU config script to a newer upstream version: $f"; + cp -f "/nix/store/x1lr71p3jqsy443jz0ravm3fv9yr2x0y-gnu-config-2023-09-19/$script" "$f"; + done; + done +} +updateSourceDateEpoch () +{ + + local path="$1"; + local -a res=($(find "$path" -type f -not -newer "$NIX_BUILD_TOP/.." -printf '%T@ %p\0' | sort -n --zero-terminated | tail -n1 --zero-terminated | head -c -1)); + local time="${res[0]//\.[0-9]*/}"; + local newestFile="${res[1]}"; + if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then + echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"; + export SOURCE_DATE_EPOCH="$time"; + local now="$(date +%s)"; + if [ "$time" -gt $((now - 60)) ]; then + echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic"; + fi; + fi +} +PATH="$PATH${nix_saved_PATH:+:$nix_saved_PATH}" +XDG_DATA_DIRS="$XDG_DATA_DIRS${nix_saved_XDG_DATA_DIRS:+:$nix_saved_XDG_DATA_DIRS}" +export NIX_BUILD_TOP="$(mktemp -d -t nix-shell.XXXXXX)" +export TMP="$NIX_BUILD_TOP" +export TMPDIR="$NIX_BUILD_TOP" +export TEMP="$NIX_BUILD_TOP" +export TEMPDIR="$NIX_BUILD_TOP" +eval "$shellHook" diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..c420855 --- /dev/null +++ b/.envrc @@ -0,0 +1,10 @@ +if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" +fi + +watch_file flake.nix +watch_file flake.lock +if ! use flake . --impure +then + echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2 +fi diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6e8b2a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.devenv +.direnv +.devenv + + + +/target +.aider diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..bb8c97f --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,949 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "amqp_serde" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "787581044ca08ad61cdb3a4e21afba087fb8cdba3bb3e23ce69a7d091808014d" +dependencies = [ + "bytes", + "serde", + "serde_bytes_ng", +] + +[[package]] +name = "amqprs" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f4a9eb66b389027566baa0c94c48eb2b72e79bd228040303aed96fdc4c95e7f" +dependencies = [ + "amqp_serde", + "async-trait", + "bytes", + "serde", + "serde_bytes", + "tokio", +] + +[[package]] +name = "async-trait" +version = "0.1.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "axum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +dependencies = [ + "async-trait", + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bytes" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "gimli" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", +] + +[[package]] +name = "hyper-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.158" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi", + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "object" +version = "0.36.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_bytes_ng" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb0ebce8684e2253f964e8b6ce51f0ccc6666bbb448fb4a6788088bda6544b6" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "syn" +version = "2.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tokio" +version = "1.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "zettle_db" +version = "0.1.0" +dependencies = [ + "amqprs", + "axum", + "serde", + "tokio", + "tracing", + "tracing-subscriber", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..33137ae --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "zettle_db" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +amqprs = "2.0.0" +axum = "0.7.5" +serde = { version = "1.0.210", features = ["derive"] } +tokio = { version = "1.40.0", features = ["full"] } +tracing = "0.1.40" +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } + + +[[bin]] +name = "server" +path = "src/server.rs" + +[[bin]] +name = "consumer" +path = "src/consumer.rs" + diff --git a/doc.rs b/doc.rs new file mode 100644 index 0000000..e1b8c78 --- /dev/null +++ b/doc.rs @@ -0,0 +1,103 @@ + +use amqprs::{ + callbacks::{DefaultChannelCallback, DefaultConnectionCallback}, + channel::{ + BasicConsumeArguments, BasicPublishArguments, QueueBindArguments, QueueDeclareArguments, + }, + connection::{Connection, OpenConnectionArguments}, + consumer::DefaultConsumer, + BasicProperties, +}; +use tokio::time; + +use tracing_subscriber::{fmt, prelude::*, EnvFilter}; + +#[tokio::main(flavor = "multi_thread", worker_threads = 2)] +async fn main() { + // construct a subscriber that prints formatted traces to stdout + // global subscriber with log level according to RUST_LOG + tracing_subscriber::registry() + .with(fmt::layer()) + .with(EnvFilter::from_default_env()) + .try_init() + .ok(); + + // open a connection to RabbitMQ server + let connection = Connection::open(&OpenConnectionArguments::new( + "localhost", + 5672, + "user", + "bitnami", + )) + .await + .unwrap(); + connection + .register_callback(DefaultConnectionCallback) + .await + .unwrap(); + + // open a channel on the connection + let channel = connection.open_channel(None).await.unwrap(); + channel + .register_callback(DefaultChannelCallback) + .await + .unwrap(); + + // declare a durable queue + let (queue_name, _, _) = channel + .queue_declare(QueueDeclareArguments::durable_client_named( + "amqprs.examples.basic", + )) + .await + .unwrap() + .unwrap(); + + // bind the queue to exchange + let routing_key = "amqprs.example"; + let exchange_name = "amq.topic"; + channel + .queue_bind(QueueBindArguments::new( + &queue_name, + exchange_name, + routing_key, + )) + .await + .unwrap(); + + ////////////////////////////////////////////////////////////////////////////// + // start consumer with given name + let args = BasicConsumeArguments::new(&queue_name, "example_basic_pub_sub"); + + channel + .basic_consume(DefaultConsumer::new(args.no_ack), args) + .await + .unwrap(); + + ////////////////////////////////////////////////////////////////////////////// + // publish message + let content = String::from( + r#" + { + "publisher": "example" + "data": "Hello, amqprs!" + } + "#, + ) + .into_bytes(); + + // create arguments for basic_publish + let args = BasicPublishArguments::new(exchange_name, routing_key); + + channel + .basic_publish(BasicProperties::default(), content, args) + .await + .unwrap(); + + // keep the `channel` and `connection` object from dropping before pub/sub is done. + // channel/connection will be closed when drop. + time::sleep(time::Duration::from_secs(1)).await; + // explicitly close + + channel.close().await.unwrap(); + connection.close().await.unwrap(); +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2fad684 --- /dev/null +++ b/flake.lock @@ -0,0 +1,658 @@ +{ + "nodes": { + "cachix": { + "inputs": { + "devenv": "devenv_2", + "flake-compat": [ + "devenv", + "flake-compat" + ], + "git-hooks": [ + "devenv", + "pre-commit-hooks" + ], + "nixpkgs": [ + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724232775, + "narHash": "sha256-6u2DycIEgrgNYlLxyGqdFVmBNiKIitnQKJ1pbRP5oko=", + "owner": "cachix", + "repo": "cachix", + "rev": "03b6cb3f953097bff378fb8b9ea094bd091a4ec7", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "cachix", + "type": "github" + } + }, + "cachix_2": { + "inputs": { + "devenv": "devenv_3", + "flake-compat": [ + "devenv", + "cachix", + "devenv", + "flake-compat" + ], + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "nixpkgs" + ], + "pre-commit-hooks": [ + "devenv", + "cachix", + "devenv", + "pre-commit-hooks" + ] + }, + "locked": { + "lastModified": 1712055811, + "narHash": "sha256-7FcfMm5A/f02yyzuavJe06zLa9hcMHsagE28ADcmQvk=", + "owner": "cachix", + "repo": "cachix", + "rev": "02e38da89851ec7fec3356a5c04bc8349cae0e30", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "cachix", + "type": "github" + } + }, + "devenv": { + "inputs": { + "cachix": "cachix", + "flake-compat": "flake-compat_2", + "nix": "nix_3", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks_2" + }, + "locked": { + "lastModified": 1726589902, + "narHash": "sha256-t2Y07oN6h9pwnpLpziZDhQE4bXOYvAzgtPZlVTO9Oe0=", + "owner": "cachix", + "repo": "devenv", + "rev": "08dd75cca1ad85622d114fff6988e1255ba26dd2", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devenv_2": { + "inputs": { + "cachix": "cachix_2", + "flake-compat": [ + "devenv", + "cachix", + "flake-compat" + ], + "nix": "nix_2", + "nixpkgs": [ + "devenv", + "cachix", + "nixpkgs" + ], + "pre-commit-hooks": [ + "devenv", + "cachix", + "git-hooks" + ] + }, + "locked": { + "lastModified": 1723156315, + "narHash": "sha256-0JrfahRMJ37Rf1i0iOOn+8Z4CLvbcGNwa2ChOAVrp/8=", + "owner": "cachix", + "repo": "devenv", + "rev": "ff5eb4f2accbcda963af67f1a1159e3f6c7f5f91", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devenv_3": { + "inputs": { + "flake-compat": [ + "devenv", + "cachix", + "devenv", + "cachix", + "flake-compat" + ], + "nix": "nix", + "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix", + "pre-commit-hooks": [ + "devenv", + "cachix", + "devenv", + "cachix", + "pre-commit-hooks" + ] + }, + "locked": { + "lastModified": 1708704632, + "narHash": "sha256-w+dOIW60FKMaHI1q5714CSibk99JfYxm0CzTinYWr+Q=", + "owner": "cachix", + "repo": "devenv", + "rev": "2ee4450b0f4b95a1b90f2eb5ffea98b90e48c196", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "python-rewrite", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "devenv", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "libgit2": { + "flake": false, + "locked": { + "lastModified": 1697646580, + "narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=", + "owner": "libgit2", + "repo": "libgit2", + "rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5", + "type": "github" + }, + "original": { + "owner": "libgit2", + "repo": "libgit2", + "type": "github" + } + }, + "nix": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "cachix", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1712911606, + "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", + "owner": "domenkozar", + "repo": "nix", + "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "devenv-2.21", + "repo": "nix", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "cachix", + "devenv", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688870561, + "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix_2": { + "inputs": { + "flake-compat": [ + "devenv", + "cachix", + "devenv", + "flake-compat" + ], + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression_2" + }, + "locked": { + "lastModified": 1712911606, + "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", + "owner": "domenkozar", + "repo": "nix", + "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "devenv-2.21", + "repo": "nix", + "type": "github" + } + }, + "nix_3": { + "inputs": { + "flake-compat": [ + "devenv", + "flake-compat" + ], + "flake-parts": "flake-parts", + "libgit2": "libgit2", + "nixpkgs": "nixpkgs_2", + "nixpkgs-23-11": "nixpkgs-23-11", + "nixpkgs-regression": "nixpkgs-regression_3", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1725980365, + "narHash": "sha256-uDwWyizzlQ0HFzrhP6rVp2+2NNA+/TM5zT32dR8GUlg=", + "owner": "domenkozar", + "repo": "nix", + "rev": "1e61e9f40673f84c3b02573145492d8af581bec5", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "devenv-2.24", + "repo": "nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1692808169, + "narHash": "sha256-x9Opq06rIiwdwGeK2Ykj69dNc2IvUH1fY55Wm7atwrE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9201b5ff357e781bf014d0330d18555695df7ba8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-23-11": { + "locked": { + "lastModified": 1717159533, + "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-regression_2": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-regression_3": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1717432640, + "narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "88269ab3044128b7c2f4c7d68448b2fb50456870", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1716977621, + "narHash": "sha256-Q1UQzYcMJH4RscmpTkjlgqQDX5yi1tZL0O345Ri6vXQ=", + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "cachix", + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1692876271, + "narHash": "sha256-IXfZEkI0Mal5y1jr6IRWMqK8GW2/f28xJenZIPQqkY0=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "d5006be9c2c2417dafb2e2e5034d83fabd207ee3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": [ + "devenv", + "nix" + ], + "flake-utils": "flake-utils_2", + "gitignore": [ + "devenv", + "nix" + ], + "nixpkgs": [ + "devenv", + "nix", + "nixpkgs" + ], + "nixpkgs-stable": [ + "devenv", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712897695, + "narHash": "sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "40e6053ecb65fcbf12863338a6dcefb3f55f1bf8", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_2": { + "inputs": { + "flake-compat": [ + "devenv", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1725513492, + "narHash": "sha256-tyMUA6NgJSvvQuzB7A1Sf8+0XCHyfSPRx/b00o6K0uo=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "7570de7b9b504cfe92025dd1be797bf546f66528", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "nixpkgs": "nixpkgs_3", + "systems": "systems_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a23e298 --- /dev/null +++ b/flake.nix @@ -0,0 +1,51 @@ +{ + inputs = { + nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling"; + systems.url = "github:nix-systems/default"; + devenv.url = "github:cachix/devenv"; + devenv.inputs.nixpkgs.follows = "nixpkgs"; + }; + + nixConfig = { + extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; + extra-substituters = "https://devenv.cachix.org"; + }; + + outputs = { + self, + nixpkgs, + devenv, + systems, + ... + } @ inputs: let + forEachSystem = nixpkgs.lib.genAttrs (import systems); + in { + packages = forEachSystem (system: { + devenv-up = self.devShells.${system}.default.config.procfileScript; + }); + + devShells = + forEachSystem + (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + default = devenv.lib.mkShell { + inherit inputs pkgs; + modules = [ + { + # https://devenv.sh/reference/options/ + enterShell = '' + echo "run devenv up -d to start and monitor services" + ''; + + languages.rust.enable = true; + + services = { + rabbitmq.enable = true; + }; + } + ]; + }; + }); + }; +} diff --git a/src/consumer.rs b/src/consumer.rs index 6bd687e..328566a 100644 --- a/src/consumer.rs +++ b/src/consumer.rs @@ -1,18 +1,9 @@ use zettle_db::rabbitmq::RabbitMQ; -#[tokio::main] -async fn main() -> Result<(), Box> { - let rabbitmq = RabbitMQ::new().await?; - let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await?.0; - rabbitmq.bind_queue(&queue_name, "amq.topic", "amqprs.example").await?; - - let mut rx = rabbitmq.consume_messages(&queue_name, "example_consumer").await?; - - println!("Consumer waiting for messages. To exit press CTRL+C"); - - while let Some(message) = rx.recv().await { - println!("Received message: {}", message); - } - - Ok(()) +#[tokio::main(flavor = "multi_thread", worker_threads = 2)] +async fn main() { + let rabbitmq = RabbitMQ::new().await; + let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await; + rabbitmq.bind_queue(&queue_name.0, "amq.topic", "amqprs.example").await; + //... } diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..c9bc93a --- /dev/null +++ b/src/lib.rs @@ -0,0 +1 @@ +pub mod rabbitmq; diff --git a/src/rabbitmq/mod.rs b/src/rabbitmq/mod.rs index 4a9717c..68e979f 100644 --- a/src/rabbitmq/mod.rs +++ b/src/rabbitmq/mod.rs @@ -7,7 +7,6 @@ use amqprs::{ consumer::DefaultConsumer, BasicProperties, }; -use tokio::sync::mpsc; pub struct RabbitMQ { pub connection: Connection, @@ -15,69 +14,43 @@ pub struct RabbitMQ { } impl RabbitMQ { - pub async fn new() -> Result> { + pub async fn new() -> Self { let connection = Connection::open(&OpenConnectionArguments::new( "localhost", 5672, "user", "bitnami", )) - .await?; + .await + .unwrap(); connection .register_callback(DefaultConnectionCallback) - .await?; + .await + .unwrap(); - let channel = connection.open_channel(None).await?; + let channel = connection.open_channel(None).await.unwrap(); channel .register_callback(DefaultChannelCallback) - .await?; + .await + .unwrap(); - Ok(RabbitMQ { connection, channel }) + RabbitMQ { connection, channel } } - pub async fn declare_queue(&self, queue_name: &str) -> Result<(String, u32, u32), Box> { + pub async fn declare_queue(&self, queue_name: &str) -> (String, u32, u32) { self.channel .queue_declare(QueueDeclareArguments::durable_client_named(queue_name)) - .await? - .ok_or_else(|| Box::new(std::io::Error::new(std::io::ErrorKind::Other, "Failed to declare queue")) as Box) + .await + .unwrap() + .unwrap() } - pub async fn bind_queue(&self, queue_name: &str, exchange_name: &str, routing_key: &str) -> Result<(), Box> { + pub async fn bind_queue(&self, queue_name: &str, exchange_name: &str, routing_key: &str) { self.channel .queue_bind(QueueBindArguments::new(queue_name, exchange_name, routing_key)) - .await?; - Ok(()) - } - - pub async fn publish_message(&self, exchange_name: &str, routing_key: &str, content: String) -> Result<(), Box> { - let args = BasicPublishArguments::new(exchange_name, routing_key); - self.channel - .basic_publish(BasicProperties::default(), content.into_bytes(), args) - .await?; - Ok(()) - } - - pub async fn consume_messages(&self, queue_name: &str, consumer_tag: &str) -> Result, Box> { - let (tx, rx) = mpsc::channel(100); - let args = BasicConsumeArguments::new(queue_name, consumer_tag); - - let consumer = DefaultConsumer::new(args.no_ack); - let tx_clone = tx.clone(); - - self.channel.basic_consume(consumer, args) - .await? - .set_delegate(move |deliver: amqprs::consumer::DeliverEvent| { - let content_str = String::from_utf8_lossy(&deliver.content).to_string(); - let tx = tx_clone.clone(); - tokio::spawn(async move { - if let Err(e) = tx.send(content_str).await { - eprintln!("Failed to send message: {}", e); - } - }); - }); - - Ok(rx) + .await + .unwrap(); } } diff --git a/src/server.rs b/src/server.rs index f7c7fc7..328566a 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1,42 +1,9 @@ -use axum::{ - routing::post, - Router, - extract::Json, -}; -use serde::Deserialize; use zettle_db::rabbitmq::RabbitMQ; -use std::sync::Arc; -#[derive(Deserialize)] -struct Message { - content: String, +#[tokio::main(flavor = "multi_thread", worker_threads = 2)] +async fn main() { + let rabbitmq = RabbitMQ::new().await; + let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await; + rabbitmq.bind_queue(&queue_name.0, "amq.topic", "amqprs.example").await; + //... } - -async fn publish_message( - Json(message): Json, - rabbitmq: axum::extract::State>, -) -> Result<(), String> { - rabbitmq - .publish_message("amq.topic", "amqprs.example", message.content) - .await - .map_err(|e| format!("Failed to publish message: {}", e)) -} - -#[tokio::main] -async fn main() -> Result<(), Box> { - let rabbitmq = Arc::new(RabbitMQ::new().await?); - let queue_name = rabbitmq.declare_queue("amqprs.examples.basic").await?.0; - rabbitmq.bind_queue(&queue_name, "amq.topic", "amqprs.example").await?; - - let app = Router::new() - .route("/publish", post(publish_message)) - .with_state(rabbitmq); - - println!("Server running on http://localhost:3000"); - axum::Server::bind(&"0.0.0.0:3000".parse().unwrap()) - .serve(app.into_make_service()) - .await?; - - Ok(()) -} -