From: Timothy Washington <twashing@gmail.com>
To: "(" <paren@disroot.org>
Cc: help-guix@gnu.org
Subject: Re: Howto supply cargo-build-system dependency to guix package definition
Date: Fri, 28 Apr 2023 16:08:45 -0400 [thread overview]
Message-ID: <CAADtM-ahiioLYT8pBTehDZbJfPySQ3tFdUqQJWxS1mgHCbL0sQ@mail.gmail.com> (raw)
In-Reply-To: <87mt2s9iy6.fsf@disroot.org>
Beauutiful!
A. Actually the "guix import crate" command set off a light bulb... Can't I
just pull in those dependencies recursively. And indeed you can. The only
reason I needed to pull in those crates, were as dependencies to rustscan
<https://crates.io/crates/rustscan>. So I went back to the beginning and
ran a recursive import on rustscan.
$ guix import crate -r rustscan
...
$ guix build -L ~/dotfiles/ rust-rustscan-2
phase `check' succeeded after 0.0 seconds
starting phase `install'
Installing rustscan v2.1.1
(/tmp/guix-build-rust-rustscan-2.1.1.drv-0/rustscan-2.1.1)
Finished release [optimized] target(s) in 0.19s
Installing
/gnu/store/10sivvy746n5jdnsgny5afxpwa5yzy5f-rust-rustscan-2.1.1/bin/rustscan
Installed package `rustscan v2.1.1
(/tmp/guix-build-rust-rustscan-2.1.1.drv-0/rustscan-2.1.1)` (executable
`rustscan`)
warning: be sure to add
`/gnu/store/10sivvy746n5jdnsgny5afxpwa5yzy5f-rust-rustscan-2.1.1/bin` to
your PATH to be able to run the
...
successfully built
/gnu/store/58bdgq64bdxkhwjvfmragj4xq8h7grhb-rust-rustscan-2.1.1.drv
/gnu/store/10sivvy746n5jdnsgny5afxpwa5yzy5f-rust-rustscan-2.1.1
B. Should I supply this to an upstream configuration? Or should each user
run their own "guix import"?
I'm happy to supply this as a definition if need be.
And thanks again!
Tim
On Fri, 28 Apr 2023 at 10:31, ( <paren@disroot.org> wrote:
> 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.
>
prev parent reply other threads:[~2023-05-01 15:03 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 ` (
2023-04-28 20:08 ` Timothy Washington [this message]
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=CAADtM-ahiioLYT8pBTehDZbJfPySQ3tFdUqQJWxS1mgHCbL0sQ@mail.gmail.com \
--to=twashing@gmail.com \
--cc=help-guix@gnu.org \
--cc=paren@disroot.org \
/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.