mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
guix home: import: Make the user to specify a destination directory.
Copy the appropriate the relevant configuration files to the destination directory, and call ‘local-file’ on them. Without this, ‘guix home import’ will generate a service declaration like this (service home-bash-service-type (home-bash-configuration (bashrc (list (slurp-file-gexp (local-file "/home/yoctocell/.bashrc")))))) but when running ‘guix home reconfigure’, the ~/.bashrc file would be moved, so when running ‘guix home reconfigure’ for the second time, it would read the ~/.bashrc which is itself a symlink to a file the store. * guix/scripts/home/import.scm (generate-bash-module+configuration): Take ‘destination-directory’ parameter (modules+configurations): Copy the user’s configuration file to ‘%destination-directory’. * guix/scripts/home.scm (process-command): Adjust accordingly; create ‘destination’ if it doesn’t exist. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
cf0abb6cfe
commit
d5eb05f01e
2 changed files with 65 additions and 45 deletions
|
@ -40,6 +40,7 @@
|
|||
#:autoload (guix scripts pull) (channel-commit-hyperlink)
|
||||
#:use-module (guix scripts home import)
|
||||
#:use-module ((guix status) #:select (with-status-verbosity))
|
||||
#:use-module ((guix build utils) #:select (mkdir-p))
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix monads)
|
||||
#:use-module (srfi srfi-1)
|
||||
|
@ -260,15 +261,20 @@ argument list and OPTS is the option alist."
|
|||
(apply search args))
|
||||
((import)
|
||||
(let* ((profiles (delete-duplicates
|
||||
(match (filter-map (match-lambda
|
||||
(('profile . p) p)
|
||||
(_ #f))
|
||||
opts)
|
||||
(() (list %current-profile))
|
||||
(lst (reverse lst)))))
|
||||
(manifest (concatenate-manifests
|
||||
(map profile-manifest profiles))))
|
||||
(import-manifest manifest (current-output-port))))
|
||||
(match (filter-map (match-lambda
|
||||
(('profile . p) p)
|
||||
(_ #f))
|
||||
opts)
|
||||
(() (list %current-profile))
|
||||
(lst (reverse lst)))))
|
||||
(manifest (concatenate-manifests
|
||||
(map profile-manifest profiles)))
|
||||
(destination (match args
|
||||
((destination) destination)
|
||||
(_ (leave (G_ "wrong number of arguments~%"))))))
|
||||
(unless (file-exists? destination)
|
||||
(mkdir-p destination))
|
||||
(import-manifest manifest destination (current-output-port))))
|
||||
((describe)
|
||||
(match (generation-number %guix-home)
|
||||
(0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue