Hi there,

I'm attempting to package a Rust program, `kak-tree-sitter`, that's available as a crate, but am having some difficulties. I'll try to describe what I've done so far... it's possible I'm doing something very obviously wrong as I'm quite new to Guix.

The program relies on another crate, `kak-tree-sitter-config`, that I think Guix should consider "private package". Both `kak-tree-sitter` and `kak-tree-sitter-config` use a single git repository to store their source code.

As suggested by the documentation about common workflows for Rust packaging I have used `guix import` to get a list of crate dependencies for both `kak-tree-sitter` and `kak-tree-sitter-config`:

    cd $HOME/Dev/kak-tree-sitter

    guix import \
      --insert=$HOME/Dev/guix/gnu/packages/rust-crates.scm \
      crate --lockfile=./Cargo.lock kak-tree-sitter

    guix import \
      --insert=$HOME/Dev/guix/gnu/packages/rust-crates.scm \
      crate --lockfile=./Cargo.lock kak-tree-sitter-config

This appears to have worked as intended but did not provide a definition for `kak-tree-sitter-config`, so I manually added a `rust-` prefixed entry to `rust-sources.scm` and to `rust-crates.scm`.

In addition to that, I have added package entries for both `kak-tree-sitter` and `kak-tree-sitter-config` to the `text-editors.scm` package list for now:

    # gnu/packages/rust-sources.scm
    (define-public rust-kak-tree-sitter-config-3.0.0
      (hidden-package
       (package
        (name "rust-kak-tree-sitter-config")
        (version "3.0.0")
        (source (origin
                  (method url-fetch)
                  (uri (crate-uri "kak-tree-sitter-config" version))
                  (file-name (string-append name "-v" version ".tar.gz"))
                  (sha256
                   (base32 "1s2g4z1yrh1sxl4qkmpd19ss3x2lr9115vbir7pnhgy63r1d63yv"))))
        (build-system cargo-build-system)
        (inputs (cargo-inptus 'rust-kak-tree-sitter-config-3.0.0))
        (home-page "https://sh.rt/~hadronized/kak-tree-sitter";)
        (synopsis "Configuration package for kak-tree-sitter")
        (description "Configuration package for kak-tree-sitter")
        (license license:bsd-3))))

    # gnu/packages/rust-crates.scm
    (define rust-kak-tree-sitter-config-3.0.0
      (crate-source "kak-tree-sitter-config" "3.0.0"
"0mcpy1gdxpqayc74i3x3ayh3q5bl6dzvsgmw91jq1r9sjkxill0r"))

    # gnu/packages/text-editors.csm
    (define-public kak-tree-sitter
      (package
        (name "kak-tree-sitter")
        (version "2.0.0")
        (source
         (origin
           (method url-fetch)
           (uri (crate-uri "kak-tree-sitter" version))
           (file-name (string-append name "-" version ".tar.gz"))
           (sha256
            (base32 "0kmilfxfm426jgkdvp2n668iwfi56v08bhv2wgp7hi4yf24kygl2"))))
        (build-system cargo-build-system)
        (inputs (cargo-inputs 'kak-tree-sitter))
        (home-page "https://sr.ht/~hadronized/kak-tree-sitter/";)
        (synopsis "Server between Kakoune and tree-sitter")
        (description
         "This package provides Server between Kakoune and tree-sitter.")
        (license license:bsd-3)))

    (define-public kak-tree-sitter-config
      (package
        (name "kak-tree-sitter-config")
        (version "3.0.0")
        (source
         (origin
           (method url-fetch)
           (uri (crate-uri "kak-tree-sitter-config" version))
           (file-name (string-append name "-" version ".tar.gz"))
           (sha256
            (base32 "03yjv9rsc5l8ky4dc5s1b3sg7fhfl9nsz2mgv42lsvqifidjkqqj"))))
        (build-system cargo-build-system)
        (inputs (cargo-inputs 'kak-tree-sitter-config))
        (home-page "https://sr.ht/~hadronized/kak-tree-sitter";)
        (synopsis "Server between Kakoune and tree-sitter; configuration layer")
        (description
         "This package provides Server between Kakoune and tree-sitter; configuration layer.")
        (license license:bsd-3)))

Despite my having defined these packages, running `./pre-inst-env guix build kak-tree-sitter` results in in an error, `no matching package named 'kak-tree-sitter-config'` despite there being both a `kak-tree-sitter-config` and `rust-kak-tree-sitter-config` defined, as well as a real crate on htths://crates.io. Here is the error and stack trace following:

    error: no matching package named `kak-tree-sitter-config` found
    location searched: directory source `/tmp/guix-build-kak-tree-sitter-2.0.0.drv-0/kak-tree-sitter-2.0.0/guix-vendor` (which is replacing registry `crates-io`)     required by package `kak-tree-sitter v2.0.0 (/tmp/guix-build-kak-tree-sitter-2.0.0.drv-0/kak-tree-sitter-2.0.0)`     As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too confusing you may wish to retry without the offline flag.
    error: in phase 'build': uncaught exception:
    %exception #<&invoke-error program: "cargo" arguments: ("build" "--offline" "-j" "16" "--release") exit-status: 101 term-signal: #f stop-signal: #f>
    phase `build' failed after 0.1 seconds
    command "cargo" "build" "--offline" "-j" "16" "--release" failed with status 101
    build process 18 exited with status 256
    note: keeping build directory `/tmp/guix-build-kak-tree-sitter-2.0.0.drv-15'     builder for `/gnu/store/nh4scf63kl9fisgf4fdmndrr93x1hfc1-kak-tree-sitter-2.0.0.drv' failed with exit code 1     build of /gnu/store/nh4scf63kl9fisgf4fdmndrr93x1hfc1-kak-tree-sitter-2.0.0.drv failed     View build log at '/var/log/guix/drvs/nh/4scf63kl9fisgf4fdmndrr93x1hfc1-kak-tree-sitter-2.0.0.drv.gz'.     guix build: error: build of `/gnu/store/nh4scf63kl9fisgf4fdmndrr93x1hfc1-kak-tree-sitter-2.0.0.drv' failed


So, it seems likely that I am missing *something* and have probably defined more things called `kak-tree-sitter-config` than I actually need to. But I'm not sure what actions to take next. Would appreciate any hints you have to get be started in the right direction.

Thanks!
Benjamin


Reply via email to