diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-04-08 16:36:08 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-04-11 21:01:32 +0200 |
commit | c62126940419d2a6c21e16e21a973990fb11e054 (patch) | |
tree | a288691006f25a965e1b684b58af41bf4f892506 /gnu/system | |
parent | df0010a9dc18937ba481393f9d153a476dac13c0 (diff) | |
download | guix-c62126940419d2a6c21e16e21a973990fb11e054.tar.gz guix-c62126940419d2a6c21e16e21a973990fb11e054.zip |
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'.
Diffstat (limited to 'gnu/system')
-rw-r--r-- | gnu/system/hurd.scm | 69 |
1 files changed, 45 insertions, 24 deletions
diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm index 7cf7476bd1..b35a99cdfc 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 base) @@ -36,24 +37,39 @@ ;;; ;;; 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 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 (cross-built thing) + (with-parameters ((%current-target-system "i586-pc-gnu")) + thing)) + + (define (cross-built-entry entry) + (manifest-entry + (inherit entry) + (item (cross-built (manifest-entry-item entry))) + (dependencies (map cross-built-entry + (manifest-entry-dependencies entry))))) - (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 cross-built-entry + (packages->manifest %base-packages/hurd))) (define grub.cfg - (let ((hurd (with-parameters ((%current-target-system "i586-pc-gnu")) - hurd)) + (let ((hurd (cross-built hurd)) (mach (with-parameters ((%current-system "i686-linux")) gnumach)) (libc (cross-libc "i586-pc-gnu"))) @@ -77,17 +93,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 @@ -106,6 +111,19 @@ PATH=~a/bin:~a/sbin:~a/hurd "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) @@ -130,7 +148,10 @@ PATH=~a/bin:~a/sbin:~a/hurd ;; 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/passwd" -> ,passwd) ("/etc/shadow" -> ,shadow) @@ -161,14 +182,14 @@ PATH=~a/bin:~a/sbin:~a/hurd (qemu-image #:file-system-type "ext2" #:file-system-options '("-o" "hurd") #:device-nodes 'hurd - #:inputs `(("system" ,hurd-os) + #:inputs `(("system" ,system-profile) ("grub.cfg" ,grub.cfg) ("fstab" ,fstab) ("passwd" ,passwd) - ("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 |