1
0
Fork 0

Start install script for actual server

master
Sudoer777's Guix Server 2024-05-26 04:37:16 -05:00
parent 18c0f73539
commit 354eaf2e84
No known key found for this signature in database
GPG Key ID: 030A38A3A5035E37
3 changed files with 46 additions and 124 deletions

View File

@ -1,31 +0,0 @@
(define-module (actual-server-2)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system node)
#:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (guix licenses)
#:use-module (gnu packages)
#:use-module (gnu packages node)
#:use-module (gnu packages package-management)
#:use-module (ice-9 pretty-print)
#:use-module (srfi srfi-1))
(define-public actual-server-2
(package
(name "actual-server-2")
(version "24.4.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/actualbudget/actual-server")
(commit "deec1f9")))
(file-name (git-file-name name version))
(sha256 (base32 "1lq5lqa3818ajyn4cs8paw0iy4ibpggzsp9p1l4xwpa1xz10jb52"))))
(build-system node-build-system)
(inputs
`(("node" ,node-lts)))
(home-page "https://github.com/actualbudget/actual-server")
(synopsis "Actual server for budget management")
(description "Actual is a local-first personal finance tool.")
(license expat)))

View File

@ -1,89 +0,0 @@
(define-module (actual-server-installer)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system node)
#:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (guix licenses)
#:use-module (gnu packages)
#:use-module (gnu packages node)
#:use-module (gnu packages package-management)
#:use-module (ice-9 pretty-print)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26))
(define-public actual-server-installer
(package
(name "actual-server-installer")
(version "24.4.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/actualbudget/actual-server")
(commit "deec1f9")))
(file-name (git-file-name name version))
(sha256 (base32 "1lq5lqa3818ajyn4cs8paw0iy4ibpggzsp9p1l4xwpa1xz10jb52"))
(snippet
'(begin
;; Guile code to pretty-print to a file
(use-modules (ice-9 pretty-print))
(let ((output-file "actual-server.scm"))
(call-with-output-file output-file
(lambda (port)
(pretty-print
'(begin
(define-module (actual-server)
#:use-module (guix packages)
#:use-module (guix build-system gnu)
#:use-module (guix licenses)
#:use-module (guix download)
#:use-module (gnu packages)
#:use-module (gnu packages node))
(define-public actual-server
(package
(name "actual-server")
(version "24.4.0")
(source (origin
(method url-fetch)
(uri "file:///tmp/actual-server-installer/actual-server.tar.gz")
(sha256
(base32 "$checksum"))))
(build-system gnu-build-system)
(inputs
`(("node" ,node-lts)))
(arguments
`(#:tests? #f ; Disable tests
#:phases (modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(delete 'install)
(add-after 'unpack 'copy-files
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(mkdir-p (string-append out "/lib"))
(copy-recursively (string-append (assoc-ref %build-inputs "source") "/lib") (string-append out "/lib"))
#t))))))
(home-page "https://github.com/actualbudget/actual-server")
(synopsis "Actual server for budget management")
(description "Actual is a local-first personal finance tool.")
(license expat))))
port))))))))
(build-system gnu-build-system)
(inputs
`(("node" ,node-lts)))
(arguments
`(#:tests? #f ; Disable tests for simplicity
#:phases (modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(delete 'install)
(add-after 'unpack 'store-source
(lambda* (#:key outputs #:allow-other-keys)
(let ((source-dir (assoc-ref outputs "out")))
(copy-recursively "." (string-append source-dir "/lib/actual-server-installer/repo"))
#t))))))
(home-page "https://github.com/actualbudget/actual-server")
(synopsis "Actual server for budget management")
(description "Actual is a local-first personal finance tool.")
(license expat)))

View File

@ -36,8 +36,46 @@
'(begin '(begin
;; Guile code to pretty-print to a file ;; Guile code to pretty-print to a file
(use-modules (ice-9 pretty-print)) (use-modules (ice-9 pretty-print))
(let ((output-file "build.scm")) (let ((build-output-file "build.scm")
(call-with-output-file output-file (run-output-file "actual-server-install"))
(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)
(guix build utils)
(ice-9 pretty-print)
(gcrypt hash)
(guix base32)
(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)))))))
(run-and-display-command "guix shell --container --network --pure --no-cwd --emulate-fhs --share=/tmp/actual-server-installer=/actual-server --user=build actual-server-installer -- bash -c 'guile $GUIX_ENVIRONMENT/lib/actual-server-installer/build.scm'")
(run-and-display-command "cd /tmp/actual-server-installer")
) port)))
(call-with-output-file build-output-file
(lambda (port) (lambda (port)
(pretty-print (pretty-print
'(begin '(begin
@ -191,7 +229,6 @@ port))))))))
("tar" ,tar) ("tar" ,tar)
("gzip" ,gzip) ("gzip" ,gzip)
("gawk" ,gawk) ("gawk" ,gawk)
("node" ,node)
("guix" ,guix) ("guix" ,guix)
("guile" ,guile-3.0) ("guile" ,guile-3.0)
("guile-gcrypt" ,guile-gcrypt) ("guile-gcrypt" ,guile-gcrypt)
@ -207,7 +244,12 @@ port))))))))
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let ((source-dir (assoc-ref outputs "out"))) (let ((source-dir (assoc-ref outputs "out")))
(copy-recursively "." (string-append source-dir "/lib/actual-server-installer/repo")) (copy-recursively "." (string-append source-dir "/lib/actual-server-installer/repo"))
(mkdir-p (string-append source-dir "/bin"))
(format #t "Checking if build.scm exists: ~a~%" (file-exists? (string-append source-dir "/lib/actual-server-installer/repo/build.scm")))
(format #t "Checking if actual-server-install exists: ~a~%" (file-exists? (string-append source-dir "/lib/actual-server-installer/repo/actual-server-install")))
(rename-file (string-append source-dir "/lib/actual-server-installer/repo/build.scm") (string-append source-dir "/lib/actual-server-installer/build.scm")) (rename-file (string-append source-dir "/lib/actual-server-installer/repo/build.scm") (string-append source-dir "/lib/actual-server-installer/build.scm"))
(rename-file (string-append source-dir "/lib/actual-server-installer/repo/actual-server-install") (string-append source-dir "/bin/actual-server-install"))
(chmod (string-append source-dir "/bin/actual-server-install") #o755)
#t)))))) #t))))))
(home-page "https://github.com/actualbudget/actual-server") (home-page "https://github.com/actualbudget/actual-server")
(synopsis "Actual server for budget management") (synopsis "Actual server for budget management")