home: services: Add home-special-file-service-type (which allows declaring symlinks to any kind of file, not only those in the store)
parent
310b855301
commit
454fbc942f
|
@ -1,12 +1,26 @@
|
||||||
(define-module (radix home services)
|
(define-module (radix home services)
|
||||||
#:export (use-home-service-modules))
|
#:use-module (guix gexp)
|
||||||
|
#:use-module (gnu home services)
|
||||||
|
#:use-module (gnu services)
|
||||||
|
#:use-module (srfi srfi-1)
|
||||||
|
#:export (home-special-files-service-type))
|
||||||
|
|
||||||
(define service-module-hint
|
(define home-special-files-service-type
|
||||||
(@@ (gnu) service-module-hint))
|
(service-type
|
||||||
|
(name 'home-special-files)
|
||||||
(define-syntax-rule (try-use-modules hint modules ...)
|
(extensions
|
||||||
((@@ (gnu) try-use-modules) hint modules ...))
|
(list (service-extension
|
||||||
|
home-activation-service-type
|
||||||
(define-syntax-rule (use-home-service-modules module ...)
|
(lambda (files)
|
||||||
(try-use-modules service-module-hint
|
#~(for-each
|
||||||
(gnu home services module) ...))
|
((@ (ice-9 match) match-lambda)
|
||||||
|
((target file)
|
||||||
|
(let* ((target (string-append (getenv "HOME") "/" target))
|
||||||
|
(pivot (string-append target ".new")))
|
||||||
|
(mkdir-p (dirname target))
|
||||||
|
(symlink file pivot)
|
||||||
|
(rename-file pivot target))))
|
||||||
|
'#$files)))))
|
||||||
|
(compose concatenate)
|
||||||
|
(extend append)
|
||||||
|
(description "Add special files to your home directory.")))
|
||||||
|
|
Loading…
Reference in New Issue