Compare commits

...

10 Commits

Author SHA1 Message Date
TakeV ea472eeb8a
Fix authorizations 2023-07-23 02:08:48 -07:00
TakeV 8c34be5660
Remove unneeded fields from gts service 2023-07-23 02:04:19 -07:00
TakeV 0c01e7cf52
Modernize the config 2023-07-23 02:04:19 -07:00
TakeV 758c175d9c
Pass frontend to service 2023-07-23 02:04:19 -07:00
TakeV 5b0bb26a92
Add gotosocial frontend 2023-07-23 02:04:19 -07:00
TakeV 2798041c31
Remove test file 2023-07-23 02:04:19 -07:00
TakeV 53b46de9e3
Buildable container 2023-07-23 02:04:19 -07:00
TakeV 9a6caabc73
Add GTS service (currently broke'd) 2023-07-23 02:04:18 -07:00
TakeV 080821eb8a
Add backend package for GoToSocial.
At present, this does not include the frontend assets.
2023-07-23 02:01:57 -07:00
TakeV e156bad613
Add backend package for GoToSocial.
At present, this does not include the frontend assets.

Add readme

Fix formatting for channel definition in readme

Balance parens
2023-04-20 15:13:53 -07:00
3 changed files with 198 additions and 0 deletions

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,80 @@
(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 copy)
#:use-module (guix build-system go))
(define-public gotosocial-frontend
(package
(name "gotosocial-frontend")
(version "0.8.0")
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/superseriousbusiness/gotosocial/releases/download/" version "/gotosocial_" version "_web-assets.tar.gz"))
(sha256
(base32
"1r3n8r5jvf2fhmdb0x2sayri4zfcjiq65vhdv9jsgh4ivmz1y0zx"))))
(build-system copy-build-system)
(arguments
(list #:install-plan #~'(("." "/gotosocial/web"))))
(synopsis "GoToSocial Frontend Assets")
(description "")
(home-page "")
(license license:agpl3)))
(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 gotosocial-frontend))
(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,96 @@
(define-module (kulupu services activity-pub)
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (gnu services)
#:use-module (gnu services certbot)
#:use-module (gnu services configuration)
#:use-module (gnu services databases)
#:use-module (gnu services base)
#:use-module (gnu services shepherd)
#:use-module (gnu services web)
#:use-module (gnu system shadow)
#:use-module (gnu packages admin)
#:use-module (kulupu packages gotosocial)
#:use-module (ice-9 match)
#:export (gotosocial-service-type
gotosocial-configuration))
(define-maybe string)
(define-configuration gotosocial-configuration
(host
(string "localhost")
"Name to use as gotosocial host")
(gotosocial
(package gotosocial)
"The gotosocial package to use")
(front-end
(package gotosocial-frontend)
"The gotosocial web asset package to use")
(config-file
(maybe-string)
"Path to configuration file, defaults to no configuration file")
(port
(integer 8080)
"Port to listen on, default 8080")
(work-dir
(string "/var/lib/gotosocial")
"GTS work directory")
(run-dir
(string "/var/run/gotosocial")
"GTS runtime directory")
(database-type
(string "sqlite")
"Database type to use, default to sqlite")
(database-address
(string "/var/run/gotosocial/gts.db")
"Address of the database, default /var/run/gotosocial/gts.db"))
(define (gotosocial-shepherd-service config)
(match-record config <gotosocial-configuration>
(gotosocial gotosocial-frontend config-file port work-dir run-dir host database-type database-address)
(let* ((gts (file-append gotosocial "/bin/gotosocial"))
(gts-frontend-assets (file-append gotosocial-frontend "/gotosocial/web/assets"))
(gts-frontend-templates (file-append gotosocial-frontend "/gotosocial/web/template"))
(command `(,gts
"server" "start" "--syslog-enabled"
,(string-append "--port=" (number->string port))
,(string-append "--db-type=" database-type)
,(string-append "--db-address=" database-address)
,(string-append "--letsencrypt-cert-dir=" work-dir "/storage/certs")
,(string-append "--storage-local-base-path=" work-dir "/storage")
,(string-append "--web-asset-base-dir=" gts-frontend-assets)
,(string-append "--web-template-base-dir=" gts-frontend-templates)
,(string-append "--host=" host))))
(list (shepherd-service
(documentation "Run GoToSocial")
(provision '(gotosocial))
(start #~(make-forkexec-constructor '#$command
#:user "gotosocial"
#:group "gotosocial"
#:directory #$work-dir))
(stop #~(make-kill-destructor)))))))
(define (gotosocial-accounts config)
(match-record config <gotosocial-configuration>
(work-dir)
(list (user-group
(name "gotosocial")
(system? #t))
(user-account
(name "gotosocial")
(system? #t)
(group "gotosocial")
(comment "GoToSocial server user")
(home-directory work-dir)
(shell (file-append bash-minimal "/bin/bash"))))))
(define gotosocial-service-type
(service-type
(name 'gotosocial)
(extensions
(list (service-extension shepherd-root-service-type gotosocial-shepherd-service)
(service-extension account-service-type gotosocial-accounts)))
(description "Runs GoToSocial")
(default-value (gotosocial-configuration))))