~whereiseveryone/guixrus

guixrus/guixrus/packages/riddim.scm -rw-r--r-- 5.8 KiB
beb74e80(unmatched-parenthesis [urgent fix] turns out patch location doesn't work out of the box in non-`guix` channels... 8 days ago
                                                                                
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
;;; GNU Guix --- Functional package management for GNU
;;; Copyright   2022 Stephen Paul Weber <singpolyma.net>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (guixrus packages riddim)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix build-system copy)
  #:use-module (guix build-system trivial)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages lua)
  #:use-module (guix hg-download))

(define-public squish
  (package
    (name "squish")
    (version "0.0.0-7d6070e5a096")
    (source
      (origin
        (method hg-fetch)
        (uri (hg-reference
          (url "https://code.matthewwild.co.uk/squish")
          (changeset "7d6070e5a096")))
        (sha256
          (base32
            "1gvcij7yssml5q77gp85hw7irslqml8dp8qnh4da6lnzik8w9jil"))))
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f ; there are none
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (add-after 'unpack 'patch-generated-shebang
           (lambda* (#:key outputs #:allow-other-keys)
             (substitute* "Makefile"
               (("install squish") "install -D squish")
               (("/usr/local") (assoc-ref outputs "out")))
             (substitute* "squish.lua"
               (("#!/usr/bin/env lua") (string-append "#!" (which "lua")))))))))
    (native-inputs
     `(("lua" ,lua-5.2)))
    (synopsis
      "")
    (description
      "")
    (home-page "https://code.matthewwild.co.uk/squish")
    (license license:expat)))

(define prosody-source-0.10
  (origin
    (method hg-fetch)
      (uri (hg-reference
        (url "https://hg.prosody.im/0.10")
        (changeset "bb8486491b48")))
      (sha256
        (base32
          "188j0g3b2hia7adl7b13wn23j1al23aly51k08abmiqcd5s3dmwb"))))

(define-public lua-verse
  (package
    (name "lua-verse")
    (version "0.0.0-a9be85b2da17")
    (source
      (origin
        (method hg-fetch)
        (uri (hg-reference
          (url "https://code.matthewwild.co.uk/verse")
          (changeset "a9be85b2da17")))
        (sha256
          (base32
            "12r9i30fqkh367wrc5v9m71z6dnfsfrp5021xlyz5zdkjj8n2qy7"))))
    (build-system copy-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'install 'squish
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (outdir (string-append out "/share/lua/5.2"))
                    (outfile (string-append outdir "/verse.lua")))
             (invoke "squish"
               (string-append "--prosody=" (assoc-ref inputs "prosody-source")))
             (mkdir-p outdir)
             (call-with-output-file outfile
               (lambda (port)
                 (format port
                   "package.path = '~a/share/lua/5.2/?.lua;~a/share/lua/5.2/?.lua;~a/share/lua/5.2/?.lua;' .. package.path;~@
                    package.cpath = '~a/lib/lua/5.2/?.so;~a/lib/lua/5.2/?.so;~a/lib/lua/5.2/?.so;' .. package.cpath;\n"
                   (assoc-ref inputs "lua-socket")
                   (assoc-ref inputs "lua-expat")
                   (assoc-ref inputs "lua-sec")
                   (assoc-ref inputs "lua-socket")
                   (assoc-ref inputs "lua-expat")
                   (assoc-ref inputs "lua-sec"))
                 (call-with-input-file "verse.lua" (lambda (inport)
                   (dump-port inport port))))))))
         (delete 'install))))
    (inputs
     `(("lua-socket" ,lua5.2-socket)
       ("lua-expat" ,lua5.2-expat)
       ("lua-sec" ,lua5.2-sec)))
    (native-inputs
     `(("squish" ,squish)
       ("lua" ,lua-5.2)
       ("prosody-source" ,prosody-source-0.10)))
    (synopsis
      "")
    (description
      "")
    (home-page "https://code.matthewwild.co.uk/verse")
    (license license:expat)))

(define-public riddim
  (package
    (name "riddim")
    (version "1c2b8d10ceed")
    (source
      (origin
        (method hg-fetch)
        (uri (hg-reference
          (url "https://code.matthewwild.co.uk/riddim")
          (changeset version)))
        (sha256
          (base32
            "0yyajkfn4q7ak31xv7rfm0wxlp4xmck0l4jviblzymj7zgdqgvzx"))))
    (build-system copy-build-system)
    (arguments
     `(#:install-plan '(("riddim.lua" "bin/riddim"))
       #:phases
       (modify-phases %standard-phases
         (add-before 'install 'squish
           (lambda* (#:key inputs #:allow-other-keys)
             (let* ((verse (string-append (assoc-ref inputs "lua-verse") "/share/lua/5.2/verse.lua")))
               (substitute* "init.lua"
                 (("local verse =")
                   (string-append "package.preload['verse'] = (function(...)
                       return dofile(\"" verse "\");
                     end)\n\nlocal verse =")))
               (substitute* "squishy"
                 (("\"youtube\",") "\"youtube\", \"servercontact\"")))
             (invoke "squish" "--executable")
             (chmod "riddim.lua" #o755))))))
    (inputs
     `(("lua" ,lua-5.2)))
    (native-inputs
     `(("squish" ,squish)
       ("lua-verse" ,lua-verse)))
    (synopsis
      "")
    (description
      "")
    (home-page "https://code.matthewwild.co.uk/riddim")
    (license license:expat)))