# channels-helpers.scm -rw-r--r-- 955 bytes View raw
                                                                                
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
26
27
(define (local-or-remote-url local-channel-name remote-channel-url)
  (let* ((local-channel-path
          (lambda (channel-name)
            (string-append (getenv "HOME")
                           "/work/"
                           channel-name)))
         (local-channel-git-path
          (lambda (channel-name)
            (string-append "file://"
                           (local-channel-path
                            channel-name)))))
    (if (file-exists? (local-channel-path local-channel-name))
        (local-channel-git-path local-channel-name)
        remote-channel-url)))

(define (local-or-remote-channel channel-name remote-channel-url)
  (channel
   (name (string->symbol channel-name))
   (url
    (local-or-remote-url channel-name remote-channel-url))))

(define extra-channels
  (lambda extra-channels
    (append extra-channels
            %default-channels)))

;; (local-or-remote-channel "rde" "https://github.com/abcdw/rde")