Hi!

How do i define a new package which is just a variation of a given
package defined in guix?

In my concrete example i try to add a new board definition file via a
patch to the u-boot bootloader. What i come up with, looks like this:

```
;; Defines a package ub which will compile u-boot for the
;; `new-cool-board` description file

(define ub (make-u-boot-package "new-cool-board" "arm-linux-gnueabihf"))

(define-public u-boot-new-cool-board-arm
  (package
    (inherit ub)
    (version "2024.01")
    (source (origin
              (patches '("0001-Add-board-description-for-new-cool-board.patch"))
              (method url-fetch)
              (uri (string-append
                    "https://ftp.denx.de/pub/u-boot/";
                    "u-boot-" version ".tar.bz2"))
              (sha256
               (base32
                "1czmpszalc6b8cj9j7q6cxcy19lnijv3916w3dag6yr3xpqi35mr"))))))

```

I create a u-boot variant for my "new-cool-board" using the build in
`make-u-boot-package` function, then i define a new package and inherit
from the package variant created with the `make-u-boot-package`
function. Then i overwrite `source` entry with an entry which also
applies my patch file. This works, however the original u-boot package
also apply some patches, which are now lost and must manually added by
me again. This seems rather error prone. Is there a better solution?

I saw that you can also apply patches via package transformation, but i
can't get it to work. I have tried the following:

```test.scm

(define u-boot-new-cool-board
  (make-u-boot-package "new-cool-board" "arm-linux-gnueabihf"))

(define transform
  (options->transformation
   '((with-patch
   . 
"u-boot-new-cool-board=/home/icepic/guix/raspberry/touchscreen/0001-Add-board-description-for-new-cool-board.patch"))))

(transform u-boot-new-cool-board)

```

If i now build the test.scm with

`guix build -f test.scm --target=arm-linux-gnueabihf -v3 -K`

my patch is not applied and the build fails, because there is no target
for "new-cool-board".

Thanks for your help!


-- 
Best regards

Christoph

Reply via email to