On Wed, Feb 26, 2025 at 02:43:33PM +0800, Hilton Chain wrote: > On Tue, 25 Feb 2025 06:26:57 +0800, > Hilton Chain wrote: > > > > I'm working on the generator in: > > https://git.boiledscript.com/hako/guix/commits/branch/origin-crates > > > > Next step is to integrate cargo2guix, I expect to have a working demo within > > this week. > > Time to try in your own channel!!!
Probably need to change the headers in cargo2guix to not say it's not a part of Guix :) > --8<---------------cut here---------------start------------->8--- > guix time-machine --no-channel-files > --url=https://git.boiledscript.com/hako/guix.git --branch=origin-crates > --disable-authentication \ > import --insert <MODULE FILE> crate --lockfile=<LOCKFILE> <NAME> > --8<---------------cut here---------------end--------------->8--- > > A mirror is available at https://codeberg.org/hako/guix-mirror.git in case > cloning from my server is slow for you. > > > Module boilerplate: > --8<---------------cut here---------------start------------->8--- > (define-module (<...>) > #:use-module (guix gexp) > #:use-module (guix packages) > #:use-module (guix download) > #:use-module (guix git-download) > #:use-module (guix build-system cargo)) > > ;;; > ;;; *-cargo-inputs and crates definitions > ;;; > ;;; This file is managed by ‘guix import’. DO NOT add definitions manually. > ;;; > --8<---------------cut here---------------end--------------->8--- > > NAME-cargo-inputs will be defined as a list in MODULE, and can be used with > ‘(force NAME-cargo-inputs)’ and modify it with append, cons etc., e.g. > --8<---------------cut here---------------start------------->8--- > (use-modules MODULE) > (package > ... > (inputs (force NAME-cargo-inputs))) > --8<---------------cut here---------------end--------------->8--- > > > Examples: > * Module creation: > https://git.boiledscript.com/hako/guix/commit/76ee706140045b16b74d68723b3b959b6e768720 > > * Update zoxide: > https://git.boiledscript.com/hako/guix/commit/76ee706140045b16b74d68723b3b959b6e768720 > > * Remove #:cargo-inputs for librsvg: > https://git.boiledscript.com/hako/guix/commit/003708b472448b2abd64227ff8947cc9abf143e2 > > > TODO: > * Support directory and Cargo workspace input in cargo-build-system I was looking closely at cargo2guix earlier this week, and I hacked up that if a [[package]] had a source but no checksum it was a git reference, and if it had no source and no checksum then it must be inside the workspace. > I have modified cargo2guix to support git checkouts but commented it out due > to > lack of cargo-build-system support. Looking at guix/build/cargo-build-system, the "easiest" option would be to take the git-checkout and then turn it into a .tar.gz. Otherwise crate-src? and 'configure would need to be adjusted to handle git checkouts. > * Deletion of unused variables > > I have deletion logic in mind but don't know how to implement it at the > moment: > --8<---------------cut here---------------start------------->8--- > While reading file MODULE, find definitions > If the definition is ‘(delay (list ...))’, add content of the list to > REFERENCES. > Otherwise add the definition name to VARIABLES > > UNUSED_VARIABLES = VARIABLES - REFERENCES > > Delete UNUSED_VARIABLES from MODULES in one go. > --8<---------------cut here---------------end--------------->8--- Would it be easier to have 1 package per module, as in just the cargo inputs for zoxide in gnu/packages/rust-crates/zoxide.scm, and then you wouldn't need to worry about removing variables that aren't used by zoxide anymore but are used by another package? > * Package cargo-audio[1] and cargo-license[2] or similiar software, and write > a > step-by-step packaging workflow. > > [1] https://github.com/rustsec/rustsec/tree/main/cargo-audit > [2] https://github.com/onur/cargo-license What's the reasoning behind delay and force for the <package>-cargo-inputs? I think the source-only cargo inputs shouldn't be public variables, only the <package>-cargo-inputs variable. -- Efraim Flashner <efr...@flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted
signature.asc
Description: PGP signature