Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22b65d35f3 | ||
|
|
b0fb623e08 | ||
|
|
cf4c84d7c9 | ||
|
|
ad9e60dad3 | ||
|
|
1c6d7f7a8f |
5 changed files with 44 additions and 18 deletions
16
Cargo.toml
16
Cargo.toml
|
|
@ -1,10 +1,6 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
members = [
|
members = ["hive-ag3nt", "hive-c0re", "hive-sh4re"]
|
||||||
"hive-ag3nt",
|
|
||||||
"hive-c0re",
|
|
||||||
"hive-sh4re",
|
|
||||||
]
|
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
@ -25,6 +21,14 @@ hive-sh4re = { path = "hive-sh4re" }
|
||||||
rusqlite = { version = "0.37", features = ["bundled"] }
|
rusqlite = { version = "0.37", features = ["bundled"] }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
tokio = { version = "1", features = ["io-util", "macros", "net", "process", "rt-multi-thread", "signal", "time"] }
|
tokio = { version = "1", features = [
|
||||||
|
"io-util",
|
||||||
|
"macros",
|
||||||
|
"net",
|
||||||
|
"process",
|
||||||
|
"rt-multi-thread",
|
||||||
|
"signal",
|
||||||
|
"time",
|
||||||
|
] }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
|
|
|
||||||
33
flake.nix
33
flake.nix
|
|
@ -34,6 +34,7 @@
|
||||||
keep-sorted.enable = true;
|
keep-sorted.enable = true;
|
||||||
nixfmt.enable = true;
|
nixfmt.enable = true;
|
||||||
rustfmt.enable = true;
|
rustfmt.enable = true;
|
||||||
|
taplo.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
forAllSystems =
|
forAllSystems =
|
||||||
|
|
@ -126,16 +127,38 @@
|
||||||
checks = forAllSystems (
|
checks = forAllSystems (
|
||||||
{
|
{
|
||||||
treefmt-eval,
|
treefmt-eval,
|
||||||
|
pkgs,
|
||||||
naersk-lib,
|
naersk-lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
formatting = treefmt-eval.config.build.check self;
|
formatting = treefmt-eval.config.build.check self;
|
||||||
clippy = naersk-lib.buildPackage {
|
# Clippy as a check: reuse naersk's vendored-deps environment but
|
||||||
src = ./.;
|
# replace the build phase with `cargo clippy --workspace --all-targets
|
||||||
mode = "clippy";
|
# -- -D warnings`. Naersk's own `mode = "clippy"` mangles the `--`
|
||||||
cargoClippyOptions = orig: orig ++ [ "--all-targets" "--" "-D" "warnings" ];
|
# separator, so we go through overrideAttrs instead.
|
||||||
};
|
clippy =
|
||||||
|
(naersk-lib.buildPackage {
|
||||||
|
src = ./.;
|
||||||
|
# Skip the actual build; we only care about the clippy lint.
|
||||||
|
doCheck = false;
|
||||||
|
copyTarget = false;
|
||||||
|
}).overrideAttrs
|
||||||
|
(old: {
|
||||||
|
name = "${old.name}-clippy";
|
||||||
|
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.clippy ];
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
cargo clippy --workspace --all-targets -- -D warnings
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
mkdir -p $out
|
||||||
|
touch $out/.clippy-passed
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,7 @@ pub struct AgentSocket {
|
||||||
pub handle: JoinHandle<()>,
|
pub handle: JoinHandle<()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start(
|
pub fn start(agent: &str, socket_path: &Path, broker: Arc<Broker>) -> Result<AgentSocket> {
|
||||||
agent: &str,
|
|
||||||
socket_path: &Path,
|
|
||||||
broker: Arc<Broker>,
|
|
||||||
) -> Result<AgentSocket> {
|
|
||||||
let agent = agent.to_owned();
|
let agent = agent.to_owned();
|
||||||
if let Some(parent) = socket_path.parent() {
|
if let Some(parent) = socket_path.parent() {
|
||||||
std::fs::create_dir_all(parent)
|
std::fs::create_dir_all(parent)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ impl Approvals {
|
||||||
}
|
}
|
||||||
let conn = Connection::open(path)
|
let conn = Connection::open(path)
|
||||||
.with_context(|| format!("open approvals db {}", path.display()))?;
|
.with_context(|| format!("open approvals db {}", path.display()))?;
|
||||||
conn.execute_batch(SCHEMA).context("apply approvals schema")?;
|
conn.execute_batch(SCHEMA)
|
||||||
|
.context("apply approvals schema")?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
conn: Mutex::new(conn),
|
conn: Mutex::new(conn),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,9 @@ async fn main() -> Result<()> {
|
||||||
}
|
}
|
||||||
Cmd::List => render(client::request(&cli.socket, HostRequest::List).await?),
|
Cmd::List => render(client::request(&cli.socket, HostRequest::List).await?),
|
||||||
Cmd::Pending => render(client::request(&cli.socket, HostRequest::Pending).await?),
|
Cmd::Pending => render(client::request(&cli.socket, HostRequest::Pending).await?),
|
||||||
Cmd::Approve { id } => render(client::request(&cli.socket, HostRequest::Approve { id }).await?),
|
Cmd::Approve { id } => {
|
||||||
|
render(client::request(&cli.socket, HostRequest::Approve { id }).await?)
|
||||||
|
}
|
||||||
Cmd::Deny { id } => render(client::request(&cli.socket, HostRequest::Deny { id }).await?),
|
Cmd::Deny { id } => render(client::request(&cli.socket, HostRequest::Deny { id }).await?),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue