ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

rename cargo crates (#372)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

authored by

marshmallow
autofix-ci[bot]
and committed by
GitHub
ffc72a3e 9749c1e6

+104 -123
+1 -1
.github/workflows/autofix.yml
··· 41 41 ~/.cargo/git/db/ 42 42 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 43 43 - name: setup sqlx 44 - run: nix develop -L -v -c sqlx database setup --source ./wire/lib/src/cache/migrations/ 44 + run: nix develop -L -v -c sqlx database setup --source ./crates/core/src/cache/migrations/ 45 45 - name: autofix sqlx 46 46 run: nix develop -L -v -c cargo sqlx prepare --workspace 47 47 - name: clippy --fix
+55 -55
Cargo.lock
··· 1120 1120 ] 1121 1121 1122 1122 [[package]] 1123 - name = "key_agent" 1124 - version = "1.0.0" 1125 - dependencies = [ 1126 - "anyhow", 1127 - "base64", 1128 - "futures-util", 1129 - "nix 0.30.1", 1130 - "prost", 1131 - "prost-build", 1132 - "sha2", 1133 - "tokio", 1134 - "tokio-util", 1135 - ] 1136 - 1137 - [[package]] 1138 1123 name = "lazy_static" 1139 1124 version = "1.5.0" 1140 1125 source = "registry+https://github.com/rust-lang/crates.io-index" 1141 1126 checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 1142 1127 dependencies = [ 1143 1128 "spin", 1144 - ] 1145 - 1146 - [[package]] 1147 - name = "lib" 1148 - version = "1.0.0" 1149 - dependencies = [ 1150 - "aho-corasick", 1151 - "anyhow", 1152 - "base64", 1153 - "derive_more", 1154 - "enum_dispatch", 1155 - "futures", 1156 - "gethostname", 1157 - "gjson", 1158 - "im", 1159 - "itertools", 1160 - "key_agent", 1161 - "miette", 1162 - "nix 0.30.1", 1163 - "nix-compat", 1164 - "num_enum", 1165 - "owo-colors", 1166 - "portable-pty", 1167 - "proc-macro2", 1168 - "prost", 1169 - "rand 0.9.2", 1170 - "serde", 1171 - "serde_json", 1172 - "sha2", 1173 - "sqlx", 1174 - "strip-ansi-escapes", 1175 - "syn 2.0.111", 1176 - "tempdir", 1177 - "termion", 1178 - "thiserror 2.0.17", 1179 - "tokio", 1180 - "tokio-util", 1181 - "tracing", 1182 - "zstd", 1183 1129 ] 1184 1130 1185 1131 [[package]] ··· 3223 3169 "futures", 3224 3170 "im", 3225 3171 "itertools", 3226 - "lib", 3227 3172 "miette", 3228 3173 "nix-compat", 3229 3174 "owo-colors", ··· 3236 3181 "tracing", 3237 3182 "tracing-log", 3238 3183 "tracing-subscriber", 3184 + "wire-core", 3185 + ] 3186 + 3187 + [[package]] 3188 + name = "wire-core" 3189 + version = "1.0.0" 3190 + dependencies = [ 3191 + "aho-corasick", 3192 + "anyhow", 3193 + "base64", 3194 + "derive_more", 3195 + "enum_dispatch", 3196 + "futures", 3197 + "gethostname", 3198 + "gjson", 3199 + "im", 3200 + "itertools", 3201 + "miette", 3202 + "nix 0.30.1", 3203 + "nix-compat", 3204 + "num_enum", 3205 + "owo-colors", 3206 + "portable-pty", 3207 + "proc-macro2", 3208 + "prost", 3209 + "rand 0.9.2", 3210 + "serde", 3211 + "serde_json", 3212 + "sha2", 3213 + "sqlx", 3214 + "strip-ansi-escapes", 3215 + "syn 2.0.111", 3216 + "tempdir", 3217 + "termion", 3218 + "thiserror 2.0.17", 3219 + "tokio", 3220 + "tokio-util", 3221 + "tracing", 3222 + "wire-key-agent", 3223 + "zstd", 3224 + ] 3225 + 3226 + [[package]] 3227 + name = "wire-key-agent" 3228 + version = "1.0.0" 3229 + dependencies = [ 3230 + "anyhow", 3231 + "base64", 3232 + "futures-util", 3233 + "nix 0.30.1", 3234 + "prost", 3235 + "prost-build", 3236 + "sha2", 3237 + "tokio", 3238 + "tokio-util", 3239 3239 ] 3240 3240 3241 3241 [[package]]
+1 -1
Cargo.toml
··· 1 1 [workspace] 2 - members = ["wire/key_agent", "wire/lib", "wire/cli"] 2 + members = ["crates/key_agent", "crates/core", "crates/cli"] 3 3 resolver = "2" 4 4 package.edition = "2024" 5 5 package.version = "1.0.0"
-21
README.md
··· 6 6 7 7 Read the [The Tutorial](https://wire.althaea.zone/tutorial/overview.html), [Guides](https://wire.althaea.zone/guides/installation.html), or continue reading this readme for development information. 8 8 9 - ## Tree Layout 10 - 11 - ``` 12 - wire 13 - ├── wire 14 - │ ├── lib 15 - │ │ └── Rust library containing business logic, consumed by `wire` 16 - │ ├── cli 17 - │ │ └── Rust binary, using `lib` 18 - │ └── key_agent 19 - │ └── Rust binary ran on a target node. receives key file bytes and metadata w/ protobuf over SSH stdin 20 - ├── doc 21 - │ └── a [vitepress](https://vitepress.dev/) site 22 - ├── runtime 23 - │ └── Nix files used during runtime to evaluate nodes 24 - ├── bench 25 - │ └── A little tool to benchmark wire against a large hive 26 - └──tests 27 - └── Directories used during cargo & NixOS VM testing 28 - ``` 29 - 30 9 ## Development 31 10 32 11 Please use `nix develop` for access to the development environment and to ensure
+17
crates/key_agent/default.nix
··· 1 + { 2 + perSystem = 3 + { 4 + buildRustProgram, 5 + system, 6 + ... 7 + }: 8 + { 9 + packages = { 10 + agent = buildRustProgram { 11 + name = "wire-key-agent"; 12 + pname = "wire-tool-key-agent-${system}"; 13 + cargoExtraArgs = "-p wire-key-agent"; 14 + }; 15 + }; 16 + }; 17 + }
+2 -2
flake.nix
··· 37 37 ./nix/utils.nix # utility functions 38 38 ./nix/shells.nix 39 39 ./nix/tests.nix 40 - ./wire/cli 41 - ./wire/key_agent 40 + ./crates/cli 41 + ./crates/key_agent 42 42 ./doc 43 43 ./tests/nix 44 44 ./runtime
+1 -1
nix/utils.nix
··· 20 20 fileset = unions [ 21 21 ../.cargo 22 22 ../.sqlx 23 - ../wire 23 + ../crates 24 24 ../Cargo.toml 25 25 ../Cargo.lock 26 26 ];
+1 -1
wire/cli/Cargo.toml crates/cli/Cargo.toml
··· 17 17 tracing = { workspace = true } 18 18 tracing-log = { workspace = true } 19 19 tracing-subscriber = { workspace = true } 20 - lib = { path = "../lib" } 20 + wire-core = { path = "../core" } 21 21 serde_json = { workspace = true } 22 22 miette = { workspace = true } 23 23 thiserror = { workspace = true }
+1 -1
wire/cli/default.nix crates/cli/default.nix
··· 30 30 preBuild = '' 31 31 export DATABASE_URL=sqlite:./db.sqlite3 32 32 sqlx database create 33 - sqlx migrate run --source ./wire/lib/src/cache/migrations/ 33 + sqlx migrate run --source ./crates/core/src/cache/migrations/ 34 34 ''; 35 35 postInstall = '' 36 36 installShellCompletion --cmd wire \
+4 -4
wire/cli/src/apply.rs crates/cli/src/apply.rs
··· 3 3 4 4 use futures::{FutureExt, StreamExt}; 5 5 use itertools::{Either, Itertools}; 6 - use lib::hive::node::{Context, GoalExecutor, Name, StepState, should_apply_locally}; 7 - use lib::hive::{Hive, HiveLocation}; 8 - use lib::status::STATUS; 9 - use lib::{SubCommandModifiers, errors::HiveLibError}; 10 6 use miette::{Diagnostic, IntoDiagnostic, Result}; 11 7 use std::collections::HashSet; 12 8 use std::io::{Read, stderr}; ··· 14 10 use std::sync::atomic::AtomicBool; 15 11 use thiserror::Error; 16 12 use tracing::{Span, error, info}; 13 + use wire_core::hive::node::{Context, GoalExecutor, Name, StepState, should_apply_locally}; 14 + use wire_core::hive::{Hive, HiveLocation}; 15 + use wire_core::status::STATUS; 16 + use wire_core::{SubCommandModifiers, errors::HiveLibError}; 17 17 18 18 use crate::cli::{ApplyArgs, ApplyTarget}; 19 19
+8 -6
wire/cli/src/cli.rs crates/cli/src/cli.rs
··· 8 8 use clap_complete::engine::ArgValueCompleter; 9 9 use clap_num::number_range; 10 10 use clap_verbosity_flag::InfoLevel; 11 - use lib::SubCommandModifiers; 12 - use lib::commands::common::get_hive_node_names; 13 - use lib::hive::node::{Goal as HiveGoal, HandleUnreachable, Name, SwitchToConfigurationGoal}; 14 - use lib::hive::{Hive, get_hive_location}; 15 11 use tokio::runtime::Handle; 12 + use wire_core::SubCommandModifiers; 13 + use wire_core::commands::common::get_hive_node_names; 14 + use wire_core::hive::node::{Goal as HiveGoal, HandleUnreachable, Name, SwitchToConfigurationGoal}; 15 + use wire_core::hive::{Hive, get_hive_location}; 16 16 17 17 use std::io::IsTerminal; 18 18 use std::{ ··· 252 252 show_trace: self.show_trace, 253 253 non_interactive: self.non_interactive, 254 254 ssh_accept_host: match &self.command { 255 - Commands::Apply(args) if args.ssh_accept_host => lib::StrictHostKeyChecking::No, 256 - _ => lib::StrictHostKeyChecking::default(), 255 + Commands::Apply(args) if args.ssh_accept_host => { 256 + wire_core::StrictHostKeyChecking::No 257 + } 258 + _ => wire_core::StrictHostKeyChecking::default(), 257 259 }, 258 260 } 259 261 }
+4 -4
wire/cli/src/main.rs crates/cli/src/main.rs
··· 15 15 use clap::CommandFactory; 16 16 use clap::Parser; 17 17 use clap_complete::CompleteEnv; 18 - use lib::cache::InspectionCache; 19 - use lib::commands::common::get_hive_node_names; 20 - use lib::hive::Hive; 21 - use lib::hive::get_hive_location; 22 18 use miette::IntoDiagnostic; 23 19 use miette::Result; 24 20 use signal_hook::consts::SIGINT; 25 21 use signal_hook_tokio::Signals; 26 22 use tracing::error; 27 23 use tracing::warn; 24 + use wire_core::cache::InspectionCache; 25 + use wire_core::commands::common::get_hive_node_names; 26 + use wire_core::hive::Hive; 27 + use wire_core::hive::get_hive_location; 28 28 29 29 #[macro_use] 30 30 extern crate enum_display_derive;
wire/cli/src/sigint.rs crates/cli/src/sigint.rs
+1 -1
wire/cli/src/tracing_setup.rs crates/cli/src/tracing_setup.rs
··· 8 8 }; 9 9 10 10 use clap_verbosity_flag::{LogLevel, Verbosity}; 11 - use lib::{STDIN_CLOBBER_LOCK, status::STATUS}; 12 11 use owo_colors::{OwoColorize, Stream, Style}; 13 12 use tracing::{Level, Subscriber}; 14 13 use tracing_log::AsTrace; ··· 23 22 registry::LookupSpan, 24 23 util::SubscriberInitExt, 25 24 }; 25 + use wire_core::{STDIN_CLOBBER_LOCK, status::STATUS}; 26 26 27 27 /// The non-clobbering writer ensures that log lines are held while interactive 28 28 /// prompts are shown to the user. If logs where shown, they would "clobber" the
+1 -1
wire/key_agent/Cargo.toml crates/key_agent/Cargo.toml
··· 1 1 [package] 2 - name = "key_agent" 2 + name = "wire-key-agent" 3 3 edition.workspace = true 4 4 version.workspace = true 5 5
wire/key_agent/build.rs crates/key_agent/build.rs
-17
wire/key_agent/default.nix
··· 1 - { 2 - perSystem = 3 - { 4 - buildRustProgram, 5 - system, 6 - ... 7 - }: 8 - { 9 - packages = { 10 - agent = buildRustProgram { 11 - name = "key_agent"; 12 - pname = "wire-tool-key_agent-${system}"; 13 - cargoExtraArgs = "-p key_agent"; 14 - }; 15 - }; 16 - }; 17 - }
wire/key_agent/src/keys.proto crates/key_agent/src/keys.proto
wire/key_agent/src/lib.rs crates/key_agent/src/lib.rs
+1 -1
wire/key_agent/src/main.rs crates/key_agent/src/main.rs
··· 5 5 use base64::Engine; 6 6 use base64::prelude::BASE64_STANDARD; 7 7 use futures_util::stream::StreamExt; 8 - use key_agent::keys::KeySpec; 9 8 use nix::unistd::{Group, User}; 10 9 use prost::Message; 11 10 use prost::bytes::Bytes; ··· 16 15 use tokio::fs::File; 17 16 use tokio::io::AsyncWriteExt; 18 17 use tokio_util::codec::{FramedRead, LengthDelimitedCodec}; 18 + use wire_key_agent::keys::KeySpec; 19 19 20 20 fn create_path(key_path: &Path) -> Result<(), anyhow::Error> { 21 21 let prefix = key_path.parent().unwrap();
+2 -2
wire/lib/Cargo.toml crates/core/Cargo.toml
··· 1 1 [package] 2 - name = "lib" 2 + name = "wire-core" 3 3 version.workspace = true 4 4 edition.workspace = true 5 5 ··· 17 17 im = { workspace = true } 18 18 thiserror = "2.0.17" 19 19 derive_more = { version = "2.0.1", features = ["display"] } 20 - key_agent = { path = "../key_agent" } 20 + wire-key-agent = { path = "../key_agent" } 21 21 futures = "0.3.31" 22 22 prost = { workspace = true } 23 23 gethostname = "1.1.0"
wire/lib/build.rs crates/core/build.rs
wire/lib/src/cache/migrations/20251124234730_init.sql crates/core/src/cache/migrations/20251124234730_init.sql
wire/lib/src/cache/migrations/20251126222409_blobs.sql crates/core/src/cache/migrations/20251126222409_blobs.sql
wire/lib/src/cache/mod.rs crates/core/src/cache/mod.rs
wire/lib/src/commands/common.rs crates/core/src/commands/common.rs
wire/lib/src/commands/mod.rs crates/core/src/commands/mod.rs
wire/lib/src/commands/noninteractive.rs crates/core/src/commands/noninteractive.rs
wire/lib/src/commands/pty/input.rs crates/core/src/commands/pty/input.rs
wire/lib/src/commands/pty/logbuffer.rs crates/core/src/commands/pty/logbuffer.rs
wire/lib/src/commands/pty/mod.rs crates/core/src/commands/pty/mod.rs
wire/lib/src/commands/pty/output.rs crates/core/src/commands/pty/output.rs
wire/lib/src/errors.rs crates/core/src/errors.rs
wire/lib/src/hive/mod.rs crates/core/src/hive/mod.rs
wire/lib/src/hive/node.rs crates/core/src/hive/node.rs
wire/lib/src/hive/steps/activate.rs crates/core/src/hive/steps/activate.rs
wire/lib/src/hive/steps/build.rs crates/core/src/hive/steps/build.rs
wire/lib/src/hive/steps/cleanup.rs crates/core/src/hive/steps/cleanup.rs
wire/lib/src/hive/steps/evaluate.rs crates/core/src/hive/steps/evaluate.rs
+4 -4
wire/lib/src/hive/steps/keys.rs crates/core/src/hive/steps/keys.rs
··· 147 147 } 148 148 } 149 149 150 - async fn process_key(key: &Key) -> Result<(key_agent::keys::KeySpec, Vec<u8>), KeyError> { 150 + async fn process_key(key: &Key) -> Result<(wire_key_agent::keys::KeySpec, Vec<u8>), KeyError> { 151 151 let mut reader = create_reader(key).await?; 152 152 153 153 let mut buf = Vec::new(); ··· 162 162 debug!("Staging push to {}", destination.clone().display()); 163 163 164 164 Ok(( 165 - key_agent::keys::KeySpec { 165 + wire_key_agent::keys::KeySpec { 166 166 length: buf 167 167 .len() 168 168 .try_into() ··· 252 252 return Ok(()); 253 253 } 254 254 255 - let command_string = format!("{agent_directory}/bin/key_agent"); 255 + let command_string = format!("{agent_directory}/bin/wire-key-agent"); 256 256 257 257 let mut child = run_command( 258 258 &CommandArguments::new(command_string, ctx.modifiers) ··· 297 297 async fn select_keys( 298 298 &self, 299 299 keys: &Vector<Key>, 300 - ) -> Result<Peekable<IntoIter<(key_agent::keys::KeySpec, std::vec::Vec<u8>)>>, HiveLibError> 300 + ) -> Result<Peekable<IntoIter<(wire_key_agent::keys::KeySpec, std::vec::Vec<u8>)>>, HiveLibError> 301 301 { 302 302 let futures = keys 303 303 .iter()
wire/lib/src/hive/steps/mod.rs crates/core/src/hive/steps/mod.rs
wire/lib/src/hive/steps/ping.rs crates/core/src/hive/steps/ping.rs
wire/lib/src/hive/steps/push.rs crates/core/src/hive/steps/push.rs
wire/lib/src/lib.rs crates/core/src/lib.rs
wire/lib/src/status.rs crates/core/src/status.rs
wire/lib/src/test_macros.rs crates/core/src/test_macros.rs
wire/lib/src/test_support.rs crates/core/src/test_support.rs