Paste number 317551: script->package

Paste number 317551: script->package
Pasted by: davexunit
When:5 years, 5 months ago
Share:Tweet this! | http://paste.lisp.org/+6T0V
Channel:None
Paste contents:
Raw Source | XML | Display As
(define (script->package source-file interpreter)
  (package
    (name (basename source-file))
    (version "1")
    (source source-file)
    (build-system trivial-build-system)
    (arguments
     '(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let* ((bin (string-append %output "/bin"))
                (source (assoc-ref %build-inputs "source"))
                (exe (string-append bin "/" (strip-store-file-name source)))
                (interpreter (assoc-ref %build-inputs "interpreter")))
           (mkdir-p bin)
           (copy-file source exe)
           (patch-shebang exe
                          (list (string-append interpreter "/bin")
                                (string-append interpreter "/sbin")))))))
    (inputs
     `(("interpreter" ,interpreter)))
    (synopsis (string-append "Guix wrapper for " name))
    (description (string-append "Guix wrapper for the " name " "
                                (package-name interpreter)
                                " script."))
    (home-page #f)
    (license #f)))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.