gnu: Add pixelfed-service-type.
* .guix/modules/pixelfed-service.scm (pixelfed-service-type): New variable.
This commit is contained in:
parent
488400f9a3
commit
de381a5744
|
@ -0,0 +1,71 @@
|
|||
(define-module (pixelfed-service)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:use-module (guix records)
|
||||
#:use-module (guix packages)
|
||||
#: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 (gnu packages bash)
|
||||
#:use-module (gnu packages base)
|
||||
#:use-module (pixelfed)
|
||||
#:use-module (ice-9 match)
|
||||
#:export (pixelfed-service-type
|
||||
pixelfed-configuration))
|
||||
|
||||
(define-maybe string)
|
||||
|
||||
(define-configuration pixelfed-configuration
|
||||
(url
|
||||
(string "localhost")
|
||||
"Url for the pixelfed instance")
|
||||
(pixelfed
|
||||
(package pixelfed)
|
||||
"The pixelfed 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/pixelfed")
|
||||
"Pixelfed work directory")
|
||||
(postgres?
|
||||
(boolean #t)
|
||||
"Set up postgres DB")
|
||||
(nginx?
|
||||
(boolean #t)
|
||||
"Set up reverse proxy via nginx")
|
||||
(https?
|
||||
(boolean #t)
|
||||
"Set up HTTPS via certbot")
|
||||
(no-serialization))
|
||||
|
||||
(define (pixelfed-accounts config)
|
||||
(match-record config <pixelfed-configruation>
|
||||
(work-dir)
|
||||
(list (user-group
|
||||
(name "pixelfed")
|
||||
(system? #t))
|
||||
(user-account
|
||||
(name "pixelfed")
|
||||
(system? #t)
|
||||
(group "pixelfed")
|
||||
(comment "pixelfed server user")
|
||||
(home-directory work-dir)
|
||||
(shell (file-append bash-minimal "/bin/bash"))))))
|
||||
|
||||
(define-public pixelfed-service-type
|
||||
(service-type
|
||||
(name 'pixelfed)
|
||||
(extensions
|
||||
(list (service-extennsion account-service-type pixelfed-accounts)))
|
||||
(description "Runs pixelfed")
|
||||
(default-value (pixelfed-configuration))))
|
Loading…
Reference in New Issue