diff options
| author | Oleg Pykhalov <go.wigust@gmail.com> | 2017-12-12 02:13:55 +0300 |
|---|---|---|
| committer | Oleg Pykhalov <go.wigust@gmail.com> | 2018-02-28 04:40:56 +0300 |
| commit | e1cf4fd2d2fc0aab0f91c8ac961a8134cbefe200 (patch) | |
| tree | 5c1923f5cce7a5257c88b4316e37e24129bf6a29 /gnu/services/version-control.scm | |
| parent | 29d37e999c495431eafde90027d2b97b16d0db4e (diff) | |
services: cgit: Add more configuration fields.
* gnu/services/version-control.scm (cgit-service-type): Move to separate file.
* gnu/services/cgit.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add this.
* gnu/tests/version-control.scm: Add this.
* doc/guix.texi (Cgit Service): Document this.
Diffstat (limited to 'gnu/services/version-control.scm')
| -rw-r--r-- | gnu/services/version-control.scm | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm index 7166ed3d4ff..afead87ec7c 100644 --- a/gnu/services/version-control.scm +++ b/gnu/services/version-control.scm | |||
| @@ -38,26 +38,6 @@ | |||
| 38 | git-daemon-configuration | 38 | git-daemon-configuration |
| 39 | git-daemon-configuration? | 39 | git-daemon-configuration? |
| 40 | 40 | ||
| 41 | <cgit-configuration-file> | ||
| 42 | cgit-configuration-file | ||
| 43 | cgit-configuration-file? | ||
| 44 | cgit-configuration-file-css | ||
| 45 | cgit-configuration-file-logo | ||
| 46 | cgit-configuration-file-robots | ||
| 47 | cgit-configuration-file-virtual-root | ||
| 48 | cgit-configuration-file-repository-directory | ||
| 49 | |||
| 50 | <cgit-configuration> | ||
| 51 | cgit-configuration | ||
| 52 | cgit-configuration? | ||
| 53 | cgit-configuration-config-file | ||
| 54 | cgit-configuration-package | ||
| 55 | |||
| 56 | %cgit-configuration-nginx | ||
| 57 | cgit-configuration-nginx-config | ||
| 58 | |||
| 59 | cgit-service-type | ||
| 60 | |||
| 61 | git-http-configuration | 41 | git-http-configuration |
| 62 | git-http-configuration? | 42 | git-http-configuration? |
| 63 | git-http-nginx-location-configuration)) | 43 | git-http-nginx-location-configuration)) |
| @@ -174,107 +154,6 @@ access to exported repositories under @file{/srv/git}." | |||
| 174 | 154 | ||
| 175 | 155 | ||
| 176 | ;;; | 156 | ;;; |
| 177 | ;;; Cgit | ||
| 178 | ;;; | ||
| 179 | |||
| 180 | (define-record-type* <cgit-configuration-file> | ||
| 181 | cgit-configuration-file | ||
| 182 | make-cgit-configuration-file | ||
| 183 | cgit-configuration-file? | ||
| 184 | (css cgit-configuration-file-css ; string | ||
| 185 | (default "/share/cgit/cgit.css")) | ||
| 186 | (logo cgit-configuration-file-logo ; string | ||
| 187 | (default "/share/cgit/cgit.png")) | ||
| 188 | (robots cgit-configuration-file-robots ; list | ||
| 189 | (default '("noindex" "nofollow"))) | ||
| 190 | (virtual-root cgit-configuration-file-virtual-root ; string | ||
| 191 | (default "/")) | ||
| 192 | (repository-directory cgit-configuration-file-repository-directory ; string | ||
| 193 | (default "/srv/git"))) | ||
| 194 | |||
| 195 | (define (cgit-configuration-robots-string robots) | ||
| 196 | (string-join robots ", ")) | ||
| 197 | |||
| 198 | (define-gexp-compiler (cgit-configuration-file-compiler | ||
| 199 | (file <cgit-configuration-file>) system target) | ||
| 200 | (match file | ||
| 201 | (($ <cgit-configuration-file> css logo | ||
| 202 | robots virtual-root repository-directory) | ||
| 203 | (apply text-file* "cgitrc" | ||
| 204 | (letrec-syntax ((option (syntax-rules () | ||
| 205 | ((_ key value) | ||
| 206 | (if value | ||
| 207 | `(,key "=" ,value "\n") | ||
| 208 | '())))) | ||
| 209 | (key/value (syntax-rules () | ||
| 210 | ((_ (key value) rest ...) | ||
| 211 | (append (option key value) | ||
| 212 | (key/value rest ...))) | ||
| 213 | ((_) | ||
| 214 | '())))) | ||
| 215 | (key/value ("css" css) | ||
| 216 | ("logo" logo) | ||
| 217 | ("robots" (cgit-configuration-robots-string robots)) | ||
| 218 | ("virtual-root" virtual-root) | ||
| 219 | ("scan-path" repository-directory))))))) | ||
| 220 | |||
| 221 | (define %cgit-configuration-nginx | ||
| 222 | (list | ||
| 223 | (nginx-server-configuration | ||
| 224 | (root cgit) | ||
| 225 | (locations | ||
| 226 | (list | ||
| 227 | (nginx-location-configuration | ||
| 228 | (uri "@cgit") | ||
| 229 | (body '("fastcgi_param SCRIPT_FILENAME $document_root/lib/cgit/cgit.cgi;" | ||
| 230 | "fastcgi_param PATH_INFO $uri;" | ||
| 231 | "fastcgi_param QUERY_STRING $args;" | ||
| 232 | "fastcgi_param HTTP_HOST $server_name;" | ||
| 233 | "fastcgi_pass 127.0.0.1:9000;"))))) | ||
| 234 | (try-files (list "$uri" "@cgit")) | ||
| 235 | (listen '("80")) | ||
| 236 | (ssl-certificate #f) | ||
| 237 | (ssl-certificate-key #f)))) | ||
| 238 | |||
| 239 | (define-record-type* <cgit-configuration> | ||
| 240 | cgit-configuration make-cgit-configuration | ||
| 241 | cgit-configuration? | ||
| 242 | (config-file cgit-configuration-config-file | ||
| 243 | (default (cgit-configuration-file))) | ||
| 244 | (package cgit-configuration-package | ||
| 245 | (default cgit)) | ||
| 246 | (nginx cgit-configuration-nginx | ||
| 247 | (default %cgit-configuration-nginx))) | ||
| 248 | |||
| 249 | (define (cgit-activation config) | ||
| 250 | ;; Cgit compiled with default configuration path | ||
| 251 | #~(begin | ||
| 252 | (use-modules (guix build utils)) | ||
| 253 | (mkdir-p "/var/cache/cgit") | ||
| 254 | (copy-file #$(cgit-configuration-config-file config) "/etc/cgitrc"))) | ||
| 255 | |||
| 256 | (define (cgit-configuration-nginx-config config) | ||
| 257 | (cgit-configuration-nginx config)) | ||
| 258 | |||
| 259 | (define cgit-service-type | ||
| 260 | (service-type | ||
| 261 | (name 'cgit) | ||
| 262 | (extensions | ||
| 263 | (list (service-extension activation-service-type | ||
| 264 | cgit-activation) | ||
| 265 | (service-extension nginx-service-type | ||
| 266 | cgit-configuration-nginx-config) | ||
| 267 | |||
| 268 | ;; Make sure fcgiwrap is instantiated. | ||
| 269 | (service-extension fcgiwrap-service-type | ||
| 270 | (const #t)))) | ||
| 271 | (default-value (cgit-configuration)) | ||
| 272 | (description | ||
| 273 | "Run the Cgit web interface, which allows users to browse Git | ||
| 274 | repositories."))) | ||
| 275 | |||
| 276 | |||
| 277 | ;;; | ||
| 278 | ;;; HTTP access. Add the result of calling | 157 | ;;; HTTP access. Add the result of calling |
| 279 | ;;; git-http-nginx-location-configuration to an nginx-server-configuration's | 158 | ;;; git-http-nginx-location-configuration to an nginx-server-configuration's |
| 280 | ;;; "locations" field. | 159 | ;;; "locations" field. |
