Commit graph

19 commits

Author SHA1 Message Date
Andrew Tropin d6b9a3faa8
home: symlink-manager: Use no-follow version of file-exists?.
* gnu/home/services/symlink-manager.scm (update-symlinks-script): Use
no-follow version of file-exists?.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-04-10 00:17:40 +02:00
Andrew Tropin 20645d8467
home: Add home-xdg-data-files-service-type.
* gnu/home/services.scm (home-xdg-data-files-service-type): New variable.
* gnu/home/services/symlink-manager.scm (update-symlinks-script): Add a proper
handling for XDG_DATA_HOME value.
* gnu/home/services/xdg.scm (home-xdg-mime-applications-service-type): Use
home-xdg-data-files service.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-04-08 20:13:48 +02:00
Andrew Tropin 5832d9fb60
home: symlink-manager: Remove appending of leading dot.
* gnu/home/services.scm (xdg-configuration-files-directory): Add leading dot.
* gnu/home/services.scm (xdg-configuration-files-service-type): Change name.
* gnu/home/services/shells.scm (add-shell-profile-file,
zsh-get-configuration-files, add-zsh-dot-configuration,
add-zsh-xdg-configuration, add-bash-configuration): Add leading dots.
* gnu/home/services/symlink-manager.scm (update-symlinks-script): Remove
leading dot.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-04-08 20:13:45 +02:00
Andrew Tropin 92c2397070
home: symlink-manager: Respect XDG_CONFIG_HOME during activation.
* gnu/home/services/symlink-manager.scm (update-symlinks-script): Respect
XDG_CONFIG_HOME during activation.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-20 19:02:41 +01:00
Andrew Tropin d3ef61ab17
home: Explicitly connect home-file and symlink-manager services.
* gnu/home/services.scm (home-files-directory): New variable.
* gnu/home/symlink-manager.scm (update-symlinks-script): Use
home-files-directory variable from (gnu home services).

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-20 19:02:41 +01:00
Andrew Tropin d05954047f
home: symlink-manager: Add missing 'done' word in message.
* gnu/home/services/symlink-manager.scm (update-symlinks-script): Add missing
'done' word in message, keep code width below 80 column.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-20 19:02:41 +01:00
Andrew Tropin 9e86e58d6f
home: symlink-manager: Use existing home-directory symbol.
* gnu/home/services/symlink-manager.scm (update-symlinks-script): Use
existing home-directory symbol instead of additional getenv call.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-20 19:02:40 +01:00
Ludovic Courtès 2a55f99aff
home: symlink-manager: Rename "path" to "file" where appropriate.
* gnu/home/services/symlink-manager.scm (update-symlinks-script):
[home-path]: Rename to...
[home-directory]: ... this.  Adjust users.
[backup-dir]: Rename to...
[backup-directory]: ... this.  Adjust user.
[get-target-path]: Rename to...
[target-file]: ... this.  Adjust users.
[get-backup-path]: Remove.
[backup-file]: Inline it.
[cleanup-symlinks](get-source-path): Rename to...
(source-file): ... this.  Adjust users.
Rename 'he-path' to 'home' and 'new-he-path' to 'pivot'.
2022-03-10 11:43:15 +01:00
Ludovic Courtès 1fb6ef0473
home: symlink-manager: 'create-symlinks' uses 'file-system-fold'.
This removes the need for two intermediate representations of the file
tree.

* gnu/home/services/symlink-manager.scm (update-symlinks-script)
[simplify-file-tree, file-tree-traverse]: Remove.
[create-symlinks]: Rewrite in terms of 'file-system-fold'.
2022-03-10 11:43:14 +01:00
Ludovic Courtès 5fa188e92e
home: symlink-manager: 'cleanup-symlinks' uses 'file-system-fold'.
* gnu/home/services/symlink-manager.scm (update-symlinks-script)[cleanup-symlinks]:
Take a home generation and iterate over its config files directly with
'file-system-fold'.  Adjuster caller accordingly.  Remove 'old-tree'.
2022-03-10 11:43:14 +01:00
Ludovic Courtès a3a76a8384
home: symlink-manager: Avoid extra 'lstat' call.
* gnu/home/services/symlink-manager.scm (update-symlinks-script)[symlink-to-store?]:
Avoid extra 'lstat' call.
2022-03-10 11:43:14 +01:00
Ludovic Courtès a81bb1e4bb
home: symlink-manager: Remove 'empty-directory?' and avoid TOCTTOU race.
This removes three 'stat' syscalls.

* gnu/home/services/symlink-manager.scm (update-symlinks-script)[empty-directory?]:
Remove.
[cleanup-symlinks]: Replace use of 'file-exists?', 'file-is-directory?',
and 'empty-directory?' by a single 'rmdir' call.
2022-03-10 11:43:14 +01:00
Ludovic Courtès e1b38046a6
home: symlink-manager: Use 'file-is-directory?'.
* gnu/home/services/symlink-manager.scm (update-symlinks-script)[directory?]:
Remove.
Change callers to use 'file-is-directory?' instead.
2022-03-10 11:43:13 +01:00
Ludovic Courtès cf803b71c7
home: symlink-manager: Use 'for-each' when used for effects.
* gnu/home/services/symlink-manager.scm (update-symlinks-script)[cleanup-symlinks]
[create-symlinks]: Use 'for-each' instead of 'map'.
2022-03-10 11:43:13 +01:00
Ludovic Courtès 7a8856f540
home: symlink-manager: Move helper procedures as top-level defines.
* gnu/home/services/symlink-manager.scm (update-symlinks-script): Remove
'config-home', which is unused.  Move 'home-path', 'backup-dir',
'get-target-path', 'get-backup-path', 'directory?', 'empty-directory?',
'symlink-to-store?', and 'backup-file' to the top level.  Move
'create-symlinks' and 'cleanup-symlinks' to the top level as well, and
add parameters.  Adjust callers.
2022-03-10 11:43:13 +01:00
Ludovic Courtès 66bf60a4cd
home: symlink-manager: Clarify module imports.
* gnu/home/services/symlink-manager.scm (update-symlinks-script): Wrap
body in 'with-imported-modules'.  Move (guix build utils) import to the
top.  Move #$%initialize-gettext after definitions.
2022-03-10 11:43:13 +01:00
Xinglu Chen cde3376b35
home: services: Make strings in Gexps translateble.
* gnu/home/services.scm (%initialize-gettext): New variable.
(compute-on-first-login-script): Use it.
(compute-on-change-gexp): Likewise.
* gnu/home/services/symlink-manager.scm (update-symlinks-script): Likewise.
* po/guix/POTFILES.in: Add gnu/home-services.scm and
gnu/home/services/symlink-manager.scm.

Suggested-by: Ludovic Courtès <ludo@gnu.org>
Link: <https://yhetil.org/guix-bugs/87sfvy8k1u.fsf@gnu.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-03 19:32:07 +01:00
Oleg Pykhalov 0e8d2df0f1
Move (gnu home-services) to (gnu home services).
* gnu/home-services.scm (%guix-home-root-directory): Replace
gnu/home-services.scm with "gnu/home/services.scm".
Rename to gnu/home/services.scm.
* gnu/local.mk
(GNU_SYSTEM_MODULES): Rename gnu/home-services.scm to gnu/home/services.scm.
* doc/he-config-bare-bones.scm:
Replace (gnu home-services) with (gnu home services).
* gnu/home.scm: Same.
* gnu/home/services/fontutils.scm: Same.
* gnu/home/services/mcron.scm: Same.
* gnu/home/services/shells.scm: Same.
* gnu/home/services/shepherd.scm: Same.
* gnu/home/services/symlink-manager.scm: Same.
* gnu/home/services/xdg.scm: Same.
* guix/scripts/home.scm: Same.
* guix/self.scm: Same.
2021-10-09 19:24:18 +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
Renamed from gnu/home-services/symlink-manager.scm (Browse further)