home: import: Fix handling of manifest entries with specific output.

specification->package fails on manifest entries with specific outputs,
resulting in an invalid home configuration.  This changes the import command
to use specification->package+output instead.

* guix/scripts/home/import.scm (manifest+configuration-files->code): Make sure
manifest entries with specific output are also handled.
* tests/home-import.scm: Specify output in home environment manifest entry.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Arjan Adriaanse 2022-01-02 18:20:45 +01:00 committed by Ludovic Courtès
parent 282197b521
commit d7fb57bcd5
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 11 additions and 7 deletions

View file

@ -2,6 +2,7 @@
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Arjan Adriaanse <arjan@adriaan.se>
;;;
;;; This file is part of GNU Guix.
;;;
@ -164,7 +165,8 @@ (define (manifest+configuration-files->code manifest
,@(delete-duplicates (concatenate modules)))
(home-environment
(packages (map specification->package ,packages))
(packages (map (compose list specification->package+output)
,packages))
(services (list ,@services)))))))))
(define* (import-manifest

View file

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2022 Arjan Adriaanse <arjan@adriaan.se>
;;;
;;; This file is part of GNU Guix.
;;;
@ -52,7 +53,8 @@ (define glibc
(define gcc
(manifest-entry
(name "gcc")
(version "10.3.0")
(version "")
(output "lib")
(item "/gnu/store/...")))
;; Helpers for checking and generating home environments.
@ -101,8 +103,8 @@ (define-home-environment-matcher match-home-environment-no-services
('gnu 'services))
('home-environment
('packages
('map 'specification->package
('list "guile@2.0.9" "gcc" "glibc@2.19")))
('map ('compose 'list 'specification->package+output)
('list "guile@2.0.9" "gcc:lib" "glibc@2.19")))
('services
('list)))))
@ -118,7 +120,7 @@ (define-home-environment-matcher match-home-environment-transformations
('home-environment
('packages
('list (transform ('specification->package "guile@2.0.9"))
('specification->package "gcc")
('list ('specification->package "gcc") "lib")
('specification->package "glibc@2.19")))
('services ('list)))))
@ -130,7 +132,7 @@ (define-home-environment-matcher match-home-environment-no-services-nor-packages
('gnu 'services))
('home-environment
('packages
('map 'specification->package
('map ('compose 'list 'specification->package+output)
('list)))
('services
('list)))))
@ -145,7 +147,7 @@ (define-home-environment-matcher match-home-environment-bash-service
('gnu 'home 'services 'shells))
('home-environment
('packages
('map 'specification->package
('map ('compose 'list 'specification->package+output)
('list)))
('services
('list ('service