[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’.
- [bug#36404] [PATCH v4 4/4] doc: Add section for 'guix deploy'., (continued)
- [bug#36404] [PATCH v4 4/4] doc: Add section for 'guix deploy'., Thompson, David, 2019/07/04
- [bug#36404] [PATCH v4 4/4] doc: Add section for 'guix deploy'., Ludovic Courtès, 2019/07/05
- [bug#36404] [PATCH v4 3/4] Add 'guix deploy'., Thompson, David, 2019/07/04
- [bug#36404] [PATCH v4 3/4] Add 'guix deploy'., Ludovic Courtès, 2019/07/05
- [bug#36404] [PATCH v4 2/4] gnu: Add machine type for deployment specifications., Ludovic Courtès, 2019/07/04
- [bug#36404] [PATCH v4 2/4] gnu: Add machine type for deployment specifications., Jakob L. Kreuze, 2019/07/04
- [bug#36404] [PATCH v4 2/4] gnu: Add machine type for deployment specifications., Thompson, David, 2019/07/04
- [bug#36404] [PATCH v4 2/4] gnu: Add machine type for deployment specifications., Ludovic Courtès, 2019/07/05
- [bug#36404] [PATCH v4 2/4] gnu: Add machine type for deployment specifications.,
Ludovic Courtès <=
- [bug#36404] [PATCH v5 0/4] Add 'guix deploy'., Jakob L. Kreuze, 2019/07/05
- [bug#36404] [PATCH v5 1/4] ssh: Add 'identity' keyword to 'open-ssh-session'., Jakob L. Kreuze, 2019/07/05
- [bug#36404] [PATCH v5 2/4] gnu: Add machine type for deployment specifications., Jakob L. Kreuze, 2019/07/05
- [bug#36404] [PATCH v5 3/4] Add 'guix deploy'., Jakob L. Kreuze, 2019/07/05
- [bug#36404] [PATCH v5 4/4] doc: Add section for 'guix deploy'., Jakob L. Kreuze, 2019/07/05
- bug#36404: [PATCH v5 4/4] doc: Add section for 'guix deploy'., Christopher Lemmer Webber, 2019/07/05
- [bug#36404] [PATCH v5 4/4] doc: Add section for 'guix deploy'., Jakob L. Kreuze, 2019/07/05
- [bug#36404] [PATCH v5 4/4] doc: Add section for 'guix deploy'., Ludovic Courtès, 2019/07/06
- [bug#36404] [PATCH v4 1/4] ssh: Add 'identity' keyword to 'open-ssh-session'., Thompson, David, 2019/07/04