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.

use snix nix_compat + derive

closes #299

+448 -119
+386 -6
Cargo.lock
··· 119 119 checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" 120 120 121 121 [[package]] 122 + name = "base64ct" 123 + version = "1.8.0" 124 + source = "registry+https://github.com/rust-lang/crates.io-index" 125 + checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" 126 + 127 + [[package]] 122 128 name = "beef" 123 129 version = "0.5.2" 124 130 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 155 161 ] 156 162 157 163 [[package]] 164 + name = "bstr" 165 + version = "1.12.0" 166 + source = "registry+https://github.com/rust-lang/crates.io-index" 167 + checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" 168 + dependencies = [ 169 + "memchr", 170 + "regex-automata", 171 + "serde", 172 + ] 173 + 174 + [[package]] 158 175 name = "bumpalo" 159 176 version = "3.19.0" 160 177 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 165 182 version = "1.10.1" 166 183 source = "registry+https://github.com/rust-lang/crates.io-index" 167 184 checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" 185 + 186 + [[package]] 187 + name = "cc" 188 + version = "1.2.41" 189 + source = "registry+https://github.com/rust-lang/crates.io-index" 190 + checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" 191 + dependencies = [ 192 + "find-msvc-tools", 193 + "shlex", 194 + ] 168 195 169 196 [[package]] 170 197 name = "cfg-if" ··· 281 308 ] 282 309 283 310 [[package]] 311 + name = "const-oid" 312 + version = "0.9.6" 313 + source = "registry+https://github.com/rust-lang/crates.io-index" 314 + checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" 315 + 316 + [[package]] 284 317 name = "cpufeatures" 285 318 version = "0.2.17" 286 319 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 300 333 ] 301 334 302 335 [[package]] 336 + name = "curve25519-dalek" 337 + version = "4.1.3" 338 + source = "registry+https://github.com/rust-lang/crates.io-index" 339 + checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" 340 + dependencies = [ 341 + "cfg-if", 342 + "cpufeatures", 343 + "curve25519-dalek-derive", 344 + "digest", 345 + "fiat-crypto", 346 + "rustc_version", 347 + "subtle", 348 + "zeroize", 349 + ] 350 + 351 + [[package]] 352 + name = "curve25519-dalek-derive" 353 + version = "0.1.1" 354 + source = "registry+https://github.com/rust-lang/crates.io-index" 355 + checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" 356 + dependencies = [ 357 + "proc-macro2", 358 + "quote", 359 + "syn 2.0.106", 360 + ] 361 + 362 + [[package]] 363 + name = "darling" 364 + version = "0.21.3" 365 + source = "registry+https://github.com/rust-lang/crates.io-index" 366 + checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" 367 + dependencies = [ 368 + "darling_core", 369 + "darling_macro", 370 + ] 371 + 372 + [[package]] 373 + name = "darling_core" 374 + version = "0.21.3" 375 + source = "registry+https://github.com/rust-lang/crates.io-index" 376 + checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" 377 + dependencies = [ 378 + "fnv", 379 + "ident_case", 380 + "proc-macro2", 381 + "quote", 382 + "strsim", 383 + "syn 2.0.106", 384 + ] 385 + 386 + [[package]] 387 + name = "darling_macro" 388 + version = "0.21.3" 389 + source = "registry+https://github.com/rust-lang/crates.io-index" 390 + checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" 391 + dependencies = [ 392 + "darling_core", 393 + "quote", 394 + "syn 2.0.106", 395 + ] 396 + 397 + [[package]] 398 + name = "data-encoding" 399 + version = "2.9.0" 400 + source = "registry+https://github.com/rust-lang/crates.io-index" 401 + checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" 402 + 403 + [[package]] 404 + name = "der" 405 + version = "0.7.10" 406 + source = "registry+https://github.com/rust-lang/crates.io-index" 407 + checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" 408 + dependencies = [ 409 + "const-oid", 410 + "zeroize", 411 + ] 412 + 413 + [[package]] 303 414 name = "derive_more" 304 415 version = "2.0.1" 305 416 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 353 464 checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" 354 465 355 466 [[package]] 467 + name = "ed25519" 468 + version = "2.2.3" 469 + source = "registry+https://github.com/rust-lang/crates.io-index" 470 + checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" 471 + dependencies = [ 472 + "pkcs8", 473 + "signature", 474 + ] 475 + 476 + [[package]] 477 + name = "ed25519-dalek" 478 + version = "2.2.0" 479 + source = "registry+https://github.com/rust-lang/crates.io-index" 480 + checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" 481 + dependencies = [ 482 + "curve25519-dalek", 483 + "ed25519", 484 + "serde", 485 + "sha2", 486 + "subtle", 487 + "zeroize", 488 + ] 489 + 490 + [[package]] 356 491 name = "either" 357 492 version = "1.15.0" 358 493 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 410 545 checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 411 546 412 547 [[package]] 548 + name = "fiat-crypto" 549 + version = "0.2.9" 550 + source = "registry+https://github.com/rust-lang/crates.io-index" 551 + checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" 552 + 553 + [[package]] 413 554 name = "filedescriptor" 414 555 version = "0.8.3" 415 556 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 419 560 "thiserror 1.0.69", 420 561 "winapi", 421 562 ] 563 + 564 + [[package]] 565 + name = "find-msvc-tools" 566 + version = "0.1.4" 567 + source = "registry+https://github.com/rust-lang/crates.io-index" 568 + checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" 422 569 423 570 [[package]] 424 571 name = "fixedbitset" ··· 549 696 550 697 [[package]] 551 698 name = "getrandom" 699 + version = "0.2.16" 700 + source = "registry+https://github.com/rust-lang/crates.io-index" 701 + checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" 702 + dependencies = [ 703 + "cfg-if", 704 + "libc", 705 + "wasi 0.11.1+wasi-snapshot-preview1", 706 + ] 707 + 708 + [[package]] 709 + name = "getrandom" 552 710 version = "0.3.3" 553 711 source = "registry+https://github.com/rust-lang/crates.io-index" 554 712 checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" ··· 576 734 version = "0.5.0" 577 735 source = "registry+https://github.com/rust-lang/crates.io-index" 578 736 checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 737 + 738 + [[package]] 739 + name = "ident_case" 740 + version = "1.0.1" 741 + source = "registry+https://github.com/rust-lang/crates.io-index" 742 + checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 579 743 580 744 [[package]] 581 745 name = "im" ··· 688 852 "key_agent", 689 853 "miette", 690 854 "nix 0.30.1", 855 + "nix-compat", 691 856 "portable-pty", 692 857 "proc-macro2", 693 858 "prost", ··· 696 861 "serde", 697 862 "serde-query", 698 863 "serde_json", 699 - "serde_repr", 700 864 "sha2", 701 865 "syn 2.0.106", 702 866 "tempdir", ··· 715 879 checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" 716 880 717 881 [[package]] 882 + name = "libmimalloc-sys" 883 + version = "0.1.44" 884 + source = "registry+https://github.com/rust-lang/crates.io-index" 885 + checksum = "667f4fec20f29dfc6bc7357c582d91796c169ad7e2fce709468aefeb2c099870" 886 + dependencies = [ 887 + "cc", 888 + "libc", 889 + ] 890 + 891 + [[package]] 718 892 name = "linux-raw-sys" 719 893 version = "0.9.4" 720 894 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 796 970 ] 797 971 798 972 [[package]] 973 + name = "mimalloc" 974 + version = "0.1.48" 975 + source = "registry+https://github.com/rust-lang/crates.io-index" 976 + checksum = "e1ee66a4b64c74f4ef288bcbb9192ad9c3feaad75193129ac8509af543894fd8" 977 + dependencies = [ 978 + "libmimalloc-sys", 979 + ] 980 + 981 + [[package]] 799 982 name = "miniz_oxide" 800 983 version = "0.8.9" 801 984 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 852 1035 ] 853 1036 854 1037 [[package]] 1038 + name = "nix-compat" 1039 + version = "0.1.0" 1040 + source = "git+https://git.snix.dev/snix/snix.git#d89202f5a2db180474deb31b717c2554a6004895" 1041 + dependencies = [ 1042 + "bitflags 2.9.1", 1043 + "bstr", 1044 + "bytes", 1045 + "data-encoding", 1046 + "ed25519", 1047 + "ed25519-dalek", 1048 + "futures", 1049 + "mimalloc", 1050 + "nix-compat-derive", 1051 + "nom", 1052 + "num_enum", 1053 + "pin-project-lite", 1054 + "serde", 1055 + "serde_json", 1056 + "serde_with", 1057 + "sha2", 1058 + "thiserror 2.0.17", 1059 + "tokio", 1060 + "tracing", 1061 + ] 1062 + 1063 + [[package]] 1064 + name = "nix-compat-derive" 1065 + version = "0.1.0" 1066 + source = "git+https://git.snix.dev/snix/snix.git#d89202f5a2db180474deb31b717c2554a6004895" 1067 + dependencies = [ 1068 + "proc-macro2", 1069 + "quote", 1070 + "syn 2.0.106", 1071 + ] 1072 + 1073 + [[package]] 1074 + name = "nom" 1075 + version = "8.0.0" 1076 + source = "registry+https://github.com/rust-lang/crates.io-index" 1077 + checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" 1078 + dependencies = [ 1079 + "memchr", 1080 + ] 1081 + 1082 + [[package]] 855 1083 name = "nu-ansi-term" 856 1084 version = "0.50.1" 857 1085 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 870 1098 ] 871 1099 872 1100 [[package]] 1101 + name = "num_enum" 1102 + version = "0.7.4" 1103 + source = "registry+https://github.com/rust-lang/crates.io-index" 1104 + checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" 1105 + dependencies = [ 1106 + "num_enum_derive", 1107 + "rustversion", 1108 + ] 1109 + 1110 + [[package]] 1111 + name = "num_enum_derive" 1112 + version = "0.7.4" 1113 + source = "registry+https://github.com/rust-lang/crates.io-index" 1114 + checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" 1115 + dependencies = [ 1116 + "proc-macro-crate", 1117 + "proc-macro2", 1118 + "quote", 1119 + "syn 2.0.106", 1120 + ] 1121 + 1122 + [[package]] 873 1123 name = "object" 874 1124 version = "0.36.7" 875 1125 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 942 1192 checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 943 1193 944 1194 [[package]] 1195 + name = "pkcs8" 1196 + version = "0.10.2" 1197 + source = "registry+https://github.com/rust-lang/crates.io-index" 1198 + checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" 1199 + dependencies = [ 1200 + "der", 1201 + "spki", 1202 + ] 1203 + 1204 + [[package]] 945 1205 name = "portable-atomic" 946 1206 version = "1.11.1" 947 1207 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 988 1248 ] 989 1249 990 1250 [[package]] 1251 + name = "proc-macro-crate" 1252 + version = "3.4.0" 1253 + source = "registry+https://github.com/rust-lang/crates.io-index" 1254 + checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" 1255 + dependencies = [ 1256 + "toml_edit", 1257 + ] 1258 + 1259 + [[package]] 991 1260 name = "proc-macro-error" 992 1261 version = "1.0.4" 993 1262 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1140 1409 version = "0.6.4" 1141 1410 source = "registry+https://github.com/rust-lang/crates.io-index" 1142 1411 checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1412 + dependencies = [ 1413 + "getrandom 0.2.16", 1414 + ] 1143 1415 1144 1416 [[package]] 1145 1417 name = "rand_core" ··· 1147 1419 source = "registry+https://github.com/rust-lang/crates.io-index" 1148 1420 checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" 1149 1421 dependencies = [ 1150 - "getrandom", 1422 + "getrandom 0.3.3", 1151 1423 ] 1152 1424 1153 1425 [[package]] ··· 1234 1506 checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 1235 1507 1236 1508 [[package]] 1509 + name = "rustc_version" 1510 + version = "0.4.1" 1511 + source = "registry+https://github.com/rust-lang/crates.io-index" 1512 + checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" 1513 + dependencies = [ 1514 + "semver", 1515 + ] 1516 + 1517 + [[package]] 1237 1518 name = "rustix" 1238 1519 version = "1.0.8" 1239 1520 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1247 1528 ] 1248 1529 1249 1530 [[package]] 1531 + name = "rustversion" 1532 + version = "1.0.22" 1533 + source = "registry+https://github.com/rust-lang/crates.io-index" 1534 + checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" 1535 + 1536 + [[package]] 1250 1537 name = "ryu" 1251 1538 version = "1.0.20" 1252 1539 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1259 1546 checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 1260 1547 1261 1548 [[package]] 1549 + name = "semver" 1550 + version = "1.0.27" 1551 + source = "registry+https://github.com/rust-lang/crates.io-index" 1552 + checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" 1553 + 1554 + [[package]] 1262 1555 name = "serde" 1263 1556 version = "1.0.228" 1264 1557 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1337 1630 ] 1338 1631 1339 1632 [[package]] 1340 - name = "serde_repr" 1341 - version = "0.1.20" 1633 + name = "serde_with" 1634 + version = "3.15.0" 1635 + source = "registry+https://github.com/rust-lang/crates.io-index" 1636 + checksum = "6093cd8c01b25262b84927e0f7151692158fab02d961e04c979d3903eba7ecc5" 1637 + dependencies = [ 1638 + "serde_core", 1639 + "serde_with_macros", 1640 + ] 1641 + 1642 + [[package]] 1643 + name = "serde_with_macros" 1644 + version = "3.15.0" 1342 1645 source = "registry+https://github.com/rust-lang/crates.io-index" 1343 - checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" 1646 + checksum = "a7e6c180db0816026a61afa1cff5344fb7ebded7e4d3062772179f2501481c27" 1344 1647 dependencies = [ 1648 + "darling", 1345 1649 "proc-macro2", 1346 1650 "quote", 1347 1651 "syn 2.0.106", ··· 1395 1699 checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" 1396 1700 1397 1701 [[package]] 1702 + name = "shlex" 1703 + version = "1.3.0" 1704 + source = "registry+https://github.com/rust-lang/crates.io-index" 1705 + checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 1706 + 1707 + [[package]] 1398 1708 name = "signal-hook-registry" 1399 1709 version = "1.4.6" 1400 1710 source = "registry+https://github.com/rust-lang/crates.io-index" 1401 1711 checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" 1402 1712 dependencies = [ 1403 1713 "libc", 1714 + ] 1715 + 1716 + [[package]] 1717 + name = "signature" 1718 + version = "2.2.0" 1719 + source = "registry+https://github.com/rust-lang/crates.io-index" 1720 + checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" 1721 + dependencies = [ 1722 + "rand_core 0.6.4", 1404 1723 ] 1405 1724 1406 1725 [[package]] ··· 1436 1755 ] 1437 1756 1438 1757 [[package]] 1758 + name = "spki" 1759 + version = "0.7.3" 1760 + source = "registry+https://github.com/rust-lang/crates.io-index" 1761 + checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" 1762 + dependencies = [ 1763 + "base64ct", 1764 + "der", 1765 + ] 1766 + 1767 + [[package]] 1439 1768 name = "strsim" 1440 1769 version = "0.11.1" 1441 1770 source = "registry+https://github.com/rust-lang/crates.io-index" 1442 1771 checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 1443 1772 1444 1773 [[package]] 1774 + name = "subtle" 1775 + version = "2.6.1" 1776 + source = "registry+https://github.com/rust-lang/crates.io-index" 1777 + checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" 1778 + 1779 + [[package]] 1445 1780 name = "supports-color" 1446 1781 version = "3.0.2" 1447 1782 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1501 1836 checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" 1502 1837 dependencies = [ 1503 1838 "fastrand", 1504 - "getrandom", 1839 + "getrandom 0.3.3", 1505 1840 "once_cell", 1506 1841 "rustix", 1507 1842 "windows-sys 0.59.0", ··· 1621 1956 "futures-sink", 1622 1957 "pin-project-lite", 1623 1958 "tokio", 1959 + ] 1960 + 1961 + [[package]] 1962 + name = "toml_datetime" 1963 + version = "0.7.3" 1964 + source = "registry+https://github.com/rust-lang/crates.io-index" 1965 + checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" 1966 + dependencies = [ 1967 + "serde_core", 1968 + ] 1969 + 1970 + [[package]] 1971 + name = "toml_edit" 1972 + version = "0.23.5" 1973 + source = "registry+https://github.com/rust-lang/crates.io-index" 1974 + checksum = "c2ad0b7ae9cfeef5605163839cb9221f453399f15cfb5c10be9885fcf56611f9" 1975 + dependencies = [ 1976 + "indexmap", 1977 + "toml_datetime", 1978 + "toml_parser", 1979 + "winnow", 1980 + ] 1981 + 1982 + [[package]] 1983 + name = "toml_parser" 1984 + version = "1.0.4" 1985 + source = "registry+https://github.com/rust-lang/crates.io-index" 1986 + checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" 1987 + dependencies = [ 1988 + "winnow", 1624 1989 ] 1625 1990 1626 1991 [[package]] ··· 2033 2398 checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" 2034 2399 2035 2400 [[package]] 2401 + name = "winnow" 2402 + version = "0.7.13" 2403 + source = "registry+https://github.com/rust-lang/crates.io-index" 2404 + checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" 2405 + dependencies = [ 2406 + "memchr", 2407 + ] 2408 + 2409 + [[package]] 2036 2410 name = "winreg" 2037 2411 version = "0.10.1" 2038 2412 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2095 2469 "quote", 2096 2470 "syn 2.0.106", 2097 2471 ] 2472 + 2473 + [[package]] 2474 + name = "zeroize" 2475 + version = "1.8.2" 2476 + source = "registry+https://github.com/rust-lang/crates.io-index" 2477 + checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
+3 -1
wire/lib/Cargo.toml
··· 15 15 im = { workspace = true } 16 16 serde-query = "0.2.0" 17 17 thiserror = "2.0.17" 18 - serde_repr = "0.1.20" 19 18 regex = "1.12.2" 20 19 derive_more = { version = "2.0.1", features = ["display"] } 21 20 key_agent = { path = "../key_agent" } ··· 32 31 enum_dispatch = "0.3.13" 33 32 sha2 = { workspace = true } 34 33 base64 = { workspace = true } 34 + nix-compat = { git = "https://git.snix.dev/snix/snix.git", features = [ 35 + "serde", 36 + ] } 35 37 36 38 [dev-dependencies] 37 39 tempdir = "0.3"
+6 -6
wire/lib/src/commands/interactive.rs
··· 23 23 use crate::commands::CommandArguments; 24 24 use crate::commands::interactive_logbuffer::LogBuffer; 25 25 use crate::errors::CommandError; 26 - use crate::nix_log::NixLog; 26 + use crate::nix_log::{SubcommandLog, get_errorish_message}; 27 27 use crate::{ 28 28 commands::{ChildOutputMode, WireCommand, WireCommandChip}, 29 29 errors::HiveLibError, ··· 431 431 432 432 if began { 433 433 if let Some(stripped) = line.strip_prefix('#') { 434 - output_mode.trace(stripped.to_string()); 434 + output_mode.trace(&stripped.to_string()); 435 435 let mut queue = stdout_collection.lock().unwrap(); 436 436 queue.push_front(stripped.to_string()); 437 437 continue; 438 438 } 439 439 440 - let log = output_mode.trace(line.clone()); 440 + let log = output_mode.trace(&line); 441 441 let mut queue = stderr_collection.lock().unwrap(); 442 442 443 - if let Some(NixLog::Internal(log)) = log { 444 - if let Some(message) = log.get_errorish_message() { 443 + if let Some(SubcommandLog::Internal(log)) = log { 444 + if let Some(message) = get_errorish_message(&log) { 445 445 // add at most 10 message to the front, drop the rest. 446 - queue.push_front(message); 446 + queue.push_front(message.to_string()); 447 447 queue.truncate(10); 448 448 } 449 449 }
+10 -12
wire/lib/src/commands/mod.rs
··· 6 6 sync::{Arc, Mutex}, 7 7 }; 8 8 9 + use nix_compat::log::{AT_NIX_PREFIX, LogMessage}; 10 + 9 11 use crate::{ 10 12 SubCommandModifiers, 11 13 commands::{ ··· 14 16 }, 15 17 errors::{CommandError, HiveLibError}, 16 18 hive::node::Target, 17 - nix_log::{Action, Internal, NixLog, Trace}, 19 + nix_log::{self, SubcommandLog, Trace}, 18 20 }; 19 21 20 22 pub(crate) mod common; ··· 144 146 } 145 147 146 148 impl ChildOutputMode { 147 - fn trace(self, line: String) -> Option<NixLog> { 149 + fn trace(self, line: &String) -> Option<nix_log::SubcommandLog<'_>> { 148 150 let log = match self { 149 151 ChildOutputMode::Nix => { 150 - let log = 151 - serde_json::from_str::<Internal>(line.strip_prefix("@nix ").unwrap_or(&line)) 152 - .map(NixLog::Internal) 153 - .unwrap_or(NixLog::Raw(line)); 152 + let log = 153 + serde_json::from_str::<LogMessage>(line.strip_prefix(AT_NIX_PREFIX).unwrap_or(line)) 154 + .map(SubcommandLog::Internal) 155 + .unwrap_or(SubcommandLog::Raw(line.into())); 154 156 155 - // Throw out stop logs 156 - if let NixLog::Internal(Internal { 157 - action: Action::Stop, 158 - }) = log 159 - { 157 + if !matches!(log, SubcommandLog::Internal(LogMessage::Msg {..})) { 160 158 return None; 161 159 } 162 160 163 161 log 164 162 } 165 - Self::Raw => NixLog::Raw(line), 163 + Self::Raw => SubcommandLog::Raw(line.into()), 166 164 }; 167 165 168 166 log.trace();
+5 -5
wire/lib/src/commands/noninteractive.rs
··· 21 21 commands::{ChildOutputMode, CommandArguments, WireCommand, WireCommandChip}, 22 22 errors::{CommandError, HiveLibError}, 23 23 hive::node::Target, 24 - nix_log::NixLog, 24 + nix_log::{SubcommandLog, get_errorish_message}, 25 25 }; 26 26 27 27 pub(crate) struct NonInteractiveCommand<'t> { ··· 187 187 let mut io_reader = tokio::io::AsyncBufReadExt::lines(BufReader::new(reader)); 188 188 189 189 while let Some(line) = io_reader.next_line().await.unwrap() { 190 - let log = output_mode.trace(line.clone()); 190 + let log = output_mode.trace(&line); 191 191 192 192 if !is_error { 193 193 let mut queue = collection.lock().await; 194 194 queue.push_front(line); 195 - } else if let Some(NixLog::Internal(log)) = log { 196 - if let Some(message) = log.get_errorish_message() { 195 + } else if let Some(SubcommandLog::Internal(log)) = log { 196 + if let Some(message) = get_errorish_message(&log) { 197 197 let mut queue = collection.lock().await; 198 - queue.push_front(message); 198 + queue.push_front(message.to_string()); 199 199 // add at most 10 message to the front, drop the rest. 200 200 queue.truncate(10); 201 201 }
+38 -89
wire/lib/src/nix_log.rs
··· 1 1 // SPDX-License-Identifier: AGPL-3.0-or-later 2 2 // Copyright 2024-2025 wire Contributors 3 3 4 - use serde::{Deserialize, Serialize}; 5 - use serde_repr::{Deserialize_repr, Serialize_repr}; 6 - use std::fmt::{Debug, Display}; 4 + use std::{borrow::Cow, fmt::{Debug, Display}}; 7 5 use tracing::{Level as tracing_level, event, info}; 6 + use nix_compat::log::{LogMessage, VerbosityLevel}; 8 7 9 8 // static DIGEST_RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"[0-9a-z]{32}").unwrap()); 10 9 11 - #[derive(Serialize, Deserialize, Debug)] 12 - #[serde(tag = "action")] 13 - pub enum Action { 14 - #[serde(rename = "msg", alias = "start")] 15 - Message { 16 - level: Level, 17 - #[serde(rename = "msg", alias = "text")] 18 - message: Option<String>, 19 - }, 20 - #[serde(rename = "stop", alias = "result")] 21 - Stop, 22 - } 23 - 24 - #[derive(Serialize_repr, Deserialize_repr, PartialEq, Debug)] 25 - #[repr(u8)] 26 - pub enum Level { 27 - Error = 0, 28 - Warn = 1, 29 - Notice = 2, 30 - Info = 3, 31 - Talkative = 4, 32 - Chatty = 5, 33 - Debug = 6, 34 - Vomit = 7, 35 - } 36 - 37 - #[derive(Serialize, Deserialize, Debug)] 38 - pub struct Internal { 39 - #[serde(flatten)] 40 - pub action: Action, 41 - } 42 - 43 10 #[derive(Debug)] 44 - pub enum NixLog { 45 - Internal(Internal), 46 - Raw(String), 11 + pub enum SubcommandLog<'a> { 12 + Internal(LogMessage<'a>), 13 + Raw(Cow<'a, str>), 47 14 } 48 15 49 16 pub(crate) trait Trace { 50 17 fn trace(&self); 51 18 } 52 19 53 - impl Internal { 54 - pub fn get_errorish_message(self) -> Option<String> { 55 - if let Action::Message { 56 - level: Level::Error | Level::Warn | Level::Notice, 57 - message, 58 - } = self.action 59 - { 60 - return message; 61 - } 62 - 63 - None 20 + pub fn get_errorish_message<'a>(message: &'a LogMessage<'a>) -> Option<&'a Cow<'a, str>> { 21 + if let LogMessage::Msg { 22 + level: VerbosityLevel::Error | VerbosityLevel::Warn | VerbosityLevel::Notice, 23 + msg, 24 + } = message 25 + { 26 + return Some(msg); 64 27 } 28 + 29 + None 65 30 } 66 31 67 - impl Trace for Internal { 32 + impl Trace for LogMessage<'_> { 68 33 fn trace(&self) { 69 - match &self.action { 70 - Action::Message { level, message } => { 71 - let text = match message { 72 - Some(text) if text.is_empty() => return, 73 - None => return, 74 - Some(text) => text, 75 - }; 34 + if let LogMessage::Msg { level, msg } = &self { 35 + if msg.is_empty() { 36 + return; 37 + } 76 38 77 - match level { 78 - Level::Info => event!(tracing_level::INFO, "{text}"), 79 - Level::Warn | Level::Notice => event!(tracing_level::WARN, "{text}"), 80 - Level::Error => event!(tracing_level::ERROR, "{text}"), 81 - Level::Debug => event!(tracing_level::DEBUG, "{text}"), 82 - Level::Vomit | Level::Talkative | Level::Chatty => { 83 - event!(tracing_level::TRACE, "{text}"); 84 - } 39 + match level { 40 + VerbosityLevel::Info => event!(tracing_level::INFO, "{msg}"), 41 + VerbosityLevel::Warn | VerbosityLevel::Notice => event!(tracing_level::WARN, "{msg}"), 42 + VerbosityLevel::Error => event!(tracing_level::ERROR, "{msg}"), 43 + VerbosityLevel::Debug => event!(tracing_level::DEBUG, "{msg}"), 44 + VerbosityLevel::Vomit | VerbosityLevel::Talkative | VerbosityLevel::Chatty => { 45 + event!(tracing_level::TRACE, "{msg}"); 85 46 } 86 47 } 87 - Action::Stop => {} 88 48 } 89 49 } 90 50 } 91 51 92 - impl Trace for NixLog { 52 + impl Trace for SubcommandLog<'_> { 93 53 fn trace(&self) { 94 54 match self { 95 - NixLog::Internal(line) => { 55 + SubcommandLog::Internal(line) => { 96 56 line.trace(); 97 57 98 58 // tracing_indicatif::span_ext::IndicatifSpanExt::pb_set_message( ··· 100 60 // &DIGEST_RE.replace_all(&line.to_string(), "…"), 101 61 // ); 102 62 } 103 - NixLog::Raw(line) => info!("{line}"), 63 + SubcommandLog::Raw(line) => info!("{line}"), 104 64 } 105 65 } 106 66 } 107 67 108 - impl Display for Internal { 68 + impl Display for SubcommandLog<'_> { 109 69 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 110 - match &self.action { 111 - Action::Message { level, message } => { 70 + match &self { 71 + SubcommandLog::Internal(line) => match line { 72 + LogMessage::Msg { level, msg } => 112 73 write!( 113 74 f, 114 - "{level:?}: {}", 115 - match message { 116 - Some(message) => message, 117 - None => "Nix log without text", 118 - } 119 - ) 120 - } 121 - Action::Stop => write!(f, ""), 122 - } 123 - } 124 - } 125 - 126 - impl Display for NixLog { 127 - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 128 - match &self { 129 - NixLog::Internal(line) => Display::fmt(&line, f), 130 - NixLog::Raw(line) => Display::fmt(&line, f), 75 + "{level:?}: {msg}" 76 + ), 77 + _ => Ok(()) 78 + }, 79 + SubcommandLog::Raw(line) => Display::fmt(&line, f), 131 80 } 132 81 } 133 82 }