Add run script for Actual Server
parent
2b120529c5
commit
fee899ee77
|
@ -88,7 +88,8 @@
|
||||||
#:use-module (guix download)
|
#:use-module (guix download)
|
||||||
#:use-module (gnu packages)
|
#:use-module (gnu packages)
|
||||||
#:use-module (gnu packages node)
|
#:use-module (gnu packages node)
|
||||||
#:use-module
|
#:use-module (gnu packages guile)
|
||||||
|
#:use-module
|
||||||
(gnu packages gcc)
|
(gnu packages gcc)
|
||||||
#:use-module
|
#:use-module
|
||||||
(guix build utils)
|
(guix build utils)
|
||||||
|
@ -102,6 +103,51 @@
|
||||||
(source (origin
|
(source (origin
|
||||||
(method url-fetch)
|
(method url-fetch)
|
||||||
(uri (string-append "file://" ,directory "/actual-server.tar.gz"))
|
(uri (string-append "file://" ,directory "/actual-server.tar.gz"))
|
||||||
|
(snippet
|
||||||
|
'(begin
|
||||||
|
;; Guile code to pretty-print to a file
|
||||||
|
(use-modules (ice-9 pretty-print))
|
||||||
|
(let (
|
||||||
|
(run-output-file "actual-server-start"))
|
||||||
|
(call-with-output-file run-output-file
|
||||||
|
(lambda (port)
|
||||||
|
(format port "#!/usr/bin/env guile~%!#~%")
|
||||||
|
(pretty-print
|
||||||
|
'(begin
|
||||||
|
(use-modules
|
||||||
|
(ice-9 popen)
|
||||||
|
(ice-9 rdelim)
|
||||||
|
(srfi srfi-1)
|
||||||
|
(rnrs io ports)
|
||||||
|
(rnrs bytevectors)
|
||||||
|
(rnrs files)
|
||||||
|
(ice-9 pretty-print)
|
||||||
|
(ice-9 ftw))
|
||||||
|
(define (run-and-display-command command)
|
||||||
|
(let* ((port (open-pipe* OPEN_READ "sh" "-c" command))
|
||||||
|
(status #f))
|
||||||
|
(let loop ()
|
||||||
|
(let ((line (read-line port 'concat)))
|
||||||
|
(if (eof-object? line)
|
||||||
|
(begin
|
||||||
|
(set! status (close-pipe port))
|
||||||
|
(if (not (zero? status))
|
||||||
|
(error "Command failed" command status)))
|
||||||
|
(begin (display line) (force-output) (loop)))))))
|
||||||
|
(define ld-library-path "/lib") ;(getenv "LD_LIBRARY_PATH"))
|
||||||
|
(define home-path (getenv "HOME"))
|
||||||
|
(define sym-source (string-append home-path "/.cache/node"))
|
||||||
|
(define sym-target (string-append ld-library-path "/actual-server/node"))
|
||||||
|
|
||||||
|
; (mkdir (string-append home-path "/.cache"))
|
||||||
|
(symlink sym-target sym-source)
|
||||||
|
|
||||||
|
(run-and-display-command (string-append "cd " ld-library-path "/actual-server/proj && corepack enable && yarn start"))
|
||||||
|
; (run-and-display-command "corepack enable")
|
||||||
|
; (run-and-display-command "yarn start")
|
||||||
|
|
||||||
|
)
|
||||||
|
port))))))
|
||||||
(sha256
|
(sha256
|
||||||
(base32 ,checksum))))
|
(base32 ,checksum))))
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
|
@ -110,7 +156,8 @@
|
||||||
("node" ,node-lts)
|
("node" ,node-lts)
|
||||||
("bash" ,bash)
|
("bash" ,bash)
|
||||||
("coreutils" ,coreutils)
|
("coreutils" ,coreutils)
|
||||||
("findutils" ,findutils)))
|
("findutils" ,findutils)
|
||||||
|
("guile" ,guile-3.0)))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
`(("patchelf" ,patchelf)))
|
`(("patchelf" ,patchelf)))
|
||||||
(arguments
|
(arguments
|
||||||
|
@ -123,6 +170,9 @@
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
(let ((out (assoc-ref outputs "out")))
|
(let ((out (assoc-ref outputs "out")))
|
||||||
(copy-recursively "." (string-append out "/lib"))
|
(copy-recursively "." (string-append out "/lib"))
|
||||||
|
(format #t "Checking if actual-server-start exists: ~a~%" (file-exists? (string-append out "/lib/actual-server-start")))
|
||||||
|
(rename-file (string-append out "/lib/actual-server-start") (string-append out "/bin/actual-server"))
|
||||||
|
(chmod (string-append out "/bin/actual-server") #o755)
|
||||||
#t)))
|
#t)))
|
||||||
(add-after 'copy-files 'patch-runpath
|
(add-after 'copy-files 'patch-runpath
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
|
|
Loading…
Reference in New Issue