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!!!

--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 have modified cargo2guix to support git checkouts but commented it out due to
lack of cargo-build-system support.

* 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---

* 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

Reply via email to