[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Minimal working examples of packages for experimentation?
From: |
Jelle Licht |
Subject: |
Re: Minimal working examples of packages for experimentation? |
Date: |
Mon, 27 Feb 2023 22:33:16 +0100 |
Hello Rodrigo!
Rodrigo Morales <moralesrodrigo1100@gmail.com> writes:
> [snip]
> The following is the package that I wrote.
>
> ,----
> | (define-module (my-simple)
> | #:use-module (guix licenses)
> | #:use-module (guix packages)
> | #:use-module (guix gexp)
> | #:use-module (guix build-system trivial)
> | #:use-module (guix download))
> |
> | (define-public my-simple-1
> | (package
> | (name "my-simple-1")
> | (version "2.10")
> | (source (origin
> | (method url-fetch)
> | (uri "
> https://www.gnu.org/graphics/heckert_gnu.transp.small.png")
> | (sha256 (base32
> "1686w7x3qk85i5693nrj7lbdh64232fdsqd5rgxgijv1y39rldbr"))))
> | (build-system trivial-build-system)
> | (synopsis "My synopsis")
> | (description "My description")
> | (home-page "https://example.org/")
> | (license gpl3+)))
> `----
> [snip]
> 3 What I'm looking for
> ======================
>
> 1. Why the package that I wrote failing? How could I fix it?
Looking at `info "(guix) Build Systems"'[0], in the blurb about the
trivial-build-system:
--8<---------------cut here---------------start------------->8---
This build system requires a ‘#:builder’ argument. This argument
must be a Scheme expression that builds the package output(s)—as
with ‘build-expression->derivation’ (*note
‘build-expression->derivation’: Derivations.).
--8<---------------cut here---------------end--------------->8---
The reason your package fails to build, is that it doesn't provide such
a #:builder argument. This argument is also responsible for creating the
actual output, which can be a file or directory.
The simplest snippet I can think of for making your package "work":
--8<---------------cut here---------------start------------->8---
(define-public my-simple-1
(package
; .. existing stuff
(arguments (list #:builder #~(mkdir #$output)))))
--8<---------------cut here---------------end--------------->8---
Note that this simply creates the output directory, and does nothing
else.
What may seem a bit misleading here is that "build expressions" have
mostly been ported to this hip thing called G-Expressions (see `info
"(guix) G-Expressions"' [1]).
> 2. Do you know simpler package definitions (aka minimal working
> examples) that I could use for experimenting?
Simple does not always imply easy. If we're talking about an easy to use
build system, I think the `copy-build-system' could work, as does the
gnu-build-system as it allows you to play with the moving parts without
having to supply all of these moving parts yourself :).
A package that uses the trivial-build-system that does slightly more is
`inxi-minimal', which you can find by issuing a `guix edit inxi-minimal'.
HTH!
- Jelle
[0]:
https://guix.gnu.org/manual/devel/en/html_node/Build-Systems.html#index-trivial_002dbuild_002dsystem
[1]: https://guix.gnu.org/manual/devel/en/html_node/G_002dExpressions.html