help-guix
[Top][All Lists]
Advanced

[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: Fri, 23 Aug 2019 19:42:56 +0000

Hello!

Would someone help defining a trivial package?

Essentially:

    …/releases$ tree

    .

    ├── release_1.tar.lz

    ├── release_2.tar.lz

    └── release_3.tar.lz

    …/release_3$ tree

    .

    ├── bin

    │   └── program

    └── src

        └── hello_world.py

    …/release_3$ cat ./bin/program

    #! /usr/bin/env bash

    script_path="${BASH_SOURCE[0]}"

    script_dir="$(dirname $script_path)"

    python3 "$script_dir/../src/hello_world.py"

    …/release_3$ ./bin/program

    Hello world!

Defining this package would mean:

  1. download the release_3.tar.lz

  2. uncompress release_3.tar.lz

  3. add ~…/release_3/bin~ to the path

     - where ~…~ is the path in the store

-----------------------------------------

expected conclusion:

  $ which program

  …/release_3/bin/program

  $ program

  Hello World!

Here is an attempt at defining the package (incomplete, does not work) in 
blog.scm:

    (define-module (blog)

      #:use-module (guix packages)

      #:use-module (guix download)

      #:use-module (guix build-system trivial)

      #:use-module (guix licenses)

      #:use-module (gnu packages python))

    (define-public blog

      (package

        (name "blog")

        (version "3")

        (source

          (origin

            (method url-fetch)

            (uri (string-append "/home/phf/programs/blog/release_" version 
".tar.lz"))

            (sha256

              (base32

                "1y819b53ksyas6asldysr0r8p73n5i8ipbpmbgjrfx8qz8cy2zsx"))))

        (build-system trivial-build-system)

        (arguments

          '(#:builder #~(begin

                          (mkdir #$output)

                          (chdir #$output)

                          ...

                          )))

        (inputs `(("python" ,python)))

        (synopsis "Guix 'hello world' to learn about Guix")

        (license gpl3+)))

Here is the line that I use to try to build and debug along the way:

    $ guix build --keep-failed --verbosity=2 --file=./blog.scm

Thank you for your answers !

Pierre-Henry

reply via email to

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