all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using local package in shell manifest
@ 2023-10-25 20:49 Jesse
  2023-10-26 14:16 ` Tomas Volf
  0 siblings, 1 reply; 4+ messages in thread
From: Jesse @ 2023-10-25 20:49 UTC (permalink / raw)
  To: help-guix

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

Hello,

I have written a package that I have installed with "guix package 
--install-from-file=crosstool-ng.scm". I was able to get it to build and 
install. I can use it if I do "source ~/.guix-profile/etc/profile".

However, I would like to add it to a shell manifest. My manifest just 
includes

(specifications->manifest
   (list "gcc" "git" "zsh" "crosstool-ng"))

My understanding is that "specifications->manifest" is supposed to 
search for the packages in the list? It returns the following when I 
rung "guix shell" in the directory with the manifest.scm:

guix shell: loading environment from 
'/home/jesse/Code/guix-tests/manifest.scm'...
hint: Consider passing the `--check' option once to make sure your shell 
does not
clobber environment variables.

guix shell: error: crosstool-ng: unknown package
guix shell: error: failed to load 
'/home/jesse/Code/guix-tests/manifest.scm':
gnu/packages.scm:545:4: In procedure specification->package+output:
Throw to key `quit' with args `(1)'.

I'd imagine it doesn't know where to look for the package? Is there a 
way to tell guix shell where to look? If not, is there a way to include 
the package in the manifest file? For what it's worth, I have attached 
the package file in question.

This is also my first foray into Guix and Guile, so I've been kind of 
banging my head through writing a package and the manual but I got a 
little stuck here.

Thanks

[-- Attachment #2: crosstool-ng.scm --]
[-- Type: text/x-scheme, Size: 1628 bytes --]

(use-modules
 (guix packages)
 (guix git-download)
 (guix licenses)
 (guix profiles)
 (guix build-system gnu)
 (guix build-system python)
 (guix build utils)
 (gnu packages python)
 (gnu packages autotools)
 (gnu packages gettext)
 (gnu packages texinfo)
 (gnu packages pkg-config)
 (gnu packages base)
 (gnu packages flex)
 (gnu packages gawk)
 (gnu packages man)
 (gnu packages bison)
 (gnu packages compression)
 (gnu packages ncurses)
 )

(package
 (name "crosstool-ng")
 (version "1.26.0")
 (source (origin
          (method git-fetch)
          (uri (git-reference
                (url "https://github.com/crosstool-ng/crosstool-ng.git")
                (commit (string-append "crosstool-ng-" version))))
          (sha256
           (base32
            "04z7zwhxfbjqrd4j16lviilppsd8phwi8zv2rs4jpkmqni6856j1")
           )
          ))
 (build-system gnu-build-system)
 (native-inputs
  (list autoconf
        automake
        gettext-minimal
        libtool
        texinfo
        bison
        flex
        gawk
        unzip
        which
        help2man
        python
        ncurses
        pkg-config))
 (arguments
  '(#:phases (modify-phases %standard-phases
                            (add-before 'bootstrap 'fix-version-gen
                                        (lambda* _
                                                 (patch-shebang "maintainer/git-version-gen")
                                                 )))))

 (synopsis "A versatile (cross-)toolchain generator.")
 (description "A versatile (cross-)toolchain generator.")
 (home-page "https://crosstool-ng.github.io/docs/")
 (license gpl2)
 )

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

* Re: Using local package in shell manifest
  2023-10-25 20:49 Using local package in shell manifest Jesse
@ 2023-10-26 14:16 ` Tomas Volf
  2023-10-26 14:48   ` Jesse
  0 siblings, 1 reply; 4+ messages in thread
From: Tomas Volf @ 2023-10-26 14:16 UTC (permalink / raw)
  To: Jesse; +Cc: help-guix

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

On 2023-10-25 16:49:43 -0400, Jesse wrote:
> Hello,
> 
> I have written a package that I have installed with "guix package
> --install-from-file=crosstool-ng.scm". I was able to get it to build and
> install. I can use it if I do "source ~/.guix-profile/etc/profile".
> 
> However, I would like to add it to a shell manifest. My manifest just
> includes
> 
> (specifications->manifest
>   (list "gcc" "git" "zsh" "crosstool-ng"))
> 
> My understanding is that "specifications->manifest" is supposed to search
> for the packages in the list? It returns the following when I rung "guix
> shell" in the directory with the manifest.scm:
> 
> guix shell: loading environment from
> '/home/jesse/Code/guix-tests/manifest.scm'...
> hint: Consider passing the `--check' option once to make sure your shell
> does not
> clobber environment variables.
> 
> guix shell: error: crosstool-ng: unknown package
> guix shell: error: failed to load
> '/home/jesse/Code/guix-tests/manifest.scm':
> gnu/packages.scm:545:4: In procedure specification->package+output:
> Throw to key `quit' with args `(1)'.
> 
> I'd imagine it doesn't know where to look for the package? Is there a way to
> tell guix shell where to look? If not, is there a way to include the package
> in the manifest file? For what it's worth, I have attached the package file
> in question.

I can think of few options:

0. If it would make sense to upstream the package, you should.  That will solve
your problem.

1. Next you could create your own channel, and publish the package there.  After
adding the channel, it should also just work.

2. You could load the package by an absolute path and use it that way, something
like this (untested):

(concatenate-manifests
 (list (specifications->manifest (list "gcc" "git" "zsh"))
       (packages->manifest (list (load "/home/.../crosstool-ng.scm")))))

3. Alternative of the above would be to move the package definition into the
manifest.scm itself, allowing you to drop the load invocation.

Dunno, maybe there are better ways.

> 
> This is also my first foray into Guix and Guile, so I've been kind of
> banging my head through writing a package and the manual but I got a little
> stuck here.
> 
> Thanks

> (use-modules
>  (guix packages)
>  (guix git-download)
>  (guix licenses)
>  (guix profiles)
>  (guix build-system gnu)
>  (guix build-system python)
>  (guix build utils)
>  (gnu packages python)
>  (gnu packages autotools)
>  (gnu packages gettext)
>  (gnu packages texinfo)
>  (gnu packages pkg-config)
>  (gnu packages base)
>  (gnu packages flex)
>  (gnu packages gawk)
>  (gnu packages man)
>  (gnu packages bison)
>  (gnu packages compression)
>  (gnu packages ncurses)
>  )
> 
> (package
>  (name "crosstool-ng")
>  (version "1.26.0")
>  (source (origin
>           (method git-fetch)
>           (uri (git-reference
>                 (url "https://github.com/crosstool-ng/crosstool-ng.git")
>                 (commit (string-append "crosstool-ng-" version))))
>           (sha256
>            (base32
>             "04z7zwhxfbjqrd4j16lviilppsd8phwi8zv2rs4jpkmqni6856j1")
>            )
>           ))
>  (build-system gnu-build-system)
>  (native-inputs
>   (list autoconf
>         automake
>         gettext-minimal
>         libtool
>         texinfo
>         bison
>         flex
>         gawk
>         unzip
>         which
>         help2man
>         python
>         ncurses
>         pkg-config))
>  (arguments
>   '(#:phases (modify-phases %standard-phases
>                             (add-before 'bootstrap 'fix-version-gen
>                                         (lambda* _
>                                                  (patch-shebang "maintainer/git-version-gen")
>                                                  )))))
> 
>  (synopsis "A versatile (cross-)toolchain generator.")
>  (description "A versatile (cross-)toolchain generator.")
>  (home-page "https://crosstool-ng.github.io/docs/")
>  (license gpl2)
>  )

T.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

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

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

* Re: Using local package in shell manifest
  2023-10-26 14:16 ` Tomas Volf
@ 2023-10-26 14:48   ` Jesse
  2023-10-26 15:43     ` Tomas Volf
  0 siblings, 1 reply; 4+ messages in thread
From: Jesse @ 2023-10-26 14:48 UTC (permalink / raw)
  To: Jesse, help-guix

Thanks Tomas,

I plan to upstream it but there is some more development I'd like to try 
out first. If I put it in the manifest, is there some different syntax I 
need to use? I have been doing some searching and it seems like I would 
have to wrap the "(package ...)" expression in define-public and the 
use-module seems to be a bit different too? I am having trouble finding 
the distinction in the manual.

On 10/26/23 10:16, Tomas Volf wrote:
> On 2023-10-25 16:49:43 -0400, Jesse wrote:
>> Hello,
>>
>> I have written a package that I have installed with "guix package
>> --install-from-file=crosstool-ng.scm". I was able to get it to build and
>> install. I can use it if I do "source ~/.guix-profile/etc/profile".
>>
>> However, I would like to add it to a shell manifest. My manifest just
>> includes
>>
>> (specifications->manifest
>>    (list "gcc" "git" "zsh" "crosstool-ng"))
>>
>> My understanding is that "specifications->manifest" is supposed to search
>> for the packages in the list? It returns the following when I rung "guix
>> shell" in the directory with the manifest.scm:
>>
>> guix shell: loading environment from
>> '/home/jesse/Code/guix-tests/manifest.scm'...
>> hint: Consider passing the `--check' option once to make sure your shell
>> does not
>> clobber environment variables.
>>
>> guix shell: error: crosstool-ng: unknown package
>> guix shell: error: failed to load
>> '/home/jesse/Code/guix-tests/manifest.scm':
>> gnu/packages.scm:545:4: In procedure specification->package+output:
>> Throw to key `quit' with args `(1)'.
>>
>> I'd imagine it doesn't know where to look for the package? Is there a way to
>> tell guix shell where to look? If not, is there a way to include the package
>> in the manifest file? For what it's worth, I have attached the package file
>> in question.
> I can think of few options:
>
> 0. If it would make sense to upstream the package, you should.  That will solve
> your problem.
>
> 1. Next you could create your own channel, and publish the package there.  After
> adding the channel, it should also just work.
>
> 2. You could load the package by an absolute path and use it that way, something
> like this (untested):
>
> (concatenate-manifests
>   (list (specifications->manifest (list "gcc" "git" "zsh"))
>         (packages->manifest (list (load "/home/.../crosstool-ng.scm")))))
>
> 3. Alternative of the above would be to move the package definition into the
> manifest.scm itself, allowing you to drop the load invocation.
>
> Dunno, maybe there are better ways.
>
>> This is also my first foray into Guix and Guile, so I've been kind of
>> banging my head through writing a package and the manual but I got a little
>> stuck here.
>>
>> Thanks
>> (use-modules
>>   (guix packages)
>>   (guix git-download)
>>   (guix licenses)
>>   (guix profiles)
>>   (guix build-system gnu)
>>   (guix build-system python)
>>   (guix build utils)
>>   (gnu packages python)
>>   (gnu packages autotools)
>>   (gnu packages gettext)
>>   (gnu packages texinfo)
>>   (gnu packages pkg-config)
>>   (gnu packages base)
>>   (gnu packages flex)
>>   (gnu packages gawk)
>>   (gnu packages man)
>>   (gnu packages bison)
>>   (gnu packages compression)
>>   (gnu packages ncurses)
>>   )
>>
>> (package
>>   (name "crosstool-ng")
>>   (version "1.26.0")
>>   (source (origin
>>            (method git-fetch)
>>            (uri (git-reference
>>                  (url "https://github.com/crosstool-ng/crosstool-ng.git")
>>                  (commit (string-append "crosstool-ng-" version))))
>>            (sha256
>>             (base32
>>              "04z7zwhxfbjqrd4j16lviilppsd8phwi8zv2rs4jpkmqni6856j1")
>>             )
>>            ))
>>   (build-system gnu-build-system)
>>   (native-inputs
>>    (list autoconf
>>          automake
>>          gettext-minimal
>>          libtool
>>          texinfo
>>          bison
>>          flex
>>          gawk
>>          unzip
>>          which
>>          help2man
>>          python
>>          ncurses
>>          pkg-config))
>>   (arguments
>>    '(#:phases (modify-phases %standard-phases
>>                              (add-before 'bootstrap 'fix-version-gen
>>                                          (lambda* _
>>                                                   (patch-shebang "maintainer/git-version-gen")
>>                                                   )))))
>>
>>   (synopsis "A versatile (cross-)toolchain generator.")
>>   (description "A versatile (cross-)toolchain generator.")
>>   (home-page "https://crosstool-ng.github.io/docs/")
>>   (license gpl2)
>>   )
> T.
>


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

* Re: Using local package in shell manifest
  2023-10-26 14:48   ` Jesse
@ 2023-10-26 15:43     ` Tomas Volf
  0 siblings, 0 replies; 4+ messages in thread
From: Tomas Volf @ 2023-10-26 15:43 UTC (permalink / raw)
  To: Jesse; +Cc: help-guix

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

On 2023-10-26 10:48:45 -0400, Jesse wrote:
> Thanks Tomas,
> 
> I plan to upstream it but there is some more development I'd like to try out
> first. If I put it in the manifest, is there some different syntax I need to
> use? I have been doing some searching and it seems like I would have to wrap
> the "(package ...)" expression in define-public and the use-module seems to
> be a bit different too? I am having trouble finding the distinction in the
> manual.

My understanding is that for guix.scm, the object returned by the file has to be
a package? and it will be installed.  That is why you only need:

    [..]

    (package ...)

If you would put it into the manifest instead, you can just store it into a
variable, it does not even have to be public.  So you could do something like:

    [..]

    (define crosstool-ng
      (package ...) ; The very same definition from guix.scm
    )

    (packages->manifest (list crosstool-ng)) ; The variable from above

Technically you could even just have ...(list (package ...)), but that would get
unwieldy quickly.

Since define-public is for exporting symbols from module, it should not be
required in this particular case.

As far as I can the main difference between guix.scm and manifest.scm is that
former is expected to produce (== have as a last expression) a build-able object
(usually package?), and the latter a manifest? object.

> 
> On 10/26/23 10:16, Tomas Volf wrote:
> > On 2023-10-25 16:49:43 -0400, Jesse wrote:
> > > Hello,
> > > 
> > > I have written a package that I have installed with "guix package
> > > --install-from-file=crosstool-ng.scm". I was able to get it to build and
> > > install. I can use it if I do "source ~/.guix-profile/etc/profile".
> > > 
> > > However, I would like to add it to a shell manifest. My manifest just
> > > includes
> > > 
> > > (specifications->manifest
> > >    (list "gcc" "git" "zsh" "crosstool-ng"))
> > > 
> > > My understanding is that "specifications->manifest" is supposed to search
> > > for the packages in the list? It returns the following when I rung "guix
> > > shell" in the directory with the manifest.scm:
> > > 
> > > guix shell: loading environment from
> > > '/home/jesse/Code/guix-tests/manifest.scm'...
> > > hint: Consider passing the `--check' option once to make sure your shell
> > > does not
> > > clobber environment variables.
> > > 
> > > guix shell: error: crosstool-ng: unknown package
> > > guix shell: error: failed to load
> > > '/home/jesse/Code/guix-tests/manifest.scm':
> > > gnu/packages.scm:545:4: In procedure specification->package+output:
> > > Throw to key `quit' with args `(1)'.
> > > 
> > > I'd imagine it doesn't know where to look for the package? Is there a way to
> > > tell guix shell where to look? If not, is there a way to include the package
> > > in the manifest file? For what it's worth, I have attached the package file
> > > in question.
> > I can think of few options:
> > 
> > 0. If it would make sense to upstream the package, you should.  That will solve
> > your problem.
> > 
> > 1. Next you could create your own channel, and publish the package there.  After
> > adding the channel, it should also just work.
> > 
> > 2. You could load the package by an absolute path and use it that way, something
> > like this (untested):
> > 
> > (concatenate-manifests
> >   (list (specifications->manifest (list "gcc" "git" "zsh"))
> >         (packages->manifest (list (load "/home/.../crosstool-ng.scm")))))
> > 
> > 3. Alternative of the above would be to move the package definition into the
> > manifest.scm itself, allowing you to drop the load invocation.
> > 
> > Dunno, maybe there are better ways.
> > 
> > > This is also my first foray into Guix and Guile, so I've been kind of
> > > banging my head through writing a package and the manual but I got a little
> > > stuck here.
> > > 
> > > Thanks
> > > (use-modules
> > >   (guix packages)
> > >   (guix git-download)
> > >   (guix licenses)
> > >   (guix profiles)
> > >   (guix build-system gnu)
> > >   (guix build-system python)
> > >   (guix build utils)
> > >   (gnu packages python)
> > >   (gnu packages autotools)
> > >   (gnu packages gettext)
> > >   (gnu packages texinfo)
> > >   (gnu packages pkg-config)
> > >   (gnu packages base)
> > >   (gnu packages flex)
> > >   (gnu packages gawk)
> > >   (gnu packages man)
> > >   (gnu packages bison)
> > >   (gnu packages compression)
> > >   (gnu packages ncurses)
> > >   )
> > > 
> > > (package
> > >   (name "crosstool-ng")
> > >   (version "1.26.0")
> > >   (source (origin
> > >            (method git-fetch)
> > >            (uri (git-reference
> > >                  (url "https://github.com/crosstool-ng/crosstool-ng.git")
> > >                  (commit (string-append "crosstool-ng-" version))))
> > >            (sha256
> > >             (base32
> > >              "04z7zwhxfbjqrd4j16lviilppsd8phwi8zv2rs4jpkmqni6856j1")
> > >             )
> > >            ))
> > >   (build-system gnu-build-system)
> > >   (native-inputs
> > >    (list autoconf
> > >          automake
> > >          gettext-minimal
> > >          libtool
> > >          texinfo
> > >          bison
> > >          flex
> > >          gawk
> > >          unzip
> > >          which
> > >          help2man
> > >          python
> > >          ncurses
> > >          pkg-config))
> > >   (arguments
> > >    '(#:phases (modify-phases %standard-phases
> > >                              (add-before 'bootstrap 'fix-version-gen
> > >                                          (lambda* _
> > >                                                   (patch-shebang "maintainer/git-version-gen")
> > >                                                   )))))
> > > 
> > >   (synopsis "A versatile (cross-)toolchain generator.")
> > >   (description "A versatile (cross-)toolchain generator.")
> > >   (home-page "https://crosstool-ng.github.io/docs/")
> > >   (license gpl2)
> > >   )
> > T.
> > 
> 

T.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

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

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

end of thread, other threads:[~2023-10-26 15:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-25 20:49 Using local package in shell manifest Jesse
2023-10-26 14:16 ` Tomas Volf
2023-10-26 14:48   ` Jesse
2023-10-26 15:43     ` Tomas Volf

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.