ngi-nix/ngipkgs

RASN

fricklerhandwerk opened this issue ยท 11 comments

Safe ASN.1 codec framework for Rust

This is a Rust library, and likely to be a small overall effort.

Please contact the author @XAMPPRocky to coordinate. You can open issues on their repository.

This looks like an easy one.

Thank you for mentioning, let me know if there's a good way to mention the nix package in the upstream repository. ๐Ÿ™‚

@cleeyv maybe you could share your ideas or plans on this.

I took a look at RASN, and I don't understand what should be packaged here.

So, what's the expectation?

jfly commented

There's no Cargo.toml in the repo since 4bb207a.

@lorenzleutgeb you mean Cargo.lock, yes? I see a Cargo.toml in this repo: https://github.com/XAMPPRocky/rasn/blob/main/Cargo.toml

I think your high level question is spot on, though: this feels like a Rust library, and @ngi-nix/fungus's recent experience packaging mCaptcha has taught us that the nixpkgs Rust machinery does not require that we package Rust dependencies as idiomatic nix derivations in order to use them.

Yes rasn is a rust library.

There are a few fn main entrypoints, but it's not clear which is the canonical one.

The first two are for the fuzzer which is for development only, the third one is just an example program.

The last one is an actual program (it's a compiler that generates Rust [maybe other languages in the future] code from ASN.1 specifications), similar to protoc. It's currently still in "pre-alpha" state, but the hope is eventually that it would be something that we distribute to users.

I don't use nix myself, so I would defer to the people here on the best practices for packaging a Rust library.

In reply to @jfly:

There's no Cargo.toml in the repo since 4bb207a.

@lorenzleutgeb you mean Cargo.lock, yes?

Of course. Sorry.

I think your high level question is spot on, though: this feels like a Rust library, and @ngi-nix/fungus's recent experience packaging mCaptcha has taught us that the nixpkgs Rust machinery require that we package Rust dependencies as idiomatic nix derivations in order to use them.

Hmm okay, then probably I need to learn more. I thought that buildRustPackage (as you use in your mCaptcha branch) is only for building applications. But you seem to be talking about libraries (like RASN is)? Wouldn't buildRustCrate be the mkDerivation wrapper to use for libraries? I don't even find any usages in nixpkgs.

jfly commented

Sorry, I had a big typo in my message. Fixed:

our recent experience packaging mCaptcha has taught us that the nixpkgs Rust machinery does not require that we package Rust dependencies as idiomatic nix derivations in order to use them.

Sounds like the code generator can be a user-facing package. Since it's still in the works, it may make most sense to keep it upstream, as someone would have to fix breaking updates here. @XAMPPRocky what do you think?

Going over this with @mightyiam, here is what we think:

  • Rust library crates generally do not benefit from being packaged with Nix
  • The compiler is in "pre-alpha" state, so packaging it might be premature

When you'd like the compiler packaged, please let us know.

Seems like there's nothing to do here right now. @XAMPPRocky please comment when ready.