unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* How do I define a package?
@ 2018-08-14 22:22 Luther Thompson
  2018-08-14 22:32 ` Pierre Neidhardt
  0 siblings, 1 reply; 5+ messages in thread
From: Luther Thompson @ 2018-08-14 22:22 UTC (permalink / raw)
  To: help-guix

I'm trying to define a package for a new program I'm writing. After
looking through the manual, this is my best guess for what to do:

I put this guix.scm in my source directory:

(define-module (gnu packages doses)
  #:use-module (guix build-system scons)
  #:use-module (guix gexp)
  #:use-module (guix licenses)
  #:use-module (guix packages))

(define-public doses
  (package
   (name "doses")
   (version "0.0.0")
   (source (local-file "." "doses" #:recursive? #t))
   (build-system scons-build-system)
   (synopsis "A program.")
   (description "A description of a program.")
   (license cc0)
   (home-page "https://github.com/luther9")))


I then ran `guix package --install-from-file=guix.scm`. This gave no
output and did not create a new generation.

So, what do I do next?

Luther

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How do I define a package?
  2018-08-14 22:22 How do I define a package? Luther Thompson
@ 2018-08-14 22:32 ` Pierre Neidhardt
  2018-08-16 22:34   ` Luther Thompson
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Neidhardt @ 2018-08-14 22:32 UTC (permalink / raw)
  To: Luther Thompson; +Cc: help-guix

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

From `guix package --help`

--8<---------------cut here---------------start------------->8---
  -f, --install-from-file=FILE
                         install the package that the code within FILE
                         evaluates to
--8<---------------cut here---------------end--------------->8---

In your file, the last top-level expression
is not a package, so `guix package --install-from-file=FILE` does nothing.

Add this last line

--8<---------------cut here---------------start------------->8---
doses
--8<---------------cut here---------------end--------------->8---

and you should be good to go!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How do I define a package?
  2018-08-14 22:32 ` Pierre Neidhardt
@ 2018-08-16 22:34   ` Luther Thompson
  2018-08-22  6:01     ` Leo Famulari
  0 siblings, 1 reply; 5+ messages in thread
From: Luther Thompson @ 2018-08-16 22:34 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

On Wed, 15 Aug 2018 00:32:26 +0200
Pierre Neidhardt <ambrevar@gmail.com> wrote:
> In your file, the last top-level expression
> is not a package, so `guix package --install-from-file=FILE` does
> nothing.
> 
> Add this last line
> 
> --8<---------------cut here---------------start------------->8---
> doses
> --8<---------------cut here---------------end--------------->8---
> 
> and you should be good to go!

Ok, got it. Seems kind of obvious now that you say it. Thanks.

My next issue is that it won't install. I see this in the middle of
the build output:

starting phase `install'
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: *** [/usr] /usr: Permission denied
scons: building terminated because of errors.

As I understand it, every package has its own store directory, which
mirrors FHS, and all the package's files get installed there. I expect
Guix to install files to my package's store directory, but it looks
like it wants to install to the root filesystem instead. I might need
to add an `arguments` field to my package, but I'm not sure what to put
in it.

Also, my Sconscript has `env.Install('/usr/local/bin', 'doses')` for
its install target, which specifies the standard place to install files
in other OSes. Does scons-build-system assume some kind of different
usage, like maybe a relative path?

Luther

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How do I define a package?
  2018-08-16 22:34   ` Luther Thompson
@ 2018-08-22  6:01     ` Leo Famulari
  2018-08-29 22:40       ` Luther Thompson
  0 siblings, 1 reply; 5+ messages in thread
From: Leo Famulari @ 2018-08-22  6:01 UTC (permalink / raw)
  To: Luther Thompson; +Cc: help-guix

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

On Thu, Aug 16, 2018 at 06:34:30PM -0400, Luther Thompson wrote:
> My next issue is that it won't install. I see this in the middle of
> the build output:
> 
> starting phase `install'
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> scons: *** [/usr] /usr: Permission denied
> scons: building terminated because of errors.
> 
> As I understand it, every package has its own store directory, which
> mirrors FHS, and all the package's files get installed there. I expect
> Guix to install files to my package's store directory, but it looks
> like it wants to install to the root filesystem instead. I might need
> to add an `arguments` field to my package, but I'm not sure what to put
> in it.

Looking at some other Guix packages using the scons-build-system, it
seems like the Sconscripts usually take a 'PREFIX' or 'prefix' argument
that should contain the output directory in /gnu/store.

For example:

------
    (build-system scons-build-system)
    (arguments
     `(#:tests? #f  ;no tests
       #:scons-flags
       (list (string-append "prefix=" (assoc-ref %outputs "out")))
------

Which is from the aria-maestosa package:

https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/music.scm?id=dc695341f77c6c5326fd0aca78f94bf8ac0212f8#n150

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How do I define a package?
  2018-08-22  6:01     ` Leo Famulari
@ 2018-08-29 22:40       ` Luther Thompson
  0 siblings, 0 replies; 5+ messages in thread
From: Luther Thompson @ 2018-08-29 22:40 UTC (permalink / raw)
  To: Leo Famulari; +Cc: help-guix, Pierre Neidhardt

On Wed, 22 Aug 2018 02:01:26 -0400
Leo Famulari <leo@famulari.name> wrote:
> Looking at some other Guix packages using the scons-build-system, it
> seems like the Sconscripts usually take a 'PREFIX' or 'prefix'
> argument that should contain the output directory in /gnu/store.
> 
> For example:
> 
> ------
>     (build-system scons-build-system)
>     (arguments
>      `(#:tests? #f  ;no tests
>        #:scons-flags
>        (list (string-append "prefix=" (assoc-ref %outputs "out")))
> ------

That fixed it. Thanks!

For other people reading this, the "prefix=" is an arbitrary argument
that the SConstruct has to look for in the ARGUMENTS dict. For example,
I used `ARGUMENTS.get('prefix', '/usr/local')`.

Regards,
Luther

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-29 22:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-14 22:22 How do I define a package? Luther Thompson
2018-08-14 22:32 ` Pierre Neidhardt
2018-08-16 22:34   ` Luther Thompson
2018-08-22  6:01     ` Leo Famulari
2018-08-29 22:40       ` Luther Thompson

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).