blob: 9f0bdc40daf1c7368ba299eddd735d7f03b0f425 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
(define-module (ryan-services file-manager)
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu services)
#:use-module (gnu services configuration)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (srfi srfi-1)
#:use-module (guix gexp))
(define-public (home-symlinks files)
;; Simple service to symlink two paths. Treats all paths with HOME prepended
(for-each (lambda (pair)
(let ((path1 (car pair))
(path2 (cadr pair)))
(let ((full-path1 (string-append (getenv "HOME") "/" path1))
(full-path2 (string-append (getenv "HOME") "/" path2)))
(if (file-exists? full-path2)
(if (eq? (stat:type (lstat full-path2)) 'regular)
((display (format #f "WARNING: Deleting regular file ~a.\n" full-path2))
(delete-file full-path2)
(symlink full-path1 full-path2))
#f)
(symlink full-path1 full-path2)))))
files))
|