diff --git a/Cargo.lock b/Cargo.lock index 6b43947..0f3a1f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1558,23 +1558,14 @@ version = "0.1.0" dependencies = [ "anyhow", "clap", - "patagia-client", - "tokio", - "tracing", - "tracing-chrome", - "tracing-subscriber", -] - -[[package]] -name = "patagia-client" -version = "0.0.1" -dependencies = [ - "anyhow", - "chrono", "progenitor", "reqwest", "schemars", "serde", + "tokio", + "tracing", + "tracing-chrome", + "tracing-subscriber", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6540a46..bd87172 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,13 +2,11 @@ resolver = "2" members = [ "agent", - "client", "controller", "xtask", ] default-members = [ "agent", - "client", "controller", "xtask", ] diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 467eabb..9a87168 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -7,11 +7,14 @@ license = "MPL-2.0" [dependencies] anyhow.workspace = true clap.workspace = true -patagia-client = { path = "../client" } +progenitor.workspace = true +reqwest.workspace = true +schemars.workspace = true +serde.workspace = true tokio.workspace = true -tracing.workspace = true tracing-chrome.workspace = true tracing-subscriber.workspace = true +tracing.workspace = true [[bin]] name = "patagia-agent" diff --git a/agent/src/main.rs b/agent/src/main.rs index a3e4a95..c3e72ed 100644 --- a/agent/src/main.rs +++ b/agent/src/main.rs @@ -3,6 +3,8 @@ use clap::Parser; use tokio::time::{sleep, Duration}; use tracing_subscriber::prelude::*; +mod patagia_api; + #[derive(Parser, Debug)] #[command(version, about, long_about = None)] struct Cli {} @@ -19,7 +21,7 @@ async fn main() -> Result<()> { tracing::info!("Patagia Agent"); - let client = patagia_client::Client::new("http://localhost:9474"); + let client = patagia_api::Client::new("http://localhost:9474"); let result = client.version().await?; tracing::info!("Result: {:?}", result); diff --git a/client/src/lib.rs b/agent/src/patagia_api.rs similarity index 99% rename from client/src/lib.rs rename to agent/src/patagia_api.rs index 8dca05c..841b609 100644 --- a/client/src/lib.rs +++ b/agent/src/patagia_api.rs @@ -1,4 +1,3 @@ use progenitor::generate_api; - generate_api!(spec = "../api.json", derives = [schemars::JsonSchema]); diff --git a/client/Cargo.toml b/client/Cargo.toml deleted file mode 100644 index b619654..0000000 --- a/client/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "patagia-client" -version = "0.0.1" -license = "MPL-2.0" -edition = "2021" - -[dependencies] -anyhow.workspace = true -chrono = { version = "0.4.0", default-features = false, features = ["serde"] } -progenitor.workspace = true -reqwest.workspace = true -schemars.workspace = true -serde.workspace = true diff --git a/flake.nix b/flake.nix index 2edb4bb..ee7135b 100644 --- a/flake.nix +++ b/flake.nix @@ -52,23 +52,14 @@ pkg-config ]; - sourceAndFixtures = path: type: (craneLib.filterCargoSources path type); + jsonFilter = path: _type: builtins.match ".*json$" path != null; + sourceAndFixtures = path: type: + (jsonFilter path type) || (craneLib.filterCargoSources path type); src = pkgs.lib.cleanSourceWith { src = ./.; filter = sourceAndFixtures; }; - treefmtEval = treefmt-nix.lib.evalModule pkgs { - projectRootFile = "flake.nix"; - programs = { - nixfmt.enable = true; - nixfmt.package = pkgs.nixfmt-rfc-style; - shfmt.enable = true; - rustfmt.enable = true; - }; - settings.formatter.rustfmt.command = pkgs.lib.mkForce "${pkgs.rust-toolchain}/bin/rustfmt"; - }; - commonArgs = { inherit src stdenv nativeBuildInputs; strictDeps = true; @@ -95,7 +86,6 @@ ./Cargo.toml ./Cargo.lock (craneLib.fileset.commonCargoSources ./agent) - (craneLib.fileset.commonCargoSources ./client) (craneLib.fileset.commonCargoSources ./controller) (craneLib.fileset.commonCargoSources ./xtask) (craneLib.fileset.commonCargoSources crate) @@ -128,6 +118,18 @@ src = fileSetForCrate ./xtask; } ); + + treefmtEval = treefmt-nix.lib.evalModule pkgs { + projectRootFile = "flake.nix"; + programs = { + nixfmt.enable = true; + nixfmt.package = pkgs.nixfmt-rfc-style; + shfmt.enable = true; + rustfmt.enable = true; + }; + settings.formatter.rustfmt.command = pkgs.lib.mkForce "${pkgs.rust-toolchain}/bin/rustfmt"; + }; + in { # `nix build` @@ -165,6 +167,7 @@ ( commonArgs // { + inherit cargoArtifacts; src = fileSetForCrate ./xtask; } ) @@ -188,6 +191,7 @@ cargo-nextest cargo-watch hyperfine + openssl just rust-dev-toolchain watchexec