unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: raingloom <raingloom@riseup.net>, guix-devel@gnu.org
Subject: Re: Building hexyl (a rust app) without cargo, with antioxidant-build-system
Date: Wed, 06 Apr 2022 12:10:59 +0200	[thread overview]
Message-ID: <eea4fd5ba7ac321a16bb54386fbeeb2ff1d37ce1.camel@telenet.be> (raw)
In-Reply-To: <20220406002829.3f48dd37@riseup.net>

[-- Attachment #1: Type: text/plain, Size: 4102 bytes --]

raingloom schreef op wo 06-04-2022 om 00:28 [+0200]:
> I'm also a bit worried with the trend of Guix trying to duplicate
> functionality already present in language package managers and config
> file formats. It creates a two-sources-of-truth situation.

For service configurations, there is only one source of truth: the
configuration record.  It just happens to be converted to another
format.  The underlying file format, TOML is not Cargo-specific
(https://toml.io/en/) and parsed with python-toml, presumably python-
toml parses it correctly.  (Whether antioxidant-build-system interprets
it correctly, is of course a different matter.)

Also, Cargo is both a package manager and a build system.  The package
manager part is useless to Guix, we even have to work-around it (see
e.g. patch-cargo-checksums, crate-closure).  Unfortunately, there does
not seem to be a way to only use the build system part of Cargo and
ignore the package manager part, so the build system part has to be
reimplemented ...

> Trying to keep one up to date with the other can be an issue, this is why I
> didn't create a custom record type for Yggdrasil config files and just
> used a generic JSON converter. Which paid off, since there were in fact
> changes in the config fields between versions.

The configuration record fields does not have to support every new
thing, it just haves to be _sufficiently_ up to date for users.  And if
a configuration field that's needed is missing, then it's almost
trivial to add it.

Additionally, some services have an 'extra-content' escape hatch. 
yggrasil-configuration could have one too, then the user could have
both write most things as Scheme (benefit: largely unified interface,
more automation possible) _and_ be able to use the latest features not
yet directly supported by the configuraiton fields, via the escape
hatch.

> Will this build system avoid that issue as well?

antioxidant-build-system is a build system, not a configuration format.

I've found that most Cargo.toml are rather tame.  They often just set:

  * name
  * Some metadata like version, authors, home-page, include, exclude
    ... that antioxidant-build-system doesn't need.
  * sometimes 'build' or 'path'
  * dependencies  / dev-dependencies / build-dependencies, also
    unneeded by antioxidant-build-system (the importer might need them,
    but that's a separate component)

Looking at <https://doc.rust-lang.org/cargo/reference/manifest.html>,
there are some more things are things that antioxidant-build-system
doesn't need:

  * resolver
  * badges, [[bench]]
  * the [patch] and [replace]  --- just use a variant package in the
    package inputs

Now, there are some things that aren't yet supported by antioxidant-
build-system but probably need to be:

  * autobins / autoexamples / autotests / [lib] / [bin] / [example]
    / [links]
  * setting various environment variables before build.rs
    (there's probably some list somewhere ...)

But aside from that, it seems that the essential parts of Cargo.toml
are rather tame and unlikely to be added to.  And if something
essential is added anyway and needs to be supported, then it should be
easy to modify antioxidant-build-system appropriately (long-term)
and/or work-around it by setting some environment variables locally or
maybe some substitute* (short-term).

> I guess if the data it operates on has truly stable semantics, then
> writing an independent implementation is not as big a problem, since
> once written and debugged, it won't need to change.
> (And getting rid of cargo would be nice for Rust dev on Guix.)

AFAICT, the parts important to Guix are sufficiently stable -- not
immutable (sometimes changes do happen).  And even if it was unstable,
it still seems much better than just using Cargo (due to much shorter
build times, less strict about versions, not having to add winapi
crates when compiling for Linux, no copying tarballs around, no
#:cargo-inputs instead of [propagated-]inputs ...).

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2022-04-06 10:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04  5:10 Building hexyl (a rust app) without cargo, with antioxidant-build-system Brendan Tildesley
2022-04-04  9:26 ` Maxime Devos
2022-04-05 22:28   ` raingloom
2022-04-06 10:10     ` Maxime Devos [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-03-31 11:55 Removing #:skip-build? from the crate importer? Maxime Devos
2022-03-31 19:47 ` Hartmut Goebel
2022-03-31 20:06   ` Compiling rust things without cargo (super WIP POC) Maxime Devos
2022-04-02 15:18     ` Building hexyl (a rust app) without cargo, with antioxidant-build-system Maxime Devos
2022-04-05 16:10       ` Maxime Devos
2022-04-06 15:49         ` Hartmut Goebel
2022-04-06 16:06           ` Maxime Devos
2022-05-30  8:23       ` Efraim Flashner
2022-05-30 13:37         ` raingloom
2022-05-30 15:15         ` Maxime Devos

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=eea4fd5ba7ac321a16bb54386fbeeb2ff1d37ce1.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=guix-devel@gnu.org \
    --cc=raingloom@riseup.net \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).