diff --git a/radix/home/services.scm b/radix/home/services.scm index 66ffc06..c5246a3 100644 --- a/radix/home/services.scm +++ b/radix/home/services.scm @@ -1,12 +1,26 @@ (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 - (@@ (gnu) service-module-hint)) - -(define-syntax-rule (try-use-modules hint modules ...) - ((@@ (gnu) try-use-modules) hint modules ...)) - -(define-syntax-rule (use-home-service-modules module ...) - (try-use-modules service-module-hint - (gnu home services module) ...)) +(define home-special-files-service-type + (service-type + (name 'home-special-files) + (extensions + (list (service-extension + home-activation-service-type + (lambda (files) + #~(for-each + ((@ (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.")))