From a0c33c4bf6a27bd44bf7e8a788bd856373827231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcolas=20Varela=20Auler?= Date: Fri, 6 Dec 2024 12:20:02 -0300 Subject: [PATCH] experiment: ci cached from local (#166) * feat: created more derivations for build and run * feat: added cachix to devshell * bump: plotly to 0.11 * deps: use rustls instead of openssl native * flake: remove unused packages --- .gitignore | 1 + Cargo.lock | 319 ++++++++++++++++++++++++++++++++++------------------- Cargo.toml | 8 +- flake.nix | 131 ++++++++++++---------- 4 files changed, 283 insertions(+), 176 deletions(-) diff --git a/.gitignore b/.gitignore index 700342e..308e4c8 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ pre-commit-* # ignore direnv # .envrc .direnv/ +result diff --git a/Cargo.lock b/Cargo.lock index 02f4e99..2ccdb47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -264,7 +264,7 @@ dependencies = [ "form_urlencoded", "serde", "subtle", - "thiserror", + "thiserror 1.0.69", "tower-cookies", "tower-layer", "tower-service", @@ -425,6 +425,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chrono" version = "0.4.38" @@ -772,9 +778,9 @@ checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "fdeflate" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07c6f4c64c1d33a3111c4466f7365ebdcc37c5bd1ea0d62aae2e3d722aacbedb" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" dependencies = [ "simd-adler32", ] @@ -848,21 +854,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -879,7 +870,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835f84f38484cc86f110a805655697908257fb9a7af005234060891557198e9" dependencies = [ "nonempty", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1247,31 +1238,52 @@ dependencies = [ ] [[package]] -name = "hyper-timeout" -version = "0.5.2" +name = "hyper-rustls" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ + "futures-util", + "http 1.2.0", "hyper", "hyper-util", - "pin-project-lite", + "log", + "rustls 0.22.4", + "rustls-native-certs", + "rustls-pki-types", "tokio", + "tokio-rustls 0.25.0", "tower-service", ] [[package]] -name = "hyper-tls" -version = "0.6.0" +name = "hyper-rustls" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ - "bytes", - "http-body-util", + "futures-util", + "http 1.2.0", "hyper", "hyper-util", - "native-tls", + "rustls 0.23.19", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.1", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper", + "hyper-util", + "pin-project-lite", "tokio", - "tokio-native-tls", "tower-service", ] @@ -1547,9 +1559,9 @@ dependencies = [ [[package]] name = "lettre" -version = "0.11.10" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0161e452348e399deb685ba05e55ee116cae9410f4f51fe42d597361444521d9" +checksum = "ab4c9a167ff73df98a5ecc07e8bf5ce90b583665da3d1762eb1f775ad4d0d6f5" dependencies = [ "base64 0.22.1", "chumsky", @@ -1559,13 +1571,16 @@ dependencies = [ "httpdate", "idna", "mime", - "native-tls", "nom", "percent-encoding", "quoted_printable", + "rustls 0.23.19", + "rustls-pemfile", + "rustls-pki-types", "socket2", "tokio", "url", + "webpki-roots", ] [[package]] @@ -1694,23 +1709,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "native-tls" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "no-std-compat" version = "0.4.1" @@ -1817,50 +1815,12 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" -[[package]] -name = "openssl" -version = "0.10.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-sys" -version = "0.9.104" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "opentelemetry" version = "0.27.1" @@ -1871,7 +1831,7 @@ dependencies = [ "futures-sink", "js-sys", "pin-project-lite", - "thiserror", + "thiserror 1.0.69", "tracing", ] @@ -1910,7 +1870,7 @@ dependencies = [ "opentelemetry-proto", "opentelemetry_sdk", "prost", - "thiserror", + "thiserror 1.0.69", "tokio", "tonic", "tracing", @@ -1949,7 +1909,7 @@ dependencies = [ "percent-encoding", "rand", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-stream", "tracing", @@ -2095,9 +2055,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "plotly" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e1ffd11c8a6ef0b730b9d3e46ad2404f79905825cb20223fa0547434a2dff54" +checksum = "77e50e865d46d1341c2271022853125604acf7d5f54c2bee318a517ca29fcd77" dependencies = [ "dyn-clone", "erased-serde", @@ -2114,9 +2074,9 @@ dependencies = [ [[package]] name = "plotly_derive" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e940d8d8db30c6f4cc37dab9aab61f4c9cc1e6efb6d18902ab88fa09c03560" +checksum = "7fd64e90c0425a679512dc379216730925c0bc4857df34e9316d997731772ac0" dependencies = [ "darling", "proc-macro2", @@ -2253,6 +2213,58 @@ dependencies = [ "winapi", ] +[[package]] +name = "quinn" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.23.19", + "socket2", + "thiserror 2.0.4", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" +dependencies = [ + "bytes", + "getrandom", + "rand", + "ring", + "rustc-hash", + "rustls 0.23.19", + "rustls-pki-types", + "slab", + "thiserror 2.0.4", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "quote" version = "1.0.37" @@ -2374,28 +2386,31 @@ dependencies = [ "http-body", "http-body-util", "hyper", - "hyper-tls", + "hyper-rustls 0.27.3", "hyper-util", "ipnet", "js-sys", "log", "mime", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", + "quinn", + "rustls 0.23.19", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper 1.0.2", "tokio", - "tokio-native-tls", + "tokio-rustls 0.26.1", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "windows-registry", ] @@ -2535,12 +2550,27 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + [[package]] name = "rustls" version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ + "log", "once_cell", "ring", "rustls-pki-types", @@ -2549,6 +2579,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "2.2.0" @@ -2563,6 +2606,9 @@ name = "rustls-pki-types" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +dependencies = [ + "web-time", +] [[package]] name = "rustls-webpki" @@ -2888,14 +2934,14 @@ dependencies = [ "once_cell", "paste", "percent-encoding", - "rustls", + "rustls 0.23.19", "rustls-pemfile", "serde", "serde_json", "sha2", "smallvec", "sqlformat", - "thiserror", + "thiserror 1.0.69", "time", "tokio", "tokio-stream", @@ -2981,7 +3027,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 1.0.69", "time", "tracing", "uuid", @@ -3021,7 +3067,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 1.0.69", "time", "tracing", "uuid", @@ -3129,14 +3175,14 @@ dependencies = [ "http 1.2.0", "http-body-util", "hyper", - "hyper-tls", + "hyper-rustls 0.26.0", "hyper-util", "serde", "serde_derive", "serde_json", "serde_repr", "serde_with", - "thiserror", + "thiserror 1.0.69", "time", "tokio", "url", @@ -3198,7 +3244,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" +dependencies = [ + "thiserror-impl 2.0.4", ] [[package]] @@ -3212,6 +3267,17 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror-impl" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -3308,20 +3374,31 @@ dependencies = [ ] [[package]] -name = "tokio-native-tls" -version = "0.3.1" +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ - "native-tls", + "rustls 0.23.19", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -3330,9 +3407,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -3511,7 +3588,7 @@ dependencies = [ "rand", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "time", "tokio", "tracing", @@ -3538,7 +3615,7 @@ dependencies = [ "async-trait", "rmp-serde", "sqlx", - "thiserror", + "thiserror 1.0.69", "time", "tower-sessions-core", ] @@ -3554,7 +3631,7 @@ dependencies = [ "governor", "http 1.2.0", "pin-project", - "thiserror", + "thiserror 1.0.69", "tower 0.5.1", "tracing", ] @@ -3863,6 +3940,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpki-roots" version = "0.26.7" diff --git a/Cargo.toml b/Cargo.toml index d4c064a..7648ab2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ askama_axum = { version = "0.4.0", default-features = false } axum = { version = "0.7.7", default-features = false } axum-helmet = { version = "0.1.0", default-features = false } axum-login = { version = "0.16.0", default-features = false } -lettre = { version = "0.11.9", default-features = false, features = ["smtp-transport", "native-tls", "builder"] } +lettre = { version = "0.11.9", default-features = false, features = ["smtp-transport", "rustls-tls", "builder"] } opentelemetry = "0.27.0" opentelemetry-appender-log = "0.27.0" opentelemetry-appender-tracing = "0.27.0" @@ -22,15 +22,15 @@ opentelemetry-otlp = { version = "0.27.0", features = ["tonic", "zstd-tonic"] } opentelemetry-semantic-conventions = { version = "0.27.0", features = ["semconv_experimental"] } opentelemetry_sdk = { version = "0.27.0", features = ["rt-tokio"] } password-auth = { version = "1.1.0-pre.1", default-features = false, features = ["argon2"] } -plotly = { version = "0.10.0", default-features=false, features = ["with-axum"] } +plotly = { version = "0.11.0", default-features=false, features = ["with-axum"] } rand = { version = "0.8.5", default-features = false } regex = { version = "1.11.0", default-features = false } -reqwest = { version = "0.12.8", default-features = false, features = ["json", "default-tls"] } +reqwest = { version = "0.12.8", default-features = false, features = ["json", "rustls-tls"] } serde = { version = "1.0.210", default-features = false, features = ["derive", "serde_derive"] } serde_json = { version = "1.0.128", default-features = false } sqlx = { version = "0.8.2", default-features = false, features = ["runtime-tokio-rustls", "postgres", "time", "uuid", "migrate"] } strum = { version = "0.26.3", default-features = false, features = ["strum_macros", "derive"] } -svix = { version = "1.38.0", default-features = false, features = ["native-tls"] } +svix = { version = "1.38.0", default-features = false, features = ["http2"] } time = { version = "0.3.36", default-features = false, features = ["serde", "serde-human-readable", "serde-well-known", "parsing"] } tokio = { version = "1.40.0", default-features = false, features = ["full"] } totp-rs = { version = "5.6.0", default-features = false, features = ["qr"] } diff --git a/flake.nix b/flake.nix index 78c4ebc..6fd5b74 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,7 @@ ... }: { imports = [ - ./devshells.nix + # ./devshells.nix ]; systems = [ @@ -49,6 +49,51 @@ ... }: let craneLib = (inputs.crane.mkLib pkgs).overrideToolchain (p: p.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)); + + # rust = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default); + # NB: we don't need to overlay our custom toolchain for the *entire* + # pkgs (which would require rebuidling anything else which uses rust). + # Instead, we just want to update the scope that crane will use by appending + # our specific toolchain there. + ## src = craneLib.cleanCargoSource ./.; + unfilteredRoot = ./.; # The original, unfiltered source + src = lib.fileset.toSource { + root = unfilteredRoot; + fileset = lib.fileset.unions [ + # Default files from crane (Rust and cargo files) + (craneLib.fileset.commonCargoSources unfilteredRoot) + # Include all the .sql migrations as well + ./migrations + ./.sqlx + ./templates + ]; + }; + + # Common arguments can be set here to avoid repeating them later + commonArgs = { + inherit src; + strictDeps = true; + + RUSTFLAGS = "-Z threads=4"; + }; + + # Build *just* the cargo dependencies, so we can reuse + # all of that work (e.g. via cachix) when running in CI + cargoArtifacts = craneLib.buildDepsOnly commonArgs; + # Build the actual crate itself, reusing the dependency + # artifacts from above. + ## runs tests -> which will break currently due to network connectivity + ## my-crate = craneLib.buildPackage (commonArgs + ### my-crate = craneLib.cargoBuild (commonArgs + ### // { + ### inherit cargoArtifacts; + ### }); + my-crate = craneLib.buildPackage (commonArgs + // { + inherit cargoArtifacts; + + doCheck = false; # skip tests + }); in { _module.args.pkgs = import inputs.nixpkgs { inherit system; @@ -58,61 +103,7 @@ ]; }; - checks = let - # rust = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default); - # NB: we don't need to overlay our custom toolchain for the *entire* - # pkgs (which would require rebuidling anything else which uses rust). - # Instead, we just want to update the scope that crane will use by appending - # our specific toolchain there. - ## src = craneLib.cleanCargoSource ./.; - unfilteredRoot = ./.; # The original, unfiltered source - src = lib.fileset.toSource { - root = unfilteredRoot; - fileset = lib.fileset.unions [ - # Default files from crane (Rust and cargo files) - (craneLib.fileset.commonCargoSources unfilteredRoot) - # Include all the .sql migrations as well - ./migrations - ./.sqlx - ./templates - ]; - }; - - # Common arguments can be set here to avoid repeating them later - commonArgs = { - inherit src; - strictDeps = true; - - RUSTFLAGS = "-Z threads=4"; - - buildInputs = [ - pkgs.openssl - pkgs.pkg-config - ]; - nativeBuildInputs = [ - pkgs.pkg-config - pkgs.openssl - ]; - }; - - # Build *just* the cargo dependencies, so we can reuse - # all of that work (e.g. via cachix) when running in CI - cargoArtifacts = craneLib.buildDepsOnly commonArgs; - # Build the actual crate itself, reusing the dependency - # artifacts from above. - ## runs tests -> which will break currently due to network connectivity - ## my-crate = craneLib.buildPackage (commonArgs - ### my-crate = craneLib.cargoBuild (commonArgs - ### // { - ### inherit cargoArtifacts; - ### }); - my-crate = craneLib.buildPackage (commonArgs - // { - inherit cargoArtifacts; - - doCheck = false; # skip tests - }); - in { + checks = { # Build the crate as part of `nix flake check` for convenience inherit my-crate; @@ -128,6 +119,34 @@ cargoClippyExtraArgs = "--all-targets -- --deny warnings"; }); }; + + packages = { + default = my-crate; + + cargoArtifacts = cargoArtifacts; + }; + + apps.default = { + type = "app"; + program = my-crate; + }; + + devShells.default = craneLib.devShell { + RUSTFLAGS = "-Zthreads=4"; + + packages = with pkgs; [ + bacon + cachix + cargo-expand + cargo-llvm-cov + cargo-nextest + jq + postgresql + python3 + svix-cli + sqlx-cli + ]; + }; }; } ))