Create package that generates another package
parent
098f3847a6
commit
8ee4a09c81
|
@ -1,4 +1,4 @@
|
|||
(define-module (actual-server)
|
||||
(define-module (actual-server-2)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix git-download)
|
||||
#:use-module (guix build-system node)
|
||||
|
@ -7,11 +7,13 @@
|
|||
#:use-module (guix licenses)
|
||||
#:use-module (gnu packages)
|
||||
#:use-module (gnu packages node)
|
||||
#:use-module (gnu packages package-management))
|
||||
#:use-module (gnu packages package-management)
|
||||
#:use-module (ice-9 pretty-print)
|
||||
#:use-module (srfi srfi-1))
|
||||
|
||||
(define-public actual-server-src
|
||||
(define-public actual-server-2
|
||||
(package
|
||||
(name "actual-server-src")
|
||||
(name "actual-server-2")
|
||||
(version "24.4.0")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
|
@ -20,20 +22,9 @@
|
|||
(commit "deec1f9")))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256 (base32 "1lq5lqa3818ajyn4cs8paw0iy4ibpggzsp9p1l4xwpa1xz10jb52"))))
|
||||
(build-system gnu-build-system)
|
||||
(build-system node-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 "/src"))
|
||||
#t))))))
|
||||
(home-page "https://github.com/actualbudget/actual-server")
|
||||
(synopsis "Actual server for budget management")
|
||||
(description "Actual is a local-first personal finance tool.")
|
|
@ -0,0 +1,89 @@
|
|||
(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)))
|
|
@ -0,0 +1,147 @@
|
|||
(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 "build.scm"))
|
||||
(call-with-output-file output-file
|
||||
(lambda (port)
|
||||
(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))
|
||||
|
||||
(define (run-shell-command command)
|
||||
(let* ((p (open-pipe* OPEN_READ "sh" "-c" command))
|
||||
(output (get-string-all p)))
|
||||
(close-pipe p)
|
||||
output))
|
||||
|
||||
(define (run-and-display-command command)
|
||||
(let ((port (open-pipe* OPEN_READ "sh" "-c" command)))
|
||||
(let loop ()
|
||||
(let ((line (read-line port 'concat)))
|
||||
(if (eof-object? line)
|
||||
(close-pipe port)
|
||||
(begin
|
||||
(display line)
|
||||
(force-output) ; Ensure output is flushed immediately
|
||||
(loop)))))))
|
||||
|
||||
;; Enable corepack and install yarn
|
||||
(run-and-display-command "corepack enable")
|
||||
(run-and-display-command "corepack install")
|
||||
(run-and-display-command "yarn install")
|
||||
|
||||
;; Create the necessary directory
|
||||
(mkdir-p "/actual-server-build/lib/actual-server-node")
|
||||
|
||||
;; Copy directory
|
||||
(copy-recursively "~/.cache" "/actual-server-build/lib/actual-server-node/.cache")
|
||||
|
||||
;; Create tar.gz archive
|
||||
(run-and-display-command "tar -czvf /actual-server/actual-server.tar.gz -C /actual-server-build .")
|
||||
|
||||
;; Calculate checksum
|
||||
(define (sha256sum file)
|
||||
(call-with-input-file file
|
||||
(lambda (port)
|
||||
(let ((digest (sha256 (get-bytevector-all port))))
|
||||
(bytevector->nix-base32-string digest)))))
|
||||
|
||||
(let* ((checksum (sha256sum "/actual-server/actual-server.tar.gz"))
|
||||
(actual-server-scm
|
||||
`(
|
||||
(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))))))
|
||||
|
||||
;; Write the content to actual-server.scm
|
||||
(call-with-output-file "/actual-server/actual-server.scm"
|
||||
(lambda (port)
|
||||
(for-each (lambda (expr) (pretty-print expr port))
|
||||
actual-server-scm)))))
|
||||
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)))
|
Loading…
Reference in New Issue