[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help defining a trivial package.

From: Pierre-Henry F.
Subject: Help defining a trivial package.
Date: Thu, 29 Aug 2019 11:23:26 +0000

> As a note for the future, it would be helpful to include the error
> message that you saw when things went wrong.  Here, I’m assuming that
> Guix said:
>     guix build: error: #<unspecified>: not something we can build
> Running “guix build --file=X” causes Guix to build the last expression
> evaluated in the file “X”.  In your case, the last expression that gets
> evaluated is the “define-public” form, which returns an unspecified
> value.
> While testing, you can put “blog” at the bottom of the file, causing
> Guix to build your defined “blog” package.
> Hope that helps!
> -- Tim

Great :-) !

So, we have, in ~bash~:

  $ lzip --decompress release_3.tar.lz
  $ tar xf release_3.tar
  $ cd blog/ # coming from the preceding line.
  $ tree
  ├── bin
  │   └── program
  └── src

  $ cat src/
  print("Hello world!")

  $ cat bin/program
  #! /usr/bin/env bash

  script_dir="$(dirname $script_path)"
  python3 "$script_dir/../src/"

That's it.

The idea is to build a Guix package that does exactly that.
Expected outcome:

  $ guix package -s blog
  # fetch release_3.tar.lz
  # uncompress ...
  # ...

  $ program
  Hello World!

My question: how to build that Guix package?  I try to get something working 
the docs.  This is how the package looks to far:

    (guix packages)
    (guix download)
    (guix build-system trivial)
    (guix licenses)
    (guix gexp)
    (gnu packages base)
    (gnu packages python))

  ;; The "derivation" i.e. low level sequence of instructions that the build 
deamon is
  ;; supposed to execute on the behalf of the user.
  (define build-drv
          (mkdir #$output)
          (chdir #$output)
          (symlink (string-append #$coreutils "/bin/ls")

    (name "blog")
    (version "3")
        (method url-fetch)
        (uri (string-append "/home/phf/programs/blog/releases/release_" version 
    (build-system trivial-build-system)
    (arguments `(#:builder ,build-drv))

    (inputs `(("python" ,python)))
    (synopsis "Guix 'hello world' to learn about Guix")
    (description "Guess what GNU Hello prints!")
    (home-page "";)
    (license gpl3+))

Assuming everything else is correct, would you please help refine ~build-drv~ 
it matches the ~bash~ above ?

This is what the execution trace looks like:

  phf@f02c:~/tools/guix/packages$ guix build --keep-failed --verbosity=2 
  substitute: updating substitutes from ''... 100.0%
  building /gnu/store/8b0gyazhgmc9rkrxir7vxpav0x28xk3d-blog-3.drv...
  ERROR: In procedure primitive-load:
  In procedure scm_lreadr: 
/gnu/store/zlbf2x6n4084v0cpw2rh9dydqmi5b2rn-blog-3-guile-builder:1:10: Unknown 
# object: #\<
  note: keeping build directory `/tmp/guix-build-blog-3.drv-2'
  builder for `/gnu/store/8b0gyazhgmc9rkrxir7vxpav0x28xk3d-blog-3.drv' failed 
with exit code 1
  build of /gnu/store/8b0gyazhgmc9rkrxir7vxpav0x28xk3d-blog-3.drv failed
  View build log at 
  guix build: error: build of 
`/gnu/store/8b0gyazhgmc9rkrxir7vxpav0x28xk3d-blog-3.drv' failed

  phf@f02c:~/tools/guix/packages$ ll /tmp/guix-build-blog-3.drv-2
  total 140K
  drwxr-xr-x  2 phf  phf  4.0K Aug 29 13:14 ./
  drwxrwxrwt 21 root root 132K Aug 29 13:14 ../

Thanks !

reply via email to

[Prev in Thread] Current Thread [Next in Thread]