system-configuration/systems/ene.scm

ene.scm

1
;;; Tyreunom's system administration and configuration tools.
2
;;;
3
;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
4
;;;
5
;;; This program is free software: you can redistribute it and/or modify
6
;;; it under the terms of the GNU General Public License as published by
7
;;; the Free Software Foundation, either version 3 of the License, or
8
;;; (at your option) any later version.
9
;;;
10
;;; This program is distributed in the hope that it will be useful,
11
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
;;; GNU General Public License for more details.
14
;;;
15
;;; You should have received a copy of the GNU General Public License
16
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18
(use-modules (gnu))
19
(use-modules (gnu bootloader))
20
(use-modules (gnu packages bootloaders))
21
(use-modules (gnu services dns))
22
(use-modules (gnu services networking))
23
(use-modules (gnu services web))
24
(use-modules (gnu system))
25
26
(use-modules (config certbot) (config dns) (config mail) (config os))
27
28
29
(define u-boot-allwinner-bootloader (@@ (gnu bootloader u-boot) u-boot-allwinner-bootloader))
30
31
(define u-boot-cubietruck-bootloader
32
  (bootloader
33
    (inherit u-boot-allwinner-bootloader)
34
    (package u-boot-cubietruck)))
35
36
(operating-system
37
  (inherit (tyreunom-os "ene"))
38
  (bootloader
39
    (bootloader-configuration
40
      (target "/dev/mmcblk0")
41
      (bootloader u-boot-cubietruck-bootloader)))
42
  (initrd-modules (cons* "sunxi-mmc" "sd_mod" "ahci_sunxi" %base-initrd-modules))
43
  (file-systems (cons (file-system
44
                        (mount-point "/")
45
                        (device "/dev/sda1")
46
                        (type "ext4"))
47
                      %base-file-systems))
48
  (services
49
    (append
50
      (list
51
        (service dhcp-client-service-type)
52
        (agetty-service
53
          (agetty-configuration
54
            (extra-options '("-L"))
55
            (baud-rate "115200")
56
            (term "vt100")
57
            (tty "ttyS0")))
58
        (service nginx-service-type)
59
        (service knot-service-type
60
                 (knot-configuration
61
                   (includes '("/etc/knot/secrets.conf"))
62
                   (acls (list master-acl))
63
                   (remotes (list hermes))
64
                   (zones (list lepiller-master-zone
65
                                ipv4-reverse-master-zone
66
                                ipv6-reverse-master-zone))))
67
        (certbot-service `(("courriel.lepiller.eu" "imap.lepiller.eu")
68
                           ("ene.lepiller.eu" "rennes.lepiller.eu")
69
                           ("avatar.lepiller.eu")))
70
        (service php-fpm-service-type)
71
        (cat-avatar-generator-service
72
          #:configuration
73
          (nginx-server-configuration
74
            (server-name '("avatar.lepiller.eu"))
75
            (ssl-certificate "/etc/letsencrypt/live/avatar.lepiller.eu/fullchain.pem")
76
            (ssl-certificate-key "/etc/letsencrypt/live/avatar.lepiller.eu/privkey.pem")
77
            (listen '("443 ssl http2" "[::]:443 ssl http2"))))
78
        (simple-service 'default-http-server nginx-service-type
79
          (list (nginx-server-configuration
80
                  (ssl-certificate "/etc/letsencrypt/live/ene.lepiller.eu/fullchain.pem")
81
                  (ssl-certificate-key "/etc/letsencrypt/live/ene.lepiller.eu/privkey.pem")
82
                  (listen '("443 ssl http2" "[::]:443 ssl http2"))
83
                  (server-name '(default))(root "/srv/http/default")))))
84
      (lepiller-mail-services
85
        #:interface "eth0"
86
        #:domain "courriel.lepiller.eu")
87
      (server-services "ene"))))
88