From: Evgeny Pisemsky <mail@pisemsky.site>
To: 72400@debbugs.gnu.org
Subject: [bug#72400] [PATCH] services: gitile: Allow to set user and group.
Date: Wed, 31 Jul 2024 18:00:55 +0300 [thread overview]
Message-ID: <87sevpehco.fsf@pisemsky.site> (raw)
[-- Attachment #1: 0001-services-gitile-Allow-to-set-user-and-group.patch --]
[-- Type: text/x-patch, Size: 5744 bytes --]
From 91ec60142ea1220cf4a87883915bf086e1344f69 Mon Sep 17 00:00:00 2001
Message-ID: <91ec60142ea1220cf4a87883915bf086e1344f69.1722437974.git.mail@pisemsky.site>
From: Evgeny Pisemsky <mail@pisemsky.site>
Date: Wed, 31 Jul 2024 17:30:50 +0300
Subject: [PATCH] services: gitile: Allow to set user and group.
Change-Id: I757d7a6c2690326272f0437eda2ba4b2fae409a0
---
doc/guix.texi | 7 +++++
gnu/services/version-control.scm | 45 ++++++++++++++++++++------------
2 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 41814042f5..9b04a0b0e5 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -129,6 +129,7 @@
Copyright @copyright{} 2024 Richard Sent@*
Copyright @copyright{} 2024 Dariqq@*
Copyright @copyright{} 2024 Denis 'GNUtoo' Carikli@*
+Copyright @copyright{} 2024 Evgeny Pisemsky@*
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -39287,6 +39288,12 @@ Version Control Services
The footer content, as a list of sxml expressions. This is shown on every
page served by Gitile.
+@item @code{user} (default: @code{"git"})
+Owner of the @code{gitile} process.
+
+@item @code{group} (default: @code{"git"})
+Owner's group of the @code{gitile} process.
+
@item @code{nginx}
An nginx server block that will be extended and used as a reverse proxy by
Gitile to serve its pages, and as a normal web server to serve its assets.
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm
index 14ff0a59a6..d61675345f 100644
--- a/gnu/services/version-control.scm
+++ b/gnu/services/version-control.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2018 Christopher Baines <mail@cbaines.net>
;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2024 Evgeny Pisemsky <mail@pisemsky.site>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -74,6 +75,8 @@ (define-module (gnu services version-control)
gitile-configuration-index-title
gitile-configuration-intro
gitile-configuration-footer
+ gitile-configuration-user
+ gitile-configuration-group
gitile-configuration-nginx
gitile-service-type))
@@ -441,6 +444,10 @@ (define-record-type* <gitile-configuration>
(default '()))
(footer gitile-configuration-footer
(default '()))
+ (user gitile-configuration-user
+ (default "git"))
+ (group gitile-configuration-group
+ (default "git"))
(nginx gitile-configuration-nginx))
(define (gitile-config-file host port database repositories base-git-url
@@ -462,7 +469,7 @@ (define (gitile-config-file host port database repositories base-git-url
(define gitile-nginx-server-block
(match-lambda
(($ <gitile-configuration> package host port database repositories
- base-git-url index-title intro footer nginx)
+ base-git-url index-title intro footer user group nginx)
(list (nginx-server-configuration
(inherit nginx)
(locations
@@ -488,7 +495,7 @@ (define gitile-nginx-server-block
(define gitile-shepherd-service
(match-lambda
(($ <gitile-configuration> package host port database repositories
- base-git-url index-title intro footer nginx)
+ base-git-url index-title intro footer user group nginx)
(list (shepherd-service
(provision '(gitile))
(requirement '(loopback))
@@ -500,21 +507,27 @@ (define gitile-shepherd-service
repositories
base-git-url index-title
intro footer))
- #:user "gitile"
- #:group "git")))
+ #:user #$user
+ #:group #$group)))
(stop #~(make-kill-destructor)))))))
-(define %gitile-accounts
- (list (user-group
- (name "git")
- (system? #t))
- (user-account
- (name "gitile")
- (group "git")
- (system? #t)
- (comment "Gitile user")
- (home-directory "/var/empty")
- (shell (file-append shadow "/sbin/nologin")))))
+(define (gitile-accounts config)
+ (let ((user (gitile-configuration-user config))
+ (group (gitile-configuration-group config)))
+ (filter identity
+ (list
+ (and (equal? group "gitile")
+ (user-group
+ (name "gitile")
+ (system? #t)))
+ (and (equal? user "gitile")
+ (user-account
+ (name "gitile")
+ (group group)
+ (system? #t)
+ (comment "Gitile user")
+ (home-directory "/var/empty")
+ (shell (file-append shadow "/sbin/nologin"))))))))
(define gitile-service-type
(service-type
@@ -523,7 +536,7 @@ (define gitile-service-type
on the web.")
(extensions
(list (service-extension account-service-type
- (const %gitile-accounts))
+ gitile-accounts)
(service-extension shepherd-root-service-type
gitile-shepherd-service)
(service-extension nginx-service-type
base-commit: 01d4363168ed10ea223047f7a7b83201f161ec0b
--
2.45.2
next reply other threads:[~2024-07-31 15:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-31 15:00 Evgeny Pisemsky [this message]
2024-08-01 3:15 ` [bug#72400] [PATCH] services: gitile: Allow to set user and group guix-patches--- via
2024-08-01 8:45 ` Evgeny Pisemsky
2024-08-02 16:15 ` guix-patches--- via
2024-08-05 10:13 ` Evgeny Pisemsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sevpehco.fsf@pisemsky.site \
--to=mail@pisemsky.site \
--cc=72400@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).