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

rename key_agent to agent

+98 -115
+60 -77
Cargo.lock
··· 18 18 checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" 19 19 20 20 [[package]] 21 + name = "agent" 22 + version = "1.0.0-beta.0" 23 + dependencies = [ 24 + "anyhow", 25 + "base64", 26 + "futures-util", 27 + "nix 0.30.1", 28 + "prost", 29 + "prost-build", 30 + "sha2", 31 + "tokio", 32 + "tokio-util", 33 + ] 34 + 35 + [[package]] 21 36 name = "aho-corasick" 22 37 version = "1.1.4" 23 38 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 296 311 "heck", 297 312 "proc-macro2", 298 313 "quote", 299 - "syn 2.0.111", 314 + "syn 2.0.110", 300 315 ] 301 316 302 317 [[package]] ··· 327 342 checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" 328 343 329 344 [[package]] 330 - name = "convert_case" 331 - version = "0.10.0" 332 - source = "registry+https://github.com/rust-lang/crates.io-index" 333 - checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" 334 - dependencies = [ 335 - "unicode-segmentation", 336 - ] 337 - 338 - [[package]] 339 345 name = "cpufeatures" 340 346 version = "0.2.17" 341 347 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 346 352 347 353 [[package]] 348 354 name = "crc" 349 - version = "3.3.0" 355 + version = "3.4.0" 350 356 source = "registry+https://github.com/rust-lang/crates.io-index" 351 - checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" 357 + checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" 352 358 dependencies = [ 353 359 "crc-catalog", 354 360 ] ··· 408 414 dependencies = [ 409 415 "proc-macro2", 410 416 "quote", 411 - "syn 2.0.111", 417 + "syn 2.0.110", 412 418 ] 413 419 414 420 [[package]] ··· 432 438 "proc-macro2", 433 439 "quote", 434 440 "strsim", 435 - "syn 2.0.111", 441 + "syn 2.0.110", 436 442 ] 437 443 438 444 [[package]] ··· 443 449 dependencies = [ 444 450 "darling_core", 445 451 "quote", 446 - "syn 2.0.111", 452 + "syn 2.0.110", 447 453 ] 448 454 449 455 [[package]] ··· 465 471 466 472 [[package]] 467 473 name = "derive_more" 468 - version = "2.1.0" 474 + version = "2.0.1" 469 475 source = "registry+https://github.com/rust-lang/crates.io-index" 470 - checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" 476 + checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" 471 477 dependencies = [ 472 478 "derive_more-impl", 473 479 ] 474 480 475 481 [[package]] 476 482 name = "derive_more-impl" 477 - version = "2.1.0" 483 + version = "2.0.1" 478 484 source = "registry+https://github.com/rust-lang/crates.io-index" 479 - checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" 485 + checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" 480 486 dependencies = [ 481 - "convert_case", 482 487 "proc-macro2", 483 488 "quote", 484 - "rustc_version", 485 - "syn 2.0.111", 489 + "syn 2.0.110", 486 490 "unicode-xid", 487 491 ] 488 492 ··· 522 526 dependencies = [ 523 527 "proc-macro2", 524 528 "quote", 525 - "syn 2.0.111", 529 + "syn 2.0.110", 526 530 ] 527 531 528 532 [[package]] ··· 590 594 "once_cell", 591 595 "proc-macro2", 592 596 "quote", 593 - "syn 2.0.111", 597 + "syn 2.0.110", 594 598 ] 595 599 596 600 [[package]] ··· 771 775 dependencies = [ 772 776 "proc-macro2", 773 777 "quote", 774 - "syn 2.0.111", 778 + "syn 2.0.110", 775 779 ] 776 780 777 781 [[package]] ··· 1117 1121 dependencies = [ 1118 1122 "getrandom 0.3.3", 1119 1123 "libc", 1120 - ] 1121 - 1122 - [[package]] 1123 - name = "key_agent" 1124 - version = "1.0.0-beta.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 1124 ] 1136 1125 1137 1126 [[package]] ··· 1147 1136 name = "lib" 1148 1137 version = "1.0.0-beta.0" 1149 1138 dependencies = [ 1139 + "agent", 1150 1140 "aho-corasick", 1151 1141 "anyhow", 1152 1142 "base64", ··· 1157 1147 "gjson", 1158 1148 "im", 1159 1149 "itertools", 1160 - "key_agent", 1161 1150 "miette", 1162 1151 "nix 0.30.1", 1163 1152 "nix-compat", ··· 1172 1161 "sha2", 1173 1162 "sqlx", 1174 1163 "strip-ansi-escapes", 1175 - "syn 2.0.111", 1164 + "syn 2.0.110", 1176 1165 "tempdir", 1177 1166 "termion", 1178 1167 "thiserror 2.0.17", ··· 1297 1286 dependencies = [ 1298 1287 "proc-macro2", 1299 1288 "quote", 1300 - "syn 2.0.111", 1289 + "syn 2.0.110", 1301 1290 ] 1302 1291 1303 1292 [[package]] ··· 1399 1388 dependencies = [ 1400 1389 "proc-macro2", 1401 1390 "quote", 1402 - "syn 2.0.111", 1391 + "syn 2.0.110", 1403 1392 ] 1404 1393 1405 1394 [[package]] ··· 1485 1474 "proc-macro-crate", 1486 1475 "proc-macro2", 1487 1476 "quote", 1488 - "syn 2.0.111", 1477 + "syn 2.0.110", 1489 1478 ] 1490 1479 1491 1480 [[package]] ··· 1664 1653 checksum = "ff24dfcda44452b9816fff4cd4227e1bb73ff5a2f1bc1105aa92fb8565ce44d2" 1665 1654 dependencies = [ 1666 1655 "proc-macro2", 1667 - "syn 2.0.111", 1656 + "syn 2.0.110", 1668 1657 ] 1669 1658 1670 1659 [[package]] ··· 1711 1700 "prost", 1712 1701 "prost-types", 1713 1702 "regex", 1714 - "syn 2.0.111", 1703 + "syn 2.0.110", 1715 1704 "tempfile", 1716 1705 ] 1717 1706 ··· 1725 1714 "itertools", 1726 1715 "proc-macro2", 1727 1716 "quote", 1728 - "syn 2.0.111", 1717 + "syn 2.0.110", 1729 1718 ] 1730 1719 1731 1720 [[package]] ··· 2009 1998 dependencies = [ 2010 1999 "proc-macro2", 2011 2000 "quote", 2012 - "syn 2.0.111", 2001 + "syn 2.0.110", 2013 2002 ] 2014 2003 2015 2004 [[package]] ··· 2056 2045 "darling", 2057 2046 "proc-macro2", 2058 2047 "quote", 2059 - "syn 2.0.111", 2048 + "syn 2.0.110", 2060 2049 ] 2061 2050 2062 2051 [[package]] ··· 2253 2242 "quote", 2254 2243 "sqlx-core", 2255 2244 "sqlx-macros-core", 2256 - "syn 2.0.111", 2245 + "syn 2.0.110", 2257 2246 ] 2258 2247 2259 2248 [[package]] ··· 2276 2265 "sqlx-mysql", 2277 2266 "sqlx-postgres", 2278 2267 "sqlx-sqlite", 2279 - "syn 2.0.111", 2268 + "syn 2.0.110", 2280 2269 "tokio", 2281 2270 "url", 2282 2271 ] ··· 2466 2455 2467 2456 [[package]] 2468 2457 name = "syn" 2469 - version = "2.0.111" 2458 + version = "2.0.110" 2470 2459 source = "registry+https://github.com/rust-lang/crates.io-index" 2471 - checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" 2460 + checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" 2472 2461 dependencies = [ 2473 2462 "proc-macro2", 2474 2463 "quote", ··· 2483 2472 dependencies = [ 2484 2473 "proc-macro2", 2485 2474 "quote", 2486 - "syn 2.0.111", 2475 + "syn 2.0.110", 2487 2476 ] 2488 2477 2489 2478 [[package]] ··· 2565 2554 dependencies = [ 2566 2555 "proc-macro2", 2567 2556 "quote", 2568 - "syn 2.0.111", 2557 + "syn 2.0.110", 2569 2558 ] 2570 2559 2571 2560 [[package]] ··· 2576 2565 dependencies = [ 2577 2566 "proc-macro2", 2578 2567 "quote", 2579 - "syn 2.0.111", 2568 + "syn 2.0.110", 2580 2569 ] 2581 2570 2582 2571 [[package]] ··· 2644 2633 dependencies = [ 2645 2634 "proc-macro2", 2646 2635 "quote", 2647 - "syn 2.0.111", 2636 + "syn 2.0.110", 2648 2637 ] 2649 2638 2650 2639 [[package]] ··· 2703 2692 2704 2693 [[package]] 2705 2694 name = "tracing" 2706 - version = "0.1.43" 2695 + version = "0.1.41" 2707 2696 source = "registry+https://github.com/rust-lang/crates.io-index" 2708 - checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" 2697 + checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" 2709 2698 dependencies = [ 2710 2699 "log", 2711 2700 "pin-project-lite", ··· 2715 2704 2716 2705 [[package]] 2717 2706 name = "tracing-attributes" 2718 - version = "0.1.31" 2707 + version = "0.1.30" 2719 2708 source = "registry+https://github.com/rust-lang/crates.io-index" 2720 - checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" 2709 + checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" 2721 2710 dependencies = [ 2722 2711 "proc-macro2", 2723 2712 "quote", 2724 - "syn 2.0.111", 2713 + "syn 2.0.110", 2725 2714 ] 2726 2715 2727 2716 [[package]] 2728 2717 name = "tracing-core" 2729 - version = "0.1.35" 2718 + version = "0.1.34" 2730 2719 source = "registry+https://github.com/rust-lang/crates.io-index" 2731 - checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" 2720 + checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" 2732 2721 dependencies = [ 2733 2722 "once_cell", 2734 2723 "valuable", ··· 2747 2736 2748 2737 [[package]] 2749 2738 name = "tracing-subscriber" 2750 - version = "0.3.22" 2739 + version = "0.3.20" 2751 2740 source = "registry+https://github.com/rust-lang/crates.io-index" 2752 - checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" 2741 + checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" 2753 2742 dependencies = [ 2754 2743 "nu-ansi-term", 2755 2744 "sharded-slab", ··· 2797 2786 version = "0.1.4" 2798 2787 source = "registry+https://github.com/rust-lang/crates.io-index" 2799 2788 checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" 2800 - 2801 - [[package]] 2802 - name = "unicode-segmentation" 2803 - version = "1.12.0" 2804 - source = "registry+https://github.com/rust-lang/crates.io-index" 2805 - checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" 2806 2789 2807 2790 [[package]] 2808 2791 name = "unicode-width" ··· 3249 3232 dependencies = [ 3250 3233 "proc-macro2", 3251 3234 "quote", 3252 - "syn 2.0.111", 3235 + "syn 2.0.110", 3253 3236 "synstructure", 3254 3237 ] 3255 3238 ··· 3270 3253 dependencies = [ 3271 3254 "proc-macro2", 3272 3255 "quote", 3273 - "syn 2.0.111", 3256 + "syn 2.0.110", 3274 3257 ] 3275 3258 3276 3259 [[package]] ··· 3290 3273 dependencies = [ 3291 3274 "proc-macro2", 3292 3275 "quote", 3293 - "syn 2.0.111", 3276 + "syn 2.0.110", 3294 3277 "synstructure", 3295 3278 ] 3296 3279 ··· 3330 3313 dependencies = [ 3331 3314 "proc-macro2", 3332 3315 "quote", 3333 - "syn 2.0.111", 3316 + "syn 2.0.110", 3334 3317 ] 3335 3318 3336 3319 [[package]]
+1 -1
Cargo.toml
··· 1 1 [workspace] 2 - members = ["wire/key_agent", "wire/lib", "wire/cli"] 2 + members = ["wire/agent", "wire/lib", "wire/cli"] 3 3 resolver = "2" 4 4 package.edition = "2024" 5 5 package.version = "1.0.0-beta.0"
+1 -1
README.md
··· 15 15 │ │ └── Rust library containing business logic, consumed by `wire` 16 16 │ ├── cli 17 17 │ │ └── Rust binary, using `lib` 18 - │ └── key_agent 18 + │ └── agent 19 19 │ └── Rust binary ran on a target node. receives key file bytes and metadata w/ protobuf over SSH stdin 20 20 ├── doc 21 21 │ └── a [vitepress](https://vitepress.dev/) site
+1 -1
doc/guides/keys.md
··· 38 38 Otherwise, you may see errors such as: 39 39 40 40 ``` 41 - error: cannot add path '/nix/store/...-wire-tool-key_agent-x86_64-linux-...' because it lacks a signature by a trusted key 41 + error: cannot add path '/nix/store/...-wire-tool-agent-x86_64-linux-...' because it lacks a signature by a trusted key 42 42 ``` 43 43 44 44 This is a requirement because `nix copy` is used to copy the binary.
+1 -1
doc/guides/non-root-user.md
··· 56 56 INFO eval_hive: evaluating hive Flake("/path/to/hive") 57 57 ... 58 58 INFO media | step="Upload key @ NoFilter" progress="3/4" 59 - deploy-user@node:22 | Authenticate for "sudo /nix/store/.../bin/key_agent": 59 + deploy-user@node:22 | Authenticate for "sudo /nix/store/.../bin/agent": 60 60 [sudo] password for deploy-user: 61 61 ``` 62 62
+1 -1
flake.nix
··· 38 38 ./nix/shells.nix 39 39 ./nix/tests.nix 40 40 ./wire/cli 41 - ./wire/key_agent 41 + ./wire/agent 42 42 ./doc 43 43 ./tests/nix 44 44 ./runtime
+1 -1
justfile
··· 4 4 cargo build --profile profiling --features dhat-heap 5 5 @echo 'dhat binaries in target/profiling' 6 6 @echo 'Example:' 7 - @echo 'WIRE_KEY_AGENT=/nix/store/...-key_agent-0.1.0 PROJECT/target/profiling/wire apply ...' 7 + @echo 'WIRE_AGENT=/nix/store/...-agent-0.1.0 PROJECT/target/profiling/wire apply ...'
+1 -1
nix/tests.nix
··· 20 20 21 21 installPhaseCommand = '' 22 22 mkdir -p $out 23 - cp $(ls target/debug/deps/{wire,lib,key_agent}-* | grep -v "\.d") $out 23 + cp $(ls target/debug/deps/{wire,lib,agent}-* | grep -v "\.d") $out 24 24 ''; 25 25 } 26 26 // commonArgs
+17
wire/agent/default.nix
··· 1 + { 2 + perSystem = 3 + { 4 + buildRustProgram, 5 + system, 6 + ... 7 + }: 8 + { 9 + packages = { 10 + agent = buildRustProgram { 11 + name = "agent"; 12 + pname = "wire-tool-agent-${system}"; 13 + cargoExtraArgs = "-p agent"; 14 + }; 15 + }; 16 + }; 17 + }
+2 -2
wire/cli/default.nix
··· 12 12 let 13 13 cleanSystem = system: lib.replaceStrings [ "-" ] [ "_" ] system; 14 14 agents = lib.strings.concatMapStrings ( 15 - system: "--set WIRE_KEY_AGENT_${cleanSystem system} ${(getSystem system).packages.agent} " 15 + system: "--set WIRE_AGENT_${cleanSystem system} ${(getSystem system).packages.agent} " 16 16 ) (import inputs.linux-systems); 17 17 in 18 18 { ··· 70 70 pkgs.makeWrapper 71 71 ]; 72 72 postBuild = '' 73 - wrapProgram $out/bin/wire --set WIRE_KEY_AGENT_${cleanSystem system} ${self'.packages.agent} 73 + wrapProgram $out/bin/wire --set WIRE_AGENT_${cleanSystem system} ${self'.packages.agent} 74 74 ''; 75 75 meta.mainProgram = "wire"; 76 76 };
+1 -1
wire/key_agent/Cargo.toml wire/agent/Cargo.toml
··· 1 1 [package] 2 - name = "key_agent" 2 + name = "agent" 3 3 edition.workspace = true 4 4 version.workspace = true 5 5
wire/key_agent/build.rs wire/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 - }
+1 -1
wire/key_agent/src/keys.proto wire/agent/src/keys.proto
··· 3 3 4 4 syntax = "proto3"; 5 5 6 - package key_agent.keys; 6 + package agent.keys; 7 7 8 8 message KeySpec { 9 9 string destination = 1;
+1 -1
wire/key_agent/src/lib.rs wire/agent/src/lib.rs
··· 2 2 // Copyright 2024-2025 wire Contributors 3 3 4 4 pub mod keys { 5 - include!(concat!(env!("OUT_DIR"), "/key_agent.keys.rs")); 5 + include!(concat!(env!("OUT_DIR"), "/agent.keys.rs")); 6 6 }
+1 -1
wire/key_agent/src/main.rs wire/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; 8 + use agent::keys::KeySpec; 9 9 use nix::unistd::{Group, User}; 10 10 use prost::Message; 11 11 use prost::bytes::Bytes;
+1 -1
wire/lib/Cargo.toml
··· 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 + agent = { path = "../agent" } 21 21 futures = "0.3.31" 22 22 prost = { workspace = true } 23 23 gethostname = "1.1.0"
+1 -1
wire/lib/src/hive/node.rs
··· 291 291 pub evaluation: Option<Derivation>, 292 292 pub evaluation_rx: Option<oneshot::Receiver<Result<Derivation, HiveLibError>>>, 293 293 pub build: Option<String>, 294 - pub key_agent_directory: Option<String>, 294 + pub agent_directory: Option<String>, 295 295 } 296 296 297 297 pub struct Context<'a> {
+6 -6
wire/lib/src/hive/steps/keys.rs
··· 125 125 } 126 126 } 127 127 128 - async fn process_key(key: &Key) -> Result<(key_agent::keys::KeySpec, Vec<u8>), KeyError> { 128 + async fn process_key(key: &Key) -> Result<(agent::keys::KeySpec, Vec<u8>), KeyError> { 129 129 let mut reader = create_reader(key).await?; 130 130 131 131 let mut buf = Vec::new(); ··· 140 140 debug!("Staging push to {}", destination.clone().display()); 141 141 142 142 Ok(( 143 - key_agent::keys::KeySpec { 143 + agent::keys::KeySpec { 144 144 length: buf 145 145 .len() 146 146 .try_into() ··· 221 221 222 222 #[instrument(skip_all, name = "keys")] 223 223 async fn execute(&self, ctx: &mut Context<'_>) -> Result<(), HiveLibError> { 224 - let agent_directory = ctx.state.key_agent_directory.as_ref().unwrap(); 224 + let agent_directory = ctx.state.agent_directory.as_ref().unwrap(); 225 225 226 226 let futures = ctx 227 227 .node ··· 249 249 return Ok(()); 250 250 } 251 251 252 - let command_string = format!("{agent_directory}/bin/key_agent"); 252 + let command_string = format!("{agent_directory}/bin/agent"); 253 253 254 254 let mut child = run_command( 255 255 &CommandArguments::new(command_string, ctx.modifiers) ··· 305 305 #[instrument(skip_all, name = "push_agent")] 306 306 async fn execute(&self, ctx: &mut Context<'_>) -> Result<(), HiveLibError> { 307 307 let arg_name = format!( 308 - "WIRE_KEY_AGENT_{platform}", 308 + "WIRE_AGENT_{platform}", 309 309 platform = ctx.node.host_platform.replace('-', "_") 310 310 ); 311 311 ··· 322 322 push(ctx, Push::Path(&agent_directory)).await?; 323 323 } 324 324 325 - ctx.state.key_agent_directory = Some(agent_directory); 325 + ctx.state.agent_directory = Some(agent_directory); 326 326 327 327 Ok(()) 328 328 }