all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "(" <paren@disroot.org>
To: Timothy Washington <twashing@gmail.com>
Cc: help-guix@gnu.org
Subject: Re: Howto supply cargo-build-system dependency to guix package definition
Date: Fri, 28 Apr 2023 15:23:53 +0100	[thread overview]
Message-ID: <87mt2s9iy6.fsf@disroot.org> (raw)
In-Reply-To: <CAADtM-Zbj3Oynd3yWbr2wQawTsOZyPoouKyJ994Xf0ekBAQrVA@mail.gmail.com>

Timothy Washington <twashing@gmail.com> writes:
> ..the build fails on missing "cidr-utils". Now "cidr-utils" is in Rust's crates.io. 
> But is that what Guix' cargo-build-system is referencing? 
> Otherwise, do we need to create a Guix .scm (scheme definition)?

Guix can't grab things from the internet during the build for
reproducibility reasons, so it uses a Cargo feature that lets you
substitute the registry for a directory full of tarballed crates, and
unpacks all the CARGO-INPUTS there (this is why CARGO-BUILD-SYSTEM uses
its own input list rather than just INPUTS).

It seems like Guix doesn't have RUST-CIDR-UTILS yet:

```
$ guix show rust-cidr-utils
guix show: error: rust-cidr-utils: package not found
```

You don't have to write the package definition manually, though:

```
$ guix import crate cidr-utils
(define-public rust-cidr-utils-0.5
  (package
    (name "rust-cidr-utils")
    (version "0.5.10")
    (source (origin
              (method url-fetch)
              (uri (crate-uri "cidr-utils" version))
              (file-name (string-append name "-" version ".tar.gz"))
              (sha256
               (base32
                "0750jbxvdbyyxcqnzsw438158r9drs2g077ymx9r9lv193q3dypx"))))
    (build-system cargo-build-system)
    (arguments
     `(#:cargo-inputs (("rust-debug-helper" ,rust-debug-helper-0.3)
                       ("rust-num-bigint" ,rust-num-bigint-0.4)
                       ("rust-num-traits" ,rust-num-traits-0.2)
                       ("rust-once-cell" ,rust-once-cell-1)
                       ("rust-regex" ,rust-regex-1)
                       ("rust-serde" ,rust-serde-1))))
    (home-page "https://magiclen.org/cidr-utils")
    (synopsis
     "This crate provides data structures and functions to deal with IPv4 CIDRs and IPv6 CIDRs.")
    (description
     "This crate provides data structures and functions to deal with IPv4 CIDRs and
IPv6 CIDRs.")
    (license license:expat)))
```

Above your main package definition, you should copy in this package, and
you'll want to edit the SYNOPSIS and DESCRIPTION to make them less alike
and make them follow the usual style:

```
(synopsis "CIDR library for IPv4 and IPv6")
(description
 "This package provides a crate for dealing with Classless Inter-Domain
Routing in IPv4 and IPv6.")
```

Now you can just use RUST-CIDR-UTILS-0.5 like any other crate.


  reply	other threads:[~2023-04-28 14:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-23 16:18 Howto supply cargo-build-system dependency to guix package definition Timothy Washington
2023-04-24  6:19 ` (
2023-04-24  6:23   ` (
2023-04-25  3:48     ` Timothy Washington
2023-04-25  5:56       ` (
2023-04-25 20:44         ` Timothy Washington
2023-04-26  5:43           ` (
2023-04-27  4:53             ` Timothy Washington
2023-04-27 16:36               ` (
2023-04-28  3:06                 ` Timothy Washington
2023-04-28 14:23                   ` ( [this message]
2023-04-28 20:08                     ` Timothy Washington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mt2s9iy6.fsf@disroot.org \
    --to=paren@disroot.org \
    --cc=help-guix@gnu.org \
    --cc=twashing@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.