Compare commits

...

4 Commits

Author SHA1 Message Date
TakeV 95cf3caa0b
Add GTS service (currently broke'd) 2023-05-02 19:24:09 -07:00
TakeV 2c6c4cf981
Fix formatting for channel definition in readme 2023-04-18 18:23:21 -07:00
TakeV 6acb925611
Add readme 2023-04-18 18:22:19 -07:00
TakeV ed17f9df1e
Add backend package for GoToSocial.
At present, this does not include the frontend assets.
2023-04-18 18:10:05 -07:00
5 changed files with 208 additions and 1 deletions

View File

@ -1,4 +1,4 @@
(authorizations (authorizations
(version 0) (version 0)
(("1086 326D E207 068C 1C02 5129 A64F 4134 5C74 00AF" (("1086 326D E207 068C 1C02 5129 A64F 4134 5C74 00AF"
(name "TakeV")))) (name "TakeV"))

22
README.org Normal file
View File

@ -0,0 +1,22 @@
* About
kulupu mi is a guix channel which packages various federated servers.
To use this channel, add the following entry to your default-channels:
#+begin_src scheme
(channel
(name 'kulupu-mi)
(url "https://git.solarpunk.moe/TakeV/kulupu-mi.git")
(branch "main")
(introduction
(make-channel-introduction
"cc9a267ed48680f3cb7319f6c1fa5d6f6800b4b7"
(openpgp-fingerprint
"1086 326D E207 068C 1C02 5129 A64F 4134 5C74 00AF"))))
#+end_src
* Packages
** [[https://docs.gotosocial.org/en/latest/][GoToSocial]]
Lightweight ActivityPub server, intended to be used with third party ActivityPub client.
*Only includes backend server. No front end files at the moment.*

View File

@ -0,0 +1,62 @@
(define-module (kulupu packages gotosocial)
#:use-module ((guix licenses)
#:prefix license:)
#:use-module (gnu packages)
#:use-module (gnu packages golang)
#:use-module (gnu packages shells)
#:use-module (gnu packages python)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix gexp)
#:use-module (guix build-system go))
(define-public gotosocial
(let* ((import-path "github.com/superseriousbusiness/gotosocial")
(working-path (string-append "src/" import-path)))
(package
(name "gotosocial")
(version "0.8.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url
"https://github.com/superseriousbusiness/gotosocial")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1cxdk59r57hbg5pwpg5vhhdzwcgpa6jdwhhblhhyk7pq1ym386n1"))))
(build-system go-build-system)
(arguments
(list #:go go-1.20
#:import-path import-path
#:phases #~(modify-phases %standard-phases
(add-before 'build 'chdir
(lambda _
(setenv "ORIG_DIR"
(getcwd))
(chdir #$working-path)))
(replace 'build
(lambda _
(setenv "VERSION"
#$version)
(invoke "sh"
(string-append (getcwd)
"/scripts/build.sh"))))
(replace 'check
(lambda _
(invoke "sh" "test/envparsing.sh")))
(add-after 'install 'install-binary
(lambda _
(install-file "gotosocial"
(string-append #$output "/bin"))))
(add-before 'install-license-files 'chdir-back
(lambda _
(chdir (getenv "ORIG_DIR")))))))
(propagated-inputs (list python-minimal-wrapper zsh))
(home-page "https://github.com/superseriousbusiness/gotosocial")
(synopsis "GoToSocial")
(description
"GoToSocial is an @@url{https://activitypub.rocks/,ActivityPub} social network server, written in Golang.")
(license license:agpl3))))

View File

@ -0,0 +1,73 @@
(define-module (kulupu services activity-pub)
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (gnu services)
#:use-module (gnu services base)
#:use-module (gnu services shepherd)
#:use-module (gnu system shadow)
#:use-module (gnu packages admin)
#:use-module (kulupu packages gotosocial)
#:use-module (ice-9 match)
#:export (gotosocial-shepherd-service
gotosocial-service-type
gts-config
gts-config?))
(define-record-type* <gts-config> gts-config
make-gts-config
gts-config?
(pkg gotosocial-configuration-package (default gotosocial))
(config-file gotosocial-configuration-config (default #f)) ; file-like
(port gotosocial-port (default #f))
(cert-dir gotosocial-letsencrypt-cert-dir (default #f))
(storage-dir gotosocial-storage-local-base-path (default #f))
(web-asset-dir gotosocial-web-asset-dir (default #f))
(host gotosocial-host (default #f))
(db-type gotosocial-db-type (default #f))
(db-address gotosocial-db-address (default #f)))
(define gotosocial-shepherd-service
(match-lambda (($ <gts-config> pkg config-file port cert-dir storage-dir web-asset-dir host db-type db-address)
(let* ((gotosocial (file-append pkg "/bin/gotosocial"))
(command `(,gotosocial
"server" "start"
,@(if port `(,(string-append "--port=" (number->string port))) '())
,@(if db-type `(,(string-append "--db-type=" db-type)) '())
,@(if db-address `(,(string-append "--db-address=" db-address)) '())
,@(if cert-dir `(,(string-append "--letsencrypt-cert-dir=" cert-dir)) '())
,@(if storage-dir `(,(string-append "--storage-local-base-path=" storage-dir)) '())
,@(if web-asset-dir `(,(string-append "--letsencrypt-cert-dir=" web-asset-dir)) '())
,@(if config-file `(,(string-append "--config-path=" config-file)) '())
,@(if host `(,(string-append "--host=" host)) '())
)))
(list (shepherd-service
(documentation "Run GoToSocial")
(requirement '(networking))
(provision '(gotosocial-server))
(start #~(make-forkexec-constructor '#$command
#:user "gotosocial"
#:group "gotosocial"))
(stop #~(make-kill-destructor))))))))
(define %gotosocial-server-account
(list (user-group
(name "gotosocial")
(system? #t))
(user-account
(name "gotosocial")
(system? #t)
(group "gotosocial")
(comment "GoToSocial server user")
(home-directory "/var/empty/")
(shell (file-append shadow "/sbin/nologin")))))
(define gotosocial-service-type
(service-type
(name 'gotosocial)
(extensions
(list (service-extension shepherd-root-service-type
gotosocial-shepherd-service)
(service-extension account-service-type
(const %gotosocial-server-account))))
(description "Runs GoToSocial")
(default-value (gts-config))))

View File

@ -0,0 +1,50 @@
(use-modules (gnu)
(guix packages)
(guix build-system trivial)
(guix licenses)
(gnu system nss))
(include "activity-pub.scm")
(define dummy-package
(package
(name "dummy")
(version "0")
(source #f)
(build-system trivial-build-system)
(arguments
`(#:modules ((guix build utils))
#:target #f
#:builder (begin
(use-modules (guix build utils))
(let* ((out (assoc-ref %outputs "out"))
(dummy (string-append out "/dummy")))
(mkdir-p out)
(call-with-output-file dummy
(const #t))))))
(home-page #f)
(synopsis #f)
(description #f)
(license (fsdg-compatible "dummy"))))
(define dummy-bootloader
(bootloader
(name 'dummy-bootloader)
(package dummy-package)
(configuration-file "/dev/null")
(configuration-file-generator
(lambda (. _rest)
(plain-file "dummy-bootloader" "")))
(installer #~(const #t))))
(define dummy-kernel dummy-package)
(define generate-container-os
(lambda (hostname)
(operating-system
(host-name hostname)
(bootloader (bootloader-configuration (bootloader dummy-bootloader)))
(file-systems '())
(services (cons* (gotosocial-service-type) %base-services)))))
(generate-container-os "test")