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