diff options
author | Florian Klink <flokli@flokli.de> | 2024-08-21T08·06+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-08-21T09·40+0000 |
commit | e03ea11badbf40971d6bf87eede33fe3b046c98b (patch) | |
tree | d520dedadeb8193b2da323adb2623a269217951c /users/picnoir | |
parent | 2357079891819c679821ea58a7715de7be431aaa (diff) |
feat(nix-compat/nix_http): init parse_nar[info]_str r/8547
This moves the URL component parsing code we had in nar-bridge to nix-compat. We change the function signature to return an Option, not a Result<_, StatusCode>. This allows returning more appropriate error codes, as we can ok_or(…) at the callsite, which we now do: on an upload to an invalid path, we now return "unauthorized", while on a GET/HEAD, we return "not found". This also adds support to parse compression suffixes. While not supported in nar-bridge, other users of nix-compat might very well want to parse these paths. Also fix the error message when parsing NAR urls, it mentioned 32, not 52, which is a copypasta error from the narinfo URL parsing code. Change-Id: Id1be9a8044814b54ce68b125c52dfe933c9c4f74 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12260 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
Diffstat (limited to 'users/picnoir')
-rw-r--r-- | users/picnoir/tvix-daemon/Cargo.lock | 25 | ||||
-rw-r--r-- | users/picnoir/tvix-daemon/Cargo.nix | 250 |
2 files changed, 201 insertions, 74 deletions
diff --git a/users/picnoir/tvix-daemon/Cargo.lock b/users/picnoir/tvix-daemon/Cargo.lock index 683203f5ca1e..07191d673664 100644 --- a/users/picnoir/tvix-daemon/Cargo.lock +++ b/users/picnoir/tvix-daemon/Cargo.lock @@ -331,9 +331,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "der" @@ -659,6 +659,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] +name = "libmimalloc-sys" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44" +dependencies = [ + "cc", + "libc", +] + +[[package]] name = "litrs" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -693,6 +703,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] +name = "mimalloc" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633" +dependencies = [ + "libmimalloc-sys", +] + +[[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -746,6 +765,7 @@ dependencies = [ "ed25519-dalek", "enum-primitive-derive", "glob", + "mimalloc", "nom", "num-traits", "pin-project-lite", @@ -754,6 +774,7 @@ dependencies = [ "sha2", "thiserror", "tokio", + "tracing", ] [[package]] diff --git a/users/picnoir/tvix-daemon/Cargo.nix b/users/picnoir/tvix-daemon/Cargo.nix index 2382027f9b13..18dd066fedb6 100644 --- a/users/picnoir/tvix-daemon/Cargo.nix +++ b/users/picnoir/tvix-daemon/Cargo.nix @@ -1,4 +1,4 @@ -# This file was @generated by crate2nix 0.13.0 with the command: +# This file was @generated by crate2nix 0.14.1 with the command: # "generate" "--all-features" # See https://github.com/kolloch/crate2nix for more info. @@ -13,6 +13,8 @@ , rootFeatures ? [ "default" ] # If true, throw errors instead of issueing deprecation warnings. , strictDeprecation ? false + # Elements to add to the `-C target-feature=` argument passed to `rustc` + # (separated by `,`, prefixed with `+`). # Used for conditional compilation based on CPU feature detection. , targetFeatures ? [ ] # Whether to perform release builds: longer compile times, faster binaries. @@ -181,6 +183,7 @@ rec { version = "0.2.3"; edition = "2021"; sha256 = "134jhzrz89labrdwxxnjxqjdg06qvaflj1wkfnmyapwyldfwcnn7"; + libName = "anstyle_parse"; dependencies = [ { name = "utf8parse"; @@ -200,6 +203,7 @@ rec { version = "1.0.2"; edition = "2021"; sha256 = "0j3na4b1nma39g4x7cwvj009awxckjf3z2vkwhldgka44hqj72g2"; + libName = "anstyle_query"; dependencies = [ { name = "windows-sys"; @@ -215,6 +219,7 @@ rec { version = "3.0.2"; edition = "2021"; sha256 = "19v0fv400bmp4niqpzxnhg83vz12mmqv7l2l8vi80qcdxj0lpm8w"; + libName = "anstyle_wincon"; dependencies = [ { name = "anstyle"; @@ -234,6 +239,7 @@ rec { version = "0.3.5"; edition = "2018"; sha256 = "0l8sjq1rylkb1ak0pdyjn83b3k6x36j22myngl4sqqgg7whdsmnd"; + libName = "async_stream"; authors = [ "Carl Lerche <me@carllerche.com>" ]; @@ -259,6 +265,7 @@ rec { edition = "2018"; sha256 = "14q179j4y8p2z1d0ic6aqgy9fhwz8p9cai1ia8kpw4bw7q12mrhn"; procMacro = true; + libName = "async_stream_impl"; authors = [ "Carl Lerche <me@carllerche.com>" ]; @@ -285,6 +292,7 @@ rec { edition = "2021"; sha256 = "1adf1jh2yg39rkpmqjqyr9xyd6849p0d95425i6imgbhx0syx069"; procMacro = true; + libName = "async_trait"; authors = [ "David Tolnay <dtolnay@gmail.com>" ]; @@ -497,6 +505,7 @@ rec { version = "0.4.3"; edition = "2021"; sha256 = "1qx28wg4j6qdcdrisqwyaavlzc0zvbsrcwa99zf9456lfbyn6p51"; + libName = "axum_core"; dependencies = [ { name = "async-trait"; @@ -682,6 +691,7 @@ rec { version = "0.10.4"; edition = "2018"; sha256 = "0w9sa2ypmrsqqvc20nhwr75wbb5cjr4kkyhpjm1z1lv2kdicfy1h"; + libName = "block_buffer"; authors = [ "RustCrypto Developers" ]; @@ -764,6 +774,7 @@ rec { version = "1.0.0"; edition = "2018"; sha256 = "1za0vb97n4brpzpv8lsbnzmq5r8f2b0cpqqr0sy8h5bn751xxwds"; + libName = "cfg_if"; authors = [ "Alex Crichton <alex@alexcrichton.com>" ]; @@ -902,6 +913,7 @@ rec { version = "0.9.6"; edition = "2021"; sha256 = "1y0jnqaq7p2wvspnx7qj76m7hjcqpz73qzvr9l2p9n2s51vr6if2"; + libName = "const_oid"; authors = [ "RustCrypto Developers" ]; @@ -921,7 +933,7 @@ rec { { name = "libc"; packageId = "libc"; - target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "aarch64-linux-android"); + target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "aarch64-linux-android"); } { name = "libc"; @@ -946,6 +958,7 @@ rec { version = "0.1.6"; edition = "2018"; sha256 = "1cvby95a6xg7kxdz5ln3rl9xh66nz66w46mm3g56ri1z5x815yqv"; + libName = "crypto_common"; authors = [ "RustCrypto Developers" ]; @@ -971,6 +984,7 @@ rec { version = "4.1.2"; edition = "2021"; sha256 = "0j7kqchcgycs4a11gvlda93h9w2jr05nn4hjpfyh2kn94a4pnrqa"; + libName = "curve25519_dalek"; authors = [ "Isis Lovecruft <isis@patternsinthevoid.net>" "Henry de Valence <hdevalence@hdevalence.ca>" @@ -1043,6 +1057,7 @@ rec { edition = "2021"; sha256 = "1cry71xxrr0mcy5my3fb502cwfxy6822k4pm19cwrilrg7hq4s7l"; procMacro = true; + libName = "curve25519_dalek_derive"; dependencies = [ { name = "proc-macro2"; @@ -1062,9 +1077,10 @@ rec { }; "data-encoding" = rec { crateName = "data-encoding"; - version = "2.5.0"; + version = "2.6.0"; edition = "2018"; - sha256 = "1rcbnwfmfxhlshzbn3r7srm3azqha3mn33yxyqxkzz2wpqcjm5ky"; + sha256 = "1qnn68n4vragxaxlkqcb1r28d3hhj43wch67lm4rpxlw89wnjmp8"; + libName = "data_encoding"; authors = [ "Julien Cretin <git@ia0.eu>" ]; @@ -1149,6 +1165,7 @@ rec { edition = "2018"; sha256 = "15cvgxqngxslgllz15m8aban6wqfgsi6nlhr0g25yfsnd6nq4lpg"; procMacro = true; + libName = "document_features"; libPath = "lib.rs"; authors = [ "Slint Developers <info@slint-ui.com>" @@ -1200,6 +1217,7 @@ rec { version = "2.1.1"; edition = "2021"; sha256 = "0w88cafwglg9hjizldbmlza0ns3hls81zk1bcih3m5m3h67algaa"; + libName = "ed25519_dalek"; authors = [ "isis lovecruft <isis@patternsinthevoid.net>" "Tony Arcieri <bascule@gmail.com>" @@ -1278,6 +1296,7 @@ rec { edition = "2018"; sha256 = "0k6wcf58h5kh64yq5nfq71va53kaya0kzxwsjwbgwm2n2zd9axxs"; procMacro = true; + libName = "enum_primitive_derive"; authors = [ "Doug Goldstein <cardoe@cardoe.com>" ]; @@ -1310,6 +1329,7 @@ rec { version = "0.2.6"; edition = "2018"; sha256 = "10hkkkjynhibvchznkxx81gwxqarn9i5sgz40d6xxb8xzhsz8xhn"; + libName = "fiat_crypto"; authors = [ "Fiat Crypto library authors <jgross@mit.edu>" ]; @@ -1358,6 +1378,7 @@ rec { version = "0.3.30"; edition = "2018"; sha256 = "0y6b7xxqdjm9hlcjpakcg41qfl7lihf6gavk8fyqijsxhvbzgj7a"; + libName = "futures_channel"; dependencies = [ { name = "futures-core"; @@ -1379,6 +1400,7 @@ rec { version = "0.3.30"; edition = "2018"; sha256 = "07aslayrn3lbggj54kci0ishmd1pr367fp7iks7adia1p05miinz"; + libName = "futures_core"; features = { "default" = [ "std" ]; "portable-atomic" = [ "dep:portable-atomic" ]; @@ -1392,6 +1414,7 @@ rec { edition = "2018"; sha256 = "1b49qh9d402y8nka4q6wvvj0c88qq91wbr192mdn5h54nzs0qxc7"; procMacro = true; + libName = "futures_macro"; dependencies = [ { name = "proc-macro2"; @@ -1414,6 +1437,7 @@ rec { version = "0.3.30"; edition = "2018"; sha256 = "1dag8xyyaya8n8mh8smx7x6w2dpmafg2din145v973a3hw7f1f4z"; + libName = "futures_sink"; features = { "default" = [ "std" ]; "std" = [ "alloc" ]; @@ -1425,6 +1449,7 @@ rec { version = "0.3.30"; edition = "2018"; sha256 = "013h1724454hj8qczp8vvs10qfiqrxr937qsrv6rhii68ahlzn1q"; + libName = "futures_task"; features = { "default" = [ "std" ]; "std" = [ "alloc" ]; @@ -1436,6 +1461,7 @@ rec { version = "0.3.30"; edition = "2018"; sha256 = "0j0xqhcir1zf2dcbpd421kgw6wvsk0rpxflylcysn1rlp3g02r1x"; + libName = "futures_util"; dependencies = [ { name = "futures-core"; @@ -1690,6 +1716,7 @@ rec { version = "0.3.9"; edition = "2021"; sha256 = "092hxjbjnq5fmz66grd9plxd0sh6ssg5fhgwwwqbrzgzkjwdycfj"; + libName = "hermit_abi"; authors = [ "Stefan Lankes" ]; @@ -1735,6 +1762,7 @@ rec { version = "1.0.0"; edition = "2018"; sha256 = "0hyn8n3iadrbwq8y0p1rl1275s4nm49bllw5wji29g4aa3dqbb0w"; + libName = "http_body"; authors = [ "Carl Lerche <me@carllerche.com>" "Lucio Franco <luciofranco14@gmail.com>" @@ -1757,6 +1785,7 @@ rec { version = "0.1.1"; edition = "2018"; sha256 = "07agldas2qgcfc05ckiarlmf9vzragbda823nqhrqrc6mjrghx84"; + libName = "http_body_util"; authors = [ "Carl Lerche <me@carllerche.com>" "Lucio Franco <luciofranco14@gmail.com>" @@ -1912,6 +1941,7 @@ rec { version = "0.1.3"; edition = "2021"; sha256 = "1akngan7j0n2n0wd25c6952mvqbkj9gp1lcwzyxjc0d37l8yyf6a"; + libName = "hyper_util"; authors = [ "Sean McArthur <sean@seanmonstar.com>" ]; @@ -2053,6 +2083,33 @@ rec { }; resolvedDefaultFeatures = [ "default" "extra_traits" "std" ]; }; + "libmimalloc-sys" = rec { + crateName = "libmimalloc-sys"; + version = "0.1.39"; + edition = "2018"; + links = "mimalloc"; + sha256 = "0i3b0dzz7cp0ik7ys66q92r16va78gwlbrnxhj5fnkdxsc8niai3"; + libName = "libmimalloc_sys"; + authors = [ + "Octavian Oncescu <octavonce@gmail.com>" + ]; + dependencies = [ + { + name = "libc"; + packageId = "libc"; + } + ]; + buildDependencies = [ + { + name = "cc"; + packageId = "cc"; + } + ]; + features = { + "cty" = [ "dep:cty" ]; + "extended" = [ "cty" ]; + }; + }; "litrs" = rec { crateName = "litrs"; version = "0.4.1"; @@ -2150,6 +2207,34 @@ rec { }; resolvedDefaultFeatures = [ "alloc" "default" "std" ]; }; + "mimalloc" = rec { + crateName = "mimalloc"; + version = "0.1.43"; + edition = "2018"; + sha256 = "0csnyrxc16i592gm5ffham07jyj2w98qsh9jyy1rv59lmr8474b8"; + authors = [ + "Octavian Oncescu <octavonce@gmail.com>" + "Vincent Rouillé <vincent@speedy37.fr>" + "Thom Chiovoloni <chiovolonit@gmail.com>" + ]; + dependencies = [ + { + name = "libmimalloc-sys"; + packageId = "libmimalloc-sys"; + usesDefaultFeatures = false; + } + ]; + features = { + "debug" = [ "libmimalloc-sys/debug" ]; + "debug_in_debug" = [ "libmimalloc-sys/debug_in_debug" ]; + "extended" = [ "libmimalloc-sys/extended" ]; + "local_dynamic_tls" = [ "libmimalloc-sys/local_dynamic_tls" ]; + "no_thp" = [ "libmimalloc-sys/no_thp" ]; + "override" = [ "libmimalloc-sys/override" ]; + "secure" = [ "libmimalloc-sys/secure" ]; + }; + resolvedDefaultFeatures = [ "default" ]; + }; "mime" = rec { crateName = "mime"; version = "0.3.17"; @@ -2165,6 +2250,7 @@ rec { version = "0.2.1"; edition = "2018"; sha256 = "16ppc5g84aijpri4jzv14rvcnslvlpphbszc7zzp6vfkddf4qdb8"; + libName = "minimal_lexical"; authors = [ "Alex Huszagh <ahuszagh@gmail.com>" ]; @@ -2286,12 +2372,8 @@ rec { version = "0.1.0"; edition = "2021"; crateBin = [ ]; - # We can't filter paths with references in Nix 2.4 - # See https://github.com/NixOS/nix/issues/5410 - src = - if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion)) - then lib.cleanSourceWith { filter = sourceFilter; src = ../../../tvix/nix-compat; } - else ../../../tvix/nix-compat; + src = lib.cleanSourceWith { filter = sourceFilter; src = ../../../tvix/nix-compat; }; + libName = "nix_compat"; dependencies = [ { name = "bitflags"; @@ -2323,6 +2405,10 @@ rec { packageId = "glob"; } { + name = "mimalloc"; + packageId = "mimalloc"; + } + { name = "nom"; packageId = "nom"; } @@ -2358,20 +2444,29 @@ rec { optional = true; features = [ "io-util" "macros" ]; } + { + name = "tracing"; + packageId = "tracing"; + } ]; devDependencies = [ { + name = "mimalloc"; + packageId = "mimalloc"; + } + { name = "serde_json"; packageId = "serde_json"; } ]; features = { "async" = [ "tokio" ]; + "default" = [ "async" "wire" ]; "pin-project-lite" = [ "dep:pin-project-lite" ]; "tokio" = [ "dep:tokio" ]; "wire" = [ "tokio" "pin-project-lite" ]; }; - resolvedDefaultFeatures = [ "pin-project-lite" "tokio" "wire" ]; + resolvedDefaultFeatures = [ "async" "default" "pin-project-lite" "tokio" "wire" ]; }; "nom" = rec { crateName = "nom"; @@ -2404,6 +2499,7 @@ rec { version = "0.46.0"; edition = "2018"; sha256 = "115sywxh53p190lyw97alm14nc004qj5jm5lvdj608z84rbida3p"; + libName = "nu_ansi_term"; authors = [ "ogham@bsago.me" "Ryan Scheel (Havvy) <ryan.havvy@gmail.com>" @@ -2432,6 +2528,7 @@ rec { version = "0.2.18"; edition = "2018"; sha256 = "0yjib8p2p9kzmaz48xwhs69w5dh1wipph9jgnillzd2x33jz03fs"; + libName = "num_traits"; authors = [ "The Rust Project Developers" ]; @@ -2602,6 +2699,7 @@ rec { version = "2.3.1"; edition = "2018"; sha256 = "0gi8wgx0dcy8rnv1kywdv98lwcx67hz0a0zwpib5v2i08r88y573"; + libName = "percent_encoding"; authors = [ "The rust-url developers" ]; @@ -2616,6 +2714,7 @@ rec { version = "1.1.5"; edition = "2021"; sha256 = "1cxl146x0q7lawp0m1826wsgj8mmmfs6ja8q7m6f7ff5j6vl7gxn"; + libName = "pin_project"; dependencies = [ { name = "pin-project-internal"; @@ -2630,6 +2729,7 @@ rec { edition = "2021"; sha256 = "0r9r4ivwiyqf45sv6b30l1dx282lxaax2f6gl84jwa3q590s8f1g"; procMacro = true; + libName = "pin_project_internal"; dependencies = [ { name = "proc-macro2"; @@ -2652,6 +2752,7 @@ rec { version = "0.2.13"; edition = "2018"; sha256 = "0n0bwr5qxlf0mhn2xkl36sy55118s9qmvx2yl5f3ixkb007lbywa"; + libName = "pin_project_lite"; }; "pin-utils" = rec { @@ -2659,6 +2760,7 @@ rec { version = "0.1.0"; edition = "2018"; sha256 = "117ir7vslsl2z1a7qzhws4pd01cg2d3338c47swjyvqv2n60v1wb"; + libName = "pin_utils"; authors = [ "Josef Brandl <mail@josefbrandl.de>" ]; @@ -2718,6 +2820,7 @@ rec { version = "1.0.79"; edition = "2021"; sha256 = "0bn004ybzdqid81cqppr5c9jrvqsxv50x60sxc41cwpmk0igydg8"; + libName = "proc_macro2"; authors = [ "David Tolnay <dtolnay@gmail.com>" "Alex Crichton <alex@alexcrichton.com>" @@ -2803,6 +2906,7 @@ rec { version = "0.4.6"; edition = "2021"; sha256 = "1spaq7y4im7s56d1gxa2hi4hzf6dwswb1bv8xyavzya7k25kpf46"; + libName = "regex_automata"; authors = [ "The Rust Project Developers" "Andrew Gallant <jamslam@gmail.com>" @@ -2843,6 +2947,7 @@ rec { version = "0.1.23"; edition = "2015"; sha256 = "0xnbk2bmyzshacjm2g1kd4zzv2y2az14bw3sjccq5qkpmsfvn9nn"; + libName = "rustc_demangle"; authors = [ "Alex Crichton <alex@alexcrichton.com>" ]; @@ -3119,6 +3224,7 @@ rec { version = "0.1.7"; edition = "2018"; sha256 = "1xipjr4nqsgw34k7a2cgj9zaasl2ds6jwn89886kww93d32a637l"; + libName = "sharded_slab"; authors = [ "Eliza Weisman <eliza@buoyant.io>" ]; @@ -3137,6 +3243,7 @@ rec { version = "1.4.1"; edition = "2015"; sha256 = "18crkkw5k82bvcx088xlf5g4n3772m24qhzgfan80nda7d3rn8nq"; + libName = "signal_hook_registry"; authors = [ "Michal 'vorner' Vaner <vorner@vorner.cz>" "Masaki Hara <ackie.h.gmai@gmail.com>" @@ -3359,6 +3466,7 @@ rec { edition = "2021"; sha256 = "1xylyqcb8rv5yh2yf97hg4n4kg27qccc0ijafr1zqklrhahkn7y6"; procMacro = true; + libName = "thiserror_impl"; authors = [ "David Tolnay <dtolnay@gmail.com>" ]; @@ -3513,6 +3621,7 @@ rec { version = "0.3.2"; edition = "2021"; sha256 = "00vkr1cywd2agn8jbkzwwf7y4ps3cfjm8l9ab697px2cgc97wdln"; + libName = "tokio_listener"; dependencies = [ { name = "axum"; @@ -3598,6 +3707,7 @@ rec { edition = "2021"; sha256 = "0fwjy4vdx1h9pi4g2nml72wi0fr27b5m954p13ji9anyy8l1x2jv"; procMacro = true; + libName = "tokio_macros"; authors = [ "Tokio Contributors <team@tokio.rs>" ]; @@ -3623,6 +3733,7 @@ rec { version = "0.1.14"; edition = "2021"; sha256 = "0hi8hcwavh5sdi1ivc9qc4yvyr32f153c212dpd7sb366y6rhz1r"; + libName = "tokio_stream"; authors = [ "Tokio Contributors <team@tokio.rs>" ]; @@ -3666,6 +3777,7 @@ rec { version = "0.4.4"; edition = "2021"; sha256 = "1xzri2m3dg8nzdyznm77nymvil9cyh1gfdfrbnska51iqfmvls14"; + libName = "tokio_test"; authors = [ "Tokio Contributors <team@tokio.rs>" ]; @@ -3706,6 +3818,7 @@ rec { version = "0.7.10"; edition = "2021"; sha256 = "058y6x4mf0fsqji9rfyb77qbfyc50y4pk2spqgj6xsyr693z66al"; + libName = "tokio_util"; authors = [ "Tokio Contributors <team@tokio.rs>" ]; @@ -3867,6 +3980,7 @@ rec { version = "0.3.2"; edition = "2018"; sha256 = "1l7i17k9vlssrdg4s3b0ia5jjkmmxsvv8s9y9ih0jfi8ssz8s362"; + libName = "tower_layer"; authors = [ "Tower Maintainers <team@tower-rs.com>" ]; @@ -3877,6 +3991,7 @@ rec { version = "0.3.2"; edition = "2018"; sha256 = "0lmfzmmvid2yp2l36mbavhmqgsvzqf7r2wiwz73ml4xmwaf1rg5n"; + libName = "tower_service"; authors = [ "Tower Maintainers <team@tower-rs.com>" ]; @@ -3935,6 +4050,7 @@ rec { edition = "2018"; sha256 = "1rvb5dn9z6d0xdj14r403z0af0bbaqhg02hq4jc97g5wds6lqw1l"; procMacro = true; + libName = "tracing_attributes"; authors = [ "Tokio Contributors <team@tokio.rs>" "Eliza Weisman <eliza@buoyant.io>" @@ -3963,6 +4079,7 @@ rec { version = "0.1.32"; edition = "2018"; sha256 = "0m5aglin3cdwxpvbg6kz0r9r0k31j48n0kcfwsp6l49z26k3svf0"; + libName = "tracing_core"; authors = [ "Tokio Contributors <team@tokio.rs>" ]; @@ -3993,6 +4110,7 @@ rec { version = "0.2.0"; edition = "2018"; sha256 = "1hs77z026k730ij1a9dhahzrl0s073gfa2hm5p0fbl0b80gmz1gf"; + libName = "tracing_log"; authors = [ "Tokio Contributors <team@tokio.rs>" ]; @@ -4024,6 +4142,7 @@ rec { version = "0.3.18"; edition = "2018"; sha256 = "12vs1bwk4kig1l2qqjbbn2nm5amwiqmkcmnznylzmnfvjy6083xd"; + libName = "tracing_subscriber"; authors = [ "Eliza Weisman <eliza@buoyant.io>" "David Barsky <me@davidbarsky.com>" @@ -4110,12 +4229,7 @@ rec { requiredFeatures = [ ]; } ]; - # We can't filter paths with references in Nix 2.4 - # See https://github.com/NixOS/nix/issues/5410 - src = - if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion)) - then lib.cleanSourceWith { filter = sourceFilter; src = ./.; } - else ./.; + src = lib.cleanSourceWith { filter = sourceFilter; src = ./.; }; dependencies = [ { name = "clap"; @@ -4173,6 +4287,7 @@ rec { version = "1.0.12"; edition = "2018"; sha256 = "0jzf1znfpb2gx8nr8mvmyqs1crnv79l57nxnbiszc7xf7ynbjm1k"; + libName = "unicode_ident"; authors = [ "David Tolnay <dtolnay@gmail.com>" ]; @@ -4242,12 +4357,12 @@ rec { { name = "winapi-i686-pc-windows-gnu"; packageId = "winapi-i686-pc-windows-gnu"; - target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "i686-pc-windows-gnu"); + target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "i686-pc-windows-gnu"); } { name = "winapi-x86_64-pc-windows-gnu"; packageId = "winapi-x86_64-pc-windows-gnu"; - target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "x86_64-pc-windows-gnu"); + target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "x86_64-pc-windows-gnu"); } ]; features = { @@ -4260,6 +4375,7 @@ rec { version = "0.4.0"; edition = "2015"; sha256 = "1dmpa6mvcvzz16zg6d5vrfy4bxgg541wxrcip7cnshi06v38ffxc"; + libName = "winapi_i686_pc_windows_gnu"; authors = [ "Peter Atashian <retep998@gmail.com>" ]; @@ -4270,6 +4386,7 @@ rec { version = "0.4.0"; edition = "2015"; sha256 = "0gqq64czqb64kskjryj8isp62m2sgvx25yyj3kpc2myh85w24bki"; + libName = "winapi_x86_64_pc_windows_gnu"; authors = [ "Peter Atashian <retep998@gmail.com>" ]; @@ -4280,6 +4397,7 @@ rec { version = "0.48.0"; edition = "2018"; sha256 = "1aan23v5gs7gya1lc46hqn9mdh8yph3fhxmhxlw36pn6pqc28zb7"; + libName = "windows_sys"; authors = [ "Microsoft" ]; @@ -4573,6 +4691,7 @@ rec { version = "0.52.0"; edition = "2021"; sha256 = "0gd3v4ji88490zgb6b5mq5zgbvwv7zx1ibn8v3x83rwcdbryaar8"; + libName = "windows_sys"; authors = [ "Microsoft" ]; @@ -4820,6 +4939,7 @@ rec { version = "0.48.5"; edition = "2018"; sha256 = "034ljxqshifs1lan89xwpcy1hp0lhdh4b5n0d2z4fwjx2piacbws"; + libName = "windows_targets"; authors = [ "Microsoft" ]; @@ -4827,7 +4947,7 @@ rec { { name = "windows_aarch64_gnullvm"; packageId = "windows_aarch64_gnullvm 0.48.5"; - target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "aarch64-pc-windows-gnullvm"); + target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "aarch64-pc-windows-gnullvm"); } { name = "windows_aarch64_msvc"; @@ -4852,7 +4972,7 @@ rec { { name = "windows_x86_64_gnullvm"; packageId = "windows_x86_64_gnullvm 0.48.5"; - target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "x86_64-pc-windows-gnullvm"); + target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "x86_64-pc-windows-gnullvm"); } { name = "windows_x86_64_msvc"; @@ -4867,6 +4987,7 @@ rec { version = "0.52.4"; edition = "2021"; sha256 = "06sdd7fin3dj9cmlg6n1dw0n1l10jhn9b8ckz1cqf0drb9z7plvx"; + libName = "windows_targets"; authors = [ "Microsoft" ]; @@ -4874,7 +4995,7 @@ rec { { name = "windows_aarch64_gnullvm"; packageId = "windows_aarch64_gnullvm 0.52.4"; - target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "aarch64-pc-windows-gnullvm"); + target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "aarch64-pc-windows-gnullvm"); } { name = "windows_aarch64_msvc"; @@ -4899,7 +5020,7 @@ rec { { name = "windows_x86_64_gnullvm"; packageId = "windows_x86_64_gnullvm 0.52.4"; - target = { target, features }: (pkgs.rust.lib.toRustTarget stdenv.hostPlatform == "x86_64-pc-windows-gnullvm"); + target = { target, features }: (stdenv.hostPlatform.rust.rustcTarget == "x86_64-pc-windows-gnullvm"); } { name = "windows_x86_64_msvc"; @@ -5081,14 +5202,11 @@ rec { fuchsia = true; test = false; - /* We are choosing an arbitrary rust version to grab `lib` from, - which is unfortunate, but `lib` has been version-agnostic the - whole time so this is good enough for now. - */ - os = pkgs.rust.lib.toTargetOs platform; - arch = pkgs.rust.lib.toTargetArch platform; - family = pkgs.rust.lib.toTargetFamily platform; - vendor = pkgs.rust.lib.toTargetVendor platform; + inherit (platform.rust.platform) + arch + os + vendor; + family = platform.rust.platform.target-family; env = "gnu"; endian = if platform.parsed.cpu.significantByte.name == "littleEndian" @@ -5178,51 +5296,41 @@ rec { testPostRun ]); in - pkgs.runCommand "run-tests-${testCrate.name}" - { - inherit testCrateFlags; - buildInputs = testInputs; - } '' - set -e + pkgs.stdenvNoCC.mkDerivation { + name = "run-tests-${testCrate.name}"; - export RUST_BACKTRACE=1 + inherit (crate) src; - # recreate a file hierarchy as when running tests with cargo + inherit testCrateFlags; - # the source for test data - # It's necessary to locate the source in $NIX_BUILD_TOP/source/ - # instead of $NIX_BUILD_TOP/ - # because we compiled those test binaries in the former and not the latter. - # So all paths will expect source tree to be there and not in the build top directly. - # For example: $NIX_BUILD_TOP := /build in general, if you ask yourself. - # TODO(raitobezarius): I believe there could be more edge cases if `crate.sourceRoot` - # do exist but it's very hard to reason about them, so let's wait until the first bug report. - mkdir -p source/ - cd source/ + buildInputs = testInputs; - ${pkgs.buildPackages.xorg.lndir}/bin/lndir ${crate.src} + buildPhase = '' + set -e + export RUST_BACKTRACE=1 - # build outputs - testRoot=target/debug - mkdir -p $testRoot + # build outputs + testRoot=target/debug + mkdir -p $testRoot - # executables of the crate - # we copy to prevent std::env::current_exe() to resolve to a store location - for i in ${crate}/bin/*; do - cp "$i" "$testRoot" - done - chmod +w -R . + # executables of the crate + # we copy to prevent std::env::current_exe() to resolve to a store location + for i in ${crate}/bin/*; do + cp "$i" "$testRoot" + done + chmod +w -R . - # test harness executables are suffixed with a hash, like cargo does - # this allows to prevent name collision with the main - # executables of the crate - hash=$(basename $out) - for file in ${drv}/tests/*; do - f=$testRoot/$(basename $file)-$hash - cp $file $f - ${testCommand} - done - ''; + # test harness executables are suffixed with a hash, like cargo does + # this allows to prevent name collision with the main + # executables of the crate + hash=$(basename $out) + for file in ${drv}/tests/*; do + f=$testRoot/$(basename $file)-$hash + cp $file $f + ${testCommand} + done + ''; + }; in pkgs.runCommand "${crate.name}-linked" { @@ -5331,7 +5439,7 @@ rec { let self = { crates = lib.mapAttrs (packageId: value: buildByPackageIdForPkgsImpl self pkgs packageId) crateConfigs; - target = makeTarget pkgs.stdenv.hostPlatform; + target = makeTarget stdenv.hostPlatform; build = mkBuiltByPackageIdByPkgs pkgs.buildPackages; }; in @@ -5406,8 +5514,6 @@ rec { buildRustCrateForPkgsFunc pkgs ( crateConfig // { - # https://github.com/NixOS/nixpkgs/issues/218712 - dontStrip = stdenv.hostPlatform.isDarwin; src = crateConfig.src or ( pkgs.fetchurl rec { name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz"; |