services: home-writable-files-manager: Improve handling of out-of-store files.

* modules/rosenthal/home/services/writable-files-manager.scm
  (update-writable-files-script)
  [cleanup-writable-files]: Handle copied and symlinked targets differently.
  [create-writable-files]: Create symlink when source doesn't exist.
This commit is contained in:
Hilton Chain committed 2026-11-30 10:55:10 +08:00
1 parent a8da12053f
commit 6af9d5426f
1 file changed
+5 -3
@@ -146,8 +146,9 @@ subdirectory from XDG_CONFIG_HOME to generate a target path."
;; we'll create later, it will be backed up later during
;; create-writable-files phase.
(if (or (symlink-to-store? target)
(equal? (file-hash* source)
(file-hash* target)))
(equal?
(file-hash* (if (symbolic-link? target) file source))
(file-hash* target)))
(begin
(format #t (G_ "Removing ~a...") target)
(delete-file target)
@@ -213,7 +214,8 @@ subdirectory from XDG_CONFIG_HOME to generate a target path."
(backup-file (strip file)))
(format #t (G_ "Copying ~a -> ~a...")
source target)
(if (file-is-directory? source)
(if (or (not (file-exists? source))
(file-is-directory? source))
(symlink source target)
(begin
(copy-file source target)