diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1afd0d..b83a918 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,9 +49,9 @@ jobs: wsl --set-default-version 2 2>&1 - run: | Invoke-Pester ./tests/windows.ps1 2>&1 - - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 - timeout-minutes: 10 + # - if: ${{ failure() }} + # uses: mxschmitt/action-tmate@v3 + # timeout-minutes: 10 linux: needs: setup if: ${{ github.event.workflow_run.name == 'build-linux' || github.event_name == 'push' }} diff --git a/codchi/Cargo.lock b/codchi/Cargo.lock index 78b3dd8..66364da 100644 --- a/codchi/Cargo.lock +++ b/codchi/Cargo.lock @@ -124,6 +124,149 @@ dependencies = [ "backtrace", ] +[[package]] +name = "async-broadcast" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cd0e2e25ea8e5f7e9df04578dc6cf5c83577fd09b1a46aaf5c85e1c33f2a7e" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" +dependencies = [ + "async-lock", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-io" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" +dependencies = [ + "async-lock", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix", + "tracing", +] + +[[package]] +name = "async-recursion" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "async-signal" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix", + "signal-hook-registry", + "slab", + "windows-sys 0.59.0", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "atk" version = "0.18.0" @@ -147,6 +290,12 @@ dependencies = [ "system-deps", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.4.0" @@ -195,6 +344,15 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "block2" version = "0.5.1" @@ -204,6 +362,19 @@ dependencies = [ "objc2", ] +[[package]] +name = "blocking" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + [[package]] name = "build-data" version = "0.2.1" @@ -466,7 +637,7 @@ dependencies = [ [[package]] name = "codchi" -version = "0.2.2" +version = "0.2.3" dependencies = [ "anyhow", "build-data", @@ -498,6 +669,7 @@ dependencies = [ "mslnk", "nix", "not-so-human-panic", + "notify-rust", "num_enum", "number_prefix", "petname", @@ -545,6 +717,15 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "console" version = "0.15.8" @@ -598,6 +779,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -679,6 +869,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "darling" version = "0.20.10" @@ -724,6 +924,16 @@ dependencies = [ "serde", ] +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + [[package]] name = "directories" version = "5.0.1" @@ -742,6 +952,16 @@ dependencies = [ "dirs-sys", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + [[package]] name = "dirs-sys" version = "0.4.1" @@ -754,6 +974,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "dispatch" version = "0.2.0" @@ -825,6 +1056,33 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "endi" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" + +[[package]] +name = "enumflags2" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d232db7f5956f3f14313dc2f87985c58bd2c695ce124c8cdd984e08e15ac133d" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "env_filter" version = "0.1.2" @@ -864,6 +1122,33 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "event-listener" +version = "5.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + [[package]] name = "fdeflate" version = "0.3.5" @@ -987,6 +1272,19 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +[[package]] +name = "futures-lite" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + [[package]] name = "futures-macro" version = "0.3.31" @@ -998,6 +1296,12 @@ dependencies = [ "syn 2.0.79", ] +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + [[package]] name = "futures-task" version = "0.3.31" @@ -1011,8 +1315,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", + "futures-io", "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", "slab", @@ -1121,6 +1428,16 @@ dependencies = [ "x11", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -1654,6 +1971,19 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "mac-notification-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce8f34f3717aa37177e723df6c1fc5fb02b2a1087374ea3fe0ea42316dc8f91" +dependencies = [ + "cc", + "dirs-next", + "objc-foundation", + "objc_id", + "time", +] + [[package]] name = "malloc_buf" version = "0.0.6" @@ -1791,6 +2121,7 @@ dependencies = [ "cfg-if", "cfg_aliases", "libc", + "memoffset", ] [[package]] @@ -1819,6 +2150,19 @@ dependencies = [ "uuid", ] +[[package]] +name = "notify-rust" +version = "4.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5134a72dc570b178bff81b01e81ab14a6fcc015391ed4b3b14853090658cd3a3" +dependencies = [ + "log", + "mac-notification-sys", + "serde", + "tauri-winrt-notification", + "zbus", +] + [[package]] name = "ntapi" version = "0.4.1" @@ -1879,6 +2223,17 @@ dependencies = [ "malloc_buf", ] +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + [[package]] name = "objc-sys" version = "0.3.5" @@ -1978,6 +2333,15 @@ dependencies = [ "objc2-metal", ] +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + [[package]] name = "object" version = "0.36.5" @@ -1999,6 +2363,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + [[package]] name = "os_info" version = "3.8.2" @@ -2045,6 +2419,12 @@ dependencies = [ "system-deps", ] +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + [[package]] name = "parking_lot" version = "0.12.3" @@ -2099,6 +2479,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + [[package]] name = "pkg-config" version = "0.3.31" @@ -2118,6 +2509,21 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "polling" +version = "3.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "portable-atomic" version = "1.9.0" @@ -2206,6 +2612,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "quick-xml" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.37" @@ -2466,6 +2881,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "serde_spanned" version = "0.6.8" @@ -2518,6 +2944,17 @@ dependencies = [ "unsafe-libyaml", ] +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "shared_child" version = "1.0.1" @@ -2585,6 +3022,12 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "strsim" version = "0.11.1" @@ -2717,6 +3160,30 @@ version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" +[[package]] +name = "tauri-winrt-notification" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89f5fb70d6f62381f5d9b2ba9008196150b40b75f3068eb24faeddf1c686871" +dependencies = [ + "quick-xml", + "windows 0.56.0", + "windows-version", +] + +[[package]] +name = "tempfile" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + [[package]] name = "thiserror" version = "1.0.64" @@ -2869,6 +3336,37 @@ dependencies = [ "winnow 0.6.20", ] +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + [[package]] name = "tray-icon" version = "0.19.0" @@ -2889,6 +3387,23 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "uds_windows" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" +dependencies = [ + "memoffset", + "tempfile", + "winapi", +] + [[package]] name = "unicode-bidi" version = "0.3.17" @@ -3102,6 +3617,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1de69df01bdf1ead2f4ac895dc77c9351aefff65b2f3db429a343f9cbf05e132" +dependencies = [ + "windows-core 0.56.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows" version = "0.57.0" @@ -3131,6 +3656,18 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4698e52ed2d08f8658ab0c39512a7c00ee5fe2688c65f8c0a4f06750d729f2a6" +dependencies = [ + "windows-implement 0.56.0", + "windows-interface 0.56.0", + "windows-result 0.1.2", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.57.0" @@ -3156,6 +3693,17 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-implement" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "windows-implement" version = "0.57.0" @@ -3178,6 +3726,17 @@ dependencies = [ "syn 2.0.79", ] +[[package]] +name = "windows-interface" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "windows-interface" version = "0.57.0" @@ -3507,6 +4066,78 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "xdg-home" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "zbus" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725" +dependencies = [ + "async-broadcast", + "async-executor", + "async-fs", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix", + "ordered-stream", + "rand", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "windows-sys 0.52.0", + "xdg-home", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267db9407081e90bbfa46d841d3cbc60f59c0351838c4bc65199ecd79ab1983e" +dependencies = [ + "proc-macro-crate 3.2.0", + "proc-macro2", + "quote", + "syn 2.0.79", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" +dependencies = [ + "serde", + "static_assertions", + "zvariant", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -3527,3 +4158,40 @@ dependencies = [ "quote", "syn 2.0.79", ] + +[[package]] +name = "zvariant" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe" +dependencies = [ + "endi", + "enumflags2", + "serde", + "static_assertions", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449" +dependencies = [ + "proc-macro-crate 3.2.0", + "proc-macro2", + "quote", + "syn 2.0.79", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] diff --git a/codchi/Cargo.toml b/codchi/Cargo.toml index 1a879f2..7ba69cb 100644 --- a/codchi/Cargo.toml +++ b/codchi/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "codchi" build = "build/main.rs" -version = "0.2.2" +version = "0.2.3" edition = "2021" rust-version = "1.80.0" resolver = "2" @@ -52,13 +52,14 @@ tao = { version = "0.30", default-features = false } fs4 = { version = "0.9", features = ["sync"] } git-url-parse = "0.4.5" toml_edit = { version = "0.22.22", features = ["serde"] } +which = "6.0.3" +notify-rust = "4.11.3" # clap-help = "1.3.0" # termimad = "0.30.0" [target.'cfg(unix)'.dependencies] indoc = "2.0.5" nix = { version = "0.29.0", features = ["user", "hostname"] } -which = "6.0.3" [target.'cfg(windows)'.dependencies] known-folders = "1.2.0" diff --git a/codchi/src/cli.rs b/codchi/src/cli.rs index 20cb0d5..4a60acb 100644 --- a/codchi/src/cli.rs +++ b/codchi/src/cli.rs @@ -22,6 +22,9 @@ pub static DEBUG: LazyLock = LazyLock::new(|| { .unwrap() >= Level::Debug }); +#[cfg(target_os = "windows")] +pub static TERMINAL: LazyLock = + LazyLock::new(|| CLI_ARGS.get().and_then(|cli| cli.terminal) != Some(false)); type DefaultLogLevel = InfoLevel; diff --git a/codchi/src/module.rs b/codchi/src/module.rs index 6f567bc..21c02b9 100644 --- a/codchi/src/module.rs +++ b/codchi/src/module.rs @@ -1,6 +1,7 @@ use crate::cli::{InputOptions, ModuleAttrPath, ModuleName, NixpkgsLocation, RelativePath}; use crate::config::git_url::{GitUrl, Scheme}; use crate::consts; +use crate::consts::user::DEFAULT_HOME; use crate::logging::{log_progress, set_progress_status}; use crate::platform::{nix::NixDriver, *}; use crate::progress_scope; @@ -664,6 +665,7 @@ nix run nixpkgs#git -- checkout {commit} .cmd() .script(cmd) .with_user(platform::LinuxUser::Default) + .with_cwd(DEFAULT_HOME.clone()) .output_ok_streaming(channel().1, |line| { log_progress("git clone", log::Level::Info, &line) })?; diff --git a/codchi/src/platform/host.rs b/codchi/src/platform/host.rs index 5bde3f2..75df328 100644 --- a/codchi/src/platform/host.rs +++ b/codchi/src/platform/host.rs @@ -131,10 +131,6 @@ pub trait Host: Sized { use windows::Win32::System::Threading::*; cmd.creation_flags(CREATE_NEW_PROCESS_GROUP.0 | CREATE_NO_WINDOW.0); } - // #[cfg(target_family = "unix")] - // { - // cmd.creation_flags(); - // } cmd.spawn()?; anyhow::Ok(()) } diff --git a/codchi/src/platform/linux/mod.rs b/codchi/src/platform/linux/mod.rs index 8b8968a..1d5218a 100644 --- a/codchi/src/platform/linux/mod.rs +++ b/codchi/src/platform/linux/mod.rs @@ -264,10 +264,11 @@ tail -f "{log_file}" .with_user(LinuxUser::Default) .retry_until_ok(); - // self.cmd() - // .run("ls", &[]) - // .with_user(LinuxUser::Default) - // .retry_until_ok(); + // somehow the above doesn't suffice when LXC container is freshly started + self.cmd() + .run("bash", &["-lc", "ls"]) + .with_user(LinuxUser::Default) + .retry_until_ok(); cancel_tx .send(()) diff --git a/codchi/src/platform/machine.rs b/codchi/src/platform/machine.rs index a0d0cdb..6f161be 100644 --- a/codchi/src/platform/machine.rs +++ b/codchi/src/platform/machine.rs @@ -217,11 +217,15 @@ fi }; set_progress_status(format!("Building {}...", self.config.name)); - let update = if no_update { - "" - } else { - "ndd $NIX_VERBOSITY flake update" - }; + if !no_update { + Driver::store() + .cmd() + .script(format!(r#"ndd $NIX_VERBOSITY flake update"#)) + .with_cwd(consts::store::DIR_CONFIG.join_machine(&self.config.name)) + .output_ok_streaming(channel().1, |line| { + log_progress("build", log::Level::Debug, &line) + })?; + } Driver::store() .cmd() .script(format!( @@ -229,7 +233,6 @@ fi NIX_CFG_FILE="$(ndd build $NIX_VERBOSITY --no-link --print-out-paths \ '.#nixosConfigurations.default.config.environment.etc."nix/nix.conf".source')" export NIX_CONFIG="$(cat $NIX_CFG_FILE)" -{update} if [ ! -e system ]; then ndd $NIX_VERBOSITY profile install --option warn-dirty false --profile system \ '.#nixosConfigurations.default.config.system.build.toplevel' @@ -395,10 +398,8 @@ git add flake.* #[cfg(target_os = "windows")] Driver::host().start_vcxsrv(false)?; - // if self.platform_status == PlatformStatus::Stopped { set_progress_status(format!("Starting {}...", self.config.name)); self.start()?; - // } let cmd = match cmd.split_first() { Some((cmd, args)) => self @@ -410,14 +411,6 @@ git add flake.* hide_progress(); cmd.with_cwd(consts::user::DEFAULT_HOME.clone()) - // .with_env( - // self.config - // .secrets - // .clone() - // .into_iter() - // .map(|(name, val)| (format!("CODCHI_{name}"), val)) - // .collect(), - // ) .with_user(LinuxUser::Default) .exec()?; Ok(()) diff --git a/codchi/src/platform/windows/host.rs b/codchi/src/platform/windows/host.rs index d9153e4..c724617 100644 --- a/codchi/src/platform/windows/host.rs +++ b/codchi/src/platform/windows/host.rs @@ -6,14 +6,12 @@ use crate::{ util::PathExt, }; use anyhow::{Context, Result}; +use itertools::Itertools; use known_folders::{get_known_folder_path, KnownFolder}; use mslnk::ShellLink; use std::{env, fs, os::windows::process::CommandExt, process::Command}; use sysinfo::System; -use windows::Win32::System::Threading::{ - CREATE_NEW_CONSOLE, CREATE_NEW_PROCESS_GROUP, CREATE_NO_WINDOW, -}; -// use winreg::{enums::HKEY_CURRENT_USER, RegKey}; +use windows::Win32::System::Threading::{CREATE_NEW_PROCESS_GROUP, CREATE_NO_WINDOW}; pub struct HostImpl; impl HostImpl {} @@ -151,14 +149,21 @@ impl Host for HostImpl { } fn open_terminal(&self, cmd: &[&str]) -> Result<()> { - if let Some((cmd, args)) = cmd.split_first() { - Command::new(cmd) - .args(args) - .creation_flags(CREATE_NEW_CONSOLE.0) - .spawn()?; - } else { - anyhow::bail!("Failed to open terminal with an empty command"); + let terms = vec![ + ("wt.exe", vec!["nt"]), + ("alacritty.exe", vec!["-e"]), + ("wezterm.exe", vec!["-e"]), + ]; + for (term, args) in &terms { + if let Ok(path) = which::which(term) { + Command::new(path).args(args).args(cmd).spawn()?; + return Ok(()); + } } - Ok(()) + + anyhow::bail!( + "Could not find a terminal. Tried: {}", + terms.iter().map(|(term, _)| term).join(", ") + ) } } diff --git a/codchi/src/platform/windows/mod.rs b/codchi/src/platform/windows/mod.rs index 6b0cd31..02dc525 100644 --- a/codchi/src/platform/windows/mod.rs +++ b/codchi/src/platform/windows/mod.rs @@ -184,30 +184,39 @@ impl MachineDriver for Machine { thread::sleep(Duration::from_millis(200)); } - let mut env_file = OpenOptions::new() - .truncate(true) - .write(true) - .create(true) - .open(env_path)?; - - for (key, value) in &env { - writeln!(env_file, r#"export CODCHI_{key}="{value}""#)?; - } - env_file.sync_all()?; + if let Err(err) = (|| { + let mut env_file = OpenOptions::new() + .truncate(true) + .write(true) + .create(true) + .open(env_path)?; + + for (key, value) in &env { + writeln!(env_file, r#"export CODCHI_{key}="{value}""#)?; + } + env_file.sync_all()?; - if self.platform_status == PlatformStatus::Running { - self.cmd() - .script(format!( - r#" -while [ ! -f {} ]; do + if self.platform_status == PlatformStatus::Running { + self.cmd() + .script(format!( + r#" +while [ ! -f {tmp_env} ]; do sleep .25 done -mv -f {} {} +mv -f {tmp_env} {etc_env} "#, - CODCHI_ENV_TMP.0, CODCHI_ENV_TMP.0, CODCHI_ENV.0 - )) - .with_user(LinuxUser::Root) - .wait_ok()?; + tmp_env = CODCHI_ENV_TMP.0, + etc_env = CODCHI_ENV.0 + )) + .with_user(LinuxUser::Root) + .wait_ok()?; + } + anyhow::Ok(()) + })() { + log::error!( + "Failed to write '{}': {err}. Trying backup method...", + CODCHI_ENV_TMP.0 + ); } Driver::store() diff --git a/codchi/src/tray/mod.rs b/codchi/src/tray/mod.rs index b64b0d1..5ef4512 100644 --- a/codchi/src/tray/mod.rs +++ b/codchi/src/tray/mod.rs @@ -6,6 +6,7 @@ use crate::{ }; use anyhow::Result; use core::*; +use notify_rust::Notification; use std::{env, sync::mpsc::channel, thread}; use tray_icon::menu::{CheckMenuItem, MenuItem}; use TrayItem::*; @@ -105,14 +106,21 @@ pub fn run() -> Result<()> { Button { text: "Terminal".to_string(), on_click: Box::leak(Box::new(move |_| { - Driver::host() + if let Err(err) = Driver::host() .open_terminal(&[ &env::current_exe().unwrap().display().to_string(), "exec", &name, ]) .trace_err(&format!("Failed opening terminal for {name}")) - .ignore(); + { + Notification::new() + .summary("Codchi Error") + .body(&err.to_string()) + .auto_icon() + .show() + .ignore(); + } TrayOp::Noop })), } diff --git a/docs/src/docs/contrib/roadmap.md b/docs/src/docs/contrib/roadmap.md index ad99673..fd6c5e4 100644 --- a/docs/src/docs/contrib/roadmap.md +++ b/docs/src/docs/contrib/roadmap.md @@ -9,9 +9,7 @@ - MVP Features - - [ ] consolidate --help, man & docs - [ ] Codchi doctor (periodical check) - - [ ] codchi clone - [ ] License @@ -22,9 +20,6 @@ - [/] GPU - WSL: Terminal integration (#14) - - [ ] completions - - Linux - - Powershell - Docs - [ ] Internal Docs / Contrib - [ ] Uninstalling Codchi, Migrating away @@ -32,14 +27,11 @@ - Bugs - update required with local repos => invalidate nix cache flag? - (testing: dont prompt) - - LXD: error on first start - open questions: - WSL - what happens if store stops and machines runs? - how to handle network reset (VcXsrv)? => wslg as default? - - ~Linux & auto roots (e.g. ./result, direnv): native nix~ - => garbage collection: how to add roots inside machines to global nix - LXD - Wayland support / xwayland? diff --git a/docs/src/docs/start/installation.md b/docs/src/docs/start/installation.md index 67de393..a5707c6 100644 --- a/docs/src/docs/start/installation.md +++ b/docs/src/docs/start/installation.md @@ -42,14 +42,25 @@ download and install a newer codchi.msix at any time. ### Shell Completions -On some Windows Systems running PowerShell scripts is considered a security vulnerability and often completely disabled. Therefore Codchi doesn't try to automatically run PowerShell Scripts and you have to manually add the completions: +On some Windows Systems running PowerShell scripts is considered a security vulnerability and often completely disabled. Therefore Codchi doesn't try to automatically run PowerShell scripts and you have to manually add the following to the end of your PowerShell configuration (find it by running `$PROFILE` in PowerShell): ```ps1 -# In PowerShell: -mkdir $env:USERPROFILE\Documents\WindowsPowerShell -echo 'codchi completion powershell | invoke-expression' >> $PROFILE +Invoke-Expression (& codchi completion powershell | Out-String) ``` +#### Further Recommendations + +- For better tab complete and history search: + ```ps1 + # Shows navigable menu of all options when hitting tab + Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete + + # Autocompletion for arrow keys (when something was already typed) + Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward + Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward + ``` +- Install [Starship.rs](https://starship.rs/) for a better prompt + ## Linux diff --git a/nix/container/machine/wsl.nix b/nix/container/machine/wsl.nix index 52389a0..a7262b9 100644 --- a/nix/container/machine/wsl.nix +++ b/nix/container/machine/wsl.nix @@ -23,6 +23,7 @@ let inherit (lib) mkEnableOption mkIf pipe concatLines; INIT_LOG = "${mnt}${consts.store.MACHINE_LOG}"; INIT_ENV_TMP = "/tmp/codchi-env"; + INIT_ENV_BACKUP = "/mnt/wsl/codchi/.machine-init-env"; in { @@ -58,15 +59,21 @@ in ''; machine.init.hostSetup = /* bash */ '' - if [ ! -f "${INIT_ENV_TMP}" ]; then + [ -d /etc ] || mkdir /etc + + if [ -f "${INIT_ENV_TMP}" ]; then + mv "${INIT_ENV_TMP}" "${consts.machine.INIT_ENV}" + elif [ -f "${INIT_ENV_BACKUP}" ]; then + mv "${INIT_ENV_BACKUP}" "${consts.machine.INIT_ENV}" + else echo "This distribution is only meant to be started by codchi.exe!" >&2 /mnt/c/WINDOWS/system32/msg.exe '*' "This distribution is only meant to be started by codchi.exe!" >&2 exit 1 fi - [ -d /etc ] || mkdir /etc - mv "${INIT_ENV_TMP}" "${consts.machine.INIT_ENV}" - + # sometimes they don't get deleted... + rm -f "${INIT_ENV_TMP}" "${INIT_ENV_BACKUP}" || true + source "${consts.machine.INIT_ENV}" if [ -z "''${CODCHI_MACHINE_NAME:-}" ]; then diff --git a/tests/windows.ps1 b/tests/windows.ps1 index 7b62f33..8382440 100644 --- a/tests/windows.ps1 +++ b/tests/windows.ps1 @@ -16,6 +16,6 @@ Describe "codchi.msix" { { codchi.exe -vv clone codchi https://github.com/aformatik/codchi nixosModules.codchi } | Should -Not -Throw } It "builds codchi inside codchi" { - { codchi.exe exec -vv codchi bash -lc 'cd codchi/codchi && direnv allow && cargo run --version' } | Should -Not -Throw + { codchi.exe exec -vv codchi bash -lc 'cd codchi/codchi && direnv allow && cargo run -- --version' } | Should -Not -Throw } }