services: bitlbee: Run in a container.
* gnu/services/networking.scm (bitlbee-shepherd-service): Wrap in 'with-imported-modules' and add 'modules' field. Use 'make-forkexec-constructor/container' and pass #:mappings.
This commit is contained in:
		
							parent
							
								
									63302a4e55
								
							
						
					
					
						commit
						a062b6ca99
					
				
					 1 changed files with 24 additions and 8 deletions
				
			
		| 
						 | 
					@ -36,6 +36,7 @@
 | 
				
			||||||
  #:use-module (gnu packages gnome)
 | 
					  #:use-module (gnu packages gnome)
 | 
				
			||||||
  #:use-module (guix gexp)
 | 
					  #:use-module (guix gexp)
 | 
				
			||||||
  #:use-module (guix records)
 | 
					  #:use-module (guix records)
 | 
				
			||||||
 | 
					  #:use-module (guix modules)
 | 
				
			||||||
  #:use-module (srfi srfi-1)
 | 
					  #:use-module (srfi srfi-1)
 | 
				
			||||||
  #:use-module (srfi srfi-9)
 | 
					  #:use-module (srfi srfi-9)
 | 
				
			||||||
  #:use-module (srfi srfi-26)
 | 
					  #:use-module (srfi srfi-26)
 | 
				
			||||||
| 
						 | 
					@ -624,14 +625,29 @@ project's documentation} for more information."
 | 
				
			||||||
  DaemonPort = " (number->string port) "
 | 
					  DaemonPort = " (number->string port) "
 | 
				
			||||||
" extra-settings))))
 | 
					" extra-settings))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       (list (shepherd-service
 | 
					       (with-imported-modules (source-module-closure
 | 
				
			||||||
              (provision '(bitlbee))
 | 
					                               '((gnu build shepherd)
 | 
				
			||||||
              (requirement '(user-processes loopback))
 | 
					                                 (gnu system file-systems)))
 | 
				
			||||||
              (start #~(make-forkexec-constructor
 | 
					         (list (shepherd-service
 | 
				
			||||||
                        (list (string-append #$bitlbee "/sbin/bitlbee")
 | 
					                (provision '(bitlbee))
 | 
				
			||||||
                              "-n" "-F" "-u" "bitlbee" "-c" #$conf)
 | 
					
 | 
				
			||||||
                        #:pid-file "/var/run/bitlbee.pid"))
 | 
					                ;; Note: If networking is not up, then /etc/resolv.conf
 | 
				
			||||||
              (stop  #~(make-kill-destructor))))))))
 | 
					                ;; doesn't get mapped in the container, hence the dependency
 | 
				
			||||||
 | 
					                ;; on 'networking'.
 | 
				
			||||||
 | 
					                (requirement '(user-processes networking))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                (modules '((gnu build shepherd)
 | 
				
			||||||
 | 
					                           (gnu system file-systems)))
 | 
				
			||||||
 | 
					                (start #~(make-forkexec-constructor/container
 | 
				
			||||||
 | 
					                          (list #$(file-append bitlbee "/sbin/bitlbee")
 | 
				
			||||||
 | 
					                                "-n" "-F" "-u" "bitlbee" "-c" #$conf)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                          #:pid-file "/var/run/bitlbee.pid"
 | 
				
			||||||
 | 
					                          #:mappings (list (file-system-mapping
 | 
				
			||||||
 | 
					                                            (source "/var/lib/bitlbee")
 | 
				
			||||||
 | 
					                                            (target source)
 | 
				
			||||||
 | 
					                                            (writable? #t)))))
 | 
				
			||||||
 | 
					                (stop  #~(make-kill-destructor)))))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define %bitlbee-accounts
 | 
					(define %bitlbee-accounts
 | 
				
			||||||
  ;; User group and account to run BitlBee.
 | 
					  ;; User group and account to run BitlBee.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue