guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#36404] [PATCH v4 2/4] gnu: Add machine type for deployment specific


From: Ludovic Courtès
Subject: [bug#36404] [PATCH v4 2/4] gnu: Add machine type for deployment specifications.
Date: Fri, 05 Jul 2019 10:24:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

address@hidden (Jakob L. Kreuze) skribis:

> +(define (build-machine machine)
> +  "Monadic procedure that builds the system derivation for MACHINE and 
> returning
> +a list containing the path of the derivation file and the path of the 
> derivation
> +output."
> +  (let ((os (machine-system machine)))
> +    (mlet* %store-monad ((osdrv (operating-system-derivation os))
> +                         (_ ((store-lift build-derivations) (list osdrv))))
> +      (return (list (derivation-file-name osdrv)
> +                    (derivation->output-path osdrv))))))
> +
> +(define (machine-remote-eval machine exp)
> +  "Evaluate EXP, a gexp, on MACHINE. Ensure that all the elements EXP refers 
> to
> +are built and deployed to MACHINE beforehand."
> +  (let ((environment (machine-environment machine)))
> +    ((environment-type-machine-remote-eval environment) machine exp)))
> +
> +(define (deploy-machine machine)
> +  "Monadic procedure transferring the new system's OS closure to the remote
> +MACHINE, activating it on MACHINE and switching MACHINE to the new 
> generation."
> +  (let ((environment (machine-environment machine)))
> +    ((environment-type-deploy-machine environment) machine)))

In the SSH case, ‘deploy-machine’ should roughly translate to:

  (remote-eval #~(switch-to-system #$os) machine)

Thus, ‘build-machine’ is unnecessary: the actual build of OS is
automatically triggered by ‘remote-eval’, either locally or remotely,
depending on #:build-locally?.

So I believe you can remove ‘build-machine’ altogether.

> +        (error "unsupported configuration type"))))

It’s a bit verbose, but I’d suggest using SRFI-34/35 instead, like so:

  (raise (condition
          (&message (message "unsupported machine configuration type"))))

That way, if you also add the file to po/guix/POTFILES.in, i18n will do
its magic.  :-)

Otherwise it looks great to me!

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]