summaryrefslogtreecommitdiff
path: root/src/guix
diff options
context:
space:
mode:
Diffstat (limited to 'src/guix')
-rw-r--r--src/guix/packages.scm156
-rw-r--r--src/guix/services.scm2
-rw-r--r--src/guix/system.scm2
3 files changed, 95 insertions, 65 deletions
diff --git a/src/guix/packages.scm b/src/guix/packages.scm
index 691b1b1..ce67d79 100644
--- a/src/guix/packages.scm
+++ b/src/guix/packages.scm
@@ -1,80 +1,43 @@
(define-module (packages)
+ #:use-module ((ice-9 textual-ports) #:prefix textual-ports:)
#:use-module ((guix licenses) #:prefix licenses:)
- #:use-module ((ice-9 popen) #:prefix popen:)
- #:use-module ((ice-9 rdelim) #:prefix rdelim:)
- #:use-module ((org euandre queue) #:prefix queue:)
- #:use-module ((xyz euandreh heredoc) #:prefix heredoc:)
+ #:use-module ((json) #:prefix json:)
+ #:use-module (json)
#:use-module (gnu)
- #:use-module (guix build utils)
#:use-module (guix build-system gnu)
#:use-module (guix download)
#:use-module (guix packages)
#:use-module (guix utils))
(use-package-modules
- node
+ golang
+ golang-xyz
sqlite)
-(heredoc:enable-syntax)
-(define +working-dir+
- (if (directory-exists? "/opt/deploy/current")
- "/opt/deploy/current"
- (canonicalize-path ".")))
-(define +version-cmd+ #"-
- if grep -q deployer /etc/passwd && [ -e /opt/deploy/current ]; then
- sudo -u deployer git -C /opt/deploy/current rev-parse HEAD
- else
- git rev-parse HEAD
- fi
- "#)
+(define (slurp f)
+ (string-trim-both
+ (call-with-input-file
+ f
+ textual-ports:get-string-all)))
-(define +repo-version+
- (let* ((port (popen:open-input-pipe +version-cmd+))
- (v (rdelim:read-line port)))
- (popen:close-pipe port)
- v))
-
-;; FIXME: this goes to the package repository later, alongside versions for
-;; other package managers. The same is true for the papo-service-type.
-(define-public papo
+(define (go-package-0 name)
(package
- (name "papo")
- (version "da4d8a7b62ca33c58c1f37dfdcb8294abefc8afa")
+ (name name)
+ (version (slurp (string-append "src/versions/" name "/version")))
(source
(origin
(method url-fetch)
(uri
- (string-append "https://papo.im/git/papo/snapshot/papo-"
+ (string-append "https://papo.im/git/"
+ name
+ "/snapshot/"
+ name
+ "-"
version
".tar.xz"))
(sha256
- (base32 "0z08y8nizjb8afy7hscx3l8wqsr2sxc22av5aq9z4k299jkwgp1g"))))
- (build-system gnu-build-system) ;; FIXME: posix-build-system
- (arguments
- (list
- #:make-flags
- #~(list
- (string-append "PREFIX=" %output)
- (string-append "CC=" #$(cc-for-target)))
- #:phases
- #~(modify-phases %standard-phases
- (delete 'configure))))
- (inputs
- (list
- node-lts
- sqlite))
- (synopsis "FIXME: slurp from package")
- (description "FIXME: slurp from package")
- (home-page "FIXME: slurp from package")
- (license licenses:agpl3+))) ;; "FIXME: also slurp from package
-
-(define-public papo.im
- (package
- (name "papo.im")
- (version +repo-version+)
- (source
- (local-file +working-dir+ #:recursive? #t))
+ (base32 (slurp (string-append "src/versions/" name "/sha256"))))))
(build-system gnu-build-system)
(arguments
(list
@@ -83,14 +46,81 @@
(string-append "PREFIX=" %output))
#:phases
#~(modify-phases %standard-phases
- (delete 'configure))))
- (inputs
- (list))
- (home-page #f)
+ (delete 'configure)
+ (add-before 'build 'setenv-golang
+ (lambda _
+ (setenv "GOCACHE"
+ (string-append (getenv "TMPDIR") "/GOCACHE")))))))
+ (native-inputs
+ (list
+ go-1.22))
(synopsis #f)
(description #f)
- (license #f)))
+ (home-page #f)
+ (license licenses:agpl3+)))
+
+(define (go-package-1 name)
+ (let ((base (go-package-0 name)))
+ (package (inherit base)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (add-before 'build 'add-gobang-vendored-dependency
+ (lambda _
+ (mkdir-p "vendor/euandre.org/gobang/src")
+ (copy-file
+ (string-append #$(this-package-native-input "gobang")
+ "/src/gobang/lib.go")
+ "vendor/euandre.org/gobang/src/lib.go")
+ (call-with-output-file
+ "vendor/modules.txt"
+ (lambda (port)
+ (format port
+ "~a~%~a~%~a~%~a~%"
+ "# euandre.org/gobang v0.1.0 => ../gobang"
+ "## explicit; go 1.21.5"
+ "euandre.org/gobang/src"
+ "# euandre.org/gobang => ../gobang")))))))))
+ (native-inputs
+ (modify-inputs (package-native-inputs base)
+ (append gobang))))))
+
+(define (go-package-2 name)
+ (let ((base (go-package-1 name)))
+ (package (inherit base)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (add-before 'build 'add-gosqlite3-vendored-dependency
+ (lambda _
+ (copy-recursively
+ (string-append #$(this-package-native-input
+ "go-github-com-mattn-go-sqlite3")
+ "/src")
+ "vendor")
+ (call-with-output-file
+ "vendor/modules.txt"
+ (lambda (port)
+ (format port
+ "~a~%~a~%~a~%"
+ "# github.com/mattn/go-sqlite3 v1.14.22"
+ "## explicit; go 1.19"
+ "github.com/mattn/go-sqlite3")))))))))
+ (native-inputs
+ (modify-inputs (package-native-inputs base)
+ (append
+ go-github-com-mattn-go-sqlite3
+ `(,sqlite "out")
+ `(,sqlite "static")))))))
+
+
+(define-public gobang (go-package-0 "gobang"))
+(define-public binder (go-package-1 "binder"))
+(define-public papod (go-package-2 "papod"))
(list
- papo
- papo.im)
+ gobang
+ binder
+ papod)
diff --git a/src/guix/services.scm b/src/guix/services.scm
index c1fceb3..1e5ae4e 100644
--- a/src/guix/services.scm
+++ b/src/guix/services.scm
@@ -58,7 +58,7 @@
(log-rotation
(frequency 'weekly)
(files (list log-file))
- (options '("rotate 52"))))))
+ (options '("rotate 5200"))))))
(define (papo-activation config)
(match-record config <papo-configuration>
diff --git a/src/guix/system.scm b/src/guix/system.scm
index 12d96e1..f5c2368 100644
--- a/src/guix/system.scm
+++ b/src/guix/system.scm
@@ -376,7 +376,7 @@
(log-rotation
(frequency 'weekly)
(files '("/var/log/cronjobs.log"))
- (options '("rotate 52")))))
+ (options '("rotate 5200")))))
(service fail2ban-service-type)
(service mcron-service-type
(mcron-configuration