From 1c6d7f7a8f4a835257c7f3e01e3a4ff6b61bb365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Thu, 14 May 2026 22:58:25 +0200 Subject: [PATCH 1/5] fmt --- flake.nix | 10 +++++++++- hive-c0re/src/agent_server.rs | 6 +----- hive-c0re/src/approvals.rs | 3 ++- hive-c0re/src/main.rs | 4 +++- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 9b480bbc..67cbe783 100644 --- a/flake.nix +++ b/flake.nix @@ -134,7 +134,15 @@ clippy = naersk-lib.buildPackage { src = ./.; mode = "clippy"; - cargoClippyOptions = orig: orig ++ [ "--all-targets" "--" "-D" "warnings" ]; + cargoClippyOptions = + orig: + orig + ++ [ + "--all-targets" + "--" + "-D" + "warnings" + ]; }; } ); diff --git a/hive-c0re/src/agent_server.rs b/hive-c0re/src/agent_server.rs index 66d484d5..b08e18f2 100644 --- a/hive-c0re/src/agent_server.rs +++ b/hive-c0re/src/agent_server.rs @@ -18,11 +18,7 @@ pub struct AgentSocket { pub handle: JoinHandle<()>, } -pub fn start( - agent: &str, - socket_path: &Path, - broker: Arc, -) -> Result { +pub fn start(agent: &str, socket_path: &Path, broker: Arc) -> Result { let agent = agent.to_owned(); if let Some(parent) = socket_path.parent() { std::fs::create_dir_all(parent) diff --git a/hive-c0re/src/approvals.rs b/hive-c0re/src/approvals.rs index 0dbeac17..8c32c407 100644 --- a/hive-c0re/src/approvals.rs +++ b/hive-c0re/src/approvals.rs @@ -36,7 +36,8 @@ impl Approvals { } let conn = Connection::open(path) .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 { conn: Mutex::new(conn), }) diff --git a/hive-c0re/src/main.rs b/hive-c0re/src/main.rs index f31f2c1a..ce5aa10e 100644 --- a/hive-c0re/src/main.rs +++ b/hive-c0re/src/main.rs @@ -81,7 +81,9 @@ async fn main() -> Result<()> { } Cmd::List => render(client::request(&cli.socket, HostRequest::List).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?), } } From ad9e60dad39824b9ad84b1ad3fa44d027016429a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Thu, 14 May 2026 23:00:16 +0200 Subject: [PATCH 2/5] flake clippy: cargoBuildOptions with -- -D warnings --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 67cbe783..029ab70c 100644 --- a/flake.nix +++ b/flake.nix @@ -134,11 +134,11 @@ clippy = naersk-lib.buildPackage { src = ./.; mode = "clippy"; - cargoClippyOptions = + cargoBuildOptions = orig: orig ++ [ - "--all-targets" + "--workspace" "--" "-D" "warnings" From cf4c84d7c9ccb9e057a736f778eb8f71fef048bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Thu, 14 May 2026 23:01:13 +0200 Subject: [PATCH 3/5] flake clippy: override build phase to bypass naersk mode --- flake.nix | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/flake.nix b/flake.nix index 029ab70c..1bb82f51 100644 --- a/flake.nix +++ b/flake.nix @@ -126,24 +126,38 @@ checks = forAllSystems ( { treefmt-eval, + pkgs, naersk-lib, ... }: { formatting = treefmt-eval.config.build.check self; - clippy = naersk-lib.buildPackage { - src = ./.; - mode = "clippy"; - cargoBuildOptions = - orig: - orig - ++ [ - "--workspace" - "--" - "-D" - "warnings" - ]; - }; + # Clippy as a check: reuse naersk's vendored-deps environment but + # replace the build phase with `cargo clippy --workspace --all-targets + # -- -D warnings`. Naersk's own `mode = "clippy"` mangles the `--` + # 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: { + pname = "${old.pname}-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 + ''; + }); } ); }; From b0fb623e088c140d4ac2762091c36d6742eea137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Thu, 14 May 2026 23:01:32 +0200 Subject: [PATCH 4/5] flake clippy: use name not pname --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 1bb82f51..67d2ab40 100644 --- a/flake.nix +++ b/flake.nix @@ -144,7 +144,7 @@ copyTarget = false; }).overrideAttrs (old: { - pname = "${old.pname}-clippy"; + name = "${old.name}-clippy"; nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.clippy ]; buildPhase = '' runHook preBuild From 22b65d35f34e7de65f9d130d7b84ea008f6b532f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Thu, 14 May 2026 23:02:42 +0200 Subject: [PATCH 5/5] treefmt: add taplo (toml) formatter --- Cargo.toml | 16 ++++++++++------ flake.nix | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f18cf761..a19750c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,6 @@ [workspace] resolver = "3" -members = [ - "hive-ag3nt", - "hive-c0re", - "hive-sh4re", -] +members = ["hive-ag3nt", "hive-c0re", "hive-sh4re"] [workspace.package] edition = "2024" @@ -25,6 +21,14 @@ hive-sh4re = { path = "hive-sh4re" } rusqlite = { version = "0.37", features = ["bundled"] } serde = { version = "1", features = ["derive"] } 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-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/flake.nix b/flake.nix index 67d2ab40..18f109cc 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,7 @@ keep-sorted.enable = true; nixfmt.enable = true; rustfmt.enable = true; + taplo.enable = true; }; }; forAllSystems =