guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch wip-hurd-vm updated: system: hurd: Create a proper profile.


From: guix-commits
Subject: branch wip-hurd-vm updated: system: hurd: Create a proper profile.
Date: Wed, 08 Apr 2020 10:37:45 -0400

This is an automated email from the git hooks/post-receive script.

civodul pushed a commit to branch wip-hurd-vm
in repository guix.

The following commit(s) were added to refs/heads/wip-hurd-vm by this push:
     new 4bae9c4  system: hurd: Create a proper profile.
4bae9c4 is described below

commit 4bae9c46464384fce8be6613c409c7202fcbde46
Author: Ludovic Courtès <address@hidden>
AuthorDate: Wed Apr 8 16:36:08 2020 +0200

    system: hurd: Create a proper profile.
    
    * gnu/system/hurd.scm (compile-manifest): New procedure.
    (cross-hurd-image)[for-hurd, hurd-os]: Remove.
    [system-profile]: New variable.
    [profile]: Rename to...
    [etc-profile]: ... this, and adjust accordingly.
    [hurd-directives]: Create /run/current-system/profile and /etc/profile.
    Adjust arguments to 'qemu-image'.
---
 gnu/system/hurd.scm | 62 +++++++++++++++++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 23 deletions(-)

diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm
index bf2946f..b617036 100644
--- a/gnu/system/hurd.scm
+++ b/gnu/system/hurd.scm
@@ -18,6 +18,7 @@
 
 (define-module (gnu system hurd)
   #:use-module (guix gexp)
+  #:use-module (guix profiles)
   #:use-module (guix utils)
   #:use-module (gnu bootloader grub)
   #:use-module (gnu packages admin)
@@ -40,20 +41,30 @@
 ;;;
 ;;; Code:
 
+;; XXX: Surely this belongs in (guix profiles), but perhaps we need high-level
+;; <profile> objects so one can specify hooks, etc.?
+(define-gexp-compiler (compile-manifest (manifest
+                                         (@@ (guix profiles) <manifest>))
+                                        system target)
+  "Lower MANIFEST as a profile."
+  (profile-derivation manifest
+                      #:system system
+                      #:target target))
+
 (define %base-packages/hurd
   (list hurd bash coreutils file findutils grep guile-3.0 guix openssh sed))
 
 (define* (cross-hurd-image #:key (hurd hurd) (gnumach gnumach))
   "Return a cross-built GNU/Hurd image."
 
-  (define (for-hurd p)
-    (with-parameters ((%current-target-system "i586-pc-gnu")) p))
-
-  (define hurd-os
-    (directory-union "gnu+hurd"
-                     (cons (with-parameters ((%current-system "i686-linux"))
-                             gnumach)
-                           (map for-hurd %base-packages/hurd))))
+  (define system-profile
+    (map-manifest-entries
+     (lambda (entry)
+       (manifest-entry
+         (inherit entry)
+         (item (with-parameters ((%current-target-system "i586-pc-gnu"))
+                 (manifest-entry-item entry)))))
+     (packages->manifest %base-packages/hurd)))
 
   (define grub.cfg
     (let ((hurd (with-parameters ((%current-target-system "i586-pc-gnu"))
@@ -81,17 +92,6 @@ menuentry \"GNU\" {
                                    #+mach #+mach #+hurd
                                    #+libc #+hurd))))))
 
-  (define profile
-    (let ((packages (map for-hurd %base-packages/hurd)))
-      (computed-file
-       "profile"
-       #~(call-with-output-file #$output
-           (lambda (port)
-             (format port "
-PATH=~a/bin:~a/sbin:~a/hurd
-"
-                     #+hurd-os #+hurd-os  #+hurd-os))))))
-
   (define fstab
     (plain-file "fstab"
                 "# This file was generated from your Guix configuration.  Any 
changes
@@ -116,6 +116,19 @@ guixbuilder:x:1:1:guixbuilder:/var/empty:/bin/no-sh
                 "root::0:0:0:0:::
 "))
 
+  (define etc-profile
+    (plain-file "profile"
+                "\
+export PS1='\\u@\\h\\$ '
+
+GUIX_PROFILE=\"/run/current-system/profile\"
+. \"$GUIX_PROFILE/etc/profile\"
+
+GUIX_PROFILE=\"$HOME/.guix-profile\"
+if [ -f \"$GUIX_PROFILE/etc/profile\" ]; then
+  . \"$GUIX_PROFILE/etc/profile\"
+fi\n"))
+
   (define hurd-directives
     `((directory "/servers")
       ,@(map (lambda (server)
@@ -140,7 +153,10 @@ guixbuilder:x:1:1:guixbuilder:/var/empty:/bin/no-sh
 
       ;; TODO: Create those during activation, eventually.
       (directory "/root")
-      ("/root/.profile" -> ,profile)
+      (directory "/run")
+      (directory "/run/current-system")
+      ("/run/current-system/profile" -> ,system-profile)
+      ("/etc/profile" -> ,etc-profile)
       ("/etc/fstab" -> ,fstab)
       ("/etc/group" -> ,group)
       ("/etc/passwd" -> ,passwd)
@@ -171,15 +187,15 @@ guixbuilder:x:1:1:guixbuilder:/var/empty:/bin/no-sh
 
   (qemu-image #:file-system-type "ext2"
               #:file-system-options '("-o" "hurd")
-              #:inputs `(("system" ,hurd-os)
+              #:inputs `(("system" ,system-profile)
                          ("grub.cfg" ,grub.cfg)
                          ("fstab" ,fstab)
                          ("passwd" ,passwd)
                          ("group" ,group)
-                         ("profile" ,profile)
+                         ("etc-profile" ,etc-profile)
                          ("shadow" ,shadow))
               #:copy-inputs? #t
-              #:os hurd-os
+              #:os system-profile
               #:bootcfg-drv grub.cfg
               #:bootloader grub-bootloader
               #:register-closures? #f



reply via email to

[Prev in Thread] Current Thread [Next in Thread]