all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to split config.scm in multiple files
@ 2018-11-17  8:59 Giovanni Biscuolo
  2018-11-17  9:16 ` Julien Lepiller
  2018-11-22 13:04 ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Giovanni Biscuolo @ 2018-11-17  8:59 UTC (permalink / raw)
  To: help-guix

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

Hello Help! :-)

sorry but I'm new to Guile

please is there a way to include external .scm files in my main
config.scm, I tried with Guile local inclusion in config.scm

 (include base-services.scm)

but I get

.................
sudo guix system reconfigure config.scm
config.scm:8:0: error: extraneous field initializers (include)
................

thanks!
Giovanni

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

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

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

* Re: how to split config.scm in multiple files
  2018-11-17  8:59 how to split config.scm in multiple files Giovanni Biscuolo
@ 2018-11-17  9:16 ` Julien Lepiller
  2018-11-22 13:04 ` Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: Julien Lepiller @ 2018-11-17  9:16 UTC (permalink / raw)
  To: help-guix, Giovanni Biscuolo

Hi,

You can create a module, say /etc/config/base-services.scm

To include it, you need to make it a module, so in base-services.scm:

(define-module (base-services)
  #:use-module (gnu services base)
  …
  #:export (my-services))
(define my-services (cons*.… %base-services))

And in your config.scm, you can import this module like so:

(add-to-load-path "/etc/config")
(use-modules (base-services))

(operating-system
  …
  (services my-services))

I don't think you can include a scheme file in the operating-system record directly, but maybe someone will prove me wrong :)

Le 17 novembre 2018 09:59:02 GMT+01:00, Giovanni Biscuolo <g@xelera.eu> a écrit :
>Hello Help! :-)
>
>sorry but I'm new to Guile
>
>please is there a way to include external .scm files in my main
>config.scm, I tried with Guile local inclusion in config.scm
>
> (include base-services.scm)
>
>but I get
>
>.................
>sudo guix system reconfigure config.scm
>config.scm:8:0: error: extraneous field initializers (include)
>................
>
>thanks!
>Giovanni

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

* Re: how to split config.scm in multiple files
  2018-11-17  8:59 how to split config.scm in multiple files Giovanni Biscuolo
  2018-11-17  9:16 ` Julien Lepiller
@ 2018-11-22 13:04 ` Ludovic Courtès
  2018-11-27 17:57   ` Giovanni Biscuolo
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2018-11-22 13:04 UTC (permalink / raw)
  To: Giovanni Biscuolo; +Cc: help-guix

Hello Giovanni,

Giovanni Biscuolo <g@xelera.eu> skribis:

> please is there a way to include external .scm files in my main
> config.scm, I tried with Guile local inclusion in config.scm
>
>  (include base-services.scm)
>
> but I get
>
> .................
> sudo guix system reconfigure config.scm
> config.scm:8:0: error: extraneous field initializers (include)
> ................

The ‘include’ form exists but you would need to use it at the top level.

However, I recommend using Guile’s module system instead.  An example of
that can be found here:

  • modules:
    https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/modules/sysadmin

  • config files that use these modules:
    https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/berlin.scm
    https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/build-machine.scm

Here, assuming you’re in the hydra/ directory, you’d simply run, say:

  guix system reconfigure -L ./modules ./berlin.scm

HTH!

Ludo’.

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

* Re: how to split config.scm in multiple files
  2018-11-22 13:04 ` Ludovic Courtès
@ 2018-11-27 17:57   ` Giovanni Biscuolo
  2018-11-28 17:11     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Giovanni Biscuolo @ 2018-11-27 17:57 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix

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

Hi Ludo,

ludo@gnu.org (Ludovic Courtès) writes:

[...]

> The ‘include’ form exists but you would need to use it at the top
> level.

OK, got it thanks!

> However, I recommend using Guile’s module system instead.  An example of
> that can be found here:
>
>   • modules:
>     https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/modules/sysadmin

ooooh: maintenance.git is *almost* more interesting than the guix manual
itself :-O

>   • config files that use these modules:
>     https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/berlin.scm
>     https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/build-machine.scm

OK I'm still not able to hack my modules in Guile but that code is clear enough
for me to understand how it works... and it's great! (\me study!)

IaGC [1] is much more... *functional* than other forms of IaC :-)

> Here, assuming you’re in the hydra/ directory, you’d simply run, say:
>
>   guix system reconfigure -L ./modules ./berlin.scm

got it!

kudos!
Giovanni

[1] Infrastructure as Guile Code

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

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

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

* Re: how to split config.scm in multiple files
  2018-11-27 17:57   ` Giovanni Biscuolo
@ 2018-11-28 17:11     ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2018-11-28 17:11 UTC (permalink / raw)
  To: Giovanni Biscuolo; +Cc: help-guix

Giovanni Biscuolo <g@xelera.eu> skribis:

> IaGC [1] is much more... *functional* than other forms of IaC :-)

> [1] Infrastructure as Guile Code

Heheh, looks like we have our new marketing buzzword.  :-)

Ludo’.

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

end of thread, other threads:[~2018-11-28 17:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-17  8:59 how to split config.scm in multiple files Giovanni Biscuolo
2018-11-17  9:16 ` Julien Lepiller
2018-11-22 13:04 ` Ludovic Courtès
2018-11-27 17:57   ` Giovanni Biscuolo
2018-11-28 17:11     ` Ludovic Courtès

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.