From patchwork Mon Nov 7 15:50:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Bakke X-Patchwork-Id: 17262 Received: (qmail 103774 invoked by uid 89); 7 Nov 2016 16:04:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-Status: No, score=-4.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: lists.gnu.org Received: from lists.gnu.org (HELO lists.gnu.org) (208.118.235.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Nov 2016 16:04:46 +0000 Received: from localhost ([::1]:54889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c3mPc-0001Vj-Jm for patchwork@sourceware.org; Mon, 07 Nov 2016 11:04:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c3mC8-0006jV-6o for guix-devel@gnu.org; Mon, 07 Nov 2016 10:50:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c3mC3-0005Vd-CO for guix-devel@gnu.org; Mon, 07 Nov 2016 10:50:48 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:56666) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c3mC2-0005VN-To for guix-devel@gnu.org; Mon, 07 Nov 2016 10:50:43 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 553CD2048B; Mon, 7 Nov 2016 10:50:42 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Mon, 07 Nov 2016 10:50:42 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=IVNJk+C1YmTOqaDNZYOC6RPmw4o=; b=tCtqVR md8zdFbig7T/pGJTa0hwYFoBZCN+TZ8t8U+1HuXOnJuMYzuKFoQkP4RFec/jAd6t Wr7gqAAZ7qRwuqzHa+c8oaHW3UR73JQw/4idgUbqtQqRE7cZwHXDkTHAa4ECuRvi lzmhDvW++ISuiaUw+K0JQTseBhutTChkPVG1A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=IVNJk+C1YmTOqa DNZYOC6RPmw4o=; b=pks0J99pWe64Db4agAuig3p7EWeBAJN9Xr4qzXW4UNY3yn TgYmDdm7aIcyabMhOWxyp7Ag7tiOChzxc5gFKOv0xMpAX/F1DbMVPqV/nCYIXz/Z OiCAoj1MiMihVvjDDug3faaDRhVCv8UxOBKqRyOau+lKtcQFuupxUbaxI8RAI= X-ME-Sender: X-Sasl-enc: vubvrQ4ghddkFOVoj3tnleETRoXVHz1PoFMwYjGAeMMt 1478533840 Received: from localhost (169.243.187.81.in-addr.arpa [81.187.243.169]) by mail.messagingengine.com (Postfix) with ESMTPA id C4C23CCF32; Mon, 7 Nov 2016 10:50:40 -0500 (EST) From: Marius Bakke To: Danny Milosavljevic Subject: Re: How to use custom grub? In-Reply-To: <20161107160544.76784851@scratchpost.org> References: <8737j85yek.fsf@duckhunt.i-did-not-set--mail-host-address--so-tickle-me> <87a8df1ioy.fsf@gnu.org> <878tsy6r2k.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me> <20161106004117.1d08b79b@scratchpost.org> <20161107114833.2c1453ca@scratchpost.org> <87inrz8qss.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me> <20161107160544.76784851@scratchpost.org> User-Agent: Notmuch/0.23.1 (https://notmuchmail.org) Emacs/25.1.1 (x86_64-unknown-linux-gnu) Date: Mon, 07 Nov 2016 15:50:39 +0000 Message-ID: <87bmxr8f1s.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.26 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+patchwork=sourceware.org@gnu.org Sender: "Guix-devel" Danny Milosavljevic writes: > Hi Marius, > > On Mon, 07 Nov 2016 11:36:51 +0000 > Marius Bakke wrote: > >> That's it! This makes it pick up (bootloader (grub-configuration (grub >> grub-efi))) from my config.scm: >> >> making '/gnu/store/kgk9rrawq9fxh1g2j6121gl3lcz47395-system' the current system... >> Installing for x86_64-efi platform. >> Installation finished. No error reported. >> >> Even though I'm now working on multi-platform grub, I think we should >> have this anyway so that the "grub" argument works as expected. WDYT? > > Yes, I agree that grub should not be magically picked up but rather be read from the configuration - as you do here. This makes alternative bootloaders possible and is also less surprising in any case. > > Also in guix/scripts/system.scm in perform-action there's a (setenv "PATH" ...) form. I think that one should be replaced, too - for much the same reasons. It would be better to just pass grub to install-grub* (which would need its parameter list adapted) instead of mucking with PATH :P > > In this way the package variable would flow from the os configuration all the way to the actual "grub-install" invocation call without magical environment variables, packages that just happen to be pulled in from some imported module etc. > > If you want, you can also fix this one up, too. (If not, I'll wait until your stuff is merged and fix it myself - no worries) > > A first test whether it was enough is to remove the #:use-module (gnu packages grub) from guix/scripts/system.scm and see whether it still works (it should). For clarity I would make the final patch remove it, too. Hi Danny! You raise some very good points. The patch I just sent indeed works without #:use-module (gnu packages grub), so that should be included. Passing the grub object to grub-install seems like it is better suited for a separate patch. I have a couple of other things on my list before ready to hack on grub-install (need to pass "--efi-directory" somehow), but happy to review any work on it. Attached is the same patch without loading the grub module. Would be great to clear this out of the patch queue. Thanks a lot! :) From 5e31312aeae87d63ab2c64e92835231b59c804db Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Mon, 7 Nov 2016 11:56:52 +0000 Subject: [PATCH] system: Use grub from bootloader configuration. * gnu/system/grub.scm (gnu): Export grub-configuration-grub. * guix/scripts/system.scm (perform-action): Use it. (define-module): Don't import (gnu packages grub). Co-authored-by: Danny Milosavljevic --- gnu/system/grub.scm | 1 + guix/scripts/system.scm | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm index 5c9d0f1..4657b06 100644 --- a/gnu/system/grub.scm +++ b/gnu/system/grub.scm @@ -51,6 +51,7 @@ grub-configuration grub-configuration? grub-configuration-device + grub-configuration-grub menu-entry menu-entry? diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index df9b37d..71ddccf 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -44,7 +44,6 @@ #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (gnu services herd) - #:use-module (gnu packages grub) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-19) @@ -617,7 +616,8 @@ building anything." #:image-size image-size #:full-boot? full-boot? #:mappings mappings)) - (grub (package->derivation grub)) + (grub (package->derivation (grub-configuration-grub + (operating-system-bootloader os)))) (grub.cfg (if (eq? 'container action) (return #f) (operating-system-grub.cfg os -- 2.10.2