Commit Graph

10 Commits

Author SHA1 Message Date
Xinglu Chen 40acbaf078
Add tests for ‘guix home import’.
* tests/home-import.scm: New file.
* Makefile.am (SCM_TESTS): Add it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-31 00:51:05 +02:00
Xinglu Chen 256bd71264
guix home: import: Delete duplicate modules when importing.
Two different services might require the same module(s), so delete duplicates
when generating the ‘use-modules’ form.

* import.scm (manifest->code): Delete duplicate modules.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-31 00:51:05 +02:00
Xinglu Chen e12e8aad35
guix home: import: Don’t use 'slurp-file-gexp'.
‘slurp-file-gexp’ is not a bound procedure.

* guix/scripts/home/import.scm (generate-bash-configuration+modules): Don’t
  use ‘slurp-file-gexp’.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-31 00:51:05 +02:00
Xinglu Chen 3be1a982f3
guix home: import: Fix module name for Bash service.
* guix/scripts/home/import.scm (generate-bash-configuration+modules): Change
(gnu home-services bash) to (gnu home-services shells); add (guix gexp).

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-31 00:51:05 +02:00
Xinglu Chen e4d09d25ae
guix home: import: Allow multiple modules to be imported for each service.
Previously, only one module could be imported for each service, e.g., only
(gnu home-services shell) could be imported when generating the Bash service
declaration.  However, for some services, multiple modules might need to be
imported in order for it to work.

* guix/scripts/home/import.scm (generate-bash-module+configuration): Rename to
...
(generate-bash-configuration+modules): ... this.
(%files-configurations-alist): Rename to ...
(%files+configurations-alist): ... this.
(modules+configurations): Rename to ...
(configurations+modules): ... this.
(manifest->code): Adjust accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-10-31 00:51:05 +02:00
Xinglu Chen d5eb05f01e
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>
2021-10-31 00:51:05 +02:00
Oleg Pykhalov fee0bced7f
home: services: configuration: Support file-like objects.
* gnu/home/services/configuration.scm (interpose): Operate only with file-like
objects.
(string-or-gexp?): Delete procedure.
(serialize-string-or-gexp): Rename to 'serialize-file-like'.
(text-config?): Call 'file-like' intead of 'string-or-gexp?'.
* guix/scripts/home/import.scm:
(generate-bash-module+configuration): Don't call slurp-file-gexp.
* gnu/home/services/configuration.scm: Move content ...
* gnu/services/configuration.scm: here.
* gnu/home/services/shells.scm: Delete (gnu home services configuration).
* gnu/home/services/xdg.scm: Same.
* gnu/local.mk: Same.
* tests/guix-home.sh:
Test home-bash-service-type and extension with home-bash-extension.
2021-10-09 19:24:19 +03:00
Oleg Pykhalov ba8ddb3480
gnu: Move (gnu home-services) to (gnu home services).
* gnu/home-services/configuration.scm: Move the content ...
* gnu/home/services/configuration.scm: ... here.
* doc/guix.texi:
Replace (gnu home-services mcron) with (gnu home services mcron).
Replace (gnu home-services) with (gnu home services).
* gnu/home.scm:
Replace (gnu home-services fontutils) with (gnu services fontutils).
Replace (gnu home-services shells) with (gnu home services shells).
Replace (gnu home-services symlink-manager) with
(gnu home services symlink-manager).
Replace (gnu home-services xdg) with (gnu home services xdg).
* gnu/home-services/fontutils.scm: Rename to gnu/services/fontutils.scm.
* gnu/home-services/mcron.scm: Move to gnu/home/services/mcron.scm.
Replace (gnu home-services shepherd) with (gnu home services shepherd).
* gnu/home-services.scm (%service-type-path):
Search home services in "gnu/services".
* gnu/home-services/shells.scm: Replace (gnu home-services configuration) with
(gnu home services configuration).
Rename to gnu/home/services/shells.scm.
Replace (gnu home-services utils) with (gnu home services utils).
* gnu/home-services/shepherd.scm: Move to gnu/home/services/shepherd.scm.
* gnu/home-services/symlink-manager.scm:
Rename to gnu/home/services/symlink-manager.scm.
* gnu/home-services/utils.scm: Rename to gnu/home/services/utils.scm.
* gnu/home-services/xdg.scm: Rename to gnu/home/services/xdg.scm.
* guix/scripts/home/import.scm:
Replace (gnu home-services bash) with (gnu home services bash).
* gnu/home-services.scm: Update documentation string.
* doc/he-config-bare-bones.scm:
Apply new (gnu home-services ...) modules location.
* gnu/local.mk (GNU_SYSTEM_MODULES): Same.
2021-10-08 15:36:18 +03:00
Andrew Tropin badf788f15
home-services: Add missing imports and function definition.
* gnu/home-services/configuration.scm: Add missing imports.
* gnu/home-services/utils.scm (list->human-readable-list): Add new function.
* gnu/home-services/configuration.scm: Add missing imports.
* gnu/home-services/xdg.scm: Fix ensure-list function.
* guix/scripts/home/import.scm: Add missing imports.

Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
2021-09-28 13:50:21 +03:00
Andrew Tropin 879abff4fd
scripts: home: Add import subcommand.
* guix/scripts/home/import.scm: New file.
* Makefile.am (MODULES): Add it.

Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
2021-09-09 20:26:51 +03:00