unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Alex Kost <alezost@gmail.com>
To: John J Foerch <jjfoerch@earthlink.net>
Cc: help-guix@gnu.org
Subject: Re: simplest package definition?
Date: Thu, 25 Aug 2016 11:19:55 +0300	[thread overview]
Message-ID: <87fuptb6qc.fsf@gmail.com> (raw)
In-Reply-To: <87fuptslku.fsf@hecubus.retroj.net> (John J. Foerch's message of "Wed, 24 Aug 2016 21:07:13 -0400")

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

John J Foerch (2016-08-25 04:07 +0300) wrote:

> Hello Guix,
>
> What is the simplest possible package definition, to install a single
> shell script?  If possible, I would like to install it from the
> directory in which I'm developing it, and the package definition would
> also be in a file in this directory.

So you have some dir and 2 files there: "my-shell-script" and
"guix.scm", right?  If you don't care about shebang (I mean if you have
"#!/bin/sh" in the script, it will not be changed to
/gnu/store/.../bash), then you can use trivial-build-system.  So the
contents of "guix.scm" can be:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: guix-script-test.scm --]
[-- Type: text/x-scheme, Size: 824 bytes --]

(use-modules
 (guix gexp)
 (guix packages)
 (guix build-system trivial))

(let ((script-name "my-shell-script"))
  (package
    (name script-name)
    (version "0.1")
    (source (local-file (string-append (dirname (current-filename))
                                       "/" script-name)))
    (build-system trivial-build-system)
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let* ((bin-dir  (string-append %output "/bin"))
                (bin-file (string-append bin-dir "/" ,script-name)))
           (mkdir-p bin-dir)
           (copy-file (assoc-ref %build-inputs "source") bin-file)
           (chmod bin-file #o555)))))
    (home-page #f)
    (synopsis "bla bla")
    (description "More verbose bla bla")
    (license #f)))

[-- Attachment #3: Type: text/plain, Size: 244 bytes --]


Use "guix build -f .../guix.scm" to build it.

If you care about shebang, I think you need to use gnu-build-system
(there is a phase that patches shebangs), but it requires removing many
phases and probably some additional tweaking.

-- 
Alex

  reply	other threads:[~2016-08-25  8:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25  1:07 simplest package definition? John J Foerch
2016-08-25  8:19 ` Alex Kost [this message]
2016-08-25  8:52   ` Alex Kost
2016-08-25  9:03     ` Vincent Legoll
2016-08-25 13:42     ` John J Foerch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fuptb6qc.fsf@gmail.com \
    --to=alezost@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=jjfoerch@earthlink.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).