diff options
| author | Mark H Weaver <mhw@netris.org> | 2018-09-29 21:18:45 -0400 |
|---|---|---|
| committer | Mark H Weaver <mhw@netris.org> | 2018-09-29 21:18:45 -0400 |
| commit | 17bea1803cf706d8db053d8d73302a4455684d29 (patch) | |
| tree | 073d30a8ff065d4e08cc4901f7e97e72a9de68a6 /gnu/services/version-control.scm | |
| parent | e72ca4111fce4b05bf2a685e451f26e06680e36c (diff) | |
Revert "services: Add Gitolite."
This reverts commit 258a6d944ed891fa92fa87a16731e5dfe0bac477.
Diffstat (limited to 'gnu/services/version-control.scm')
| -rw-r--r-- | gnu/services/version-control.scm | 179 |
1 files changed, 1 insertions, 178 deletions
diff --git a/gnu/services/version-control.scm b/gnu/services/version-control.scm index cc8cd220211..58274c8beed 100644 --- a/gnu/services/version-control.scm +++ b/gnu/services/version-control.scm | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | ;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org> | 3 | ;;; Copyright © 2016 Sou Bunnbu <iyzsong@member.fsf.org> |
| 4 | ;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com> | 4 | ;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com> |
| 5 | ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org> | 5 | ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org> |
| 6 | ;;; Copyright © 2018 Christopher Baines <mail@cbaines.net> | ||
| 7 | ;;; | 6 | ;;; |
| 8 | ;;; This file is part of GNU Guix. | 7 | ;;; This file is part of GNU Guix. |
| 9 | ;;; | 8 | ;;; |
| @@ -41,23 +40,7 @@ | |||
| 41 | 40 | ||
| 42 | git-http-configuration | 41 | git-http-configuration |
| 43 | git-http-configuration? | 42 | git-http-configuration? |
| 44 | git-http-nginx-location-configuration | 43 | git-http-nginx-location-configuration)) |
| 45 | |||
| 46 | <gitolite-configuration> | ||
| 47 | gitolite-configuration | ||
| 48 | gitolite-configuration-package | ||
| 49 | gitolite-configuration-user | ||
| 50 | gitolite-configuration-rc-file | ||
| 51 | gitolite-configuration-admin-pubkey | ||
| 52 | |||
| 53 | <gitolite-rc-file> | ||
| 54 | gitolite-rc-file | ||
| 55 | gitolite-rc-file-umask | ||
| 56 | gitolite-rc-file-git-config-keys | ||
| 57 | gitolite-rc-file-roles | ||
| 58 | gitolite-rc-file-enable | ||
| 59 | |||
| 60 | gitolite-service-type)) | ||
| 61 | 44 | ||
| 62 | ;;; Commentary: | 45 | ;;; Commentary: |
| 63 | ;;; | 46 | ;;; |
| @@ -214,163 +197,3 @@ access to exported repositories under @file{/srv/git}." | |||
| 214 | "") | 197 | "") |
| 215 | (list "fastcgi_param GIT_PROJECT_ROOT " git-root ";") | 198 | (list "fastcgi_param GIT_PROJECT_ROOT " git-root ";") |
| 216 | "fastcgi_param PATH_INFO $1;")))))) | 199 | "fastcgi_param PATH_INFO $1;")))))) |
| 217 | |||
| 218 | |||
| 219 | ;;; | ||
| 220 | ;;; Gitolite | ||
| 221 | ;;; | ||
| 222 | |||
| 223 | (define-record-type* <gitolite-rc-file> | ||
| 224 | gitolite-rc-file make-gitolite-rc-file | ||
| 225 | gitolite-rc-file? | ||
| 226 | (umask gitolite-rc-file-umask | ||
| 227 | (default #o0077)) | ||
| 228 | (git-config-keys gitolite-rc-file-git-config-keys | ||
| 229 | (default "")) | ||
| 230 | (roles gitolite-rc-file-roles | ||
| 231 | (default '(("READERS" . 1) | ||
| 232 | ("WRITERS" . 1)))) | ||
| 233 | (enable gitolite-rc-file-enable | ||
| 234 | (default '("help" | ||
| 235 | "desc" | ||
| 236 | "info" | ||
| 237 | "perms" | ||
| 238 | "writable" | ||
| 239 | "ssh-authkeys" | ||
| 240 | "git-config" | ||
| 241 | "daemon" | ||
| 242 | "gitweb")))) | ||
| 243 | |||
| 244 | (define-gexp-compiler (gitolite-rc-file-compiler | ||
| 245 | (file <gitolite-rc-file>) system target) | ||
| 246 | (match file | ||
| 247 | (($ <gitolite-rc-file> umask git-config-keys roles enable) | ||
| 248 | (apply text-file* "gitolite.rc" | ||
| 249 | `("%RC = (\n" | ||
| 250 | " UMASK => " ,(format #f "~4,'0o" umask) ",\n" | ||
| 251 | " GIT_CONFIG_KEYS => '" ,git-config-keys "',\n" | ||
| 252 | " ROLES => {\n" | ||
| 253 | ,@(map (match-lambda | ||
| 254 | ((role . value) | ||
| 255 | (simple-format #f " ~A => ~A,\n" role value))) | ||
| 256 | roles) | ||
| 257 | " },\n" | ||
| 258 | "\n" | ||
| 259 | " ENABLE => [\n" | ||
| 260 | ,@(map (lambda (value) | ||
| 261 | (simple-format #f " '~A',\n" value)) | ||
| 262 | enable) | ||
| 263 | " ],\n" | ||
| 264 | ");\n" | ||
| 265 | "\n" | ||
| 266 | "1;\n"))))) | ||
| 267 | |||
| 268 | (define-record-type* <gitolite-configuration> | ||
| 269 | gitolite-configuration make-gitolite-configuration | ||
| 270 | gitolite-configuration? | ||
| 271 | (package gitolite-configuration-package | ||
| 272 | (default gitolite)) | ||
| 273 | (user gitolite-configuration-user | ||
| 274 | (default "git")) | ||
| 275 | (group gitolite-configuration-group | ||
| 276 | (default "git")) | ||
| 277 | (home-directory gitolite-configuration-home-directory | ||
| 278 | (default "/var/lib/gitolite")) | ||
| 279 | (rc-file gitolite-configuration-rc-file | ||
| 280 | (default (gitolite-rc-file))) | ||
| 281 | (admin-pubkey gitolite-configuration-admin-pubkey)) | ||
| 282 | |||
| 283 | (define gitolite-accounts | ||
| 284 | (match-lambda | ||
| 285 | (($ <gitolite-configuration> package user group home-directory | ||
| 286 | rc-file admin-pubkey) | ||
| 287 | ;; User group and account to run Gitolite. | ||
| 288 | (list (user-group (name user) (system? #t)) | ||
| 289 | (user-account | ||
| 290 | (name user) | ||
| 291 | (group group) | ||
| 292 | (system? #t) | ||
| 293 | (comment "Gitolite user") | ||
| 294 | (home-directory home-directory)))))) | ||
| 295 | |||
| 296 | (define gitolite-activation | ||
| 297 | (match-lambda | ||
| 298 | (($ <gitolite-configuration> package user group home | ||
| 299 | rc-file admin-pubkey) | ||
| 300 | #~(begin | ||
| 301 | (use-modules (ice-9 match) | ||
| 302 | (guix build utils)) | ||
| 303 | |||
| 304 | (let* ((user-info (getpwnam #$user)) | ||
| 305 | (admin-pubkey #$admin-pubkey) | ||
| 306 | (pubkey-file (string-append | ||
| 307 | #$home "/" | ||
| 308 | (basename | ||
| 309 | (strip-store-file-name admin-pubkey))))) | ||
| 310 | |||
| 311 | (simple-format #t "guix: gitolite: installing ~A\n" #$rc-file) | ||
| 312 | (copy-file #$rc-file #$(string-append home "/.gitolite.rc")) | ||
| 313 | |||
| 314 | ;; The key must be writable, so copy it from the store | ||
| 315 | (copy-file admin-pubkey pubkey-file) | ||
| 316 | |||
| 317 | (chmod pubkey-file #o500) | ||
| 318 | (chown pubkey-file | ||
| 319 | (passwd:uid user-info) | ||
| 320 | (passwd:gid user-info)) | ||
| 321 | |||
| 322 | ;; Set the git configuration, to avoid gitolite trying to use | ||
| 323 | ;; the hostname command, as the network might not be up yet | ||
| 324 | (with-output-to-file #$(string-append home "/.gitconfig") | ||
| 325 | (lambda () | ||
| 326 | (display "[user] | ||
| 327 | name = GNU Guix | ||
| 328 | email = guix@localhost | ||
| 329 | "))) | ||
| 330 | ;; Run Gitolite setup, as this updates the hooks and include the | ||
| 331 | ;; admin pubkey if specified. The admin pubkey is required for | ||
| 332 | ;; initial setup, and will replace the previous key if run after | ||
| 333 | ;; initial setup | ||
| 334 | (match (primitive-fork) | ||
| 335 | (0 | ||
| 336 | ;; Exit with a non-zero status code if an exception is thrown. | ||
| 337 | (dynamic-wind | ||
| 338 | (const #t) | ||
| 339 | (lambda () | ||
| 340 | (setenv "HOME" (passwd:dir user-info)) | ||
| 341 | (setenv "USER" #$user) | ||
| 342 | (setgid (passwd:gid user-info)) | ||
| 343 | (setuid (passwd:uid user-info)) | ||
| 344 | (primitive-exit | ||
| 345 | (system* #$(file-append package "/bin/gitolite") | ||
| 346 | "setup" | ||
| 347 | "-m" "gitolite setup by GNU Guix" | ||
| 348 | "-pk" pubkey-file))) | ||
| 349 | (lambda () | ||
| 350 | (primitive-exit 1)))) | ||
| 351 | (pid (waitpid pid))) | ||
| 352 | |||
| 353 | (when (file-exists? pubkey-file) | ||
| 354 | (delete-file pubkey-file))))))) | ||
| 355 | |||
| 356 | (define gitolite-service-type | ||
| 357 | (service-type | ||
| 358 | (name 'gitolite) | ||
| 359 | (extensions | ||
| 360 | (list (service-extension activation-service-type | ||
| 361 | gitolite-activation) | ||
| 362 | (service-extension account-service-type | ||
| 363 | gitolite-accounts) | ||
| 364 | (service-extension profile-service-type | ||
| 365 | ;; The Gitolite package in Guix uses | ||
| 366 | ;; gitolite-shell in the authorized_keys file, so | ||
| 367 | ;; gitolite-shell needs to be on the PATH for | ||
| 368 | ;; gitolite to work. | ||
| 369 | (lambda (config) | ||
| 370 | (list | ||
| 371 | (gitolite-configuration-package config)))))) | ||
| 372 | (description | ||
| 373 | "Setup @command{gitolite}, a Git hosting tool providing access over SSH.. | ||
| 374 | By default, the @code{git} user is used, but this is configurable. | ||
| 375 | Additionally, Gitolite can integrate with with tools like gitweb or cgit to | ||
| 376 | provide a web interface to view selected repositories."))) | ||
