2023-01-31 12:18:03 +01:00
|
|
|
[package]
|
|
|
|
name = "nix-compat"
|
|
|
|
version = "0.1.0"
|
|
|
|
edition = "2021"
|
|
|
|
|
2023-10-09 23:06:02 +02:00
|
|
|
[features]
|
2024-05-26 19:33:18 +02:00
|
|
|
# async NAR writer. Also needs the `wire` feature.
|
2024-04-10 15:33:02 +02:00
|
|
|
async = ["tokio"]
|
2024-04-10 13:54:11 +02:00
|
|
|
# code emitting low-level packets used in the daemon protocol.
|
2024-07-20 11:25:04 +02:00
|
|
|
wire = ["tokio", "pin-project-lite", "bytes"]
|
2024-07-22 16:51:42 +02:00
|
|
|
test = []
|
2023-10-09 23:06:02 +02:00
|
|
|
|
2024-04-18 11:57:10 +02:00
|
|
|
# Enable all features by default.
|
2024-07-22 16:51:42 +02:00
|
|
|
default = ["async", "wire", "nix-compat-derive"]
|
2024-04-18 11:57:10 +02:00
|
|
|
|
2023-01-31 12:18:03 +01:00
|
|
|
[dependencies]
|
2023-11-10 17:19:02 +01:00
|
|
|
bitflags = "2.4.1"
|
2023-07-29 21:14:44 +02:00
|
|
|
bstr = { version = "1.6.0", features = ["alloc", "unicode", "serde"] }
|
2024-06-30 18:54:27 +02:00
|
|
|
data-encoding = "2.6.0"
|
2023-11-19 21:21:24 +01:00
|
|
|
ed25519 = "2.2.3"
|
|
|
|
ed25519-dalek = "2.1.0"
|
2024-03-21 09:52:21 +01:00
|
|
|
enum-primitive-derive = "0.3.0"
|
2023-07-31 15:46:39 +02:00
|
|
|
glob = "0.3.0"
|
2024-08-07 23:21:26 +02:00
|
|
|
mimalloc = "0.1.43"
|
2023-07-31 15:46:39 +02:00
|
|
|
nom = "7.1.3"
|
2024-03-21 09:52:21 +01:00
|
|
|
num-traits = "0.2.18"
|
2023-01-31 14:45:42 +01:00
|
|
|
serde = { version = "1.0", features = ["derive"] }
|
2023-03-14 17:16:05 +01:00
|
|
|
serde_json = "1.0"
|
2023-01-31 12:18:03 +01:00
|
|
|
sha2 = "0.10.6"
|
|
|
|
thiserror = "1.0.38"
|
feat(nix-compat/nix_http): init parse_nar[info]_str
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
2024-08-21 10:06:12 +02:00
|
|
|
tracing = "0.1.37"
|
2023-01-31 12:18:03 +01:00
|
|
|
|
2024-07-20 11:25:04 +02:00
|
|
|
[dependencies.bytes]
|
|
|
|
optional = true
|
|
|
|
version = "1.6.1"
|
|
|
|
|
2024-07-22 16:51:42 +02:00
|
|
|
[dependencies.nix-compat-derive]
|
|
|
|
path = "../nix-compat-derive"
|
|
|
|
optional = true
|
|
|
|
default-features = false
|
|
|
|
|
feat(nix-compat/wire): add low-level wire format primitives code
This brings some initial Nix wire format parsing code, used in the nix
daemon protocol, remote store/builder protocol, as well as the NAR
format itself (note we already have more specialized code for the last
one).
Thanks to embr, this code already exists, in
https://codeberg.org/gorgon/gorgon/src/branch/main/nix-daemon/src/wire.rs,
and we can vendor it into here, as EUPL is compatible with GPL (in that
direction).
The code uses the tokio::io Reader and Writer traits, not the ones from
the `futures` crate, as they provide some more convenient `read_u64_le`
functions.
More application-specific parsing code, as well as code to read strings,
or bytes are left out for now, as we want to be be more restrictive
w.r.t allowed max sizes, and need to parse bytes, not strings.
The code slightly diverges, as we have clippy looped into CI.
`Ok(…?)` can be turned into just the inner expression, and
some .and_then can be expressed in a simpler fashion.
Change-Id: Ie3adcb485e9d66786673b1962a08d4e5df3781d9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11148
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr>
2024-03-14 14:08:05 +01:00
|
|
|
[dependencies.tokio]
|
|
|
|
optional = true
|
|
|
|
version = "1.32.0"
|
|
|
|
features = ["io-util", "macros"]
|
|
|
|
|
2024-04-04 18:03:44 +02:00
|
|
|
[dependencies.pin-project-lite]
|
|
|
|
optional = true
|
|
|
|
version = "0.2.13"
|
|
|
|
|
2023-01-31 12:18:03 +01:00
|
|
|
[dev-dependencies]
|
2024-04-08 16:59:05 +02:00
|
|
|
criterion = { version = "0.5", features = ["html_reports"] }
|
2023-12-24 21:56:48 +01:00
|
|
|
futures = { version = "0.3.30", default-features = false, features = ["executor"] }
|
2024-04-08 16:59:05 +02:00
|
|
|
hex-literal = "0.4.1"
|
2023-10-14 22:34:18 +02:00
|
|
|
lazy_static = "1.4.0"
|
2024-08-07 23:21:26 +02:00
|
|
|
mimalloc = "0.1.43"
|
2024-04-08 16:59:05 +02:00
|
|
|
pretty_assertions = "1.4.0"
|
|
|
|
rstest = "0.19.0"
|
2023-01-31 14:45:42 +01:00
|
|
|
serde_json = "1.0"
|
2024-08-19 15:57:26 +02:00
|
|
|
smol_str = "0.2.2"
|
feat(nix-compat/wire): add low-level wire format primitives code
This brings some initial Nix wire format parsing code, used in the nix
daemon protocol, remote store/builder protocol, as well as the NAR
format itself (note we already have more specialized code for the last
one).
Thanks to embr, this code already exists, in
https://codeberg.org/gorgon/gorgon/src/branch/main/nix-daemon/src/wire.rs,
and we can vendor it into here, as EUPL is compatible with GPL (in that
direction).
The code uses the tokio::io Reader and Writer traits, not the ones from
the `futures` crate, as they provide some more convenient `read_u64_le`
functions.
More application-specific parsing code, as well as code to read strings,
or bytes are left out for now, as we want to be be more restrictive
w.r.t allowed max sizes, and need to parse bytes, not strings.
The code slightly diverges, as we have clippy looped into CI.
`Ok(…?)` can be turned into just the inner expression, and
some .and_then can be expressed in a simpler fashion.
Change-Id: Ie3adcb485e9d66786673b1962a08d4e5df3781d9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11148
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr>
2024-03-14 14:08:05 +01:00
|
|
|
tokio-test = "0.4.3"
|
2024-03-07 15:37:27 +01:00
|
|
|
zstd = "^0.13.0"
|
2023-01-31 14:45:42 +01:00
|
|
|
|
2023-07-31 17:50:48 +02:00
|
|
|
[[bench]]
|
|
|
|
name = "derivation_parse_aterm"
|
|
|
|
harness = false
|
2023-10-27 12:54:31 +02:00
|
|
|
|
|
|
|
[[bench]]
|
|
|
|
name = "narinfo_parse"
|
|
|
|
harness = false
|