~singpolyma/jmp-pay

7c850ab77171c3a66e02a45151dde55ffbc948ef — Christopher Vollick 10 months ago 0345edb
Modernize guix

I've taken the pattern from jmp-register and imported it over here.
Main takeaways is that there's no module anymore, and there's a
manifest with dev dependencies.

So, basically it's much easier to now just run `guix shell` and have
that work automatically, but also have things like pry!
Wow!

Even if you wanted to test build, though, it's now the simpler:
  guix build --with-source=$PWD -f guix.scm

Rather than the older version that used `-L.` and had jmp-pay and then
also had to specify that that was the source you were overriding.
2 files changed, 129 insertions(+), 23 deletions(-)

R jmp-pay.scm => guix.scm
A manifest.scm
R jmp-pay.scm => guix.scm +33 -23
@@ 1,15 1,20 @@
(define-module (jmp-pay)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system ruby)
  #:use-module (guix build-system copy)
  #:use-module (gnu packages ruby)
  #:use-module (gnu packages databases)
  #:use-module (ice-9 rdelim)
  #:use-module (ice-9 popen)
)
(use-modules
  ((guix licenses) #:prefix license:)
  (guix packages)
  (guix download)
  (guix git-download)
  (guix build-system ruby)
  (guix build-system copy)
  (gnu packages ruby)
  (gnu packages tls)
  (gnu packages databases)
  (ice-9 rdelim)
  (ice-9 popen))

(define-public ruby-eventmachine-openssl
  (package
    (inherit ruby-eventmachine)
    (inputs `(("openssl" ,openssl)))))

(define-public ruby-sucker-punch
  (package


@@ 871,16 876,25 @@
    (home-page "http://github.com/igrigorik/em-synchrony")
    (license license:expat)))

;;;;

(define %source-dir (dirname (current-filename)))
(define %git-dir (string-append %source-dir "/.git"))

;;;;
; Bake a template by eval'ing the leaves
(define-public (bake tmpl)
 (list
  (car tmpl)
  (cons (caadr tmpl) (map
   (lambda (x) (list (car x) (eval (cadr x) (current-module))))
   (cdadr tmpl)))))

; double-escaped template of the jmp-pay sexp
; This allows us to bake the expression without doing a full eval to a record,
; so it can be written
(define-public jmp-pay-template
  '(package
  '((package-input-rewriting `((,ruby-eventmachine . ,ruby-eventmachine-openssl)))
  (package
    (name "jmp-pay")
    (version (read-line (open-pipe* OPEN_READ "git" "--git-dir" %git-dir "describe" "--always" "--dirty")))
    (source


@@ 949,18 963,14 @@
      "Web service and cronjobs for payment handling")
    (home-page
      "https://git.singpolyma.net/jmp-pay")
    (license 'license:agpl3)))
    (license 'license:agpl3))))

; Baked version of jmp-pay-template with leaves eval'd
(define-public jmp-pay-baked
 (cons
  (car jmp-pay-template)
  (map
   (lambda (x) (list (car x) (eval (cadr x) (current-module))))
   (cdr jmp-pay-template))))
	(bake jmp-pay-template))

; Build clean from git the version from a local clone
; To build whatever is sitting in local use:
; guix build --with-source="jmp-pay@$(git describe --always --dirty)=$(pwd)" -L . jmp-pay
(define-public jmp-pay
  (eval jmp-pay-baked (current-module)))
; guix build --with-source=$PWD -f guix.scm

(eval jmp-pay-baked (current-module))

A manifest.scm => manifest.scm +96 -0
@@ 0,0 1,96 @@
(use-modules
  ((guix licenses) #:prefix license:)
  (guix packages)
  (guix download)
  (guix git-download)
  (guix build-system ruby)
  (guix build-system copy)
  (guix utils)
  (gnu packages dhall)
  (gnu packages ruby)
  (gnu packages rails)
  (gnu packages databases)
  (gnu packages tls)
  (gnu packages web)
  (ice-9 rdelim)
  (ice-9 popen))

(define jmp-pay (load "./guix.scm"))

(define-public ruby-interception
  (package
    (name "ruby-interception")
    (version "0.5")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "interception" version))
        (sha256
          (base32 "01vrkn28psdx1ysh5js3hn17nfp1nvvv46wc1pwqsakm6vb1hf55"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-rspec))
    (synopsis
      "Provides a cross-platform ability to intercept all exceptions as they are raised.")
    (description
      "This package provides a cross-platform ability to intercept all exceptions as
they are raised.")
    (home-page "http://github.com/ConradIrwin/interception")
    (license #f)))

(define-public ruby-pry-rescue
  (package
    (name "ruby-pry-rescue")
    (version "1.5.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "pry-rescue" version))
        (sha256
          (base32 "1wn72y8y3d3g0ng350ld92nyjln012432q2z2iy9lhwzjc4dwi65"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'skip-bogus-test
           (lambda _
             (substitute* "spec/source_location_spec.rb"
               (("time = Time.now") "skip")))))))
    (propagated-inputs (list ruby-interception ruby-pry))
    (native-inputs (list ruby-rspec ruby-pry-stack-explorer))
    (synopsis
      "Allows you to wrap code in Pry::rescue{ } to open a pry session at any unhandled exceptions")
    (description
      "Allows you to wrap code in Pry::rescue{ } to open a pry session at any unhandled
exceptions")
    (home-page "https://github.com/ConradIrwin/pry-rescue")
    (license license:expat)))

(define-public ruby-pry-reload
  (package
    (name "ruby-pry-reload")
    (version "0.3")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "pry-reload" version))
        (sha256
          (base32 "1gld1454sd5xp2v4vihrhcjh4sgkx7m1kc29qx1nr96r4z2gm471"))))
    (build-system ruby-build-system)
    (arguments
     ;; No tests
     `(#:tests? #f))
    (propagated-inputs (list ruby-listen))
    (synopsis "Tracks and reloads changed files")
    (description "Tracks and reloads changed files")
    (home-page "https://github.com/runa/pry-reload")
    (license #f)))

(concatenate-manifests
  (list
    (packages->manifest
      (list
        ruby-rubocop
        ruby-pry-reload
        ruby-pry-stack-explorer
        ruby-pry-rescue))
    (package->development-manifest jmp-pay)))