system: hurd: Create a proper profile.
* gnu/system/hurd.scm (compile-manifest): New procedure. (cross-hurd-image)[for-hurd, hurd-os]: Remove. [cross-built, cross-built-entry]: New procedures. [system-profile]: New variable. [grub.cfg]: Use 'cross-built'. [profile]: Rename to... [etc-profile]: ... this, and adjust accordingly. [hurd-directives]: Create /run/current-system/profile and /etc/profile. Adjust arguments to 'qemu-image'.
This commit is contained in:
		
							parent
							
								
									df0010a9dc
								
							
						
					
					
						commit
						c621269404
					
				
					 1 changed files with 45 additions and 24 deletions
				
			
		| 
						 | 
					@ -18,6 +18,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define-module (gnu system hurd)
 | 
					(define-module (gnu system hurd)
 | 
				
			||||||
  #:use-module (guix gexp)
 | 
					  #:use-module (guix gexp)
 | 
				
			||||||
 | 
					  #:use-module (guix profiles)
 | 
				
			||||||
  #:use-module (guix utils)
 | 
					  #:use-module (guix utils)
 | 
				
			||||||
  #:use-module (gnu bootloader grub)
 | 
					  #:use-module (gnu bootloader grub)
 | 
				
			||||||
  #:use-module (gnu packages base)
 | 
					  #:use-module (gnu packages base)
 | 
				
			||||||
| 
						 | 
					@ -36,24 +37,39 @@
 | 
				
			||||||
;;;
 | 
					;;;
 | 
				
			||||||
;;; Code:
 | 
					;;; 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
 | 
					(define %base-packages/hurd
 | 
				
			||||||
  (list hurd bash coreutils file findutils grep sed guile-3.0))
 | 
					  (list hurd bash coreutils file findutils grep sed guile-3.0))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define* (cross-hurd-image #:key (hurd hurd) (gnumach gnumach))
 | 
					(define* (cross-hurd-image #:key (hurd hurd) (gnumach gnumach))
 | 
				
			||||||
  "Return a cross-built GNU/Hurd image."
 | 
					  "Return a cross-built GNU/Hurd image."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (define (for-hurd p)
 | 
					  (define (cross-built thing)
 | 
				
			||||||
    (with-parameters ((%current-target-system "i586-pc-gnu")) p))
 | 
					    (with-parameters ((%current-target-system "i586-pc-gnu"))
 | 
				
			||||||
 | 
					      thing))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (define hurd-os
 | 
					  (define (cross-built-entry entry)
 | 
				
			||||||
    (directory-union "gnu+hurd"
 | 
					    (manifest-entry
 | 
				
			||||||
                     (cons (with-parameters ((%current-system "i686-linux"))
 | 
					      (inherit entry)
 | 
				
			||||||
                             gnumach)
 | 
					      (item (cross-built (manifest-entry-item entry)))
 | 
				
			||||||
                           (map for-hurd %base-packages/hurd))))
 | 
					      (dependencies (map cross-built-entry
 | 
				
			||||||
 | 
					                         (manifest-entry-dependencies entry)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  (define system-profile
 | 
				
			||||||
 | 
					    (map-manifest-entries cross-built-entry
 | 
				
			||||||
 | 
					                          (packages->manifest %base-packages/hurd)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (define grub.cfg
 | 
					  (define grub.cfg
 | 
				
			||||||
    (let ((hurd (with-parameters ((%current-target-system "i586-pc-gnu"))
 | 
					    (let ((hurd (cross-built hurd))
 | 
				
			||||||
                  hurd))
 | 
					 | 
				
			||||||
          (mach (with-parameters ((%current-system "i686-linux"))
 | 
					          (mach (with-parameters ((%current-system "i686-linux"))
 | 
				
			||||||
                  gnumach))
 | 
					                  gnumach))
 | 
				
			||||||
          (libc (cross-libc "i586-pc-gnu")))
 | 
					          (libc (cross-libc "i586-pc-gnu")))
 | 
				
			||||||
| 
						 | 
					@ -77,17 +93,6 @@ menuentry \"GNU\" {
 | 
				
			||||||
                                   #+mach #+mach #+hurd
 | 
					                                   #+mach #+mach #+hurd
 | 
				
			||||||
                                   #+libc #+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
 | 
					  (define fstab
 | 
				
			||||||
    (plain-file "fstab"
 | 
					    (plain-file "fstab"
 | 
				
			||||||
                "# This file was generated from your Guix configuration.  Any changes
 | 
					                "# This file was generated from your Guix configuration.  Any changes
 | 
				
			||||||
| 
						 | 
					@ -106,6 +111,19 @@ PATH=~a/bin:~a/sbin:~a/hurd
 | 
				
			||||||
                "root::0:0:0:0:::
 | 
					                "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
 | 
					  (define hurd-directives
 | 
				
			||||||
    `((directory "/servers")
 | 
					    `((directory "/servers")
 | 
				
			||||||
      ,@(map (lambda (server)
 | 
					      ,@(map (lambda (server)
 | 
				
			||||||
| 
						 | 
					@ -130,7 +148,10 @@ PATH=~a/bin:~a/sbin:~a/hurd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ;; TODO: Create those during activation, eventually.
 | 
					      ;; TODO: Create those during activation, eventually.
 | 
				
			||||||
      (directory "/root")
 | 
					      (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/fstab" -> ,fstab)
 | 
				
			||||||
      ("/etc/passwd" -> ,passwd)
 | 
					      ("/etc/passwd" -> ,passwd)
 | 
				
			||||||
      ("/etc/shadow" -> ,shadow)
 | 
					      ("/etc/shadow" -> ,shadow)
 | 
				
			||||||
| 
						 | 
					@ -161,14 +182,14 @@ PATH=~a/bin:~a/sbin:~a/hurd
 | 
				
			||||||
  (qemu-image #:file-system-type "ext2"
 | 
					  (qemu-image #:file-system-type "ext2"
 | 
				
			||||||
              #:file-system-options '("-o" "hurd")
 | 
					              #:file-system-options '("-o" "hurd")
 | 
				
			||||||
              #:device-nodes 'hurd
 | 
					              #:device-nodes 'hurd
 | 
				
			||||||
              #:inputs `(("system" ,hurd-os)
 | 
					              #:inputs `(("system" ,system-profile)
 | 
				
			||||||
                         ("grub.cfg" ,grub.cfg)
 | 
					                         ("grub.cfg" ,grub.cfg)
 | 
				
			||||||
                         ("fstab" ,fstab)
 | 
					                         ("fstab" ,fstab)
 | 
				
			||||||
                         ("passwd" ,passwd)
 | 
					                         ("passwd" ,passwd)
 | 
				
			||||||
                         ("profile" ,profile)
 | 
					                         ("etc-profile" ,etc-profile)
 | 
				
			||||||
                         ("shadow" ,shadow))
 | 
					                         ("shadow" ,shadow))
 | 
				
			||||||
              #:copy-inputs? #t
 | 
					              #:copy-inputs? #t
 | 
				
			||||||
              #:os hurd-os
 | 
					              #:os system-profile
 | 
				
			||||||
              #:bootcfg-drv grub.cfg
 | 
					              #:bootcfg-drv grub.cfg
 | 
				
			||||||
              #:bootloader grub-bootloader
 | 
					              #:bootloader grub-bootloader
 | 
				
			||||||
              #:register-closures? #f
 | 
					              #:register-closures? #f
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue