unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Problem using multiple manifest files
@ 2018-10-12 21:50 Thaddäus Töppen
  2018-10-13  4:08 ` Ricardo Wurmus
  2018-10-13 19:52 ` Mikhail Kryshen
  0 siblings, 2 replies; 7+ messages in thread
From: Thaddäus Töppen @ 2018-10-12 21:50 UTC (permalink / raw)
  To: help-guix

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

Hello Guix community,

I am new to Guix, and I am having trouble, using multiple manifest files.
For example, I have a file "emacs.scm", containing:

(specifications->manifest
  '("emacs" "emacs-evil"))

…and then other similar files, bundling different things, like programming
languages / xorg stuff etc.

When I use "guix package -m emacs.scm" it installs the packages and they
are available. When I then install the next manifest file's packages, the
"emacs.scm" packages are no longer available – the links in
"~/.guix-profile/bin" have been removed.

Am I correct in assuming, that only one manifest file can be installed at a
time, thus all package definitions have to be in one file (or at least
imported into a main-package-file)?

Also: If I have more (beginner) questions, should I drop them all in one
mail or create separate threads

Best Regards
Thaddäus

[-- Attachment #2: Type: text/html, Size: 1820 bytes --]

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

* Re: Problem using multiple manifest files
  2018-10-12 21:50 Problem using multiple manifest files Thaddäus Töppen
@ 2018-10-13  4:08 ` Ricardo Wurmus
  2018-10-13 19:52 ` Mikhail Kryshen
  1 sibling, 0 replies; 7+ messages in thread
From: Ricardo Wurmus @ 2018-10-13  4:08 UTC (permalink / raw)
  To: Thaddäus Töppen; +Cc: help-guix


Hello Thaddäus,

> Hello Guix community,

welcome!

> When I use "guix package -m emacs.scm" it installs the packages and they
> are available. When I then install the next manifest file's packages, the
> "emacs.scm" packages are no longer available – the links in
> "~/.guix-profile/bin" have been removed.
>
> Am I correct in assuming, that only one manifest file can be installed at a
> time, thus all package definitions have to be in one file (or at least
> imported into a main-package-file)?

Yes, this is correct.  A manifest declares the contents of a single
profile.  By passing a manifest file to “guix package -m” you tell it to
only install the declared packages and remove everything else.

You can instantiate different manifest to different profiles by also
passing “-p /path/to/other/profile”.  You can combine them in a session
by source-ing each of the profiles’ “etc/profile” files.

> Also: If I have more (beginner) questions, should I drop them all in one
> mail or create separate threads

It’s better to send separate emails.

--
Ricardo

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

* Re: Problem using multiple manifest files
  2018-10-12 21:50 Problem using multiple manifest files Thaddäus Töppen
  2018-10-13  4:08 ` Ricardo Wurmus
@ 2018-10-13 19:52 ` Mikhail Kryshen
  2018-10-15 12:10   ` Ludovic Courtès
  2018-10-20 19:53   ` Chris Marusich
  1 sibling, 2 replies; 7+ messages in thread
From: Mikhail Kryshen @ 2018-10-13 19:52 UTC (permalink / raw)
  To: Thaddäus Töppen, help-guix

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

Thaddäus Töppen <thaddaeus.toeppen@gmail.com> writes:
> Am I correct in assuming, that only one manifest file can be installed at a
> time, thus all package definitions have to be in one file (or at least
> imported into a main-package-file)?

Yes, but since manifest file is a Guile program, you can implement any
custom logic for constructing the manifest there.

Here is an example of a manifest file that loads multiple manifests and
composes them into one:

----------------------------------------------------------------------
(use-modules (srfi srfi-1)
             ((guix ui) #:select (make-user-module)))

(define (load-manifest file)
  ;; Load manifest file in a fresh module with necessary imports.
  (let ((module (make-user-module '((guix profiles) (gnu)))))
    (save-module-excursion
     (lambda _
       (set-current-module module)
       (load (canonicalize-path file))))))

(define (combined-manifest-from-files . files)
  (fold (lambda (file combined)
          (manifest-add combined
                        (manifest-entries (load-manifest file))))
        (manifest '())
        files))

(combined-manifest-from-files
 "emacs.scm"
 "xorg.scm"
 "etc.scm")
----------------------------------------------------------------------

-- 
Mikhail

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

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

* Re: Problem using multiple manifest files
  2018-10-13 19:52 ` Mikhail Kryshen
@ 2018-10-15 12:10   ` Ludovic Courtès
  2018-10-20 19:53   ` Chris Marusich
  1 sibling, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2018-10-15 12:10 UTC (permalink / raw)
  To: Mikhail Kryshen; +Cc: help-guix

Hello,

Mikhail Kryshen <mikhail@kryshen.net> skribis:

> Here is an example of a manifest file that loads multiple manifests and
> composes them into one:
>
> ----------------------------------------------------------------------
> (use-modules (srfi srfi-1)
>              ((guix ui) #:select (make-user-module)))
>
> (define (load-manifest file)
>   ;; Load manifest file in a fresh module with necessary imports.
>   (let ((module (make-user-module '((guix profiles) (gnu)))))
>     (save-module-excursion
>      (lambda _
>        (set-current-module module)
>        (load (canonicalize-path file))))))
>
> (define (combined-manifest-from-files . files)
>   (fold (lambda (file combined)
>           (manifest-add combined
>                         (manifest-entries (load-manifest file))))
>         (manifest '())
>         files))
>
> (combined-manifest-from-files
>  "emacs.scm"
>  "xorg.scm"
>  "etc.scm")
> ----------------------------------------------------------------------

Nice example!

Ludo’.

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

* Re: Problem using multiple manifest files
  2018-10-13 19:52 ` Mikhail Kryshen
  2018-10-15 12:10   ` Ludovic Courtès
@ 2018-10-20 19:53   ` Chris Marusich
  2018-10-22 18:39     ` Mikhail Kryshen
  1 sibling, 1 reply; 7+ messages in thread
From: Chris Marusich @ 2018-10-20 19:53 UTC (permalink / raw)
  To: Mikhail Kryshen; +Cc: help-guix

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

Mikhail Kryshen <mikhail@kryshen.net> writes:

> (use-modules (srfi srfi-1)
>              ((guix ui) #:select (make-user-module)))
>
> (define (load-manifest file)
>   ;; Load manifest file in a fresh module with necessary imports.
>   (let ((module (make-user-module '((guix profiles) (gnu)))))
>     (save-module-excursion
>      (lambda _
>        (set-current-module module)
>        (load (canonicalize-path file))))))

Neat example!  But what is make-user-module doing, and is it necessary?

I checked in the Guix source and found that this procedure uses the
procedure make-fresh-user-module, which comes from the (ice-9 boot)
module and is not documented in the Guile Reference manual.  I stopped
investigating when I checked the ice-9 source code and found that it did
not contain an immediately helpful docstring or comment.  It feels like
maybe make-fresh-user-module ought to be documented in "(guile) Module
System Reflection", but it isn't.  Unfortunately, I don't have time
right now to dig deeper.

-- 
Chris

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

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

* Re: Problem using multiple manifest files
  2018-10-20 19:53   ` Chris Marusich
@ 2018-10-22 18:39     ` Mikhail Kryshen
  2018-10-23  8:07       ` Chris Marusich
  0 siblings, 1 reply; 7+ messages in thread
From: Mikhail Kryshen @ 2018-10-22 18:39 UTC (permalink / raw)
  To: Chris Marusich; +Cc: Thaddäus Töppen, help-guix

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

Chris Marusich <cmmarusich@gmail.com> writes:

> Mikhail Kryshen <mikhail@kryshen.net> writes:
>
>> (use-modules (srfi srfi-1)
>>              ((guix ui) #:select (make-user-module)))
>>
>> (define (load-manifest file)
>>   ;; Load manifest file in a fresh module with necessary imports.
>>   (let ((module (make-user-module '((guix profiles) (gnu)))))
>>     (save-module-excursion
>>      (lambda _
>>        (set-current-module module)
>>        (load (canonicalize-path file))))))
>
> Neat example!

Thanks! 

> But what is make-user-module doing, and is it necessary?

I looked into the Guix source and reproduced what "guix package -m" does
to load a manifest file.  Make-user-module procedure appear to be used
in Guix to dynamically create modules for running user code.  I could
have simply used "load" here, but then all the files would be loaded in
the same environment and could potentially interfere with each other.

-- 
Mikhail

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

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

* Re: Problem using multiple manifest files
  2018-10-22 18:39     ` Mikhail Kryshen
@ 2018-10-23  8:07       ` Chris Marusich
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Marusich @ 2018-10-23  8:07 UTC (permalink / raw)
  To: Mikhail Kryshen; +Cc: Thaddäus Töppen, help-guix

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

Mikhail Kryshen <mikhail@kryshen.net> writes:

> Chris Marusich <cmmarusich@gmail.com> writes:
>
>> Mikhail Kryshen <mikhail@kryshen.net> writes:
>>
>>> (use-modules (srfi srfi-1)
>>>              ((guix ui) #:select (make-user-module)))
>>>
>>> (define (load-manifest file)
>>>   ;; Load manifest file in a fresh module with necessary imports.
>>>   (let ((module (make-user-module '((guix profiles) (gnu)))))
>>>     (save-module-excursion
>>>      (lambda _
>>>        (set-current-module module)
>>>        (load (canonicalize-path file))))))
>>
>> Neat example!
>
> Thanks! 
>
>> But what is make-user-module doing, and is it necessary?
>
> I looked into the Guix source and reproduced what "guix package -m" does
> to load a manifest file.  Make-user-module procedure appear to be used
> in Guix to dynamically create modules for running user code.  I could
> have simply used "load" here, but then all the files would be loaded in
> the same environment and could potentially interfere with each other.

I see.  Thank you for the explanation!  That does indeed seem to be the
intent.

-- 
Chris

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

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

end of thread, other threads:[~2018-10-23  8:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-12 21:50 Problem using multiple manifest files Thaddäus Töppen
2018-10-13  4:08 ` Ricardo Wurmus
2018-10-13 19:52 ` Mikhail Kryshen
2018-10-15 12:10   ` Ludovic Courtès
2018-10-20 19:53   ` Chris Marusich
2018-10-22 18:39     ` Mikhail Kryshen
2018-10-23  8:07       ` Chris Marusich

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