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 bootloader u-boot)) |
21 | (use-modules (gnu packages bootloaders)) |
22 | (use-modules (gnu services dns)) |
23 | (use-modules (gnu services mail)) |
24 | (use-modules (gnu services networking)) |
25 | (use-modules (gnu services web)) |
26 | (use-modules (gnu system)) |
27 | |
28 | (use-modules (gnu packages mail)) |
29 | (use-modules (gnu packages web)) |
30 | (use-modules (guix packages)) |
31 | (use-modules (guix utils)) |
32 | |
33 | (use-modules (config certbot) (config dns) (config iptables) |
34 | (config mail) (config os)) |
35 | |
36 | ;; Copy from (gnu bootloader u-boot) |
37 | (define install-allwinner-u-boot |
38 | #~(lambda (bootloader device mount-point) |
39 | (let ((u-boot (string-append bootloader |
40 | "/libexec/u-boot-sunxi-with-spl.bin"))) |
41 | (write-file-on-device u-boot (stat:size (stat u-boot)) |
42 | device (* 8 1024))))) |
43 | |
44 | (define u-boot-cubietruck-bootloader |
45 | (bootloader |
46 | (inherit u-boot-bootloader) |
47 | (package u-boot-cubietruck) |
48 | (installer install-allwinner-u-boot))) |
49 | |
50 | (operating-system |
51 | (inherit (tyreunom-os "ene")) |
52 | (bootloader |
53 | (bootloader-configuration |
54 | (target "/dev/mmcblk0") |
55 | (bootloader u-boot-cubietruck-bootloader))) |
56 | (initrd-modules (cons* "sunxi-mmc" "sd_mod" "ahci_sunxi" %base-initrd-modules)) |
57 | (file-systems (cons (file-system |
58 | (mount-point "/") |
59 | (device "/dev/sda1") |
60 | (type "ext4")) |
61 | %base-file-systems)) |
62 | (services |
63 | (append |
64 | (list |
65 | (service dhcp-client-service-type) |
66 | lepiller-iptables-service |
67 | (agetty-service |
68 | (agetty-configuration |
69 | (extra-options '("-L")) |
70 | (baud-rate "115200") |
71 | (term "vt100") |
72 | (tty "ttyS0"))) |
73 | (service nginx-service-type) |
74 | (service knot-service-type |
75 | (knot-configuration |
76 | (includes '("/etc/knot/secrets.conf")) |
77 | (acls (list master-acl)) |
78 | (remotes (list hermes)) |
79 | (zones (list lepiller-master-zone |
80 | ipv4-reverse-master-zone |
81 | ipv6-reverse-master-zone)))) |
82 | (certbot-service `(("courriel.lepiller.eu" "imap.lepiller.eu") |
83 | ("ene.lepiller.eu" "rennes.lepiller.eu") |
84 | ("avatar.lepiller.eu"))) |
85 | (service php-fpm-service-type) |
86 | (cat-avatar-generator-service |
87 | #:package |
88 | (package |
89 | (inherit cat-avatar-generator) |
90 | (arguments |
91 | (substitute-keyword-arguments (package-arguments cat-avatar-generator) |
92 | ((#:modules modules) |
93 | `((guix build utils)))))) |
94 | #:configuration |
95 | (nginx-server-configuration |
96 | (server-name '("avatar.lepiller.eu")) |
97 | (ssl-certificate "/etc/letsencrypt/live/avatar.lepiller.eu/fullchain.pem") |
98 | (ssl-certificate-key "/etc/letsencrypt/live/avatar.lepiller.eu/privkey.pem") |
99 | (listen '("443 ssl http2" "[::]:443 ssl http2")))) |
100 | (simple-service 'default-http-server nginx-service-type |
101 | (list (nginx-server-configuration |
102 | (ssl-certificate "/etc/letsencrypt/live/ene.lepiller.eu/fullchain.pem") |
103 | (ssl-certificate-key "/etc/letsencrypt/live/ene.lepiller.eu/privkey.pem") |
104 | (listen '("443 ssl http2" "[::]:443 ssl http2")) |
105 | (server-name '(default))(root "/srv/http/default"))))) |
106 | (modify-services |
107 | (lepiller-mail-services |
108 | #:interface "eth0" |
109 | #:domain "courriel.lepiller.eu") |
110 | (dovecot-service-type |
111 | config => |
112 | (dovecot-configuration |
113 | (inherit config) |
114 | (dovecot |
115 | (package |
116 | (inherit dovecot) |
117 | (arguments |
118 | (append |
119 | `(#:tests? #f) |
120 | (package-arguments dovecot)))))))) |
121 | (server-services "ene")))) |
122 |