Subject: [bug#77093] [PATCH rust-team v2 17/17] doc: Document lockfile importer based Rust packaging workflow.

From: Hilton Chain <[email-masked]>
Date: Wed, 19 Mar 2025 19:34:46 +0800

On Wed, 19 Mar 2025 14:52:32 +0800,
Efraim Flashner wrote:
>
> > +Let's demonstrate the packaging workflow by examples, note that package-specific
> > +issues are not involved here.
> > +
> > +In preparation, we'll add the following packages to our environment:
> > +
> > +@example
> > +guix shell rust rust:cargo cargo-audit cargo-license
> > +@end example
>
> I was able to run cargo-audit as 'cargo-audit audit ...' but I wouldn't
> actually recommend that to anyone.  I'm not sure we actually need rust
> in the shell but I don't have a strong preference.  More thinking aloud,

‘cargo generate-lockfile’ sometimes requires rust.

> perhaps we should adjust rust:cargo to automatically pull in rust:out?

Sounds reasonable.

> I also find it amusing to suggest using cargo-audit when it's not (yet)
> in guix and we immediately follow up with importing it.

XD yes, it's funny to use cargo-audit audit cargo-audit, and cargo-license to
check license of cargo-license.

> I could see an argument for putting this part in the cookbook instead of
> here but I feel strongly that it should be here.
> > [...]
> > +@item
> > +@code{niri} also has Cargo workspace dependencies.  When packaging a Cargo
> > +workspace, build argument @code{#:cargo-package-crates} is required.
> > +
> > +@lisp
> > +(define-public rust-pipewire-for-niri
> > +  (let ((commit "fd3d8f7861a29c2eeaa4c393402e013578bb36d9")
> > +        (revision "0"))
> > +    (package
> > +      (name "rust-pipewire")
> > +      (version (git-version "0.8.0" revision commit))
> > +      (source
> > +       (origin
> > +         (method git-fetch)
> > +         (uri (git-reference
> > +               (url "https://gitlab.freedesktop.org/pipewire/pipewire-rs.git")
> > +               (commit commit)))
> > +         (file-name (git-file-name name version))
> > +         (sha256
> > +          (base32 "1hzyhz7xg0mz8a5y9j6yil513p1m610q3j9pzf6q55vdh5mcn79v"))))
> > +      (build-system cargo-build-system)
> > +      (arguments
> > +       (list #:skip-build? #t
> > +             #:cargo-package-crates
> > +             ''("libspa-sys" "libspa" "pipewire-sys" "pipewire")))
> > +      (inputs (cargo-inputs 'rust-pipewire-for-niri))
>
> should these be inputs or propagated-inputs? in rust-ring-0.17 in
> rust-sources they are propagated. I would think inputs would be enough
> since the Cargo.lock file will let us know which other crates are
> necessary for actually building it as a dependency of that package.

For rust-ring-0.17 the propagation is necessary, I think this is because our
packaged version is a bit older than the one used in generated lockfile.