From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Pierre-Henry F." Subject: Help defining a trivial package. Date: Thu, 29 Aug 2019 11:23:26 +0000 Message-ID: References: <87sgppfnha.fsf@ngyro.com> Reply-To: "Pierre-Henry F." Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:58034) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i3Ich-0007lp-H7 for help-guix@gnu.org; Thu, 29 Aug 2019 07:29:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i3Ice-00023t-M6 for help-guix@gnu.org; Thu, 29 Aug 2019 07:29:51 -0400 Received: from mail-40132.protonmail.ch ([185.70.40.132]:59502) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i3Ice-0001zy-8Y for help-guix@gnu.org; Thu, 29 Aug 2019 07:29:48 -0400 In-Reply-To: <87sgppfnha.fsf@ngyro.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Timothy Sample Cc: "help-guix\\@gnu.org" > As a note for the future, it would be helpful to include the error > message that you saw when things went wrong. Here, I=E2=80=99m assuming = that > Guix said: > > guix build: error: #: not something we can build > > Running =E2=80=9Cguix build --file=3DX=E2=80=9D causes Guix to build the = last expression > evaluated in the file =E2=80=9CX=E2=80=9D. In your case, the last expres= sion that gets > evaluated is the =E2=80=9Cdefine-public=E2=80=9D form, which returns an u= nspecified > value. > > While testing, you can put =E2=80=9Cblog=E2=80=9D at the bottom of the fi= le, causing > Guix to build your defined =E2=80=9Cblog=E2=80=9D 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 . =E2=94=9C=E2=94=80=E2=94=80 bin =E2=94=82 =E2=94=94=E2=94=80=E2=94=80 program =E2=94=94=E2=94=80=E2=94=80 src =E2=94=94=E2=94=80=E2=94=80 hello_world.py $ cat src/hello_world.py print("Hello world!") $ cat bin/program #! /usr/bin/env bash script_path=3D"${BASH_SOURCE[0]}" script_dir=3D"$(dirname $script_path)" python3 "$script_dir/../src/hello_world.py" 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 workin= g using the docs. This is how the package looks to far: (use-modules (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 buil= d deamon is ;; supposed to execute on the behalf of the user. (define build-drv (gexp->derivation "the-thing" #~(begin (mkdir #$output) (chdir #$output) (symlink (string-append #$coreutils "/bin/ls") "list-files")))) (package (name "blog") (version "3") (source (origin (method url-fetch) (uri (string-append "/home/phf/programs/blog/releases/release_" ver= sion ".tar.lz")) (sha256 (base32 "1y819b53ksyas6asldysr0r8p73n5i8ipbpmbgjrfx8qz8cy2zsx")))) (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 "http://www.gnu.org/software/hello/") (license gpl3+)) Assuming everything else is correct, would you please help refine ~build-dr= v~ until it matches the ~bash~ above ? This is what the execution trace looks like: phf@f02c:~/tools/guix/packages$ guix build --keep-failed --verbosity=3D2 = --file=3D./blog.scm substitute: updating substitutes from 'https://ci.guix.gnu.org'... 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' fail= ed with exit code 1 build of /gnu/store/8b0gyazhgmc9rkrxir7vxpav0x28xk3d-blog-3.drv failed View build log at '/var/log/guix/drvs/8b/0gyazhgmc9rkrxir7vxpav0x28xk3d-b= log-3.drv.bz2'. 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 ! PHF