From 429ef4e165e4a625b0046500a31243d9e563e47f Mon Sep 17 00:00:00 2001 From: Medformatik Date: Mon, 17 Mar 2025 19:50:46 +0100 Subject: [PATCH] Fix Nix --- Cargo.lock | 400 +++++++++++++++++++++++------------- ethercat-hal/Cargo.toml | 2 +- flake.lock | 96 +++++++++ flake.nix | 36 +++- nixos/default.nix | 29 ++- nixos/modules/qitech.nix | 28 ++- nixos/packages/electron.nix | 93 ++++----- nixos/packages/server.nix | 47 +++-- server/Cargo.toml | 2 +- 9 files changed, 485 insertions(+), 248 deletions(-) create mode 100644 flake.lock diff --git a/Cargo.lock b/Cargo.lock index 4af2b4ee..2a76b99d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.95" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "arbitrary" @@ -174,7 +174,7 @@ checksum = "99e1aca718ea7b89985790c94aad72d77533063fe00bc497bb79a7c2dae6a661" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -246,7 +246,7 @@ checksum = "604fde5e028fea851ce1d8570bbdc034bec850d157f7569d10f347d06808c05c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -278,9 +278,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "bitvec" @@ -317,9 +317,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" dependencies = [ "serde", ] @@ -332,9 +332,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.12" +version = "1.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755717a7de9ec452bf7f3f1a3099085deabd7f2962b861dae91ecd7a365903d2" +checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" dependencies = [ "shlex", ] @@ -353,16 +353,16 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-link", ] [[package]] @@ -394,18 +394,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.28" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e77c3243bd94243c03672cb5154667347c457ca271254724f9f393aee1c05ff" +checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.27" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7" +checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8" dependencies = [ "anstyle", "clap_lex", @@ -526,9 +526,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f" +checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010" [[package]] name = "deluxe" @@ -540,7 +540,7 @@ dependencies = [ "deluxe-macros", "once_cell", "proc-macro2", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -553,7 +553,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -568,7 +568,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -579,7 +579,7 @@ checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -594,18 +594,18 @@ dependencies = [ [[package]] name = "document-features" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" dependencies = [ "litrs", ] [[package]] name = "either" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "embassy-time" @@ -688,11 +688,11 @@ dependencies = [ "hyper", "hyper-util", "pin-project-lite", - "rand", + "rand 0.8.5", "serde", "serde_json", "smallvec", - "thiserror 2.0.11", + "thiserror 2.0.12", "tokio", "tokio-tungstenite", "tower-layer", @@ -711,22 +711,22 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.6" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" +checksum = "c3716d7a920fb4fac5d84e9d4bce8ceb321e9414b4409da61b07b75c1e3d0697" dependencies = [ "anstream", "anstyle", "env_filter", - "humantime", + "jiff", "log", ] [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" @@ -781,18 +781,19 @@ dependencies = [ "deluxe", "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "ethercrab" version = "0.5.0" +source = "git+https://github.com/qitechgmbh/ethercrab.git?branch=master#a71a509233ad4474343da8804dd49cb0b1bd75d1" dependencies = [ "async-channel", "async-io", "atomic-waker", "atomic_enum", - "bitflags 2.8.0", + "bitflags 2.9.0", "crc", "embassy-time", "embedded-io-async", @@ -816,6 +817,7 @@ dependencies = [ [[package]] name = "ethercrab-wire" version = "0.2.0" +source = "git+https://github.com/qitechgmbh/ethercrab.git?branch=master#a71a509233ad4474343da8804dd49cb0b1bd75d1" dependencies = [ "ethercrab-wire-derive", "heapless", @@ -824,11 +826,12 @@ dependencies = [ [[package]] name = "ethercrab-wire-derive" version = "0.2.0" +source = "git+https://github.com/qitechgmbh/ethercrab.git?branch=master#a71a509233ad4474343da8804dd49cb0b1bd75d1" dependencies = [ "criterion", "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -948,7 +951,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -999,7 +1002,19 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.13.3+wasi-0.2.2", + "windows-targets", ] [[package]] @@ -1010,9 +1025,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "half" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +checksum = "7db2ff139bba50379da6aa0766b52fdcb62cb5b263009b09ed58ba604e14bbd1" dependencies = [ "cfg-if", "crunchy", @@ -1056,10 +1071,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] -name = "http" -version = "1.2.0" +name = "hermit-abi" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" +checksum = "fbd780fe5cc30f81464441920d82ac8740e2e46b29a6fad543ddd075229ce37e" + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ "bytes", "fnv", @@ -1078,12 +1099,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", - "futures-util", + "futures-core", "http", "http-body", "pin-project-lite", @@ -1097,9 +1118,9 @@ checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" [[package]] name = "httparse" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d708df4e7140240a16cd6ab0ab65c972d7433ab77819ea693fde9c43811e2a" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" @@ -1107,12 +1128,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "hyper" version = "1.6.0" @@ -1198,9 +1213,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.7.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", "hashbrown", @@ -1212,7 +1227,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab01638bb6a279897b7691f87f3f3c232451711fd419a69ced980ce61074fa46" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "cfg-if", "libc", ] @@ -1237,11 +1252,11 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.15" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19b23d53f35ce9f56aebc7d1bb4e6ac1e9c0db7ac85c8d1760c04379edced37" +checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" dependencies = [ - "hermit-abi", + "hermit-abi 0.5.0", "libc", "windows-sys 0.59.0", ] @@ -1273,9 +1288,33 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jiff" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d699bc6dfc879fb1bf9bdff0d4c56f0884fc6f0d0eb0fba397a6d00cd9a6b85e" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", +] + +[[package]] +name = "jiff-static" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d16e75759ee0aa64c57a56acbf43916987b20c77373cb7e808979e02b93c9f9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] [[package]] name = "js-sys" @@ -1295,9 +1334,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libloading" @@ -1333,9 +1372,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.25" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "matchit" @@ -1376,9 +1415,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924" +checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" dependencies = [ "adler2", ] @@ -1390,7 +1429,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", ] @@ -1427,7 +1466,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "cfg-if", "cfg_aliases", "libc", @@ -1470,15 +1509,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.3" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" [[package]] name = "oorandom" -version = "11.1.4" +version = "11.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" [[package]] name = "open" @@ -1567,9 +1606,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "pnet_base" @@ -1611,7 +1650,7 @@ checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" dependencies = [ "cfg-if", "concurrent-queue", - "hermit-abi", + "hermit-abi 0.4.0", "pin-project-lite", "rustix", "tracing", @@ -1619,10 +1658,25 @@ dependencies = [ ] [[package]] -name = "ppv-lite86" -version = "0.2.20" +name = "portable-atomic" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ "zerocopy", ] @@ -1639,18 +1693,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -1668,8 +1722,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", + "zerocopy", ] [[package]] @@ -1679,7 +1744,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", ] [[package]] @@ -1688,16 +1763,25 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.1", ] [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", ] [[package]] @@ -1741,7 +1825,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "errno 0.3.10", "libc", "linux-raw-sys", @@ -1750,15 +1834,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "ryu" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "same-file" @@ -1783,34 +1867,34 @@ checksum = "22f968c5ea23d555e670b449c1c5e7b2fc399fdaec1d304a17cd48e288abc107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "serde" -version = "1.0.217" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.217" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "serde_json" -version = "1.0.138" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -1820,9 +1904,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +checksum = "59fab13f937fa393d08645bf3a84bdfe86e296747b506ada67bb15f10f218b2a" dependencies = [ "itoa", "serde", @@ -1929,9 +2013,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" dependencies = [ "serde", ] @@ -1986,7 +2070,7 @@ dependencies = [ "serde", "socketioxide-core", "socketioxide-parser-common", - "thiserror 2.0.11", + "thiserror 2.0.12", "tokio", "tower-layer", "tower-service", @@ -2004,7 +2088,7 @@ dependencies = [ "futures-core", "serde", "smallvec", - "thiserror 2.0.11", + "thiserror 2.0.12", ] [[package]] @@ -2061,9 +2145,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.98" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -2093,11 +2177,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.11", + "thiserror-impl 2.0.12", ] [[package]] @@ -2108,18 +2192,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "thiserror-impl" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -2128,7 +2212,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe075d7053dae61ac5413a34ea7d4913b6e6207844fd726bdd858b37ff72bf5" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "cfg-if", "libc", "log", @@ -2167,9 +2251,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.43.0" +version = "1.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" +checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" dependencies = [ "backtrace", "bytes", @@ -2191,14 +2275,14 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "tokio-tungstenite" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4bf6fecd69fcdede0ec680aaf474cdab988f9de6bc73d3758f0160e3b7025a" +checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" dependencies = [ "futures-util", "log", @@ -2208,9 +2292,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" +checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" dependencies = [ "bytes", "futures-core", @@ -2258,7 +2342,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "bytes", "futures-util", "http", @@ -2323,7 +2407,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -2363,27 +2447,26 @@ dependencies = [ [[package]] name = "tungstenite" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413083a99c579593656008130e29255e54dcaae495be556cc26888f211648c24" +checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" dependencies = [ - "byteorder", "bytes", "data-encoding", "http", "httparse", "log", - "rand", + "rand 0.9.0", "sha1", - "thiserror 2.0.11", + "thiserror 2.0.12", "utf-8", ] [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "unicase" @@ -2393,9 +2476,9 @@ checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-ident" -version = "1.0.16" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "uom" @@ -2453,6 +2536,15 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.13.3+wasi-0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasm-bindgen" version = "0.2.100" @@ -2475,7 +2567,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", "wasm-bindgen-shared", ] @@ -2497,7 +2589,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2551,6 +2643,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-link" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3" + [[package]] name = "windows-sys" version = "0.36.1" @@ -2685,6 +2783,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +dependencies = [ + "bitflags 2.9.0", +] + [[package]] name = "wyz" version = "0.5.1" @@ -2696,21 +2803,20 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] diff --git a/ethercat-hal/Cargo.toml b/ethercat-hal/Cargo.toml index 3a1180c3..0f637c4b 100644 --- a/ethercat-hal/Cargo.toml +++ b/ethercat-hal/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] anyhow = "1.0.95" crossbeam-utils = "0.8.21" -ethercrab = { path = "../ethercrab" } +ethercrab = { git = "https://github.com/qitechgmbh/ethercrab.git", branch = "master" } ethercat_hal_derive = { version = "0.1.0", path = "../ethercat-hal-derive" } log = "0.4.25" stepper_driver = { version = "0.1.0", path = "../stepper-driver" } diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..7517b83b --- /dev/null +++ b/flake.lock @@ -0,0 +1,96 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1742136038, + "narHash": "sha256-DDe16FJk18sadknQKKG/9FbwEro7A57tg9vB5kxZ8kY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a1185f4064c18a5db37c5c84e5638c78b46e3341", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1736320768, + "narHash": "sha256-nIYdTAiKIGnFNugbomgBJR+Xv5F1ZQU+HfaBqJKroC0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4bc9c909d9ac828a039f288cf872d16d38185db8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1742178793, + "narHash": "sha256-S2onMdoDS4tIYd3/Jc5oFEZBr2dJOgPrh9KzSO/bfDw=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "954582a766a50ebef5695a9616c93b5386418c08", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 00a36169..cf43bbc6 100644 --- a/flake.nix +++ b/flake.nix @@ -3,19 +3,33 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + rust-overlay.url = "github:oxalica/rust-overlay"; + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs }: - let - supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); - in - { - # Re-export packages from nixos/default.nix - packages = forAllSystems (system: import ./nixos { pkgs = nixpkgsFor.${system}; }); - - # Re-export NixOS module + outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { inherit system overlays; }; + + # Use Rust beta as required + rust = pkgs.rust-bin.beta.latest.default.override { + extensions = [ "rust-src" "rust-analyzer" ]; + targets = [ "x86_64-unknown-linux-gnu" ]; + }; + in { + packages = { + server = pkgs.callPackage ./nixos/packages/server.nix { + inherit rust; + }; + + electron = pkgs.callPackage ./nixos/packages/electron.nix {}; + + default = self.packages.${system}.server; + }; + } + ) // { nixosModules.qitech = import ./nixos/modules/qitech.nix; nixosModules.default = self.nixosModules.qitech; }; diff --git a/nixos/default.nix b/nixos/default.nix index 4a9ff155..0ca179fa 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -5,11 +5,30 @@ } }: -{ - packages = { - server = pkgs.callPackage ./packages/server.nix {}; - electron = pkgs.callPackage ./packages/electron.nix {}; +let + rust = pkgs.rust-bin.beta.latest.default.override { + extensions = [ "rust-src" "rust-analyzer" ]; + targets = [ "x86_64-unknown-linux-gnu" ]; }; +in { + server = pkgs.callPackage ./nixos/packages/server.nix { inherit rust; }; + electron = pkgs.callPackage ./nixos/packages/electron.nix { }; - nixosModules.qitech = import ./modules/qitech.nix; + # Package for quick development testing without a flake + shell = pkgs.mkShell { + buildInputs = with pkgs; [ + rust + pkg-config + libudev-zero + libpcap + nodejs + nodePackages.npm + ]; + + shellHook = '' + echo "QiTech Industries Control Software Development Environment" + echo "Rust version: $(${rust}/bin/rustc --version)" + echo "Node version: $(${pkgs.nodejs}/bin/node --version)" + ''; + }; } diff --git a/nixos/modules/qitech.nix b/nixos/modules/qitech.nix index e4c234fc..aaf1cadf 100644 --- a/nixos/modules/qitech.nix +++ b/nixos/modules/qitech.nix @@ -4,7 +4,6 @@ with lib; let cfg = config.services.qitech; - qitechPackages = (import ../. { inherit pkgs; }).packages; in { options.services.qitech = { enable = mkEnableOption "QiTech Industries Control Software"; @@ -32,23 +31,34 @@ in { default = 8000; description = "Port on which the QiTech server listens"; }; + + package = mkOption { + type = types.package; + default = pkgs.qitech-server or null; + description = "The QiTech server package to use"; + }; }; config = mkIf cfg.enable { - # Always create a dedicated system user + assertions = [ + { + assertion = cfg.package != null; + message = "No QiTech server package available. Please add it to your pkgs or explicitly set services.qitech.package."; + } + ]; + users.users.${cfg.user} = { isSystemUser = true; group = cfg.group; description = "QiTech service user"; - # Add to groups needed for hardware access extraGroups = [ "realtime" "plugdev" "dialout" "uucp" ]; }; users.groups.${cfg.group} = {}; - # Install the packages - environment.systemPackages = [ - qitechPackages.electron + # Install the Electron app system-wide + environment.systemPackages = with pkgs; [ + qitech-electron ]; # Configure udev rules for EtherCAT device access @@ -70,14 +80,14 @@ in { Type = "simple"; User = cfg.user; Group = cfg.group; - ExecStart = "${qitechPackages.server}/bin/server"; + ExecStart = "${cfg.package}/bin/qitech-server"; Restart = "on-failure"; # Grant specific capabilities needed for EtherCAT CapabilityBoundingSet = "CAP_NET_RAW CAP_NET_ADMIN CAP_SYS_NICE"; AmbientCapabilities = "CAP_NET_RAW CAP_NET_ADMIN CAP_SYS_NICE"; - # Hardening that's still compatible with hardware access + # Hardening options NoNewPrivileges = true; ProtectSystem = "strict"; ProtectHome = true; @@ -88,7 +98,7 @@ in { RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_NETLINK AF_PACKET"; RestrictNamespaces = true; LockPersonality = true; - MemoryDenyWriteExecute = false; # May need JIT compilation + MemoryDenyWriteExecute = false; }; environment = { diff --git a/nixos/packages/electron.nix b/nixos/packages/electron.nix index 7eff70da..d6ba112d 100644 --- a/nixos/packages/electron.nix +++ b/nixos/packages/electron.nix @@ -1,7 +1,6 @@ { lib , stdenv , makeWrapper -, fetchFromGitHub , nodejs , electron , nodePackages @@ -20,92 +19,77 @@ stdenv.mkDerivation rec { nodePackages.npm git makeWrapper - cacert # Add SSL certificates + cacert ]; - # Fix the SSL certificate issues + # Environment variables for the build SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt"; - NODE_TLS_REJECT_UNAUTHORIZED = "0"; # Allow npm to proceed even with certificate issues - - # Avoid update notifications npm_config_update_notifier = false; - npm_config_loglevel = "verbose"; - + npm_config_cache = "$TMPDIR/npm-cache"; + buildPhase = '' export HOME=$TMPDIR - # Configure git for npm - git config --global user.email "nixbuild@localhost" - git config --global user.name "Nix Builder" + # Ensure git directories exist + mkdir -p $HOME - # Show available scripts - echo "Available npm scripts:" - npm run || true + # Setup git for npm with explicit config path + ${git}/bin/git config --global --add safe.directory '*' + ${git}/bin/git config --global user.email "nixbuild@localhost" + ${git}/bin/git config --global user.name "Nix Builder" # Install dependencies - echo "Installing dependencies... (this may take a while)" - npm install --no-audit --no-fund || npm install --no-audit --no-fund --unsafe-perm || { - echo "Normal installation failed. Trying with legacy peer deps..." - npm install --legacy-peer-deps --no-audit --no-fund --unsafe-perm - } + echo "Installing dependencies..." + npm ci --no-audit --no-fund || npm install --no-audit --no-fund --legacy-peer-deps - # Run the package command + # Build the application + echo "Building application..." + npm run build || true + + # Package the application echo "Packaging application..." - npm run package || { - echo "Packaging failed. Trying with start script..." - npm run start -- --no-sandbox - } - - # Create distributable if package succeeded - if [ -d "out" ]; then - echo "Creating distributable..." - npm run make || true - fi + npm run package || true ''; installPhase = '' - mkdir -p $out/share/qitech + mkdir -p $out/share/qitech-electron $out/bin - # Check for various output directories that electron-forge might create + # Install the app - check various output directories if [ -d "out" ]; then - echo "Found 'out' directory, copying contents" - cp -r out/* $out/share/qitech/ || true - fi - - if [ -d "dist" ]; then - echo "Found 'dist' directory, copying contents" - cp -r dist/* $out/share/qitech/ || true - fi - - if [ -d "make" ]; then - echo "Found 'make' directory, copying contents" - cp -r make/* $out/share/qitech/ || true - fi - - # If no build output was found, copy the source - if [ ! "$(ls -A $out/share/qitech)" ]; then - echo "No build output found. Copying the source itself." - cp -r * $out/share/qitech/ + cp -r out/* $out/share/qitech-electron/ || true + elif [ -d "dist" ]; then + cp -r dist/* $out/share/qitech-electron/ || true + else + # Fallback - copy the source and node_modules + echo "No build output found - using source files" + cp -r src package.json $out/share/qitech-electron/ || true + if [ -d "node_modules" ]; then + cp -r node_modules $out/share/qitech-electron/ || true + fi fi # Create desktop entry mkdir -p $out/share/applications - cat > $out/share/applications/qitech.desktop << EOF + cat > $out/share/applications/qitech-electron.desktop << EOF [Desktop Entry] Name=QiTech Control Comment=QiTech Industries Control Software Exec=qitech-electron + Icon=$out/share/qitech-electron/icon.png Terminal=false Type=Application Categories=Development;Engineering; EOF + # Find an icon if it exists + if [ -f "build/icon.png" ]; then + cp build/icon.png $out/share/qitech-electron/ || true + fi + # Create wrapper script - mkdir -p $out/bin makeWrapper ${electron}/bin/electron $out/bin/qitech-electron \ - --add-flags "$out/share/qitech" \ - --set NODE_PATH "$out/lib/node_modules" \ + --add-flags "$out/share/qitech-electron" \ --add-flags "--no-sandbox" ''; @@ -113,7 +97,6 @@ stdenv.mkDerivation rec { description = "QiTech Industries Control Software - Electron Frontend"; homepage = "https://qitech.com"; license = licenses.mit; - maintainers = []; platforms = platforms.linux; }; } diff --git a/nixos/packages/server.nix b/nixos/packages/server.nix index abf8d5d8..f0f21360 100644 --- a/nixos/packages/server.nix +++ b/nixos/packages/server.nix @@ -3,44 +3,53 @@ , pkg-config , libudev-zero , libpcap -, rust-bin +, rust }: -let - rust = rust-bin.beta.latest.default; -in stdenv.mkDerivation rec { pname = "qitech-server"; version = "0.1.0"; src = lib.cleanSource ../..; - nativeBuildInputs = [ - pkg-config - rust - ]; - - buildInputs = [ - libpcap - libudev-zero - ]; + nativeBuildInputs = [ pkg-config rust ]; + buildInputs = [ libpcap libudev-zero ]; buildPhase = '' + export HOME=$TMPDIR export CARGO_HOME=$TMPDIR/.cargo - cd server - cargo build --release + + # Reduce memory usage + export CARGO_BUILD_JOBS=1 + + # Create a swap file if building on a memory-constrained system + if [ ! -f /swapfile ] && [ $(free -m | grep Mem | awk '{print $2}') -lt 8000 ]; then + mkdir -p $TMPDIR/swap + dd if=/dev/zero of=$TMPDIR/swap/swapfile bs=1M count=4096 + chmod 600 $TMPDIR/swap/swapfile + mkswap $TMPDIR/swap/swapfile + swapon $TMPDIR/swap/swapfile + fi + + # Build with fewer parallel jobs + ${rust}/bin/cargo build --release --package server + + # Cleanup swap if we created it + if [ -f $TMPDIR/swap/swapfile ]; then + swapoff $TMPDIR/swap/swapfile + rm $TMPDIR/swap/swapfile + fi ''; installPhase = '' mkdir -p $out/bin - cp ../target/release/server $out/bin/ + cp target/release/server $out/bin/qitech-server ''; meta = with lib; { description = "QiTech Industries Control Software - Server Component"; - homepage = "https://qitech.com"; # Replace with actual homepage - license = licenses.mit; # Replace with actual license - maintainers = []; + homepage = "https://qitech.com"; + license = licenses.mit; platforms = platforms.linux; }; } diff --git a/server/Cargo.toml b/server/Cargo.toml index 071cc6b2..c1cdc329 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.86" # etehrcat network-interface = "2.0.0" -ethercrab = { path = "../ethercrab" } +ethercrab = { git = "https://github.com/qitechgmbh/ethercrab.git", branch = "master" } ethercat_hal = { version = "0.1.0", path = "../ethercat-hal" } # concurrency