system: hurd: Add root profile.

* gnu/system/hurd.scm (%base-packages/hurd): New variable.
(cross-hurd-image)[for-hurd]: New function.
(cross-hurd-image)[hurd-os]: Use them.
(cross-hurd-image)[profile]: Hack'y .profile for root, only setting PATH.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-04-08 08:04:52 +02:00 committed by Ludovic Courtès
parent 5fbf4f85e1
commit da987ece8f
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -23,6 +23,8 @@ (define-module (gnu system hurd)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages file)
#:use-module (gnu packages guile)
#:use-module (gnu packages hurd)
#:use-module (gnu system vm)
#:export (cross-hurd-image))
@ -34,18 +36,20 @@ (define-module (gnu system hurd)
;;;
;;; Code:
(define %base-packages/hurd
(list hurd bash coreutils file findutils grep sed guile-3.0))
(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
(let-syntax ((for-hurd (syntax-rules ()
((_ things ...)
(list (with-parameters ((%current-target-system
"i586-pc-gnu"))
things) ...)))))
(directory-union "gnu+hurd"
(cons (with-parameters ((%current-system "i686-linux"))
gnumach)
(for-hurd hurd bash coreutils grep sed)))))
(map for-hurd %base-packages/hurd))))
(define grub.cfg
(let ((hurd (with-parameters ((%current-target-system "i586-pc-gnu"))
@ -73,6 +77,17 @@ (define grub.cfg
#+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
@ -84,14 +99,12 @@ (define fstab
(define passwd
(plain-file "passwd"
"root:x:0:0:root:/root:/bin/sh
"
))
"))
(define shadow
(plain-file "shadow"
"root::0:0:0:0:::
"
))
"))
(define hurd-directives
`((directory "/servers")
@ -117,6 +130,7 @@ (define hurd-directives
;; TODO: Create those during activation, eventually.
(directory "/root")
("/root/.profile" -> ,profile)
("/etc/fstab" -> ,fstab)
("/etc/passwd" -> ,passwd)
("/etc/shadow" -> ,shadow)
@ -151,6 +165,7 @@ (define hurd-directives
("grub.cfg" ,grub.cfg)
("fstab" ,fstab)
("passwd" ,passwd)
("profile" ,profile)
("shadow" ,shadow))
#:copy-inputs? #t
#:os hurd-os