channel

The Guix channel used by MonasTech systems
Log | Files | Refs | README

services.scm (4360B)


      1 (define-module (mt services)
      2   #:use-module (guix gexp)
      3   #:use-module (gnu packages libusb)
      4   #:use-module (gnu packages linux)
      5   #:use-module (gnu packages nfs)
      6   #:use-module (gnu services)
      7   #:use-module (gnu services avahi)
      8   #:use-module (gnu services base)
      9   #:use-module (gnu services dbus)
     10   #:use-module (gnu services desktop)
     11   #:use-module (gnu services networking)
     12   #:use-module (gnu services sound)
     13   #:use-module (gnu services ssh)
     14   #:use-module (gnu system)
     15   #:use-module (gnu system privilege)
     16   #:use-module (mt channels)
     17   #:export (%mt-bishop-services
     18             %mt-clergy-services
     19             %mt-laity-services
     20             %mt-desktop-services))
     21 
     22 ;; Provide substitutes for all machines and perform build farm capabilities
     23 ;; TODO: Add anti-spam measures
     24 ;; TODO: Add build farm capabilities
     25 (define %mt-bishop-services
     26   (append
     27     (list
     28       ;; Ethernet-only internet
     29       (service dhcpcd-service-type)
     30       ;; Required by guix-publish
     31       (service avahi-service-type)
     32       ;; Host a substitute server on locahost.
     33       ;; Each server should ideally serve this from a subdomain
     34       (service guix-publish-service-type
     35                (guix-publish-configuration
     36                  (port 8080)))
     37       ;; Allow SSH access but do not take passwords
     38       (service openssh-service-type
     39                (openssh-configuration
     40                  (password-authentication? #f))))
     41     (modify-services %base-services
     42       (guix-service-type
     43         config => (guix-configuration
     44                     (inherit config)
     45                     (channels %mt-channels)
     46                     (substitute-urls %mt-substitute-urls)
     47                     (authorized-keys %mt-authorized-guix-keys))))))
     48 
     49 ;; Provide substitutes for laity on the same network
     50 (define %mt-clergy-services
     51   (append
     52     (list 
     53       ;; Host a local substitute server
     54       (service guix-publish-service-type
     55                (guix-publish-configuration
     56                  (host "0.0.0.0") ;; Open to any connections
     57                  (advertise? #t))) ;; Allow automatic detection by other systems
     58       (service openssh-service-type
     59                (openssh-configuration
     60                  (password-authentication? #f))))
     61     (modify-services %base-services
     62       (guix-service-type
     63         config => (guix-configuration
     64                     (inherit config)
     65                     (channels %mt-channels)
     66                     (substitute-urls %mt-substitute-urls)
     67                     (authorized-keys %mt-authorized-guix-keys))))))
     68 
     69 ;; Discover clergy on the local network and use them as a substitute
     70 ;; TODO: Work out how to properly authorize local clergy systems
     71 (define %mt-laity-services
     72     (modify-services %base-services
     73       (guix-service-type
     74         config => (guix-configuration
     75                     (inherit config)
     76                     (channels %mt-channels)
     77                     (substitute-urls %mt-substitute-urls)
     78                     ;; Attempt to substitute from clergy on the local network
     79                     (discover? #t)
     80                     (authorized-keys %mt-authorized-guix-keys)))))
     81 
     82 ;; These are basic services that will generally be used by all user systems. It
     83 ;; should contain everything necessary to begin building a basic desktop setup.
     84 ;; Essentially, these are all the "standard" services that you wouldn't need on
     85 ;; a server.
     86 ;; TODO: Add printer-related services
     87 (define %mt-desktop-services
     88    (list
     89      ;; Essential
     90      (service dbus-root-service-type)
     91      (service elogind-service-type)
     92      (service polkit-service-type)
     93      polkit-wheel-service
     94      (service avahi-service-type) ;; Used by guix-daemon
     95      (service ntp-service-type)
     96     
     97      ;; Complimentary
     98      fontconfig-file-system-service
     99      (service udisks-service-type)
    100      (service upower-service-type) ;; TODO: Make optional
    101 
    102      ;; Networking
    103      (service network-manager-service-type)
    104      (service wpa-supplicant-service-type)
    105      (service usb-modeswitch-service-type)
    106 
    107      ;; Audio
    108      (service pulseaudio-service-type)
    109      (service alsa-service-type)))
    110 
    111 ;; TODO: Create automatic update services
    112 ;; This would be for laity and clergy machines. It would basically check for
    113 ;; configuration / channel updates daily and notify users that updates are
    114 ;; available. They will not be forced to update. It would also prompt monthly to
    115 ;; perform a guix update.