From patchwork Sat Jun 13 19:41:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mathieu Othacehe X-Patchwork-Id: 22699 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9C87B27BBE3; Sat, 13 Jun 2020 20:42:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 09E6A27BBE1 for ; Sat, 13 Jun 2020 20:42:10 +0100 (BST) Received: from localhost ([::1]:58768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkC2b-0004zv-Gc for patchwork@mira.cbaines.net; Sat, 13 Jun 2020 15:42:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkC2U-0004yM-8p for guix-patches@gnu.org; Sat, 13 Jun 2020 15:42:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59219) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jkC2T-0007CO-WF for guix-patches@gnu.org; Sat, 13 Jun 2020 15:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jkC2T-0001oO-Uo for guix-patches@gnu.org; Sat, 13 Jun 2020 15:42:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41839] [PATCH 1/2] image: Move hurd image definition to a dedicated file. References: <20200613194001.9580-1-othacehe@gnu.org> In-Reply-To: <20200613194001.9580-1-othacehe@gnu.org> Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 13 Jun 2020 19:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41839 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41839@debbugs.gnu.org Cc: Mathieu Othacehe Received: via spool by 41839-submit@debbugs.gnu.org id=B41839.15920773206950 (code B ref 41839); Sat, 13 Jun 2020 19:42:01 +0000 Received: (at 41839) by debbugs.gnu.org; 13 Jun 2020 19:42:00 +0000 Received: from localhost ([127.0.0.1]:42531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkC2S-0001o2-FB for submit@debbugs.gnu.org; Sat, 13 Jun 2020 15:42:00 -0400 Received: from mail-wm1-f46.google.com ([209.85.128.46]:52992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkC2N-0001nZ-Cc for 41839@debbugs.gnu.org; Sat, 13 Jun 2020 15:41:58 -0400 Received: by mail-wm1-f46.google.com with SMTP id r9so10887396wmh.2 for <41839@debbugs.gnu.org>; Sat, 13 Jun 2020 12:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=a9zzTa9ejzdaIGoo65ggUDBrQ6Gy7gHFs2bSFTc2/Tw=; b=GiiHRaXY4kfcxLjDejAu0xyk7pXAqIEgmGl3baqAC977wZlMoJu3d90QiD4dYefkFl eHmI1uLDwepvFxOV/H6DS3X+EVA20Ewk21VrlWQQ9KhcFqDd9QpgSxbTiiyWosC7DNWp 7hUNo0HIA2wiehAKyLCABgsJlO7xyeOpUoCacUvxQO84ApqiM7S2921cPy02QV5rott8 MuKVfYi+zbaX+Q4IfOtBamWLQwUIPk4lpyxcPjubyUs0cX2aOP8//PdNkVFC9m1q6CuQ 0HN+pqI5fNzKRqBXGfMsrul5iLwnWrGHTuX0cD12c4vqxm1NzdiK2p7m4ViAwDMmz+pw k0qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=a9zzTa9ejzdaIGoo65ggUDBrQ6Gy7gHFs2bSFTc2/Tw=; b=QZ1R0xQEQeRtEYt3qUVW4uIqL236GUi8ZwM6RHzavnE89z1yphH4xm2iehY2CskMg/ UpNflm/BDp7zIVZMZKwdvxsZ6WIbcafNYo/nDpBr4Pt2Qq5S5RQa1pVbah8Sr0+XM75c jYuj6bPcrB5VOyw/7QiPQowHWG5jrFl7X7WxIfPT1heSpYszG9Q6UOYmX6pZQllN2cCY N8wS+MefjhiRrBLRyUu3i5mRJ0Uz2f+5zqoHw3YPULtxlDMbFHd7fqhgSHMpaVM3ElIN oWmBF89r0KvYOy87EfdS1cgDZDPM70xnum6oMyBsGrOD/rHS5J8bAB6bB9kOAAAyBNeJ I3VQ== X-Gm-Message-State: AOAM530LuEXbTZzwJVlPwaFifk8OmDnZAA1tys8ot96WgUKiNvdSUZTL Kb031GDO6mbdWxmsUFJcWtyxkoqcIRY= X-Google-Smtp-Source: ABdhPJxgDfx91LjXFdz5WHZ8pznPMaRNM2MWwwOKXslwRtfdb3NDrPsMniEKbPLPXcVxZTc3Vjt6Vw== X-Received: by 2002:a1c:5603:: with SMTP id k3mr5199814wmb.116.1592077308997; Sat, 13 Jun 2020 12:41:48 -0700 (PDT) Received: from meru.fronius.com ([2a01:e0a:fa:a50:d869:cbcf:2456:40cc]) by smtp.gmail.com with ESMTPSA id a6sm15968918wrn.38.2020.06.13.12.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 12:41:48 -0700 (PDT) From: Mathieu Othacehe X-Google-Original-From: Mathieu Othacehe Date: Sat, 13 Jun 2020 21:41:39 +0200 Message-Id: <20200613194140.10367-1-othacehe@gnu.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches This moves hurd-disk-image to a dedicated file. It also defines a default operating-system so that the image can be built standalone. * gnu/system/images/hurd.scm: New file, * gnu/local.mk (GNU_SYSTEM_MODULES): add it. * gnu/image.scm ()[name]: New field. * gnu/system/image.scm (root-offset, root-label): Export it, (hurd-disk-image): remove it as this is now defined in the new, Hurd dedicated file above, (find-image): adapt to avoid loop dependency. --- gnu/image.scm | 2 + gnu/local.mk | 2 + gnu/system/image.scm | 23 +++--------- gnu/system/images/hurd.scm | 76 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 17 deletions(-) create mode 100644 gnu/system/images/hurd.scm diff --git a/gnu/image.scm b/gnu/image.scm index 19b466527b..dc66f2c533 100644 --- a/gnu/image.scm +++ b/gnu/image.scm @@ -67,6 +67,8 @@ (define-record-type* image make-image image? + (name image-name ;symbol + (default #f)) (format image-format) ;symbol (target image-target (default #f)) diff --git a/gnu/local.mk b/gnu/local.mk index 583274235b..eeeb276478 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -629,6 +629,8 @@ GNU_SYSTEM_MODULES = \ %D%/system/uuid.scm \ %D%/system/vm.scm \ \ + %D%/system/images/hurd.scm \ + \ %D%/machine.scm \ %D%/machine/digital-ocean.scm \ %D%/machine/ssh.scm \ diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 1bda25fd7f..cb8fe18bcc 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -53,10 +53,12 @@ #:use-module (srfi srfi-35) #:use-module (rnrs bytevectors) #:use-module (ice-9 match) - #:export (esp-partition + #:export (root-offset + root-label + + esp-partition root-partition - hurd-disk-image efi-disk-image iso9660-image @@ -101,20 +103,6 @@ (list #:make-device-nodes make-hurd-device-nodes))))) -(define hurd-disk-image - (image - (format 'disk-image) - (target "i586-pc-gnu") - (partitions - (list (partition - (size 'guess) - (offset root-offset) - (label root-label) - (file-system "ext2") - (file-system-options '("-o" "hurd" "-O" "ext_attr")) - (flags '(boot)) - (initializer hurd-initialize-root-partition)))))) - (define efi-disk-image (image (format 'disk-image) @@ -569,7 +557,8 @@ addition of the record." (_ (cond ((and target (hurd-triplet? target)) - hurd-disk-image) + (module-ref (resolve-interface '(gnu system images hurd)) + 'hurd-disk-image)) (else efi-disk-image))))) diff --git a/gnu/system/images/hurd.scm b/gnu/system/images/hurd.scm new file mode 100644 index 0000000000..4417f03cc8 --- /dev/null +++ b/gnu/system/images/hurd.scm @@ -0,0 +1,76 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2020 Mathieu Othacehe +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu system images hurd) + #:use-module (guix gexp) + #:use-module (gnu bootloader) + #:use-module (gnu bootloader grub) + #:use-module (gnu image) + #:use-module (gnu packages ssh) + #:use-module (gnu services) + #:use-module (gnu services ssh) + #:use-module (gnu system) + #:use-module (gnu system file-systems) + #:use-module (gnu system hurd) + #:use-module (gnu system image) + #:export (hurd-barebones-os + hurd-disk-image + hurd-barebones-disk-image)) + +(define hurd-barebones-os + (operating-system + (inherit %hurd-default-operating-system) + (bootloader (bootloader-configuration + (bootloader grub-minimal-bootloader) + (target "/dev/sdX"))) + (file-systems (cons (file-system + (device (file-system-label "my-root")) + (mount-point "/") + (type "ext2")) + %base-file-systems)) + (host-name "guixygnu") + (timezone "Europe/Amsterdam") + (packages (cons openssh-sans-x %base-packages/hurd)) + (services (cons (service openssh-service-type + (openssh-configuration + (openssh openssh-sans-x) + (use-pam? #f) + (port-number 2222) + (permit-root-login #t) + (allow-empty-passwords? #t) + (password-authentication? #t))) + %base-services/hurd)))) + +(define hurd-disk-image + (image + (format 'disk-image) + (target "i586-pc-gnu") + (partitions + (list (partition + (size 'guess) + (offset root-offset) + (label root-label) + (file-system "ext2") + (flags '(boot)) + (initializer (gexp initialize-root-partition))))))) + +(define hurd-barebones-disk-image + (image + (inherit hurd-disk-image) + (name 'hurd-barebones-disk-image) + (operating-system hurd-barebones-os)))