From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:55421) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hjJWk-0007ky-SW for guix-patches@gnu.org; Fri, 05 Jul 2019 04:25:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hjJWj-0007fA-QC for guix-patches@gnu.org; Fri, 05 Jul 2019 04:25:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43507) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hjJWj-0007ez-MX for guix-patches@gnu.org; Fri, 05 Jul 2019 04:25:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hjJWg-0004Ih-J1 for guix-patches@gnu.org; Fri, 05 Jul 2019 04:25:05 -0400 Subject: [bug#36404] [PATCH v4 2/4] gnu: Add machine type for deployment specifications. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87o92ianbj.fsf@sdf.lonestar.org> <87o92glap5.fsf@dustycloud.org> <878sthoqzi.fsf@gnu.org> <87imsl9tsx.fsf_-_@sdf.lonestar.org> <87ef399tpu.fsf_-_@sdf.lonestar.org> <87a7dx9tog.fsf_-_@sdf.lonestar.org> <875zol9tn2.fsf_-_@sdf.lonestar.org> <871rz99tl9.fsf_-_@sdf.lonestar.org> <875zoldqah.fsf@kyleam.com> <87muhwtmfp.fsf@sdf.lonestar.org> <871rz874l2.fsf@kyleam.com> <877e90tj7l.fsf_-_@sdf.lonestar.org> <8736jotj5v.fsf_-_@sdf.lonestar.org> <87y31gs4k5.fsf_-_@sdf.lonestar.org> Date: Fri, 05 Jul 2019 10:24:10 +0200 In-Reply-To: <87y31gs4k5.fsf_-_@sdf.lonestar.org> (Jakob L. Kreuze's message of "Tue, 02 Jul 2019 13:56:58 -0400") Message-ID: <87y31cnb2t.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: "Jakob L. Kreuze" Cc: 36404@debbugs.gnu.org zerodaysfordays@sdf.lonestar.org (Jakob L. Kreuze) skribis: > +(define (build-machine machine) > + "Monadic procedure that builds the system derivation for MACHINE and r= eturning > +a list containing the path of the derivation file and the path of the de= rivation > +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 re= fers 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 rem= ote > +MACHINE, activating it on MACHINE and switching MACHINE to the new gener= ation." > + (let ((environment (machine-environment machine))) > + ((environment-type-deploy-machine environment) machine))) In the SSH case, =E2=80=98deploy-machine=E2=80=99 should roughly translate = to: (remote-eval #~(switch-to-system #$os) machine) Thus, =E2=80=98build-machine=E2=80=99 is unnecessary: the actual build of O= S is automatically triggered by =E2=80=98remote-eval=E2=80=99, either locally or= remotely, depending on #:build-locally?. So I believe you can remove =E2=80=98build-machine=E2=80=99 altogether. > + (error "unsupported configuration type")))) It=E2=80=99s a bit verbose, but I=E2=80=99d suggest using SRFI-34/35 instea= d, 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=E2=80=99.