From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Seeking guidance regarding system roll-back and switch-generation Date: Fri, 22 Jul 2016 17:49:18 +0200 Message-ID: <87vazxk70h.fsf@gnu.org> References: <87twfo7h5v.fsf@gmail.com> <87vb03nlq8.fsf@gnu.org> <874m7mvxcz.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQcha-0001zd-Id for guix-devel@gnu.org; Fri, 22 Jul 2016 11:49:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQchW-0008Vo-8p for guix-devel@gnu.org; Fri, 22 Jul 2016 11:49:25 -0400 In-Reply-To: <874m7mvxcz.fsf@gmail.com> (Chris Marusich's message of "Tue, 19 Jul 2016 01:35:40 -0700") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Chris Marusich Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi! Chris Marusich skribis: > Thank you very much for taking the time to respond! Now I have a better > idea of how to proceed. Sorry for the delay! That=E2=80=99s what you get for asking difficult questions. ;-) > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Chris Marusich skribis: >> >>> I've noticed that the GuixSD mechanism is different from the NixOS >>> mechanism. In particular, NixOS uses an "install-grub" script (which is >>> specific to each system generation) to install grub, but GuixSD does >>> not. Is this difference intentional? >> >> Looking at >> , >> part of it seems to be concerned with the generation of grub.cfg, which >> is what (gnu system grub) does. >> >> It also does a couple more things, such as providing proper EFI support, >> and avoiding reinstalling GRUB when possible (whereas =E2=80=98guix syst= em >> reconfigure=E2=80=99 currently reruns =E2=80=98grub-install=E2=80=99 eac= h time, even when it=E2=80=99s >> not strictly needed.) >> >> So I don=E2=80=99t think it=E2=80=99s very different, after all. Or am = I missing >> something? > > Yes, they both install grub, but the mechanism seems different. NixOS > generates a script for each system generation, which installs exactly > the right grub for that generation. Unless I'm mistaken, GuixSD does > not do that. Instead, the existing GuixSD mechanism seems to require an > operating system configuration file. GuixSD uses that to determine the > correct grub, which it then installs. Sure, but it seems to be equivalent in the end. >> Switching to a generations primarily means: (1) running the target=E2=80= =99s >> activation script, (2) updating Shepherd services, and (3) updating >> grub.cfg. > > In addition to (3), don't we also need to install the grub software > itself? In general yes (there are cases where this is not needed, but let=E2=80=99s ignore them.) >> Of these (1) and (3) are currently easy to do on GuixSD. (Right? :-)) > > For both (1) and (3), the current GuixSD mechanism appears to require an > operating system configuration file. The output of =E2=80=98guix system build=E2=80=99 contains the =E2=80=98par= ameters=E2=80=99 file, which is enough to generate grub.cfg (see =E2=80=98previous-grub-entries=E2=80=99= in (guix scripts system)). However, the activation script is indeed missing. We can add it to the output of =E2=80=98guix system build=E2=80=99 by extending =E2=80=98system-= service-type=E2=80=99: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/services.scm b/gnu/services.scm index 5479bfa..fc3e17e 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -352,11 +352,18 @@ ACTIVATION-SCRIPT-TYPE." (define (second-argument a b) b) +(define (gexps->activation-system-entry gexps) + "Return a directory entry to add to the result of the 'system' derivation." + (mlet %store-monad ((script (activation-script gexps))) + (return `(("activate" ,script))))) + (define activation-service-type (service-type (name 'activate) (extensions (list (service-extension boot-service-type - gexps->activation-gexp))) + gexps->activation-gexp) + (service-extension system-service-type + gexps->activation-system-entry))) (compose append) (extend second-argument))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This way we have direct access to each generation=E2=80=99s activation scri= pt and we should be fine with (3). WDYT? > Yes, I think that makes sense. I need to learn more about GuixSD's > activation mechanism, but it makes sense that a procedural definition > (e.g., like in NixOS's switch-to-configuration script) is equivalent to > a declarative definition. I think a declarative definition of services > would be fine. Concretely speaking, is there a specific format that is > convenient to use for such a "declarative definition of services"? I would suggest an sexp as discussed at: https://lists.gnu.org/archive/html/guix-devel/2016-06/msg00173.html > What about the grub installation? The =E2=80=98parameters=E2=80=99 file should be enough, as you wrote. HTH! Ludo=E2=80=99. --=-=-=--