Mikhail Kryshen <mikh...@kryshen.net> writes:

> Chris Marusich <cmmarus...@gmail.com> writes:
>
>> Mikhail Kryshen <mikh...@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: signature.asc
Description: PGP signature

Reply via email to