executable_youtube-build 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/run/current-system/profile/bin/guile \
  2. --no-auto-compile -e (youtube-build) -s
  3. !#
  4. ;;;; youtube-build --- SYNOPSIS
  5. ;;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
  6. ;;;; Released under the GNU GPLv3 or any later version.
  7. (define-module (youtube-build)
  8. #:use-module (srfi srfi-37)
  9. #:use-module (guix discovery)
  10. #:use-module (guix packages)
  11. #:use-module (guix monads)
  12. #:use-module (guix store)
  13. #:use-module (guix derivations)
  14. #:export (main))
  15. ;;; Commentary:
  16. ;;;
  17. ;;; DESCRIPTION
  18. ;;;
  19. ;;; Code:
  20. (define %options
  21. (let ((display-and-exit-proc (lambda (msg)
  22. (lambda (opt name arg loads)
  23. (display msg) (quit)))))
  24. (list (option '(#\v "version") #f #f
  25. (display-and-exit-proc "youtube-build version 0.0.1\n"))
  26. (option '(#\h "help") #f #f
  27. (display-and-exit-proc
  28. "Usage: youtube-build ...")))))
  29. (define %default-options
  30. '())
  31. (define c (open-connection))
  32. (define (main args)
  33. (define opts
  34. (args-fold (cdr (program-arguments))
  35. %options
  36. (lambda (opt name arg loads)
  37. (error "Unrecognized option `~A'" name))
  38. (lambda (op loads)
  39. (cons op loads))
  40. %default-options))
  41. (add-to-load-path "/home/oleg/src/music")
  42. (map (lambda (package)
  43. (run-with-store c (package->derivation package)))
  44. (fold-module-public-variables cons '()
  45. (all-modules (map (lambda (entry)
  46. `(,entry . "music"))
  47. %load-path)))))
  48. ;;; youtube-build ends here